Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/.classpath_gtk18
-rw-r--r--bundles/org.eclipse.swt/.classpath_gtk_j2me18
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_motif18
-rw-r--r--bundles/org.eclipse.swt/.classpath_motif_j2me18
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_photon18
-rw-r--r--bundles/org.eclipse.swt/.classpath_photon_j2me18
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_win3219
-rw-r--r--bundles/org.eclipse.swt/.classpath_win32_j2me19
-rwxr-xr-xbundles/org.eclipse.swt/.cvsignore2
-rwxr-xr-xbundles/org.eclipse.swt/.vcm_meta12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java86
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/package.html15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/AnimatedProgress.java168
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentEvent.java67
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentListener.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java71
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java1057
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java448
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java1571
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderAdapter.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderEvent.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderListener.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java429
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ControlEditor.java237
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java879
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultLineStyler.java624
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyEvent.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyListener.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundEvent.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundListener.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleEvent.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleListener.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/PopupList.java248
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java397
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java378
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StackLayout.java74
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java147
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java1014
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextContent.java187
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextEvent.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java71
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrinter.java373
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableEditor.java179
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTree.java761
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeEditor.java226
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeItem.java568
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangeListener.java43
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangedEvent.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangingEvent.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeEditor.java161
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/VerifyKeyListener.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewForm.java491
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java653
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/package.html14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java131
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java78
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java69
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java97
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java171
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java73
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java142
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java133
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java69
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java92
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java73
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java142
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java133
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java69
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java92
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java206
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java482
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java602
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java100
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java77
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java101
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java76
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java62
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java214
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java167
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java215
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java223
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java65
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java75
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java63
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java75
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java102
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java132
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java353
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java482
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java609
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java142
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java156
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java79
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java116
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java114
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java92
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java53
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java214
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java1024
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java421
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java586
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java1346
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java513
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java268
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java63
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java127
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java690
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java179
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java523
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java63
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java115
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html65
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html239
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt506
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak134
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c235
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c2693
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h593
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c7865
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java225
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java112
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java663
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html65
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html239
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt506
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak134
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c235
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c2693
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h593
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c7865
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java225
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java112
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java663
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.csh60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/cde.c263
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c158
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/kde.cc587
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_aix.mak59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak84
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_solaris.mak70
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.c1396
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.h463
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/swt.c8854
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/CDE.java48
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/KDE.java58
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java1394
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/Visual.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XAnyEvent.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XButtonEvent.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCharStruct.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XColor.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XEvent.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XExposeEvent.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFontStruct.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XGCValues.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XImage.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XInputEvent.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XKeyEvent.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XMotionEvent.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XRectangle.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowChanges.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowEvent.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/build.sh8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/make_photon.mak30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.c1380
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.h365
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/swt.c6737
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontDetails.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java2971
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgMap_t.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhArea_t.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhClipHeader.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhDim_t.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhEvent_t.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhImage_t.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPoint_t.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRect_t.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRegion_t.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhTile_t.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build-ce.bat28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_wince.mak41
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.c4006
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h1160
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c6826
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.rc63
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c3256
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java541
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnum.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IFont.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java54
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersist.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStorage.java143
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStream.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java154
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java49
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/package.html20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ACCEL.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BITMAP.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DIBSECTION.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DOCINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DROPFILES.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/FILETIME.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GCP_RESULTS.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GRADIENT_RECT.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HDITEM.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HELPINFO.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ICONINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGFONT.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGPEN.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LRESULT.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVITEM.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUINFO.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MSG.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHDR.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHEADER.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NONCLIENTMETRICS.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java2281
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFO.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/POINT.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PRINTDLG.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/RECT.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFO.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHMENUBARINFO.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SIZE.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTON.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCHAR.java109
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCITEM.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TOOLINFO.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRIVERTEX.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVITEM.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WNDCLASS.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/package.html22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java163
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/package.html13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java194
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java308
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java194
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java308
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/PrintDialog.java194
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java550
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java194
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java308
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java263
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java502
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/common/org/eclipse/swt/program/package.html14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java145
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java145
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java1065
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/photon/org/eclipse/swt/program/Program.java195
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java319
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c340
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h55
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java1924
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTError.java113
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTException.java106
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java29
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmListener.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java40
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlEvent.java31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeListener.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusAdapter.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusListener.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpListener.java34
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyAdapter.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyEvent.java48
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyListener.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuAdapter.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuListener.java40
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyListener.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseAdapter.java52
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseEvent.java68
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseListener.java51
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseMoveListener.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackAdapter.java53
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackListener.java53
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintEvent.java76
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintListener.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionAdapter.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionEvent.java83
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionListener.java50
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellAdapter.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellListener.java61
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseEvent.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseListener.java40
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeAdapter.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeEvent.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeListener.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyEvent.java51
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyListener.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/package.html22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Drawable.java45
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java3540
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java292
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java78
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderListener.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/PaletteData.java205
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java93
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/RGB.java108
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java269
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/package.html17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java189
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/FileFormat.java105
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java521
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGAppn.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGComment.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGEndOfImage.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFileFormat.java1892
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java38
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFrameHeader.java208
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGHuffmanTable.java262
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java159
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGRestartInterval.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGScanHeader.java117
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGSegment.java54
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGStartOfImage.java29
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java179
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java51
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWCodec.java476
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWNode.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PNGFileFormat.java536
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java334
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunkReader.java64
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngDecodingDataStream.java131
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngFileReadState.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java122
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTables.java156
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIdatChunk.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIendChunk.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java373
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngLzBlockReader.java169
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java88
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngTrnsChunk.java133
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinBMPFileFormat.java664
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java282
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/package.html18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/package.html20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java157
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java645
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java28
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java235
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/package.html13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/package.html15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java252
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java84
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java116
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Item.java114
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Layout.java76
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Listener.java45
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/RunnableLock.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Synchronizer.java153
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java222
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/package.html15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/version.txt1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatibility.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java379
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventListener.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventObject.java50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SerializableCompatibility.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java296
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java84
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java933
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolItem.java290
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java1105
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabItem.java414
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/AbstractTreeItem.java312
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Header.java333
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItem.java316
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItemWidget.java2053
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Table.java2654
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableColumn.java527
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableItem.java1093
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java1638
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeItem.java1280
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeRoots.java157
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java257
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java302
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java116
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java556
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java221
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java547
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java122
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java1759
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java650
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java492
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java273
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java85
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java493
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java264
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java508
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java167
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java1077
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java504
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java2229
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java447
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java149
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java1516
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java188
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java166
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java253
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/GtkFileDialog.java150
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java365
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java1138
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java563
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java631
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java253
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java215
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java333
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java389
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java639
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java239
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java851
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java539
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java554
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java218
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java1411
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java403
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java503
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java1226
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java351
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java744
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java388
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java968
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java496
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java141
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java921
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java89
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java257
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java302
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java116
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java556
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java221
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java547
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java122
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java1759
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java650
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java492
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java273
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java85
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java493
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java264
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java508
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java167
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java1077
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java504
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java2229
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java447
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java149
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java1516
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java188
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java166
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java253
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/GtkFileDialog.java150
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java365
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java1138
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java563
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java631
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java253
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java215
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java333
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java389
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java639
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java239
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java851
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java539
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java554
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java218
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java1411
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java403
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java503
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java1226
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java351
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java744
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java388
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java968
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java496
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java141
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java921
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java89
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Color.java332
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Cursor.java268
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java691
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/DeviceData.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Font.java400
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java521
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontMetrics.java116
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java2500
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java34
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java1288
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Region.java259
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/Converter.java381
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java703
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java264
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java490
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ColorDialog.java528
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Combo.java1282
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java652
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java2681
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Decorations.java596
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/DirectoryDialog.java317
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java2032
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FileDialog.java424
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontDialog.java934
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyle.java90
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyles.java133
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java280
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java453
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/List.java1527
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Menu.java720
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java815
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java416
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java310
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java279
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java338
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ScrollBar.java698
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java309
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java1166
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Slider.java512
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java1517
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java428
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolDrawable.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java1045
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java577
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java921
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/WidgetTable.java121
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Color.java236
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Cursor.java298
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java467
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/DeviceData.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Font.java217
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java395
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontMetrics.java148
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java2486
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GCData.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java980
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Region.java321
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/Converter.java85
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java616
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java261
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java491
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ColorDialog.java140
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java1065
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java687
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java2329
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Decorations.java499
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/DirectoryDialog.java161
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java1608
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FileDialog.java265
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java145
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java193
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java435
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java1229
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java656
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java789
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java195
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java224
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java311
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java351
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java690
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java223
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java919
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java506
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java554
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java258
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java1376
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java315
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java799
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java376
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java881
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/WidgetTable.java100
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java324
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java370
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java702
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java219
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java680
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java170
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java2290
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java1888
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java300
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java458
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java184
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java635
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java214
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java556
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java186
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java1271
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java769
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java3833
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java644
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java381
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java1320
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java238
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java1848
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java397
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java189
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java327
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java242
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java531
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java1515
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java799
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java803
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java237
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java270
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java380
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java396
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java977
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java376
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java1153
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java796
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java775
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java259
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java2371
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java472
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java594
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java1763
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java783
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java752
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java684
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java1704
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java568
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java986
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/WidgetTable.java113
-rw-r--r--bundles/org.eclipse.swt/about.html48
-rw-r--r--bundles/org.eclipse.swt/build.properties1
-rw-r--r--bundles/org.eclipse.swt/build.xml191
-rw-r--r--bundles/org.eclipse.swt/build_j2me.xml191
-rwxr-xr-xbundles/org.eclipse.swt/buildnotes_swt.html584
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/about.html59
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/cpl-v05.html239
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/lgpl-v21.txt506
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-gnome-motif-2024.sobin4782 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-gtk-2024.sobin202203 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-kde-motif-2024.sobin26213 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-motif-2024.sobin366418 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-pi-gtk-2024.sobin224177 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/linux/x86/libswt-pixbuf-gtk-2024.sobin7121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/qnx/x86/libswt-photon-2024.sobin391569 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/solaris/sparc/libswt-cde-motif-2024.sobin8344 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/solaris/sparc/libswt-motif-2024.sobin458600 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/win32-ce/arm/swt-win32-2024.dllbin310272 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/os/win32/x86/swt-win32-2024.dllbin262144 -> 0 bytes
-rw-r--r--bundles/org.eclipse.swt/plugin.properties1
-rwxr-xr-xbundles/org.eclipse.swt/plugin.xml18
-rwxr-xr-xbundles/org.eclipse.swt/readme_swt.html108
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.classpath12
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.vcm_meta14
-rw-r--r--examples/org.eclipse.swt.examples.controls/about.html30
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/build.properties7
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html33
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/icons/controls_example.gifbin111 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java28
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java49
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/plugin.properties15
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/plugin.xml55
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java28
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java49
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.classpath21
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.vcm_meta13
-rw-r--r--examples/org.eclipse.swt.examples.launcher/about.html30
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/build.properties9
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html59
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html65
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/closedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/launcher_example.gifbin168 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/openFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java183
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java290
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java85
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java9
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java413
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java234
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java79
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java23
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/plugin.properties96
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/plugin.xml77
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd217
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java85
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java413
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java234
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.classpath11
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.vcm_meta13
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/about.html30
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/build.properties7
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html40
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gifbin881 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gifbin883 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gifbin928 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gifbin174 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gifbin380 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java354
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java170
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java251
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.properties52
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.xml56
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java354
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java170
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java251
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.classpath11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.vcm_meta13
-rw-r--r--examples/org.eclipse.swt.examples.paint/about.html30
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/build.properties7
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_none.gifbin865 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_outline.gifbin872 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_solid.gifbin861 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gifbin880 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gifbin880 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gifbin879 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gifbin871 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/options_font.gifbin868 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/paint_example.gifbin932 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gifbin890 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gifbin872 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_line.gifbin860 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_pencil.gifbin874 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_polyline.gifbin879 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gifbin865 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gifbin871 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_text.gifbin875 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java72
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java10
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java87
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java226
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java129
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java32
-rw-r--r--examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java78
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java29
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java13
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java494
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java52
-rw-r--r--examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java69
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java45
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java65
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java47
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java58
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java153
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java53
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java122
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java27
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/plugin.properties123
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/plugin.xml56
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java72
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java10
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java87
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java226
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java129
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java32
-rw-r--r--examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java78
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java29
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java13
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java494
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java52
-rw-r--r--examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java69
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java45
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java65
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java47
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java58
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java153
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java53
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java122
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java27
-rwxr-xr-xexamples/org.eclipse.swt.examples/.classpath7
-rwxr-xr-xexamples/org.eclipse.swt.examples/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples/.vcm_meta12
-rw-r--r--examples/org.eclipse.swt.examples/about.html30
-rwxr-xr-xexamples/org.eclipse.swt.examples/build.properties15
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html33
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_control_ex.html34
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html52
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html38
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html56
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html98
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_addressbook.properties59
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_control.properties181
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_fileviewer.properties59
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_helloworld.properties1
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_hoverhelp.properties16
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_images.properties101
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_javaviewer.properties7
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_texteditor.properties6
-rwxr-xr-xexamples/org.eclipse.swt.examples/import.properties16
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java909
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java157
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java197
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java83
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java188
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java114
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java177
-rw-r--r--examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/CoolBarTab.java269
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java431
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java165
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java114
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java168
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java165
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java224
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java233
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java370
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java179
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java107
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java246
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java120
-rw-r--r--examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/closedFolder.gifbin906 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/openFolder.gifbin184 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/target.gifbin917 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java1728
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java147
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gifbin167 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gifbin143 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gifbin132 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gifbin227 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gifbin182 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gifbin163 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gifbin153 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gifbin217 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gifbin231 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java26
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java33
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java40
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java35
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java336
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gifbin92 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java2019
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java373
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java180
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java355
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.properties101
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.xml174
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java909
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java157
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java197
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java83
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java188
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java114
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java177
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java269
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java431
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java165
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java114
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java168
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java165
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java224
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java233
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java370
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java179
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java107
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java246
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java120
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gifbin906 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gifbin184 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gifbin917 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java1728
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java147
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gifbin167 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gifbin143 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gifbin132 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gifbin227 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gifbin182 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gifbin163 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gifbin153 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gifbin217 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gifbin231 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java26
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java33
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java40
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java35
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java336
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gifbin92 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java2019
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java373
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java180
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java355
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmpbin134 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/.classpath9
-rw-r--r--tests/org.eclipse.swt.tests/.cvsignore1
-rw-r--r--tests/org.eclipse.swt.tests/.vcm_meta7
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java178
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java63
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java33
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java1021
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java26
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java103
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java154
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java102
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java102
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java82
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java52
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java184
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java292
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java136
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java220
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java52
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java143
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java315
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java69
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java68
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java102
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java112
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java130
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java173
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java3652
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java167
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java100
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java214
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java100
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java202
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java558
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java88
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java78
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java148
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java84
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java66
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java100
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java106
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java90
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java82
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java82
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java82
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java84
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java66
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java58
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java280
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java220
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java156
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java56
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java48
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java302
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java245
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java119
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java378
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java175
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java168
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java102
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java78
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java98
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java159
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java320
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java528
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java60
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java66
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java143
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java166
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java108
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java270
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java111
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java208
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java116
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java679
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java161
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java823
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java128
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java334
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java246
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java108
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java135
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java363
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java72
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java153
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java106
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java113
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java117
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java205
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java54
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java2143
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java42
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java364
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java279
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java133
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java627
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java106
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java669
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java890
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java70
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java424
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java841
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java66
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java404
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java185
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java1635
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java268
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java505
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java976
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java206
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java223
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java122
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java507
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java266
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java66
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java191
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmpbin1062 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gifbin70 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmpbin1438 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmpbin1438 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmpbin1062 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmpbin1062 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmpbin1654 -> 0 bytes
-rw-r--r--tests/org.eclipse.swt.tests/about.html30
-rw-r--r--tests/org.eclipse.swt.tests/build.properties3
-rw-r--r--tests/org.eclipse.swt.tests/plugin.xml18
-rw-r--r--tests/org.eclipse.swt.tests/test.xml49
1387 files changed, 0 insertions, 360638 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk
deleted file mode 100644
index b70d21aca7..0000000000
--- a/bundles/org.eclipse.swt/.classpath_gtk
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_gtk_j2me b/bundles/org.eclipse.swt/.classpath_gtk_j2me
deleted file mode 100644
index 48fef2d099..0000000000
--- a/bundles/org.eclipse.swt/.classpath_gtk_j2me
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2me"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/gtk"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif
deleted file mode 100755
index 70d3634e41..0000000000
--- a/bundles/org.eclipse.swt/.classpath_motif
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/motif"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/motif"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_motif_j2me b/bundles/org.eclipse.swt/.classpath_motif_j2me
deleted file mode 100644
index abf6b8b5cc..0000000000
--- a/bundles/org.eclipse.swt/.classpath_motif_j2me
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/motif"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2me"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/motif"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/motif"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
- <classpathentry kind="output" path="bin"/>
-</classpath> \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/.classpath_photon b/bundles/org.eclipse.swt/.classpath_photon
deleted file mode 100755
index 5afc80d379..0000000000
--- a/bundles/org.eclipse.swt/.classpath_photon
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/photon"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/photon"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_photon_j2me b/bundles/org.eclipse.swt/.classpath_photon_j2me
deleted file mode 100644
index 8a436c634f..0000000000
--- a/bundles/org.eclipse.swt/.classpath_photon_j2me
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/photon"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2me"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/photon"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_win32 b/bundles/org.eclipse.swt/.classpath_win32
deleted file mode 100755
index 35ad7414ea..0000000000
--- a/bundles/org.eclipse.swt/.classpath_win32
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/win32"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT AWT/win32"/>
- <classpathentry kind="src" path="Eclipse SWT OLE Win32/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/win32"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_win32_j2me b/bundles/org.eclipse.swt/.classpath_win32_j2me
deleted file mode 100644
index 2b2dd638a6..0000000000
--- a/bundles/org.eclipse.swt/.classpath_win32_j2me
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="Eclipse SWT/win32"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2me"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT AWT/win32"/>
- <classpathentry kind="src" path="Eclipse SWT OLE Win32/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/win32"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT PI/win32"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.swt/.cvsignore b/bundles/org.eclipse.swt/.cvsignore
deleted file mode 100755
index 3f041525eb..0000000000
--- a/bundles/org.eclipse.swt/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-.classpath
diff --git a/bundles/org.eclipse.swt/.vcm_meta b/bundles/org.eclipse.swt/.vcm_meta
deleted file mode 100755
index 67f905f685..0000000000
--- a/bundles/org.eclipse.swt/.vcm_meta
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java
deleted file mode 100755
index d6f26064d6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.swt.internal.awt.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Win32, SUN AWT */
-import sun.awt.DrawingSurface;
-import sun.awt.windows.WDrawingSurfaceInfo;
-import sun.awt.windows.WEmbeddedFrame;
-
-/* SWT Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.graphics.Rectangle;
-
-/* AWT Imports */
-import java.awt.Canvas;
-import java.awt.Panel;
-import java.awt.Dimension;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowEvent;
-import java.awt.event.FocusEvent;
-
-public class SWT_AWT {
-
-public static Panel new_Panel (final Composite parent) {
- int handle = parent.handle;
- final WEmbeddedFrame frame = new WEmbeddedFrame (handle);
- Panel panel = new Panel ();
- frame.add (panel);
- parent.addListener (SWT.Activate, new Listener () {
- public void handleEvent (Event e) {
- frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
- frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_GAINED));
- }
- });
- parent.addListener (SWT.Deactivate, new Listener () {
- public void handleEvent (Event e) {
- frame.dispatchEvent (new WindowEvent(frame, WindowEvent.WINDOW_DEACTIVATED));
- frame.dispatchEvent (new FocusEvent(frame, FocusEvent.FOCUS_LOST));
- }
- });
- parent.addListener (SWT.Resize, new Listener () {
- public void handleEvent (Event e) {
- Rectangle rect = parent.getClientArea ();
- frame.setSize (rect.width, rect.height);
- frame.validate ();
- }
- });
- parent.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event e) {
- frame.dispose ();
- }
- });
- return panel;
-}
-
-public static Shell new_Shell (Display display, final Canvas parent) {
- DrawingSurface ds = (DrawingSurface)parent.getPeer();
- WDrawingSurfaceInfo wds = (WDrawingSurfaceInfo)ds.getDrawingSurfaceInfo();
- wds.lock ();
- int handle = wds.getHWnd ();
- wds.unlock ();
- final Shell shell = Shell.win32_new (display, handle);
- final Display newDisplay = shell.getDisplay ();
- parent.addComponentListener(new ComponentAdapter () {
- public void componentResized (ComponentEvent e) {
- newDisplay.syncExec (new Runnable () {
- public void run () {
- Dimension dim = parent.getSize ();
- shell.setSize (dim.width, dim.height);
- }
- });
- }
- });
- shell.setVisible (true);
- return shell;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/package.html
deleted file mode 100755
index 14ccb40f0e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT experimental AWT embedding support
-<h2>
-Package Specification</h2>
-This package contains an experimental <code>SWT_AWT</code> class which provides support for
-embedding AWT widgets within SWT layouts. Currently, this support only works on win32 platforms,
-and has several lightweight widget focus issues.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/AnimatedProgress.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/AnimatedProgress.java
deleted file mode 100755
index efdb04a943..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/AnimatedProgress.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-
-/**
- * A control for showing progress feedback for a long running operation.
- */
-public class AnimatedProgress extends Canvas {
-
- private static final int SLEEP = 70;
- private static final int DEFAULT_WIDTH = 160;
- private static final int DEFAULT_HEIGHT = 18;
- private boolean active = false;
- private boolean showStripes = false;
- private int value;
- private int orientation = SWT.HORIZONTAL;
- private boolean showBorder = false;
-
-public AnimatedProgress(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- if ((style & SWT.VERTICAL) != 0) {
- orientation = SWT.VERTICAL;
- }
- showBorder = (style & SWT.BORDER) != 0;
-
- addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- redraw();
- }
- });
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e);
- }
- });
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e){
- stop();
- }
- });
-}
-private static int checkStyle (int style) {
- int mask = SWT.NONE;
- return style & mask;
-}
-/**
- * Stop the animation if it is not already stopped and
- * reset the presentation to a blank appearance.
- */
-public synchronized void clear(){
- if (active)
- stop();
- showStripes = false;
- redraw();
-}
-public Point computeSize(int wHint, int hHint, boolean changed) {
- Point size = null;
- if (orientation == SWT.HORIZONTAL) {
- size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
- } else {
- size = new Point(DEFAULT_HEIGHT, DEFAULT_WIDTH);
- }
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
-
- return size;
-}
-private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
-
- gc.setForeground(topleft);
- gc.drawLine(x, y, x+w-1, y);
- gc.drawLine(x, y, x, y+h-1);
-
- gc.setForeground(bottomright);
- gc.drawLine(x+w, y, x+w, y+h);
- gc.drawLine(x, y+h, x+w, y+h);
-}
-private void paint(PaintEvent event) {
- GC gc = event.gc;
- Display disp= getDisplay();
-
- Rectangle rect= getClientArea();
- gc.fillRectangle(rect);
- if (showBorder) {
- drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1,
- disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW),
- disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- }
-
- paintStripes(gc);
-}
-private void paintStripes(GC gc) {
-
- if (!showStripes) return;
-
- Rectangle rect= getClientArea();
- // Subtracted border painted by paint.
- rect = new Rectangle(rect.x+2, rect.y+2, rect.width-4, rect.height-4);
-
- gc.setLineWidth(2);
- gc.setClipping(rect);
- Color color = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
- gc.setBackground(color);
- gc.fillRectangle(rect);
- gc.setForeground(this.getBackground());
- int step = 12;
- int foregroundValue = value == 0 ? step - 2 : value - 2;
- if (orientation == SWT.HORIZONTAL) {
- int y = rect.y - 1;
- int w = rect.width;
- int h = rect.height + 2;
- for (int i= 0; i < w; i+= step) {
- int x = i + foregroundValue;
- gc.drawLine(x, y, x, h);
- }
- } else {
- int x = rect.x - 1;
- int w = rect.width + 2;
- int h = rect.height;
-
- for (int i= 0; i < h; i+= step) {
- int y = i + foregroundValue;
- gc.drawLine(x, y, w, y);
- }
- }
-
- if (active) {
- value = (value + 2) % step;
- }
-}
-/**
-* Start the animation.
-*/
-public synchronized void start() {
-
- if (active) return;
-
- active = true;
- showStripes = true;
-
- final Display display = getDisplay();
- final Runnable [] timer = new Runnable [1];
- timer [0] = new Runnable () {
- public void run () {
- if (!active) return;
- GC gc = new GC(AnimatedProgress.this);
- paintStripes(gc);
- gc.dispose();
- display.timerExec (SLEEP, timer [0]);
- }
- };
- display.timerExec (SLEEP, timer [0]);
-}
-/**
-* Stop the animation. Freeze the presentation at its current appearance.
-*/
-public synchronized void stop() {
- active = false;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentEvent.java
deleted file mode 100644
index 9c9394c8bb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentEvent.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * This event is sent to BidiSegmentListeners when a line is to
- * be measured or rendered in a bidi locale. The segments field is
- * used to specify text ranges in the line that should be treated as
- * separate segments for bidi reordering. Each segment will be reordered
- * and rendered separately.
- * <p>
- * The elements in the segments field specify the start offset of
- * a segment relative to the start of the line. They must follow
- * the following rules:
- * <ul>
- * <li>first element must be 0
- * <li>elements must be in ascending order and must not have duplicates
- * <li>elements must not exceed the line length
- * </ul>
- * In addition, the last element may be set to the end of the line
- * but this is not required.
- *
- * The segments field may be left null if the entire line should
- * be reordered as is.
- * </p>
- * A BidiSegmentListener may be used when adjacent segments of
- * right-to-left text should not be reordered relative to each other.
- * For example, within a Java editor, you may wish multiple
- * right-to-left string literals to be reordered differently than the
- * bidi algorithm specifies.
- *
- * Example:
- * <pre>
- * stored line = "R1R2R3" + "R4R5R6"
- * R1 to R6 are right-to-left characters. The quotation marks
- * are part of the line text. The line is 13 characters long.
- *
- * segments = null:
- * entire line will be reordered and thus the two R2L segments
- * swapped (as per the bidi algorithm).
- * visual line (rendered on screen) = "R6R5R4" + "R3R2R1"
- *
- * segments = [0, 5, 8]
- * "R1R2R3" will be reordered, followed by [blank]+[blank] and
- * "R4R5R6".
- * visual line = "R3R2R1" + "R6R5R4"
- * </pre>
- */
-public class BidiSegmentEvent extends TypedEvent {
- /** line start offset */
- public int lineOffset;
- /** line text */
- public String lineText;
- /** bidi segments, see above */
- public int[] segments;
-
-BidiSegmentEvent(StyledTextEvent e) {
- super(e);
- lineOffset = e.detail;
- lineText = e.text;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentListener.java
deleted file mode 100644
index 806a7ecbba..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BidiSegmentListener.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * This listener interface may be implemented in order to receive
- * BidiSegmentEvents.
- * @see BidiSegmentEvent
- */
-public interface BidiSegmentListener extends SWTEventListener {
-
-/**
- * This method is called when a line needs to be reordered for
- * measuring or rendering in a bidi locale.
- * <p>
- *
- * @param event.lineOffset line start offset (input)
- * @param event.lineText line text (input)
- * @param event.segments text segments that should be reordered
- * separately. (output)
- * @see BidiSegmentEvent
- */
-public void lineGetSegments(BidiSegmentEvent event);
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java
deleted file mode 100755
index fc640a5a31..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Support for showing a Busy Cursor during a long running process.
- */
-public class BusyIndicator {
-
- static int nextBusyId = 1;
- static final String BUSYID_NAME = "SWT BusyIndicator";
-
-/**
- * Runs the given <code>Runnable</code> while providing
- * busy feedback using this busy indicator.
- *
- * @param the display on which the busy feedback should be
- * displayed. If the display is null, the Display for the current
- * thread will be used. If there is no Display for the current thread,
- * the runnable code will be executed and no busy feedback will be displayed.
- * @param the runnable for which busy feedback is to be shown
- * @see #showWhile
- */
-
-public static void showWhile(Display display, Runnable runnable) {
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- runnable.run();
- return;
- }
- }
-
- Integer busyId = new Integer(nextBusyId);
- nextBusyId++;
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
-
- Shell[] shells = display.getShells();
- for (int i = 0; i < shells.length; i++) {
- Integer id = (Integer)shells[i].getData(BUSYID_NAME);
- if (id == null) {
- shells[i].setCursor(cursor);
- shells[i].setData(BUSYID_NAME, busyId);
- }
- }
-
- try {
- runnable.run();
- } finally {
- shells = display.getShells();
- for (int i = 0; i < shells.length; i++) {
- Integer id = (Integer)shells[i].getData(BUSYID_NAME);
- if (id == busyId) {
- shells[i].setCursor(null);
- shells[i].setData(BUSYID_NAME, null);
- }
- }
- if (cursor != null && !cursor.isDisposed()) {
- cursor.dispose();
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
deleted file mode 100755
index 37d2b55bc4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
+++ /dev/null
@@ -1,1057 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * The CCombo class represents a selectable user interface object
- * that combines a text field and a list and issues notificiation
- * when an item is selected from the list.
- * <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER, READ_ONLY</dd>
- * <dt><b>Events:</b>
- * <dd>Selection</dd>
- * </dl>
- */
-public final class CCombo extends Composite {
-
- static final int ITEMS_SHOWING = 5;
-
- Text text;
- List list;
- Shell popup;
- Button arrow;
- boolean hasFocus;
-
-public CCombo (Composite parent, int style) {
- super (parent, checkStyle (style));
-
- style = getStyle();
-
- int textStyle = SWT.SINGLE;
- if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
- if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
- text = new Text (this, textStyle);
-
- popup = new Shell (getShell (), SWT.NO_TRIM);
-
- int listStyle = SWT.SINGLE | SWT.V_SCROLL;
- if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
- list = new List (popup, listStyle);
-
- int arrowStyle = SWT.ARROW | SWT.DOWN;
- if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT;
- arrow = new Button (this, arrowStyle);
-
- Listener listener = new Listener () {
- public void handleEvent (Event event) {
- if (popup == event.widget) {
- popupEvent (event);
- return;
- }
- if (text == event.widget) {
- textEvent (event);
- return;
- }
- if (list == event.widget) {
- listEvent (event);
- return;
- }
- if (arrow == event.widget) {
- arrowEvent (event);
- return;
- }
- if (CCombo.this == event.widget) {
- comboEvent (event);
- return;
- }
-
- }
- };
-
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
- for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
-
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
- for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
-
- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
-
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
-
- int [] arrowEvents = {SWT.MouseDown, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
-
-}
-static int checkStyle (int style) {
- int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT;
- return style & mask;
-}
-/**
-* Adds an item.
-* <p>
-* The item is placed at the end of the list.
-* Indexing is zero based.
-*
-* @param string the new item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when the string is null
-* @exception SWTError(ERROR_ITEM_NOT_ADDED)
-* when the item cannot be added
-*/
-public void add (String string) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string);
-}
-/**
-* Adds an item at an index.
-* <p>
-* The item is placed at an index in the list.
-* Indexing is zero based.
-*
-* This operation will fail when the index is
-* out of range.
-*
-* @param string the new item
-* @param index the index for the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when the string is null
-* @exception SWTError(ERROR_ITEM_NOT_ADDED)
-* when the item cannot be added
-*/
-public void add (String string, int index) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string, index);
-}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void addModifyListener (ModifyListener listener) {;
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void addSelectionListener(SelectionListener listener) {
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-void arrowEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- Control focusControl = getDisplay ().getFocusControl();
- if (focusControl == list || focusControl == text) return;
- hasFocus = false;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusOut, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- dropDown (!isDropped ());
- break;
- }
- }
-}
-/**
-* Clears the current selection.
-* <p>
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void clearSelection () {
- text.clearSelection ();
- list.deselectAll ();
-}
-void comboEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (popup != null && !popup.isDisposed ()) popup.dispose ();
- popup = null;
- text = null;
- list = null;
- arrow = null;
- break;
- case SWT.Move:
- dropDown(false);
- break;
- case SWT.Resize:
- internalLayout();
- break;
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- int width = 0, height = 0;
- Point textSize = text.computeSize (wHint, SWT.DEFAULT, changed);
- Point arrowSize = arrow.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
- Point listSize = list.computeSize (wHint, SWT.DEFAULT, changed);
- Point barSize = list.getVerticalBar().getSize();
- int borderWidth = getBorderWidth();
-
- height = Math.max (hHint, Math.max(textSize.y, arrowSize.y) + 2*borderWidth);
- width = Math.max (wHint, Math.max(textSize.x + arrowSize.x + 2*borderWidth, listSize.x + 2) );
- return new Point (width, height);
-}
-/**
-* Deselects an item.
-* <p>
-* If the item at an index is selected, it is
-* deselected. If the item at an index is not
-* selected, it remains deselected. Indices
-* that are out of range are ignored. Indexing
-* is zero based.
-*
-* @param index the index of the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void deselect (int index) {
- list.deselect (index);
-}
-/**
-* Deselects all items.
-* <p>
-*
-* If an item is selected, it is deselected.
-* If an item is not selected, it remains unselected.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void deselectAll () {
- list.deselectAll ();
-}
-void dropDown (boolean drop) {
- if (drop == isDropped ()) return;
- if (!drop) {
- popup.setVisible (false);
- text.setFocus();
- return;
- }
- int index = list.getSelectionIndex ();
- if (index != -1) list.setTopIndex (index);
- Rectangle listRect = list.getBounds ();
- int borderWidth = getBorderWidth();
- Point point = toDisplay (new Point (0 - borderWidth, 0 - borderWidth));
- Point comboSize = getSize();
- popup.setBounds (point.x, point.y + comboSize.y, comboSize.x, listRect.height + 2);
- popup.setVisible (true);
- list.setFocus();
-}
-public Control [] getChildren () {
- return new Control [0];
-}
-boolean getEditable () {
- return text.getEditable ();
-}
-/**
-* Gets an item at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the item
-* @return the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_ITEM)
-* when the operation fails
-*/
-public String getItem (int index) {
- return list.getItem (index);
-}
-/**
-* Gets the number of items.
-* <p>
-* This operation will fail if the number of
-* items could not be queried from the OS.
-*
-* @return the number of items in the widget
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_COUNT)
-* when the operation fails
-*/
-public int getItemCount () {
- return list.getItemCount ();
-}
-/**
-* Gets the height of one item.
-* <p>
-* This operation will fail if the height of
-* one item could not be queried from the OS.
-*
-* @return the height of one item in the widget
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_ITEM_HEIGHT)
-* when the operation fails
-*/
-public int getItemHeight () {
- return list.getItemHeight ();
-}
-/**
-* Gets the items.
-* <p>
-* This operation will fail if the items cannot
-* be queried from the OS.
-*
-* @return the items in the widget
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_ITEM)
-* when the operation fails
-*/
-public String [] getItems () {
- return list.getItems ();
-}
-/**
-* Gets the selection.
-* <p>
-* @return a point representing the selection start and end
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public Point getSelection () {
- return text.getSelection ();
-}
-/**
-* Gets the index of the selected item.
-* <p>
-* Indexing is zero based.
-* If no item is selected -1 is returned.
-*
-* @return the index of the selected item.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public int getSelectionIndex () {
- return list.getSelectionIndex ();
-}
-/**
-* Gets the widget text.
-* <p>
-* If the widget has no text, an empty string is returned.
-*
-* @return the widget text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public String getText () {
- return text.getText ();
-}
-/**
-* Gets the height of the combo's text field.
-* <p>
-* The operation will fail if the height cannot
-* be queried from the OS.
-
-* @return the height of the combo's text field.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_ERROR_CANNOT_GET_ITEM_HEIGHT)
-* when the operation fails
-*/
-public int getTextHeight () {
- return text.getLineHeight();
-}
-/**
-* Gets the text limit.
-* <p>
-* @return the text limit
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public int getTextLimit () {
- return text.getTextLimit ();
-}
-/**
-* Gets the index of an item.
-* <p>
-* The list is searched starting at 0 until an
-* item is found that is equal to the search item.
-* If no item is found, -1 is returned. Indexing
-* is zero based.
-*
-* @param string the search item
-* @return the index of the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public int indexOf (String string) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string);
-}
-/**
-* Gets the index of an item.
-* <p>
-* The widget is searched starting at start including
-* the end position until an item is found that
-* is equal to the search itenm. If no item is
-* found, -1 is returned. Indexing is zero based.
-*
-* @param string the search item
-* @param index the starting position
-* @return the index of the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public int indexOf (String string, int start) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string, start);
-}
-boolean isDropped () {
- return popup.getVisible ();
-}
-public boolean isFocusControl () {
- if (text.isFocusControl() || arrow.isFocusControl() || list.isFocusControl() || popup.isFocusControl()) {
- return true;
- } else {
- return super.isFocusControl();
- }
-}
-void internalLayout () {
- if (isDropped ()) dropDown (false);
-
- Rectangle rect = getClientArea();
- int width = rect.width;
- int height = rect.height;
- Point arrowSize = arrow.computeSize(SWT.DEFAULT, height);
- text.setBounds (0, 0, width - arrowSize.x, height);
- arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
-
- Point size = getSize();
- int listHeight = list.getItemHeight () * ITEMS_SHOWING;
- Rectangle trim = list.computeTrim (0, 0, size.x - 2, listHeight);
- list.setBounds (1, 1, size.x - 2, trim.height);
-}
-void listEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- Control focusControl = getDisplay ().getFocusControl();
- if (focusControl == text || focusControl == arrow) return;
- hasFocus = false;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusOut, e);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- dropDown (false);
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.DefaultSelection, e);
- break;
- }
- case SWT.Selection: {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- text.setText (list.getItem (index));
- text.selectAll ();
- list.setSelection(index);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- e.doit = event.doit;
- notifyListeners(SWT.Selection, e);
- event.doit = e.doit;
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- event.doit = false;
- break;
- }
- Event e = new Event();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.keyCode = event.keyCode;
- notifyListeners(SWT.Traverse, e);
- event.doit = e.doit;
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyUp, e);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.ESC) {
- // escape key cancels popup list
- dropDown (false);
- }
- if (event.character == SWT.CR || event.character == '\t') {
- // Enter and Tab cause default selection
- dropDown (false);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
-
- }
- }
-}
-void popupEvent(Event event) {
- switch (event.type) {
- case SWT.Paint:
- // draw black rectangle around list
- Rectangle listRect = list.getBounds();
- Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
- event.gc.setForeground(black);
- event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
- break;
- case SWT.Close:
- event.doit = false;
- dropDown (false);
- break;
- case SWT.Deactivate:
- dropDown (false);
- break;
- }
-}
-public void redraw (int x, int y, int width, int height, boolean all) {
- if (!all) return;
- Point location = text.getLocation();
- text.redraw(x - location.x, y - location.y, width, height, all);
- location = list.getLocation();
- list.redraw(x - location.x, y - location.y, width, height, all);
- if (arrow != null) {
- location = arrow.getLocation();
- arrow.redraw(x - location.x, y - location.y, width, height, all);
- }
-}
-
-/**
-* Removes an item at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be removed from
-* the OS.
-*
-* @param index the index of the item
-* @return the selection state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (int index) {
- list.remove (index);
-}
-/**
-* Removes a range of items.
-* <p>
-* Indexing is zero based. The range of items
-* is from the start index up to and including
-* the end index.
-*
-* This operation will fail when the index is out
-* of range or an item could not be removed from
-* the OS.
-*
-* @param start the start of the range
-* @param end the end of the range
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (int start, int end) {
- list.remove (start, end);
-}
-/**
-* Removes an item.
-* <p>
-* This operation will fail when the item
-* could not be removed from the OS.
-*
-* @param string the search item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-* @exception SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (String string) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.remove (string);
-}
-/**
-* Removes all items.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void removeAll () {
- text.setText ("");
- list.removeAll ();
-}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void removeModifyListener (ModifyListener listener) {
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
-}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void removeSelectionListener (SelectionListener listener) {
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
-}
-/**
-* Selects an item.
-* <p>
-* If the item at an index is not selected, it is
-* selected. Indices that are out of
-* range are ignored. Indexing is zero based.
-*
-* @param index the index of the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void select (int index) {
- if (index == -1) {
- list.deselectAll ();
- text.setText ("");
- return;
- }
- if (0 <= index && index < list.getItemCount()) {
- if (index != getSelectionIndex()) {
- text.setText (list.getItem (index));
- text.selectAll ();
- list.select (index);
- list.showSelection ();
- }
- }
-}
-public void setBackground (Color color) {
- super.setBackground(color);
- if (text != null) text.setBackground(color);
- if (list != null) list.setBackground(color);
- if (arrow != null) arrow.setBackground(color);
-}
-
-
-/**
-* Sets the focus.
-*/
-public boolean setFocus () {
- return text.setFocus ();
-}
-/**
-* Sets the widget font.
-*/
-public void setFont (Font font) {
- super.setFont (font);
- text.setFont (font);
- list.setFont (font);
- internalLayout ();
-}
-public void setForeground (Color color) {
- super.setForeground(color);
- if (text != null) text.setForeground(color);
- if (list != null) list.setForeground(color);
- if (arrow != null) arrow.setForeground(color);
-}
-/**
-* Sets the text of an item.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be changed in
-* the OS.
-*
-* @param index the index for the item
-* @param string the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when items is null
-* @exception SWTError(ERROR_ITEM_NOT_MODIFIED)
-* when the operation fails
-*/
-public void setItem (int index, String string) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.setItem (index, string);
-}
-/**
-* Sets all items.
-* <p>
-* @param items the array of items
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when items is null
-* @exception SWTError(ERROR_ITEM_NOT_ADDED)
-* when the operation fails
-*/
-public void setItems (String [] items) {
- if (items == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int style = getStyle();
- if ((style & SWT.READ_ONLY) != 0) text.setText ("");
- list.setItems (items);
-}
-/**
-* Sets the new selection.
-* <p>
-* @param selection point representing the start and the end of the new selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when selection is null
-*/
-public void setSelection (Point selection) {
- if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- text.setSelection (selection.x, selection.y);
-}
-
-/**
-* Sets the widget text
-* <p>
-* @param string the widget text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public void setText (String string) {
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = list.indexOf (string);
- if (index == -1) {
- list.deselectAll ();
- text.setText (string);
- return;
- }
- text.setText (string);
- text.selectAll ();
- list.setSelection (index);
- list.showSelection ();
-}
-/**
-* Sets the text limit
-* <p>
-* @param limit new text limit
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_BE_ZERO)
-* when limit is 0
-*/
-public void setTextLimit (int limit) {
- text.setTextLimit (limit);
-}
-
-void textEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- Control focusControl = getDisplay ().getFocusControl();
- if (focusControl == list || focusControl == arrow) return;
- hasFocus = false;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusOut, e);
- break;
- }
- case SWT.KeyDown: {
-
- if (event.character == SWT.ESC) { // escape key cancels popup list
- dropDown (false);
- }
- if (event.character == SWT.CR || event.character == '\t') {
- dropDown (false);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
-
- if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {
- int oldIndex = getSelectionIndex ();
- if (event.keyCode == SWT.ARROW_UP) {
- select (Math.max (oldIndex - 1, 0));
- } else {
- select (Math.min (oldIndex + 1, getItemCount () - 1));
- }
-
- if (oldIndex != getSelectionIndex ()) {
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.Selection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
- }
-
- // Further work : Need to add support for incremental search in
- // pop up list as characters typed in text widget
-
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyUp, e);
- break;
- }
- case SWT.Modify: {
- list.deselectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.Modify, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- text.selectAll ();
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- // The tab key causes default selection and
- // the arrow keys are used to manipulate the list contents so
- // do not use them for traversal.
- event.doit = false;
- break;
- }
-
- Event e = new Event();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.keyCode = event.keyCode;
- notifyListeners(SWT.Traverse, e);
- event.doit = e.doit;
- break;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java
deleted file mode 100755
index 799891d8fa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java
+++ /dev/null
@@ -1,448 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * A Label which supports aligned text and/or an image and different border styles.
- * <p>
- * If there is not enough space a SmartLabel uses the following strategy to fit the
- * information into the available space:
- * <pre>
- * ignores the indent in left align mode
- * ignores the image and the gap
- * shortens the text by replacing the center portion of the label with an ellipsis
- * shortens the text by removing the center portion of the label
- * </pre>
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b>
- * <dd></dd>
- * </dl>
- */
-public class CLabel extends Canvas {
-
- /** Gap between icon and text */
- private static final int GAP = 5;
- /** Left and right margins */
- private static final int INDENT = 3;
- /** a string inserted in the middle of text that has been shortened */
- private static final String ellipsis = "...";
- /** the alignment. Either CENTER, RIGHT, LEFT. Default is LEFT*/
- private int align = SWT.LEFT;
- private int hIndent = INDENT;
- private int vIndent = INDENT;
- /** the current text */
- private String text;
- /** the current icon */
- private Image image;
- // The tooltip is used for two purposes - the application can set
- // a tooltip or the tooltip can be used to display the full text when the
- // the text has been truncated due to the label being too short.
- // The appToolTip stores the tooltip set by the application. Control.tooltiptext
- // contains whatever tooltip is currently being displayed.
- private String appToolTipText;
-
- private Image backgroundImage;
- private Color[] gradientColors;
- private int[] gradientPercents;
-
-
-/**
- * Create a CLabel with the given border style as a child of parent.
- */
-public CLabel(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- if ((style & SWT.CENTER) != 0) align = SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) align = SWT.RIGHT;
- if ((style & SWT.LEFT) != 0) align = SWT.LEFT;
-
- addPaintListener(new PaintListener(){
- public void paintControl(PaintEvent event) {
- onPaint(event);
- }
- });
-
- addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent event) {
- onDispose(event);
- }
- });
-
-}
-/**
- * Check the style bits to ensure that no invalid styles are applied.
- */
-private static int checkStyle (int style) {
- int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE;
- style = style & mask;
- style |= SWT.NO_FOCUS | SWT.NO_BACKGROUND;
- return style;
-}
-public Point computeSize(int wHint, int hHint, boolean changed) {
- Point e = getTotalSize(image, text);
- if (wHint == SWT.DEFAULT){
- e.x += 2*hIndent;
- } else {
- e.x = wHint;
- }
- if (hHint == SWT.DEFAULT) {
- e.y += 2*vIndent;
- } else {
- e.y = hHint;
- }
- return e;
-}
-/**
- * Draw a rectangle in the given colors.
- */
-private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
- gc.setForeground(bottomright);
- gc.drawLine(x+w, y, x+w, y+h);
- gc.drawLine(x, y+h, x+w, y+h);
-
- gc.setForeground(topleft);
- gc.drawLine(x, y, x+w-1, y);
- gc.drawLine(x, y, x, y+h-1);
-}
-/**
- * Returns the alignment.
- * The alignment style (LEFT, CENTER or RIGHT) is returned.
- */
-public int getAlignment() {
- return align;
-}
-/**
- * Return the CLabel's image or <code>null</code>.
- */
-public Image getImage() {
- return image;
-}
-/**
- * Compute the minimum size.
- */
-private Point getTotalSize(Image image, String text) {
- Point size = new Point(0, 0);
-
- if (image != null) {
- Rectangle r = image.getBounds();
- size.x += r.width;
- size.y += r.height;
- }
-
- GC gc = new GC(this);
- if (text != null && text.length() > 0) {
- Point e = gc.textExtent(text);
- size.x += e.x;
- size.y = Math.max(size.y, e.y);
- if (image != null) size.x += GAP;
- } else {
- size.y = Math.max(size.y, gc.getFontMetrics().getHeight());
- }
- gc.dispose();
-
- return size;
-}
-public void setToolTipText (String string) {
- super.setToolTipText (string);
- appToolTipText = super.getToolTipText();
-}
-/**
- * Return the Label's text.
- */
-public String getText() {
- return text;
-}
-public String getToolTipText () {
- return appToolTipText;
-}
-/**
- * Paint the Label's border.
- */
-private void paintBorder(GC gc, Rectangle r) {
- Display disp= getDisplay();
-
- Color c1 = null;
- Color c2 = null;
-
- int style = getStyle();
- if ((style & SWT.SHADOW_IN) != 0) {
- c1 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- c2 = disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- }
- if ((style & SWT.SHADOW_OUT) != 0) {
- c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- }
-
- if (c1 != null && c2 != null) {
- gc.setLineWidth(1);
- drawBevelRect(gc, r.x, r.y, r.width-1, r.height-1, c1, c2);
- }
-}
-private void onDispose(DisposeEvent event) {
- gradientColors = null;
- gradientPercents = null;
- backgroundImage = null;
-}
-/*
- * Process the paint event
- */
-private void onPaint(PaintEvent event) {
- Rectangle rect = getClientArea();
- if (rect.width == 0 || rect.height == 0) return;
-
- boolean shortenText = false;
- String t = text;
- Image img = image;
- int availableWidth = rect.width - 2*hIndent;
- Point extent = getTotalSize(img, t);
- if (extent.x > availableWidth) {
- img = null;
- extent = getTotalSize(img, t);
- if (extent.x > availableWidth) {
- shortenText = true;
- }
- }
-
- GC gc = event.gc;
-
- // shorten the text
- if (shortenText) {
- t = shortenText(gc, text, availableWidth);
- extent = getTotalSize(img, t);
- if (appToolTipText == null) {
- super.setToolTipText(text);
- }
- } else {
- super.setToolTipText(appToolTipText);
- }
-
- // determine horizontal position
- int x = rect.x + hIndent;
- if (align == SWT.CENTER) {
- x = (rect.width-extent.x)/2;
- }
- if (align == SWT.RIGHT) {
- x = rect.width-extent.x - hIndent;
- }
-
- // draw a background image behind the text
- try {
- if (backgroundImage != null) {
- // draw a background image behind the text
- Rectangle imageRect = backgroundImage.getBounds();
- gc.drawImage(backgroundImage, 0, 0, imageRect.width, imageRect.height,
- 0, 0, rect.width, rect.height);
- } else if (gradientColors != null) {
- // draw a gradient behind the text
- final Color oldBackground = gc.getBackground();
- if (gradientColors.length == 1) {
- if (gradientColors[0] != null) gc.setBackground(gradientColors[0]);
- gc.fillRectangle(0, 0, rect.width, rect.height);
- } else {
- final Color oldForeground = gc.getForeground();
- Color lastColor = gradientColors[0];
- if (lastColor == null) lastColor = oldBackground;
- for (int i = 0, pos = 0; i < gradientPercents.length; ++i) {
- gc.setForeground(lastColor);
- lastColor = gradientColors[i + 1];
- if (lastColor == null) lastColor = oldBackground;
- gc.setBackground(lastColor);
- final int gradientWidth = (gradientPercents[i] * rect.width / 100) - pos;
- gc.fillGradientRectangle(pos, 0, gradientWidth, rect.height, false);
- pos += gradientWidth;
- }
- gc.setForeground(oldForeground);
- }
- gc.setBackground(oldBackground);
- } else {
- gc.setBackground(getBackground());
- gc.fillRectangle(rect);
- }
- } catch (SWTException e) {
- gc.setBackground(getBackground());
- gc.fillRectangle(rect);
- }
-
- // draw border
- int style = getStyle();
- if ((style & SWT.SHADOW_IN) != 0 || (style & SWT.SHADOW_OUT) != 0) {
- paintBorder(gc, rect);
- }
- // draw the image
- if (img != null) {
- Rectangle imageRect = img.getBounds();
- gc.drawImage(img, 0, 0, imageRect.width, imageRect.height,
- x, (rect.height-imageRect.height)/2, imageRect.width, imageRect.height);
- x += imageRect.width + GAP;
- }
- // draw the text
- if (t != null) {
- int textHeight = gc.getFontMetrics().getHeight();
- gc.setForeground(getForeground());
- gc.drawText(t, x, rect.y + (rect.height-textHeight)/2, true);
- }
-}
-/**
- * Set the alignment of the CLabel.
- * Use the values LEFT, CENTER and RIGHT to align image and text within the available space.
- */
-public void setAlignment(int align) {
- if (align != SWT.LEFT && align != SWT.RIGHT && align != SWT.CENTER) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.align != align) {
- this.align = align;
- redraw();
- }
-}
-/**
- * Specify a gradiant of colours to be draw in the background of the CLabel.
- * For example to draw a gradiant that varies from dark blue to blue and then to
- * white, use the following call to setBackground:
- * <pre>
- * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
- * display.getSystemColor(SWT.COLOR_BLUE),
- * display.getSystemColor(SWT.COLOR_WHITE),
- * display.getSystemColor(SWT.COLOR_WHITE)},
- * new int[] {25, 50, 100});
- * </pre>
- *
- * @param colors an array of Color that specifies the colors to appear in the gradiant
- * in order of appearance left to right. The value <code>null</code> clears the
- * background gradiant. The value <code>null</code> can be used inside the array of
- * Color to specify the background color.
- * @param percents an array of integers between 0 and 100 specifying the percent of the width
- * of the widget at which the color should change. The size of the percents array must be one
- * less than the size of the colors array.
- */
-public void setBackground(Color[] colors, int[] percents) {
- if (colors != null) {
- if (percents == null || percents.length != colors.length - 1) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (getDisplay().getDepth() < 15) {
- // Don't use gradients on low color displays
- colors = new Color[] { colors[0] };
- percents = new int[] { };
- }
- for (int i = 0; i < percents.length; i++) {
- if (percents[i] < 0 || percents[i] > 100) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (i > 0 && percents[i] < percents[i-1]) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
- }
-
- // Are these settings the same as before?
- final Color background = getBackground();
- if (backgroundImage == null) {
- if ((gradientColors != null) && (colors != null) &&
- (gradientColors.length == colors.length)) {
- boolean same = false;
- for (int i = 0; i < gradientColors.length; i++) {
- same = (gradientColors[i] == colors[i]) ||
- ((gradientColors[i] == null) && (colors[i] == background)) ||
- ((gradientColors[i] == background) && (colors[i] == null));
- if (!same) break;
- }
- if (same) {
- for (int i = 0; i < gradientPercents.length; i++) {
- same = gradientPercents[i] == percents[i];
- if (!same) break;
- }
- }
- if (same) return;
- }
- } else {
- backgroundImage = null;
- }
- // Store the new settings
- if (colors == null) {
- gradientColors = null;
- gradientPercents = null;
- } else {
- gradientColors = new Color[colors.length];
- for (int i = 0; i < colors.length; ++i)
- gradientColors[i] = (colors[i] != null) ? colors[i] : background;
- gradientPercents = new int[percents.length];
- for (int i = 0; i < percents.length; ++i)
- gradientPercents[i] = percents[i];
- }
- // Refresh with the new settings
- redraw();
-}
-public void setBackground(Image image) {
- if (image == backgroundImage) return;
- gradientColors = null;
- gradientPercents = null;
- backgroundImage = image;
- redraw();
-
-}
-public void setFont(Font font) {
- super.setFont(font);
- redraw();
-}
-/**
- * Set the label's Image.
- * The value <code>null</code> clears it.
- */
-public void setImage(Image image) {
- if (image != this.image) {
- this.image = image;
- redraw();
- }
-}
-/**
- * Set the label's text.
- * The value <code>null</code> clears it.
- */
-public void setText(String text) {
- if (text == null) text = "";
- if (! text.equals(this.text)) {
- this.text = text;
- redraw();
- }
-}
-/**
- * Shorten the given text <code>t</code> so that its length doesn't exceed
- * the given width. The default implementation replaces characters in the
- * center of the original string with an ellipsis ("...").
- * Override if you need a different strategy.
- */
-protected String shortenText(GC gc, String t, int width) {
- if (t == null) return null;
- int w = gc.textExtent(ellipsis).x;
- int l = t.length();
- int pivot = l/2;
- int s = pivot;
- int e = pivot+1;
- while (s >= 0 && e < l) {
- String s1 = t.substring(0, s);
- String s2 = t.substring(e, l);
- int l1 = gc.textExtent(s1).x;
- int l2 = gc.textExtent(s2).x;
- if (l1+w+l2 < width) {
- t = s1 + ellipsis + s2;
- break;
- }
- s--;
- e++;
- }
- return t;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
deleted file mode 100755
index 9e5b3ebf12..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
+++ /dev/null
@@ -1,1571 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>CTabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>CTabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>TOP, BOTTOM, FLAT</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * <dd>"CTabFolder"</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class CTabFolder extends Composite {
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the form.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the form.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
-
- /**
- * Color of innermost line of drop shadow border.
- */
- public static RGB borderInsideRGB = new RGB (132, 130, 132);
- /**
- * Color of middle line of drop shadow border.
- */
- public static RGB borderMiddleRGB = new RGB (143, 141, 138);
- /**
- * Color of outermost line of drop shadow border.
- */
- public static RGB borderOutsideRGB = new RGB (171, 168, 165);
-
- /*
- * A multiple of the tab height that specifies the minimum width to which a tab
- * will be compressed before scrolling arrows are used to navigate the tabs.
- */
- public static int MIN_TAB_WIDTH = 3;
-
- /* sizing, positioning */
- int xClient, yClient;
- boolean onBottom = false;
- int fixedTabHeight = 0;
-
- /* item management */
- private CTabItem items[] = new CTabItem[0];
- private int selectedIndex = -1;
- int topTabIndex = -1; // index of the left most visible tab.
-
- /* External Listener management */
- private CTabFolderListener[] tabListeners = new CTabFolderListener[0];
-
- /* Color appearance */
- Image backgroundImage;
- Color[] gradientColors;
- int[] gradientPercents;
- Color selectionForeground;
-
- // internal constants
- private static final int DEFAULT_WIDTH = 64;
- private static final int DEFAULT_HEIGHT = 64;
-
- // scrolling arrows
- private ToolBar arrowBar;
- private Image arrowLeftImage;
- private Image arrowRightImage;
-
- // close button
- boolean showClose = false;
- private Image closeImage;
- ToolBar closeBar;
- private ToolBar inactiveCloseBar;
- private CTabItem inactiveItem;
-
- private boolean shortenedTabs = false;
-
- // borders
- boolean showBorders = false;
- private int borderBottom = 0;
- private int borderLeft = 0;
- private int borderRight = 0;
- private int borderTop = 0;
- private Color borderColor1;
- private Color borderColor2;
- private Color borderColor3;
-
- // when disposing CTabFolder, don't try to layout the items or
- // change the selection as each child is destroyed.
- private boolean inDispose = false;
-
- // keep track of size changes in order to redraw only affected area
- // on Resize
- private Rectangle oldArea;
-
- // insertion marker
- int insertionIndex = -2; // Index of insert marker. Marker always shown after index.
- // -2 means no insert marker
-
- // tool tip
- private Shell tip;
-
-/**
- * Construct a CTabFolder with the specified parent and style.
- * @param parent org.eclipse.swt.widgets.Composite
- * @param swtStyle int
- */
-public CTabFolder(Composite parent, int style) {
- super(parent, checkStyle (style));
-
- onBottom = (getStyle() & SWT.BOTTOM) != 0;
-
- borderColor1 = new Color(getDisplay(), borderInsideRGB);
- borderColor2 = new Color(getDisplay(), borderMiddleRGB);
- borderColor3 = new Color(getDisplay(), borderOutsideRGB);
- Color background = getBackground();
-
- // tool tip support
- Display display = getDisplay();
- tip = new Shell (getShell(), SWT.ON_TOP);
- GridLayout layout = new GridLayout();
- layout.marginWidth = layout.marginHeight = 1;
- tip.setLayout(layout);
- Label label = new Label (tip, SWT.NONE);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- label.setForeground (display.getSystemColor (SWT.COLOR_INFO_FOREGROUND));
- label.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
- tip.setBackground(label.getBackground());
-
- // Add all listeners
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose: onDispose(); break;
- case SWT.Paint: onPaint(event); break;
- case SWT.Resize: onResize(); break;
- case SWT.MouseDoubleClick: onMouseDoubleClick(event); break;
- case SWT.MouseDown: onMouseDown(event); break;
- case SWT.MouseExit: onMouseExit(event); break;
- case SWT.MouseHover: onMouseHover(event); break;
- case SWT.MouseMove: onMouseMove(event); break;
- case SWT.FocusIn: onFocus(event); break;
- case SWT.FocusOut: onFocus(event); break;
- case SWT.KeyDown: onKeyDown(event); break;
- case SWT.Traverse: onTraverse(event); break;
- }
- }
- };
-
- int[] folderEvents = new int[]{
- SWT.Dispose,
- SWT.MouseDown,
- SWT.MouseDoubleClick,
- SWT.MouseMove,
- SWT.MouseExit,
- SWT.MouseHover,
- SWT.Paint,
- SWT.Resize,
- SWT.FocusIn,
- SWT.FocusOut,
- SWT.KeyDown,
- SWT.Traverse,
- };
- for (int i = 0; i < folderEvents.length; i++) {
- addListener(folderEvents[i], listener);
- }
-
- createArrowBar();
- createCloseBar();
-
- setBorderVisible((style & SWT.BORDER) != 0);
-}
-private static int checkStyle (int style) {
- int mask = SWT.TOP | SWT.BOTTOM | SWT.FLAT;
- style = style & mask;
- // TOP and BOTTOM are mutually exlusive.
- // TOP is the default
- if ((style & SWT.TOP) != 0)
- style = style & ~(SWT.TOP | SWT.BOTTOM) | SWT.TOP;
- // reduce the flash by not redrawing the entire area on a Resize event
- style |= SWT.NO_REDRAW_RESIZE;
- return style;
-}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_NULL_ARGUMENT when listener is null</li>
-* </ul>
-*/
-public void addSelectionListener(SelectionListener listener) {
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when a tab item is closed.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- *
- * @see CTabFolderListener
- * @see #removeCTabFolderListener
- */
-public void addCTabFolderListener(CTabFolderListener listener) {
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- // add to array
- CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length + 1];
- System.arraycopy(tabListeners, 0, newTabListeners, 0, tabListeners.length);
- tabListeners = newTabListeners;
- tabListeners[tabListeners.length - 1] = listener;
- showClose = true;
- layoutItems();
-}
-void onClientAreaChange() {
- oldArea = null;
- notifyListeners(SWT.Resize, new Event());
-}
-private void closeNotify(CTabItem item, int time) {
- if (item == null) return;
-
- CTabFolderEvent event = new CTabFolderEvent(this);
- event.widget = this;
- event.time = time;
- event.item = item;
- event.doit = true;
- if (tabListeners != null) {
- for (int i = 0; i < tabListeners.length; i++) {
- tabListeners[i].itemClosed(event);
- }
- }
- if (event.doit) {
- item.dispose();
- }
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- int minWidth = 0;
- int minHeight = 0;
-
- // tab width
- if (items.length > 0) {
- CTabItem lastItem = items[items.length-1];
- minWidth = lastItem.x + lastItem.width;
- }
-
- // get max preferred size of items
- for (int i = 0; i < items.length; i++) {
- Control control = items[i].getControl();
- if (control != null && !control.isDisposed()){
- Point size = control.computeSize (wHint, hHint);
- minWidth = Math.max (minWidth, size.x);
- minHeight = Math.max (minHeight, size.y);
- }
- }
- if (minWidth == 0) minWidth = DEFAULT_WIDTH;
- if (minHeight == 0) minHeight = DEFAULT_HEIGHT;
-
- if (wHint != SWT.DEFAULT) minWidth = wHint;
- if (hHint != SWT.DEFAULT) minHeight = hHint;
-
- Rectangle trim = computeTrim(0, 0, minWidth, minHeight);
- return new Point (trim.width, trim.height);
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- int tabHeight = getTabHeight();
- int trimX = x - marginWidth - borderLeft;
- int trimY = y - marginHeight - tabHeight - borderTop;
- if (onBottom) {
- trimY = y - marginHeight - borderTop;
- }
- int trimWidth = width + borderLeft + borderRight + 2*marginWidth;
- int trimHeight = height + borderTop + borderBottom + 2*marginHeight + tabHeight;
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-/**
- * Create the specified item at 'index'.
- */
-void createItem (CTabItem item, int index) {
- if (0 > index || index > getItemCount ()){
- SWT.error (SWT.ERROR_INVALID_RANGE);
- }
- // grow by one and rearrange the array.
- CTabItem[] newItems = new CTabItem [items.length + 1];
- System.arraycopy(items, 0, newItems, 0, index);
- newItems[index] = item;
- System.arraycopy(items, index, newItems, index + 1, items.length - index);
- items = newItems;
-
- item.parent = this;
-
- if (selectedIndex >= index) {
- selectedIndex ++;
- }
- if (items.length == 1) {
- topTabIndex = 0;
- }
-
- layoutItems();
- ensureVisible();
-
- if (items.length == 1) {
- redraw();
- } else {
- redrawTabArea(-1);
- }
-}
-
-private void createArrowBar() {
- // create arrow buttons for scrolling
- arrowBar = new ToolBar(this, SWT.FLAT);
- arrowBar.setVisible(false);
- arrowBar.setBackground(getBackground());
- ToolItem scrollLeft = new ToolItem(arrowBar, SWT.PUSH);
- scrollLeft.setEnabled(false);
- ToolItem scrollRight = new ToolItem(arrowBar, SWT.PUSH);
- scrollRight.setEnabled(false);
-
- scrollLeft.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- scroll_scrollLeft();
- }
- });
- scrollRight.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- scroll_scrollRight();
- }
- });
-
-}
-private void createCloseBar() {
- Color background = getBackground();
- closeBar = new ToolBar(this, SWT.FLAT);
- closeBar.setVisible(false);
- if (gradientColors != null && gradientColors.length > 0) {
- closeBar.setBackground(gradientColors[gradientColors.length - 1]);
- } else {
- closeBar.setBackground(background);
- }
- ToolItem closeItem = new ToolItem(closeBar, SWT.PUSH);
-
- inactiveCloseBar = new ToolBar(this, SWT.FLAT);
- inactiveCloseBar.setVisible(false);
- inactiveCloseBar.setBackground(background);
- ToolItem inactiveCloseItem = new ToolItem(inactiveCloseBar, SWT.PUSH);
-
- closeItem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- closeNotify(getSelection(), event.time);
- }
- });
- inactiveCloseItem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- closeNotify(inactiveItem, event.time);
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
- }
- });
- inactiveCloseBar.addListener (SWT.MouseExit, new Listener() {
- public void handleEvent(Event event) {
- if (inactiveItem != null) {
- Rectangle itemBounds = inactiveItem.getBounds();
- if (itemBounds.contains(event.x, event.y)) return;
- }
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
- }
- });
-
-}
-/**
- * Destroy the specified item.
- */
-void destroyItem (CTabItem item) {
- if (inDispose) return;
-
- int index = indexOf(item);
- if (index == -1) return; // should this trigger an error?
-
- insertionIndex = -2;
-
- if (items.length == 1) {
- items = new CTabItem[0];
- selectedIndex = -1;
- topTabIndex = 0;
-
- Control control = item.getControl();
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- closeBar.setVisible(false);
- redraw();
- return;
- }
-
- // shrink by one and rearrange the array.
- CTabItem[] newItems = new CTabItem [items.length - 1];
- System.arraycopy(items, 0, newItems, 0, index);
- System.arraycopy(items, index + 1, newItems, index, items.length - index - 1);
- items = newItems;
-
- if (topTabIndex == items.length) {
- --topTabIndex;
- }
-
- // move the selection if this item is selected
- if (selectedIndex == index) {
- Control control = item.getControl();
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- selectedIndex = -1;
- setSelection(Math.max(0, index - 1), true);
- } else if (selectedIndex > index) {
- selectedIndex --;
- }
-
- layoutItems();
- ensureVisible();
- redrawTabArea(-1);
-}
-private void onKeyDown(Event e) {
- if (e.keyCode == SWT.ARROW_LEFT) {
- if (selectedIndex > 0) {
- setSelection(selectedIndex - 1, true);
- }
- }
- if (e.keyCode == SWT.ARROW_RIGHT) {
- if (selectedIndex < items.length - 1) {
- setSelection(selectedIndex + 1, true);
- }
- }
-}
-/**
- * Dispose the items of the receiver
- */
-private void onDispose() {
- inDispose = true;
-
- // items array is resized during CTabItem.dispose
- // it is set to null if the last item is removed
- int length = items.length;
- for (int i = 0; i < length; i++) {
- if (items[i] != null) {
- items[i].dispose();
- }
- }
-
- // clean up resources
- if (tip != null && !tip.isDisposed()) {
- tip.dispose();
- tip = null;
- }
-
- if (arrowLeftImage != null) arrowLeftImage.dispose();
- arrowLeftImage = null;
- if (arrowRightImage != null) arrowRightImage.dispose();
- arrowRightImage = null;
- if (closeImage != null) closeImage.dispose();
- closeImage = null;
-
- gradientColors = null;
- gradientPercents = null;
- backgroundImage = null;
-
- if (borderColor1 != null) borderColor1.dispose();
- borderColor1 = null;
-
- if (borderColor2 != null) borderColor2.dispose();
- borderColor2 = null;
-
- if (borderColor3 != null) borderColor3.dispose();
- borderColor3 = null;
-}
-public void onFocus(Event e) {
- if (selectedIndex >= 0) {
- redrawTabArea(selectedIndex);
- } else {
- setSelection(0, true);
- }
-}
-/**
- * Draw a border around the receiver.
- */
-private void drawBorder(GC gc) {
-
- Rectangle d = super.getClientArea();
-
- if (showBorders) {
- if ((getStyle() & SWT.FLAT) != 0) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 1, d.y + d.height - 1);
- } else {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 3, d.y + d.height - 3);
-
- gc.setForeground(borderColor2);
- gc.drawLine(d.x + 1, d.y + d.height - 2, d.x + d.width - 1, d.y + d.height - 2);
- gc.drawLine(d.x + d.width - 2, d.y + 1, d.x + d.width - 2, d.y + d.height - 1);
-
- gc.setForeground(borderColor3);
- gc.drawLine(d.x + 2, d.y + d.height - 1, d.x + d.width - 2, d.y + d.height - 1);
- gc.drawLine(d.x + d.width - 1, d.y + 2, d.x + d.width - 1, d.y + d.height - 2);
-
- // fill in corners with parent's background
- gc.setForeground(getParent().getBackground());
- gc.drawLine(d.x + d.width - 2, d.y, d.x + d.width - 1, d.y);
- gc.drawLine(d.x + d.width - 1, d.y + 1, d.x + d.width - 1, d.y + 1);
-
- gc.drawLine(d.x, d.y + d.height - 2, d.x, d.y + d.height - 2);
- gc.drawLine(d.x, d.y + d.height - 1, d.x + 1, d.y + d.height - 1);
-
- gc.drawLine(d.x + d.width - 1, d.y + d.height - 1, d.x + d.width - 1, d.y + d.height - 1);
- }
-
- }
-
- // draw a separator line
- if (items.length > 0) {
- int tabHeight = getTabHeight();
- int lineY = d.y + borderTop + tabHeight;
- if (onBottom) {
- lineY = d.y + d.height - borderBottom - tabHeight - 1;
- }
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + borderLeft, lineY, d.x + d.width - borderRight, lineY);
- }
-
- gc.setForeground(getForeground());
-}
-public Rectangle getClientArea() {
- Rectangle clientArea = super.getClientArea();
- clientArea.x = xClient;
- clientArea.y = yClient;
- clientArea.width -= 2*marginWidth + borderLeft + borderRight;
- clientArea.height -= 2*marginHeight + borderTop + borderBottom + getTabHeight() + 1;
- return clientArea;
-}
-public int getTabHeight(){
- if (fixedTabHeight > 0) return fixedTabHeight;
-
- int tempHeight = 0;
- GC gc = new GC(this);
- for (int i=0; i < items.length; i++) {
- tempHeight = Math.max(tempHeight, items[i].preferredHeight(gc));
- }
- gc.dispose();
- return tempHeight;
-}
-/**
- * Return the tab that is located at the specified index.
- */
-public CTabItem getItem (int index) {
- if (index < 0 || index > items.length)
- SWT.error(SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-/**
-* Gets the item at a point in the widget.
-* <p>
-*
-* @return the item at a point
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_CANNOT_GET_COUNT when the operation fails</li>
-* </ul>
-*/
-public CTabItem getItem (Point pt) {
- for (int i = 0; i < items.length; i++) {
- Rectangle bounds = items[i].getBounds();
- if (bounds.contains(pt)) return items[i];
- }
- return null;
-}
-/**
- * Return the number of tabs in the folder.
- */
-public int getItemCount(){
- return items.length;
-}
-/**
- * Return the tab items.
- */
-public CTabItem [] getItems() {
- CTabItem[] tabItems = new CTabItem [items.length];
- System.arraycopy(items, 0, tabItems, 0, items.length);
- return tabItems;
-}
-/**
- * Return the selected tab item, or an empty array if there
- * is no selection.
- */
-public CTabItem getSelection() {
- if (selectedIndex == -1) return null;
- return items[selectedIndex];
-}
-/**
- * Return the index of the selected tab item, or -1 if there
- * is no selection.
- */
-public int getSelectionIndex() {
- return selectedIndex;
-}
-
-
-/**
- * Return the index of the specified tab or -1 if the tab is not
- * in the receiver.
- */
-public int indexOf(CTabItem item) {
- if (item == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- for (int i = 0; i < items.length; i++) {
- if (items[i] == item) return i;
- }
- return -1;
-}
-
-private void layoutButtons() {
-
- updateArrowBar();
- updateCloseBar();
-
- int tabHeight = getTabHeight();
- Rectangle area = super.getClientArea();
-
- boolean leftVisible = scroll_leftVisible();
- boolean rightVisible = scroll_rightVisible();
- if (leftVisible || rightVisible) {
- Point size = arrowBar.computeSize(SWT.DEFAULT, tabHeight);
- int x = area.x + area.width - borderRight - size.x;
- int y = (onBottom) ? area.y + area.height - borderBottom - size.y : area.y + borderTop;
-
- arrowBar.setBounds(x, y, size.x, size.y);
- ToolItem[] items = arrowBar.getItems();
- items[0].setEnabled(leftVisible);
- items[1].setEnabled(rightVisible);
- arrowBar.setVisible(true);
- } else {
- arrowBar.setVisible(false);
- }
-
- // When the close button is right at the edge of the Tab folder, hide it because
- // otherwise it may block off a part of the border on the right
- if (showClose) {
- CTabItem item = getSelection();
- if (item == null) {
- closeBar.setVisible(false);
- } else {
- int toolbarHeight = tabHeight - CTabItem.TOP_MARGIN - CTabItem.BOTTOM_MARGIN + 2; // +2 to ignore gab between focus rectangle
- int x = item.x + item.width - toolbarHeight - 1;
- int y = item.y + Math.max(0, (item.height - toolbarHeight)/2);
- closeBar.setBounds(x, y, toolbarHeight, toolbarHeight);
- if (arrowBar.isVisible()) {
- Rectangle arrowRect = arrowBar.getBounds();
- arrowRect.width += borderRight;
- closeBar.setVisible(!arrowRect.contains(x, y));
- } else {
- closeBar.setVisible(true);
- }
- }
- }
-}
-/**
- * Layout the items and store the client area size.
- */
- void layoutItems() {
- if (isDisposed()) return;
-
- Rectangle area = super.getClientArea();
- int tabHeight = getTabHeight();
-
- shortenedTabs = false;
- if (items.length > 0) {
- int[] widths = new int[items.length];
- int totalWidth = 0;
- GC gc = new GC(this);
- for (int i = 0; i < items.length; i++) {
- widths[i] = items[i].preferredWidth(gc);
- totalWidth += widths[i];
- }
- gc.dispose();
- if (totalWidth < (area.width - borderLeft - borderRight) ) {
- topTabIndex = 0;
- } else {
-
- int oldAverageWidth = 0;
- int averageWidth = (area.width - borderLeft - borderRight) / items.length;
- while (averageWidth > oldAverageWidth) {
- int width = area.width - borderLeft - borderRight;
- int count = items.length;
- for (int i = 0; i < items.length; i++) {
- if (widths[i] < averageWidth) {
- width -= widths[i];
- count--;
- }
- }
- oldAverageWidth = averageWidth;
- if (count > 0) {
- averageWidth = width / count;
- }
- }
- if (averageWidth > MIN_TAB_WIDTH * tabHeight) {
- for (int i = 0; i < items.length; i++) {
- if (widths[i] > averageWidth) {
- widths[i] = averageWidth;
- }
- }
- topTabIndex = 0;
- shortenedTabs = true;
- }
- }
- int x = area.x;
- int y = area.y + borderTop;
- if (onBottom) {
- y = Math.max(0, area.y + area.height - borderBottom - tabHeight);
- }
- for (int i = topTabIndex - 1; i>=0; i--) {
- // if the first visible tab is not the first tab
- CTabItem tab = items[i];
- tab.width = widths[i];
- tab.height = getTabHeight();
- x -= tab.width;
- // layout tab items from right to left thus making them invisible
- tab.x = x;
- tab.y = y;
- }
-
- x = area.x + borderLeft;
- for (int i=topTabIndex; i<items.length; i++) {
- // continue laying out remaining, visible items left to right
- CTabItem tab = items[i];
- tab.x = x;
- tab.y = y;
- tab.height = tabHeight;
- tab.width = widths[i];
- x = x + tab.width;
- }
- }
-
- xClient = area.x + borderLeft + marginWidth;
- if (onBottom) {
- yClient = area.y + borderTop + marginHeight;
- } else {
- yClient = area.y + borderTop + tabHeight + 1 + marginHeight;
- // +1 is for the line at the bottom of the tabs
- }
-
- // resize the scrollbar and close butotns
- layoutButtons();
-}
-boolean onMnemonic (Event event) {
- char key = event.character;
- for (int i = 0; i < items.length; i++) {
- if (items[i] != null) {
- char mnemonic = getMnemonic (items[i].getText ());
- if (mnemonic != '\0') {
- if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) {
- setSelection(i, true);
- return true;
- }
- }
- }
- }
- return false;
-}
-/**
- * Paint the receiver.
- */
-private void onPaint(Event event) {
- GC gc = event.gc;
- Rectangle rect = super.getClientArea();
- if (items.length == 0) {
-
- if (showBorders) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(rect.x + borderRight,
- rect.y + borderBottom,
- rect.x + rect.width - borderRight - 1,
- rect.y + rect.height - borderBottom - 1);
- // fill in top and left edge with parent's background color
- gc.setBackground(getParent().getBackground());
- gc.fillRectangle(rect.x, rect.y, borderRight, rect.height);
- gc.fillRectangle(rect.x, rect.y, rect.width, borderBottom);
-
- }
- int tabHeight = getTabHeight();
- if (tabHeight > 0) {
- int y = rect.y + borderBottom + tabHeight;
- if (onBottom) {
- y = rect.y + rect.height - tabHeight - 1;
- }
- gc.setForeground(borderColor1);
- gc.drawLine(rect.x + borderRight, y, rect.x + rect.width, y);
- }
- gc.setForeground(getForeground());
- gc.setBackground(getBackground());
- return;
- }
-
- // redraw the Border
- drawBorder(gc);
-
- rect.x += borderLeft;
- rect.y += borderTop;
- rect.width -= borderLeft + borderRight;
- rect.height -= borderTop + borderBottom;
- gc.setClipping(rect);
-
- // Draw the unselected tabs first.
- for (int i=0; i < items.length; i++) {
- if (i != selectedIndex && event.getBounds().intersects(items[i].getBounds())) {
- items[i].onPaint(gc, false);
- }
- }
- // Selected tab comes last
- if (selectedIndex != -1) {
- items[selectedIndex].onPaint(gc, true);
- }
-
- // draw insertion mark
- if (insertionIndex > -2) {
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
- if (insertionIndex == -1) {
- Rectangle bounds = items[0].getBounds();
- gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
- gc.drawLine(bounds.x - 2, bounds.y, bounds.x + 2, bounds.y);
- gc.drawLine(bounds.x - 1, bounds.y + 1, bounds.x + 1, bounds.y + 1);
- gc.drawLine(bounds.x - 1, bounds.y + bounds.height - 2, bounds.x + 1, bounds.y + bounds.height - 2);
- gc.drawLine(bounds.x - 2, bounds.y + bounds.height - 1, bounds.x + 2, bounds.y + bounds.height - 1);
-
- } else {
- Rectangle bounds = items[insertionIndex].getBounds();
- gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height - 1);
- gc.drawLine(bounds.x + bounds.width - 2, bounds.y, bounds.x + bounds.width + 2, bounds.y);
- gc.drawLine(bounds.x + bounds.width - 1, bounds.y + 1, bounds.x + bounds.width + 1, bounds.y + 1);
- gc.drawLine(bounds.x + bounds.width - 1, bounds.y + bounds.height - 2, bounds.x + bounds.width + 1, bounds.y + bounds.height - 2);
- gc.drawLine(bounds.x + bounds.width - 2, bounds.y + bounds.height - 1, bounds.x + bounds.width + 2, bounds.y + bounds.height - 1);
- }
- }
-
- gc.setForeground(getForeground());
- gc.setBackground(getBackground());
-}
-private void redrawTabArea(int index) {
- int x = 0, y = 0, width = 0, height = 0;
- if (index == -1) {
- Rectangle area = super.getClientArea();
- if (area.width == 0 || area.height == 0) return;
- width = area.x + area.width - borderLeft - borderRight;
- height = getTabHeight() + 1; // +1 causes top line between content and tabs to be redrawn
- x = area.x + borderLeft;
- y = area.y + borderTop;
- if (onBottom) {
- y = Math.max(0, area.y + area.height - borderBottom - height);
- }
- } else {
- CTabItem item = items[index];
- x = item.x;
- y = item.y;
- Rectangle area = super.getClientArea();
- width = area.x + area.width - x;
- height = item.height;
- }
- redraw(x, y, width, height, false);
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeCTabFolderListener(CTabFolderListener listener) {
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (tabListeners.length == 0) return;
- int index = -1;
- for (int i = 0; i < tabListeners.length; i++) {
- if (listener == tabListeners[i]){
- index = i;
- break;
- }
- }
- if (index == -1) return;
- if (tabListeners.length == 1) {
- tabListeners = new CTabFolderListener[0];
- showClose = false;
- return;
- }
- CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length - 1];
- System.arraycopy(tabListeners, 0, newTabListeners, 0, index);
- System.arraycopy(tabListeners, index + 1, newTabListeners, index, tabListeners.length - index - 1);
- tabListeners = newTabListeners;
-}
-
-/**
- * The widget was resized. Adjust the size of the currently selected page.
- */
-private void onResize() {
-
- if (items.length == 0) {
- redraw();
- return;
- }
-
- Rectangle area = super.getClientArea();
- if (oldArea == null || oldArea.width == 0 || oldArea.height == 0) {
- layoutItems();
- redraw();
- } else {
- if (onBottom && oldArea.height != area.height){
- // move tabs up or down if tabs on bottom
- layoutItems();
- redraw();
- } else {
- int width = 0;
- if (oldArea.width < area.width) {
- width = area.width - oldArea.width + borderRight;
- } else if (oldArea.width > area.width) {
- width = borderRight;
- }
- redraw(area.x + area.width - width, area.y, width, area.height, false);
-
- int height = 0;
- if (oldArea.height < area.height) {
- height = area.height - oldArea.height + borderBottom;
- }
- if (oldArea.height > area.height) {
- height = borderBottom;
- }
- redraw(area.x, area.y + area.height - height, area.width, height, false);
-
- if (oldArea.width != area.width) {
- // resize the widths so that all tabs are visible
- layoutItems();
- redrawTabArea(-1);
- }
- }
- }
- oldArea = area;
-
- // resize content
- if (selectedIndex != -1) {
- Control control = items[selectedIndex].getControl();
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- }
- }
-}
-
-public void setBackground (Color color) {
- super.setBackground(color);
- color = getBackground();
-
- // init inactive close button
- inactiveCloseBar.setBackground(color);
-
- // init scroll buttons
- arrowBar.setBackground(color);
-
- // init close button
- if (gradientColors == null) {
- closeBar.setBackground(color);
- }
-}
-/**
- * Specify a gradiant of colours to be draw in the background of the selected tab.
- * For example to draw a gradiant that varies from dark blue to blue and then to
- * white, use the following call to setBackground:
- * <pre>
- * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
- * display.getSystemColor(SWT.COLOR_BLUE),
- * display.getSystemColor(SWT.COLOR_WHITE),
- * display.getSystemColor(SWT.COLOR_WHITE)},
- * new int[] {25, 50, 100});
- * </pre>
- *
- * @param colors an array of Color that specifies the colors to appear in the gradiant
- * in order of appearance left to right. The value <code>null</code> clears the
- * background gradiant. The value <code>null</code> can be used inside the array of
- * Color to specify the background color.
- * @param percents an array of integers between 0 and 100 specifying the percent of the width
- * of the widget at which the color should change. The size of the percents array must be one
- * less than the size of the colors array.
- */
-
-public void setSelectionBackground(Color[] colors, int[] percents) {
- if (colors != null) {
- if (percents == null || percents.length != colors.length - 1) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (getDisplay().getDepth() < 15) {
- // Don't use gradients on low color displays
- colors = new Color[] { colors[0] };
- percents = new int[] { };
- }
- for (int i = 0; i < percents.length; i++) {
- if (percents[i] < 0 || percents[i] > 100) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (i > 0 && percents[i] < percents[i-1]) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
- }
-
- // Are these settings the same as before?
- final Color background = getBackground();
- if (backgroundImage == null) {
- if ((gradientColors != null) && (colors != null) &&
- (gradientColors.length == colors.length)) {
- boolean same = false;
- for (int i = 0; i < gradientColors.length; i++) {
- same = (gradientColors[i] == colors[i]) ||
- ((gradientColors[i] == null) && (colors[i] == background)) ||
- ((gradientColors[i] == background) && (colors[i] == null));
- if (!same) break;
- }
- if (same) {
- for (int i = 0; i < gradientPercents.length; i++) {
- same = gradientPercents[i] == percents[i];
- if (!same) break;
- }
- }
- if (same) return;
- }
- } else {
- backgroundImage = null;
- }
- // Store the new settings
- if (colors == null) {
- gradientColors = null;
- gradientPercents = null;
- closeBar.setBackground(background);
- } else {
- gradientColors = new Color[colors.length];
- for (int i = 0; i < colors.length; ++i)
- gradientColors[i] = (colors[i] != null) ? colors[i] : background;
- gradientPercents = new int[percents.length];
- for (int i = 0; i < percents.length; ++i)
- gradientPercents[i] = percents[i];
- if (getDisplay().getDepth() < 15) closeBar.setBackground(background);
- else closeBar.setBackground(gradientColors[gradientColors.length - 1]);
- }
-
- // Refresh with the new settings
- if (selectedIndex > -1) redrawTabArea(selectedIndex);
-}
-public void setSelectionBackground(Image image) {
- if (image == backgroundImage) return;
- gradientColors = null;
- gradientPercents = null;
- backgroundImage = image;
- redrawTabArea(selectedIndex);
-}
-public void setBorderVisible(boolean show) {
- if (showBorders == show) return;
-
- showBorders = show;
- if (showBorders) {
- if ((getStyle() & SWT.FLAT) != 0) {
- borderBottom = borderTop = borderLeft = borderRight = 1;
- } else {
- borderLeft = borderTop = 1;
- borderRight = borderBottom = 3;
- }
- } else {
- borderBottom = borderTop = borderLeft = borderRight = 0;
- }
- onClientAreaChange();
-}
-public void setFont(Font font) {
- if (font != null && font.equals(getFont())) return;
- int oldHeight = getTabHeight();
- super.setFont(font);
- if (oldHeight != getTabHeight()){
- onClientAreaChange();
- } else {
- layoutItems();
- redraw();
- }
-}
-public void setSelectionForeground (Color color) {
- if (selectionForeground == color) return;
- if (color == null) color = getForeground();
- selectionForeground = color;
- if (selectedIndex > -1) {
- redrawTabArea(selectedIndex);
- }
-}
-public void setInsertMark(CTabItem item, boolean after) {
- int index = -1;
- if (item != null) {
- index = indexOf(item);
- }
- setInsertMark(index, after);
-}
-public void setInsertMark(int index, boolean after) {
- if (index < -1 || index >= getItemCount()) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (index == -1) {
- index = -2;
- } else {
- index = after ? index : --index;
- }
-
- if (insertionIndex == index) return;
- int oldIndex = insertionIndex;
- insertionIndex = index;
- if (index > -1) redrawTabArea(index);
- if (oldIndex > 1) redrawTabArea(oldIndex);
-}
-
-/**
- * Set the selection to the tab at the specified index.
- */
-public void setSelection(int index) {
- if (index < 0 || index >= items.length) return;
- if (selectedIndex == index) return;
-
- if (showClose) {
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
- if (arrowBar.isVisible()) {
- Rectangle arrowRect = arrowBar.getBounds();
- arrowRect.width += borderRight;
- closeBar.setVisible(!arrowRect.contains(closeBar.getLocation()));
- } else {
- closeBar.setVisible(true);
- }
- }
-
- int oldIndex = selectedIndex;
- selectedIndex = index;
-
- Control control = items[index].control;
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- control.setVisible(true);
- }
-
- if (oldIndex != -1) {
- control = items[oldIndex].control;
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- }
- ensureVisible();
-
- redrawTabArea(-1);
-}
-private void ensureVisible() {
- if (selectedIndex == -1) return;
- // make sure selected item is visible
- Rectangle area = super.getClientArea();
- if (area.width == 0) return;
- int areaWidth = area.x + area.width - borderRight;
-
- CTabItem tabItem = items[selectedIndex];
- if (selectedIndex < topTabIndex) {
- topTabIndex = selectedIndex;
- }
- layoutItems();
-
- int scrollWidth = arrowBar.getSize().x;
- int width = areaWidth;
- if (scroll_leftVisible() || scroll_rightVisible()) {
- width -= scrollWidth;
- }
- while (tabItem.x + tabItem.width > width && selectedIndex != topTabIndex) {
- topTabIndex++;
- layoutItems();
- width = areaWidth;
- if (scroll_leftVisible() || scroll_rightVisible()) {
- width -= scrollWidth;
- }
- }
-}
-
-char getMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while ((index < length) && (string.charAt (index) != '&')) index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != '&') return string.charAt (index);
- index++;
- } while (index < length);
- return '\0';
-}
-/**
- * Set the selection to the specified item.
- */
-public void setSelection(CTabItem item) {
- if (item == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int index = indexOf(item);
- setSelection(index);
-}
-/**
- * Set the selection to the tab at the specified index.
- */
-private void setSelection(int index, boolean notify) {
- int oldSelectedIndex = selectedIndex;
- setSelection(index);
- if (notify && selectedIndex != oldSelectedIndex && selectedIndex != -1) {
- Event event = new Event();
- event.item = getItem(selectedIndex);
- notifyListeners(SWT.Selection, event);
- }
-}
-
-private void updateCloseBar() {
- int imageHeight = getTabHeight() - CTabItem.TOP_MARGIN - CTabItem.BOTTOM_MARGIN - 6;
- if (imageHeight < 4) return;
-
- if (closeImage != null && closeImage.getBounds().height == imageHeight) return;
-
- if (closeBar != null) closeBar.dispose();
- closeBar = null;
- if (inactiveCloseBar != null) inactiveCloseBar.dispose();
- inactiveCloseBar = null;
- createCloseBar();
-
- ToolItem closeItem = closeBar.getItems()[0];
- ToolItem inactiveCloseItem = inactiveCloseBar.getItems()[0];
-
- if (closeImage != null) closeImage.dispose();
-
- Display display = getDisplay();
- Color foreground = getForeground();
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color background = getBackground();
-
- PaletteData palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), black.getRGB()});
- ImageData imageData = new ImageData(imageHeight, imageHeight, 4, palette);
- imageData.transparentPixel = 1;
- closeImage = new Image(display, imageData);
- GC gc = new GC(closeImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, imageHeight, imageHeight);
- gc.setForeground(black);
-
- int h = (imageHeight /2 )* 2;
- gc.drawLine( 0, 0, h - 2, h - 2);
- gc.drawLine( 1, 0, h - 1, h - 2);
- gc.drawLine( 0, h - 2, h - 2, 0);
- gc.drawLine( 1, h - 2, h - 1, 0);
-
- gc.dispose();
-
- closeItem.setImage(closeImage);
- inactiveCloseItem.setImage(closeImage);
-}
-private void updateArrowBar() {
-
- int imageHeight = getTabHeight() - CTabItem.TOP_MARGIN - CTabItem.BOTTOM_MARGIN - 6;
- if (imageHeight < 4) return;
-
- if (arrowLeftImage != null && arrowLeftImage.getBounds().height == imageHeight) return;
-
- if (arrowBar != null) arrowBar.dispose();
- arrowBar = null;
- if (arrowLeftImage != null) arrowLeftImage.dispose();
- if (arrowRightImage != null) arrowRightImage.dispose();
-
- createArrowBar();
- ToolItem[] items = arrowBar.getItems();
- ToolItem left = items[0];
- ToolItem right = items[1];
-
- Display display = getDisplay();
- Color foreground = getForeground();
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color background = getBackground();
-
- PaletteData palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), black.getRGB()});
- ImageData imageData = new ImageData(imageHeight, imageHeight, 4, palette);
- imageData.transparentPixel = 1;
- arrowLeftImage = new Image(display, imageData);
- GC gc = new GC(arrowLeftImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, imageHeight, imageHeight);
- gc.setBackground(black);
- int indent = 0;
- int midpoint = (imageHeight - 2*indent)/2;
- int height = 2 * midpoint;
- int[] pointArr = new int[] {indent, indent + midpoint,
- indent + height, indent,
- indent + height, indent + height};
- gc.fillPolygon(pointArr);
- gc.dispose();
-
- palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), black.getRGB()});
- imageData = new ImageData(imageHeight, imageHeight, 4, palette);
- imageData.transparentPixel = 1;
- arrowRightImage = new Image(display, imageData);
- gc = new GC(arrowRightImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, imageHeight, imageHeight);
- gc.setBackground(black);
- pointArr = new int[] {indent, indent,
- indent, indent + height,
- indent + height, indent + midpoint};
- gc.fillPolygon(pointArr);
- gc.dispose();
-
- left.setImage(arrowLeftImage);
- right.setImage(arrowRightImage);
-}
-
-private void onMouseDoubleClick(Event event) {
- Event e = new Event();
- e.item = getItem(new Point(event.x, event.y));
- notifyListeners(SWT.DefaultSelection, e);
-}
-/**
- * A mouse button was pressed down.
- * If one of the tab scroll buttons was hit, scroll in the appropriate
- * direction.
- * If a tab was hit select the tab.
- */
-private void onMouseDown(Event event) {
- for (int i=0; i<items.length; i++) {
- if (items[i].getBounds().contains(new Point(event.x, event.y))) {
- setSelection(i, true);
- return;
- }
- }
-}
-
-private void onMouseExit(Event event) {
- Rectangle inactiveBounds = inactiveCloseBar.getBounds();
- if (inactiveBounds.contains(event.x, event.y)) return;
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
-
- if (!tip.isDisposed() && tip.isVisible()) tip.setVisible(false);
-}
-
-private void onMouseHover(Event event) {
- if (tip.isDisposed()) return;
- Point pt = new Point (event.x, event.y);
- CTabItem item = getItem(pt);
- if (item != null) {
- String tooltip = item.getToolTipText();
- if (tooltip != null) {
- Label label = (Label) (tip.getChildren() [0]);
- label.setText(tooltip);
- tip.pack();
- pt.y += 16;
- pt = toDisplay(pt);
- /*
- * Ensure that the tooltip is on the screen.
- */
- Display display = tip.getDisplay();
- Rectangle rect = display.getBounds();
- Point size = tip.getSize();
- pt.x = Math.max (0, Math.min (pt.x, rect.width - size.x));
- pt.y = Math.max (0, Math.min (pt.y, rect.height - size.y));
- tip.setLocation(pt);
-
- tip.setVisible(true);
- return;
- }
- }
-
- tip.setVisible(false);
-}
-
-private void onMouseMove(Event event) {
- if (!showClose) return;
-
- CTabItem item = null;
- for (int i=0; i<items.length; i++) {
- Rectangle rect = items[i].getBounds();
- if (rect.contains(new Point(event.x, event.y))) {
- item = items[i];
- break;
- }
- }
- if (item == inactiveItem) return;
-
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
-
- if (item == null || item == getSelection()) return;
-
- int toolbarHeight = getTabHeight() - CTabItem.TOP_MARGIN - CTabItem.BOTTOM_MARGIN + 2; // +2 to ignore gab between focus rectangle
- int x = item.x + item.width - toolbarHeight;
- int y = item.y + Math.max(0, (item.height - toolbarHeight)/2);
-
- if (arrowBar.isVisible()) {
- Rectangle scrollArea = arrowBar.getBounds();
- scrollArea.width += borderRight;
- if (scrollArea.contains(x, y)) return;
- }
-
- inactiveCloseBar.setBounds(x, y, toolbarHeight,toolbarHeight);
- inactiveCloseBar.setVisible(true);
- inactiveItem = item;
-}
-private void onTraverse (Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- event.doit = true;
- break;
- case SWT.TRAVERSE_MNEMONIC:
- event.doit = onMnemonic(event);
- if (event.doit) event.detail = SWT.TRAVERSE_NONE;
- break;
- case SWT.TRAVERSE_PAGE_NEXT:
- case SWT.TRAVERSE_PAGE_PREVIOUS:
- event.doit = onPageTraversal(event);
- if (event.doit) event.detail = SWT.TRAVERSE_NONE;
- break;
- }
-}
-
-private boolean onPageTraversal(Event event) {
- int count = getItemCount ();
- if (count == 0) return false;
- int index = getSelectionIndex ();
- if (index == -1) {
- index = 0;
- } else {
- int offset = (event.detail == SWT.TRAVERSE_PAGE_NEXT) ? 1 : -1;
- index = (index + offset + count) % count;
- }
- setSelection (index, true);
- return true;
-}
-/**
- * Answer the area where the left scroll button is drawn.
- */
-private Rectangle scroll_getBounds() {
- if (arrowBar != null)
- return arrowBar.getBounds();
- return new Rectangle(0, 0, 0, 0);
-}
-
-/**
- * Answer true if not all tabs can be visible in the receive
- * thus requiring the scroll buttons to be visible.
- */
-private boolean scroll_leftVisible() {
- return topTabIndex > 0;
-}
-
-/**
- * Answer true if not all tabs can be visible in the receive
- * thus requiring the scroll buttons to be visible.
- */
-private boolean scroll_rightVisible() {
- if (topTabIndex < items.length - 1) {
- // only show Scroll buttons if there is more than one item
- // and if we are not alread at the last item
- CTabItem tabItem = items[items.length-1];
- int tabStopX = tabItem.x + tabItem.width;
- Rectangle area = super.getClientArea();
- if (tabStopX > area.x + area.width - borderRight) {
- return true; // not all tabs fit in the client area
- }
- }
- return false;
-}
-
-/**
- * Scroll the tab items to the left.
- */
-private void scroll_scrollLeft() {
- if (scroll_leftVisible()) {
- --topTabIndex;
- layoutItems();
- redrawTabArea(-1);
- }
-}
-
-/**
- * Scroll the tab items to the right.
- */
-private void scroll_scrollRight() {
- if (scroll_rightVisible()) {
- topTabIndex++;
- layoutItems();
- redrawTabArea(-1);
- }
-}
-public void setTabHeight(int height) {
- if (height < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (fixedTabHeight == height) return;
- fixedTabHeight = height;
- onClientAreaChange();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderAdapter.java
deleted file mode 100755
index 1b72804de7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderAdapter.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class CTabFolderAdapter implements CTabFolderListener {
- public void itemClosed(CTabFolderEvent event){};
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderEvent.java
deleted file mode 100755
index c19ecfc43d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderEvent.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.widgets.*;
-
-public class CTabFolderEvent extends TypedEvent {
- public Widget item;
- public boolean doit;
-
-CTabFolderEvent(Widget w) {
- super(w);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderListener.java
deleted file mode 100755
index cfc10a8796..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderListener.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public interface CTabFolderListener {
- public void itemClosed(CTabFolderEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
deleted file mode 100755
index 265df47d86..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class CTabItem extends Item {
- CTabFolder parent;
- int x,y,width,height = 0;
- String toolTipText;
- Control control; // the tab page
-
- private Image disabledImage;
-
- // internal constants
- static final int LEFT_MARGIN = 4;
- static final int RIGHT_MARGIN = 4;
- static final int TOP_MARGIN = 3;
- static final int BOTTOM_MARGIN = 3;
- private static final int INTERNAL_SPACING = 2;
-
- private static final String ellipsis = "...";
-
-/**
- * Construct a CTabItem with the specified parent and style.
- */
-public CTabItem (CTabFolder parent, int style) {
- this(parent, style, parent.getItemCount());
-}
-/**
- * Construct a CTabItem with the specified parent and style, inserted at
- * the specified index.
- */
-public CTabItem (CTabFolder parent, int style, int index) {
- super (parent, checkStyle(style));
- parent.createItem (this, index);
-}
-private static int checkStyle(int style) {
- return SWT.NONE;
-}
-
-public void dispose () {
- if (isDisposed()) return;
- super.dispose();
- parent.destroyItem(this);
- parent = null;
- control = null;
- toolTipText = null;
-}
-
-/**
- * Return the bounds of the CTabItem.
- */
-public Rectangle getBounds () {
- return new Rectangle(x, y, width, height);
-}
-/**
-* Gets the control.
-* <p>
-* @return the control
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public Control getControl () {
- return control;
-}
-/**
- * Answer the display of the receiver's parent widget.
- */
-public Display getDisplay() {
- if (parent == null) SWT.error(SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay();
-}
-public Image getDisabledImage(){
- return disabledImage;
-}
-/**
- * Return the parent of the CTabItem.
- */
-public CTabFolder getParent () {
- return parent;
-}
-/**
- * Gets the tool tip text.
- * <p>
- * @return the tool tip text.
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
-public String getToolTipText () {
- return toolTipText;
-}
-/**
- * Paint the receiver.
- */
-void onPaint(GC gc, boolean isSelected) {
-
- if (width == 0 || height == 0) return;
-
- Display display = getDisplay();
- Color highlightShadow = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- Color normalShadow = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
-
- int index = parent.indexOf(this);
-
- if (isSelected) {
-
- Rectangle bounds = null;
- if (!parent.onBottom) {
- if (index == parent.topTabIndex) {
- bounds = new Rectangle(x + 1, y + 1, width - 2, height - 1);
- } else {
- bounds = new Rectangle(x + 2, y + 1, width - 3, height - 1);
- }
- } else {
- if (index == parent.topTabIndex) {
- bounds = new Rectangle(x + 1, y + 1, width - 2, height - 2);
- } else {
- bounds = new Rectangle(x + 2, y + 1, width - 3, height - 2);
- }
- }
- if (parent.backgroundImage != null) {
- // draw a background image behind the text
- Rectangle imageRect = parent.backgroundImage.getBounds();
- gc.drawImage(parent.backgroundImage, 0, 0, imageRect.width, imageRect.height,
- bounds.x, bounds.y, bounds.width, bounds.height);
- } else if (parent.gradientColors != null) {
- // draw a gradient behind the text
- Color oldBackground = gc.getBackground();
- if (parent.gradientColors.length == 1) {
- if (parent.gradientColors[0] != null) gc.setBackground(parent.gradientColors[0]);
- gc.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
- } else {
- Color oldForeground = gc.getForeground();
- Color lastColor = parent.gradientColors[0];
- if (lastColor == null) lastColor = oldBackground;
- for (int i = 0, pos = 0; i < parent.gradientPercents.length; ++i) {
- gc.setForeground(lastColor);
- lastColor = parent.gradientColors[i + 1];
- if (lastColor == null) lastColor = oldBackground;
- gc.setBackground(lastColor);
- int gradientWidth = (parent.gradientPercents[i] * bounds.width / 100) - pos;
- gc.fillGradientRectangle(bounds.x + pos, bounds.y, gradientWidth, bounds.height, false);
- pos += gradientWidth;
- }
- gc.setForeground(oldForeground);
- }
- gc.setBackground(oldBackground);
- }
-
- // draw tab lines
- if (!parent.onBottom) {
- gc.setForeground(normalShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + 1, y);
- gc.drawLine(x, y + 1, x, y + height - 2);
- gc.drawLine(x, y + height - 1, x, y + height - 1);
- }
- gc.drawLine(x + width - 1, y, x + width - 1, y);
- gc.drawLine(x + width, y + 1, x + width, y + height - 2);
- gc.drawLine(x + width, y + height - 1, x + width, y + height - 1);
-
- gc.setForeground(highlightShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 2, y, x + 2, y);
- gc.drawLine(x + 1, y + 1, x + 1, y + height - 2);
- gc.drawLine(x + 1, y + height - 1, x + 1, y + height - 1);
- } else {
- gc.drawLine(x, y, x, y + height - 1);
- }
-
- gc.drawLine(x + width - 2, y, x + width - 2, y);
- gc.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
- gc.drawLine(x + width - 1, y + height - 1, x + width - 1, y + height - 1);
-
- // light line across top
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 3, y, x + width - 3, y);
- } else {
- gc.drawLine(x + 1, y, x + width - 3, y);
- }
- } else {
- gc.setForeground(normalShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x, y, x, y);
- gc.drawLine(x, y + 1, x, y + height - 2);
- gc.drawLine(x + 1, y + height - 1, x + 1, y + height - 1);
- }
- gc.drawLine(x + width, y, x + width, y);
- gc.drawLine(x + width, y + 1, x + width, y + height - 2);
- gc.drawLine(x + width - 1, y + height - 1, x + width - 1, y + height - 1);
-
- gc.setForeground(highlightShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + 1, y);
- gc.drawLine(x + 1, y + 1, x + 1, y + height - 2);
- gc.drawLine(x + 2, y + height - 1, x + 2, y + height - 1);
- } else {
- gc.drawLine(x, y, x, y + height - 1);
- }
-
- gc.drawLine(x + width - 1, y, x + width - 1, y);
- gc.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
- gc.drawLine(x + width - 2, y + height - 1, x + width - 2, y + height - 1);
-
- // light line across top and bottom
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + width - 2, y);
- gc.drawLine(x + 2, y + height - 1, x + width - 3, y + height - 1);
- } else {
- gc.drawLine(x + 1, y, x + width - 2, y);
- gc.drawLine(x + 1, y + height - 1, x + width - 3, y + height - 1);
- }
- }
- if (parent.isFocusControl()) {
- // draw a focus rectangle
- int x1, y1, width1, height1;
- if (!parent.onBottom) {
- if (index == parent.topTabIndex) {
- x1 = x + 1; y1 = y + 1; width1 = width - 2; height1 = height - 1;
- } else {
- x1 = x + 2; y1 = y + 1; width1 = width - 3; height1 = height - 1;
- }
- } else {
- if (index == parent.topTabIndex) {
- x1 = x + 1; y1 = y + 1; width1 = width - 2; height1 = height - 2;
- } else {
- x1 = x + 2; y1 = y + 1; width1 = width - 3; height1 = height - 2;
- }
- }
- gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.drawFocus(x1, y1, width1, height1);
- }
- } else {
- // draw tab lines for unselected items
- gc.setForeground(normalShadow);
- if (!parent.onBottom) {
- if (index != parent.topTabIndex && index != parent.getSelectionIndex() + 1) {
- gc.drawLine(x, y, x, y + (height / 2));
- }
- } else {
- if (index != parent.topTabIndex && index != parent.getSelectionIndex() + 1) {
- gc.drawLine(x, y + (height / 2), x, y + height - 1);
- }
- }
-
- }
-
- // draw Image
- int xDraw = x + LEFT_MARGIN;
-
- Image image = getImage();
- if (!isSelected && image != null) {
- Image temp = getDisabledImage();
- if (temp != null){
- image = temp;
- }
- }
- if (image != null) {
- Rectangle imageBounds = image.getBounds();
- int imageX = xDraw;
- int imageHeight = Math.min(height - BOTTOM_MARGIN - TOP_MARGIN, imageBounds.height);
- int imageY = y + (height - imageHeight) / 2;
- int imageWidth = imageBounds.width * imageHeight / imageBounds.height;
- gc.drawImage(image,
- imageBounds.x, imageBounds.y, imageBounds.width, imageBounds.height,
- imageX, imageY, imageWidth, imageHeight);
- xDraw += imageWidth + INTERNAL_SPACING;
- }
-
- // draw Text
- int textWidth = x + width - xDraw - RIGHT_MARGIN;
- if (isSelected && parent.showClose) {
- textWidth = x + width - xDraw - parent.closeBar.getSize().x - RIGHT_MARGIN;
- }
- String text = shortenText(gc, getText(), textWidth);
-
- if (isSelected && parent.selectionForeground != null) {
- gc.setForeground(parent.selectionForeground);
- } else {
- gc.setForeground(parent.getForeground());
- }
- int textY = y + (height - gc.textExtent(text, SWT.DRAW_MNEMONIC).y) / 2;
- gc.drawText(text, xDraw, textY, SWT.DRAW_TRANSPARENT | SWT.DRAW_MNEMONIC);
-
- gc.setForeground(parent.getForeground());
-}
-private static String shortenText(GC gc, String text, int width) {
- if (gc.textExtent(text, SWT.DRAW_MNEMONIC).x <= width) return text;
-
- int ellipseWidth = gc.textExtent(ellipsis, SWT.DRAW_MNEMONIC).x;
- int length = text.length();
- int end = length - 1;
- while (end > 0) {
- text = text.substring(0, end);
- int l1 = gc.textExtent(text, SWT.DRAW_MNEMONIC).x;
- if (l1 + ellipseWidth <= width) {
- return text + ellipsis;
- }
- end--;
- }
- return "";
-}
-/**
- * Answer the preferred height of the receiver for the GC.
- */
-int preferredHeight(GC gc) {
- Image image = getImage();
- int height = 0;
- if (image != null) height = image.getBounds().height;
- String text = getText();
- height = Math.max(height, gc.textExtent(text, SWT.DRAW_MNEMONIC).y);
- return height + TOP_MARGIN + BOTTOM_MARGIN;
-}
-/**
- * Answer the preferred width of the receiver for the GC.
- */
-int preferredWidth(GC gc) {
- int width = 0;
- Image image = getImage();
- if (image != null) width += image.getBounds().width;
- String text = getText();
- if (text != null) {
- if (image != null) width += INTERNAL_SPACING;
- width += gc.textExtent(text, SWT.DRAW_MNEMONIC).x;
- }
- if (parent.showClose) width += INTERNAL_SPACING + preferredHeight(gc); // closebar will be square and will fill preferred height
- return width + LEFT_MARGIN + RIGHT_MARGIN;
-}
-/**
- * Sets the control.
- * <p>
- * @param control the new control
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
-public void setControl (Control control) {
- if (control != null && control.getParent() != parent) {
- SWT.error (SWT.ERROR_INVALID_PARENT);
- }
- if (this.control != null && !this.control.isDisposed()) {
- this.control.setVisible(false);
- }
-
- this.control = control;
- if (this.control != null) {
- int index = parent.indexOf (this);
- if (index == parent.getSelectionIndex ()){
- this.control.setBounds(parent.getClientArea ());
- this.control.setVisible(true);
- } else {
- this.control.setVisible(false);
- }
- }
-}
-/**
- * Sets the image.
- * <p>
- * @param image the new image (or null)
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
-public void setImage (Image image) {
- if (image != null && image.equals(getImage())) return;
- int oldHeight = parent.getTabHeight();
- super.setImage(image);
- if (oldHeight != parent.getTabHeight()) {
- parent.onClientAreaChange();
- } else {
- parent.layoutItems();
- parent.redraw();
- }
-}
-public void setDisabledImage (Image image) {
- if (image != null && image.equals(getDisabledImage())) return;
- disabledImage = image;
- parent.redraw();
-}
-
-/**
- * Set the widget text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters but must not contain line delimiters.
- *
- * @param string the new label for the widget
- *
- */
-public void setText (String string) {
- if (string.equals(getText())) return;
- super.setText(string);
- parent.layoutItems();
- parent.redraw();
-}
-
-/**
- * Sets the tool tip text.
- * <p>
- * @param string the new tool tip text (or null)
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
-public void setToolTipText (String string) {
- toolTipText = string;
-}
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ControlEditor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ControlEditor.java
deleted file mode 100755
index 9dfd02a16d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ControlEditor.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
-*
-* A ControlEditor is a manager for a Control that appears above a composite and tracks with the
-* moving and resizing of that composite. It can be used to display one control above
-* another control. This could be used when editing a control that does not have editing
-* capabilities by using a text editor or for launching a dialog by placing a button
-* above a control.
-*
-* <p> Here is an example of using a ControlEditor:
-*
-* <code><pre>
-* Canvas canvas = new Canvas(shell, SWT.BORDER);
-* canvas.setBounds(10, 10, 300, 300);
-* Color color = new Color(null, 255, 0, 0);
-* canvas.setBackground(color);
-* ControlEditor editor = new ControlEditor (canvas);
-* // The editor will be a button in the bottom right corner of the canvas.
-* // When selected, it will launch a Color dialog that will change the background
-* // of the canvas.
-* Button button = new Button(canvas, SWT.PUSH);
-* button.setText("Select Color...");
-* button.addSelectionListener (new SelectionAdapter() {
-* public void widgetSelected(SelectionEvent e) {
-* ColorDialog dialog = new ColorDialog(shell);
-* dialog.open();
-* RGB rgb = dialog.getRGB();
-* if (rgb != null) {
-* if (color != null) color.dispose();
-* color = new Color(null, rgb);
-* canvas.setBackground(color);
-* }
-*
-* }
-* });
-*
-* editor.horizontalAlignment = SWT.RIGHT;
-* editor.verticalAlignment = SWT.BOTTOM;
-* editor.grabHorizontal = false;
-* editor.grabVertical = false;
-* Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-* editor.minimumWidth = size.x;
-* editor.minimumHeight = size.y;
-* editor.setEditor (button);
-* </pre></code>
-*/
-public class ControlEditor {
-
- /**
- * Specifies how the editor should be aligned relative to the control. Allowed values
- * are SWT.LEFT, SWT.RIGHT and SWT.CENTER. The default value is SWT.CENTER.
- */
- public int horizontalAlignment = SWT.CENTER;
-
- /**
- * Specifies whether the editor should be sized to use the entire width of the control.
- * True means resize the editor to the same width as the cell. False means do not adjust
- * the width of the editor. The default value is false.
- */
- public boolean grabHorizontal = false;
-
- /**
- * Specifies the minimum width the editor can have. This is used in association with
- * a true value of grabHorizontal. If the cell becomes smaller than the minimumWidth, the
- * editor will not made smaller than the minumum width value. The default value is 0.
- */
- public int minimumWidth = 0;
-
- /**
- * Specifies how the editor should be aligned relative to the control. Allowed values
- * are SWT.TOP, SWT.BOTTOM and SWT.CENTER. The default value is SWT.CENTER.
- */
- public int verticalAlignment = SWT.CENTER;
-
- /**
- * Specifies whether the editor should be sized to use the entire height of the control.
- * True means resize the editor to the same height as the underlying control. False means do not adjust
- * the height of the editor. The default value is false.
- */
- public boolean grabVertical = false;
-
- /**
- * Specifies the minimum height the editor can have. This is used in association with
- * a true value of grabVertical. If the control becomes smaller than the minimumHeight, the
- * editor will not made smaller than the minumum height value. The default value is 0.
- */
- public int minimumHeight = 0;
-
- Composite parent;
- Control editor;
- private boolean hadFocus;
- private Listener internalListener;
-/**
-* Creates a ControlEditor for the specified Composite.
-*
-* @param parent the Composite above which this editor will be displayed
-*
-*/
-public ControlEditor (Composite parent) {
- this.parent = parent;
-
- internalListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.widget instanceof ScrollBar && e.type == SWT.Selection)
- scroll (e);
- else if (e.type == SWT.Resize)
- resize ();
- }
- };
-
- parent.addListener (SWT.Resize, internalListener);
-
- ScrollBar hBar = parent.getHorizontalBar ();
- if (hBar != null) hBar.addListener (SWT.Selection, internalListener);
- ScrollBar vBar = parent.getVerticalBar ();
- if (vBar != null) vBar.addListener (SWT.Selection, internalListener);
-}
-Rectangle computeBounds (){
- Rectangle clientArea = parent.getClientArea();
- Rectangle editorRect = new Rectangle(clientArea.x, clientArea.y, minimumWidth, minimumHeight);
-
- if (grabHorizontal)
- editorRect.width = Math.max(clientArea.width, minimumWidth);
-
- if (grabVertical)
- editorRect.height = Math.max(clientArea.height, minimumHeight);
-
- switch (horizontalAlignment) {
- case SWT.RIGHT:
- editorRect.x += clientArea.width - editorRect.width;
- break;
- case SWT.LEFT:
- // do nothing - clientArea.x is the right answer
- break;
- default:
- // default is CENTER
- editorRect.x += (clientArea.width - editorRect.width)/2;
- }
-
- switch (verticalAlignment) {
- case SWT.BOTTOM:
- editorRect.y += clientArea.height - editorRect.height;
- break;
- case SWT.TOP:
- // do nothing - clientArea.y is the right answer
- break;
- default :
- // default is CENTER
- editorRect.y += (clientArea.height - editorRect.height)/2;
- }
-
-
- return editorRect;
-
-}
-/**
- * Removes all associations between the Editor and the underlying composite. The
- * composite and the editor Control are <b>not</b> disposed.
- */
-public void dispose () {
- if (!parent.isDisposed()) {
- parent.removeListener (SWT.Resize, internalListener);
- ScrollBar hBar = parent.getHorizontalBar ();
- if (hBar != null) hBar.removeListener (SWT.Selection, internalListener);
- ScrollBar vBar = parent.getVerticalBar ();
- if (vBar != null) vBar.removeListener (SWT.Selection, internalListener);
- }
-
- parent = null;
- editor = null;
- hadFocus = false;
- internalListener = null;
-}
-/**
-* Returns the Control that is displayed above the composite being edited.
-*
-* @return the Control that is displayed above the composite being edited
-*/
-public Control getEditor () {
- return editor;
-}
-void resize () {
- if (editor == null || editor.isDisposed()) return;
- if (editor.getVisible ()) {
- hadFocus = editor.isFocusControl();
- } // this doesn't work because
- // resizing the column takes the focus away
- // before we get here
- editor.setBounds (computeBounds ());
- if (hadFocus) editor.setFocus ();
-}
-void scroll (Event e) {
- if (editor == null || editor.isDisposed()) return;
- if (editor.getVisible ()) {
- hadFocus = editor.isFocusControl();
- }
- boolean visible = e.detail != SWT.DRAG;
- if (visible) {
- editor.setBounds (computeBounds ());
- }
- editor.setVisible (visible);
- if (visible && hadFocus) editor.setFocus ();
-}
-/**
-* Specify the Control that is to be displayed.
-*
-* <p>Note: The Control provided as the editor <b>must</b> be created with its parent
-* being the Composite specified in the ControlEditor constructor.
-*
-* @param editor the Control that is displayed above the composite being edited
-*/
-public void setEditor (Control editor) {
-
- if (editor == null) {
- // this is the case where the caller is setting the editor to be blank
- // set all the values accordingly
- this.editor = null;
- return;
- }
-
- this.editor = editor;
-
- editor.setVisible (false);
- editor.setBounds (computeBounds ());
- editor.setVisible (true);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
deleted file mode 100755
index 530b5a1adb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
+++ /dev/null
@@ -1,879 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.Vector;
-
-class DefaultContent implements StyledTextContent {
- private final static String LineDelimiter = System.getProperty("line.separator");
-
- Vector textListeners = new Vector(); // stores text listeners for event sending
- char[] textStore = new char[0]; // stores the actual text
- int gapStart = -1; // the character position start of the gap
- int gapEnd = -1; // the character position after the end of the gap
- int gapLine = -1; // the line on which the gap exists, the gap will always be associated
- // with one line
- int highWatermark = 300;
- int lowWatermark = 50;
-
- int[][] lines = new int[50][2]; // array of character positions and lengths representing
- // the lines of text
- int lineCount = 0; // the number of lines of text
- int expandExp = 1; // the expansion exponent, used to increase the lines array exponentially
- int replaceExpandExp = 1; // the expansion exponent, used to increase the lines array exponentially
-
-/**
- * Creates a new DefaultContent and initializes it. A <code>StyledTextContent</> will always have
- * at least one empty line.
- */
-DefaultContent() {
- super();
- setText("");
-}
-/**
- * Adds a line to the end of the line indexes array. Increases the size of the array if necessary.
- * <code>lineCount</code> is updated to reflect the new entry.
- * <p>
- *
- * @param start the start of the line
- * @param length the length of the line
- */
-void addLineIndex(int start, int length) {
- int size = lines.length;
- if (lineCount == size) {
- // expand the lines by powers of 2
- int[][] newLines = new int[size+Compatibility.pow2(expandExp)][2];
- System.arraycopy(lines, 0, newLines, 0, size);
- lines = newLines;
- expandExp++;
- }
- int[] range = new int[] {start, length};
- lines[lineCount] = range;
- lineCount++;
-}
-/**
- * Adds a line index to the end of <code>linesArray</code>. Increases the
- * size of the array if necessary and returns a new array.
- * <p>
- *
- * @param start the start of the line
- * @param length the length of the line
- * @param linesArray the array to which to add the line index
- * @param count the position at which to add the line
- * @return a new array of line indexes
- */
-int[][] addLineIndex(int start, int length, int[][] linesArray, int count) {
- int size = linesArray.length;
- int[][] newLines = linesArray;
- if (count == size) {
- newLines = new int[size+Compatibility.pow2(replaceExpandExp)][2];
- replaceExpandExp++;
- System.arraycopy(linesArray, 0, newLines, 0, size);
- }
- int[] range = new int[] {start, length};
- newLines[count] = range;
- return newLines;
-}
-/**
- * Adds a <code>TextChangeListener</code> listening for
- * <code>TextChangingEvent</code> and <code>TextChangedEvent</code>. A
- * <code>TextChangingEvent</code> is sent before changes to the text occur.
- * A <code>TextChangedEvent</code> is sent after changes to the text
- * occured.
- * <p>
- *
- * @param listener the listener
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void addTextChangeListener(TextChangeListener listener) {
- if (listener == null) error(SWT.ERROR_NULL_ARGUMENT);
- StyledTextListener typedListener = new StyledTextListener(listener);
- textListeners.addElement(typedListener);
-}
-/**
- * Adjusts the gap to accomodate a text change that is occurring.
- * <p>
- *
- * @param position the position at which a change is occurring
- * @param sizeHint the size of the change
- * @param line the line where the gap will go
- */
-void adjustGap(int position, int sizeHint, int line) {
- if (position == gapStart) {
- // text is being inserted at the gap position
- int size = (gapEnd - gapStart) - sizeHint;
- if (lowWatermark <= size && size <= highWatermark)
- return;
- } else if ((position + sizeHint == gapStart) && (sizeHint < 0)) {
- // text is being deleted at the gap position
- int size = (gapEnd - gapStart) - sizeHint;
- if (lowWatermark <= size && size <= highWatermark)
- return;
- }
- moveAndResizeGap(position, sizeHint, line);
-}
-/**
- * Calculates the indexes of each line in the text store. Assumes no gap exists.
- * Optimized to do less checking.
- */
-void indexLines(){
- int start = 0;
- lineCount = 0;
- int textLength = textStore.length;
- int i;
- for (i=start; i<textLength; i++) {
- char ch = textStore[i];
- if (ch == SWT.CR) {
- // see if the next character is a LF
- if (i + 1 < textLength) {
- ch = textStore[i+1];
- if (ch == SWT.LF) {
- i++;
- }
- }
- addLineIndex(start, i - start + 1);
- start = i + 1;
- } else if (ch == SWT.LF) {
- addLineIndex(start, i - start + 1);
- start = i + 1;
- }
- }
- addLineIndex(start, i - start);
-}
-/**
- * Returns whether or not the given character is a line delimiter. Both CR and LF
- * are valid line delimiters.
- * <p>
- *
- * @param ch the character to test
- * @return true if ch is a delimiter, false otherwise
- */
-boolean isDelimiter(char ch) {
- if (ch == SWT.CR) return true;
- if (ch == SWT.LF) return true;
- return false;
-}
-/**
- * Determine whether or not the replace operation is valid. DefaultContent will not allow
- * the /r/n line delimiter to be split or partially deleted.
- * <p>
- *
- * @param start start offset of text to replace
- * @param replaceLength start offset of text to replace
- * @param newText start offset of text to replace
- */
-protected boolean isValidReplace(int start, int replaceLength, String newText){
- if (replaceLength == 0) {
- // inserting text, see if the \r\n line delimiter is being split
- if (start == 0) return true;
- if (start == getCharCount()) return true;
- char before = getTextRange(start - 1, 1).charAt(0);
- if (before == '\r') {
- char after = getTextRange(start, 1).charAt(0);
- if (after == '\n') return false;
- }
- } else {
- // deleting text, see if part of a \r\n line delimiter is being deleted
- char startChar = getTextRange(start, 1).charAt(0);
- if (startChar == '\n') {
- // see if char before delete position is \r
- if (start != 0) {
- char before = getTextRange(start - 1, 1).charAt(0);
- if (before == '\r') return false;
- }
- }
- char endChar = getTextRange(start + replaceLength - 1, 1).charAt(0);
- if (endChar == '\r') {
- // see if char after delete position is \n
- if (start + replaceLength != getCharCount()) {
- char after = getTextRange(start + replaceLength, 1).charAt(0);
- if (after == '\n') return false;
- }
- }
- }
- return true;
-}
-/**
- * Calculates the indexes of each line of text in the given range.
- * <p>
- *
- * @param offset the logical start offset of the text lineate
- * @param length the length of the text to lineate, includes gap
- * @param numLines the number of lines to initially allocate for the line index array,
- * passed in for efficiency (the exact number of lines may be known)
- * @return a line indexes array where each line is identified by a start offset and
- * a length
- */
-int[][] indexLines(int offset, int length, int numLines){
- int[][] indexedLines = new int[numLines][2];
- int start = 0;
- int lineCnt = 0;
- int i;
- replaceExpandExp = 1;
- for (i=start; i<length; i++) {
- int location = i + offset;
- if ((location >= gapStart) && (location < gapEnd)) {
- // ignore the gap
- } else {
- char ch = textStore[location];
- if (ch == SWT.CR) {
- // see if the next character is a LF
- if (location+1 < textStore.length) {
- ch = textStore[location+1];
- if (ch == SWT.LF) {
- i++;
- }
- }
- indexedLines = addLineIndex(start, i - start + 1, indexedLines, lineCnt);
- lineCnt++;
- start = i + 1;
- } else if (ch == SWT.LF) {
- indexedLines = addLineIndex(start, i - start + 1, indexedLines, lineCnt);
- lineCnt++;
- start = i + 1;
- }
- }
- }
- int[][] newLines = new int[lineCnt+1][2];
- System.arraycopy(indexedLines, 0, newLines, 0, lineCnt);
- int[] range = new int[] {start, i - start};
- newLines[lineCnt]=range;
- return newLines;
-}
-/**
- * Inserts text.
- * <p>
- *
- * @param position the position at which to insert the text
- * @param length the text to insert
- */
-void insert(int position, String text) {
- if (text.length() == 0) return;
-
- int startLine = getLineAtOffset(position);
- int change = text.length();
- boolean endInsert = position == getCharCount();
- adjustGap(position, change, startLine);
-
- // during an insert the gap will be adjusted to start at
- // position and it will be associated with startline, the
- // inserted text will be placed in the gap
- int startLineOffset = getOffsetAtLine(startLine);
- // at this point, startLineLength will include the start line
- // and all of the newly inserted text
- int startLineLength = getPhysicalLine(startLine).length();
-
- if (change > 0) {
- // shrink gap
- gapStart += (change);
- for (int i = 0; i < text.length(); i++)
- textStore[position + i]= text.charAt(i);
- }
-
- // figure out the number of new lines that have been inserted
- int [][] newLines = indexLines(startLineOffset, startLineLength, 10);
- // only insert an empty line if it is the last line in the text
- int numNewLines = newLines.length - 1;
- if (newLines[numNewLines][1] == 0) {
- // last inserted line is a new line
- if (endInsert) {
- // insert happening at end of the text, leave numNewLines as
- // is since the last new line will not be concatenated with another
- // line
- numNewLines += 1;
- } else {
- numNewLines -= 1;
- }
- }
-
- // make room for the new lines
- expandLinesBy(numNewLines);
- // shift down the lines after the replace line
- for (int i = lineCount-1; i > startLine; i--) {
- lines[i + numNewLines]=lines[i];
- }
- // insert the new lines
- for (int i=0; i<numNewLines; i++) {
- newLines[i][0] += startLineOffset;
- lines[startLine + i]=newLines[i];
- }
- // update the last inserted line
- if (numNewLines < newLines.length) {
- newLines[numNewLines][0] += startLineOffset;
- lines[startLine + numNewLines] = newLines[numNewLines];
- }
-
- lineCount += numNewLines;
- gapLine = getLineAtPhysicalOffset(gapStart);
-}
-/**
- * Moves the gap and adjusts its size in anticipation of a text change.
- * The gap is resized to actual size + the specified size and moved to the given
- * position.
- * <p>
- *
- * @param position the position at which a change is occurring
- * @param sizeHint the size of the change
- * @param line the line where the gap should be put
- */
-void moveAndResizeGap(int position, int size, int newGapLine) {
- char[] content = null;
- int oldSize = gapEnd - gapStart;
- int newSize;
- if (size > 0) {
- newSize = highWatermark + size;
- } else {
- newSize = lowWatermark - size;
- }
- // remove the old gap from the lines information
- if (gapExists()) {
- // adjust the line length
- lines[gapLine][1] = lines[gapLine][1] - oldSize;
- // adjust the offsets of the lines after the gapLine
- for (int i=gapLine+1; i<lineCount; i++) {
- lines[i][0]=lines[i][0]-oldSize;
- }
- }
-
- if (newSize < 0) {
- if (oldSize > 0) {
- // removing the gap
- content = new char[textStore.length - oldSize];
- System.arraycopy(textStore, 0, content, 0, gapStart);
- System.arraycopy(textStore, gapEnd, content, gapStart, content.length - gapStart);
- textStore= content;
- }
- gapStart = gapEnd= position;
- return;
- }
- content = new char[textStore.length + (newSize - oldSize)];
- int newGapStart = position;
- int newGapEnd = newGapStart + newSize;
- if (oldSize == 0) {
- System.arraycopy(textStore, 0, content, 0, newGapStart);
- System.arraycopy(textStore, newGapStart, content, newGapEnd, content.length - newGapEnd);
- } else if (newGapStart < gapStart) {
- int delta = gapStart - newGapStart;
- System.arraycopy(textStore, 0, content, 0, newGapStart);
- System.arraycopy(textStore, newGapStart, content, newGapEnd, delta);
- System.arraycopy(textStore, gapEnd, content, newGapEnd + delta, textStore.length - gapEnd);
- } else {
- int delta = newGapStart - gapStart;
- System.arraycopy(textStore, 0, content, 0, gapStart);
- System.arraycopy(textStore, gapEnd, content, gapStart, delta);
- System.arraycopy(textStore, gapEnd + delta, content, newGapEnd, content.length - newGapEnd);
- }
- textStore = content;
- gapStart = newGapStart;
- gapEnd = newGapEnd;
-
- // add the new gap to the lines information
- if (gapExists()) {
- gapLine = newGapLine;
- // adjust the line length
- int gapLength = gapEnd - gapStart;
- lines[gapLine][1] = lines[gapLine][1] + (gapLength);
- // adjust the offsets of the lines after the gapLine
- for (int i=gapLine+1; i<lineCount; i++) {
- lines[i][0]=lines[i][0]+gapLength;
- }
- }
-}
-/**
- * Returns the number of lines that are in the specified text.
- * <p>
- *
- * @param startOffset the start of the text to lineate
- * @param length the length of the text to lineate
- * @return number of lines
- */
-int lineCount(int startOffset, int length){
- if (length == 0) {
- return 0;
- }
- int lineCnt = 0;
- int count = 0;
- int i = startOffset;
- if (i >= gapStart) {
- i += gapEnd - gapStart;
- }
- while (count < length) {
- if ((i >= gapStart) && (i < gapEnd)) {
- // ignore the gap
- } else {
- char ch = textStore[i];
- if (ch == SWT.CR) {
- // see if the next character is a LF
- if (i + 1 < textStore.length) {
- ch = textStore[i+1];
- if (ch == SWT.LF) {
- i++;
- count++;
- }
- }
- lineCnt++;
- } else if (ch == SWT.LF) {
- lineCnt++;
- }
- count++;
- }
- i++;
- }
- return lineCnt;
-}
-/**
- * Returns the number of lines that are in the specified text.
- * <p>
- *
- * @param text the text to lineate
- * @return number of lines in the text
- */
-int lineCount(String text){
- int lineCount = 0;
- int length = text.length();
- for (int i = 0; i < length; i++) {
- char ch = text.charAt(i);
- if (ch == SWT.CR) {
- if (i + 1 < length && text.charAt(i + 1) == SWT.LF) {
- i++;
- }
- lineCount++;
- }
- else
- if (ch == SWT.LF) {
- lineCount++;
- }
- }
- return lineCount;
-}
-/**
- * @return the logical length of the text store
- */
-public int getCharCount() {
- int length = gapEnd - gapStart;
- return (textStore.length - length);
-}
-/**
- * Returns the line at <code>index</code> without delimiters.
- * <p>
- *
- * @param index the index of the line to return
- * @return the logical line text (i.e., without the gap)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT when index is out of range</li>
- * </ul>
- */
-public String getLine(int index) {
- if ((index >= lineCount) || (index < 0)) error(SWT.ERROR_INVALID_ARGUMENT);
- int start = lines[index][0];
- int length = lines[index][1];
- int end = start + length - 1;
- if (!gapExists() || (end < gapStart) || (start >= gapEnd)) {
- // line is before or after the gap
- while ((length - 1 >= 0) && isDelimiter(textStore[start+length-1])) {
- length--;
- }
- return new String(textStore, start, length);
- } else {
- // gap is in the specified range, strip out the gap
- StringBuffer buf = new StringBuffer();
- int gapLength = gapEnd - gapStart;
- buf.append(textStore, start, gapStart - start);
- buf.append(textStore, gapEnd, length - gapLength - (gapStart - start));
- length = buf.length();
- while ((length - 1 >=0) && isDelimiter(buf.charAt(length-1))) {
- length--;
- }
- return Compatibility.substring(buf, 0, length);
- }
-}
-/**
- * Returns the line delimiter that should be used by the StyledText
- * widget when inserting new lines. This delimiter may be different than the
- * delimiter that is used by the <code>StyledTextContent</code> interface.
- * <p>
- *
- * @return the platform line delimiter as specified in the line.separator
- * system property.
- */
-public String getLineDelimiter() {
- return LineDelimiter;
-}
-/**
- * Returns the line at the given index with delimiters.
- * <p>
- * @param index the index of the line to return
- * @return the logical line text (i.e., without the gap) with delimiters
- */
-String getFullLine(int index) {
- int start = lines[index][0];
- int length = lines[index][1];
- int end = start + length - 1;
- if (!gapExists() || (end < gapStart) || (start >= gapEnd)) {
- // line is before or after the gap
- return new String(textStore, start, length);
- } else {
- // gap is in the specified range, strip out the gap
- StringBuffer buf = new StringBuffer();
- int gapLength = gapEnd - gapStart;
- buf.append(textStore, start, gapStart - start);
- buf.append(textStore, gapEnd, length - gapLength - (gapStart - start));
- return buf.toString();
- }
-}
-/**
- * Returns the physical line at the given index (i.e., with delimiters and the gap).
- * <p>
- *
- * @param index the line index
- * @return the physical line
- */
-String getPhysicalLine(int index) {
- int start = lines[index][0];
- int length = lines[index][1];
- return getPhysicalText(start, length);
-}
-/**
- * @return the number of lines in the text store
- */
-public int getLineCount(){
- return lineCount;
-}
-/**
- * Returns the line at the given offset.
- * <p>
- *
- * @param charPosition logical character offset (i.e., does not include gap)
- * @return the line index
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT when charPosition is out of range</li>
- * </ul>
- */
-public int getLineAtOffset(int charPosition){
- int position;
- if ((charPosition > getCharCount()) || (charPosition < 0)) error(SWT.ERROR_INVALID_ARGUMENT);
- if (charPosition < gapStart) {
- // position is before the gap
- position = charPosition;
- } else {
- // position includes the gap
- position = charPosition + (gapEnd - gapStart);
- }
-
- // if last line and the line is not empty you can ask for
- // a position that doesn't exist (the one to the right of the
- // last character) - for inserting
- if (lineCount > 0) {
- int lastLine = lineCount - 1;
- if (position == lines[lastLine][0] + lines[lastLine][1])
- return lastLine;
- }
-
- int high = lineCount;
- int low = -1;
- int index = lineCount;
- while (high - low > 1) {
- index = (high + low) / 2;
- int lineStart = lines[index][0];
- int lineEnd = lineStart + lines[index][1] - 1;
- if (position <= lineStart) {
- high = index;
- } else if (position <= lineEnd) {
- high = index;
- break;
- } else {
- low = index;
- }
- }
-
- return high;
-}
-/**
- * Returns the line index at the given physical offset.
- * <p>
- *
- * @param position physical character offset (i.e., includes gap)
- * @return the line index
- */
-int getLineAtPhysicalOffset(int position){
- int high = lineCount;
- int low = -1;
- int index = lineCount;
- while (high - low > 1) {
- index = (high + low) / 2;
- int lineStart = lines[index][0];
- int lineEnd = lineStart + lines[index][1] - 1;
- if (position <= lineStart) {
- high = index;
- } else if (position <= lineEnd) {
- high = index;
- break;
- } else {
- low = index;
- }
- }
- return high;
-}
-/**
- * Returns the logical offset of the given line.
- * <p>
- *
- * @param lineIndex index of line
- * @return the logical starting offset of the line. When there are not any lines,
- * getOffsetAtLine(0) is a valid call that should answer 0.
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT when lineIndex is out of range</li>
- * </ul>
- */
-public int getOffsetAtLine(int lineIndex) {
- if (lineIndex == 0) return 0;
- if ((lineIndex >= lineCount) || (lineIndex < 0)) error(SWT.ERROR_INVALID_ARGUMENT);
- int start = lines[lineIndex][0];
- if (start > gapEnd) {
- return start - (gapEnd - gapStart);
- } else {
- return start;
- }
-}
-/**
- * Increases the line indexes array to accomodate more lines.
- * <p>
- *
- * @param numLines the number to increase the array by
- */
-void expandLinesBy(int numLines) {
- int size = lines.length;
- if (size - lineCount >= numLines) {
- return;
- }
- int[][] newLines = new int[size+Math.max(10, numLines)][2];
- System.arraycopy(lines, 0, newLines, 0, size);
- lines = newLines;
-}
-/**
- * Reports an SWT error.
- * <p>
- *
- * @param code the error code
- */
-void error (int code) {
- SWT.error(code);
-}
-/**
- * Returns whether or not a gap exists in the text store.
- * <p>
- *
- * @return true if gap exists, false otherwise
- */
-boolean gapExists() {
- return gapStart != gapEnd;
-}
-
-/**
- * Returns a string representing the continous content of
- * the text store.
- * <p>
- *
- * @param start the physical start offset of the text to return
- * @param length the physical length of the text to return
- * @return the text
- */
-String getPhysicalText(int start, int length) {
- return new String(textStore, start, length);
-}
-/**
- * Returns a string representing the logical content of
- * the text store (i.e., gap stripped out).
- * <p>
- *
- * @param start the logical start offset of the text to return
- * @param length the logical length of the text to return
- * @return the text
- */
-public String getTextRange(int start, int length) {
- if (textStore == null)
- return "";
- if (length == 0)
- return "";
- int end= start + length;
- if (!gapExists() || (end < gapStart))
- return new String(textStore, start, length);
- if (gapStart < start) {
- int gapLength= gapEnd - gapStart;
- return new String(textStore, start + gapLength , length);
- }
- StringBuffer buf = new StringBuffer();
- buf.append(textStore, start, gapStart - start);
- buf.append(textStore, gapEnd, end - gapStart);
- return buf.toString();
-}
-/**
- * Removes the specified <code>TextChangeListener</code>.
- * <p>
- *
- * @param listener the listener
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void removeTextChangeListener(TextChangeListener listener){
- if (listener == null) error(SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<textListeners.size(); i++) {
- TypedListener typedListener = (TypedListener) textListeners.elementAt(i);
- if (typedListener.getEventListener () == listener) {
- textListeners.removeElementAt(i);
- break;
- }
- }
-}
-/**
- * Replaces the text with <code>newText</code> starting at position <code>start</code>
- * for a length of <code>replaceLength</code>. Notifies the appropriate listeners.
- * <p>
- *
- * When sending the TextChangingEvent, <code>newLineCount</code> is the number of
- * lines that are going to be inserted and <code>replaceLineCount</code> is
- * the number of lines that are going to be deleted, based on the change
- * that occurs visually. For example:
- * <ul>
- * <li>(replaceText,newText) ==> (replaceLineCount,newLineCount)
- * <li>("","\n") ==> (0,1)
- * <li>("\n\n","a") ==> (2,0)
- * </ul>
- * </p>
- *
- * @param start start offset of text to replace
- * @param replaceLength start offset of text to replace
- * @param newText start offset of text to replace
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_ARGUMENT when the text change results in a multi byte
- * line delimiter being split or partially deleted. Splitting a line
- * delimiter by inserting text between the CR and LF characters of the
- * \r\n delimiter or deleting part of this line delimiter is not supported</li>
- * </ul>
- */
-public void replaceTextRange(int start, int replaceLength, String newText){
- // check for invalid replace operations
- if (!isValidReplace(start, replaceLength, newText)) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- // inform listeners
- StyledTextEvent event = new StyledTextEvent(this);
- event.type = StyledText.TextChanging;
- event.start = start;
- event.replaceLineCount = lineCount(start, replaceLength);
- event.text = newText;
- event.newLineCount = lineCount(newText);
- event.replaceCharCount = replaceLength;
- event.newCharCount = newText.length();
- sendTextEvent(event);
-
- // first delete the text to be replaced
- delete(start, replaceLength, event.replaceLineCount + 1);
- // then insert the new text
- insert(start, newText);
- // inform listeners
- event = new StyledTextEvent(this);
- event.type = StyledText.TextChanged;
- sendTextEvent(event);
- // printLines();
-}
-/**
- * Sends the text listeners the TextChanged event.
- */
-void sendTextEvent(StyledTextEvent event) {
- for (int i=0; i<textListeners.size(); i++) {
- ((StyledTextListener)textListeners.elementAt(i)).handleEvent(event);
- }
-}
-/**
- * Sets the content to text and removes the gap since there are no sensible predictions
- * about where the next change will occur.
- * <p>
- *
- * @param text the text
- */
-public void setText (String text){
- textStore = text.toCharArray();
- gapStart = -1;
- gapEnd = -1;
- expandExp = 1;
- indexLines();
- StyledTextEvent event = new StyledTextEvent(this);
- event.type = StyledText.TextSet;
- event.text = "";
- sendTextEvent(event);
-}
-/**
- * Deletes text.
- * <p>
- * @param position the position at which the text to delete starts
- * @param length the length of the text to delete
- * @param numLines the number of lines that are being deleted
- */
-void delete(int position, int length, int numLines) {
- if (length == 0) return;
-
- int startLine = getLineAtOffset(position);
- int startLineOffset = getOffsetAtLine(startLine);
- int endLine = getLineAtOffset(position + length);
-
- String endText = "";
- boolean splittingDelimiter = false;
- if (position + length < getCharCount()) {
- endText = getTextRange(position + length - 1, 2);
- if ((endText.charAt(0) == SWT.CR) && (endText.charAt(1) == SWT.LF)) {
- splittingDelimiter = true;
- }
- }
-
- adjustGap(position + length, -length, startLine);
- int [][] oldLines = indexLines(position, length + (gapEnd - gapStart), numLines);
-
- // enlarge the gap - the gap can be enlarged either to the
- // right or left
- if (position + length == gapStart) {
- gapStart -= length;
- } else {
- gapEnd += length;
- }
-
- // figure out the length of the new concatenated line, do so by
- // finding the first line delmiter after position
- int j = position;
- boolean eol = false;
- while (j < textStore.length && !eol) {
- if (j < gapStart || j >= gapEnd) {
- char ch = textStore[j];
- if (isDelimiter(ch)) {
- if (j + 1 < textStore.length)
- if (ch == SWT.CR && (textStore[j+1] == SWT.LF))
- j++;
- eol = true;
- }
- }
- j++;
- }
- // update the line where the deletion started
- lines[startLine][1] = (position - startLineOffset) + (j - position);
- // figure out the number of lines that have been deleted
- int numOldLines = oldLines.length - 1;
- if (splittingDelimiter) numOldLines -= 1;
- // shift up the lines after the last deleted line, no need to update
- // the offset or length of the lines
- for (int i = endLine + 1; i < lineCount; i++) {
- lines[i - numOldLines]=lines[i];
- }
- lineCount -= numOldLines;
- gapLine = getLineAtPhysicalOffset(gapStart);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultLineStyler.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultLineStyler.java
deleted file mode 100755
index 4612053c46..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultLineStyler.java
+++ /dev/null
@@ -1,624 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Compatibility;
-import java.util.Vector;
-
-class DefaultLineStyler implements LineStyleListener, LineBackgroundListener {
- StyledTextContent content;
- StyleRange styles[] = new StyleRange[0];
- int styleCount = 0; // the number of styles
- int styleExpandExp = 1; // the expansion exponent, used to increase the styles array exponentially
- int lineExpandExp = 1; // the expansion exponent, used to increase the lines array exponentially
- int lineCount = 0;
- Color lineBackgrounds[];
-
-/**
- * Creates a new default line styler.
- * <p>
- *
- * @param content the text to which the styles apply
- */
-public DefaultLineStyler(StyledTextContent content) {
- this.content = content;
- lineCount = content.getLineCount();
- lineBackgrounds = new Color[lineCount];
-}
-/**
- * Inserts a style at the given location.
- * <p>
- *
- * @param style the new style
- * @param index the index at which to insert the style (the new style
- * will reside at this index)
- *
- */
-void insertStyle(StyleRange style, int index) {
- int size = styles.length;
- if (styleCount == size) {
- // expand the styles array by powers of 2
- StyleRange[] newStyles = new StyleRange[size+Compatibility.pow2(styleExpandExp)];
- System.arraycopy(styles, 0, newStyles, 0, size);
- styles = newStyles;
- styleExpandExp++;
- }
- // shift the styles down to make room for the new style
- for (int i=styleCount-1; i>=index; i--) {
- styles[i+1]=styles[i];
- }
- styles[index] = style;
- styleCount++;
-}
-/**
- * Inserts a style, merging it with adjacent styles if possible.
- * <p>
- *
- * @param style the new style
- * @param index the index at which to insert the style (the new style
- * will reside at this index)
- * @return true if the style was inserted, false if the style was merged with an adjacent
- * style
- */
-boolean insertMergeStyle(StyleRange style, int index) {
- if (mergeStyleBefore(style, index)) return false;
- if (mergeStyleAfter(style, index)) return false;
- insertStyle(style, index);
- return true;
-}
-/**
- * Merges the style with the style before it if possible.
- * <p>
- *
- * @param style the new style
- * @param index the index at which to attempt the merge.
- * @return true if the style was merged, false otherwise
- */
-boolean mergeStyleBefore(StyleRange style, int index) {
- // see if the style is similar to the style before it and merge the
- // styles if possible
- if (index > 0) {
- StyleRange previous = styles[index-1];
- if (style.similarTo(previous)) {
- // the start of style needs to be in the range of the previous style
- // and the end of style needs to be < the start of the next style
- int previousEnd = previous.start + previous.length;
- if ((style.start <= previousEnd) && (style.start >= previous.start)) {
- int styleEnd = style.start + style.length;
- if ((index == styleCount) || (styleEnd <= styles[index].start)) {
- previous.length = style.start + style.length - previous.start;
- return true;
- }
- }
- }
- }
- return false;
-}
-/**
- * Merges the style with the style after it if possible.
- * <p>
- *
- * @param style the new style
- * @param index the index at which to attempt the merge.
- * @return true if the style was merged, false otherwise
- */
-boolean mergeStyleAfter(StyleRange style, int index) {
- // see if the style is similar to the style that will be after it and
- // merge the styles if possible
- if (index < styleCount) {
- StyleRange next = styles[index];
- if (style.similarTo(next)) {
- // the end of style needs to be in the range of the next style and
- // the start of style needs to be > the end of the previous style
- int styleEnd = style.start + style.length;
- int nextEnd = next.start + next.length;
- if ((styleEnd <= nextEnd) && (styleEnd >= next.start)) {
- if ((index == 0) || (style.start >= styles[index-1].start + styles[index-1].length)) {
- next.length = next.start + next.length - style.start;
- next.start = style.start;
- return true;
- }
- }
- }
- }
- return false;
-}
-/**
- * Removes style information that is defined for the range of text in <code>clearStyle</code>.
- * <p>
- *
- * @param clearStyle the style information to use for clearing
- */
-void clearStyle(StyleRange clearStyle) {
- Point pt = getOverlappingStyles(clearStyle.start, clearStyle.length);
- int clearStyleEnd = clearStyle.start + clearStyle.length - 1;
-
- // no overlapped styles exist
- if ((pt == null) || (pt.y == 0)) return;
-
- // the newStyle overlaps one or more of the existing styles
- // pt.x is the index of the first overlapped style, pt.y is the number of overlapped
- // styles
- int count = 0;
- for (int i=pt.x; count<pt.y; i++) {
- StyleRange overlap = styles[i];
- int overlapEnd = overlap.start + overlap.length - 1;
- if (overlap.start < clearStyle.start) {
- if (overlapEnd <= clearStyleEnd) {
- // the end of overlap needs to be cleared
- overlap.length=clearStyle.start - overlap.start;
- } else {
- // middle of overlap needs to be cleared, this will
- // cause overlap to be broken into two
- StyleRange endStyle = (StyleRange)overlap.clone();
- endStyle.start = clearStyleEnd + 1;
- endStyle.length = overlapEnd - clearStyleEnd;
- overlap.length = clearStyle.start - overlap.start;
- insertStyle(endStyle, i+1);
- break;
- }
- } else {
- if (overlapEnd <= clearStyleEnd) {
- // entire overlap needs to be cleared
- deleteStyle(i);
- i--;
- } else {
- // beginning of overlap needs to be cleared
- overlap.start=clearStyleEnd + 1;
- overlap.length=overlapEnd - overlap.start + 1;
- break;
- }
- }
- count++;
- }
-}
-/**
- * Increases the <code>linebackgrounds</code> array to accomodate new line background
- * information.
- * <p>
- *
- * @param numLines the number to increase the array by
- */
-void expandLinesBy(int numLines) {
- int size = lineBackgrounds.length;
- if (size - lineCount >= numLines) {
- return;
- }
- Color[] newLines = new Color[size+Math.max(Compatibility.pow2(lineExpandExp), numLines)];
- System.arraycopy(lineBackgrounds, 0, newLines, 0, size);
- lineBackgrounds = newLines;
- lineExpandExp++;
-}
-/**
- * Deletes the style at <code>index</code>.
- * <p>
- *
- * @param index the index of the style to be deleted
- */
-void deleteStyle(int index) {
- // move the styles up
- for (int i=index+1; i<styleCount; i++) {
- styles[i-1] = styles[i];
- }
- styles[styleCount-1]=null;
- styleCount--;
-}
-/**
- * Returns the styles that are defined.
- * <p>
- *
- * @return the copied array of styles
- */
-StyleRange [] getStyleRanges() {
- StyleRange[] newStyles = new StyleRange[styleCount];
- System.arraycopy(styles, 0, newStyles, 0, styleCount);
- return newStyles;
-}
-/**
- * Handles the get line background color callback.
- * <p>
- *
- * @param event.lineOffset line number (input)
- * @param event.lineText line text (input)
- * @param event.background line background color (output)
- */
-public void lineGetBackground(LineBackgroundEvent event) {
- int lineIndex = content.getLineAtOffset(event.lineOffset);
- event.lineBackground = lineBackgrounds[lineIndex];
-}
-/**
- * Handles the get line style information callback.
- * <p>
- *
- * @param event.lineOffset line number (input)
- * @param event.lineText line text (input)
- * @param event.styles array of StyleRanges, need to be in order (output)
- */
-public void lineGetStyle(LineStyleEvent event) {
- int lineStart = event.lineOffset;
- int lineEnd = lineStart + event.lineText.length();
-
- int high = searchForStyle(lineStart, lineEnd);
- StyleRange style = null;
- Vector lineStyles = new Vector();
-
- // index will represent a style that
- // -- starts after the line (end processing)
- // -- ends before the line (continue processing)
- // -- starts before the line, ends in the line (add range)
- // -- starts in the line, ends in the line (add range)
- // -- starts in the line, ends after the line (add range)
- // -- starts before the line, ends after the line (add range)
- for (int index = high; index < styleCount; index++) {
- style = styles[index];
- if (style.start > lineEnd)
- // style starts after the line, end looping
- break;
- int styleEnd = style.start + style.length - 1;
- if (styleEnd >= lineStart) lineStyles.addElement(style);
- }
- event.styles = new StyleRange[lineStyles.size()];
- lineStyles.copyInto(event.styles);
-}
-/**
- * Searches for the first style in the <code>start</code> - <code>end</code> range.
- * <p>
- *
- * @return the index of the first style that overlaps the input range
- */
-int searchForStyle(int start, int end) {
- int high = styleCount;
- int low = -1;
- int index = high;
- // find the index of the first style for the given range, use a binary search
- while (high - low > 1) {
- index = (high + low) / 2;
- StyleRange style = styles[index];
- int styleEnd = style.start + style.length - 1;
- if (start <= style.start || end <= styleEnd || (start > style.start && styleEnd >= start && styleEnd < end)) {
- high = index;
- }
- else {
- low = index;
- }
- }
- return high;
-}
-/**
- * Updates the line background colors to reflect a new color. Called by StyledText.
- * <p>
- *
- * @param startLine index of the first line to color
- * @param lineCount number of lines to color starting at startLine
- * @param background the background color for the lines
- */
-void setLineBackground(int startLine, int count, Color background) {
- for (int i=startLine; i<startLine + count; i++) {
- lineBackgrounds[i]=background;
- }
-}
-/**
- * Update the styles to reflect the new style. <code>newStyle</code> will
- * replace any old style for the range. When this method is called, the
- * DefaultLineStyler may merge the new style with an existing style (if possible).
- * Called by StyledText when a style is added. Called by StyledText.
- * <p>
- *
- * @param newStyle the new style information.
- */
-void setStyleRange(StyleRange newStyle) {
- if (newStyle == null) {
- styles = new StyleRange[0];
- styleExpandExp = 1;
- styleCount = 0;
- return;
- }
- if (newStyle.length ==0) return;
- if (newStyle.isUnstyled()) {
- clearStyle(newStyle);
- return;
- }
-
- Point pt = getOverlappingStyles(newStyle.start, newStyle.length);
- int newStyleEnd = newStyle.start + newStyle.length - 1;
-
- // no styles exist
- if (pt == null) {
- insertStyle(newStyle, 0);
- return;
- }
-
- // newStyle does not overlap any other styles
- if (pt.y == 0) {
- insertMergeStyle(newStyle, pt.x);
- return;
- }
-
- // the newStyle overlaps one or more of the existing styles
- boolean added = false; // indicates whether or not the new style has been added
- int count = 0;
- // pt.x is the index of the first overlapped style, pt.y is the number of overlapped
- // styles
- for (int i=pt.x; count<pt.y; i++) {
- StyleRange overlap = styles[i];
- int overlapEnd = overlap.start + overlap.length - 1;
- if (overlap.start < newStyle.start) {
- if (overlapEnd <= newStyleEnd) {
- // the end of overlap needs to be replaced by newStyle
- if (newStyle.similarTo(overlap)) {
- // update overlap to accomodate the new style
- overlap.length = newStyle.start + newStyle.length - overlap.start;
- } else {
- overlap.length=newStyle.start - overlap.start;
- // see if newStyle can be merged with the style after overlap, if so,
- // processing is done
- if (mergeStyleAfter(newStyle, i+1)) break;
- // otherwise, insert the newStyle, newStyle may still overlap other
- // styles after it so continue processing
- insertStyle(newStyle, i+1);
- i++;
- }
- added = true;
- } else {
- // middle of overlap needs to be replaced by newStyle, this will
- // cause overlap to be broken into two
- if (newStyle.similarTo(overlap)) break;
- StyleRange endStyle = (StyleRange)overlap.clone();
- endStyle.start = newStyleEnd + 1;
- endStyle.length = overlapEnd - newStyleEnd;
- overlap.length = newStyle.start - overlap.start;
- insertStyle(newStyle, i+1);
- i++;
- insertStyle(endStyle, i+1);
- // when newStyle overlaps the middle of a style, this implies that
- // processing is done (no more overlapped styles)
- break;
- }
- } else {
- if (overlapEnd <= newStyleEnd) {
- // overlap will be replaced by the newStyle, make sure newStyle
- // hasn't already been added, if it has just delete overlap
- if (!added) {
- styles[i] = newStyle;
- added = true;
- } else {
- deleteStyle(i);
- i--;
- }
- } else {
- // beginning of overlap needs to be replaced by newStyle
- overlap.start=newStyleEnd + 1;
- overlap.length=overlapEnd - overlap.start + 1;
- if (!added) {
- insertMergeStyle(newStyle, i);
- }
- // when newStyle overlaps only the beginning of a style, this implies
- // that processing is done (no more overlapped styles)
- break;
- }
- }
- count++;
- }
-}
-/**
- * Sets the array of styles and discards old styles. Called by StyledText.
- * <p>
- *
- * @param styles the new styles, must be in order and non-overlapping
- */
-void setStyleRanges(StyleRange[] styles) {
- this.styles = new StyleRange[styles.length];
- System.arraycopy(styles, 0, this.styles, 0, styles.length);
- styleCount = styles.length;
- styleExpandExp = 1;
-}
-/**
- * Updates the style ranges and line backgrounds to reflect a pending text
- * change.
- * Called by StyledText when a TextChangingEvent is received.
- * <p>
- *
- * @param event the event with the text change information
- */
-public void textChanging(TextChangingEvent event) {
- int startLine = content.getLineAtOffset(event.start);
- int startLineOffset = content.getOffsetAtLine(startLine);
-
- textChanging(event.start, -event.replaceCharCount);
- textChanging(event.start, event.newCharCount);
-
- if (event.replaceCharCount == content.getCharCount()) {
- // all text is going to be replaced, clear line backgrounds
- linesChanging(0, -lineCount);
- linesChanging(0, content.getLineCount() - event.replaceLineCount + event.newLineCount);
- return;
- }
-
- if (event.start != startLineOffset) {
- startLine = startLine + 1;
- }
-
- linesChanging(startLine, -event.replaceLineCount);
- linesChanging(startLine, event.newLineCount);
-}
-/*
- * Updates the line backgrounds to reflect a pending text change.
- * <p>
- *
- * @param start the starting line of the change that is about to take place
- * @param delta the number of lines in the change, > 0 indicates lines inserted,
- * < 0 indicates lines deleted
- */
-void linesChanging(int start, int delta) {
- if (delta == 0) return;
- boolean inserting = delta > 0;
- if (inserting) {
- // shift the lines down to make room for new lines
- expandLinesBy(delta);
- for (int i = lineCount-1; i >= start; i--) {
- lineBackgrounds[i + delta]=lineBackgrounds[i];
- }
- for (int i=start; i<start + delta; i++) {
- lineBackgrounds[i]=null;
- }
- } else {
- // shift up the lines
- for (int i = start - delta; i < lineCount; i++) {
- lineBackgrounds[i+delta]=lineBackgrounds[i];
- }
- }
- lineCount += delta;
-}
-/*
- * Updates the style ranges to reflect a text change.
- * <p>
- *
- * @param start the starting offset of the change that is about to
- * take place
- * @param delta the length of the change, > 0 indicates text inserted,
- * < 0 indicates text deleted
- */
-void textChanging(int start, int delta) {
- if (delta == 0) return;
- StyleRange style;
- // find the index of the first style for the given offset, use a binary search
- // to find the index
- int end;
- boolean inserting = delta > 0;
- if (inserting) {
- end = (start + delta) - 1;
- } else {
- end = (start - delta) - 1;
- }
- int high = searchForStyle(start, end);
- int index;
- // update the styles that are in the affected range
- for (index = high; index < styleCount; index++) {
- style = styles[index];
- if (inserting) {
- if (style.start >= start) break;
- // in the insert case only one style range will be directly affected,
- // it will need to be split into two and then the newStyle inserted
- StyleRange beforeStyle = (StyleRange)style.clone();
- beforeStyle.length = start - style.start;
- style.start = start;
- style.length = style.length - beforeStyle.length;
- if (beforeStyle.length != 0) insertStyle(beforeStyle, index);
- index++;
- break;
- } else {
- int styleEnd = style.start + style.length - 1;
- if (style.start > end) break;
- // in the delete case, any style that overlaps the change range will be
- // affected
- if (style.start < start) {
- if (styleEnd <= end) {
- // style starts before change range, ends in change range
- style.length = start - style.start;
- } else {
- // style starts before change range, ends after change range
- style.length = style.length + delta;
- index++;
- break;
- }
- } else {
- if (styleEnd <= end) {
- // style starts in change range, ends in change range
- deleteStyle(index);
- index--;
- } else {
- // style starts in change range, ends after change range
- style.start = start;
- style.length = styleEnd - end;
- index++;
- break;
- }
- }
- }
- }
- // change the offsets of the styles after the affected styles
- for (int i = index ; i < styleCount; i++) {
- style = styles[i];
- style.start = style.start + delta;
- }
-}
-/**
- * Returns the indexes of the styles that overlap the given range. Styles that partially
- * or fully overlap the range will be returned.
- * <p>
- *
- * @return Point where x is the index of the starting overlap style, y is the number of
- * styles that overlap the range
- */
-Point getOverlappingStyles(int start, int length) {
- StyleRange style;
- if (styleCount == 0) return null;
- // find the index of the first style for the given offset, use a binary search
- // to find the index
- int end = start + length - 1;
- int high = searchForStyle(start, end);
- int count = 0;
- for (int index = high; index < styleCount; index++) {
- style = styles[index];
- int styleEnd = style.start + style.length - 1;
- if (style.start > end) break;
- if (styleEnd >= start) count++;
- }
- return new Point(high, count);
-}
-/**
- * Returns the background color of a line. Called by StyledText. It is safe to return
- * the existing Color object since the colors are set and managed by the client.
- * <p>
- *
- * @param index the line index
- * @return the background color of the line at the given index
- */
-Color getLineBackground(int index) {
- return lineBackgrounds[index];
-}
-/**
- * Returns the style for the character at <code>offset</code>. Called by StyledText.
- * Returns a new style. Does not return the existing style.
- * <p>
- *
- * @param offset the character position in the text
- * @return a cloned StyleRange with start == offset and length == 1 if a style is
- * specified or null if no style is specified
- */
-StyleRange getStyleRangeAtOffset(int offset) {
- if (styleCount == 0) return null;
- Point pt = getOverlappingStyles(offset, 1);
- if (pt == null || pt.y == 0) return null;
- StyleRange newStyle = (StyleRange)styles[pt.x].clone();
- newStyle.start = offset;
- newStyle.length = 1;
- return newStyle;
-}
-/**
- * Returns the styles for the given range. Returns the existing styles,
- * so be careful not to modify the return value. Styles are not cloned
- * in order to make this method as efficient as possible.
- * <p>
- *
- * @param offset the start position of the text range
- * @param length the length of the text range
- * @return a StyleRange array or null if no styles are specified for the text
- * range
- */
-StyleRange[] getStyleRangesFor(int offset, int length) {
- if (styleCount == 0) return null;
- Point pt = getOverlappingStyles(offset, length);
- if (pt == null || pt.y == 0) return null;
- StyleRange[] ranges = new StyleRange[pt.y];
- for (int i=0; i<pt.y; i++) {
- StyleRange newStyle = styles[pt.x + i];
- ranges[i]=newStyle;
- }
- return ranges;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyEvent.java
deleted file mode 100755
index 517471267d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * This event is sent after a text change occurs.
- */
-public final class ExtendedModifyEvent extends TypedEvent {
- public int start; // start offset of the new text
- public int length; // length of the new text
- public String replacedText; // replaced text or empty string if no text was replaced
-
-public ExtendedModifyEvent(StyledTextEvent e) {
- super(e);
- start = e.start;
- length = e.end - e.start;
- replacedText = e.text;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyListener.java
deleted file mode 100755
index 48c5929f83..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-public interface ExtendedModifyListener extends SWTEventListener {
-/**
- * This method is called after a text change occurs.
- * <p>
- *
- * @param event.start the start offset of the new text (input)
- * @param event.length the length of the new text (input)
- * @param event.replacedText the replaced text (input)
- */
-public void modifyText(ExtendedModifyEvent event);
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundEvent.java
deleted file mode 100755
index 711c84302d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This event is sent when a line is about to be drawn.
- */
-public class LineBackgroundEvent extends TypedEvent {
- public int lineOffset; // line start offset
- public String lineText; // line text
- public Color lineBackground; // line background color
-
-public LineBackgroundEvent(StyledTextEvent e) {
- super(e);
- lineOffset = e.detail;
- lineText = e.text;
-}
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundListener.java
deleted file mode 100755
index 1460e26431..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-public interface LineBackgroundListener extends SWTEventListener {
-
-/**
- * This method is called when a line is about to be drawn in order to get its
- * background color.
- * <p>
- *
- * @param event.lineOffset line start offset (input)
- * @param event.lineText line text (input)
- * @param event.lineBackground line background color (output)
- */
-public void lineGetBackground(LineBackgroundEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleEvent.java
deleted file mode 100755
index 86a7e0c7a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleEvent.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This event is sent when a line is about to be drawn.
- */
-public class LineStyleEvent extends TypedEvent {
- public int lineOffset; // line start offset
- public String lineText; // line text
- public StyleRange[] styles; // array of StyleRanges
-
-public LineStyleEvent(StyledTextEvent e) {
- super(e);
- lineOffset = e.detail;
- lineText = e.text;
- styles = e.styles;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleListener.java
deleted file mode 100755
index e8e525ece8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-public interface LineStyleListener extends SWTEventListener {
-/**
- * This method is called when a line is about to be drawn in order to get the
- * line's style information.
- * <p>
- *
- * @param event.lineOffset line start offset (input)
- * @param event.lineText line text (input)
- * @param event.styles array of StyleRanges, need to be in order (output)
- */
-public void lineGetStyle(LineStyleEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/PopupList.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/PopupList.java
deleted file mode 100755
index 5f650a3396..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/PopupList.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-/**
-* A PopupList is a list of selectable items that appears in its own shell positioned above
-* its parent shell. It it used for selecting items when editing a Table cell (similar to the
-* list that appears when you open a Combo box).
-*
-* The list will be positioned so that does not run off the screen and the largest number of items
-* are visible. It may appear above the current cursor location or below it depending how close you
-* are to the edge of the screen.
-*/
-public class PopupList {
- private Shell shell;
- private List list;
- private int minimumWidth;
-/**
-* Creates a PopupList above the specified shell.
-*/
-public PopupList(Shell parent) {
-
- shell = new Shell(parent, 0);
-
- list = new List(shell, SWT.SINGLE | SWT.V_SCROLL);
-
- // close dialog if user selects outside of the shell
- shell.addListener(SWT.Deactivate, new Listener() {
- public void handleEvent(Event e){
- shell.setVisible (false);
- };
- });
-
- // resize shell when list resizes
- shell.addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e){}
- public void controlResized(ControlEvent e){
- Rectangle shellSize = shell.getClientArea();
- list.setSize(shellSize.width, shellSize.height);
- }
- });
-
- // return list selection on Mouse Up or Carriage Return
- list.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e){};
- public void mouseDown(MouseEvent e){};
- public void mouseUp(MouseEvent e){
- shell.setVisible (false);
- };
- });
- list.addKeyListener(new KeyListener() {
- public void keyReleased(KeyEvent e){};
- public void keyPressed(KeyEvent e){
- if (e.character == '\r'){
- shell.setVisible (false);
- }
- };
- });
-
-}
-/**
-* Gets the widget font.
-* <p>
-* @return the widget font
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* </ul>
-*/
-public Font getFont () {
- return list.getFont();
-}
-/**
-* Gets the items.
-* <p>
-* This operation will fail if the items cannot
-* be queried from the OS.
-*
-* @return the items in the widget
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_CANNOT_GET_ITEM when the operation fails</li>
-* </ul>
-*/
-public String[] getItems () {
- return list.getItems();
-}
-/**
-* Gets the minimum width of the list.
-*
-* @return the minimum width of the list
-*/
-public int getMinimumWidth () {
- return minimumWidth;
-}
-/**
-* Launches the Popup List, waits for an item to be selected and then closes PopupList.
-*
-* @param rect the initial size and location of the PopupList; the dialog will be
-* positioned so that it does not run off the screen and the largest number of items are visible
-*
-* @return the text of the selected item or null if no item is selected
-*/
-public String open (Rectangle rect) {
-
- Point listSize = list.computeSize (rect.width, SWT.DEFAULT);
- Rectangle screenSize = shell.getDisplay().getBounds();
-
- // Position the dialog so that it does not run off the screen and the largest number of items are visible
- int spaceBelow = screenSize.height - (rect.y + rect.height) - 30;
- int spaceAbove = rect.y - 30;
-
- int y = 0;
- if (spaceAbove > spaceBelow && listSize.y > spaceBelow) {
- // place popup list above table cell
- if (listSize.y > spaceAbove){
- listSize.y = spaceAbove;
- } else {
- listSize.y += 2;
- }
- y = rect.y - listSize.y;
-
- } else {
- // place popup list below table cell
- if (listSize.y > spaceBelow){
- listSize.y = spaceBelow;
- } else {
- listSize.y += 2;
- }
- y = rect.y + rect.height;
- }
-
- // Make dialog as wide as the cell
- listSize.x = rect.width;
- // dialog width should not be les than minimumwidth
- if (listSize.x < minimumWidth)
- listSize.x = minimumWidth;
-
- // Align right side of dialog with right side of cell
- int x = rect.x + rect.width - listSize.x;
-
- shell.setBounds(x, y, listSize.x, listSize.y);
-
- shell.open();
- list.setFocus();
-
- Display display = shell.getDisplay();
- while (!shell.isDisposed () && shell.isVisible ()) {
- if (!display.readAndDispatch()) display.sleep();
- }
-
- String result = null;
- if (!shell.isDisposed ()) {
- String [] strings = list.getSelection ();
- shell.dispose();
- if (strings.length != 0) result = strings [0];
- }
- return result;
-}
-/**
-* Selects an item with text that starts with specified String.
-* <p>
-* If the item is not currently selected, it is selected.
-* If the item at an index is selected, it remains selected.
-* If the string is not matched, it is ignored.
-*
-* @param string the text of the item
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* </ul>
-*/
-public void select(String string) {
- String[] items = list.getItems();
-
- // find the first entry in the list that starts with the
- // specified string
- if (string != null){
- for (int i = 0; i < items.length; i++) {
- if (items[i].startsWith(string)){
- int index = list.indexOf(items[i]);
- list.select(index);
- break;
- }
- }
- }
-}
-/**
-* Sets the widget font.
-* <p>
-* When new font is null, the font reverts
-* to the default system font for the widget.
-*
-* @param font the new font (or null)
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* </ul>
-*/
-public void setFont (Font font) {
- list.setFont(font);
-}
-/**
-* Sets all items.
-* <p>
-* The previous selection is cleared.
-* The previous items are deleted.
-* The new items are added.
-* The top index is set to 0.
-*
-* @param items the array of items
-*
-* This operation will fail when an item is null
-* or could not be added in the OS.
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_NULL_ARGUMENT when items is null</li>
-* <li>ERROR_ITEM_NOT_ADDED when the operation fails</li>
-* </ul>
-*/
-public void setItems (String[] strings) {
- list.setItems(strings);
-}
-/**
-* Sets the minimum width of the list.
-*
-* @param width the minimum width of the list
-*/
-public void setMinimumWidth (int width) {
- if (width < 0)
- throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
-
- minimumWidth = width;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java
deleted file mode 100755
index 5be042724e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * This class provides access to the public constants provided by <code>StyledText</code>.
- */
-public class ST {
-
- /* StyledText key action constants */
- /* Navigation */
- public static final int LINE_UP = SWT.ARROW_UP;
- public static final int LINE_DOWN = SWT.ARROW_DOWN;
- public static final int LINE_START = SWT.HOME;
- public static final int LINE_END = SWT.END;
- public static final int COLUMN_PREVIOUS = SWT.ARROW_LEFT;
- public static final int COLUMN_NEXT = SWT.ARROW_RIGHT;
- public static final int PAGE_UP = SWT.PAGE_UP;
- public static final int PAGE_DOWN = SWT.PAGE_DOWN;
- public static final int WORD_PREVIOUS = SWT.ARROW_LEFT | SWT.CTRL;
- public static final int WORD_NEXT = SWT.ARROW_RIGHT | SWT.CTRL;
- public static final int TEXT_START = SWT.HOME | SWT.CTRL;
- public static final int TEXT_END = SWT.END | SWT.CTRL;
- public static final int WINDOW_START = SWT.PAGE_UP | SWT.CTRL;
- public static final int WINDOW_END = SWT.PAGE_DOWN | SWT.CTRL;
-
- /* Selection */
- public static final int SELECT_LINE_UP = SWT.ARROW_UP | SWT.SHIFT;
- public static final int SELECT_LINE_DOWN = SWT.ARROW_DOWN | SWT.SHIFT;
- public static final int SELECT_LINE_START = SWT.HOME | SWT.SHIFT;
- public static final int SELECT_LINE_END = SWT.END | SWT.SHIFT;
- public static final int SELECT_COLUMN_PREVIOUS = SWT.ARROW_LEFT | SWT.SHIFT;
- public static final int SELECT_COLUMN_NEXT = SWT.ARROW_RIGHT | SWT.SHIFT;
- public static final int SELECT_PAGE_UP = SWT.PAGE_UP | SWT.SHIFT;
- public static final int SELECT_PAGE_DOWN = SWT.PAGE_DOWN | SWT.SHIFT;
- public static final int SELECT_WORD_PREVIOUS = SWT.ARROW_LEFT | SWT.CTRL | SWT.SHIFT;
- public static final int SELECT_WORD_NEXT = SWT.ARROW_RIGHT | SWT.CTRL | SWT.SHIFT;
- public static final int SELECT_TEXT_START = SWT.HOME | SWT.CTRL | SWT.SHIFT;
- public static final int SELECT_TEXT_END = SWT.END | SWT.CTRL | SWT.SHIFT;
- public static final int SELECT_WINDOW_START = SWT.PAGE_UP | SWT.CTRL| SWT.SHIFT;
- public static final int SELECT_WINDOW_END = SWT.PAGE_DOWN | SWT.CTRL | SWT.SHIFT;
-
- /* Modification */
- public static final int CUT = SWT.DEL | SWT.SHIFT;
- public static final int COPY = SWT.INSERT | SWT.CTRL;
- public static final int PASTE = SWT.INSERT | SWT.SHIFT;
- public static final int DELETE_PREVIOUS = SWT.BS;
- public static final int DELETE_NEXT = SWT.DEL;
-
- /* Miscellaneous */
- public static final int TOGGLE_OVERWRITE = SWT.INSERT;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java
deleted file mode 100755
index 20696fcc6b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * The SashForm lays out its children in a Row or Column arrangement (as specified
- * by the orientation) and places a Sash between the children.
- * One child may be maximized to occupy the entire size of the SashForm.
- * The relative sizes of the children may be specfied using weights.
- *
- * <p>
- * <dl>
- * <dt><b>Styles:</b><dd>HORIZONTAL, VERTICAL
- * </dl>
- */
-public class SashForm extends Composite {
-
- public int SASH_WIDTH = 3;
-
- private static final int DRAG_MINIMUM = 20;
-
- private int orientation = SWT.HORIZONTAL;
- private Sash[] sashes = new Sash[0];
- private Control[] controls = new Control[0];
- private Control maxControl = null;
- private Listener sashListener;
-
-public SashForm(Composite parent, int style) {
- super(parent, checkStyle(style));
- if ((style & SWT.VERTICAL) != 0){
- orientation = SWT.VERTICAL;
- }
-
- this.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event e) {
- layout(true);
- }
- });
-
- sashListener = new Listener() {
- public void handleEvent(Event e) {
- onDragSash(e);
- }
- };
-}
-private static int checkStyle (int style) {
- int mask = SWT.BORDER;
- return style & mask;
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
-
- Control[] controls = getControls(true);
- if (controls.length == 0) return new Point(wHint, hHint);
-
- int width = 0;
- int height = 0;
- boolean vertical = (orientation == SWT.VERTICAL);
- if (vertical) {
- width = wHint;
- height += (controls.length - 1) * SASH_WIDTH;
- } else {
- height = hHint;
- width += controls.length *SASH_WIDTH;
- }
- for (int i = 0; i < controls.length; i++) {
- if (vertical) {
- Point size = controls[i].computeSize(wHint, SWT.DEFAULT);
- height += size.y;
- } else {
- Point size = controls[i].computeSize(SWT.DEFAULT, hHint);
- width += size.x;
- }
- }
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
-
- return new Point(width, height);
-}
-/**
- * Answer SWT.HORIZONTAL if the controls in the SashForm are laid out side by side.
- * Answer SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.
- */
-public int getOrientation() {
- return orientation;
-}
-/**
- * Answer the control that currently is maximized in the SashForm. This value may be null.
- */
-public Control getMaximizedControl(){
- return this.maxControl;
-}
-/**
- * Answer the relative weight of each child in the SashForm. The weight represents the
- * percent of the total width (if SashForm has Horizontal orientation) or
- * total height (if SashForm has Vertical orientation) each control occupies.
- * The weights are returned in order of the creation of the widgets (weight[0]
- * corresponds to the weight of the first child created).
- */
-
-public int[] getWeights() {
- Control[] cArray = getControls(false);
- float[] ratios = new float[cArray.length];
- for (int i = 0; i < cArray.length; i++) {
- Float ratio = (Float)cArray[i].getData("layout ratio");
- if (ratio != null) {
- ratios[i] = ratio.floatValue();
- } else {
- ratios[i] = (float)0.2;
- }
- }
-
- int[] weights = new int[cArray.length];
- for (int i = 0; i < weights.length; i++) {
- weights[i] = (int)(ratios[i] * 1000);
- }
- return weights;
-}
-private Control[] getControls(boolean onlyVisible) {
- Control[] children = getChildren();
- Control[] controls = new Control[0];
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof Sash) continue;
- if (onlyVisible && !children[i].getVisible()) continue;
-
- Control[] newControls = new Control[controls.length + 1];
- System.arraycopy(controls, 0, newControls, 0, controls.length);
- newControls[controls.length] = children[i];
- controls = newControls;
- }
- return controls;
-}
-public void layout(boolean changed) {
- Rectangle area = getClientArea();
- if (area.width == 0 || area.height == 0) return;
-
- Control[] newControls = getControls(true);
- if (controls.length == 0 && newControls.length == 0) return;
- controls = newControls;
-
- if (maxControl != null && !maxControl.isDisposed()) {
- for (int i= 0; i < controls.length; i++){
- if (controls[i] != maxControl) {
- controls[i].setBounds(-200, -200, 0, 0);
- } else {
- controls[i].setBounds(area);
- }
- }
- return;
- }
-
- // keep just the right number of sashes
- if (sashes.length < controls.length - 1) {
- Sash[] newSashes = new Sash[controls.length - 1];
- System.arraycopy(sashes, 0, newSashes, 0, sashes.length);
- int sashOrientation = (orientation == SWT.HORIZONTAL) ? SWT.VERTICAL : SWT.HORIZONTAL;
- for (int i = sashes.length; i < newSashes.length; i++) {
- newSashes[i] = new Sash(this, sashOrientation);
- newSashes[i].addListener(SWT.Selection, sashListener);
- }
- sashes = newSashes;
- }
- if (sashes.length > controls.length - 1) {
- if (controls.length == 0) {
- for (int i = 0; i < sashes.length; i++) {
- sashes[i].dispose();
- }
- sashes = new Sash[0];
- } else {
- Sash[] newSashes = new Sash[controls.length - 1];
- System.arraycopy(sashes, 0, newSashes, 0, newSashes.length);
- for (int i = controls.length - 1; i < sashes.length; i++) {
- sashes[i].dispose();
- }
- sashes = newSashes;
- }
- }
-
- if (controls.length == 0) return;
-
- // get the ratios
- float[] ratios = new float[controls.length];
- float total = 0;
- for (int i = 0; i < controls.length; i++) {
- Float ratio = (Float)controls[i].getData("layout ratio");
- if (ratio != null) {
- ratios[i] = ratio.floatValue();
- } else {
- ratios[i] = (float)0.2;
- }
- total += ratios[i];
- }
-
- if (orientation == SWT.HORIZONTAL) {
- total += (float)sashes.length * ((float)SASH_WIDTH / (float)area.width);
- } else {
- total += (float)sashes.length * ((float)SASH_WIDTH / (float)area.height);
- }
-
- if (orientation == SWT.HORIZONTAL) {
- int width = (int)((ratios[0] / total) * (float)area.width);
- int x = area.x;
- controls[0].setBounds(x, area.y, width, area.height);
- x += width;
- for (int i = 1; i < controls.length - 1; i++) {
- sashes[i - 1].setBounds(x, area.y, SASH_WIDTH, area.height);
- x += SASH_WIDTH;
- width = (int)((ratios[i] / total) * (float)area.width);
- controls[i].setBounds(x, area.y, width, area.height);
- x += width;
- }
- if (controls.length > 1) {
- sashes[sashes.length - 1].setBounds(x, area.y, SASH_WIDTH, area.height);
- x += SASH_WIDTH;
- width = area.width - x;
- controls[controls.length - 1].setBounds(x, area.y, width, area.height);
- }
- } else {
- int height = (int)((ratios[0] / total) * (float)area.height);
- int y = area.y;
- controls[0].setBounds(area.x, y, area.width, height);
- y += height;
- for (int i = 1; i < controls.length - 1; i++) {
- sashes[i - 1].setBounds(area.x, y, area.width, SASH_WIDTH);
- y += SASH_WIDTH;
- height = (int)((ratios[i] / total) * (float)area.height);
- controls[i].setBounds(area.x, y, area.width, height);
- y += height;
- }
- if (controls.length > 1) {
- sashes[sashes.length - 1].setBounds(area.x, y, area.width, SASH_WIDTH);
- y += SASH_WIDTH;
- height = area.height - y;
- controls[controls.length - 1].setBounds(area.x, y, area.width, height);
- }
-
- }
-}
-private void onDragSash(Event event) {
- if (event.detail == SWT.DRAG) {
- // constrain feedback
- Rectangle area = getClientArea();
- if (orientation == SWT.HORIZONTAL) {
- event.x = Math.min(Math.max(DRAG_MINIMUM, event.x), area.width - DRAG_MINIMUM);
- } else {
- event.y = Math.min(Math.max(DRAG_MINIMUM, event.y), area.height - DRAG_MINIMUM);
- }
- return;
- }
-
- Sash sash = (Sash)event.widget;
- int sashIndex = -1;
- for (int i= 0; i < sashes.length; i++) {
- if (sashes[i] == sash) {
- sashIndex = i;
- break;
- }
- }
- if (sashIndex == -1) return;
-
- Control c1 = controls[sashIndex];
- Control c2 = controls[sashIndex + 1];
- Rectangle b1 = c1.getBounds();
- Rectangle b2 = c2.getBounds();
-
- Rectangle sashBounds = sash.getBounds();
- Rectangle area = getClientArea();
- if (orientation == SWT.HORIZONTAL) {
- int shift = event.x - sashBounds.x;
- b1.width += shift;
- b2.x += shift;
- b2.width -= shift;
- if (b1.width < DRAG_MINIMUM || b2.width < DRAG_MINIMUM) {
- return;
- }
- c1.setData("layout ratio", new Float((float)b1.width / (float)area.width));
- c2.setData("layout ratio", new Float((float)b2.width / (float)area.width));
- } else {
- int shift = event.y - sashBounds.y;
- b1.height += shift;
- b2.y += shift;
- b2.height -= shift;
- if (b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM) {
- return;
- }
- c1.setData("layout ratio", new Float((float)b1.height / (float)area.height));
- c2.setData("layout ratio", new Float((float)b2.height / (float)area.height));
- }
-
- c1.setBounds(b1);
- sash.setBounds(event.x, event.y, event.width, event.height);
- c2.setBounds(b2);
-}
-/**
- * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side.
- * If orientation is SWT.VERTICAL, lay the controls in the SashForm out top to bottom.
- */
-public void setOrientation(int orientation) {
- if (this.orientation == orientation) return;
- if (orientation != SWT.HORIZONTAL && orientation != SWT.VERTICAL) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.orientation = orientation;
-
- int sashOrientation = (orientation == SWT.HORIZONTAL) ? SWT.VERTICAL : SWT.HORIZONTAL;
- for (int i = 0; i < sashes.length; i++) {
- sashes[i].dispose();
- sashes[i] = new Sash(this, sashOrientation);
- sashes[i].addListener(SWT.Selection, sashListener);
- }
- layout();
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note : SashForm does not use a layout class to size and position its children.
- * </p>
- *
- * @param the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
-}
-/**
- * Specify the control that should take up the entire client area of the SashForm.
- * If one control has been maximized, and this method is called with a different control,
- * the previous control will be minimized and the new control will be maximized..
- * if the value of control is null, the SashForm will minimize all controls and return to
- * the default layout where all controls are laid out separated by sashes.
- */
-public void setMaximizedControl(Control control){
- if (control == null) {
- if (maxControl != null) {
- this.maxControl = null;
- layout();
- for (int i= 0; i < sashes.length; i++){
- sashes[i].setVisible(true);
- }
- }
- return;
- }
-
- for (int i= 0; i < sashes.length; i++){
- sashes[i].setVisible(false);
- }
- maxControl = control;
- layout();
-
-// // walk up
-// w= getParent();
-// if (w instanceof SplitForm)
-// ((SplitForm) w).internalMaximize(this);
-// else
-// layout(true);
-}
-
-/**
- * Specify the relative weight of each child in the SashForm. This will determine
- * what percent of the total width (if SashForm has Horizontal orientation) or
- * total height (if SashForm has Vertical orientation) each control will occupy.
- * The weights must be positive values and there must be an entry for each
- * non-sash child of the SashForm.
- */
-public void setWeights(int[] weights) {
- Control[] cArray = getControls(false);
- if (weights == null || weights.length != cArray.length) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- int total = 0;
- for (int i = 0; i < weights.length; i++) {
- if (weights[i] < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- total += weights[i];
- }
- if (total == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- for (int i = 0; i < cArray.length; i++) {
- cArray[i].setData("layout ratio", new Float((float)weights[i] / (float)total));
- }
-
- layout();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java
deleted file mode 100755
index fcc237a78c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A ScrolledComposite provides scrollbars and will scroll its content when the user
- * uses the scrollbars.
- *
- *
- * <p>There are two ways to use the ScrolledComposite:
- *
- * <p>
- * 1) Set the size of the control that is being scrolled and the ScrolledComposite
- * will show scrollbars when the contained control can not be fully seen.
- *
- * 2) The second way imitates the way a browser would work. Set the minimum size of
- * the control and the ScrolledComposite will show scroll bars if the visible area is
- * less than the minimum size of the control and it will expand the size of the control
- * if the visible area is greater than the minimum size. This requires invoking
- * both setMinWidth(), setMinHeight() and setExpandHorizontal(), setExpandVertical().
- *
- * <code><pre>
- * public static void main (String [] args) {
- * Display display = new Display ();
- * Color red = display.getSystemColor(SWT.COLOR_RED);
- * Color blue = display.getSystemColor(SWT.COLOR_BLUE);
- * Shell shell = new Shell (display);
- * shell.setLayout(new FillLayout());
- *
- * // set the size of the scrolled content - method 1
- * final ScrolledComposite sc1 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- * final Composite c1 = new Composite(sc1, SWT.NONE);
- * sc1.setContent(c1);
- * c1.setBackground(red);
- * GridLayout layout = new GridLayout();
- * layout.numColumns = 4;
- * c1.setLayout(layout);
- * Button b1 = new Button (c1, SWT.PUSH);
- * b1.setText("first button");
- * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- *
- * // set the minimum width and height of the scrolled content - method 2
- * final ScrolledComposite sc2 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- * sc2.setExpandHorizontal(true);
- * sc2.setExpandVertical(true);
- * final Composite c2 = new Composite(sc2, SWT.NONE);
- * sc2.setContent(c2);
- * c2.setBackground(blue);
- * layout = new GridLayout();
- * layout.numColumns = 4;
- * c2.setLayout(layout);
- * Button b2 = new Button (c2, SWT.PUSH);
- * b2.setText("first button");
- * sc2.setMinSize(c2.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- *
- * Button add = new Button (shell, SWT.PUSH);
- * add.setText("add children");
- * final int[] index = new int[]{0};
- * add.addListener(SWT.Selection, new Listener() {
- * public void handleEvent(Event e) {
- * index[0]++;
- * Button button = new Button(c1, SWT.PUSH);
- * button.setText("button "+index[0]);
- * // reset size of content so children can be seen - method 1
- * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- * c1.layout();
- *
- * button = new Button(c2, SWT.PUSH);
- * button.setText("button "+index[0]);
- * // reset the minimum width and height so children can be seen - method 2
- * sc2.setMinSize(c2.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- * c2.layout();
- * }
- * });
- *
- * shell.open ();
- * while (!shell.isDisposed ()) {
- * if (!display.readAndDispatch ()) display.sleep ();
- * }
- * display.dispose ();
- * }
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles:</b><dd>H_SCROLL, V_SCROLL
- * </dl>
- */
-public class ScrolledComposite extends Composite {
-
- private Control content;
- private Listener contentListener;
-
- private int minHeight = 0;
- private int minWidth = 0;
- private boolean expandHorizontal = false;
- private boolean expandVertical = false;
- private boolean alwaysShowScroll = false;
- private boolean inResize = false;
-
-public ScrolledComposite(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- ScrollBar hBar = getHorizontalBar ();
- if (hBar != null) {
- hBar.addListener (SWT.Selection, new Listener () {
- public void handleEvent (Event e) {
- hScroll();
- }
- });
- }
-
- ScrollBar vBar = getVerticalBar ();
- if (vBar != null) {
- vBar.addListener (SWT.Selection, new Listener () {
- public void handleEvent (Event e) {
- vScroll();
- }
- });
- }
-
- addListener (SWT.Resize, new Listener () {
- public void handleEvent (Event e) {
- resize();
- }
- });
-
- contentListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.type != SWT.Resize) return;
- resize();
- }
- };
-}
-
-private static int checkStyle (int style) {
- int mask = SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- return style & mask;
-}
-
-/**
- * Returns the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- *
- * @return the Always Show Scrollbars flag value
- */
-public boolean getAlwaysShowScrollBars() {
- return alwaysShowScroll;
-}
-
-/**
- * Get the content that is being scrolled.
- */
-public Control getContent() {
- return content;
-}
-
-private void hScroll() {
- if (content == null) return;
- Point location = content.getLocation ();
- ScrollBar hBar = getHorizontalBar ();
- int hSelection = hBar.getSelection ();
- content.setLocation (-hSelection, location.y);
-}
-
-public void layout(boolean changed) {
- if (content == null) return;
- Rectangle contentRect = content.getBounds();
- ScrollBar hBar = getHorizontalBar ();
- ScrollBar vBar = getVerticalBar ();
- if (!alwaysShowScroll) {
- boolean hVisible = needHScroll(contentRect, false);
- boolean vVisible = needVScroll(contentRect, hVisible);
- if (!hVisible && vVisible) hVisible = needHScroll(contentRect, vVisible);
- if (hBar != null) hBar.setVisible(hVisible);
- if (vBar != null) vBar.setVisible(vVisible);
- }
-
- Rectangle hostRect = getClientArea();
- if (expandHorizontal) {
- contentRect.width = Math.max(minWidth, hostRect.width);
- }
- if (expandVertical) {
- contentRect.height = Math.max(minHeight, hostRect.height);
- }
-
- if (hBar != null) {
- hBar.setMaximum (contentRect.width);
- hBar.setThumb (Math.min (contentRect.width, hostRect.width));
- int hPage = contentRect.width - hostRect.width;
- int hSelection = hBar.getSelection ();
- if (hSelection >= hPage) {
- if (hPage <= 0) {
- hSelection = 0;
- hBar.setSelection(0);
- }
- contentRect.x = -hSelection;
- }
- }
-
- if (vBar != null) {
- vBar.setMaximum (contentRect.height);
- vBar.setThumb (Math.min (contentRect.height, hostRect.height));
- int vPage = contentRect.height - hostRect.height;
- int vSelection = vBar.getSelection ();
- if (vSelection >= vPage) {
- if (vPage <= 0) {
- vSelection = 0;
- vBar.setSelection(0);
- }
- contentRect.y = -vSelection;
- }
- }
-
- content.setBounds (contentRect);
-}
-
-private boolean needHScroll(Rectangle contentRect, boolean vVisible) {
- ScrollBar hBar = getHorizontalBar();
- if (hBar == null) return false;
-
- Rectangle hostRect = getBounds();
- int border = getBorderWidth();
- hostRect.width -= 2*border;
- ScrollBar vBar = getVerticalBar();
- if (vVisible && vBar != null) hostRect.width -= vBar.getSize().x;
-
- if (!expandHorizontal && contentRect.width > hostRect.width) return true;
- if (expandHorizontal && minWidth > hostRect.width) return true;
- return false;
-}
-
-private boolean needVScroll(Rectangle contentRect, boolean hVisible) {
- ScrollBar vBar = getVerticalBar();
- if (vBar == null) return false;
-
- Rectangle hostRect = getBounds();
- int border = getBorderWidth();
- hostRect.height -= 2*border;
- ScrollBar hBar = getHorizontalBar();
- if (hVisible && hBar != null) hostRect.height -= hBar.getSize().y;
-
- if (!expandHorizontal && contentRect.height > hostRect.height) return true;
- if (expandHorizontal && minHeight > hostRect.height) return true;
- return false;
-}
-
-private void resize() {
- if (inResize) return;
- inResize = true;
- layout();
- inResize = false;
-}
-
-/**
- * Set the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- */
-public void setAlwaysShowScrollBars(boolean show) {
- if (show == alwaysShowScroll) return;
- alwaysShowScroll = show;
- ScrollBar hBar = getHorizontalBar ();
- if (hBar != null && alwaysShowScroll) hBar.setVisible(true);
- ScrollBar vBar = getVerticalBar ();
- if (vBar != null && alwaysShowScroll) vBar.setVisible(true);
- layout();
-}
-
-/**
- * Set the content that will be scrolled.
- */
-public void setContent(Control content) {
- if (this.content != null && !this.content.isDisposed()) {
- this.content.removeListener(SWT.Resize, contentListener);
- this.content.setBounds(new Rectangle(-200, -200, 0, 0));
- }
-
- this.content = content;
- ScrollBar vBar = getVerticalBar ();
- ScrollBar hBar = getHorizontalBar ();
- if (this.content != null) {
- if (vBar != null) {
- vBar.setMaximum (0);
- vBar.setThumb (0);
- vBar.setSelection(0);
- }
- if (hBar != null) {
- hBar.setMaximum (0);
- hBar.setThumb (0);
- hBar.setSelection(0);
- }
- content.setLocation(0, 0);
- layout();
- this.content.addListener(SWT.Resize, contentListener);
- } else {
- if (hBar != null) hBar.setVisible(alwaysShowScroll);
- if (vBar != null) vBar.setVisible(alwaysShowScroll);
- }
-}
-/**
- * Configure the ScrolledComposite to resize the content object to be as wide as the
- * ScrolledComposite when the width of the ScrolledComposite is greater than the
- * minimum width specified in setMinWidth. If the ScrolledComposite is less than the
- * minimum width, the content will not resized and instead the horizontal scroll bar will be
- * used to view the entire width.
- * If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
- */
-public void setExpandHorizontal(boolean expand) {
- if (expand == expandHorizontal) return;
- expandHorizontal = expand;
- layout();
-}
-/**
- * Configure the ScrolledComposite to resize the content object to be as tall as the
- * ScrolledComposite when the height of the ScrolledComposite is greater than the
- * minimum height specified in setMinHeight. If the ScrolledComposite is less than the
- * minimum height, the content will not resized and instead the vertical scroll bar will be
- * used to view the entire height.
- * If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
- */
-public void setExpandVertical(boolean expand) {
- if (expand == expandVertical) return;
- expandVertical = expand;
- layout();
-}
-public void setLayout (Layout layout) {
- // do not allow a layout to be set on this class because layout is being handled by the resize listener
- return;
-}
-/**
- * Specify the minimum height at which the ScrolledComposite will begin scrolling the
- * content with the vertical scroll bar. This value is only relevant if
- * setExpandVertical(true) has been set.
- */
-public void setMinHeight(int height) {
- setMinSize(minWidth, height);
-}
-public void setMinSize(Point size) {
- setMinSize(size.x, size.y);
-}
-public void setMinSize(int width, int height) {
- if (width == minWidth && height == minHeight) return;
- minWidth = Math.max(0, width);
- minHeight = Math.max(0, height);
- layout();
-}
-/**
- * Specify the minimum width at which the ScrolledComposite will begin scrolling the
- * content with the horizontal scroll bar. This value is only relevant if
- * setExpandHorizontal(true) has been set.
- */
-
-public void setMinWidth(int width) {
- setMinSize(width, minHeight);
-}
-
-private void vScroll() {
- Control[] children = getChildren();
- if (children.length == 0) return;
- Control content = children[0];
- Point location = content.getLocation ();
- ScrollBar vBar = getVerticalBar ();
- int vSelection = vBar.getSelection ();
- content.setLocation (location.x, -vSelection);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StackLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StackLayout.java
deleted file mode 100755
index 02fab5cb46..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StackLayout.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-
-/**
- * This Layout stacks all the controls one on top of the other and resizes all controls
- * to have the same size and location.
- * The control specified in topControl is visible and all other controls are not visible.
- * Users must set the topControl value to flip between the visible items and the call
- * layout() on the composite which has the StackLayout.
- */
-
-public class StackLayout extends Layout {
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the layout.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the layout.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
-
- /**
- * topControl the Control that is displayed at the top of the stack.
- * All other controls that are children of the parent composite will not be visible.
- */
- public Control topControl;
-
-protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Control children[] = composite.getChildren();
-
- int maxWidth = 0;
- int maxHeight = 0;
- for (int i = 0; i < children.length; i++) {
- Point size = children[i].computeSize(wHint, hHint, flushCache);
- maxWidth = Math.max(size.x, maxWidth);
- maxHeight = Math.max(size.y, maxHeight);
- }
-
- int width = wHint, height = hHint;
- if (wHint == SWT.DEFAULT) width = maxWidth;
- if (hHint == SWT.DEFAULT) height = maxHeight;
- return new Point(width + 2 * marginWidth, height + 2 * marginHeight);
-}
-
-protected void layout(Composite composite, boolean flushCache) {
- Control children[] = composite.getChildren();
- Rectangle rect = composite.getClientArea();
- rect.x += marginWidth;
- rect.y += marginHeight;
- rect.width -= 2 * marginWidth;
- rect.height -= 2 * marginHeight;
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- children[i].setVisible(children[i] == topControl);
-
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java
deleted file mode 100755
index 9fd1bda9f7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.CloneableCompatibility;
-
-public class StyleRange implements CloneableCompatibility {
- public int start; // style start offset. 0 based from the document start
- public int length; // style length.
- public Color foreground;
- public Color background;
- public int fontStyle = SWT.NORMAL; // may be SWT.NORMAL or SWT.BOLD
-
-public StyleRange() {
-}
-/**
- * Create a new style range.
- * <p>
- *
- * @param start start offset of the style
- * @param length length of the style
- * @param foreground foreground color of the style, null if none
- * @param background background color of the style, null if none
- */
-public StyleRange(int start, int length, Color foreground, Color background) {
- this.start = start;
- this.length = length;
- this.foreground = foreground;
- this.background = background;
-}
-
-/**
- * Create a new style range.
- * <p>
- *
- * @param start start offset of the style
- * @param length length of the style
- * @param foreground foreground color of the style, null if none
- * @param background background color of the style, null if none
- * @param fontStyle font style of the style, may be SWT.NORMAL or SWT.BOLD
- */
-public StyleRange(int start, int length, Color foreground, Color background, int fontStyle) {
- this.start = start;
- this.length = length;
- this.foreground = foreground;
- this.background = background;
- this.fontStyle = fontStyle;
-}
-
-/**
- * Compare the specified object to this StyleRange and answer if the two
- * are equal. The object must be an instance of StyleRange and have the
- * same field values.
- * <p>
- *
- * @param object the object to compare with this object
- * @return true if the objects are equal, false otherwise
- */
-public boolean equals(Object object) {
- StyleRange style;
- if (object == this) return true;
- if (object instanceof StyleRange) style = (StyleRange)object;
- else return false;
- if (this.start != style.start) return false;
- if (this.length != style.length) return false;
- if (this.foreground != null) {
- if (!this.foreground.equals(style.foreground)) return false;
- } else if (style.foreground != null) return false;
- if (this.background != null) {
- if (!this.background.equals(style.background)) return false;
- } else if (style.background != null) return false;
- if (this.fontStyle != style.fontStyle) return false;
- return true;
-}
-/**
- * Returns an integer hash code for the receiver. Objects which are
- * equal answer the same value for this method.
- * <p>
- *
- * @return the receiver's hash
- */
-public int hashCode() {
- return start + length + foreground.hashCode() + background.hashCode() + fontStyle;
-}
-/**
- * Returns whether or not the receiver is unstyled (i.e., does not have any
- * style attributes specified).
- * <p>
- *
- * @return true if the receiver is unstyled, false otherwise.
- */
-public boolean isUnstyled() {
- if (this.foreground != null) return false;
- if (this.background != null) return false;
- if (this.fontStyle != SWT.NORMAL) return false;
- return true;
-}
-/**
- * Compares the specified object to this StyleRange and answer if the two
- * are similar. The object must be an instance of StyleRange and have the
- * same field values for except for start and length.
- * <p>
- *
- * @param object the object to compare with this object
- * @return true if the objects are similar, false otherwise
- */
-public boolean similarTo(StyleRange style) {
- if (this.foreground != null) {
- if (!this.foreground.equals(style.foreground)) return false;
- } else if (style.foreground != null) return false;
- if (this.background != null) {
- if (!this.background.equals(style.background)) return false;
- } else if (style.background != null) return false;
- if (this.fontStyle != style.fontStyle) return false;
- return true;
-}
-/**
- * Answers a new StyleRange with the same values as this StyleRange.
- * <p>
- *
- * @return a shallow copy of this StyleRange
- */
-public Object clone() {
- StyleRange style = new StyleRange(start, length, foreground, background, fontStyle);
- return style;
-}
-/**
- * Answers a string description of the receiver.
- * <p>
- *
- * @return a printable representation for the receiver.
- */
-public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(start + "," + length + " fg:" + foreground + " bg:" + background + " fStyle:");
- if (fontStyle == SWT.NORMAL) {
- buf.append("normal");
- } else if (fontStyle == SWT.BOLD) {
- buf.append("bold");
- }
- return buf.toString();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java
deleted file mode 100644
index e6090812a1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java
+++ /dev/null
@@ -1,1014 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2001, 2002.
- * All Rights Reserved
- */
-
-import java.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * This class provides API for StyledText to implement bidirectional text
- * functions.
- * Objects of this class are created for a single line of text.
- */
-class StyledTextBidi {
- private GC gc;
- private int[] bidiSegments; // bidi text segments, each segment will be rendered separately
- private int[] renderPositions; // x position at which characters of the line are rendered, in visual order
- private int[] order; // reordering indices in logical order, iV=order[iL] (iV=visual index, iL=logical index),
- // if no character in a line needs reordering all iV and iL are the same.
- private int[] dx; // distance between character cells. in visual order. renderPositions[iV + 1] = renderPositions[iV] + dx[iV]
- private byte[] classBuffer; // the character types in logical order, see BidiUtil for the possible types
- private char[] glyphBuffer; // the glyphs in visual order as they will be rendered on screen.
-
- /**
- * This class describes a text segment of a single direction, either
- * left-to-right (L2R) or right-to-left (R2L).
- * Objects of this class are used by StyledTextBidi rendering methods
- * to render logically contiguous text segments that may be visually
- * discontiguous if they consist of different directions.
- */
- class DirectionRun {
- int logicalStart;
- int logicalEnd;
-
- DirectionRun(int logicalStart, int logicalEnd) {
- this.logicalStart = logicalStart;
- this.logicalEnd = logicalEnd;
- }
- int getVisualStart() {
- int visualStart = order[logicalStart];
- int visualEnd = order[logicalEnd];
- // the visualStart of a R2L direction run is actually
- // at the run's logicalEnd, answered as such since rendering
- // always occurs from L2R regardless of the text run's
- // direction
- if (visualEnd < visualStart) {
- visualStart = visualEnd;
- }
- return visualStart;
- }
- int getVisualEnd() {
- int visualStart = order[logicalStart];
- int visualEnd = order[logicalEnd];
- // the visualEnd of a R2L direction run is actually
- // at the run's logicalStart, answered as such since rendering
- // always occurs from L2R regardless of the text run's
- // direction
- if (visualEnd < visualStart) {
- visualEnd = visualStart;
- }
- return visualEnd;
- }
- int getRenderStartX() {
- return renderPositions[getVisualStart()];
- }
- int getRenderStopX() {
- int visualEnd = getVisualEnd();
-
- return renderPositions[visualEnd] + dx[visualEnd];
- }
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("vStart,Stop:" + getVisualStart() + "," + getVisualEnd() + " lStart,Stop:" + logicalStart + "," + logicalEnd + " renderStart,Stop: " + getRenderStartX() + "," + getRenderStopX());
- return buf.toString();
- }
- }
-
-/**
- * Constructs an instance of this class for a line of text. The text
- * is reordered to reflect how it will be displayed.
- * <p>
- *
- * @param gc the GC to use for rendering and measuring of this line.
- * @param tabWidth tab width in number of spaces, used to calculate
- * tab stops
- * @param text line that bidi data should be calculated for
- * @param boldRanges bold text segments in the line, specified as
- * i=bold start,i+1=bold length
- * @param boldFont font that bold text will be rendered in, needed for
- * proper measuring of bold text segments.
- * @param offset text segments that should be measured and reordered
- * separately, may be needed to preserve the order of separate R2L
- * segments to each other
- */
-public StyledTextBidi(GC gc, int tabWidth, String text, StyleRange[] ranges, Font boldFont, int[] offsets) {
- int length = text.length();
-
- this.gc = gc;
- bidiSegments = offsets;
- renderPositions = new int[length];
- order = new int[length];
- dx = new int[length];
- classBuffer = new byte[length];
- if (length == 0) {
- glyphBuffer = new char[0];
- }
- else {
- glyphBuffer = BidiUtil.getRenderInfo(gc, text, order, classBuffer, dx, 0, offsets);
- if (ranges != null) {
- // If the font supports characters shaping, break up the font style ranges based on
- // the specified bidi segments. Each bidi segment will be treated separately
- // for font style purposes.
- StyleRange[] segmentedRanges;
- if (isCharacterShaped(gc)) segmentedRanges = segmentedRangesFor(ranges);
- else segmentedRanges = ranges;
- Font normalFont = gc.getFont();
- gc.setFont(boldFont);
- for (int i = 0; i < segmentedRanges.length; i++) {
- StyleRange segmentedRange = segmentedRanges[i];
- int rangeStart = segmentedRange.start;
- int rangeLength = segmentedRange.length;
- // Font styled text needs to be processed so that the dx array reflects the styled
- // font.
- prepareFontStyledText(text, rangeStart, rangeLength);
- }
- gc.setFont(normalFont);
- }
- calculateTabStops(text, tabWidth);
- calculateRenderPositions();
- }
-}
-/**
- * Constructs an instance of this class for a line of text. This constructor
- * should be used when only ordering (not rendering) information is needed.
- * Only the class and order arrays will be filled during this call.
- * <p>
- *
- * @param gc the GC to use for rendering and measuring of this line.
- * @param text line that bidi data should be calculated for
- * @param offset text segments that should be measured and reordered
- * separately, may be needed to preserve the order of separate R2L
- * segments to each other
- */
-public StyledTextBidi(GC gc, String text, int[] offsets) {
- int length = text.length();
- this.gc = gc;
- bidiSegments = offsets;
- order = new int[length];
- classBuffer = new byte[length];
- BidiUtil.getOrderInfo(gc, text, order, classBuffer, 0, offsets);
- // initialize the unused arrays
- dx = new int[0];
- renderPositions = new int[0];
- glyphBuffer = new char[0];
-
-}
-/**
- * Adds a listener that should be called when the user changes the
- * keyboard layout for the specified window.
- * <p>
- *
- * @param control Control to add the keyboard language listener for.
- * Each window has its own keyboard language setting.
- * @param runnable the listener that should be called when the user
- * changes the keyboard layout.
- */
-static void addLanguageListener(Control control, Runnable runnable) {
- BidiUtil.addLanguageListener(control.handle, runnable);
-}
-/**
- * Answers the direction of the active keyboard language - either
- * L2R or R2L. The active keyboard language determines the direction
- * of the caret and can be changed by the user (e.g., via Alt-Shift on
- * Win32 platforms).
- * <p>
- *
- * @return the direction of the active keyboard language. SWT.LEFT (for L2R
- * language) or SWT.RIGHT (for R2L language).
- */
-static int getKeyboardLanguageDirection() {
- int language = BidiUtil.getKeyboardLanguage();
- if (language == BidiUtil.KEYBOARD_HEBREW) {
- return SWT.RIGHT;
- }
- if (language == BidiUtil.KEYBOARD_ARABIC) {
- return SWT.RIGHT;
- }
- return SWT.LEFT;
-}
-/**
- * Removes the keyboard language listener for the specified window.
- * <p>
- *
- * @param control window to remove the keyboard language listener from.
- */
-static void removeLanguageListener(Control control) {
- BidiUtil.removeLanguageListener(control.handle);
-}
-/**
- * Calculates render positions using the glyph distance values in the dx array.
- */
-private void calculateRenderPositions() {
- renderPositions = new int[dx.length];
- renderPositions[0] = StyledText.XINSET;
- for (int i = 0; i < dx.length - 1; i++) {
- renderPositions[i + 1] = renderPositions[i] + dx[i];
- }
-}
-/**
- * Calculate the line's tab stops and adjust the dx array to
- * reflect the width of tab characters.
- * <p>
- *
- * @param text the original line text (not reordered) containing
- * tab characters.
- * @param tabWidth number of pixels that one tab character represents
- */
-private void calculateTabStops(String text, int tabWidth) {
- int tabIndex = text.indexOf('\t', 0);
- int logicalIndex = 0;
- int x = StyledText.XINSET;
- int spaceWidth = gc.stringExtent(" ").x;
-
- while (tabIndex != -1) {
- for (; logicalIndex < tabIndex; logicalIndex++) {
- x += dx[order[logicalIndex]];
- }
- int tabStop = x + tabWidth;
- // make sure tab stop is at least one space width apart
- // from the last character. fixes 4844.
- if (tabWidth - tabStop % tabWidth < spaceWidth) {
- tabStop += tabWidth;
- }
- tabStop -= tabStop % tabWidth;
- dx[order[tabIndex]] = tabStop - x;
- tabIndex = text.indexOf('\t', tabIndex + 1);
- }
-}
-/**
- * Renders the specified text segment. All text is rendered L2R
- * regardless of the direction of the text. The rendered text may
- * be visually discontiguous if the text segment is bidirectional.
- * <p>
- *
- * @param logicalStart start offset in the logical text
- * @param length number of logical characters to render
- * @param xOffset x location of the line start
- * @param yOffset y location of the line start
- */
-void drawBidiText(int logicalStart, int length, int xOffset, int yOffset) {
- Enumeration directionRuns = getDirectionRuns(logicalStart, length).elements();
- int endOffset = logicalStart + length;
-
- if (endOffset > getTextLength()) {
- return;
- }
- while (directionRuns.hasMoreElements()) {
- DirectionRun run = (DirectionRun) directionRuns.nextElement();
- int visualStart = run.getVisualStart();
- int visualEnd = run.getVisualEnd();
- int x = xOffset + run.getRenderStartX();
- drawGlyphs(visualStart, visualEnd - visualStart + 1, x, yOffset);
- }
-}
-/**
- * Renders a segment of glyphs. Glyphs are visual objects so the
- * start and length are visual as well. Glyphs are always rendered L2R.
- * <p>
- *
- * @param visualStart start offset of the glyphs to render relative to the
- * line start.
- * @param length number of glyphs to render
- * @param x x location to render at
- * @param y y location to render at
- */
-private void drawGlyphs(int visualStart, int length, int x, int y) {
- char[] renderBuffer = new char[length];
- int[] renderDx = new int[length];
- if (length == 0) {
- return;
- }
- System.arraycopy(glyphBuffer, visualStart, renderBuffer, 0, length);
- // copy the distance values for the desired rendering range
- System.arraycopy(dx, visualStart, renderDx, 0, length);
- BidiUtil.drawGlyphs(gc, renderBuffer, renderDx, x, y);
-}
-/**
- * Fills a rectangle spanning the given logical range.
- * The rectangle may be visually discontiguous if the text segment
- * is bidirectional.
- * <p>
- *
- * @param logicalStart logcial start offset of the rectangle
- * @param length number of logical characters the rectangle should span
- * @param xOffset x location of the line start
- * @param yOffset y location of the line start
- * @param height height of the rectangle
- */
-void fillBackground(int logicalStart, int length, int xOffset, int yOffset, int height) {
- Enumeration directionRuns = getDirectionRuns(logicalStart, length).elements();
-
- if (logicalStart + length > getTextLength()) {
- return;
- }
- while (directionRuns.hasMoreElements()) {
- DirectionRun run = (DirectionRun) directionRuns.nextElement();
- int startX = run.getRenderStartX();
- gc.fillRectangle(xOffset + startX, yOffset, run.getRenderStopX() - startX, height);
- }
-}
-/**
- * Returns the offset and direction that will be used to position the caret for
- * the given x location. The caret will be placed in front of or behind the
- * character at location x depending on what type of character (i.e., R2L or L2R)
- * is at location x. This method is used for positioning the caret when a mouse
- * click occurs within the widget.
- * <p>
- *
- * @param x the x location of the character in the line.
- * @return array containing the caret offset and direction for the x location.
- * index 0: offset relative to the start of the line
- * index 1: direction, either ST.COLUMN_NEXT or ST.COLUMN_PREVIOUS.
- * The direction is used to control the caret position at direction
- * boundaries. The semantics follow the behavior for keyboard cursor
- * navigation.
- * Example: RRRLLL
- * Pressing cursor left (COLUMN_PREVIOUS) in the L2R segment places the cursor
- * in front of the first character of the L2R segment. Pressing cursor right
- * (COLUMN_NEXT) in a R2L segment places the cursor behind the last character
- * of the R2L segment. However, both are the same logical offset.
- */
-int[] getCaretOffsetAndDirectionAtX(int x) {
- int lineLength = getTextLength();
- int offset;
- int direction;
-
- if (lineLength == 0) {
- return new int[] {0, 0};
- }
- int eol = renderPositions[renderPositions.length - 1] + dx[dx.length - 1];
- if (x >= eol) {
- return new int[] {lineLength, ST.COLUMN_NEXT};
- }
- // get the visual offset of the clicked character
- int visualOffset = getVisualOffsetAtX(x);
- // figure out if the character was clicked on the right or left
- int halfway = renderPositions[visualOffset] + dx[visualOffset] / 2;
- boolean visualLeft = (x <= halfway);
- offset = getLogicalOffset(visualOffset);
-
- if (isRightToLeft(offset)) {
- if (visualLeft) {
- if (isLigated(gc)) {
- // the caret should be positioned after the last
- // character of the ligature
- offset = getLigatureEndOffset(offset);
- }
- offset++;
- // position the caret as if the caret is to the right
- // of the character at location x and the NEXT key is
- // pressed
- direction = ST.COLUMN_NEXT;
- }
- else {
- // position the caret as if the caret is to the left
- // of the character at location x and the PREVIOUS key is
- // pressed
- direction = ST.COLUMN_PREVIOUS;
- }
- }
- else {
- if (visualLeft) {
- // position the caret as if the caret is to the right
- // of the character at location x and the PREVIOUS key is
- // pressed
- direction = ST.COLUMN_PREVIOUS;
- }
- else {
- // position the caret as if the caret is to the left
- // of the character at location x and the NEXT key is
- // pressed
- offset++;
- direction = ST.COLUMN_NEXT;
- }
- }
- return new int[] {offset, direction};
-}
-/**
- * Returns the caret position at the specified offset in the line.
- * <p>
- * @param logicalOffset offset of the character in the line
- * @return the caret position at the specified offset in the line.
- */
-int getCaretPosition(int logicalOffset) {
- return getCaretPosition(logicalOffset, ST.COLUMN_NEXT);
-}
-/**
- * Returns the caret position at the specified offset in the line.
- * The direction parameter is used to determine the caret position
- * at direction boundaries. If the logical offset is between a R2L
- * and a L2R segment, pressing cursor left in the L2R segment places
- * the cursor in front of the first character of the L2R segment; whereas
- * pressing cursor right in the R2L segment places the cursor behind
- * the last character of the R2L segment. However, both caret positions
- * are at the same logical offset.
- * <p>
- *
- * @param logicalOffset offset of the character in the line
- * @param direction direction the caret moved to the specified location.
- * either ST.COLUMN_NEXT (right cursor key) or ST.COLUMN_PREVIOUS (left cursor key) .
- * @return the caret position at the specified offset in the line,
- * taking the direction into account as described above.
- */
-int getCaretPosition(int logicalOffset, int direction) {
- int caretX;
-
- if (getTextLength() == 0) {
- return StyledText.XINSET;
- }
- // at or past end of line?
- if (logicalOffset >= order.length) {
- logicalOffset = Math.min(logicalOffset, order.length - 1);
- int visualOffset = order[logicalOffset];
- if (isRightToLeft(logicalOffset)) {
- caretX = renderPositions[visualOffset];
- }
- else {
- caretX = renderPositions[visualOffset] + dx[visualOffset];
- }
- }
- else
- // at beginning of line?
- if (logicalOffset == 0) {
- int visualOffset = order[logicalOffset];
- if (isRightToLeft(logicalOffset)) {
- caretX = renderPositions[visualOffset] + dx[visualOffset];
- }
- else {
- caretX = renderPositions[visualOffset];
- }
- }
- else
- // consider local numbers as R2L in determining direction boundaries.
- // fixes 1GK9API.
- // treat user specified direction segments like real direction changes.
- if (direction == ST.COLUMN_NEXT &&
- (isRightToLeftInput(logicalOffset) != isRightToLeftInput(logicalOffset - 1) ||
- isStartOfBidiSegment(logicalOffset))) {
- int visualOffset = order[logicalOffset-1];
- // moving between segments.
- // do not consider local numbers as R2L here, to determine position,
- // because local numbers are navigated L2R and we want the caret to
- // be to the right of the number. see 1GK9API
- if (isRightToLeft(logicalOffset - 1)) {
- // moving from RtoL to LtoR
- caretX = renderPositions[visualOffset];
- }
- else {
- // moving from LtoR to RtoL
- caretX = renderPositions[visualOffset] + dx[visualOffset];
- }
- }
- else
- // consider local numbers as R2L in determining direction boundaries.
- // fixes 1GK9API.
- if (direction == ST.COLUMN_PREVIOUS &&
- isRightToLeftInput(logicalOffset) != isRightToLeftInput(logicalOffset - 1)) {
- int visualOffset = order[logicalOffset];
- // moving between segments.
- // consider local numbers as R2L here, to determine position, because
- // we want to stay in L2R segment and place the cursor to the left of
- // first L2R character. see 1GK9API
- if (isRightToLeftInput(logicalOffset - 1)) {
- // moving from LtoR to RtoL
- caretX = renderPositions[visualOffset];
- }
- else {
- // moving from RtoL to LtoR
- caretX = renderPositions[visualOffset] + dx[visualOffset];
- }
- }
- else
- if (isRightToLeft(logicalOffset)) {
- int visualOffset = order[logicalOffset];
- caretX = renderPositions[visualOffset] + dx[visualOffset];
- }
- else {
- caretX = renderPositions[order[logicalOffset]];
- }
- return caretX;
-}
-/**
- * Returns the direction segments that are in the specified text
- * range. The text range may be visually discontiguous if the
- * text is bidirectional. Each returned direction run has a single
- * direction and the runs all go from left to right, regardless of
- * the direction of the text in the segment. User specified segments
- * (via BidiSegmentListener) are taken into account and result in
- * separate direction runs.
- * <p>
- *
- * @param logicalStart offset of the logcial start of the first
- * direction segment
- * @param length length of the text included in the direction
- * segments
- * @return the direction segments that are in the specified
- * text range, each segment has a single direction.
- */
-private Vector getDirectionRuns(int logicalStart, int length) {
- Vector directionRuns = new Vector();
- int logicalEnd = logicalStart + length - 1;
- int segmentLogicalStart = logicalStart;
- int segmentLogicalEnd = segmentLogicalStart;
-
- if (logicalEnd < getTextLength()) {
- int bidiSegmentIndex = 0;
- int bidiSegmentEnd = bidiSegments[bidiSegmentIndex + 1];
-
- // Find the bidi segment that the direction runs start in.
- // There will always be at least on bidi segment (for the entire line).
- while (bidiSegmentIndex < bidiSegments.length - 2 && bidiSegmentEnd <= logicalStart) {
- bidiSegmentIndex++;
- bidiSegmentEnd = bidiSegments[bidiSegmentIndex + 1];
- }
- while (segmentLogicalEnd <= logicalEnd) {
- int segType = classBuffer[segmentLogicalStart];
- // Search for the end of the direction segment. Each segment needs to
- // be rendered separately.
- // E.g., 11211 (1=R2L, 2=L2R), rendering from logical index 0 to 5
- // would be visual 1 to 4 and would thus miss visual 0. Rendering the
- // segments separately would render from visual 1 to 0, then 2, then
- // 4 to 3.
- while (segmentLogicalEnd < logicalEnd &&
- segType == classBuffer[segmentLogicalEnd + 1] &&
- segmentLogicalEnd + 1 < bidiSegmentEnd) {
- segmentLogicalEnd++;
- }
- directionRuns.addElement(new DirectionRun(segmentLogicalStart, segmentLogicalEnd));
- segmentLogicalStart = ++segmentLogicalEnd;
- // The current direction run ends at a bidi segment end. Get the next bidi segment.
- if (segmentLogicalEnd == bidiSegmentEnd && bidiSegmentIndex < bidiSegments.length - 2) {
- bidiSegmentIndex++;
- bidiSegmentEnd = bidiSegments[bidiSegmentIndex + 1];
- }
- }
- }
- return directionRuns;
-}
-/**
- * Returns the offset of the last character comprising a ligature.
- * <p>
- *
- * @return the offset of the last character comprising a ligature.
- */
-int getLigatureEndOffset(int offset) {
- // assume only bidi languages support ligatures
- if (!isRightToLeft(offset)) return offset;
- int newOffset = offset;
- int i = offset + 1;
- // a ligature is a visual character that is comprised of
- // multiple logical characters, thus each logical part of
- // a ligature will have the same order value
- while (i<order.length && (order[i] == order[offset])) {
- newOffset = i;
- i++;
- }
- return newOffset;
-}
-/**
- * Returns the offset of the first character comprising a ligature.
- * <p>
- *
- * @return the offset of the first character comprising a ligature.
- */
-int getLigatureStartOffset(int offset) {
- // assume only bidi languages support ligatures
- if (!isRightToLeft(offset)) return offset;
- int newOffset = offset;
- int i = offset - 1;
- // a ligature is a visual character that is comprised of
- // multiple logical characters, thus each logical part of
- // a ligature will have the same order value
- while (i>=0 && (order[i] == order[offset])) {
- newOffset = i;
- i--;
- }
- return newOffset;
-}
-/**
- * Returns the logical offset of the character at the specified
- * visual offset.
- * <p>
- *
- * @param visualOffset the visual offset
- * @return the logical offset of the character at <code>visualOffset</code>.
- */
-private int getLogicalOffset(int visualOffset) {
- int logicalOffset = 0;
-
- while (logicalOffset < order.length && order[logicalOffset] != visualOffset) {
- logicalOffset++;
- }
- return logicalOffset;
-}
-/**
- * Returns the offset of the character at the specified x location.
- * <p>
- *
- * @param x the location of the character
- * @return the logical offset of the character at the specified x
- * location.
- */
-int getOffsetAtX(int x) {
- int visualOffset;
-
- if (getTextLength() == 0) {
- return 0;
- }
- if (x >= renderPositions[renderPositions.length - 1] + dx[dx.length - 1]) {
- // Return when x is past the end of the line. Fixes 1GLADBK.
- return -1;
- }
- visualOffset = getVisualOffsetAtX(x);
- return getLogicalOffset(visualOffset);
-}
-/**
- * Returns the visual offset of the character at the specified x
- * location.
- * <p>
- *
- * @param x the location of the character
- * @return the visual offset of the character at the specified x
- * location.
- */
-private int getVisualOffsetAtX(int x) {
- int lineLength = getTextLength();
- int low = -1;
- int high = lineLength;
-
- while (high - low > 1) {
- int offset = (high + low) / 2;
- int visualX = renderPositions[offset];
-
- // visualX + dx is the start of the next character. Restrict right/high
- // search boundary only if x is before next character. Fixes 1GL4ZVE.
- if (x < visualX + dx[offset]) {
- high = offset;
- }
- else
- if (high == lineLength && high - offset == 1) {
- // requested x location is past end of line
- high = -1;
- }
- else {
- low = offset;
- }
- }
- return high;
-}
-/**
- * Returns the reordering indices that map between logical and
- * visual index of characters in the specified range.
- * <p>
- *
- * @param start start offset of the reordering indices
- * @param length number of reordering indices to return
- * @return the reordering indices that map between logical and
- * visual index of characters in the specified range. Relative
- * to the start of the range.
- */
-private int[] getRenderIndexesFor(int start, int length) {
- int[] positions = new int[length];
- int end = start + length;
-
- for (int i = start; i < end; i++) {
- positions[i-start] = order[i];
- }
- return positions;
-}
-/**
- * Break up the given ranges such that each range is fully contained within a bidi
- * segment.
- */
-private StyleRange[] segmentedRangesFor(StyleRange[] ranges) {
- if ((bidiSegments == null) || (bidiSegments.length == 0)) return ranges;
- Vector newRanges = new Vector();
- int j=0;
- int startSegment;
- int endSegment;
- for (int i=0; i<ranges.length; i++) {
- int start = ranges[i].start;
- int end = start+ranges[i].length;
- startSegment=-1;
- endSegment=-1;
- boolean done = false;
- while (j<bidiSegments.length && !done) {
- if (bidiSegments[j]<=start) {
- startSegment=j;
- }
- if (bidiSegments[j]>=end) {
- endSegment=j-1;
- j--;
- }
- done = (startSegment != -1) && (endSegment != -1);
- if (!done) j++;
- }
- if (startSegment == endSegment) {
- // range is within one segment
- StyleRange newStyle = new StyleRange(start, end-start, null, null);
- newRanges.addElement(newStyle);
- } else if (startSegment > endSegment) {
- // range is within no segment (i.e., it's empty)
- } else {
- // range spans multiple segments
- StyleRange newStyle = new StyleRange(start, bidiSegments[startSegment+1]-start, null, null);
- newRanges.addElement(newStyle);
- startSegment++;
- for (int k=startSegment; k<endSegment; k++) {
- newStyle = new StyleRange(bidiSegments[k], bidiSegments[k+1]-bidiSegments[k], null, null);
- newRanges.addElement(newStyle);
- }
- newStyle = new StyleRange(bidiSegments[endSegment], end-bidiSegments[endSegment], null, null);
- newRanges.addElement(newStyle);
- }
- }
- StyleRange[] rangeArray = new StyleRange[newRanges.size()];
- for (int i=0; i<newRanges.size(); i++) {
- rangeArray[i]=(StyleRange)newRanges.elementAt(i);
- }
- return rangeArray;
-}
-/**
- * Returns the number of characters in the line.
- * <p>
- *
- * @return the number of characters in the line.
- */
-private int getTextLength() {
- return dx.length;
-}
-/**
- * Returns the width in pixels of the line.
- * <p>
- *
- * @return the width in pixels of the line.
- */
-int getTextWidth() {
- int width = 0;
-
- if (getTextLength() > 0) {
- width = renderPositions[renderPositions.length - 1] + dx[dx.length - 1];
- }
- return width;
-}
-/**
- * Returns whether the current platform supports a bidi language.
- * <p>
- *
- * @return true=bidi is supported, false otherwise.
- */
-static boolean isBidiPlatform() {
- return BidiUtil.isBidiPlatform();
-}
-/**
- * Returns whether the font set in the specified gc supports
- * character shaping.
- * <p>
- *
- * @param gc the GC that should be tested for character shaping.
- * @return
- * true=the font set in the specified gc supports character shaped glyphs
- * false=the font set in the specified gc doesn't support character shaped glyphs
- */
-static boolean isCharacterShaped(GC gc) {
- return (BidiUtil.getFontBidiAttributes(gc) & BidiUtil.GLYPHSHAPE) != 0;
-}
-/**
- * Returns whether the font set in the specified gc contains
- * ligatured glyphs.
- * <p>
- *
- * @param gc the GC that should be tested for ligatures.
- * @return
- * true=the font set in the specified gc contains ligatured glyphs.
- * false=the font set in the specified gc doesn't contain ligatured
- * glyphs.
- */
-static boolean isLigated(GC gc) {
- return (BidiUtil.getFontBidiAttributes(gc) & BidiUtil.LIGATE) != 0;
-}
-/**
- * Returns the direction of the character at the specified index.
- * Used for rendering and caret positioning where local numbers (e.g.,
- * national Arabic, or Hindi, numbers) are considered left-to-right.
- * <p>
- *
- * @param logicalIndex the index of the character
- * @return
- * true=the character at the specified index is in a right-to-left
- * codepage (e.g., Hebrew, Arabic).
- * false=the character at the specified index is in a left-to-right/latin
- * codepage.
- */
-boolean isRightToLeft(int logicalIndex) {
- boolean isRightToLeft = false;
-
- if (logicalIndex < classBuffer.length) {
- isRightToLeft = (classBuffer[logicalIndex] == BidiUtil.CLASS_ARABIC) ||
- (classBuffer[logicalIndex] == BidiUtil.CLASS_HEBREW);
- }
- return isRightToLeft;
-}
-/**
- * Returns the direction of the character at the specified index.
- * Used for setting the keyboard language where local numbers (e.g.,
- * national Arabic, or Hindi, numbers) are considered right-to-left.
- * <p>
- *
- * @param logicalIndex the index of the character
- * @return
- * true=the character at the specified index is in a right-to-left
- * codepage (e.g., Hebrew, Arabic).
- * false=the character at the specified index is in a left-to-right/latin
- * codepage.
- */
-boolean isRightToLeftInput(int logicalIndex) {
- boolean isRightToLeft = false;
-
- if (logicalIndex < classBuffer.length) {
- isRightToLeft = (classBuffer[logicalIndex] == BidiUtil.CLASS_ARABIC) ||
- (classBuffer[logicalIndex] == BidiUtil.CLASS_HEBREW) ||
- (classBuffer[logicalIndex] == BidiUtil.CLASS_LOCALNUMBER);
- }
- return isRightToLeft;
-}
-/**
- * Returns whether the specified index is the start of a user
- * specified direction segment.
- * <p>
- *
- * @param logicalIndex the index to test
- * @return true=the specified index is the start of a user specified
- * direction segment, false otherwise
- */
-private boolean isStartOfBidiSegment(int logicalIndex) {
- for (int i = 0; i < bidiSegments.length; i++) {
- if (bidiSegments[i] == logicalIndex) return true;
- }
- return false;
-}
-/**
- * Reorders and calculates render positions for the specified sub-line
- * of text. The results will be merged with the data for the rest of
- * the line .
- * <p>
- *
- * @param textline the entire line of text that this object represents.
- * @param logicalStart the start offset of the first character to
- * reorder.
- * @param length the number of characters to reorder
- */
-private void prepareFontStyledText(String textline, int logicalStart, int length) {
- int byteCount = length;
- int flags = 0;
- String text = textline.substring(logicalStart, logicalStart + length);
-
- // Figure out what is before and after the substring so that the proper character
- // shaping will occur. Character shaping will not occur across bidi segments, so
- // if the styled text starts or ends on a bidi segment, do not process the text
- // for character shaping.
- if (logicalStart != 0
- && isCharacterShaped(gc)
- && !isStartOfBidiSegment(logicalStart)
- && !Compatibility.isWhitespace(textline.charAt(logicalStart - 1))
- && isRightToLeft(logicalStart - 1)) {
- // if the start of the substring is not the beginning of the
- // text line, check to see what is before the string
- flags |= BidiUtil.LINKBEFORE;
- }
- if ((logicalStart + byteCount) != dx.length
- && isCharacterShaped(gc)
- && !isStartOfBidiSegment(logicalStart + length)
- && !Compatibility.isWhitespace(textline.charAt(logicalStart + byteCount))
- && isRightToLeft(logicalStart + byteCount)) {
- // if the end of the substring is not the end of the text line,
- // check to see what is after the substring
- flags |= BidiUtil.LINKAFTER;
- }
- // set classification values for the substring
- flags |= BidiUtil.CLASSIN;
- byte[] classArray = new byte[byteCount];
- int[] renderIndexes = getRenderIndexesFor(logicalStart, byteCount);
- for (int i = 0; i < byteCount; i++) {
- classArray[i] = classBuffer[renderIndexes[i]];
- }
- int[] dxArray = new int[byteCount];
- int[] orderArray = new int[byteCount];
- BidiUtil.getRenderInfo(gc, text, orderArray, classArray, dxArray, flags, new int[] {0, text.length()});
- // update the existing dx array with the new dx values based on the bold font
- for (int i = 0; i < dxArray.length; i++) {
- int dxValue = dxArray[orderArray[i]];
- int visualIndex = renderIndexes[i];
- dx[visualIndex] = dxValue;
- }
-}
-/**
- * Redraws a rectangle spanning the given logical range.
- * The rectangle may be visually discontiguous if the text segment
- * is bidirectional.
- * <p>
- *
- * @param parent window that should be invalidated
- * @param logicalStart logcial start offset of the rectangle
- * @param length number of logical characters the rectangle should span
- * @param xOffset x location of the line start
- * @param yOffset y location of the line start
- * @param height height of the invalidated rectangle
- */
-void redrawRange(Control parent, int logicalStart, int length, int xOffset, int yOffset, int height) {
- Enumeration directionRuns = getDirectionRuns(logicalStart, length).elements();
-
- if (logicalStart + length > getTextLength()) {
- return;
- }
- while (directionRuns.hasMoreElements()) {
- DirectionRun run = (DirectionRun) directionRuns.nextElement();
- int startX = run.getRenderStartX();
-
- parent.redraw(xOffset + startX, yOffset, run.getRenderStopX() - startX, height, true);
- }
-}
-/**
- * Sets the keyboard language to match the codepage of the character
- * at the specified offset.
- * Only distinguishes between left-to-right and right-to-left
- * characters and sets the keyboard language to one of Latin, Hebrew
- * and Arabic.
- * <p>
- *
- * @param logicalIndex logical offset of the character to use for
- * determining the new keyboard language.
- */
-void setKeyboardLanguage(int logicalIndex) {
- int language = BidiUtil.KEYBOARD_LATIN;
-
- if (logicalIndex >= classBuffer.length) {
- return;
- }
- if (isRightToLeftInput(logicalIndex)) {
- String codePage = System.getProperty("file.encoding").toUpperCase();
- if ("CP1255".equals(codePage)) {
- language = BidiUtil.KEYBOARD_HEBREW;
- }
- else
- if ("CP1256".equals(codePage)) {
- language = BidiUtil.KEYBOARD_ARABIC;
- }
- }
- BidiUtil.setKeyboardLanguage(language);
-}
-/**
- * Returns a string representation of the receiver.
- * <p>
- *
- * @return a string representation of the receiver for
- * debugging purposes. The output order of the StyledTextbidi values
- * is as follows: order, render position, dx, character class, glyphs.
- */
-public String toString() {
- StringBuffer buf = new StringBuffer();
-
- buf.append("StyledTextBidi {{");
- // order
- for (int i = 0; i < order.length; i++) {
- if (i != 0) {
- buf.append(",");
- }
- buf.append(order[i]);
- }
- buf.append("}, {");
- // render positions
- for (int i = 0; i < renderPositions.length; i++) {
- if (i != 0) {
- buf.append(",");
- }
- buf.append(renderPositions[i]);
- }
- buf.append("}, {");
- // dx
- for (int i = 0; i < dx.length; i++) {
- if (i != 0) {
- buf.append(",");
- }
- buf.append(dx[i]);
- }
- buf.append("}, {");
- // character class
- for (int i = 0; i < classBuffer.length; i++) {
- if (i != 0) {
- buf.append(",");
- }
- buf.append(classBuffer[i]);
- }
- buf.append("}, {");
- // glyphs
- buf.append(glyphBuffer);
- buf.append("}}");
- return buf.toString();
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextContent.java
deleted file mode 100755
index ac8733b45c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextContent.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-public interface StyledTextContent {
-
-/**
- * Called by StyledText to add itself as an Observer to content changes.
- * Implementors should send a TextChangingEvent when changes to the content
- * are about to occur and a TextChangedEvent when the changes did occur.
- * The widget only updates the screen properly when it receives both events.
- * <p>
- *
- * @param listener the listener
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void addTextChangeListener(TextChangeListener listener);
-
-/**
- * Return the number of characters in the content.
- * <p>
- *
- * @return the number of characters in the content.
- */
-public int getCharCount();
-
-/**
- * Return the line at the given line index without delimiters.
- * <p>
- *
- * @param lineIndex index of the line to return. Does not include delimiters
- * of preceeding lines. Index 0 is the first line of the content.
- * @return the line text without delimiters
- */
-public String getLine(int lineIndex);
-
-/**
- * Return the line index at the given character offset.
- * <p>
- *
- * @param offset offset of the line to return. The first character of the document
- * is at offset 0. An offset of getLength() is valid and should answer
- * the number of lines.
- * @return the line index. The first line is at index 0. If the character at offset
- * is a delimiter character, answer the line index of the line that is delimited.
- * For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
- * <ul>
- * <li>getLineAtOffset(0) == 0
- * <li>getLineAtOffset(1) == 0
- * <li>getLineAtOffset(2) == 1
- * <li>getLineAtOffset(3) == 1
- * <li>getLineAtOffset(4) == 2
- * </ul>
- */
-public int getLineAtOffset(int offset);
-
-/**
- * Return the number of lines. Should answer 1 when no text is specified.
- * The StyledText widget relies on this behavior for drawing the cursor.
- * <p>
- *
- * @return the number of lines. For example:
- * <ul>
- * <li> text value ==> getLineCount
- * <li> null ==> 1
- * <li> "" ==> 1
- * <li> "a\n" ==> 2
- * <li> "\n\n" ==> 3
- * </ul>
- */
-public int getLineCount();
-
-/**
- * Return the line delimiter that should be used by the StyledText
- * widget when inserting new lines. New lines entered using key strokes
- * and paste operations use this line delimiter.
- * Implementors may use System.getProperty("line.separator") to return
- * the platform line delimiter.
- * <p>
- *
- * @return the line delimiter that should be used by the StyledText widget
- * when inserting new lines.
- */
-public String getLineDelimiter();
-
-/**
- * Return the character offset of the first character of the given line.
- * <p>
- * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0)
- * is a valid call that should return 0.
- * </p>
- *
- * @param lineIndex index of the line. The first line is at index 0.
- * @return offset offset of the first character of the line. The first character
- * of the document is at offset 0. The return value should include
- * line delimiters. For example, if text = "\r\ntest\r\n" and delimiter = "\r\n",
- * then:
- * <ul>
- * <li>getOffsetAtLine(0) == 0
- * <li>getOffsetAtLine(1) == 2
- * <li>getOffsetAtLine(2) == 8
- * </ul>
- */
-public int getOffsetAtLine(int lineIndex);
-
-/**
- * Returns a string representing the content at the given range.
- * <p>
- *
- * @param start the start offset of the text to return. Offset 0 is the first
- * character of the document.
- * @param length the length of the text to return
- * @return the text at the given range
- */
-public String getTextRange(int start, int length);
-
-/**
- * Remove the specified text changed listener.
- * <p>
- *
- * @param listener the listener
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void removeTextChangeListener(TextChangeListener listener);
-
-/**
- * Replace the text with "newText" starting at position "start"
- * for a length of "replaceLength".
- * <p>
- * Implementors have to notify the TextChangeListeners that were added
- * using <code>addTextChangeListener</code> before and after the content
- * is changed. A <code>TextChangingEvent</code> has to be sent before the
- * content is changed and a <code>TextChangedEvent</code> has to be sent
- * after the content has changed.
- * The text change that occurs after the <code>TextChangingEvent</code>
- * has been sent has to be consistent with the data provided in the
- * <code>TextChangingEvent</code>.
- * This data will be cached by the widget and will be used when the
- * <code>TextChangedEvent</code> is received.
- * <p>
- * The <code>TextChangingEvent</code> should be set as follows:
- * <ul>
- * <li>event.start = start of the replaced text
- * <li>event.newText = text that is going to be inserted or empty String
- * if no text will be inserted
- * <li>event.replaceCharCount = length of text that is going to be replaced
- * <li>event.newCharCount = length of text that is going to be inserted
- * <li>event.replaceLineCount = number of lines that are going to be replaced
- * <li>event.newLineCount = number of new lines that are going to be inserted
- * </ul>
- * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount is
- * the number of deleted lines based on the change that occurs visually. For
- * example:
- * <ul>
- * <li>(replaceText, newText) ==> (replaceLineCount, newLineCount)
- * <li>("", "\n") ==> (0, 1)
- * <li>("\n\n", "a") ==> (2, 0)
- * <li>("a", "\n\n") ==> (0, 2)
- * <li>("\n", "") ==> (1, 0)
- * </ul>
- * </p>
- *
- * @param start start offset of text to replace, none of the offsets include
- * delimiters of preceeding lines, offset 0 is the first character of the document
- * @param replaceLength start offset of text to replace
- * @param newText start offset of text to replace
- */
-public void replaceTextRange(int start, int replaceLength, String text);
-
-/**
- * Set text to "text".
- * Implementors have to send a <code>TextChangedEvent</code> to the
- * TextChangeListeners that were added using <code>addTextChangeListener</code>.
- * <p>
- *
- * @param text the new text
- */
-public void setText(String text);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextEvent.java
deleted file mode 100755
index 5fd9e16754..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- *
- */
-class StyledTextEvent extends Event {
- // used by LineStyleEvent
- StyleRange[] styles;
- // used by LineBackgroundEvent
- Color lineBackground;
- // used by BidiSegmentEvent
- int[] segments;
- // used by TextChangedEvent
- int replaceCharCount;
- int newCharCount;
- int replaceLineCount;
- int newLineCount;
-
-StyledTextEvent (StyledTextContent content) {
- super();
- data = content;
-}
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java
deleted file mode 100755
index a708fa0334..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.SWTEventListener;
-
-class StyledTextListener extends TypedListener {
-/**
- */
-StyledTextListener(SWTEventListener listener) {
- super(listener);
-}
-/**
- * Process StyledText events by invoking the event's handler.
- */
-public void handleEvent(Event e) {
- TextChangedEvent textChangedEvent;
-
- switch (e.type) {
- case StyledText.ExtendedModify:
- ExtendedModifyEvent extendedModifyEvent = new ExtendedModifyEvent((StyledTextEvent) e);
- ((ExtendedModifyListener) eventListener).modifyText(extendedModifyEvent);
- break;
-
- case StyledText.LineGetBackground:
- LineBackgroundEvent lineBgEvent = new LineBackgroundEvent((StyledTextEvent) e);
- ((LineBackgroundListener) eventListener).lineGetBackground(lineBgEvent);
- ((StyledTextEvent) e).lineBackground = lineBgEvent.lineBackground;
- break;
-
- case StyledText.LineGetSegments:
- BidiSegmentEvent segmentEvent = new BidiSegmentEvent((StyledTextEvent) e);
- ((BidiSegmentListener) eventListener).lineGetSegments(segmentEvent);
- ((StyledTextEvent) e).segments = segmentEvent.segments;
- break;
-
- case StyledText.LineGetStyle:
- LineStyleEvent lineStyleEvent = new LineStyleEvent((StyledTextEvent) e);
- ((LineStyleListener) eventListener).lineGetStyle(lineStyleEvent);
- ((StyledTextEvent) e).styles = lineStyleEvent.styles;
- break;
-
- case StyledText.VerifyKey:
- VerifyEvent verifyEvent = new VerifyEvent(e);
- ((VerifyKeyListener) eventListener).verifyKey(verifyEvent);
- e.doit = verifyEvent.doit;
- break;
-
- case StyledText.TextChanged:
- textChangedEvent = new TextChangedEvent((StyledTextContent) e.data);
- ((TextChangeListener) eventListener).textChanged(textChangedEvent);
- break;
-
- case StyledText.TextChanging:
- TextChangingEvent textChangingEvent = new TextChangingEvent((StyledTextContent) e.data, (StyledTextEvent) e);
- ((TextChangeListener) eventListener).textChanging(textChangingEvent);
- break;
-
- case StyledText.TextSet:
- textChangedEvent = new TextChangedEvent((StyledTextContent) e.data);
- ((TextChangeListener) eventListener).textSet(textChangedEvent);
- break;
- }
-}
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrinter.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrinter.java
deleted file mode 100755
index b333851d67..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrinter.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import java.util.Vector;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.printing.*;
-import org.eclipse.swt.internal.Compatibility;
-
-class StyledTextPrinter implements Runnable {
- class RTFState {
- int fontStyle;
- int foreground;
- int background;
- }
- Vector savedState = new Vector();
-
- Printer printer;
- GC gc;
- String rtf;
- StringBuffer wordBuffer;
- int startPage, endPage, currentPage;
- int index, end;
- String tabs = "";
- int tabWidth = 0;
- int lineHeight = 0;
- int leftMargin, rightMargin, topMargin, bottomMargin;
- int x, y;
-
- /* We can optimize for fonts because we know styledText only has one font.
- * As soon as we know the font name and point size, we will create and store
- * fonts for the following styles: normal, bold, italic, and bold italic.
- */
- Font fontTable[][] = new Font[1][4];
- boolean creatingFontTable = false;
- String fontName;
- int fontSize;
- int currentFontStyle = SWT.NORMAL;
- int currentFont = -1;
- int defaultFont = -1;
-
- Vector colorTable = new Vector();
- boolean creatingColorTable = false;
- int red, green, blue;
- int currentForeground = -1;
- int currentBackground = -1;
-
- static void print(StyledText styledText) {
- Printer printer = new Printer();
- new StyledTextPrinter(styledText, printer).run();
- printer.dispose();
- }
-
- StyledTextPrinter(StyledText styledText, Printer printer) {
- this.printer = printer;
- PrinterData data = printer.getPrinterData();
- startPage = 1;
- endPage = Integer.MAX_VALUE;
- if (data.scope == PrinterData.PAGE_RANGE) {
- startPage = data.startPage;
- endPage = data.endPage;
- }
-
- /* Create a buffer for computing tab width. */
- int tabSize = styledText.getTabs();
- StringBuffer tabBuffer = new StringBuffer(tabSize);
- for (int i = 0; i < tabSize; i++) tabBuffer.append(' ');
- tabs = tabBuffer.toString();
-
- /* Get RTF from the StyledText.*/
- rtf = styledText.getRtf();
- }
-
- public void run() {
- if (printer.startJob("Printing")) {
- Rectangle clientArea = printer.getClientArea();
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- Point dpi = printer.getDPI();
- leftMargin = dpi.x + trim.x; // one inch from left side of paper
- rightMargin = clientArea.width - dpi.x + trim.x + trim.width; // one inch from right side of paper
- topMargin = dpi.y + trim.y; // one inch from top edge of paper
- bottomMargin = clientArea.height - dpi.y + trim.y + trim.height; // one inch from bottom edge of paper
-
- /* Create a printer GC and print the RTF to it. */
- gc = new GC(printer);
- x = leftMargin;
- y = topMargin;
- currentPage = 1;
- if (startPage == 1) {
- printer.startPage();
- }
- end = rtf.length();
- index = 0;
- wordBuffer = new StringBuffer();
- while (index < end) {
- char c = rtf.charAt(index);
- index++;
- switch (c) {
- case '\\':
- printWordBuffer();
- parseControlWord();
- break;
- case '{':
- printWordBuffer();
- saveState();
- break;
- case '}':
- printWordBuffer();
- restoreState();
- break;
- case 0x0a:
- case 0x0d:
- printWordBuffer();
- break;
- default:
- parseChar(c);
- }
- }
- if (y + lineHeight <= bottomMargin) {
- printer.endPage();
- }
- printer.endJob();
-
- /* Cleanup */
- gc.dispose();
- for (int i = 0; i < 4; i++) {
- fontTable[currentFont][i].dispose();
- }
- for (int i = 0; i < colorTable.size(); i++) {
- ((Color)colorTable.elementAt(i)).dispose();
- }
- }
- }
-
- void parseControlWord() {
- if (index >= end) return;
- char c = rtf.charAt(index);
- index++;
- if (!Compatibility.isLetter(c)) {
- handleControlSymbol(c);
- return;
- }
- StringBuffer controlWord = new StringBuffer();
- controlWord.append(c);
- while (index < end) {
- c = rtf.charAt(index);
- index++;
- if (!Compatibility.isLetter(c)) break;
- controlWord.append(c);
- }
- boolean isNegative = false;
- if (c == '-') {
- isNegative = true;
- c = rtf.charAt(index);
- index++;
- }
- boolean hasParameter = false;
- StringBuffer paramBuffer = new StringBuffer();
- int parameter = 0;
- if (Character.isDigit(c)) {
- hasParameter = true;
- paramBuffer.append(c);
- while (index < end) {
- c = rtf.charAt(index);
- index++;
- if (!Character.isDigit(c)) break;
- paramBuffer.append(c);
- }
- try {
- parameter = Integer.valueOf(paramBuffer.toString()).intValue();
- } catch (NumberFormatException e) {}
- if (isNegative) parameter = -parameter;
- }
- if (c != ' ') index--;
- if (hasParameter) {
- handleControlWord(controlWord.toString(), parameter);
- } else {
- handleControlWord(controlWord.toString());
- }
- }
-
- void parseChar(char c) {
- if (c == 0) return;
- if (c == ';') {
- if (creatingFontTable) {
- fontName = wordBuffer.toString();
- wordBuffer = new StringBuffer();
- creatingFontTable = false;
- return;
- }
- if (creatingColorTable) {
- colorTable.addElement(new Color(printer, red, green, blue));
- red = green = blue = 0;
- return;
- }
- }
- if (c != '\t') {
- wordBuffer.append(c);
- }
- if (!Compatibility.isLetterOrDigit(c) && !creatingFontTable) {
- printWordBuffer();
- if (c == '\t') {
- x += tabWidth;
- }
- }
- }
-
- void printWordBuffer() {
- if (wordBuffer.length() > 0) {
- String word = wordBuffer.toString();
- int wordWidth = gc.stringExtent(word).x;
- if (x + wordWidth > rightMargin) {
- /* word doesn't fit on current line, so wrap */
- newline();
- }
- if (currentPage >= startPage && currentPage <= endPage) {
- gc.drawString(word, x, y, true);
- }
- x += wordWidth;
- wordBuffer = new StringBuffer();
- }
- }
-
- void handleControlSymbol(char c) {
- switch (c) {
- case '\\':
- case '{':
- case '}':
- parseChar(c);
- }
- }
-
- void handleControlWord(String controlWord) {
- if (controlWord.equals("par")) newline();
- else if (controlWord.equals("b")) setFontStyle(currentFontStyle | SWT.BOLD);
- else if (controlWord.equals("i")) setFontStyle(currentFontStyle | SWT.ITALIC);
- else if (controlWord.equals("fnil")) setFont(defaultFont);
- else if (controlWord.equals("fonttbl")) createFontTable();
- else if (controlWord.equals("colortbl")) createColorTable();
- }
-
- void handleControlWord(String controlWord, int parameter) {
- if (controlWord.equals("highlight")) setBackground(parameter);
- else if (controlWord.equals("cf")) setForeground(parameter);
- else if (controlWord.equals("b")) setFontStyle(currentFontStyle & ~SWT.BOLD);
- else if (controlWord.equals("i")) setFontStyle(currentFontStyle & ~SWT.ITALIC);
- else if (controlWord.equals("f")) setFont(parameter);
- else if (controlWord.equals("fs")) setFontSize(parameter);
- else if (controlWord.equals("red")) red = parameter;
- else if (controlWord.equals("green")) green = parameter;
- else if (controlWord.equals("blue")) blue = parameter;
- else if (controlWord.equals("deff")) setDefaultFont(parameter);
- }
-
- void setDefaultFont(int number) {
- defaultFont = number;
- }
-
- void setFont(int number) {
- currentFont = number;
- }
-
- void createFontTable() {
- creatingFontTable = true;
- currentFont = 0;
- }
-
- void setFontSize(int size) {
- fontSize = size / 2;
- createFonts();
- }
-
- void createFonts() {
- if (fontName != null && fontSize != -1) {
- // currentFont must already be set
- fontTable[currentFont][0] = new Font(printer, fontName, fontSize, SWT.NORMAL);
- fontTable[currentFont][1] = new Font(printer, fontName, fontSize, SWT.BOLD);
- fontTable[currentFont][2] = new Font(printer, fontName, fontSize, SWT.ITALIC);
- fontTable[currentFont][3] = new Font(printer, fontName, fontSize, SWT.BOLD | SWT.ITALIC);
- setFontStyle(SWT.NORMAL);
- }
- }
-
- void setFontStyle(int style) {
- // currentFont must already be set
- Font font;
- if ((style & SWT.BOLD) != 0) {
- if ((style & SWT.ITALIC) != 0) {
- font = fontTable[currentFont][3];
- } else {
- font = fontTable[currentFont][1];
- }
- } else if ((style & SWT.ITALIC) != 0) {
- font = fontTable[currentFont][2];
- } else {
- font = fontTable[currentFont][0];
- }
- gc.setFont(font);
- tabWidth = gc.stringExtent(tabs).x;
- lineHeight = gc.getFontMetrics().getHeight();
- currentFontStyle = style;
- }
-
- void createColorTable() {
- creatingColorTable = true;
- red = green = blue = 0;
- }
-
- void setForeground(int color) {
- if (color != currentForeground) {
- // colors must already be in table
- gc.setForeground((Color)colorTable.elementAt(color));
- currentForeground = color;
- }
- }
-
- void setBackground(int color) {
- if (color != currentBackground) {
- // colors must already be in table
- gc.setBackground((Color)colorTable.elementAt(color));
- currentBackground = color;
- }
- }
-
- void newline() {
- x = leftMargin;
- y += lineHeight;
- if (y + lineHeight > bottomMargin) {
- printer.endPage();
- if (index + 1 < end) {
- y = topMargin;
- currentPage++;
- if (currentPage >= startPage && currentPage <= endPage) {
- printer.startPage();
- }
- }
- }
- }
-
- void saveState() {
- RTFState state = new RTFState();
- state.fontStyle = currentFontStyle;
- state.foreground = currentForeground;
- state.background = currentBackground;
- savedState.addElement(state);
- }
-
- void restoreState() {
- if (savedState.isEmpty()) return;
- if (creatingColorTable) {
- setForeground(0);
- setBackground(1);
- creatingColorTable = false;
- }
-
- int index = savedState.size() - 1;
- RTFState state = (RTFState)savedState.elementAt(index);
- savedState.removeElementAt(index);
-
- setFontStyle(state.fontStyle);
- if (state.foreground != -1) setForeground(state.foreground);
- if (state.background != -1) setBackground(state.background);
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableEditor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableEditor.java
deleted file mode 100755
index 1fdca24770..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableEditor.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
-*
-* A TableEditor is a manager for a Control that appears above a cell in a Table and tracks with the
-* moving and resizing of that cell. It can be used to display a text widget above a cell
-* in a Table so that the user can edit the contents of that cell. It can also be used to display
-* a button that can launch a dialog for modifying the contents of the associated cell.
-*
-* <p> Here is an example of using a TableEditor:
-* <code><pre>
-* Table table = new Table(parent, SWT.FULL_SELECTION);
-* TableEditor editor = new TableEditor (table);
-* table.addSelectionListener (new SelectionAdapter() {
-* public void widgetSelected(SelectionEvent e) {
-*
-* // Clean up any previous editor control
-* Control oldEditor = editor.getEditor();
-* if (oldEditor != null)
-* oldEditor.dispose();
-*
-* // Identify the selected row
-* int index = table.getSelectionIndex ();
-* if (index == -1) return;
-* TableItem item = table.getItem (index);
-*
-* // The control that will be the editor must be a child of the Table
-* Text text = new Text(table, SWT.NONE);
-*
-* //The text editor must have the same size as the cell and must
-* //not be any smaller than 50 pixels.
-* editor.horizontalAlignment = SWT.LEFT;
-* editor.grabHorizontal = true;
-* editor.minimumWidth = 50;
-*
-* // Open the text editor in the second column of the selected row.
-* editor.setEditor (text, item, 1);
-*
-* // Assign focus to the text control
-* text.setFocus ();
-* }
-* });
-* </pre></code>
-*/
-public class TableEditor extends ControlEditor {
-
- Table table;
- TableItem item;
- int column = -1;
- Listener columnListener;
-/**
-* Creates a TableEditor for the specified Table.
-*
-* @param table the Table Control above which this editor will be displayed
-*
-*/
-public TableEditor (Table table) {
- super(table);
- this.table = table;
-
- columnListener = new Listener() {
- public void handleEvent(Event e) {
- resize ();
- }
- };
-
-}
-Rectangle computeBounds () {
- if (item == null || column == -1 || item.isDisposed()) return new Rectangle(0, 0, 0, 0);
-
- Rectangle cell = item.getBounds(column);
- Rectangle editorRect = new Rectangle(cell.x, cell.y, minimumWidth, cell.height);
- Rectangle area = table.getClientArea();
- if (cell.x < area.x + area.width) {
- if (cell.x + cell.width > area.x + area.width) {
- cell.width = area.width - cell.x;
- }
- }
-
- if (grabHorizontal){
- editorRect.width = Math.max(cell.width, minimumWidth);
- }
-
- if (horizontalAlignment == SWT.RIGHT) {
- editorRect.x += cell.width - editorRect.width;
- } else if (horizontalAlignment == SWT.LEFT) {
- // do nothing - cell.x is the right answer
- } else { // default is CENTER
- editorRect.x += (cell.width - editorRect.width)/2;
- }
-
- return editorRect;
-}
-/**
- * Removes all associations between the TableEditor and the cell in the table. The
- * Table and the editor Control are <b>not</b> disposed.
- */
-public void dispose () {
-
- if (this.column > -1 && this.column < table.getColumnCount()){
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.removeListener(SWT.Resize, columnListener);
- tableColumn.removeListener(SWT.Move, columnListener);
- }
-
- table = null;
- item = null;
- column = -1;
-
- super.dispose();
-}
-/**
-* Returns the zero based index of the column of the cell being tracked by this editor.
-*
-* @return the zero based index of the column of the cell being tracked by this editor
-*/
-public int getColumn () {
- return column;
-}
-public void setColumn(int column) {
-
- if (this.column > -1 && this.column < table.getColumnCount()){
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.removeListener(SWT.Resize, columnListener);
- tableColumn.removeListener(SWT.Move, columnListener);
- this.column = -1;
- }
-
- if (column < 0 || column >= table.getColumnCount()) return;
-
- this.column = column;
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.addListener(SWT.Resize, columnListener);
- tableColumn.addListener(SWT.Move, columnListener);
-}
-/**
-* Returns the TableItem for the row of the cell being tracked by this editor.
-*
-* @return the TableItem for the row of the cell being tracked by this editor
-*/
-public TableItem getItem () {
- return item;
-}
-public void setItem (TableItem item) {
- this.item = item;
-}
-public void setEditor (Control editor) {
- TableItem item = null;
- if (table.getItemCount() > 0) {
- item = table.getItem(0);
- }
- this.setEditor(editor, item, 0);
-}
-
-/**
-* Specify the Control that is to be displayed and the cell in the table that it is to be positioned above.
-*
-* <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Table control
-* specified in the TableEditor constructor.
-*
-* @param editor the Control that is displayed above the cell being edited
-* @param item the TableItem for the row of the cell being tracked by this editor
-* @param column the zero based index of the column of the cell being tracked by this editor
-*/
-public void setEditor (Control editor, TableItem item, int column) {
- setItem(item);
- setColumn(column);
- super.setEditor(editor);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTree.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTree.java
deleted file mode 100755
index fe0fced0ea..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTree.java
+++ /dev/null
@@ -1,761 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Enumeration;
-import java.util.Vector;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A TableTree is a selectable user interface object
- * that displays a hierarchy of items, and issues
- * notification when an item is selected.
- * A TableTree may be single or multi select.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TableTreeItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b> <dd> SINGLE, MULTI, CHECK, FULL_SELECTION
- * <dt><b>Events:</b> <dd> Selection, DefaultSelection, Collapse, Expand
- * </dl>
- */
-public class TableTree extends Composite {
- Table table;
- TableTreeItem[] items = EMPTY_ITEMS;
- Image plusImage, minusImage, sizeImage;
-
- /*
- * TableTreeItems are not treated as children but rather as items.
- * When the TableTree is disposed, all children are disposed because
- * TableTree inherits this behaviour from Composite. The items
- * must be disposed separately. Because TableTree is not part of
- * the org.eclipse.swt.widgets package, the method releaseWidget can
- * not be overriden (this is how items are disposed of in Table and Tree).
- * Instead, the items are disposed of in response to the dispose event on the
- * TableTree. The "inDispose" flag is used to distinguish between disposing
- * one TableTreeItem (e.g. when removing an entry from the TableTree) and
- * disposing the entire TableTree.
- */
- boolean inDispose = false;
-
- static final TableTreeItem[] EMPTY_ITEMS = new TableTreeItem [0];
- static final String[] EMPTY_TEXTS = new String [0];
- static final Image[] EMPTY_IMAGES = new Image [0];
-
-/**
- * Creates a new instance of the widget.
- *
- * @param parent a composite widget
- * @param style the bitwise OR'ing of widget styles
- */
-public TableTree(Composite parent, int style) {
- super(parent, SWT.NONE);
- table = new Table(this, style);
- setBackground(table.getBackground());
- setForeground(table.getForeground());
- setFont(table.getFont());
- Listener tableListener = new Listener() {
- public void handleEvent(Event e) {
- switch (e.type) {
- case SWT.MouseDown: onMouseDown(e); break;
- case SWT.Selection: onSelection(e); break;
- case SWT.DefaultSelection: onSelection(e); break;
- case SWT.KeyDown: onKeyDown(e); break;
- }
- }
- };
- int[] tableEvents = new int[]{SWT.MouseDown,
- SWT.Selection,
- SWT.DefaultSelection,
- SWT.KeyDown};
- for (int i = 0; i < tableEvents.length; i++) {
- table.addListener(tableEvents[i], tableListener);
- }
-
- Listener listener = new Listener() {
- public void handleEvent(Event e) {
- switch (e.type) {
- case SWT.Dispose: onDispose(e); break;
- case SWT.Resize: onResize(e); break;
- case SWT.FocusIn: onFocusIn(e); break;
- }
- }
- };
- int[] events = new int[]{SWT.Dispose,
- SWT.Resize,
- SWT.FocusIn};
- for (int i = 0; i < events.length; i++) {
- addListener(events[i], listener);
- }
-}
-
-int addItem(TableTreeItem item, int index) {
- if (index < 0 || index > items.length) throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
- TableTreeItem[] newItems = new TableTreeItem[items.length + 1];
- System.arraycopy(items, 0, newItems, 0, index);
- newItems[index] = item;
- System.arraycopy(items, index, newItems, index + 1, items.length - index);
- items = newItems;
-
- /* Return the index in the table where this table should be inserted */
- if (index == items.length - 1 )
- return table.getItemCount();
- else
- return table.indexOf(items[index+1].tableItem);
-}
-
-/**
- * Adds the listener to receive selection events.
- * <p>
- *
- * @param listener the selection listener
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when listener is null
- * </ul>
- */
-public void addSelectionListener(SelectionListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-/**
- * Adds the listener to receive tree events.
- * <p>
- *
- * @param listener the tree listener
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when listener is null
- * </ul>
- */
-public void addTreeListener(TreeListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Expand, typedListener);
- addListener (SWT.Collapse, typedListener);
-}
-
-/**
- * Computes the preferred size of the widget.
- * <p>
- * Calculate the preferred size of the widget based
- * on the current contents. The hint arguments allow
- * a specific client area width and/or height to be
- * requested. The hints may be honored depending on
- * the platform and the layout.
- *
- * @param wHint the width hint (can be SWT.DEFAULT)
- * @param hHint the height hint (can be SWT.DEFAULT)
- * @return a point containing the preferred size of the widget including trim
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public Point computeSize (int wHint, int hHint) {
- return table.computeSize (wHint, hHint, true);
-}
-
-/**
- * Computes the widget trim.
- * <p>
- * Trim is widget specific and may include scroll
- * bars and menu bar in addition to other trimmings
- * that are outside of the widget's client area.
- *
- * @param x the x location of the client area
- * @param y the y location of the client area
- * @param width the width of the client area
- * @param height the height of the client area
- * @return a rectangle containing the trim of the widget.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- return table.computeTrim(x, y, width, height);
-}
-
-/**
- * Deselects all items.
- * <p>
- * If an item is selected, it is deselected.
- * If an item is not selected, it remains unselected.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * </ul>
- */
-public void deselectAll () {
- table.deselectAll();
-}
-
-/* Expand upward from the specified leaf item. */
-void expandItem (TableTreeItem item) {
- if (item == null || item.getExpanded()) return;
- expandItem(item.parentItem);
- item.setExpanded(true);
- Event event = new Event();
- event.item = item;
- notifyListeners(SWT.Expand, event);
-}
-
-/**
- * Gets the number of items.
- * <p>
- * @return the number of items in the widget
- */
-public int getItemCount () {
- return items.length;
-}
-
-/**
- * Gets the height of one item.
- * <p>
- * This operation will fail if the height of
- * one item could not be queried from the OS.
- *
- * @return the height of one item in the widget
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT when the operation fails
- * </ul>
- */
-public int getItemHeight () {
- return table.getItemHeight();
-}
-
-/**
- * Gets the items.
- * <p>
- * @return the items in the widget
- *
- */
-public TableTreeItem [] getItems () {
- TableTreeItem[] newItems = new TableTreeItem[items.length];
- System.arraycopy(items, 0, newItems, 0, items.length);
- return newItems;
-}
-
-/**
- * Gets the selected items.
- * <p>
- * This operation will fail if the selected
- * items cannot be queried from the OS.
- *
- * @return the selected items in the widget
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_CANNOT_GET_SELECTION when the operation fails</li>
- * </ul>
- */
-public TableTreeItem [] getSelection () {
- TableItem[] selection = table.getSelection();
- TableTreeItem [] result = new TableTreeItem[selection.length];
- for (int i = 0; i < selection.length; i++){
- result[i] = (TableTreeItem) selection[i].getData();
- }
- return result;
-}
-
-/**
- * Gets the number of selected items.
- * <p>
- * This operation will fail if the number of selected
- * items cannot be queried from the OS.
- *
- * @return the number of selected items in the widget
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_CANNOT_GET_COUNT when the operation fails</li>
- * </ul>
- */
-public int getSelectionCount () {
- return table.getSelectionCount();
-}
-
-/**
- * Returns the underlying Table control.
- *
- * @return the underlying Table control
- */
-public Table getTable () {
- return table;
-}
-
-void createImages () {
-
- int itemHeight = sizeImage.getBounds().height;
- // Calculate border around image.
- // At least 9 pixels are needed to draw the image
- // Leave at least a 6 pixel border.
- int indent = Math.min(6, (itemHeight - 9) / 2);
- indent = Math.max(0, indent);
- int size = Math.max (10, itemHeight - 2 * indent);
- size = ((size + 1) / 2) * 2; // size must be an even number
- int midpoint = indent + size / 2;
-
- Color foreground = getForeground();
- Color plusMinus = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color background = getBackground();
-
- /* Plus image */
- PaletteData palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), plusMinus.getRGB()});
- ImageData imageData = new ImageData(itemHeight, itemHeight, 4, palette);
- imageData.transparentPixel = 1;
- plusImage = new Image(getDisplay(), imageData);
- GC gc = new GC(plusImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, itemHeight, itemHeight);
- gc.setForeground(plusMinus);
- gc.drawRectangle(indent, indent, size, size);
- gc.setForeground(foreground);
- gc.drawLine(midpoint, indent + 2, midpoint, indent + size - 2);
- gc.drawLine(indent + 2, midpoint, indent + size - 2, midpoint);
- gc.dispose();
-
- /* Minus image */
- palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), plusMinus.getRGB()});
- imageData = new ImageData(itemHeight, itemHeight, 4, palette);
- imageData.transparentPixel = 1;
- minusImage = new Image(getDisplay(), imageData);
- gc = new GC(minusImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, itemHeight, itemHeight);
- gc.setForeground(plusMinus);
- gc.drawRectangle(indent, indent, size, size);
- gc.setForeground(foreground);
- gc.drawLine(indent + 2, midpoint, indent + size - 2, midpoint);
- gc.dispose();
-}
-
-Image getPlusImage() {
- if (plusImage == null) createImages();
- return plusImage;
-}
-
-Image getMinusImage() {
- if (minusImage == null) createImages();
- return minusImage;
-}
-
-/**
- * Gets the index of an item.
- *
- * <p>The widget is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based. This index is relative to the parent only.
- *
- * @param item the search item
- * @return the index of the item or -1
- *
- */
-public int indexOf (TableTreeItem item) {
- for (int i = 0; i < items.length; i++) {
- if (item == items[i]) return i;
- }
- return -1;
-}
-
-void onDispose(Event e) {
- inDispose = true;
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
- inDispose = false;
- if (plusImage != null) plusImage.dispose();
- if (minusImage != null) minusImage.dispose();
- if (sizeImage != null) sizeImage.dispose();
- plusImage = minusImage = sizeImage = null;
-}
-
-void onResize(Event e) {
- Rectangle area = getClientArea();
- table.setBounds(0, 0, area.width, area.height);
-}
-
-void onSelection(Event e) {
- Event event = new Event();
- TableItem tableItem = (TableItem)e.item;
- TableTreeItem item = getItem(tableItem);
- event.item = item;
-
- if (e.type == SWT.Selection
- && e.detail == SWT.CHECK
- && item != null) {
- event.detail = SWT.CHECK;
- item.checked = tableItem.getChecked();
- }
- notifyListeners(e.type, event);
-}
-public TableTreeItem getItem(Point point) {
- TableItem item = table.getItem(point);
- if (item == null) return null;
- return getItem(item);
-
-}
-TableTreeItem getItem(TableItem tableItem) {
- if (tableItem == null) return null;
- for (int i = 0; i < items.length; i++) {
- TableTreeItem item = items[i].getItem(tableItem);
- if (item != null) return item;
- }
- return null;
-}
-void onFocusIn (Event e) {
- table.setFocus();
-}
-
-void onKeyDown (Event e) {
- TableTreeItem[] selection = getSelection();
- if (selection.length == 0) return;
- TableTreeItem item = selection[0];
- int type = 0;
- if (e.keyCode == SWT.ARROW_RIGHT || e.keyCode == SWT.ARROW_LEFT) {
- if (e.keyCode == SWT.ARROW_RIGHT) {
- if (item.getItemCount() == 0) return;
- if (item.getExpanded()) {
- TableTreeItem newSelection = item.getItems()[0];
- table.setSelection(new TableItem[]{newSelection.tableItem});
- showItem(newSelection);
- type = SWT.Selection;
- } else {
- item.setExpanded(true);
- type = SWT.Expand;
- }
- } else {
- if (item.getExpanded()) {
- item.setExpanded(false);
- type = SWT.Collapse;
- } else {
- TableTreeItem parent = item.getParentItem();
- if (parent != null) {
- int index = parent.indexOf(item);
- if (index != 0) return;
- table.setSelection(new TableItem[]{parent.tableItem});
- type = SWT.Selection;
- }
- }
- }
- }
- if (e.character == '*') {
- item.expandAll(true);
- }
- if (e.character == '-') {
- if (item.getExpanded()) {
- item.setExpanded(false);
- type = SWT.Collapse;
- }
- }
- if (e.character == '+') {
- if (item.getItemCount() > 0 && !item.getExpanded()) {
- item.setExpanded(true);
- type = SWT.Expand;
- }
- }
- if (type == 0) return;
- Event event = new Event();
- notifyListeners(type, event);
-}
-void onMouseDown(Event event) {
- /* If user clicked on the [+] or [-], expand or collapse the tree. */
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- Rectangle rect = items[i].getImageBounds(0);
- if (rect.contains(event.x, event.y)) {
- TableTreeItem item = (TableTreeItem) items[i].getData();
- event = new Event();
- event.item = item;
- item.setExpanded(!item.getExpanded());
- if (item.getExpanded()) {
- notifyListeners(SWT.Expand, event);
- } else {
- notifyListeners(SWT.Collapse, event);
- }
- return;
- }
- }
-}
-
-/**
- * Removes all items.
- * <p>
- * This operation will fail when an item
- * could not be removed in the OS.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_ITEM_NOT_REMOVED when the operation fails
- * </ul>
- */
-public void removeAll () {
- setRedraw(false);
- for (int i = items.length - 1; i >= 0; i--) {
- items[i].dispose();
- }
- items = EMPTY_ITEMS;
- setRedraw(true);
-}
-
-void removeItem(TableTreeItem item) {
- int index = 0;
- while (index < items.length && items[index] != item) index++;
- if (index == items.length) return;
- TableTreeItem[] newItems = new TableTreeItem[items.length - 1];
- System.arraycopy(items, 0, newItems, 0, index);
- System.arraycopy(items, index + 1, newItems, index, items.length - index - 1);
- items = newItems;
-}
-
-/**
- * Removes the listener.
- * <p>
- *
- * @param listener the listener
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when listener is null
- * </ul>
- */
-public void removeSelectionListener (SelectionListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when listener is null
- * </ul>
- */
-public void removeTreeListener (TreeListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Expand, listener);
- removeListener(SWT.Collapse, listener);
-}
-
-/**
- * Selects all items.
- * <p>
- * If an item is not selected, it is selected.
- * If an item is selected, it remains selected.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * </ul>
- */
-public void selectAll () {
- table.selectAll();
-}
-
-/**
- * Sets the widget background color.
- * <p>
- * When new color is null, the background reverts
- * to the default system color for the widget.
- *
- * @param color the new color (or null)
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setBackground (Color color) {
- super.setBackground(color);
- table.setBackground(color);
- if (sizeImage != null) {
- GC gc = new GC (sizeImage);
- gc.setBackground(getBackground());
- Rectangle size = sizeImage.getBounds();
- gc.fillRectangle(size);
- gc.dispose();
- }
-}
-
-/**
- * Sets the enabled state.
- * <p>
- * A disabled widget is typically not selectable from
- * the user interface and draws with an inactive or
- * grayed look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- super.setEnabled(enabled);
- table.setEnabled(enabled);
-}
-
-/**
- * Sets the widget font.
- * <p>
- * When new font is null, the font reverts
- * to the default system font for the widget.
- *
- * @param font the new font (or null)
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setFont (Font font) {
- super.setFont(font);
- table.setFont(font);
-}
-
-/**
- * Gets the widget foreground color.
- * <p>
- * @return the widget foreground color
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setForeground (Color color) {
- super.setForeground(color);
- table.setForeground(color);
-}
-
-/**
- * Sets the pop up menu.
- * <p>
- * Every control has an optional pop up menu that is
- * displayed when the user requests a popup menu for
- * the control. The sequence of key strokes/button
- * presses/button releases that is used to request
- * a pop up menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_MENU_NOT_POP_UP when the menu is not a POP_UP</li>
- * <li>ERROR_NO_COMMON_PARENT when the menu is not in the same widget tree</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- super.setMenu(menu);
- table.setMenu(menu);
-}
-
-/**
- * Sets the selection.
- * <p>
- * @param items new selection
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when items is null
- * </ul>
- */
-public void setSelection (TableTreeItem[] items) {
- TableItem[] tableItems = new TableItem[items.length];
- for (int i = 0; i < items.length; i++) {
- if (items[i] == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT);
- if (!items[i].getVisible()) expandItem (items[i]);
- tableItems[i] = items[i].tableItem;
- }
- table.setSelection(tableItems);
-}
-
-/**
- * Sets the tool tip text.
- * <p>
- * @param string the new tool tip text (or null)
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- super.setToolTipText(string);
- table.setToolTipText(string);
-}
-
-/**
- * Shows the item.
- * <p>
- * @param item the item to be shown
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * <li>ERROR_NULL_ARGUMENT when item is null
- * </ul>
- */
-public void showItem (TableTreeItem item) {
- if (item == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- if (!item.getVisible()) expandItem (item);
- TableItem tableItem = item.tableItem;
- table.showItem(tableItem);
-}
-
-/**
- * Shows the selection.
- * <p>
- * If there is no selection or the selection
- * is already visible, this method does nothing.
- * If the selection is scrolled out of view,
- * the top index of the widget is changed such
- * that selection becomes visible.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed
- * </ul>
- */
-public void showSelection () {
- table.showSelection();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeEditor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeEditor.java
deleted file mode 100755
index 0819ce0515..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeEditor.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-/**
-*
-* A TableTreeEditor is a manager for a Control that appears above a cell in a TableTree
-* and tracks with the moving and resizing of that cell. It can be used to display a
-* text widget above a cell in a TableTree so that the user can edit the contents of
-* that cell. It can also be used to display a button that can launch a dialog for
-* modifying the contents of the associated cell.
-*
-* <p> Here is an example of using a TableTreeEditor:
-* <code><pre>
-* public static void main (String [] args) {
-* Display display = new Display ();
-* Shell shell = new Shell (display);
-* final TableTree tableTree = new TableTree(shell, SWT.FULL_SELECTION);
-* Table table = tableTree.getTable();
-* table.setLinesVisible(true);
-* TableColumn column1 = new TableColumn(table, SWT.NONE);
-* column1.setText("column 1");
-* TableColumn column2 = new TableColumn(table, SWT.NONE);
-* column2.setText("column 2");
-* for (int i = 0; i < 40; i++) {
-* TableTreeItem item = new TableTreeItem(tableTree, SWT.NONE);
-* item.setText(0, "table tree item"+i);
-* item.setText(1, "value "+i);
-* }
-* column1.pack();
-* column2.pack();
-* final TableTreeEditor editor = new TableTreeEditor (tableTree);
-* tableTree.addSelectionListener (new SelectionAdapter() {
-* public void widgetSelected(SelectionEvent e) {
-* // Clean up any previous editor control
-* Control oldEditor = editor.getEditor();
-* if (oldEditor != null)
-* oldEditor.dispose();
-* // Identify the selected row
-* TableTreeItem[] selection = tableTree.getSelection();
-* if (selection.length == 0) return;
-* TableTreeItem item = selection[0];
-* // The control that will be the editor must be a child of the Table
-* // that underlies the TableTree
-* Text text = new Text(tableTree.getTable(), SWT.NONE);
-* //text.moveAbove(tableTree);
-* //The text editor must have the same size as the cell and must
-* //not be any smaller than 50 pixels.
-* editor.horizontalAlignment = SWT.LEFT;
-* editor.grabHorizontal = true;
-* //editor.minimumWidth = 50;
-* // Open the text editor in the second column of the selected row.
-* editor.setEditor (text, item, 1);
-* // Assign focus to the text control
-* text.setFocus ();
-* }
-* });
-* tableTree.setBounds(10, 10, 200, 400);
-* shell.open ();
-* while (!shell.isDisposed ()) {
-* if (!display.readAndDispatch ()) display.sleep ();
-* }
-* display.dispose ();
-* }
-* </pre></code>
-*/
-public class TableTreeEditor extends ControlEditor {
-
- TableTree tableTree;
- TableTreeItem item;
- int column = -1;
- ControlListener columnListener;
- TreeListener treeListener;
-/**
-* Creates a TableEditor for the specified Table.
-*
-* @param table the Table Control above which this editor will be displayed
-*
-*/
-public TableTreeEditor (TableTree tableTree) {
- super(tableTree.getTable());
- this.tableTree = tableTree;
-
- treeListener = new TreeListener () {
- final Runnable runnable = new Runnable() {
- public void run() {
- if (TableTreeEditor.this.tableTree.isDisposed() || editor == null) return;
- resize();
- editor.setVisible(true);
- }
- };
- public void treeCollapsed(TreeEvent e) {
- if (editor == null) return;
- editor.setVisible(false);
- Display display = TableTreeEditor.this.tableTree.getDisplay();
- display.asyncExec(runnable);
- }
- public void treeExpanded(TreeEvent e) {
- if (editor == null) return;
- editor.setVisible(false);
- Display display = TableTreeEditor.this.tableTree.getDisplay();
- display.asyncExec(runnable);
- }
- };
- tableTree.addTreeListener(treeListener);
-
- columnListener = new ControlListener() {
- public void controlMoved(ControlEvent e){
- resize ();
- }
- public void controlResized(ControlEvent e){
- resize ();
- }
- };
-
-}
-Rectangle computeBounds () {
- if (item == null || column == -1 || item.isDisposed() || item.tableItem == null) return new Rectangle(0, 0, 0, 0);
- Rectangle cell = item.getBounds(column);
- Rectangle editorRect = new Rectangle(cell.x, cell.y, minimumWidth, cell.height);
- Rectangle area = tableTree.getClientArea();
- if (cell.x < area.x + area.width) {
- if (cell.x + cell.width > area.x + area.width) {
- cell.width = area.width - cell.x;
- }
- }
-
- if (grabHorizontal){
- editorRect.width = Math.max(cell.width, minimumWidth);
- }
-
- if (horizontalAlignment == SWT.RIGHT) {
- editorRect.x += cell.width - editorRect.width;
- } else if (horizontalAlignment == SWT.LEFT) {
- // do nothing - cell.x is the right answer
- } else { // default is CENTER
- editorRect.x += (cell.width - editorRect.width)/2;
- }
-
- return editorRect;
-}
-/**
- * Removes all associations between the TableEditor and the cell in the table. The
- * Table and the editor Control are <b>not</b> disposed.
- */
-public void dispose () {
-
- if (treeListener != null)
- tableTree.removeTreeListener(treeListener);
- treeListener = null;
- Table table = tableTree.getTable();
- if (this.column > -1 && this.column < table.getColumnCount()){
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.removeControlListener(columnListener);
- }
-
- tableTree = null;
- item = null;
- column = -1;
-
- super.dispose();
-}
-/**
-* Returns the zero based index of the column of the cell being tracked by this editor.
-*
-* @return the zero based index of the column of the cell being tracked by this editor
-*/
-public int getColumn () {
- return column;
-}
-public void setColumn(int column) {
- Table table = tableTree.getTable();
- if (this.column > -1 && this.column < table.getColumnCount()){
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.removeControlListener(columnListener);
- this.column = -1;
- }
-
- if (column < 0 || column >= table.getColumnCount()) return;
-
- this.column = column;
- TableColumn tableColumn = table.getColumn(this.column);
- tableColumn.addControlListener(columnListener);
-}
-/**
-* Returns the TableItem for the row of the cell being tracked by this editor.
-*
-* @return the TableItem for the row of the cell being tracked by this editor
-*/
-public TableTreeItem getItem () {
- return item;
-}
-public void setItem (TableTreeItem item) {
- this.item = item;
-}
-public void setEditor (Control editor) {
- TableTreeItem item = null;
- if (tableTree.getItemCount() > 0) {
- item = tableTree.getItems()[0];
- }
- this.setEditor(editor, item, 0);
-}
-
-/**
-* Specify the Control that is to be displayed and the cell in the table that it is to be positioned above.
-*
-* <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Table control
-* specified in the TableEditor constructor.
-*
-* @param editor the Control that is displayed above the cell being edited
-* @param item the TableItem for the row of the cell being tracked by this editor
-* @param column the zero based index of the column of the cell being tracked by this editor
-*/
-public void setEditor (Control editor, TableTreeItem item, int column) {
- setItem(item);
- setColumn(column);
- super.setEditor(editor);
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeItem.java
deleted file mode 100755
index 0cffbc1417..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeItem.java
+++ /dev/null
@@ -1,568 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A TableTreeItem is a selectable user interface object
- * that represents an item in a heirarchy of items in a
- * TableTree.
- */
-public class TableTreeItem extends Item {
- TableItem tableItem;
- TableTree parent;
- TableTreeItem parentItem;
- TableTreeItem [] items = TableTree.EMPTY_ITEMS;
- String[] texts = TableTree.EMPTY_TEXTS;
- Image[] images = TableTree.EMPTY_IMAGES;
- boolean expanded;
- boolean checked;
-
-/**
- * Create a new instance of a root item.
- *
- * @param parent the TableTree that contains this root item
- * @param style the bitwise OR'ing of widget styles
- */
-public TableTreeItem(TableTree parent, int style) {
- this (parent, style, parent.getItemCount());
-}
-
-/**
- * Create a new instance of a root item in the position
- * indicated by the specified index.
- *
- * @param parent the TableTree that contains this root item
- * @param style the bitwise OR'ing of widget styles
- * @param index specifies the position of this item in the TableTree
- * relative to other root items
- */
-public TableTreeItem(TableTree parent, int style, int index) {
- this (parent, null, style, index);
-}
-
-/**
- * Create a new instance of a sub item.
- *
- * @param parent this item's parent in the hierarchy of TableTree items
- * @param style the bitwise OR'ing of widget styles
- */
-public TableTreeItem(TableTreeItem parent, int style) {
- this (parent, style, parent.getItemCount());
-}
-
-/**
- * Create a new instance of a sub item in the position
- * indicated by the specified index.
- *
- * @param parent this item's parent in the hierarchy of TableTree items
- * @param style the bitwise OR'ing of widget styles
- * @param index specifies the position of this item in the TableTree
- * relative to other children of the same parent
- */
-public TableTreeItem(TableTreeItem parent, int style, int index) {
- this (parent.getParent(), parent, style, index);
-}
-
-TableTreeItem(TableTree parent, TableTreeItem parentItem, int style, int index) {
- super(parent, style);
- this.parent = parent;
- this.parentItem = parentItem;
- if (parentItem == null) {
-
- /* Root items are visible immediately */
- int tableIndex = parent.addItem(this, index);
- tableItem = new TableItem(parent.getTable(), style, tableIndex);
- tableItem.setData(this);
- addCheck();
- /*
- * Feature in the Table. The table uses the first image that
- * is inserted into the table to size the table rows. If the
- * user is allowed to insert the first image, this will cause
- * the +/- images to be scaled. The fix is to insert a dummy
- * image to force the size.
- */
- if (parent.sizeImage == null) {
- int itemHeight = parent.getItemHeight();
- parent.sizeImage = new Image(null, itemHeight, itemHeight);
- GC gc = new GC (parent.sizeImage);
- gc.setBackground(parent.getBackground());
- gc.fillRectangle(0, 0, itemHeight, itemHeight);
- gc.dispose();
- tableItem.setImage(0, parent.sizeImage);
- }
- } else {
- parentItem.addItem(this, index);
- }
-}
-void addCheck() {
- Table table = parent.getTable();
- if ((table.getStyle() & SWT.CHECK) == 0) return;
- tableItem.setChecked(checked);
-}
-void addItem(TableTreeItem item, int index) {
- if (item == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT);
- if (index < 0 || index > items.length) throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
-
- /* Now that item has a sub-node it must indicate that it can be expanded */
- if (items.length == 0 && index == 0) {
- if (tableItem != null) {
- Image image = expanded ? parent.getMinusImage() : parent.getPlusImage();
- tableItem.setImage(0, image);
- }
- }
-
- /* Put the item in the items list */
- TableTreeItem[] newItems = new TableTreeItem[items.length + 1];
- System.arraycopy(items, 0, newItems, 0, index);
- newItems[index] = item;
- System.arraycopy(items, index, newItems, index + 1, items.length - index);
- items = newItems;
- if (expanded) item.setVisible(true);
-}
-
-/**
- * Gets the widget bounds at the specified index.
- * <p>
- * @return the widget bounds at the specified index
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds (int index) {
- if (tableItem != null) {
- return tableItem.getBounds(index);
- } else {
- return new Rectangle(0, 0, 0, 0);
- }
-}
-/**
-* Gets the checked state.
-* <p>
-* @return the item checked state.
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* </ul>
-*/
-public boolean getChecked () {
- if (tableItem == null) {
- return checked;
- }
- return tableItem.getChecked();
-}
-
-/**
- * Gets the Display.
- * <p>
- * This method gets the Display that is associated
- * with the widget.
- *
- * @return the widget data
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public Display getDisplay () {
- TableTree parent = this.parent;
- if (parent == null) throw new SWTError (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Gets the expanded state of the widget.
- * <p>
- * @return a boolean that is the expanded state of the widget
- */
-public boolean getExpanded () {
- return expanded;
-}
-
-/**
- * Gets the first image.
- * <p>
- * The image in column 0 is reserved for the [+] and [-]
- * images of the tree, therefore getImage(0) will return null.
- *
- * @return the image at index 0
- */
-public Image getImage () {
- return getImage(0);
-}
-
-/**
- * Gets the image at the specified index.
- * <p>
- * Indexing is zero based. The image can be null.
- * The image in column 0 is reserved for the [+] and [-]
- * images of the tree, therefore getImage(0) will return null.
- * Return null if the index is out of range.
- *
- * @param index the index of the image
- * @return the image at the specified index or null
- */
-public Image getImage (int index) {
- if (0 < index && index < images.length) return images[index];
- return null;
-}
-
-int getIndent() {
- if (parentItem == null) return 0;
- return parentItem.getIndent() + 1;
-}
-
-/**
- * Gets the number of sub items.
- * <p>
- * @return the number of sub items
- */
-public int getItemCount () {
- return items.length;
-}
-
-/**
- * Gets the sub items.
- * <p>
- * @return the sub items
- */
-public TableTreeItem[] getItems () {
- TableTreeItem[] newItems = new TableTreeItem[items.length];
- System.arraycopy(items, 0, newItems, 0, items.length);
- return newItems;
-}
-
-TableTreeItem getItem(TableItem tableItem) {
- if (tableItem == null) return null;
- if (this.tableItem == tableItem) return this;
- for (int i = 0; i < items.length; i++) {
- TableTreeItem item = items[i].getItem(tableItem);
- if (item != null) return item;
- }
- return null;
-}
-
-/**
- * Gets the parent.
- * <p>
- * @return the parent
- */
-public TableTree getParent () {
- return parent;
-}
-
-/**
- * Gets the parent item.
- * <p>
- * @return the parent item.
- */
-public TableTreeItem getParentItem () {
- return parentItem;
-}
-
-/**
- * Gets the first item text.
- * <p>
- * @return the item text at index 0, which can be null
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_CANNOT_GET_TEXT when the operation fails</li>
- * </ul>
- */
-public String getText () {
- return getText(0);
-}
-
-/**
- * Gets the item text at the specified index.
- * <p>
- * Indexing is zero based.
- *
- * This operation will fail when the index is out
- * of range or an item could not be queried from
- * the OS.
- *
- * @param index the index of the item
- * @return the item text at the specified index, which can be null
- */
-public String getText(int index) {
- if (0 <= index && index < texts.length) return texts[index];
- return null;
-}
-
-boolean getVisible () {
- return tableItem != null;
-}
-
-/**
- * Gets the index of the specified item.
- *
- * <p>The widget is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based. This index is relative to the parent only.
- *
- * @param item the search item
- * @return the index of the item or -1 if the item is not found
- *
- */
-public int indexOf (TableTreeItem item) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] == item) return i;
- }
- return -1;
-}
-
-void expandAll(boolean notify) {
- if (items.length == 0) return;
- if (!expanded) {
- setExpanded(true);
- if (notify) notifyListeners(SWT.Expand, new Event());
- for (int i = 0; i < items.length; i++) {
- items[i].expandAll(notify);
- }
- }
-}
-int expandedIndexOf (TableTreeItem item) {
- int index = 0;
- for (int i = 0; i < items.length; i++) {
- if (items[i] == item) return index;
- if (items[i].expanded) index += items[i].visibleChildrenCount ();
- index++;
- }
- return -1;
-}
-
-int visibleChildrenCount () {
- int count = 0;
- for (int i = 0; i < items.length; i++) {
- if (items[i].getVisible ()) {
- count += 1 + items[i].visibleChildrenCount ();
- }
- }
- return count;
-}
-
-public void dispose () {
- if (isDisposed()) return;
- for (int i = items.length - 1; i >= 0; i--) {
- items[i].dispose();
- }
- super.dispose();
- if (!parent.inDispose) {
- if (parentItem != null) {
- parentItem.removeItem(this);
- } else {
- parent.removeItem(this);
- }
- if (tableItem != null) tableItem.dispose();
- }
- items = null;
- parentItem = null;
- parent = null;
- images = null;
- texts = null;
- tableItem = null;
-}
-
-void removeItem(TableTreeItem item) {
- int index = 0;
- while (index < items.length && items[index] != item) index++;
- if (index == items.length) return;
- TableTreeItem[] newItems = new TableTreeItem[items.length - 1];
- System.arraycopy(items, 0, newItems, 0, index);
- System.arraycopy(items, index + 1, newItems, index, items.length - index - 1);
- items = newItems;
- if (items.length == 0) {
- if (tableItem != null) tableItem.setImage(0, null);
- }
-}
-
-/**
-* Sets the checked state.
-* <p>
-* @param checked the new checked state.
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* </ul>
-*/
-public void setChecked (boolean checked) {
- if (tableItem != null) {
- tableItem.setChecked(checked);
- }
- this.checked = checked;
-}
-/**
- * Sets the expanded state.
- * <p>
- * @param expanded the new expanded state.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setExpanded (boolean expanded) {
- if (items.length == 0) return;
- this.expanded = expanded;
- if (tableItem == null) return;
- parent.setRedraw(false);
- for (int i = 0; i < items.length; i++) {
- items[i].setVisible(expanded);
- }
- Image image = expanded ? parent.getMinusImage() : parent.getPlusImage();
- tableItem.setImage(0, image);
- parent.setRedraw(true);
-}
-
-/**
- * Sets the image at an index.
- * <p>
- * The image can be null.
- * The image in column 0 is reserved for the [+] and [-]
- * images of the tree, therefore do nothing if index is 0.
- *
- * @param image the new image or null
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setImage (int index, Image image) {
- int columnCount = Math.max(parent.getTable().getColumnCount(), 1);
- if (index <= 0 || index >= columnCount) return;
- if (images.length < columnCount) {
- Image[] newImages = new Image[columnCount];
- System.arraycopy(images, 0, newImages, 0, images.length);
- images = newImages;
- }
- images[index] = image;
- if (tableItem != null) tableItem.setImage(index, image);
-}
-
-/**
- * Sets the first image.
- * <p>
- * The image can be null.
- * The image in column 0 is reserved for the [+] and [-]
- * images of the tree, therefore do nothing.
- *
- * @param image the new image or null
- */
-public void setImage (Image image) {
- setImage(0, image);
-}
-
-/**
- * Sets the widget text.
- * <p>
- *
- * The widget text for an item is the label of the
- * item or the label of the text specified by a column
- * number.
- *
- * @param index the column number
- * @param text the new text
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when string is null</li>
- * </ul>
- */
-public void setText(int index, String text) {
- int columnCount = Math.max(parent.getTable().getColumnCount(), 1);
- if (index < 0 || index >= columnCount) return;
- if (texts.length < columnCount) {
- String[] newTexts = new String[columnCount];
- System.arraycopy(texts, 0, newTexts, 0, texts.length);
- texts = newTexts;
- }
- texts[index] = text;
- if (tableItem != null) tableItem.setText(index, text);
-}
-
-/**
- * Sets the widget text.
- * <p>
- *
- * The widget text for an item is the label of the
- * item or the label of the text specified by a column
- * number.
- *
- * @param index the column number
- * @param text the new text
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when string is null</li>
- * </ul>
- */
-public void setText (String string) {
- setText(0, string);
-}
-
-void setVisible (boolean show) {
- if (parentItem == null) return; // this is a root and can not be toggled between visible and hidden
- if (getVisible() == show) return;
-
- if (show) {
- if (!parentItem.getVisible()) return; // parentItem must already be visible
- // create underlying table item and set data in table item to stored data
- Table table = parent.getTable();
- int parentIndex = table.indexOf(parentItem.tableItem);
- int index = parentItem.expandedIndexOf(this) + parentIndex + 1;
- if (index < 0) return;
- tableItem = new TableItem(table, getStyle(), index);
- tableItem.setData(this);
- tableItem.setImageIndent(getIndent());
- addCheck();
-
- // restore fields to item
- // ignore any images in the first column
- int columnCount = Math.max(table.getColumnCount(), 1);
- for (int i = 0; i < columnCount; i++) {
- if (i < texts.length && texts[i] != null) setText(i, texts[i]);
- if (i < images.length && images[i] != null) setImage(i, images[i]);
- }
-
- // display the children and the appropriate [+]/[-] symbol as required
- if (items.length != 0) {
- if (expanded) {
- tableItem.setImage(0, parent.getMinusImage());
- for (int i = 0, length = items.length; i < length; i++) {
- items[i].setVisible(true);
- }
- } else {
- tableItem.setImage(0, parent.getPlusImage());
- }
- }
-
- } else {
-
- for (int i = 0, length = items.length; i < length; i++) {
- items[i].setVisible(false);
- }
- // remove row from table
- tableItem.dispose();
- tableItem = null;
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangeListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangeListener.java
deleted file mode 100755
index 29bbf04505..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangeListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * The StyledText widget implements this listener to receive
- * notifications when changes to the model occur.
- * It is not intended for use by users of the StyledText widget
- * or implementors of StyledTextContent. Users should listen to
- * the ModifyEvent or ExtendedModifyEvent that is sent by the StyledText
- * widget to receive text change notifications.
- */
-public interface TextChangeListener extends SWTEventListener {
-
-/**
- * @param event.start replace start offset (input)
- * @param event.newText text that is going to be inserted or empty String
- * if no text will be inserted (input)
- * @param event.replaceCharCount length of text that is going to be
- * replaced (input)
- * @param event.newCharCount length of text that is going to be inserted
- * (input)
- * @param event.replaceLineCount number of lines that are going to be
- * replaced (input)
- * @param event.newLineCount number of new lines that are going to be
- * inserted (input)
- */
-public void textChanging(TextChangingEvent event);
-
-/**
- */
-public void textChanged(TextChangedEvent event);
-
-/**
- */
-public void textSet(TextChangedEvent event);
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangedEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangedEvent.java
deleted file mode 100755
index 5a7648cd8b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangedEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * This event is sent by the StyledTextContent implementor when a change to
- * the text occurs.
- */
-public class TextChangedEvent extends TypedEvent {
-/**
- * Create the TextChangedEvent to be used by the StyledTextContent implementor.
- * <p>
- *
- * @param source the object that will be sending the TextChangedEvent, cannot be null
- */
-public TextChangedEvent(StyledTextContent source) {
- super(source);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangingEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangingEvent.java
deleted file mode 100755
index b334ead550..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangingEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * This event is sent by the StyledTextContent implementor when a change to
- * the text is about to occur.
- */
-public class TextChangingEvent extends TypedEvent {
- public int start; // replace start offset
- public String newText; // text that is going to be inserted or empty
- // String if no text will be inserted
- public int replaceCharCount; // length of text that is going to be replaced
- public int newCharCount; // length of text that is going to be inserted
- public int replaceLineCount; // number of lines that are going to be replaced
- public int newLineCount; // number of new lines that are going to be inserted
-
-/**
- * Create the TextChangedEvent to be used by the StyledTextContent implementor.
- * <p>
- *
- * @param source the object that will be sending the TextChangedEvent, cannot be null
- */
-public TextChangingEvent(StyledTextContent source) {
- super(source);
-}
-TextChangingEvent(StyledTextContent source, StyledTextEvent e) {
- super(source);
- start = e.start;
- replaceCharCount = e.replaceCharCount;
- newCharCount = e.newCharCount;
- replaceLineCount = e.replaceLineCount;
- newLineCount = e.newLineCount;
- newText = e.text;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeEditor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeEditor.java
deleted file mode 100755
index a828282da8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeEditor.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-
-/**
-*
-* A TreeEditor is a manager for a Control that appears above a cell in a Tree and tracks with the
-* moving and resizing of that cell. It can be used to display a text widget above a cell
-* in a Tree so that the user can edit the contents of that cell. It can also be used to display
-* a button that can launch a dialog for modifying the contents of the associated cell.
-*
-* <p> Here is an example of using a TreeEditor:
-* <code><pre>
-* final Tree tree = new Tree(parent, SWT.FULL_SELECTION);
-* final TreeEditor editor = new TreeEditor (tree);
-* tree.addSelectionListener (new SelectionAdapter() {
-* public void widgetSelected(SelectionEvent e) {
-*
-* // Clean up any previous editor control
-* Control oldEditor = editor.getEditor();
-* if (oldEditor != null)
-* oldEditor.dispose();
-*
-* // Identify the selected row
-* TreeItem item = (TreeItem)e.item;
-*
-* // The control that will be the editor must be a child of the Tree
-* Text text = new Text(tree, SWT.NONE);
-*
-* //The text editor must have the same size as the cell and must
-* //not be any smaller than 50 pixels.
-* editor.horizontalAlignment = SWT.LEFT;
-* editor.grabHorizontal = true;
-* editor.minimumWidth = 50;
-*
-* // Open the text editor on the selected row.
-* editor.setEditor (text, item);
-*
-* // Assign focus to the text control
-* text.setFocus ();
-* }
-* });
-* </pre></code>
-*/
-public class TreeEditor extends ControlEditor {
- Tree tree;
- TreeItem item;
- TreeListener treeListener;
-/**
-* Creates a TreeEditor for the specified Tree.
-*
-* @param tree the Tree Control above which this editor will be displayed
-*
-*/
-public TreeEditor (Tree tree) {
- super(tree);
- this.tree = tree;
- treeListener = new TreeAdapter () {
- final Runnable runnable = new Runnable() {
- public void run() {
- if (TreeEditor.this.tree.isDisposed() || editor == null) return;
- resize();
- editor.setVisible(true);
- }
- };
- public void treeCollapsed(TreeEvent e) {
- if (editor == null) return;
- editor.setVisible(false);
- Display display = TreeEditor.this.tree.getDisplay();
- display.asyncExec(runnable);
- }
- public void treeExpanded(TreeEvent e) {
- if (editor == null) return;
- editor.setVisible(false);
- Display display = TreeEditor.this.tree.getDisplay();
- display.asyncExec(runnable);
- }
- };
- tree.addTreeListener(treeListener);
-}
-Rectangle computeBounds () {
- if (item == null || item.isDisposed()) return new Rectangle(0, 0, 0, 0);
-
- Rectangle cell = item.getBounds();
- Rectangle area = tree.getClientArea();
- if (cell.x < area.x + area.width) {
- if (cell.x + cell.width > area.x + area.width) {
- cell.width = area.x + area.width - cell.x;
- }
- }
- Rectangle editorRect = new Rectangle(cell.x, cell.y, minimumWidth, cell.height);
-
- if (grabHorizontal) {
- editorRect.width = Math.max(area.x + area.width - cell.x, minimumWidth);
- }
-
- if (horizontalAlignment == SWT.RIGHT) {
- editorRect.x = Math.max(cell.x, cell.x + cell.width - editorRect.width);
- } else if (horizontalAlignment == SWT.LEFT) {
- // do nothing - cell.x is the right answer
- } else { // default is CENTER
- editorRect.x = Math.max(cell.x, cell.x + (cell.width - editorRect.width)/2);
- }
-
- return editorRect;
-}
-/**
- * Removes all associations between the TreeEditor and the cell in the tree. The
- * tree and the editor Control are <b>not</b> disposed.
- */
-public void dispose () {
- if (treeListener != null)
- tree.removeTreeListener(treeListener);
- treeListener = null;
- tree = null;
- item = null;
- super.dispose();
-}
-/**
-* Returns the TreeItem for the row of the cell being tracked by this editor.
-*
-* @return the TreeItem for the row of the cell being tracked by this editor
-*/
-public TreeItem getItem () {
- return item;
-}
-public void setItem (TreeItem item) {
- this.item = item;
-}
-
-/**
-* Specify the Control that is to be displayed and the cell in the tree that it is to be positioned above.
-*
-* <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Tree control
-* specified in the TreeEditor constructor.
-*
-* @param editor the Control that is displayed above the cell being edited
-* @param item the TreeItem for the row of the cell being tracked by this editor
-* @param column the zero based index of the column of the cell being tracked by this editor
-*/
-public void setEditor (Control editor, TreeItem item) {
- setItem (item);
- super.setEditor (editor);
-}
-public void setEditor (Control editor) {
- TreeItem item = null;
- if (tree.getItemCount() != 0) {
- item = tree.getItems()[0];
- }
- this.setEditor(editor, item);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/VerifyKeyListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/VerifyKeyListener.java
deleted file mode 100755
index 3d44eb51a4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/VerifyKeyListener.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.internal.SWTEventListener;
-
-public interface VerifyKeyListener extends SWTEventListener {
-/**
- * @param event.character the character that was typed (input)
- * @param event.keyCode the key code that was typed (input)
- * @param event.stateMask the state of the keyboard (input)
- * @param event.doit processed or not (output)
- */
-public void verifyKey (VerifyEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewForm.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewForm.java
deleted file mode 100755
index 6529b0109d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewForm.java
+++ /dev/null
@@ -1,491 +0,0 @@
-package org.eclipse.swt.custom;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-public class ViewForm extends Composite {
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the form.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the form.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
-
- /**
- * Color of innermost line of drop shadow border.
- */
- public static RGB borderInsideRGB = new RGB (132, 130, 132);
- /**
- * Color of middle line of drop shadow border.
- */
- public static RGB borderMiddleRGB = new RGB (143, 141, 138);
- /**
- * Color of outermost line of drop shadow border.
- */
- public static RGB borderOutsideRGB = new RGB (171, 168, 165);
-
- // SWT widgets
- private Control topLeft;
- private Control topCenter;
- private Control topRight;
- private Control content;
-
- // Configuration and state info
- private boolean separateTopCenter = false;
- private int drawLine1 = -1;
- private int drawLine2 = -1;
-
- private boolean showBorder = false;
-
- private int BORDER_TOP = 0;
- private int BORDER_BOTTOM = 0;
- private int BORDER_LEFT = 0;
- private int BORDER_RIGHT = 0;
-
- private Color borderColor1;
- private Color borderColor2;
- private Color borderColor3;
-
- private Rectangle oldArea;
- private static final int OFFSCREEN = -200;
-/**
-* Creates a ViewForm.
-* <p>
-* This method creates a child widget using style bits
-* to select a particular look or set of properties.
-*
-* @param parent a composite widget (cannot be null)
-* @param style the bitwise OR'ing of widget styles
-*
-* @exception SWTError <ul>
-* <li> ERROR_THREAD_INVALID_ACCESS when called from the wrong thread </li>
-* <li> ERROR_ERROR_NULL_ARGUMENT when the parent is null </li>
-* </ul>
-*/
-public ViewForm(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- borderColor1 = new Color(getDisplay(), borderInsideRGB);
- borderColor2 = new Color(getDisplay(), borderMiddleRGB);
- borderColor3 = new Color(getDisplay(), borderOutsideRGB);
- setBorderVisible((style & SWT.BORDER) != 0);
-
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- onPaint(event.gc);
- }
- });
- addControlListener(new ControlAdapter(){
- public void controlResized(ControlEvent e) {
- onResize();
- }
- });
-
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event e) {
- onDispose();
- }
- });
-}
-/**
- * Check the style bits to ensure that no invalid styles are applied.
- * @private
- */
-private static int checkStyle (int style) {
- int mask = SWT.FLAT;
- return style & mask | SWT.NO_REDRAW_RESIZE;
-}
-public Point computeSize(int wHint, int hHint, boolean changed) {
- // size of title bar area
- Point leftSize = new Point(0, 0);
- if (topLeft != null) {
- leftSize = topLeft.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point centerSize = new Point(0, 0);
- if (topCenter != null) {
- centerSize = topCenter.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point rightSize = new Point(0, 0);
- if (topRight != null) {
- rightSize = topRight.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point size = new Point(0, 0);
- // calculate width of title bar
- if (separateTopCenter) {
- size.x = leftSize.x + rightSize.x;
- size.x = Math.max(centerSize.x, size.x);
- size.y = Math.max(leftSize.y, rightSize.y);
- if (topCenter != null){
- size.y += centerSize.y;
- }
- } else {
- size.x = leftSize.x + centerSize.x + rightSize.x;
- size.y = Math.max(leftSize.y, Math.max(centerSize.y, rightSize.y));
- }
-
- if (content != null) {
- Point contentSize = new Point(0, 0);
- contentSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- size.x = Math.max (size.x, contentSize.x);
- size.y += contentSize.y;
- }
-
- size.x += 2 * marginWidth + BORDER_LEFT + BORDER_RIGHT;
- size.y += 2 * marginHeight + BORDER_TOP + BORDER_BOTTOM;
-
- return size;
-}
-public Rectangle getClientArea() {
- Rectangle clientArea = super.getClientArea();
- clientArea.x += BORDER_LEFT;
- clientArea.y += BORDER_TOP;
- clientArea.width -= BORDER_LEFT + BORDER_RIGHT;
- clientArea.height -= BORDER_TOP + BORDER_BOTTOM;
- return clientArea;
-}
-/**
-* Returns the content area.
-*/
-public Control getContent() {
- return content;
-}
-/**
-* Returns Control that appears in the top center of the pane.
-* Typically this is a toolbar.
-*/
-public Control getTopCenter() {
- return topCenter;
-}
-/**
-* Returns the Control that appears in the top left corner of the pane.
-* Typically this is a label such as CLabel.
-*/
-public Control getTopLeft() {
- return topLeft;
-}
-/**
-* Returns the control in the top right corner of the pane.
-* Typically this is a Close button or a composite with a Menu and Close button.
-*/
-public Control getTopRight() {
- return topRight;
-}
-public void layout (boolean changed) {
- Rectangle rect = getClientArea();
-
- drawLine1 = -1;
- drawLine2 = -1;
-
- Point leftSize = new Point(0, 0);
- if (topLeft != null && !topLeft.isDisposed()) {
- leftSize = topLeft.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point centerSize = new Point(0, 0);
- if (topCenter != null && !topCenter.isDisposed()) {
- centerSize = topCenter.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point rightSize = new Point(0, 0);
- if (topRight != null && !topRight.isDisposed()) {
- rightSize = topRight.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
-
- int minTopWidth = leftSize.x + centerSize.x + rightSize.x + 2*marginWidth + 1; // +1 for highlight line
- int height = rect.y + marginHeight;
-
- boolean top = false;
- if (separateTopCenter || minTopWidth > rect.width) {;
- int topHeight = Math.max(rightSize.y, leftSize.y);
- if (topRight != null && !topRight.isDisposed()) {
- top = true;
- topRight.setBounds(rect.x + rect.width - marginWidth - rightSize.x,
- rect.y + 1 + marginHeight,
- rightSize.x, topHeight);
- height += 1 + topHeight; // +1 for highlight line
- }
- if (topLeft != null && !topLeft.isDisposed()) {
- top = true;
- leftSize = topLeft.computeSize(rect.width - 2* marginWidth - rightSize.x - 1, SWT.DEFAULT);
- topLeft.setBounds(rect.x + 1 + marginWidth,
- rect.y + 1 + marginHeight,
- leftSize.x, topHeight);
- height = Math.max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- if (topCenter != null && !topCenter.isDisposed()) {
- top = true;
- if (height > rect.y + marginHeight) {
- drawLine1 = height;
- height += 1; // +1 for divider line
- }
- centerSize = topCenter.computeSize(rect.width - 2 * marginWidth, SWT.DEFAULT);
- topCenter.setBounds(rect.x + rect.width - marginWidth - centerSize.x,
- height,
- centerSize.x, centerSize.y);
- height += centerSize.y;
-
- }
- } else {
- int topHeight = Math.max(rightSize.y, Math.max(centerSize.y, leftSize.y));
- if (topRight != null && !topRight.isDisposed()) {
- top = true;
- topRight.setBounds(rect.x + rect.width - marginWidth - rightSize.x,
- rect.y + marginHeight + 1, // +1 for highlight line
- rightSize.x, topHeight);
- height += 1 + topHeight; // +1 for highlight line
- }
- if (topCenter != null && !topCenter.isDisposed()) {
- top = true;
- topCenter.setBounds(rect.x + rect.width - marginWidth - rightSize.x - centerSize.x,
- rect.y + marginHeight + 1, // +1 for highlight line
- centerSize.x, topHeight);
- height = Math.max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- if (topLeft != null && !topLeft.isDisposed()) {
- top = true;
- leftSize = topLeft.computeSize(rect.width - 2 * marginWidth - rightSize.x - centerSize.x - 1, topHeight);
- topLeft.setBounds(rect.x + marginWidth + 1, // +1 for highlight line
- rect.y + marginHeight + 1, // +1 for highlight line
- leftSize.x, topHeight);
- height = Math.max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- }
-
- if (content != null && !content.isDisposed()) {
- if (top) {
- drawLine2 = height;
- height += 1; // +1 for divider line
- }
- content.setBounds(rect.x + marginWidth,
- height,
- rect.width - 2 * marginWidth,
- rect.y + rect.height - height - marginHeight);
- }
-}
-private void onDispose() {
- if (borderColor1 != null) {
- borderColor1.dispose();
- }
- borderColor1 = null;
-
- if (borderColor2 != null) {
- borderColor2.dispose();
- }
- borderColor2 = null;
-
- if (borderColor3 != null) {
- borderColor3.dispose();
- }
- borderColor3 = null;
-}
-/**
-* Draws the focus border.
-*/
-private void onPaint(GC gc) {
- Rectangle d = super.getClientArea();
-
- if (showBorder) {
- if ((getStyle() & SWT.FLAT) !=0) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 1, d.y + d.height - 1);
- } else {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 3, d.y + d.height - 3);
-
- gc.setForeground(borderColor2);
- gc.drawLine(d.x + 1, d.y + d.height - 2, d.x + d.width - 1, d.y + d.height - 2);
- gc.drawLine(d.x + d.width - 2, d.y + 1, d.x + d.width - 2, d.y + d.height - 1);
-
- gc.setForeground(borderColor3);
- gc.drawLine(d.x + 2, d.y + d.height - 1, d.x + d.width - 2, d.y + d.height - 1);
- gc.drawLine(d.x + d.width - 1, d.y + 2, d.x + d.width - 1, d.y + d.height - 2);
- }
- }
-
- if (drawLine1 != -1) {
- // top seperator line
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + BORDER_LEFT, drawLine1, d.x + d.width - BORDER_RIGHT, drawLine1);
- }
- if (drawLine2 != -1) {
- // content separator line
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + BORDER_LEFT, drawLine2, d.x + d.width - BORDER_RIGHT, drawLine2);
- }
- // highlight on top
- int y = drawLine1;
- if (y == -1){
- y = drawLine2;
- }
- if (y != -1) {
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- gc.drawLine(d.x + BORDER_LEFT + marginWidth, d.y + BORDER_TOP + marginHeight,
- d.x + BORDER_LEFT + marginWidth, y - 1);
- gc.drawLine(d.x + BORDER_LEFT + marginWidth, d.y + BORDER_TOP + marginHeight,
- d.x + d.width - BORDER_RIGHT - marginWidth - 1, d.y + BORDER_TOP + marginHeight);
- }
-
- gc.setForeground(getForeground());
-}
-private void onResize() {
- layout();
-
- Rectangle area = super.getClientArea();
- if (oldArea == null || oldArea.width == 0 || oldArea.height == 0) {
- redraw();
- } else {
- int width = 0;
- if (oldArea.width < area.width) {
- width = area.width - oldArea.width + BORDER_RIGHT;
- } else if (oldArea.width > area.width) {
- width = BORDER_RIGHT;
- }
- redraw(area.x + area.width - width, area.y, width, area.height, false);
-
- int height = 0;
- if (oldArea.height < area.height) {
- height = area.height - oldArea.height + BORDER_BOTTOM;
- }
- if (oldArea.height > area.height) {
- height = BORDER_BOTTOM;
- }
- redraw(area.x, area.y + area.height - height, area.width, height, false);
- }
- oldArea = area;
-}
-/**
-* Sets the content.
-* Setting the content to null will remove it from
-* the pane - however, the creator of the content must dispose of the content.
-*/
-public void setContent(Control content) {
- if (content != null && content.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.content != null && !this.content.isDisposed()) {
- this.content.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.content = content;
- layout();
-}
-
-/**
-* Set the widget font.
-* This will apply the font to the topLeft, topRight and topCenter widgets.
-*/
-public void setFont(Font f) {
- super.setFont(f);
- if (topLeft != null && !topLeft.isDisposed()) topLeft.setFont(f);
- if (topCenter != null && !topCenter.isDisposed()) topCenter.setFont(f);
- if (topRight != null && !topRight.isDisposed()) topRight.setFont(f);
-
- layout();
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note : ViewForm does not use a layout class to size and position its children.
- * </p>
- *
- * @param the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- return;
-}
-/**
-* Set the control that appears in the top center of the pane.
-* Typically this is a toolbar.
-* The topCenter is optional. Setting the topCenter to null will remove it from
-* the pane - however, the creator of the topCenter must dispose of the topCenter.
-*/
-public void setTopCenter(Control topCenter) {
- if (topCenter != null && topCenter.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topCenter != null && !this.topCenter.isDisposed()) {
- this.topCenter.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topCenter = topCenter;
- layout();
-}
-/**
-* Set the control that appears in the top left corner of the pane.
-* Typically this is a label such as CLabel.
-* The topLeft is optional. Setting the top left control to null will remove it from
-* the pane - however, the creator of the control must dispose of the control.
-*/
-public void setTopLeft(Control c) {
- if (c != null && c.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topLeft != null && !this.topLeft.isDisposed()) {
- this.topLeft.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topLeft = c;
- layout();
-}
-/**
-* Set the control that appears in the top right corner of the pane.
-* Typically this is a Close button or a composite with a Menu and Close button.
-* The topRight is optional. Setting the top right control to null will remove it from
-* the pane - however, the creator of the control must dispose of the control.
-*/
-public void setTopRight(Control c) {
- if (c != null && c.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topRight != null && !this.topRight.isDisposed()) {
- this.topRight.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topRight = c;
- layout();
-}
-public void setBorderVisible(boolean show) {
- if (showBorder == show) return;
-
- showBorder = show;
- if (showBorder) {
- if ((getStyle() & SWT.FLAT)!= 0) {
- BORDER_LEFT = BORDER_TOP = BORDER_RIGHT = BORDER_BOTTOM = 1;
- } else {
- BORDER_LEFT = BORDER_TOP = 1;
- BORDER_RIGHT = BORDER_BOTTOM = 3;
- }
- } else {
- BORDER_BOTTOM = BORDER_TOP = BORDER_LEFT = BORDER_RIGHT = 0;
- }
-
- layout();
- redraw();
-}
-/**
-* If true, the topCenter will always appear on a separate line by itself, otherwise the
-* topCenter will appear in the top row if there is room and will be moved to the second row if
-* required.
-*/
-public void setTopCenterSeparate(boolean show) {
- separateTopCenter = show;
- layout();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java
deleted file mode 100644
index bf05aadb17..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java
+++ /dev/null
@@ -1,653 +0,0 @@
-package org.eclipse.swt.custom;
-/*
- * (c) Copyright IBM Corp. 2001, 2002.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-
-/**
- * An instance of class <code>WrappedContent</code> is used by
- * StyledText to display wrapped lines. Lines are wrapped at word
- * breaks which are marked by a space character. Trailing space
- * behind words is kept on the current line.
- * If the last remaining word on a line can not be fully displayed
- * the line is wrapped character by character.
- * WrappedContent wraps a StyledTextContent which provides the line
- * data. The start offset and length of wrapped lines is calculated
- * and updated based on recalculation requests and text changes.
- * <p>
- * All public methods in this class implement the
- * <code>StyledTextContent</code> interface. Package visible
- * methods are internal API for use by <code>StyledText</code>.
- * </p>
- */
-class WrappedContent implements StyledTextContent {
- final static int LINE_OFFSET = 0; // index of line offset in visualLines array
- final static int LINE_LENGTH = 1; // index of line lenght in visualLines array
- final static int WRAP_LINE_LENGTH = 0;
- final static int WRAP_LINE_WIDTH = 1;
-
- StyledText parent;
- StyledTextContent logicalContent;
- int[][] visualLines; // start and length of each visual line
- int visualLineCount = 0;
-
-/**
- * Create a new instance.
- *
- * @param styledText StyledText widget that displays the lines
- * wrapped by the new instance.
- * @param logicalContent StyledTextContent that provides the line
- * data.
- */
-WrappedContent(StyledText styledText, StyledTextContent logicalContent) {
- parent = styledText;
- this.logicalContent = logicalContent;
-}
-/**
- * @see StyledTextContent#addTextChangeListener(TextChangeListener)
- */
-public void addTextChangeListener(TextChangeListener listener) {
- logicalContent.addTextChangeListener(listener);
-}
-/**
- * Grow the lines array to at least the specified size.
- * <p>
- *
- * @param numLines number of elements that the array should have
- * at a minimum
- */
-private void ensureSize(int numLines) {
- int size = visualLines.length;
- if (size >= numLines) {
- return;
- }
- int[][] newLines = new int[Math.max(size * 2, numLines)][2];
- System.arraycopy(visualLines, 0, newLines, 0, size);
- visualLines = newLines;
- resetVisualLines(size, visualLines.length - size);
-}
-/**
- * @see StyledTextContent#getCharCount()
- */
-public int getCharCount() {
- return logicalContent.getCharCount();
-}
-/**
- * @return the visual (wrapped) line at the specified index
- * @see StyledTextContent#getLine(int)
- */
-public String getLine(int lineIndex) {
- String line;
-
- // redirect call to logical content if there are no wrapped lines
- if (visualLineCount == 0) {
- line = logicalContent.getLine(lineIndex);
- }
- else {
- line = logicalContent.getTextRange(visualLines[lineIndex][LINE_OFFSET], visualLines[lineIndex][LINE_LENGTH]);
- }
- return line;
-}
-/**
- * Returns the visual (wrapped) line at given offset.
- * <p>
- * The offset is ambiguous if it identifies the end of a visual line and
- * there is another visual line below. In this case the end of the visual
- * line has the same offset as the beginning of the next visual line
- * since the visual line break is not represented by any character in the
- * logical line.
- * In this ambiguous case the offset is assumed to represent the end of a
- * visual line and the index of the first visual line is returned.
- * </p>
- *
- * @param offset offset of the desired line.
- * @return the index of the visual (wrapped) line at the specified offset
- * @see StyledTextContent#getLineAtOffset(int)
- */
-public int getLineAtOffset(int offset) {
- int lastLine = visualLineCount - 1;
- int lastChar;
-
- // redirect call to logical content if there are no wrapped lines
- if (visualLineCount == 0) {
- return logicalContent.getLineAtOffset(offset);
- }
- // can't use getCharCount to get the number of characters since this
- // method is called in textChanged, when the logicalContent used by
- // getCharCount has already changed. at that point the visual lines
- // have not been updated yet and we thus need to use the old character
- // count which is only available in the visual content.
- lastChar = visualLines[lastLine][LINE_OFFSET] + visualLines[lastLine][LINE_LENGTH];
- if (offset < 0 || (offset > 0 && offset > lastChar)) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- // if last line and the line is not empty you can ask for
- // a position that doesn't exist (the one to the right of the
- // last character) - for inserting
- if (offset == lastChar) {
- return lastLine;
- }
-
- int high = visualLineCount;
- int low = -1;
- int index = visualLineCount;
- while (high - low > 1) {
- index = (high + low) / 2;
- int lineStart = visualLines[index][LINE_OFFSET];
- if (offset >= lineStart) {
- int lineEnd = lineStart + visualLines[index][LINE_LENGTH];
- low = index;
- if (offset <= lineEnd) {
- break;
- }
- }
- else {
- high = index;
- }
- }
- if (low > 0 && offset == visualLines[low - 1][LINE_OFFSET] + visualLines[low - 1][LINE_LENGTH]) {
- // end of a visual line/beginning of next visual line is ambiguous
- // (they have the same offset). always return the first visual line
- low--;
- }
- return low;
-}
-/**
- * @return the number of visual (wrapped) lines
- * @see StyledTextContent#getLineCount()
- */
-public int getLineCount() {
- int lineCount = visualLineCount;
-
- // redirect call to logical content if there are no wrapped lines
- if (visualLineCount == 0) {
- lineCount = logicalContent.getLineCount();
- }
- return lineCount;
-}
-/**
- * @see StyledTextContent#getLineDelimiter()
- */
-public String getLineDelimiter() {
- return logicalContent.getLineDelimiter();
-}
-/**
- * @return the start offset of the visual (wrapped) line at the given
- * index
- * @see StyledTextContent#getOffsetAtLine(int)
- */
-public int getOffsetAtLine(int lineIndex) {
- int offset;
-
- // redirect call to logical content if there are no wrapped lines
- if (visualLineCount == 0) {
- offset = logicalContent.getOffsetAtLine(lineIndex);
- }
- else {
- offset = visualLines[lineIndex][LINE_OFFSET];
- }
- return offset;
-}
-/**
- * @see StyledTextContent#getTextRange(int, int)
- */
-public String getTextRange(int start, int length) {
- return logicalContent.getTextRange(start, length);
-}
-/**
- * Returns the offset of the character after the word at the specified
- * offset.
- * <p>
- * Words are separated by spaces. Trailing spaces are considered part
- * of the word.
- * </p>
- *
- * @param line logical line the word is in
- * @param startOffset start offset of the line, relative to the start
- * of the logical line.
- * @param offset offset of the word to return the end of, relative to
- * the start of the visual line.
- * @return the offset of the character after the word at the specified
- * offset.
- */
-private int getWordEnd(String line, int startOffset, int offset) {
- int lineLength = line.length();
-
- offset += startOffset;
- if (offset >= lineLength) {
- return offset - startOffset;
- }
- // skip over leading whitespace
- do {
- offset++;
- } while (offset < lineLength && Compatibility.isSpaceChar(line.charAt(offset)));
- while (offset < lineLength && Compatibility.isSpaceChar(line.charAt(offset)) == false) {
- offset++;
- }
- // skip over trailing whitespace
- while (offset < lineLength && Compatibility.isSpaceChar(line.charAt(offset))) {
- offset++;
- }
- return offset - startOffset;
-}
-/**
- * Returns the start offset of the word at the specified offset.
- * There are two classes of words formed by a sequence of characters:
- * <p>
- * Words are separated by spaces. Trailing spaces are considered part
- * of the word.
- * </p>
- *
- * @param line logical line the word is in
- * @param startOffset start offset of the line, relative to the start
- * of the logical line.
- * @param offset offset of the word to return the start of, relative to
- * the start of the visual line.
- * @return the start offset of the word at the specified offset.
- */
-private int getWordStart(String line, int startOffset, int offset) {
- offset += startOffset;
- // skip over trailing whitespace
- do {
- offset--;
- } while (offset > startOffset && Compatibility.isSpaceChar(line.charAt(offset)));
- while (offset > startOffset && Compatibility.isSpaceChar(line.charAt(offset - 1)) == false) {
- offset--;
- }
- return offset - startOffset;
-}
-/**
- * @see StyledTextContent#removeTextChangeListener(TextChangeListener)
- */
-public void removeTextChangeListener(TextChangeListener listener) {
- logicalContent.removeTextChangeListener(listener);
-}
-/**
- * Reset the visual (wrapped) lines in the specified range.
- * If the range specifies partial logical lines (e.g., startLine is
- * the second of two visual lines) it is extended to reset all visual
- * lines of a logical line.
- * Following the reset the logical lines in the reset visual range are
- * rewrapped.
- * <p>
- *
- * @param startLine index of the first visual line
- * @param lineCount number of visual lines
- */
-void reset(int startLine, int lineCount) {
- if (lineCount <= 0 || visualLineCount == 0) {
- return;
- }
- reset(startLine, lineCount, true);
-}
-/**
- * Reset the visual (wrapped) lines in the specified range.
- * If the range specifies partial logical lines (e.g., startLine is
- * the second of two visual lines) it is extended to reset all visual
- * lines of a logical line.
- * <p>
- *
- * @param startLine index of the first visual line
- * @param lineCount number of visual lines
- * @param wrap true=rewrap the logical lines in the reset visual range
- * false=don't rewrap lines. Visual lines will be left in an inconsistent
- * state since there will be a range of unwrapped and unknown lines.
- * @return the first visual line that was reset
- */
-private int reset(int startLine, int lineCount, boolean wrap) {
- if (lineCount <= 0) {
- return startLine;
- }
- // make sure that all visual lines of the first logical line are
- // being reset. visualFirstLine is the first visual line of the
- // first logical line that has at least one visual line reset.
- int visualFirstLineOffset = getOffsetAtLine(startLine);
- int logicalFirstLine = logicalContent.getLineAtOffset(visualFirstLineOffset);
- int logicalFirstLineOffset = logicalContent.getOffsetAtLine(logicalFirstLine);
- int visualFirstLine = getLineAtOffset(logicalFirstLineOffset);
-
- lineCount += startLine - visualFirstLine;
- startLine = visualFirstLine;
-
- // make sure that all visual lines of the last logical line are
- // being reset.
- int lastLine = startLine + lineCount - 1;
- int lastLineEnd = visualLines[lastLine][LINE_OFFSET] + visualLines[lastLine][LINE_LENGTH];
- int logicalEndLine = 0;
-
- while (lastLine < visualLineCount - 1 && lastLineEnd == visualLines[lastLine + 1][LINE_OFFSET]) {
- lastLine++;
- lastLineEnd = visualLines[lastLine][LINE_OFFSET] + visualLines[lastLine][LINE_LENGTH];
- }
- if (wrap) {
- if (lastLine == visualLineCount - 1) {
- logicalEndLine = logicalContent.getLineCount();
- }
- else {
- logicalEndLine = logicalContent.getLineAtOffset(visualLines[lastLine + 1][LINE_OFFSET]);
- }
- }
- lineCount = lastLine - startLine + 1;
- resetVisualLines(startLine, lineCount);
- visualLineCount -= lineCount;
- if (wrap) {
- // always recalculate line wrap immediately after a reset
- // because the content always needs to be in a usable state.
- // i.e., there must not be any reset but unwrapped lines
- wrapLineRange(logicalFirstLine, logicalEndLine, startLine);
- }
- return startLine;
-}
-/**
- * Reset the visual (wrapped) lines in the specified range.
- * <p>
- *
- * @param startLine index of the first visual line
- * @param lineCount number of visual lines
- */
-private void resetVisualLines(int startLine, int lineCount) {
- int endLine = startLine + lineCount;
-
- for (int i = startLine; i < endLine; i++) {
- visualLines[i] = new int[] {-1, -1};
- }
-}
-/**
- * @see StyledTextContent#replaceTextRange(int, int, String)
- */
-public void replaceTextRange(int start, int replaceLength, String text) {
- logicalContent.replaceTextRange(start, replaceLength, text);
-}
-/**
- * @see StyledTextContent#setText(String)
- */
-public void setText(String text) {
- logicalContent.setText(text);
-}
-/**
- * Set the line wrap data for the specified visual (wrapped) line.
- * <p>
- *
- * @param visualLineIndex index of the visual line
- * @param visualLineOffset start offset of the visual line, relative
- * to the start of the document
- * @param visualLineLength length of the visual line
- */
-private void setVisualLine(int visualLineIndex, int visualLineOffset, int visualLineLength) {
- ensureSize(visualLineCount + 1);
- // is the space for the visual line already taken? can happen if
- // there are more visual lines for a given logical line than before
- if (visualLines[visualLineIndex][LINE_OFFSET] != -1) {
- System.arraycopy(visualLines, visualLineIndex, visualLines, visualLineIndex + 1, visualLineCount - visualLineIndex);
- visualLines[visualLineIndex] = new int[2];
- }
- visualLines[visualLineIndex][LINE_OFFSET] = visualLineOffset;
- visualLines[visualLineIndex][LINE_LENGTH] = visualLineLength;
- visualLineCount++;
-}
-/**
- * Recalculates the line wrap for the lines affected by the
- * text change.
- * <p>
- *
- * @param startOffset the start offset of the text change
- * @param newLineCount the number of inserted lines
- * @param replaceLineCount the number of deleted lines
- * @param newCharCount the number of new characters
- * @param replaceCharCount the number of deleted characters
- */
-void textChanged(int startOffset, int newLineCount, int replaceLineCount, int newCharCount, int replaceCharCount) {
- // do nothing if there are no wrapped lines
- if (visualLineCount == 0) {
- return;
- }
- int logicalStartLine = logicalContent.getLineAtOffset(startOffset);
- int visualStartLine = getLineAtOffset(startOffset);
- int visualReplaceLastLine = visualLineCount - 1;
- int textChangeDelta = newCharCount - replaceCharCount;
-
- if (replaceLineCount > 0) {
- visualReplaceLastLine = getLineAtOffset(startOffset + replaceCharCount);
- // at the start of a visual line/end of the previous visual line?
- if (visualReplaceLastLine == 0 ||
- visualLines[visualReplaceLastLine][LINE_OFFSET] == visualLines[visualReplaceLastLine - 1][LINE_OFFSET] + visualLines[visualReplaceLastLine - 1][LINE_LENGTH]) {
- visualReplaceLastLine++;
- }
- visualStartLine = reset(visualStartLine, visualReplaceLastLine - visualStartLine + 1, false);
- }
- else {
- visualStartLine = reset(visualStartLine, 1, false);
- }
- visualReplaceLastLine = wrapLineRange(logicalStartLine, logicalStartLine + 1 + newLineCount, visualStartLine);
- for (int i = visualReplaceLastLine; i < visualLineCount; i++) {
- visualLines[i][LINE_OFFSET] += textChangeDelta;
- }
-}
-/**
- * Measure the width of a segment in the specified logical line.
- * <p>
- *
- * @param line the logical line
- * @param logicalLineOffset start offset of the logical line, relative
- * to the start of the document
- * @param visualLineOffset offset to start measuring at/start offset
- * of the visual line
- * @param visualLineLength length of the segment to measure/the visual
- * line
- * @param styles StyleRanges to use during measuring
- * @param startX x position of the visual line relative to the start
- * of the logical line
- * @param gc GC to use for measuring
- * @param fontData FontData currently set in gc. Used to reduce calls
- * to gc.getFont().getFontData()
- */
-private int textWidth(String line, int logicalLineOffset, int visualLineOffset, int visualLineLength, StyleRange[] styles, int startX, GC gc, FontData fontData) {
- int width;
-
- if (styles != null) {
- // while wrapping a line, the logcial line styles may contain
- // style ranges that don't apply (i.e., completely on the previous/next
- // visual line). Therefore we need to filter the logical lines.
- styles = parent.getVisualLineStyleData(styles, logicalLineOffset + visualLineOffset, visualLineLength);
- }
- if (parent.isBidi()) {
- String wrappedLine = line.substring(visualLineOffset, visualLineOffset + visualLineLength);
- StyledTextBidi bidi = parent.getStyledTextBidi(wrappedLine, logicalLineOffset + visualLineOffset, gc, styles);
- width = bidi.getTextWidth();
- }
- else {
- width = parent.textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength, styles, startX, gc, fontData);
- }
- return width;
-}
-/**
- * Wrap the given logical line at the specified offset.
- * Called repeatedly until the entire logical lines has been split into
- * visual (wrapped) lines.
- * <p>
- *
- * @param line the logical line
- * @param logicalLineOffset offset of the logical line, relative to the
- * beginning of the content
- * @param visualLineOffset start offset of the new visual line, relative
- * to the start of the logical line.
- * @param startX x position of visualLineOffset, relative to the beginning
- * of the logical line
- * @param width width to wrap the line to
- * @param numChars average number of characters that fit into width
- * @param styles StyleRanges to use for measuring the wrapped line
- * @param gc GC to use for measuring
- * @param fontData FontData currently set in gc. Used to reduce calls to
- * gc.getFont().getFontData()
- * @return int[0]=length of the new visual line, int[1]=width in pixels
- * of the new visual line
- */
-private int[] wrapLine(String line, int logicalLineOffset, int visualLineOffset, int startX, int width, int numChars, StyleRange[] styles, GC gc, FontData fontData) {
- int lineLength = line.length();
- int lineWidth = 0;
- int visualLineLength;
-
- numChars = Math.min(numChars, lineLength - visualLineOffset);
- visualLineLength = getWordStart(line, visualLineOffset, numChars);
- // find a word that is within the client area. make sure at least one
- // character is on each line so that line wrap algorithm terminates.
- if (visualLineLength > 0) {
- lineWidth = textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength, styles, startX, gc, fontData);
- if (lineWidth >= width) {
- while (visualLineLength > 1 && lineWidth >= width) {
- visualLineLength = getWordStart(line, visualLineOffset, visualLineLength);
- lineWidth = textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength, styles, startX, gc, fontData);
- }
- }
- else
- if (lineWidth < width) {
- while (visualLineOffset + visualLineLength < lineLength) {
- int newLineLength = getWordEnd(line, visualLineOffset, visualLineLength);
- int newLineWidth = textWidth(line, logicalLineOffset, visualLineOffset, newLineLength, styles, startX, gc, fontData);
- // would next word be beyond client area?
- if (newLineWidth >= width) {
- break;
- }
- else {
- visualLineLength = newLineLength;
- lineWidth = newLineWidth;
- }
- }
- }
- }
- if (visualLineLength <= 0) {
- // no complete word fits on the line. either first word was not within
- // estimated number of characters or it was beyond the line width even
- // though it was within numChars.
- visualLineLength = numChars;
- lineWidth = textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength, styles, startX, gc, fontData);
- if (lineWidth >= width) {
- while (visualLineLength > 1 && lineWidth >= width) {
- visualLineLength--;
- lineWidth = textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength, styles, startX, gc, fontData);
- }
- }
- else
- if (lineWidth < width) {
- while (visualLineOffset + visualLineLength < lineLength) {
- int newLineWidth = textWidth(line, logicalLineOffset, visualLineOffset, visualLineLength + 1, styles, startX, gc, fontData);
- if (newLineWidth >= width) {
- break;
- }
- else {
- visualLineLength++;
- lineWidth = newLineWidth;
- }
- }
- }
- }
- return new int[] {visualLineLength, lineWidth};
-}
-/**
- * Wrap the logical lines in the given range at the current client
- * area width of the StyledText widget
- * <p>
- *
- * @param startLine first logical line to wrap
- * @param endLine line after last logical line
- * @param visualLineIndex visual (wrapped) line index that startLine
- * corresponds to.
- * @return index of the line following the last wrapped line
- */
-private int wrapLineRange(int startLine, int endLine, int visualLineIndex) {
- int emptyLineCount = 0;
-
- visualLineIndex = wrapLineRange(startLine, endLine, visualLineIndex, parent.getClientArea().width);
- // is there space left for more visual lines? can happen if there are fewer
- // visual lines for a given logical line than before
- for (int i = visualLineIndex; i < visualLines.length; i++, emptyLineCount++) {
- if (visualLines[i][LINE_OFFSET] != -1) {
- break;
- }
- }
- if (emptyLineCount > 0) {
- int copyLineCount = visualLineCount - visualLineIndex;
- System.arraycopy(visualLines, visualLineIndex + emptyLineCount, visualLines, visualLineIndex, copyLineCount);
- resetVisualLines(visualLineIndex + copyLineCount, emptyLineCount);
- }
- return visualLineIndex;
-}
-/**
- * Wrap the lines in the given range. Skip lines that have already
- * been wrapped.
- * <p>
- *
- * @param startLine first logical line to wrap
- * @param endLine line after last logical line
- * @param visualLineIndex visual (wrapped) line index that startLine
- * corresponds to.
- * @param width line width to wrap at
- * @return index of last wrapped line
- */
-private int wrapLineRange(int startLine, int endLine, int visualLineIndex, int width) {
- GC gc = new GC(parent);
- FontData fontData = gc.getFont().getFontData()[0];
- int numChars = Math.max(1, width / gc.getFontMetrics().getAverageCharWidth());
-
- // if there are no wrapped lines and the width is 0 the widget has
- // not been made visible/sized yet. don't wrap until the widget size
- // is known.
- if (visualLineCount == 0 && width == 0) {
- return visualLineIndex;
- }
- for (int i = startLine; i < endLine; i++) {
- String line = logicalContent.getLine(i);
- int lineOffset = logicalContent.getOffsetAtLine(i);
- int lineLength = line.length();
-
- if (lineLength == 0) {
- setVisualLine(visualLineIndex, lineOffset, 0);
- visualLineIndex++;
- continue;
- }
- StyleRange[] styles = null;
- StyledTextEvent event = parent.getLineStyleData(lineOffset, line);
- int startOffset = 0;
- int startX = 0;
-
- if (event != null) {
- styles = parent.filterLineStyles(event.styles);
- }
- while (startOffset < lineLength) {
- int[] result = wrapLine(line, lineOffset, startOffset, startX, width, numChars, styles, gc, fontData);
-
- setVisualLine(visualLineIndex, lineOffset + startOffset, result[WRAP_LINE_LENGTH]);
- startOffset += result[WRAP_LINE_LENGTH];
- startX += result[WRAP_LINE_WIDTH];
- visualLineIndex++;
- }
- }
- gc.dispose();
- return visualLineIndex;
-}
-/**
- * Wrap all logical lines at the current client area width of the
- * StyledText widget
- */
-void wrapLines() {
- wrapLines(parent.getClientArea().width);
-}
-/**
- * Wrap all logical lines at the given width.
- * <p>
- *
- * @param width width to wrap lines at
- */
-void wrapLines(int width) {
- int lineCount = logicalContent.getLineCount();
-
- visualLineCount = 0;
- visualLines = new int[lineCount][2];
- resetVisualLines(0, visualLines.length);
- wrapLineRange(0, lineCount, 0, width);
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/package.html b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/package.html
deleted file mode 100755
index cb946ce558..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Custom widgets.
-<h2>
-Package Specification</h2>
-This package contains the custom widgets which were written to provide the
-standard look and feel of the Eclipse platform.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java
deleted file mode 100755
index 3e3bcba80b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- *
- * Class DND contains all the constants used in defining a
- * DragSource or a DropTarget.
- *
- */
-
-
-public class DND {
-
- /**
- * Drag and Drop Operation: no drag/drop operation is performed
- */
- public final static int DROP_NONE = 0;
- /**
- * Drag and Drop Operation: a copy of the data in the drag source is added to the drop target
- */
- public final static int DROP_COPY = 1;
- /**
- * Drag and Drop Operation: the data is added to the drop target and removed from the drag source
- */
- public final static int DROP_MOVE = 2;
- /**
- * Drag and Drop Operation: the drop target makes a link to the data in the drag source
- */
- public final static int DROP_LINK = 4;
-
- public final static int DROP_TARGET_MOVE = 5;
- /**
- * DragSource Event: the drop has successfully completed or has been terminated (such as hitting the ESC key);
- * perform cleanup such as removing data on a move operation
- */
- public static final int DragEnd = 2000;
- /**
- * DragSource Event: the data to be dropped is required from the drag source
- */
- public static final int DragSetData = 2001;
- /**
- * DropTarget Event: the cursor has entered the drop target boundaries
- */
- public static final int DragEnter = 2002;
- /**
- * DropTarget Event: the cursor has left the drop target boundaries
- */
- public static final int DragLeave = 2003;
- /**
- * DropTarget Event: the cursor is moving over the drop target
- */
- public static final int DragOver = 2004;
- /**
- * DropTarget Event: the operation being performed has changed
- * (usually due to the user changing the selected key while dragging)
- */
- public static final int DragOperationChanged = 2005;
- /**
- * DropTarget Event: the data is being dropped
- */
- public static final int Drop = 2006;
- /**
- * DropTarget Event: the drop target is given a last chance to modify the drop
- */
- public static final int DropAccept = 2007;
- /**
- * DragSource Event: a drag is about to begin
- */
- public static final int DragStart = 2008;
-
- public static final int FEEDBACK_NONE = 0;
- public static final int FEEDBACK_SELECT = 1;
- public static final int FEEDBACK_INSERT_BEFORE = 2;
- public static final int FEEDBACK_INSERT_AFTER = 4;
- public static final int FEEDBACK_SCROLL = 8;
- public static final int FEEDBACK_EXPAND = 16;
-
-
- /**
- * Error code for SWTError - drag source can not be initialized
- */
- public static final int ERROR_CANNOT_INIT_DRAG = 2000;
- /**
- * Error code for SWTError - drop target cannot be initialized
- */
- public static final int ERROR_CANNOT_INIT_DROP = 2001;
- /**
- * Error code for SWTError - Data can not be set on system clipboard
- */
- public static final int ERROR_CANNOT_SET_CLIPBOARD = 2002;
-
-
- static final String INIT_DRAG_MESSAGE = "Can not initialize Drag";
- static final String INIT_DROP_MESSAGE = "Can not initialize Drop";
- static final String CANNOT_SET_CLIPBOARD_MESSAGE = "Can not set data in clipboard";
-
-public static void error (int code) {
- error (code, 0);
-}
-
-public static void error (int code, int hresult) {
- switch (code) {
- /* OS Failure/Limit (fatal, may occur only on some platforms) */
- case DND.ERROR_CANNOT_INIT_DRAG:{
- String msg = DND.INIT_DRAG_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- case DND.ERROR_CANNOT_INIT_DROP:{
- String msg = DND.INIT_DROP_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- case DND.ERROR_CANNOT_SET_CLIPBOARD:{
- String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- }
-
- /* Unknown/Undefined Error */
- SWT.error(code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
deleted file mode 100755
index e0dfd61d96..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-class DNDEvent extends Event {
-
- public TransferData dataType;
- public TransferData[] dataTypes;
- public int operations;
- public int feedback;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java
deleted file mode 100755
index 8c20b7365b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.internal.SWTEventListener;
-
-
-class DNDListener extends org.eclipse.swt.widgets.TypedListener {
-/**
- * DNDListener constructor comment.
- * @param listener org.eclipse.swt.internal.SWTEventListener
- */
-DNDListener(SWTEventListener listener) {
- super(listener);
-}
-public void handleEvent (Event e) {
- switch (e.type) {
- case DND.DragStart: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragStart (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragEnd: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragFinished (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragSetData: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragSetData (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragEnter: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragEnter (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragLeave: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragLeave (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragOver: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragOver (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.Drop: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).drop (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DropAccept: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dropAccept (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragOperationChanged: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragOperationChanged (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
-
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java
deleted file mode 100755
index 30a349cafd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DragSourceAdapter implements DragSourceListener {
- public void dragStart(DragSourceEvent event){};
- public void dragFinished(DragSourceEvent event){};
- public void dragSetData(DragSourceEvent event){};
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
deleted file mode 100755
index f47370a7c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.events.TypedEvent;
-
-/**
- * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener.
- *
- * <p>dragStart : When a drag operation is about to being, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that is initiating the drag
- * <li>time - (in) the time the drag action occurred
- * <li>doit - (out) the application can set this value to false to prevent the drag from starting. Set to true by default.
- * </ul></p>
- *
- * <p>dragSetData : When requesting data from the DragSource, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>dataType - (in) the type of data requested. This is a TransferData object and can be used with the Transfer subclasses.
- * <li>data - (out) the application inserts the actual data here (must match the dataType). This is a Java object and
- * the type of Java object that the application should insert here depends on the data type.
- * For example, a TextTransfer requires a Java String containing the text; a FileTransfer requires
- * a Java array of String with each String in the array representing the full path of the file.
- * To determine what type of object you need to place in this field, consult the description of
- * the Transfer subclass
- * </ul></p>
- *
- * <p>dragFinished : When a drag operation has been completed, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (in) true if the operation performed successfully
- * <li>detail - (in) the operation that was performed (DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- */
-
-public class DragSourceEvent extends TypedEvent {
- public int detail;
- public boolean doit;
-
- /**
- * Platform specific information about the type of data being transferred.
- */
- public TransferData dataType;
-
-public DragSourceEvent(DNDEvent e) {
- super(e);
- this.data = e.data;
- this.detail = e.detail;
- this.doit = e.doit;
- this.dataType = e.dataType;
-}
-void updateEvent(DNDEvent e) {
- e.widget = this.widget;
- e.time = this.time;
- e.data = this.data;
- e.detail = this.detail;
- e.doit = this.doit;
- e.dataType = this.dataType;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java
deleted file mode 100755
index d952888812..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * The <code>DragSourceListener</code> class provides event notification to the application for DragSource events.
- *
- * <p>When the user drops data on a <code>DropTarget</code>, the application which defines the <code>DragSource</code>
- * must provide the dropped data by implementing <code>dragSetData</code>.</p>
- *
- * <p>After the drop has completed successfully or has been aborted, the application which defines the
- * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful
- * <b>move</b> operation, the application must remove the data that was transferred.</p>
- *
- */
-public interface DragSourceListener extends SWTEventListener {
-
-/**
- * The user has begun the actions required to drag the widget. This event gives the application
- * the chance to decide if a drag should be started.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (out) set to fase by default. To cause a drag to begin, set this to true.
- * </ul></p>
- *
- * @param event the information associated with the drag finished event
- *
- */
-public void dragStart(DragSourceEvent event);
-
-/**
- * The data is required from the drag source.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>dataType - (in) the type of data requested. This is a TransferData object and can be used with the Transfer subclasses.
- * <li>data - (out) the application inserts the actual data here (must match the dataType)
- * </ul></p>
- *
- * @param event the information associated with the drag set data event
- */
-public void dragSetData(DragSourceEvent event);
-
-/**
- * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting
- * the ESC key). Perform cleanup such as removing data from the source side on a successful move operation.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (in) true if the operation performed successfully
- * <li>detail - (in) the operation that was performed (DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * @param event the information associated with the drag finished event
- *
- */
-public void dragFinished(DragSourceEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java
deleted file mode 100755
index fc55ade742..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-abstract class DragUnderEffect {
-
-abstract void show(int effect, int x, int y);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java
deleted file mode 100755
index 2b551b138c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DropTargetAdapter implements DropTargetListener {
-
-public void dragEnter(DropTargetEvent event){};
-public void dragLeave(DropTargetEvent event){};
-public void dragOperationChanged(DropTargetEvent event){};
-public void dragOver(DropTargetEvent event){};
-public void drop(DropTargetEvent event){};
-public void dropAccept(DropTargetEvent event){};
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
deleted file mode 100755
index 19dff63554..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
- *
- * <p>When in dragEnter(), dragOver(), dragLeave(), dragOperationChanged(), dropAccept(),
- * the following fields apply:
- * <ul>
- * <li>(in)widget - the object on which the data will be dropped if the mouse is released
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the DropTarget <code>Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the DropTarget <code>Control</code>
- * <li>(in)dataTypes - a list of the types of data that the DragSource can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided on a drop
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul>
- * The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes list</code>.</p>
- *
- * <p>When in drop(), the following fields apply:
- * <ul>
- * <li>(in)widget - the object on which the data was dropped
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>Display</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>Display</code>
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * <li>(in)currentDataType - the specific type of data that is be contained in the <code>data</code> field
- * <li>(in)data - the data (which is of type currentDataType); the type Java Object contained in this field is
- * dependant on the Transfer subclass. For example, the TextTransfer subclass provides a
- * String with the text in the String. The FileTransfer object provides an array of String with
- * each String in the array containing the full path of the file.
- * </ul>
- * The application can cancel the drop operation by setting the detail field to DND.DROP_NONE.</p>
- *
- */
-public class DropTargetEvent extends TypedEvent {
- public int x;
- public int y;
- public int detail;
- /**
- * A list of the operations that the DragSource can support
- * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
- */
- public int operations;
- public int feedback;
- public Widget item;
-
- /*
- * Platform specfic data.
- */
- /**
- * The type of data that will be dropped.
- */
- public TransferData currentDataType;
- /**
- * A list of the types of data that the DragSource is capable of providing.
- * The currentDataType must be a member of this list.
- */
- public TransferData[] dataTypes;
-
-
-public DropTargetEvent(DNDEvent e) {
- super(e);
- this.data = e.data;
- this.x = e.x;
- this.y = e.y;
- this.detail = e.detail;
- this.currentDataType = e.dataType;
- this.dataTypes = e.dataTypes;
- this.operations = e.operations;
- this.feedback = e.feedback;
- this.item = e.item;
-}
-void updateEvent(DNDEvent e) {
- e.widget = this.widget;
- e.time = this.time;
- e.data = this.data;
- e.x = this.x;
- e.y = this.y;
- e.detail = this.detail;
- e.dataType = this.currentDataType;
- e.dataTypes = this.dataTypes;
- e.operations = this.operations;
- e.feedback = this.feedback;
- e.item = this.item;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java
deleted file mode 100755
index 5defa79fe2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * The <code>DropTargetListener</code> class provides event notification to the application for DropTarget events.
- *
- * <p>As the user moves the cursor into, over and out of a Control that has been designated as a DropTarget, events
- * indicate what operation can be performed and what data can be transferred if a drop where to occur at that point.
- * The application can respond to these events and change the type of data that will be dropped, change the operation
- * that will be performed or stop any drop from happening on the current target.</p>
- *
- * <p>When the user causes a drop to happen by releasing the mouse over a valid drop target, the application has one
- * last chance to change the data type of the drop through the DropAccept event. If the drop is still allowed, the
- * DropAccept event is immediately followed by the Drop event. In the Drop event, the application can still change the
- * operation that is performed but the data type is fixed.</p>
- *
- */
-public interface DropTargetListener extends SWTEventListener {
-/**
- * The cursor has entered the drop target boundaries.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag enter event
- *
- */
-public void dragEnter(DropTargetEvent event);
-/**
- * The cursor has left the drop target boundaries.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag leave event
- *
- */
-
-public void dragLeave(DropTargetEvent event);
-/**
- * The operation being performed has changed (usually due to the user changing the selected key while dragging).
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag operation changed event
- */
-
-public void dragOperationChanged(DropTargetEvent event);
-/**
- * The cursor is moving over the drop target.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag over event
- *
- */
-
-public void dragOver(DropTargetEvent event);
-/**
- * The data is being dropped.
- *
- * <p>The following fields in DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * <li>(in)currentDataType - the specific type of data that will be provided
- * <li>(in)data - the data (which is of type currentDataType)
- * </ul></p>
- *
- * <p>The application can refuse to perform the drop operation by setting the detail field to DND.DROP_NONE.</p>
- *
- * @param event the information associated with the drop event
- *
- */
-
-public void drop(DropTargetEvent event);
-/**
- * The drop target is given the chance to change the nature of the drop. It can veto the drop by setting the
- * <code>event.detail</code> field to <code>DND.DROP_NONE</code>, it can change the data of data that will be
- * dropped by setting the <code>event.currentDataType</code> field to a different value or it can change the
- * operation that will be performed by changing the <code>event.detail</code> field.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drop accept event
- *
- */
-public void dropAccept(DropTargetEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java
deleted file mode 100755
index d3d854a3e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-class NoDragUnderEffect extends DragUnderEffect {
-
-NoDragUnderEffect(Control control) {}
-void show(int effect, int x, int y){}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html
deleted file mode 100755
index e2adf9d6c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Drag and Drop support.
-<h2>
-Package Specification</h2>
-This package contains the classes which make up the public API of the SWT Drag and Drop support.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100644
index c8c5e4a05a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- return null;
-}
-public boolean isSupportedType(TransferData transferData){
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100644
index b368acb214..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
- return display.getData("TextTransfer");
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- for (int i = 0; i < transferAgents.length; i++) {
- if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
- display.setData("TextTransfer", data[i]);
- return;
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100644
index 1c41d9e326..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public final class DragSource extends Widget {
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, style);
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
-
-}
-
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-/**
- * @deprecated - use DragSourceListener.dragStart
- */
-public void startDrag() {
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100644
index 1be0fe0207..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public final class DropTarget extends Widget {
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
- super(control, style);
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
-}
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return null;
-}
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer() { return null; }
-public void notifyListener (int eventType, Event event) {}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100644
index a3f240b7a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return null;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- return null;
-}
-protected String[] getTypeNames(){
- return null;
-}
-protected int[] getTypeIds(){
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100644
index 490afaebc7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100644
index 6862a2ea48..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- return table.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100644
index d84cbfe40a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100644
index 9dcf84ff27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100644
index bade8baef0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100644
index 54ff723827..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- return tree.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100644
index c8c5e4a05a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- return null;
-}
-public boolean isSupportedType(TransferData transferData){
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100644
index b368acb214..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
- return display.getData("TextTransfer");
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- for (int i = 0; i < transferAgents.length; i++) {
- if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
- display.setData("TextTransfer", data[i]);
- return;
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100644
index 1c41d9e326..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public final class DragSource extends Widget {
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, style);
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
-
-}
-
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-/**
- * @deprecated - use DragSourceListener.dragStart
- */
-public void startDrag() {
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100644
index 1be0fe0207..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public final class DropTarget extends Widget {
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
- super(control, style);
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
-}
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return null;
-}
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer() { return null; }
-public void notifyListener (int eventType, Event event) {}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100644
index a3f240b7a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return null;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- return null;
-}
-protected String[] getTypeNames(){
- return null;
-}
-protected int[] getTypeIds(){
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100644
index 490afaebc7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100644
index 6862a2ea48..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- return table.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100644
index d84cbfe40a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100644
index 9dcf84ff27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100644
index bade8baef0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100644
index 54ff723827..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- return tree.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index de4a1159a9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- }
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- if (transferData.type == types[i]) return true;
- }
- return false;
-}
-protected void javaToNative (Object object, TransferData transferData){
- if ((object == null) || !(object instanceof byte[]) || !(isSupportedType(transferData))) {
- transferData.result = 0;
- return;
- }
- byte[] buffer = (byte[])object;
- transferData.pValue = OS.XtMalloc(buffer.length + 1);
- OS.memmove(transferData.pValue, buffer, buffer.length);
- transferData.length = buffer.length;
- transferData.format = 8;
- transferData.result = 1;
-}
-protected Object nativeToJava(TransferData transferData){
-
- if (transferData.pValue == 0 || !(isSupportedType(transferData))) return null;
-
- int size = transferData.format * transferData.length / 8;
- byte[] buffer = new byte[size];
- OS.memmove(buffer, transferData.pValue, size);
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 4bf7a126ff..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
- private final int MAX_RETRIES = 10;
- private int shellHandle;
-
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (null, null, widgetClass, display.xDisplay, null, 0);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- if (shellHandle != 0) OS.XtDestroyWidget (shellHandle);
- shellHandle = 0;
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() ) return null;
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0) return null;
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0) return null;
-
- // Open clipboard for retrieval
- int retries = 0;
- int status = OS.XmClipboardStartRetrieve(xDisplay, xWindow, OS.XtLastTimestampProcessed(xDisplay));
- while ( status == OS.XmClipboardLocked && retries < MAX_RETRIES) {
- retries ++;
- status = OS.XmClipboardStartRetrieve(xDisplay, xWindow, OS.XtLastTimestampProcessed(xDisplay));
- };
- if (status != OS.XmClipboardSuccess) return null;
-
- // Does Clipboard have data in required format?
- String type = null;
- int[] length = new int[1];
- String[] supportedTypes = transfer.getTypeNames();
- for (int i = 0; i < supportedTypes.length; i++) {
- if (OS.XmClipboardInquireLength(xDisplay, xWindow, supportedTypes[i].getBytes(), length) == 1 /*OS.XmClipboardSuccess*/ ) {
- type = supportedTypes[i];
- break;
- }
- }
-
- // Retrieve data from Clipboard
- byte[] data = null;
- if (type != null) {
- data = new byte[length[0]];
- status = OS.XmClipboardRetrieve(xDisplay, xWindow, type.getBytes(), data, length[0], new int[1], new int[1]);
- if (status != OS.XmClipboardSuccess) {
- data = null;
- }
- }
-
- // Close Clipboard
- status = OS.XmClipboardEndRetrieve(xDisplay, xWindow);
-
- if (data == null) return null;
-
- // Pass data to transfer agent for conversion to a Java Object
- // Memory is allocated here to emulate the way Drag and Drop transfers data.
- TransferData transferData = new TransferData();
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, type, false);
- transferData.type = OS.XmInternAtom (xDisplay, bName, false);
- transferData.pValue = OS.XtMalloc(data.length);
- OS.memmove(transferData.pValue, data, data.length);
- transferData.length = data.length;
- transferData.format = 8;
- transferData.result = 1;
-
- Object result = transfer.nativeToJava(transferData);
-
- // Clean up allocated memory
- OS.XtFree(transferData.pValue);
-
- return result;
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- // Open clipboard for setting
- int[] item_id = new int[1];
- int retries = 0;
- int status = OS.XmClipboardStartCopy(xDisplay, xWindow, 0, OS.XtLastTimestampProcessed(xDisplay), shellHandle, 0, item_id);
- while ( status == OS.XmClipboardLocked && retries < MAX_RETRIES) {
- retries ++;
- status = OS.XmClipboardStartCopy(xDisplay, xWindow, 0, OS.XtLastTimestampProcessed(xDisplay), shellHandle, 0, item_id);
- };
- if (status != OS.XmClipboardSuccess)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- // copy data directly over to System clipboard (not deferred)
- for (int i = 0; i < transferAgents.length; i++) {
- String[] names = transferAgents[i].getTypeNames();
- for (int j = 0; j < names.length; j++) {
-
- TransferData transferData = new TransferData();
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, names[j], false);
- transferData.type = OS.XmInternAtom (xDisplay, bName, false);
- transferAgents[i].javaToNative(data[i], transferData);
- status = OS.XmClipboardFail;
- if (transferData.result == 1 && transferData.format == 8){
- byte[] buffer = new byte[transferData.length];
- OS.memmove(buffer, transferData.pValue, transferData.length);
- status = OS.XmClipboardCopy(xDisplay, xWindow, item_id[0], bName, buffer, transferData.length, 0, null);
- }
- // Clean up allocated memory
- if (transferData.pValue != 0) {
- OS.XtFree(transferData.pValue);
- }
- }
- }
-
- // close clipboard for setting
- OS.XmClipboardEndCopy(xDisplay, xWindow, item_id[0]);
-
- if (status != OS.XmClipboardSuccess)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- int[] count = new int[1];
- int[] max_length = new int[1];
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0)
- DND.error(SWT.ERROR_UNSPECIFIED);
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0)
- DND.error(SWT.ERROR_UNSPECIFIED);
- if (OS.XmClipboardInquireCount(xDisplay, xWindow, count, max_length) != OS.XmClipboardSuccess)
- DND.error(SWT.ERROR_UNSPECIFIED);
- String[] types = new String[count[0]];
- for (int i = 0; i < count[0]; i++) {
- byte[] buffer = new byte[max_length[0]];
- int[] copied_length = new int[1];
- int rc = OS.XmClipboardInquireFormat(xDisplay, xWindow, i + 1, buffer, buffer.length, copied_length);
- if (rc == OS.XmClipboardNoData){
- types[i] = "";
- continue;
- }
- if (rc != OS.XmClipboardSuccess)
- DND.error(SWT.ERROR_UNSPECIFIED);
- byte[] buffer2 = new byte[copied_length[0]];
- System.arraycopy(buffer, 0, buffer2, 0, copied_length[0]);
- types[i] = new String(buffer2);
- }
- return types;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 38b3e08568..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,482 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public class DragSource extends Widget {
-
- private Callback convertProc;
- private Callback dragDropFinish;
- private Callback dropFinish;
-
- // info for registering as a drag source
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- private boolean moveRequested;
-
- int dragContext;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose) {
- if (!DragSource.this.isDisposed()){
- DragSource.this.dispose();
- }
- }
- if (event.type == SWT.DragDetect){
- DragSource.this.drag();
- }
-
- }
- };
- this.control.addListener (SWT.Dispose, controlListener);
- this.control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragSetData, typedListener);
- addListener (DND.DragEnd, typedListener);
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private int convertProcCallback(int widget, int pSelection, int pTarget, int pType_return, int ppValue_return, int pLength_return, int pFormat_return, int max_length, int client_data, int request_id) {
- /*
- pSelection - atom specifying which property is being used to transfer the selection (only support _MOTIF_DROP)
- pTarget - atom specifying the type in which the requestor wants the information
- pType_return - [out] type atom that data has been converted to (usually the same as pTarget)
- ppValue_return - [out] set to a pointer to a block of memory
- pLength_return - [out] number of elements in the array
- pFormat_return - [out] size in bits of each element in the array
-
- */
-
- if (pSelection == 0 )
- return 0;
-
- // is this a drop?
- int[] selection = new int[1];
- OS.memmove(selection, pSelection, 4);
- int motifDropAtom = Transfer.registerType("_MOTIF_DROP\0");
- if (selection[0] != motifDropAtom) return 0;
-
- // get the target value from pTarget
- int[] target = new int[1];
- OS.memmove(target, pTarget, 4);
-
- // handle the "Move" case
- if (target[0] == Transfer.registerType("DELETE\0")) { // DELETE corresponds to a Move request
- moveRequested = true;
- OS.memmove(pType_return,new int[]{Transfer.registerType("NULL\0")}, 4);
- OS.memmove(ppValue_return, new int[]{0}, 4);
- OS.memmove(pLength_return, new int[]{0}, 4);
- OS.memmove(pFormat_return, new int[]{8}, 4);
- return 1;
- }
-
- // do we support the requested data type?
- boolean dataMatch = true;
- TransferData transferData = new TransferData();
- transferData.type = target[0];
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- dataMatch = true;
- break;
- }
- }
- if (!dataMatch) return 0;
-
- DNDEvent event = new DNDEvent();
- event.widget = control;
- //event.time = ??;
- event.dataType = transferData;
- try {
- notifyListeners(DND.DragSetData,event);
- } catch (Throwable err) {
- return 0;
- }
-
- if (event.data == null) return 0;
-
- Transfer transferAgent = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferAgent = transferAgents[i];
- break;
- }
- }
- if (transferAgent == null) return 0;
-
- transferAgent.javaToNative(event.data, transferData);
- if (transferData.result == 1){
- OS.memmove(ppValue_return, new int[]{transferData.pValue}, 4);
- OS.memmove(pType_return, new int[]{transferData.type}, 4);
- OS.memmove(pLength_return, new int[]{transferData.length}, 4);
- OS.memmove(pFormat_return, new int[]{transferData.format}, 4);
- return 1;
- } else {
- OS.memmove(ppValue_return, new int[]{0}, 4);
- OS.memmove(pLength_return, new int[]{0}, 4);
- OS.memmove(pFormat_return, new int[]{8}, 4);
- return 0;
- }
-}
-private void drag() {
- if (transferAgents == null)
- return;
-
- // Current event must be a Button Press event
- Display display = control.getDisplay ();
- if (display.xEvent.type != OS.ButtonPress) return;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = display.xEvent.pad2;
- event.doit = true;
-
- try {
- notifyListeners(DND.DragStart, event);
- } catch (Throwable e) {
- event.doit = false;
- }
-
- if (!event.doit) {
- int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
- int dc = OS.XmGetDragContext(control.handle, time);
- if (dc != 0){
- OS.XmDragCancel(dc);
- }
- return;
- }
-
- // set the protocol (optional)
- // not implemented
-
- // create pixmaps for icons (optional)
- // not implemented
-
- // Copy targets to global memory
- TransferData[] transferData = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] data = transferAgents[i].getSupportedTypes();
- TransferData[] newTransferData = new TransferData[transferData.length + data.length];
- System.arraycopy(transferData, 0, newTransferData, 0, transferData.length);
- System.arraycopy(data, 0, newTransferData, transferData.length, data.length);
- transferData = newTransferData;
- }
- int[] dataTypes = new int[transferData.length];
- for (int i = 0; i < transferData.length; i++){
- dataTypes[i] = transferData[i].type;
- }
- int pExportTargets = OS.XtMalloc(dataTypes.length * 4);
- OS.memmove(pExportTargets, dataTypes, dataTypes.length * 4);
-
- if (convertProc == null)
- convertProc = new Callback(this, "convertProcCallback", 10);
- if (convertProc == null) return;
-
- int[] args = new int[]{
- OS.XmNexportTargets, pExportTargets,
- OS.XmNnumExportTargets, dataTypes.length,
- OS.XmNdragOperations, opToOsOp(getStyle()),
- OS.XmNconvertProc, convertProc.getAddress(),
- OS.XmNoperationCursorIcon, 0,
- OS.XmNsourceCursorIcon, 0,
- OS.XmNstateCursorIcon, 0,
- OS.XmNclientData, 0,
- OS.XmNblendModel, OS.XmBLEND_ALL
- };
-
- // look for existing drag contexts
- int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
- dragContext = OS.XmGetDragContext(control.handle, time);
- if (dragContext != 0){
- OS.XtSetValues(dragContext, args, args.length /2);
- } else {
- dragContext = OS.XmDragStart(this.control.handle, display.xEvent, args, args.length / 2);
- }
- OS.XtFree(pExportTargets);
- if (dragContext == 0) return;
-
- // register a call back to clean up when drop is done (optional)
- if (dragDropFinish == null)
- dragDropFinish = new Callback(this, "dragDropFinishCallback", 3);
- OS.XtAddCallback(dragContext, OS.XmNdragDropFinishCallback, dragDropFinish.getAddress(), 0);
-
- // register a call back to tell user what happened (optional)
- if (dropFinish == null)
- dropFinish = new Callback(this, "dropFinishCallback", 3);
- OS.XtAddCallback(dragContext, OS.XmNdropFinishCallback, dropFinish.getAddress(), 0);
- return;
-}
-
-private int dragDropFinishCallback(int widget, int client_data, int call_data) {
-
- // uncomment the following code when we allow users to specify their own source icons
- // release the pre set source icon
- //int pSourceIcon = OS.XtMalloc(4);
- //int[] args = new int[]{OS.XmNsourceCursorIcon, pSourceIcon};
- //OS.XtGetValues(control.handle, args, args.length / 2);
- //int[] sourceIcon = new int[1];
- //OS.memmove(sourceIcon, pSourceIcon, 4);
- //if (sourceIcon[0] != 0)
- //OS.XtDestroyWidget(sourceIcon[0]);
- //OS.XtFree(pSourceIcon);
-
- dragContext = 0;
-
- if (convertProc != null)
- convertProc.dispose();
- convertProc = null;
-
- if (dragDropFinish != null)
- dragDropFinish.dispose();
- dragDropFinish = null;
-
- if (dropFinish != null)
- dropFinish.dispose();
- dropFinish = null;
-
- return 0;
-}
-private int dropFinishCallback(int widget, int client_data, int call_data) {
-
- XmDropFinishCallback data = new XmDropFinishCallback();
- OS.memmove(data, call_data, XmDropFinishCallback.sizeof);
-
- if (data.dropAction != OS.XmDROP || data.dropSiteStatus != OS.XmDROP_SITE_VALID) return 0;
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = data.timeStamp;
- if (moveRequested) {
- event.detail = DND.DROP_MOVE;
- } else {
- if (data.operation == OS.XmDROP_MOVE) {
- event.detail = DND.DROP_NONE;
- } else {
- event.detail = osOpToOp(data.operation);
- }
-
- }
- event.doit = (data.completionStatus != 0);
-
- try {
- notifyListeners(DND.DragEnd,event);
- } catch (Throwable err) {
- }
-
- moveRequested = false;
-
- return 0;
-}
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-private void onDispose() {
- if (convertProc != null)
- convertProc.dispose();
- convertProc = null;
-
- if (dragDropFinish != null)
- dragDropFinish.dispose();
- dragDropFinish = null;
-
- if (dropFinish != null)
- dropFinish.dispose();
- dropFinish = null;
-
- if (control != null && controlListener != null) {
- control.removeListener(SWT.Dispose, controlListener);
- control.removeListener(SWT.DragDetect, controlListener);
- }
- control = null;
- controlListener = null;
- transferAgents = null;
-}
-private byte opToOsOp(int operation){
- byte osOperation = OS.XmDROP_NOOP;
-
- if ((operation & DND.DROP_COPY) == DND.DROP_COPY)
- osOperation |= OS.XmDROP_COPY;
- if ((operation & DND.DROP_MOVE) == DND.DROP_MOVE)
- osOperation |= OS.XmDROP_MOVE;
- if ((operation & DND.DROP_LINK) == DND.DROP_LINK)
- osOperation |= OS.XmDROP_LINK;
-
- return osOperation;
-}
-private int osOpToOp(byte osOperation){
- int operation = DND.DROP_NONE;
-
- if ((osOperation & OS.XmDROP_COPY) == OS.XmDROP_COPY)
- operation |= DND.DROP_COPY;
- if ((osOperation & OS.XmDROP_MOVE) == OS.XmDROP_MOVE)
- operation |= DND.DROP_MOVE;
- if ((osOperation & OS.XmDROP_LINK) == OS.XmDROP_LINK)
- operation |= DND.DROP_LINK;
-
- return operation;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragSetData, listener);
- removeListener (DND.DragEnd, listener);
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index 8f5421a2c9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,602 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public class DropTarget extends Widget {
-
- private Callback dropProc;
- private Callback transferProc;
- private Callback dragProc;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int dropTransferObject;
- private XmDropProcCallback droppedEventData;
-
- private DragUnderEffect effect;
-
- private static final int DRAGOVER_HYSTERESIS = 50;
- private long dragOverStart;
- private Runnable dragOverHeartbeat;
- private DNDEvent dragOverEvent;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- dropProc = new Callback(this, "dropProcCallback", 3);
- if (dropProc == null)
- DND.error(DND.ERROR_CANNOT_INIT_DROP);
-
- dragProc = new Callback(this, "dragProcCallback", 3);
- if (dragProc == null)
- DND.error(DND.ERROR_CANNOT_INIT_DROP);
-
- int[] args = new int[]{
- OS.XmNdropSiteOperations, opToOsOp(style),
- OS.XmNdropSiteActivity, OS.XmDROP_SITE_ACTIVE,
- OS.XmNdropProc, dropProc.getAddress(),
- OS.XmNdragProc, dragProc.getAddress(),
- OS.XmNanimationStyle, OS.XmDRAG_UNDER_NONE,
- OS.XmNdropSiteType, OS.XmDROP_SITE_COMPOSITE,
- };
-
- // the OS may have registered this widget as a drop site on creation.
- // Remove the registered drop site because it has preconfigured values which we do not want.
- //OS.XmDropSiteUnregister(control.handle);
- // Register drop site with our own values
- OS.XmDropSiteRegister(control.handle, args, args.length / 2);
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (!DropTarget.this.isDisposed()){
- DropTarget.this.dispose();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void updateDragOverHover(long delay, DNDEvent event) {
- if (delay == 0) {
- dragOverStart = 0;
- dragOverEvent = null;
- dragOverHeartbeat = null;
- return;
- }
- dragOverStart = System.currentTimeMillis() + delay;
- if (dragOverEvent == null) dragOverEvent = new DNDEvent();
- dragOverEvent.x = event.x;
- dragOverEvent.y = event.y;
- dragOverEvent.dataTypes = event.dataTypes;
- dragOverEvent.operations = event.operations;
- dragOverEvent.dataType = event.dataType;
- dragOverEvent.detail = event.detail;
-}
-private int dragProcCallback(int widget, int client_data, int call_data) {
-
- XmDragProcCallback callbackData = new XmDragProcCallback();
- OS.memmove(callbackData, call_data, XmDragProcCallback.sizeof);
-
- if (callbackData.reason == OS.XmCR_DROP_SITE_ENTER_MESSAGE){
- releaseDropInfo();
-
- // get the export targets
- int ppExportTargets = OS.XtMalloc(4);
- int pNumExportTargets = OS.XtMalloc(4);
- int[] args = new int[]{
- OS.XmNexportTargets, ppExportTargets,
- OS.XmNnumExportTargets, pNumExportTargets
- };
-
- OS.XtGetValues(callbackData.dragContext, args, args.length / 2);
- int[] numExportTargets = new int[1];
- OS.memmove(numExportTargets, pNumExportTargets, 4);
- OS.XtFree(pNumExportTargets);
- int[] pExportTargets = new int[1];
- OS.memmove(pExportTargets, ppExportTargets, 4);
- OS.XtFree(ppExportTargets);
- int[] exportTargets = new int[numExportTargets[0]];
- OS.memmove(exportTargets, pExportTargets[0], 4*numExportTargets[0]);
- //?OS.XtFree(pExportTargets[0]);
-
- for (int i = 0, length = exportTargets.length; i < length; i++){
- for (int j = 0, length2 = transferAgents.length; j < length2; j++){
- TransferData transferData = new TransferData();
- transferData.type = exportTargets[i];
- if (transferAgents[j].isSupportedType(transferData)) {
- TransferData[] newDataTypes = new TransferData[dataTypes.length + 1];
- System.arraycopy(dataTypes, 0, newDataTypes, 0, dataTypes.length);
- newDataTypes[dataTypes.length] = transferData;
- dataTypes = newDataTypes;
- break;
- }
- }
- }
- }
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = callbackData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) callbackData.x, (short) callbackData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- event.operations = osOpToOp(callbackData.operations);
- event.dataType = selectedDataType;
- event.detail = osOpToOp(callbackData.operation);
-
- try {
- switch (callbackData.reason) {
- case OS.XmCR_DROP_SITE_ENTER_MESSAGE :
- if (dataTypes.length > 0) {
- event.dataType = dataTypes[0];
- }
- dragOverHeartbeat = new Runnable() {
- public void run() {
- if (control.isDisposed() || dragOverStart == 0) return;
- long time = System.currentTimeMillis();
- int delay = DRAGOVER_HYSTERESIS;
- if (time >= dragOverStart) {
- DNDEvent event = new DNDEvent();
- event.widget = control;
- event.time = (int)time;
- event.x = dragOverEvent.x;
- event.y = dragOverEvent.y;
- event.dataTypes = dragOverEvent.dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- event.operations = dragOverEvent.operations;
- event.dataType = dragOverEvent.dataType;
- event.detail = dragOverEvent.detail;
- notifyListeners(DND.DragOver, event);
- effect.show(event.feedback, event.x, event.y);
- } else {
- delay = (int)(dragOverStart - time);
- }
- control.getDisplay().timerExec(delay, dragOverHeartbeat);
- }
- };
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
-
- notifyListeners(DND.DragEnter, event);
- effect.show(event.feedback, event.x, event.y);
- dragOverHeartbeat.run();
- break;
-
- case OS.XmCR_DROP_SITE_MOTION_MESSAGE :
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
- notifyListeners(DND.DragOver, event);
- effect.show(event.feedback, event.x, event.y);
- break;
- case OS.XmCR_OPERATION_CHANGED :
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
- notifyListeners(DND.DragOperationChanged, event);
- effect.show(event.feedback, event.x, event.y);
- break;
- case OS.XmCR_DROP_SITE_LEAVE_MESSAGE :
- event.detail = DND.DROP_NONE;
- updateDragOverHover(0, null);
- notifyListeners(DND.DragLeave, event);
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- return 0;
- }
- } catch (Throwable err) {
- callbackData.dropSiteStatus = OS.XmDROP_SITE_INVALID;
- callbackData.operation = opToOsOp(DND.DROP_NONE);
- OS.memmove(call_data, callbackData, XmDragProcCallback.sizeof);
- return 0;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)) {
- selectedDataType = event.dataType;
- break;
- }
- }
- int lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((event.detail & osOpToOp(callbackData.operations)) == event.detail)) {
- lastOperation = event.detail;
- }
-
- callbackData.dropSiteStatus = OS.XmDROP_SITE_VALID;
- callbackData.operation = opToOsOp(lastOperation);
- OS.memmove(call_data, callbackData, XmDragProcCallback.sizeof);
-
- return 0;
-}
-private int dropProcCallback(int widget, int client_data, int call_data) {
- updateDragOverHover(0, null);
- effect.show(DND.FEEDBACK_NONE, 0, 0);
-
- droppedEventData = new XmDropProcCallback();
- OS.memmove(droppedEventData, call_data, XmDropProcCallback.sizeof);
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = droppedEventData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) droppedEventData.x, (short) droppedEventData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.operations = osOpToOp(droppedEventData.operations);
- event.dataType = selectedDataType;
- event.detail = osOpToOp(droppedEventData.operation);
-
- try {
- notifyListeners(DND.DropAccept,event);
- } catch (Throwable err) {
- event.detail = DND.DROP_NONE;
- event.dataType = null;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)) {
- selectedDataType = event.dataType;
- break;
- }
- }
- int lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((event.detail & osOpToOp(droppedEventData.operations)) == event.detail)) {
- lastOperation = event.detail;
- }
-
- if (lastOperation == DND.DROP_NONE) {
- // this was not a successful drop
- int[] args = new int[] {OS.XmNtransferStatus, OS.XmTRANSFER_FAILURE,
- OS.XmNnumDropTransfers, 0};
- dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);
- return 0;
- }
-
- // ask drag source for dropped data
- int[] transferEntries = new int[2];
- transferEntries[0] = 0;
- transferEntries[1] = selectedDataType.type;
-
- int pTransferEntries = OS.XtMalloc(transferEntries.length * 4);
- OS.memmove(pTransferEntries, transferEntries, transferEntries.length * 4);
- if (transferProc == null)
- transferProc = new Callback(this, "transferProcCallback", 7);
-
- if (transferProc != null){
- int[] args = new int[] {OS.XmNdropTransfers, pTransferEntries,
- OS.XmNnumDropTransfers, transferEntries.length / 2,
- OS.XmNtransferProc, transferProc.getAddress()};
-
- dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);
- OS.XtFree(pTransferEntries);
- }
-
- return 0;
-}
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-private void onDispose() {
-
- if (dropProc != null)
- dropProc.dispose();
- dropProc = null;
-
- if (transferProc != null)
- transferProc.dispose();
- transferProc = null;
-
- if (dragProc != null)
- dragProc.dispose();
- dragProc = null;
- //if (control != null && !control.isDisposed()){
- // OS.XmDropSiteUnregister(control.handle);
- //}
- if (controlListener != null) {
- control.removeListener(SWT.Dispose, controlListener);
- }
- controlListener = null;
- control = null;
- transferAgents = null;
-}
-private byte opToOsOp(int operation){
- byte osOperation = OS.XmDROP_NOOP;
-
- if ((operation & DND.DROP_COPY) == DND.DROP_COPY)
- osOperation |= OS.XmDROP_COPY;
- if ((operation & DND.DROP_MOVE) == DND.DROP_MOVE)
- osOperation |= OS.XmDROP_MOVE;
- if ((operation & DND.DROP_LINK) == DND.DROP_LINK)
- osOperation |= OS.XmDROP_LINK;
-
- return osOperation;
-}
-private int osOpToOp(byte osOperation){
- int operation = DND.DROP_NONE;
-
- if ((osOperation & OS.XmDROP_COPY) == OS.XmDROP_COPY)
- operation |= DND.DROP_COPY;
- if ((osOperation & OS.XmDROP_MOVE) == OS.XmDROP_MOVE)
- operation |= DND.DROP_MOVE;
- if ((osOperation & OS.XmDROP_LINK) == OS.XmDROP_LINK)
- operation |= DND.DROP_LINK;
-
- return operation;
-}
-private void releaseDropInfo(){
- selectedDataType = null;
- dataTypes = new TransferData[0];
- droppedEventData = null;
- dropTransferObject = 0;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-
- // register data types
- TransferData[] transferData = new TransferData[0];
- for (int i = 0, length = transferAgents.length; i < length; i++){
- TransferData[] data = transferAgents[i].getSupportedTypes();
- TransferData[] newTransferData = new TransferData[transferData.length + data.length];
- System.arraycopy(transferData, 0, newTransferData, 0, transferData.length);
- System.arraycopy(data, 0, newTransferData, transferData.length, data.length);
- transferData = newTransferData;
- }
-
- int[] atoms = new int[transferData.length];
- for (int i = 0, length = transferData.length; i < length; i++){
- atoms[i] = transferData[i].type;
- }
-
- // Copy import targets to global memory
- int pImportTargets = OS.XtMalloc(atoms.length * 4);
- OS.memmove(pImportTargets, atoms, atoms.length * 4);
-
- int[] args = new int[]{
- OS.XmNimportTargets, pImportTargets,
- OS.XmNnumImportTargets, atoms.length
- };
-
- OS.XmDropSiteUpdate(control.handle, args, args.length / 2);
-
- OS.XtFree(pImportTargets);
-
-}
-private int transferProcCallback(int widget, int client_data, int pSelection, int pType, int pValue, int pLength, int pFormat) {
-
- int[] type = new int[1];
- OS.memmove(type, pType, 4);
-
- // get dropped data object
- Transfer transferAgent = null;
- TransferData transferData = new TransferData();
- transferData.type = type[0];
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferAgent = transferAgents[i];
- break;
- }
- }
- if (transferAgent != null) {
- transferData.pValue = pValue;
- int[] length = new int[1];
- OS.memmove(length, pLength, 4);
- transferData.length = length[0];
- int[] format = new int[1];
- OS.memmove(format, pFormat, 4);
- transferData.format = format[0];
- Object data = transferAgent.nativeToJava(transferData);
-
- OS.XtFree(transferData.pValue); //?? Should we be freeing this, and what about the other memory?
-
- // notify listeners of drop
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = droppedEventData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) droppedEventData.x, (short) droppedEventData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.operations = osOpToOp(droppedEventData.operations);
- event.dataType = transferData;
- event.detail = osOpToOp(droppedEventData.operation);
- event.data = data;
-
- try {
- notifyListeners(DND.Drop,event);
- } catch (Throwable err) {
- event.detail = DND.DROP_NONE;
- }
-
- if ((event.detail & DND.DROP_MOVE) == DND.DROP_MOVE) {
- OS.XmDropTransferAdd(dropTransferObject, new int[]{0, Transfer.registerType("DELETE\0")}, 1);
- }
- }
-
- return 0;
-}
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index 0bda4b53f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
- private static final String TYPENAME = "text/uri-list\0";
- private static final int TYPEID = registerType(TYPENAME);
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-
- if (object == null || !(object instanceof String[])) return;
-
- // build a byte array from data
- String[] files = (String[])object;
-
- // create a string separated by "new lines" to represent list of files
- String nativeFormat = "file:";
- for (int i = 0, length = files.length; i < length; i++){
- nativeFormat += files[i]+"\r";
- }
- nativeFormat += "\0";
- // pass byte array on to super to convert to native
- super.javaToNative(nativeFormat.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
-
- byte[] data = (byte[])super.nativeToJava(transferData);
- if (data == null) return null;
- String string = new String(data);
- // parse data and convert string to array of files
- int start = string.indexOf("file:");
- if (start == -1) return null;
- start += 5;
- String[] fileNames = new String[0];
- while (start < string.length()) {
- int end = string.indexOf("\r", start);
- if (end == -1) end = string.length() - 1;
-
- String fileName = string.substring(start, end);
- String[] newFileNames = new String[fileNames.length + 1];
- System.arraycopy(fileNames, 0, newFileNames, 0, fileNames.length);
- newFileNames[fileNames.length] = fileName;
- fileNames = newFileNames;
-
- start = string.indexOf("file:", end);
- if (start == -1) break;
- start += 5;
- }
- return fileNames;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index f2b015d4b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- String text = (String)object;
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- return new String(buffer);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index 7b9e962ca3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
- private TableItem dropSelection;
- private TableItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.deselectAll();
- }
- scrollHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
- currentEffect = effect;
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(item);
- return;
- }
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) setDropSelection(null);
-}
-private void setDropSelection (TableItem item) {
- if (item == dropSelection) return;
- if (dropSelection != null) table.deselectAll();
- dropSelection = item;
- if (dropSelection != null) table.setSelection(new TableItem[]{dropSelection});
-}
-private void scrollHover (int effect, TableItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TableItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- Rectangle area = table.getClientArea();
- TableItem showItem = null;
- int itemIndex = table.indexOf(item);
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = table.getItem(Math.max(0, itemIndex - 1));
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = table.getItem(Math.min(table.getItemCount() - 1, itemIndex + 1));
- }
- if (showItem != null) {
- table.showItem(showItem);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index 93fb0cf71e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- String text = (String)object;
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- return new String(buffer);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index adfd307815..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.motif.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
-
- int xDisplay = Display.getDefault().xDisplay; // using default because we don't have a particular widget
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, formatName, false);
- int atom = OS.XmInternAtom (xDisplay, bName, false);
- return atom;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index 19562957a4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- /* attributes specific to set/get */
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index 4dc65a9ae6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.SWT;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
- private TreeItem dropSelection = null;
- private TreeItem insertMark = null;
- private boolean insertBefore = false;
-
- private TreeItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
- private TreeItem expandItem;
- private long expandBeginTime;
- private static final int EXPAND_HYSTERESIS = 1000; // milli seconds
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- effect = checkEffect(effect);
- TreeItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.deselectAll();
- }
- scrollHover(effect, item, x, y);
- expandHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
- currentEffect = effect;
-}
-private int checkEffect(int effect) {
- // Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
- int mask = DND.FEEDBACK_INSERT_AFTER | DND.FEEDBACK_INSERT_BEFORE | DND.FEEDBACK_SELECT;
- int bits = effect & mask;
- if (bits == DND.FEEDBACK_INSERT_AFTER || bits == DND.FEEDBACK_INSERT_BEFORE || bits == DND.FEEDBACK_SELECT) return effect;
- return (effect & ~mask);
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- if (!area.contains(coordinates)) return null;
-
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree.
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, coordinates.y);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- // Check if we are just below the last item of the tree
- coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- if (coordinates.y > area.y + area.height - tree.getItemHeight()) {;
- int y1 = area.y + area.height - tree.getItemHeight();
- coordinates = new Point(coordinates.x, y1);
-
- item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree just above the bottom..
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y1);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- setDropSelection(item);
- return;
- }
- if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (effect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- setInsertMark(item, (effect & DND.FEEDBACK_INSERT_BEFORE) != 0);
- return;
- }
-
- setInsertMark(null, false);
- setDropSelection(null);
-}
-private void setDropSelection (TreeItem item) {
- if (item == dropSelection) return;
- if (dropSelection != null) tree.deselectAll();
- dropSelection = item;
- if (dropSelection != null) tree.setSelection(new TreeItem[]{dropSelection});
-}
-private void setInsertMark(TreeItem item, boolean before) {
- if (item == insertMark && before == insertBefore) return;
- insertMark = item;
- insertBefore = before;
- tree.setInsertMark(item, before);
-}
-private void scrollHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TreeItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- TreeItem showItem = null;
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = getPreviousVisibleItem(item);
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = getNextVisibleItem(item, true);
- }
- if (showItem != null) {
- tree.showItem(showItem);
- }
-}
-private void expandHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_EXPAND) == 0) {
- expandBeginTime = 0;
- expandItem = null;
- return;
- }
- if (expandItem == item && expandBeginTime != 0) {
- if (System.currentTimeMillis() >= expandBeginTime) {
- expand(item, x, y);
- expandBeginTime = 0;
- expandItem = null;
- }
- return;
- }
- expandBeginTime = System.currentTimeMillis() + EXPAND_HYSTERESIS;
- expandItem = item;
-}
-private void expand(TreeItem item, int x, int y) {
- if (item == null || item.getExpanded()) return;
- Event event = new Event();
- event.x = x;
- event.y = y;
- event.item = item;
- event.time = (int) System.currentTimeMillis();
- tree.notifyListeners(SWT.Expand, event);
- if (item.isDisposed()) return;
- item.setExpanded(true);
-}
-private TreeItem getNextVisibleItem(TreeItem item, boolean includeChildren) {
- // look down
- // neccesary on the first pass only
- if (includeChildren && item.getItemCount() > 0 && item.getExpanded()) {
- return item.getItems()[0];
- }
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = 0; i < peers.length - 1; i++) {
- if (peers[i] == item) return peers[i + 1];
- }
- // look up
- if (parent != null) return getNextVisibleItem(parent, false);
- return null;
-}
-private TreeItem getPreviousVisibleItem(TreeItem item) {
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = peers.length - 1; i > 0; i--) {
- if (peers[i] == item) {
- TreeItem peer = peers[i-1];
- if (!peer.getExpanded() || peer.getItemCount() == 0) return peer;
- TreeItem[] peerItems = peer.getItems();
- return peerItems[peerItems.length - 1];
- }
- }
- // look up
- return parent;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index 3ab0c9971d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- }
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- if (transferData.type == types[i]) return true;
- }
- return false;
-}
-protected void javaToNative (Object object, TransferData transferData){
- if ((object == null) || !(object instanceof byte[]) || !(isSupportedType(transferData))) {
- transferData.result = 0;
- return;
- }
- byte[] buffer = (byte[])object;
- transferData.pData = OS.malloc(buffer.length);
- OS.memmove(transferData.pData, buffer, buffer.length);
- transferData.length = buffer.length;
- transferData.result = 1;
-}
-protected Object nativeToJava(TransferData transferData){
-
- if (transferData.pData == 0 || !(isSupportedType(transferData))) return null;
-
- int size = transferData.length;
- if (size == 0) return null;
- byte[] buffer = new byte[size];
- OS.memmove(buffer, transferData.pData, size);
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 266f5107ab..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
- private final int MAX_RETRIES = 10;
-
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() ) return null;
-
- Object result = null;
-
- int ig = OS.PhInputGroup(0);
- int cbdata = OS.PhClipboardPasteStart((short)ig);
- if (cbdata == 0) return result;
- try {
- String[] types = transfer.getTypeNames();
- int[] ids = transfer.getTypeIds();
- for (int i = 0; i < types.length; i++) {
- byte[] type = Converter.wcsToMbcs(null, types[i], true);
- int pClipHeader = OS.PhClipboardPasteType(cbdata, type);
- if (pClipHeader != 0) {
- PhClipHeader clipHeader = new PhClipHeader();
- OS.memmove(clipHeader, pClipHeader, PhClipHeader.sizeof);
- TransferData data = new TransferData();
- data.pData = clipHeader.data;
- data.length = clipHeader.length;
- data.type = ids[i];
- result = transfer.nativeToJava(data);
- break;
- }
- }
- } finally {
- OS.PhClipboardPasteFinish(cbdata);
- }
-
- return result;
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
- if (display.isDisposed() ) return;
-
- if (data == null) {
- int ig = OS.PhInputGroup(0);
- if (OS.PhClipboardCopy((short)ig, 0, null) != 0) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- }
- return;
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- byte[] clips = new byte[0];
- int count = 0;
- for (int i = 0; i < transferAgents.length; i++) {
- String[] names = transferAgents[i].getTypeNames();
- int[] ids = transferAgents[i].getTypeIds();
- for (int j = 0; j < names.length; j++) {
- TransferData transferData = new TransferData();
- transferData.type = ids[j];
- transferAgents[i].javaToNative(data[i], transferData);
- PhClipHeader clip = new PhClipHeader();
- clip.data = transferData.pData;
- clip.length = (short)transferData.length;
- byte[] temp = Converter.wcsToMbcs(null, names[j], false);
- byte[] type = new byte[8];
- System.arraycopy(temp, 0, type, 0, Math.min(type.length, temp.length));
- clip.type_0 = type[0];
- clip.type_1 = type[1];
- clip.type_2 = type[2];
- clip.type_3 = type[3];
- clip.type_4 = type[4];
- clip.type_5 = type[5];
- clip.type_6 = type[6];
- clip.type_7 = type[7];
- byte[] buffer = new byte[PhClipHeader.sizeof];
- OS.memmove(buffer, clip, PhClipHeader.sizeof);
- byte[] newClips = new byte[clips.length + buffer.length];
- System.arraycopy(clips, 0, newClips, 0, clips.length);
- System.arraycopy(buffer, 0, newClips, clips.length, buffer.length);
- clips = newClips;
- count++;
- }
- }
-
- if (count > 0){
- int ig = OS.PhInputGroup(0);
- if (OS.PhClipboardCopy((short)ig, count, clips) != 0) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- String[] types = new String[0];
- int ig = OS.PhInputGroup(0);
- int cbdata = OS.PhClipboardPasteStart((short)ig);
- if (cbdata == 0) return types;
- try {
- int pClipHeader = 0;
- int n = 0;
- while ((pClipHeader = OS.PhClipboardPasteTypeN(cbdata, n++)) != 0) {
- PhClipHeader clipHeader = new PhClipHeader();
- OS.memmove(clipHeader, pClipHeader, PhClipHeader.sizeof);
- byte[] buffer = new byte[8];
- buffer[0] = clipHeader.type_0;
- buffer[1] = clipHeader.type_1;
- buffer[2] = clipHeader.type_2;
- buffer[3] = clipHeader.type_3;
- buffer[4] = clipHeader.type_4;
- buffer[5] = clipHeader.type_5;
- buffer[6] = clipHeader.type_6;
- buffer[7] = clipHeader.type_7;
- char [] unicode = Converter.mbcsToWcs (null, buffer);
-
- String[] newTypes = new String[types.length + 1];
- System.arraycopy(types, 0, newTypes, 0, types.length);
- newTypes[types.length] = new String (unicode).trim();
- types = newTypes;
- }
- } finally {
- OS.PhClipboardPasteFinish(cbdata);
- }
- return types;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 9c3fedd6a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public class DragSource extends Widget {
-
- private Callback convertProc;
- private Callback dragDropFinish;
- private Callback dropFinish;
-
- // info for registering as a drag source
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- private boolean myDrag;
-
- int dragContext;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose) {
- if (!DragSource.this.isDisposed()){
- DragSource.this.dispose();
- }
- }
- if (event.type == SWT.DragDetect){
-// DragSource.this.drag();
- }
-
- }
- };
- this.control.addListener (SWT.Dispose, controlListener);
- this.control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
-// onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragSetData, typedListener);
- addListener (DND.DragEnd, typedListener);
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-
-
-
-
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-
-
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragSetData, listener);
- removeListener (DND.DragEnd, listener);
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index 1abeb8104d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public class DropTarget extends Widget {
-
- private Callback dropProc;
- private Callback transferProc;
- private Callback dragProc;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int dropTransferObject;
-
- private DragUnderEffect effect;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (!DropTarget.this.isDisposed()){
- DropTarget.this.dispose();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- //onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-
-
-
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index 9ba4ffe40b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
- private static final String TYPENAME = "files";
- private static final int TYPEID = registerType(TYPENAME);
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
- DND.error(org.eclipse.swt.SWT.ERROR_NOT_IMPLEMENTED);
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- DND.error(org.eclipse.swt.SWT.ERROR_NOT_IMPLEMENTED);
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index 0a7123f4a5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME = "RTF";
- private static final int TYPEID = registerType(TYPENAME);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
- byte [] buffer = Converter.wcsToMbcs (null, (String)object, false);
- super.javaToNative(buffer, transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- /// get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index d9e566bb5d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index c6e037cf14..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.photon.OS;
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME = "TEXT";
- private static final int TYPEID = registerType(TYPENAME);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
- byte [] buffer = Converter.wcsToMbcs (null, (String)object, false);
- super.javaToNative(buffer, transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index 7984436caf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- if (formatName == "TEXT") return 10;
- if (formatName == "files") return 11;
- if (formatName == "RTF") return 12;
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index b287069a6f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int pData;
- int length;
- int result;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index d37961bda1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = tree.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = tree.toControl(coordinates);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index 86e486532d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
-
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- data[i].formatetc = new FORMATETC();
- data[i].formatetc.cfFormat = types[i];
- data[i].formatetc.dwAspect = COM.DVASPECT_CONTENT;
- data[i].formatetc.lindex = -1;
- data[i].formatetc.tymed = COM.TYMED_HGLOBAL;
- }
-
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
-
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- FORMATETC format = transferData.formatetc;
- if (format.cfFormat == types[i] &&
- (format.dwAspect & COM.DVASPECT_CONTENT) == COM.DVASPECT_CONTENT &&
- (format.tymed & COM.TYMED_HGLOBAL) == COM.TYMED_HGLOBAL )
- return true;
- }
- return false;
-}
-/**
- * Converts a Java byte array to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java byte array containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-protected void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof byte[])) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- byte[] data = (byte[])object;
-
- if (isSupportedType(transferData)) {
- // Allocate the memory because the caller (DropTarget) has not handed it in
- // The caller of this method must release the data when it is done with it.
- int size = data.length;
- int newPtr = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, size);
- OS.MoveMemory(newPtr, data, size);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-}
-/**
- * Converts a platform specific representation of a byte array to a Java byte array.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java byte array containing the transferred data if the conversion was successful;
- * otherwise null
- */
-protected Object nativeToJava(TransferData transferData){
-
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- IDataObject data = new IDataObject(transferData.pIDataObject);
- data.AddRef();
-
- FORMATETC formatetc = transferData.formatetc;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.result = data.GetData(formatetc, stgmedium);
- data.Release();
-
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- int size = OS.GlobalSize(stgmedium.unionField);
- byte[] buffer = new byte[size];
- int ptr = OS.GlobalLock(stgmedium.unionField);
- OS.MoveMemory(buffer, ptr, size);
- OS.GlobalUnlock(ptr);
- OS.GlobalFree(stgmedium.unionField);
-
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 2eb5d8296b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- // ole interfaces
- private COMObject iUnknown;
- private COMObject iDataObject;
- private int refCount;
-
- private final int MAX_RETRIES = 10;
- private Transfer[] transferAgents = new Transfer[0];
- private Object[] data = new Object[0];
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
-
- createCOMInterfaces();
- this.AddRef();
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- this.Release();
-}
-public Object getContents(Transfer transfer) {
- int[] ppv = new int[1];
- int retrys = 0;
- while ((COM.OleGetClipboard(ppv) != COM.S_OK) && retrys < MAX_RETRIES) {
- retrys++;
- }
- if (retrys == MAX_RETRIES) return null;
-
- IDataObject dataObject = new IDataObject(ppv[0]);
-
- TransferData[] allowed = transfer.getSupportedTypes();
- TransferData match = null;
- for (int i = 0; i < allowed.length; i++) {
- if (dataObject.QueryGetData(allowed[i].formatetc) == COM.S_OK) {
- match = allowed[i];
- break;
- }
- }
- if (match == null) return null;
-
- match.pIDataObject = ppv[0];
- return transfer.nativeToJava(match);
-}
-public void setContents(Object[] data, Transfer[] dataTypes){
-
- boolean current = (COM.OleIsCurrentClipboard(this.iDataObject.getAddress()) == COM.S_OK);
-
- if (data == null || dataTypes == null || data.length != dataTypes.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- this.data = data;
- this.transferAgents = dataTypes;
-
- int retries = 0;
- int result = 0;
- while ((result = COM.OleSetClipboard(this.iDataObject.getAddress())) != COM.S_OK && retries < MAX_RETRIES){
- retries++;
- }
- if (retries == MAX_RETRIES) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD, result);
- }
-
- if (COM.OleIsCurrentClipboard(this.iDataObject.getAddress()) != COM.S_OK) return;
-
- retries = 0;
- while ((COM.OleFlushClipboard() != COM.S_OK) && (retries < MAX_RETRIES)) {
- retries++;
- }
-
- this.data = new Object[0];
- this.transferAgents = new Transfer[0];
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
- iDataObject = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 2, 3, 2, 4, 1, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetData(args[0], args[1]);}
- // method4 GetDataHere - not implemented
- public int method5(int[] args) {return QueryGetData(args[0]);}
- // method6 GetCanonicalFormatEtc - not implemented
- // method7 SetData - not implemented
- public int method8(int[] args) {return EnumFormatEtc(args[0], args[1]);}
- // method9 DAdvise - not implemented
- // method10 DUnadvise - not implemented
- // method11 EnumDAdvise - not implemented
- };
-}
-private void disposeCOMInterfaces() {
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDataObject != null)
- iDataObject.dispose();
- iDataObject = null;
-}
-private int EnumFormatEtc(int dwDirection, int ppenumFormatetc) {
- // only allow getting of data - SetData is not currently supported
- if (dwDirection == COM.DATADIR_SET) return COM.E_NOTIMPL;
-
- // what types have been registered?
- TransferData[] allowedDataTypes = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] formats = transferAgents[i].getSupportedTypes();
- TransferData[] newAllowedDataTypes = new TransferData[allowedDataTypes.length + formats.length];
- System.arraycopy(allowedDataTypes, 0, newAllowedDataTypes, 0, allowedDataTypes.length);
- System.arraycopy(formats, 0, newAllowedDataTypes, allowedDataTypes.length, formats.length);
- allowedDataTypes = newAllowedDataTypes;
- }
-
- OleEnumFORMATETC enumFORMATETC = new OleEnumFORMATETC();
- enumFORMATETC.AddRef();
-
- FORMATETC[] formats = new FORMATETC[allowedDataTypes.length];
- for (int i = 0; i < formats.length; i++){
- formats[i] = allowedDataTypes[i].formatetc;
- }
- enumFORMATETC.setFormats(formats);
-
- COM.MoveMemory(ppenumFormatetc, new int[] {enumFORMATETC.getAddress()}, 4);
- return COM.S_OK;
-}
-private int GetData(int pFormatetc, int pmedium) {
- /* Called by a data consumer to obtain data from a source data object.
- The GetData method renders the data described in the specified FORMATETC
- structure and transfers it through the specified STGMEDIUM structure.
- The caller then assumes responsibility for releasing the STGMEDIUM structure.
- */
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- if (QueryGetData(pFormatetc) != COM.S_OK) return COM.DV_E_FORMATETC;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.E_FAIL;
-
- // get matching transfer agent to perform conversion
- int transferIndex = -1;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferIndex = i;
- break;
- }
- }
- if (transferIndex == -1) return COM.DV_E_FORMATETC;
-
- transferAgents[transferIndex].javaToNative(data[transferIndex], transferData);
- COM.MoveMemory(pmedium, transferData.stgmedium, STGMEDIUM.sizeof);
- return transferData.result;
-}
-private int QueryGetData(int pFormatetc) {
-
- if (transferAgents == null) return COM.E_FAIL;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- // is this type supported by the transfer agent?
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData))
- return COM.S_OK;
- }
-
- return COM.DV_E_FORMATETC;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDataObject) ) {
- COM.MoveMemory(ppvObject, new int[] {iDataObject.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- int[] ppv = new int[1];
- int retrys = 0;
- while ((COM.OleGetClipboard(ppv) != COM.S_OK) && retrys < MAX_RETRIES) {
- retrys++;
- }
- if (retrys == MAX_RETRIES) return null;
-
- IDataObject dataObject = new IDataObject(ppv[0]);
-
- int[] ppFormatetc = new int[1];
- int rc = dataObject.EnumFormatEtc(COM.DATADIR_GET, ppFormatetc);
- dataObject.Release();
- if (rc != COM.S_OK)
- DND.error(SWT.ERROR_UNSPECIFIED);
-
- IEnumFORMATETC enum = new IEnumFORMATETC(ppFormatetc[0]);
-
- // Loop over enumerator and save any types that match what we are looking for
- int rgelt = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, FORMATETC.sizeof);
- int[] pceltFetched = new int[1];
- enum.Reset();
- String[] types = new String[0];
- while (enum.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {
- FORMATETC formatetc = new FORMATETC();
- COM.MoveMemory(formatetc, rgelt, FORMATETC.sizeof);
- int maxSize = 128;
- TCHAR buffer = new TCHAR(0, maxSize);
- int size = COM.GetClipboardFormatName(formatetc.cfFormat, buffer, maxSize);
- String type = null;
- if (size != 0) {
- type = buffer.toString(0, size);
- } else {
- switch (formatetc.cfFormat) {
- case COM.CF_HDROP:
- type = "CF_HDROP";
- break;
- case COM.CF_TEXT:
- type = "CF_TEXT";
- break;
- case COM.CF_BITMAP:
- type = "CF_BITMAP";
- break;
- case COM.CF_METAFILEPICT:
- type = "CF_METAFILEPICT";
- break;
- case COM.CF_SYLK:
- type = "CF_SYLK";
- break;
- case COM.CF_DIF:
- type = "CF_DIF";
- break;
- case COM.CF_TIFF:
- type = "CF_TIFF";
- break;
- case COM.CF_OEMTEXT:
- type = "CF_OEMTEXT";
- break;
- case COM.CF_DIB:
- type = "CF_DIB";
- break;
- case COM.CF_PALETTE:
- type = "CF_PALETTE";
- break;
- case COM.CF_PENDATA:
- type = "CF_PENDATA";
- break;
- case COM.CF_RIFF:
- type = "CF_RIFF";
- break;
- case COM.CF_WAVE:
- type = "CF_WAVE";
- break;
- case COM.CF_UNICODETEXT:
- type = "CF_UNICODETEXT";
- break;
- case COM.CF_ENHMETAFILE:
- type = "CF_ENHMETAFILE";
- break;
- case COM.CF_LOCALE:
- type = "CF_LOCALE";
- break;
- case COM.CF_MAX:
- type = "CF_MAX";
- break;
- default:
- continue;
- }
- }
-
- String[] newTypes = new String[types.length + 1];
- System.arraycopy(types, 0, newTypes, 0, types.length);
- newTypes[types.length] = type;
- types = newTypes;
- }
- OS.GlobalFree(rgelt);
- enum.Release();
-
- return types;
-
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 65c21271bd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,482 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-
-public class DragSource extends Widget {
-
- // ole interfaces
- private COMObject iUnknown;
- private COMObject iDropSource;
- private COMObject iDataObject;
- private int refCount;
-
- // info for registering as a drag source
- private Control control;
- private Transfer[] transferAgents = new Transfer[0];
-
- private Listener controlListener;
-
- private int dataEffect;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
-
- super (control, checkStyle (style));
-
- this.control = control;
-
- createCOMInterfaces();
-
- this.AddRef();
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose){
- DragSource.this.dispose();
- }
- if (event.type == SWT.DragDetect) {
- DragSource.this.drag();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
- control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event e) {
- onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragEnd, typedListener);
- addListener (DND.DragSetData, typedListener);
-
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iDropSource = new COMObject(new int[]{2, 0, 0, 2, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return QueryContinueDrag(args[0], args[1]);}
- public int method4(int[] args) {return GiveFeedback(args[0]);}
- };
-
- iDataObject = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 2, 3, 2, 4, 1, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetData(args[0], args[1]);}
- // method4 GetDataHere - not implemented
- public int method5(int[] args) {return QueryGetData(args[0]);}
- // method6 GetCanonicalFormatEtc - not implemented
- public int method7(int[] args) {return SetData(args[0], args[1], args[2]);}
- public int method8(int[] args) {return EnumFormatEtc(args[0], args[1]);}
- // method9 DAdvise - not implemented
- // method10 DUnadvise - not implemented
- // method11 EnumDAdvise - not implemented
- };
-}
-private void onDispose () {
- this.Release();
-
- if (control != null && controlListener != null){
- control.removeListener(SWT.Dispose, controlListener);
- control.removeListener(SWT.DragDetect, controlListener);
- }
- controlListener = null;
- control = null;
-
- transferAgents = null;
-}
-private int osToOp(int osOperation){
- int operation = 0;
- if ((osOperation & COM.DROPEFFECT_COPY) != 0){
- operation |= DND.DROP_COPY;
- }
- if ((osOperation & COM.DROPEFFECT_LINK) != 0) {
- operation |= DND.DROP_LINK;
- }
- if ((osOperation & COM.DROPEFFECT_MOVE) != 0) {
- operation |= DND.DROP_MOVE;
- }
- return operation;
-
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDropSource != null)
- iDropSource.dispose();
- iDropSource = null;
-
- if (iDataObject != null)
- iDataObject.dispose();
- iDataObject = null;
-}
-private void drag() {
-
- if (transferAgents == null || getStyle() == 0) return;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.doit = true;
-
- try {
- notifyListeners(DND.DragStart,event);
- } catch (Throwable e) {
- return;
- }
-
- if (!event.doit) return;
-
- dataEffect = DND.DROP_NONE;
- int[] pdwEffect = new int[1];
- int result = COM.DoDragDrop(iDataObject.getAddress(), iDropSource.getAddress(), getStyle(), pdwEffect);
- int operation = osToOp(pdwEffect[0]);
- event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- if (dataEffect == DND.DROP_MOVE && (operation == DND.DROP_NONE || operation == DND.DROP_COPY)) {
- dataEffect = DND.DROP_TARGET_MOVE;
- }
- if (dataEffect == DND.DROP_NONE) {
- dataEffect = operation;
- }
- event.detail = dataEffect;
- event.doit = (result == COM.DRAGDROP_S_DROP);
-
- try {
- notifyListeners(DND.DragEnd,event);
- } catch (Throwable e) {
- }
-}
-
-private int EnumFormatEtc(int dwDirection, int ppenumFormatetc) {
- // only allow getting of data - SetData is not currently supported
- if (dwDirection == COM.DATADIR_SET) return COM.E_NOTIMPL;
-
- // what types have been registered?
- TransferData[] allowedDataTypes = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] formats = transferAgents[i].getSupportedTypes();
- TransferData[] newAllowedDataTypes = new TransferData[allowedDataTypes.length + formats.length];
- System.arraycopy(allowedDataTypes, 0, newAllowedDataTypes, 0, allowedDataTypes.length);
- System.arraycopy(formats, 0, newAllowedDataTypes, allowedDataTypes.length, formats.length);
- allowedDataTypes = newAllowedDataTypes;
- }
-
- OleEnumFORMATETC enumFORMATETC = new OleEnumFORMATETC();
- enumFORMATETC.AddRef();
-
- FORMATETC[] formats = new FORMATETC[allowedDataTypes.length];
- for (int i = 0; i < formats.length; i++){
- formats[i] = allowedDataTypes[i].formatetc;
- }
- enumFORMATETC.setFormats(formats);
-
- COM.MoveMemory(ppenumFormatetc, new int[] {enumFORMATETC.getAddress()}, 4);
- return COM.S_OK;
-}
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-private int GetData(int pFormatetc, int pmedium) {
- /* Called by a data consumer to obtain data from a source data object.
- The GetData method renders the data described in the specified FORMATETC
- structure and transfers it through the specified STGMEDIUM structure.
- The caller then assumes responsibility for releasing the STGMEDIUM structure.
- */
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- if (QueryGetData(pFormatetc) != COM.S_OK) return COM.DV_E_FORMATETC;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.E_FAIL;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.dataType = transferData;
- try {
- notifyListeners(DND.DragSetData,event);
- } catch (Throwable e) {
- return COM.E_FAIL;
- }
-
- if (event.data == null) return COM.DV_E_FORMATETC;
-
- // get matching transfer agent to perform conversion
- Transfer transfer = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(event.dataType )){
- transfer = transferAgents[i];
- break;
- }
- }
- if (transfer == null) return COM.DV_E_FORMATETC;
-
- transfer.javaToNative(event.data, transferData);
- COM.MoveMemory(pmedium, transferData.stgmedium, STGMEDIUM.sizeof);
- return transferData.result;
-}
-
-
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-private int GiveFeedback(int dwEffect) {
- return COM.DRAGDROP_S_USEDEFAULTCURSORS;
-}
-
-
-private int QueryContinueDrag(int fEscapePressed, int grfKeyState) {
- if (fEscapePressed != 0)
- return COM.DRAGDROP_S_CANCEL;
- if ((grfKeyState & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0)
- return COM.DRAGDROP_S_DROP;
-
- return COM.S_OK;
-}
-private int QueryGetData(int pFormatetc) {
-
- if (transferAgents == null) return COM.E_FAIL;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- // is this type supported by the transfer agent?
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData))
- return COM.S_OK;
- }
-
- return COM.DV_E_FORMATETC;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDropSource)) {
- COM.MoveMemory(ppvObject, new int[] {iDropSource.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDataObject) ) {
- COM.MoveMemory(ppvObject, new int[] {iDataObject.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragEnd, listener);
- removeListener (DND.DragSetData, listener);
-}
-private static int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect");
-private int SetData(int pFormatetc, int pmedium, int fRelease) {
-
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- FORMATETC formatetc = new FORMATETC();
- COM.MoveMemory(formatetc, pFormatetc, FORMATETC.sizeof);
- if (formatetc.cfFormat == CFSTR_PERFORMEDDROPEFFECT && formatetc.tymed == COM.TYMED_HGLOBAL) {
- STGMEDIUM stgmedium = new STGMEDIUM();
- COM.MoveMemory(stgmedium, pmedium,STGMEDIUM.sizeof);
- int[] ptrEffect = new int[1];
- OS.MoveMemory(ptrEffect, stgmedium.unionField,4);
- int[] effect = new int[1];
- OS.MoveMemory(effect, ptrEffect[0],4);
- dataEffect = osToOp(effect[0]);
- }
- if (fRelease == 1) {
- COM.ReleaseStgMedium(pmedium);
- }
- return COM.S_OK;
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index c12c26c2b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,609 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-
-public class DropTarget extends Widget {
-
-
- // interfaces
- private COMObject iUnknown;
- private COMObject iDropTarget;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
-
- private Transfer[] transferAgents = new Transfer[0];;
-
- private int refCount;
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int lastOperation;
- private int keyState;
-
- private DragUnderEffect effect;
-
- private int iDataObject;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- createCOMInterfaces();
-
- int result = 0;
- if ((result = COM.CoLockObjectExternal(iDropTarget.getAddress(), true, true)) != COM.S_OK)
- DND.error(DND.ERROR_CANNOT_INIT_DROP, result);
- if ((result = COM.RegisterDragDrop( control.handle, iDropTarget.getAddress() )) != COM.S_OK)
- DND.error(DND.ERROR_CANNOT_INIT_DROP, result);
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- DropTarget.this.dispose();
- }
- };
-
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iDropTarget = new COMObject(new int[]{2, 0, 0, 5, 4, 0, 5}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return DragEnter(args[0], args[1], args[2], args[3], args[4]);}
- public int method4(int[] args) {return DragOver(args[0], args[1], args[2], args[3]);}
- public int method5(int[] args) {return DragLeave();}
- public int method6(int[] args) {return Drop(args[0], args[1], args[2], args[3], args[4]);}
- };
-
-}
-private void onDispose () {
- if (control == null) return;
-
- COM.RevokeDragDrop(control.handle);
-
- if (controlListener != null)
- control.removeListener(SWT.Dispose, controlListener);
- controlListener = null;
- transferAgents = null;
- control = null;
-
- COM.CoLockObjectExternal(iDropTarget.getAddress(), false, true);
-
- this.Release();
-
- COM.CoFreeUnusedLibraries();
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDropTarget != null)
- iDropTarget.dispose();
- iDropTarget = null;
-}
-private int DragEnter(
- int pDataObject, //Pointer to the interface of the source data object
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y, //Current cursor coordinates
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
-
- selectedDataType = null;
- dataTypes = new TransferData[0];
- iDataObject = 0;
- lastOperation = DND.DROP_NONE;
-
- // Are any types being dragged for which we have a matching transfer object?
- // Get enumerator of dragged types
- IDataObject dataObject = new IDataObject(pDataObject);
- dataObject.AddRef();
- int[] address = new int[1];
- if (dataObject.EnumFormatEtc(COM.DATADIR_GET, address) != COM.S_OK){
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- dataObject.Release();
- return COM.S_OK;
- }
- IEnumFORMATETC enum = new IEnumFORMATETC(address[0]);
- dataObject.Release();
- iDataObject = pDataObject;
-
- // Loop over enumerator and save any types that match what we are looking for
- int rgelt = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, FORMATETC.sizeof);
- int[] pceltFetched = new int[1];
- enum.Reset();
- while (enum.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, rgelt, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- TransferData[] newDataTypes = new TransferData[dataTypes.length + 1];
- System.arraycopy(dataTypes, 0, newDataTypes, 0, dataTypes.length);
- newDataTypes[dataTypes.length] = transferData;
- dataTypes = newDataTypes;
- break;
- }
- }
- }
- OS.GlobalFree(rgelt);
- enum.Release();
-
- // give listeners a chance to have input
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- if (dataTypes.length > 0) {
- event.dataType = dataTypes[0];
- event.dataType.pIDataObject = pDataObject;
- }
- event.detail = DND.DROP_NONE;
- // assign operation if it is allowed
- keyState = osToOp(getOperationFromKeyState(grfKeyState));
- if ((keyState & getStyle()) == keyState){
- event.detail = keyState;
- }
-
- try {
- notifyListeners(DND.DragEnter,event);
- } catch (Throwable e) {
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- return COM.S_OK;
- }
-
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
- if (selectedDataType != null && ((allowedEffects[0] & event.detail) == event.detail)) {
- lastOperation = event.detail;
- }
-
- effect.show(event.feedback, event.x, event.y);
-
- OS.MoveMemory(pdwEffect, new int[] {opToOs(lastOperation)}, 4);
- return COM.S_OK;
-}
-private int DragLeave()
-{
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- keyState = DND.DROP_NONE;
-
- // give listeners a chance to react
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.detail = DND.DROP_NONE;
- try {
- notifyListeners(DND.DragLeave, event);
- } catch (Throwable e) {}
-
- return COM.S_OK;
-}
-private int DragOver(
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y,
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- event.dataType = selectedDataType;
- if (event.dataType != null) {
- event.dataType.pIDataObject = iDataObject;
- }
-
- try {
- int oldKeyState = keyState;
- keyState = osToOp(getOperationFromKeyState(grfKeyState));
- if (keyState == oldKeyState) {
- event.detail = lastOperation;
- // update with new drag over info
- notifyListeners(DND.DragOver,event);
- } else {
- event.detail = keyState;
- // operation has changed
- notifyListeners(DND.DragOperationChanged, event);
- }
- } catch (Throwable e) {
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- return COM.S_OK;
- }
-
- // update drop data and drag under effect based on response from event
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
-
- lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((allowedEffects[0] & event.detail) == event.detail)) {
- lastOperation = event.detail;
- }
-
- effect.show(event.feedback, event.x, event.y);
-
- OS.MoveMemory(pdwEffect, new int[] {opToOs(lastOperation)}, 4);
- return COM.S_OK;
-}
-private int Drop(
- int pDataObject, //Pointer to the interface for the source data
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y,
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
-
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- keyState = DND.DROP_NONE;
-
- // Send a DragLeave event to be consistant with Motif
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.detail = DND.DROP_NONE;
- try {
- notifyListeners(DND.DragLeave, event);
- } catch (Throwable e) {}
-
- // Send a DropAccept event to be consistant with Motif
- event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- event.dataType = selectedDataType;
- if (event.dataType != null) {
- event.dataType.pIDataObject = iDataObject;
- }
- event.detail = lastOperation;
-
- try {
- notifyListeners(DND.DropAccept,event);
- } catch (Throwable e) {
- event.dataType = null;
- event.detail = DND.DROP_NONE;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
- lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && (allowedEffects[0] & event.detail) == event.detail) {
- lastOperation = event.detail;
- }
-
- if (lastOperation != DND.DROP_NONE){
- // find the matching converter
- Transfer matchingTransfer = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(event.dataType)){
- matchingTransfer = transferAgents[i];
- break;
- }
- }
- if (matchingTransfer == null){
- lastOperation = DND.DROP_NONE;
- } else {
- event.dataType.pIDataObject = pDataObject;
- Object data = matchingTransfer.nativeToJava(event.dataType);
- event.data = data;
- try {
- notifyListeners(DND.Drop,event);
- lastOperation = DND.DROP_NONE;
- if ((allowedEffects[0] & event.detail) == event.detail) {
- lastOperation = event.detail;
- }
- } catch (Throwable e) {
- lastOperation = DND.DROP_NONE;
- }
-
- }
- }
-
- OS.MoveMemory(pdwEffect, new int[] {osToOp(lastOperation)}, 4);
- return COM.S_OK;
-}
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-private int getOperationFromKeyState(int grfKeyState) {
- boolean ctrl = (grfKeyState & OS.MK_CONTROL) != 0;
- boolean shift = (grfKeyState & OS.MK_SHIFT) != 0;
- if (ctrl && shift) {
- // CTRL + SHIFT == Link
- return COM.DROPEFFECT_LINK;
- }
- if (ctrl){
- //CTRL == COPY
- return COM.DROPEFFECT_COPY;
- }
-
- return COM.DROPEFFECT_MOVE; // default operation
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-private int opToOs(int operation) {
- int osOperation = 0;
- if ((operation & DND.DROP_COPY) != 0){
- osOperation |= COM.DROPEFFECT_COPY;
- }
- if ((operation & DND.DROP_LINK) != 0) {
- osOperation |= COM.DROPEFFECT_LINK;
- }
- if ((operation & DND.DROP_MOVE) != 0) {
- osOperation |= COM.DROPEFFECT_MOVE;
- }
- return osOperation;
-}
-private int osToOp(int osOperation){
- int operation = 0;
- if ((osOperation & COM.DROPEFFECT_COPY) != 0){
- operation |= DND.DROP_COPY;
- }
- if ((osOperation & COM.DROPEFFECT_LINK) != 0) {
- operation |= DND.DROP_LINK;
- }
- if ((osOperation & COM.DROPEFFECT_MOVE) != 0) {
- operation |= DND.DROP_MOVE;
- }
- return operation;
-
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIDropTarget)) {
- COM.MoveMemory(ppvObject, new int[] {iDropTarget.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
-
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index ec11a1df68..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.TCHAR;
-import org.eclipse.swt.internal.win32.DROPFILES;
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-
- if (object == null || !(object instanceof String[])) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- if (isSupportedType(transferData)) {
-
- String[] fileNames = (String[]) object;
- StringBuffer allFiles = new StringBuffer();
- for (int i = 0; i < fileNames.length; i++) {
- allFiles.append(fileNames[i]);
- allFiles.append('\0'); // each name is null terminated
- }
- TCHAR buffer = new TCHAR(0, allFiles.toString(), true); // there is an extra null terminator at the very end
-
- DROPFILES dropfiles = new DROPFILES();
- dropfiles.pFiles = DROPFILES.sizeof;
- dropfiles.pt_x = dropfiles.pt_y = 0;
- dropfiles.fNC = 0;
- dropfiles.fWide = COM.IsUnicode ? 1 : 0;
-
- // Allocate the memory because the caller (DropTarget) has not handed it in
- // The caller of this method must release the data when it is done with it.
- int byteCount = buffer.length() * TCHAR.sizeof;
- int newPtr = COM.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, DROPFILES.sizeof + byteCount);
- COM.MoveMemory(newPtr, dropfiles, DROPFILES.sizeof);
- COM.MoveMemory(newPtr + DROPFILES.sizeof, buffer, byteCount);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
-
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- // get file names from IDataObject
- IDataObject dataObject = new IDataObject(transferData.pIDataObject);
- dataObject.AddRef();
-
- FORMATETC formatetc = new FORMATETC();
- formatetc.cfFormat = COM.CF_HDROP;
- formatetc.ptd = 0;
- formatetc.dwAspect = COM.DVASPECT_CONTENT;
- formatetc.lindex = -1;
- formatetc.tymed = COM.TYMED_HGLOBAL;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
-
- transferData.result = dataObject.GetData(formatetc, stgmedium);
- dataObject.Release();
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- // How many files are there?
- int count = COM.DragQueryFile(stgmedium.unionField, 0xFFFFFFFF, null, 0);
- String[] fileNames = new String[count];
- for (int i = 0; i < count; i++){
- // How long is the name ?
- int size = COM.DragQueryFile(stgmedium.unionField, i, null, 0) + 1;
- TCHAR lpszFile = new TCHAR(0, size);
- // Get file name and append it to string
- COM.DragQueryFile(stgmedium.unionField, i, lpszFile, size);
- fileNames[i] = lpszFile.toString(0, lpszFile.strlen());
- }
- COM.DragFinish(stgmedium.unionField); // frees data associated with HDROP data
- return fileNames;
-}
-protected int[] getTypeIds(){
- return new int[] {COM.CF_HDROP};
-}
-protected String[] getTypeNames(){
- return new String[] {"CF_HDROP"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
deleted file mode 100755
index 80b8bc248b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-
-final class OleEnumFORMATETC {
-
- private COMObject iUnknown;
- private COMObject iEnumFORMATETC;
-
- private int refCount;
- private int index;
-
- private FORMATETC[] formats;
-
-OleEnumFORMATETC() {
-
- createCOMInterfaces();
-
-}
-int AddRef() {
- refCount++;
- return refCount;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[] {2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
- iEnumFORMATETC = new COMObject(new int[] {2, 0, 0, 3, 1, 0, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return Next(args[0], args[1], args[2]);}
- public int method4(int[] args) {return Skip(args[0]);}
- public int method5(int[] args) {return Reset();}
- // method6 Clone - not implemented
- };
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iEnumFORMATETC != null)
- iEnumFORMATETC.dispose();
- iEnumFORMATETC = null;
-}
-int getAddress() {
- return iEnumFORMATETC.getAddress();
-}
-private FORMATETC[] getNextItems(int numItems){
-
- if (formats == null || numItems < 1) return null;
-
- int endIndex = index + numItems - 1;
- if (endIndex > (formats.length - 1)) endIndex = formats.length - 1;
- if (index > endIndex) return null;
-
- FORMATETC[] items = new FORMATETC[endIndex - index + 1];
- for (int i = 0; i < items.length; i++){
- items[i] = formats[index];
- index++;
- }
-
- return items;
-}
-private int Next(int celt, int rgelt, int pceltFetched) {
- /* Retrieves the next celt items in the enumeration sequence.
- If there are fewer than the requested number of elements left in the sequence,
- it retrieves the remaining elements.
- The number of elements actually retrieved is returned through pceltFetched
- (unless the caller passed in NULL for that parameter).
- */
-
- if (rgelt == 0) return COM.E_INVALIDARG;
- if (pceltFetched == 0 && celt != 1) return COM.E_INVALIDARG;
-
- FORMATETC[] nextItems = getNextItems(celt);
- if (nextItems != null) {
- for (int i = 0; i < nextItems.length; i++) {
- COM.MoveMemory(rgelt + i*FORMATETC.sizeof, nextItems[i], FORMATETC.sizeof);
- }
-
- if (pceltFetched != 0)
- COM.MoveMemory(pceltFetched, new int[] {nextItems.length}, 4);
-
- if (nextItems.length == celt) return COM.S_OK;
-
- } else {
- if (pceltFetched != 0)
- COM.MoveMemory(pceltFetched, new int[] {0}, 4);
- COM.MoveMemory(rgelt, new FORMATETC(), FORMATETC.sizeof);
-
- }
- return COM.S_FALSE;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0) return COM.E_NOINTERFACE;
-
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIEnumFORMATETC)) {
- COM.MoveMemory(ppvObject, new int[] {iEnumFORMATETC.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-int Release() {
- refCount--;
-
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-private int Reset() {
- //Resets the enumeration sequence to the beginning.
- index = 0;
- return COM.S_OK;
-}
-void setFormats(FORMATETC[] newFormats) {
- formats = newFormats;
- index = 0;
-}
-private int Skip(int celt) {
- //Skips over the next specified number of elements in the enumeration sequence.
- if (celt < 1 ) return COM.E_INVALIDARG;
-
- index += celt;
- if (index > (formats.length - 1)){
- index = formats.length - 1;
- return COM.S_FALSE;
- }
- return COM.S_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index 3dba0b73db..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static final String CF_RTF_NAME = "Rich Text Format";
- private static final int CF_RTF = registerType(CF_RTF_NAME);
- private static RTFTransfer _instance = new RTFTransfer();
-
-private RTFTransfer() {}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- // CF_RTF is stored as a null terminated byte array
- // create a byte array from object
- String text = (String) object+'\0';
- // pass byte array on to super to convert to native
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- String string = new String(buffer);
- // remove null terminator
- int index = string.indexOf("\0");
- string = string.substring(0, index);
- return string;
-}
-protected int[] getTypeIds(){
- return new int[] {CF_RTF};
-}
-protected String[] getTypeNames(){
- return new String[] {"CF_RTF"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index 93cd62e919..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.LVITEM;
-import org.eclipse.swt.internal.win32.OS;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem[] selection = new TableItem[0];
- int currentEffect = DND.FEEDBACK_NONE;
-// private TableItem dropSelection
- private TableItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.deselectAll();
- }
- scrollHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
- currentEffect = effect;
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(item);
- } else {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- }
-}
-private void setDropSelection (TableItem item) {
-// if (item == dropSelection) return;
-// if (dropSelection != null) table.deselectAll();
-// dropSelection = item;
-// if (dropSelection != null) table.setSelection(new TableItem[]{dropSelection});
-
- LVITEM lvItem = new LVITEM ();
- lvItem.stateMask = OS.LVIS_DROPHILITED;
- // remove all drop highlighting
- OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, -1, lvItem);
- if (item != null) {
- lvItem.state = OS.LVIS_DROPHILITED;
- int index = table.indexOf(item);
- OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, index, lvItem);
- }
-}
-private void scrollHover (int effect, TableItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TableItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- Rectangle area = table.getClientArea();
- TableItem showItem = null;
- int itemIndex = table.indexOf(item);
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = table.getItem(Math.max(0, itemIndex - 1));
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = table.getItem(Math.min(table.getItemCount() - 1, itemIndex + 1));
- }
- if (showItem != null) {
- table.showItem(showItem);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index c13190749b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.COM;
-import org.eclipse.swt.internal.win32.TCHAR;
-import org.eclipse.swt.internal.ole.win32.STGMEDIUM;
-import org.eclipse.swt.internal.ole.win32.FORMATETC;
-import org.eclipse.swt.internal.ole.win32.IDataObject;
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
-private TextTransfer() {}
-
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- if (isSupportedType(transferData)) {
- TCHAR buffer = new TCHAR(0, (String)object, true);
- int byteCount = buffer.length() * TCHAR.sizeof;
- int newPtr = COM.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, byteCount);
- COM.MoveMemory(newPtr, buffer, byteCount);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- IDataObject data = new IDataObject(transferData.pIDataObject);
- data.AddRef();
-
- FORMATETC formatetc = transferData.formatetc;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.result = data.GetData(formatetc, stgmedium);
- data.Release();
-
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- int size = COM.GlobalSize(stgmedium.unionField);
- TCHAR buffer = new TCHAR(0, size / TCHAR.sizeof);
- int ptr = COM.GlobalLock(stgmedium.unionField);
- COM.MoveMemory(buffer, ptr, size);
- COM.GlobalUnlock(ptr);
- COM.GlobalFree(stgmedium.unionField);
- return buffer.toString(0, buffer.strlen());
-}
-protected int[] getTypeIds(){
- return new int[] {COM.IsUnicode ? COM.CF_UNICODETEXT : COM.CF_TEXT};
-}
-protected String[] getTypeNames(){
- return new String[] {COM.IsUnicode ? "CF_UNICODETEXT" : "CF_TEXT"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index ba9fc63d37..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.COM;
-import org.eclipse.swt.internal.win32.TCHAR;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-
-abstract protected int[] getTypeIds();
-abstract protected String[] getTypeNames();
-
-/**
- * Converts a Java Object to a platform specific representation of the data.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java Object containing the data to be transferred
- *
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific representation of the data
- */
- abstract protected void javaToNative (Object object, TransferData transferData);
-
-/**
- * Converts a platform specific representation of data to a Java Object.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- *
- * @return a Java Object containing the transferred data if the conversion was successful;
- * otherwise null
- */
- abstract protected Object nativeToJava(TransferData transferData);
-
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- // Look name up in the registry
- // If name is not in registry, add it and return assigned value.
- // If name already exists in registry, return its assigned value
- TCHAR chFormatName = new TCHAR(0, formatName, true);
- return COM.RegisterClipboardFormat(chFormatName);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index 434a1682c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- /* Not Javadoc
- * Data Type - a Windows format structure which describes additional aspects of the type
- * (Warning: This field is platform dependent)
- */
- public FORMATETC formatetc;
-
- /* Not Javadoc
- * Set Data - a data storage structure which you update to contain the data to be transferred in the
- * (Warning: This field is platform dependent)
- */
- public STGMEDIUM stgmedium;
-
- /* Not Javadoc
- * Set Data - the result of converting a Java object into an stgmedium value
- * (Warning: This field is platform dependent)
- */
- public int result = COM.E_FAIL;
-
- /* Not Javadoc
- * Get Data - the address of an IDataObject OLE Interface which contains the data that was transferred
- * (Warning: This field is platform dependent)
- */
- public int pIDataObject;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index 67337fb865..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.OS;
-import org.eclipse.swt.internal.win32.TVITEM;
-import org.eclipse.swt.SWT;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-// private TreeItem dropSelection = null;
- private TreeItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
- private TreeItem expandItem;
- private long expandBeginTime;
- private static final int EXPAND_HYSTERESIS = 1000; // milli seconds
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- effect = checkEffect(effect);
- TreeItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.deselectAll();
- }
- scrollHover(effect, item, x, y);
- expandHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
- currentEffect = effect;
-
-}
-private int checkEffect(int effect) {
- // Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
- int mask = DND.FEEDBACK_INSERT_AFTER | DND.FEEDBACK_INSERT_BEFORE | DND.FEEDBACK_SELECT;
- int bits = effect & mask;
- if (bits == DND.FEEDBACK_INSERT_AFTER || bits == DND.FEEDBACK_INSERT_BEFORE || bits == DND.FEEDBACK_SELECT) return effect;
- return (effect & ~mask);
-}
-private TreeItem findItem(int x, int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- if (!area.contains(coordinates)) return null;
-
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree.
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- Point pt = new Point(x1, coordinates.y);
- item = tree.getItem(pt);
- if (item != null) return item;
- }
- // Check if we are just below the last item of the tree
- if (coordinates.y > area.y + area.height - tree.getItemHeight()) {;
- int y1 = area.y + area.height - tree.getItemHeight();
- Point pt = new Point(coordinates.x, y1);
- item = tree.getItem(pt);
- if (item != null) return item;
-
- // Scan across the width of the tree just above the bottom..
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- pt = new Point(x1, y1);
- item = tree.getItem(pt);
- if (item != null) return item;
- }
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- setDropSelection(item);
- return;
- }
- if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (effect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- tree.setInsertMark(item, (effect & DND.FEEDBACK_INSERT_BEFORE) != 0);
- return;
- }
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
-}
-private void setDropSelection (TreeItem item) {
-// if (item == dropSelection) return;
-// if (dropSelection != null) tree.deselectAll();
-// dropSelection = item;
-// if (dropSelection != null) tree.setSelection(new TreeItem[]{dropSelection});
-
- int hNewItem = 0;
- if (item != null) hNewItem = item.handle;
- OS.SendMessage (tree.handle, OS.TVM_SELECTITEM, OS.TVIS_DROPHILITED, hNewItem);
-}
-private void scrollHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TreeItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- TreeItem showItem = null;
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = getPreviousVisibleItem(item);
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = getNextVisibleItem(item, true);
- }
- if (showItem != null) {
- tree.showItem(showItem);
- }
-}
-private void expandHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_EXPAND) == 0) {
- expandBeginTime = 0;
- expandItem = null;
- return;
- }
- if (expandItem == item && expandBeginTime != 0) {
- if (System.currentTimeMillis() >= expandBeginTime) {
- expand(item, x, y);
- expandBeginTime = 0;
- expandItem = null;
- }
- return;
- }
- expandBeginTime = System.currentTimeMillis() + EXPAND_HYSTERESIS;
- expandItem = item;
-}
-private void expand(TreeItem item, int x, int y) {
- if (item == null) return;
- if (item.getExpanded()) return;
- Event event = new Event();
- event.x = x;
- event.y = y;
- event.item = item;
- event.time = (int) System.currentTimeMillis();
- tree.notifyListeners(SWT.Expand, event);
- if (item.isDisposed()) return;
- item.setExpanded(true);
-}
-private TreeItem getNextVisibleItem(TreeItem item, boolean includeChildren) {
- // look down
- // neccesary on the first pass only
- if (includeChildren && item.getItemCount() > 0 && item.getExpanded()) {
- return item.getItems()[0];
- }
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = 0; i < peers.length - 1; i++) {
- if (peers[i] == item) return peers[i + 1];
- }
- // look up
- if (parent != null) return getNextVisibleItem(parent, false);
- return null;
-}
-private TreeItem getPreviousVisibleItem(TreeItem item) {
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = peers.length - 1; i > 0; i--) {
- if (peers[i] == item) {
- TreeItem peer = peers[i-1];
- if (!peer.getExpanded() || peer.getItemCount() == 0) return peer;
- TreeItem[] peerItems = peer.getItems();
- return peerItems[peerItems.length - 1];
- }
- }
- // look up
- return parent;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java
deleted file mode 100755
index 9b34c80fd5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java
+++ /dev/null
@@ -1,1024 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-import java.util.Hashtable;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class COMObject {
-
- private int ppVtable;
-
- static private final int MAX_ARG_COUNT = 12;
- static private final int MAX_VTABLE_LENGTH = 80;
- static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT];
- static private Hashtable ObjectMap = new Hashtable();
-
-public COMObject(int[] argCounts) {
- int[] callbackAddresses = new int[argCounts.length];
- for (int i = 0, length = argCounts.length; i < length; i++){
- if ((Callbacks[i][argCounts[i]]) == null) {
- Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true);
- }
- callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress();
- }
-
- int pVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * argCounts.length);
- COM.MoveMemory(pVtable, callbackAddresses, 4 * argCounts.length);
- ppVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4);
- COM.MoveMemory(ppVtable, new int[] {pVtable}, 4);
- ObjectMap.put(new Integer(ppVtable), this);
-}
-
-public static GUID IIDFromString(String lpsz) {
- // create a null terminated array of char
- char[] buffer = (lpsz +"\0").toCharArray();
-
- // invoke system method
- GUID lpiid = new GUID();
- if (COM.IIDFromString(buffer, lpiid) == COM.S_OK)
- return lpiid;
- return null;
-}
-
-static int callback0(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method0(args);
-}
-static int callback1(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method1(args);
-}
-static int callback2(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method2(args);
-}
-static int callback3(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method3(args);
-}
-static int callback4(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method4(args);
-}
-static int callback5(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method5(args);
-}
-static int callback6(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method6(args);
-}
-static int callback7(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method7(args);
-}
-static int callback8(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method8(args);
-}
-static int callback9(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method9(args);
-}
-static int callback10(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method10(args);
-}
-static int callback11(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method11(args);
-}
-static int callback12(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method12(args);
-}
-static int callback13(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method13(args);
-}
-static int callback14(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method14(args);
-}
-static int callback15(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method15(args);
-}
-static int callback16(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method16(args);
-}
-static int callback17(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method17(args);
-}
-static int callback18(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method18(args);
-}
-static int callback19(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method19(args);
-}
-static int callback20(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method20(args);
-}
-static int callback21(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method21(args);
-}
-static int callback22(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method22(args);
-}
-static int callback23(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method23(args);
-}
-static int callback24(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method24(args);
-}
-static int callback25(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method25(args);
-}
-static int callback26(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method26(args);
-}
-static int callback27(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method27(args);
-}
-static int callback28(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method28(args);
-}
-static int callback29(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method29(args);
-}
-static int callback30(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method30(args);
-}
-static int callback31(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method31(args);
-}
-static int callback32(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method32(args);
-}
-static int callback33(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method33(args);
-}
-static int callback34(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method34(args);
-}
-static int callback35(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method35(args);
-}
-static int callback36(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method36(args);
-}
-static int callback37(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method37(args);
-}
-static int callback38(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method38(args);
-}
-static int callback39(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method39(args);
-}
-static int callback40(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method40(args);
-}
-static int callback41(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method41(args);
-}
-static int callback42(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method42(args);
-}
-static int callback43(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method43(args);
-}
-static int callback44(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method44(args);
-}
-static int callback45(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method45(args);
-}
-static int callback46(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method46(args);
-}
-static int callback47(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method47(args);
-}
-static int callback48(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method48(args);
-}
-static int callback49(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method49(args);
-}
-static int callback50(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method50(args);
-}
-static int callback51(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method51(args);
-}
-static int callback52(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method52(args);
-}
-static int callback53(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method53(args);
-}
-static int callback54(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method54(args);
-}
-static int callback55(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method55(args);
-}
-static int callback56(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method56(args);
-}
-static int callback57(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method57(args);
-}
-static int callback58(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method58(args);
-}
-static int callback59(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method59(args);
-}
-static int callback60(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method60(args);
-}
-static int callback61(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method61(args);
-}
-static int callback62(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method62(args);
-}
-static int callback63(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method63(args);
-}
-static int callback64(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method64(args);
-}
-static int callback65(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method65(args);
-}
-static int callback66(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method66(args);
-}
-static int callback67(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method67(args);
-}
-static int callback68(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method68(args);
-}
-static int callback69(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method69(args);
-}
-static int callback70(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method70(args);
-}
-static int callback71(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method71(args);
-}
-static int callback72(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method72(args);
-}
-static int callback73(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method73(args);
-}
-static int callback74(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method74(args);
-}
-static int callback75(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method75(args);
-}
-static int callback76(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method76(args);
-}
-static int callback77(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method77(args);
-}
-static int callback78(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method78(args);
-}
-static int callback79(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return COM.E_FAIL;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((COMObject) object).method79(args);
-}
-public void dispose() {
- // free the memory for this reference
- int[] pVtable = new int[1];
- OS.MoveMemory(pVtable, ppVtable, 4);
- OS.GlobalFree(pVtable[0]);
- OS.GlobalFree(ppVtable);
-
- // remove this ppVtable from the list
- ObjectMap.remove(new Integer(ppVtable));
-
- ppVtable = 0;
-}
-public int getAddress () {
- return ppVtable;
-}
-public int method0(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method1(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method2(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method3(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method4(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method5(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method6(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method7(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method8(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method9(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method10(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method11(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method12(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method13(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method14(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method15(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method16(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method17(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method18(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method19(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method20(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method21(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method22(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method23(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method24(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method25(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method26(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method27(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method28(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method29(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method30(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method31(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method32(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method33(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method34(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method35(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method36(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method37(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method38(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method39(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method40(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method41(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method42(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method43(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method44(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method45(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method46(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method47(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method48(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method49(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method50(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method51(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method52(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method53(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method54(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method55(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method56(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method57(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method58(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method59(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method60(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method61(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method62(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method63(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method64(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method65(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method66(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method67(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method68(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method69(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method70(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method71(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method72(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method73(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method74(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method75(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method76(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method77(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method78(int[] args) {
- return COM.E_NOTIMPL;
-}
-public int method79(int[] args) {
- return COM.E_NOTIMPL;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java
deleted file mode 100755
index 59db640d75..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java
+++ /dev/null
@@ -1,421 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import java.io.File;
-import org.eclipse.swt.internal.ole.win32.COM;
-import org.eclipse.swt.internal.win32.OS;
-import org.eclipse.swt.internal.win32.TCHAR;
-
-
-/**
- *
- * OLE contains all the constants used to create an ActiveX Control or an OLE Document.
- *
- * <p>Definitions for these constants can be found in MSDN.
- *
- */
-public class OLE extends SWT {
-
- public static final int S_FALSE = 1; // Used for functions that semantically return a Boolean FALSE result to indicate that the function succeeded.
- public static final int S_OK = 0; // Function succeeded.
-
- // Verbs that can be invoked on this client
- public static final int OLEIVERB_DISCARDUNDOSTATE = -6; // close the OLE object and discard the undo state
- public static final int OLEIVERB_HIDE = -3; // hide the OLE object
- public static final int OLEIVERB_INPLACEACTIVATE = -5; // open the OLE for editing in-place
- public static final int OLEIVERB_OPEN = -2; // open the OLE object for editing in a separate window
- public static final int OLEIVERB_PRIMARY = 0; // opens the OLE object for editing
- public static final int OLEIVERB_PROPERTIES = -7; // request the OLE object properties dialog
- public static final int OLEIVERB_SHOW = -1; // show the OLE object
- public static final int OLEIVERB_UIACTIVATE = -4; // activate the UI for the OLE object
-
- public static final int PROPERTY_CHANGING = 0;
- public static final int PROPERTY_CHANGED = 1;
-
- /**
- * Error code for OleError - No specific error information available
- */
- public static final int HRESULT_UNSPECIFIED = 0;
- /**
- * Error code for OleError - Failed to create file
- */
- public static final int ERROR_CANNOT_CREATE_FILE = 1000;
- /**
- * Error code for OleError - Failed to create Ole Client
- */
- public static final int ERROR_CANNOT_CREATE_OBJECT = 1001;
- /**
- * Error code for OleError - File does not exist, is not accessible to user or does not have the correct format
- */
- public static final int ERROR_CANNOT_OPEN_FILE = 1002;
- /**
- * Error code for OleError - Failed to find requested interface on OLE Object
- */
- public static final int ERROR_INTERFACE_NOT_FOUND = 1003;
- /**
- * Error code for OleError - Class ID not found in registry
- */
- public static final int ERROR_INVALID_CLASSID = 1004;
- /**
- * Error code for OleError - Failed to get the class factory for the specified classID
- */
- public static final int ERROR_CANNOT_ACCESS_CLASSFACTORY = 1005;
- /**
- * Error code for OleError - Failed to create Licensed instance
- */
- public static final int ERROR_CANNOT_CREATE_LICENSED_OBJECT = 1006;
- /**
- * Error code for OleError - Out of Memory
- */
- public static final int ERROR_OUT_OF_MEMORY = 1007;
- /**
- * Error code for OleError - Failed to change Variant type
- */
- public static final int ERROR_CANNOT_CHANGE_VARIANT_TYPE = 1010;
- /**
- * Error code for OleError - Invalid address received for Ole Interface
- */
- public static final int ERROR_INVALID_INTERFACE_ADDRESS = 1011;
- /**
- * Error code for OleError - Unable to find Application
- */
- public static final int ERROR_APPLICATION_NOT_FOUND = 1013;
- /**
- * Error code for OleError - Action can not be performed
- */
- public static final int ERROR_ACTION_NOT_PERFORMED = 1014;
-
- public static final int OLECMDF_SUPPORTED = 1;
- public static final int OLECMDF_ENABLED = 2;
- public static final int OLECMDF_LATCHED = 4;
- public static final int OLECMDF_NINCHED = 8;
-
- public static final int OLECMDTEXTF_NONE = 0;
- public static final int OLECMDTEXTF_NAME = 1;
- public static final int OLECMDTEXTF_STATUS = 2;
-
- public static final int OLECMDEXECOPT_DODEFAULT = 0;
- public static final int OLECMDEXECOPT_PROMPTUSER = 1;
- public static final int OLECMDEXECOPT_DONTPROMPTUSER = 2;
- public static final int OLECMDEXECOPT_SHOWHELP = 3;
-
- public static final int OLECMDID_OPEN = 1;
- public static final int OLECMDID_NEW = 2;
- public static final int OLECMDID_SAVE = 3;
- public static final int OLECMDID_SAVEAS = 4;
- public static final int OLECMDID_SAVECOPYAS = 5;
- public static final int OLECMDID_PRINT = 6;
- public static final int OLECMDID_PRINTPREVIEW = 7;
- public static final int OLECMDID_PAGESETUP = 8;
- public static final int OLECMDID_SPELL = 9;
- public static final int OLECMDID_PROPERTIES = 10;
- public static final int OLECMDID_CUT = 11;
- public static final int OLECMDID_COPY = 12;
- public static final int OLECMDID_PASTE = 13;
- public static final int OLECMDID_PASTESPECIAL = 14;
- public static final int OLECMDID_UNDO = 15;
- public static final int OLECMDID_REDO = 16;
- public static final int OLECMDID_SELECTALL = 17;
- public static final int OLECMDID_CLEARSELECTION = 18;
- public static final int OLECMDID_ZOOM = 19;
- public static final int OLECMDID_GETZOOMRANGE = 20;
- public static final int OLECMDID_UPDATECOMMANDS = 21;
- public static final int OLECMDID_REFRESH = 22;
- public static final int OLECMDID_STOP = 23;
- public static final int OLECMDID_HIDETOOLBARS = 24;
- public static final int OLECMDID_SETPROGRESSMAX = 25;
- public static final int OLECMDID_SETPROGRESSPOS = 26;
- public static final int OLECMDID_SETPROGRESSTEXT = 27;
- public static final int OLECMDID_SETTITLE = 28;
- public static final int OLECMDID_SETDOWNLOADSTATE = 29;
- public static final int OLECMDID_STOPDOWNLOAD = 30;
-
- /* Ole Property Description flags */
- public static int VARFLAG_FREADONLY = 0x1;
- public static int VARFLAG_FSOURCE = 0x2;
- public static int VARFLAG_FBINDABLE = 0x4;
- public static int VARFLAG_FREQUESTEDIT = 0x8;
- public static int VARFLAG_FDISPLAYBIND = 0x10;
- public static int VARFLAG_FDEFAULTBIND = 0x20;
- public static int VARFLAG_FHIDDEN = 0x40;
- public static int VARFLAG_FRESTRICTED = 0x80;
- public static int VARFLAG_FDEFAULTCOLLELEM = 0x100;
- public static int VARFLAG_FUIDEFAULT = 0x200;
- public static int VARFLAG_FNONBROWSABLE = 0x400;
- public static int VARFLAG_FREPLACEABLE = 0x800;
- public static int VARFLAG_FIMMEDIATEBIND = 0x1000;
-
- /* Ole Property Description kind */
- public static int VAR_PERINSTANCE = 0;
- public static int VAR_STATIC = 1;
- public static int VAR_CONST = 2;
- public static int VAR_DISPATCH = 3;
-
- /* Ole Parameter Description flags */
- public static short IDLFLAG_NONE = 0;
- public static short IDLFLAG_FIN = 1;
- public static short IDLFLAG_FOUT = 2;
- public static short IDLFLAG_FLCID = 4;
- public static short IDLFLAG_FRETVAL = 8;
-
- /* Ole Description types */
- public static final short VT_BOOL = 11; // Boolean; True=-1, False=0.
- public static final short VT_BSTR = 8; // Binary String.
- public static final short VT_BYREF = 16384; // By reference - must be combined with one of the othre VT values
- public static final short VT_CY = 6; // Currency.
- public static final short VT_DATE = 7; // Date.
- public static final short VT_DISPATCH = 9; // IDispatch
- public static final short VT_EMPTY = 0; // Not specified.
- public static final short VT_ERROR = 10; // Scodes.
- public static final short VT_I2 = 2; // 2-byte signed int.
- public static final short VT_I4 = 3; // 4-byte signed int.
- public static final short VT_NULL = 1; // Null.
- public static final short VT_R4 = 4; // 4-byte real.
- public static final short VT_R8 = 5; // 8-byte real.
- public static final short VT_UI1 = 17; // Unsigned char.
- public static final short VT_UI4 = 19; // Unsigned int.
- public static final short VT_UNKNOWN = 13; // IUnknown FAR*.
- public static final short VT_VARIANT = 12; // VARIANT FAR*.
- public static final short VT_PTR = 26;
- public static final short VT_USERDEFINED = 29;
- public static final short VT_HRESULT = 25;
- public static final short VT_DECIMAL = 14;
- public static final short VT_I1 = 16;
- public static final short VT_UI2 = 18;
- public static final short VT_I8 = 20;
- public static final short VT_UI8 = 21;
- public static final short VT_INT = 22;
- public static final short VT_UINT = 23;
- public static final short VT_VOID = 24;
- public static final short VT_SAFEARRAY = 27;
- public static final short VT_CARRAY = 28;
- public static final short VT_LPSTR = 30;
- public static final short VT_LPWSTR = 31;
- public static final short VT_RECORD = 36;
- public static final short VT_FILETIME = 64;
- public static final short VT_BLOB = 65;
- public static final short VT_STREAM = 66;
- public static final short VT_STORAGE = 67;
- public static final short VT_STREAMED_OBJECT = 68;
- public static final short VT_STORED_OBJECT = 69;
- public static final short VT_BLOB_OBJECT = 70;
- public static final short VT_CF = 71;
- public static final short VT_CLSID = 72;
- public static final short VT_VERSIONED_STREAM = 73;
- public static final short VT_BSTR_BLOB = 0xfff;
- public static final short VT_VECTOR = 0x1000;
- public static final short VT_ARRAY = 0x2000;
-
- /* Ole Function Description Invoke Kind values */
- public static final int INVOKE_FUNC = 1;
- public static final int INVOKE_PROPERTYGET = 2;
- public static final int INVOKE_PROPERTYPUT = 4;
- public static final int INVOKE_PROPERTYPUTREF = 8;
-
- /* Ole Function Description function kind */
- public static final int FUNC_VIRTUAL = 0;
- public static final int FUNC_PUREVIRTUAL = 1;
- public static final int FUNC_NONVIRTUAL = 2;
- public static final int FUNC_STATIC = 3;
- public static final int FUNC_DISPATCH = 4;
-
- /* Ole Function Description function flags */
- public static final short FUNCFLAG_FRESTRICTED = 1;
- public static final short FUNCFLAG_FSOURCE = 0x2;
- public static final short FUNCFLAG_FBINDABLE = 0x4;
- public static final short FUNCFLAG_FREQUESTEDIT = 0x8;
- public static final short FUNCFLAG_FDISPLAYBIND = 0x10;
- public static final short FUNCFLAG_FDEFAULTBIND = 0x20;
- public static final short FUNCFLAG_FHIDDEN = 0x40;
- public static final short FUNCFLAG_FUSESGETLASTERROR = 0x80;
- public static final short FUNCFLAG_FDEFAULTCOLLELEM = 0x100;
- public static final short FUNCFLAG_FUIDEFAULT = 0x200;
- public static final short FUNCFLAG_FNONBROWSABLE = 0x400;
- public static final short FUNCFLAG_FREPLACEABLE = 0x800;
- public static final short FUNCFLAG_FIMMEDIATEBIND = 0x1000;
-
- /* Ole Function Description calling convention */
- public static final int CC_FASTCALL = 0;
- public static final int CC_CDECL = 1;
- public static final int CC_MSCPASCAL = 2;
- public static final int CC_PASCAL = 2;
- public static final int CC_MACPASCAL = 3;
- public static final int CC_STDCALL = 4;
- public static final int CC_FPFASTCALL = 5;
- public static final int CC_SYSCALL = 6;
- public static final int CC_MPWCDECL = 7;
- public static final int CC_MPWPASCAL = 8;
- public static final int CC_MAX = 9;
-
- static final String ERROR_NOT_IMPLEMENTED_MSG = "Required functionality not currently supported.";
- static final String ERROR_CANNOT_CREATE_FILE_MSG = "Failed to create file.";
- static final String ERROR_CANNOT_CREATE_OBJECT_MSG = "Failed to create Ole Client.";
- static final String ERROR_CANNOT_OPEN_FILE_MSG = "File does not exist, is not accessible to user or does not have the correct format.";
- static final String ERROR_INTERFACE_NOT_FOUND_MSG = "Failed to find requested interface on OLE Object.";
- static final String ERROR_INVALID_CLASSID_MSG = "Class ID not found in registry";
- static final String ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG = "Failed to get the class factory for the specified classID";
- static final String ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG = "Failed to create Licensed instance";
- static final String ERROR_OUT_OF_MEMORY_MSG = "Out of Memory";
- static final String ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG = "Failed to change Variant type";
- static final String ERROR_INVALID_INTERFACE_ADDRESS_MSG = "Invalid address received for Ole Interface.";
- static final String ERROR_APPLICATION_NOT_FOUND_MSG = "Unable to find Application.";
- static final String ERROR_ACTION_NOT_PERFORMED_MSG = "Action can not be performed.";
-
-
-public static void error (int code) {
- error (code, 0);
-}
-public static void error (int code, int hresult) {
-
- switch (code) {
- /* Illegal Arguments (non-fatal) */
- case ERROR_INVALID_INTERFACE_ADDRESS :{
- throw new IllegalArgumentException (ERROR_INVALID_INTERFACE_ADDRESS_MSG);
- }
-
- /* SWT Errors (non-fatal) */
- case ERROR_CANNOT_CREATE_FILE : {
- String msg = ERROR_CANNOT_CREATE_FILE_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_CANNOT_CREATE_OBJECT : {
- String msg = ERROR_CANNOT_CREATE_OBJECT_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_CANNOT_OPEN_FILE : {
- String msg = ERROR_CANNOT_OPEN_FILE_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_INTERFACE_NOT_FOUND : {
- String msg = ERROR_INTERFACE_NOT_FOUND_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_INVALID_CLASSID : {
- String msg = ERROR_INVALID_CLASSID_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_CANNOT_ACCESS_CLASSFACTORY : {
- String msg = ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_CANNOT_CREATE_LICENSED_OBJECT : {
- String msg = ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_CANNOT_CHANGE_VARIANT_TYPE : {
- String msg = ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_APPLICATION_NOT_FOUND : {
- String msg = ERROR_APPLICATION_NOT_FOUND_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
- case ERROR_ACTION_NOT_PERFORMED : {
- String msg = ERROR_ACTION_NOT_PERFORMED_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTException (code, msg);
- }
-
- /* OS Failure/Limit (fatal, may occur only on some platforms) */
- case ERROR_OUT_OF_MEMORY : {
- String msg = ERROR_ACTION_NOT_PERFORMED_MSG;
- if (hresult != 0) msg += " result = "+hresult;
- throw new SWTError (code, msg);
- }
- }
-
- /* Unknown/Undefined Error */
- SWT.error(code);
-}
-
-/*
- * Finds the OLE program id that is associated with an extension.
- * The extension may or may not begin with a '.'. On platforms
- * that do not support OLE, an empty string is returned.
- *
- * @param extension the program extension
- * @return a string that is the OLE program id or an empty string
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static String findProgramID (String extension) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return "";
-
- if (extension.charAt (0) != '.') extension = "." + extension;
-
- /* Use the character encoding for the default locale */
- TCHAR extensionKey = new TCHAR(0, extension, true);
- String result = getKeyValue(extensionKey);
- if (result != null) {
- // look for "<programID>\NotInsertable"
- TCHAR notInsertableKey = new TCHAR(0, result+"\\NotInsertable", true);
- if (getKeyExists(notInsertableKey)) return "";
- // look for "<programID>\Insertable"
- TCHAR insertableKey = new TCHAR(0, result+"\\Insertable", true);
- if (getKeyExists(insertableKey)) return result;
- // look for "<programID>\protocol\StdFileEditing\server"
- TCHAR serverKey = new TCHAR(0, result+"\\protocol\\StdFileEditing\\server", true);
- if (getKeyExists(serverKey)) return result;
- }
-
- return "";
-}
-static String getKeyValue (TCHAR key) {
- int [] phkResult = new int [1];
- if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
- return null;
- }
- String result = null;
- int [] lpcbData = new int [1];
- if (OS.RegQueryValueEx (phkResult [0], (TCHAR) null, 0, null, null, lpcbData) == 0) {
- /* Use the character encoding for the default locale */
- TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof);
- if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
- int length = Math.max(0, lpData.length () - 1);
- result = lpData.toString (0, length);
- }
- }
- if (phkResult [0] != 0) OS.RegCloseKey (phkResult [0]);
- return result;
-}
-private static boolean getKeyExists (TCHAR key) {
- int [] phkResult = new int [1];
- if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
- return false;
- }
- if (phkResult [0] != 0) OS.RegCloseKey (phkResult [0]);
- return true;
-}
-/**
- * Returns true if the specified file has an OLE Storage format.
- *
- * Note all empty files (regardless of extension) will return false.
- *
- * @param file the file to be checked
- *
- * @return true if this file has an OLE Storage format
- */
-public static boolean isOleFile(File file) {
- if (file == null || !file.exists() || file.isDirectory())
- return false;
-
- return (COM.StgIsStorageFile((file.getAbsolutePath()+"\0").toCharArray()) == COM.S_OK);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java
deleted file mode 100755
index 840ea96247..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java
+++ /dev/null
@@ -1,586 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * OleAutomation provides a generic mechanism for accessing functionality that is
- * specific to a particular ActiveX Control or OLE Document.
- *
- * <p>The OLE Document or ActiveX Control must support the IDispatch interface in order to provide
- * OleAutomation support. The additional functionality provided by the OLE Object is specified in
- * its IDL file. The additional methods can either be to get property values (<code>getProperty</code>),
- * to set property values (<code>setProperty</code>) or to invoke a method (<code>invoke</code> or
- * <code>invokeNoReply</code>). Arguments are passed around in the form of <code>Variant</code>
- * objects.
- *
- * <p>Here is a sample IDL fragment:
- *
- * <pre>
- * interface IMyControl : IDispatch
- * {
- * [propget, id(0)] HRESULT maxFileCount([retval, out] int *c);
- * [propput, id(0)] HRESULT maxFileCount([in] int c);
- * [id(1)] HRESULT AddFile([in] BSTR fileName);
- * };
- * </pre>
- *
- * <p>An example of how to interact with this extended functionality is shown below:
- *
- * <code><pre>
- * OleAutomation automation = new OleAutomation(myControlSite);
- *
- * // Look up the ID of the maxFileCount parameter
- * int[] rgdispid = automation.getIDsOfNames(new String[]{"maxFileCount"});
- * int maxFileCountID = rgdispid[0];
- *
- * // Set the property maxFileCount to 100:
- * if (automation.setProperty(maxFileCountID, new Variant(100))) {
- * System.out.println("Max File Count was successfully set.");
- * }
- *
- * // Get the new value of the maxFileCount parameter:
- * Variant pVarResult = automation.getProperty(maxFileCountID);
- * if (pVarResult != null) {
- * System.out.println("Max File Count is "+pVarResult.getInt());
- * }
- *
- * // Invoke the AddFile method
- * // Look up the IDs of the AddFile method and its parameter
- * rgdispid = automation.getIDsOfNames(new String[]{"AddFile", "fileName"});
- * int dispIdMember = rgdispid[0];
- * int[] rgdispidNamedArgs = new int[] {rgdispid[1]};
- *
- * // Convert arguments to Variant objects
- * Variant[] rgvarg = new Variant[1];
- * String fileName = "C:\\testfile";
- * rgvarg[0] = new Variant(fileName);
- *
- * // Call the method
- * Variant pVarResult = automation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
- *
- * // Check the return value
- * if (pVarResult == null || pVarResult.getInt() != OLE.S_OK){
- * System.out.println("Failed to add file "+fileName);
- * }
- *
- * automation.dispose();
- *
- * </pre></code>
- */
-public final class OleAutomation {
- private IDispatch objIDispatch;
- private String exceptionDescription;
- private ITypeInfo objITypeInfo;
-
-OleAutomation(int address) {
- if (address == 0) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS);
- objIDispatch = new IDispatch(address);
- objIDispatch.AddRef();
-}
-/**
- * Creates an OleAutomation object for the specified client.
- *
- * @param clientSite the site for the OLE Document or ActiveX Control whose additional functionality
- * you need to access
- *
- * @exception SWTError <ul>
- * <li>ERROR_INVALID_INTERFACE_ADDRESS when called with an invalid client site
- * </ul>
- */
- public OleAutomation(OleClientSite clientSite) {
- if (clientSite == null) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS);
- objIDispatch = clientSite.getAutomationObject();
-
- int[] ppv = new int[1];
- int result = objIDispatch.GetTypeInfo(0, COM.LOCALE_USER_DEFAULT, ppv);
- if (result == OLE.S_OK) {
- objITypeInfo = new ITypeInfo(ppv[0]);
- objITypeInfo.AddRef();
- }
- }
-/**
- * Disposes the automation object.
- * <p>
- * This method releases the IDispatch interface on the OLE Document or ActiveX Control.
- * Do not use the OleAutomation object after it has been disposed.
- */
-public void dispose() {
-
- if (objIDispatch != null){
- objIDispatch.Release();
- }
- objIDispatch = null;
-
- if (objITypeInfo != null){
- objITypeInfo.Release();
- }
- objITypeInfo = null;
-
-}
-int getAddress() {
- return objIDispatch.getAddress();
-}
-public String getHelpFile(int dispId) {
- if (objITypeInfo == null) return null;
- String[] file = new String[1];
- int rc = objITypeInfo.GetDocumentation(dispId, null, null, null, file );
- if (rc == OLE.S_OK) return file[0];
- return null;
-}
-public String getDocumentation(int dispId) {
- if (objITypeInfo == null) return null;
- String[] doc = new String[1];
- int rc = objITypeInfo.GetDocumentation(dispId, null, doc, null, null );
- if (rc == OLE.S_OK) return doc[0];
- return null;
-}
-public OlePropertyDescription getPropertyDescription(int index) {
- if (objITypeInfo == null) return null;
- int[] ppVarDesc = new int[1];
- int rc = objITypeInfo.GetVarDesc(index, ppVarDesc);
- if (rc != OLE.S_OK) return null;
- VARDESC1 vardesc = new VARDESC1();
- COM.MoveMemory(vardesc, ppVarDesc[0], VARDESC1.sizeof);
-
- OlePropertyDescription data = new OlePropertyDescription();
- data.id = vardesc.memid;
- data.name = getName(vardesc.memid);
- data.type = vardesc.elemdescVar_tdesc_vt;
- if (data.type == OLE.VT_PTR) {
- short[] vt = new short[1];
- COM.MoveMemory(vt, vardesc.elemdescVar_tdesc_union + 4, 2);
- data.type = vt[0];
- }
- data.flags = vardesc.wVarFlags;
- data.kind = vardesc.varkind;
- data.description = getDocumentation(vardesc.memid);
- data.helpFile = getHelpFile(vardesc.memid);
-
- objITypeInfo.ReleaseVarDesc(ppVarDesc[0]);
- return data;
-}
-public OleFunctionDescription getFunctionDescription(int index) {
- if (objITypeInfo == null) return null;
- int[] ppFuncDesc = new int[1];
- int rc = objITypeInfo.GetFuncDesc(index, ppFuncDesc);
- if (rc != OLE.S_OK) return null;
- FUNCDESC1 funcdesc = new FUNCDESC1();
- COM.MoveMemory(funcdesc, ppFuncDesc[0], FUNCDESC1.sizeof);
-
- OleFunctionDescription data = new OleFunctionDescription();
-
- data.id = funcdesc.memid;
- data.optionalArgCount = funcdesc.cParamsOpt;
- data.invokeKind = funcdesc.invkind;
- data.funcKind = funcdesc.funckind;
- data.flags = funcdesc.wFuncFlags;
- data.callingConvention = funcdesc.callconv;
- data.documentation = getDocumentation(funcdesc.memid);
- data.helpFile = getHelpFile(funcdesc.memid);
-
- String[] names = getNames(funcdesc.memid, funcdesc.cParams + 1);
- if (names.length > 0) {
- data.name = names[0];
- }
- data.args = new OleParameterDescription[funcdesc.cParams];
- for (int i = 0; i < data.args.length; i++) {
- data.args[i] = new OleParameterDescription();
- if (names.length > i + 1) {
- data.args[i].name = names[i + 1];
- }
- short[] vt = new short[1];
- COM.MoveMemory(vt, funcdesc.lprgelemdescParam + i * 16 + 4, 2);
- if (vt[0] == OLE.VT_PTR) {
- int[] pTypedesc = new int[1];
- COM.MoveMemory(pTypedesc, funcdesc.lprgelemdescParam + i * 16, 4);
- short[] vt2 = new short[1];
- COM.MoveMemory(vt2, pTypedesc[0] + 4, 2);
- vt[0] = (short)(vt2[0] | COM.VT_BYREF);
- }
- data.args[i].type = vt[0];
- short[] wParamFlags = new short[1];
- COM.MoveMemory(wParamFlags, funcdesc.lprgelemdescParam + i * 16 + 12, 2);
- data.args[i].flags = wParamFlags[0];
- }
-
- data.returnType = funcdesc.elemdescFunc_tdesc_vt;
- if (data.returnType == OLE.VT_PTR) {
- short[] vt = new short[1];
- COM.MoveMemory(vt, funcdesc.elemdescFunc_tdesc_union + 4, 2);
- data.returnType = vt[0];
- }
-
- objITypeInfo.ReleaseFuncDesc(ppFuncDesc[0]);
- return data;
-}
-public TYPEATTR getTypeInfoAttributes() {
- if (objITypeInfo == null) return null;
- int[] ppTypeAttr = new int[1];
- int rc = objITypeInfo.GetTypeAttr(ppTypeAttr);
- if (rc != OLE.S_OK) return null;
- TYPEATTR typeattr = new TYPEATTR();
- COM.MoveMemory(typeattr, ppTypeAttr[0], TYPEATTR.sizeof);
- objITypeInfo.ReleaseTypeAttr(ppTypeAttr[0]);
- return typeattr;
-}
-public String getName(int dispId) {
- if (objITypeInfo == null) return null;
- String[] name = new String[1];
- int rc = objITypeInfo.GetDocumentation(dispId, name, null, null, null );
- if (rc == OLE.S_OK) return name[0];
- return null;
-}
-public String[] getNames(int dispId, int maxSize) {
- if (objITypeInfo == null) return new String[0];
- String[] names = new String[maxSize];
- int[] count = new int[1];
- int rc = objITypeInfo.GetNames(dispId, names, maxSize, count);
- if (rc == OLE.S_OK) {
- String[] newNames = new String[count[0]];
- System.arraycopy(names, 0, newNames, 0, count[0]);
- return newNames;
- }
- return new String[0];
-}
-/**
- * Returns the positive integer values (IDs) that are associated with the specified names by the
- * IDispatch implementor. If you are trying to get the names of the parameters in a method, the first
- * String in the names array must be the name of the method followed by the names of the parameters.
- *
- * @param names an array of names for which you require the identifiers
- *
- * @return positive integer values that are associated with the specified names in the same
- * order as the names where provided; or null if the names are unknown
- */
-public int[] getIDsOfNames(String[] names) {
-
- int[] rgdispid = new int[names.length];
- int result = objIDispatch.GetIDsOfNames(new GUID(), names, names.length, COM.LOCALE_USER_DEFAULT, rgdispid);
- if (result != COM.S_OK) return null;
-
- return rgdispid;
-}
-/**
- * Returns a description of the last error encountered.
- *
- * @return a description of the last error encountered
- */
-public String getLastError() {
-
- return exceptionDescription;
-
-}
-/**
- * Returns the value of the property specified by the dispIdMember.
- *
- * @param dispIdMember the ID of the property as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @return the value of the property specified by the dispIdMember
- */
-public Variant getProperty(int dispIdMember) {
- // get the IDispatch interface for the control
- if (objIDispatch == null) return null;
-
- DISPPARAMS pDispParams = new DISPPARAMS();
- EXCEPINFO excepInfo = new EXCEPINFO();
- int[] pArgErr = new int[1];
- int pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- int result = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, COM.DISPATCH_PROPERTYGET, pDispParams, pVarResultAddress, excepInfo, pArgErr);
-
- // save error string and cleanup EXCEPINFO
- manageExcepinfo(result, excepInfo);
-
- Variant pVarResult = null;
- if (result == COM.S_OK) {
- pVarResult = new Variant();
- pVarResult.setData(pVarResultAddress);
- }
-
- COM.VariantClear(pVarResultAddress);
- OS.GlobalFree(pVarResultAddress);
-
- return pVarResult;
-
-}
-/**
- * Invokes a method on the OLE Object; the method has no parameters.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @return the result of the method or null if the method failed to give result information
- */
-public Variant invoke(int dispIdMember) {
-
- Variant pVarResult = new Variant();
- int result = invoke(dispIdMember, null, null, pVarResult);
-
- if (result == COM.S_OK) return pVarResult;
-
- return null;
-}
-/**
- * Invokes a method on the OLE Object; the method has no optional parameters.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @param rgvarg an array of arguments for the method. All arguments are considered to be
- * read only unless the Variant is a By Reference Variant type.
- *
- * @return the result of the method or null if the method failed to give result information
- */
-public Variant invoke(int dispIdMember, Variant[] rgvarg) {
-
- Variant pVarResult = new Variant();
- int result = invoke(dispIdMember, rgvarg, null, pVarResult);
-
- if (result == COM.S_OK) return pVarResult;
-
- return null;
-}
-/**
- * Invokes a method on the OLE Object; the method has optional parameters. It is not
- * neccessary to specify all the optional parameters, only include the parameters for which
- * you are providing values.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @param rgvarg an array of arguments for the method. All arguments are considered to be
- * read only unless the Variant is a By Reference Variant type.
- *
- * @param rgdispidNamedArgs an array of identifiers for the arguments specified in rgvarg; the
- * parameter IDs must be in the same order as their corresponding values;
- * all arguments must have an identifier - identifiers can be obtained using
- * OleAutomation.getIDsOfNames
- *
- * @return the result of the method or null if the method failed to give result information
- */
-public Variant invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs) {
-
- Variant pVarResult = new Variant();
- int result = invoke(dispIdMember, rgvarg, rgdispidNamedArgs, pVarResult);
-
- if (result == COM.S_OK) return pVarResult;
-
- return null;
-}
-private int invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs, Variant pVarResult) {
-
- // get the IDispatch interface for the control
- if (objIDispatch == null) return COM.E_FAIL;
-
- // create a DISPPARAMS structure for the input parameters
- DISPPARAMS pDispParams = new DISPPARAMS();
- // store arguments in rgvarg
- if (rgvarg != null && rgvarg.length > 0) {
- pDispParams.cArgs = rgvarg.length;
- pDispParams.rgvarg = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, Variant.sizeof * rgvarg.length);
- int offset = 0;
- for (int i = rgvarg.length - 1; i >= 0 ; i--) {
- rgvarg[i].getData(pDispParams.rgvarg + offset);
- offset += Variant.sizeof;
- }
- }
-
- // if arguments have ids, store the ids in rgdispidNamedArgs
- if (rgdispidNamedArgs != null && rgdispidNamedArgs.length > 0) {
- pDispParams.cNamedArgs = rgdispidNamedArgs.length;
- pDispParams.rgdispidNamedArgs = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * rgdispidNamedArgs.length);
- int offset = 0;
- for (int i = rgdispidNamedArgs.length; i > 0; i--) {
- COM.MoveMemory(pDispParams.rgdispidNamedArgs + offset, new int[] {rgdispidNamedArgs[i-1]}, 4);
- offset += 4;
- }
- }
-
- // invoke the method
- EXCEPINFO excepInfo = new EXCEPINFO();
- int[] pArgErr = new int[1];
- int pVarResultAddress = 0;
- if (pVarResult != null) pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- int result = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, COM.DISPATCH_METHOD, pDispParams, pVarResultAddress, excepInfo, pArgErr);
-
- if (pVarResultAddress != 0){
- pVarResult.setData(pVarResultAddress);
- COM.VariantClear(pVarResultAddress);
- OS.GlobalFree(pVarResultAddress);
- }
-
- // free the Dispparams resources
- if (pDispParams.rgdispidNamedArgs != 0){
- OS.GlobalFree(pDispParams.rgdispidNamedArgs);
- }
- if (pDispParams.rgvarg != 0) {
- int offset = 0;
- for (int i = 0, length = rgvarg.length; i < length; i++){
- COM.VariantClear(pDispParams.rgvarg + offset);
- offset += Variant.sizeof;
- }
- OS.GlobalFree(pDispParams.rgvarg);
- }
-
- // save error string and cleanup EXCEPINFO
- manageExcepinfo(result, excepInfo);
-
- return result;
-}
-/**
- * Invokes a method on the OLE Object; the method has no parameters. In the early days of OLE,
- * the IDispatch interface was not well defined and some applications (mainly Word) did not support
- * a return value. For these applications, call this method instead of calling
- * <code>public void invoke(int dispIdMember)</code>.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @exception SWTError <ul>
- * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
- * </ul>
- */
-public void invokeNoReply(int dispIdMember) {
- int result = invoke(dispIdMember, null, null, null);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
-}
-/**
- * Invokes a method on the OLE Object; the method has no optional parameters. In the early days of OLE,
- * the IDispatch interface was not well defined and some applications (mainly Word) did not support
- * a return value. For these applications, call this method instead of calling
- * <code>public void invoke(int dispIdMember, Variant[] rgvarg)</code>.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @param rgvarg an array of arguments for the method. All arguments are considered to be
- * read only unless the Variant is a By Reference Variant type.
- *
- * @exception SWTError <ul>
- * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
- * </ul>
- */
-public void invokeNoReply(int dispIdMember, Variant[] rgvarg) {
- int result = invoke(dispIdMember, rgvarg, null, null);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
-}
-/**
- * Invokes a method on the OLE Object; the method has optional parameters. It is not
- * neccessary to specify all the optional parameters, only include the parameters for which
- * you are providing values. In the early days of OLE, the IDispatch interface was not well
- * defined and some applications (mainly Word) did not support a return value. For these
- * applications, call this method instead of calling
- * <code>public void invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs)</code>.
- *
- * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- *
- * @param rgvarg an array of arguments for the method. All arguments are considered to be
- * read only unless the Variant is a By Reference Variant type.
- *
- * @param rgdispidNamedArgs an array of identifiers for the arguments specified in rgvarg; the
- * parameter IDs must be in the same order as their corresponding values;
- * all arguments must have an identifier - identifiers can be obtained using
- * OleAutomation.getIDsOfNames
- *
- * @exception SWTError <ul>
- * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
- * </ul>
- */
-public void invokeNoReply(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs) {
- int result = invoke(dispIdMember, rgvarg, rgdispidNamedArgs, null);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
-}
-private void manageExcepinfo(int hResult, EXCEPINFO excepInfo) {
-
- if (hResult == COM.S_OK){
- exceptionDescription = new String("No Error");
- return;
- }
-
- // extract exception info
- if (hResult == COM.DISP_E_EXCEPTION) {
- if (excepInfo.bstrDescription != 0){
- int size = COM.SysStringByteLen(excepInfo.bstrDescription);
- char[] buffer = new char[(size + 1) /2];
- COM.MoveMemory(buffer, excepInfo.bstrDescription, size);
- exceptionDescription = new String(buffer);
- } else {
- exceptionDescription = new String("OLE Automation Error Exception ");
- if (excepInfo.wCode != 0){
- exceptionDescription += "code = "+excepInfo.wCode;
- } else if (excepInfo.scode != 0){
- exceptionDescription += "code = "+excepInfo.scode;
- }
- }
- } else {
- exceptionDescription = new String("OLE Automation Error HResult : "+hResult);
- }
-
- // cleanup EXCEPINFO struct
- if (excepInfo.bstrDescription != 0)
- COM.SysFreeString(excepInfo.bstrDescription);
- if (excepInfo.bstrHelpFile != 0)
- COM.SysFreeString(excepInfo.bstrHelpFile);
- if (excepInfo.bstrSource != 0)
- COM.SysFreeString(excepInfo.bstrSource);
-}
-/**
- * Sets the property specified by the dispIdMember to a new value.
- *
- * @param dispIdMember the ID of the property as specified by the IDL of the ActiveX Control; the
- * value for the ID can be obtained using OleAutomation.getIDsOfNames
- * @param rgvarg the new value of the property
- *
- * @return true if the operation was successful
- */
-public boolean setProperty(int dispIdMember, Variant rgvarg) {
-
- // get the IDispatch interface for the control
- if (objIDispatch == null) return false;
-
- // create Dispparams structure with input parameters
- DISPPARAMS pDispParams = new DISPPARAMS();
- pDispParams.cArgs = 1;
- pDispParams.rgvarg = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, Variant.sizeof);
- rgvarg.getData(pDispParams.rgvarg);
-
- // add in information for named args
- pDispParams.cNamedArgs = 1;
- pDispParams.rgdispidNamedArgs = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4);
- COM.MoveMemory(pDispParams.rgdispidNamedArgs, new int[] {COM.DISPID_PROPERTYPUT}, 4);
-
- int pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- EXCEPINFO excepInfo = new EXCEPINFO();
- int[] pArgErr = new int[1];
- int dwFlags = COM.DISPATCH_PROPERTYPUT;
- if ((rgvarg.getType() & COM.VT_BYREF) == COM.VT_BYREF)
- dwFlags = COM.DISPATCH_PROPERTYPUTREF;
- int rc = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, dwFlags, pDispParams, pVarResultAddress, excepInfo, pArgErr);
-
- // free the result
- COM.VariantClear(pVarResultAddress);
- OS.GlobalFree(pVarResultAddress);
-
- // free the Dispparams resources
- OS.GlobalFree(pDispParams.rgdispidNamedArgs);
- COM.VariantClear(pDispParams.rgvarg);
- OS.GlobalFree(pDispParams.rgvarg);
-
- // save error string and cleanup EXCEPINFO
- manageExcepinfo(rc, excepInfo);
-
- return (rc == COM.S_OK);
-
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
deleted file mode 100755
index ad36e69e01..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
+++ /dev/null
@@ -1,1346 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-/**
- * OleClientSite provides a site to manage an embedded OLE Document within a container.
- *
- * <p>The OleClientSite provides the following capabilities:
- * <ul>
- * <li>creates the in-place editor for a blank document or opening an existing OLE Document
- * <li>lays the editor out
- * <li>provides a mechanism for activating and deactivating the Document
- * <li>provides a mechanism for saving changes made to the document
- * </ul>
- *
- * <p>This object implements the OLE Interfaces IUnknown, IOleClientSite, IAdviseSink,
- * IOleInPlaceSite
- *
- * <p>Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles</b> <dd>BORDER
- * <dt><b>Events</b> <dd>Dispose, Move, Resize
- * </dl>
- *
- */
-public class OleClientSite extends Composite {
-
- // Interfaces for this Ole Client Container
- private COMObject iUnknown;
- private COMObject iOleClientSite;
- private COMObject iAdviseSink;
- private COMObject iOleInPlaceSite;
-
- protected GUID appClsid;
- private GUID objClsid;
- private int refCount;
-
- // References to the associated Frame.
- protected OleFrame frame;
-
- // Access to the embedded/linked Ole Object
- protected IUnknown objIUnknown;
- protected IOleObject objIOleObject;
- protected IViewObject2 objIViewObject2;
- protected IOleInPlaceObject objIOleInPlaceObject;
- protected IOleCommandTarget objIOleCommandTarget;
-
- // Related storage information
- protected IStorage tempStorage; // IStorage interface of the receiver
-
- // Internal state and style information
- private boolean active; // Track whether the object is in place active
- private int aspect; // the display aspect of the embedded object, e.g., DvaspectContent or DvaspectIcon
- private int type; // Indicates the type of client that can be supported inside this container
- private boolean isStatic; // Indicates item's display is static, i.e., a bitmap, metafile, etc.
-
- private RECT borderWidths = new RECT();
- private RECT indent = new RECT();
- private boolean inUpdate = false;
- private boolean inInit = true;
-
- private static final String WORDPROGID = "Word.Document";
-
- private Listener listener;
-
-protected OleClientSite(Composite parent, int style) {
- // this constructor should never be used by itself because it does
- // not create an Ole Object
-
- super(parent, style);
-
- createCOMInterfaces();
-
- // install the Ole Frame for this Client Site
- while (true) {
- if (parent instanceof OleFrame){
- frame = (OleFrame)parent;
- break;
- }
- parent = parent.getParent();
- if (parent == null) break;
- }
- if (frame == null) OLE.error(SWT.ERROR_INVALID_ARGUMENT);
- frame.AddRef();
-
- active = false;
- aspect = COM.DVASPECT_CONTENT;
- type = COM.OLEEMBEDDED;
- isStatic = false;
-
- listener = new Listener() {
- public void handleEvent(Event e) {
- switch (e.type) {
- case SWT.Resize :
- case SWT.Move :
- onResize(e);
- break;
- case SWT.Dispose :
- onDispose(e);
- break;
- case SWT.FocusIn:
- onFocusIn(e);
- break;
- case SWT.Paint:
- onPaint(e);
- break;
- case SWT.Traverse:
- onTraverse(e);
- break;
- case SWT.KeyDown:
- break;
- default :
- OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
- };
-
- frame.addListener(SWT.Resize, listener);
- frame.addListener(SWT.Move, listener);
- addListener(SWT.Dispose, listener);
- addListener(SWT.FocusIn, listener);
- addListener(SWT.Paint, listener);
- addListener(SWT.Traverse, listener);
- addListener(SWT.KeyDown, listener);
-}
-/**
- * Create an OleClientSite child widget using the OLE Document type associated with the
- * specified file. The OLE Document type is determined either through header information in the file
- * or through a Registry entry for the file extension. Use style bits to select a particular look
- * or set of properties.
- *
- * @param parent a composite widget; must be an OleFrame
- * @param style the bitwise OR'ing of widget styles
- * @param file the file that is to be opened in this OLE Document
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null</ul>
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
- * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
- * <li>ERROR_CANNOT_OPEN_FILE when failed to open file
- * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
- *
- */
-public OleClientSite(Composite parent, int style, File file) {
- this(parent, style);
- try {
-
- if (file == null || file.isDirectory() || !file.exists())
- OLE.error(OLE.ERROR_INVALID_ARGUMENT);
-
- // Is there an associated CLSID?
- appClsid = new GUID();
- char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
- int result = COM.GetClassFile(fileName, appClsid);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
-
- // Open a temporary storage object
- tempStorage = createTempStorage();
-
- // Create ole object with storage object
- int[] address = new int[1];
- result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
-
- objIUnknown = new IUnknown(address[0]);
-
- // Init sinks
- addObjectReferences();
-
- COM.OleRun(objIUnknown.getAddress());
- } catch (SWTException e) {
- disposeCOMInterfaces();
- frame.Release();
- throw e;
- }
-}
-/**
- * Create an OleClientSite child widget to edit a blank document using the specified OLE Document
- * application. Use style bits to select a particular look or set of properties.
- *
- * @param parent a composite widget; must be an OleFrame
- * @param style the bitwise OR'ing of widget styles
- * @param progID the unique program identifier of am OLE Document application;
- * the value of the ProgID key or the value of the VersionIndependentProgID key specified
- * in the registry for the desired OLE Document (for example, the VersionIndependentProgID
- * for Word is Word.Document)
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
- * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
- * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
- * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
- * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
- *
- */
-public OleClientSite(Composite parent, int style, String progId) {
- this(parent, style);
- try {
- appClsid = getClassID(progId);
- if (appClsid == null)
- OLE.error(OLE.ERROR_INVALID_CLASSID);
-
- // Open a temporary storage object
- tempStorage = createTempStorage();
-
- // Create ole object with storage object
- int[] address = new int[1];
- int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
-
- objIUnknown = new IUnknown(address[0]);
-
- // Init sinks
- addObjectReferences();
-
- COM.OleRun(objIUnknown.getAddress());
-
- } catch (SWTException e) {
- disposeCOMInterfaces();
- frame.Release();
- throw e;
- }
-}
-/**
- * @private
- *
- * Create an OleClientSite child widget to edit the specified file using the specified OLE Document
- * application. Use style bits to select a particular look or set of properties.
- *
- * @param parent a composite widget; must be an OleFrame
- * @param style the bitwise OR'ing of widget styles
- * @param progID the unique program identifier of am OLE Document application;
- * the value of the ProgID key or the value of the VersionIndependentProgID key specified
- * in the registry for the desired OLE Document (for example, the VersionIndependentProgID
- * for Word is Word.Document)
- * @param file the file that is to be opened in this OLE Document
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
- * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
- * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
- * <li>ERROR_CANNOT_OPEN_FILE when failed to open file
- * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
- * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
- *
- */
-public OleClientSite(Composite parent, int style, String progId, File file) {
- this(parent, style);
-
- try {
-
- if (file == null || file.isDirectory() || !file.exists())
- OLE.error(OLE.ERROR_INVALID_ARGUMENT);
-
- appClsid = getClassID(progId);
-
- // Are we opening this file with the preferred OLE object?
- char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
- GUID fileClsid = new GUID();
- COM.GetClassFile(fileName, fileClsid);
-
- if (COM.IsEqualGUID(appClsid, fileClsid)){
- // use default mechanism
- // Open a temporary storage object
- tempStorage = createTempStorage();
-
- // Create ole object with storage object
- int[] address = new int[1];
- int result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
-
- objIUnknown = new IUnknown(address[0]);
- } else {
- // use a conversion mechanism
-
- // Word does not follow the standard and does not use "CONTENTS" as the name of
- // its primary stream
- String contentStream = "CONTENTS";
- GUID wordGUID = getClassID(WORDPROGID);
- if (COM.IsEqualGUID(appClsid, wordGUID)) contentStream = "WordDocument";
-
- // Copy over the contents of the file into a new temporary storage object
- OleFile oleFile = new OleFile(file, contentStream, OleFile.READ);
- IStorage storage = oleFile.getRootStorage();
- storage.AddRef();
- // Open a temporary storage object
- tempStorage = createTempStorage();
- // Copy over contents of file
- int result = storage.CopyTo(0, null, null, tempStorage.getAddress());
- storage.Release();
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
- oleFile.dispose();
-
- // create ole client
- int[] ppv = new int[1];
- result = COM.CoCreateInstance(appClsid, 0, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, COM.IIDIUnknown, ppv);
- if (result != COM.S_OK){
- tempStorage.Release();
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
- }
- objIUnknown = new IUnknown(ppv[0]);
-
- // get the persistant storage of the ole client
- ppv = new int[1];
- result = objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv);
- if (result != COM.S_OK){
- tempStorage.Release();
- objIUnknown.Release();
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
- }
- IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
-
- // load the contents of the file into the ole client site
- result = iPersistStorage.Load(tempStorage.getAddress());
- iPersistStorage.Release();
- if (result != COM.S_OK){
- tempStorage.Release();
- tempStorage = null;
- objIUnknown.Release();
- objIUnknown = null;
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
- }
- }
-
- // Init sinks
- addObjectReferences();
-
- COM.OleRun(objIUnknown.getAddress());
- } catch (SWTException e) {
- disposeCOMInterfaces();
- frame.Release();
- throw e;
- }
-}
-private void activateInPlaceClient() {
- if (objIOleInPlaceObject == null) return;
-
- // bring client window to foreground
- int[] phwnd = new int[1];
- if (objIOleInPlaceObject.GetWindow(phwnd) == COM.S_OK) {
- OS.SetWindowPos(phwnd[0], OS.HWND_TOP, 0, 0, 0, 0, OS.SWP_NOSIZE | OS.SWP_NOMOVE);
- }
- frame.setCurrentDocument(this);
-}
-protected void addObjectReferences() {
-
- //
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIPersist, ppvObject) == COM.S_OK) {
- IPersist objIPersist = new IPersist(ppvObject[0]);
- GUID tempid = new GUID();
- if (objIPersist.GetClassID(tempid) == COM.S_OK)
- objClsid = tempid;
- objIPersist.Release();
- }
-
- //
- ppvObject = new int[1];
- int result = objIUnknown.QueryInterface(COM.IIDIViewObject2, ppvObject);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
- objIViewObject2 = new IViewObject2(ppvObject[0]);
- objIViewObject2.SetAdvise(aspect, 0, iAdviseSink.getAddress());
-
- //
- ppvObject = new int[1];
- result = objIUnknown.QueryInterface(COM.IIDIOleObject, ppvObject);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
- objIOleObject = new IOleObject(ppvObject[0]);
- objIOleObject.SetClientSite(iOleClientSite.getAddress());
- int[] pdwConnection = new int[1];
- objIOleObject.Advise(iAdviseSink.getAddress(), pdwConnection);
- objIOleObject.SetHostNames("main", "main");
-
- // Notify the control object that it is embedded in an OLE container
- COM.OleSetContainedObject(objIUnknown.getAddress(), true);
-
- // Is OLE object linked or embedded?
- ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIOleLink, ppvObject) == COM.S_OK) {
- IOleLink objIOleLink = new IOleLink(ppvObject[0]);
- int[] ppmk = new int[1];
- if (objIOleLink.GetSourceMoniker(ppmk) == COM.S_OK) {
- IMoniker objIMoniker = new IMoniker(ppmk[0]);
- objIMoniker.Release();
- type = COM.OLELINKED;
- objIOleLink.BindIfRunning();
- } else {
- isStatic = true;
- }
- objIOleLink.Release();
- }
-}
-protected int AddRef() {
- refCount++;
- return refCount;
-}
-private int CanInPlaceActivate() {
- if (aspect == COM.DVASPECT_CONTENT && type == COM.OLEEMBEDDED)
- return COM.S_OK;
-
- return COM.S_FALSE;
-}
-private int ContextSensitiveHelp(int fEnterMode) {
- return COM.S_OK;
-}
-protected void createCOMInterfaces() {
-
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iOleClientSite = new COMObject(new int[]{2, 0, 0, 0, 3, 1, 0, 1, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return SaveObject();}
- // method4 GetMoniker - not implemented
- public int method5(int[] args) {return GetContainer(args[0]);}
- public int method6(int[] args) {return ShowObject();}
- public int method7(int[] args) {return OnShowWindow(args[0]);}
- // method8 RequestNewObjectLayout - not implemented
- };
-
- iAdviseSink = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return OnDataChange(args[0], args[1]);}
- public int method4(int[] args) {return OnViewChange(args[0], args[1]);}
- //method5 OnRename - not implemented
- public int method6(int[] args) {OnSave();return 0;}
- public int method7(int[] args) {return OnClose();}
- };
-
- iOleInPlaceSite = new COMObject(new int[]{2, 0, 0, 1, 1, 0, 0, 0, 5, 1, 1, 0, 0, 0, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetWindow(args[0]);}
- public int method4(int[] args) {return ContextSensitiveHelp(args[0]);}
- public int method5(int[] args) {return CanInPlaceActivate();}
- public int method6(int[] args) {return OnInPlaceActivate();}
- public int method7(int[] args) {return OnUIActivate();}
- public int method8(int[] args) {return GetWindowContext(args[0], args[1], args[2], args[3], args[4]);}
- public int method9(int[] args) {return Scroll(args[0]);}
- public int method10(int[] args) {return OnUIDeactivate(args[0]);}
- public int method11(int[] args) {return OnInPlaceDeactivate();}
- // method12 DiscardUndoState - not implemented
- // method13 DeactivateAndUndoChange - not implemented
- public int method14(int[] args) {return OnPosRectChange(args[0]);}
- };
-}
-protected IStorage createTempStorage() {
- int[] tempStorage = new int[1];
- int grfMode = COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_DELETEONRELEASE;
- int result = COM.StgCreateDocfile(null, grfMode, 0, tempStorage);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result);
- return new IStorage(tempStorage[0]);
-}
-/**
- * Deactivates an active in-place object and discards the object's undo state.
- */
-public void deactivateInPlaceClient() {
- if (active && objIOleInPlaceObject != null) {
- objIOleInPlaceObject.InPlaceDeactivate();
- }
-}
-private void deleteTempStorage() {
- //Destroy this item's contents in the temp root IStorage.
- if (tempStorage != null){
- tempStorage.Release();
- }
-
- tempStorage = null;
-}
-protected void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iOleClientSite != null)
- iOleClientSite.dispose();
- iOleClientSite = null;
-
- if (iAdviseSink != null)
- iAdviseSink.dispose();
- iAdviseSink = null;
-
- if (iOleInPlaceSite != null)
- iOleInPlaceSite.dispose();
- iOleInPlaceSite = null;
-}
-/**
- * Requests that the OLE Document or ActiveX Control perform an action; actions are almost always
- * changes to the activation state.
- *
- * @param verb the operation that is requested. This is one of the OLE.OLEIVERB_ values
- *
- * @return an HRESULT value indicating the success of the operation request; OLE.S_OK indicates
- * success
- */
-public int doVerb(int verb) {
- if (objIOleObject == null || isStatic)
- return COM.E_FAIL;
- boolean wasActive = active;
-
- int oleobject = objIOleObject.getAddress();
- COM.OleRun(oleobject);
-
- // See PR: 1FV9RZW
- int result = objIOleObject.DoVerb(verb, null, iOleClientSite.getAddress(), 0, handle, null);
-
- if (active) setObjectRects();
-
- // synch up with state of object
- if (wasActive != active){
- if (active) {
- activateInPlaceClient();
- } else {
- deactivateInPlaceClient();
- }
- }
-
- if (active && inInit) {
- updateStorage();
- inInit = false;
- }
- return result;
-}
-/**
- * Asks the OLE Document or ActiveX Control to execute a command from a standard
- * list of commands. The OLE Document or ActiveX Control must support the IOleCommandTarget
- * interface. The OLE Document or ActiveX Control does not have to support all the commands
- * in the standard list. To check if a command is supported, you can call queryStatus with
- * the cmdID.
- *
- * @param cmdID the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
- * commands
- * @param options the optional flags; these are the OLE.OLECMDEXECOPT_ values
- * @param in the argument for the command
- * @param out the return value of the command
- *
- * @return an HRESULT value; OLE.S_OK is returned if successful
- *
- */
-public int exec(int cmdID, int options, Variant in, Variant out) {
-
- if (objIOleCommandTarget == null) {
- int[] address = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
- return OLE.ERROR_INTERFACE_NOT_FOUND;
- objIOleCommandTarget = new IOleCommandTarget(address[0]);
- }
-
- int inAddress = 0;
- if (in != null){
- inAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- in.getData(inAddress);
- }
- int outAddress = 0;
- if (out != null){
- outAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- out.getData(outAddress);
- }
-
- int result = objIOleCommandTarget.Exec(null, cmdID, options, inAddress, outAddress);
-
- if (inAddress != 0){
- COM.VariantClear(inAddress);
- OS.GlobalFree(inAddress);
- }
- if (outAddress != 0) {
- out.setData(outAddress);
- COM.VariantClear(outAddress);
- OS.GlobalFree(outAddress);
- }
-
- return result;
-}
-IDispatch getAutomationObject() {
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIDispatch, ppvObject) != COM.S_OK)
- return null;
- return new IDispatch(ppvObject[0]);
-}
-protected GUID getClassID(String clientName) {
- // create a GUID struct to hold the result
- GUID guid = new GUID();
-
- // create a null terminated array of char
- char[] buffer = null;
- if (clientName != null) {
- int count = clientName.length();
- buffer = new char[count + 1];
- clientName.getChars(0, count, buffer, 0);
- }
- if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){
- int result = COM.CLSIDFromString(buffer, guid);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_INVALID_CLASSID, result);
- }
- return guid;
-}
-private int GetContainer(int ppContainer) {
-
- /* Simple containers that do not support links to their embedded
- objects probably do not need to implement this method. Instead,
- they can return E_NOINTERFACE and set ppContainer to NULL.*/
-
- if (ppContainer != 0)
- COM.MoveMemory(ppContainer, new int[]{0}, 4);
- return COM.E_NOINTERFACE;
-}
-private SIZE getExtent() {
- SIZE sizel = new SIZE();
- // get the current size of the embedded OLENatives object
- if (objIOleObject != null) {
- if ( objIViewObject2 != null && !COM.OleIsRunning(objIOleObject.getAddress())) {
- objIViewObject2.GetExtent(aspect, -1, null, sizel);
- } else {
- objIOleObject.GetExtent(aspect, sizel);
- }
- }
- return xFormHimetricToPixels(sizel);
-}
-public Rectangle getIndent() {
- return new Rectangle(indent.left, indent.right, indent.top, indent.bottom);
-}
-/**
- * Returns the program ID of the OLE Document or ActiveX Control.
- *
- * @return the program ID of the OLE Document or ActiveX Control
- */
-public String getProgramID(){
- if (appClsid != null){
- int[] lplpszProgID = new int[1];
- if (COM.ProgIDFromCLSID(appClsid, lplpszProgID) == COM.S_OK) {
- int length = OS.GlobalSize(lplpszProgID[0]);
- int ptr = OS.GlobalLock(lplpszProgID[0]);
- char[] buffer = new char[length];
- COM.MoveMemory(buffer, lplpszProgID[0], length);
- OS.GlobalUnlock(ptr);
- OS.GlobalFree(lplpszProgID[0]);
-
- String result = new String(buffer);
- // remove null terminator
- int index = result.indexOf("\0");
- return result.substring(0, index);
- }
- }
- return null;
-}
-protected int GetWindow(int phwnd) {
-
- if (phwnd == 0)
- return COM.E_INVALIDARG;
- if (frame == null) {
- COM.MoveMemory(phwnd, new int[] {0}, 4);
- return COM.E_NOTIMPL;
- }
-
- // Copy the Window's handle into the memory passed in
- COM.MoveMemory(phwnd, new int[] {frame.handle}, 4);
- return COM.S_OK;
-}
-private int GetWindowContext(int ppFrame, int ppDoc, int lprcPosRect, int lprcClipRect, int lpFrameInfo) {
-
- if (frame == null || ppFrame == 0)
- return COM.E_NOTIMPL;
-
- // fill in frame handle
- int iOleInPlaceFrame = frame.getIOleInPlaceFrame();
- COM.MoveMemory(ppFrame, new int[] {iOleInPlaceFrame}, 4);
- frame.AddRef();
-
- // null out document handle
- if (ppDoc != 0) {
- COM.MoveMemory(ppDoc, new int[] {0}, 4);
- }
-
- // fill in position and clipping info
- Rectangle clientArea = this.getClientArea();
- Point clientLocation = this.getLocation();
- setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
-
- RECT posRect = new RECT();
- posRect.left = clientLocation.x + indent.left;
- posRect.top = clientLocation.y + indent.top;
- posRect.right = clientLocation.x + clientArea.width - indent.right;
- posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
-
- RECT clipRect = new RECT();
- Rectangle frameArea = frame.getClientArea();
- clipRect.left = frameArea.x;
- clipRect.top = frameArea.y;
- clipRect.right = frameArea.x + frameArea.width;
- clipRect.bottom = frameArea.y + frameArea.height;
-
- if (lprcPosRect != 0) {
- OS.MoveMemory(lprcPosRect, posRect, RECT.sizeof);
- }
- if (lprcClipRect != 0) {
- OS.MoveMemory(lprcClipRect, clipRect, RECT.sizeof);
- }
-
- // get frame info
- OLEINPLACEFRAMEINFO frameInfo = new OLEINPLACEFRAMEINFO();
- frameInfo.cb = OLEINPLACEFRAMEINFO.sizeof;
- frameInfo.fMDIApp = 0;
- frameInfo.hwndFrame = frame.handle;
- Shell shell = getShell();
- Menu menubar = shell.getMenuBar();
- if (menubar != null && !menubar.isDisposed()) {
- int hwnd = shell.handle;
- int cAccel = OS.SendMessage(hwnd, OS.WM_APP, 0, 0);
- if (cAccel != 0) {
- int hAccel = OS.SendMessage(hwnd, OS.WM_APP+1, 0, 0);
- if (hAccel != 0) {
- frameInfo.cAccelEntries = cAccel;
- frameInfo.haccel = hAccel;
- }
- }
- }
- COM.MoveMemory(lpFrameInfo, frameInfo, OLEINPLACEFRAMEINFO.sizeof);
-
- return COM.S_OK;
-}
-public boolean isDirty() {
- // Note: this method must return true unless it is absolutely clear that the
- // contents of the Ole Document do not differ from the contents in the file
- // on the file system.
-
- // Get access to the persistant storage mechanism
- int[] address = new int[1];
- if (objIOleObject.QueryInterface(COM.IIDIPersistFile, address) != COM.S_OK)
- return true;
- IPersistStorage permStorage = new IPersistStorage(address[0]);
- // Are the contents of the permanent storage different from the file?
- int result = permStorage.IsDirty();
- permStorage.Release();
- if (result == COM.S_FALSE) return false;
- return true;
-}
-public boolean isFocusControl () {
- checkWidget ();
- int focusHwnd = OS.GetFocus();
- if (focusHwnd == handle) return true;
- if (objIOleInPlaceObject == null) return false;
- int[] phwnd = new int[1];
- objIOleInPlaceObject.GetWindow(phwnd);
- if (phwnd[0] == 0) return false;
- do {
- if (phwnd[0] == focusHwnd) return true;
- } while ((focusHwnd = OS.GetParent (focusHwnd)) != 0);
- return false;
-}
-private int OnClose() {
- return COM.S_OK;
-}
-private int OnDataChange(int pFormatetc, int pStgmed) {
- return COM.S_OK;
-}
-private void onDispose(Event e) {
-
- doVerb(OLE.OLEIVERB_DISCARDUNDOSTATE);
-
- releaseObjectInterfaces(); // Note, must release object interfaces before releasing frame
- deleteTempStorage();
-
- // remove listeners
- removeListener(SWT.Resize, listener);
- removeListener(SWT.Move, listener);
- removeListener(SWT.Dispose, listener);
- frame.removeListener(SWT.Resize, listener);
- frame.Release();
- frame = null;
-}
-private void onFocusIn(Event e) {
- if (objIOleInPlaceObject == null) return;
- if (isFocusControl()) return;
- int[] phwnd = new int[1];
- objIOleInPlaceObject.GetWindow(phwnd);
- if (phwnd[0] == 0) return;
- OS.SetFocus(phwnd[0]);
-}
-private int OnInPlaceActivate() {
- active = true;
- if (objIOleObject == null)
- return COM.S_OK;
- int[] ppvObject = new int[1];
- if (objIOleObject.QueryInterface(COM.IIDIOleInPlaceObject, ppvObject) == COM.S_OK) {
- objIOleInPlaceObject = new IOleInPlaceObject(ppvObject[0]);
- }
- return COM.S_OK;
-}
-private int OnInPlaceDeactivate() {
-
- if (objIOleInPlaceObject != null)
- objIOleInPlaceObject.Release();
- objIOleInPlaceObject = null;
- active = false;
- return COM.S_OK;
-}
-private int OnPosRectChange(int lprcPosRect) {
-
- setObjectRects();
-
- return COM.S_OK;
-}
-private void onPaint(Event e) {
- if (!active && objIUnknown != null) {
- SIZE size = getExtent();
- Rectangle area = getClientArea();
- RECT rect = new RECT();
- if (getProgramID().startsWith("Excel.Sheet")) {
- rect.left = area.x; rect.right = area.x + (area.height * size.cx / size.cy);
- rect.top = area.y; rect.bottom = area.y + area.height;
- } else {
- rect.left = area.x; rect.right = area.x + size.cx;
- rect.top = area.y; rect.bottom = area.y + size.cy;
- }
-
- int pArea = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, RECT.sizeof);
- OS.MoveMemory(pArea, rect, RECT.sizeof);
- COM.OleDraw(objIUnknown.getAddress(), aspect, e.gc.handle, pArea);
- OS.GlobalFree(pArea);
- }
-}
-private void onResize(Event e) {
- Rectangle area = frame.getClientArea();
- setBounds(borderWidths.left,
- borderWidths.top,
- area.width - borderWidths.left - borderWidths.right,
- area.height - borderWidths.top - borderWidths.bottom);
-
- setObjectRects();
-}
-private void OnSave() {
-}
-private int OnShowWindow(int fShow) {
- boolean wasActive = active;
- active = (fShow != 0);
- if (wasActive != active){
- if (active) {
- activateInPlaceClient();
- } else {
- deactivateInPlaceClient();
- }
- }
- return COM.S_OK;
-}
-private int OnUIActivate() {
- return COM.S_OK;
-}
-private int OnUIDeactivate(int fUndoable) {
-
- // currently, we are ignoring the fUndoable flag
- if (frame == null || frame.isDisposed()) return COM.S_OK;
-
- frame.SetActiveObject(0,0);
-
- Shell shell = getShell();
- Menu menubar = shell.getMenuBar();
- if (menubar == null || menubar.isDisposed())
- return COM.S_OK;
-
- int shellHandle = shell.handle;
- OS.SetMenu(shellHandle, menubar.handle);
- return COM.OleSetMenuDescriptor(0, shellHandle, 0, 0, 0);
-}
-private void onTraverse(Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- case SWT.TRAVERSE_PAGE_NEXT:
- case SWT.TRAVERSE_PAGE_PREVIOUS:
- case SWT.TRAVERSE_MNEMONIC:
- event.doit = true;
- break;
- }
-}
-private int OnViewChange(int dwAspect, int lindex) {
- return COM.S_OK;
-}
-private IStorage openStorage(IStorage storage, String name) {
- int mode = COM.STGM_TRANSACTED | COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE;
- int[] ppStg = new int[1];
- if (storage.OpenStorage(name, 0, mode, null, 0, ppStg) != COM.S_OK) {
- // IStorage does not exist, so create one
- mode = mode | COM.STGM_CREATE;
- if (storage.CreateStorage(name, mode, 0, 0, ppStg) != COM.S_OK)
- return null;
- }
- return new IStorage(ppStg[0]);
-}
-protected int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_NOINTERFACE;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIAdviseSink)) {
- COM.MoveMemory(ppvObject, new int[] {iAdviseSink.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) {
- COM.MoveMemory(ppvObject, new int[] {iOleClientSite.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceSite)) {
- COM.MoveMemory(ppvObject, new int[] {iOleInPlaceSite.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-/**
- * Returns the status of the specified command. The status is any bitwise OR'd combination of
- * SWTOLE.OLECMDF_SUPPORTED, SWTOLE.OLECMDF_ENABLED, SWTOLE.OLECMDF_LATCHED, SWTOLE.OLECMDF_NINCHED.
- * You can query the status of a command before invoking it with OleClientSite.exec. The
- * OLE Document or ActiveX Control must support the IOleCommandTarget to make use of this method.
- *
- * @param cmd the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
- * commands
- *
- * @return the status of the specified command or 0 if unable to query the OLE Object; these are the
- * OLE.OLECMDF_ values
- */
-public int queryStatus(int cmd) {
-
- if (objIOleCommandTarget == null) {
- int[] address = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
- return 0;
- objIOleCommandTarget = new IOleCommandTarget(address[0]);
- }
-
- OLECMD olecmd = new OLECMD();
- olecmd.cmdID = cmd;
-
- int result = objIOleCommandTarget.QueryStatus(null, 1, olecmd, null);
-
- if (result != COM.S_OK) return 0;
-
- return olecmd.cmdf;
-}
-protected int Release() {
- refCount--;
-
- if (refCount == 0) {
- disposeCOMInterfaces();
- }
- return refCount;
-}
-protected void releaseObjectInterfaces() {
-
- if (objIOleInPlaceObject!= null)
- objIOleInPlaceObject.Release();
- objIOleInPlaceObject = null;
-
- if (objIOleObject != null) {
- objIOleObject.Close(COM.OLECLOSE_NOSAVE);
- objIOleObject.Release();
- }
- objIOleObject = null;
-
- if (objIViewObject2 != null) {
- objIViewObject2.SetAdvise(aspect, 0, 0);
- objIViewObject2.Release();
- }
- objIViewObject2 = null;
-
- if (objIOleCommandTarget != null)
- objIOleCommandTarget.Release();
- objIOleCommandTarget = null;
-
- if (objIUnknown != null){
- objIUnknown.Release();
- }
- objIUnknown = null;
-
- COM.CoFreeUnusedLibraries();
-}
-public boolean save(File file, boolean includeOleInfo) {
- if (includeOleInfo)
- return saveToStorageFile(file);
- return saveToTraditionalFile(file);
-}
-private boolean saveFromContents(int address, File file) {
-
- boolean success = false;
-
- IStream tempContents = new IStream(address);
- tempContents.AddRef();
-
- try {
- FileOutputStream writer = new FileOutputStream(file);
-
- int increment = 1024 * 4;
- int pv = COM.CoTaskMemAlloc(increment);
- int[] pcbWritten = new int[1];
- while (tempContents.Read(pv, increment, pcbWritten) == COM.S_OK && pcbWritten[0] > 0) {
- byte[] buffer = new byte[ pcbWritten[0]];
- OS.MoveMemory(buffer, pv, pcbWritten[0]);
- writer.write(buffer); // Note: if file does not exist, this will create the file the
- // first time it is called
- success = true;
- }
- COM.CoTaskMemFree(pv);
-
- writer.close();
-
- } catch (IOException err) {
- }
-
- tempContents.Release();
-
- return success;
-}
-private boolean saveFromOle10Native(int address, File file) {
-
- boolean success = false;
-
- IStream tempContents = new IStream(address);
- tempContents.AddRef();
-
- // The "\1Ole10Native" stream contains a DWORD header whose value is the length
- // of the native data that follows.
- int pv = COM.CoTaskMemAlloc(4);
- int[] size = new int[1];
- int rc = tempContents.Read(pv, 4, null);
- OS.MoveMemory(size, pv, 4);
- COM.CoTaskMemFree(pv);
- if (rc == COM.S_OK && size[0] > 0) {
-
- // Read the data
- byte[] buffer = new byte[size[0]];
- pv = COM.CoTaskMemAlloc(size[0]);
- rc = tempContents.Read(pv, size[0], null);
- OS.MoveMemory(buffer, pv, size[0]);
- COM.CoTaskMemFree(pv);
-
- // open the file and write data into it
- try {
- FileOutputStream writer = new FileOutputStream(file);
- writer.write(buffer); // Note: if file does not exist, this will create the file
- writer.close();
-
- success = true;
- } catch (IOException err) {
- }
- }
- tempContents.Release();
-
- return success;
-}
-private int SaveObject() {
-
- updateStorage();
-
- return COM.S_OK;
-}
-/**
- * Saves the document to the specified file and includes OLE spcific inforrmation. This method
- * must <b>only</b> be used for files that have an OLE Storage format. For example, a word file
- * edited with Word.Document should be saved using this method because there is formating information
- * that should be stored in the OLE specific Storage format.
- *
- * @param file the file to which the changes are to be saved
- *
- * @return true if the save was successful
- */
-private boolean saveToStorageFile(File file) {
- // Note: if the file already exists, some applications will not overwrite the file
- // In these cases, you should delete the file first (probably save the contents of the file in case the
- // save fails)
- if (file == null || file.isDirectory())
- return false;
-
- if (!updateStorage())
- return false;
-
- // get access to the persistant storage mechanism
- int[] address = new int[1];
- if (objIOleObject.QueryInterface(COM.IIDIPersistStorage, address) != COM.S_OK)
- return false;
- IPersistStorage permStorage = new IPersistStorage(address[0]);
-
- // The file will be saved using the formating of the current application - this
- // may not be the format of the application that was originally used to create the file
- // e.g. if an Excel file is opened in Word, the Word application will save the file in the
- // Word format
-
- boolean success = false;
- OleFile oleFile = new OleFile(file, null, OleFile.WRITE);
- IStorage storage = oleFile.getRootStorage();
- storage.AddRef();
- if (COM.OleSave(permStorage.getAddress(), storage.getAddress(), false) == COM.S_OK) {
- if (storage.Commit(COM.STGC_DEFAULT) == COM.S_OK)
- success = true;
- }
- storage.Release();
- oleFile.dispose();
- permStorage.Release();
-
- return success;
-}
-/**
- * Saves the document to the specified file. This method must be used for
- * files that do not have an OLE Storage format. For example, a bitmap file edited with MSPaint
- * should be saved using this method because bitmap is a standard format that does not include any
- * OLE specific data.
- *
- * @param file the file to which the changes are to be saved
- *
- * @return true if the save was successful
- */
-private boolean saveToTraditionalFile(File file) {
- // Note: if the file already exists, some applications will not overwrite the file
- // In these cases, you should delete the file first (probably save the contents of the file in case the
- // save fails)
- if (file == null || file.isDirectory())
- return false;
- if (!updateStorage())
- return false;
-
- int[] address = new int[1];
- // Look for a CONTENTS stream
- if (tempStorage.OpenStream("CONTENTS", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
- return saveFromContents(address[0], file);
-
- // Look for Ole 1.0 object stream
- if (tempStorage.OpenStream("\1Ole10Native", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
- return saveFromOle10Native(address[0], file);
-
- return false;
-}
-private int Scroll(int scrollExtant) {
- return COM.S_OK;
-}
-void setBorderSpace(RECT newBorderwidth) {
- borderWidths = newBorderwidth;
-
- // readjust size and location of client site
- Rectangle area = frame.getClientArea();
- setBounds(borderWidths.left, borderWidths.top,
- area.width - borderWidths.left - borderWidths.right,
- area.height - borderWidths.top - borderWidths.bottom);
-
- setObjectRects();
-}
-private void setExtent(int width, int height){
- // Resize the width and height of the embedded/linked OLENatives object
- // to the specified values.
-
- if (objIOleObject == null || isStatic) return;
-
- if (inUpdate) return;
-
- SIZE currentExtent = getExtent();
- if (width == currentExtent.cx && height == currentExtent.cy) return;
-
- SIZE newExtent = new SIZE();
- newExtent.cx = width; newExtent.cy = height;
- newExtent = xFormPixelsToHimetric(newExtent);
-
- // Get the server running first, then do a SetExtent, then show it
- boolean alreadyRunning = COM.OleIsRunning(objIOleObject.getAddress());
- if (!alreadyRunning)
- COM.OleRun(objIOleObject.getAddress());
-
- if (objIOleObject.SetExtent(aspect, newExtent) == COM.S_OK){
- inUpdate = true;
- objIOleObject.Update();
- inUpdate = false;
- if (!alreadyRunning)
- // Close server if it wasn't already running upon entering this method.
- objIOleObject.Close(COM.OLECLOSE_SAVEIFDIRTY);
- }
-
-}
-public void setIndent(Rectangle newIndent) {
- indent = new RECT();
- indent.left = newIndent.x;
- indent.right = newIndent.width;
- indent.top = newIndent.y;
- indent.bottom = newIndent.height;
-}
-private void setObjectRects() {
-
- if (objIOleInPlaceObject == null) return;
-
- // size the object to fill the available space
- // leave a border
- Rectangle clientArea = this.getClientArea();
- Point clientLocation = this.getLocation();
- setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
-
- RECT posRect = new RECT();
- posRect.left = clientLocation.x + indent.left;
- posRect.top = clientLocation.y + indent.top;
- posRect.right = clientLocation.x + clientArea.width - indent.right;
- posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
-
- RECT clipRect = new RECT();
- Rectangle frameArea = frame.getClientArea();
- clipRect.left = frameArea.x;
- clipRect.top = frameArea.y;
- clipRect.right = frameArea.x + frameArea.width;
- clipRect.bottom = frameArea.y + frameArea.height;
-
- objIOleInPlaceObject.SetObjectRects(posRect, clipRect);
-
-}
-
-private int ShowObject() {
- /* Tells the container to position the object so it is visible to
- * the user. This method ensures that the container itself is
- * visible and not minimized.
- */
- return COM.S_OK;
-}
-/**
- * Displays a dialog with the property information for this OLE Object. The OLE Document or
- * ActiveX Control must support the ISpecifyPropertyPages interface.
- *
- * @param title the name that will appear in the titlebar of the dialog
- */
-public void showProperties(String title) {
-
- // Get the Property Page information from the OLE Object
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDISpecifyPropertyPages, ppvObject) != COM.S_OK) return;
- ISpecifyPropertyPages objISPP = new ISpecifyPropertyPages(ppvObject[0]);
- CAUUID caGUID = new CAUUID();
- int result = objISPP.GetPages(caGUID);
- objISPP.Release();
- if (result != COM.S_OK) return;
-
- // create a frame in which to display the pages
- char[] chTitle = null;
- if (title != null) {
- chTitle = new char[title.length()];
- title.getChars(0, title.length(), chTitle, 0);
- }
- result = COM.OleCreatePropertyFrame(frame.handle, 10, 10, chTitle, 1, new int[] {objIUnknown.getAddress()}, caGUID.cElems, caGUID.pElems, COM.LOCALE_USER_DEFAULT, 0, 0);
-
- // free the property page information
- COM.CoTaskMemFree(caGUID.pElems);
-}
-private boolean updateStorage() {
-
- if (tempStorage == null) return false;
-
- int[] ppv = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv) != COM.S_OK) return false;
- IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
-
- int result = COM.OleSave(iPersistStorage.getAddress(), tempStorage.getAddress(), true);
-
- if (result != COM.S_OK){
- // OleSave will fail for static objects, so do what OleSave does.
- COM.WriteClassStg(tempStorage.getAddress(), objClsid);
- result = iPersistStorage.Save(tempStorage.getAddress(), true);
- }
-
- tempStorage.Commit(COM.STGC_DEFAULT);
- result = iPersistStorage.SaveCompleted(0);
- iPersistStorage.Release();
-
- return true;
-}
-private SIZE xFormHimetricToPixels(SIZE aSize) {
- // Return a new Size which is the pixel transformation of a
- // size in HIMETRIC units.
-
- int hDC = OS.GetDC(0);
- int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
- int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
- OS.ReleaseDC(0, hDC);
- int cx = Compatibility.round(aSize.cx * xppi, 2540); // 2540 HIMETRIC units per inch
- int cy = Compatibility.round(aSize.cy * yppi, 2540);
- SIZE size = new SIZE();
- size.cx = cx;
- size.cy = cy;
- return size;
-}
-private SIZE xFormPixelsToHimetric(SIZE aSize) {
- // Return a new size which is the HIMETRIC transformation of a
- // size in pixel units.
-
- int hDC = OS.GetDC(0);
- int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
- int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
- OS.ReleaseDC(0, hDC);
- int cx = Compatibility.round(aSize.cx * 2540, xppi); // 2540 HIMETRIC units per inch
- int cy = Compatibility.round(aSize.cy * 2540, yppi);
- SIZE size = new SIZE();
- size.cx = cx;
- size.cy = cy;
- return size;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
deleted file mode 100755
index b2d2104a43..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
+++ /dev/null
@@ -1,513 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * OleControlSite provides a site to manage an embedded ActiveX Control within a container.
- *
- * <p>In addition to the behaviour provided by OleClientSite, this object provides the following:
- * <ul>
- * <li>events from the ActiveX control
- * <li>notification of property changes from the ActiveX control
- * <li>simplified access to well known properties of the ActiveX Control (e.g. font, background color)
- * <li>expose ambient properties of the container to the ActiveX Control
- * </ul>
- *
- * <p>This object implements the OLE Interfaces IOleControlSite, IDispatch, and IPropertyNotifySink.
- *
- * <p>Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles</b> <dd>BORDER
- * <dt><b>Events</b> <dd>Dispose, Move, Resize
- * </dl>
- *
- */
-public class OleControlSite extends OleClientSite
-{
- // interfaces for this container
- private COMObject iOleControlSite;
- private COMObject iDispatch;
-
- // supporting Property Change attributes
- private OlePropertyChangeSink olePropertyChangeSink;
-
- // supporting Event Sink attributes
- private OleEventSink oleEventSink;
-
- // supporting information for the Control COM object
- private CONTROLINFO currentControlInfo;
- private String licenseInfo;
-
-/**
- * Create an OleControlSite child widget using style bits
- * to select a particular look or set of properties.
- *
- * @param parent a composite widget; must be an OleFrame
- * @param style the bitwise OR'ing of widget styles
- * @param progID the unique program identifier which has been registered for this ActiveX Control;
- * the value of the ProgID key or the value of the VersionIndependentProgID key specified
- * in the registry for this Control (for example, the VersionIndependentProgID for
- * Internet Explorer is Shell.Explorer)
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
- * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
- * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
- * <li>ERROR_CANNOT_ACCESS_CLASSFACTORY when Class Factory could not be found
- * <li>ERROR_CANNOT_CREATE_LICENSED_OBJECT when failed to create a licensed OLE Object
- * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
- *
- */
-public OleControlSite(Composite parent, int style, String progId) {
- super(parent, style);
-
- createCOMInterfaces();
-
- // check for licensing
- appClsid = getClassID(progId);
- if (appClsid == null) OLE.error(OLE.ERROR_INVALID_CLASSID);
-
- int licinfo = getLicenseInfo(appClsid);
- if (licinfo == 0) {
-
- // Open a storage object
- tempStorage = createTempStorage();
-
- // Create ole object with storage object
- int[] address = new int[1];
- int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
-
- objIUnknown = new IUnknown(address[0]);
-
- } else {
- // Prepare the ClassFactory
- int[] ppvObject = new int[1];
- try {
- int result = COM.CoGetClassObject(appClsid, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, 0, COM.IIDIClassFactory2, ppvObject);
- if (result != COM.S_OK) {
- OLE.error(OLE.ERROR_CANNOT_ACCESS_CLASSFACTORY, result);
- }
- IClassFactory2 classFactory = new IClassFactory2(ppvObject[0]);
- // Create Com Object
- ppvObject = new int[1];
- result = classFactory.CreateInstanceLic(0, 0, COM.IIDIUnknown, licinfo, ppvObject);
- classFactory.Release();
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_LICENSED_OBJECT, result);
- } finally {
- COM.SysFreeString(licinfo);
- }
-
- objIUnknown = new IUnknown(ppvObject[0]);
-
- // Prepare a storage medium
- ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppvObject) == COM.S_OK) {
- IPersistStorage persist = new IPersistStorage(ppvObject[0]);
- tempStorage = createTempStorage();
- persist.InitNew(tempStorage.getAddress());
- persist.Release();
- }
- }
-
- // Init sinks
- try {
- addObjectReferences();
- } catch (SWTError e) {
- disposeCOMInterfaces();
- frame.Release();
- throw e;
- }
-
- COM.OleRun(objIUnknown.getAddress());
-}
-/**
- * Adds the listener to receive events.
- *
- * @param eventID the id of the event
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addEventListener(int eventID, OleListener listener) {
- if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- oleEventSink.addListener(eventID, listener);
-}
-protected void addObjectReferences() {
-
- super.addObjectReferences();
-
- // Get event notification from control
- connectEventSink();
- // Get property change notification from control
- connectPropertyChangeSink();
-
- // Get access to the Control object
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIOleControl, ppvObject) == COM.S_OK) {
- IOleControl objIOleControl = new IOleControl(ppvObject[0]);
- // ask the control for its info in case users
- // need to act on it
- currentControlInfo = new CONTROLINFO();
- objIOleControl.GetControlInfo(currentControlInfo);
- objIOleControl.Release();
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param propertyID the identifier of the property
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addPropertyListener(int propertyID, OleListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- olePropertyChangeSink.addListener(propertyID, listener);
-}
-private void connectEventSink() {
- oleEventSink = new OleEventSink(this);
- oleEventSink.AddRef();
- oleEventSink.connect(objIUnknown);
-}
-private void connectPropertyChangeSink() {
- olePropertyChangeSink = new OlePropertyChangeSink(this);
- olePropertyChangeSink.AddRef();
- olePropertyChangeSink.connect(objIUnknown);
-}
-protected void createCOMInterfaces () {
- super.createCOMInterfaces();
-
- // register each of the interfaces that this object implements
- iOleControlSite = new COMObject(new int[]{2, 0, 0, 0, 1, 1, 3, 2, 1, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return OnControlInfoChanged();}
- // method4 LockInPlaceActive - not implemented
- // method5 GetExtendedControl - not implemented
- // method6 TransformCoords - not implemented
- // method7 Translate Accelerator - not implemented
- public int method8(int[] args) {return OnFocus(args[0]);}
- // method9 ShowPropertyFrame - not implemented
- };
-
- iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 5, 8}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- // method3 GetTypeInfoCount - not implemented
- // method4 GetTypeInfo - not implemented
- // method5 GetIDsOfNames - not implemented
- public int method6(int[] args) {return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
- };
-}
-private void disconnectEventSink() {
-
- if (oleEventSink != null) {
- oleEventSink.disconnect(objIUnknown);
- oleEventSink.Release();
- }
- oleEventSink = null;
-}
-private void disconnectPropertyChangeSink() {
-
- if (olePropertyChangeSink != null) {
- olePropertyChangeSink.disconnect(objIUnknown);
- olePropertyChangeSink.Release();
- }
- olePropertyChangeSink = null;
-}
-protected void disposeCOMInterfaces() {
- super.disposeCOMInterfaces();
-
- if (iOleControlSite != null)
- iOleControlSite.dispose();
- iOleControlSite = null;
-
- if (iDispatch != null)
- iDispatch.dispose();
- iDispatch = null;
-}
-public Color getBackground () {
-
- if (objIUnknown != null) {
- // !! We are getting the OLE_COLOR - should we change this to the COLORREF value?
- OleAutomation oleObject= new OleAutomation(this);
- Variant varBackColor = oleObject.getProperty(COM.DISPID_BACKCOLOR);
- oleObject.dispose();
-
- if (varBackColor != null){
- int[] colorRef = new int[1];
- if (COM.OleTranslateColor(varBackColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
- return Color.win32_new(getDisplay(), colorRef[0]);
- }
- }
-
- return super.getBackground();
-}
-public Font getFont () {
-
- if (objIUnknown != null) {
- OleAutomation oleObject= new OleAutomation(this);
- Variant varDispFont = oleObject.getProperty(COM.DISPID_FONT);
- oleObject.dispose();
-
- if (varDispFont != null){
- OleAutomation iDispFont = varDispFont.getAutomation();
- Variant lfFaceName = iDispFont.getProperty(COM.DISPID_FONT_NAME);
- Variant lfHeight = iDispFont.getProperty(COM.DISPID_FONT_SIZE);
- Variant lfItalic = iDispFont.getProperty(COM.DISPID_FONT_ITALIC);
- //Variant lfCharSet = iDispFont.getProperty(COM.DISPID_FONT_CHARSET);
- Variant lfBold = iDispFont.getProperty(COM.DISPID_FONT_BOLD);
- iDispFont.dispose();
-
- if (lfFaceName != null &&
- lfHeight != null &&
- lfItalic != null &&
- lfBold != null){
- int style = 3 * lfBold.getInt() + 2 * lfItalic.getInt();
- Font font = new Font(getShell().getDisplay(), lfFaceName.getString(), lfHeight.getInt(), style);
- return font;
- }
- }
- }
-
- return super.getFont();
-}
-public Color getForeground () {
-
- if (objIUnknown != null) {
- // !! We are getting the OLE_COLOR - should we change this to the COLORREF value?
- OleAutomation oleObject= new OleAutomation(this);
- Variant varForeColor = oleObject.getProperty(COM.DISPID_FORECOLOR);
- oleObject.dispose();
-
- if (varForeColor != null){
- int[] colorRef = new int[1];
- if (COM.OleTranslateColor(varForeColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
- return Color.win32_new(getDisplay(), colorRef[0]);
- }
- }
-
- return super.getForeground();
-}
-protected int getLicenseInfo(GUID clsid) {
- int[] ppvObject = new int[1];
-
- if (COM.CoGetClassObject(clsid, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, 0, COM.IIDIClassFactory2, ppvObject) != COM.S_OK) {
- return 0;
- }
- IClassFactory2 classFactory = new IClassFactory2(ppvObject[0]);
- LICINFO licinfo = new LICINFO();
- if (classFactory.GetLicInfo(licinfo) != COM.S_OK) {
- classFactory.Release();
- return 0;
- }
- int[] pBstrKey = new int[1];
- if (licinfo != null && licinfo.fRuntimeKeyAvail != 0) {
- if (classFactory.RequestLicKey(0, pBstrKey) == COM.S_OK) {
- classFactory.Release();
- return pBstrKey[0];
- }
- }
- classFactory.Release();
- return 0;
-}
-protected int GetWindow(int phwnd) {
-
- if (phwnd == 0)
- return COM.E_INVALIDARG;
- if (frame == null) {
- COM.MoveMemory(phwnd, new int[] {0}, 4);
- return COM.E_NOTIMPL;
- }
-
- // Copy the Window's handle into the memory passed in
- COM.MoveMemory(phwnd, new int[] {handle}, 4);
- return COM.S_OK;
-}
-private int Invoke(int dispIdMember, int riid, int lcid, int dwFlags, int pDispParams, int pVarResult, int pExcepInfo, int pArgErr) {
- if (pVarResult == 0 || dwFlags != COM.DISPATCH_PROPERTYGET) {
- if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
- if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
- return COM.DISP_E_MEMBERNOTFOUND;
- }
- switch (dispIdMember) {
- case COM.DISPID_AMBIENT_USERMODE :
- Variant usermode = new Variant(true);
- if (pVarResult != 0) usermode.getData(pVarResult);
- return COM.S_OK;
-
- case COM.DISPID_AMBIENT_UIDEAD :
- Variant uidead = new Variant(false);
- if (pVarResult != 0) uidead.getData(pVarResult);
- return COM.S_OK;
-
- // indicate a false result
- case COM.DISPID_AMBIENT_SUPPORTSMNEMONICS :
- case COM.DISPID_AMBIENT_SHOWGRABHANDLES :
- case COM.DISPID_AMBIENT_SHOWHATCHING :
- if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
- if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
- if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
- return COM.S_FALSE;
-
- // not implemented
- case COM.DISPID_AMBIENT_OFFLINEIFNOTCONNECTED :
- case COM.DISPID_AMBIENT_BACKCOLOR :
- case COM.DISPID_AMBIENT_FORECOLOR :
- case COM.DISPID_AMBIENT_FONT :
- case COM.DISPID_AMBIENT_LOCALEID :
- case COM.DISPID_AMBIENT_SILENT :
- case COM.DISPID_AMBIENT_MESSAGEREFLECT :
- if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
- if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
- if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
- return COM.E_NOTIMPL;
-
- default :
- if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
- if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
- if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
- return COM.DISP_E_MEMBERNOTFOUND;
- }
-}
-private int OnControlInfoChanged() {
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIOleControl, ppvObject) == COM.S_OK) {
- IOleControl objIOleControl = new IOleControl(ppvObject[0]);
- // ask the control for its info in case users
- // need to act on it
- currentControlInfo = new CONTROLINFO();
- objIOleControl.GetControlInfo(currentControlInfo);
- objIOleControl.Release();
- }
- return COM.S_OK;
-}
-private int OnFocus(int fGotFocus) {
- return COM.S_OK;
-}
-protected int OnUIDeactivate(int fUndoable) {
- // controls don't need to do anything for
- // border space or menubars
- return COM.S_OK;
-}
-protected int QueryInterface(int riid, int ppvObject) {
- int result = super.QueryInterface(riid, ppvObject);
- if (result == COM.S_OK)
- return result;
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIOleControlSite)) {
- COM.MoveMemory(ppvObject, new int[] {iOleControlSite.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) {
- COM.MoveMemory(ppvObject, new int[] {iDispatch.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-protected void releaseObjectInterfaces() {
-
- disconnectEventSink();
-
- disconnectPropertyChangeSink();
-
- super.releaseObjectInterfaces();
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeEventListener(int eventID, OleListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- oleEventSink.removeListener(eventID, listener);
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removePropertyListener(int propertyID, OleListener listener) {
- if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
- olePropertyChangeSink.removeListener(propertyID, listener);
-}
-public void setBackground (Color color) {
-
- super.setBackground(color);
-
- //set the background of the ActiveX Control
- if (objIUnknown != null) {
- OleAutomation oleObject= new OleAutomation(this);
- oleObject.setProperty(COM.DISPID_BACKCOLOR, new Variant(color.handle));
- oleObject.dispose();
- }
-}
-public void setFont (Font font) {
-
- super.setFont(font);
-
- //set the font of the ActiveX Control
- if (objIUnknown != null) {
-
- OleAutomation oleObject= new OleAutomation(this);
- Variant varDispFont = oleObject.getProperty(COM.DISPID_FONT);
- oleObject.dispose();
-
- if (varDispFont != null){
- OleAutomation iDispFont = varDispFont.getAutomation();
- FontData[] fdata = font.getFontData();
- iDispFont.setProperty(COM.DISPID_FONT_NAME, new Variant(fdata[0].getName()));
- iDispFont.setProperty(COM.DISPID_FONT_SIZE, new Variant(fdata[0].getHeight()));
- iDispFont.setProperty(COM.DISPID_FONT_ITALIC, new Variant(fdata[0].getStyle() & SWT.ITALIC));
- //iDispFont.setProperty(COM.DISPID_FONT_CHARSET, new Variant(fdata[0].getCharset));
- iDispFont.setProperty(COM.DISPID_FONT_BOLD, new Variant((fdata[0].getStyle() & SWT.BOLD)));
- iDispFont.dispose();
- }
- }
-
- return;
-}
-public void setForeground (Color color) {
-
- super.setForeground(color);
-
- //set the foreground of the ActiveX Control
- if (objIUnknown != null) {
- OleAutomation oleObject= new OleAutomation(this);
- oleObject.setProperty(COM.DISPID_FORECOLOR, new Variant(color.handle));
- oleObject.dispose();
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java
deleted file mode 100755
index 0b9fe629e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Widget;
-
-public class OleEvent {
- public int type;
- public Widget widget;
- public int detail;
- public boolean doit = true;
- public Variant[] arguments;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java
deleted file mode 100755
index 5a8ce28281..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.*;
-
-final class OleEventSink
-{
- private OleControlSite controlSite;
-
- private COMObject iUnknown;
- private COMObject iDispatch;
- private int refCount;
-
- private int eventCookie;
- private GUID eventSinkDispInterface;
-
- private OleEventTable eventTable;
-
-OleEventSink(OleControlSite controlSite) {
-
- this.controlSite = controlSite;
-
- createCOMInterfaces();
-}
-void addListener(int eventID, OleListener listener) {
- if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new OleEventTable ();
- eventTable.hook(eventID, listener);
-}
-int AddRef() {
- refCount++;
- return refCount;
-}
-void connect(IUnknown objIUnknown) {
-
- // What is the custom Event Sink interface?
- eventSinkDispInterface = getEventSinkDispInterface(objIUnknown);
-
- // It is possible that the Control does not have an Event sink.
- // In this case, just carry on.
- if (eventSinkDispInterface == null) return;
-
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
- IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
- int[] ppCP = new int[1];
- if (cpc.FindConnectionPoint(eventSinkDispInterface, ppCP) == COM.S_OK) {
- IConnectionPoint cp = new IConnectionPoint(ppCP[0]);
- int[] pCookie = new int[1];
- if (cp.Advise(iUnknown.getAddress(), pCookie) == COM.S_OK)
- eventCookie = pCookie[0];
- cp.Release();
- }
- cpc.Release();
- }
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
- iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 4, 8}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- // method3 GetTypeInfoCount - not implemented
- // method4 GetTypeInfo - not implemented
- // method5 GetIDsOfNames - not implemented
- public int method6(int[] args) {return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
- };
-}
-void disconnect(IUnknown objIUnknown) {
-
- // disconnect event sink
- if (eventCookie != 0 && objIUnknown != null) {
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
- IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
- if (cpc.FindConnectionPoint(eventSinkDispInterface, ppvObject) == COM.S_OK) {
- IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
- if (cp.Unadvise(eventCookie) == COM.S_OK) {
- eventCookie = 0;
- }
- cp.Release();
- }
- cpc.Release();
- }
- }
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null);
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDispatch != null)
- iDispatch.dispose();
- iDispatch = null;
-
-}
-private GUID getEventSinkDispInterface(IUnknown objIUnknown) {
-
- // get Event Sink I/F from IProvideClassInfo2
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIProvideClassInfo2, ppvObject) == COM.S_OK) {
- IProvideClassInfo2 pci2 = new IProvideClassInfo2(ppvObject[0]);
- GUID eventsinkdisp = new GUID();
- int result = pci2.GetGUID(COM.GUIDKIND_DEFAULT_SOURCE_DISP_IID, eventsinkdisp);
- pci2.Release();
- if (result == COM.S_OK) {
- eventSinkDispInterface = eventsinkdisp;
- return eventSinkDispInterface;
- }
-
- }
-
- // get Event Sink I/F from IProvideClassInfo
- if (objIUnknown.QueryInterface(COM.IIDIProvideClassInfo, ppvObject) == COM.S_OK) {
- int[] ppTI = new int[1];
- int[] ppEI = new int[1];
- TYPEATTR typeAttribute = null;
- IProvideClassInfo pci = new IProvideClassInfo(ppvObject[0]);
- int result = pci.GetClassInfo(ppTI);
- pci.Release();
- if (result != COM.S_OK) return null;
-
- if (ppTI != null && ppTI.length == 1) {
- ITypeInfo classInfo = new ITypeInfo(ppTI[0]);
- int[] ppTypeAttr = new int[1];
- result = classInfo.GetTypeAttr(ppTypeAttr);
- if (result != COM.S_OK) {
- classInfo.Release();
- return null;
- }
- typeAttribute = new TYPEATTR();
- COM.MoveMemory(typeAttribute, ppTypeAttr[0], TYPEATTR.sizeof);
- classInfo.ReleaseTypeAttr(ppTypeAttr[0]);
- int implMask = COM.IMPLTYPEFLAG_FDEFAULT | COM.IMPLTYPEFLAG_FSOURCE | COM.IMPLTYPEFLAG_FRESTRICTED;
- int implBits = COM.IMPLTYPEFLAG_FDEFAULT | COM.IMPLTYPEFLAG_FSOURCE;
- for (int i = 0; i < typeAttribute.cImplTypes; i++) {
- int[] pImplTypeFlags = new int[1];
- if (classInfo.GetImplTypeFlags(i, pImplTypeFlags) == COM.S_OK) {
- if ((pImplTypeFlags[0] & implMask) == implBits) {
- int[] pRefType = new int[1];
- if (classInfo.GetRefTypeOfImplType(i, pRefType) == COM.S_OK) {
- classInfo.GetRefTypeInfo(pRefType[0], ppEI);
- }
- }
- }
- }
- classInfo.Release();
-
- //
- if (ppEI != null && ppEI.length == 1) {
- ppTypeAttr = new int[1];
- ITypeInfo eventInfo = new ITypeInfo(ppEI[0]);
- if (eventInfo.GetTypeAttr(ppTypeAttr) == COM.S_OK) {
- typeAttribute = new TYPEATTR();
- COM.MoveMemory(typeAttribute, ppTypeAttr[0], TYPEATTR.sizeof);
- eventInfo.ReleaseTypeAttr(ppTypeAttr[0]);
- if (ppTypeAttr != null && ppTypeAttr[0] != 0) {
- eventSinkDispInterface = new GUID();
- eventSinkDispInterface.data1 = typeAttribute.guid_data1;
- eventSinkDispInterface.data2 = typeAttribute.guid_data2;
- eventSinkDispInterface.data3 = typeAttribute.guid_data3;
- eventSinkDispInterface.b0 = typeAttribute.guid_b0;
- eventSinkDispInterface.b1 = typeAttribute.guid_b1;
- eventSinkDispInterface.b2 = typeAttribute.guid_b2;
- eventSinkDispInterface.b3 = typeAttribute.guid_b3;
- eventSinkDispInterface.b4 = typeAttribute.guid_b4;
- eventSinkDispInterface.b5 = typeAttribute.guid_b5;
- eventSinkDispInterface.b6 = typeAttribute.guid_b6;
- eventSinkDispInterface.b7 = typeAttribute.guid_b7;
- }
- }
- eventInfo.Release();
- }
- }
- }
- return eventSinkDispInterface;
-}
-private int Invoke(int dispIdMember, int riid, int lcid, int dwFlags, int pDispParams, int pVarResult, int pExcepInfo, int pArgErr)
-{
- if (eventTable == null || !eventTable.hooks(dispIdMember)) return COM.S_OK;
-
- // Construct an array of the parameters that are passed in
- // Note: parameters are passed in reverse order - here we will correct the order
- Variant[] eventInfo = null;
- if (pDispParams != 0) {
- DISPPARAMS dispParams = new DISPPARAMS();
- COM.MoveMemory(dispParams, pDispParams, DISPPARAMS.sizeof);
- eventInfo = new Variant[dispParams.cArgs];
- int size = Variant.sizeof;
- int offset = (dispParams.cArgs - 1) * size;
-
- for (int j = 0; j < dispParams.cArgs; j++){
- eventInfo[j] = new Variant();
- eventInfo[j].setData(dispParams.rgvarg + offset);
- offset = offset - size;
- }
- }
-
- OleEvent event = new OleEvent();
- event.arguments = eventInfo;
- notifyListener(dispIdMember,event);
-
- return COM.S_OK;
-}
-/**
-* Notify listeners of an event.
-* <p>
-* This method notifies all listeners that an event
-* has occurred.
-*
-* @param eventType the desired SWT event
-* @param event the event data
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_NULL_ARGUMENT when handler is null</li>
-* </ul>
-*/
-private void notifyListener (int eventType, OleEvent event) {
- if (event == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = controlSite;
- eventTable.sendEvent (event);
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if ( COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) ||
- COM.IsEqualGUID(guid, eventSinkDispInterface)) {
- COM.MoveMemory(ppvObject, new int[] {iDispatch.getAddress()}, 4);
- AddRef();
- return OLE.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- }
-
- return refCount;
-}
-void removeListener(int eventID, OleListener listener) {
- if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventID, listener);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java
deleted file mode 100755
index aee23f6ce1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
-* The OleEventTable class implements a simple
-* look up mechanism that maps an event type
-* to a listener. Muliple listeners for the
-* same event type are supported.
-*
-*/
-
-class OleEventTable {
- int [] types;
- OleListener [] handlers;
-void hook (int eventType, OleListener handler) {
- if (types == null) types = new int [4];
- if (handlers == null) handlers = new OleListener [4];
- for (int i=0; i<types.length; i++) {
- if (types [i] == 0) {
- types [i] = eventType;
- handlers [i] = handler;
- return;
- }
- }
- int size = types.length;
- int [] newTypes = new int [size + 4];
- OleListener [] newHandlers = new OleListener [size + 4];
- System.arraycopy (types, 0, newTypes, 0, size);
- System.arraycopy (handlers, 0, newHandlers, 0, size);
- types = newTypes; handlers = newHandlers;
- types [size] = eventType; handlers [size] = handler;
-}
-boolean hooks (int eventType) {
- if (handlers == null) return false;
- for (int i=0; i<types.length; i++) {
- if (types [i] == eventType) return true;
- }
- return false;
-}
-void sendEvent (OleEvent event) {
- if (handlers == null) return;
- for (int i=0; i<types.length; i++) {
- if (types [i] == event.type) {
- OleListener listener = handlers [i];
- if (listener != null) listener.handleEvent (event);
- }
- }
-}
-void unhook (int eventType, OleListener handler) {
- if (handlers == null) return;
- for (int i=0; i<types.length; i++) {
- if ((types [i] == eventType) && (handlers [i] == handler)) {
- types [i] = 0;
- handlers [i] = null;
- return;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java
deleted file mode 100755
index 5691c8859c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-
-final class OleFile {
- IStorage rootStorage;
- File file;
- String streamName;
-
- static int READ = 0;
- static int WRITE = 1;
-OleFile(File file, String streamName, int mode) {
- if (file == null || file.isDirectory())
- OLE.error(OLE.ERROR_INVALID_ARGUMENT);
-
- this.file = file;
- this.streamName = streamName;
-
- if (mode == READ)
- openForRead();
- if (mode == WRITE)
- openForWrite();
-}
-void dispose() {
-
- rootStorage.Release();
- rootStorage = null;
- file = null;
- streamName = null;
-}
-IStorage getRootStorage() {
- return rootStorage;
-}
-private void openForRead() {
-
- if (!file.exists()) return;
-
- char[] path = (file.getAbsolutePath()+"\0").toCharArray();
- if (COM.StgIsStorageFile(path) == COM.S_OK) {
- readStorageFile(path);
- } else {
- readTraditionalFile(path);
- }
-
-}
-private void openForWrite() {
- char[] filePath = (file.getAbsolutePath()+"\0").toCharArray();
- int[] address = new int[1];
- int mode = COM.STGM_TRANSACTED | COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_CREATE;
-
- int result = COM.StgCreateDocfile(filePath, mode, 0, address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result);
-
- IStorage storage = new IStorage(address[0]);
-
- rootStorage = storage;
-}
-private void readStorageFile(char[] path) {
-
- int mode = COM.STGM_READ | COM.STGM_TRANSACTED | COM.STGM_SHARE_EXCLUSIVE;
- int[] address = new int[1];
-
- int result = COM.StgOpenStorage(path, 0, mode, 0, 0, address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
-
- rootStorage = new IStorage(address[0]);
- rootStorage.AddRef();
-}
-private void readTraditionalFile(char[] path) {
-
- if (streamName == null) OLE.error(OLE.ERROR_NULL_ARGUMENT);
-
- int mode = COM.STGM_DIRECT | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_READWRITE | COM.STGM_CREATE;
-
- // Create a temporary storage object
- int[] address = new int[1];
- int result = COM.StgCreateDocfile(null, mode | COM.STGM_DELETEONRELEASE, 0, address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
- rootStorage = new IStorage(address[0]);
- rootStorage.AddRef();
-
- // Create a stream on the storage object with the name specified in streamName
- address = new int[1];
- result = rootStorage.CreateStream(streamName, mode, 0, 0, address);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
-
- // Copy over data in file to named stream
- IStream stream = new IStream(address[0]);
- stream.AddRef();
- try {
-
- FileInputStream fileInput = new FileInputStream(file);
-
- int increment = 1024*4;
- byte[] buffer = new byte[increment];
- int count = 0;
-
- while((count = fileInput.read(buffer)) > 0){
- int pv = COM.CoTaskMemAlloc(count);
- OS.MoveMemory(pv, buffer, count);
- result = stream.Write(pv, count, null) ;
- COM.CoTaskMemFree(pv);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
- }
- stream.Commit(COM.STGC_DEFAULT);
-
- fileInput.close();
- } catch (IOException err) {
- OLE.error(OLE.ERROR_CANNOT_OPEN_FILE);
- }
-
- stream.Release();
-
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
deleted file mode 100755
index ecdd7a6152..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
+++ /dev/null
@@ -1,690 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.internal.*;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- *
- * OleFrame is an OLE Container's top level frame.
- *
- * <p>This object implements the OLE Interfaces IUnknown and IOleInPlaceFrame
- *
- * <p>OleFrame allows the container to do the following: <ul>
- * <li>position and size the ActiveX Control or OLE Document within the application
- * <li>insert menu items from the application into the OLE Document's menu
- * <li>activate and deactivate the OLE Document's menus
- * <li>position the OLE Document's menu in the application
- * <li>translate accelerator keystrokes intended for the container's frame</ul>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>BORDER
- * <dt><b>Events</b> <dd>Dispose, Move, Resize
- * </dl>
- *
- */
-final public class OleFrame extends Composite
-{
- // Interfaces for this Ole Client Container
- private COMObject iUnknown;
- private COMObject iOleInPlaceFrame;
-
- // Access to the embedded/linked Ole Object
- private IOleInPlaceActiveObject objIOleInPlaceActiveObject;
-
- private OleClientSite currentdoc;
-
- private int refCount = 0;
-
- private MenuItem[] fileMenuItems;
- private MenuItem[] containerMenuItems;
- private MenuItem[] windowMenuItems;
-
- private Listener listener;
-
- private static String CHECK_FOCUS = "OLE_CHECK_FOCUS";
- private static String HHOOK = "OLE_HHOOK";
- private static String HHOOKMSG = "OLE_HHOOK_MSG";
-
-/**
- * Create an OleFrame child widget using style bits
- * to select a particular look or set of properties.
- *
- * @param parent a composite widget (cannot be null)
- * @param style the bitwise OR'ing of widget styles
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
- * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
- *
- */
-public OleFrame(Composite parent, int style) {
- // set up widget attributes
- super(parent, style | SWT.CLIP_CHILDREN | SWT.CLIP_SIBLINGS);
-
- createCOMInterfaces();
-
- // setup cleanup proc
- listener = new Listener() {
- public void handleEvent(Event e) {
- switch (e.type) {
- case SWT.Dispose :
- onDispose(e);
- break;
- case SWT.Resize :
- case SWT.Move :
- onResize(e);
- break;
- default :
- OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
- };
-
- addListener(SWT.Dispose, listener);
-
- // inform inplaceactiveobject whenever frame resizes
- addListener(SWT.Resize, listener);
-
- // inform inplaceactiveobject whenever frame moves
- addListener(SWT.Move, listener);
-
- // Maintain a reference to yourself so that when
- // ClientSites close, they don't take the frame away
- // with them.
- this.AddRef();
-
- // Check for focus change
- Display display = getDisplay();
- initCheckFocus(display);
- initMsgHook(display);
-}
-private static void initCheckFocus (final Display display) {
- if (display.getData(CHECK_FOCUS) != null) return;
- display.setData(CHECK_FOCUS, CHECK_FOCUS);
- final int time = 50;
- final Runnable[] timer = new Runnable[1];
- final Control[] lastFocus = new Control[1];
- timer[0] = new Runnable() {
- public void run() {
- Control currentFocus = display.getFocusControl();
- if (lastFocus[0] != currentFocus) {
- Event event = new Event();
- if (lastFocus[0] instanceof OleFrame) {
- if (!lastFocus [0].isDisposed()) {
- OleFrame frame = (OleFrame) lastFocus[0];
- OleClientSite client = frame.getCurrentDocument();
- if (client != null) {
- client.notifyListeners (SWT.FocusOut, event);
- }
- }
- }
- if (lastFocus [0] instanceof OleControlSite) {
- if (!lastFocus[0].isDisposed()) {
- lastFocus[0].notifyListeners (SWT.FocusOut, event);
- }
- }
- if (currentFocus instanceof OleFrame) {
- OleFrame frame = (OleFrame) currentFocus;
- OleClientSite client = frame.getCurrentDocument();
- if (client != null) {
- client.notifyListeners (SWT.FocusIn, event);
- }
- }
- if (currentFocus instanceof OleControlSite) {
- currentFocus.notifyListeners(SWT.FocusIn, event);
- }
- }
- lastFocus[0] = currentFocus;
- display.timerExec(time, timer[0]);
- }
- };
- display.timerExec(time, timer[0]);
-}
-private static void initMsgHook(Display display) {
- if (display.getData(HHOOK) != null) return;
- final Callback callback = new Callback(OleFrame.class, "getMsgProc", 3);
- int address = callback.getAddress();
- int threadId = OS.GetCurrentThreadId();
- final int hHook = OS.SetWindowsHookEx(OS.WH_GETMESSAGE, address, 0, threadId);
- if (hHook == 0) {
- callback.dispose();
- return;
- }
- display.setData(HHOOK, new Integer(hHook));
- display.setData(HHOOKMSG, new MSG());
- display.disposeExec(new Runnable() {
- public void run() {
- if (hHook != 0) OS.UnhookWindowsHookEx(hHook);
- if (callback != null) callback.dispose();
- }
- });
-}
-static int getMsgProc(int code, int wParam, int lParam) {
- Display display = Display.getCurrent();
- if (display == null) return 0;
- Integer hHook = (Integer)display.getData(HHOOK);
- if (hHook == null) return 0;
- if (code < 0) {
- return OS.CallNextHookEx(hHook.intValue(), code, wParam, lParam);
- }
- MSG msg = (MSG)display.getData(HHOOKMSG);
- OS.MoveMemory(msg, lParam, MSG.sizeof);
- int message = msg.message;
- if (OS.WM_KEYFIRST <= message && message <= OS.WM_KEYLAST) {
- if (display != null) {
- Widget widget = null;
- int hwnd = msg.hwnd;
- while (hwnd != 0) {
- widget = display.findWidget (hwnd);
- if (widget != null) break;
- hwnd = OS.GetParent (hwnd);
- }
- if (widget != null && widget instanceof OleClientSite) {
- OleClientSite site = (OleClientSite)widget;
- if (site.handle == hwnd) {
- OleFrame frame = site.frame;
- if (frame.translateOleAccelerator(msg)) {
- // In order to prevent this message from also being processed
- // by the application, zero out message, wParam and lParam
- OS.MoveMemory(lParam + 4, new int[] {OS.WM_NULL, 0, 0}, 12);
- return 0;
- }
- }
- }
- }
- }
- return OS.CallNextHookEx(hHook.intValue(), code, wParam, lParam);
-}
-/**
- * Increment the count of references to this instance
- *
- * @return the current reference count
- */
-int AddRef() {
- refCount++;
- return refCount;
-}
-private int ContextSensitiveHelp(int fEnterMode) {
- return COM.S_OK;
-}
-private void createCOMInterfaces() {
- // Create each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iOleInPlaceFrame = new COMObject(new int[]{2, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 2}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetWindow(args[0]);}
- public int method4(int[] args) {return ContextSensitiveHelp(args[0]);}
- public int method5(int[] args) {return GetBorder(args[0]);}
- public int method6(int[] args) {return RequestBorderSpace(args[0]);}
- public int method7(int[] args) {return SetBorderSpace(args[0]);}
- public int method8(int[] args) {return SetActiveObject(args[0], args[1]);}
- public int method9(int[] args) {return InsertMenus(args[0], args[1]);}
- public int method10(int[] args) {return SetMenu(args[0], args[1], args[2]);}
- public int method11(int[] args) {return RemoveMenus(args[0]);}
- // method12 SetStatusText - not implemented
- // method13 EnableModeless - not implemented
- public int method14(int[] args) {return TranslateAccelerator(args[0], args[1]);}
- };
-}
-private void disposeCOMInterfaces () {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iOleInPlaceFrame != null)
- iOleInPlaceFrame.dispose();
- iOleInPlaceFrame = null;
-}
-private int GetBorder(int lprectBorder) {
- /*
- The IOleInPlaceUIWindow::GetBorder function, when called on a document or frame window
- object, returns the outer rectangle (relative to the window) where the object can put
- toolbars or similar controls.
- */
- if (lprectBorder == 0) return COM.E_INVALIDARG;
- RECT rectBorder = new RECT();
- // Coordinates must be relative to the window
- OS.GetClientRect(handle, rectBorder);
- OS.MoveMemory(lprectBorder, rectBorder, RECT.sizeof);
- return COM.S_OK;
-}
-/**
- *
- * Returns the application menu items that will appear in the Container location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * @return the application menu items that will appear in the Container location when an OLE Document
- * is in-place activated.
- *
- */
-public MenuItem[] getContainerMenus(){
- return containerMenuItems;
-}
-/**
- *
- * Returns the application menu items that will appear in the File location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * @return the application menu items that will appear in the File location when an OLE Document
- * is in-place activated.
- *
- */
-public MenuItem[] getFileMenus(){
- return fileMenuItems;
-}
-int getIOleInPlaceFrame() {
- return iOleInPlaceFrame.getAddress();
-}
-private int getMenuItemID(int hMenu, int index) {
- int id = 0;
- MENUITEMINFO lpmii = new MENUITEMINFO();
- lpmii.cbSize = MENUITEMINFO.sizeof;
- lpmii.fMask = OS.MIIM_STATE | OS.MIIM_SUBMENU | OS.MIIM_ID;
- OS.GetMenuItemInfo(hMenu, index, true, lpmii);
- if ((lpmii.fState & OS.MF_POPUP) == OS.MF_POPUP) {
- id = lpmii.hSubMenu;
- } else {
- id = lpmii.wID;
- }
- return id;
-}
-private int GetWindow(int phwnd) {
- if (phwnd != 0) {
- COM.MoveMemory(phwnd, new int[] {handle}, 4);
- }
- return COM.S_OK;
-}
-/**
- *
- * Returns the application menu items that will appear in the Window location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * @return the application menu items that will appear in the Window location when an OLE Document
- * is in-place activated.
- *
- */
-public MenuItem[] getWindowMenus(){
- return windowMenuItems;
-}
-private int InsertMenus(int hmenuShared, int lpMenuWidths) {
- // locate menu bar
- Menu menubar = getShell().getMenuBar();
- if (menubar == null || menubar.isDisposed()) {
- COM.MoveMemory(lpMenuWidths, new int[] {0}, 4);
- return COM.S_OK;
- }
- int hMenu = menubar.handle;
-
- // Create a holder for menu information. This will be passed down to
- // the OS and the OS will fill in the requested information for each menu.
- MENUITEMINFO lpmii = new MENUITEMINFO();
- int hHeap = OS.GetProcessHeap();
- int cch = 128;
- int byteCount = cch * TCHAR.sizeof;
- int pszText = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- lpmii.cbSize = MENUITEMINFO.sizeof;
- lpmii.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_SUBMENU | OS.MIIM_DATA;
- lpmii.dwTypeData = pszText;
- lpmii.cch = cch;
-
- // Loop over all "File-like" menus in the menubar and get information about the
- // item from the OS.
- int fileMenuCount = 0;
- int newindex = 0;
- if (this.fileMenuItems != null) {
- for (int i = 0; i < this.fileMenuItems.length; i++) {
- MenuItem item = this.fileMenuItems[i];
- if (item != null) {
- int index = item.getParent().indexOf(item);
- lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
- // exact number of characters in name. Reset it to our max size
- // before each call.
- if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
- if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
- // keep track of the number of items
- fileMenuCount++;
- newindex++;
- }
- }
- }
- }
- }
-
- // copy the menu item count information to the pointer
- COM.MoveMemory(lpMenuWidths, new int[] {fileMenuCount}, 4);
-
- // Loop over all "Container-like" menus in the menubar and get information about the
- // item from the OS.
- int containerMenuCount = 0;
- if (this.containerMenuItems != null) {
- for (int i = 0; i < this.containerMenuItems.length; i++) {
- MenuItem item = this.containerMenuItems[i];
- if (item != null) {
- int index = item.getParent().indexOf(item);
- lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
- // exact nuber of characters in name. Reset it to a large number
- // before each call.
- if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
- if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
- // keep track of the number of items
- containerMenuCount++;
- newindex++;
- }
- }
- }
- }
- }
-
- // copy the menu item count information to the pointer
- COM.MoveMemory(lpMenuWidths + 8, new int[] {containerMenuCount}, 4);
-
- // Loop over all "Window-like" menus in the menubar and get information about the
- // item from the OS.
- int windowMenuCount = 0;
- if (this.windowMenuItems != null) {
- for (int i = 0; i < this.windowMenuItems.length; i++) {
- MenuItem item = this.windowMenuItems[i];
- if (item != null) {
- int index = item.getParent().indexOf(item);
- lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
- // exact nuber of characters in name. Reset it to a large number
- // before each call.
- if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
- if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
- // keep track of the number of items
- windowMenuCount++;
- newindex++;
- }
- }
- }
- }
- }
-
- // copy the menu item count information to the pointer
- COM.MoveMemory(lpMenuWidths + 16, new int[] {windowMenuCount}, 4);
-
- // free resources used in querying the OS
- if (pszText != 0)
- OS.HeapFree(hHeap, 0, pszText);
- return COM.S_OK;
-}
-private void onDispose(Event e) {
-
- releaseObjectInterfaces();
- currentdoc = null;
-
- this.Release();
-}
-private void onResize(Event e) {
- if (objIOleInPlaceActiveObject != null) {
- RECT lpRect = new RECT();
- OS.GetClientRect(handle, lpRect);
- objIOleInPlaceActiveObject.ResizeBorder(lpRect, iOleInPlaceFrame.getAddress(), true);
- }
-}
-private int QueryInterface(int riid, int ppvObject) {
-// implements IUnknown, IOleInPlaceFrame, IOleContainer, IOleInPlaceUIWindow
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIOleInPlaceFrame) ) {
- COM.MoveMemory(ppvObject, new int[] {iOleInPlaceFrame.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-/**
- * Decrement the count of references to this instance
- *
- * @return the current reference count
- */
-int Release() {
- refCount--;
- if (refCount == 0){
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
- return refCount;
-}
-private void releaseObjectInterfaces() {
- if (objIOleInPlaceActiveObject != null) {
- objIOleInPlaceActiveObject.Release();
- }
- objIOleInPlaceActiveObject = null;
-}
-private int RemoveMenus(int hmenuShared) {
-
- Menu menubar = getShell().getMenuBar();
- if (menubar == null || menubar.isDisposed()) return COM.S_FALSE;
-
- int hMenu = menubar.handle;
-
- Vector ids = new Vector();
- if (this.fileMenuItems != null) {
- for (int i = 0; i < this.fileMenuItems.length; i++) {
- MenuItem item = this.fileMenuItems[i];
- if (item != null && !item.isDisposed()) {
- int index = item.getParent().indexOf(item);
- // get Id from original menubar
- int id = getMenuItemID(hMenu, index);
- ids.addElement(new Integer(id));
- }
- }
- }
- if (this.containerMenuItems != null) {
- for (int i = 0; i < this.containerMenuItems.length; i++) {
- MenuItem item = this.containerMenuItems[i];
- if (item != null && !item.isDisposed()) {
- int index = item.getParent().indexOf(item);
- int id = getMenuItemID(hMenu, index);
- ids.addElement(new Integer(id));
- }
- }
- }
- if (this.windowMenuItems != null) {
- for (int i = 0; i < this.windowMenuItems.length; i++) {
- MenuItem item = this.windowMenuItems[i];
- if (item != null && !item.isDisposed()) {
- int index = item.getParent().indexOf(item);
- int id = getMenuItemID(hMenu, index);
- ids.addElement(new Integer(id));
- }
- }
- }
- int index = OS.GetMenuItemCount(hmenuShared) - 1;
- for (int i = index; i >= 0; i--) {
- int id = getMenuItemID(hmenuShared, i);
- if (ids.contains(new Integer(id))){
- OS.RemoveMenu(hmenuShared, i, OS.MF_BYPOSITION);
- }
- }
- return COM.S_OK;
-}
-private int RequestBorderSpace(int pborderwidths) {
- return COM.S_OK;
-}
-int SetActiveObject(int pActiveObject, int pszObjName) {
- if (objIOleInPlaceActiveObject != null) {
- objIOleInPlaceActiveObject.Release();
- objIOleInPlaceActiveObject = null;
- }
- if (pActiveObject != 0) {
- objIOleInPlaceActiveObject = new IOleInPlaceActiveObject(pActiveObject);
- objIOleInPlaceActiveObject.AddRef();
- }
-
- return COM.S_OK;
-}
-private int SetBorderSpace(int pborderwidths) {
- // A Control/Document can :
- // Use its own toolbars, requesting border space of a specific size, or,
- // Use no toolbars, but force the container to remove its toolbars by passing a
- // valid BORDERWIDTHS structure containing nothing but zeros in the pborderwidths parameter, or,
- // Use no toolbars but allow the in-place container to leave its toolbars up by
- // passing NULL as the pborderwidths parameter.
-
- RECT borderwidth = new RECT();
- if (pborderwidths == 0 || currentdoc == null ) return COM.S_OK;
-
- COM.MoveMemory(borderwidth, pborderwidths, RECT.sizeof);
- currentdoc.setBorderSpace(borderwidth);
-
- return COM.S_OK;
-}
-/**
- *
- * Specify the menu items that should appear in the Container location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * <p>This method must be called before in place activation of the OLE Document. After the Document
- * is activated, the menu bar will not be modified until a subsequent activation.
- *
- * @param containerMenus an array of top level MenuItems to be inserted into the Container location of
- * the menubar
- */
-public void setContainerMenus(MenuItem[] containerMenus){
- containerMenuItems = containerMenus;
-}
-OleClientSite getCurrentDocument() {
- return currentdoc;
-}
-void setCurrentDocument(OleClientSite doc) {
- currentdoc = doc;
-
- if (currentdoc != null && objIOleInPlaceActiveObject != null) {
- RECT lpRect = new RECT();
- OS.GetClientRect(handle, lpRect);
- objIOleInPlaceActiveObject.ResizeBorder(lpRect, iOleInPlaceFrame.getAddress(), true);
- }
-}
-/**
- *
- * Specify the menu items that should appear in the File location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * <p>This method must be called before in place activation of the OLE Document. After the Document
- * is activated, the menu bar will not be modified until a subsequent activation.
- *
- * @param fileMenus an array of top level MenuItems to be inserted into the Flie location of
- * the menubar
- */
-public void setFileMenus(MenuItem[] fileMenus){
- fileMenuItems = fileMenus;
-}
-private int SetMenu(int hmenuShared, int holemenu, int hwndActiveObject) {
-
- int inPlaceActiveObject = 0;
- if (objIOleInPlaceActiveObject != null)
- inPlaceActiveObject = objIOleInPlaceActiveObject.getAddress();
-
- Menu menubar = getShell().getMenuBar();
- if (menubar == null || menubar.isDisposed()){
- return COM.OleSetMenuDescriptor(0, getShell().handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
- }
-
- int handle = menubar.getShell().handle;
-
- if (hmenuShared == 0 && holemenu == 0) {
- // re-instate the original menu - this occurs on deactivation
- hmenuShared = menubar.handle;
- }
- if (hmenuShared == 0) return COM.E_FAIL;
-
- OS.SetMenu(handle, hmenuShared);
- OS.DrawMenuBar(handle);
-
- return COM.OleSetMenuDescriptor(holemenu, handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
-}
-/**
- *
- * Set the menu items that should appear in the Window location when an OLE Document
- * is in-place activated.
- *
- * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
- * is given the opportunity to merge some of its menus into the menubar. The application
- * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
- * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
- * menu locations. Note that an application can insert more than one menu into a single location.
- *
- * <p>This method must be called before in place activation of the OLE Document. After the Document
- * is activated, the menu bar will not be modified until a subsequent activation.
- *
- * @param windowMenus an array of top level MenuItems to be inserted into the Window location of
- * the menubar
- */
-public void setWindowMenus(MenuItem[] windowMenus){
- windowMenuItems = windowMenus;
-}
-private boolean translateOleAccelerator(MSG msg) {
- if (objIOleInPlaceActiveObject == null) return false;
- return objIOleInPlaceActiveObject.TranslateAccelerator(msg) != OLE.S_FALSE;
-}
-private int TranslateAccelerator(int lpmsg, int wID){
- Menu menubar = getShell().getMenuBar();
- if (menubar == null || menubar.isDisposed() || !menubar.isEnabled()) return COM.S_FALSE;
- if (wID < 0) return COM.S_FALSE;
-
- Shell shell = menubar.getShell();
- int hwnd = shell.handle;
- int hAccel = OS.SendMessage(hwnd, OS.WM_APP+1, 0, 0);
- if (hAccel == 0) return COM.S_FALSE;
-
- MSG msg = new MSG();
- OS.MoveMemory(msg, lpmsg, MSG.sizeof);
- int result = OS.TranslateAccelerator(hwnd, hAccel, msg);
- return result == 0 ? COM.S_FALSE : COM.S_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java
deleted file mode 100755
index 1e4c6a0c28..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.ole.win32.COM;
-
-public class OleFunctionDescription {
-
- public int id;
- public String name;
- public OleParameterDescription[] args;
- public int optionalArgCount;
- public short returnType;
- public int invokeKind;
- public int funcKind;
- public short flags;
- public int callingConvention;
- public String documentation;
- public String helpFile;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java
deleted file mode 100755
index 2fd261d9ab..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- */
-public interface OleListener
-{
-/**
- *
- */
-public void handleEvent(OleEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java
deleted file mode 100755
index 69bb5c997a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class OleParameterDescription {
- public String name;
- public short flags;
- public short type;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
deleted file mode 100755
index f87d36437f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.*;
-
-final class OlePropertyChangeSink {
-
- private OleControlSite controlSite;
- //private IUnknown objIUnknown;
-
- private COMObject iUnknown;
- private COMObject iPropertyNotifySink;
-
- private int refCount;
-
- private int propertyCookie;
-
- private OleEventTable eventTable;
-
-OlePropertyChangeSink(OleControlSite controlSite) {
-
- this.controlSite = controlSite;
-
- createCOMInterfaces();
-}
-void addListener(int propertyID, OleListener listener) {
- if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new OleEventTable ();
- eventTable.hook(propertyID, listener);
-}
-int AddRef() {
- refCount++;
- return refCount;
-}
-void connect(IUnknown objIUnknown) {
-
- // Set up property change notification sink
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
- IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
- if (cpc.FindConnectionPoint(COM.IIDIPropertyNotifySink, ppvObject) == COM.S_OK) {
- IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
- int[] cookie = new int[1];
- if (cp.Advise(iPropertyNotifySink.getAddress(), cookie) == COM.S_OK) {
- propertyCookie = cookie[0];
- }
- cp.Release();
- }
- cpc.Release();
- }
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iPropertyNotifySink = new COMObject(new int[]{2, 0, 0, 1, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return OnChanged(args[0]);}
- public int method4(int[] args) {return OnRequestEdit(args[0]);}
- };
-}
-void disconnect(IUnknown objIUnknown) {
-
- // disconnect property notification sink
- if (propertyCookie != 0 && objIUnknown != null) {
- int[] ppvObject = new int[1];
- if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
- IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
- if (cpc.FindConnectionPoint(COM.IIDIPropertyNotifySink, ppvObject) == COM.S_OK) {
- IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
- if (cp.Unadvise(propertyCookie) == COM.S_OK) {
- propertyCookie = 0;
- }
- cp.Release();
- }
- cpc.Release();
- }
- }
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null);
- iUnknown.dispose();
- iUnknown = null;
-
- if (iPropertyNotifySink != null)
- iPropertyNotifySink.dispose();
- iPropertyNotifySink = null;
-
-}
-/**
-* Notify listeners of an event.
-* <p>
-* This method notifies all listeners that an event
-* has occurred.
-*
-* @param eventType the desired SWT event
-* @param event the event data
-*
-* @exception SWTError <ul>
-* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
-* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
-* <li>ERROR_NULL_ARGUMENT when handler is null</li>
-* </ul>
-*/
-private void notifyListener (int eventType, OleEvent event) {
- if (event == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = controlSite;
- eventTable.sendEvent (event);
-}
-private int OnChanged(int dispID) {
-
- if (eventTable == null || !eventTable.hooks(dispID)) return COM.S_OK;
-
- OleEvent event = new OleEvent();
- event.detail = OLE.PROPERTY_CHANGED;
- notifyListener(dispID,event);
-
- return COM.S_OK;
-}
-private int OnRequestEdit(int dispID) {
-
- if (eventTable == null || !eventTable.hooks(dispID)) return COM.S_OK;
-
- OleEvent event = new OleEvent();
- event.doit = true;
- event.detail = OLE.PROPERTY_CHANGING;
-
- notifyListener(dispID,event);
-
- if (event.doit) return COM.S_OK;
-
- return COM.S_FALSE;
-}
-private int QueryInterface(int riid, int ppvObject) {
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIPropertyNotifySink)) {
- COM.MoveMemory(ppvObject, new int[] {iPropertyNotifySink.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- }
-
- return refCount;
-}
-void removeListener(int propertyID, OleListener listener) {
- if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (propertyID, listener);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java
deleted file mode 100755
index 515a485f65..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class OlePropertyDescription {
- public int id;
- public String name;
- public int type;
- public int flags;
- public int kind;
- public String description;
- public String helpFile;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java
deleted file mode 100755
index 079d0b23b3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java
+++ /dev/null
@@ -1,523 +0,0 @@
-package org.eclipse.swt.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.*;
-/**
- *
- * A Variant is a generic OLE mechanism for passing data of different types via a common interface.
- *
- * <p>It is used within the OleAutomation object for getting a property, setting a property or invoking
- * a method on an OLE Control or OLE Document.
- *
- */
-public final class Variant
-{
- // A variant always takes up 16 bytes, no matter what you
- // store in it. Objects, strings, and arrays are not physically
- // stored in the Variant; in these cases, four bytes of the
- // Variant are used to hold either an object reference, or a
- // pointer to the string or array. The actual data are stored elsewhere.
- public static final int sizeof = 16;
-
- private short type; // OLE.VT_* type
-
- private boolean booleanData;
- private float floatData;
- private int intData;
- private short shortData;
- private String stringData;
- private int byRefPtr;
- private OleAutomation dispatchData;
- private IUnknown unknownData;
-Variant(){
- type = COM.VT_EMPTY;
-}
-/**
- * Create a Variant object which represents a Java float as a VT_R4.
- *
- * @param val the Java float value that this Variant represents
- *
- */
-public Variant(float val) {
- type = COM.VT_R4;
- floatData = val;
-
-}
-/**
- * Create a Variant object which represents a Java int as a VT_I4.
- *
- * @param val the Java int value that this Variant represents
- *
- */
- public Variant(int val) {
-
- type = COM.VT_I4;
- intData = val;
-}
-/**
- * Create a Variant object which contains a reference to the data being transferred.
- *
- * <p>When creating a VT_BYREF Variant, you must give the full Variant type including VT_BYREF
- * (such as <code>short byRefType = OLE.VT_BSTR | OLE.VT_BYREF</code>).
- *
- * @param ptr a pointer to the data being transferred.
- * @param byRefType the type of the data being transferred such as OLE.VT_BSTR | OLE.VT_BYREF
- *
- */
-public Variant(int ptr, short byRefType) {
- type = byRefType;
- byRefPtr = ptr;
-}
-/**
- * Create a Variant object which represents an IDispatch interface as a VT_Dispatch.
- *
- * @param automation the OleAutomation object that this Variant represents
- *
- */
-public Variant(OleAutomation automation) {
- type = COM.VT_DISPATCH;
- dispatchData = automation;
-}
-/**
- * Create a Variant object which represents an IUnknown interface as a VT_UNKNOWN.
- *
- * <p>The caller is expected to have appropriately invoked unknown.AddRef() before creating
- * this Variant.
- *
- * @param unknown the IUnknown object that this Variant represents
- *
- */
-public Variant(IUnknown unknown) {
- type = COM.VT_UNKNOWN;
- unknownData = unknown;
-}
-/**
- * Create a Variant object which represents a Java String as a VT_BSTR.
- *
- * @param string the Java String value that this Variant represents
- *
- */
-public Variant(String string) {
- type = COM.VT_BSTR;
- stringData = string;
-}
-/**
- * Create a Variant object which represents a Java short as a VT_I2.
- *
- * @param val the Java short value that this Variant represents
- *
- */
-public Variant(short val) {
- type = COM.VT_I2;
- shortData = val;
-}
-/**
- * Create a Variant object which represents a Java boolean as a VT_BOOL.
- *
- * @param val the Java boolean value that this Variant represents
- *
- */
-public Variant(boolean val) {
-
- type = COM.VT_BOOL;
- booleanData = val;
-}
-/**
- * Returns the OleAutomation object represented by this Variant.
- *
- * <p>If this Variant does not contain an OleAutomation object, an attempt is made to
- * coerce the Variant type into an OleAutomation object. If this fails, an error is
- * thrown.
- *
- * @return the OleAutomation object represented by this Variant
- *
- * @exception SWTError
- * ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an OleAutomation object
- */
-public OleAutomation getAutomation() {
- if (type == COM.VT_DISPATCH)
- return dispatchData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_DISPATCH);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant autoVar = new Variant();
- autoVar.setData(newPtr);
- return autoVar.getAutomation();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr); // Note: This must absolutely be done AFTER the
- // OleAutomation object is created as Variant Clear
- // will result in a Release being performed on the
- // Dispatch object
- OS.GlobalFree(newPtr);
- }
-}
-/**
- * Returns the Java boolean represented by this Variant.
- *
- * <p>If this Variant does not contain a Java boolean, an attempt is made to
- * coerce the Variant type into a Java boolean. If this fails, an error is thrown.
- *
- * @return the Java boolean represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a boolean</ul>
- *
- */
-public boolean getBoolean() {
- if (type == COM.VT_BOOL)
- return booleanData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_BOOL);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant boolVar = new Variant();
- boolVar.setData(newPtr);
- return boolVar.getBoolean();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr);
- OS.GlobalFree(newPtr);
- }
-}
-/**
- * Returns a pointer to the referenced data represented by this Variant.
- *
- * <p>If this Variant does not contain a reference to data, zero is returned.
- *
- * @return a pointer to the referenced data represented by this Variant or 0
- *
- */
-public int getByRef() {
- if ((type & COM.VT_BYREF)== COM.VT_BYREF)
- return byRefPtr;
-
- return 0;
-}
-void getData(int pData){
- if (pData == 0) OLE.error(OLE.ERROR_OUT_OF_MEMORY);
-
- COM.VariantInit(pData);
-
- if ((type & COM.VT_BYREF) == COM.VT_BYREF) {
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new int[]{byRefPtr}, 4);
- return;
- }
-
- switch (type) {
- case COM.VT_EMPTY :
- break;
- case COM.VT_BOOL :
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new short[]{(short)((booleanData) ? 1 : 0)}, 2);
- break;
- case COM.VT_R4 :
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new float[]{floatData}, 4);
- break;
- case COM.VT_I4 :
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new int[]{intData}, 4);
- break;
- case COM.VT_DISPATCH :
- IDispatch dispatch = new IDispatch(dispatchData.getAddress());
- dispatch.AddRef();
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new int[]{dispatch.getAddress()}, 4);
- break;
- case COM.VT_UNKNOWN :
- unknownData.AddRef();
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new int[]{unknownData.getAddress()}, 4);
- break;
- case COM.VT_I2 :
- COM.MoveMemory(pData, new short[] {type}, 2);
- COM.MoveMemory(pData + 8, new short[]{shortData}, 2);
- break;
- case COM.VT_BSTR :
- COM.MoveMemory(pData, new short[] {type}, 2);
- char[] data = (stringData+"\0").toCharArray();
- int ptr = COM.SysAllocString(data);
- COM.MoveMemory(pData + 8, new int[] {ptr}, 4);
- break;
-
- default :
- OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
-}
-/**
- * Returns the Java float represented by this Variant.
- *
- * <p>If this Variant does not contain a Java float, an attempt is made to
- * coerce the Variant type into a Java float. If this fails, an error is thrown.
- *
- * @return the Java float represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a float</ul>
- */
-public float getFloat() {
- if (type == COM.VT_R4)
- return floatData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_R4);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant floatVar = new Variant();
- floatVar.setData(newPtr);
- return floatVar.getFloat();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr);
- OS.GlobalFree(newPtr);
- }
-
-}
-/**
- * Returns the Java int represented by this Variant.
- *
- * <p>If this Variant does not contain a Java int, an attempt is made to
- * coerce the Variant type into a Java int. If this fails, an error is thrown.
- *
- * @return the Java int represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a int</ul>
- */
-public int getInt() {
- if (type == COM.VT_I4)
- return intData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_I4);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant intVar = new Variant();
- intVar.setData(newPtr);
- return intVar.getInt();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr);
- OS.GlobalFree(newPtr);
- }
-}
-/**
- * Returns the Java short represented by this Variant.
- *
- * <p>If this Variant does not contain a Java short, an attempt is made to
- * coerce the Variant type into a Java short. If this fails, an error is thrown.
- *
- * @return the Java short represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a short</ul>
- */
-public short getShort() {
- if (type == COM.VT_I2)
- return shortData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_I2);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant shortVar = new Variant();
- shortVar.setData(newPtr);
- return shortVar.getShort();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr);
- OS.GlobalFree(newPtr);
- }
-
-}
-/**
- * Returns the Java String represented by this Variant.
- *
- * <p>If this Variant does not contain a Java String, an attempt is made to
- * coerce the Variant type into a Java String. If this fails, an error is thrown.
- *
- * @return the Java String represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a String</ul>
- */
-public String getString() {
- if (type == COM.VT_BSTR)
- return stringData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_BSTR);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
-
- Variant stringVar = new Variant();
- stringVar.setData(newPtr);
- return stringVar.getString();
-
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr);
- OS.GlobalFree(newPtr);
- }
-}
-short getType() {
- return type;
-}
-/**
- * Returns the IUnknown object represented by this Variant.
- *
- * <p>If this Variant does not contain an IUnknown object, an attempt is made to
- * coerce the Variant type into an IUnknown object. If this fails, an error is
- * thrown.
- *
- * @return the IUnknown object represented by this Variant
- *
- * @exception SWTError
- * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into
- * an IUnknown object</ul>
- */
-public IUnknown getUnknown() {
- if (type == COM.VT_UNKNOWN)
- return unknownData;
-
- // try to coerce the value to the desired type
- int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
- try {
- getData(oldPtr);
- int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_UNKNOWN);
- if (result != COM.S_OK)
- OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
- Variant unknownVar = new Variant();
- unknownVar.setData(newPtr);
- return unknownVar.getUnknown();
- } finally {
- COM.VariantClear(oldPtr);
- OS.GlobalFree(oldPtr);
- COM.VariantClear(newPtr); // Note: This must absolutely be done AFTER the
- // IUnknown object is created as Variant Clear
- // will result in a Release being performed on the
- // Dispatch object
- OS.GlobalFree(newPtr);
- }
-}
-void setData(int pData){
- if (pData == 0) OLE.error(OLE.ERROR_INVALID_ARGUMENT);
-
- short[] dataType = new short[1];
- COM.MoveMemory(dataType, pData, 2);
- type = dataType[0];
-
- if ((type & COM.VT_BYREF) == COM.VT_BYREF) {
- int[] newByRefPtr = new int[1];
- OS.MoveMemory(newByRefPtr, pData + 8, 4);
- byRefPtr = newByRefPtr[0];
- return;
- }
-
- switch (type) {
- case COM.VT_EMPTY :
- break;
- case COM.VT_BOOL :
- short[] newBooleanData = new short[1];
- COM.MoveMemory(newBooleanData, pData + 8, 2);
- booleanData = (newBooleanData[0] != 0);
- break;
- case COM.VT_R4 :
- float[] newFloatData = new float[1];
- COM.MoveMemory(newFloatData, pData + 8, 4);
- floatData = newFloatData[0];
- break;
- case COM.VT_I4 :
- int[] newIntData = new int[1];
- OS.MoveMemory(newIntData, pData + 8, 4);
- intData = newIntData[0];
- break;
- case COM.VT_DISPATCH :
- int[] newDispatchData = new int[1];
- OS.MoveMemory(newDispatchData, pData + 8, 4);
- dispatchData = new OleAutomation(newDispatchData[0]);
- break;
- case COM.VT_UNKNOWN :
- int[] newUnknownData = new int[1];
- OS.MoveMemory(newUnknownData, pData + 8, 4);
- unknownData = new IUnknown(newUnknownData[0]);
- unknownData.AddRef();
- break;
- case COM.VT_I2 :
- short[] newShortData = new short[1];
- COM.MoveMemory(newShortData, pData + 8, 2);
- shortData = newShortData[0];
- break;
- case COM.VT_BSTR :
- // get the address of the memory in which the string resides
- int[] hMem = new int[1];
- OS.MoveMemory(hMem, pData + 8, 4);
-
- // Get the size of the string from the OS - the size is expressed in number
- // of bytes - each unicode character is 2 bytes.
- int size = COM.SysStringByteLen(hMem[0]);
- if (size > 0){
- // get the unicode character array from the global memory and create a String
- char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
- COM.MoveMemory(buffer, hMem[0], size);
- stringData = new String(buffer);
- }
- break;
-
- default :
- // try coercing it into one of the known forms
- int newPData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
- if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_R4) == COM.S_OK) {
- setData(newPData);
- } else if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_I4) == COM.S_OK) {
- setData(newPData);
- } else if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_BSTR) == COM.S_OK) {
- setData(newPData);
- }
- COM.VariantClear(newPData);
- OS.GlobalFree(newPData);
- break;
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html
deleted file mode 100755
index 740fc1e68e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html
+++ /dev/null
@@ -1,19 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Win32 OLE implementation classes.
-<h2>
-Package Specification</h2>
-This package contains the classes which provide the public API to the
-the Microsoft Win32 Object Linking and Embedding mechanism
-that the win32 variant of SWT is capable of using.
-<p>
-Referencing any of the classes in this package directly guarantees
-that the code is platform specific.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java
deleted file mode 100644
index 61565c507a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class Library {
-
- /* SWT Version - Mmmm (M=major, mmm=minor) */
-
- /**
- * SWT Major version number (must be >= 0)
- */
- static int MAJOR_VERSION = 2;
-
- /**
- * SWT Minor version number (must be in the range 0..999)
- */
- static int MINOR_VERSION = 24;
-
- /**
- * SWT revision number (must be >= 0)
- */
- static int REVISION = 0;
-
-/**
- * Returns the SWT version as an integer in the standard format
- * <em>Mmmm</em> where <em>M</em> is the major version number
- * and <em>mmm</em> is the minor version number.
- *
- * @return the version of the currently running SWT
- */
-public static int getVersion () {
- return MAJOR_VERSION * 1000 + MINOR_VERSION;
-}
-
-/**
- * Returns the SWT revision number as an integer. Revision changes
- * occur as a result of non-API breaking bug fixes.
- *
- * @return the revision number of the currently running SWT
- */
-public static int getRevision () {
- return REVISION;
-}
-
-/**
- * Loads the shared library that matches the version of the
- * Java code which is currently running. SWT shared libraries
- * follow an encoding scheme where the major, minor and revision
- * numbers are embedded in the library name and this along with
- * <code>name</code> is used to load the library. If this fails,
- * <code>name</code> is used in another attempt to load the library,
- * this time ignoring the SWT version encoding scheme.
- *
- * @param name the name of the library to load
- */
-public static void loadLibrary (String name) {
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
deleted file mode 100644
index 0386d04522..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class Library {
-
- /* SWT Version - Mmmm (M=major, mmm=minor) */
-
- /**
- * SWT Major version number (must be >= 0)
- */
- static int MAJOR_VERSION = 2;
-
- /**
- * SWT Minor version number (must be in the range 0..999)
- */
- static int MINOR_VERSION = 24;
-
- /**
- * SWT revision number (must be >= 0)
- */
- static int REVISION = 0;
-
-/**
- * Returns the SWT version as an integer in the standard format
- * <em>Mmmm</em> where <em>M</em> is the major version number
- * and <em>mmm</em> is the minor version number.
- *
- * @return the version of the currently running SWT
- */
-public static int getVersion () {
- return MAJOR_VERSION * 1000 + MINOR_VERSION;
-}
-
-/**
- * Returns the platform name.
- *
- * @return the platform name of the currently running SWT
- */
-static String getPlatform () {
- String [] names = new String [] {"motif", "gtk", "win32", "photon",};
- for (int i = 0; i < names.length; i++) {
- try {
- Class.forName("org.eclipse.swt.internal."+names[i]+".OS");
- return names[i];
- } catch (ClassNotFoundException e) {
- }
- }
- return "unknown";
-}
-
-/**
- * Returns the SWT revision number as an integer. Revision changes
- * occur as a result of non-API breaking bug fixes.
- *
- * @return the revision number of the currently running SWT
- */
-public static int getRevision () {
- return REVISION;
-}
-
-/**
- * Loads the shared library that matches the version of the
- * Java code which is currently running. SWT shared libraries
- * follow an encoding scheme where the major, minor and revision
- * numbers are embedded in the library name and this along with
- * <code>name</code> is used to load the library. If this fails,
- * <code>name</code> is used in another attempt to load the library,
- * this time ignoring the SWT version encoding scheme.
- *
- * @param name the name of the library to load
- */
-public static void loadLibrary (String name) {
- /*
- * Include platform name to support different windowing systems
- * on same operating system.
- */
- String platform = getPlatform ();
-
- /*
- * Get version qualifier.
- */
- String version = System.getProperty ("swt.version");
- if (version == null) {
- version = "" + MAJOR_VERSION;
- /* Force 3 digits in minor version number */
- if (MINOR_VERSION < 10) {
- version += "00";
- } else {
- if (MINOR_VERSION < 100) version += "0";
- }
- version += MINOR_VERSION;
- /* No "r" until first revision */
- if (REVISION > 0) version += "r" + REVISION;
- }
-
- try {
- String newName = name + "-" + platform + "-" + version;
- System.loadLibrary (newName);
- return;
- } catch (UnsatisfiedLinkError e1) {
- try {
- String newName = name + "-" + platform;
- System.loadLibrary (newName);
- return;
- } catch (UnsatisfiedLinkError e2) {
- throw e1;
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html
deleted file mode 100644
index 84bc06db42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body lang="EN-US" link="blue" vlink="purple">
-<table border="0" cellspacing="5" cellpadding="2" width="100%" >
- <tr>
- <td align="LEFT" valign="TOP" colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF">About This Plug-in Sub-directory</font></b></td>
- </tr>
- <tr>
- <td>
-<p>29th January, 2002</p>
-<h3>License</h3>
-<p>All content in this plug-in sub-directory &quot;Content&quot; is made available by Eclipse.org under the following terms and conditions:</p>
-
-<p>The following files shall be defined as the SWT:</p>
-<ul>
- <li>libswt-gtk-2024.so</li>
- <li>libswt-motif-2024.so</li>
- <li>libswt-gnome-motif-2024.so</li>
- <li>libswt-kde-motif-2024.so</li>
- <li>swt.jar</li>
-</ul>
-
-<p>The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> &quot;CPL&quot;.
-For the purposes of the CPL the term "Program" shall mean the SWT.</p>
-
-<h3>Third Party Content</h3>
-
-<p>All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ &quot;Library&quot;. GTK+ is made available
-by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
-<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> &quot;LGPL&quot;. Use of the GTK+ Binding on a standalone basis, is also governed
-by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
-
-<p>In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
-containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
-other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
-governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
-work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
-
-<h3>Contributions</h3>
-
-<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
-Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
-of the contribution for which you are the copyright holder).</p>
-</td></tr></table>
-</body>
-</html>
-
-
-
-
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html
deleted file mode 100644
index 800c7797bd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
-<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
-<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
-<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
-<BODY bgColor=#ffffff>
-<DIV align=center>
-<P>
-<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
- <TBODY>
- <TR>
- <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
- size=3>
- <H1>Common Public License Version 0.5</H1><TT>
- <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
- PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
- USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
- ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
- </B></FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Contribution"
-means:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
- Contributor, the initial code and documentation distributed under this
- Agreement, and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) in the case of each
- subsequent Contributor:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
- and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) additions to the
- Program;</FONT></P>
- <P><FONT face="Courier New, Courier, mono">where such changes and/or
- additions to the Program originate from and are distributed by that
- particular Contributor. A Contribution 'originates' from a Contributor
- if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include
- additions to the Program which: (i) are separate modules of software
- distributed in conjunction with the Program under their own license
- agreement, and (ii) are not derivative works of the
- Program.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
- or entity that distributes the Program. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
- claims licensable by a Contributor which are necessarily infringed by the
- use or sale of its Contribution alone or when combined with the
- Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Program" means the
- Contributions distributed in accordance with this Agreement. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
- receives the Program under this Agreement, including all Contributors.
- </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
- RIGHTS</B></FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free copyright license to reproduce,
- prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any,
- and such derivative works, in source code and object code
- form.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer
- the Contribution of such Contributor, if any, in source code and object
- code form. This patent license shall apply to the combination of the
- Contribution and the Program if, at the time the Contribution is added
- by the Contributor, such addition of the Contribution causes such
- combination to be covered by the Licensed Patents. The patent license
- shall not apply to any other combinations which include the
- Contribution. No hardware per se is licensed hereunder.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
- although each Contributor grants the licenses to its Contributions set
- forth herein, no assurances are provided by any Contributor that the
- Program does not infringe the patent or other intellectual property
- rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement
- of intellectual property rights or otherwise. As a condition to
- exercising the rights and licenses granted hereunder, each Recipient
- hereby assumes sole responsibility to secure any other intellectual
- property rights needed, if any. For example, if a third party patent
- license is required to allow Recipient to distribute the Program, it is
- Recipient's responsibility to acquire that license before distributing
- the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">d) Each Contributor
- represents that to its knowledge it has sufficient copyright rights in
- its Contribution, if any, to grant the copyright license set forth in
- this Agreement.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono"><STRONG>3.
- REQUIREMENTS</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
- distribute the Program in object code form under its own license
- agreement, provided that: </FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
- and conditions of this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) its license
- agreement:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
- behalf of all Contributors all warranties and conditions, express and
- implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of
- merchantability and fitness for a particular purpose; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
- behalf of all Contributors all liability for damages, including direct,
- indirect, special, incidental and consequential damages, such as lost
- profits; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iii) states that any
- provisions which differ from this Agreement are offered by that
- Contributor alone and not by any other party; and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iv) states that source code
- for the Program is available from such Contributor, and informs
- licensees how to obtain it in a reasonable manner on or through a medium
- customarily used for software exchange. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">When the Program is made
- available in source code form:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it must be made available
- under this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
- must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
- alter any copyright notices contained within the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
- itself as the originator of its Contribution, if any, in a manner that
- reasonably allows subsequent Recipients to identify the originator of the
- Contribution. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
- DISTRIBUTION</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Commercial distributors of
- software may accept certain responsibilities with respect to end users,
- business partners and the like. While this license is intended to
- facilitate the commercial use of the Program, the Contributor who includes
- the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors.
- Therefore, if a Contributor includes the Program in a commercial product
- offering, such Contributor ("Commercial Contributor") hereby agrees to
- defend and indemnify every other Contributor ("Indemnified Contributor")
- against any losses, damages and costs (collectively "Losses") arising from
- claims, lawsuits and other legal actions brought by a third party against
- the Indemnified Contributor to the extent caused by the acts or omissions
- of such Commercial Contributor in connection with its distribution of the
- Program in a commercial product offering. The obligations in this section
- do not apply to any claims or Losses relating to any actual or alleged
- intellectual property infringement. In order to qualify, an Indemnified
- Contributor must: a) promptly notify the Commercial Contributor in writing
- of such claim, and b) allow the Commercial Contributor to control, and
- cooperate with the Commercial Contributor in, the defense and any related
- settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">For example, a Contributor
- might include the Program in a commercial product offering, Product X.
- That Contributor is then a Commercial Contributor. If that Commercial
- Contributor then makes performance claims, or offers warranties related to
- Product X, those performance claims and warranties are such Commercial
- Contributor's responsibility alone. Under this section, the Commercial
- Contributor would have to defend claims against the other Contributors
- related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the
- Commercial Contributor must pay those damages. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
- WARRANTY</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
- WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- Each Recipient is solely responsible for determining the appropriateness
- of using and distributing the Program and assumes all risks associated
- with its exercise of rights under this Agreement, including but not
- limited to the risks and costs of program errors, compliance with
- applicable laws, damage to or loss of data, programs or equipment, and
- unavailability or interruption of operations. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
- LIABILITY </STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
- LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
- RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGES. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>7.
- GENERAL</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">If any provision of this
- Agreement is invalid or unenforceable under applicable law, it shall not
- affect the validity or enforceability of the remainder of the terms of
- this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
- litigation against a Contributor with respect to a patent applicable to
- software (including a cross-claim or counterclaim in a lawsuit), then any
- patent licenses granted by that Contributor to such Recipient under this
- Agreement shall terminate as of the date such litigation is filed. In
- addition, If Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the
- Program itself (excluding combinations of the Program with other software
- or hardware) infringes such Recipient's patent(s), then such Recipient's
- rights granted under Section 2(b) shall terminate as of the date such
- litigation is filed.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
- this Agreement shall terminate if it fails to comply with any of the
- material terms or conditions of this Agreement and does not cure such
- failure in a reasonable period of time after becoming aware of such
- noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this
- Agreement and any licenses granted by Recipient relating to the Program
- shall continue and survive. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
- and distribute copies of this Agreement, but in order to avoid
- inconsistency the Agreement is copyrighted and may only be modified in the
- following manner. The Agreement Steward reserves the right to publish new
- versions (including revisions) of this Agreement from time to time. No one
- other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to
- serve as the Agreement Steward to a suitable separate entity. Each new
- version of the Agreement will be given a distinguishing version number.
- The Program (including Contributions) may always be distributed subject to
- the version of the Agreement under which it was received. In addition,
- after a new version of the Agreement is published, Contributor may elect
- to distribute the Program (including its Contributions) under the new
- version. Except as expressly stated in Sections 2(a) and 2(b) above,
- Recipient receives no rights or licenses to the intellectual property of
- any Contributor under this Agreement, whether expressly, by implication,
- estoppel or otherwise. All rights in the Program not expressly granted
- under this Agreement are reserved. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
- the laws of the State of New York and the intellectual property laws of
- the United States of America. No party to this Agreement will bring a
- legal action under this Agreement more than one year after the cause of
- action arose. Each party waives its rights to a jury trial in any
- resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
-<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt
deleted file mode 100644
index 3f50d0454c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt
+++ /dev/null
@@ -1,506 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh
deleted file mode 100644
index 05e11d1cf7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/csh
-
-# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
-#
-# The contents of this file are made available under the terms
-# of the GNU Lesser General Public License (LGPL) Version 2.1 that
-# accompanies this distribution (lgpl-v21.txt). The LGPL is also
-# available at http://www.gnu.org/licenses/lgpl.html. If the version
-# of the LGPL at http://www.gnu.org is different to the version of
-# the LGPL accompanying this distribution and there is any conflict
-# between the two license versions, the terms of the LGPL accompanying
-# this distribution shall govern.
-
-# Some UNIX/Linux compilers don't like <CR>'s in files (DOS format).
-set fixup_files = `grep -l "\ " *.[ch]`
-if ( "$fixup_files" != "" ) then
- echo "Converting files from DOS to UNIX format:"
- foreach file ($fixup_files)
- echo " $file"
- ex $file << EOF >& /dev/null
-g/ \$/s///
-w
-EOF
- end
-endif
-
-# Determine the operating system being built
-
-make -f make_gtk.mak $1 $2 $3 $4
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak
deleted file mode 100644
index c3a594a2c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak
+++ /dev/null
@@ -1,134 +0,0 @@
-# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
-#
-# The contents of this file are made available under the terms
-# of the GNU Lesser General Public License (LGPL) Version 2.1 that
-# accompanies this distribution (lgpl-v21.txt). The LGPL is also
-# available at http://www.gnu.org/licenses/lgpl.html. If the version
-# of the LGPL at http://www.gnu.org is different to the version of
-# the LGPL accompanying this distribution and there is any conflict
-# between the two license versions, the terms of the LGPL accompanying
-# this distribution shall govern.
-#
-# Makefile for creating SWT libraries on Linux
-
-include make_common.mak
-
-SWT_VERSION=$(maj_ver)$(min_ver)
-
-
-# Define the installation directories for various products.
-# Your system may have these in a different place.
-# IVE_HOME - IBM's version of Java (J9)
-IVE_HOME = /bluebird/teamswt/swt-builddir/ive
-#IVE_HOME = /opt/IBMvame1.4/ive
-
-JAVA_JNI=$(IVE_HOME)/bin/include
-JAVAH=$(IVE_HOME)/bin/javah
-LD_LIBRARY_PATH=$(IVE_HOME)/bin
-
-# Define the various DLL (shared) libraries to be made.
-
-SWT_PREFIX = swt
-WS_PREFIX = gtk
-SWT_DLL = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-PI_PREFIX = swt-pi
-SWTPI_DLL = lib$(PI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-GNOME_PREFIX = swt-gnome
-GNOME_DLL = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-GNOME_LIB = -x -shared \
- -L/usr/lib \
- -lgnome -lglib \
- -lm -ldl
-
-PIXBUF_PREFIX = swt-pixbuf
-PIXBUF_DLL = lib$(PIXBUF_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-
-#
-# Target Rules
-#
-
-all: make_swt make_pixbuf # make_gnome
-
-make_swt: $(SWT_DLL) $(SWTPI_DLL)
-
-#make_gnome: $(GNOME_DLL)
-
-make_pixbuf: $(PIXBUF_DLL)
-
-
-# All about Linking
-
-$(SWT_DLL): callback.o
- ld -x -shared \
- -o $(SWT_DLL) callback.o
-
-# Note: your setup may be different. Consult `gtk-config --libs`
-$(SWTPI_DLL): swt.o structs.o
- ld -x -shared \
- -L/usr/lib -L/usr/X11R6/lib \
- -lgtk -lgdk -lgmodule -lglib \
- -ldl -lXi -lXext -lX11 -lm -lc \
- -o $(SWTPI_DLL) swt.o structs.o
-
-#$(GNOME_DLL): gnome.o
-# ld -o $@ gnome.o $(GNOME_LIB)
-
-$(PIXBUF_DLL): pixbuf.o
- ld -x -shared \
- -L/usr/lib -L/usr/X11R6/lib \
- -lgdk_pixbuf \
- -lgtk -lgdk -lgmodule -lglib \
- -ldl -lXi -lXext -lX11 -lm -lc \
- -o $(PIXBUF_DLL) pixbuf.o
-
-
-# All about Compiling
-
-SWT_C_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- `gtk-config --cflags`
-
-SWT_PIXBUF_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- -I/usr/include/gdk-pixbuf \
- `gtk-config --cflags`
-
-SWT_GNOME_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- `gnome-config --cflags gnome`
-
-swt.o: swt.c swt.h
- gcc $(SWT_C_FLAGS) swt.c
-
-structs.o: structs.c
- gcc $(SWT_C_FLAGS) structs.c
-
-callback.o: callback.c
- gcc $(SWT_C_FLAGS) callback.c
-
-globals.o: globals.c
- gcc $(SWT_C_FLAGS) globals.c
-
-library.o: library.c
- gcc $(SWT_C_FLAGS) library.c
-
-pixbuf.o: pixbuf.c
- gcc $(SWT_PIXBUF_FLAGS) pixbuf.c
-
-#gnome.o: gnome.c
-# gcc $(SWT_GNOME_FLAGS) gnome.c
-
-clean:
- rm -f *.o *.so
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c
deleted file mode 100644
index f624fe3577..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-#include "swt.h"
-#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_colorspace
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1colorspace
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_colorspace((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_n_channels
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1n_1channels
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_n_channels((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_has_alpha
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1has_1alpha
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jboolean) gdk_pixbuf_get_has_alpha((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_bits_per_sample
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1bits_1per_1sample
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_bits_per_sample((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_pixels
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1pixels
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_pixels((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_width
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1width
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_width((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_height
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1height
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_height((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_rowstride
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1rowstride
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_rowstride((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_new
- * Signature: (IZIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1new
- (JNIEnv *env, jclass cl,
- jint colorspace,
- jboolean hasAlpha,
- jint bpc,
- jint width, jint height)
-{
- return (jint) gdk_pixbuf_new (
- colorspace,
- (gboolean) hasAlpha,
- bpc,
- width, height
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_copy
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1copy
- (JNIEnv *env, jclass cl, jint source) {
- return (jint)gdk_pixbuf_copy ((GdkPixbuf*) source);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_render_to_drawable
- * Signature: (IIIIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable
- (JNIEnv *env, jclass cl,
- jint pixbuf,
- jint drawable,
- jint gc,
- jint src_x, jint src_y,
- jint dest_x, jint dest_y,
- jint width, jint height,
- jint dithering,
- jint x_dither, jint y_dither) {
- gdk_pixbuf_render_to_drawable (
- (GdkPixbuf*) pixbuf,
- (GdkDrawable*) drawable,
- (GdkGC*) gc,
- src_x, src_y,
- dest_x, dest_y,
- width, height,
- dithering,
- x_dither, y_dither
- );
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_render_to_drawable_alpha
- * Signature: (IIIIIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable_1alpha
- (JNIEnv *env, jclass cl,
- jint pixbuf,
- jint drawable,
- jint src_x, jint src_y, jint dest_x, jint dest_y,
- jint width, jint height,
- jint alphaMode,
- jint alphaThreshold,
- jint dithering,
- jint x_dither, jint y_dither)
-{
- gdk_pixbuf_render_to_drawable_alpha (
- (GdkPixbuf*) pixbuf,
- (GdkDrawable*) drawable,
- src_x, src_y,
- dest_x, dest_y,
- width, height,
- alphaMode,
- alphaThreshold,
- dithering,
- x_dither, y_dither
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_scale
- * Signature: (IIIIIIDDDDI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1scale
- (JNIEnv *env, jclass cl,
- jint source, jint dest,
- jint dest_x, jint dest_y,
- jint dest_width, jint dest_height,
- jdouble offset_x, jdouble offset_y,
- jdouble scale_x, jdouble scale_y,
- jint interp_type) {
- gdk_pixbuf_scale ((GdkPixbuf*)source, (GdkPixbuf*)dest,
- dest_x, dest_y,
- dest_width, dest_height,
- offset_x, offset_y,
- scale_x, scale_y,
- interp_type
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_from_drawable
- * Signature: (IIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1from_1drawable
- (JNIEnv *env, jclass cl,
- jint dest, jint src, jint cmap,
- jint src_x, jint src_y,
- jint dest_x, jint dest_y,
- jint width, jint height)
-{
- gdk_pixbuf_get_from_drawable (
- (GdkPixbuf*) dest,
- (GdkDrawable*) src,
- (GdkColormap*) cmap,
- src_x, src_y,
- dest_x, dest_y,
- width, height);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
deleted file mode 100644
index 321855b550..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
+++ /dev/null
@@ -1,2693 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Windows structs
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Globals */
-GdkColor_FID_CACHE GdkColorFc;
-GdkEventKey_FID_CACHE GdkEventKeyFc;
-GdkEventButton_FID_CACHE GdkEventButtonFc;
-GdkEventMotion_FID_CACHE GdkEventMotionFc;
-GdkEventExpose_FID_CACHE GdkEventExposeFc;
-GdkFont_FID_CACHE GdkFontFc;
-GdkGCValues_FID_CACHE GdkGCValuesFc;
-GdkImage_FID_CACHE GdkImageFc;
-GdkPoint_FID_CACHE GdkPointFc;
-GdkRectangle_FID_CACHE GdkRectangleFc;
-GdkVisual_FID_CACHE GdkVisualFc;
-GtkObject_FID_CACHE GtkObjectFc;
-GtkData_FID_CACHE GtkDataFc;
-GtkAdjustment_FID_CACHE GtkAdjustmentFc;
-GtkAllocation_FID_CACHE GtkAllocationFc;
-GtkWidget_FID_CACHE GtkWidgetFc;
-GtkContainer_FID_CACHE GtkContainerFc;
-GtkBin_FID_CACHE GtkBinFc;
-GtkMenu_FID_CACHE GtkMenuFc;
-GtkItem_FID_CACHE GtkItemFc;
-GtkMenuShell_FID_CACHE GtkMenuShellFc;
-GtkMenuItem_FID_CACHE GtkMenuItemFc;
-GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
-GtkWindow_FID_CACHE GtkWindowFc;
-GtkDialog_FID_CACHE GtkDialogFc;
-GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
-GtkBox_FID_CACHE GtkBoxFc;
-GtkHBox_FID_CACHE GtkHBoxFc;
-GtkCombo_FID_CACHE GtkComboFc;
-GtkFileSelection_FID_CACHE GtkFileSelectionFc;
-GtkFrame_FID_CACHE GtkFrameFc;
-GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
-GtkCList_FID_CACHE GtkCListFc;
-GtkEditable_FID_CACHE GtkEditableFc;
-GtkText_FID_CACHE GtkTextFc;
-GtkProgress_FID_CACHE GtkProgressFc;
-GtkProgressBar_FID_CACHE GtkProgressBarFc;
-GtkArg_FID_CACHE GtkArgFc;
-GtkRequisition_FID_CACHE GtkRequisitionFc;
-GtkStyle_FID_CACHE GtkStyleFc;
-GtkStyleClass_FID_CACHE GtkStyleClassFc;
-GtkCListRow_FID_CACHE GtkCListRowFc;
-GtkCListColumn_FID_CACHE GtkCListColumnFc;
-GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
-GtkCTree_FID_CACHE GtkCTreeFc;
-
-/* ----------- fid and class caches ----------- */
-/*
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkColorClass = (*env)->GetObjectClass(env, lpGdkColor);
-
- lpCache->pixel = (*env)->GetFieldID(env, lpCache->GdkColorClass, "pixel", "I");
- lpCache->red = (*env)->GetFieldID(env, lpCache->GdkColorClass, "red", "S");
- lpCache->green = (*env)->GetFieldID(env, lpCache->GdkColorClass, "green", "S");
- lpCache->blue = (*env)->GetFieldID(env, lpCache->GdkColorClass, "blue", "S");
- lpCache->cached = 1;
-};
-
-void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventKeyClass = (*env)->GetObjectClass(env, lpGdkEventKey);
-
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "time", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "state", "I");
- lpCache->keyval = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "keyval", "I");
- lpCache->length = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "length", "I");
- lpCache->string = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "string", "I");
- lpCache->cached = 1;
-};
-
-void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventButtonClass = (*env)->GetObjectClass(env, lpGdkEventButton);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "time", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x", "J");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y", "J");
- lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "pressure", "J");
- lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "xtilt", "J");
- lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "ytilt", "J");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "state", "I");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "button", "I");
- lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "source", "I");
- lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "deviceid", "I");
- lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x_root", "J");
- lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y_root", "J");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventMotionClass = (*env)->GetObjectClass(env, lpGdkEventMotion);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "time", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x", "J");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y", "J");
- lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "pressure", "J");
- lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "xtilt", "J");
- lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "ytilt", "J");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "state", "I");
- lpCache->is_hint = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "is_hint", "I");
- lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "source", "I");
- lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "deviceid", "I");
- lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x_root", "J");
- lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y_root", "J");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventExposeClass = (*env)->GetObjectClass(env, lpGdkEventExpose);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "send_event", "B");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "height", "S");
- lpCache->count = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "count", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkFontClass = (*env)->GetObjectClass(env, lpGdkFont);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkFontClass, "type", "I");
- lpCache->ascent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "ascent", "I");
- lpCache->descent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "descent", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkGCValuesClass = (*env)->GetObjectClass(env, lpGdkGCValues);
-
- lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_pixel", "I");
- lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_red", "S");
- lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_green", "S");
- lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_blue", "S");
- lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_pixel", "I");
- lpCache->background_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_red", "S");
- lpCache->background_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_green", "S");
- lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_blue", "S");
- lpCache->font = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "font", "I");
- lpCache->function = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "function", "I");
- lpCache->fill = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "fill", "I");
- lpCache->tile = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "tile", "I");
- lpCache->stipple = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "stipple", "I");
- lpCache->clip_mask = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_mask", "I");
- lpCache->subwindow_mode = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "subwindow_mode", "I");
- lpCache->ts_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_x_origin", "I");
- lpCache->ts_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_y_origin", "I");
- lpCache->clip_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_x_origin", "I");
- lpCache->clip_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_y_origin", "I");
- lpCache->graphics_exposures = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "graphics_exposures", "I");
- lpCache->line_width = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_width", "I");
- lpCache->line_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_style", "I");
- lpCache->cap_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "cap_style", "I");
- lpCache->join_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "join_style", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkImageClass = (*env)->GetObjectClass(env, lpGdkImage);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkImageClass, "type", "I");
- lpCache->visual = (*env)->GetFieldID(env, lpCache->GdkImageClass, "visual", "I");
- lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkImageClass, "byte_order", "I");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkImageClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkImageClass, "height", "S");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkImageClass, "depth", "S");
- lpCache->bpp = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpp", "S");
- lpCache->bpl = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpl", "S");
- lpCache->mem = (*env)->GetFieldID(env, lpCache->GdkImageClass, "mem", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkPointClass = (*env)->GetObjectClass(env, lpGdkPoint);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkPointClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkPointClass, "y", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkRectangleClass = (*env)->GetObjectClass(env, lpGdkRectangle);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkVisualClass = (*env)->GetObjectClass(env, lpGdkVisual);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "type", "I");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "depth", "I");
- lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "byte_order", "I");
- lpCache->colormap_size = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "colormap_size", "I");
- lpCache->bits_per_rgb = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "bits_per_rgb", "I");
- lpCache->red_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_mask", "I");
- lpCache->red_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_shift", "I");
- lpCache->red_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_prec", "I");
- lpCache->green_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_mask", "I");
- lpCache->green_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_shift", "I");
- lpCache->green_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_prec", "I");
- lpCache->blue_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_mask", "I");
- lpCache->blue_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_shift", "I");
- lpCache->blue_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_prec", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkAllocationClass = (*env)->GetObjectClass(env, lpGtkAllocation);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkArgClass = (*env)->GetObjectClass(env, lpGtkArg);
-
- fprintf(stderr, "WARNING: Unimplemented method cacheGtkArgFids.\n");
- lpCache->cached = 1;
-};
-
-void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkBinClass = (*env)->GetObjectClass(env, lpGtkBin);
- cacheGtkContainerFids(env, lpGtkBin, &PGLOB(GtkContainerFc));
- lpCache->child = (*env)->GetFieldID(env, lpCache->GtkBinClass, "child", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCListClass = (*env)->GetObjectClass(env, lpGtkCList);
- cacheGtkContainerFids(env, lpGtkCList, &PGLOB(GtkContainerFc));
- lpCache->clist_flags = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_flags", "S");
- lpCache->row_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_mem_chunk", "I");
- lpCache->cell_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cell_mem_chunk", "I");
- lpCache->freeze_count = (*env)->GetFieldID(env, lpCache->GtkCListClass, "freeze_count", "I");
- lpCache->internal_allocation_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_x", "S");
- lpCache->internal_allocation_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_y", "S");
- lpCache->internal_allocation_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_width", "S");
- lpCache->internal_allocation_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_height", "S");
- lpCache->rows = (*env)->GetFieldID(env, lpCache->GtkCListClass, "rows", "I");
- lpCache->row_center_offset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_center_offset", "I");
- lpCache->row_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_height", "I");
- lpCache->row_list = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list", "I");
- lpCache->row_list_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list_end", "I");
- lpCache->columns = (*env)->GetFieldID(env, lpCache->GtkCListClass, "columns", "I");
- lpCache->column_title_area_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_x", "S");
- lpCache->column_title_area_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_y", "S");
- lpCache->column_title_area_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_width", "S");
- lpCache->column_title_area_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_height", "S");
- lpCache->title_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "title_window", "I");
- lpCache->column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column", "I");
- lpCache->clist_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window", "I");
- lpCache->clist_window_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_width", "I");
- lpCache->clist_window_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_height", "I");
- lpCache->hoffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hoffset", "I");
- lpCache->voffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "voffset", "I");
- lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "shadow_type", "I");
- lpCache->selection_mode = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_mode", "I");
- lpCache->selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection", "I");
- lpCache->selection_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_end", "I");
- lpCache->undo_selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_selection", "I");
- lpCache->undo_unselection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_unselection", "I");
- lpCache->undo_anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_anchor", "I");
- lpCache->button_actions0 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions0", "B");
- lpCache->button_actions1 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions1", "B");
- lpCache->button_actions2 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions2", "B");
- lpCache->button_actions3 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions3", "B");
- lpCache->button_actions4 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions4", "B");
- lpCache->drag_button = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_button", "B");
- lpCache->click_cell_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_row", "I");
- lpCache->click_cell_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_column", "I");
- lpCache->hadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hadjustment", "I");
- lpCache->vadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vadjustment", "I");
- lpCache->xor_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "xor_gc", "I");
- lpCache->fg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "fg_gc", "I");
- lpCache->bg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "bg_gc", "I");
- lpCache->cursor_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cursor_drag", "I");
- lpCache->x_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "x_drag", "I");
- lpCache->focus_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "focus_row", "I");
- lpCache->anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor", "I");
- lpCache->anchor_state = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor_state", "I");
- lpCache->drag_pos = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_pos", "I");
- lpCache->htimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "htimer", "I");
- lpCache->vtimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vtimer", "I");
- lpCache->sort_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_type", "I");
- lpCache->compare = (*env)->GetFieldID(env, lpCache->GtkCListClass, "compare", "I");
- lpCache->sort_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_column", "I");
-
- lpCache->cached = 1;
-};
-
-
-void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkColorSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkColorSelectionDialog);
- cacheGtkWindowFids(env, lpGtkColorSelectionDialog, &PGLOB(GtkWindowFc));
- lpCache->colorsel = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "colorsel", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "main_vbox", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "ok_button", "I");
- lpCache->reset_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "reset_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "cancel_button", "I");
- lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "help_button", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkComboClass = (*env)->GetObjectClass(env, lpGtkCombo);
- cacheGtkHBoxFids(env, lpGtkCombo, &PGLOB(GtkHBoxFc));
- lpCache->entry = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry", "I");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "button", "I");
- lpCache->popup = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popup", "I");
- lpCache->popwin = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popwin", "I");
- lpCache->list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list", "I");
- lpCache->entry_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry_change_id", "I");
- lpCache->list_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list_change_id", "I");
- lpCache->value_in_list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "value_in_list", "I");
- lpCache->ok_if_empty = (*env)->GetFieldID(env, lpCache->GtkComboClass, "ok_if_empty", "I");
- lpCache->case_sensitive = (*env)->GetFieldID(env, lpCache->GtkComboClass, "case_sensitive", "I");
- lpCache->use_arrows = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows", "I");
- lpCache->use_arrows_always = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows_always", "I");
- lpCache->current_button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "current_button", "S");
- lpCache->activate_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "activate_id", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkContainerClass = (*env)->GetObjectClass(env, lpGtkContainer);
- cacheGtkWidgetFids(env, lpGtkContainer, &PGLOB(GtkWidgetFc));
- lpCache->focus_child = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "focus_child", "I");
- lpCache->border_width = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "border_width", "I");
- lpCache->need_resize = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "need_resize", "I");
- lpCache->resize_mode = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_mode", "I");
- lpCache->resize_widgets = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_widgets", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkDataClass = (*env)->GetObjectClass(env, lpGtkData);
- cacheGtkObjectFids(env, lpGtkData, &PGLOB(GtkObjectFc));
-
- lpCache->cached = 1;
-};
-
-void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkEditableClass = (*env)->GetObjectClass(env, lpGtkEditable);
- cacheGtkWidgetFids(env, lpGtkEditable, &PGLOB(GtkWidgetFc));
- lpCache->current_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "current_pos", "I");
- lpCache->selection_start_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_start_pos", "I");
- lpCache->selection_end_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_end_pos", "I");
- lpCache->has_selection = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "has_selection", "I");
- lpCache->editable = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "editable", "I");
- lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "visible", "I");
- lpCache->ic = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic", "I");
- lpCache->ic_attr = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic_attr", "I");
- lpCache->clipboard_text = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "clipboard_text", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkTextClass = (*env)->GetObjectClass(env, lpGtkText);
- cacheGtkEditableFids(env, lpGtkText, &PGLOB(GtkEditableFc));
-
- lpCache->first_line_start_index = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_line_start_index", "I");
- lpCache->first_onscreen_hor_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_hor_pixel", "I");
- lpCache->first_onscreen_ver_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_ver_pixel", "I");
- lpCache->default_tab_width = (*env)->GetFieldID(env, lpCache->GtkTextClass, "default_tab_width", "I");
- lpCache->cursor_pos_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_x", "I");
- lpCache->cursor_pos_y = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_y", "I");
- lpCache->cursor_virtual_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_virtual_x", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFileSelectionClass = (*env)->GetObjectClass(env, lpGtkFileSelection);
- cacheGtkWindowFids(env, lpGtkFileSelection, &PGLOB(GtkWindowFc));
- lpCache->dir_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "dir_list", "I");
- lpCache->file_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "file_list", "I");
- lpCache->selection_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_entry", "I");
- lpCache->selection_text = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_text", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "main_vbox", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "ok_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cancel_button", "I");
- lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "help_button", "I");
- lpCache->history_pulldown = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_pulldown", "I");
- lpCache->history_menu = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_menu", "I");
- lpCache->history_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_list", "I");
- lpCache->fileop_dialog = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_dialog", "I");
- lpCache->fileop_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_entry", "I");
- lpCache->fileop_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_file", "I");
- lpCache->cmpl_state = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cmpl_state", "I");
- lpCache->fileop_c_dir = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_c_dir", "I");
- lpCache->fileop_del_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_del_file", "I");
- lpCache->fileop_ren_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_ren_file", "I");
- lpCache->button_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "button_area", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "action_area", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFontSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkFontSelectionDialog);
- cacheGtkWindowFids(env, lpGtkFontSelectionDialog, &PGLOB(GtkWindowFc));
- lpCache->fontsel = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "fontsel", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "main_vbox", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "action_area", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "ok_button", "I");
- lpCache->apply_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "apply_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "cancel_button", "I");
- lpCache->dialog_width = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "dialog_width", "I");
- lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "auto_resize", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkObjectClass = (*env)->GetObjectClass(env, lpGtkObject);
- lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "klass", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "flags", "I");
- lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "ref_count", "I");
- lpCache->object_data = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "object_data", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkProgressClass = (*env)->GetObjectClass(env, lpGtkProgress);
-
- fprintf(stderr, "WARNING: Unimplemented method cacheGtkProgressFids.\n");
- lpCache->cached = 1;
-};
-
-void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkProgressBarClass = (*env)->GetObjectClass(env, lpGtkProgressBar);
- cacheGtkProgressFids(env, lpGtkProgressBar, &PGLOB(GtkProgressFc));
- lpCache->bar_style = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "bar_style", "I");
- lpCache->orientation = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "orientation", "I");
- lpCache->blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "blocks", "I");
- lpCache->in_block = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "in_block", "I");
- lpCache->activity_pos = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_pos", "I");
- lpCache->activity_step = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_step", "I");
- lpCache->activity_blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_blocks", "I");
- lpCache->activity_dir = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_dir", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkRequisitionClass = (*env)->GetObjectClass(env, lpGtkRequisition);
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkStyleClazz = (*env)->GetObjectClass(env, lpGtkStyle);
- lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "klass", "I");
- lpCache->fg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_pixel", "I");
- lpCache->fg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_red", "S");
- lpCache->fg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_green", "S");
- lpCache->fg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_blue", "S");
- lpCache->fg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_pixel", "I");
- lpCache->fg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_red", "S");
- lpCache->fg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_green", "S");
- lpCache->fg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_blue", "S");
- lpCache->fg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_pixel", "I");
- lpCache->fg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_red", "S");
- lpCache->fg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_green", "S");
- lpCache->fg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_blue", "S");
- lpCache->fg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_pixel", "I");
- lpCache->fg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_red", "S");
- lpCache->fg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_green", "S");
- lpCache->fg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_blue", "S");
- lpCache->fg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_pixel", "I");
- lpCache->fg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_red", "S");
- lpCache->fg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_green", "S");
- lpCache->fg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_blue", "S");
- lpCache->bg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_pixel", "I");
- lpCache->bg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_red", "S");
- lpCache->bg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_green", "S");
- lpCache->bg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_blue", "S");
- lpCache->bg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_pixel", "I");
- lpCache->bg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_red", "S");
- lpCache->bg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_green", "S");
- lpCache->bg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_blue", "S");
- lpCache->bg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_pixel", "I");
- lpCache->bg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_red", "S");
- lpCache->bg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_green", "S");
- lpCache->bg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_blue", "S");
- lpCache->bg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_pixel", "I");
- lpCache->bg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_red", "S");
- lpCache->bg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_green", "S");
- lpCache->bg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_blue", "S");
- lpCache->bg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_pixel", "I");
- lpCache->bg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_red", "S");
- lpCache->bg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_green", "S");
- lpCache->bg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_blue", "S");
- lpCache->light0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_pixel", "I");
- lpCache->light0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_red", "S");
- lpCache->light0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_green", "S");
- lpCache->light0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_blue", "S");
- lpCache->light1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_pixel", "I");
- lpCache->light1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_red", "S");
- lpCache->light1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_green", "S");
- lpCache->light1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_blue", "S");
- lpCache->light2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_pixel", "I");
- lpCache->light2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_red", "S");
- lpCache->light2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_green", "S");
- lpCache->light2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_blue", "S");
- lpCache->light3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_pixel", "I");
- lpCache->light3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_red", "S");
- lpCache->light3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_green", "S");
- lpCache->light3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_blue", "S");
- lpCache->light4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_pixel", "I");
- lpCache->light4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_red", "S");
- lpCache->light4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_green", "S");
- lpCache->light4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_blue", "S");
- lpCache->dark0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_pixel", "I");
- lpCache->dark0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_red", "S");
- lpCache->dark0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_green", "S");
- lpCache->dark0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_blue", "S");
- lpCache->dark1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_pixel", "I");
- lpCache->dark1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_red", "S");
- lpCache->dark1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_green", "S");
- lpCache->dark1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_blue", "S");
- lpCache->dark2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_pixel", "I");
- lpCache->dark2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_red", "S");
- lpCache->dark2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_green", "S");
- lpCache->dark2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_blue", "S");
- lpCache->dark3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_pixel", "I");
- lpCache->dark3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_red", "S");
- lpCache->dark3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_green", "S");
- lpCache->dark3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_blue", "S");
- lpCache->dark4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_pixel", "I");
- lpCache->dark4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_red", "S");
- lpCache->dark4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_green", "S");
- lpCache->dark4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_blue", "S");
- lpCache->mid0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_pixel", "I");
- lpCache->mid0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_red", "S");
- lpCache->mid0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_green", "S");
- lpCache->mid0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_blue", "S");
- lpCache->mid1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_pixel", "I");
- lpCache->mid1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_red", "S");
- lpCache->mid1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_green", "S");
- lpCache->mid1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_blue", "S");
- lpCache->mid2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_pixel", "I");
- lpCache->mid2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_red", "S");
- lpCache->mid2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_green", "S");
- lpCache->mid2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_blue", "S");
- lpCache->mid3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_pixel", "I");
- lpCache->mid3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_red", "S");
- lpCache->mid3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_green", "S");
- lpCache->mid3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_blue", "S");
- lpCache->mid4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_pixel", "I");
- lpCache->mid4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_red", "S");
- lpCache->mid4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_green", "S");
- lpCache->mid4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_blue", "S");
- lpCache->text0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_pixel", "I");
- lpCache->text0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_red", "S");
- lpCache->text0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_green", "S");
- lpCache->text0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_blue", "S");
- lpCache->text1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_pixel", "I");
- lpCache->text1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_red", "S");
- lpCache->text1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_green", "S");
- lpCache->text1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_blue", "S");
- lpCache->text2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_pixel", "I");
- lpCache->text2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_red", "S");
- lpCache->text2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_green", "S");
- lpCache->text2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_blue", "S");
- lpCache->text3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_pixel", "I");
- lpCache->text3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_red", "S");
- lpCache->text3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_green", "S");
- lpCache->text3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_blue", "S");
- lpCache->text4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_pixel", "I");
- lpCache->text4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_red", "S");
- lpCache->text4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_green", "S");
- lpCache->text4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_blue", "S");
- lpCache->base0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_pixel", "I");
- lpCache->base0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_red", "S");
- lpCache->base0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_green", "S");
- lpCache->base0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_blue", "S");
- lpCache->base1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_pixel", "I");
- lpCache->base1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_red", "S");
- lpCache->base1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_green", "S");
- lpCache->base1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_blue", "S");
- lpCache->base2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_pixel", "I");
- lpCache->base2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_red", "S");
- lpCache->base2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_green", "S");
- lpCache->base2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_blue", "S");
- lpCache->base3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_pixel", "I");
- lpCache->base3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_red", "S");
- lpCache->base3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_green", "S");
- lpCache->base3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_blue", "S");
- lpCache->base4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_pixel", "I");
- lpCache->base4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_red", "S");
- lpCache->base4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_green", "S");
- lpCache->base4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_blue", "S");
- lpCache->black_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_pixel", "I");
- lpCache->black_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_red", "S");
- lpCache->black_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_green", "S");
- lpCache->black_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_blue", "S");
- lpCache->white_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_pixel", "I");
- lpCache->white_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_red", "S");
- lpCache->white_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_green", "S");
- lpCache->white_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_blue", "S");
- lpCache->font = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "font", "I");
- lpCache->fg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc0", "I");
- lpCache->fg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc1", "I");
- lpCache->fg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc2", "I");
- lpCache->fg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc3", "I");
- lpCache->fg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc4", "I");
- lpCache->bg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc0", "I");
- lpCache->bg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc1", "I");
- lpCache->bg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc2", "I");
- lpCache->bg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc3", "I");
- lpCache->bg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc4", "I");
- lpCache->light_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc0", "I");
- lpCache->light_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc1", "I");
- lpCache->light_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc2", "I");
- lpCache->light_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc3", "I");
- lpCache->light_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc4", "I");
- lpCache->dark_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc0", "I");
- lpCache->dark_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc1", "I");
- lpCache->dark_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc2", "I");
- lpCache->dark_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc3", "I");
- lpCache->dark_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc4", "I");
- lpCache->mid_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc0", "I");
- lpCache->mid_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc1", "I");
- lpCache->mid_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc2", "I");
- lpCache->mid_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc3", "I");
- lpCache->mid_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc4", "I");
- lpCache->text_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc0", "I");
- lpCache->text_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc1", "I");
- lpCache->text_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc2", "I");
- lpCache->text_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc3", "I");
- lpCache->text_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc4", "I");
- lpCache->base_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc0", "I");
- lpCache->base_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc1", "I");
- lpCache->base_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc2", "I");
- lpCache->base_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc3", "I");
- lpCache->base_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc4", "I");
- lpCache->black_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_gc", "I");
- lpCache->white_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_gc", "I");
- lpCache->bg_pixmap0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap0", "I");
- lpCache->bg_pixmap1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap1", "I");
- lpCache->bg_pixmap2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap2", "I");
- lpCache->bg_pixmap3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap3", "I");
- lpCache->bg_pixmap4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap4", "I");
- lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "ref_count", "I");
- lpCache->attach_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "attach_count", "I");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "depth", "I");
- lpCache->colormap = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "colormap", "I");
- lpCache->engine = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine", "I");
- lpCache->engine_data = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine_data", "I");
- lpCache->rc_style = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "rc_style", "I");
- lpCache->styles = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "styles", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkStyleClassClazz = (*env)->GetObjectClass(env, lpGtkStyleClass);
- lpCache->xthickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "xthickness", "I");
- lpCache->ythickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "ythickness", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkWidgetClass = (*env)->GetObjectClass(env, lpGtkWidget);
- cacheGtkObjectFids(env, lpGtkWidget, &PGLOB(GtkObjectFc));
- lpCache->private_flags = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "private_flags", "S");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "state", "B");
- lpCache->saved_state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "saved_state", "B");
- lpCache->name = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "name", "I");
- lpCache->style = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "style", "I");
- lpCache->req_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_width", "S");
- lpCache->req_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_height", "S");
- lpCache->alloc_x = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_x", "S");
- lpCache->alloc_y = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_y", "S");
- lpCache->alloc_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_width", "S");
- lpCache->alloc_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_height", "S");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "window", "I");
- lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "parent", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFrameFids(JNIEnv *env, jobject lpGtkFrame, PGtkFrame_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFrameClass = (*env)->GetObjectClass(env, lpGtkFrame);
- cacheGtkBinFids(env, lpGtkFrame, &PGLOB(GtkBinFc));
- lpCache->label = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label", "I");
- lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "shadow_type", "S");
- lpCache->label_width = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_width", "S");
- lpCache->label_height = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_height", "S");
- lpCache->label_xalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_xalign", "F");
- lpCache->label_yalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_yalign", "F");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkWindowClass = (*env)->GetObjectClass(env, lpGtkWindow);
- cacheGtkBinFids(env, lpGtkWindow, &PGLOB(GtkBinFc));
- lpCache->title = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "title", "I");
- lpCache->wmclass_name = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_name", "I");
- lpCache->wmclass_class = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_class", "I");
- lpCache->type = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "type", "I");
- lpCache->focus_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "focus_widget", "I");
- lpCache->default_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "default_widget", "I");
- lpCache->transient_parent = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "transient_parent", "I");
- lpCache->resize_count = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "resize_count", "S");
- lpCache->allow_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_shrink", "I");
- lpCache->allow_grow = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_grow", "I");
- lpCache->auto_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "auto_shrink", "I");
- lpCache->handling_resize = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "handling_resize", "I");
- lpCache->position = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "position", "I");
- lpCache->use_uposition = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "use_uposition", "I");
- lpCache->modal = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "modal", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkDialogFids(JNIEnv *env, jobject lpGtkDialog, PGtkDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkDialogClass = (*env)->GetObjectClass(env, lpGtkDialog);
- cacheGtkWindowFids(env, lpGtkDialog, &PGLOB(GtkWindowFc));
- lpCache->vbox = (*env)->GetFieldID(env, lpCache->GtkDialogClass, "vbox", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkDialogClass, "action_area", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCheckMenuItemClass = (*env)->GetObjectClass(env, lpGtkCheckMenuItem);
- cacheGtkMenuItemFids(env, lpGtkCheckMenuItem, &PGLOB(GtkMenuItemFc));
- lpCache->active = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "active", "I");
- lpCache->always_show_toggle = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "always_show_toggle", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkAdjustmentClass = (*env)->GetObjectClass(env, lpGtkAdjustment);
- cacheGtkDataFids(env, lpGtkAdjustment, &PGLOB(GtkDataFc));
- lpCache->lower = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "lower", "F");
- lpCache->upper = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "upper", "F");
- lpCache->value = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "value", "F");
- lpCache->step_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "step_increment", "F");
- lpCache->page_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_increment", "F");
- lpCache->page_size = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_size", "F");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkBoxClass = (*env)->GetObjectClass(env, lpGtkBox);
- cacheGtkContainerFids(env, lpGtkBox, &PGLOB(GtkContainerFc));
- lpCache->children = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "children", "I");
- lpCache->spacing = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "spacing", "S");
- lpCache->homogeneous = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "homogeneous", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkHBoxClass = (*env)->GetObjectClass(env, lpGtkHBox);
- cacheGtkBoxFids(env, lpGtkHBox, &PGLOB(GtkBoxFc));
-
- lpCache->cached = 1;
-};
-
-void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuClass = (*env)->GetObjectClass(env, lpGtkMenu);
- cacheGtkMenuShellFids(env, lpGtkMenu, &PGLOB(GtkMenuShellFc));
- lpCache->parent_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "parent_menu_item", "I");
- lpCache->old_active_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "old_active_menu_item", "I");
- lpCache->accel_group = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "accel_group", "I");
- lpCache->position_func = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func", "I");
- lpCache->position_func_data = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func_data", "I");
- lpCache->toplevel = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "toplevel", "I");
- lpCache->tearoff_window = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "tearoff_window", "I");
- lpCache->torn_off = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "torn_off", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuShellClass = (*env)->GetObjectClass(env, lpGtkMenuShell);
- cacheGtkContainerFids(env, lpGtkMenuShell, &PGLOB(GtkContainerFc));
- lpCache->active = (*env)->GetFieldID(env, lpCache->GtkMenuShellClass, "active", "I");
- lpCache->cached = 1;
-
-};
-
-void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkItemClass = (*env)->GetObjectClass(env, lpGtkItem);
- cacheGtkBinFids(env, lpGtkItem, &PGLOB(GtkBinFc));
-
- lpCache->cached = 1;
-}
-
-void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuItemClass = (*env)->GetObjectClass(env, lpGtkMenuItem);
- cacheGtkItemFids(env, lpGtkMenuItem, &PGLOB(GtkItemFc));
- lpCache->submenu = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu", "I");
- lpCache->accelerator_signal = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_signal", "I");
- lpCache->toggle_size = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "toggle_size", "I");
- lpCache->accelerator_width = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_width", "I");
- lpCache->show_toggle_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_toggle_indicator", "I");
- lpCache->show_submenu_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_submenu_indicator", "I");
- lpCache->submenu_placement = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_placement", "I");
- lpCache->submenu_direction = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_direction", "I");
- lpCache->right_justify = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "right_justify", "I");
- lpCache->timer = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "timer", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkCListRowClass = (*env)->GetObjectClass(env, lpGtkCListRow);
- lpCache->cell = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "cell", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "state", "I");
- lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_red", "S");
- lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_green", "S");
- lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_blue", "S");
- lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_pixel", "I");
- lpCache->background_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_red", "S");
- lpCache->background_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_green", "S");
- lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_blue", "S");
- lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_pixel", "I");
- lpCache->style = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "style", "I");
- lpCache->data = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "data", "I");
- lpCache->destroy = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "destroy", "I");
- lpCache->fg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "fg_set", "I");
- lpCache->bg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "bg_set", "I");
- lpCache->selectable = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "selectable", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkCListColumnClass = (*env)->GetObjectClass(env, lpGtkCListColumn);
- lpCache->title = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "title", "I");
- lpCache->area_x = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_x", "S");
- lpCache->area_y = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_y", "S");
- lpCache->area_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_width", "S");
- lpCache->area_height = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_height", "S");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "window", "I");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width", "I");
- lpCache->min_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "min_width", "I");
- lpCache->max_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "max_width", "I");
- lpCache->justification = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "justification", "I");
- lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "visible", "I");
- lpCache->width_set = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width_set", "I");
- lpCache->resizeable = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "resizeable", "I");
- lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "auto_resize", "I");
- lpCache->button_passive = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button_passive", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCTreeClass = (*env)->GetObjectClass(env, lpGtkCTree);
- cacheGtkCListFids(env, lpGtkCTree, &PGLOB(GtkCListFc));
- lpCache->tree_indent = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_indent", "I");
- lpCache->tree_column = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_column", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCTreeRowClass = (*env)->GetObjectClass(env, lpGtkCTreeRow);
- cacheGtkCListRowFids(env, lpGtkCTreeRow, &PGLOB(GtkCListRowFc));
- lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "parent", "I");
- lpCache->sibling = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "sibling", "I");
- lpCache->children = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "children", "I");
- lpCache->pixmap_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_closed", "I");
- lpCache->mask_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_closed", "I");
- lpCache->pixmap_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_opened", "I");
- lpCache->mask_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_opened", "I");
- lpCache->level = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "level", "S");
- lpCache->is_leaf = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "is_leaf", "I");
- lpCache->expanded = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "expanded", "I");
-
- lpCache->cached = 1;
-}
-
-/* ----------- swt getters and setters ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- */
-void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
-{
- lpGdkColor->pixel = (*env)->GetIntField(env, lpObject, lpGdkColorFc->pixel);
- lpGdkColor->red = (*env)->GetShortField(env, lpObject, lpGdkColorFc->red);
- lpGdkColor->green = (*env)->GetShortField(env, lpObject, lpGdkColorFc->green);
- lpGdkColor->blue = (*env)->GetShortField(env, lpObject, lpGdkColorFc->blue);
-}
-
-void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkColorFc->pixel, (jint)lpGdkColor->pixel);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->red, (jshort)lpGdkColor->red);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->green, (jshort)lpGdkColor->green);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->blue, (jshort)lpGdkColor->blue);
-}
-
-void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
-{
- GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
- lpGdkEventKey->type = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->type);
- lpGdkEventKey->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->window);
- lpGdkEventKey->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventKeyFc->send_event);
- lpGdkEventKey->time = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->time);
- lpGdkEventKey->state = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->state);
- lpGdkEventKey->keyval = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->keyval);
- lpGdkEventKey->length = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->length);
- lpGdkEventKey->string = (char*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->string);
-}
-
-void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
-{
- GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->type, (jint)lpGdkEventKey->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->window, (jint)lpGdkEventKey->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventKeyFc->send_event, (jbyte)lpGdkEventKey->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->time, (jint)lpGdkEventKey->time);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->state, (jint)lpGdkEventKey->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->keyval, (jint)lpGdkEventKey->keyval);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->length, (jint)lpGdkEventKey->length);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->string, (jint)lpGdkEventKey->string);
-}
-
-void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
-{
- GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
- lpGdkEventButton->type = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->type);
- lpGdkEventButton->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->window);
- lpGdkEventButton->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventButtonFc->send_event);
- lpGdkEventButton->time = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->time);
- lpGdkEventButton->x = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x);
- lpGdkEventButton->y = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y);
- lpGdkEventButton->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->pressure);
- lpGdkEventButton->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->xtilt);
- lpGdkEventButton->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->ytilt);
- lpGdkEventButton->state = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->state);
- lpGdkEventButton->button = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->button);
- lpGdkEventButton->source = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->source);
- lpGdkEventButton->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->deviceid);
- lpGdkEventButton->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x_root);
- lpGdkEventButton->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y_root);
-}
-
-void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
-{
- GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->type, (jint)lpGdkEventButton->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->window, (jint)lpGdkEventButton->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventButtonFc->send_event, (jbyte)lpGdkEventButton->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->time, (jint)lpGdkEventButton->time);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x, (jlong)lpGdkEventButton->x);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y, (jlong)lpGdkEventButton->y);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->pressure, (jlong)lpGdkEventButton->pressure);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->xtilt, (jlong)lpGdkEventButton->xtilt);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->ytilt, (jlong)lpGdkEventButton->ytilt);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->state, (jint)lpGdkEventButton->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->button, (jint)lpGdkEventButton->button);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->source, (jint)lpGdkEventButton->source);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->deviceid, (jint)lpGdkEventButton->deviceid);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x_root, (jlong)lpGdkEventButton->x_root);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y_root, (jlong)lpGdkEventButton->y_root);
-}
-
-void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
-{
- GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
- lpGdkEventMotion->type = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->type);
- lpGdkEventMotion->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->window);
- lpGdkEventMotion->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventMotionFc->send_event);
- lpGdkEventMotion->time = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->time);
- lpGdkEventMotion->x = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x);
- lpGdkEventMotion->y = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y);
- lpGdkEventMotion->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->pressure);
- lpGdkEventMotion->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->xtilt);
- lpGdkEventMotion->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->ytilt);
- lpGdkEventMotion->state = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->state);
- lpGdkEventMotion->is_hint = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->is_hint);
- lpGdkEventMotion->source = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->source);
- lpGdkEventMotion->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->deviceid);
- lpGdkEventMotion->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x_root);
- lpGdkEventMotion->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y_root);
-}
-
-void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
-{
- GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->type, lpGdkEventMotion->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->window, (jint)lpGdkEventMotion->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventMotionFc->send_event, lpGdkEventMotion->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->time, (jint)lpGdkEventMotion->time);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x, (jlong)lpGdkEventMotion->x);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y, (jlong)lpGdkEventMotion->y);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->pressure, (jlong)lpGdkEventMotion->pressure);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->xtilt, (jlong)lpGdkEventMotion->xtilt);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->ytilt, (jlong)lpGdkEventMotion->ytilt);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->state, (jint)lpGdkEventMotion->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->is_hint, (jint)lpGdkEventMotion->is_hint);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->source, (jint)lpGdkEventMotion->source);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->deviceid, (jint)lpGdkEventMotion->deviceid);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x_root, (jlong)lpGdkEventMotion->x_root);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y_root, (jlong)lpGdkEventMotion->y_root);
-}
-
-void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
-{
- GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
- lpGdkEventExpose->area.x = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->x);
- lpGdkEventExpose->area.y = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->y);
- lpGdkEventExpose->area.width = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->width);
- lpGdkEventExpose->area.height = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->height);
- lpGdkEventExpose->count = (*env)->GetIntField(env, lpObject, lpGdkEventExposeFc->count);
-}
-
-void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
-{
- GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->x, (jshort)lpGdkEventExpose->area.x);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->y, (jshort)lpGdkEventExpose->area.y);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->width, (jshort)lpGdkEventExpose->area.width);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->height, (jshort)lpGdkEventExpose->area.height);
- (*env)->SetIntField(env, lpObject, lpGdkEventExposeFc->count, (jint)lpGdkEventExpose->count);
-}
-
-void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
-{
- lpGdkFont->type = (*env)->GetIntField(env, lpObject, lpGdkFontFc->type);
- lpGdkFont->ascent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->ascent);
- lpGdkFont->descent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->descent);
-}
-
-void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->type, (jint)lpGdkFont->type);
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->ascent, (jint)lpGdkFont->ascent);
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->descent, (jint)lpGdkFont->descent);
-}
-
-void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
-{
- lpGdkGCValues->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel);
- lpGdkGCValues->foreground.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red);
- lpGdkGCValues->foreground.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green);
- lpGdkGCValues->foreground.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue);
- lpGdkGCValues->background.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel);
- lpGdkGCValues->background.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_red);
- lpGdkGCValues->background.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_green);
- lpGdkGCValues->background.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_blue);
- lpGdkGCValues->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->font);
- lpGdkGCValues->function = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->function);
- lpGdkGCValues->fill = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->fill);
- lpGdkGCValues->tile = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->tile);
- lpGdkGCValues->stipple = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->stipple);
- lpGdkGCValues->clip_mask = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask);
- lpGdkGCValues->subwindow_mode = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode);
- lpGdkGCValues->ts_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin);
- lpGdkGCValues->ts_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin);
- lpGdkGCValues->clip_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin);
- lpGdkGCValues->clip_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin);
- lpGdkGCValues->graphics_exposures = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures);
- lpGdkGCValues->line_width = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_width);
- lpGdkGCValues->line_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_style);
- lpGdkGCValues->cap_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->cap_style);
- lpGdkGCValues->join_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->join_style);
-}
-
-void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel, (jint)lpGdkGCValues->foreground.pixel);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red, (jshort)lpGdkGCValues->foreground.red);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green, (jshort)lpGdkGCValues->foreground.green);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue, (jshort)lpGdkGCValues->foreground.blue);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel, (jint)lpGdkGCValues->background.pixel);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_red, (jshort)lpGdkGCValues->background.red);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_green, (jshort)lpGdkGCValues->background.green);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_blue, (jshort)lpGdkGCValues->background.blue);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->font, (jint)lpGdkGCValues->font);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->function, (jint)lpGdkGCValues->function);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->fill, (jint)lpGdkGCValues->fill);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->tile, (jint)lpGdkGCValues->tile);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->stipple, (jint)lpGdkGCValues->stipple);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask, (jint)lpGdkGCValues->clip_mask);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode, (jint)lpGdkGCValues->subwindow_mode);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin, (jint)lpGdkGCValues->ts_x_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin, (jint)lpGdkGCValues->ts_y_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin, (jint)lpGdkGCValues->clip_x_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin, (jint)lpGdkGCValues->clip_y_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures, (jint)lpGdkGCValues->graphics_exposures);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_width, (jint)lpGdkGCValues->line_width);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_style, (jint)lpGdkGCValues->line_style);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->cap_style, (jint)lpGdkGCValues->cap_style);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->join_style, (jint)lpGdkGCValues->join_style);
-}
-
-void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
-{
- lpGdkImage->type = (*env)->GetIntField(env, lpObject, lpGdkImageFc->type);
- lpGdkImage->visual = (GdkVisual*)(*env)->GetIntField(env, lpObject, lpGdkImageFc->visual);
- lpGdkImage->byte_order = (*env)->GetIntField(env, lpObject, lpGdkImageFc->byte_order);
- lpGdkImage->width = (*env)->GetShortField(env, lpObject, lpGdkImageFc->width);
- lpGdkImage->height = (*env)->GetShortField(env, lpObject, lpGdkImageFc->height);
- lpGdkImage->depth = (*env)->GetShortField(env, lpObject, lpGdkImageFc->depth);
- lpGdkImage->bpp = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpp);
- lpGdkImage->bpl = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpl);
- lpGdkImage->mem = (gpointer)(*env)->GetIntField(env, lpObject, lpGdkImageFc->mem);
-}
-
-void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->type, (jint)lpGdkImage->type);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->visual, (jint)lpGdkImage->visual);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->byte_order, (jint)lpGdkImage->byte_order);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->width, (jshort)lpGdkImage->width);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->height, (jshort)lpGdkImage->height);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->depth, (jshort)lpGdkImage->depth);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpp, (jshort)lpGdkImage->bpp);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpl, (jshort)lpGdkImage->bpl);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->mem, (jint)lpGdkImage->mem);
-}
-
-void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
-{
- lpGdkPoint->x = (*env)->GetShortField(env, lpObject, lpGdkPointFc->x);
- lpGdkPoint->y = (*env)->GetShortField(env, lpObject, lpGdkPointFc->y);
-}
-
-void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
-{
- (*env)->SetShortField(env, lpObject, lpGdkPointFc->x, (jshort)lpGdkPoint->x);
- (*env)->SetShortField(env, lpObject, lpGdkPointFc->y, (jshort)lpGdkPoint->y);
-}
-
-void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
-{
- lpGdkRectangle->x = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->x);
- lpGdkRectangle->y = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->y);
- lpGdkRectangle->width = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->width);
- lpGdkRectangle->height = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->height);
-}
-
-void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
-{
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->x, (jshort)lpGdkRectangle->x);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->y, (jshort)lpGdkRectangle->y);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->width, (jshort)lpGdkRectangle->width);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->height, (jshort)lpGdkRectangle->height);
-}
-
-void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
-{
- lpGdkVisual->type = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->type);
- lpGdkVisual->depth = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->depth);
- lpGdkVisual->byte_order = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->byte_order);
- lpGdkVisual->colormap_size = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->colormap_size);
- lpGdkVisual->bits_per_rgb = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb);
- lpGdkVisual->red_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_mask);
- lpGdkVisual->red_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_shift);
- lpGdkVisual->red_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_prec);
- lpGdkVisual->green_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_mask);
- lpGdkVisual->green_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_shift);
- lpGdkVisual->green_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_prec);
- lpGdkVisual->blue_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_mask);
- lpGdkVisual->blue_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_shift);
- lpGdkVisual->blue_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_prec);
-}
-
-void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->type, (jint)lpGdkVisual->type);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->depth, (jint)lpGdkVisual->depth);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->byte_order, (jint)lpGdkVisual->byte_order);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->colormap_size, (jint)lpGdkVisual->colormap_size);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb, (jint)lpGdkVisual->bits_per_rgb);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_mask, (jint)lpGdkVisual->red_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_shift, (jint)lpGdkVisual->red_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_prec, (jint)lpGdkVisual->red_prec);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_mask, (jint)lpGdkVisual->green_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_shift, (jint)lpGdkVisual->green_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_prec, (jint)lpGdkVisual->green_prec);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_mask, (jint)lpGdkVisual->blue_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_shift, (jint)lpGdkVisual->blue_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_prec, (jint)lpGdkVisual->blue_prec);
-}
-
-void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
-{
- lpGtkAllocation->x = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->x);
- lpGtkAllocation->y = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->y);
- lpGtkAllocation->width = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->width);
- lpGtkAllocation->height = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->height);
-}
-
-void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
-{
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->x, lpGtkAllocation->x);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->y, lpGtkAllocation->y);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->width, lpGtkAllocation->width);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->height, lpGtkAllocation->height);
-}
-
-void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
-{
- fprintf(stderr, "WARNING: Unimplemented method getGtkArgFields.\n");
-}
-
-void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
-{
- fprintf(stderr, "WARNING: Unimplemented method setGtkArgFields.\n");
-}
-
-void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
- lpGtkBin->child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkBinFc->child);
-}
-
-void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkBinFc->child, (jint)lpGtkBin->child);
-}
-
-void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
- lpGtkBox->children = (GList*)(*env)->GetIntField(env, lpObject, lpGtkBoxFc->children);
- lpGtkBox->spacing = (*env)->GetShortField(env, lpObject, lpGtkBoxFc->spacing);
- lpGtkBox->homogeneous = (*env)->GetIntField(env, lpObject, lpGtkBoxFc->homogeneous);
-}
-
-void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkBoxFc->children, (jint)lpGtkBox->children);
- (*env)->SetShortField(env, lpObject, lpGtkBoxFc->spacing, (jshort)lpGtkBox->spacing);
- (*env)->SetIntField(env, lpObject, lpGtkBoxFc->homogeneous, (jint)lpGtkBox->homogeneous);
-}
-
-void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
- lpGtkCList->flags = (*env)->GetShortField(env, lpObject, lpGtkCListFc->clist_flags);
- lpGtkCList->row_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk);
- lpGtkCList->cell_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk);
- lpGtkCList->freeze_count = (*env)->GetIntField(env, lpObject, lpGtkCListFc->freeze_count);
- lpGtkCList->internal_allocation.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x);
- lpGtkCList->internal_allocation.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y);
- lpGtkCList->internal_allocation.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width);
- lpGtkCList->internal_allocation.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height);
- lpGtkCList->rows = (*env)->GetIntField(env, lpObject, lpGtkCListFc->rows);
- lpGtkCList->row_center_offset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_center_offset);
- lpGtkCList->row_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_height);
- lpGtkCList->row_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list);
- lpGtkCList->row_list_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list_end);
- lpGtkCList->columns = (*env)->GetIntField(env, lpObject, lpGtkCListFc->columns);
- lpGtkCList->column_title_area.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_x);
- lpGtkCList->column_title_area.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_y);
- lpGtkCList->column_title_area.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_width);
- lpGtkCList->column_title_area.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_height);
- lpGtkCList->title_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->title_window);
- lpGtkCList->column = (GtkCListColumn*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->column);
- lpGtkCList->clist_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window);
- lpGtkCList->clist_window_width = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_width);
- lpGtkCList->clist_window_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_height);
- lpGtkCList->hoffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->hoffset);
- lpGtkCList->voffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->voffset);
- lpGtkCList->shadow_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->shadow_type);
- lpGtkCList->selection_mode = (*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_mode);
- lpGtkCList->selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection);
- lpGtkCList->selection_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_end);
- lpGtkCList->undo_selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_selection);
- lpGtkCList->undo_unselection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_unselection);
- lpGtkCList->undo_anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_anchor);
- lpGtkCList->button_actions[0] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions0);
- lpGtkCList->button_actions[1] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions1);
- lpGtkCList->button_actions[2] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions2);
- lpGtkCList->button_actions[3] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions3);
- lpGtkCList->button_actions[4] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions4);
- lpGtkCList->drag_button = (*env)->GetByteField(env, lpObject, lpGtkCListFc->drag_button);
- lpGtkCList->click_cell.row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_row);
- lpGtkCList->click_cell.column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_column);
- lpGtkCList->hadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->hadjustment);
- lpGtkCList->vadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->vadjustment);
- lpGtkCList->xor_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->xor_gc);
- lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
- lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
- lpGtkCList->cursor_drag = (GdkCursor*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cursor_drag);
- lpGtkCList->x_drag = (*env)->GetIntField(env, lpObject, lpGtkCListFc->x_drag);
- lpGtkCList->focus_row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->focus_row);
- lpGtkCList->anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor);
- lpGtkCList->anchor_state = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor_state);
- lpGtkCList->drag_pos = (*env)->GetIntField(env, lpObject, lpGtkCListFc->drag_pos);
- lpGtkCList->htimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->htimer);
- lpGtkCList->vtimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->vtimer);
- lpGtkCList->sort_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_type);
- lpGtkCList->compare = (GtkCListCompareFunc)(*env)->GetIntField(env, lpObject, lpGtkCListFc->compare);
- lpGtkCList->sort_column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_column);
-}
-
-void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->clist_flags, (jshort)lpGtkCList->flags);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk, (jint)lpGtkCList->row_mem_chunk);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk, (jint)lpGtkCList->cell_mem_chunk);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->freeze_count, (jint)lpGtkCList->freeze_count);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x, (jshort)lpGtkCList->internal_allocation.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y, (jshort)lpGtkCList->internal_allocation.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width, (jshort)lpGtkCList->internal_allocation.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height, (jshort)lpGtkCList->internal_allocation.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->rows, (jint)lpGtkCList->rows);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_center_offset, (jint)lpGtkCList->row_center_offset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_height, (jint)lpGtkCList->row_height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list, (jint)lpGtkCList->row_list);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list_end, (jint)lpGtkCList->row_list_end);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->columns, (jint)lpGtkCList->columns);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_x, (jshort)lpGtkCList->column_title_area.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_y, (jshort)lpGtkCList->column_title_area.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_width, (jshort)lpGtkCList->column_title_area.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_height, (jshort)lpGtkCList->column_title_area.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->title_window, (jint)lpGtkCList->title_window);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->column, (jint)lpGtkCList->column);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window, (jint)lpGtkCList->clist_window);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_width, (jint)lpGtkCList->clist_window_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_height, (jint)lpGtkCList->clist_window_height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->hoffset, (jint)lpGtkCList->hoffset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->voffset, (jint)lpGtkCList->voffset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->shadow_type, (jint)lpGtkCList->shadow_type);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_mode, (jint)lpGtkCList->selection_mode);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection, (jint)lpGtkCList->selection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_end, (jint)lpGtkCList->selection_end);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_selection, (jint)lpGtkCList->undo_selection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_unselection, (jint)lpGtkCList->undo_unselection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_anchor, (jint)lpGtkCList->undo_anchor);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions0, (jbyte)lpGtkCList->button_actions[0]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions1, (jbyte)lpGtkCList->button_actions[1]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions2, (jbyte)lpGtkCList->button_actions[2]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions3, (jbyte)lpGtkCList->button_actions[3]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions4, (jbyte)lpGtkCList->button_actions[4]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->drag_button, (jbyte)lpGtkCList->drag_button);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_row, (jint)lpGtkCList->click_cell.row);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_column, (jint)lpGtkCList->click_cell.column);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->hadjustment, (jint)lpGtkCList->hadjustment);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->vadjustment, (jint)lpGtkCList->vadjustment);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->xor_gc, (jint)lpGtkCList->xor_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->cursor_drag, (jint)lpGtkCList->cursor_drag);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->x_drag, (jint)lpGtkCList->x_drag);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->focus_row, (jint)lpGtkCList->focus_row);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor, (jint)lpGtkCList->anchor);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor_state, (jint)lpGtkCList->anchor_state);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->drag_pos, (jint)lpGtkCList->drag_pos);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->htimer, (jint)lpGtkCList->htimer);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->vtimer, (jint)lpGtkCList->vtimer);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_type, (jint)lpGtkCList->sort_type);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->compare, (jint)lpGtkCList->compare);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_column, (jint)lpGtkCList->sort_column);
-}
-
-void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
- lpGtkColorSelectionDialog->colorsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel);
- lpGtkColorSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox);
- lpGtkColorSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button);
- lpGtkColorSelectionDialog->reset_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button);
- lpGtkColorSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button);
- lpGtkColorSelectionDialog->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button);
-}
-
-void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel, (jint)lpGtkColorSelectionDialog->colorsel);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox, (jint)lpGtkColorSelectionDialog->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button, (jint)lpGtkColorSelectionDialog->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button, (jint)lpGtkColorSelectionDialog->reset_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button, (jint)lpGtkColorSelectionDialog->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button, (jint)lpGtkColorSelectionDialog->help_button);
-}
-
-void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
-{
- DECL_GLOB(pGlob)
- getGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
- lpGtkCombo->entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->entry);
- lpGtkCombo->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->button);
- lpGtkCombo->popup = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popup);
- lpGtkCombo->popwin = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popwin);
- lpGtkCombo->list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->list);
- lpGtkCombo->entry_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->entry_change_id);
- lpGtkCombo->list_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->list_change_id);
- lpGtkCombo->value_in_list = (*env)->GetIntField(env, lpObject, lpGtkComboFc->value_in_list);
- lpGtkCombo->ok_if_empty = (*env)->GetIntField(env, lpObject, lpGtkComboFc->ok_if_empty);
- lpGtkCombo->case_sensitive = (*env)->GetIntField(env, lpObject, lpGtkComboFc->case_sensitive);
- lpGtkCombo->use_arrows = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows);
- lpGtkCombo->use_arrows_always = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows_always);
- lpGtkCombo->current_button = (*env)->GetShortField(env, lpObject, lpGtkComboFc->current_button);
- lpGtkCombo->activate_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->activate_id);
-}
-
-void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
-{
- DECL_GLOB(pGlob)
- setGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry, (jint)lpGtkCombo->entry);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->button, (jint)lpGtkCombo->button);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->popup, (jint)lpGtkCombo->popup);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->popwin, (jint)lpGtkCombo->popwin);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->list, (jint)lpGtkCombo->list);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry_change_id, (jint)lpGtkCombo->entry_change_id);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->list_change_id, (jint)lpGtkCombo->list_change_id);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->value_in_list, (jint)lpGtkCombo->value_in_list);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->ok_if_empty, (jint)lpGtkCombo->ok_if_empty);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->case_sensitive, (jint)lpGtkCombo->case_sensitive);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows, (jint)lpGtkCombo->use_arrows);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows_always, (jint)lpGtkCombo->use_arrows_always);
- (*env)->SetShortField(env, lpObject, lpGtkComboFc->current_button, (jshort)lpGtkCombo->current_button);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->activate_id, (jint)lpGtkCombo->activate_id);
-}
-
-void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
- lpGtkContainer->focus_child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->focus_child);
- lpGtkContainer->border_width = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->border_width);
- lpGtkContainer->need_resize = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->need_resize);
- lpGtkContainer->resize_mode = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_mode);
- lpGtkContainer->resize_widgets = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_widgets);
-}
-
-void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->focus_child, (jint)lpGtkContainer->focus_child);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->border_width, (jint)lpGtkContainer->border_width);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->need_resize, (jint)lpGtkContainer->need_resize);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_mode, (jint)lpGtkContainer->resize_mode);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_widgets, (jint)lpGtkContainer->resize_widgets);
-}
-
-void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
- lpGtkEditable->current_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->current_pos);
- lpGtkEditable->selection_start_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos);
- lpGtkEditable->selection_end_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos);
- lpGtkEditable->has_selection = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->has_selection);
- lpGtkEditable->editable = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->editable);
- lpGtkEditable->visible = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->visible);
- lpGtkEditable->ic = (GdkIC*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic);
- lpGtkEditable->ic_attr = (GdkICAttr*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic_attr);
- lpGtkEditable->clipboard_text = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->clipboard_text);
-}
-
-void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->current_pos, (jint)lpGtkEditable->current_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos, (jint)lpGtkEditable->selection_start_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos, (jint)lpGtkEditable->selection_end_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->has_selection, (jint)lpGtkEditable->has_selection);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->editable, (jint)lpGtkEditable->editable);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->visible, (jint)lpGtkEditable->visible);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic, (jint)lpGtkEditable->ic);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic_attr, (jint)lpGtkEditable->ic_attr);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->clipboard_text, (jint)lpGtkEditable->clipboard_text);
-}
-
-void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
-{
- DECL_GLOB(pGlob)
- getGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
-
- lpGtkText->first_line_start_index = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_line_start_index);
- lpGtkText->first_onscreen_hor_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel);
- lpGtkText->first_onscreen_ver_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel);
- lpGtkText->default_tab_width = (*env)->GetIntField(env, lpObject, lpGtkTextFc->default_tab_width);
- lpGtkText->cursor_pos_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x);
- lpGtkText->cursor_pos_y = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y);
- lpGtkText->cursor_virtual_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x);
-}
-
-void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
-{
- DECL_GLOB(pGlob)
- setGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_line_start_index, (jint)lpGtkText->first_line_start_index);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel, (jint)lpGtkText->first_onscreen_hor_pixel);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel, (jint)lpGtkText->first_onscreen_ver_pixel);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->default_tab_width, (jint)lpGtkText->default_tab_width);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x, (jint)lpGtkText->cursor_pos_x);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y, (jint)lpGtkText->cursor_pos_y);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x, (jint)lpGtkText->cursor_virtual_x);
-}
-
-void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
- lpGtkFileSelection->dir_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list);
- lpGtkFileSelection->file_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->file_list);
- lpGtkFileSelection->selection_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry);
- lpGtkFileSelection->selection_text = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text);
- lpGtkFileSelection->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox);
- lpGtkFileSelection->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button);
- lpGtkFileSelection->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button);
- lpGtkFileSelection->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->help_button);
- lpGtkFileSelection->history_pulldown = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown);
- lpGtkFileSelection->history_menu = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu);
- lpGtkFileSelection->history_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_list);
- lpGtkFileSelection->fileop_dialog = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog);
- lpGtkFileSelection->fileop_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry);
- lpGtkFileSelection->fileop_file = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file);
- lpGtkFileSelection->cmpl_state = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state);
- lpGtkFileSelection->fileop_c_dir = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir);
- lpGtkFileSelection->fileop_del_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file);
- lpGtkFileSelection->fileop_ren_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file);
- lpGtkFileSelection->button_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->button_area);
- lpGtkFileSelection->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->action_area);
-}
-
-void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list, (jint)lpGtkFileSelection->dir_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->file_list, (jint)lpGtkFileSelection->file_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry, (jint)lpGtkFileSelection->selection_entry);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text, (jint)lpGtkFileSelection->selection_text);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox, (jint)lpGtkFileSelection->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button, (jint)lpGtkFileSelection->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button, (jint)lpGtkFileSelection->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->help_button, (jint)lpGtkFileSelection->help_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown, (jint)lpGtkFileSelection->history_pulldown);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu, (jint)lpGtkFileSelection->history_menu);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_list, (jint)lpGtkFileSelection->history_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog, (jint)lpGtkFileSelection->fileop_dialog);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry, (jint)lpGtkFileSelection->fileop_entry);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file, (jint)lpGtkFileSelection->fileop_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state, (jint)lpGtkFileSelection->cmpl_state);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir, (jint)lpGtkFileSelection->fileop_c_dir);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file, (jint)lpGtkFileSelection->fileop_del_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file, (jint)lpGtkFileSelection->fileop_ren_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->button_area, (jint)lpGtkFileSelection->button_area);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->action_area, (jint)lpGtkFileSelection->action_area);
-}
-
-void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
- lpGtkFontSelectionDialog->fontsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel);
- lpGtkFontSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox);
- lpGtkFontSelectionDialog->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area);
- lpGtkFontSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button);
- lpGtkFontSelectionDialog->apply_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button);
- lpGtkFontSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button);
- lpGtkFontSelectionDialog->dialog_width = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width);
- lpGtkFontSelectionDialog->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize);
-}
-
-void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel, (jint)lpGtkFontSelectionDialog->fontsel);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox, (jint)lpGtkFontSelectionDialog->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area, (jint)lpGtkFontSelectionDialog->action_area);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button, (jint)lpGtkFontSelectionDialog->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button, (jint)lpGtkFontSelectionDialog->apply_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button, (jint)lpGtkFontSelectionDialog->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width, (jint)lpGtkFontSelectionDialog->dialog_width);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize, (jint)lpGtkFontSelectionDialog->auto_resize);
-}
-
-void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
-{
- DECL_GLOB(pGlob)
- getGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
-}
-
-void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
-{
- DECL_GLOB(pGlob)
- setGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
-}
-
-void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
-{
- lpGtkObject->klass = (GtkObjectClass*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->klass);
- lpGtkObject->flags = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->flags);
- lpGtkObject->ref_count = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->ref_count);
- lpGtkObject->object_data = (GData*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->object_data);
-}
-
-void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->klass, (jint)lpGtkObject->klass);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->flags, (jint)lpGtkObject->flags);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->ref_count, (jint)lpGtkObject->ref_count);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->object_data, (jint)lpGtkObject->object_data);
-}
-
-void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
- lpGtkProgress->adjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->adjustment);
- lpGtkProgress->offscreen_pixmap = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap);
- lpGtkProgress->format = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->format);
- lpGtkProgress->x_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->x_align);
- lpGtkProgress->y_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->y_align);
- lpGtkProgress->show_text = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->show_text);
- lpGtkProgress->activity_mode = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->activity_mode);
-}
-
-void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->adjustment, (jint)lpGtkProgress->adjustment);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap, (jint)lpGtkProgress->offscreen_pixmap);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->format, (jint)lpGtkProgress->format);
- (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->x_align, (jfloat)lpGtkProgress->x_align);
- (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->y_align, (jfloat)lpGtkProgress->y_align);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->show_text, (jint)lpGtkProgress->show_text);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->activity_mode, (jint)lpGtkProgress->activity_mode);
-}
-
-void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
-{
- DECL_GLOB(pGlob)
- getGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
- lpGtkProgressBar->bar_style = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->bar_style);
- lpGtkProgressBar->orientation = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->orientation);
- lpGtkProgressBar->blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->blocks);
- lpGtkProgressBar->in_block = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->in_block);
- lpGtkProgressBar->activity_pos = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos);
- lpGtkProgressBar->activity_step = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_step);
- lpGtkProgressBar->activity_blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks);
- lpGtkProgressBar->activity_dir = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir);
-}
-
-void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
-{
- DECL_GLOB(pGlob)
- setGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->bar_style, (jint)lpGtkProgressBar->bar_style);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->orientation, (jint)lpGtkProgressBar->orientation);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->blocks, (jint)lpGtkProgressBar->blocks);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->in_block, (jint)lpGtkProgressBar->in_block);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos, (jint)lpGtkProgressBar->activity_pos);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_step, (jint)lpGtkProgressBar->activity_step);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks, (jint)lpGtkProgressBar->activity_blocks);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir, (jint)lpGtkProgressBar->activity_dir);
-}
-
-void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
-{
- lpGtkRequisition->width = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->width);
- lpGtkRequisition->height = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->height);
-}
-
-void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
-{
- (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->width, lpGtkRequisition->width);
- (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->height, lpGtkRequisition->height);
-}
-
-void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
-{
- lpGtkStyle->klass = (GtkStyleClass*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->klass);
- lpGtkStyle->fg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel);
- lpGtkStyle->fg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_red);
- lpGtkStyle->fg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_green);
- lpGtkStyle->fg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_blue);
- lpGtkStyle->fg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel);
- lpGtkStyle->fg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_red);
- lpGtkStyle->fg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_green);
- lpGtkStyle->fg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_blue);
- lpGtkStyle->fg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel);
- lpGtkStyle->fg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_red);
- lpGtkStyle->fg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_green);
- lpGtkStyle->fg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_blue);
- lpGtkStyle->fg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel);
- lpGtkStyle->fg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_red);
- lpGtkStyle->fg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_green);
- lpGtkStyle->fg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_blue);
- lpGtkStyle->fg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel);
- lpGtkStyle->fg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_red);
- lpGtkStyle->fg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_green);
- lpGtkStyle->fg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_blue);
- lpGtkStyle->bg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel);
- lpGtkStyle->bg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_red);
- lpGtkStyle->bg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_green);
- lpGtkStyle->bg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_blue);
- lpGtkStyle->bg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel);
- lpGtkStyle->bg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_red);
- lpGtkStyle->bg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_green);
- lpGtkStyle->bg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_blue);
- lpGtkStyle->bg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel);
- lpGtkStyle->bg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_red);
- lpGtkStyle->bg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_green);
- lpGtkStyle->bg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_blue);
- lpGtkStyle->bg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel);
- lpGtkStyle->bg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_red);
- lpGtkStyle->bg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_green);
- lpGtkStyle->bg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_blue);
- lpGtkStyle->bg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel);
- lpGtkStyle->bg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_red);
- lpGtkStyle->bg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_green);
- lpGtkStyle->bg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_blue);
- lpGtkStyle->light[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light0_pixel);
- lpGtkStyle->light[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_red);
- lpGtkStyle->light[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_green);
- lpGtkStyle->light[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_blue);
- lpGtkStyle->light[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light1_pixel);
- lpGtkStyle->light[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_red);
- lpGtkStyle->light[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_green);
- lpGtkStyle->light[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_blue);
- lpGtkStyle->light[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light2_pixel);
- lpGtkStyle->light[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_red);
- lpGtkStyle->light[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_green);
- lpGtkStyle->light[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_blue);
- lpGtkStyle->light[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light3_pixel);
- lpGtkStyle->light[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_red);
- lpGtkStyle->light[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_green);
- lpGtkStyle->light[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_blue);
- lpGtkStyle->light[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light4_pixel);
- lpGtkStyle->light[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_red);
- lpGtkStyle->light[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_green);
- lpGtkStyle->light[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_blue);
- lpGtkStyle->dark[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel);
- lpGtkStyle->dark[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_red);
- lpGtkStyle->dark[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_green);
- lpGtkStyle->dark[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_blue);
- lpGtkStyle->dark[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel);
- lpGtkStyle->dark[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_red);
- lpGtkStyle->dark[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_green);
- lpGtkStyle->dark[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_blue);
- lpGtkStyle->dark[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel);
- lpGtkStyle->dark[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_red);
- lpGtkStyle->dark[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_green);
- lpGtkStyle->dark[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_blue);
- lpGtkStyle->dark[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel);
- lpGtkStyle->dark[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_red);
- lpGtkStyle->dark[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_green);
- lpGtkStyle->dark[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_blue);
- lpGtkStyle->dark[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel);
- lpGtkStyle->dark[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_red);
- lpGtkStyle->dark[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_green);
- lpGtkStyle->dark[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_blue);
- lpGtkStyle->mid[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel);
- lpGtkStyle->mid[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_red);
- lpGtkStyle->mid[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_green);
- lpGtkStyle->mid[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_blue);
- lpGtkStyle->mid[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel);
- lpGtkStyle->mid[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_red);
- lpGtkStyle->mid[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_green);
- lpGtkStyle->mid[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_blue);
- lpGtkStyle->mid[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel);
- lpGtkStyle->mid[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_red);
- lpGtkStyle->mid[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_green);
- lpGtkStyle->mid[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_blue);
- lpGtkStyle->mid[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel);
- lpGtkStyle->mid[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_red);
- lpGtkStyle->mid[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_green);
- lpGtkStyle->mid[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_blue);
- lpGtkStyle->mid[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel);
- lpGtkStyle->mid[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_red);
- lpGtkStyle->mid[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_green);
- lpGtkStyle->mid[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_blue);
- lpGtkStyle->text[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text0_pixel);
- lpGtkStyle->text[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_red);
- lpGtkStyle->text[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_green);
- lpGtkStyle->text[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_blue);
- lpGtkStyle->text[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text1_pixel);
- lpGtkStyle->text[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_red);
- lpGtkStyle->text[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_green);
- lpGtkStyle->text[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_blue);
- lpGtkStyle->text[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text2_pixel);
- lpGtkStyle->text[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_red);
- lpGtkStyle->text[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_green);
- lpGtkStyle->text[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_blue);
- lpGtkStyle->text[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text3_pixel);
- lpGtkStyle->text[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_red);
- lpGtkStyle->text[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_green);
- lpGtkStyle->text[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_blue);
- lpGtkStyle->text[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text4_pixel);
- lpGtkStyle->text[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_red);
- lpGtkStyle->text[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_green);
- lpGtkStyle->text[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_blue);
- lpGtkStyle->base[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base0_pixel);
- lpGtkStyle->base[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_red);
- lpGtkStyle->base[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_green);
- lpGtkStyle->base[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_blue);
- lpGtkStyle->base[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base1_pixel);
- lpGtkStyle->base[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_red);
- lpGtkStyle->base[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_green);
- lpGtkStyle->base[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_blue);
- lpGtkStyle->base[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base2_pixel);
- lpGtkStyle->base[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_red);
- lpGtkStyle->base[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_green);
- lpGtkStyle->base[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_blue);
- lpGtkStyle->base[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base3_pixel);
- lpGtkStyle->base[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_red);
- lpGtkStyle->base[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_green);
- lpGtkStyle->base[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_blue);
- lpGtkStyle->base[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base4_pixel);
- lpGtkStyle->base[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_red);
- lpGtkStyle->base[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_green);
- lpGtkStyle->base[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_blue);
- lpGtkStyle->black.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_pixel);
- lpGtkStyle->black.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_red);
- lpGtkStyle->black.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_green);
- lpGtkStyle->black.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_blue);
- lpGtkStyle->white.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_pixel);
- lpGtkStyle->white.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_red);
- lpGtkStyle->white.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_green);
- lpGtkStyle->white.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_blue);
- lpGtkStyle->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->font);
- lpGtkStyle->fg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc0);
- lpGtkStyle->fg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc1);
- lpGtkStyle->fg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc2);
- lpGtkStyle->fg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc3);
- lpGtkStyle->fg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc4);
- lpGtkStyle->bg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc0);
- lpGtkStyle->bg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc1);
- lpGtkStyle->bg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc2);
- lpGtkStyle->bg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc3);
- lpGtkStyle->bg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc4);
- lpGtkStyle->light_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc0);
- lpGtkStyle->light_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc1);
- lpGtkStyle->light_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc2);
- lpGtkStyle->light_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc3);
- lpGtkStyle->light_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc4);
- lpGtkStyle->dark_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc0);
- lpGtkStyle->dark_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc1);
- lpGtkStyle->dark_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc2);
- lpGtkStyle->dark_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc3);
- lpGtkStyle->dark_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc4);
- lpGtkStyle->mid_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc0);
- lpGtkStyle->mid_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc1);
- lpGtkStyle->mid_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc2);
- lpGtkStyle->mid_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc3);
- lpGtkStyle->mid_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc4);
- lpGtkStyle->text_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc0);
- lpGtkStyle->text_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc1);
- lpGtkStyle->text_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc2);
- lpGtkStyle->text_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc3);
- lpGtkStyle->text_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc4);
- lpGtkStyle->base_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc0);
- lpGtkStyle->base_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc1);
- lpGtkStyle->base_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc2);
- lpGtkStyle->base_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc3);
- lpGtkStyle->base_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc4);
- lpGtkStyle->black_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_gc);
- lpGtkStyle->white_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_gc);
- lpGtkStyle->bg_pixmap[0] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0);
- lpGtkStyle->bg_pixmap[1] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1);
- lpGtkStyle->bg_pixmap[2] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2);
- lpGtkStyle->bg_pixmap[3] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3);
- lpGtkStyle->bg_pixmap[4] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4);
- lpGtkStyle->ref_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->ref_count);
- lpGtkStyle->attach_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->attach_count);
- lpGtkStyle->depth = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->depth);
- lpGtkStyle->colormap = (GdkColormap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->colormap);
- lpGtkStyle->engine = (GtkThemeEngine*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine);
- lpGtkStyle->engine_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine_data);
- lpGtkStyle->rc_style = (GtkRcStyle*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->rc_style);
- lpGtkStyle->styles = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->styles);
-}
-
-void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->klass, (jint)lpGtkStyle->klass);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel, (jint)lpGtkStyle->fg[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_red, (jshort)lpGtkStyle->fg[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_green, (jshort)lpGtkStyle->fg[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_blue, (jshort)lpGtkStyle->fg[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel, (jint)lpGtkStyle->fg[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_red, (jshort)lpGtkStyle->fg[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_green, (jshort)lpGtkStyle->fg[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_blue, (jshort)lpGtkStyle->fg[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel, (jint)lpGtkStyle->fg[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_red, (jshort)lpGtkStyle->fg[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_green, (jshort)lpGtkStyle->fg[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_blue, (jshort)lpGtkStyle->fg[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel, (jint)lpGtkStyle->fg[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_red, (jshort)lpGtkStyle->fg[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_green, (jshort)lpGtkStyle->fg[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_blue, (jshort)lpGtkStyle->fg[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel, (jint)lpGtkStyle->fg[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_red, (jshort)lpGtkStyle->fg[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_green, (jshort)lpGtkStyle->fg[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_blue, (jshort)lpGtkStyle->fg[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel, (jint)lpGtkStyle->bg[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_red, (jshort)lpGtkStyle->bg[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_green, (jshort)lpGtkStyle->bg[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_blue, (jshort)lpGtkStyle->bg[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel, (jint)lpGtkStyle->bg[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_red, (jshort)lpGtkStyle->bg[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_green, (jshort)lpGtkStyle->bg[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_blue, (jshort)lpGtkStyle->bg[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel, (jint)lpGtkStyle->bg[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_red, (jshort)lpGtkStyle->bg[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_green, (jshort)lpGtkStyle->bg[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_blue, (jshort)lpGtkStyle->bg[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel, (jint)lpGtkStyle->bg[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_red, (jshort)lpGtkStyle->bg[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_green, (jshort)lpGtkStyle->bg[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_blue, (jshort)lpGtkStyle->bg[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel, (jint)lpGtkStyle->bg[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_red, (jshort)lpGtkStyle->bg[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_green, (jshort)lpGtkStyle->bg[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_blue, (jshort)lpGtkStyle->bg[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light0_pixel, (jint)lpGtkStyle->light[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_red, (jshort)lpGtkStyle->light[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_green, (jshort)lpGtkStyle->light[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_blue, (jshort)lpGtkStyle->light[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light1_pixel, (jint)lpGtkStyle->light[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_red, (jshort)lpGtkStyle->light[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_green, (jshort)lpGtkStyle->light[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_blue, (jshort)lpGtkStyle->light[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light2_pixel, (jint)lpGtkStyle->light[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_red, (jshort)lpGtkStyle->light[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_green, (jshort)lpGtkStyle->light[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_blue, (jshort)lpGtkStyle->light[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light3_pixel, (jint)lpGtkStyle->light[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_red, (jshort)lpGtkStyle->light[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_green, (jshort)lpGtkStyle->light[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_blue, (jshort)lpGtkStyle->light[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light4_pixel, (jint)lpGtkStyle->light[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_red, (jshort)lpGtkStyle->light[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_green, (jshort)lpGtkStyle->light[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_blue, (jshort)lpGtkStyle->light[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel, (jint)lpGtkStyle->dark[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_red, (jshort)lpGtkStyle->dark[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_green, (jshort)lpGtkStyle->dark[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_blue, (jshort)lpGtkStyle->dark[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel, (jint)lpGtkStyle->dark[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_red, (jshort)lpGtkStyle->dark[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_green, (jshort)lpGtkStyle->dark[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_blue, (jshort)lpGtkStyle->dark[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel, (jint)lpGtkStyle->dark[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_red, (jshort)lpGtkStyle->dark[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_green, (jshort)lpGtkStyle->dark[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_blue, (jshort)lpGtkStyle->dark[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel, (jint)lpGtkStyle->dark[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_red, (jshort)lpGtkStyle->dark[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_green, (jshort)lpGtkStyle->dark[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_blue, (jshort)lpGtkStyle->dark[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel, (jint)lpGtkStyle->dark[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_red, (jshort)lpGtkStyle->dark[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_green, (jshort)lpGtkStyle->dark[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_blue, (jshort)lpGtkStyle->dark[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel, (jint)lpGtkStyle->mid[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_red, (jshort)lpGtkStyle->mid[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_green, (jshort)lpGtkStyle->mid[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_blue, (jshort)lpGtkStyle->mid[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel, (jint)lpGtkStyle->mid[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_red, (jshort)lpGtkStyle->mid[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_green, (jshort)lpGtkStyle->mid[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_blue, (jshort)lpGtkStyle->mid[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel, (jint)lpGtkStyle->mid[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_red, (jshort)lpGtkStyle->mid[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_green, (jshort)lpGtkStyle->mid[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_blue, (jshort)lpGtkStyle->mid[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel, (jint)lpGtkStyle->mid[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_red, (jshort)lpGtkStyle->mid[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_green, (jshort)lpGtkStyle->mid[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_blue, (jshort)lpGtkStyle->mid[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel, (jint)lpGtkStyle->mid[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_red, (jshort)lpGtkStyle->mid[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_green, (jshort)lpGtkStyle->mid[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_blue, (jshort)lpGtkStyle->mid[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text0_pixel, (jint)lpGtkStyle->text[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_red, (jshort)lpGtkStyle->text[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_green, (jshort)lpGtkStyle->text[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_blue, (jshort)lpGtkStyle->text[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text1_pixel, (jint)lpGtkStyle->text[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_red, (jshort)lpGtkStyle->text[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_green, (jshort)lpGtkStyle->text[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_blue, (jshort)lpGtkStyle->text[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text2_pixel, (jint)lpGtkStyle->text[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_red, (jshort)lpGtkStyle->text[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_green, (jshort)lpGtkStyle->text[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_blue, (jshort)lpGtkStyle->text[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text3_pixel, (jint)lpGtkStyle->text[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_red, (jshort)lpGtkStyle->text[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_green, (jshort)lpGtkStyle->text[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_blue, (jshort)lpGtkStyle->text[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text4_pixel, (jint)lpGtkStyle->text[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_red, (jshort)lpGtkStyle->text[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_green, (jshort)lpGtkStyle->text[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_blue, (jshort)lpGtkStyle->text[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base0_pixel, (jint)lpGtkStyle->base[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_red, (jshort)lpGtkStyle->base[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_green, (jshort)lpGtkStyle->base[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_blue, (jshort)lpGtkStyle->base[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base1_pixel, (jint)lpGtkStyle->base[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_red, (jshort)lpGtkStyle->base[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_green, (jshort)lpGtkStyle->base[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_blue, (jshort)lpGtkStyle->base[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base2_pixel, (jint)lpGtkStyle->base[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_red, (jshort)lpGtkStyle->base[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_green, (jshort)lpGtkStyle->base[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_blue, (jshort)lpGtkStyle->base[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base3_pixel, (jint)lpGtkStyle->base[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_red, (jshort)lpGtkStyle->base[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_green, (jshort)lpGtkStyle->base[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_blue, (jshort)lpGtkStyle->base[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base4_pixel, (jint)lpGtkStyle->base[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_red, (jshort)lpGtkStyle->base[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_green, (jshort)lpGtkStyle->base[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_blue, (jshort)lpGtkStyle->base[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_pixel, (jint)lpGtkStyle->black.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_red, (jshort)lpGtkStyle->black.red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_green, (jshort)lpGtkStyle->black.green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_blue, (jshort)lpGtkStyle->black.blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_pixel, (jint)lpGtkStyle->white.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_red, (jshort)lpGtkStyle->white.red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_green, (jshort)lpGtkStyle->white.green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_blue, (jshort)lpGtkStyle->white.blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->font, (jint)lpGtkStyle->font);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc0, (jint)lpGtkStyle->fg_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc1, (jint)lpGtkStyle->fg_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc2, (jint)lpGtkStyle->fg_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc3, (jint)lpGtkStyle->fg_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc4, (jint)lpGtkStyle->fg_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc0, (jint)lpGtkStyle->bg_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc1, (jint)lpGtkStyle->bg_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc2, (jint)lpGtkStyle->bg_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc3, (jint)lpGtkStyle->bg_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc4, (jint)lpGtkStyle->bg_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc0, (jint)lpGtkStyle->light_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc1, (jint)lpGtkStyle->light_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc2, (jint)lpGtkStyle->light_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc3, (jint)lpGtkStyle->light_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc4, (jint)lpGtkStyle->light_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc0, (jint)lpGtkStyle->dark_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc1, (jint)lpGtkStyle->dark_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc2, (jint)lpGtkStyle->dark_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc3, (jint)lpGtkStyle->dark_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc4, (jint)lpGtkStyle->dark_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc0, (jint)lpGtkStyle->mid_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc1, (jint)lpGtkStyle->mid_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc2, (jint)lpGtkStyle->mid_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc3, (jint)lpGtkStyle->mid_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc4, (jint)lpGtkStyle->mid_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc0, (jint)lpGtkStyle->text_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc1, (jint)lpGtkStyle->text_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc2, (jint)lpGtkStyle->text_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc3, (jint)lpGtkStyle->text_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc4, (jint)lpGtkStyle->text_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc0, (jint)lpGtkStyle->base_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc1, (jint)lpGtkStyle->base_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc2, (jint)lpGtkStyle->base_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc3, (jint)lpGtkStyle->base_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc4, (jint)lpGtkStyle->base_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_gc, (jint)lpGtkStyle->black_gc);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_gc, (jint)lpGtkStyle->white_gc);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0, (jint)lpGtkStyle->bg_pixmap[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1, (jint)lpGtkStyle->bg_pixmap[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2, (jint)lpGtkStyle->bg_pixmap[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3, (jint)lpGtkStyle->bg_pixmap[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4, (jint)lpGtkStyle->bg_pixmap[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->ref_count, (jint)lpGtkStyle->ref_count);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->attach_count, (jint)lpGtkStyle->attach_count);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->depth, (jint)lpGtkStyle->depth);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->colormap, (jint)lpGtkStyle->colormap);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine, (jint)lpGtkStyle->engine);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine_data, (jint)lpGtkStyle->engine_data);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->rc_style, (jint)lpGtkStyle->rc_style);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->styles, (jint)lpGtkStyle->styles);
-}
-
-void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
-{
- lpGtkStyleClass->xthickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->xthickness);
- lpGtkStyleClass->ythickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->ythickness);
-}
-
-void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->xthickness, (jint)lpGtkStyleClass->xthickness);
- (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->ythickness, (jint)lpGtkStyleClass->ythickness);
-}
-
-void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
-{
- DECL_GLOB(pGlob)
- getGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
- lpGtkWidget->private_flags = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->private_flags);
- lpGtkWidget->state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->state);
- lpGtkWidget->saved_state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->saved_state);
- lpGtkWidget->name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->name);
- lpGtkWidget->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->style);
- lpGtkWidget->requisition.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_width);
- lpGtkWidget->requisition.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_height);
- lpGtkWidget->allocation.x = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_x);
- lpGtkWidget->allocation.y = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_y);
- lpGtkWidget->allocation.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_width);
- lpGtkWidget->allocation.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_height);
- lpGtkWidget->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->window);
- lpGtkWidget->parent = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->parent);
-}
-
-void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
- lpGtkFrame->label = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFrameFc->label);
- lpGtkFrame->shadow_type = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->shadow_type);
- lpGtkFrame->label_width = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_width);
- lpGtkFrame->label_height = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_height);
- lpGtkFrame->label_xalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_xalign);
- lpGtkFrame->label_yalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_yalign);
-}
-
-void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
-{
- DECL_GLOB(pGlob)
- setGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->private_flags, (jshort)lpGtkWidget->private_flags);
- (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->state, (jbyte)lpGtkWidget->state);
- (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->saved_state, (jbyte)lpGtkWidget->saved_state);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->name, (jint)lpGtkWidget->name);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->style, (jint)lpGtkWidget->style);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_width, (jshort)lpGtkWidget->requisition.width);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_height, (jshort)lpGtkWidget->requisition.height);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_x, (jshort)lpGtkWidget->allocation.x);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_y, (jshort)lpGtkWidget->allocation.y);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_width, (jshort)lpGtkWidget->allocation.width);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_height, (jshort)lpGtkWidget->allocation.height);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->window, (jint)lpGtkWidget->window);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->parent, (jint)lpGtkWidget->parent);
-}
-
-void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
- (*env)->SetIntField (env, lpObject, lpGtkFrameFc->label, (jint)lpGtkFrame->label);
- (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_width, (jshort)lpGtkFrame->label_width);
- (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_height, (jshort)lpGtkFrame->label_height);
- (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_xalign, (jfloat)lpGtkFrame->label_xalign);
- (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_yalign, (jfloat)lpGtkFrame->label_yalign);
-}
-
-void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
- lpGtkWindow->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
- lpGtkWindow->wmclass_name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_name);
- lpGtkWindow->wmclass_class = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_class);
- lpGtkWindow->type = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->type);
- lpGtkWindow->focus_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->focus_widget);
- lpGtkWindow->default_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->default_widget);
- lpGtkWindow->transient_parent = (GtkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->transient_parent);
- lpGtkWindow->resize_count = (*env)->GetShortField(env, lpObject, lpGtkWindowFc->resize_count);
- lpGtkWindow->allow_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_shrink);
- lpGtkWindow->allow_grow = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_grow);
- lpGtkWindow->auto_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->auto_shrink);
- lpGtkWindow->handling_resize = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->handling_resize);
- lpGtkWindow->position = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->position);
- lpGtkWindow->use_uposition = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->use_uposition);
- lpGtkWindow->modal = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
-}
-
-void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->title, (jint)lpGtkWindow->title);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_name, (jint)lpGtkWindow->wmclass_name);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_class, (jint)lpGtkWindow->wmclass_class);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->type, (jint)lpGtkWindow->type);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->focus_widget, (jint)lpGtkWindow->focus_widget);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->default_widget, (jint)lpGtkWindow->default_widget);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->transient_parent, (jint)lpGtkWindow->title);
- (*env)->SetShortField(env, lpObject, lpGtkWindowFc->resize_count, (jshort)lpGtkWindow->resize_count);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_shrink, (jint)lpGtkWindow->allow_shrink);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_grow, (jint)lpGtkWindow->allow_grow);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->auto_shrink, (jint)lpGtkWindow->auto_shrink);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->handling_resize, (jint)lpGtkWindow->handling_resize);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->position, (jint)lpGtkWindow->position);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->use_uposition, (jint)lpGtkWindow->use_uposition);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->modal, (jint)lpGtkWindow->modal);
-}
-
-void getGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkDialog->window, &PGLOB(GtkWindowFc));
- lpGtkDialog->vbox = (GtkWidget*) (*env)->GetIntField(env, lpObject, lpGtkDialogFc->vbox);
- lpGtkDialog->action_area = (GtkWidget*) (*env)->GetIntField(env, lpObject, lpGtkDialogFc->action_area);
-}
-
-void setGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkDialogFc->vbox, (jint)lpGtkDialog->vbox);
- (*env)->SetIntField(env, lpObject, lpGtkDialogFc->action_area, (jint)lpGtkDialog->action_area);
-}
-
-void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
-{
- DECL_GLOB(pGlob)
- getGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
- lpGtkMenu->parent_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item);
- lpGtkMenu->old_active_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item);
- lpGtkMenu->accel_group = (GtkAccelGroup*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->accel_group);
- lpGtkMenu->position_func = (GtkMenuPositionFunc)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func);
- lpGtkMenu->position_func_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func_data);
- lpGtkMenu->toplevel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->toplevel);
- lpGtkMenu->tearoff_window = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->tearoff_window);
- lpGtkMenu->torn_off = (*env)->GetIntField(env, lpObject, lpGtkMenuFc->torn_off);
-}
-
-void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
-{
- DECL_GLOB(pGlob)
- setGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item, (jint)lpGtkMenu->parent_menu_item);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item, (jint)lpGtkMenu->old_active_menu_item);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->accel_group, (jint)lpGtkMenu->accel_group);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func, (jint)lpGtkMenu->position_func);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func_data, (jint)lpGtkMenu->position_func_data);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->toplevel, (jint)lpGtkMenu->toplevel);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->tearoff_window, (jint)lpGtkMenu->tearoff_window);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->torn_off, (jint)lpGtkMenu->torn_off);
-}
-
-void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
- lpGtkMenuShell->active = (*env)->GetIntField(env, lpObject, lpGtkMenuShellFc->active);
-}
-
-void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkMenuShellFc->active, (jint)lpGtkMenuShell->active);
-}
-
-void getGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
-}
-
-void setGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
-}
-
-void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
-}
-
-void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
-}
-
-void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
- lpGtkCheckMenuItem->active = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->active);
- lpGtkCheckMenuItem->always_show_toggle = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle);
-}
-
-void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
- (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->active, (jint)lpGtkCheckMenuItem->active);
- (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle, (jint)lpGtkCheckMenuItem->always_show_toggle);
-}
-
-void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
-{
- DECL_GLOB(pGlob)
- getGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
-}
-
-void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
-{
- DECL_GLOB(pGlob)
- setGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
-}
-
-void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
-{
- DECL_GLOB(pGlob)
- getGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
- lpGtkAdjustment->lower = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->lower);
- lpGtkAdjustment->upper = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->upper);
- lpGtkAdjustment->value = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->value);
- lpGtkAdjustment->step_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment);
- lpGtkAdjustment->page_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment);
- lpGtkAdjustment->page_size = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size);
-}
-
-void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
-{
- DECL_GLOB(pGlob)
- setGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->lower, (jfloat)lpGtkAdjustment->lower);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->upper, (jfloat)lpGtkAdjustment->upper);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->value, (jfloat)lpGtkAdjustment->value);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment, (jfloat)lpGtkAdjustment->step_increment);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment, (jfloat)lpGtkAdjustment->page_increment);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size, (jfloat)lpGtkAdjustment->page_size);
-}
-
-void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
-{
- lpGtkCListRow->cell = (GtkCell*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->cell);
- lpGtkCListRow->state = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->state);
- lpGtkCListRow->foreground.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_red);
- lpGtkCListRow->foreground.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_green);
- lpGtkCListRow->foreground.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue);
- lpGtkCListRow->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel);
- lpGtkCListRow->background.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_red);
- lpGtkCListRow->background.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_green);
- lpGtkCListRow->background.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_blue);
- lpGtkCListRow->background.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->background_pixel);
- lpGtkCListRow->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->style);
- lpGtkCListRow->data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->data);
- lpGtkCListRow->destroy = (GtkDestroyNotify)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->destroy);
- lpGtkCListRow->fg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->fg_set);
- lpGtkCListRow->bg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->bg_set);
- lpGtkCListRow->selectable = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->selectable);
-}
-
-void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
-{
- lpGtkCListColumn->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->title);
- lpGtkCListColumn->area.x = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_x);
- lpGtkCListColumn->area.y = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_y);
- lpGtkCListColumn->area.width = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_width);
- lpGtkCListColumn->area.height = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_height);
- lpGtkCListColumn->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button);
- lpGtkCListColumn->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->window);
- lpGtkCListColumn->width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width);
- lpGtkCListColumn->min_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->min_width);
- lpGtkCListColumn->max_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->max_width);
- lpGtkCListColumn->justification = (GtkJustification)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->justification);
- lpGtkCListColumn->visible = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->visible);
- lpGtkCListColumn->width_set = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width_set);
- lpGtkCListColumn->resizeable = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->resizeable);
- lpGtkCListColumn->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize);
- lpGtkCListColumn->button_passive = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button_passive);
-}
-
-void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->cell, (jint)lpGtkCListRow->cell);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->state, (jint)lpGtkCListRow->state);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_red, (jshort)lpGtkCListRow->foreground.red);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_green, (jshort)lpGtkCListRow->foreground.green);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue, (jshort)lpGtkCListRow->foreground.blue);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel, (jint)lpGtkCListRow->foreground.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_red, (jshort)lpGtkCListRow->background.red);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_green, (jshort)lpGtkCListRow->background.green);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_blue, (jshort)lpGtkCListRow->background.blue);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->background_pixel, (jint)lpGtkCListRow->background.pixel);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->style, (jint)lpGtkCListRow->style);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->data, (jint)lpGtkCListRow->data);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->destroy, (jint)lpGtkCListRow->destroy);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->fg_set, (jint)lpGtkCListRow->fg_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->bg_set, (jint)lpGtkCListRow->bg_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->selectable, (jint)lpGtkCListRow->selectable);
-}
-
-void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->title, (jint)lpGtkCListColumn->title);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_x, (jshort)lpGtkCListColumn->area.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_y, (jshort)lpGtkCListColumn->area.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_width, (jshort)lpGtkCListColumn->area.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_height, (jshort)lpGtkCListColumn->area.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button, (jint)lpGtkCListColumn->button);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->window, (jint)lpGtkCListColumn->window);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width, (jshort)lpGtkCListColumn->width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->min_width, (jint)lpGtkCListColumn->min_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->max_width, (jint)lpGtkCListColumn->max_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->justification, (jint)lpGtkCListColumn->justification);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->visible, (jint)lpGtkCListColumn->visible);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width_set, (jint)lpGtkCListColumn->width_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->resizeable, (jint)lpGtkCListColumn->resizeable);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize, (jint)lpGtkCListColumn->auto_resize);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button_passive, (jint)lpGtkCListColumn->button_passive);
-}
-
-void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
-{
- DECL_GLOB(pGlob)
- getGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
- lpGtkCTree->tree_indent = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_indent);
- lpGtkCTree->tree_column = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_column);
-}
-
-void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
-{
- DECL_GLOB(pGlob)
- setGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
- (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_indent, (jint)lpGtkCTree->tree_indent);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_column, (jint)lpGtkCTree->tree_column);
-}
-
-void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
-{
- DECL_GLOB(pGlob)
- getGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
- lpGtkCTreeRow->parent = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->parent);
- lpGtkCTreeRow->sibling = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->sibling);
- lpGtkCTreeRow->children = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->children);
- lpGtkCTreeRow->pixmap_closed = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed);
- lpGtkCTreeRow->mask_closed = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed);
- lpGtkCTreeRow->pixmap_opened = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened);
- lpGtkCTreeRow->mask_opened = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened);
- lpGtkCTreeRow->level = (*env)->GetShortField(env, lpObject, lpGtkCTreeRowFc->level);
- lpGtkCTreeRow->is_leaf = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf);
- lpGtkCTreeRow->expanded = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->expanded);
-}
-
-void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
-{
- DECL_GLOB(pGlob)
- setGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->parent, (jint)lpGtkCTreeRow->parent);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->sibling, (jint)lpGtkCTreeRow->sibling);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->children, (jint)lpGtkCTreeRow->children);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed, (jint)lpGtkCTreeRow->pixmap_closed);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed, (jint)lpGtkCTreeRow->mask_closed);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened, (jint)lpGtkCTreeRow->pixmap_opened);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened, (jint)lpGtkCTreeRow->mask_opened);
- (*env)->SetShortField(env, lpObject, lpGtkCTreeRowFc->level, (jshort)lpGtkCTreeRow->level);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf, (jint)lpGtkCTreeRow->is_leaf);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->expanded, (jint)lpGtkCTreeRow->expanded);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
deleted file mode 100644
index c746b0d630..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for GTK structs.
- */
-
-#ifndef INC_structs_H
-#define INC_structs_H
-
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
-/* ----------- fid and class caches ----------- */
-/**
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-
-/* ----------- fid cache structures ----------- */
-
-typedef struct GdkColor_FID_CACHE {
- int cached;
- jclass GdkColorClass;
- jfieldID pixel, red, green, blue;
-} GdkColor_FID_CACHE;
-
-typedef GdkColor_FID_CACHE *PGdkColor_FID_CACHE;
-
-typedef struct GdkEventKey_FID_CACHE {
- int cached;
- jclass GdkEventKeyClass;
- jfieldID type, window, send_event, time, state, keyval, length, string;
-} GdkEventKey_FID_CACHE;
-
-typedef GdkEventKey_FID_CACHE *PGdkEventKey_FID_CACHE;
-
-typedef struct GdkEventButton_FID_CACHE {
- int cached;
- jclass GdkEventButtonClass;
- jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, button, source, deviceid, x_root, y_root;
-} GdkEventButton_FID_CACHE;
-
-typedef GdkEventButton_FID_CACHE *PGdkEventButton_FID_CACHE;
-
-typedef struct GdkEventMotion_FID_CACHE {
- int cached;
- jclass GdkEventMotionClass;
- jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, is_hint, source, deviceid, x_root, y_root;
-} GdkEventMotion_FID_CACHE;
-
-typedef GdkEventMotion_FID_CACHE *PGdkEventMotion_FID_CACHE;
-
-typedef struct GdkEventExpose_FID_CACHE {
- int cached;
- jclass GdkEventExposeClass;
- jfieldID type, window, send_event, x, y, width, height, count;
-} GdkEventExpose_FID_CACHE;
-
-typedef GdkEventExpose_FID_CACHE *PGdkEventExpose_FID_CACHE;
-
-typedef struct GdkFont_FID_CACHE {
- int cached;
- jclass GdkFontClass;
- jfieldID type, ascent, descent;
-} GdkFont_FID_CACHE;
-
-typedef GdkFont_FID_CACHE *PGdkFont_FID_CACHE;
-
-typedef struct GdkGCValues_FID_CACHE {
- int cached;
- jclass GdkGCValuesClass;
- jfieldID foreground_pixel, foreground_red, foreground_green, foreground_blue, background_pixel, background_red, background_green, background_blue, font, function, fill, tile, stipple, clip_mask, subwindow_mode, ts_x_origin, ts_y_origin, clip_x_origin, clip_y_origin, graphics_exposures, line_width, line_style, cap_style, join_style;
-} GdkGCValues_FID_CACHE;
-
-typedef GdkGCValues_FID_CACHE *PGdkGCValues_FID_CACHE;
-
-typedef struct GdkImage_FID_CACHE {
- int cached;
- jclass GdkImageClass;
- jfieldID type, visual, byte_order, width, height, depth, bpp, bpl, mem;
-} GdkImage_FID_CACHE;
-
-typedef GdkImage_FID_CACHE *PGdkImage_FID_CACHE;
-
-typedef struct GdkPoint_FID_CACHE {
- int cached;
- jclass GdkPointClass;
- jfieldID x, y;
-} GdkPoint_FID_CACHE;
-
-typedef GdkPoint_FID_CACHE *PGdkPoint_FID_CACHE;
-
-typedef struct GdkRectangle_FID_CACHE {
- int cached;
- jclass GdkRectangleClass;
- jfieldID x, y, width, height;
-} GdkRectangle_FID_CACHE;
-
-typedef GdkRectangle_FID_CACHE *PGdkRectangle_FID_CACHE;
-
-typedef struct GdkVisual_FID_CACHE {
- int cached;
- jclass GdkVisualClass;
- jfieldID type, depth, byte_order, colormap_size, bits_per_rgb, red_mask, red_shift, red_prec, green_mask, green_shift, green_prec, blue_mask, blue_shift, blue_prec;
-} GdkVisual_FID_CACHE;
-
-typedef GdkVisual_FID_CACHE *PGdkVisual_FID_CACHE;
-
-typedef struct GtkObject_FID_CACHE {
- int cached;
- jclass GtkObjectClass;
- jfieldID klass, flags, ref_count, object_data;
-} GtkObject_FID_CACHE;
-
-typedef GtkObject_FID_CACHE *PGtkObject_FID_CACHE;
-
-typedef struct GtkData_FID_CACHE {
- int cached;
- jclass GtkDataClass;
-} GtkData_FID_CACHE;
-
-typedef GtkData_FID_CACHE *PGtkData_FID_CACHE;
-
-typedef struct GtkAdjustment_FID_CACHE {
- int cached;
- jclass GtkAdjustmentClass;
- jfieldID lower, upper, value, step_increment, page_increment, page_size;
-} GtkAdjustment_FID_CACHE;
-
-typedef GtkAdjustment_FID_CACHE *PGtkAdjustment_FID_CACHE;
-
-typedef struct GtkAllocation_FID_CACHE {
- int cached;
- jclass GtkAllocationClass;
- jfieldID x, y, width, height;
-} GtkAllocation_FID_CACHE;
-
-typedef GtkAllocation_FID_CACHE *PGtkAllocation_FID_CACHE;
-
-typedef struct GtkWidget_FID_CACHE {
- int cached;
- jclass GtkWidgetClass;
- jfieldID private_flags, state, saved_state, name, style, req_width, req_height, alloc_x, alloc_y, alloc_width, alloc_height, window, parent;
-} GtkWidget_FID_CACHE;
-
-typedef GtkWidget_FID_CACHE *PGtkWidget_FID_CACHE;
-
-typedef struct GtkContainer_FID_CACHE {
- int cached;
- jclass GtkContainerClass;
- jfieldID focus_child, border_width, need_resize, resize_mode, resize_widgets;
-} GtkContainer_FID_CACHE;
-
-typedef GtkContainer_FID_CACHE *PGtkContainer_FID_CACHE;
-
-typedef struct GtkBin_FID_CACHE {
- int cached;
- jclass GtkBinClass;
- jfieldID child;
-} GtkBin_FID_CACHE;
-
-typedef GtkBin_FID_CACHE *PGtkBin_FID_CACHE;
-
-typedef struct GtkFrame_FID_CACHE {
- int cached;
- jclass GtkFrameClass;
- jfieldID label, shadow_type,
- label_width, label_height,
- label_xalign, label_yalign;
-} GtkFrame_FID_CACHE;
-
-typedef GtkFrame_FID_CACHE *PGtkFrame_FID_CACHE;
-
-typedef struct GtkMenu_FID_CACHE {
- int cached;
- jclass GtkMenuClass;
- jfieldID parent_menu_item, old_active_menu_item, accel_group, position_func, position_func_data, toplevel, tearoff_window, torn_off;
-} GtkMenu_FID_CACHE;
-
-typedef GtkMenu_FID_CACHE *PGtkMenu_FID_CACHE;
-
-typedef struct GtkMenuShell_FID_CACHE {
- int cached;
- jclass GtkMenuShellClass;
- jfieldID active;
-} GtkMenuShell_FID_CACHE;
-
-typedef GtkMenuShell_FID_CACHE *PGtkMenuShell_FID_CACHE;
-
-typedef struct GtkItem_FID_CACHE {
- int cached;
- jclass GtkItemClass;
-} GtkItem_FID_CACHE;
-
-typedef GtkItem_FID_CACHE *PGtkItem_FID_CACHE;
-
-typedef struct GtkMenuItem_FID_CACHE {
- int cached;
- jclass GtkMenuItemClass;
- jfieldID submenu, accelerator_signal, toggle_size, accelerator_width, show_toggle_indicator, show_submenu_indicator, submenu_placement, submenu_direction, right_justify, timer;
-} GtkMenuItem_FID_CACHE;
-
-typedef GtkMenuItem_FID_CACHE *PGtkMenuItem_FID_CACHE;
-
-typedef struct GtkCheckMenuItem_FID_CACHE {
- int cached;
- jclass GtkCheckMenuItemClass;
- jfieldID active, always_show_toggle;
-} GtkCheckMenuItem_FID_CACHE;
-
-typedef GtkCheckMenuItem_FID_CACHE *PGtkCheckMenuItem_FID_CACHE;
-
-typedef struct GtkWindow_FID_CACHE {
- int cached;
- jclass GtkWindowClass;
- jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal;
-} GtkWindow_FID_CACHE;
-
-typedef GtkWindow_FID_CACHE *PGtkWindow_FID_CACHE;
-
-typedef struct GtkDialog_FID_CACHE {
- int cached;
- jclass GtkDialogClass;
- jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal, vbox, action_area;
-} GtkDialog_FID_CACHE;
-
-typedef GtkDialog_FID_CACHE *PGtkDialog_FID_CACHE;
-
-typedef struct GtkColorSelectionDialog_FID_CACHE {
- int cached;
- jclass GtkColorSelectionDialogClass;
- jfieldID colorsel, main_vbox, ok_button, reset_button, cancel_button, help_button;
-} GtkColorSelectionDialog_FID_CACHE;
-
-typedef GtkColorSelectionDialog_FID_CACHE *PGtkColorSelectionDialog_FID_CACHE;
-
-typedef struct GtkBox_FID_CACHE {
- int cached;
- jclass GtkBoxClass;
- jfieldID children, spacing, homogeneous;
-} GtkBox_FID_CACHE;
-
-typedef GtkBox_FID_CACHE *PGtkBox_FID_CACHE;
-
-typedef struct GtkHBox_FID_CACHE {
- int cached;
- jclass GtkHBoxClass;
-} GtkHBox_FID_CACHE;
-
-typedef GtkHBox_FID_CACHE *PGtkHBox_FID_CACHE;
-
-typedef struct GtkCombo_FID_CACHE {
- int cached;
- jclass GtkComboClass;
- jfieldID entry, button, popup, popwin, list, entry_change_id, list_change_id, value_in_list, ok_if_empty, case_sensitive, use_arrows, use_arrows_always, current_button, activate_id;
-} GtkCombo_FID_CACHE;
-
-typedef GtkCombo_FID_CACHE *PGtkCombo_FID_CACHE;
-
-typedef struct GtkFileSelection_FID_CACHE {
- int cached;
- jclass GtkFileSelectionClass;
- jfieldID dir_list, file_list, selection_entry, selection_text, main_vbox, ok_button, cancel_button, help_button, history_pulldown, history_menu, history_list, fileop_dialog, fileop_entry, fileop_file, cmpl_state, fileop_c_dir, fileop_del_file, fileop_ren_file, button_area, action_area;
-} GtkFileSelection_FID_CACHE;
-
-typedef GtkFileSelection_FID_CACHE *PGtkFileSelection_FID_CACHE;
-
-typedef struct GtkFontSelectionDialog_FID_CACHE {
- int cached;
- jclass GtkFontSelectionDialogClass;
- jfieldID fontsel, main_vbox, action_area, ok_button, apply_button, cancel_button, dialog_width, auto_resize;
-} GtkFontSelectionDialog_FID_CACHE;
-
-typedef GtkFontSelectionDialog_FID_CACHE *PGtkFontSelectionDialog_FID_CACHE;
-
-typedef struct GtkCList_FID_CACHE {
- int cached;
- jclass GtkCListClass;
- jfieldID clist_flags, row_mem_chunk, cell_mem_chunk, freeze_count, internal_allocation_x, internal_allocation_y, internal_allocation_width, internal_allocation_height, rows, row_center_offset, row_height, row_list, row_list_end, columns, column_title_area_x, column_title_area_y, column_title_area_width, column_title_area_height, title_window, column, clist_window, clist_window_width, clist_window_height, hoffset, voffset, shadow_type, selection_mode, selection, selection_end, undo_selection, undo_unselection, undo_anchor, button_actions0, button_actions1, button_actions2, button_actions3, button_actions4, drag_button, click_cell_row, click_cell_column, hadjustment, vadjustment, xor_gc, fg_gc, bg_gc, cursor_drag, x_drag, focus_row, anchor, anchor_state, drag_pos, htimer, vtimer, sort_type, compare, sort_column;
-} GtkCList_FID_CACHE;
-
-typedef GtkCList_FID_CACHE *PGtkCList_FID_CACHE;
-
-typedef struct GtkEditable_FID_CACHE {
- int cached;
- jclass GtkEditableClass;
- jfieldID current_pos, selection_start_pos, selection_end_pos, has_selection, editable, visible, ic, ic_attr, clipboard_text;
-} GtkEditable_FID_CACHE;
-
-typedef GtkEditable_FID_CACHE *PGtkEditable_FID_CACHE;
-
-typedef struct GtkText_FID_CACHE {
- int cached;
- jclass GtkTextClass;
- jfieldID first_line_start_index,first_onscreen_hor_pixel,first_onscreen_ver_pixel,default_tab_width,cursor_pos_x,cursor_pos_y,cursor_virtual_x;
-} GtkText_FID_CACHE;
-
-typedef GtkText_FID_CACHE *PGtkText_FID_CACHE;
-
-typedef struct GtkProgress_FID_CACHE {
- int cached;
- jclass GtkProgressClass;
- jfieldID adjustment, offscreen_pixmap, format, x_align, y_align, show_text, activity_mode;
-} GtkProgress_FID_CACHE;
-
-typedef GtkProgress_FID_CACHE *PGtkProgress_FID_CACHE;
-
-typedef struct GtkProgressBar_FID_CACHE {
- int cached;
- jclass GtkProgressBarClass;
- jfieldID bar_style, orientation, blocks, in_block, activity_pos, activity_step, activity_blocks, activity_dir;
-} GtkProgressBar_FID_CACHE;
-
-typedef GtkProgressBar_FID_CACHE *PGtkProgressBar_FID_CACHE;
-
-typedef struct GtkArg_FID_CACHE {
- int cached;
- jclass GtkArgClass;
- jfieldID type, name, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
-} GtkArg_FID_CACHE;
-
-typedef GtkArg_FID_CACHE *PGtkArg_FID_CACHE;
-
-typedef struct GtkRequisition_FID_CACHE {
- int cached;
- jclass GtkRequisitionClass;
- jfieldID width, height;
-} GtkRequisition_FID_CACHE;
-
-typedef GtkRequisition_FID_CACHE *PGtkRequisition_FID_CACHE;
-
-typedef struct GtkStyle_FID_CACHE {
- int cached;
- jclass GtkStyleClazz;
- jfieldID klass, fg0_pixel, fg0_red, fg0_green, fg0_blue, fg1_pixel, fg1_red, fg1_green, fg1_blue, fg2_pixel, fg2_red, fg2_green, fg2_blue, fg3_pixel, fg3_red, fg3_green, fg3_blue, fg4_pixel, fg4_red, fg4_green, fg4_blue, bg0_pixel, bg0_red, bg0_green, bg0_blue, bg1_pixel, bg1_red, bg1_green, bg1_blue, bg2_pixel, bg2_red, bg2_green, bg2_blue, bg3_pixel, bg3_red, bg3_green, bg3_blue, bg4_pixel, bg4_red, bg4_green, bg4_blue, light0_pixel, light0_red, light0_green, light0_blue, light1_pixel, light1_red, light1_green, light1_blue, light2_pixel, light2_red, light2_green, light2_blue, light3_pixel, light3_red, light3_green, light3_blue, light4_pixel, light4_red, light4_green, light4_blue, dark0_pixel, dark0_red, dark0_green, dark0_blue, dark1_pixel, dark1_red, dark1_green, dark1_blue, dark2_pixel, dark2_red, dark2_green, dark2_blue, dark3_pixel, dark3_red, dark3_green, dark3_blue, dark4_pixel, dark4_red, dark4_green, dark4_blue, mid0_pixel, mid0_red, mid0_green, mid0_blue, mid1_pixel, mid1_red, mid1_green, mid1_blue, mid2_pixel, mid2_red, mid2_green, mid2_blue, mid3_pixel, mid3_red, mid3_green, mid3_blue, mid4_pixel, mid4_red, mid4_green, mid4_blue, text0_pixel, text0_red, text0_green, text0_blue, text1_pixel, text1_red, text1_green, text1_blue, text2_pixel, text2_red, text2_green, text2_blue, text3_pixel, text3_red, text3_green, text3_blue, text4_pixel, text4_red, text4_green, text4_blue, base0_pixel, base0_red, base0_green, base0_blue, base1_pixel, base1_red, base1_green, base1_blue, base2_pixel, base2_red, base2_green, base2_blue, base3_pixel, base3_red, base3_green, base3_blue, base4_pixel, base4_red, base4_green, base4_blue, black_pixel, black_red, black_green, black_blue, white_pixel, white_red, white_green, white_blue, font, fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4, bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4, light_gc0, light_gc1, light_gc2, light_gc3, light_gc4, dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4, mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4, text_gc0, text_gc1, text_gc2, text_gc3, text_gc4, base_gc0, base_gc1, base_gc2, base_gc3, base_gc4, black_gc, white_gc, bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
- jfieldID ref_count, attach_count, depth, colormap, engine, engine_data, rc_style, styles;
-} GtkStyle_FID_CACHE;
-
-typedef GtkStyle_FID_CACHE *PGtkStyle_FID_CACHE;
-
-typedef struct GtkStyleClass_FID_CACHE {
- int cached;
- jclass GtkStyleClassClazz;
- jfieldID xthickness, ythickness;
-} GtkStyleClass_FID_CACHE;
-
-typedef GtkStyleClass_FID_CACHE *PGtkStyleClass_FID_CACHE;
-
-typedef struct GtkCListRow_FID_CACHE {
- int cached;
- jclass GtkCListRowClass;
- jfieldID cell, state, foreground_red, foreground_green, foreground_blue, foreground_pixel, background_red, background_green, background_blue, background_pixel, style, data, destroy, fg_set, bg_set, selectable;
-} GtkCListRow_FID_CACHE;
-
-typedef GtkCListRow_FID_CACHE *PGtkCListRow_FID_CACHE;
-
-typedef struct GtkCListColumn_FID_CACHE {
- int cached;
- jclass GtkCListColumnClass;
- jfieldID title, area_x, area_y, area_width, area_height, button, window, width, min_width, max_width, justification, visible, width_set, resizeable, auto_resize, button_passive;
-} GtkCListColumn_FID_CACHE;
-
-typedef GtkCListColumn_FID_CACHE *PGtkCListColumn_FID_CACHE;
-
-typedef struct GtkCTreeRow_FID_CACHE {
- int cached;
- jclass GtkCTreeRowClass;
- jfieldID parent, sibling, children, pixmap_closed, mask_closed, pixmap_opened, mask_opened, level, is_leaf, expanded;
-} GtkCTreeRow_FID_CACHE;
-
-typedef GtkCTreeRow_FID_CACHE *PGtkCTreeRow_FID_CACHE;
-
-typedef struct GtkCTree_FID_CACHE {
- int cached;
- jclass GtkCTreeClass;
- jfieldID tree_indent, tree_column;
-
-} GtkCTree_FID_CACHE;
-
-typedef GtkCTree_FID_CACHE *PGtkCTree_FID_CACHE;
-
-/* ----------- cache function prototypes ----------- */
-
-void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache);
-void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache);
-void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache);
-void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache);
-void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache);
-void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache);
-void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache);
-void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache);
-void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache);
-void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache);
-void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache);
-
-void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache);
-void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache);
-void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache);
-void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache);
-void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache);
-void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache);
-void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache);
-void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache);
-void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache);
-void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache);
-void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache);
-void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache);
-void cacheGtkDialogFids(JNIEnv *env, jobject lpGtkDialog, PGtkDialog_FID_CACHE lpCache);
-void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache);
-void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache);
-void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache);
-void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache);
-void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache);
-void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache);
-void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache);
-void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache);
-void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache);
-void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache);
-void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache);
-
-void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache);
-void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache);
-void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache);
-void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache);
-void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache);
-void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache);
-void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache);
-void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache);
-void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache);
-
-/* ----------- swt getter and setter prototypes ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- * The header file just contains function prototypes
- */
-void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
-void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
-void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
-void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
-void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
-void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
-void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
-void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
-void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
-void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
-void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
-void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
-void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
-void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
-void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
-void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
-void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
-void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
-void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
-void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
-void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
-void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
-void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
-void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
-void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
-void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
-void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
-void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
-void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
-void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
-void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
-void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
-void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
-void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
-void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
-void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
-void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
-void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
-void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
-void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
-void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
-void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
-void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
-void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
-void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
-void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
-void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
-void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
-void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
-void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
-void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
-void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
-void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
-void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
-void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
-void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
-void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
-void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
-void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
-void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
-void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
-void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
-void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
-void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
-void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
-void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
-void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
-void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
-void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
-void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
-void getGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc);
-void setGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc);
-void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
-void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
-void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
-void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
-void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
-void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
-void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
-void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
-void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
-void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
-void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
-void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
-void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
-void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
-void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
-void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
-
-extern GdkColor_FID_CACHE GdkColorFc;
-extern GdkEventKey_FID_CACHE GdkEventKeyFc;
-extern GdkEventButton_FID_CACHE GdkEventButtonFc;
-extern GdkEventMotion_FID_CACHE GdkEventMotionFc;
-extern GdkEventExpose_FID_CACHE GdkEventExposeFc;
-extern GdkFont_FID_CACHE GdkFontFc;
-extern GdkGCValues_FID_CACHE GdkGCValuesFc;
-extern GdkImage_FID_CACHE GdkImageFc;
-extern GdkPoint_FID_CACHE GdkPointFc;
-extern GdkRectangle_FID_CACHE GdkRectangleFc;
-extern GdkVisual_FID_CACHE GdkVisualFc;
-
-extern GtkAdjustment_FID_CACHE GtkAdjustmentFc;
-extern GtkAllocation_FID_CACHE GtkAllocationFc;
-extern GtkBin_FID_CACHE GtkBinFc;
-extern GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
-extern GtkContainer_FID_CACHE GtkContainerFc;
-extern GtkCListRow_FID_CACHE GtkCListRowFc;
-extern GtkCListColumn_FID_CACHE GtkCListColumnFc;
-extern GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
-extern GtkCTree_FID_CACHE GtkCTreeFc;
-extern GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
-extern GtkCList_FID_CACHE GtkCListFc;
-extern GtkData_FID_CACHE GtkDataFc;
-extern GtkEditable_FID_CACHE GtkEditableFc;
-extern GtkItem_FID_CACHE GtkItemFc;
-extern GtkMenu_FID_CACHE GtkMenuFc;
-extern GtkMenuShell_FID_CACHE GtkMenuShellFc;
-extern GtkMenuItem_FID_CACHE GtkMenuItemFc;
-extern GtkObject_FID_CACHE GtkObjectFc;
-extern GtkWidget_FID_CACHE GtkWidgetFc;
-extern GtkWindow_FID_CACHE GtkWindowFc;
-extern GtkDialog_FID_CACHE GtkDialogFc;
-extern GtkBox_FID_CACHE GtkBoxFc;
-extern GtkHBox_FID_CACHE GtkHBoxFc;
-extern GtkCombo_FID_CACHE GtkComboFc;
-extern GtkFileSelection_FID_CACHE GtkFileSelectionFc;
-extern GtkFrame_FID_CACHE GtkFrameFc;
-extern GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
-extern GtkText_FID_CACHE GtkTextFc;
-extern GtkProgress_FID_CACHE GtkProgressFc;
-extern GtkProgressBar_FID_CACHE GtkProgressBarFc;
-extern GtkArg_FID_CACHE GtkArgFc;
-extern GtkRequisition_FID_CACHE GtkRequisitionFc;
-extern GtkStyle_FID_CACHE GtkStyleFc;
-extern GtkStyleClass_FID_CACHE GtkStyleClassFc;
-
-#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
deleted file mode 100644
index a9f8db8414..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
+++ /dev/null
@@ -1,7865 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * SWT OS natives implementation.
- */
-
-/*#define PRINT_FAILED_RCODES*/
-#define NDEBUG
-
-#include "swt.h"
-#include "structs.h"
-
-#include <stdio.h>
-#include <assert.h>
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_draw_check
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1draw_1check
- (JNIEnv *env, jclass that, jint style, jint window, jint state_type, jint shadow_type, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive_to_depth");
-#endif
-
- gtk_draw_check((GtkStyle*)style, (GdkWindow *) window, (GtkStateType)state_type, (GtkShadowType)shadow_type, (gint) x, (gint) y, (gint) width, (gint) height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_post_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive_1to_1depth
- (JNIEnv *env, jclass that, jint ctree, jint node, jint depth, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive_to_depth");
-#endif
-
- gtk_ctree_post_recursive_to_depth((GtkCTree*)ctree, (GtkCTreeNode*)node, (jint)depth, (GtkCTreeFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_row_is_visible
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1row_1is_1visible
- (JNIEnv *env, jclass that, jint clist, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_row_is_visible");
-#endif
-
- return gtk_clist_row_is_visible((GtkCList *)clist, (gint)row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_default_handler
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint log_levels, jint message, jint unused_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_default_handler");
-#endif
-
- g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *)message, (gpointer)unused_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_set_handler
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
- (JNIEnv *env, jclass that, jbyteArray log_domain, jint log_levels, jint log_func, jint user_data)
-{
- jint rc;
- jbyte *log_domain1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_set_handler");
-#endif
-
- if (log_domain) {
- log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
- }
- rc = (jint) g_log_set_handler((gchar *)log_domain1, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
- if (log_domain) {
- (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_remove_handler
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1remove_1handler
- (JNIEnv *env, jclass that, jbyteArray log_domain, jint handler_id)
-{
- jbyte *log_domain1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_remove_handler");
-#endif
-
- if (log_domain) {
- log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
- }
- g_log_remove_handler((gchar *)log_domain1, handler_id);
- if (log_domain) {
- (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: GTK_WIDGET_TYPE
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1TYPE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_TYPE");
-#endif
-
- return GTK_WIDGET_TYPE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_get_type
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1get_1type
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_get_type");
-#endif
-
- return gtk_label_get_type ();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1unref
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_unref");
-#endif
-
- gtk_object_unref((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_ref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1destroy
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_destroy");
-#endif
-
- gtk_object_destroy((GtkObject*)object);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1data_1by_1id
- (JNIEnv *env, jclass that, jint object, jint data_id)
-{
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_get_data_by_id");
-#endif
- return (jint) gtk_object_get_data_by_id((GtkObject*)object, (GQuark) data_id);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1data_1by_1id
- (JNIEnv *env, jclass that, jint object, jint data_id, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_set_data_by_id");
-#endif
-
- gtk_object_set_data_by_id ((GtkObject*)object, (GQuark) data_id, (gpointer) data);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1quark_1from_1string
- (JNIEnv *env, jclass that, jbyteArray string)
-{
- jint result;
- jbyte *string1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_quark_from_string");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- result = g_quark_from_string((gchar *) string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return result;
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_block_by_data");
-#endif
-
- gtk_signal_handler_block_by_data((GtkObject*)object, (gpointer) data);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_unblock_by_data");
-#endif
-
- gtk_signal_handler_unblock_by_data((GtkObject*)object, (gpointer) data);
-}
-
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1rgb_1init
- (JNIEnv *env, jclass cl)
-{
- gdk_rgb_init();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1FLAGS
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_FLAGS");
-#endif
-
- return (jint) GTK_WIDGET_FLAGS((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SET_1FLAGS
- (JNIEnv *env, jclass that, jint wid, jint flag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_SET_FLAGS");
-#endif
-
- GTK_WIDGET_SET_FLAGS((GtkWidget*)wid, flag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1UNSET_1FLAGS
- (JNIEnv *env, jclass that, jint wid, jint flag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_UNSET_FLAGS");
-#endif
-
- GTK_WIDGET_UNSET_FLAGS((GtkWidget*)wid, flag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1NO_1WINDOW
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_NO_WINDOW");
-#endif
-
- return (jboolean) GTK_WIDGET_NO_WINDOW((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: GDK_ROOT_PARENT
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GDK_1ROOT_1PARENT
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GDK_ROOT_PARENT");
-#endif
-
- return (jint) GDK_ROOT_PARENT();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SENSITIVE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_SENSITIVE");
-#endif
-
- return (jboolean) GTK_WIDGET_SENSITIVE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1IS_1SENSITIVE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_IS_SENSITIVE");
-#endif
-
- return (jboolean) GTK_WIDGET_IS_SENSITIVE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_accel_group_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_group_new");
-#endif
-
- return (jint)gtk_accel_group_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_accel_group_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1unref
- (JNIEnv *env, jclass that, jint accel_group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_group_unref");
-#endif
-
- gtk_accel_group_unref((GtkAccelGroup*)accel_group);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1groups_1activate
- (JNIEnv *env, jclass that, jint accel_group, jint accel_key, jint accel_mods)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_groups_activate");
-#endif
-
- return (jboolean) gtk_accel_groups_activate(GTK_OBJECT((GtkWindow*)accel_group),
- accel_key,
- accel_mods);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1new
- (JNIEnv *env, jclass that, jfloat value, jfloat lower, jfloat upper, jfloat step_increment, jfloat page_increment, jfloat page_size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_new");
-#endif
-
- return (jint)gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_changed
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1changed
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_changed");
-#endif
-
- gtk_adjustment_changed((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_value_changed
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1value_1changed
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_value_changed");
-#endif
-
- gtk_adjustment_value_changed((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_set_value
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1set_1value
- (JNIEnv *env, jclass that, jint adjustment, jfloat value)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_set_value");
-#endif
-
- gtk_adjustment_set_value((GtkAdjustment*)adjustment, value);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_arrow_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1new
- (JNIEnv *env, jclass that, jint arrow_type, jint shadow_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_arrow_new");
-#endif
-
- return (jint)gtk_arrow_new((GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_arrow_set
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1set
- (JNIEnv *env, jclass that, jint arrow, jint arrow_type, jint shadow_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_arrow_set");
-#endif
-
- gtk_arrow_set((GtkArrow*)arrow, (GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_box_pack_start
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1start
- (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_box_pack_start");
-#endif
-
- gtk_box_pack_start((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_box_pack_end
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1end
- (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_box_pack_end");
-#endif
-
- gtk_box_pack_end((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_button_new");
-#endif
-
- return (jint)gtk_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_button_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_button_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_button_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_button_new");
-#endif
-
- return (jint)gtk_check_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_check_menu_item_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_set_active
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1active
- (JNIEnv *env, jclass that, jint check_menu_item, jboolean is_active)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_set_active");
-#endif
-
- gtk_check_menu_item_set_active((GtkCheckMenuItem*)check_menu_item, (gboolean)is_active);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_set_show_toggle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1show_1toggle
- (JNIEnv *env, jclass that, jint menu_item, jboolean always)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_set_show_toggle");
-#endif
-
- gtk_check_menu_item_set_show_toggle((GtkCheckMenuItem*)menu_item, (gboolean)always);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_set_color
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1set_1color
- (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
-{
- jdouble *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_set_color");
-#endif
-
- if (color) {
- color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
- }
- gtk_color_selection_set_color((GtkColorSelection*)colorsel, (gdouble*)color1);
- if (color) {
- (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_get_color
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1get_1color
- (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
-{
- jdouble *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_get_color");
-#endif
-
- if (color) {
- color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
- }
- gtk_color_selection_get_color((GtkColorSelection*)colorsel, (gdouble*)color1);
- if (color) {
- (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1dialog_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_dialog_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_color_selection_dialog_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_combo_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_combo_new");
-#endif
-
- return (jint)gtk_combo_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_combo_set_popdown_strings
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1set_1popdown_1strings
- (JNIEnv *env, jclass that, jint combo, jint strings)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_combo_set_popdown_strings");
-#endif
-
- gtk_combo_set_popdown_strings((GtkCombo*)combo, (GList*)strings);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_add
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1add
- (JNIEnv *env, jclass that, jint container, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_add");
-#endif
-
- gtk_container_add((GtkContainer*)container, (GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1remove
- (JNIEnv *env, jclass that, jint container, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_remove");
-#endif
-
- gtk_container_remove((GtkContainer*)container, (GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_children
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1children
- (JNIEnv *env, jclass that, jint container)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_children");
-#endif
-
- return (jint)gtk_container_children((GtkContainer*)container);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1new
- (JNIEnv *env, jclass that, jint columns, jint tree_column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_new");
-#endif
-
- return (jint)gtk_ctree_new((gint)columns, (gint)tree_column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_insert_node
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1insert_1node
- (JNIEnv *env, jclass that, jint ctree, jint parent, jint sibling, jintArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_insert_node");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_ctree_insert_node((GtkCTree*)ctree, (GtkCTreeNode*)parent, (GtkCTreeNode*)sibling, (gchar**)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_remove_node
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1remove_1node
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_remove_node");
-#endif
-
- gtk_ctree_remove_node((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_post_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive");
-#endif
-
- gtk_ctree_post_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node, (GtkCTreeFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_is_viewable
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1viewable
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_is_viewable");
-#endif
-
- return (jboolean)gtk_ctree_is_viewable((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1nth
- (JNIEnv *env, jclass that, jint ctree, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_nth");
-#endif
-
- return (jint)gtk_ctree_node_nth((GtkCTree*)ctree, row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_is_hot_spot
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1hot_1spot
- (JNIEnv *env, jclass that, jint ctree, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_is_hot_spot");
-#endif
-
- return (jboolean)gtk_ctree_is_hot_spot((GtkCTree*)ctree, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_expand
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1expand
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_expand");
-#endif
-
- gtk_ctree_expand((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_collapse
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1collapse
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_collapse");
-#endif
-
- gtk_ctree_collapse((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_select
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_select");
-#endif
-
- gtk_ctree_select((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_select_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_select_recursive");
-#endif
-
- gtk_ctree_select_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_unselect_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1unselect_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_unselect_recursive");
-#endif
-
- gtk_ctree_unselect_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_set_node_info
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1set_1node_1info
- (JNIEnv *env, jclass that, jint ctree, jint node, jbyteArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_set_node_info");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_ctree_set_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_get_node_info
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1get_1node_1info
- (JNIEnv *env, jclass that, jint ctree, jint node, jintArray text, jbyteArray spacing, jintArray pixmap_closed, jintArray mask_closed, jintArray pixmap_opened, jintArray mask_opened, jbooleanArray is_leaf, jbooleanArray expanded)
-{
- jint rc;
- jint *text1 = NULL;
- jbyte *spacing1 = NULL;
- jint *pixmap_closed1 = NULL;
- jint *mask_closed1 = NULL;
- jint *pixmap_opened1 = NULL;
- jint *mask_opened1 = NULL;
- jboolean *is_leaf1 = NULL;
- jboolean *expanded1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_get_node_info");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- if (spacing) {
- spacing1 = (*env)->GetByteArrayElements(env, spacing, NULL);
- }
- if (pixmap_closed) {
- pixmap_closed1 = (*env)->GetIntArrayElements(env, pixmap_closed, NULL);
- }
- if (mask_closed) {
- mask_closed1 = (*env)->GetIntArrayElements(env, mask_closed, NULL);
- }
- if (pixmap_opened) {
- pixmap_opened1 = (*env)->GetIntArrayElements(env, pixmap_opened, NULL);
- }
- if (mask_opened) {
- mask_opened1 = (*env)->GetIntArrayElements(env, mask_opened, NULL);
- }
- if (is_leaf) {
- is_leaf1 = (*env)->GetBooleanArrayElements(env, is_leaf, NULL);
- }
- if (expanded) {
- expanded1 = (*env)->GetBooleanArrayElements(env, expanded, NULL);
- }
- rc = (jint)gtk_ctree_get_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap_closed1, (GdkBitmap**)mask_closed1, (GdkPixmap**)pixmap_opened1, (GdkBitmap**)mask_opened1, (gboolean*)is_leaf1, (gboolean*)expanded1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- if (spacing) {
- (*env)->ReleaseByteArrayElements(env, spacing, spacing1, 0);
- }
- if (pixmap_closed) {
- (*env)->ReleaseIntArrayElements(env, pixmap_closed, pixmap_closed1, 0);
- }
- if (mask_closed) {
- (*env)->ReleaseIntArrayElements(env, mask_closed, mask_closed1, 0);
- }
- if (pixmap_opened) {
- (*env)->ReleaseIntArrayElements(env, pixmap_opened, pixmap_opened1, 0);
- }
- if (mask_opened) {
- (*env)->ReleaseIntArrayElements(env, mask_opened, mask_opened1, 0);
- }
- if (is_leaf) {
- (*env)->ReleaseBooleanArrayElements(env, is_leaf, is_leaf1, 0);
- }
- if (expanded) {
- (*env)->ReleaseBooleanArrayElements(env, expanded, expanded1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_get_row_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1style
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_get_row_style");
-#endif
-
- return (jint)gtk_ctree_node_get_row_style((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_set_row_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1set_1row_1data
- (JNIEnv *env, jclass that, jint ctree, jint node, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_set_row_data");
-#endif
-
- gtk_ctree_node_set_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_get_row_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1data
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_get_row_data");
-#endif
-
- return (jint)gtk_ctree_node_get_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_moveto
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1moveto
- (JNIEnv *env, jclass that, jint ctree, jint node, jint column, jfloat row_align, jfloat col_align)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_moveto");
-#endif
-
- gtk_ctree_node_moveto((GtkCTree*)ctree, (GtkCTreeNode*)node, (gint)column, row_align, col_align);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_is_visible
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1is_1visible
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_is_visible");
-#endif
-
- return (jint)gtk_ctree_node_is_visible((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1dialog_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_dialog_new");
-#endif
-
- return (jint)gtk_dialog_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drawing_area_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drawing_area_new");
-#endif
-
- return (jint)gtk_drawing_area_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drawing_area_size
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1size
- (JNIEnv *env, jclass that, jint darea, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drawing_area_size");
-#endif
-
- gtk_drawing_area_size((GtkDrawingArea*)darea, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_select_region
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1select_1region
- (JNIEnv *env, jclass that, jint editable, jint start, jint end)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_select_region");
-#endif
-
- gtk_editable_select_region((GtkEditable*)editable, (gint)start, (gint)end);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_insert_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1insert_1text
- (JNIEnv *env, jclass that, jint editable, jbyteArray new_text, jint new_text_length, jintArray position)
-{
- jbyte *new_text1 = NULL;
- jint *position1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_insert_text");
-#endif
-
- if (new_text) {
- new_text1 = (*env)->GetByteArrayElements(env, new_text, NULL);
- }
- if (position) {
- position1 = (*env)->GetIntArrayElements(env, position, NULL);
- }
- gtk_editable_insert_text((GtkEditable*)editable, (gchar*)new_text1, (gint)new_text_length, (gint*)position1);
- if (new_text) {
- (*env)->ReleaseByteArrayElements(env, new_text, new_text1, 0);
- }
- if (position) {
- (*env)->ReleaseIntArrayElements(env, position, position1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_delete_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1text
- (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_delete_text");
-#endif
-
- gtk_editable_delete_text((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_get_chars
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1chars
- (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_get_chars");
-#endif
-
- return (jint)gtk_editable_get_chars((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_delete_selection
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1selection
- (JNIEnv *env, jclass that, jint editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_delete_selection");
-#endif
-
- gtk_editable_delete_selection((GtkEditable*)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_set_position
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1position
- (JNIEnv *env, jclass that, jint editable, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_set_position");
-#endif
-
- gtk_editable_set_position((GtkEditable*)editable, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_get_position
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1position
- (JNIEnv *env, jclass that, jint editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_get_position");
-#endif
-
- return (jint)gtk_editable_get_position((GtkEditable*)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_set_editable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1editable
- (JNIEnv *env, jclass that, jint editable, jboolean is_editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_set_editable");
-#endif
-
- gtk_editable_set_editable((GtkEditable*)editable, (gboolean)is_editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_new");
-#endif
-
- return (jint)gtk_entry_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1text
- (JNIEnv *env, jclass that, jint entry, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_entry_set_text((GtkEntry*)entry, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_append_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1append_1text
- (JNIEnv *env, jclass that, jint entry, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_append_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_entry_append_text((GtkEntry*)entry, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_get_text
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1get_1text
- (JNIEnv *env, jclass that, jint entry)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_get_text");
-#endif
-
- return (jint)gtk_entry_get_text((GtkEntry*)entry);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_visibility
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1visibility
- (JNIEnv *env, jclass that, jint entry, jboolean visible)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_visibility");
-#endif
-
- gtk_entry_set_visibility((GtkEntry*)entry, (gboolean)visible);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_editable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1editable
- (JNIEnv *env, jclass that, jint entry, jboolean editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_editable");
-#endif
-
- gtk_entry_set_editable((GtkEntry*)entry, (gboolean)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_max_length
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1max_1length
- (JNIEnv *env, jclass that, jint entry, jshort max)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_max_length");
-#endif
-
- gtk_entry_set_max_length((GtkEntry*)entry, (guint16)max);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_event_box_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1event_1box_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_event_box_new");
-#endif
-
- return (jint)gtk_event_box_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_file_selection_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_set_filename
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1set_1filename
- (JNIEnv *env, jclass that, jint filesel, jbyteArray filename)
-{
- jbyte *filename1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_set_filename");
-#endif
-
- if (filename) {
- filename1 = (*env)->GetByteArrayElements(env, filename, NULL);
- }
- gtk_file_selection_set_filename((GtkFileSelection*)filesel, (gchar*)filename1);
- if (filename) {
- (*env)->ReleaseByteArrayElements(env, filename, filename1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_get_filename
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1get_1filename
- (JNIEnv *env, jclass that, jint filesel)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_get_filename");
-#endif
-
- return (jint)gtk_file_selection_get_filename((GtkFileSelection*)filesel);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_complete
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1complete
- (JNIEnv *env, jclass that, jint filesel, jbyteArray pattern)
-{
- jbyte *pattern1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_complete");
-#endif
-
- if (pattern) {
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- }
- gtk_file_selection_complete((GtkFileSelection*)filesel, (gchar*)pattern1);
- if (pattern) {
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_new");
-#endif
-
- return (jint)gtk_fixed_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_put
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1put
- (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_put");
-#endif
-
- gtk_fixed_put((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_move
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1move
- (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_move");
-#endif
-
- gtk_fixed_move((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_set_font_name
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1set_1font_1name
- (JNIEnv *env, jclass that, jint fontsel, jbyteArray fontname)
-{
- jboolean rc;
- jbyte *fontname1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_set_font_name");
-#endif
-
- if (fontname) {
- fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
- }
- rc = (jboolean)gtk_font_selection_set_font_name((GtkFontSelection*)fontsel, (gchar*)fontname1);
- if (fontname) {
- (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_font_selection_dialog_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_get_font_name
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1get_1font_1name
- (JNIEnv *env, jclass that, jint fsd)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_get_font_name");
-#endif
-
- return (jint)gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog*)fsd);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_set_font_name
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1set_1font_1name
- (JNIEnv *env, jclass that, jint fsd, jbyteArray fontname)
-{
- jboolean rc;
- jbyte *fontname1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_set_font_name");
-#endif
-
- if (fontname) {
- fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
- }
- rc = (jboolean)gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog*)fsd, (gchar*)fontname1);
- if (fontname) {
- (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1new
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_new");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_frame_new((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_set_label
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1label
- (JNIEnv *env, jclass that, jint frame, jbyteArray label)
-{
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_set_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- gtk_frame_set_label((GtkFrame*)frame, (gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_set_shadow_type
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1shadow_1type
- (JNIEnv *env, jclass that, jint frame, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_set_shadow_type");
-#endif
-
- gtk_frame_set_shadow_type((GtkFrame*)frame, (GtkShadowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hbox_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hbox_1new
- (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hbox_new");
-#endif
-
- return (jint)gtk_hbox_new((gboolean)homogeneous, (gint)spacing);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hscale_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscale_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hscale_new");
-#endif
-
- return (jint)gtk_hscale_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hscrollbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscrollbar_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hscrollbar_new");
-#endif
-
- return (jint)gtk_hscrollbar_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hseparator_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hseparator_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hseparator_new");
-#endif
-
- return (jint)gtk_hseparator_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1new
- (JNIEnv *env, jclass that, jbyteArray str)
-{
- jint rc;
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_new");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- rc = (jint)gtk_label_new((gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1text
- (JNIEnv *env, jclass that, jint label, jbyteArray str)
-{
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_text");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- gtk_label_set_text((GtkLabel*)label, (gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_justify
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1justify
- (JNIEnv *env, jclass that, jint label, jint jtype)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_justify");
-#endif
-
- gtk_label_set_justify((GtkLabel*)label, (GtkJustification)jtype);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_pattern
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1pattern
- (JNIEnv *env, jclass that, jint label, jbyteArray pattern)
-{
- jbyte *pattern1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_pattern");
-#endif
-
- if (pattern) {
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- }
- gtk_label_set_pattern((GtkLabel*)label, (gchar*)pattern1);
- if (pattern) {
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_line_wrap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1line_1wrap
- (JNIEnv *env, jclass that, jint label, jboolean wrap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_line_wrap");
-#endif
-
- gtk_label_set_line_wrap((GtkLabel*)label, (gboolean)wrap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_parse_uline
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1parse_1uline
- (JNIEnv *env, jclass that, jint label, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_parse_uline");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gtk_label_parse_uline((GtkLabel*)label, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_list_clear_items
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1clear_1items
- (JNIEnv *env, jclass that, jint list, jint start, jint end)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_list_clear_items");
-#endif
-
- gtk_list_clear_items((GtkList*)list, (gint)start, (gint)end);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_list_select_item
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1select_1item
- (JNIEnv *env, jclass that, jint list, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_list_select_item");
-#endif
-
- gtk_list_select_item((GtkList*)list, (gint)item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_version
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1version
- (JNIEnv *env, jclass that, jint required_major, jint required_minor, jint required_micro)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_version");
-#endif
-
- return (jint)gtk_check_version(required_major, required_minor, required_micro);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_init_check
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1init_1check
- (JNIEnv *env, jclass that, jintArray argc, jintArray argv)
-{
- jboolean rc;
- jint *argc1 = NULL;
- jint *argv1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_init_check");
-#endif
-
- if (argc) {
- argc1 = (*env)->GetIntArrayElements(env, argc, NULL);
- }
- if (argv) {
- argv1 = (*env)->GetIntArrayElements(env, argv, NULL);
- }
- rc = (jboolean)gtk_init_check((int*)argc1, (char***)argv1);
- if (argc) {
- (*env)->ReleaseIntArrayElements(env, argc, argc1, 0);
- }
- if (argv) {
- (*env)->ReleaseIntArrayElements(env, argv, argv1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_events_pending
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1events_1pending
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_events_pending");
-#endif
-
- return (jint)gtk_events_pending();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main");
-#endif
-
- gtk_main();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main_quit
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1quit
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main_quit");
-#endif
-
- gtk_main_quit();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main_iteration
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1iteration
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main_iteration");
-#endif
-
- return (jint)gtk_main_iteration();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_add
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1add
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_add");
-#endif
-
- gtk_grab_add((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_get_current
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1get_1current
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_get_current");
-#endif
-
- return (jint)gtk_grab_get_current();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1remove
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_remove");
-#endif
-
- gtk_grab_remove((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_timeout_add
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1add
- (JNIEnv *env, jclass that, jint interval, jint function, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_timeout_add");
-#endif
-
- return (jint)gtk_timeout_add((guint32)interval, (GtkFunction)function, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_timeout_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1remove
- (JNIEnv *env, jclass that, jint timeout_handler_id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_timeout_remove");
-#endif
-
- gtk_timeout_remove(timeout_handler_id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_new");
-#endif
-
- return (jint)gtk_menu_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_insert
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1insert
- (JNIEnv *env, jclass that, jint menu, jint child, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_insert");
-#endif
-
- gtk_menu_insert((GtkMenu*)menu, (GtkWidget*)child, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_popup
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popup
- (JNIEnv *env, jclass that, jint menu, jint parent_menu_shell, jint parent_menu_item, jint func, jint data, jint button, jint activate_time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_popup");
-#endif
-
- gtk_menu_popup((GtkMenu*)menu, (GtkWidget*)parent_menu_shell, (GtkWidget*)parent_menu_item, (GtkMenuPositionFunc)func, (gpointer)data, button, (guint32)activate_time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_popdown
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popdown
- (JNIEnv *env, jclass that, jint menu)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_popdown");
-#endif
-
- gtk_menu_popdown((GtkMenu*)menu);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_bar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_bar_new");
-#endif
-
- return (jint)gtk_menu_bar_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_bar_insert
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1insert
- (JNIEnv *env, jclass that, jint menu_bar, jint child, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_bar_insert");
-#endif
-
- gtk_menu_bar_insert((GtkMenuBar*)menu_bar, (GtkWidget*)child, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_new");
-#endif
-
- return (jint)gtk_menu_item_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_menu_item_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_set_submenu
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1set_1submenu
- (JNIEnv *env, jclass that, jint menu_item, jint submenu)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_set_submenu");
-#endif
-
- gtk_menu_item_set_submenu((GtkMenuItem*)menu_item, (GtkWidget*)submenu);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_remove_submenu
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1remove_1submenu
- (JNIEnv *env, jclass that, jint menu_item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_remove_submenu");
-#endif
-
- gtk_menu_item_remove_submenu((GtkMenuItem*)menu_item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_misc_set_alignment
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1misc_1set_1alignment
- (JNIEnv *env, jclass that, jint misc, jfloat xalign, jfloat yalign)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_misc_set_alignment");
-#endif
-
- gtk_misc_set_alignment((GtkMisc*)misc, xalign, yalign);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_new");
-#endif
-
- return (jint)gtk_notebook_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_append_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1append_1page
- (JNIEnv *env, jclass that, jint notebook, jint child, jint tab_label)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_append_page");
-#endif
-
- gtk_notebook_append_page((GtkNotebook*)notebook, (GtkWidget*)child, (GtkWidget*)tab_label);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_remove_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1remove_1page
- (JNIEnv *env, jclass that, jint notebook, jint page_num)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_remove_page");
-#endif
-
- gtk_notebook_remove_page((GtkNotebook*)notebook, (gint)page_num);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_get_current_page
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1get_1current_1page
- (JNIEnv *env, jclass that, jint notebook)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_get_current_page");
-#endif
-
- return (jint)gtk_notebook_get_current_page((GtkNotebook*)notebook);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_set_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1page
- (JNIEnv *env, jclass that, jint notebook, jint page_num)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_set_page");
-#endif
-
- gtk_notebook_set_page((GtkNotebook*)notebook, (gint)page_num);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_set_show_tabs
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1show_1tabs
- (JNIEnv *env, jclass that, jint notebook, jboolean show_tabs)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_set_show_tabs");
-#endif
-
- gtk_notebook_set_show_tabs((GtkNotebook*)notebook, (gboolean)show_tabs);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_ref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1ref
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_ref");
-#endif
-
- gtk_object_ref((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_set_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1user_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_set_user_data");
-#endif
-
- gtk_object_set_user_data((GtkObject*)object, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_get_user_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1user_1data
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_get_user_data");
-#endif
-
- return (jint)gtk_object_get_user_data((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_pixmap_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1new
- (JNIEnv *env, jclass that, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_pixmap_new");
-#endif
-
- return (jint)gtk_pixmap_new((GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_pixmap_set
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1set
- (JNIEnv *env, jclass that, jint pixmap, jint val, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_pixmap_set");
-#endif
-
- gtk_pixmap_set((GtkPixmap*)pixmap, (GdkPixmap*)val, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_configure
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1configure
- (JNIEnv *env, jclass that, jint progress, jfloat value, jfloat min, jfloat max)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_configure");
-#endif
-
- gtk_progress_configure((GtkProgress*)progress, value, min, max);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_new_with_adjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_new");
-#endif
-
- return (jint)gtk_progress_bar_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_set_bar_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1bar_1style
- (JNIEnv *env, jclass that, jint pbar, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_set_bar_style");
-#endif
-
- gtk_progress_bar_set_bar_style((GtkProgressBar*)pbar, (GtkProgressBarStyle)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_set_orientation
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1orientation
- (JNIEnv *env, jclass that, jint pbar, jint orientation)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_set_orientation");
-#endif
-
- gtk_progress_bar_set_orientation((GtkProgressBar*)pbar, (GtkProgressBarOrientation)orientation);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1new
- (JNIEnv *env, jclass that, jint group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_button_new");
-#endif
-
- return (jint)gtk_radio_button_new((GSList*)group);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_button_group
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1group
- (JNIEnv *env, jclass that, jint radio_button)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_button_group");
-#endif
-
- return (jint)gtk_radio_button_group((GtkRadioButton*)radio_button);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jint group, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_radio_menu_item_new_with_label((GSList*)group, (gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_range_get_adjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1range_1get_1adjustment
- (JNIEnv *env, jclass that, jint range)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_range_get_adjustment");
-#endif
-
- return (jint)gtk_range_get_adjustment((GtkRange*)range);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_digits
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1digits
- (JNIEnv *env, jclass that, jint scale, jint digits)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_digits");
-#endif
-
- gtk_scale_set_digits((GtkScale*)scale, (gint)digits);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_draw_value
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1draw_1value
- (JNIEnv *env, jclass that, jint scale, jboolean draw_value)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_draw_value");
-#endif
-
- gtk_scale_set_draw_value((GtkScale*)scale, (gboolean)draw_value);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_value_pos
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1value_1pos
- (JNIEnv *env, jclass that, jint scale, jint pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_value_pos");
-#endif
-
- gtk_scale_set_value_pos((GtkScale*)scale, (GtkPositionType)pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1new
- (JNIEnv *env, jclass that, jint hadjustment, jint vadjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_new");
-#endif
-
- return (jint)gtk_scrolled_window_new((GtkAdjustment*)hadjustment, (GtkAdjustment*)vadjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_get_hadjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1hadjustment
- (JNIEnv *env, jclass that, jint scrolled_window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_get_hadjustment");
-#endif
-
- return (jint)gtk_scrolled_window_get_hadjustment((GtkScrolledWindow*)scrolled_window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_get_vadjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1vadjustment
- (JNIEnv *env, jclass that, jint scrolled_window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_get_vadjustment");
-#endif
-
- return (jint)gtk_scrolled_window_get_vadjustment((GtkScrolledWindow*)scrolled_window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_set_policy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1set_1policy
- (JNIEnv *env, jclass that, jint scrolled_window, jint hscrollbar_policy, jint vscrollbar_policy)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_set_policy");
-#endif
-
- gtk_scrolled_window_set_policy((GtkScrolledWindow*)scrolled_window, (GtkPolicyType)hscrollbar_policy, (GtkPolicyType)vscrollbar_policy);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_selection_owner_set
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1owner_1set
- (JNIEnv *env, jclass that, jint widget, jint selection, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_selection_owner_set");
-#endif
-
- return (jint)gtk_selection_owner_set((GtkWidget*)widget, (GdkAtom)selection, (guint32)time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_selection_convert
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1convert
- (JNIEnv *env, jclass that, jint widget, jint selection, jint target, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_selection_convert");
-#endif
-
- return (jint)gtk_selection_convert((GtkWidget*)widget, (GdkAtom)selection, (GdkAtom)target, (guint32)time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_emit_stop_by_name
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1emit_1stop_1by_1name
- (JNIEnv *env, jclass that, jint object, jbyteArray name)
-{
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_emit_stop_by_name");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- gtk_signal_emit_stop_by_name((GtkObject*)object, (gchar*)name1);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_connect
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect
- (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
-{
- jint rc;
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_connect");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- rc = (jint)gtk_signal_connect((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_connect_after
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect_1after
- (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
-{
- jint rc;
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_connect_after");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- rc = (jint)gtk_signal_connect_after((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_handler_block_by_func
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1func
- (JNIEnv *env, jclass that, jint object, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_block_by_func");
-#endif
-
- gtk_signal_handler_block_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_handler_unblock_by_func
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1func
- (JNIEnv *env, jclass that, jint object, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_unblock_by_func");
-#endif
-
- gtk_signal_handler_unblock_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_style_copy
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1copy
- (JNIEnv *env, jclass that, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_style_copy");
-#endif
-
- return (jint)gtk_style_copy((GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_style_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1unref
- (JNIEnv *env, jclass that, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_style_unref");
-#endif
-
- gtk_style_unref((GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1new
- (JNIEnv *env, jclass that, jint hadj, jint vadj)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_new");
-#endif
-
- return (jint)gtk_text_new((GtkAdjustment*)hadj, (GtkAdjustment*)vadj);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_set_word_wrap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1set_1word_1wrap
- (JNIEnv *env, jclass that, jint text, jint word_wrap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_set_word_wrap");
-#endif
-
- gtk_text_set_word_wrap((GtkText*)text, (gint)word_wrap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_get_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1get_1length
- (JNIEnv *env, jclass that, jint text)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_get_length");
-#endif
-
- return (jint)gtk_text_get_length((GtkText*)text);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_new");
-#endif
-
- return (jint)gtk_toggle_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_set_active
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1set_1active
- (JNIEnv *env, jclass that, jint toggle_button, jboolean is_active)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_set_active");
-#endif
-
- gtk_toggle_button_set_active((GtkToggleButton*)toggle_button, (gboolean)is_active);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_get_active
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1get_1active
- (JNIEnv *env, jclass that, jint toggle_button)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_get_active");
-#endif
-
- return (jboolean)gtk_toggle_button_get_active((GtkToggleButton*)toggle_button);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1new
- (JNIEnv *env, jclass that, jint orientation, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_new");
-#endif
-
- return (jint)gtk_toolbar_new((GtkOrientation)orientation, (GtkToolbarStyle)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_insert_element
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1element
- (JNIEnv *env, jclass that, jint toolbar, jint type, jint widget, jbyteArray text, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint icon, jint callback, jint user_data, jint position)
-{
- jint rc;
- jbyte *text1 = NULL;
- jbyte *tooltip_text1 = NULL;
- jbyte *tooltip_private_text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_insert_element");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- if (tooltip_text) {
- tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
- }
- if (tooltip_private_text) {
- tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
- }
- rc = (jint)gtk_toolbar_insert_element((GtkToolbar*)toolbar, (GtkToolbarChildType)type, (GtkWidget*)widget, (char*)text1, (char*)tooltip_text1, (char*)tooltip_private_text1, (GtkWidget*)icon, (GtkSignalFunc)callback, (gpointer)user_data, (gint)position);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
- if (tooltip_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
- }
- if (tooltip_private_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_insert_widget
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1widget
- (JNIEnv *env, jclass that, jint toolbar, jint widget, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint position)
-{
- jbyte *tooltip_text1 = NULL;
- jbyte *tooltip_private_text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_insert_widget");
-#endif
-
- if (tooltip_text) {
- tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
- }
- if (tooltip_private_text) {
- tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
- }
- gtk_toolbar_insert_widget((GtkToolbar*)toolbar, (GtkWidget*)widget, (char*)tooltip_text1, (char*)tooltip_private_text1, (gint)position);
- if (tooltip_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
- }
- if (tooltip_private_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_set_orientation
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1orientation
- (JNIEnv *env, jclass that, jint toolbar, jint orientation)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_set_orientation");
-#endif
-
- gtk_toolbar_set_orientation((GtkToolbar*)toolbar, (GtkOrientation)orientation);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_set_button_relief
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1button_1relief
- (JNIEnv *env, jclass that, jint toolbar, jint relief)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_set_button_relief");
-#endif
-
- gtk_toolbar_set_button_relief((GtkToolbar*)toolbar, (GtkReliefStyle)relief);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_tooltips_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_tooltips_new");
-#endif
-
- return (jint)gtk_tooltips_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_tooltips_set_tip
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1set_1tip
- (JNIEnv *env, jclass that, jint tooltips, jint widget, jbyteArray tip_text, jbyteArray tip_private)
-{
- jbyte *tip_text1 = NULL;
- jbyte *tip_private1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_tooltips_set_tip");
-#endif
-
- if (tip_text) {
- tip_text1 = (*env)->GetByteArrayElements(env, tip_text, NULL);
- }
- if (tip_private) {
- tip_private1 = (*env)->GetByteArrayElements(env, tip_private, NULL);
- }
- gtk_tooltips_set_tip((GtkTooltips*)tooltips, (GtkWidget*)widget, (gchar*)tip_text1, (gchar*)tip_private1);
- if (tip_text) {
- (*env)->ReleaseByteArrayElements(env, tip_text, tip_text1, 0);
- }
- if (tip_private) {
- (*env)->ReleaseByteArrayElements(env, tip_private, tip_private1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vbox_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vbox_1new
- (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vbox_new");
-#endif
-
- return (jint)gtk_vbox_new((gboolean)homogeneous, (gint)spacing);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vscale_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscale_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vscale_new");
-#endif
-
- return (jint)gtk_vscale_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vscrollbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscrollbar_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vscrollbar_new");
-#endif
-
- return (jint)gtk_vscrollbar_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vseparator_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vseparator_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vseparator_new");
-#endif
-
- return (jint)gtk_vseparator_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1destroy
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_destroy");
-#endif
-
- gtk_widget_destroy((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_show
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show");
-#endif
-
- gtk_widget_show((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_show_now
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1now
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show_now");
-#endif
-
- gtk_widget_show_now((GtkWidget*)widget);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1all
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show_all");
-#endif
-
- gtk_widget_show_all((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_hide
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1hide
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_hide");
-#endif
-
- gtk_widget_hide((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_realize
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1realize
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_realize");
-#endif
-
- gtk_widget_realize((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_queue_draw
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1queue_1draw
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_queue_draw");
-#endif
-
- gtk_widget_queue_draw((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_size_request
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1request
- (JNIEnv *env, jclass that, jint widget, jobject requisition)
-{
- DECL_GLOB(pGlob)
- GtkRequisition requisition_struct, *requisition1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_size_request");
-#endif
-
- if (requisition) {
- requisition1 = &requisition_struct;
- cacheGtkRequisitionFids(env, requisition, &PGLOB(GtkRequisitionFc));
- getGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
- }
- gtk_widget_size_request((GtkWidget*)widget, (GtkRequisition*)requisition1);
- if (requisition) {
- setGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_size_allocate
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1allocate
- (JNIEnv *env, jclass that, jint widget, jobject allocation)
-{
- DECL_GLOB(pGlob)
- GtkAllocation allocation_struct, *allocation1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_size_allocate");
-#endif
-
- if (allocation) {
- allocation1 = &allocation_struct;
- cacheGtkAllocationFids(env, allocation, &PGLOB(GtkAllocationFc));
- getGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
- }
- gtk_widget_size_allocate((GtkWidget*)widget, (GtkAllocation*)allocation1);
- if (allocation) {
- setGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_add_accelerator
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1accelerator
- (JNIEnv *env, jclass that, jint widget, jbyteArray accel_signal, jint accel_group, jint accel_key, jint accel_mods, jint accel_flags)
-{
- jbyte *accel_signal1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_add_accelerator");
-#endif
-
- if (accel_signal) {
- accel_signal1 = (*env)->GetByteArrayElements(env, accel_signal, NULL);
- }
- gtk_widget_add_accelerator((GtkWidget*)widget, (gchar*)accel_signal1, (GtkAccelGroup*)accel_group, accel_key, accel_mods, (GtkAccelFlags)accel_flags);
- if (accel_signal) {
- (*env)->ReleaseByteArrayElements(env, accel_signal, accel_signal1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_remove_accelerator
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1remove_1accelerator
- (JNIEnv *env, jclass that, jint widget, jint accel_group, jint accel_key, jint accel_mods)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_remove_accelerator");
-#endif
-
- gtk_widget_remove_accelerator((GtkWidget*)widget, (GtkAccelGroup*)accel_group, accel_key, accel_mods);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_event
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1event
- (JNIEnv *env, jclass that, jint widget, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_event");
-#endif
-
- return (jint)gtk_widget_event((GtkWidget*)widget, (GdkEvent*)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_reparent
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1reparent
- (JNIEnv *env, jclass that, jint widget, jint new_parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_reparent");
-#endif
-
- gtk_widget_reparent((GtkWidget*)widget, (GtkWidget*)new_parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_grab_focus
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1grab_1focus
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_grab_focus");
-#endif
-
- gtk_widget_grab_focus((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_state
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1state
- (JNIEnv *env, jclass that, jint widget, jint state)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_state");
-#endif
-
- gtk_widget_set_state((GtkWidget*)widget, (GtkStateType)state);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_sensitive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1sensitive
- (JNIEnv *env, jclass that, jint widget, jboolean sensitive)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_sensitive");
-#endif
-
- gtk_widget_set_sensitive((GtkWidget*)widget, (gboolean)sensitive);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_parent
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1parent
- (JNIEnv *env, jclass that, jint widget, jint parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_parent");
-#endif
-
- gtk_widget_set_parent((GtkWidget*)widget, (GtkWidget*)parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_uposition
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1uposition
- (JNIEnv *env, jclass that, jint widget, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_uposition");
-#endif
-
- gtk_widget_set_uposition((GtkWidget*)widget, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_usize
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1usize
- (JNIEnv *env, jclass that, jint widget, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_usize");
-#endif
-
- gtk_widget_set_usize((GtkWidget*)widget, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_add_events
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1events
- (JNIEnv *env, jclass that, jint widget, jint events)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_add_events");
-#endif
-
- gtk_widget_add_events((GtkWidget*)widget, (gint)events);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1style
- (JNIEnv *env, jclass that, jint widget, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_style");
-#endif
-
- gtk_widget_set_style((GtkWidget*)widget, (GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_ensure_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1ensure_1style
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_ensure_style");
-#endif
-
- gtk_widget_ensure_style((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_get_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1style
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_get_style");
-#endif
-
- return (jint)gtk_widget_get_style((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_get_default_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1default_1style
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_get_default_style");
-#endif
-
- return (jint)gtk_widget_get_default_style();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1new
- (JNIEnv *env, jclass that, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_new");
-#endif
-
- return (jint)gtk_window_new((GtkWindowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_set_title
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1title
- (JNIEnv *env, jclass that, jint window, jbyteArray title)
-{
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_title");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- gtk_window_set_title((GtkWindow*)window, (gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1transient_1for
- (JNIEnv *env, jclass that, jint window, jint parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_transient_for");
-#endif
- gtk_window_set_transient_for((GtkWindow*)window, (GtkWindow*)parent);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1modal
- (JNIEnv *env, jclass that, jint window, jboolean modal)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_modal");
-#endif
- gtk_window_set_modal((GtkWindow*)window, modal);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_set_policy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1policy
- (JNIEnv *env, jclass that, jint window, jint allow_shrink, jint allow_grow, jint auto_shrink)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_policy");
-#endif
-
- gtk_window_set_policy((GtkWindow*)window, (gint)allow_shrink, (gint)allow_grow, (gint)auto_shrink);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_add_accel_group
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1add_1accel_1group
- (JNIEnv *env, jclass that, jint window, jint accel_group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_add_accel_group");
-#endif
-
- gtk_window_add_accel_group((GtkWindow*)window, (GtkAccelGroup*)accel_group);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_get");
-#endif
-
- return (jint)gdk_event_get();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_get_graphics_expose
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get_1graphics_1expose
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_get_graphics_expose");
-#endif
-
- return (jint)gdk_event_get_graphics_expose((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1free
- (JNIEnv *env, jclass that, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_free");
-#endif
-
- gdk_event_free((GdkEvent*)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_time_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1time_1get
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_time_get");
-#endif
-
- return (jint)gdk_time_get();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_width");
-#endif
-
- return (jint)gdk_screen_width();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_height
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1height
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_height");
-#endif
-
- return (jint)gdk_screen_height();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_width_mm
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width_1mm
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_width_mm");
-#endif
-
- return (jint)gdk_screen_width_mm();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_flush
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1flush
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_flush");
-#endif
-
- gdk_flush();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_beep
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1beep
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_beep");
-#endif
-
- gdk_beep();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_visual_get_system
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1visual_1get_1system
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_visual_get_system");
-#endif
-
- return (jint)gdk_visual_get_system();
-}
-
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1pixtext
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text, jintArray spacing, jintArray pixmap, jintArray mask)
-{
- jint *text1 = NULL;
- jint *spacing1 = NULL;
- jint *pixmap1 = NULL;
- jint *mask1 = NULL;
- int rc;
-
- if (text) text1 = (*env)->GetIntArrayElements(env, text, NULL);
- if (spacing) spacing1 = (*env)->GetIntArrayElements(env, spacing, NULL);
- if (pixmap) pixmap1 = (*env)->GetIntArrayElements(env, pixmap, NULL);
- if (mask) mask1 = (*env)->GetIntArrayElements(env, mask, NULL);
- rc = gtk_clist_get_pixtext((GtkCList*)clist, row, column, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap1, (GdkBitmap**)mask1);
- if (text) (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- if (spacing) (*env)->ReleaseIntArrayElements(env, spacing, spacing1, 0);
- if (pixmap) (*env)->ReleaseIntArrayElements(env, pixmap, pixmap1, 0);
- if (mask) (*env)->ReleaseIntArrayElements(env, mask, mask1, 0);
-
- return (jint) rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_at_pointer
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1at_1pointer
- (JNIEnv *env, jclass that, jintArray win_x, jintArray win_y)
-{
- jint rc;
- jint *win_x1 = NULL;
- jint *win_y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_at_pointer");
-#endif
-
- if (win_x) {
- win_x1 = (*env)->GetIntArrayElements(env, win_x, NULL);
- }
- if (win_y) {
- win_y1 = (*env)->GetIntArrayElements(env, win_y, NULL);
- }
- rc = (jint)gdk_window_at_pointer((gint*)win_x1, (gint*)win_y1);
- if (win_x) {
- (*env)->ReleaseIntArrayElements(env, win_x, win_x1, 0);
- }
- if (win_y) {
- (*env)->ReleaseIntArrayElements(env, win_y, win_y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_clear_area
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_clear_area");
-#endif
-
- gdk_window_clear_area((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1resize
- (JNIEnv *env, jclass that, jint window, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_resize");
-#endif
-
- gdk_window_resize((GdkWindow*)window, (gint)width, (gint)height);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1move
- (JNIEnv *env, jclass that, jint window, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_move");
-#endif
-
- gdk_window_move((GdkWindow*)window, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_clear_area_e
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area_1e
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_clear_area_e");
-#endif
-
- gdk_window_clear_area_e((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_copy_area
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1copy_1area
- (JNIEnv *env, jclass that, jint window, jint gc, jint x, jint y, jint source_window, jint source_x, jint source_y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_copy_area");
-#endif
-
- gdk_window_copy_area((GdkWindow*)window, (GdkGC*)gc, (gint)x, (gint)y, (GdkWindow*)source_window, (gint)source_x, (gint)source_y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_raise
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1raise
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_raise");
-#endif
-
- gdk_window_raise((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_lower
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1lower
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_lower");
-#endif
-
- gdk_window_lower((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1user_1data
- (JNIEnv *env, jclass that, jint window, jint user_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_user_data");
-#endif
-
- gdk_window_set_user_data((GdkWindow*)window, (gpointer)user_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_cursor
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1cursor
- (JNIEnv *env, jclass that, jint window, jint cursor)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_cursor");
-#endif
-
- gdk_window_set_cursor((GdkWindow*)window, (GdkCursor*)cursor);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1user_1data
- (JNIEnv *env, jclass that, jint window, jintArray data)
-{
- jint *data1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_user_data");
-#endif
-
- if (data) {
- data1 = (*env)->GetIntArrayElements(env, data, NULL);
- }
- gdk_window_get_user_data((GdkWindow*)window, (gpointer*)data1);
- if (data) {
- (*env)->ReleaseIntArrayElements(env, data, data1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_geometry
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1geometry
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jintArray width, jintArray height, jintArray depth)
-{
- jint *x1 = NULL;
- jint *y1 = NULL;
- jint *width1 = NULL;
- jint *height1 = NULL;
- jint *depth1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_geometry");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- if (width) {
- width1 = (*env)->GetIntArrayElements(env, width, NULL);
- }
- if (height) {
- height1 = (*env)->GetIntArrayElements(env, height, NULL);
- }
- if (depth) {
- depth1 = (*env)->GetIntArrayElements(env, depth, NULL);
- }
- gdk_window_get_geometry((GdkWindow*)window, (gint*)x1, (gint*)y1, (gint*)width1, (gint*)height1, (gint*)depth1);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- if (width) {
- (*env)->ReleaseIntArrayElements(env, width, width1, 0);
- }
- if (height) {
- (*env)->ReleaseIntArrayElements(env, height, height1, 0);
- }
- if (depth) {
- (*env)->ReleaseIntArrayElements(env, depth, depth1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_origin
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
-{
- jint rc;
- jint *x1 = NULL;
- jint *y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_origin");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- rc = (jint)gdk_window_get_origin((GdkWindow*)window, (gint*)x1, (gint*)y1);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_pointer
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1pointer
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jint mask)
-{
- jint rc;
- jint *x1 = NULL;
- jint *y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_pointer");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- rc = (jint)gdk_window_get_pointer((GdkWindow*)window, (gint*)x1, (gint*)y1, (GdkModifierType*)mask);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_icon
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1icon
- (JNIEnv *env, jclass that, jint window, jint icon_window, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_icon");
-#endif
-
- gdk_window_set_icon((GdkWindow*)window, (GdkWindow*)icon_window, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_decorations
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1decorations
- (JNIEnv *env, jclass that, jint window, jint decorations)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_decorations");
-#endif
-
- gdk_window_set_decorations((GdkWindow*)window, (GdkWMDecoration)decorations);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1show
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_show");
-#endif
-
- gdk_window_show((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new
- (JNIEnv *env, jclass that, jint cursor_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_new");
-#endif
-
- return (jint)gdk_cursor_new((GdkCursorType)cursor_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_new_from_pixmap
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new_1from_1pixmap
- (JNIEnv *env, jclass that, jint source, jint mask, jobject fg, jobject bg, jint x, jint y)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkColor fg_struct, *fg1 = NULL;
- GdkColor bg_struct, *bg1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_new_from_pixmap");
-#endif
-
- if (fg) {
- fg1 = &fg_struct;
- cacheGdkColorFids(env, fg, &PGLOB(GdkColorFc));
- getGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
- }
- if (bg) {
- bg1 = &bg_struct;
- cacheGdkColorFids(env, bg, &PGLOB(GdkColorFc));
- getGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
- }
- rc = (jint)gdk_cursor_new_from_pixmap((GdkPixmap*)source, (GdkPixmap*)mask, (GdkColor*)fg1, (GdkColor*)bg1, (gint)x, (gint)y);
- if (fg) {
- setGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
- }
- if (bg) {
- setGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1destroy
- (JNIEnv *env, jclass that, jint cursor)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_destroy");
-#endif
-
- gdk_cursor_destroy((GdkCursor*)cursor);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1new
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_new");
-#endif
-
- return (jint)gdk_gc_new((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1unref
- (JNIEnv *env, jclass that, jint gc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_unref");
-#endif
-
- gdk_gc_unref((GdkGC*)gc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1destroy
- (JNIEnv *env, jclass that, jint gc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_destroy");
-#endif
-
- gdk_gc_destroy((GdkGC*)gc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_get_values
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1get_1values
- (JNIEnv *env, jclass that, jint gc, jobject values)
-{
- DECL_GLOB(pGlob)
- GdkGCValues values_struct, *values1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_get_values");
-#endif
-
- if (values) {
- values1 = &values_struct;
- cacheGdkGCValuesFids(env, values, &PGLOB(GdkGCValuesFc));
- getGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
- }
- gdk_gc_get_values((GdkGC*)gc, (GdkGCValues*)values1);
- if (values) {
- setGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_foreground
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1foreground
- (JNIEnv *env, jclass that, jint gc, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_foreground");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_gc_set_foreground((GdkGC*)gc, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_background
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1background
- (JNIEnv *env, jclass that, jint gc, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_background");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_gc_set_background((GdkGC*)gc, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_font
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1font
- (JNIEnv *env, jclass that, jint gc, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_font");
-#endif
-
- gdk_gc_set_font((GdkGC*)gc, (GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_function
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1function
- (JNIEnv *env, jclass that, jint gc, jint function)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_function");
-#endif
-
- gdk_gc_set_function((GdkGC*)gc, (GdkFunction)function);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_fill
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1fill
- (JNIEnv *env, jclass that, jint gc, jint fill)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_fill");
-#endif
-
- gdk_gc_set_fill((GdkGC*)gc, (GdkFill)fill);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_stipple
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1stipple
- (JNIEnv *env, jclass that, jint gc, jint stipple)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_stipple");
-#endif
-
- gdk_gc_set_stipple((GdkGC*)gc, (GdkPixmap*)stipple);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_mask
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1mask
- (JNIEnv *env, jclass that, jint gc, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_mask");
-#endif
-
- gdk_gc_set_clip_mask((GdkGC*)gc, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_rectangle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1rectangle
- (JNIEnv *env, jclass that, jint gc, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- GdkRectangle rectangle_struct, *rectangle1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_rectangle");
-#endif
-
- if (rectangle) {
- rectangle1 = &rectangle_struct;
- cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
- gdk_gc_set_clip_rectangle((GdkGC*)gc, (GdkRectangle*)rectangle1);
- if (rectangle) {
- setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_region
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1region
- (JNIEnv *env, jclass that, jint gc, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_region");
-#endif
-
- gdk_gc_set_clip_region((GdkGC*)gc, (GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_subwindow
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1subwindow
- (JNIEnv *env, jclass that, jint gc, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_subwindow");
-#endif
-
- gdk_gc_set_subwindow((GdkGC*)gc, (GdkSubwindowMode)mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_exposures
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1exposures
- (JNIEnv *env, jclass that, jint gc, jboolean exposures)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_exposures");
-#endif
-
- gdk_gc_set_exposures((GdkGC*)gc, (gboolean)exposures);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_line_attributes
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1line_1attributes
- (JNIEnv *env, jclass that, jint gc, jint line_width, jint line_style, jint cap_style, jint join_style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_line_attributes");
-#endif
-
- gdk_gc_set_line_attributes((GdkGC*)gc, (gint)line_width, (GdkLineStyle)line_style, (GdkCapStyle)cap_style, (GdkJoinStyle)join_style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_dashes
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1dashes
- (JNIEnv *env, jclass that, jint gc, jint dash_offset, jbyteArray dash_list, jint n)
-{
- jbyte *dash_list1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_dashes");
-#endif
-
- if (dash_list) {
- dash_list1 = (*env)->GetByteArrayElements(env, dash_list, NULL);
- }
- gdk_gc_set_dashes((GdkGC*)gc, (gint)dash_offset, (gint8*)dash_list1, (gint)n);
- if (dash_list) {
- (*env)->ReleaseByteArrayElements(env, dash_list, dash_list1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_pixmap_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1new
- (JNIEnv *env, jclass that, jint window, jint width, jint height, jint depth)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_pixmap_new");
-#endif
-
- return (jint)gdk_pixmap_new((GdkWindow*)window, (gint)width, (gint)height, (gint)depth);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_bitmap_create_from_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1create_1from_1data
- (JNIEnv *env, jclass that, jint window, jbyteArray data, jint width, jint height)
-{
- jint rc;
- jbyte *data1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_bitmap_create_from_data");
-#endif
-
- if (data) {
- data1 = (*env)->GetByteArrayElements(env, data, NULL);
- }
- rc = (jint)gdk_bitmap_create_from_data((GdkWindow*)window, (gchar*)data1, (gint)width, (gint)height);
- if (data) {
- (*env)->ReleaseByteArrayElements(env, data, data1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_pixmap_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1unref
- (JNIEnv *env, jclass that, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_pixmap_unref");
-#endif
-
- gdk_pixmap_unref((GdkPixmap*)pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_bitmap_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1unref
- (JNIEnv *env, jclass that, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_bitmap_unref");
-#endif
-
- gdk_bitmap_unref((GdkBitmap*)pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_image_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_image_get");
-#endif
-
- return (jint)gdk_image_get((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_image_get_pixel
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get_1pixel
- (JNIEnv *env, jclass that, jint image, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_image_get_pixel");
-#endif
-
- return (jint)gdk_image_get_pixel((GdkImage*)image, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_colormap_get_system
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colormap_1get_1system
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_colormap_get_system");
-#endif
-
- return (jint)gdk_colormap_get_system();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1free
- (JNIEnv *env, jclass that, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_free");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_color_free((GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_colors_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colors_1free
- (JNIEnv *env, jclass that, jint colormap, jintArray pixels, jint npixels, jint planes)
-{
- jint *pixels1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_colors_free");
-#endif
-
- if (pixels) {
- pixels1 = (*env)->GetIntArrayElements(env, pixels, NULL);
- }
- gdk_colors_free((GdkColormap*)colormap, (gulong*)pixels1, (gint)npixels, (gulong)planes);
- if (pixels) {
- (*env)->ReleaseIntArrayElements(env, pixels, pixels1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_white
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1white
- (JNIEnv *env, jclass that, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- jboolean rc;
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_white");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- rc = (jboolean)gdk_color_white((GdkColormap*)colormap, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_alloc
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1alloc
- (JNIEnv *env, jclass that, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- jboolean rc;
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_alloc");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- rc = (jboolean)gdk_color_alloc((GdkColormap*)colormap, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_load
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1load
- (JNIEnv *env, jclass that, jbyteArray font_name)
-{
- jint rc;
- jbyte *font_name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_load");
-#endif
-
- if (font_name) {
- font_name1 = (*env)->GetByteArrayElements(env, font_name, NULL);
- }
- rc = (jint)gdk_font_load((gchar*)font_name1);
- if (font_name) {
- (*env)->ReleaseByteArrayElements(env, font_name, font_name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_ref
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1ref
- (JNIEnv *env, jclass that, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_ref");
-#endif
-
- return (jint)gdk_font_ref((GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1unref
- (JNIEnv *env, jclass that, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_unref");
-#endif
-
- gdk_font_unref((GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_equal
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1equal
- (JNIEnv *env, jclass that, jint fonta, jint fontb)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_equal");
-#endif
-
- return (jboolean)gdk_font_equal((GdkFont*)fonta, (GdkFont*)fontb);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1width
- (JNIEnv *env, jclass that, jint font, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_width");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gdk_string_width((GdkFont*)font, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_char_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1char_1width
- (JNIEnv *env, jclass that, jint font, jbyte character)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_char_width");
-#endif
-
- return (jint)gdk_char_width((GdkFont*)font, (gchar)character);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_height
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1height
- (JNIEnv *env, jclass that, jint font, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_height");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gdk_string_height((GdkFont*)font, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_extents
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1extents
- (JNIEnv *env, jclass that, jint font, jbyteArray string, jintArray lbearing, jintArray rbearing, jintArray width, jintArray ascent, jintArray descent)
-{
- jbyte *string1 = NULL;
- jint *lbearing1 = NULL;
- jint *rbearing1 = NULL;
- jint *width1 = NULL;
- jint *ascent1 = NULL;
- jint *descent1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_extents");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- if (lbearing) {
- lbearing1 = (*env)->GetIntArrayElements(env, lbearing, NULL);
- }
- if (rbearing) {
- rbearing1 = (*env)->GetIntArrayElements(env, rbearing, NULL);
- }
- if (width) {
- width1 = (*env)->GetIntArrayElements(env, width, NULL);
- }
- if (ascent) {
- ascent1 = (*env)->GetIntArrayElements(env, ascent, NULL);
- }
- if (descent) {
- descent1 = (*env)->GetIntArrayElements(env, descent, NULL);
- }
- gdk_string_extents((GdkFont*)font, (gchar*)string1, (gint*)lbearing1, (gint*)rbearing1, (gint*)width1, (gint*)ascent1, (gint*)descent1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- if (lbearing) {
- (*env)->ReleaseIntArrayElements(env, lbearing, lbearing1, 0);
- }
- if (rbearing) {
- (*env)->ReleaseIntArrayElements(env, rbearing, rbearing1, 0);
- }
- if (width) {
- (*env)->ReleaseIntArrayElements(env, width, width1, 0);
- }
- if (ascent) {
- (*env)->ReleaseIntArrayElements(env, ascent, ascent1, 0);
- }
- if (descent) {
- (*env)->ReleaseIntArrayElements(env, descent, descent1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_line
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1line
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_line");
-#endif
-
- gdk_draw_line((GdkDrawable*)drawable, (GdkGC*)gc, (gint)x1, (gint)y1, (gint)x2, (gint)y2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_rectangle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1rectangle
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_rectangle");
-#endif
-
- gdk_draw_rectangle((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_arc
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1arc
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height, jint angle1, jint angle2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_arc");
-#endif
-
- gdk_draw_arc((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height, (gint)angle1, (gint)angle2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_polygon
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1polygon
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jshortArray points, jint npoints)
-{
- jshort *points1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_polygon");
-#endif
-
- if (points) {
- points1 = (*env)->GetShortArrayElements(env, points, NULL);
- }
- gdk_draw_polygon((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (GdkPoint*)points1, (gint)npoints);
- if (points) {
- (*env)->ReleaseShortArrayElements(env, points, points1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_string
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1string
- (JNIEnv *env, jclass that, jint drawable, jint font, jint gc, jint x, jint y, jbyteArray string)
-{
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_string");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- gdk_draw_string((GdkDrawable*)drawable, (GdkFont*)font, (GdkGC*)gc, (gint)x, (gint)y, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_pixmap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1pixmap
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint src, jint xsrc, jint ysrc, jint xdest, jint ydest, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_pixmap");
-#endif
-
- gdk_draw_pixmap((GdkDrawable*)drawable, (GdkGC*)gc, (GdkDrawable*)src, (gint)xsrc, (gint)ysrc, (gint)xdest, (gint)ydest, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_lines
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1lines
- (JNIEnv *env, jclass that, jint drawable, jint gc, jshortArray points, jint npoints)
-{
- jshort *points1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_lines");
-#endif
-
- if (points) {
- points1 = (*env)->GetShortArrayElements(env, points, NULL);
- }
- gdk_draw_lines((GdkDrawable*)drawable, (GdkGC*)gc, (GdkPoint*)points1, (gint)npoints);
- if (points) {
- (*env)->ReleaseShortArrayElements(env, points, points1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_atom_intern
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1atom_1intern
- (JNIEnv *env, jclass that, jbyteArray atom_name, jint only_if_exists)
-{
- jint rc;
- jbyte *atom_name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_atom_intern");
-#endif
-
- if (atom_name) {
- atom_name1 = (*env)->GetByteArrayElements(env, atom_name, NULL);
- }
- rc = (jint)gdk_atom_intern((gchar*)atom_name1, (gint)only_if_exists);
- if (atom_name) {
- (*env)->ReleaseByteArrayElements(env, atom_name, atom_name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_new");
-#endif
-
- return (jint)gdk_region_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1destroy
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_destroy");
-#endif
-
- gdk_region_destroy((GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_get_clipbox
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1get_1clipbox
- (JNIEnv *env, jclass that, jint region, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- GdkRectangle rectangle_struct, *rectangle1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_get_clipbox");
-#endif
-
- if (rectangle) {
- rectangle1 = &rectangle_struct;
- cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
- gdk_region_get_clipbox((GdkRegion*)region, (GdkRectangle*)rectangle1);
- if (rectangle) {
- setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_empty
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1empty
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_empty");
-#endif
-
- return (jboolean)gdk_region_empty((GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_equal
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1equal
- (JNIEnv *env, jclass that, jint region1, jint region2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_equal");
-#endif
-
- return (jboolean)gdk_region_equal((GdkRegion*)region1, (GdkRegion*)region2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_point_in
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1point_1in
- (JNIEnv *env, jclass that, jint region, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_point_in");
-#endif
-
- return (jboolean)gdk_region_point_in((GdkRegion*)region, (int)x, (int)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_rect_in
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1rect_1in
- (JNIEnv *env, jclass that, jint region, jobject rect)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkRectangle rect_struct, *rect1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_rect_in");
-#endif
-
- if (rect) {
- rect1 = &rect_struct;
- cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- rc = (jint)gdk_region_rect_in((GdkRegion*)region, (GdkRectangle*)rect1);
- if (rect) {
- setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_union_with_rect
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1union_1with_1rect
- (JNIEnv *env, jclass that, jint region, jobject rect)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkRectangle rect_struct, *rect1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_union_with_rect");
-#endif
-
- if (rect) {
- rect1 = &rect_struct;
- cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- rc = (jint)gdk_region_union_with_rect((GdkRegion*)region, (GdkRectangle*)rect1);
- if (rect) {
- setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_regions_union
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1union
- (JNIEnv *env, jclass that, jint source1, jint source2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_regions_union");
-#endif
-
- return (jint)gdk_regions_union((GdkRegion*)source1, (GdkRegion*)source2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_regions_subtract
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1subtract
- (JNIEnv *env, jclass that, jint source1, jint source2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_regions_subtract");
-#endif
-
- return (jint)gdk_regions_subtract((GdkRegion*)source1, (GdkRegion*)source2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1free
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_free");
-#endif
-
- g_list_free((GList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_append
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1append
- (JNIEnv *env, jclass that, jint list, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_append");
-#endif
-
- return (jint)g_list_append((GList*)list, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_nth");
-#endif
-
- return (jint)g_list_nth((GList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1length
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_length");
-#endif
-
- return (jint)g_list_length((GList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_nth_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth_1data
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_nth_data");
-#endif
-
- return (jint)g_list_nth_data((GList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_nth");
-#endif
-
- return (jint)g_slist_nth((GSList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1length
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_length");
-#endif
-
- return (jint)g_slist_length((GSList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_nth_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth_1data
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_nth_data");
-#endif
-
- return (jint)g_slist_nth_data((GSList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_malloc
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1malloc
- (JNIEnv *env, jclass that, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_malloc");
-#endif
-
- return (jint)g_malloc((gulong)size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1free
- (JNIEnv *env, jclass that, jint mem)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_free");
-#endif
-
- g_free((gpointer)mem);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_strdup
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1strdup
- (JNIEnv *env, jclass that, jbyteArray str)
-{
- jint rc;
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_strdup");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- rc = (jint)g_strdup((gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_get_home_dir
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1get_1home_1dir
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_get_home_dir");
-#endif
-
- return (jint)g_get_home_dir();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1new
- (JNIEnv *env, jclass that, jint columns)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_new");
-#endif
-
- return (jint)gtk_clist_new((gint)columns);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_shadow_type
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1shadow_1type
- (JNIEnv *env, jclass that, jint clist, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_shadow_type");
-#endif
-
- gtk_clist_set_shadow_type((GtkCList*)clist, (GtkShadowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_selection_mode
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1selection_1mode
- (JNIEnv *env, jclass that, jint clist, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_selection_mode");
-#endif
-
- gtk_clist_set_selection_mode((GtkCList*)clist, (GtkSelectionMode)mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_freeze
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1freeze
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_freeze");
-#endif
-
- gtk_clist_freeze((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_thaw
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1thaw
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_thaw");
-#endif
-
- gtk_clist_thaw((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_show
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1show
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_show");
-#endif
-
- gtk_clist_column_titles_show((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_hide
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1hide
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_hide");
-#endif
-
- gtk_clist_column_titles_hide((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_title_passive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1title_1passive
- (JNIEnv *env, jclass that, jint clist, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_title_passive");
-#endif
-
- gtk_clist_column_title_passive((GtkCList*)clist, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_passive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1passive
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_passive");
-#endif
-
- gtk_clist_column_titles_passive((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_title
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1title
- (JNIEnv *env, jclass that, jint clist, jint column, jbyteArray title)
-{
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_title");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- gtk_clist_set_column_title((GtkCList*)clist, (gint)column, (gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_justification
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1justification
- (JNIEnv *env, jclass that, jint clist, jint column, jint justification)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_justification");
-#endif
-
- gtk_clist_set_column_justification((GtkCList*)clist, (gint)column, (GtkJustification)justification);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_visibility
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1visibility
- (JNIEnv *env, jclass that, jint clist, jint column, jboolean visible)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_visibility");
-#endif
-
- gtk_clist_set_column_visibility((GtkCList*)clist, (gint)column, (gboolean)visible);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_resizeable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1resizeable
- (JNIEnv *env, jclass that, jint clist, jint column, jboolean resizeable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_resizeable");
-#endif
-
- gtk_clist_set_column_resizeable((GtkCList*)clist, (gint)column, (gboolean)resizeable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_width
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1width
- (JNIEnv *env, jclass that, jint clist, jint column, jint width)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_width");
-#endif
-
- gtk_clist_set_column_width((GtkCList*)clist, (gint)column, (gint)width);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_moveto
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1moveto
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jfloat row_align, jfloat col_align)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_moveto");
-#endif
-
- gtk_clist_moveto((GtkCList*)clist, (gint)row, (gint)column, row_align, col_align);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1text
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_clist_set_text((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_get_text
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1text
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_get_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_get_text((GtkCList*)clist, (gint)row, (gint)column, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_pixmap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixmap
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_pixmap");
-#endif
-
- gtk_clist_set_pixmap((GtkCList*)clist, (gint)row, (gint)column, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_pixtext
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixtext
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text, jbyte spacing, jint pixmap, jint mask)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_pixtext");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_clist_set_pixtext((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_append
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1append
- (JNIEnv *env, jclass that, jint clist, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_append");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_append((GtkCList*)clist, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_insert
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1insert
- (JNIEnv *env, jclass that, jint clist, jint row, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_insert");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_insert((GtkCList*)clist, (gint)row, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1remove
- (JNIEnv *env, jclass that, jint clist, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_remove");
-#endif
-
- gtk_clist_remove((GtkCList*)clist, (gint)row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_select_row
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1row
- (JNIEnv *env, jclass that, jint clist, jint row, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_select_row");
-#endif
-
- gtk_clist_select_row((GtkCList*)clist, (gint)row, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_unselect_row
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1row
- (JNIEnv *env, jclass that, jint clist, jint row, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_unselect_row");
-#endif
-
- gtk_clist_unselect_row((GtkCList*)clist, (gint)row, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_clear
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1clear
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_clear");
-#endif
-
- gtk_clist_clear((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_get_selection_info
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1selection_1info
- (JNIEnv *env, jclass that, jint clist, jint x, jint y, jintArray row, jintArray column)
-{
- jint rc;
- jint *row1 = NULL;
- jint *column1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_get_selection_info");
-#endif
-
- if (row) {
- row1 = (*env)->GetIntArrayElements(env, row, NULL);
- }
- if (column) {
- column1 = (*env)->GetIntArrayElements(env, column, NULL);
- }
- rc = (jint)gtk_clist_get_selection_info((GtkCList*)clist, (gint)x, (gint)y, (gint*)row1, (gint*)column1);
- if (row) {
- (*env)->ReleaseIntArrayElements(env, row, row1, 0);
- }
- if (column) {
- (*env)->ReleaseIntArrayElements(env, column, column1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_select_all
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1all
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_select_all");
-#endif
-
- gtk_clist_select_all((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_unselect_all
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1all
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_unselect_all");
-#endif
-
- gtk_clist_unselect_all((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkColor src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkColorFids(env, src, &PGLOB(GdkColorFc));
- getGdkColorFields(env, src, src1, &PGLOB(GdkColorFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkColor dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkColorFids(env, dest, &PGLOB(GdkColorFc));
- setGdkColorFields(env, dest, dest1, &PGLOB(GdkColorFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkDialogFids(env, dest, &PGLOB(GtkDialogFc));
- setGtkDialogFields(env, dest, dest1, &PGLOB(GtkDialogFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyleClass_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyleClass dest_struct, *dest1 = NULL;
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkStyleClassFids(env, dest, &PGLOB(GtkStyleClassFc));
- setGtkStyleClassFields(env, dest, dest1, &PGLOB(GtkStyleClassFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventKeyFids(env, src, &PGLOB(GdkEventKeyFc));
- getGdkEventKeyFields(env, src, src1, &PGLOB(GdkEventKeyFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventKeyFids(env, dest, &PGLOB(GdkEventKeyFc));
- setGdkEventKeyFields(env, dest, dest1, &PGLOB(GdkEventKeyFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventButtonFids(env, src, &PGLOB(GdkEventButtonFc));
- getGdkEventButtonFields(env, src, src1, &PGLOB(GdkEventButtonFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventButtonFids(env, dest, &PGLOB(GdkEventButtonFc));
- setGdkEventButtonFields(env, dest, dest1, &PGLOB(GdkEventButtonFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventMotionFids(env, src, &PGLOB(GdkEventMotionFc));
- getGdkEventMotionFields(env, src, src1, &PGLOB(GdkEventMotionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventMotionFids(env, dest, &PGLOB(GdkEventMotionFc));
- setGdkEventMotionFields(env, dest, dest1, &PGLOB(GdkEventMotionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventExposeFids(env, src, &PGLOB(GdkEventExposeFc));
- getGdkEventExposeFields(env, src, src1, &PGLOB(GdkEventExposeFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventExposeFids(env, dest, &PGLOB(GdkEventExposeFc));
- setGdkEventExposeFields(env, dest, dest1, &PGLOB(GdkEventExposeFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkFont src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkFontFids(env, src, &PGLOB(GdkFontFc));
- getGdkFontFields(env, src, src1, &PGLOB(GdkFontFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkFont dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkFontFids(env, dest, &PGLOB(GdkFontFc));
- setGdkFontFields(env, dest, dest1, &PGLOB(GdkFontFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkGCValues src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkGCValuesFids(env, src, &PGLOB(GdkGCValuesFc));
- getGdkGCValuesFields(env, src, src1, &PGLOB(GdkGCValuesFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkGCValues dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkGCValuesFids(env, dest, &PGLOB(GdkGCValuesFc));
- setGdkGCValuesFields(env, dest, dest1, &PGLOB(GdkGCValuesFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkImage src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkImageFids(env, src, &PGLOB(GdkImageFc));
- getGdkImageFields(env, src, src1, &PGLOB(GdkImageFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkImage dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkImageFids(env, dest, &PGLOB(GdkImageFc));
- setGdkImageFields(env, dest, dest1, &PGLOB(GdkImageFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkPoint src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkPointFids(env, src, &PGLOB(GdkPointFc));
- getGdkPointFields(env, src, src1, &PGLOB(GdkPointFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkPoint dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkPointFids(env, dest, &PGLOB(GdkPointFc));
- setGdkPointFields(env, dest, dest1, &PGLOB(GdkPointFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkRectangle src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkRectangleFids(env, src, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, src, src1, &PGLOB(GdkRectangleFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkRectangle dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkRectangleFids(env, dest, &PGLOB(GdkRectangleFc));
- setGdkRectangleFields(env, dest, dest1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkVisual src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkVisualFids(env, src, &PGLOB(GdkVisualFc));
- getGdkVisualFields(env, src, src1, &PGLOB(GdkVisualFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkVisual dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkVisualFids(env, dest, &PGLOB(GdkVisualFc));
- setGdkVisualFields(env, dest, dest1, &PGLOB(GdkVisualFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAllocation src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkAllocationFids(env, src, &PGLOB(GtkAllocationFc));
- getGtkAllocationFields(env, src, src1, &PGLOB(GtkAllocationFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAllocation dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkAllocationFids(env, dest, &PGLOB(GtkAllocationFc));
- setGtkAllocationFields(env, dest, dest1, &PGLOB(GtkAllocationFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkArg src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkArgFids(env, src, &PGLOB(GtkArgFc));
- getGtkArgFields(env, src, src1, &PGLOB(GtkArgFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkArg dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkArgFids(env, dest, &PGLOB(GtkArgFc));
- setGtkArgFields(env, dest, dest1, &PGLOB(GtkArgFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBin src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkBinFids(env, src, &PGLOB(GtkBinFc));
- getGtkBinFields(env, src, src1, &PGLOB(GtkBinFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBin dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkBinFids(env, dest, &PGLOB(GtkBinFc));
- setGtkBinFields(env, dest, dest1, &PGLOB(GtkBinFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCList src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListFids(env, src, &PGLOB(GtkCListFc));
- getGtkCListFields(env, src, src1, &PGLOB(GtkCListFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCList dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListFids(env, dest, &PGLOB(GtkCListFc));
- setGtkCListFields(env, dest, dest1, &PGLOB(GtkCListFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenu src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkMenuFids(env, src, &PGLOB(GtkMenuFc));
- getGtkMenuFields(env, src, src1, &PGLOB(GtkMenuFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenu dest_struct={0}, *dest1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkMenuFids(env, dest, &PGLOB(GtkMenuFc));
- setGtkMenuFields(env, dest, dest1, &PGLOB(GtkMenuFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTree src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCTreeFids(env, src, &PGLOB(GtkCTreeFc));
- getGtkCTreeFields(env, src, src1, &PGLOB(GtkCTreeFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTree dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCTreeFids(env, dest, &PGLOB(GtkCTreeFc));
- setGtkCTreeFields(env, dest, dest1, &PGLOB(GtkCTreeFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkColorSelectionDialog src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkColorSelectionDialogFids(env, src, &PGLOB(GtkColorSelectionDialogFc));
- getGtkColorSelectionDialogFields(env, src, src1, &PGLOB(GtkColorSelectionDialogFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkColorSelectionDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkColorSelectionDialogFids(env, dest, &PGLOB(GtkColorSelectionDialogFc));
- setGtkColorSelectionDialogFields(env, dest, dest1, &PGLOB(GtkColorSelectionDialogFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCombo src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkComboFids(env, src, &PGLOB(GtkComboFc));
- getGtkComboFields(env, src, src1, &PGLOB(GtkComboFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCombo dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkComboFids(env, dest, &PGLOB(GtkComboFc));
- setGtkComboFields(env, dest, dest1, &PGLOB(GtkComboFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkContainer src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkContainerFids(env, src, &PGLOB(GtkContainerFc));
- getGtkContainerFields(env, src, src1, &PGLOB(GtkContainerFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkContainer dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkContainerFids(env, dest, &PGLOB(GtkContainerFc));
- setGtkContainerFields(env, dest, dest1, &PGLOB(GtkContainerFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkData src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkDataFids(env, src, &PGLOB(GtkDataFc));
- getGtkDataFields(env, src, src1, &PGLOB(GtkDataFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkData dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkDataFids(env, dest, &PGLOB(GtkDataFc));
- setGtkDataFields(env, dest, dest1, &PGLOB(GtkDataFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkEditable src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkEditableFids(env, src, &PGLOB(GtkEditableFc));
- getGtkEditableFields(env, src, src1, &PGLOB(GtkEditableFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkEditable dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkEditableFids(env, dest, &PGLOB(GtkEditableFc));
- setGtkEditableFields(env, dest, dest1, &PGLOB(GtkEditableFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkText src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkTextFids(env, src, &PGLOB(GtkTextFc));
- getGtkTextFields(env, src, src1, &PGLOB(GtkTextFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkText dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkTextFids(env, dest, &PGLOB(GtkTextFc));
- setGtkTextFields(env, dest, dest1, &PGLOB(GtkTextFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_inquiry
- * Signature:
- * Not implemented yet;
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_text_inquiry__Lorg_eclipse_swt_internal_gtk_GtkText_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFileSelection src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFileSelectionFids(env, src, &PGLOB(GtkFileSelectionFc));
- getGtkFileSelectionFields(env, src, src1, &PGLOB(GtkFileSelectionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFileSelection dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFileSelectionFids(env, dest, &PGLOB(GtkFileSelectionFc));
- setGtkFileSelectionFields(env, dest, dest1, &PGLOB(GtkFileSelectionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFontSelectionDialog src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFontSelectionDialogFids(env, src, &PGLOB(GtkFontSelectionDialogFc));
- getGtkFontSelectionDialogFields(env, src, src1, &PGLOB(GtkFontSelectionDialogFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFontSelectionDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFontSelectionDialogFids(env, dest, &PGLOB(GtkFontSelectionDialogFc));
- setGtkFontSelectionDialogFields(env, dest, dest1, &PGLOB(GtkFontSelectionDialogFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkObject src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkObjectFids(env, src, &PGLOB(GtkObjectFc));
- getGtkObjectFields(env, src, src1, &PGLOB(GtkObjectFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkObject dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkObjectFids(env, dest, &PGLOB(GtkObjectFc));
- setGtkObjectFields(env, dest, dest1, &PGLOB(GtkObjectFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgress src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkProgressFids(env, src, &PGLOB(GtkProgressFc));
- getGtkProgressFields(env, src, src1, &PGLOB(GtkProgressFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgress dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkProgressFids(env, dest, &PGLOB(GtkProgressFc));
- setGtkProgressFields(env, dest, dest1, &PGLOB(GtkProgressFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgressBar src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkProgressBarFids(env, src, &PGLOB(GtkProgressBarFc));
- getGtkProgressBarFields(env, src, src1, &PGLOB(GtkProgressBarFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgressBar dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkProgressBarFids(env, dest, &PGLOB(GtkProgressBarFc));
- setGtkProgressBarFields(env, dest, dest1, &PGLOB(GtkProgressBarFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkRequisition src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkRequisitionFids(env, src, &PGLOB(GtkRequisitionFc));
- getGtkRequisitionFields(env, src, src1, &PGLOB(GtkRequisitionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkRequisition dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkRequisitionFids(env, dest, &PGLOB(GtkRequisitionFc));
- setGtkRequisitionFields(env, dest, dest1, &PGLOB(GtkRequisitionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyle src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkStyleFids(env, src, &PGLOB(GtkStyleFc));
- getGtkStyleFields(env, src, src1, &PGLOB(GtkStyleFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyle dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkStyleFids(env, dest, &PGLOB(GtkStyleFc));
- setGtkStyleFields(env, dest, dest1, &PGLOB(GtkStyleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWidget src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkWidgetFids(env, src, &PGLOB(GtkWidgetFc));
- getGtkWidgetFields(env, src, src1, &PGLOB(GtkWidgetFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWidget dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkWidgetFids(env, dest, &PGLOB(GtkWidgetFc));
- setGtkWidgetFields(env, dest, dest1, &PGLOB(GtkWidgetFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFrame src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFrameFids(env, src, &PGLOB(GtkFrameFc));
- getGtkFrameFields(env, src, src1, &PGLOB(GtkFrameFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFrame dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFrameFids(env, dest, &PGLOB(GtkFrameFc));
- setGtkFrameFields(env, dest, dest1, &PGLOB(GtkFrameFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWindow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkWindowFids(env, src, &PGLOB(GtkWindowFc));
- getGtkWindowFields(env, src, src1, &PGLOB(GtkWindowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWindow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkWindowFids(env, dest, &PGLOB(GtkWindowFc));
- setGtkWindowFields(env, dest, dest1, &PGLOB(GtkWindowFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCheckMenuItem src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCheckMenuItemFids(env, src, &PGLOB(GtkCheckMenuItemFc));
- getGtkCheckMenuItemFields(env, src, src1, &PGLOB(GtkCheckMenuItemFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCheckMenuItem dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCheckMenuItemFids(env, dest, &PGLOB(GtkCheckMenuItemFc));
- setGtkCheckMenuItemFields(env, dest, dest1, &PGLOB(GtkCheckMenuItemFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAdjustment src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkAdjustmentFids(env, src, &PGLOB(GtkAdjustmentFc));
- getGtkAdjustmentFields(env, src, src1, &PGLOB(GtkAdjustmentFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAdjustment dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkAdjustmentFids(env, dest, &PGLOB(GtkAdjustmentFc));
- setGtkAdjustmentFields(env, dest, dest1, &PGLOB(GtkAdjustmentFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBox src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkBoxFids(env, src, &PGLOB(GtkBoxFc));
- getGtkBoxFields(env, src, src1, &PGLOB(GtkBoxFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBox dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkBoxFids(env, dest, &PGLOB(GtkBoxFc));
- setGtkBoxFields(env, dest, dest1, &PGLOB(GtkBoxFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkHBox src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkHBoxFids(env, src, &PGLOB(GtkHBoxFc));
- getGtkHBoxFields(env, src, src1, &PGLOB(GtkHBoxFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkHBox dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkHBoxFids(env, dest, &PGLOB(GtkHBoxFc));
- setGtkHBoxFields(env, dest, dest1, &PGLOB(GtkHBoxFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenuItem src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkMenuItemFids(env, src, &PGLOB(GtkMenuItemFc));
- getGtkMenuItemFields(env, src, src1, &PGLOB(GtkMenuItemFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenuItem dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkMenuItemFids(env, dest, &PGLOB(GtkMenuItemFc));
- setGtkMenuItemFields(env, dest, dest1, &PGLOB(GtkMenuItemFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListRow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListRowFids(env, src, &PGLOB(GtkCListRowFc));
- getGtkCListRowFields(env, src, src1, &PGLOB(GtkCListRowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListRow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListRowFids(env, dest, &PGLOB(GtkCListRowFc));
- setGtkCListRowFields(env, dest, dest1, &PGLOB(GtkCListRowFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListColumn src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListColumnFids(env, src, &PGLOB(GtkCListColumnFc));
- getGtkCListColumnFields(env, src, src1, &PGLOB(GtkCListColumnFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListColumn dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListColumnFids(env, dest, &PGLOB(GtkCListColumnFc));
- setGtkCListColumnFields(env, dest, dest1, &PGLOB(GtkCListColumnFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTreeRow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCTreeRowFids(env, src, &PGLOB(GtkCTreeRowFc));
- getGtkCTreeRowFields(env, src, src1, &PGLOB(GtkCTreeRowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTreeRow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCTreeRowFids(env, dest, &PGLOB(GtkCTreeRowFc));
- setGtkCTreeRowFields(env, dest, dest1, &PGLOB(GtkCTreeRowFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3BI
- (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
-{
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3BI\n");
-#endif
-
- if (src) {
- src1 = (*env)->GetByteArrayElements(env, src, NULL);
- memmove((void*)dest, (void*)src1, count);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3II
- (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
-{
- jint *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3II\n");
-#endif
-
- if (src) {
- src1 = (*env)->GetIntArrayElements(env, src, NULL);
- memmove((void*)dest, (void*)src1, count);
- (*env)->ReleaseIntArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3III
- (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
-{
- jint *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__III\n");
-#endif
-
- if (dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3BII
- (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
-{
- jbyte *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BII\n");
-#endif
-
- if (dest) {
- dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src, count);
- (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3I_3BI
- (JNIEnv *env, jclass that, jintArray dest, jbyteArray src, jint count)
-{
- jint *dest1;
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3I_3BI\n");
-#endif
-
- if (src && dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- src1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src1, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_strlen
- (JNIEnv *env, jclass that, jint string)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "strlen\n");
-#endif
-
- return (jint)strlen((char*)string);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: XListFonts
- * Signature: ([BI[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_XListFonts
- (JNIEnv *env, jclass that, jbyteArray pattern, jint maxnames, jintArray actual_count_return)
-{
- jbyte *pattern1 = NULL;
- jint *actual_count_return1=NULL;
- jint rc;
-
- if (pattern)
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- if (actual_count_return)
- actual_count_return1 = (*env)->GetIntArrayElements(env, actual_count_return, NULL);
-
- rc = (jint) XListFonts(GDK_DISPLAY(), (char *)pattern1, maxnames, (int *)actual_count_return1);
-
- if (pattern)
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- if (actual_count_return)
- (*env)->ReleaseIntArrayElements(env, actual_count_return, actual_count_return1, 0);
- return rc;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
deleted file mode 100644
index 713ba8d723..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-import org.eclipse.swt.internal.Library;
-
-public class GDKPIXBUF extends OS {
-
- /* GdkColorspace enumeration */
- /* R/G/B additive color space */
- public final static int GDK_COLORSPACE_RGB = 0;
-
- /* GIF-like animation overlay modes for frames */
- public final static int GDK_PIXBUF_FRAME_RETAIN = 0;
- public final static int GDK_PIXBUF_FRAME_DISPOSE = 1;
- public final static int GDK_PIXBUF_FRAME_REVERT = 2;
-
- /* Alpha compositing mode */
- public final static int GDK_PIXBUF_ALPHA_BILEVEL = 0;
- public final static int GDK_PIXBUF_ALPHA_FULL = 1;
-
- /* Interpolation modes */
- public final static int GDK_INTERP_NEAREST = 0;
- public final static int GDK_INTERP_TILES = 1;
- public final static int GDK_INTERP_BILINEAR = 2;
- public final static int GDK_INTERP_HYPER = 3;
-
-
-/*
- * NATIVES
- */
-
-/* GdkPixbuf accessors */
-
-/**
- * Returns the colorspace of the pixbuf argument
- */
-public static final native int gdk_pixbuf_get_colorspace (int pixbuf);
-
-/**
- * Returns the number of channels in the pixbuf argument
- */
-public static final native int gdk_pixbuf_get_n_channels (int pixbuf);
-
-/**
- * Returns true if the pixbuf specified by the argument has an alpha channel
- * (opacity information), and false otherwise.
- */
-public static final native boolean gdk_pixbuf_get_has_alpha (int pixbuf);
-
-/**
- * Returns the number of bits per pixel in each channel.
- * Normally 8.
- */
-public static final native int gdk_pixbuf_get_bits_per_sample (int pixbuf);
-
-/**
- * Returns the address of the actual image data in the OS memory.
- */
-public static final native int gdk_pixbuf_get_pixels (int pixbuf);
-
-/**
- * Returns the width of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_width (int pixbuf);
-
-/**
- * Returns the height of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_height (int pixbuf);
-
-/**
- * Returns the rowstride of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_rowstride (int pixbuf);
-
-
-/* PIXBUF CREATION FROM DATA IN MEMORY */
-
-/**
- * Create a blank pixbuf with an optimal rowstride and a new buffer
- */
-public static final native int gdk_pixbuf_new (
- int colorspace,
- boolean has_alpha,
- int bits_per_sample,
- int width,
- int height);
-
-public static final native int gdk_pixbuf_copy(int source);
-
-public static final native int gdk_pixbuf_new_from_data (
- byte[] data,
- int colorspace,
- boolean has_alpha,
- int bits_per_sample,
- int width,
- int height,
- int rowstride,
- int destroy_fn,
- int destroy_fn_data);
-
-public static final native int gdk_pixbuf_new_from_xpm_data (int pdata);
-
-
-/* PIXBUF CREATION - FILE LOADING */
-
-public static final native int gdk_pixbuf_new_from_file (byte[] filename);
-
-
-
-/* RENDERING TO A DRAWABLE */
-
-
-public static final native void gdk_pixbuf_render_to_drawable_alpha (int pixbuf,
- int drawable,
- int src_x, int src_y,
- int dest_x, int dest_y,
- int width, int height,
- int alpha_mode,
- int alpha_threshold,
- int dither,
- int x_dither, int y_dither);
-
-public static final native void gdk_pixbuf_render_to_drawable (int pixbuf,
- int drawable,
- int gc,
- int src_x, int src_y,
- int dest_x, int dest_y,
- int width, int height,
- int dither,
- int x_dither, int y_dither);
-
-/* SCALING */
-
-public static final native void gdk_pixbuf_scale (
- int src, int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- int interp_type);
-
-public static final native void gdk_pixbuf_composite (
- int src, int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- int interp_type,
- int overall_alpha);
-
-public static final native void gdk_pixbuf_composite_color (
- int src,
- int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,double scale_y,
- int interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- int color1,
- int color2);
-
-public static final native int gdk_pixbuf_scale_simple (
- int src,
- int dest_width,
- int dest_height,
- int interp_type);
-
-public static final native int gdk_pixbuf_composite_color_simple (
- int src,int dest_width,
- int dest_height,
- int interp_type,
- int overall_alpha,
- int check_size,
- int color1,
- int color2);
-
-
-
-public static final native int gdk_pixbuf_get_from_drawable (
- int dest,
- int src,
- int cmap,
- int src_x,
- int src_y,
- int dest_x,
- int dest_y,
- int width,
- int height);
-
-
-
-/* LOAD THE DLL */
-
-static {
- Library.loadLibrary ("swt-pixbuf");
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java
deleted file mode 100644
index 1db777f4b6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkColor {
- public int pixel;
- public short red;
- public short green;
- public short blue;
- public static final int sizeof = 10;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java
deleted file mode 100644
index 6da6571c0a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEvent {
- public int type;
- public int window;
- public byte send_event;
- public static final int sizeof = 88;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java
deleted file mode 100644
index 17d1febbcf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventButton extends GdkEvent {
- public int time;
- public long x;
- public long y;
- public long pressure;
- public long xtilt;
- public long ytilt;
- public int state;
- public int button;
- public int source;
- public int deviceid;
- public long x_root;
- public long y_root;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java
deleted file mode 100644
index 6fd9920e97..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventExpose extends GdkEvent {
- public short x;
- public short y;
- public short width;
- public short height;
- public int count;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java
deleted file mode 100644
index 6e4acded51..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventKey extends GdkEvent {
- public int time;
- public int state;
- public int keyval;
- public int length;
- public int string;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java
deleted file mode 100644
index 5a8d5b9c16..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventMotion extends GdkEvent {
- public int time;
- public long x;
- public long y;
- public long pressure;
- public long xtilt;
- public long ytilt;
- public int state;
- public int is_hint;
- public int source;
- public int deviceid;
- public long x_root;
- public long y_root;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java
deleted file mode 100644
index 6d7df17522..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkFont {
- public int type;
- public int ascent;
- public int descent;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java
deleted file mode 100644
index df0b4d54b5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkGCValues {
- public int foreground_pixel;
- public short foreground_red;
- public short foreground_green;
- public short foreground_blue;
- public int background_pixel;
- public short background_red;
- public short background_green;
- public short background_blue;
- public int font;
- public int function;
- public int fill;
- public int tile;
- public int stipple;
- public int clip_mask;
- public int subwindow_mode;
- public int ts_x_origin;
- public int ts_y_origin;
- public int clip_x_origin;
- public int clip_y_origin;
- public int graphics_exposures;
- public int line_width;
- public int line_style;
- public int cap_style;
- public int join_style;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java
deleted file mode 100644
index 1dad9e7991..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkRectangle {
- public short x;
- public short y;
- public short width;
- public short height;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java
deleted file mode 100644
index 3b0630a614..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkVisual {
- public int type;
- public int depth;
- public int byte_order;
- public int colormap_size;
- public int bits_per_rgb;
- public int red_mask;
- public int red_shift;
- public int red_prec;
- public int green_mask;
- public int green_shift;
- public int green_prec;
- public int blue_mask;
- public int blue_shift;
- public int blue_prec;
- public static final int sizeof = 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java
deleted file mode 100644
index b1a55987f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkAdjustment extends GtkObject {
- public float lower;
- public float upper;
- public float value;
- public float step_increment;
- public float page_increment;
- public float page_size;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java
deleted file mode 100644
index fc264d98b2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkAllocation {
- public short x;
- public short y;
- public short width;
- public short height;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java
deleted file mode 100644
index d408fc5b42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkBin extends GtkContainer {
- public int child;
- public static final int sizeof = 64;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java
deleted file mode 100644
index f948c7e4fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkBox extends GtkContainer {
- public int children;
- public short spacing;
- public int homogeneous;
- public static final int sizeof = 68;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java
deleted file mode 100644
index cb4843b18c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCList extends GtkContainer {
- public short clist_flags;
- public int row_mem_chunk;
- public int cell_mem_chunk;
- public int freeze_count;
- public short internal_allocation_x;
- public short internal_allocation_y;
- public short internal_allocation_width;
- public short internal_allocation_height;
- public int rows;
- public int row_center_offset;
- public int row_height;
- public int row_list;
- public int row_list_end;
- public int columns;
- public short column_title_area_x;
- public short column_title_area_y;
- public short column_title_area_width;
- public short column_title_area_height;
- public int title_window;
- public int column;
- public int clist_window;
- public int clist_window_width;
- public int clist_window_height;
- public int hoffset;
- public int voffset;
- public int shadow_type;
- public int selection_mode;
- public int selection;
- public int selection_end;
- public int undo_selection;
- public int undo_unselection;
- public int undo_anchor;
- public byte button_actions0;
- public byte button_actions1;
- public byte button_actions2;
- public byte button_actions3;
- public byte button_actions4;
- public byte drag_button;
- public int click_cell_row;
- public int click_cell_column;
- public int hadjustment;
- public int vadjustment;
- public int xor_gc;
- public int fg_gc;
- public int bg_gc;
- public int cursor_drag;
- public int x_drag;
- public int focus_row;
- public int anchor;
- public int anchor_state;
- public int drag_pos;
- public int htimer;
- public int vtimer;
- public int sort_type;
- public int compare;
- public int sort_column;
- public static final int sizeof = 252;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java
deleted file mode 100644
index 818924d046..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCListColumn {
- public int title;
- public short area_x;
- public short area_y;
- public short area_width;
- public short area_height;
- public int button;
- public int window;
- public int width;
- public int min_width;
- public int max_width;
- public int justification;
- public int visible;
- public int width_set;
- public int resizeable;
- public int auto_resize;
- public int button_passive;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java
deleted file mode 100644
index 73c9063ebd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCListRow {
- public int cell;
- public int state;
- public short foreground_red;
- public short foreground_green;
- public short foreground_blue;
- public int foreground_pixel;
- public short background_red;
- public short background_green;
- public short background_blue;
- public int background_pixel;
- public int style;
- public int data;
- public int destroy; // bitfield: 1
- public int fg_set; // bitfield: 1
- public int bg_set; // bitfield: 1
- public int selectable; // bitfield: 1
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java
deleted file mode 100644
index 7f6bb8ef21..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCTree extends GtkCList {
- public int tree_indent;
- public int tree_column;
- public static final int sizeof = 276;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
deleted file mode 100644
index ce9e4d6b4f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCTreeRow extends GtkCListRow {
- public int parent;
- public int sibling;
- public int children;
- public int pixmap_closed;
- public int mask_closed;
- public int pixmap_opened;
- public int mask_opened;
- public short level;
- public int is_leaf; // bitfield: 1
- public int expanded; // bitfield: 1
- public static final int sizeof = 80;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
deleted file mode 100644
index ce3c4db9b3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCheckMenuItem extends GtkMenuItem {
- public int active;
- public int always_show_toggle;
- public static final int sizeof = 88;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
deleted file mode 100644
index b677e23d94..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkColorSelectionDialog extends GtkWindow {
- public int colorsel;
- public int main_vbox;
- public int ok_button;
- public int reset_button;
- public int cancel_button;
- public int help_button;
- public static final int sizeof = 120;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java
deleted file mode 100644
index 2b44b570d1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCombo extends GtkHBox {
- public int entry;
- public int button;
- public int popup;
- public int popwin;
- public int list;
- public int entry_change_id;
- public int list_change_id;
- public int value_in_list; // bitfield : 1
- public int ok_if_empty; // bitfield : 1
- public int case_sensitive; // bitfield : 1
- public int use_arrows; // bitfield : 1
- public int use_arrows_always; // bitfield : 1
- public short current_button;
- public int activate_id;
- public static final int sizeof = 104;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java
deleted file mode 100644
index 52cb47acf2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkContainer extends GtkWidget {
- public int focus_child;
- public int border_width;
- public int need_resize;
- public int resize_mode;
- public int resize_widgets;
- public static final int sizeof = 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java
deleted file mode 100644
index d4f2ddf603..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkDialog extends GtkWindow {
- public int vbox;
- public int action_area;
- public static final int sizeof = 104;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java
deleted file mode 100644
index 8f2b772924..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkEditable extends GtkWidget {
- public int current_pos;
- public int selection_start_pos;
- public int selection_end_pos;
- public int has_selection; // bitfield : 1
- public int editable; // bitfield : 1
- public int visible; // bitfield : 1
- public int ic;
- public int ic_attr;
- public int clipboard_text;
- public static final int sizeof = 76;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java
deleted file mode 100644
index ebaf37d250..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFileSelection extends GtkWindow {
- public int dir_list;
- public int file_list;
- public int selection_entry;
- public int selection_text;
- public int main_vbox;
- public int ok_button;
- public int cancel_button;
- public int help_button;
- public int history_pulldown;
- public int history_menu;
- public int history_list;
- public int fileop_dialog;
- public int fileop_entry;
- public int fileop_file;
- public int cmpl_state;
- public int fileop_c_dir;
- public int fileop_del_file;
- public int fileop_ren_file;
- public int button_area;
- public int action_area;
- public static final int sizeof = 176;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
deleted file mode 100644
index 09ee75981c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFontSelectionDialog extends GtkWindow {
- public int fontsel;
- public int main_vbox;
- public int action_area;
- public int ok_button;
- public int apply_button;
- public int cancel_button;
- public int dialog_width;
- public int auto_resize;
- public static final int sizeof = 132;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java
deleted file mode 100644
index 0541461e5b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFrame extends GtkBin {
- public int label;
- public short shadow_type;
- public short label_width;
- public short label_height;
- public float label_xalign;
- public float label_yalign;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java
deleted file mode 100644
index 656601480a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkHBox extends GtkBox {
- public static final int sizeof = 68;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java
deleted file mode 100644
index 80db35e791..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkItem extends GtkBin {
- public static final int sizeof = 64;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java
deleted file mode 100644
index ed4542029e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkMenuItem extends GtkItem {
- public int submenu;
- public int accelerator_signal;
- public int toggle_size;
- public int accelerator_width;
- public int show_toggle_indicator;
- public int show_submenu_indicator;
- public int submenu_placement;
- public int submenu_direction;
- public int right_justify;
- public int timer;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java
deleted file mode 100644
index 226d4a7d0c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkObject {
- public int klass;
- public int flags;
- public int ref_count;
- public int object_data;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java
deleted file mode 100644
index 0c12fe44f0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkRequisition {
- public short width;
- public short height;
- public static final int sizeof = 4;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java
deleted file mode 100644
index a07067261a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkStyle {
- public int klass;
- public int fg0_pixel;
- public short fg0_red, fg0_green, fg0_blue;
- public int fg1_pixel;
- public short fg1_red, fg1_green, fg1_blue;
- public int fg2_pixel;
- public short fg2_red, fg2_green, fg2_blue;
- public int fg3_pixel;
- public short fg3_red, fg3_green, fg3_blue;
- public int fg4_pixel;
- public short fg4_red, fg4_green, fg4_blue;
- public int bg0_pixel;
- public short bg0_red, bg0_green, bg0_blue;
- public int bg1_pixel;
- public short bg1_red, bg1_green, bg1_blue;
- public int bg2_pixel;
- public short bg2_red, bg2_green, bg2_blue;
- public int bg3_pixel;
- public short bg3_red, bg3_green, bg3_blue;
- public int bg4_pixel;
- public short bg4_red, bg4_green, bg4_blue;
- public int light0_pixel;
- public short light0_red, light0_green, light0_blue;
- public int light1_pixel;
- public short light1_red, light1_green, light1_blue;
- public int light2_pixel;
- public short light2_red, light2_green, light2_blue;
- public int light3_pixel;
- public short light3_red, light3_green, light3_blue;
- public int light4_pixel;
- public short light4_red, light4_green, light4_blue;
- public int dark0_pixel;
- public short dark0_red, dark0_green, dark0_blue;
- public int dark1_pixel;
- public short dark1_red, dark1_green, dark1_blue;
- public int dark2_pixel;
- public short dark2_red, dark2_green, dark2_blue;
- public int dark3_pixel;
- public short dark3_red, dark3_green, dark3_blue;
- public int dark4_pixel;
- public short dark4_red, dark4_green, dark4_blue;
- public int mid0_pixel;
- public short mid0_red, mid0_green, mid0_blue;
- public int mid1_pixel;
- public short mid1_red, mid1_green, mid1_blue;
- public int mid2_pixel;
- public short mid2_red, mid2_green, mid2_blue;
- public int mid3_pixel;
- public short mid3_red, mid3_green, mid3_blue;
- public int mid4_pixel;
- public short mid4_red, mid4_green, mid4_blue;
- public int text0_pixel;
- public short text0_red, text0_green, text0_blue;
- public int text1_pixel;
- public short text1_red, text1_green, text1_blue;
- public int text2_pixel;
- public short text2_red, text2_green, text2_blue;
- public int text3_pixel;
- public short text3_red, text3_green, text3_blue;
- public int text4_pixel;
- public short text4_red, text4_green, text4_blue;
- public int base0_pixel;
- public short base0_red, base0_green, base0_blue;
- public int base1_pixel;
- public short base1_red, base1_green, base1_blue;
- public int base2_pixel;
- public short base2_red, base2_green, base2_blue;
- public int base3_pixel;
- public short base3_red, base3_green, base3_blue;
- public int base4_pixel;
- public short base4_red, base4_green, base4_blue;
- public int black_pixel;
- public short black_red, black_green, black_blue;
- public int white_pixel;
- public short white_red, white_green, white_blue;
- public int font;
- public int fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4;
- public int bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4;
- public int light_gc0, light_gc1, light_gc2, light_gc3, light_gc4;
- public int dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4;
- public int mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4;
- public int text_gc0, text_gc1, text_gc2, text_gc3, text_gc4;
- public int base_gc0, base_gc1, base_gc2, base_gc3, base_gc4;
- public int black_gc;
- public int white_gc;
- public int bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
- public int ref_count;
- public int attach_count;
- public int depth;
- public int colormap;
- public int engine;
- public int engine_data;
- public int rc_style;
- public int styles;
- public static final int sizeof = 652;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java
deleted file mode 100644
index a086ab46fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkStyleClass {
- public int xthickness;
- public int ythickness;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java
deleted file mode 100644
index fda4196346..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkText extends GtkEditable {
- public int first_line_start_index;
- public int first_onscreen_hor_pixel;
- public int first_onscreen_ver_pixel;
- public int default_tab_width;
- public int cursor_pos_x;
- public int cursor_pos_y;
- public int cursor_virtual_x;
- public static final int sizeof = 244;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java
deleted file mode 100644
index 405fbeb6b2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkWidget extends GtkObject {
- public short private_flags;
- public byte state;
- public byte saved_state;
- public int name;
- public int style;
- public short req_width;
- public short req_height;
- public short alloc_x;
- public short alloc_y;
- public short alloc_width;
- public short alloc_height;
- public int window;
- public int parent;
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java
deleted file mode 100644
index 152dc729f1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkWindow extends GtkBin {
- public int title;
- public int wmclass_name;
- public int wmclass_class;
- public int type;
- public int focus_widget;
- public int default_widget;
- public int transient_parent;
- public short resize_count;
- public int allow_shrink;
- public int allow_grow;
- public int auto_shrink;
- public int handling_resize;
- public int position;
- public int use_uposition;
- public int modal;
- public static final int sizeof = 96;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
deleted file mode 100644
index 2433905716..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ /dev/null
@@ -1,663 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-import org.eclipse.swt.internal.Library;
-
-public class OS {
- static {
- Library.loadLibrary("swt-pi");
- }
-
-
- public static final int GDK_NONE = 0;
-
- /* For Display.KeyTable: */
- /* Keyboard and mouse masks */
- public static final int GDK_Alt_L = 0xFFE9;
- public static final int GDK_Alt_R = 0xFFEA;
- public static final int GDK_Shift_L = 0xFFE1;
- public static final int GDK_Shift_R = 0xFFE2;
- public static final int GDK_Control_L = 0xFFE3;
- public static final int GDK_Control_R = 0xFFE4;
- /* Non-numeric keypad constants */
- public static final int GDK_Up = 0xFF52;
- public static final int GDK_Down = 0xFF54;
- public static final int GDK_Left = 0xFF51;
- public static final int GDK_Right = 0xFF53;
- public static final int GDK_Page_Up = 0xFF55;
- public static final int GDK_Page_Down = 0xFF56;
- public static final int GDK_Home = 0xFF50;
- public static final int GDK_End = 0xFF57;
- public static final int GDK_Insert = 0xFF63;
- public static final int GDK_Delete = 0xFFFF;
- /* Functions Keys */
- public static final int GDK_F1 = 0xFFBE;
- public static final int GDK_F2 = 0xFFBF;
- public static final int GDK_F3 = 0xFFC0;
- public static final int GDK_F4 = 0xFFC1;
- public static final int GDK_F5 = 0xFFC2;
- public static final int GDK_F6 = 0xFFC3;
- public static final int GDK_F7 = 0xFFC4;
- public static final int GDK_F8 = 0xFFC5;
- public static final int GDK_F9 = 0xFFC6;
- public static final int GDK_F10 = 0xFFC7;
- public static final int GDK_F11 = 0xFFC8;
- public static final int GDK_F12 = 0xFFC9;
- public static final int GDK_Return = 0xFF0D;
- /* Numeric Keypad */
- public static final int GDK_KP_Add = 0xFFAB;
- public static final int GDK_KP_Subtract = 0xFFAD;
- public static final int GDK_KP_Multiply = 0xFFAA;
- public static final int GDK_KP_Divide = 0xFFAF;
- public static final int GDK_KP_Enter = 0xFF8D;
- public static final int GDK_KP_Decimal = 0xFFAE;
- public static final int GDK_KP_0 = 0xFFB0;
- public static final int GDK_KP_1 = 0xFFB1;
- public static final int GDK_KP_2 = 0xFFB2;
- public static final int GDK_KP_3 = 0xFFB3;
- public static final int GDK_KP_4 = 0xFFB4;
- public static final int GDK_KP_5 = 0xFFB5;
- public static final int GDK_KP_6 = 0xFFB6;
- public static final int GDK_KP_7 = 0xFFB7;
- public static final int GDK_KP_8 = 0xFFB8;
- public static final int GDK_KP_9 = 0xFFB9;
-
- public static final int GDK_FONT_FONT = 0;
- public static final int GDK_FONT_FONTSET = 1;
- public static final int GDK_COPY = 0;
- public static final int GDK_INVERT = 1;
- public static final int GDK_XOR = 2;
- public static final int GDK_STIPPLED = 2;
- public static final int GDK_LINE_SOLID = 0;
- public static final int GDK_LINE_ON_OFF_DASH = 1;
- public static final int GDK_LINE_DOUBLE_DASH = 2;
- public static final int GDK_CAP_BUTT = 1;
- public static final int GDK_JOIN_MITER = 0;
- public static final int GDK_X_CURSOR = 0;
- public static final int GDK_BOTTOM_LEFT_CORNER = 12;
- public static final int GDK_BOTTOM_RIGHT_CORNER = 14;
- public static final int GDK_BOTTOM_SIDE = 16;
- public static final int GDK_CROSS = 30;
- public static final int GDK_DIAMOND_CROSS = 36;
- public static final int GDK_DOUBLE_ARROW = 42;
- public static final int GDK_HAND1 = 58;
- public static final int GDK_LEFT_PTR = 68;
- public static final int GDK_LEFT_SIDE = 70;
- public static final int GDK_QUESTION_ARROW = 92;
- public static final int GDK_RIGHT_PTR = 94;
- public static final int GDK_RIGHT_SIDE = 96;
- public static final int GDK_SB_H_DOUBLE_ARROW = 108;
- public static final int GDK_SB_UP_ARROW = 114;
- public static final int GDK_SB_V_DOUBLE_ARROW = 116;
- public static final int GDK_SIZING = 120;
- public static final int GDK_TOP_LEFT_CORNER = 134;
- public static final int GDK_TOP_RIGHT_CORNER = 136;
- public static final int GDK_TOP_SIDE = 138;
- public static final int GDK_WATCH = 150;
- public static final int GDK_XTERM = 152;
- public static final int GDK_CURSOR_IS_PIXMAP = -1;
- public static final int GDK_MOTION_NOTIFY = 3;
- public static final int GDK_BUTTON_PRESS = 4;
- public static final int GDK_2BUTTON_PRESS = 5;
- public static final int GDK_3BUTTON_PRESS = 6;
- public static final int GDK_BUTTON_RELEASE = 7;
- public static final int GDK_KEY_PRESS = 8;
- public static final int GDK_KEY_RELEASE = 9;
- public static final int GDK_NO_EXPOSE = 30;
- public static final int GDK_EXPOSURE_MASK = 1 << 1;
- public static final int GDK_POINTER_MOTION_MASK = 1 << 2;
- public static final int GDK_POINTER_MOTION_HINT_MASK = 1 << 3;
- public static final int GDK_BUTTON_MOTION_MASK = 1 << 4;
- public static final int GDK_BUTTON1_MOTION_MASK = 1 << 5;
- public static final int GDK_BUTTON2_MOTION_MASK = 1 << 6;
- public static final int GDK_BUTTON3_MOTION_MASK = 1 << 7;
- public static final int GDK_BUTTON_PRESS_MASK = 1 << 8;
- public static final int GDK_BUTTON_RELEASE_MASK = 1 << 9;
- public static final int GDK_KEY_PRESS_MASK = 1 << 10;
- public static final int GDK_KEY_RELEASE_MASK = 1 << 11;
- public static final int GDK_ENTER_NOTIFY_MASK = 1 << 12;
- public static final int GDK_LEAVE_NOTIFY_MASK = 1 << 13;
- public static final int GDK_FOCUS_CHANGE_MASK = 1 << 14;
- public static final int GDK_SHIFT_MASK = 1 << 0;
- public static final int GDK_LOCK_MASK = 1 << 1;
- public static final int GDK_CONTROL_MASK = 1 << 2;
- public static final int GDK_MOD1_MASK = 1 << 3;
- public static final int GDK_BUTTON1_MASK = 1 << 8;
- public static final int GDK_BUTTON2_MASK = 1 << 9;
- public static final int GDK_BUTTON3_MASK = 1 << 10;
- public static final int GDK_RELEASE_MASK = 1 << 13;
- public static final int GDK_MODIFIER_MASK = 0x3fff;
- public static final int GDK_INCLUDE_INFERIORS = 1;
- public static final int GDK_DECOR_ALL = 1 << 0;
- public static final int GDK_DECOR_BORDER = 1 << 1;
- public static final int GDK_DECOR_RESIZEH = 1 << 2;
- public static final int GDK_DECOR_TITLE = 1 << 3;
- public static final int GDK_DECOR_MENU = 1 << 4;
- public static final int GDK_DECOR_MINIMIZE = 1 << 5;
- public static final int GDK_DECOR_MAXIMIZE = 1 << 6;
- public static final int GDK_OVERLAP_RECTANGLE_IN = 0;
- public static final int GDK_OVERLAP_RECTANGLE_OUT = 1;
- public static final int GDK_OVERLAP_RECTANGLE_PART = 2;
- public static final int GDK_RGB_DITHER_NONE = 0;
- public static final int GDK_RGB_DITHER_NORMAL = 1;
- public static final int GDK_RGB_DITHER_MAX = 2;
- public static final int GTK_ARROW_UP = 0;
- public static final int GTK_ARROW_DOWN = 1;
- public static final int GTK_ARROW_LEFT = 2;
- public static final int GTK_ARROW_RIGHT = 3;
- public static final int GTK_JUSTIFY_LEFT = 0;
- public static final int GTK_JUSTIFY_RIGHT = 1;
- public static final int GTK_JUSTIFY_CENTER = 2;
- public static final int GTK_JUSTIFY_FILL = 3;
- public static final int GTK_ORIENTATION_HORIZONTAL = 0;
- public static final int GTK_ORIENTATION_VERTICAL = 1;
- public static final int GTK_POLICY_ALWAYS = 0;
- public static final int GTK_POLICY_AUTOMATIC = 1; // can't fix now
- public static final int GTK_POLICY_NEVER = 2;
- public static final int GTK_RELIEF_NORMAL = 0;
-// public static final int GTK_RELIEF_HALF = 1;
- public static final int GTK_RELIEF_NONE = 2;
- public static final int GTK_SELECTION_SINGLE = 0; // extra code in Table, can't fix now
- public static final int GTK_SELECTION_BROWSE = 1;
- public static final int GTK_SELECTION_MULTIPLE = 2;
- public static final int GTK_SELECTION_EXTENDED = 3;
- public static final int GTK_SHADOW_NONE = 0;
- public static final int GTK_SHADOW_IN = 1;
- public static final int GTK_SHADOW_OUT = 2;
- public static final int GTK_SHADOW_ETCHED_IN = 3;
- public static final int GTK_SHADOW_ETCHED_OUT = 4;
- public static final int GTK_STATE_NORMAL = 0;
- public static final int GTK_STATE_ACTIVE = 1;
- public static final int GTK_STATE_PRELIGHT = 2;
- public static final int GTK_STATE_SELECTED = 3;
- public static final int GTK_STATE_INSENSITIVE = 4;
- public static final int GTK_TOP_BOTTOM = 0;
- public static final int GTK_LEFT_RIGHT = 1;
- public static final int GTK_TOOLBAR_ICONS = 0;
- public static final int GTK_TOOLBAR_TEXT = 1;
- public static final int GTK_TOOLBAR_BOTH = 2;
- public static final int GTK_VISIBILITY_NONE = 0;
- public static final int GTK_VISIBILITY_PARTIAL = 1;
- public static final int GTK_VISIBILITY_FULL = 2;
- public static final int GTK_WINDOW_TOPLEVEL = 0;
- public static final int GTK_WINDOW_DIALOG = 1;
- public static final int GTK_WINDOW_POPUP = 2;
- public static final int GTK_ACCEL_VISIBLE = 1 << 0;
- public static final int GTK_NO_WINDOW = 1 << 5;
- public static final int GTK_MAPPED = 1 << 7;
- public static final int GTK_VISIBLE = 1 << 8;
- public static final int GTK_SENSITIVE = 1 << 9;
- public static final int GTK_CAN_FOCUS = 1 << 11;
- public static final int GTK_HAS_FOCUS = 1 << 12;
- public static final int GTK_CLIST_SHOW_TITLES = 1 << 2;
- public static final int GTK_PROGRESS_CONTINUOUS = 0;
- public static final int GTK_PROGRESS_DISCRETE = 1;
- public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0;
- public static final int GTK_PROGRESS_RIGHT_TO_LEFT = 1;
- public static final int GTK_PROGRESS_BOTTOM_TO_TOP = 2;
- public static final int GTK_PROGRESS_TOP_TO_BOTTOM = 3;
- public static final int GTK_TOOLBAR_CHILD_SPACE = 0;
- public static final int GTK_TOOLBAR_CHILD_BUTTON = 1;
- public static final int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 2;
- public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
- public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
-
- public static final int G_LOG_FLAG_RECURSION = 1 << 0;
- public static final int G_LOG_FLAG_FATAL = 1 << 1;
-// public static final int G_LOG_LEVEL_ERROR = 1 << 2;
-// public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
-// public static final int G_LOG_LEVEL_WARNING = 1 << 4;
-// public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
-// public static final int G_LOG_LEVEL_INFO = 1 << 6;
-// public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
- public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
-
-public static final native int GTK_WIDGET_FLAGS(int wid);
-public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
-public static final native void GTK_WIDGET_UNSET_FLAGS(int wid,int flag);
-public static final native boolean GTK_WIDGET_NO_WINDOW(int wid);
-public static final native void gdk_rgb_init();
-public static final native boolean GTK_WIDGET_SENSITIVE(int wid);
-public static final native boolean GTK_WIDGET_IS_SENSITIVE(int wid);
-public static final native void memmove(GtkStyleClass dest, int src, int size);
-public static final native void gtk_signal_handler_block_by_data(int object, int data);
-public static final native void gtk_signal_handler_unblock_by_data(int object, int data);
-public static final native int gtk_object_get_data_by_id(int object, int data_id);
-public static final native void gtk_object_set_data_by_id(int object, int data_id, int data);
-public static final native int g_quark_from_string(byte [] string);
-public static final native void gtk_object_unref(int object);
-public static final native void gtk_object_destroy(int object);
-public static final native int GTK_WIDGET_TYPE(int wid);
-public static final native int gtk_label_get_type();
-public static final native int g_log_set_handler(byte [] log_domain, int log_levels, int log_func, int user_data);
-public static final native void g_log_remove_handler(byte [] log_domain, int handler_id);
-public static final native void g_log_default_handler(int log_domain, int log_levels, int message, int unused_data);
-public static final native int gtk_clist_row_is_visible(int clist, int row);
-public static final native void gtk_ctree_post_recursive_to_depth(int ctree, int node, int depth, int func, int data);
-public static final native void gtk_draw_check(int style, int window, int state_type, int shadow_type, int x, int y, int width, int height);
-
-public static final native void g_free(int mem);
-public static final native int g_get_home_dir();
-public static final native int g_list_length(int list);
-public static final native int g_list_nth(int list, int n);
-public static final native int g_list_nth_data(int list, int n);
-public static final native void g_list_free(int list);
-public static final native int g_malloc(int size);
-public static final native int g_list_append(int list, int data);
-public static final native int g_slist_length(int list);
-public static final native int g_slist_nth(int list, int n);
-public static final native int g_slist_nth_data(int list, int n);
-public static final native int g_strdup(byte[] str);
-public static final native int gdk_colormap_get_system();
-public static final native void gdk_colors_free(int colormap, int[] pixels, int npixels, int planes);
-public static final native boolean gdk_color_alloc(int colormap, GdkColor color);
-public static final native int gdk_cursor_new(int cursor_type);
-public static final native int gdk_bitmap_create_from_data(int window, byte[] data, int width, int height);
-public static final native int gdk_cursor_new_from_pixmap(int source, int mask, GdkColor fg, GdkColor bg, int x, int y);
-public static final native void gdk_cursor_destroy(int cursor);
-public static final native int gdk_font_load(byte[] font_name);
-public static final native int gdk_font_ref(int font);
-public static final native void gdk_font_unref(int font);
-public static final native boolean gdk_font_equal(int fonta, int fontb);
-public static final native int gdk_char_width(int font, byte character);
-public static final native void gdk_gc_get_values(int gc, GdkGCValues values);
-public static final native void gdk_gc_set_font(int gc, int font);
-public static final native void gdk_gc_set_foreground(int gc, GdkColor color);
-public static final native void gdk_gc_set_background(int gc, GdkColor color);
-public static final native void gdk_gc_set_clip_mask(int gc, int mask);
-public static final native void gdk_gc_set_clip_rectangle(int gc, GdkRectangle rectangle);
-public static final native void gdk_gc_set_clip_region(int gc, int region);
-public static final native void gdk_gc_set_line_attributes(int gc, int line_width, int line_style, int cap_style, int join_style);
-public static final native void gdk_gc_set_dashes(int gc, int dash_offset, byte[] dash_list, int n);
-public static final native void gdk_gc_set_function(int gc, int function);
-public static final native void gdk_draw_line(int drawable, int gc, int x1, int y1, int x2, int y2);
-public static final native void gdk_draw_arc(int drawable, int gc, int filled, int x, int y, int width, int height, int angle1, int angle2);
-public static final native void gdk_draw_rectangle(int drawable, int gc, int filled, int x, int y, int width, int height);
-public static final native void gdk_draw_pixmap(int drawable, int gc, int src, int xsrc, int ysrc, int xdest, int ydest, int width, int height);
-public static final native void gdk_draw_lines(int drawable, int gc, short[] points, int npoints);
-public static final native void gdk_draw_polygon(int drawable, int gc, int filled, short[] points, int npoints);
-public static final native void gdk_draw_string(int drawable, int font, int gc, int x, int y, byte[] string);
-public static final native void gdk_gc_unref(int gc);
-public static final native int gdk_gc_new(int window);
-public static final native void gdk_gc_destroy(int gc);
-public static final native void gdk_bitmap_unref(int pixmap);
-public static final native boolean gdk_color_white(int colormap, GdkColor color);
-public static final native int gdk_image_get(int window, int x, int y, int width, int height);
-public static final native int gdk_image_get_pixel(int image, int x, int y);
-public static final native void gdk_gc_set_exposures(int gc, boolean exposures);
-public static final native int gdk_event_get_graphics_expose(int window);
-public static final native void gdk_event_free(int event);
-public static final native void gdk_flush();
-public static final native void gdk_beep();
-public static final native void gdk_color_free(GdkColor color);
-public static final native int GDK_ROOT_PARENT();
-public static final native void gdk_gc_set_stipple(int gc, int stipple);
-public static final native void gdk_gc_set_subwindow(int gc, int mode);
-public static final native void gdk_gc_set_fill(int gc, int fill);
-public static final native int gdk_atom_intern(byte[] atom_name, int only_if_exists);
-public static final native int gdk_event_get();
-public static final native void gdk_pixmap_unref(int pixmap);
-public static final native void gdk_region_get_clipbox(int region, GdkRectangle rectangle);
-public static final native int gdk_region_new();
-public static final native int gdk_region_union_with_rect(int region, GdkRectangle rect);
-public static final native int gdk_regions_subtract(int source1, int source2);
-public static final native int gdk_regions_union(int source1, int source2);
-public static final native void gdk_region_destroy(int region);
-public static final native int gdk_pixmap_new(int window, int width, int height, int depth);
-public static final native boolean gdk_region_point_in(int region, int x, int y);
-public static final native boolean gdk_region_empty(int region);
-public static final native boolean gdk_region_equal(int region1, int region2);
-public static final native int gdk_screen_height();
-public static final native int gdk_screen_width();
-public static final native int gdk_region_rect_in(int region, GdkRectangle rect);
-public static final native int gdk_visual_get_system();
-public static final native void gdk_string_extents(int font, byte[] string, int[] lbearing, int[] rbearing, int[] width, int[] ascent, int[] descent);
-public static final native int gdk_string_height(int font, byte[] string);
-public static final native int gdk_string_width(int font, byte[] string);
-public static final native void gdk_window_copy_area(int window, int gc, int x, int y, int source_window, int source_x, int source_y, int width, int height);
-public static final native void gdk_window_clear_area(int window, int x, int y, int width, int height);
-public static final native void gdk_window_clear_area_e(int window, int x, int y, int width, int height);
-public static final native void gdk_window_resize(int window, int width, int height);
-public static final native void gdk_window_move (int window, int x, int y);
-public static final native int gdk_window_at_pointer(int[] win_x, int[] win_y);
-public static final native int gdk_time_get();
-public static final native int gdk_screen_width_mm();
-public static final native void gdk_window_get_geometry(int window, int[] x, int[] y, int[] width, int[] height, int[] depth);
-public static final native void gdk_window_raise(int window);
-public static final native void gdk_window_lower(int window);
-public static final native int gdk_window_get_origin(int window, int[] x, int[] y);
-public static final native int gdk_window_get_pointer(int window, int[] x, int[] y, int mask);
-public static final native void gdk_window_set_cursor(int window, int cursor);
-public static final native void gdk_window_set_icon(int window, int icon_window, int pixmap, int mask);
-public static final native void gdk_window_set_user_data(int window, int user_data);
-public static final native void gdk_window_show(int window);
-public static final native void gdk_window_get_user_data(int window, int[] data);
-public static final native void gdk_window_set_decorations(int window, int decorations);
-public static final native int gtk_adjustment_new(float value, float lower, float upper, float step_increment, float page_increment, float page_size);
-public static final native void gtk_adjustment_changed(int adjustment);
-public static final native void gtk_adjustment_set_value(int adjustment, float value);
-public static final native void gtk_adjustment_value_changed(int adjustment);
-public static final native int gtk_accel_group_new();
-public static final native void gtk_accel_group_unref(int accel_group);
-public static final native boolean gtk_accel_groups_activate(int accelGroup, int accelKey, int accelMods); // accelMods is one of GdkModifierType defined in gdk/gdktypes.h
-public static final native int gtk_arrow_new(int arrow_type, int shadow_type);
-public static final native void gtk_arrow_set(int arrow, int arrow_type, int shadow_type);
-public static final native void gtk_box_pack_start(int box, int child, boolean expand, boolean fill, int padding);
-public static final native void gtk_box_pack_end(int box, int child, boolean expand, boolean fill, int padding);
-public static final native int gtk_button_new();
-public static final native int gtk_check_button_new();
-public static final native int gtk_check_version(int required_major, int required_minor, int required_micro);
-public static final native int gtk_clist_append(int clist, int[] text);
-public static final native void gtk_clist_clear(int clist);
-public static final native int gtk_check_menu_item_new_with_label(byte[] label);
-public static final native int gtk_button_new_with_label(byte[] label);
-public static final native void gtk_clist_column_title_passive(int clist, int column);
-public static final native void gtk_clist_column_titles_show(int clist);
-public static final native void gtk_clist_column_titles_hide(int clist);
-public static final native void gtk_clist_freeze(int clist);
-public static final native void gtk_clist_get_pixtext(int clist, int row, int column, int[] text, int[] spacing, int[] pixmap, int[] mask);
-public static final native void gtk_check_menu_item_set_show_toggle(int menu_item, boolean always);
-public static final native void gtk_clist_column_titles_passive(int clist);
-public static final native void gtk_check_menu_item_set_active(int check_menu_item, boolean is_active);
-public static final native int gtk_clist_insert(int clist, int row, int[] text);
-public static final native int gtk_clist_new(int columns);
-public static final native void gtk_clist_set_selection_mode(int clist, int mode);
-public static final native int gtk_clist_get_text(int clist, int row, int column, int[] text);
-public static final native void gtk_clist_remove(int clist, int row);
-public static final native void gtk_clist_select_row(int clist, int row, int column);
-public static final native void gtk_clist_select_all(int clist);
-public static final native void gtk_clist_moveto(int clist, int row, int column, float row_align, float col_align);
-public static final native void gtk_clist_set_column_title(int clist, int column, byte[] title);
-public static final native void gtk_clist_set_column_visibility(int clist, int column, boolean visible);
-public static final native int gtk_clist_get_selection_info(int clist, int x, int y, int[] row, int[] column);
-public static final native void gtk_clist_set_column_justification(int clist, int column, int justification);
-public static final native void gtk_clist_set_column_resizeable(int clist, int column, boolean resizeable);
-public static final native void gtk_clist_set_column_width(int clist, int column, int width);
-public static final native void gtk_clist_set_pixtext(int clist, int row, int column, byte[] text, byte spacing, int pixmap, int mask);
-public static final native void gtk_clist_set_pixmap(int clist, int row, int column, int pixmap, int mask);
-public static final native void gtk_container_add(int container, int widget);
-public static final native int gtk_container_children(int container);
-public static final native int gtk_color_selection_dialog_new(byte[] title);
-public static final native void gtk_color_selection_get_color(int colorsel, double[] color);
-public static final native void gtk_color_selection_set_color(int colorsel, double[] color);
-public static final native int gtk_combo_new();
-public static final native void gtk_combo_set_popdown_strings(int combo, int strings);
-public static final native void gtk_clist_set_shadow_type(int clist, int type);
-public static final native void gtk_clist_unselect_row(int clist, int row, int column);
-public static final native void gtk_clist_unselect_all(int clist);
-public static final native void gtk_clist_set_text(int clist, int row, int column, byte[] text);
-public static final native void gtk_clist_thaw(int clist);
-public static final native void gtk_container_remove(int container, int widget);
-public static final native int gtk_ctree_new(int columns, int tree_column);
-public static final native int gtk_ctree_insert_node(int ctree, int parent, int sibling, int[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
-public static final native int gtk_ctree_node_get_row_data(int ctree, int node);
-public static final native void gtk_ctree_expand(int ctree, int node);
-public static final native boolean gtk_ctree_is_hot_spot(int ctree, int x, int y);
-public static final native boolean gtk_ctree_is_viewable(int ctree, int node);
-public static final native int gtk_ctree_node_get_row_style(int ctree, int node);
-public static final native void gtk_ctree_collapse(int ctree, int node);
-public static final native int gtk_ctree_get_node_info(int ctree, int node, int[] text, byte[] spacing, int[] pixmap_closed, int[] mask_closed, int[] pixmap_opened, int[] mask_opened, boolean[] is_leaf, boolean[] expanded);
-public static final native void gtk_ctree_node_set_row_data(int ctree, int node, int data);
-public static final native void gtk_ctree_select(int ctree, int node);
-public static final native int gtk_ctree_node_nth(int ctree, int row);
-public static final native void gtk_ctree_select_recursive(int ctree, int node);
-public static final native void gtk_ctree_unselect_recursive(int ctree, int node);
-public static final native void gtk_ctree_post_recursive(int ctree, int node, int func, int data);
-public static final native void gtk_ctree_remove_node(int ctree, int node);
-public static final native int gtk_ctree_node_is_visible(int ctree, int node);
-public static final native void gtk_ctree_node_moveto(int ctree, int node, int column, float row_align, float col_align);
-public static final native void gtk_ctree_set_node_info(int ctree, int node, byte[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
-public static final native int gtk_drawing_area_new();
-public static final native int gtk_dialog_new();
-public static final native int gtk_event_box_new();
-public static final native int gtk_editable_get_position(int editable);
-public static final native void gtk_editable_set_position(int editable, int position);
-public static final native int gtk_fixed_new();
-public static final native void gtk_entry_set_editable(int entry, boolean editable);
-public static final native void gtk_fixed_put(int fixed, int widget, short x, short y);
-public static final native int gtk_entry_get_text(int entry);
-public static final native void gtk_entry_set_text(int entry, byte[] text);
-public static final native void gtk_editable_select_region(int editable, int start, int end);
-public static final native void gtk_editable_delete_text(int editable, int start_pos, int end_pos);
-public static final native void gtk_editable_insert_text(int editable, byte[] new_text, int new_text_length, int[] position);
-public static final native void gtk_drawing_area_size(int darea, int width, int height);
-public static final native int gtk_events_pending();
-public static final native int gtk_file_selection_get_filename(int filesel);
-public static final native int gtk_file_selection_new(byte[] title);
-public static final native void gtk_file_selection_set_filename(int filesel, byte[] filename);
-public static final native void gtk_file_selection_complete(int filesel, byte[] pattern);
-public static final native int gtk_font_selection_dialog_get_font_name(int fsd);
-public static final native int gtk_font_selection_dialog_new(byte[] title);
-public static final native boolean gtk_font_selection_dialog_set_font_name(int fsd, byte[] fontname);
-public static final native void gtk_editable_set_editable(int editable, boolean is_editable);
-public static final native boolean gtk_font_selection_set_font_name(int fontsel, byte[] fontname);
-public static final native int gtk_entry_new();
-public static final native void gtk_entry_append_text(int entry, byte[] text);
-public static final native void gtk_editable_delete_selection(int editable);
-public static final native int gtk_editable_get_chars(int editable, int start_pos, int end_pos);
-public static final native void gtk_entry_set_visibility(int entry, boolean visible);
-public static final native void gtk_entry_set_max_length(int entry, short max);
-public static final native void gtk_fixed_move(int fixed, int widget, short x, short y);
-public static final native boolean gtk_init_check(int[] argc, int[] argv);
-public static final native int gtk_frame_new(byte[] label);
-public static final native void gtk_frame_set_shadow_type(int frame, int type);
-public static final native void gtk_frame_set_label(int frame, byte[] label);
-public static final native int gtk_hseparator_new();
-public static final native int gtk_hbox_new(boolean homogeneous, int spacing);
-public static final native void gtk_grab_add(int widget);
-public static final native int gtk_grab_get_current();
-public static final native void gtk_grab_remove(int widget);
-public static final native int gtk_hscale_new(int adjustment);
-public static final native int gtk_hscrollbar_new(int adjustment);
-public static final native void gtk_label_set_justify(int label, int jtype);
-public static final native int gtk_label_new(byte[] str);
-public static final native void gtk_label_set_pattern(int label, byte[] pattern);
-public static final native void gtk_main_quit();
-public static final native void gtk_main();
-public static final native void gtk_list_clear_items(int list, int start, int end);
-public static final native void gtk_list_select_item(int list, int item);
-public static final native int gtk_main_iteration();
-public static final native void gtk_label_set_line_wrap(int label, boolean wrap);
-public static final native int gtk_label_parse_uline(int label, byte[] string);
-public static final native void gtk_label_set_text(int label, byte[] str);
-public static final native void gtk_misc_set_alignment(int misc, float xalign, float yalign);
-public static final native int gtk_menu_bar_new();
-public static final native int gtk_menu_new();
-public static final native void gtk_menu_popdown(int menu);
-public static final native void gtk_menu_popup(int menu, int parent_menu_shell, int parent_menu_item, int func, int data, int button, int activate_time);
-public static final native int gtk_menu_item_new();
-public static final native int gtk_menu_item_new_with_label(byte[] label);
-public static final native void gtk_menu_bar_insert(int menu_bar, int child, int position);
-public static final native void gtk_menu_insert(int menu, int child, int position);
-public static final native void gtk_menu_item_set_submenu(int menu_item, int submenu);
-public static final native void gtk_menu_item_remove_submenu(int menu_item);
-public static final native int gtk_notebook_new();
-public static final native void gtk_notebook_append_page(int notebook, int child, int tab_label);
-public static final native int gtk_notebook_get_current_page(int notebook);
-public static final native void gtk_object_ref(int object);
-public static final native void gtk_notebook_set_show_tabs(int notebook, boolean show_tabs);
-public static final native void gtk_notebook_remove_page(int notebook, int page_num);
-public static final native void gtk_notebook_set_page(int notebook, int page_num);
-public static final native void gtk_object_set_user_data(int object, int data);
-public static final native int gtk_object_get_user_data(int object);
-public static final native int gtk_pixmap_new(int pixmap, int mask);
-public static final native int gtk_progress_bar_new();
-public static final native void gtk_progress_bar_set_orientation(int pbar, int orientation);
-public static final native void gtk_progress_bar_set_bar_style(int pbar, int style);
-public static final native void gtk_progress_configure(int progress, float value, float min, float max);
-public static final native void gtk_pixmap_set(int pixmap, int val, int mask);
-public static final native int gtk_radio_button_new(int group);
-public static final native int gtk_radio_button_group(int radio_button);
-public static final native int gtk_radio_menu_item_new_with_label(int group, byte[] label);
-public static final native int gtk_range_get_adjustment(int range);
-public static final native int gtk_scrolled_window_new(int hadjustment, int vadjustment);
-public static final native void gtk_scale_set_digits(int scale, int digits);
-public static final native void gtk_scale_set_draw_value(int scale, boolean draw_value);
-public static final native void gtk_scale_set_value_pos(int scale, int pos);
-public static final native int gtk_scrolled_window_get_hadjustment(int scrolled_window);
-public static final native void gtk_scrolled_window_set_policy(int scrolled_window, int hscrollbar_policy, int vscrollbar_policy);
-public static final native int gtk_scrolled_window_get_vadjustment(int scrolled_window);
-public static final native int gtk_selection_convert(int widget, int selection, int target, int time);
-public static final native int gtk_signal_connect(int object, byte[] name, int func, int func_data);
-public static final native int gtk_selection_owner_set(int widget, int selection, int time);
-public static final native void gtk_signal_emit_stop_by_name(int object, byte[] name);
-public static final native void gtk_signal_handler_block_by_func(int object, int func, int data);
-public static final native void gtk_signal_handler_unblock_by_func(int object, int func, int data);
-public static final native int gtk_signal_connect_after(int object, byte[] name, int func, int func_data);
-public static final native int gtk_style_copy(int style);
-public static final native void gtk_style_unref(int style);
-public static final native int gtk_toggle_button_new();
-public static final native void gtk_toggle_button_set_active(int toggle_button, boolean is_active);
-public static final native boolean gtk_toggle_button_get_active(int toggle_button);
-public static final native int gtk_timeout_add(int interval, int function, int data);
-public static final native void gtk_timeout_remove(int timeout_handler_id);
-public static final native int gtk_text_new(int hadj, int vadj);
-public static final native void gtk_text_set_word_wrap(int text, int word_wrap);
-public static final native int gtk_text_get_length(int text);
-public static final native int gtk_toolbar_new(int orientation, int style);
-public static final native void gtk_toolbar_set_button_relief(int toolbar, int relief);
-public static final native void gtk_toolbar_insert_widget(int toolbar, int widget, byte[] tooltip_text, byte[] tooltip_private_text, int position);
-public static final native void gtk_toolbar_set_orientation(int toolbar, int orientation);
-public static final native int gtk_toolbar_insert_element(int toolbar, int type, int widget, byte[] text, byte[] tooltip_text, byte[] tooltip_private_text, int icon, int callback, int user_data, int position);
-public static final native int gtk_tooltips_new();
-public static final native int gtk_vseparator_new();
-public static final native int gtk_vbox_new(boolean homogeneous, int spacing);
-public static final native int gtk_vscale_new(int adjustment);
-public static final native int gtk_vscrollbar_new(int adjustment);
-public static final native void gtk_tooltips_set_tip(int tooltips, int widget, byte[] tip_text, byte[] tip_private);
-public static final native int gtk_widget_get_default_style();
-public static final native void gtk_widget_add_events(int widget, int events);
-public static final native void gtk_widget_destroy(int widget);
-public static final native int gtk_widget_event(int widget, int event);
-public static final native void gtk_widget_hide(int widget);
-public static final native void gtk_widget_grab_focus(int widget);
-public static final native int gtk_widget_get_style(int widget);
-public static final native void gtk_widget_add_accelerator(int widget, byte[] accel_signal, int accel_group, int accel_key, int accel_mods, int accel_flags);
-public static final native void gtk_widget_ensure_style(int widget);
-public static final native void gtk_widget_show(int widget);
-public static final native void gtk_widget_realize(int widget);
-static int malloc(String name) {
- int length = name.length();
- char [] unicode = new char [length];
- name.getChars (0, length, unicode, 0);
- byte[] buffer = new byte [length + 1];
- for (int i = 0; i < length; i++) {
- buffer[i] = (byte) unicode[i];
- }
- return OS.g_strdup (buffer);
-}
-
-public static final native void gtk_widget_show_all(int widget);
-public static final native void gtk_widget_show_now(int widget);
-public static final native void gtk_widget_queue_draw(int widget);
-public static final native void gtk_widget_set_style(int widget, int style);
-public static final native void gtk_widget_set_sensitive(int widget, boolean sensitive);
-public static final native void gtk_widget_set_state(int widget, int state);
-public static final native int gtk_window_new(int type);
-public static final native void gtk_widget_size_request(int widget, GtkRequisition requisition);
-public static final native void gtk_widget_set_uposition(int widget, int x, int y);
-public static final native void gtk_widget_set_usize(int widget, int width, int height);
-public static final native void gtk_widget_remove_accelerator(int widget, int accel_group, int accel_key, int accel_mods);
-public static final native void gtk_widget_set_parent(int widget, int parent);
-public static final native void gtk_window_add_accel_group(int window, int accel_group);
-public static final native void gtk_window_set_policy(int window, int allow_shrink, int allow_grow, int auto_shrink);
-public static final native void gtk_window_set_modal(int window, boolean modal);
-public static final native void gtk_window_set_title(int window, byte[] title);
-public static final native void gtk_window_set_transient_for(int window, int parent);
-public static final native void gtk_widget_reparent(int widget, int new_parent);
-public static final native void gtk_widget_size_allocate(int widget, GtkAllocation allocation);
-public static final native int XListFonts(byte[] pattern, int maxFonts, int[] pnum_fonts);
-public static final native void memmove(int[] dest, int src, int size);
-public static final native int strlen (int str);
-
-/* NEW MEMMOVES - doesn't work because of inheritance of natives */
-public static final native void memmove(byte[] dest, int src, int size);
-public static final native void memmove(int dest, GtkStyle src, int size);
-public static final native void memmove(GdkFont dest, int src, int size);
-public static final native void memmove(GtkStyle dest, int src, int size);
-public static final native void memmove(int[] dest, byte[] src, int size);
-public static final native void memmove(int dest, byte[] src, int size);
-public static final native void memmove(GdkColor dest, int src, int size);
-public static final native void memmove(GdkEventButton dest, int src, int size);
-public static final native void memmove(GdkEventExpose dest, int src, int size);
-public static final native void memmove(GdkEventKey dest, int src, int size);
-public static final native void memmove(GdkEventMotion dest, int src, int size);
-public static final native void memmove(int dest, int[] src, int size);
-public static final native void memmove(GdkVisual dest, int src, int size);
-public static final native void memmove(GtkAdjustment dest, int src, int size);
-public static final native void memmove(GtkBin dest, int src, int size);
-public static final native void memmove(GtkCList dest, int src, int size);
-public static final native void memmove(GtkCombo dest, int src, int size);
-public static final native void memmove(GtkContainer dest, int src, int size);
-public static final native void memmove(GtkCTreeRow dest, int src, int size);
-public static final native void memmove(GtkEditable dest, int src, int size);
-public static final native void memmove(GtkDialog dest, int src, int size);
-public static final native void memmove(GtkObject dest, int src, int size);
-public static final native void memmove(GtkWidget dest, int src, int size);
-public static final native void memmove(int dest, GtkAdjustment src, int size);
-public static final native void memmove(int dest, GtkBin src, int size);
-public static final native void memmove(int dest, GtkCListColumn src, int size);
-public static final native void memmove(GtkCListRow dest, int src, int size);
-public static final native void memmove(GtkCListColumn dest, int src, int size);
-public static final native void memmove(int dest, GtkEditable src, int size);
-public static final native void memmove(int dest, GtkText src, int size);
-public static final native void memmove(int dest, GtkObject src, int size);
-
-/* OLD MEMMOVES - these need to be pruned */
-public static final native void memmove(int dest, GdkColor src, int size);
-public static final native void memmove(int dest, GdkEventButton src, int size);
-public static final native void memmove(int dest, GdkEventExpose src, int size);
-public static final native void memmove(int dest, GdkEventKey src, int size);
-public static final native void memmove(int dest, GdkEventMotion src, int size);
-public static final native void memmove(int dest, GdkGCValues src, int size);
-public static final native void memmove(int dest, GdkRectangle src, int size);
-public static final native void memmove(int dest, GdkVisual src, int size);
-public static final native void memmove(int dest, GtkAllocation src, int size);
-//public static final native void memmove(int dest, GtkArg src, int size);
-public static final native void memmove(int dest, GtkBox src, int size);
-public static final native void memmove(int dest, GtkCList src, int size);
-public static final native void memmove(int dest, GtkCListRow src, int size);
-public static final native void memmove(int dest, GtkCTreeRow src, int size);
-public static final native void memmove(int dest, GtkCheckMenuItem src, int size);
-public static final native void memmove(int dest, GtkColorSelectionDialog src, int size);
-public static final native void memmove(int dest, GtkCombo src, int size);
-public static final native void memmove(int dest, GtkContainer src, int size);
-//public static final native void memmove(int dest, GtkData src, int size);
-public static final native void memmove(int dest, GtkFileSelection src, int size);
-public static final native void memmove(int dest, GtkFontSelectionDialog src, int size);
-public static final native void memmove(int dest, GtkHBox src, int size);
-public static final native void memmove(int dest, GtkMenuItem src, int size);
-public static final native void memmove(int dest, GtkRequisition src, int size);
-public static final native void memmove(int dest, GtkWidget src, int size);
-public static final native void memmove(int dest, GtkWindow src, int size);
-public static final native void memmove(int dest, GtkCTree src, int size);
-public static final native void memmove(GdkGCValues dest, int src, int size);
-public static final native void memmove(GdkRectangle dest, int src, int size);
-public static final native void memmove(GtkAllocation dest, int src, int size);
-//public static final native void memmove(GtkArg dest, int src, int size);
-public static final native void memmove(GtkBox dest, int src, int size);
-public static final native void memmove(GtkCheckMenuItem dest, int src, int size);
-public static final native void memmove(GtkColorSelectionDialog dest, int src, int size);
-//public static final native void memmove(GtkData dest, int src, int size);
-public static final native void memmove(GtkFrame dest, int src, int size);
-public static final native void memmove(GtkFileSelection dest, int src, int size);
-public static final native void memmove(GtkFontSelectionDialog dest, int src, int size);
-public static final native void memmove(GtkHBox dest, int src, int size);
-public static final native void memmove(GtkMenuItem dest, int src, int size);
-public static final native void memmove(GtkRequisition dest, int src, int size);
-public static final native void memmove(GtkText dest, int src, int size);
-public static final native void memmove(GtkWindow dest, int src, int size);
-public static final native void memmove(GtkCTree dest, int src, int size);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html
deleted file mode 100644
index 84bc06db42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body lang="EN-US" link="blue" vlink="purple">
-<table border="0" cellspacing="5" cellpadding="2" width="100%" >
- <tr>
- <td align="LEFT" valign="TOP" colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF">About This Plug-in Sub-directory</font></b></td>
- </tr>
- <tr>
- <td>
-<p>29th January, 2002</p>
-<h3>License</h3>
-<p>All content in this plug-in sub-directory &quot;Content&quot; is made available by Eclipse.org under the following terms and conditions:</p>
-
-<p>The following files shall be defined as the SWT:</p>
-<ul>
- <li>libswt-gtk-2024.so</li>
- <li>libswt-motif-2024.so</li>
- <li>libswt-gnome-motif-2024.so</li>
- <li>libswt-kde-motif-2024.so</li>
- <li>swt.jar</li>
-</ul>
-
-<p>The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> &quot;CPL&quot;.
-For the purposes of the CPL the term "Program" shall mean the SWT.</p>
-
-<h3>Third Party Content</h3>
-
-<p>All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ &quot;Library&quot;. GTK+ is made available
-by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
-<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> &quot;LGPL&quot;. Use of the GTK+ Binding on a standalone basis, is also governed
-by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
-
-<p>In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
-containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
-other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
-governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
-work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
-
-<h3>Contributions</h3>
-
-<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
-Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
-of the contribution for which you are the copyright holder).</p>
-</td></tr></table>
-</body>
-</html>
-
-
-
-
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html
deleted file mode 100644
index 800c7797bd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
-<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
-<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
-<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
-<BODY bgColor=#ffffff>
-<DIV align=center>
-<P>
-<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
- <TBODY>
- <TR>
- <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
- size=3>
- <H1>Common Public License Version 0.5</H1><TT>
- <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
- PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
- USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
- ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
- </B></FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Contribution"
-means:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
- Contributor, the initial code and documentation distributed under this
- Agreement, and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) in the case of each
- subsequent Contributor:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
- and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) additions to the
- Program;</FONT></P>
- <P><FONT face="Courier New, Courier, mono">where such changes and/or
- additions to the Program originate from and are distributed by that
- particular Contributor. A Contribution 'originates' from a Contributor
- if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include
- additions to the Program which: (i) are separate modules of software
- distributed in conjunction with the Program under their own license
- agreement, and (ii) are not derivative works of the
- Program.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
- or entity that distributes the Program. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
- claims licensable by a Contributor which are necessarily infringed by the
- use or sale of its Contribution alone or when combined with the
- Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Program" means the
- Contributions distributed in accordance with this Agreement. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
- receives the Program under this Agreement, including all Contributors.
- </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
- RIGHTS</B></FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free copyright license to reproduce,
- prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any,
- and such derivative works, in source code and object code
- form.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer
- the Contribution of such Contributor, if any, in source code and object
- code form. This patent license shall apply to the combination of the
- Contribution and the Program if, at the time the Contribution is added
- by the Contributor, such addition of the Contribution causes such
- combination to be covered by the Licensed Patents. The patent license
- shall not apply to any other combinations which include the
- Contribution. No hardware per se is licensed hereunder.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
- although each Contributor grants the licenses to its Contributions set
- forth herein, no assurances are provided by any Contributor that the
- Program does not infringe the patent or other intellectual property
- rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement
- of intellectual property rights or otherwise. As a condition to
- exercising the rights and licenses granted hereunder, each Recipient
- hereby assumes sole responsibility to secure any other intellectual
- property rights needed, if any. For example, if a third party patent
- license is required to allow Recipient to distribute the Program, it is
- Recipient's responsibility to acquire that license before distributing
- the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">d) Each Contributor
- represents that to its knowledge it has sufficient copyright rights in
- its Contribution, if any, to grant the copyright license set forth in
- this Agreement.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono"><STRONG>3.
- REQUIREMENTS</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
- distribute the Program in object code form under its own license
- agreement, provided that: </FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
- and conditions of this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) its license
- agreement:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
- behalf of all Contributors all warranties and conditions, express and
- implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of
- merchantability and fitness for a particular purpose; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
- behalf of all Contributors all liability for damages, including direct,
- indirect, special, incidental and consequential damages, such as lost
- profits; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iii) states that any
- provisions which differ from this Agreement are offered by that
- Contributor alone and not by any other party; and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iv) states that source code
- for the Program is available from such Contributor, and informs
- licensees how to obtain it in a reasonable manner on or through a medium
- customarily used for software exchange. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">When the Program is made
- available in source code form:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it must be made available
- under this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
- must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
- alter any copyright notices contained within the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
- itself as the originator of its Contribution, if any, in a manner that
- reasonably allows subsequent Recipients to identify the originator of the
- Contribution. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
- DISTRIBUTION</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Commercial distributors of
- software may accept certain responsibilities with respect to end users,
- business partners and the like. While this license is intended to
- facilitate the commercial use of the Program, the Contributor who includes
- the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors.
- Therefore, if a Contributor includes the Program in a commercial product
- offering, such Contributor ("Commercial Contributor") hereby agrees to
- defend and indemnify every other Contributor ("Indemnified Contributor")
- against any losses, damages and costs (collectively "Losses") arising from
- claims, lawsuits and other legal actions brought by a third party against
- the Indemnified Contributor to the extent caused by the acts or omissions
- of such Commercial Contributor in connection with its distribution of the
- Program in a commercial product offering. The obligations in this section
- do not apply to any claims or Losses relating to any actual or alleged
- intellectual property infringement. In order to qualify, an Indemnified
- Contributor must: a) promptly notify the Commercial Contributor in writing
- of such claim, and b) allow the Commercial Contributor to control, and
- cooperate with the Commercial Contributor in, the defense and any related
- settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">For example, a Contributor
- might include the Program in a commercial product offering, Product X.
- That Contributor is then a Commercial Contributor. If that Commercial
- Contributor then makes performance claims, or offers warranties related to
- Product X, those performance claims and warranties are such Commercial
- Contributor's responsibility alone. Under this section, the Commercial
- Contributor would have to defend claims against the other Contributors
- related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the
- Commercial Contributor must pay those damages. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
- WARRANTY</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
- WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- Each Recipient is solely responsible for determining the appropriateness
- of using and distributing the Program and assumes all risks associated
- with its exercise of rights under this Agreement, including but not
- limited to the risks and costs of program errors, compliance with
- applicable laws, damage to or loss of data, programs or equipment, and
- unavailability or interruption of operations. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
- LIABILITY </STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
- LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
- RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGES. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>7.
- GENERAL</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">If any provision of this
- Agreement is invalid or unenforceable under applicable law, it shall not
- affect the validity or enforceability of the remainder of the terms of
- this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
- litigation against a Contributor with respect to a patent applicable to
- software (including a cross-claim or counterclaim in a lawsuit), then any
- patent licenses granted by that Contributor to such Recipient under this
- Agreement shall terminate as of the date such litigation is filed. In
- addition, If Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the
- Program itself (excluding combinations of the Program with other software
- or hardware) infringes such Recipient's patent(s), then such Recipient's
- rights granted under Section 2(b) shall terminate as of the date such
- litigation is filed.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
- this Agreement shall terminate if it fails to comply with any of the
- material terms or conditions of this Agreement and does not cure such
- failure in a reasonable period of time after becoming aware of such
- noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this
- Agreement and any licenses granted by Recipient relating to the Program
- shall continue and survive. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
- and distribute copies of this Agreement, but in order to avoid
- inconsistency the Agreement is copyrighted and may only be modified in the
- following manner. The Agreement Steward reserves the right to publish new
- versions (including revisions) of this Agreement from time to time. No one
- other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to
- serve as the Agreement Steward to a suitable separate entity. Each new
- version of the Agreement will be given a distinguishing version number.
- The Program (including Contributions) may always be distributed subject to
- the version of the Agreement under which it was received. In addition,
- after a new version of the Agreement is published, Contributor may elect
- to distribute the Program (including its Contributions) under the new
- version. Except as expressly stated in Sections 2(a) and 2(b) above,
- Recipient receives no rights or licenses to the intellectual property of
- any Contributor under this Agreement, whether expressly, by implication,
- estoppel or otherwise. All rights in the Program not expressly granted
- under this Agreement are reserved. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
- the laws of the State of New York and the intellectual property laws of
- the United States of America. No party to this Agreement will bring a
- legal action under this Agreement more than one year after the cause of
- action arose. Each party waives its rights to a jury trial in any
- resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
-<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt
deleted file mode 100644
index 3f50d0454c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt
+++ /dev/null
@@ -1,506 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh
deleted file mode 100644
index 05e11d1cf7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/csh
-
-# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
-#
-# The contents of this file are made available under the terms
-# of the GNU Lesser General Public License (LGPL) Version 2.1 that
-# accompanies this distribution (lgpl-v21.txt). The LGPL is also
-# available at http://www.gnu.org/licenses/lgpl.html. If the version
-# of the LGPL at http://www.gnu.org is different to the version of
-# the LGPL accompanying this distribution and there is any conflict
-# between the two license versions, the terms of the LGPL accompanying
-# this distribution shall govern.
-
-# Some UNIX/Linux compilers don't like <CR>'s in files (DOS format).
-set fixup_files = `grep -l "\ " *.[ch]`
-if ( "$fixup_files" != "" ) then
- echo "Converting files from DOS to UNIX format:"
- foreach file ($fixup_files)
- echo " $file"
- ex $file << EOF >& /dev/null
-g/ \$/s///
-w
-EOF
- end
-endif
-
-# Determine the operating system being built
-
-make -f make_gtk.mak $1 $2 $3 $4
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak
deleted file mode 100644
index c3a594a2c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak
+++ /dev/null
@@ -1,134 +0,0 @@
-# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
-#
-# The contents of this file are made available under the terms
-# of the GNU Lesser General Public License (LGPL) Version 2.1 that
-# accompanies this distribution (lgpl-v21.txt). The LGPL is also
-# available at http://www.gnu.org/licenses/lgpl.html. If the version
-# of the LGPL at http://www.gnu.org is different to the version of
-# the LGPL accompanying this distribution and there is any conflict
-# between the two license versions, the terms of the LGPL accompanying
-# this distribution shall govern.
-#
-# Makefile for creating SWT libraries on Linux
-
-include make_common.mak
-
-SWT_VERSION=$(maj_ver)$(min_ver)
-
-
-# Define the installation directories for various products.
-# Your system may have these in a different place.
-# IVE_HOME - IBM's version of Java (J9)
-IVE_HOME = /bluebird/teamswt/swt-builddir/ive
-#IVE_HOME = /opt/IBMvame1.4/ive
-
-JAVA_JNI=$(IVE_HOME)/bin/include
-JAVAH=$(IVE_HOME)/bin/javah
-LD_LIBRARY_PATH=$(IVE_HOME)/bin
-
-# Define the various DLL (shared) libraries to be made.
-
-SWT_PREFIX = swt
-WS_PREFIX = gtk
-SWT_DLL = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-PI_PREFIX = swt-pi
-SWTPI_DLL = lib$(PI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-GNOME_PREFIX = swt-gnome
-GNOME_DLL = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-GNOME_LIB = -x -shared \
- -L/usr/lib \
- -lgnome -lglib \
- -lm -ldl
-
-PIXBUF_PREFIX = swt-pixbuf
-PIXBUF_DLL = lib$(PIXBUF_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-
-#
-# Target Rules
-#
-
-all: make_swt make_pixbuf # make_gnome
-
-make_swt: $(SWT_DLL) $(SWTPI_DLL)
-
-#make_gnome: $(GNOME_DLL)
-
-make_pixbuf: $(PIXBUF_DLL)
-
-
-# All about Linking
-
-$(SWT_DLL): callback.o
- ld -x -shared \
- -o $(SWT_DLL) callback.o
-
-# Note: your setup may be different. Consult `gtk-config --libs`
-$(SWTPI_DLL): swt.o structs.o
- ld -x -shared \
- -L/usr/lib -L/usr/X11R6/lib \
- -lgtk -lgdk -lgmodule -lglib \
- -ldl -lXi -lXext -lX11 -lm -lc \
- -o $(SWTPI_DLL) swt.o structs.o
-
-#$(GNOME_DLL): gnome.o
-# ld -o $@ gnome.o $(GNOME_LIB)
-
-$(PIXBUF_DLL): pixbuf.o
- ld -x -shared \
- -L/usr/lib -L/usr/X11R6/lib \
- -lgdk_pixbuf \
- -lgtk -lgdk -lgmodule -lglib \
- -ldl -lXi -lXext -lX11 -lm -lc \
- -o $(PIXBUF_DLL) pixbuf.o
-
-
-# All about Compiling
-
-SWT_C_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- `gtk-config --cflags`
-
-SWT_PIXBUF_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- -I/usr/include/gdk-pixbuf \
- `gtk-config --cflags`
-
-SWT_GNOME_FLAGS = -c -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DGTK \
- -fpic \
- -I$(JAVA_JNI) \
- `gnome-config --cflags gnome`
-
-swt.o: swt.c swt.h
- gcc $(SWT_C_FLAGS) swt.c
-
-structs.o: structs.c
- gcc $(SWT_C_FLAGS) structs.c
-
-callback.o: callback.c
- gcc $(SWT_C_FLAGS) callback.c
-
-globals.o: globals.c
- gcc $(SWT_C_FLAGS) globals.c
-
-library.o: library.c
- gcc $(SWT_C_FLAGS) library.c
-
-pixbuf.o: pixbuf.c
- gcc $(SWT_PIXBUF_FLAGS) pixbuf.c
-
-#gnome.o: gnome.c
-# gcc $(SWT_GNOME_FLAGS) gnome.c
-
-clean:
- rm -f *.o *.so
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c
deleted file mode 100644
index f624fe3577..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-#include "swt.h"
-#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_colorspace
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1colorspace
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_colorspace((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_n_channels
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1n_1channels
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_n_channels((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_has_alpha
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1has_1alpha
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jboolean) gdk_pixbuf_get_has_alpha((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_bits_per_sample
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1bits_1per_1sample
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_bits_per_sample((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_pixels
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1pixels
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_pixels((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_width
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1width
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_width((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_height
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1height
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_height((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_rowstride
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1rowstride
- (JNIEnv *env, jclass cl, jint pixbuf)
-{
- return (jint) gdk_pixbuf_get_rowstride((GdkPixbuf*)pixbuf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_new
- * Signature: (IZIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1new
- (JNIEnv *env, jclass cl,
- jint colorspace,
- jboolean hasAlpha,
- jint bpc,
- jint width, jint height)
-{
- return (jint) gdk_pixbuf_new (
- colorspace,
- (gboolean) hasAlpha,
- bpc,
- width, height
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_copy
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1copy
- (JNIEnv *env, jclass cl, jint source) {
- return (jint)gdk_pixbuf_copy ((GdkPixbuf*) source);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_render_to_drawable
- * Signature: (IIIIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable
- (JNIEnv *env, jclass cl,
- jint pixbuf,
- jint drawable,
- jint gc,
- jint src_x, jint src_y,
- jint dest_x, jint dest_y,
- jint width, jint height,
- jint dithering,
- jint x_dither, jint y_dither) {
- gdk_pixbuf_render_to_drawable (
- (GdkPixbuf*) pixbuf,
- (GdkDrawable*) drawable,
- (GdkGC*) gc,
- src_x, src_y,
- dest_x, dest_y,
- width, height,
- dithering,
- x_dither, y_dither
- );
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_render_to_drawable_alpha
- * Signature: (IIIIIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable_1alpha
- (JNIEnv *env, jclass cl,
- jint pixbuf,
- jint drawable,
- jint src_x, jint src_y, jint dest_x, jint dest_y,
- jint width, jint height,
- jint alphaMode,
- jint alphaThreshold,
- jint dithering,
- jint x_dither, jint y_dither)
-{
- gdk_pixbuf_render_to_drawable_alpha (
- (GdkPixbuf*) pixbuf,
- (GdkDrawable*) drawable,
- src_x, src_y,
- dest_x, dest_y,
- width, height,
- alphaMode,
- alphaThreshold,
- dithering,
- x_dither, y_dither
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_scale
- * Signature: (IIIIIIDDDDI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1scale
- (JNIEnv *env, jclass cl,
- jint source, jint dest,
- jint dest_x, jint dest_y,
- jint dest_width, jint dest_height,
- jdouble offset_x, jdouble offset_y,
- jdouble scale_x, jdouble scale_y,
- jint interp_type) {
- gdk_pixbuf_scale ((GdkPixbuf*)source, (GdkPixbuf*)dest,
- dest_x, dest_y,
- dest_width, dest_height,
- offset_x, offset_y,
- scale_x, scale_y,
- interp_type
- );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
- * Method: gdk_pixbuf_get_from_drawable
- * Signature: (IIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1from_1drawable
- (JNIEnv *env, jclass cl,
- jint dest, jint src, jint cmap,
- jint src_x, jint src_y,
- jint dest_x, jint dest_y,
- jint width, jint height)
-{
- gdk_pixbuf_get_from_drawable (
- (GdkPixbuf*) dest,
- (GdkDrawable*) src,
- (GdkColormap*) cmap,
- src_x, src_y,
- dest_x, dest_y,
- width, height);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c
deleted file mode 100644
index 321855b550..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c
+++ /dev/null
@@ -1,2693 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Windows structs
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Globals */
-GdkColor_FID_CACHE GdkColorFc;
-GdkEventKey_FID_CACHE GdkEventKeyFc;
-GdkEventButton_FID_CACHE GdkEventButtonFc;
-GdkEventMotion_FID_CACHE GdkEventMotionFc;
-GdkEventExpose_FID_CACHE GdkEventExposeFc;
-GdkFont_FID_CACHE GdkFontFc;
-GdkGCValues_FID_CACHE GdkGCValuesFc;
-GdkImage_FID_CACHE GdkImageFc;
-GdkPoint_FID_CACHE GdkPointFc;
-GdkRectangle_FID_CACHE GdkRectangleFc;
-GdkVisual_FID_CACHE GdkVisualFc;
-GtkObject_FID_CACHE GtkObjectFc;
-GtkData_FID_CACHE GtkDataFc;
-GtkAdjustment_FID_CACHE GtkAdjustmentFc;
-GtkAllocation_FID_CACHE GtkAllocationFc;
-GtkWidget_FID_CACHE GtkWidgetFc;
-GtkContainer_FID_CACHE GtkContainerFc;
-GtkBin_FID_CACHE GtkBinFc;
-GtkMenu_FID_CACHE GtkMenuFc;
-GtkItem_FID_CACHE GtkItemFc;
-GtkMenuShell_FID_CACHE GtkMenuShellFc;
-GtkMenuItem_FID_CACHE GtkMenuItemFc;
-GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
-GtkWindow_FID_CACHE GtkWindowFc;
-GtkDialog_FID_CACHE GtkDialogFc;
-GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
-GtkBox_FID_CACHE GtkBoxFc;
-GtkHBox_FID_CACHE GtkHBoxFc;
-GtkCombo_FID_CACHE GtkComboFc;
-GtkFileSelection_FID_CACHE GtkFileSelectionFc;
-GtkFrame_FID_CACHE GtkFrameFc;
-GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
-GtkCList_FID_CACHE GtkCListFc;
-GtkEditable_FID_CACHE GtkEditableFc;
-GtkText_FID_CACHE GtkTextFc;
-GtkProgress_FID_CACHE GtkProgressFc;
-GtkProgressBar_FID_CACHE GtkProgressBarFc;
-GtkArg_FID_CACHE GtkArgFc;
-GtkRequisition_FID_CACHE GtkRequisitionFc;
-GtkStyle_FID_CACHE GtkStyleFc;
-GtkStyleClass_FID_CACHE GtkStyleClassFc;
-GtkCListRow_FID_CACHE GtkCListRowFc;
-GtkCListColumn_FID_CACHE GtkCListColumnFc;
-GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
-GtkCTree_FID_CACHE GtkCTreeFc;
-
-/* ----------- fid and class caches ----------- */
-/*
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkColorClass = (*env)->GetObjectClass(env, lpGdkColor);
-
- lpCache->pixel = (*env)->GetFieldID(env, lpCache->GdkColorClass, "pixel", "I");
- lpCache->red = (*env)->GetFieldID(env, lpCache->GdkColorClass, "red", "S");
- lpCache->green = (*env)->GetFieldID(env, lpCache->GdkColorClass, "green", "S");
- lpCache->blue = (*env)->GetFieldID(env, lpCache->GdkColorClass, "blue", "S");
- lpCache->cached = 1;
-};
-
-void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventKeyClass = (*env)->GetObjectClass(env, lpGdkEventKey);
-
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "time", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "state", "I");
- lpCache->keyval = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "keyval", "I");
- lpCache->length = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "length", "I");
- lpCache->string = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "string", "I");
- lpCache->cached = 1;
-};
-
-void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventButtonClass = (*env)->GetObjectClass(env, lpGdkEventButton);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "time", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x", "J");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y", "J");
- lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "pressure", "J");
- lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "xtilt", "J");
- lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "ytilt", "J");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "state", "I");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "button", "I");
- lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "source", "I");
- lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "deviceid", "I");
- lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x_root", "J");
- lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y_root", "J");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventMotionClass = (*env)->GetObjectClass(env, lpGdkEventMotion);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "send_event", "B");
- lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "time", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x", "J");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y", "J");
- lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "pressure", "J");
- lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "xtilt", "J");
- lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "ytilt", "J");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "state", "I");
- lpCache->is_hint = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "is_hint", "I");
- lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "source", "I");
- lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "deviceid", "I");
- lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x_root", "J");
- lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y_root", "J");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkEventExposeClass = (*env)->GetObjectClass(env, lpGdkEventExpose);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "type", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "window", "I");
- lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "send_event", "B");
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "height", "S");
- lpCache->count = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "count", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkFontClass = (*env)->GetObjectClass(env, lpGdkFont);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkFontClass, "type", "I");
- lpCache->ascent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "ascent", "I");
- lpCache->descent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "descent", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkGCValuesClass = (*env)->GetObjectClass(env, lpGdkGCValues);
-
- lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_pixel", "I");
- lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_red", "S");
- lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_green", "S");
- lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_blue", "S");
- lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_pixel", "I");
- lpCache->background_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_red", "S");
- lpCache->background_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_green", "S");
- lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_blue", "S");
- lpCache->font = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "font", "I");
- lpCache->function = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "function", "I");
- lpCache->fill = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "fill", "I");
- lpCache->tile = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "tile", "I");
- lpCache->stipple = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "stipple", "I");
- lpCache->clip_mask = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_mask", "I");
- lpCache->subwindow_mode = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "subwindow_mode", "I");
- lpCache->ts_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_x_origin", "I");
- lpCache->ts_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_y_origin", "I");
- lpCache->clip_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_x_origin", "I");
- lpCache->clip_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_y_origin", "I");
- lpCache->graphics_exposures = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "graphics_exposures", "I");
- lpCache->line_width = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_width", "I");
- lpCache->line_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_style", "I");
- lpCache->cap_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "cap_style", "I");
- lpCache->join_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "join_style", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkImageClass = (*env)->GetObjectClass(env, lpGdkImage);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkImageClass, "type", "I");
- lpCache->visual = (*env)->GetFieldID(env, lpCache->GdkImageClass, "visual", "I");
- lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkImageClass, "byte_order", "I");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkImageClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkImageClass, "height", "S");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkImageClass, "depth", "S");
- lpCache->bpp = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpp", "S");
- lpCache->bpl = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpl", "S");
- lpCache->mem = (*env)->GetFieldID(env, lpCache->GdkImageClass, "mem", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkPointClass = (*env)->GetObjectClass(env, lpGdkPoint);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkPointClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkPointClass, "y", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkRectangleClass = (*env)->GetObjectClass(env, lpGdkRectangle);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GdkVisualClass = (*env)->GetObjectClass(env, lpGdkVisual);
- lpCache->type = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "type", "I");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "depth", "I");
- lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "byte_order", "I");
- lpCache->colormap_size = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "colormap_size", "I");
- lpCache->bits_per_rgb = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "bits_per_rgb", "I");
- lpCache->red_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_mask", "I");
- lpCache->red_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_shift", "I");
- lpCache->red_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_prec", "I");
- lpCache->green_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_mask", "I");
- lpCache->green_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_shift", "I");
- lpCache->green_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_prec", "I");
- lpCache->blue_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_mask", "I");
- lpCache->blue_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_shift", "I");
- lpCache->blue_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_prec", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkAllocationClass = (*env)->GetObjectClass(env, lpGtkAllocation);
- lpCache->x = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "y", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkArgClass = (*env)->GetObjectClass(env, lpGtkArg);
-
- fprintf(stderr, "WARNING: Unimplemented method cacheGtkArgFids.\n");
- lpCache->cached = 1;
-};
-
-void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkBinClass = (*env)->GetObjectClass(env, lpGtkBin);
- cacheGtkContainerFids(env, lpGtkBin, &PGLOB(GtkContainerFc));
- lpCache->child = (*env)->GetFieldID(env, lpCache->GtkBinClass, "child", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCListClass = (*env)->GetObjectClass(env, lpGtkCList);
- cacheGtkContainerFids(env, lpGtkCList, &PGLOB(GtkContainerFc));
- lpCache->clist_flags = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_flags", "S");
- lpCache->row_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_mem_chunk", "I");
- lpCache->cell_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cell_mem_chunk", "I");
- lpCache->freeze_count = (*env)->GetFieldID(env, lpCache->GtkCListClass, "freeze_count", "I");
- lpCache->internal_allocation_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_x", "S");
- lpCache->internal_allocation_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_y", "S");
- lpCache->internal_allocation_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_width", "S");
- lpCache->internal_allocation_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_height", "S");
- lpCache->rows = (*env)->GetFieldID(env, lpCache->GtkCListClass, "rows", "I");
- lpCache->row_center_offset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_center_offset", "I");
- lpCache->row_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_height", "I");
- lpCache->row_list = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list", "I");
- lpCache->row_list_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list_end", "I");
- lpCache->columns = (*env)->GetFieldID(env, lpCache->GtkCListClass, "columns", "I");
- lpCache->column_title_area_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_x", "S");
- lpCache->column_title_area_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_y", "S");
- lpCache->column_title_area_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_width", "S");
- lpCache->column_title_area_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_height", "S");
- lpCache->title_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "title_window", "I");
- lpCache->column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column", "I");
- lpCache->clist_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window", "I");
- lpCache->clist_window_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_width", "I");
- lpCache->clist_window_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_height", "I");
- lpCache->hoffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hoffset", "I");
- lpCache->voffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "voffset", "I");
- lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "shadow_type", "I");
- lpCache->selection_mode = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_mode", "I");
- lpCache->selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection", "I");
- lpCache->selection_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_end", "I");
- lpCache->undo_selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_selection", "I");
- lpCache->undo_unselection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_unselection", "I");
- lpCache->undo_anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_anchor", "I");
- lpCache->button_actions0 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions0", "B");
- lpCache->button_actions1 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions1", "B");
- lpCache->button_actions2 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions2", "B");
- lpCache->button_actions3 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions3", "B");
- lpCache->button_actions4 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions4", "B");
- lpCache->drag_button = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_button", "B");
- lpCache->click_cell_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_row", "I");
- lpCache->click_cell_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_column", "I");
- lpCache->hadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hadjustment", "I");
- lpCache->vadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vadjustment", "I");
- lpCache->xor_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "xor_gc", "I");
- lpCache->fg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "fg_gc", "I");
- lpCache->bg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "bg_gc", "I");
- lpCache->cursor_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cursor_drag", "I");
- lpCache->x_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "x_drag", "I");
- lpCache->focus_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "focus_row", "I");
- lpCache->anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor", "I");
- lpCache->anchor_state = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor_state", "I");
- lpCache->drag_pos = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_pos", "I");
- lpCache->htimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "htimer", "I");
- lpCache->vtimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vtimer", "I");
- lpCache->sort_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_type", "I");
- lpCache->compare = (*env)->GetFieldID(env, lpCache->GtkCListClass, "compare", "I");
- lpCache->sort_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_column", "I");
-
- lpCache->cached = 1;
-};
-
-
-void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkColorSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkColorSelectionDialog);
- cacheGtkWindowFids(env, lpGtkColorSelectionDialog, &PGLOB(GtkWindowFc));
- lpCache->colorsel = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "colorsel", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "main_vbox", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "ok_button", "I");
- lpCache->reset_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "reset_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "cancel_button", "I");
- lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "help_button", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkComboClass = (*env)->GetObjectClass(env, lpGtkCombo);
- cacheGtkHBoxFids(env, lpGtkCombo, &PGLOB(GtkHBoxFc));
- lpCache->entry = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry", "I");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "button", "I");
- lpCache->popup = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popup", "I");
- lpCache->popwin = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popwin", "I");
- lpCache->list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list", "I");
- lpCache->entry_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry_change_id", "I");
- lpCache->list_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list_change_id", "I");
- lpCache->value_in_list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "value_in_list", "I");
- lpCache->ok_if_empty = (*env)->GetFieldID(env, lpCache->GtkComboClass, "ok_if_empty", "I");
- lpCache->case_sensitive = (*env)->GetFieldID(env, lpCache->GtkComboClass, "case_sensitive", "I");
- lpCache->use_arrows = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows", "I");
- lpCache->use_arrows_always = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows_always", "I");
- lpCache->current_button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "current_button", "S");
- lpCache->activate_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "activate_id", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkContainerClass = (*env)->GetObjectClass(env, lpGtkContainer);
- cacheGtkWidgetFids(env, lpGtkContainer, &PGLOB(GtkWidgetFc));
- lpCache->focus_child = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "focus_child", "I");
- lpCache->border_width = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "border_width", "I");
- lpCache->need_resize = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "need_resize", "I");
- lpCache->resize_mode = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_mode", "I");
- lpCache->resize_widgets = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_widgets", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkDataClass = (*env)->GetObjectClass(env, lpGtkData);
- cacheGtkObjectFids(env, lpGtkData, &PGLOB(GtkObjectFc));
-
- lpCache->cached = 1;
-};
-
-void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkEditableClass = (*env)->GetObjectClass(env, lpGtkEditable);
- cacheGtkWidgetFids(env, lpGtkEditable, &PGLOB(GtkWidgetFc));
- lpCache->current_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "current_pos", "I");
- lpCache->selection_start_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_start_pos", "I");
- lpCache->selection_end_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_end_pos", "I");
- lpCache->has_selection = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "has_selection", "I");
- lpCache->editable = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "editable", "I");
- lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "visible", "I");
- lpCache->ic = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic", "I");
- lpCache->ic_attr = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic_attr", "I");
- lpCache->clipboard_text = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "clipboard_text", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkTextClass = (*env)->GetObjectClass(env, lpGtkText);
- cacheGtkEditableFids(env, lpGtkText, &PGLOB(GtkEditableFc));
-
- lpCache->first_line_start_index = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_line_start_index", "I");
- lpCache->first_onscreen_hor_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_hor_pixel", "I");
- lpCache->first_onscreen_ver_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_ver_pixel", "I");
- lpCache->default_tab_width = (*env)->GetFieldID(env, lpCache->GtkTextClass, "default_tab_width", "I");
- lpCache->cursor_pos_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_x", "I");
- lpCache->cursor_pos_y = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_y", "I");
- lpCache->cursor_virtual_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_virtual_x", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFileSelectionClass = (*env)->GetObjectClass(env, lpGtkFileSelection);
- cacheGtkWindowFids(env, lpGtkFileSelection, &PGLOB(GtkWindowFc));
- lpCache->dir_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "dir_list", "I");
- lpCache->file_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "file_list", "I");
- lpCache->selection_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_entry", "I");
- lpCache->selection_text = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_text", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "main_vbox", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "ok_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cancel_button", "I");
- lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "help_button", "I");
- lpCache->history_pulldown = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_pulldown", "I");
- lpCache->history_menu = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_menu", "I");
- lpCache->history_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_list", "I");
- lpCache->fileop_dialog = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_dialog", "I");
- lpCache->fileop_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_entry", "I");
- lpCache->fileop_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_file", "I");
- lpCache->cmpl_state = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cmpl_state", "I");
- lpCache->fileop_c_dir = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_c_dir", "I");
- lpCache->fileop_del_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_del_file", "I");
- lpCache->fileop_ren_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_ren_file", "I");
- lpCache->button_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "button_area", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "action_area", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFontSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkFontSelectionDialog);
- cacheGtkWindowFids(env, lpGtkFontSelectionDialog, &PGLOB(GtkWindowFc));
- lpCache->fontsel = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "fontsel", "I");
- lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "main_vbox", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "action_area", "I");
- lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "ok_button", "I");
- lpCache->apply_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "apply_button", "I");
- lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "cancel_button", "I");
- lpCache->dialog_width = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "dialog_width", "I");
- lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "auto_resize", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkObjectClass = (*env)->GetObjectClass(env, lpGtkObject);
- lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "klass", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "flags", "I");
- lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "ref_count", "I");
- lpCache->object_data = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "object_data", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkProgressClass = (*env)->GetObjectClass(env, lpGtkProgress);
-
- fprintf(stderr, "WARNING: Unimplemented method cacheGtkProgressFids.\n");
- lpCache->cached = 1;
-};
-
-void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkProgressBarClass = (*env)->GetObjectClass(env, lpGtkProgressBar);
- cacheGtkProgressFids(env, lpGtkProgressBar, &PGLOB(GtkProgressFc));
- lpCache->bar_style = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "bar_style", "I");
- lpCache->orientation = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "orientation", "I");
- lpCache->blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "blocks", "I");
- lpCache->in_block = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "in_block", "I");
- lpCache->activity_pos = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_pos", "I");
- lpCache->activity_step = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_step", "I");
- lpCache->activity_blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_blocks", "I");
- lpCache->activity_dir = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_dir", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkRequisitionClass = (*env)->GetObjectClass(env, lpGtkRequisition);
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "width", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "height", "S");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkStyleClazz = (*env)->GetObjectClass(env, lpGtkStyle);
- lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "klass", "I");
- lpCache->fg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_pixel", "I");
- lpCache->fg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_red", "S");
- lpCache->fg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_green", "S");
- lpCache->fg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_blue", "S");
- lpCache->fg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_pixel", "I");
- lpCache->fg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_red", "S");
- lpCache->fg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_green", "S");
- lpCache->fg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_blue", "S");
- lpCache->fg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_pixel", "I");
- lpCache->fg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_red", "S");
- lpCache->fg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_green", "S");
- lpCache->fg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_blue", "S");
- lpCache->fg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_pixel", "I");
- lpCache->fg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_red", "S");
- lpCache->fg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_green", "S");
- lpCache->fg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_blue", "S");
- lpCache->fg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_pixel", "I");
- lpCache->fg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_red", "S");
- lpCache->fg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_green", "S");
- lpCache->fg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_blue", "S");
- lpCache->bg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_pixel", "I");
- lpCache->bg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_red", "S");
- lpCache->bg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_green", "S");
- lpCache->bg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_blue", "S");
- lpCache->bg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_pixel", "I");
- lpCache->bg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_red", "S");
- lpCache->bg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_green", "S");
- lpCache->bg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_blue", "S");
- lpCache->bg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_pixel", "I");
- lpCache->bg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_red", "S");
- lpCache->bg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_green", "S");
- lpCache->bg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_blue", "S");
- lpCache->bg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_pixel", "I");
- lpCache->bg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_red", "S");
- lpCache->bg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_green", "S");
- lpCache->bg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_blue", "S");
- lpCache->bg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_pixel", "I");
- lpCache->bg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_red", "S");
- lpCache->bg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_green", "S");
- lpCache->bg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_blue", "S");
- lpCache->light0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_pixel", "I");
- lpCache->light0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_red", "S");
- lpCache->light0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_green", "S");
- lpCache->light0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_blue", "S");
- lpCache->light1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_pixel", "I");
- lpCache->light1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_red", "S");
- lpCache->light1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_green", "S");
- lpCache->light1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_blue", "S");
- lpCache->light2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_pixel", "I");
- lpCache->light2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_red", "S");
- lpCache->light2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_green", "S");
- lpCache->light2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_blue", "S");
- lpCache->light3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_pixel", "I");
- lpCache->light3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_red", "S");
- lpCache->light3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_green", "S");
- lpCache->light3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_blue", "S");
- lpCache->light4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_pixel", "I");
- lpCache->light4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_red", "S");
- lpCache->light4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_green", "S");
- lpCache->light4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_blue", "S");
- lpCache->dark0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_pixel", "I");
- lpCache->dark0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_red", "S");
- lpCache->dark0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_green", "S");
- lpCache->dark0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_blue", "S");
- lpCache->dark1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_pixel", "I");
- lpCache->dark1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_red", "S");
- lpCache->dark1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_green", "S");
- lpCache->dark1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_blue", "S");
- lpCache->dark2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_pixel", "I");
- lpCache->dark2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_red", "S");
- lpCache->dark2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_green", "S");
- lpCache->dark2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_blue", "S");
- lpCache->dark3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_pixel", "I");
- lpCache->dark3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_red", "S");
- lpCache->dark3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_green", "S");
- lpCache->dark3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_blue", "S");
- lpCache->dark4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_pixel", "I");
- lpCache->dark4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_red", "S");
- lpCache->dark4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_green", "S");
- lpCache->dark4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_blue", "S");
- lpCache->mid0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_pixel", "I");
- lpCache->mid0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_red", "S");
- lpCache->mid0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_green", "S");
- lpCache->mid0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_blue", "S");
- lpCache->mid1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_pixel", "I");
- lpCache->mid1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_red", "S");
- lpCache->mid1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_green", "S");
- lpCache->mid1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_blue", "S");
- lpCache->mid2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_pixel", "I");
- lpCache->mid2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_red", "S");
- lpCache->mid2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_green", "S");
- lpCache->mid2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_blue", "S");
- lpCache->mid3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_pixel", "I");
- lpCache->mid3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_red", "S");
- lpCache->mid3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_green", "S");
- lpCache->mid3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_blue", "S");
- lpCache->mid4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_pixel", "I");
- lpCache->mid4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_red", "S");
- lpCache->mid4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_green", "S");
- lpCache->mid4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_blue", "S");
- lpCache->text0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_pixel", "I");
- lpCache->text0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_red", "S");
- lpCache->text0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_green", "S");
- lpCache->text0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_blue", "S");
- lpCache->text1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_pixel", "I");
- lpCache->text1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_red", "S");
- lpCache->text1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_green", "S");
- lpCache->text1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_blue", "S");
- lpCache->text2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_pixel", "I");
- lpCache->text2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_red", "S");
- lpCache->text2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_green", "S");
- lpCache->text2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_blue", "S");
- lpCache->text3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_pixel", "I");
- lpCache->text3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_red", "S");
- lpCache->text3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_green", "S");
- lpCache->text3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_blue", "S");
- lpCache->text4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_pixel", "I");
- lpCache->text4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_red", "S");
- lpCache->text4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_green", "S");
- lpCache->text4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_blue", "S");
- lpCache->base0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_pixel", "I");
- lpCache->base0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_red", "S");
- lpCache->base0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_green", "S");
- lpCache->base0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_blue", "S");
- lpCache->base1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_pixel", "I");
- lpCache->base1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_red", "S");
- lpCache->base1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_green", "S");
- lpCache->base1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_blue", "S");
- lpCache->base2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_pixel", "I");
- lpCache->base2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_red", "S");
- lpCache->base2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_green", "S");
- lpCache->base2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_blue", "S");
- lpCache->base3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_pixel", "I");
- lpCache->base3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_red", "S");
- lpCache->base3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_green", "S");
- lpCache->base3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_blue", "S");
- lpCache->base4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_pixel", "I");
- lpCache->base4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_red", "S");
- lpCache->base4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_green", "S");
- lpCache->base4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_blue", "S");
- lpCache->black_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_pixel", "I");
- lpCache->black_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_red", "S");
- lpCache->black_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_green", "S");
- lpCache->black_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_blue", "S");
- lpCache->white_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_pixel", "I");
- lpCache->white_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_red", "S");
- lpCache->white_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_green", "S");
- lpCache->white_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_blue", "S");
- lpCache->font = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "font", "I");
- lpCache->fg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc0", "I");
- lpCache->fg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc1", "I");
- lpCache->fg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc2", "I");
- lpCache->fg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc3", "I");
- lpCache->fg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc4", "I");
- lpCache->bg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc0", "I");
- lpCache->bg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc1", "I");
- lpCache->bg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc2", "I");
- lpCache->bg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc3", "I");
- lpCache->bg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc4", "I");
- lpCache->light_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc0", "I");
- lpCache->light_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc1", "I");
- lpCache->light_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc2", "I");
- lpCache->light_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc3", "I");
- lpCache->light_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc4", "I");
- lpCache->dark_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc0", "I");
- lpCache->dark_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc1", "I");
- lpCache->dark_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc2", "I");
- lpCache->dark_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc3", "I");
- lpCache->dark_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc4", "I");
- lpCache->mid_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc0", "I");
- lpCache->mid_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc1", "I");
- lpCache->mid_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc2", "I");
- lpCache->mid_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc3", "I");
- lpCache->mid_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc4", "I");
- lpCache->text_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc0", "I");
- lpCache->text_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc1", "I");
- lpCache->text_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc2", "I");
- lpCache->text_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc3", "I");
- lpCache->text_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc4", "I");
- lpCache->base_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc0", "I");
- lpCache->base_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc1", "I");
- lpCache->base_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc2", "I");
- lpCache->base_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc3", "I");
- lpCache->base_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc4", "I");
- lpCache->black_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_gc", "I");
- lpCache->white_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_gc", "I");
- lpCache->bg_pixmap0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap0", "I");
- lpCache->bg_pixmap1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap1", "I");
- lpCache->bg_pixmap2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap2", "I");
- lpCache->bg_pixmap3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap3", "I");
- lpCache->bg_pixmap4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap4", "I");
- lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "ref_count", "I");
- lpCache->attach_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "attach_count", "I");
- lpCache->depth = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "depth", "I");
- lpCache->colormap = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "colormap", "I");
- lpCache->engine = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine", "I");
- lpCache->engine_data = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine_data", "I");
- lpCache->rc_style = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "rc_style", "I");
- lpCache->styles = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "styles", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkStyleClassClazz = (*env)->GetObjectClass(env, lpGtkStyleClass);
- lpCache->xthickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "xthickness", "I");
- lpCache->ythickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "ythickness", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkWidgetClass = (*env)->GetObjectClass(env, lpGtkWidget);
- cacheGtkObjectFids(env, lpGtkWidget, &PGLOB(GtkObjectFc));
- lpCache->private_flags = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "private_flags", "S");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "state", "B");
- lpCache->saved_state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "saved_state", "B");
- lpCache->name = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "name", "I");
- lpCache->style = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "style", "I");
- lpCache->req_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_width", "S");
- lpCache->req_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_height", "S");
- lpCache->alloc_x = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_x", "S");
- lpCache->alloc_y = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_y", "S");
- lpCache->alloc_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_width", "S");
- lpCache->alloc_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_height", "S");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "window", "I");
- lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "parent", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkFrameFids(JNIEnv *env, jobject lpGtkFrame, PGtkFrame_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkFrameClass = (*env)->GetObjectClass(env, lpGtkFrame);
- cacheGtkBinFids(env, lpGtkFrame, &PGLOB(GtkBinFc));
- lpCache->label = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label", "I");
- lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "shadow_type", "S");
- lpCache->label_width = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_width", "S");
- lpCache->label_height = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_height", "S");
- lpCache->label_xalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_xalign", "F");
- lpCache->label_yalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_yalign", "F");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkWindowClass = (*env)->GetObjectClass(env, lpGtkWindow);
- cacheGtkBinFids(env, lpGtkWindow, &PGLOB(GtkBinFc));
- lpCache->title = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "title", "I");
- lpCache->wmclass_name = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_name", "I");
- lpCache->wmclass_class = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_class", "I");
- lpCache->type = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "type", "I");
- lpCache->focus_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "focus_widget", "I");
- lpCache->default_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "default_widget", "I");
- lpCache->transient_parent = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "transient_parent", "I");
- lpCache->resize_count = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "resize_count", "S");
- lpCache->allow_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_shrink", "I");
- lpCache->allow_grow = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_grow", "I");
- lpCache->auto_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "auto_shrink", "I");
- lpCache->handling_resize = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "handling_resize", "I");
- lpCache->position = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "position", "I");
- lpCache->use_uposition = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "use_uposition", "I");
- lpCache->modal = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "modal", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkDialogFids(JNIEnv *env, jobject lpGtkDialog, PGtkDialog_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkDialogClass = (*env)->GetObjectClass(env, lpGtkDialog);
- cacheGtkWindowFids(env, lpGtkDialog, &PGLOB(GtkWindowFc));
- lpCache->vbox = (*env)->GetFieldID(env, lpCache->GtkDialogClass, "vbox", "I");
- lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkDialogClass, "action_area", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCheckMenuItemClass = (*env)->GetObjectClass(env, lpGtkCheckMenuItem);
- cacheGtkMenuItemFids(env, lpGtkCheckMenuItem, &PGLOB(GtkMenuItemFc));
- lpCache->active = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "active", "I");
- lpCache->always_show_toggle = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "always_show_toggle", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkAdjustmentClass = (*env)->GetObjectClass(env, lpGtkAdjustment);
- cacheGtkDataFids(env, lpGtkAdjustment, &PGLOB(GtkDataFc));
- lpCache->lower = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "lower", "F");
- lpCache->upper = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "upper", "F");
- lpCache->value = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "value", "F");
- lpCache->step_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "step_increment", "F");
- lpCache->page_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_increment", "F");
- lpCache->page_size = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_size", "F");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkBoxClass = (*env)->GetObjectClass(env, lpGtkBox);
- cacheGtkContainerFids(env, lpGtkBox, &PGLOB(GtkContainerFc));
- lpCache->children = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "children", "I");
- lpCache->spacing = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "spacing", "S");
- lpCache->homogeneous = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "homogeneous", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkHBoxClass = (*env)->GetObjectClass(env, lpGtkHBox);
- cacheGtkBoxFids(env, lpGtkHBox, &PGLOB(GtkBoxFc));
-
- lpCache->cached = 1;
-};
-
-void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuClass = (*env)->GetObjectClass(env, lpGtkMenu);
- cacheGtkMenuShellFids(env, lpGtkMenu, &PGLOB(GtkMenuShellFc));
- lpCache->parent_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "parent_menu_item", "I");
- lpCache->old_active_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "old_active_menu_item", "I");
- lpCache->accel_group = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "accel_group", "I");
- lpCache->position_func = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func", "I");
- lpCache->position_func_data = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func_data", "I");
- lpCache->toplevel = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "toplevel", "I");
- lpCache->tearoff_window = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "tearoff_window", "I");
- lpCache->torn_off = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "torn_off", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuShellClass = (*env)->GetObjectClass(env, lpGtkMenuShell);
- cacheGtkContainerFids(env, lpGtkMenuShell, &PGLOB(GtkContainerFc));
- lpCache->active = (*env)->GetFieldID(env, lpCache->GtkMenuShellClass, "active", "I");
- lpCache->cached = 1;
-
-};
-
-void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkItemClass = (*env)->GetObjectClass(env, lpGtkItem);
- cacheGtkBinFids(env, lpGtkItem, &PGLOB(GtkBinFc));
-
- lpCache->cached = 1;
-}
-
-void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkMenuItemClass = (*env)->GetObjectClass(env, lpGtkMenuItem);
- cacheGtkItemFids(env, lpGtkMenuItem, &PGLOB(GtkItemFc));
- lpCache->submenu = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu", "I");
- lpCache->accelerator_signal = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_signal", "I");
- lpCache->toggle_size = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "toggle_size", "I");
- lpCache->accelerator_width = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_width", "I");
- lpCache->show_toggle_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_toggle_indicator", "I");
- lpCache->show_submenu_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_submenu_indicator", "I");
- lpCache->submenu_placement = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_placement", "I");
- lpCache->submenu_direction = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_direction", "I");
- lpCache->right_justify = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "right_justify", "I");
- lpCache->timer = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "timer", "I");
-
- lpCache->cached = 1;
-};
-
-void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkCListRowClass = (*env)->GetObjectClass(env, lpGtkCListRow);
- lpCache->cell = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "cell", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "state", "I");
- lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_red", "S");
- lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_green", "S");
- lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_blue", "S");
- lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_pixel", "I");
- lpCache->background_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_red", "S");
- lpCache->background_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_green", "S");
- lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_blue", "S");
- lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_pixel", "I");
- lpCache->style = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "style", "I");
- lpCache->data = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "data", "I");
- lpCache->destroy = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "destroy", "I");
- lpCache->fg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "fg_set", "I");
- lpCache->bg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "bg_set", "I");
- lpCache->selectable = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "selectable", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->GtkCListColumnClass = (*env)->GetObjectClass(env, lpGtkCListColumn);
- lpCache->title = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "title", "I");
- lpCache->area_x = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_x", "S");
- lpCache->area_y = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_y", "S");
- lpCache->area_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_width", "S");
- lpCache->area_height = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_height", "S");
- lpCache->button = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button", "I");
- lpCache->window = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "window", "I");
- lpCache->width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width", "I");
- lpCache->min_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "min_width", "I");
- lpCache->max_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "max_width", "I");
- lpCache->justification = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "justification", "I");
- lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "visible", "I");
- lpCache->width_set = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width_set", "I");
- lpCache->resizeable = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "resizeable", "I");
- lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "auto_resize", "I");
- lpCache->button_passive = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button_passive", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCTreeClass = (*env)->GetObjectClass(env, lpGtkCTree);
- cacheGtkCListFids(env, lpGtkCTree, &PGLOB(GtkCListFc));
- lpCache->tree_indent = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_indent", "I");
- lpCache->tree_column = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_column", "I");
-
- lpCache->cached = 1;
-}
-
-void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
- if (lpCache->cached) return;
-
- lpCache->GtkCTreeRowClass = (*env)->GetObjectClass(env, lpGtkCTreeRow);
- cacheGtkCListRowFids(env, lpGtkCTreeRow, &PGLOB(GtkCListRowFc));
- lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "parent", "I");
- lpCache->sibling = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "sibling", "I");
- lpCache->children = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "children", "I");
- lpCache->pixmap_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_closed", "I");
- lpCache->mask_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_closed", "I");
- lpCache->pixmap_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_opened", "I");
- lpCache->mask_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_opened", "I");
- lpCache->level = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "level", "S");
- lpCache->is_leaf = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "is_leaf", "I");
- lpCache->expanded = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "expanded", "I");
-
- lpCache->cached = 1;
-}
-
-/* ----------- swt getters and setters ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- */
-void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
-{
- lpGdkColor->pixel = (*env)->GetIntField(env, lpObject, lpGdkColorFc->pixel);
- lpGdkColor->red = (*env)->GetShortField(env, lpObject, lpGdkColorFc->red);
- lpGdkColor->green = (*env)->GetShortField(env, lpObject, lpGdkColorFc->green);
- lpGdkColor->blue = (*env)->GetShortField(env, lpObject, lpGdkColorFc->blue);
-}
-
-void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkColorFc->pixel, (jint)lpGdkColor->pixel);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->red, (jshort)lpGdkColor->red);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->green, (jshort)lpGdkColor->green);
- (*env)->SetShortField(env, lpObject, lpGdkColorFc->blue, (jshort)lpGdkColor->blue);
-}
-
-void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
-{
- GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
- lpGdkEventKey->type = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->type);
- lpGdkEventKey->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->window);
- lpGdkEventKey->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventKeyFc->send_event);
- lpGdkEventKey->time = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->time);
- lpGdkEventKey->state = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->state);
- lpGdkEventKey->keyval = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->keyval);
- lpGdkEventKey->length = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->length);
- lpGdkEventKey->string = (char*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->string);
-}
-
-void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
-{
- GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->type, (jint)lpGdkEventKey->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->window, (jint)lpGdkEventKey->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventKeyFc->send_event, (jbyte)lpGdkEventKey->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->time, (jint)lpGdkEventKey->time);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->state, (jint)lpGdkEventKey->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->keyval, (jint)lpGdkEventKey->keyval);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->length, (jint)lpGdkEventKey->length);
- (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->string, (jint)lpGdkEventKey->string);
-}
-
-void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
-{
- GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
- lpGdkEventButton->type = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->type);
- lpGdkEventButton->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->window);
- lpGdkEventButton->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventButtonFc->send_event);
- lpGdkEventButton->time = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->time);
- lpGdkEventButton->x = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x);
- lpGdkEventButton->y = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y);
- lpGdkEventButton->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->pressure);
- lpGdkEventButton->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->xtilt);
- lpGdkEventButton->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->ytilt);
- lpGdkEventButton->state = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->state);
- lpGdkEventButton->button = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->button);
- lpGdkEventButton->source = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->source);
- lpGdkEventButton->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->deviceid);
- lpGdkEventButton->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x_root);
- lpGdkEventButton->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y_root);
-}
-
-void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
-{
- GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->type, (jint)lpGdkEventButton->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->window, (jint)lpGdkEventButton->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventButtonFc->send_event, (jbyte)lpGdkEventButton->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->time, (jint)lpGdkEventButton->time);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x, (jlong)lpGdkEventButton->x);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y, (jlong)lpGdkEventButton->y);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->pressure, (jlong)lpGdkEventButton->pressure);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->xtilt, (jlong)lpGdkEventButton->xtilt);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->ytilt, (jlong)lpGdkEventButton->ytilt);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->state, (jint)lpGdkEventButton->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->button, (jint)lpGdkEventButton->button);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->source, (jint)lpGdkEventButton->source);
- (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->deviceid, (jint)lpGdkEventButton->deviceid);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x_root, (jlong)lpGdkEventButton->x_root);
- (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y_root, (jlong)lpGdkEventButton->y_root);
-}
-
-void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
-{
- GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
- lpGdkEventMotion->type = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->type);
- lpGdkEventMotion->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->window);
- lpGdkEventMotion->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventMotionFc->send_event);
- lpGdkEventMotion->time = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->time);
- lpGdkEventMotion->x = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x);
- lpGdkEventMotion->y = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y);
- lpGdkEventMotion->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->pressure);
- lpGdkEventMotion->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->xtilt);
- lpGdkEventMotion->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->ytilt);
- lpGdkEventMotion->state = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->state);
- lpGdkEventMotion->is_hint = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->is_hint);
- lpGdkEventMotion->source = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->source);
- lpGdkEventMotion->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->deviceid);
- lpGdkEventMotion->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x_root);
- lpGdkEventMotion->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y_root);
-}
-
-void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
-{
- GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->type, lpGdkEventMotion->type);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->window, (jint)lpGdkEventMotion->window);
- (*env)->SetByteField(env, lpObject, lpGdkEventMotionFc->send_event, lpGdkEventMotion->send_event);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->time, (jint)lpGdkEventMotion->time);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x, (jlong)lpGdkEventMotion->x);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y, (jlong)lpGdkEventMotion->y);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->pressure, (jlong)lpGdkEventMotion->pressure);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->xtilt, (jlong)lpGdkEventMotion->xtilt);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->ytilt, (jlong)lpGdkEventMotion->ytilt);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->state, (jint)lpGdkEventMotion->state);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->is_hint, (jint)lpGdkEventMotion->is_hint);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->source, (jint)lpGdkEventMotion->source);
- (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->deviceid, (jint)lpGdkEventMotion->deviceid);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x_root, (jlong)lpGdkEventMotion->x_root);
- (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y_root, (jlong)lpGdkEventMotion->y_root);
-}
-
-void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
-{
- GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
- lpGdkEventExpose->area.x = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->x);
- lpGdkEventExpose->area.y = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->y);
- lpGdkEventExpose->area.width = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->width);
- lpGdkEventExpose->area.height = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->height);
- lpGdkEventExpose->count = (*env)->GetIntField(env, lpObject, lpGdkEventExposeFc->count);
-}
-
-void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
-{
- GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->x, (jshort)lpGdkEventExpose->area.x);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->y, (jshort)lpGdkEventExpose->area.y);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->width, (jshort)lpGdkEventExpose->area.width);
- (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->height, (jshort)lpGdkEventExpose->area.height);
- (*env)->SetIntField(env, lpObject, lpGdkEventExposeFc->count, (jint)lpGdkEventExpose->count);
-}
-
-void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
-{
- lpGdkFont->type = (*env)->GetIntField(env, lpObject, lpGdkFontFc->type);
- lpGdkFont->ascent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->ascent);
- lpGdkFont->descent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->descent);
-}
-
-void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->type, (jint)lpGdkFont->type);
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->ascent, (jint)lpGdkFont->ascent);
- (*env)->SetIntField(env, lpObject, lpGdkFontFc->descent, (jint)lpGdkFont->descent);
-}
-
-void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
-{
- lpGdkGCValues->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel);
- lpGdkGCValues->foreground.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red);
- lpGdkGCValues->foreground.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green);
- lpGdkGCValues->foreground.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue);
- lpGdkGCValues->background.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel);
- lpGdkGCValues->background.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_red);
- lpGdkGCValues->background.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_green);
- lpGdkGCValues->background.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_blue);
- lpGdkGCValues->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->font);
- lpGdkGCValues->function = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->function);
- lpGdkGCValues->fill = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->fill);
- lpGdkGCValues->tile = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->tile);
- lpGdkGCValues->stipple = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->stipple);
- lpGdkGCValues->clip_mask = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask);
- lpGdkGCValues->subwindow_mode = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode);
- lpGdkGCValues->ts_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin);
- lpGdkGCValues->ts_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin);
- lpGdkGCValues->clip_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin);
- lpGdkGCValues->clip_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin);
- lpGdkGCValues->graphics_exposures = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures);
- lpGdkGCValues->line_width = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_width);
- lpGdkGCValues->line_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_style);
- lpGdkGCValues->cap_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->cap_style);
- lpGdkGCValues->join_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->join_style);
-}
-
-void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel, (jint)lpGdkGCValues->foreground.pixel);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red, (jshort)lpGdkGCValues->foreground.red);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green, (jshort)lpGdkGCValues->foreground.green);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue, (jshort)lpGdkGCValues->foreground.blue);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel, (jint)lpGdkGCValues->background.pixel);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_red, (jshort)lpGdkGCValues->background.red);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_green, (jshort)lpGdkGCValues->background.green);
- (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_blue, (jshort)lpGdkGCValues->background.blue);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->font, (jint)lpGdkGCValues->font);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->function, (jint)lpGdkGCValues->function);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->fill, (jint)lpGdkGCValues->fill);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->tile, (jint)lpGdkGCValues->tile);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->stipple, (jint)lpGdkGCValues->stipple);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask, (jint)lpGdkGCValues->clip_mask);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode, (jint)lpGdkGCValues->subwindow_mode);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin, (jint)lpGdkGCValues->ts_x_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin, (jint)lpGdkGCValues->ts_y_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin, (jint)lpGdkGCValues->clip_x_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin, (jint)lpGdkGCValues->clip_y_origin);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures, (jint)lpGdkGCValues->graphics_exposures);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_width, (jint)lpGdkGCValues->line_width);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_style, (jint)lpGdkGCValues->line_style);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->cap_style, (jint)lpGdkGCValues->cap_style);
- (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->join_style, (jint)lpGdkGCValues->join_style);
-}
-
-void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
-{
- lpGdkImage->type = (*env)->GetIntField(env, lpObject, lpGdkImageFc->type);
- lpGdkImage->visual = (GdkVisual*)(*env)->GetIntField(env, lpObject, lpGdkImageFc->visual);
- lpGdkImage->byte_order = (*env)->GetIntField(env, lpObject, lpGdkImageFc->byte_order);
- lpGdkImage->width = (*env)->GetShortField(env, lpObject, lpGdkImageFc->width);
- lpGdkImage->height = (*env)->GetShortField(env, lpObject, lpGdkImageFc->height);
- lpGdkImage->depth = (*env)->GetShortField(env, lpObject, lpGdkImageFc->depth);
- lpGdkImage->bpp = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpp);
- lpGdkImage->bpl = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpl);
- lpGdkImage->mem = (gpointer)(*env)->GetIntField(env, lpObject, lpGdkImageFc->mem);
-}
-
-void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->type, (jint)lpGdkImage->type);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->visual, (jint)lpGdkImage->visual);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->byte_order, (jint)lpGdkImage->byte_order);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->width, (jshort)lpGdkImage->width);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->height, (jshort)lpGdkImage->height);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->depth, (jshort)lpGdkImage->depth);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpp, (jshort)lpGdkImage->bpp);
- (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpl, (jshort)lpGdkImage->bpl);
- (*env)->SetIntField(env, lpObject, lpGdkImageFc->mem, (jint)lpGdkImage->mem);
-}
-
-void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
-{
- lpGdkPoint->x = (*env)->GetShortField(env, lpObject, lpGdkPointFc->x);
- lpGdkPoint->y = (*env)->GetShortField(env, lpObject, lpGdkPointFc->y);
-}
-
-void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
-{
- (*env)->SetShortField(env, lpObject, lpGdkPointFc->x, (jshort)lpGdkPoint->x);
- (*env)->SetShortField(env, lpObject, lpGdkPointFc->y, (jshort)lpGdkPoint->y);
-}
-
-void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
-{
- lpGdkRectangle->x = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->x);
- lpGdkRectangle->y = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->y);
- lpGdkRectangle->width = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->width);
- lpGdkRectangle->height = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->height);
-}
-
-void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
-{
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->x, (jshort)lpGdkRectangle->x);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->y, (jshort)lpGdkRectangle->y);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->width, (jshort)lpGdkRectangle->width);
- (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->height, (jshort)lpGdkRectangle->height);
-}
-
-void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
-{
- lpGdkVisual->type = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->type);
- lpGdkVisual->depth = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->depth);
- lpGdkVisual->byte_order = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->byte_order);
- lpGdkVisual->colormap_size = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->colormap_size);
- lpGdkVisual->bits_per_rgb = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb);
- lpGdkVisual->red_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_mask);
- lpGdkVisual->red_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_shift);
- lpGdkVisual->red_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_prec);
- lpGdkVisual->green_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_mask);
- lpGdkVisual->green_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_shift);
- lpGdkVisual->green_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_prec);
- lpGdkVisual->blue_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_mask);
- lpGdkVisual->blue_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_shift);
- lpGdkVisual->blue_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_prec);
-}
-
-void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
-{
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->type, (jint)lpGdkVisual->type);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->depth, (jint)lpGdkVisual->depth);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->byte_order, (jint)lpGdkVisual->byte_order);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->colormap_size, (jint)lpGdkVisual->colormap_size);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb, (jint)lpGdkVisual->bits_per_rgb);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_mask, (jint)lpGdkVisual->red_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_shift, (jint)lpGdkVisual->red_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_prec, (jint)lpGdkVisual->red_prec);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_mask, (jint)lpGdkVisual->green_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_shift, (jint)lpGdkVisual->green_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_prec, (jint)lpGdkVisual->green_prec);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_mask, (jint)lpGdkVisual->blue_mask);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_shift, (jint)lpGdkVisual->blue_shift);
- (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_prec, (jint)lpGdkVisual->blue_prec);
-}
-
-void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
-{
- lpGtkAllocation->x = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->x);
- lpGtkAllocation->y = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->y);
- lpGtkAllocation->width = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->width);
- lpGtkAllocation->height = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->height);
-}
-
-void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
-{
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->x, lpGtkAllocation->x);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->y, lpGtkAllocation->y);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->width, lpGtkAllocation->width);
- (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->height, lpGtkAllocation->height);
-}
-
-void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
-{
- fprintf(stderr, "WARNING: Unimplemented method getGtkArgFields.\n");
-}
-
-void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
-{
- fprintf(stderr, "WARNING: Unimplemented method setGtkArgFields.\n");
-}
-
-void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
- lpGtkBin->child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkBinFc->child);
-}
-
-void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkBinFc->child, (jint)lpGtkBin->child);
-}
-
-void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
- lpGtkBox->children = (GList*)(*env)->GetIntField(env, lpObject, lpGtkBoxFc->children);
- lpGtkBox->spacing = (*env)->GetShortField(env, lpObject, lpGtkBoxFc->spacing);
- lpGtkBox->homogeneous = (*env)->GetIntField(env, lpObject, lpGtkBoxFc->homogeneous);
-}
-
-void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkBoxFc->children, (jint)lpGtkBox->children);
- (*env)->SetShortField(env, lpObject, lpGtkBoxFc->spacing, (jshort)lpGtkBox->spacing);
- (*env)->SetIntField(env, lpObject, lpGtkBoxFc->homogeneous, (jint)lpGtkBox->homogeneous);
-}
-
-void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
- lpGtkCList->flags = (*env)->GetShortField(env, lpObject, lpGtkCListFc->clist_flags);
- lpGtkCList->row_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk);
- lpGtkCList->cell_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk);
- lpGtkCList->freeze_count = (*env)->GetIntField(env, lpObject, lpGtkCListFc->freeze_count);
- lpGtkCList->internal_allocation.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x);
- lpGtkCList->internal_allocation.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y);
- lpGtkCList->internal_allocation.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width);
- lpGtkCList->internal_allocation.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height);
- lpGtkCList->rows = (*env)->GetIntField(env, lpObject, lpGtkCListFc->rows);
- lpGtkCList->row_center_offset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_center_offset);
- lpGtkCList->row_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_height);
- lpGtkCList->row_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list);
- lpGtkCList->row_list_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list_end);
- lpGtkCList->columns = (*env)->GetIntField(env, lpObject, lpGtkCListFc->columns);
- lpGtkCList->column_title_area.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_x);
- lpGtkCList->column_title_area.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_y);
- lpGtkCList->column_title_area.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_width);
- lpGtkCList->column_title_area.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_height);
- lpGtkCList->title_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->title_window);
- lpGtkCList->column = (GtkCListColumn*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->column);
- lpGtkCList->clist_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window);
- lpGtkCList->clist_window_width = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_width);
- lpGtkCList->clist_window_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_height);
- lpGtkCList->hoffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->hoffset);
- lpGtkCList->voffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->voffset);
- lpGtkCList->shadow_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->shadow_type);
- lpGtkCList->selection_mode = (*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_mode);
- lpGtkCList->selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection);
- lpGtkCList->selection_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_end);
- lpGtkCList->undo_selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_selection);
- lpGtkCList->undo_unselection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_unselection);
- lpGtkCList->undo_anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_anchor);
- lpGtkCList->button_actions[0] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions0);
- lpGtkCList->button_actions[1] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions1);
- lpGtkCList->button_actions[2] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions2);
- lpGtkCList->button_actions[3] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions3);
- lpGtkCList->button_actions[4] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions4);
- lpGtkCList->drag_button = (*env)->GetByteField(env, lpObject, lpGtkCListFc->drag_button);
- lpGtkCList->click_cell.row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_row);
- lpGtkCList->click_cell.column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_column);
- lpGtkCList->hadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->hadjustment);
- lpGtkCList->vadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->vadjustment);
- lpGtkCList->xor_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->xor_gc);
- lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
- lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
- lpGtkCList->cursor_drag = (GdkCursor*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cursor_drag);
- lpGtkCList->x_drag = (*env)->GetIntField(env, lpObject, lpGtkCListFc->x_drag);
- lpGtkCList->focus_row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->focus_row);
- lpGtkCList->anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor);
- lpGtkCList->anchor_state = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor_state);
- lpGtkCList->drag_pos = (*env)->GetIntField(env, lpObject, lpGtkCListFc->drag_pos);
- lpGtkCList->htimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->htimer);
- lpGtkCList->vtimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->vtimer);
- lpGtkCList->sort_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_type);
- lpGtkCList->compare = (GtkCListCompareFunc)(*env)->GetIntField(env, lpObject, lpGtkCListFc->compare);
- lpGtkCList->sort_column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_column);
-}
-
-void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->clist_flags, (jshort)lpGtkCList->flags);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk, (jint)lpGtkCList->row_mem_chunk);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk, (jint)lpGtkCList->cell_mem_chunk);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->freeze_count, (jint)lpGtkCList->freeze_count);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x, (jshort)lpGtkCList->internal_allocation.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y, (jshort)lpGtkCList->internal_allocation.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width, (jshort)lpGtkCList->internal_allocation.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height, (jshort)lpGtkCList->internal_allocation.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->rows, (jint)lpGtkCList->rows);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_center_offset, (jint)lpGtkCList->row_center_offset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_height, (jint)lpGtkCList->row_height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list, (jint)lpGtkCList->row_list);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list_end, (jint)lpGtkCList->row_list_end);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->columns, (jint)lpGtkCList->columns);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_x, (jshort)lpGtkCList->column_title_area.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_y, (jshort)lpGtkCList->column_title_area.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_width, (jshort)lpGtkCList->column_title_area.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_height, (jshort)lpGtkCList->column_title_area.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->title_window, (jint)lpGtkCList->title_window);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->column, (jint)lpGtkCList->column);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window, (jint)lpGtkCList->clist_window);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_width, (jint)lpGtkCList->clist_window_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_height, (jint)lpGtkCList->clist_window_height);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->hoffset, (jint)lpGtkCList->hoffset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->voffset, (jint)lpGtkCList->voffset);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->shadow_type, (jint)lpGtkCList->shadow_type);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_mode, (jint)lpGtkCList->selection_mode);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection, (jint)lpGtkCList->selection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_end, (jint)lpGtkCList->selection_end);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_selection, (jint)lpGtkCList->undo_selection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_unselection, (jint)lpGtkCList->undo_unselection);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_anchor, (jint)lpGtkCList->undo_anchor);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions0, (jbyte)lpGtkCList->button_actions[0]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions1, (jbyte)lpGtkCList->button_actions[1]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions2, (jbyte)lpGtkCList->button_actions[2]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions3, (jbyte)lpGtkCList->button_actions[3]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions4, (jbyte)lpGtkCList->button_actions[4]);
- (*env)->SetByteField(env, lpObject, lpGtkCListFc->drag_button, (jbyte)lpGtkCList->drag_button);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_row, (jint)lpGtkCList->click_cell.row);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_column, (jint)lpGtkCList->click_cell.column);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->hadjustment, (jint)lpGtkCList->hadjustment);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->vadjustment, (jint)lpGtkCList->vadjustment);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->xor_gc, (jint)lpGtkCList->xor_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->cursor_drag, (jint)lpGtkCList->cursor_drag);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->x_drag, (jint)lpGtkCList->x_drag);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->focus_row, (jint)lpGtkCList->focus_row);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor, (jint)lpGtkCList->anchor);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor_state, (jint)lpGtkCList->anchor_state);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->drag_pos, (jint)lpGtkCList->drag_pos);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->htimer, (jint)lpGtkCList->htimer);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->vtimer, (jint)lpGtkCList->vtimer);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_type, (jint)lpGtkCList->sort_type);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->compare, (jint)lpGtkCList->compare);
- (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_column, (jint)lpGtkCList->sort_column);
-}
-
-void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
- lpGtkColorSelectionDialog->colorsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel);
- lpGtkColorSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox);
- lpGtkColorSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button);
- lpGtkColorSelectionDialog->reset_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button);
- lpGtkColorSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button);
- lpGtkColorSelectionDialog->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button);
-}
-
-void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel, (jint)lpGtkColorSelectionDialog->colorsel);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox, (jint)lpGtkColorSelectionDialog->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button, (jint)lpGtkColorSelectionDialog->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button, (jint)lpGtkColorSelectionDialog->reset_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button, (jint)lpGtkColorSelectionDialog->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button, (jint)lpGtkColorSelectionDialog->help_button);
-}
-
-void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
-{
- DECL_GLOB(pGlob)
- getGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
- lpGtkCombo->entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->entry);
- lpGtkCombo->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->button);
- lpGtkCombo->popup = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popup);
- lpGtkCombo->popwin = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popwin);
- lpGtkCombo->list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->list);
- lpGtkCombo->entry_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->entry_change_id);
- lpGtkCombo->list_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->list_change_id);
- lpGtkCombo->value_in_list = (*env)->GetIntField(env, lpObject, lpGtkComboFc->value_in_list);
- lpGtkCombo->ok_if_empty = (*env)->GetIntField(env, lpObject, lpGtkComboFc->ok_if_empty);
- lpGtkCombo->case_sensitive = (*env)->GetIntField(env, lpObject, lpGtkComboFc->case_sensitive);
- lpGtkCombo->use_arrows = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows);
- lpGtkCombo->use_arrows_always = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows_always);
- lpGtkCombo->current_button = (*env)->GetShortField(env, lpObject, lpGtkComboFc->current_button);
- lpGtkCombo->activate_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->activate_id);
-}
-
-void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
-{
- DECL_GLOB(pGlob)
- setGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry, (jint)lpGtkCombo->entry);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->button, (jint)lpGtkCombo->button);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->popup, (jint)lpGtkCombo->popup);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->popwin, (jint)lpGtkCombo->popwin);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->list, (jint)lpGtkCombo->list);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry_change_id, (jint)lpGtkCombo->entry_change_id);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->list_change_id, (jint)lpGtkCombo->list_change_id);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->value_in_list, (jint)lpGtkCombo->value_in_list);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->ok_if_empty, (jint)lpGtkCombo->ok_if_empty);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->case_sensitive, (jint)lpGtkCombo->case_sensitive);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows, (jint)lpGtkCombo->use_arrows);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows_always, (jint)lpGtkCombo->use_arrows_always);
- (*env)->SetShortField(env, lpObject, lpGtkComboFc->current_button, (jshort)lpGtkCombo->current_button);
- (*env)->SetIntField(env, lpObject, lpGtkComboFc->activate_id, (jint)lpGtkCombo->activate_id);
-}
-
-void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
- lpGtkContainer->focus_child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->focus_child);
- lpGtkContainer->border_width = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->border_width);
- lpGtkContainer->need_resize = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->need_resize);
- lpGtkContainer->resize_mode = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_mode);
- lpGtkContainer->resize_widgets = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_widgets);
-}
-
-void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->focus_child, (jint)lpGtkContainer->focus_child);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->border_width, (jint)lpGtkContainer->border_width);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->need_resize, (jint)lpGtkContainer->need_resize);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_mode, (jint)lpGtkContainer->resize_mode);
- (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_widgets, (jint)lpGtkContainer->resize_widgets);
-}
-
-void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
- lpGtkEditable->current_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->current_pos);
- lpGtkEditable->selection_start_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos);
- lpGtkEditable->selection_end_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos);
- lpGtkEditable->has_selection = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->has_selection);
- lpGtkEditable->editable = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->editable);
- lpGtkEditable->visible = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->visible);
- lpGtkEditable->ic = (GdkIC*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic);
- lpGtkEditable->ic_attr = (GdkICAttr*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic_attr);
- lpGtkEditable->clipboard_text = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->clipboard_text);
-}
-
-void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->current_pos, (jint)lpGtkEditable->current_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos, (jint)lpGtkEditable->selection_start_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos, (jint)lpGtkEditable->selection_end_pos);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->has_selection, (jint)lpGtkEditable->has_selection);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->editable, (jint)lpGtkEditable->editable);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->visible, (jint)lpGtkEditable->visible);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic, (jint)lpGtkEditable->ic);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic_attr, (jint)lpGtkEditable->ic_attr);
- (*env)->SetIntField(env, lpObject, lpGtkEditableFc->clipboard_text, (jint)lpGtkEditable->clipboard_text);
-}
-
-void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
-{
- DECL_GLOB(pGlob)
- getGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
-
- lpGtkText->first_line_start_index = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_line_start_index);
- lpGtkText->first_onscreen_hor_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel);
- lpGtkText->first_onscreen_ver_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel);
- lpGtkText->default_tab_width = (*env)->GetIntField(env, lpObject, lpGtkTextFc->default_tab_width);
- lpGtkText->cursor_pos_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x);
- lpGtkText->cursor_pos_y = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y);
- lpGtkText->cursor_virtual_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x);
-}
-
-void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
-{
- DECL_GLOB(pGlob)
- setGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_line_start_index, (jint)lpGtkText->first_line_start_index);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel, (jint)lpGtkText->first_onscreen_hor_pixel);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel, (jint)lpGtkText->first_onscreen_ver_pixel);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->default_tab_width, (jint)lpGtkText->default_tab_width);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x, (jint)lpGtkText->cursor_pos_x);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y, (jint)lpGtkText->cursor_pos_y);
- (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x, (jint)lpGtkText->cursor_virtual_x);
-}
-
-void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
- lpGtkFileSelection->dir_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list);
- lpGtkFileSelection->file_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->file_list);
- lpGtkFileSelection->selection_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry);
- lpGtkFileSelection->selection_text = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text);
- lpGtkFileSelection->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox);
- lpGtkFileSelection->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button);
- lpGtkFileSelection->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button);
- lpGtkFileSelection->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->help_button);
- lpGtkFileSelection->history_pulldown = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown);
- lpGtkFileSelection->history_menu = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu);
- lpGtkFileSelection->history_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_list);
- lpGtkFileSelection->fileop_dialog = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog);
- lpGtkFileSelection->fileop_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry);
- lpGtkFileSelection->fileop_file = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file);
- lpGtkFileSelection->cmpl_state = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state);
- lpGtkFileSelection->fileop_c_dir = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir);
- lpGtkFileSelection->fileop_del_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file);
- lpGtkFileSelection->fileop_ren_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file);
- lpGtkFileSelection->button_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->button_area);
- lpGtkFileSelection->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->action_area);
-}
-
-void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list, (jint)lpGtkFileSelection->dir_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->file_list, (jint)lpGtkFileSelection->file_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry, (jint)lpGtkFileSelection->selection_entry);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text, (jint)lpGtkFileSelection->selection_text);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox, (jint)lpGtkFileSelection->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button, (jint)lpGtkFileSelection->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button, (jint)lpGtkFileSelection->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->help_button, (jint)lpGtkFileSelection->help_button);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown, (jint)lpGtkFileSelection->history_pulldown);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu, (jint)lpGtkFileSelection->history_menu);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_list, (jint)lpGtkFileSelection->history_list);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog, (jint)lpGtkFileSelection->fileop_dialog);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry, (jint)lpGtkFileSelection->fileop_entry);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file, (jint)lpGtkFileSelection->fileop_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state, (jint)lpGtkFileSelection->cmpl_state);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir, (jint)lpGtkFileSelection->fileop_c_dir);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file, (jint)lpGtkFileSelection->fileop_del_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file, (jint)lpGtkFileSelection->fileop_ren_file);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->button_area, (jint)lpGtkFileSelection->button_area);
- (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->action_area, (jint)lpGtkFileSelection->action_area);
-}
-
-void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
- lpGtkFontSelectionDialog->fontsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel);
- lpGtkFontSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox);
- lpGtkFontSelectionDialog->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area);
- lpGtkFontSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button);
- lpGtkFontSelectionDialog->apply_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button);
- lpGtkFontSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button);
- lpGtkFontSelectionDialog->dialog_width = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width);
- lpGtkFontSelectionDialog->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize);
-}
-
-void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel, (jint)lpGtkFontSelectionDialog->fontsel);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox, (jint)lpGtkFontSelectionDialog->main_vbox);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area, (jint)lpGtkFontSelectionDialog->action_area);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button, (jint)lpGtkFontSelectionDialog->ok_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button, (jint)lpGtkFontSelectionDialog->apply_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button, (jint)lpGtkFontSelectionDialog->cancel_button);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width, (jint)lpGtkFontSelectionDialog->dialog_width);
- (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize, (jint)lpGtkFontSelectionDialog->auto_resize);
-}
-
-void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
-{
- DECL_GLOB(pGlob)
- getGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
-}
-
-void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
-{
- DECL_GLOB(pGlob)
- setGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
-}
-
-void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
-{
- lpGtkObject->klass = (GtkObjectClass*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->klass);
- lpGtkObject->flags = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->flags);
- lpGtkObject->ref_count = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->ref_count);
- lpGtkObject->object_data = (GData*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->object_data);
-}
-
-void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->klass, (jint)lpGtkObject->klass);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->flags, (jint)lpGtkObject->flags);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->ref_count, (jint)lpGtkObject->ref_count);
- (*env)->SetIntField(env, lpObject, lpGtkObjectFc->object_data, (jint)lpGtkObject->object_data);
-}
-
-void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
-{
- DECL_GLOB(pGlob)
- getGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
- lpGtkProgress->adjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->adjustment);
- lpGtkProgress->offscreen_pixmap = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap);
- lpGtkProgress->format = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->format);
- lpGtkProgress->x_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->x_align);
- lpGtkProgress->y_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->y_align);
- lpGtkProgress->show_text = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->show_text);
- lpGtkProgress->activity_mode = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->activity_mode);
-}
-
-void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
-{
- DECL_GLOB(pGlob)
- setGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->adjustment, (jint)lpGtkProgress->adjustment);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap, (jint)lpGtkProgress->offscreen_pixmap);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->format, (jint)lpGtkProgress->format);
- (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->x_align, (jfloat)lpGtkProgress->x_align);
- (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->y_align, (jfloat)lpGtkProgress->y_align);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->show_text, (jint)lpGtkProgress->show_text);
- (*env)->SetIntField(env, lpObject, lpGtkProgressFc->activity_mode, (jint)lpGtkProgress->activity_mode);
-}
-
-void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
-{
- DECL_GLOB(pGlob)
- getGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
- lpGtkProgressBar->bar_style = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->bar_style);
- lpGtkProgressBar->orientation = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->orientation);
- lpGtkProgressBar->blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->blocks);
- lpGtkProgressBar->in_block = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->in_block);
- lpGtkProgressBar->activity_pos = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos);
- lpGtkProgressBar->activity_step = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_step);
- lpGtkProgressBar->activity_blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks);
- lpGtkProgressBar->activity_dir = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir);
-}
-
-void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
-{
- DECL_GLOB(pGlob)
- setGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->bar_style, (jint)lpGtkProgressBar->bar_style);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->orientation, (jint)lpGtkProgressBar->orientation);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->blocks, (jint)lpGtkProgressBar->blocks);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->in_block, (jint)lpGtkProgressBar->in_block);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos, (jint)lpGtkProgressBar->activity_pos);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_step, (jint)lpGtkProgressBar->activity_step);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks, (jint)lpGtkProgressBar->activity_blocks);
- (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir, (jint)lpGtkProgressBar->activity_dir);
-}
-
-void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
-{
- lpGtkRequisition->width = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->width);
- lpGtkRequisition->height = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->height);
-}
-
-void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
-{
- (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->width, lpGtkRequisition->width);
- (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->height, lpGtkRequisition->height);
-}
-
-void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
-{
- lpGtkStyle->klass = (GtkStyleClass*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->klass);
- lpGtkStyle->fg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel);
- lpGtkStyle->fg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_red);
- lpGtkStyle->fg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_green);
- lpGtkStyle->fg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_blue);
- lpGtkStyle->fg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel);
- lpGtkStyle->fg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_red);
- lpGtkStyle->fg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_green);
- lpGtkStyle->fg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_blue);
- lpGtkStyle->fg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel);
- lpGtkStyle->fg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_red);
- lpGtkStyle->fg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_green);
- lpGtkStyle->fg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_blue);
- lpGtkStyle->fg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel);
- lpGtkStyle->fg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_red);
- lpGtkStyle->fg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_green);
- lpGtkStyle->fg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_blue);
- lpGtkStyle->fg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel);
- lpGtkStyle->fg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_red);
- lpGtkStyle->fg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_green);
- lpGtkStyle->fg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_blue);
- lpGtkStyle->bg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel);
- lpGtkStyle->bg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_red);
- lpGtkStyle->bg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_green);
- lpGtkStyle->bg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_blue);
- lpGtkStyle->bg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel);
- lpGtkStyle->bg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_red);
- lpGtkStyle->bg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_green);
- lpGtkStyle->bg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_blue);
- lpGtkStyle->bg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel);
- lpGtkStyle->bg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_red);
- lpGtkStyle->bg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_green);
- lpGtkStyle->bg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_blue);
- lpGtkStyle->bg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel);
- lpGtkStyle->bg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_red);
- lpGtkStyle->bg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_green);
- lpGtkStyle->bg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_blue);
- lpGtkStyle->bg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel);
- lpGtkStyle->bg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_red);
- lpGtkStyle->bg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_green);
- lpGtkStyle->bg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_blue);
- lpGtkStyle->light[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light0_pixel);
- lpGtkStyle->light[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_red);
- lpGtkStyle->light[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_green);
- lpGtkStyle->light[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_blue);
- lpGtkStyle->light[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light1_pixel);
- lpGtkStyle->light[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_red);
- lpGtkStyle->light[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_green);
- lpGtkStyle->light[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_blue);
- lpGtkStyle->light[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light2_pixel);
- lpGtkStyle->light[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_red);
- lpGtkStyle->light[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_green);
- lpGtkStyle->light[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_blue);
- lpGtkStyle->light[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light3_pixel);
- lpGtkStyle->light[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_red);
- lpGtkStyle->light[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_green);
- lpGtkStyle->light[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_blue);
- lpGtkStyle->light[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light4_pixel);
- lpGtkStyle->light[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_red);
- lpGtkStyle->light[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_green);
- lpGtkStyle->light[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_blue);
- lpGtkStyle->dark[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel);
- lpGtkStyle->dark[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_red);
- lpGtkStyle->dark[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_green);
- lpGtkStyle->dark[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_blue);
- lpGtkStyle->dark[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel);
- lpGtkStyle->dark[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_red);
- lpGtkStyle->dark[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_green);
- lpGtkStyle->dark[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_blue);
- lpGtkStyle->dark[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel);
- lpGtkStyle->dark[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_red);
- lpGtkStyle->dark[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_green);
- lpGtkStyle->dark[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_blue);
- lpGtkStyle->dark[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel);
- lpGtkStyle->dark[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_red);
- lpGtkStyle->dark[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_green);
- lpGtkStyle->dark[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_blue);
- lpGtkStyle->dark[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel);
- lpGtkStyle->dark[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_red);
- lpGtkStyle->dark[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_green);
- lpGtkStyle->dark[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_blue);
- lpGtkStyle->mid[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel);
- lpGtkStyle->mid[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_red);
- lpGtkStyle->mid[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_green);
- lpGtkStyle->mid[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_blue);
- lpGtkStyle->mid[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel);
- lpGtkStyle->mid[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_red);
- lpGtkStyle->mid[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_green);
- lpGtkStyle->mid[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_blue);
- lpGtkStyle->mid[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel);
- lpGtkStyle->mid[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_red);
- lpGtkStyle->mid[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_green);
- lpGtkStyle->mid[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_blue);
- lpGtkStyle->mid[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel);
- lpGtkStyle->mid[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_red);
- lpGtkStyle->mid[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_green);
- lpGtkStyle->mid[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_blue);
- lpGtkStyle->mid[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel);
- lpGtkStyle->mid[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_red);
- lpGtkStyle->mid[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_green);
- lpGtkStyle->mid[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_blue);
- lpGtkStyle->text[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text0_pixel);
- lpGtkStyle->text[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_red);
- lpGtkStyle->text[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_green);
- lpGtkStyle->text[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_blue);
- lpGtkStyle->text[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text1_pixel);
- lpGtkStyle->text[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_red);
- lpGtkStyle->text[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_green);
- lpGtkStyle->text[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_blue);
- lpGtkStyle->text[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text2_pixel);
- lpGtkStyle->text[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_red);
- lpGtkStyle->text[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_green);
- lpGtkStyle->text[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_blue);
- lpGtkStyle->text[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text3_pixel);
- lpGtkStyle->text[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_red);
- lpGtkStyle->text[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_green);
- lpGtkStyle->text[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_blue);
- lpGtkStyle->text[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text4_pixel);
- lpGtkStyle->text[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_red);
- lpGtkStyle->text[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_green);
- lpGtkStyle->text[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_blue);
- lpGtkStyle->base[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base0_pixel);
- lpGtkStyle->base[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_red);
- lpGtkStyle->base[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_green);
- lpGtkStyle->base[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_blue);
- lpGtkStyle->base[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base1_pixel);
- lpGtkStyle->base[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_red);
- lpGtkStyle->base[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_green);
- lpGtkStyle->base[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_blue);
- lpGtkStyle->base[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base2_pixel);
- lpGtkStyle->base[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_red);
- lpGtkStyle->base[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_green);
- lpGtkStyle->base[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_blue);
- lpGtkStyle->base[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base3_pixel);
- lpGtkStyle->base[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_red);
- lpGtkStyle->base[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_green);
- lpGtkStyle->base[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_blue);
- lpGtkStyle->base[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base4_pixel);
- lpGtkStyle->base[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_red);
- lpGtkStyle->base[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_green);
- lpGtkStyle->base[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_blue);
- lpGtkStyle->black.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_pixel);
- lpGtkStyle->black.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_red);
- lpGtkStyle->black.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_green);
- lpGtkStyle->black.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_blue);
- lpGtkStyle->white.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_pixel);
- lpGtkStyle->white.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_red);
- lpGtkStyle->white.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_green);
- lpGtkStyle->white.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_blue);
- lpGtkStyle->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->font);
- lpGtkStyle->fg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc0);
- lpGtkStyle->fg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc1);
- lpGtkStyle->fg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc2);
- lpGtkStyle->fg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc3);
- lpGtkStyle->fg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc4);
- lpGtkStyle->bg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc0);
- lpGtkStyle->bg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc1);
- lpGtkStyle->bg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc2);
- lpGtkStyle->bg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc3);
- lpGtkStyle->bg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc4);
- lpGtkStyle->light_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc0);
- lpGtkStyle->light_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc1);
- lpGtkStyle->light_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc2);
- lpGtkStyle->light_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc3);
- lpGtkStyle->light_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc4);
- lpGtkStyle->dark_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc0);
- lpGtkStyle->dark_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc1);
- lpGtkStyle->dark_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc2);
- lpGtkStyle->dark_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc3);
- lpGtkStyle->dark_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc4);
- lpGtkStyle->mid_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc0);
- lpGtkStyle->mid_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc1);
- lpGtkStyle->mid_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc2);
- lpGtkStyle->mid_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc3);
- lpGtkStyle->mid_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc4);
- lpGtkStyle->text_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc0);
- lpGtkStyle->text_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc1);
- lpGtkStyle->text_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc2);
- lpGtkStyle->text_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc3);
- lpGtkStyle->text_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc4);
- lpGtkStyle->base_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc0);
- lpGtkStyle->base_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc1);
- lpGtkStyle->base_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc2);
- lpGtkStyle->base_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc3);
- lpGtkStyle->base_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc4);
- lpGtkStyle->black_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_gc);
- lpGtkStyle->white_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_gc);
- lpGtkStyle->bg_pixmap[0] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0);
- lpGtkStyle->bg_pixmap[1] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1);
- lpGtkStyle->bg_pixmap[2] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2);
- lpGtkStyle->bg_pixmap[3] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3);
- lpGtkStyle->bg_pixmap[4] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4);
- lpGtkStyle->ref_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->ref_count);
- lpGtkStyle->attach_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->attach_count);
- lpGtkStyle->depth = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->depth);
- lpGtkStyle->colormap = (GdkColormap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->colormap);
- lpGtkStyle->engine = (GtkThemeEngine*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine);
- lpGtkStyle->engine_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine_data);
- lpGtkStyle->rc_style = (GtkRcStyle*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->rc_style);
- lpGtkStyle->styles = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->styles);
-}
-
-void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->klass, (jint)lpGtkStyle->klass);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel, (jint)lpGtkStyle->fg[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_red, (jshort)lpGtkStyle->fg[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_green, (jshort)lpGtkStyle->fg[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_blue, (jshort)lpGtkStyle->fg[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel, (jint)lpGtkStyle->fg[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_red, (jshort)lpGtkStyle->fg[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_green, (jshort)lpGtkStyle->fg[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_blue, (jshort)lpGtkStyle->fg[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel, (jint)lpGtkStyle->fg[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_red, (jshort)lpGtkStyle->fg[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_green, (jshort)lpGtkStyle->fg[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_blue, (jshort)lpGtkStyle->fg[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel, (jint)lpGtkStyle->fg[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_red, (jshort)lpGtkStyle->fg[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_green, (jshort)lpGtkStyle->fg[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_blue, (jshort)lpGtkStyle->fg[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel, (jint)lpGtkStyle->fg[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_red, (jshort)lpGtkStyle->fg[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_green, (jshort)lpGtkStyle->fg[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_blue, (jshort)lpGtkStyle->fg[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel, (jint)lpGtkStyle->bg[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_red, (jshort)lpGtkStyle->bg[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_green, (jshort)lpGtkStyle->bg[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_blue, (jshort)lpGtkStyle->bg[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel, (jint)lpGtkStyle->bg[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_red, (jshort)lpGtkStyle->bg[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_green, (jshort)lpGtkStyle->bg[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_blue, (jshort)lpGtkStyle->bg[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel, (jint)lpGtkStyle->bg[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_red, (jshort)lpGtkStyle->bg[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_green, (jshort)lpGtkStyle->bg[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_blue, (jshort)lpGtkStyle->bg[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel, (jint)lpGtkStyle->bg[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_red, (jshort)lpGtkStyle->bg[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_green, (jshort)lpGtkStyle->bg[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_blue, (jshort)lpGtkStyle->bg[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel, (jint)lpGtkStyle->bg[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_red, (jshort)lpGtkStyle->bg[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_green, (jshort)lpGtkStyle->bg[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_blue, (jshort)lpGtkStyle->bg[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light0_pixel, (jint)lpGtkStyle->light[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_red, (jshort)lpGtkStyle->light[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_green, (jshort)lpGtkStyle->light[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_blue, (jshort)lpGtkStyle->light[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light1_pixel, (jint)lpGtkStyle->light[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_red, (jshort)lpGtkStyle->light[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_green, (jshort)lpGtkStyle->light[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_blue, (jshort)lpGtkStyle->light[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light2_pixel, (jint)lpGtkStyle->light[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_red, (jshort)lpGtkStyle->light[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_green, (jshort)lpGtkStyle->light[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_blue, (jshort)lpGtkStyle->light[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light3_pixel, (jint)lpGtkStyle->light[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_red, (jshort)lpGtkStyle->light[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_green, (jshort)lpGtkStyle->light[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_blue, (jshort)lpGtkStyle->light[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light4_pixel, (jint)lpGtkStyle->light[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_red, (jshort)lpGtkStyle->light[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_green, (jshort)lpGtkStyle->light[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_blue, (jshort)lpGtkStyle->light[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel, (jint)lpGtkStyle->dark[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_red, (jshort)lpGtkStyle->dark[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_green, (jshort)lpGtkStyle->dark[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_blue, (jshort)lpGtkStyle->dark[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel, (jint)lpGtkStyle->dark[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_red, (jshort)lpGtkStyle->dark[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_green, (jshort)lpGtkStyle->dark[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_blue, (jshort)lpGtkStyle->dark[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel, (jint)lpGtkStyle->dark[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_red, (jshort)lpGtkStyle->dark[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_green, (jshort)lpGtkStyle->dark[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_blue, (jshort)lpGtkStyle->dark[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel, (jint)lpGtkStyle->dark[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_red, (jshort)lpGtkStyle->dark[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_green, (jshort)lpGtkStyle->dark[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_blue, (jshort)lpGtkStyle->dark[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel, (jint)lpGtkStyle->dark[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_red, (jshort)lpGtkStyle->dark[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_green, (jshort)lpGtkStyle->dark[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_blue, (jshort)lpGtkStyle->dark[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel, (jint)lpGtkStyle->mid[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_red, (jshort)lpGtkStyle->mid[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_green, (jshort)lpGtkStyle->mid[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_blue, (jshort)lpGtkStyle->mid[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel, (jint)lpGtkStyle->mid[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_red, (jshort)lpGtkStyle->mid[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_green, (jshort)lpGtkStyle->mid[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_blue, (jshort)lpGtkStyle->mid[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel, (jint)lpGtkStyle->mid[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_red, (jshort)lpGtkStyle->mid[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_green, (jshort)lpGtkStyle->mid[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_blue, (jshort)lpGtkStyle->mid[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel, (jint)lpGtkStyle->mid[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_red, (jshort)lpGtkStyle->mid[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_green, (jshort)lpGtkStyle->mid[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_blue, (jshort)lpGtkStyle->mid[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel, (jint)lpGtkStyle->mid[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_red, (jshort)lpGtkStyle->mid[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_green, (jshort)lpGtkStyle->mid[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_blue, (jshort)lpGtkStyle->mid[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text0_pixel, (jint)lpGtkStyle->text[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_red, (jshort)lpGtkStyle->text[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_green, (jshort)lpGtkStyle->text[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_blue, (jshort)lpGtkStyle->text[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text1_pixel, (jint)lpGtkStyle->text[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_red, (jshort)lpGtkStyle->text[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_green, (jshort)lpGtkStyle->text[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_blue, (jshort)lpGtkStyle->text[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text2_pixel, (jint)lpGtkStyle->text[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_red, (jshort)lpGtkStyle->text[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_green, (jshort)lpGtkStyle->text[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_blue, (jshort)lpGtkStyle->text[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text3_pixel, (jint)lpGtkStyle->text[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_red, (jshort)lpGtkStyle->text[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_green, (jshort)lpGtkStyle->text[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_blue, (jshort)lpGtkStyle->text[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text4_pixel, (jint)lpGtkStyle->text[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_red, (jshort)lpGtkStyle->text[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_green, (jshort)lpGtkStyle->text[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_blue, (jshort)lpGtkStyle->text[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base0_pixel, (jint)lpGtkStyle->base[0].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_red, (jshort)lpGtkStyle->base[0].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_green, (jshort)lpGtkStyle->base[0].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_blue, (jshort)lpGtkStyle->base[0].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base1_pixel, (jint)lpGtkStyle->base[1].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_red, (jshort)lpGtkStyle->base[1].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_green, (jshort)lpGtkStyle->base[1].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_blue, (jshort)lpGtkStyle->base[1].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base2_pixel, (jint)lpGtkStyle->base[2].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_red, (jshort)lpGtkStyle->base[2].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_green, (jshort)lpGtkStyle->base[2].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_blue, (jshort)lpGtkStyle->base[2].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base3_pixel, (jint)lpGtkStyle->base[3].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_red, (jshort)lpGtkStyle->base[3].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_green, (jshort)lpGtkStyle->base[3].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_blue, (jshort)lpGtkStyle->base[3].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base4_pixel, (jint)lpGtkStyle->base[4].pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_red, (jshort)lpGtkStyle->base[4].red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_green, (jshort)lpGtkStyle->base[4].green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_blue, (jshort)lpGtkStyle->base[4].blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_pixel, (jint)lpGtkStyle->black.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_red, (jshort)lpGtkStyle->black.red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_green, (jshort)lpGtkStyle->black.green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_blue, (jshort)lpGtkStyle->black.blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_pixel, (jint)lpGtkStyle->white.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_red, (jshort)lpGtkStyle->white.red);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_green, (jshort)lpGtkStyle->white.green);
- (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_blue, (jshort)lpGtkStyle->white.blue);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->font, (jint)lpGtkStyle->font);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc0, (jint)lpGtkStyle->fg_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc1, (jint)lpGtkStyle->fg_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc2, (jint)lpGtkStyle->fg_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc3, (jint)lpGtkStyle->fg_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc4, (jint)lpGtkStyle->fg_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc0, (jint)lpGtkStyle->bg_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc1, (jint)lpGtkStyle->bg_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc2, (jint)lpGtkStyle->bg_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc3, (jint)lpGtkStyle->bg_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc4, (jint)lpGtkStyle->bg_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc0, (jint)lpGtkStyle->light_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc1, (jint)lpGtkStyle->light_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc2, (jint)lpGtkStyle->light_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc3, (jint)lpGtkStyle->light_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc4, (jint)lpGtkStyle->light_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc0, (jint)lpGtkStyle->dark_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc1, (jint)lpGtkStyle->dark_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc2, (jint)lpGtkStyle->dark_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc3, (jint)lpGtkStyle->dark_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc4, (jint)lpGtkStyle->dark_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc0, (jint)lpGtkStyle->mid_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc1, (jint)lpGtkStyle->mid_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc2, (jint)lpGtkStyle->mid_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc3, (jint)lpGtkStyle->mid_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc4, (jint)lpGtkStyle->mid_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc0, (jint)lpGtkStyle->text_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc1, (jint)lpGtkStyle->text_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc2, (jint)lpGtkStyle->text_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc3, (jint)lpGtkStyle->text_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc4, (jint)lpGtkStyle->text_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc0, (jint)lpGtkStyle->base_gc[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc1, (jint)lpGtkStyle->base_gc[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc2, (jint)lpGtkStyle->base_gc[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc3, (jint)lpGtkStyle->base_gc[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc4, (jint)lpGtkStyle->base_gc[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_gc, (jint)lpGtkStyle->black_gc);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_gc, (jint)lpGtkStyle->white_gc);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0, (jint)lpGtkStyle->bg_pixmap[0]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1, (jint)lpGtkStyle->bg_pixmap[1]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2, (jint)lpGtkStyle->bg_pixmap[2]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3, (jint)lpGtkStyle->bg_pixmap[3]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4, (jint)lpGtkStyle->bg_pixmap[4]);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->ref_count, (jint)lpGtkStyle->ref_count);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->attach_count, (jint)lpGtkStyle->attach_count);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->depth, (jint)lpGtkStyle->depth);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->colormap, (jint)lpGtkStyle->colormap);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine, (jint)lpGtkStyle->engine);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine_data, (jint)lpGtkStyle->engine_data);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->rc_style, (jint)lpGtkStyle->rc_style);
- (*env)->SetIntField(env, lpObject, lpGtkStyleFc->styles, (jint)lpGtkStyle->styles);
-}
-
-void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
-{
- lpGtkStyleClass->xthickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->xthickness);
- lpGtkStyleClass->ythickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->ythickness);
-}
-
-void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->xthickness, (jint)lpGtkStyleClass->xthickness);
- (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->ythickness, (jint)lpGtkStyleClass->ythickness);
-}
-
-void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
-{
- DECL_GLOB(pGlob)
- getGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
- lpGtkWidget->private_flags = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->private_flags);
- lpGtkWidget->state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->state);
- lpGtkWidget->saved_state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->saved_state);
- lpGtkWidget->name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->name);
- lpGtkWidget->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->style);
- lpGtkWidget->requisition.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_width);
- lpGtkWidget->requisition.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_height);
- lpGtkWidget->allocation.x = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_x);
- lpGtkWidget->allocation.y = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_y);
- lpGtkWidget->allocation.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_width);
- lpGtkWidget->allocation.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_height);
- lpGtkWidget->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->window);
- lpGtkWidget->parent = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->parent);
-}
-
-void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
- lpGtkFrame->label = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFrameFc->label);
- lpGtkFrame->shadow_type = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->shadow_type);
- lpGtkFrame->label_width = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_width);
- lpGtkFrame->label_height = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_height);
- lpGtkFrame->label_xalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_xalign);
- lpGtkFrame->label_yalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_yalign);
-}
-
-void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
-{
- DECL_GLOB(pGlob)
- setGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->private_flags, (jshort)lpGtkWidget->private_flags);
- (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->state, (jbyte)lpGtkWidget->state);
- (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->saved_state, (jbyte)lpGtkWidget->saved_state);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->name, (jint)lpGtkWidget->name);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->style, (jint)lpGtkWidget->style);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_width, (jshort)lpGtkWidget->requisition.width);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_height, (jshort)lpGtkWidget->requisition.height);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_x, (jshort)lpGtkWidget->allocation.x);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_y, (jshort)lpGtkWidget->allocation.y);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_width, (jshort)lpGtkWidget->allocation.width);
- (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_height, (jshort)lpGtkWidget->allocation.height);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->window, (jint)lpGtkWidget->window);
- (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->parent, (jint)lpGtkWidget->parent);
-}
-
-void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
- (*env)->SetIntField (env, lpObject, lpGtkFrameFc->label, (jint)lpGtkFrame->label);
- (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_width, (jshort)lpGtkFrame->label_width);
- (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_height, (jshort)lpGtkFrame->label_height);
- (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_xalign, (jfloat)lpGtkFrame->label_xalign);
- (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_yalign, (jfloat)lpGtkFrame->label_yalign);
-}
-
-void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
- lpGtkWindow->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
- lpGtkWindow->wmclass_name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_name);
- lpGtkWindow->wmclass_class = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_class);
- lpGtkWindow->type = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->type);
- lpGtkWindow->focus_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->focus_widget);
- lpGtkWindow->default_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->default_widget);
- lpGtkWindow->transient_parent = (GtkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->transient_parent);
- lpGtkWindow->resize_count = (*env)->GetShortField(env, lpObject, lpGtkWindowFc->resize_count);
- lpGtkWindow->allow_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_shrink);
- lpGtkWindow->allow_grow = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_grow);
- lpGtkWindow->auto_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->auto_shrink);
- lpGtkWindow->handling_resize = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->handling_resize);
- lpGtkWindow->position = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->position);
- lpGtkWindow->use_uposition = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->use_uposition);
- lpGtkWindow->modal = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
-}
-
-void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->title, (jint)lpGtkWindow->title);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_name, (jint)lpGtkWindow->wmclass_name);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_class, (jint)lpGtkWindow->wmclass_class);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->type, (jint)lpGtkWindow->type);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->focus_widget, (jint)lpGtkWindow->focus_widget);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->default_widget, (jint)lpGtkWindow->default_widget);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->transient_parent, (jint)lpGtkWindow->title);
- (*env)->SetShortField(env, lpObject, lpGtkWindowFc->resize_count, (jshort)lpGtkWindow->resize_count);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_shrink, (jint)lpGtkWindow->allow_shrink);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_grow, (jint)lpGtkWindow->allow_grow);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->auto_shrink, (jint)lpGtkWindow->auto_shrink);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->handling_resize, (jint)lpGtkWindow->handling_resize);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->position, (jint)lpGtkWindow->position);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->use_uposition, (jint)lpGtkWindow->use_uposition);
- (*env)->SetIntField(env, lpObject, lpGtkWindowFc->modal, (jint)lpGtkWindow->modal);
-}
-
-void getGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc)
-{
- DECL_GLOB(pGlob)
- getGtkWindowFields(env, lpObject, &lpGtkDialog->window, &PGLOB(GtkWindowFc));
- lpGtkDialog->vbox = (GtkWidget*) (*env)->GetIntField(env, lpObject, lpGtkDialogFc->vbox);
- lpGtkDialog->action_area = (GtkWidget*) (*env)->GetIntField(env, lpObject, lpGtkDialogFc->action_area);
-}
-
-void setGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc)
-{
- DECL_GLOB(pGlob)
- setGtkWindowFields(env, lpObject, &lpGtkDialog->window, &PGLOB(GtkWindowFc));
- (*env)->SetIntField(env, lpObject, lpGtkDialogFc->vbox, (jint)lpGtkDialog->vbox);
- (*env)->SetIntField(env, lpObject, lpGtkDialogFc->action_area, (jint)lpGtkDialog->action_area);
-}
-
-void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
-{
- DECL_GLOB(pGlob)
- getGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
- lpGtkMenu->parent_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item);
- lpGtkMenu->old_active_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item);
- lpGtkMenu->accel_group = (GtkAccelGroup*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->accel_group);
- lpGtkMenu->position_func = (GtkMenuPositionFunc)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func);
- lpGtkMenu->position_func_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func_data);
- lpGtkMenu->toplevel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->toplevel);
- lpGtkMenu->tearoff_window = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->tearoff_window);
- lpGtkMenu->torn_off = (*env)->GetIntField(env, lpObject, lpGtkMenuFc->torn_off);
-}
-
-void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
-{
- DECL_GLOB(pGlob)
- setGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item, (jint)lpGtkMenu->parent_menu_item);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item, (jint)lpGtkMenu->old_active_menu_item);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->accel_group, (jint)lpGtkMenu->accel_group);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func, (jint)lpGtkMenu->position_func);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func_data, (jint)lpGtkMenu->position_func_data);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->toplevel, (jint)lpGtkMenu->toplevel);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->tearoff_window, (jint)lpGtkMenu->tearoff_window);
- (*env)->SetIntField(env, lpObject, lpGtkMenuFc->torn_off, (jint)lpGtkMenu->torn_off);
-}
-
-void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
-{
- DECL_GLOB(pGlob)
- getGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
- lpGtkMenuShell->active = (*env)->GetIntField(env, lpObject, lpGtkMenuShellFc->active);
-}
-
-void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
-{
- DECL_GLOB(pGlob)
- setGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
- (*env)->SetIntField(env, lpObject, lpGtkMenuShellFc->active, (jint)lpGtkMenuShell->active);
-}
-
-void getGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
-}
-
-void setGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
-}
-
-void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
-}
-
-void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
-}
-
-void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
-{
- DECL_GLOB(pGlob)
- getGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
- lpGtkCheckMenuItem->active = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->active);
- lpGtkCheckMenuItem->always_show_toggle = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle);
-}
-
-void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
-{
- DECL_GLOB(pGlob)
- setGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
- (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->active, (jint)lpGtkCheckMenuItem->active);
- (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle, (jint)lpGtkCheckMenuItem->always_show_toggle);
-}
-
-void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
-{
- DECL_GLOB(pGlob)
- getGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
-}
-
-void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
-{
- DECL_GLOB(pGlob)
- setGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
-}
-
-void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
-{
- DECL_GLOB(pGlob)
- getGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
- lpGtkAdjustment->lower = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->lower);
- lpGtkAdjustment->upper = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->upper);
- lpGtkAdjustment->value = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->value);
- lpGtkAdjustment->step_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment);
- lpGtkAdjustment->page_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment);
- lpGtkAdjustment->page_size = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size);
-}
-
-void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
-{
- DECL_GLOB(pGlob)
- setGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->lower, (jfloat)lpGtkAdjustment->lower);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->upper, (jfloat)lpGtkAdjustment->upper);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->value, (jfloat)lpGtkAdjustment->value);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment, (jfloat)lpGtkAdjustment->step_increment);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment, (jfloat)lpGtkAdjustment->page_increment);
- (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size, (jfloat)lpGtkAdjustment->page_size);
-}
-
-void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
-{
- lpGtkCListRow->cell = (GtkCell*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->cell);
- lpGtkCListRow->state = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->state);
- lpGtkCListRow->foreground.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_red);
- lpGtkCListRow->foreground.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_green);
- lpGtkCListRow->foreground.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue);
- lpGtkCListRow->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel);
- lpGtkCListRow->background.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_red);
- lpGtkCListRow->background.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_green);
- lpGtkCListRow->background.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_blue);
- lpGtkCListRow->background.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->background_pixel);
- lpGtkCListRow->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->style);
- lpGtkCListRow->data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->data);
- lpGtkCListRow->destroy = (GtkDestroyNotify)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->destroy);
- lpGtkCListRow->fg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->fg_set);
- lpGtkCListRow->bg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->bg_set);
- lpGtkCListRow->selectable = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->selectable);
-}
-
-void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
-{
- lpGtkCListColumn->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->title);
- lpGtkCListColumn->area.x = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_x);
- lpGtkCListColumn->area.y = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_y);
- lpGtkCListColumn->area.width = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_width);
- lpGtkCListColumn->area.height = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_height);
- lpGtkCListColumn->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button);
- lpGtkCListColumn->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->window);
- lpGtkCListColumn->width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width);
- lpGtkCListColumn->min_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->min_width);
- lpGtkCListColumn->max_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->max_width);
- lpGtkCListColumn->justification = (GtkJustification)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->justification);
- lpGtkCListColumn->visible = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->visible);
- lpGtkCListColumn->width_set = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width_set);
- lpGtkCListColumn->resizeable = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->resizeable);
- lpGtkCListColumn->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize);
- lpGtkCListColumn->button_passive = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button_passive);
-}
-
-void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->cell, (jint)lpGtkCListRow->cell);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->state, (jint)lpGtkCListRow->state);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_red, (jshort)lpGtkCListRow->foreground.red);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_green, (jshort)lpGtkCListRow->foreground.green);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue, (jshort)lpGtkCListRow->foreground.blue);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel, (jint)lpGtkCListRow->foreground.pixel);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_red, (jshort)lpGtkCListRow->background.red);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_green, (jshort)lpGtkCListRow->background.green);
- (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_blue, (jshort)lpGtkCListRow->background.blue);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->background_pixel, (jint)lpGtkCListRow->background.pixel);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->style, (jint)lpGtkCListRow->style);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->data, (jint)lpGtkCListRow->data);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->destroy, (jint)lpGtkCListRow->destroy);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->fg_set, (jint)lpGtkCListRow->fg_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->bg_set, (jint)lpGtkCListRow->bg_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->selectable, (jint)lpGtkCListRow->selectable);
-}
-
-void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
-{
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->title, (jint)lpGtkCListColumn->title);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_x, (jshort)lpGtkCListColumn->area.x);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_y, (jshort)lpGtkCListColumn->area.y);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_width, (jshort)lpGtkCListColumn->area.width);
- (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_height, (jshort)lpGtkCListColumn->area.height);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button, (jint)lpGtkCListColumn->button);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->window, (jint)lpGtkCListColumn->window);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width, (jshort)lpGtkCListColumn->width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->min_width, (jint)lpGtkCListColumn->min_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->max_width, (jint)lpGtkCListColumn->max_width);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->justification, (jint)lpGtkCListColumn->justification);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->visible, (jint)lpGtkCListColumn->visible);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width_set, (jint)lpGtkCListColumn->width_set);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->resizeable, (jint)lpGtkCListColumn->resizeable);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize, (jint)lpGtkCListColumn->auto_resize);
- (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button_passive, (jint)lpGtkCListColumn->button_passive);
-}
-
-void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
-{
- DECL_GLOB(pGlob)
- getGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
- lpGtkCTree->tree_indent = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_indent);
- lpGtkCTree->tree_column = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_column);
-}
-
-void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
-{
- DECL_GLOB(pGlob)
- setGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
- (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_indent, (jint)lpGtkCTree->tree_indent);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_column, (jint)lpGtkCTree->tree_column);
-}
-
-void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
-{
- DECL_GLOB(pGlob)
- getGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
- lpGtkCTreeRow->parent = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->parent);
- lpGtkCTreeRow->sibling = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->sibling);
- lpGtkCTreeRow->children = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->children);
- lpGtkCTreeRow->pixmap_closed = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed);
- lpGtkCTreeRow->mask_closed = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed);
- lpGtkCTreeRow->pixmap_opened = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened);
- lpGtkCTreeRow->mask_opened = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened);
- lpGtkCTreeRow->level = (*env)->GetShortField(env, lpObject, lpGtkCTreeRowFc->level);
- lpGtkCTreeRow->is_leaf = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf);
- lpGtkCTreeRow->expanded = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->expanded);
-}
-
-void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
-{
- DECL_GLOB(pGlob)
- setGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->parent, (jint)lpGtkCTreeRow->parent);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->sibling, (jint)lpGtkCTreeRow->sibling);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->children, (jint)lpGtkCTreeRow->children);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed, (jint)lpGtkCTreeRow->pixmap_closed);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed, (jint)lpGtkCTreeRow->mask_closed);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened, (jint)lpGtkCTreeRow->pixmap_opened);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened, (jint)lpGtkCTreeRow->mask_opened);
- (*env)->SetShortField(env, lpObject, lpGtkCTreeRowFc->level, (jshort)lpGtkCTreeRow->level);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf, (jint)lpGtkCTreeRow->is_leaf);
- (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->expanded, (jint)lpGtkCTreeRow->expanded);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h
deleted file mode 100644
index c746b0d630..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for GTK structs.
- */
-
-#ifndef INC_structs_H
-#define INC_structs_H
-
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
-/* ----------- fid and class caches ----------- */
-/**
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-
-/* ----------- fid cache structures ----------- */
-
-typedef struct GdkColor_FID_CACHE {
- int cached;
- jclass GdkColorClass;
- jfieldID pixel, red, green, blue;
-} GdkColor_FID_CACHE;
-
-typedef GdkColor_FID_CACHE *PGdkColor_FID_CACHE;
-
-typedef struct GdkEventKey_FID_CACHE {
- int cached;
- jclass GdkEventKeyClass;
- jfieldID type, window, send_event, time, state, keyval, length, string;
-} GdkEventKey_FID_CACHE;
-
-typedef GdkEventKey_FID_CACHE *PGdkEventKey_FID_CACHE;
-
-typedef struct GdkEventButton_FID_CACHE {
- int cached;
- jclass GdkEventButtonClass;
- jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, button, source, deviceid, x_root, y_root;
-} GdkEventButton_FID_CACHE;
-
-typedef GdkEventButton_FID_CACHE *PGdkEventButton_FID_CACHE;
-
-typedef struct GdkEventMotion_FID_CACHE {
- int cached;
- jclass GdkEventMotionClass;
- jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, is_hint, source, deviceid, x_root, y_root;
-} GdkEventMotion_FID_CACHE;
-
-typedef GdkEventMotion_FID_CACHE *PGdkEventMotion_FID_CACHE;
-
-typedef struct GdkEventExpose_FID_CACHE {
- int cached;
- jclass GdkEventExposeClass;
- jfieldID type, window, send_event, x, y, width, height, count;
-} GdkEventExpose_FID_CACHE;
-
-typedef GdkEventExpose_FID_CACHE *PGdkEventExpose_FID_CACHE;
-
-typedef struct GdkFont_FID_CACHE {
- int cached;
- jclass GdkFontClass;
- jfieldID type, ascent, descent;
-} GdkFont_FID_CACHE;
-
-typedef GdkFont_FID_CACHE *PGdkFont_FID_CACHE;
-
-typedef struct GdkGCValues_FID_CACHE {
- int cached;
- jclass GdkGCValuesClass;
- jfieldID foreground_pixel, foreground_red, foreground_green, foreground_blue, background_pixel, background_red, background_green, background_blue, font, function, fill, tile, stipple, clip_mask, subwindow_mode, ts_x_origin, ts_y_origin, clip_x_origin, clip_y_origin, graphics_exposures, line_width, line_style, cap_style, join_style;
-} GdkGCValues_FID_CACHE;
-
-typedef GdkGCValues_FID_CACHE *PGdkGCValues_FID_CACHE;
-
-typedef struct GdkImage_FID_CACHE {
- int cached;
- jclass GdkImageClass;
- jfieldID type, visual, byte_order, width, height, depth, bpp, bpl, mem;
-} GdkImage_FID_CACHE;
-
-typedef GdkImage_FID_CACHE *PGdkImage_FID_CACHE;
-
-typedef struct GdkPoint_FID_CACHE {
- int cached;
- jclass GdkPointClass;
- jfieldID x, y;
-} GdkPoint_FID_CACHE;
-
-typedef GdkPoint_FID_CACHE *PGdkPoint_FID_CACHE;
-
-typedef struct GdkRectangle_FID_CACHE {
- int cached;
- jclass GdkRectangleClass;
- jfieldID x, y, width, height;
-} GdkRectangle_FID_CACHE;
-
-typedef GdkRectangle_FID_CACHE *PGdkRectangle_FID_CACHE;
-
-typedef struct GdkVisual_FID_CACHE {
- int cached;
- jclass GdkVisualClass;
- jfieldID type, depth, byte_order, colormap_size, bits_per_rgb, red_mask, red_shift, red_prec, green_mask, green_shift, green_prec, blue_mask, blue_shift, blue_prec;
-} GdkVisual_FID_CACHE;
-
-typedef GdkVisual_FID_CACHE *PGdkVisual_FID_CACHE;
-
-typedef struct GtkObject_FID_CACHE {
- int cached;
- jclass GtkObjectClass;
- jfieldID klass, flags, ref_count, object_data;
-} GtkObject_FID_CACHE;
-
-typedef GtkObject_FID_CACHE *PGtkObject_FID_CACHE;
-
-typedef struct GtkData_FID_CACHE {
- int cached;
- jclass GtkDataClass;
-} GtkData_FID_CACHE;
-
-typedef GtkData_FID_CACHE *PGtkData_FID_CACHE;
-
-typedef struct GtkAdjustment_FID_CACHE {
- int cached;
- jclass GtkAdjustmentClass;
- jfieldID lower, upper, value, step_increment, page_increment, page_size;
-} GtkAdjustment_FID_CACHE;
-
-typedef GtkAdjustment_FID_CACHE *PGtkAdjustment_FID_CACHE;
-
-typedef struct GtkAllocation_FID_CACHE {
- int cached;
- jclass GtkAllocationClass;
- jfieldID x, y, width, height;
-} GtkAllocation_FID_CACHE;
-
-typedef GtkAllocation_FID_CACHE *PGtkAllocation_FID_CACHE;
-
-typedef struct GtkWidget_FID_CACHE {
- int cached;
- jclass GtkWidgetClass;
- jfieldID private_flags, state, saved_state, name, style, req_width, req_height, alloc_x, alloc_y, alloc_width, alloc_height, window, parent;
-} GtkWidget_FID_CACHE;
-
-typedef GtkWidget_FID_CACHE *PGtkWidget_FID_CACHE;
-
-typedef struct GtkContainer_FID_CACHE {
- int cached;
- jclass GtkContainerClass;
- jfieldID focus_child, border_width, need_resize, resize_mode, resize_widgets;
-} GtkContainer_FID_CACHE;
-
-typedef GtkContainer_FID_CACHE *PGtkContainer_FID_CACHE;
-
-typedef struct GtkBin_FID_CACHE {
- int cached;
- jclass GtkBinClass;
- jfieldID child;
-} GtkBin_FID_CACHE;
-
-typedef GtkBin_FID_CACHE *PGtkBin_FID_CACHE;
-
-typedef struct GtkFrame_FID_CACHE {
- int cached;
- jclass GtkFrameClass;
- jfieldID label, shadow_type,
- label_width, label_height,
- label_xalign, label_yalign;
-} GtkFrame_FID_CACHE;
-
-typedef GtkFrame_FID_CACHE *PGtkFrame_FID_CACHE;
-
-typedef struct GtkMenu_FID_CACHE {
- int cached;
- jclass GtkMenuClass;
- jfieldID parent_menu_item, old_active_menu_item, accel_group, position_func, position_func_data, toplevel, tearoff_window, torn_off;
-} GtkMenu_FID_CACHE;
-
-typedef GtkMenu_FID_CACHE *PGtkMenu_FID_CACHE;
-
-typedef struct GtkMenuShell_FID_CACHE {
- int cached;
- jclass GtkMenuShellClass;
- jfieldID active;
-} GtkMenuShell_FID_CACHE;
-
-typedef GtkMenuShell_FID_CACHE *PGtkMenuShell_FID_CACHE;
-
-typedef struct GtkItem_FID_CACHE {
- int cached;
- jclass GtkItemClass;
-} GtkItem_FID_CACHE;
-
-typedef GtkItem_FID_CACHE *PGtkItem_FID_CACHE;
-
-typedef struct GtkMenuItem_FID_CACHE {
- int cached;
- jclass GtkMenuItemClass;
- jfieldID submenu, accelerator_signal, toggle_size, accelerator_width, show_toggle_indicator, show_submenu_indicator, submenu_placement, submenu_direction, right_justify, timer;
-} GtkMenuItem_FID_CACHE;
-
-typedef GtkMenuItem_FID_CACHE *PGtkMenuItem_FID_CACHE;
-
-typedef struct GtkCheckMenuItem_FID_CACHE {
- int cached;
- jclass GtkCheckMenuItemClass;
- jfieldID active, always_show_toggle;
-} GtkCheckMenuItem_FID_CACHE;
-
-typedef GtkCheckMenuItem_FID_CACHE *PGtkCheckMenuItem_FID_CACHE;
-
-typedef struct GtkWindow_FID_CACHE {
- int cached;
- jclass GtkWindowClass;
- jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal;
-} GtkWindow_FID_CACHE;
-
-typedef GtkWindow_FID_CACHE *PGtkWindow_FID_CACHE;
-
-typedef struct GtkDialog_FID_CACHE {
- int cached;
- jclass GtkDialogClass;
- jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal, vbox, action_area;
-} GtkDialog_FID_CACHE;
-
-typedef GtkDialog_FID_CACHE *PGtkDialog_FID_CACHE;
-
-typedef struct GtkColorSelectionDialog_FID_CACHE {
- int cached;
- jclass GtkColorSelectionDialogClass;
- jfieldID colorsel, main_vbox, ok_button, reset_button, cancel_button, help_button;
-} GtkColorSelectionDialog_FID_CACHE;
-
-typedef GtkColorSelectionDialog_FID_CACHE *PGtkColorSelectionDialog_FID_CACHE;
-
-typedef struct GtkBox_FID_CACHE {
- int cached;
- jclass GtkBoxClass;
- jfieldID children, spacing, homogeneous;
-} GtkBox_FID_CACHE;
-
-typedef GtkBox_FID_CACHE *PGtkBox_FID_CACHE;
-
-typedef struct GtkHBox_FID_CACHE {
- int cached;
- jclass GtkHBoxClass;
-} GtkHBox_FID_CACHE;
-
-typedef GtkHBox_FID_CACHE *PGtkHBox_FID_CACHE;
-
-typedef struct GtkCombo_FID_CACHE {
- int cached;
- jclass GtkComboClass;
- jfieldID entry, button, popup, popwin, list, entry_change_id, list_change_id, value_in_list, ok_if_empty, case_sensitive, use_arrows, use_arrows_always, current_button, activate_id;
-} GtkCombo_FID_CACHE;
-
-typedef GtkCombo_FID_CACHE *PGtkCombo_FID_CACHE;
-
-typedef struct GtkFileSelection_FID_CACHE {
- int cached;
- jclass GtkFileSelectionClass;
- jfieldID dir_list, file_list, selection_entry, selection_text, main_vbox, ok_button, cancel_button, help_button, history_pulldown, history_menu, history_list, fileop_dialog, fileop_entry, fileop_file, cmpl_state, fileop_c_dir, fileop_del_file, fileop_ren_file, button_area, action_area;
-} GtkFileSelection_FID_CACHE;
-
-typedef GtkFileSelection_FID_CACHE *PGtkFileSelection_FID_CACHE;
-
-typedef struct GtkFontSelectionDialog_FID_CACHE {
- int cached;
- jclass GtkFontSelectionDialogClass;
- jfieldID fontsel, main_vbox, action_area, ok_button, apply_button, cancel_button, dialog_width, auto_resize;
-} GtkFontSelectionDialog_FID_CACHE;
-
-typedef GtkFontSelectionDialog_FID_CACHE *PGtkFontSelectionDialog_FID_CACHE;
-
-typedef struct GtkCList_FID_CACHE {
- int cached;
- jclass GtkCListClass;
- jfieldID clist_flags, row_mem_chunk, cell_mem_chunk, freeze_count, internal_allocation_x, internal_allocation_y, internal_allocation_width, internal_allocation_height, rows, row_center_offset, row_height, row_list, row_list_end, columns, column_title_area_x, column_title_area_y, column_title_area_width, column_title_area_height, title_window, column, clist_window, clist_window_width, clist_window_height, hoffset, voffset, shadow_type, selection_mode, selection, selection_end, undo_selection, undo_unselection, undo_anchor, button_actions0, button_actions1, button_actions2, button_actions3, button_actions4, drag_button, click_cell_row, click_cell_column, hadjustment, vadjustment, xor_gc, fg_gc, bg_gc, cursor_drag, x_drag, focus_row, anchor, anchor_state, drag_pos, htimer, vtimer, sort_type, compare, sort_column;
-} GtkCList_FID_CACHE;
-
-typedef GtkCList_FID_CACHE *PGtkCList_FID_CACHE;
-
-typedef struct GtkEditable_FID_CACHE {
- int cached;
- jclass GtkEditableClass;
- jfieldID current_pos, selection_start_pos, selection_end_pos, has_selection, editable, visible, ic, ic_attr, clipboard_text;
-} GtkEditable_FID_CACHE;
-
-typedef GtkEditable_FID_CACHE *PGtkEditable_FID_CACHE;
-
-typedef struct GtkText_FID_CACHE {
- int cached;
- jclass GtkTextClass;
- jfieldID first_line_start_index,first_onscreen_hor_pixel,first_onscreen_ver_pixel,default_tab_width,cursor_pos_x,cursor_pos_y,cursor_virtual_x;
-} GtkText_FID_CACHE;
-
-typedef GtkText_FID_CACHE *PGtkText_FID_CACHE;
-
-typedef struct GtkProgress_FID_CACHE {
- int cached;
- jclass GtkProgressClass;
- jfieldID adjustment, offscreen_pixmap, format, x_align, y_align, show_text, activity_mode;
-} GtkProgress_FID_CACHE;
-
-typedef GtkProgress_FID_CACHE *PGtkProgress_FID_CACHE;
-
-typedef struct GtkProgressBar_FID_CACHE {
- int cached;
- jclass GtkProgressBarClass;
- jfieldID bar_style, orientation, blocks, in_block, activity_pos, activity_step, activity_blocks, activity_dir;
-} GtkProgressBar_FID_CACHE;
-
-typedef GtkProgressBar_FID_CACHE *PGtkProgressBar_FID_CACHE;
-
-typedef struct GtkArg_FID_CACHE {
- int cached;
- jclass GtkArgClass;
- jfieldID type, name, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
-} GtkArg_FID_CACHE;
-
-typedef GtkArg_FID_CACHE *PGtkArg_FID_CACHE;
-
-typedef struct GtkRequisition_FID_CACHE {
- int cached;
- jclass GtkRequisitionClass;
- jfieldID width, height;
-} GtkRequisition_FID_CACHE;
-
-typedef GtkRequisition_FID_CACHE *PGtkRequisition_FID_CACHE;
-
-typedef struct GtkStyle_FID_CACHE {
- int cached;
- jclass GtkStyleClazz;
- jfieldID klass, fg0_pixel, fg0_red, fg0_green, fg0_blue, fg1_pixel, fg1_red, fg1_green, fg1_blue, fg2_pixel, fg2_red, fg2_green, fg2_blue, fg3_pixel, fg3_red, fg3_green, fg3_blue, fg4_pixel, fg4_red, fg4_green, fg4_blue, bg0_pixel, bg0_red, bg0_green, bg0_blue, bg1_pixel, bg1_red, bg1_green, bg1_blue, bg2_pixel, bg2_red, bg2_green, bg2_blue, bg3_pixel, bg3_red, bg3_green, bg3_blue, bg4_pixel, bg4_red, bg4_green, bg4_blue, light0_pixel, light0_red, light0_green, light0_blue, light1_pixel, light1_red, light1_green, light1_blue, light2_pixel, light2_red, light2_green, light2_blue, light3_pixel, light3_red, light3_green, light3_blue, light4_pixel, light4_red, light4_green, light4_blue, dark0_pixel, dark0_red, dark0_green, dark0_blue, dark1_pixel, dark1_red, dark1_green, dark1_blue, dark2_pixel, dark2_red, dark2_green, dark2_blue, dark3_pixel, dark3_red, dark3_green, dark3_blue, dark4_pixel, dark4_red, dark4_green, dark4_blue, mid0_pixel, mid0_red, mid0_green, mid0_blue, mid1_pixel, mid1_red, mid1_green, mid1_blue, mid2_pixel, mid2_red, mid2_green, mid2_blue, mid3_pixel, mid3_red, mid3_green, mid3_blue, mid4_pixel, mid4_red, mid4_green, mid4_blue, text0_pixel, text0_red, text0_green, text0_blue, text1_pixel, text1_red, text1_green, text1_blue, text2_pixel, text2_red, text2_green, text2_blue, text3_pixel, text3_red, text3_green, text3_blue, text4_pixel, text4_red, text4_green, text4_blue, base0_pixel, base0_red, base0_green, base0_blue, base1_pixel, base1_red, base1_green, base1_blue, base2_pixel, base2_red, base2_green, base2_blue, base3_pixel, base3_red, base3_green, base3_blue, base4_pixel, base4_red, base4_green, base4_blue, black_pixel, black_red, black_green, black_blue, white_pixel, white_red, white_green, white_blue, font, fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4, bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4, light_gc0, light_gc1, light_gc2, light_gc3, light_gc4, dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4, mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4, text_gc0, text_gc1, text_gc2, text_gc3, text_gc4, base_gc0, base_gc1, base_gc2, base_gc3, base_gc4, black_gc, white_gc, bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
- jfieldID ref_count, attach_count, depth, colormap, engine, engine_data, rc_style, styles;
-} GtkStyle_FID_CACHE;
-
-typedef GtkStyle_FID_CACHE *PGtkStyle_FID_CACHE;
-
-typedef struct GtkStyleClass_FID_CACHE {
- int cached;
- jclass GtkStyleClassClazz;
- jfieldID xthickness, ythickness;
-} GtkStyleClass_FID_CACHE;
-
-typedef GtkStyleClass_FID_CACHE *PGtkStyleClass_FID_CACHE;
-
-typedef struct GtkCListRow_FID_CACHE {
- int cached;
- jclass GtkCListRowClass;
- jfieldID cell, state, foreground_red, foreground_green, foreground_blue, foreground_pixel, background_red, background_green, background_blue, background_pixel, style, data, destroy, fg_set, bg_set, selectable;
-} GtkCListRow_FID_CACHE;
-
-typedef GtkCListRow_FID_CACHE *PGtkCListRow_FID_CACHE;
-
-typedef struct GtkCListColumn_FID_CACHE {
- int cached;
- jclass GtkCListColumnClass;
- jfieldID title, area_x, area_y, area_width, area_height, button, window, width, min_width, max_width, justification, visible, width_set, resizeable, auto_resize, button_passive;
-} GtkCListColumn_FID_CACHE;
-
-typedef GtkCListColumn_FID_CACHE *PGtkCListColumn_FID_CACHE;
-
-typedef struct GtkCTreeRow_FID_CACHE {
- int cached;
- jclass GtkCTreeRowClass;
- jfieldID parent, sibling, children, pixmap_closed, mask_closed, pixmap_opened, mask_opened, level, is_leaf, expanded;
-} GtkCTreeRow_FID_CACHE;
-
-typedef GtkCTreeRow_FID_CACHE *PGtkCTreeRow_FID_CACHE;
-
-typedef struct GtkCTree_FID_CACHE {
- int cached;
- jclass GtkCTreeClass;
- jfieldID tree_indent, tree_column;
-
-} GtkCTree_FID_CACHE;
-
-typedef GtkCTree_FID_CACHE *PGtkCTree_FID_CACHE;
-
-/* ----------- cache function prototypes ----------- */
-
-void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache);
-void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache);
-void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache);
-void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache);
-void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache);
-void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache);
-void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache);
-void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache);
-void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache);
-void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache);
-void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache);
-
-void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache);
-void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache);
-void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache);
-void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache);
-void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache);
-void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache);
-void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache);
-void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache);
-void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache);
-void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache);
-void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache);
-void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache);
-void cacheGtkDialogFids(JNIEnv *env, jobject lpGtkDialog, PGtkDialog_FID_CACHE lpCache);
-void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache);
-void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache);
-void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache);
-void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache);
-void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache);
-void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache);
-void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache);
-void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache);
-void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache);
-void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache);
-void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache);
-
-void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache);
-void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache);
-void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache);
-void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache);
-void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache);
-void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache);
-void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache);
-void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache);
-void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache);
-
-/* ----------- swt getter and setter prototypes ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- * The header file just contains function prototypes
- */
-void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
-void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
-void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
-void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
-void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
-void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
-void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
-void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
-void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
-void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
-void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
-void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
-void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
-void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
-void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
-void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
-void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
-void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
-void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
-void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
-void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
-void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
-void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
-void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
-void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
-void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
-void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
-void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
-void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
-void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
-void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
-void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
-void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
-void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
-void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
-void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
-void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
-void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
-void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
-void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
-void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
-void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
-void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
-void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
-void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
-void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
-void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
-void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
-void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
-void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
-void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
-void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
-void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
-void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
-void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
-void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
-void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
-void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
-void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
-void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
-void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
-void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
-void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
-void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
-void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
-void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
-void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
-void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
-void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
-void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
-void getGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc);
-void setGtkDialogFields(JNIEnv *env, jobject lpObject, GtkDialog *lpGtkDialog, GtkDialog_FID_CACHE *lpGtkDialogFc);
-void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
-void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
-void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
-void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
-void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
-void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
-void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
-void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
-void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
-void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
-void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
-void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
-void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
-void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
-void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
-void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
-
-extern GdkColor_FID_CACHE GdkColorFc;
-extern GdkEventKey_FID_CACHE GdkEventKeyFc;
-extern GdkEventButton_FID_CACHE GdkEventButtonFc;
-extern GdkEventMotion_FID_CACHE GdkEventMotionFc;
-extern GdkEventExpose_FID_CACHE GdkEventExposeFc;
-extern GdkFont_FID_CACHE GdkFontFc;
-extern GdkGCValues_FID_CACHE GdkGCValuesFc;
-extern GdkImage_FID_CACHE GdkImageFc;
-extern GdkPoint_FID_CACHE GdkPointFc;
-extern GdkRectangle_FID_CACHE GdkRectangleFc;
-extern GdkVisual_FID_CACHE GdkVisualFc;
-
-extern GtkAdjustment_FID_CACHE GtkAdjustmentFc;
-extern GtkAllocation_FID_CACHE GtkAllocationFc;
-extern GtkBin_FID_CACHE GtkBinFc;
-extern GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
-extern GtkContainer_FID_CACHE GtkContainerFc;
-extern GtkCListRow_FID_CACHE GtkCListRowFc;
-extern GtkCListColumn_FID_CACHE GtkCListColumnFc;
-extern GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
-extern GtkCTree_FID_CACHE GtkCTreeFc;
-extern GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
-extern GtkCList_FID_CACHE GtkCListFc;
-extern GtkData_FID_CACHE GtkDataFc;
-extern GtkEditable_FID_CACHE GtkEditableFc;
-extern GtkItem_FID_CACHE GtkItemFc;
-extern GtkMenu_FID_CACHE GtkMenuFc;
-extern GtkMenuShell_FID_CACHE GtkMenuShellFc;
-extern GtkMenuItem_FID_CACHE GtkMenuItemFc;
-extern GtkObject_FID_CACHE GtkObjectFc;
-extern GtkWidget_FID_CACHE GtkWidgetFc;
-extern GtkWindow_FID_CACHE GtkWindowFc;
-extern GtkDialog_FID_CACHE GtkDialogFc;
-extern GtkBox_FID_CACHE GtkBoxFc;
-extern GtkHBox_FID_CACHE GtkHBoxFc;
-extern GtkCombo_FID_CACHE GtkComboFc;
-extern GtkFileSelection_FID_CACHE GtkFileSelectionFc;
-extern GtkFrame_FID_CACHE GtkFrameFc;
-extern GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
-extern GtkText_FID_CACHE GtkTextFc;
-extern GtkProgress_FID_CACHE GtkProgressFc;
-extern GtkProgressBar_FID_CACHE GtkProgressBarFc;
-extern GtkArg_FID_CACHE GtkArgFc;
-extern GtkRequisition_FID_CACHE GtkRequisitionFc;
-extern GtkStyle_FID_CACHE GtkStyleFc;
-extern GtkStyleClass_FID_CACHE GtkStyleClassFc;
-
-#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
deleted file mode 100644
index a9f8db8414..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
+++ /dev/null
@@ -1,7865 +0,0 @@
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-/**
- * SWT OS natives implementation.
- */
-
-/*#define PRINT_FAILED_RCODES*/
-#define NDEBUG
-
-#include "swt.h"
-#include "structs.h"
-
-#include <stdio.h>
-#include <assert.h>
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_draw_check
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1draw_1check
- (JNIEnv *env, jclass that, jint style, jint window, jint state_type, jint shadow_type, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive_to_depth");
-#endif
-
- gtk_draw_check((GtkStyle*)style, (GdkWindow *) window, (GtkStateType)state_type, (GtkShadowType)shadow_type, (gint) x, (gint) y, (gint) width, (gint) height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_post_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive_1to_1depth
- (JNIEnv *env, jclass that, jint ctree, jint node, jint depth, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive_to_depth");
-#endif
-
- gtk_ctree_post_recursive_to_depth((GtkCTree*)ctree, (GtkCTreeNode*)node, (jint)depth, (GtkCTreeFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_row_is_visible
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1row_1is_1visible
- (JNIEnv *env, jclass that, jint clist, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_row_is_visible");
-#endif
-
- return gtk_clist_row_is_visible((GtkCList *)clist, (gint)row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_default_handler
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint log_levels, jint message, jint unused_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_default_handler");
-#endif
-
- g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *)message, (gpointer)unused_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_set_handler
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
- (JNIEnv *env, jclass that, jbyteArray log_domain, jint log_levels, jint log_func, jint user_data)
-{
- jint rc;
- jbyte *log_domain1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_set_handler");
-#endif
-
- if (log_domain) {
- log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
- }
- rc = (jint) g_log_set_handler((gchar *)log_domain1, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
- if (log_domain) {
- (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_log_remove_handler
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1remove_1handler
- (JNIEnv *env, jclass that, jbyteArray log_domain, jint handler_id)
-{
- jbyte *log_domain1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_log_remove_handler");
-#endif
-
- if (log_domain) {
- log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
- }
- g_log_remove_handler((gchar *)log_domain1, handler_id);
- if (log_domain) {
- (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: GTK_WIDGET_TYPE
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1TYPE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_TYPE");
-#endif
-
- return GTK_WIDGET_TYPE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_get_type
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1get_1type
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_get_type");
-#endif
-
- return gtk_label_get_type ();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1unref
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_unref");
-#endif
-
- gtk_object_unref((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_ref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1destroy
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_destroy");
-#endif
-
- gtk_object_destroy((GtkObject*)object);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1data_1by_1id
- (JNIEnv *env, jclass that, jint object, jint data_id)
-{
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_get_data_by_id");
-#endif
- return (jint) gtk_object_get_data_by_id((GtkObject*)object, (GQuark) data_id);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1data_1by_1id
- (JNIEnv *env, jclass that, jint object, jint data_id, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_set_data_by_id");
-#endif
-
- gtk_object_set_data_by_id ((GtkObject*)object, (GQuark) data_id, (gpointer) data);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1quark_1from_1string
- (JNIEnv *env, jclass that, jbyteArray string)
-{
- jint result;
- jbyte *string1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_quark_from_string");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- result = g_quark_from_string((gchar *) string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return result;
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_block_by_data");
-#endif
-
- gtk_signal_handler_block_by_data((GtkObject*)object, (gpointer) data);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_unblock_by_data");
-#endif
-
- gtk_signal_handler_unblock_by_data((GtkObject*)object, (gpointer) data);
-}
-
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1rgb_1init
- (JNIEnv *env, jclass cl)
-{
- gdk_rgb_init();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1FLAGS
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_FLAGS");
-#endif
-
- return (jint) GTK_WIDGET_FLAGS((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SET_1FLAGS
- (JNIEnv *env, jclass that, jint wid, jint flag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_SET_FLAGS");
-#endif
-
- GTK_WIDGET_SET_FLAGS((GtkWidget*)wid, flag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1UNSET_1FLAGS
- (JNIEnv *env, jclass that, jint wid, jint flag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_UNSET_FLAGS");
-#endif
-
- GTK_WIDGET_UNSET_FLAGS((GtkWidget*)wid, flag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1NO_1WINDOW
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_NO_WINDOW");
-#endif
-
- return (jboolean) GTK_WIDGET_NO_WINDOW((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: GDK_ROOT_PARENT
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GDK_1ROOT_1PARENT
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GDK_ROOT_PARENT");
-#endif
-
- return (jint) GDK_ROOT_PARENT();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SENSITIVE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_SENSITIVE");
-#endif
-
- return (jboolean) GTK_WIDGET_SENSITIVE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1IS_1SENSITIVE
- (JNIEnv *env, jclass that, jint wid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GTK_WIDGET_IS_SENSITIVE");
-#endif
-
- return (jboolean) GTK_WIDGET_IS_SENSITIVE((GtkWidget*)wid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_accel_group_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_group_new");
-#endif
-
- return (jint)gtk_accel_group_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_accel_group_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1unref
- (JNIEnv *env, jclass that, jint accel_group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_group_unref");
-#endif
-
- gtk_accel_group_unref((GtkAccelGroup*)accel_group);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1groups_1activate
- (JNIEnv *env, jclass that, jint accel_group, jint accel_key, jint accel_mods)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_accel_groups_activate");
-#endif
-
- return (jboolean) gtk_accel_groups_activate(GTK_OBJECT((GtkWindow*)accel_group),
- accel_key,
- accel_mods);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1new
- (JNIEnv *env, jclass that, jfloat value, jfloat lower, jfloat upper, jfloat step_increment, jfloat page_increment, jfloat page_size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_new");
-#endif
-
- return (jint)gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_changed
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1changed
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_changed");
-#endif
-
- gtk_adjustment_changed((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_value_changed
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1value_1changed
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_value_changed");
-#endif
-
- gtk_adjustment_value_changed((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_adjustment_set_value
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1set_1value
- (JNIEnv *env, jclass that, jint adjustment, jfloat value)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_adjustment_set_value");
-#endif
-
- gtk_adjustment_set_value((GtkAdjustment*)adjustment, value);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_arrow_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1new
- (JNIEnv *env, jclass that, jint arrow_type, jint shadow_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_arrow_new");
-#endif
-
- return (jint)gtk_arrow_new((GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_arrow_set
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1set
- (JNIEnv *env, jclass that, jint arrow, jint arrow_type, jint shadow_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_arrow_set");
-#endif
-
- gtk_arrow_set((GtkArrow*)arrow, (GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_box_pack_start
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1start
- (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_box_pack_start");
-#endif
-
- gtk_box_pack_start((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_box_pack_end
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1end
- (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_box_pack_end");
-#endif
-
- gtk_box_pack_end((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_button_new");
-#endif
-
- return (jint)gtk_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_button_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_button_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_button_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_button_new");
-#endif
-
- return (jint)gtk_check_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_check_menu_item_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_set_active
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1active
- (JNIEnv *env, jclass that, jint check_menu_item, jboolean is_active)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_set_active");
-#endif
-
- gtk_check_menu_item_set_active((GtkCheckMenuItem*)check_menu_item, (gboolean)is_active);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_menu_item_set_show_toggle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1show_1toggle
- (JNIEnv *env, jclass that, jint menu_item, jboolean always)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_menu_item_set_show_toggle");
-#endif
-
- gtk_check_menu_item_set_show_toggle((GtkCheckMenuItem*)menu_item, (gboolean)always);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_set_color
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1set_1color
- (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
-{
- jdouble *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_set_color");
-#endif
-
- if (color) {
- color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
- }
- gtk_color_selection_set_color((GtkColorSelection*)colorsel, (gdouble*)color1);
- if (color) {
- (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_get_color
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1get_1color
- (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
-{
- jdouble *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_get_color");
-#endif
-
- if (color) {
- color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
- }
- gtk_color_selection_get_color((GtkColorSelection*)colorsel, (gdouble*)color1);
- if (color) {
- (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_color_selection_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1dialog_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_color_selection_dialog_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_color_selection_dialog_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_combo_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_combo_new");
-#endif
-
- return (jint)gtk_combo_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_combo_set_popdown_strings
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1set_1popdown_1strings
- (JNIEnv *env, jclass that, jint combo, jint strings)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_combo_set_popdown_strings");
-#endif
-
- gtk_combo_set_popdown_strings((GtkCombo*)combo, (GList*)strings);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_add
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1add
- (JNIEnv *env, jclass that, jint container, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_add");
-#endif
-
- gtk_container_add((GtkContainer*)container, (GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1remove
- (JNIEnv *env, jclass that, jint container, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_remove");
-#endif
-
- gtk_container_remove((GtkContainer*)container, (GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_container_children
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1children
- (JNIEnv *env, jclass that, jint container)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_container_children");
-#endif
-
- return (jint)gtk_container_children((GtkContainer*)container);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1new
- (JNIEnv *env, jclass that, jint columns, jint tree_column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_new");
-#endif
-
- return (jint)gtk_ctree_new((gint)columns, (gint)tree_column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_insert_node
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1insert_1node
- (JNIEnv *env, jclass that, jint ctree, jint parent, jint sibling, jintArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_insert_node");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_ctree_insert_node((GtkCTree*)ctree, (GtkCTreeNode*)parent, (GtkCTreeNode*)sibling, (gchar**)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_remove_node
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1remove_1node
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_remove_node");
-#endif
-
- gtk_ctree_remove_node((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_post_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_post_recursive");
-#endif
-
- gtk_ctree_post_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node, (GtkCTreeFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_is_viewable
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1viewable
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_is_viewable");
-#endif
-
- return (jboolean)gtk_ctree_is_viewable((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1nth
- (JNIEnv *env, jclass that, jint ctree, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_nth");
-#endif
-
- return (jint)gtk_ctree_node_nth((GtkCTree*)ctree, row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_is_hot_spot
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1hot_1spot
- (JNIEnv *env, jclass that, jint ctree, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_is_hot_spot");
-#endif
-
- return (jboolean)gtk_ctree_is_hot_spot((GtkCTree*)ctree, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_expand
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1expand
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_expand");
-#endif
-
- gtk_ctree_expand((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_collapse
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1collapse
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_collapse");
-#endif
-
- gtk_ctree_collapse((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_select
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_select");
-#endif
-
- gtk_ctree_select((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_select_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_select_recursive");
-#endif
-
- gtk_ctree_select_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_unselect_recursive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1unselect_1recursive
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_unselect_recursive");
-#endif
-
- gtk_ctree_unselect_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_set_node_info
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1set_1node_1info
- (JNIEnv *env, jclass that, jint ctree, jint node, jbyteArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_set_node_info");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_ctree_set_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_get_node_info
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1get_1node_1info
- (JNIEnv *env, jclass that, jint ctree, jint node, jintArray text, jbyteArray spacing, jintArray pixmap_closed, jintArray mask_closed, jintArray pixmap_opened, jintArray mask_opened, jbooleanArray is_leaf, jbooleanArray expanded)
-{
- jint rc;
- jint *text1 = NULL;
- jbyte *spacing1 = NULL;
- jint *pixmap_closed1 = NULL;
- jint *mask_closed1 = NULL;
- jint *pixmap_opened1 = NULL;
- jint *mask_opened1 = NULL;
- jboolean *is_leaf1 = NULL;
- jboolean *expanded1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_get_node_info");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- if (spacing) {
- spacing1 = (*env)->GetByteArrayElements(env, spacing, NULL);
- }
- if (pixmap_closed) {
- pixmap_closed1 = (*env)->GetIntArrayElements(env, pixmap_closed, NULL);
- }
- if (mask_closed) {
- mask_closed1 = (*env)->GetIntArrayElements(env, mask_closed, NULL);
- }
- if (pixmap_opened) {
- pixmap_opened1 = (*env)->GetIntArrayElements(env, pixmap_opened, NULL);
- }
- if (mask_opened) {
- mask_opened1 = (*env)->GetIntArrayElements(env, mask_opened, NULL);
- }
- if (is_leaf) {
- is_leaf1 = (*env)->GetBooleanArrayElements(env, is_leaf, NULL);
- }
- if (expanded) {
- expanded1 = (*env)->GetBooleanArrayElements(env, expanded, NULL);
- }
- rc = (jint)gtk_ctree_get_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap_closed1, (GdkBitmap**)mask_closed1, (GdkPixmap**)pixmap_opened1, (GdkBitmap**)mask_opened1, (gboolean*)is_leaf1, (gboolean*)expanded1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- if (spacing) {
- (*env)->ReleaseByteArrayElements(env, spacing, spacing1, 0);
- }
- if (pixmap_closed) {
- (*env)->ReleaseIntArrayElements(env, pixmap_closed, pixmap_closed1, 0);
- }
- if (mask_closed) {
- (*env)->ReleaseIntArrayElements(env, mask_closed, mask_closed1, 0);
- }
- if (pixmap_opened) {
- (*env)->ReleaseIntArrayElements(env, pixmap_opened, pixmap_opened1, 0);
- }
- if (mask_opened) {
- (*env)->ReleaseIntArrayElements(env, mask_opened, mask_opened1, 0);
- }
- if (is_leaf) {
- (*env)->ReleaseBooleanArrayElements(env, is_leaf, is_leaf1, 0);
- }
- if (expanded) {
- (*env)->ReleaseBooleanArrayElements(env, expanded, expanded1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_get_row_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1style
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_get_row_style");
-#endif
-
- return (jint)gtk_ctree_node_get_row_style((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_set_row_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1set_1row_1data
- (JNIEnv *env, jclass that, jint ctree, jint node, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_set_row_data");
-#endif
-
- gtk_ctree_node_set_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_get_row_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1data
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_get_row_data");
-#endif
-
- return (jint)gtk_ctree_node_get_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_moveto
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1moveto
- (JNIEnv *env, jclass that, jint ctree, jint node, jint column, jfloat row_align, jfloat col_align)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_moveto");
-#endif
-
- gtk_ctree_node_moveto((GtkCTree*)ctree, (GtkCTreeNode*)node, (gint)column, row_align, col_align);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_ctree_node_is_visible
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1is_1visible
- (JNIEnv *env, jclass that, jint ctree, jint node)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_ctree_node_is_visible");
-#endif
-
- return (jint)gtk_ctree_node_is_visible((GtkCTree*)ctree, (GtkCTreeNode*)node);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1dialog_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_dialog_new");
-#endif
-
- return (jint)gtk_dialog_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drawing_area_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drawing_area_new");
-#endif
-
- return (jint)gtk_drawing_area_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drawing_area_size
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1size
- (JNIEnv *env, jclass that, jint darea, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drawing_area_size");
-#endif
-
- gtk_drawing_area_size((GtkDrawingArea*)darea, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_select_region
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1select_1region
- (JNIEnv *env, jclass that, jint editable, jint start, jint end)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_select_region");
-#endif
-
- gtk_editable_select_region((GtkEditable*)editable, (gint)start, (gint)end);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_insert_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1insert_1text
- (JNIEnv *env, jclass that, jint editable, jbyteArray new_text, jint new_text_length, jintArray position)
-{
- jbyte *new_text1 = NULL;
- jint *position1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_insert_text");
-#endif
-
- if (new_text) {
- new_text1 = (*env)->GetByteArrayElements(env, new_text, NULL);
- }
- if (position) {
- position1 = (*env)->GetIntArrayElements(env, position, NULL);
- }
- gtk_editable_insert_text((GtkEditable*)editable, (gchar*)new_text1, (gint)new_text_length, (gint*)position1);
- if (new_text) {
- (*env)->ReleaseByteArrayElements(env, new_text, new_text1, 0);
- }
- if (position) {
- (*env)->ReleaseIntArrayElements(env, position, position1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_delete_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1text
- (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_delete_text");
-#endif
-
- gtk_editable_delete_text((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_get_chars
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1chars
- (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_get_chars");
-#endif
-
- return (jint)gtk_editable_get_chars((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_delete_selection
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1selection
- (JNIEnv *env, jclass that, jint editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_delete_selection");
-#endif
-
- gtk_editable_delete_selection((GtkEditable*)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_set_position
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1position
- (JNIEnv *env, jclass that, jint editable, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_set_position");
-#endif
-
- gtk_editable_set_position((GtkEditable*)editable, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_get_position
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1position
- (JNIEnv *env, jclass that, jint editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_get_position");
-#endif
-
- return (jint)gtk_editable_get_position((GtkEditable*)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_editable_set_editable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1editable
- (JNIEnv *env, jclass that, jint editable, jboolean is_editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_editable_set_editable");
-#endif
-
- gtk_editable_set_editable((GtkEditable*)editable, (gboolean)is_editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_new");
-#endif
-
- return (jint)gtk_entry_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1text
- (JNIEnv *env, jclass that, jint entry, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_entry_set_text((GtkEntry*)entry, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_append_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1append_1text
- (JNIEnv *env, jclass that, jint entry, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_append_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_entry_append_text((GtkEntry*)entry, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_get_text
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1get_1text
- (JNIEnv *env, jclass that, jint entry)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_get_text");
-#endif
-
- return (jint)gtk_entry_get_text((GtkEntry*)entry);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_visibility
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1visibility
- (JNIEnv *env, jclass that, jint entry, jboolean visible)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_visibility");
-#endif
-
- gtk_entry_set_visibility((GtkEntry*)entry, (gboolean)visible);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_editable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1editable
- (JNIEnv *env, jclass that, jint entry, jboolean editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_editable");
-#endif
-
- gtk_entry_set_editable((GtkEntry*)entry, (gboolean)editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_entry_set_max_length
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1max_1length
- (JNIEnv *env, jclass that, jint entry, jshort max)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_entry_set_max_length");
-#endif
-
- gtk_entry_set_max_length((GtkEntry*)entry, (guint16)max);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_event_box_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1event_1box_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_event_box_new");
-#endif
-
- return (jint)gtk_event_box_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_file_selection_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_set_filename
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1set_1filename
- (JNIEnv *env, jclass that, jint filesel, jbyteArray filename)
-{
- jbyte *filename1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_set_filename");
-#endif
-
- if (filename) {
- filename1 = (*env)->GetByteArrayElements(env, filename, NULL);
- }
- gtk_file_selection_set_filename((GtkFileSelection*)filesel, (gchar*)filename1);
- if (filename) {
- (*env)->ReleaseByteArrayElements(env, filename, filename1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_get_filename
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1get_1filename
- (JNIEnv *env, jclass that, jint filesel)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_get_filename");
-#endif
-
- return (jint)gtk_file_selection_get_filename((GtkFileSelection*)filesel);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_file_selection_complete
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1complete
- (JNIEnv *env, jclass that, jint filesel, jbyteArray pattern)
-{
- jbyte *pattern1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_file_selection_complete");
-#endif
-
- if (pattern) {
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- }
- gtk_file_selection_complete((GtkFileSelection*)filesel, (gchar*)pattern1);
- if (pattern) {
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_new");
-#endif
-
- return (jint)gtk_fixed_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_put
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1put
- (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_put");
-#endif
-
- gtk_fixed_put((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_fixed_move
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1move
- (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_fixed_move");
-#endif
-
- gtk_fixed_move((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_set_font_name
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1set_1font_1name
- (JNIEnv *env, jclass that, jint fontsel, jbyteArray fontname)
-{
- jboolean rc;
- jbyte *fontname1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_set_font_name");
-#endif
-
- if (fontname) {
- fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
- }
- rc = (jboolean)gtk_font_selection_set_font_name((GtkFontSelection*)fontsel, (gchar*)fontname1);
- if (fontname) {
- (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1new
- (JNIEnv *env, jclass that, jbyteArray title)
-{
- jint rc;
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_new");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- rc = (jint)gtk_font_selection_dialog_new((gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_get_font_name
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1get_1font_1name
- (JNIEnv *env, jclass that, jint fsd)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_get_font_name");
-#endif
-
- return (jint)gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog*)fsd);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_font_selection_dialog_set_font_name
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1set_1font_1name
- (JNIEnv *env, jclass that, jint fsd, jbyteArray fontname)
-{
- jboolean rc;
- jbyte *fontname1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_font_selection_dialog_set_font_name");
-#endif
-
- if (fontname) {
- fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
- }
- rc = (jboolean)gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog*)fsd, (gchar*)fontname1);
- if (fontname) {
- (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1new
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_new");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_frame_new((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_set_label
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1label
- (JNIEnv *env, jclass that, jint frame, jbyteArray label)
-{
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_set_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- gtk_frame_set_label((GtkFrame*)frame, (gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_frame_set_shadow_type
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1shadow_1type
- (JNIEnv *env, jclass that, jint frame, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_frame_set_shadow_type");
-#endif
-
- gtk_frame_set_shadow_type((GtkFrame*)frame, (GtkShadowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hbox_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hbox_1new
- (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hbox_new");
-#endif
-
- return (jint)gtk_hbox_new((gboolean)homogeneous, (gint)spacing);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hscale_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscale_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hscale_new");
-#endif
-
- return (jint)gtk_hscale_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hscrollbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscrollbar_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hscrollbar_new");
-#endif
-
- return (jint)gtk_hscrollbar_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_hseparator_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hseparator_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_hseparator_new");
-#endif
-
- return (jint)gtk_hseparator_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1new
- (JNIEnv *env, jclass that, jbyteArray str)
-{
- jint rc;
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_new");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- rc = (jint)gtk_label_new((gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1text
- (JNIEnv *env, jclass that, jint label, jbyteArray str)
-{
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_text");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- gtk_label_set_text((GtkLabel*)label, (gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_justify
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1justify
- (JNIEnv *env, jclass that, jint label, jint jtype)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_justify");
-#endif
-
- gtk_label_set_justify((GtkLabel*)label, (GtkJustification)jtype);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_pattern
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1pattern
- (JNIEnv *env, jclass that, jint label, jbyteArray pattern)
-{
- jbyte *pattern1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_pattern");
-#endif
-
- if (pattern) {
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- }
- gtk_label_set_pattern((GtkLabel*)label, (gchar*)pattern1);
- if (pattern) {
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_set_line_wrap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1line_1wrap
- (JNIEnv *env, jclass that, jint label, jboolean wrap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_set_line_wrap");
-#endif
-
- gtk_label_set_line_wrap((GtkLabel*)label, (gboolean)wrap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_label_parse_uline
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1parse_1uline
- (JNIEnv *env, jclass that, jint label, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_label_parse_uline");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gtk_label_parse_uline((GtkLabel*)label, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_list_clear_items
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1clear_1items
- (JNIEnv *env, jclass that, jint list, jint start, jint end)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_list_clear_items");
-#endif
-
- gtk_list_clear_items((GtkList*)list, (gint)start, (gint)end);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_list_select_item
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1select_1item
- (JNIEnv *env, jclass that, jint list, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_list_select_item");
-#endif
-
- gtk_list_select_item((GtkList*)list, (gint)item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_check_version
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1version
- (JNIEnv *env, jclass that, jint required_major, jint required_minor, jint required_micro)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_check_version");
-#endif
-
- return (jint)gtk_check_version(required_major, required_minor, required_micro);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_init_check
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1init_1check
- (JNIEnv *env, jclass that, jintArray argc, jintArray argv)
-{
- jboolean rc;
- jint *argc1 = NULL;
- jint *argv1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_init_check");
-#endif
-
- if (argc) {
- argc1 = (*env)->GetIntArrayElements(env, argc, NULL);
- }
- if (argv) {
- argv1 = (*env)->GetIntArrayElements(env, argv, NULL);
- }
- rc = (jboolean)gtk_init_check((int*)argc1, (char***)argv1);
- if (argc) {
- (*env)->ReleaseIntArrayElements(env, argc, argc1, 0);
- }
- if (argv) {
- (*env)->ReleaseIntArrayElements(env, argv, argv1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_events_pending
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1events_1pending
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_events_pending");
-#endif
-
- return (jint)gtk_events_pending();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main");
-#endif
-
- gtk_main();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main_quit
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1quit
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main_quit");
-#endif
-
- gtk_main_quit();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_main_iteration
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1iteration
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_main_iteration");
-#endif
-
- return (jint)gtk_main_iteration();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_add
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1add
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_add");
-#endif
-
- gtk_grab_add((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_get_current
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1get_1current
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_get_current");
-#endif
-
- return (jint)gtk_grab_get_current();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_grab_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1remove
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_grab_remove");
-#endif
-
- gtk_grab_remove((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_timeout_add
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1add
- (JNIEnv *env, jclass that, jint interval, jint function, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_timeout_add");
-#endif
-
- return (jint)gtk_timeout_add((guint32)interval, (GtkFunction)function, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_timeout_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1remove
- (JNIEnv *env, jclass that, jint timeout_handler_id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_timeout_remove");
-#endif
-
- gtk_timeout_remove(timeout_handler_id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_new");
-#endif
-
- return (jint)gtk_menu_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_insert
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1insert
- (JNIEnv *env, jclass that, jint menu, jint child, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_insert");
-#endif
-
- gtk_menu_insert((GtkMenu*)menu, (GtkWidget*)child, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_popup
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popup
- (JNIEnv *env, jclass that, jint menu, jint parent_menu_shell, jint parent_menu_item, jint func, jint data, jint button, jint activate_time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_popup");
-#endif
-
- gtk_menu_popup((GtkMenu*)menu, (GtkWidget*)parent_menu_shell, (GtkWidget*)parent_menu_item, (GtkMenuPositionFunc)func, (gpointer)data, button, (guint32)activate_time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_popdown
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popdown
- (JNIEnv *env, jclass that, jint menu)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_popdown");
-#endif
-
- gtk_menu_popdown((GtkMenu*)menu);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_bar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_bar_new");
-#endif
-
- return (jint)gtk_menu_bar_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_bar_insert
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1insert
- (JNIEnv *env, jclass that, jint menu_bar, jint child, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_bar_insert");
-#endif
-
- gtk_menu_bar_insert((GtkMenuBar*)menu_bar, (GtkWidget*)child, (gint)position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_new");
-#endif
-
- return (jint)gtk_menu_item_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_menu_item_new_with_label((gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_set_submenu
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1set_1submenu
- (JNIEnv *env, jclass that, jint menu_item, jint submenu)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_set_submenu");
-#endif
-
- gtk_menu_item_set_submenu((GtkMenuItem*)menu_item, (GtkWidget*)submenu);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_menu_item_remove_submenu
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1remove_1submenu
- (JNIEnv *env, jclass that, jint menu_item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_menu_item_remove_submenu");
-#endif
-
- gtk_menu_item_remove_submenu((GtkMenuItem*)menu_item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_misc_set_alignment
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1misc_1set_1alignment
- (JNIEnv *env, jclass that, jint misc, jfloat xalign, jfloat yalign)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_misc_set_alignment");
-#endif
-
- gtk_misc_set_alignment((GtkMisc*)misc, xalign, yalign);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_new");
-#endif
-
- return (jint)gtk_notebook_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_append_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1append_1page
- (JNIEnv *env, jclass that, jint notebook, jint child, jint tab_label)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_append_page");
-#endif
-
- gtk_notebook_append_page((GtkNotebook*)notebook, (GtkWidget*)child, (GtkWidget*)tab_label);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_remove_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1remove_1page
- (JNIEnv *env, jclass that, jint notebook, jint page_num)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_remove_page");
-#endif
-
- gtk_notebook_remove_page((GtkNotebook*)notebook, (gint)page_num);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_get_current_page
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1get_1current_1page
- (JNIEnv *env, jclass that, jint notebook)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_get_current_page");
-#endif
-
- return (jint)gtk_notebook_get_current_page((GtkNotebook*)notebook);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_set_page
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1page
- (JNIEnv *env, jclass that, jint notebook, jint page_num)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_set_page");
-#endif
-
- gtk_notebook_set_page((GtkNotebook*)notebook, (gint)page_num);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_notebook_set_show_tabs
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1show_1tabs
- (JNIEnv *env, jclass that, jint notebook, jboolean show_tabs)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_notebook_set_show_tabs");
-#endif
-
- gtk_notebook_set_show_tabs((GtkNotebook*)notebook, (gboolean)show_tabs);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_ref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1ref
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_ref");
-#endif
-
- gtk_object_ref((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_set_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1user_1data
- (JNIEnv *env, jclass that, jint object, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_set_user_data");
-#endif
-
- gtk_object_set_user_data((GtkObject*)object, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_object_get_user_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1user_1data
- (JNIEnv *env, jclass that, jint object)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_object_get_user_data");
-#endif
-
- return (jint)gtk_object_get_user_data((GtkObject*)object);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_pixmap_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1new
- (JNIEnv *env, jclass that, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_pixmap_new");
-#endif
-
- return (jint)gtk_pixmap_new((GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_pixmap_set
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1set
- (JNIEnv *env, jclass that, jint pixmap, jint val, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_pixmap_set");
-#endif
-
- gtk_pixmap_set((GtkPixmap*)pixmap, (GdkPixmap*)val, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_configure
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1configure
- (JNIEnv *env, jclass that, jint progress, jfloat value, jfloat min, jfloat max)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_configure");
-#endif
-
- gtk_progress_configure((GtkProgress*)progress, value, min, max);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_new_with_adjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_new");
-#endif
-
- return (jint)gtk_progress_bar_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_set_bar_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1bar_1style
- (JNIEnv *env, jclass that, jint pbar, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_set_bar_style");
-#endif
-
- gtk_progress_bar_set_bar_style((GtkProgressBar*)pbar, (GtkProgressBarStyle)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_progress_bar_set_orientation
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1orientation
- (JNIEnv *env, jclass that, jint pbar, jint orientation)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_progress_bar_set_orientation");
-#endif
-
- gtk_progress_bar_set_orientation((GtkProgressBar*)pbar, (GtkProgressBarOrientation)orientation);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1new
- (JNIEnv *env, jclass that, jint group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_button_new");
-#endif
-
- return (jint)gtk_radio_button_new((GSList*)group);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_button_group
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1group
- (JNIEnv *env, jclass that, jint radio_button)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_button_group");
-#endif
-
- return (jint)gtk_radio_button_group((GtkRadioButton*)radio_button);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_radio_menu_item_new_with_label
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1menu_1item_1new_1with_1label
- (JNIEnv *env, jclass that, jint group, jbyteArray label)
-{
- jint rc;
- jbyte *label1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_radio_menu_item_new_with_label");
-#endif
-
- if (label) {
- label1 = (*env)->GetByteArrayElements(env, label, NULL);
- }
- rc = (jint)gtk_radio_menu_item_new_with_label((GSList*)group, (gchar*)label1);
- if (label) {
- (*env)->ReleaseByteArrayElements(env, label, label1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_range_get_adjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1range_1get_1adjustment
- (JNIEnv *env, jclass that, jint range)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_range_get_adjustment");
-#endif
-
- return (jint)gtk_range_get_adjustment((GtkRange*)range);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_digits
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1digits
- (JNIEnv *env, jclass that, jint scale, jint digits)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_digits");
-#endif
-
- gtk_scale_set_digits((GtkScale*)scale, (gint)digits);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_draw_value
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1draw_1value
- (JNIEnv *env, jclass that, jint scale, jboolean draw_value)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_draw_value");
-#endif
-
- gtk_scale_set_draw_value((GtkScale*)scale, (gboolean)draw_value);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scale_set_value_pos
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1value_1pos
- (JNIEnv *env, jclass that, jint scale, jint pos)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scale_set_value_pos");
-#endif
-
- gtk_scale_set_value_pos((GtkScale*)scale, (GtkPositionType)pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1new
- (JNIEnv *env, jclass that, jint hadjustment, jint vadjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_new");
-#endif
-
- return (jint)gtk_scrolled_window_new((GtkAdjustment*)hadjustment, (GtkAdjustment*)vadjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_get_hadjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1hadjustment
- (JNIEnv *env, jclass that, jint scrolled_window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_get_hadjustment");
-#endif
-
- return (jint)gtk_scrolled_window_get_hadjustment((GtkScrolledWindow*)scrolled_window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_get_vadjustment
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1vadjustment
- (JNIEnv *env, jclass that, jint scrolled_window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_get_vadjustment");
-#endif
-
- return (jint)gtk_scrolled_window_get_vadjustment((GtkScrolledWindow*)scrolled_window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_scrolled_window_set_policy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1set_1policy
- (JNIEnv *env, jclass that, jint scrolled_window, jint hscrollbar_policy, jint vscrollbar_policy)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_scrolled_window_set_policy");
-#endif
-
- gtk_scrolled_window_set_policy((GtkScrolledWindow*)scrolled_window, (GtkPolicyType)hscrollbar_policy, (GtkPolicyType)vscrollbar_policy);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_selection_owner_set
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1owner_1set
- (JNIEnv *env, jclass that, jint widget, jint selection, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_selection_owner_set");
-#endif
-
- return (jint)gtk_selection_owner_set((GtkWidget*)widget, (GdkAtom)selection, (guint32)time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_selection_convert
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1convert
- (JNIEnv *env, jclass that, jint widget, jint selection, jint target, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_selection_convert");
-#endif
-
- return (jint)gtk_selection_convert((GtkWidget*)widget, (GdkAtom)selection, (GdkAtom)target, (guint32)time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_emit_stop_by_name
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1emit_1stop_1by_1name
- (JNIEnv *env, jclass that, jint object, jbyteArray name)
-{
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_emit_stop_by_name");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- gtk_signal_emit_stop_by_name((GtkObject*)object, (gchar*)name1);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_connect
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect
- (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
-{
- jint rc;
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_connect");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- rc = (jint)gtk_signal_connect((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_connect_after
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect_1after
- (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
-{
- jint rc;
- jbyte *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_connect_after");
-#endif
-
- if (name) {
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- }
- rc = (jint)gtk_signal_connect_after((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
- if (name) {
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_handler_block_by_func
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1func
- (JNIEnv *env, jclass that, jint object, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_block_by_func");
-#endif
-
- gtk_signal_handler_block_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_signal_handler_unblock_by_func
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1func
- (JNIEnv *env, jclass that, jint object, jint func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_signal_handler_unblock_by_func");
-#endif
-
- gtk_signal_handler_unblock_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_style_copy
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1copy
- (JNIEnv *env, jclass that, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_style_copy");
-#endif
-
- return (jint)gtk_style_copy((GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_style_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1unref
- (JNIEnv *env, jclass that, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_style_unref");
-#endif
-
- gtk_style_unref((GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1new
- (JNIEnv *env, jclass that, jint hadj, jint vadj)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_new");
-#endif
-
- return (jint)gtk_text_new((GtkAdjustment*)hadj, (GtkAdjustment*)vadj);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_set_word_wrap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1set_1word_1wrap
- (JNIEnv *env, jclass that, jint text, jint word_wrap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_set_word_wrap");
-#endif
-
- gtk_text_set_word_wrap((GtkText*)text, (gint)word_wrap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_get_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1get_1length
- (JNIEnv *env, jclass that, jint text)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_text_get_length");
-#endif
-
- return (jint)gtk_text_get_length((GtkText*)text);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_new");
-#endif
-
- return (jint)gtk_toggle_button_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_set_active
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1set_1active
- (JNIEnv *env, jclass that, jint toggle_button, jboolean is_active)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_set_active");
-#endif
-
- gtk_toggle_button_set_active((GtkToggleButton*)toggle_button, (gboolean)is_active);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toggle_button_get_active
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1get_1active
- (JNIEnv *env, jclass that, jint toggle_button)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toggle_button_get_active");
-#endif
-
- return (jboolean)gtk_toggle_button_get_active((GtkToggleButton*)toggle_button);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1new
- (JNIEnv *env, jclass that, jint orientation, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_new");
-#endif
-
- return (jint)gtk_toolbar_new((GtkOrientation)orientation, (GtkToolbarStyle)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_insert_element
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1element
- (JNIEnv *env, jclass that, jint toolbar, jint type, jint widget, jbyteArray text, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint icon, jint callback, jint user_data, jint position)
-{
- jint rc;
- jbyte *text1 = NULL;
- jbyte *tooltip_text1 = NULL;
- jbyte *tooltip_private_text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_insert_element");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- if (tooltip_text) {
- tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
- }
- if (tooltip_private_text) {
- tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
- }
- rc = (jint)gtk_toolbar_insert_element((GtkToolbar*)toolbar, (GtkToolbarChildType)type, (GtkWidget*)widget, (char*)text1, (char*)tooltip_text1, (char*)tooltip_private_text1, (GtkWidget*)icon, (GtkSignalFunc)callback, (gpointer)user_data, (gint)position);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
- if (tooltip_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
- }
- if (tooltip_private_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_insert_widget
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1widget
- (JNIEnv *env, jclass that, jint toolbar, jint widget, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint position)
-{
- jbyte *tooltip_text1 = NULL;
- jbyte *tooltip_private_text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_insert_widget");
-#endif
-
- if (tooltip_text) {
- tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
- }
- if (tooltip_private_text) {
- tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
- }
- gtk_toolbar_insert_widget((GtkToolbar*)toolbar, (GtkWidget*)widget, (char*)tooltip_text1, (char*)tooltip_private_text1, (gint)position);
- if (tooltip_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
- }
- if (tooltip_private_text) {
- (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_set_orientation
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1orientation
- (JNIEnv *env, jclass that, jint toolbar, jint orientation)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_set_orientation");
-#endif
-
- gtk_toolbar_set_orientation((GtkToolbar*)toolbar, (GtkOrientation)orientation);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_toolbar_set_button_relief
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1button_1relief
- (JNIEnv *env, jclass that, jint toolbar, jint relief)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_toolbar_set_button_relief");
-#endif
-
- gtk_toolbar_set_button_relief((GtkToolbar*)toolbar, (GtkReliefStyle)relief);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_tooltips_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_tooltips_new");
-#endif
-
- return (jint)gtk_tooltips_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_tooltips_set_tip
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1set_1tip
- (JNIEnv *env, jclass that, jint tooltips, jint widget, jbyteArray tip_text, jbyteArray tip_private)
-{
- jbyte *tip_text1 = NULL;
- jbyte *tip_private1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_tooltips_set_tip");
-#endif
-
- if (tip_text) {
- tip_text1 = (*env)->GetByteArrayElements(env, tip_text, NULL);
- }
- if (tip_private) {
- tip_private1 = (*env)->GetByteArrayElements(env, tip_private, NULL);
- }
- gtk_tooltips_set_tip((GtkTooltips*)tooltips, (GtkWidget*)widget, (gchar*)tip_text1, (gchar*)tip_private1);
- if (tip_text) {
- (*env)->ReleaseByteArrayElements(env, tip_text, tip_text1, 0);
- }
- if (tip_private) {
- (*env)->ReleaseByteArrayElements(env, tip_private, tip_private1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vbox_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vbox_1new
- (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vbox_new");
-#endif
-
- return (jint)gtk_vbox_new((gboolean)homogeneous, (gint)spacing);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vscale_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscale_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vscale_new");
-#endif
-
- return (jint)gtk_vscale_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vscrollbar_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscrollbar_1new
- (JNIEnv *env, jclass that, jint adjustment)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vscrollbar_new");
-#endif
-
- return (jint)gtk_vscrollbar_new((GtkAdjustment*)adjustment);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_vseparator_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vseparator_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_vseparator_new");
-#endif
-
- return (jint)gtk_vseparator_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1destroy
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_destroy");
-#endif
-
- gtk_widget_destroy((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_show
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show");
-#endif
-
- gtk_widget_show((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_show_now
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1now
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show_now");
-#endif
-
- gtk_widget_show_now((GtkWidget*)widget);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1all
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_show_all");
-#endif
-
- gtk_widget_show_all((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_hide
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1hide
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_hide");
-#endif
-
- gtk_widget_hide((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_realize
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1realize
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_realize");
-#endif
-
- gtk_widget_realize((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_queue_draw
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1queue_1draw
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_queue_draw");
-#endif
-
- gtk_widget_queue_draw((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_size_request
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1request
- (JNIEnv *env, jclass that, jint widget, jobject requisition)
-{
- DECL_GLOB(pGlob)
- GtkRequisition requisition_struct, *requisition1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_size_request");
-#endif
-
- if (requisition) {
- requisition1 = &requisition_struct;
- cacheGtkRequisitionFids(env, requisition, &PGLOB(GtkRequisitionFc));
- getGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
- }
- gtk_widget_size_request((GtkWidget*)widget, (GtkRequisition*)requisition1);
- if (requisition) {
- setGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_size_allocate
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1allocate
- (JNIEnv *env, jclass that, jint widget, jobject allocation)
-{
- DECL_GLOB(pGlob)
- GtkAllocation allocation_struct, *allocation1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_size_allocate");
-#endif
-
- if (allocation) {
- allocation1 = &allocation_struct;
- cacheGtkAllocationFids(env, allocation, &PGLOB(GtkAllocationFc));
- getGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
- }
- gtk_widget_size_allocate((GtkWidget*)widget, (GtkAllocation*)allocation1);
- if (allocation) {
- setGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_add_accelerator
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1accelerator
- (JNIEnv *env, jclass that, jint widget, jbyteArray accel_signal, jint accel_group, jint accel_key, jint accel_mods, jint accel_flags)
-{
- jbyte *accel_signal1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_add_accelerator");
-#endif
-
- if (accel_signal) {
- accel_signal1 = (*env)->GetByteArrayElements(env, accel_signal, NULL);
- }
- gtk_widget_add_accelerator((GtkWidget*)widget, (gchar*)accel_signal1, (GtkAccelGroup*)accel_group, accel_key, accel_mods, (GtkAccelFlags)accel_flags);
- if (accel_signal) {
- (*env)->ReleaseByteArrayElements(env, accel_signal, accel_signal1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_remove_accelerator
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1remove_1accelerator
- (JNIEnv *env, jclass that, jint widget, jint accel_group, jint accel_key, jint accel_mods)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_remove_accelerator");
-#endif
-
- gtk_widget_remove_accelerator((GtkWidget*)widget, (GtkAccelGroup*)accel_group, accel_key, accel_mods);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_event
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1event
- (JNIEnv *env, jclass that, jint widget, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_event");
-#endif
-
- return (jint)gtk_widget_event((GtkWidget*)widget, (GdkEvent*)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_reparent
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1reparent
- (JNIEnv *env, jclass that, jint widget, jint new_parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_reparent");
-#endif
-
- gtk_widget_reparent((GtkWidget*)widget, (GtkWidget*)new_parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_grab_focus
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1grab_1focus
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_grab_focus");
-#endif
-
- gtk_widget_grab_focus((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_state
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1state
- (JNIEnv *env, jclass that, jint widget, jint state)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_state");
-#endif
-
- gtk_widget_set_state((GtkWidget*)widget, (GtkStateType)state);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_sensitive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1sensitive
- (JNIEnv *env, jclass that, jint widget, jboolean sensitive)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_sensitive");
-#endif
-
- gtk_widget_set_sensitive((GtkWidget*)widget, (gboolean)sensitive);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_parent
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1parent
- (JNIEnv *env, jclass that, jint widget, jint parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_parent");
-#endif
-
- gtk_widget_set_parent((GtkWidget*)widget, (GtkWidget*)parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_uposition
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1uposition
- (JNIEnv *env, jclass that, jint widget, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_uposition");
-#endif
-
- gtk_widget_set_uposition((GtkWidget*)widget, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_usize
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1usize
- (JNIEnv *env, jclass that, jint widget, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_usize");
-#endif
-
- gtk_widget_set_usize((GtkWidget*)widget, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_add_events
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1events
- (JNIEnv *env, jclass that, jint widget, jint events)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_add_events");
-#endif
-
- gtk_widget_add_events((GtkWidget*)widget, (gint)events);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_set_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1style
- (JNIEnv *env, jclass that, jint widget, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_set_style");
-#endif
-
- gtk_widget_set_style((GtkWidget*)widget, (GtkStyle*)style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_ensure_style
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1ensure_1style
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_ensure_style");
-#endif
-
- gtk_widget_ensure_style((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_get_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1style
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_get_style");
-#endif
-
- return (jint)gtk_widget_get_style((GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_widget_get_default_style
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1default_1style
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_widget_get_default_style");
-#endif
-
- return (jint)gtk_widget_get_default_style();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1new
- (JNIEnv *env, jclass that, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_new");
-#endif
-
- return (jint)gtk_window_new((GtkWindowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_set_title
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1title
- (JNIEnv *env, jclass that, jint window, jbyteArray title)
-{
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_title");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- gtk_window_set_title((GtkWindow*)window, (gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1transient_1for
- (JNIEnv *env, jclass that, jint window, jint parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_transient_for");
-#endif
- gtk_window_set_transient_for((GtkWindow*)window, (GtkWindow*)parent);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1modal
- (JNIEnv *env, jclass that, jint window, jboolean modal)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_modal");
-#endif
- gtk_window_set_modal((GtkWindow*)window, modal);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_set_policy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1policy
- (JNIEnv *env, jclass that, jint window, jint allow_shrink, jint allow_grow, jint auto_shrink)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_set_policy");
-#endif
-
- gtk_window_set_policy((GtkWindow*)window, (gint)allow_shrink, (gint)allow_grow, (gint)auto_shrink);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_window_add_accel_group
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1add_1accel_1group
- (JNIEnv *env, jclass that, jint window, jint accel_group)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_window_add_accel_group");
-#endif
-
- gtk_window_add_accel_group((GtkWindow*)window, (GtkAccelGroup*)accel_group);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_get");
-#endif
-
- return (jint)gdk_event_get();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_get_graphics_expose
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get_1graphics_1expose
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_get_graphics_expose");
-#endif
-
- return (jint)gdk_event_get_graphics_expose((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_event_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1free
- (JNIEnv *env, jclass that, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_event_free");
-#endif
-
- gdk_event_free((GdkEvent*)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_time_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1time_1get
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_time_get");
-#endif
-
- return (jint)gdk_time_get();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_width");
-#endif
-
- return (jint)gdk_screen_width();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_height
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1height
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_height");
-#endif
-
- return (jint)gdk_screen_height();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_screen_width_mm
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width_1mm
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_screen_width_mm");
-#endif
-
- return (jint)gdk_screen_width_mm();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_flush
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1flush
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_flush");
-#endif
-
- gdk_flush();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_beep
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1beep
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_beep");
-#endif
-
- gdk_beep();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_visual_get_system
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1visual_1get_1system
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_visual_get_system");
-#endif
-
- return (jint)gdk_visual_get_system();
-}
-
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1pixtext
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text, jintArray spacing, jintArray pixmap, jintArray mask)
-{
- jint *text1 = NULL;
- jint *spacing1 = NULL;
- jint *pixmap1 = NULL;
- jint *mask1 = NULL;
- int rc;
-
- if (text) text1 = (*env)->GetIntArrayElements(env, text, NULL);
- if (spacing) spacing1 = (*env)->GetIntArrayElements(env, spacing, NULL);
- if (pixmap) pixmap1 = (*env)->GetIntArrayElements(env, pixmap, NULL);
- if (mask) mask1 = (*env)->GetIntArrayElements(env, mask, NULL);
- rc = gtk_clist_get_pixtext((GtkCList*)clist, row, column, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap1, (GdkBitmap**)mask1);
- if (text) (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- if (spacing) (*env)->ReleaseIntArrayElements(env, spacing, spacing1, 0);
- if (pixmap) (*env)->ReleaseIntArrayElements(env, pixmap, pixmap1, 0);
- if (mask) (*env)->ReleaseIntArrayElements(env, mask, mask1, 0);
-
- return (jint) rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_at_pointer
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1at_1pointer
- (JNIEnv *env, jclass that, jintArray win_x, jintArray win_y)
-{
- jint rc;
- jint *win_x1 = NULL;
- jint *win_y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_at_pointer");
-#endif
-
- if (win_x) {
- win_x1 = (*env)->GetIntArrayElements(env, win_x, NULL);
- }
- if (win_y) {
- win_y1 = (*env)->GetIntArrayElements(env, win_y, NULL);
- }
- rc = (jint)gdk_window_at_pointer((gint*)win_x1, (gint*)win_y1);
- if (win_x) {
- (*env)->ReleaseIntArrayElements(env, win_x, win_x1, 0);
- }
- if (win_y) {
- (*env)->ReleaseIntArrayElements(env, win_y, win_y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_clear_area
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_clear_area");
-#endif
-
- gdk_window_clear_area((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1resize
- (JNIEnv *env, jclass that, jint window, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_resize");
-#endif
-
- gdk_window_resize((GdkWindow*)window, (gint)width, (gint)height);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1move
- (JNIEnv *env, jclass that, jint window, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_move");
-#endif
-
- gdk_window_move((GdkWindow*)window, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_clear_area_e
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area_1e
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_clear_area_e");
-#endif
-
- gdk_window_clear_area_e((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_copy_area
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1copy_1area
- (JNIEnv *env, jclass that, jint window, jint gc, jint x, jint y, jint source_window, jint source_x, jint source_y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_copy_area");
-#endif
-
- gdk_window_copy_area((GdkWindow*)window, (GdkGC*)gc, (gint)x, (gint)y, (GdkWindow*)source_window, (gint)source_x, (gint)source_y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_raise
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1raise
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_raise");
-#endif
-
- gdk_window_raise((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_lower
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1lower
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_lower");
-#endif
-
- gdk_window_lower((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1user_1data
- (JNIEnv *env, jclass that, jint window, jint user_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_user_data");
-#endif
-
- gdk_window_set_user_data((GdkWindow*)window, (gpointer)user_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_cursor
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1cursor
- (JNIEnv *env, jclass that, jint window, jint cursor)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_cursor");
-#endif
-
- gdk_window_set_cursor((GdkWindow*)window, (GdkCursor*)cursor);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_user_data
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1user_1data
- (JNIEnv *env, jclass that, jint window, jintArray data)
-{
- jint *data1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_user_data");
-#endif
-
- if (data) {
- data1 = (*env)->GetIntArrayElements(env, data, NULL);
- }
- gdk_window_get_user_data((GdkWindow*)window, (gpointer*)data1);
- if (data) {
- (*env)->ReleaseIntArrayElements(env, data, data1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_geometry
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1geometry
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jintArray width, jintArray height, jintArray depth)
-{
- jint *x1 = NULL;
- jint *y1 = NULL;
- jint *width1 = NULL;
- jint *height1 = NULL;
- jint *depth1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_geometry");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- if (width) {
- width1 = (*env)->GetIntArrayElements(env, width, NULL);
- }
- if (height) {
- height1 = (*env)->GetIntArrayElements(env, height, NULL);
- }
- if (depth) {
- depth1 = (*env)->GetIntArrayElements(env, depth, NULL);
- }
- gdk_window_get_geometry((GdkWindow*)window, (gint*)x1, (gint*)y1, (gint*)width1, (gint*)height1, (gint*)depth1);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- if (width) {
- (*env)->ReleaseIntArrayElements(env, width, width1, 0);
- }
- if (height) {
- (*env)->ReleaseIntArrayElements(env, height, height1, 0);
- }
- if (depth) {
- (*env)->ReleaseIntArrayElements(env, depth, depth1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_origin
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
-{
- jint rc;
- jint *x1 = NULL;
- jint *y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_origin");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- rc = (jint)gdk_window_get_origin((GdkWindow*)window, (gint*)x1, (gint*)y1);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_get_pointer
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1pointer
- (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jint mask)
-{
- jint rc;
- jint *x1 = NULL;
- jint *y1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_get_pointer");
-#endif
-
- if (x) {
- x1 = (*env)->GetIntArrayElements(env, x, NULL);
- }
- if (y) {
- y1 = (*env)->GetIntArrayElements(env, y, NULL);
- }
- rc = (jint)gdk_window_get_pointer((GdkWindow*)window, (gint*)x1, (gint*)y1, (GdkModifierType*)mask);
- if (x) {
- (*env)->ReleaseIntArrayElements(env, x, x1, 0);
- }
- if (y) {
- (*env)->ReleaseIntArrayElements(env, y, y1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_icon
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1icon
- (JNIEnv *env, jclass that, jint window, jint icon_window, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_icon");
-#endif
-
- gdk_window_set_icon((GdkWindow*)window, (GdkWindow*)icon_window, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_window_set_decorations
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1decorations
- (JNIEnv *env, jclass that, jint window, jint decorations)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_set_decorations");
-#endif
-
- gdk_window_set_decorations((GdkWindow*)window, (GdkWMDecoration)decorations);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1show
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_window_show");
-#endif
-
- gdk_window_show((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new
- (JNIEnv *env, jclass that, jint cursor_type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_new");
-#endif
-
- return (jint)gdk_cursor_new((GdkCursorType)cursor_type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_new_from_pixmap
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new_1from_1pixmap
- (JNIEnv *env, jclass that, jint source, jint mask, jobject fg, jobject bg, jint x, jint y)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkColor fg_struct, *fg1 = NULL;
- GdkColor bg_struct, *bg1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_new_from_pixmap");
-#endif
-
- if (fg) {
- fg1 = &fg_struct;
- cacheGdkColorFids(env, fg, &PGLOB(GdkColorFc));
- getGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
- }
- if (bg) {
- bg1 = &bg_struct;
- cacheGdkColorFids(env, bg, &PGLOB(GdkColorFc));
- getGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
- }
- rc = (jint)gdk_cursor_new_from_pixmap((GdkPixmap*)source, (GdkPixmap*)mask, (GdkColor*)fg1, (GdkColor*)bg1, (gint)x, (gint)y);
- if (fg) {
- setGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
- }
- if (bg) {
- setGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_cursor_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1destroy
- (JNIEnv *env, jclass that, jint cursor)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_cursor_destroy");
-#endif
-
- gdk_cursor_destroy((GdkCursor*)cursor);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1new
- (JNIEnv *env, jclass that, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_new");
-#endif
-
- return (jint)gdk_gc_new((GdkWindow*)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1unref
- (JNIEnv *env, jclass that, jint gc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_unref");
-#endif
-
- gdk_gc_unref((GdkGC*)gc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1destroy
- (JNIEnv *env, jclass that, jint gc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_destroy");
-#endif
-
- gdk_gc_destroy((GdkGC*)gc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_get_values
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1get_1values
- (JNIEnv *env, jclass that, jint gc, jobject values)
-{
- DECL_GLOB(pGlob)
- GdkGCValues values_struct, *values1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_get_values");
-#endif
-
- if (values) {
- values1 = &values_struct;
- cacheGdkGCValuesFids(env, values, &PGLOB(GdkGCValuesFc));
- getGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
- }
- gdk_gc_get_values((GdkGC*)gc, (GdkGCValues*)values1);
- if (values) {
- setGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_foreground
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1foreground
- (JNIEnv *env, jclass that, jint gc, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_foreground");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_gc_set_foreground((GdkGC*)gc, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_background
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1background
- (JNIEnv *env, jclass that, jint gc, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_background");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_gc_set_background((GdkGC*)gc, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_font
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1font
- (JNIEnv *env, jclass that, jint gc, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_font");
-#endif
-
- gdk_gc_set_font((GdkGC*)gc, (GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_function
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1function
- (JNIEnv *env, jclass that, jint gc, jint function)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_function");
-#endif
-
- gdk_gc_set_function((GdkGC*)gc, (GdkFunction)function);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_fill
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1fill
- (JNIEnv *env, jclass that, jint gc, jint fill)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_fill");
-#endif
-
- gdk_gc_set_fill((GdkGC*)gc, (GdkFill)fill);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_stipple
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1stipple
- (JNIEnv *env, jclass that, jint gc, jint stipple)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_stipple");
-#endif
-
- gdk_gc_set_stipple((GdkGC*)gc, (GdkPixmap*)stipple);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_mask
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1mask
- (JNIEnv *env, jclass that, jint gc, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_mask");
-#endif
-
- gdk_gc_set_clip_mask((GdkGC*)gc, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_rectangle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1rectangle
- (JNIEnv *env, jclass that, jint gc, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- GdkRectangle rectangle_struct, *rectangle1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_rectangle");
-#endif
-
- if (rectangle) {
- rectangle1 = &rectangle_struct;
- cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
- gdk_gc_set_clip_rectangle((GdkGC*)gc, (GdkRectangle*)rectangle1);
- if (rectangle) {
- setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_clip_region
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1region
- (JNIEnv *env, jclass that, jint gc, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_clip_region");
-#endif
-
- gdk_gc_set_clip_region((GdkGC*)gc, (GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_subwindow
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1subwindow
- (JNIEnv *env, jclass that, jint gc, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_subwindow");
-#endif
-
- gdk_gc_set_subwindow((GdkGC*)gc, (GdkSubwindowMode)mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_exposures
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1exposures
- (JNIEnv *env, jclass that, jint gc, jboolean exposures)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_exposures");
-#endif
-
- gdk_gc_set_exposures((GdkGC*)gc, (gboolean)exposures);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_line_attributes
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1line_1attributes
- (JNIEnv *env, jclass that, jint gc, jint line_width, jint line_style, jint cap_style, jint join_style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_line_attributes");
-#endif
-
- gdk_gc_set_line_attributes((GdkGC*)gc, (gint)line_width, (GdkLineStyle)line_style, (GdkCapStyle)cap_style, (GdkJoinStyle)join_style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_gc_set_dashes
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1dashes
- (JNIEnv *env, jclass that, jint gc, jint dash_offset, jbyteArray dash_list, jint n)
-{
- jbyte *dash_list1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_gc_set_dashes");
-#endif
-
- if (dash_list) {
- dash_list1 = (*env)->GetByteArrayElements(env, dash_list, NULL);
- }
- gdk_gc_set_dashes((GdkGC*)gc, (gint)dash_offset, (gint8*)dash_list1, (gint)n);
- if (dash_list) {
- (*env)->ReleaseByteArrayElements(env, dash_list, dash_list1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_pixmap_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1new
- (JNIEnv *env, jclass that, jint window, jint width, jint height, jint depth)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_pixmap_new");
-#endif
-
- return (jint)gdk_pixmap_new((GdkWindow*)window, (gint)width, (gint)height, (gint)depth);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_bitmap_create_from_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1create_1from_1data
- (JNIEnv *env, jclass that, jint window, jbyteArray data, jint width, jint height)
-{
- jint rc;
- jbyte *data1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_bitmap_create_from_data");
-#endif
-
- if (data) {
- data1 = (*env)->GetByteArrayElements(env, data, NULL);
- }
- rc = (jint)gdk_bitmap_create_from_data((GdkWindow*)window, (gchar*)data1, (gint)width, (gint)height);
- if (data) {
- (*env)->ReleaseByteArrayElements(env, data, data1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_pixmap_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1unref
- (JNIEnv *env, jclass that, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_pixmap_unref");
-#endif
-
- gdk_pixmap_unref((GdkPixmap*)pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_bitmap_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1unref
- (JNIEnv *env, jclass that, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_bitmap_unref");
-#endif
-
- gdk_bitmap_unref((GdkBitmap*)pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_image_get
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get
- (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_image_get");
-#endif
-
- return (jint)gdk_image_get((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_image_get_pixel
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get_1pixel
- (JNIEnv *env, jclass that, jint image, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_image_get_pixel");
-#endif
-
- return (jint)gdk_image_get_pixel((GdkImage*)image, (gint)x, (gint)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_colormap_get_system
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colormap_1get_1system
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_colormap_get_system");
-#endif
-
- return (jint)gdk_colormap_get_system();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1free
- (JNIEnv *env, jclass that, jobject color)
-{
- DECL_GLOB(pGlob)
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_free");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- gdk_color_free((GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_colors_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colors_1free
- (JNIEnv *env, jclass that, jint colormap, jintArray pixels, jint npixels, jint planes)
-{
- jint *pixels1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_colors_free");
-#endif
-
- if (pixels) {
- pixels1 = (*env)->GetIntArrayElements(env, pixels, NULL);
- }
- gdk_colors_free((GdkColormap*)colormap, (gulong*)pixels1, (gint)npixels, (gulong)planes);
- if (pixels) {
- (*env)->ReleaseIntArrayElements(env, pixels, pixels1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_white
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1white
- (JNIEnv *env, jclass that, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- jboolean rc;
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_white");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- rc = (jboolean)gdk_color_white((GdkColormap*)colormap, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_color_alloc
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1alloc
- (JNIEnv *env, jclass that, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- jboolean rc;
- GdkColor color_struct, *color1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_color_alloc");
-#endif
-
- if (color) {
- color1 = &color_struct;
- cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
- getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- rc = (jboolean)gdk_color_alloc((GdkColormap*)colormap, (GdkColor*)color1);
- if (color) {
- setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_load
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1load
- (JNIEnv *env, jclass that, jbyteArray font_name)
-{
- jint rc;
- jbyte *font_name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_load");
-#endif
-
- if (font_name) {
- font_name1 = (*env)->GetByteArrayElements(env, font_name, NULL);
- }
- rc = (jint)gdk_font_load((gchar*)font_name1);
- if (font_name) {
- (*env)->ReleaseByteArrayElements(env, font_name, font_name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_ref
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1ref
- (JNIEnv *env, jclass that, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_ref");
-#endif
-
- return (jint)gdk_font_ref((GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_unref
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1unref
- (JNIEnv *env, jclass that, jint font)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_unref");
-#endif
-
- gdk_font_unref((GdkFont*)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_font_equal
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1equal
- (JNIEnv *env, jclass that, jint fonta, jint fontb)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_font_equal");
-#endif
-
- return (jboolean)gdk_font_equal((GdkFont*)fonta, (GdkFont*)fontb);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1width
- (JNIEnv *env, jclass that, jint font, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_width");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gdk_string_width((GdkFont*)font, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_char_width
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1char_1width
- (JNIEnv *env, jclass that, jint font, jbyte character)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_char_width");
-#endif
-
- return (jint)gdk_char_width((GdkFont*)font, (gchar)character);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_height
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1height
- (JNIEnv *env, jclass that, jint font, jbyteArray string)
-{
- jint rc;
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_height");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- rc = (jint)gdk_string_height((GdkFont*)font, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_string_extents
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1extents
- (JNIEnv *env, jclass that, jint font, jbyteArray string, jintArray lbearing, jintArray rbearing, jintArray width, jintArray ascent, jintArray descent)
-{
- jbyte *string1 = NULL;
- jint *lbearing1 = NULL;
- jint *rbearing1 = NULL;
- jint *width1 = NULL;
- jint *ascent1 = NULL;
- jint *descent1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_string_extents");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- if (lbearing) {
- lbearing1 = (*env)->GetIntArrayElements(env, lbearing, NULL);
- }
- if (rbearing) {
- rbearing1 = (*env)->GetIntArrayElements(env, rbearing, NULL);
- }
- if (width) {
- width1 = (*env)->GetIntArrayElements(env, width, NULL);
- }
- if (ascent) {
- ascent1 = (*env)->GetIntArrayElements(env, ascent, NULL);
- }
- if (descent) {
- descent1 = (*env)->GetIntArrayElements(env, descent, NULL);
- }
- gdk_string_extents((GdkFont*)font, (gchar*)string1, (gint*)lbearing1, (gint*)rbearing1, (gint*)width1, (gint*)ascent1, (gint*)descent1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
- if (lbearing) {
- (*env)->ReleaseIntArrayElements(env, lbearing, lbearing1, 0);
- }
- if (rbearing) {
- (*env)->ReleaseIntArrayElements(env, rbearing, rbearing1, 0);
- }
- if (width) {
- (*env)->ReleaseIntArrayElements(env, width, width1, 0);
- }
- if (ascent) {
- (*env)->ReleaseIntArrayElements(env, ascent, ascent1, 0);
- }
- if (descent) {
- (*env)->ReleaseIntArrayElements(env, descent, descent1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_line
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1line
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_line");
-#endif
-
- gdk_draw_line((GdkDrawable*)drawable, (GdkGC*)gc, (gint)x1, (gint)y1, (gint)x2, (gint)y2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_rectangle
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1rectangle
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_rectangle");
-#endif
-
- gdk_draw_rectangle((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_arc
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1arc
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height, jint angle1, jint angle2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_arc");
-#endif
-
- gdk_draw_arc((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height, (gint)angle1, (gint)angle2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_polygon
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1polygon
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jshortArray points, jint npoints)
-{
- jshort *points1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_polygon");
-#endif
-
- if (points) {
- points1 = (*env)->GetShortArrayElements(env, points, NULL);
- }
- gdk_draw_polygon((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (GdkPoint*)points1, (gint)npoints);
- if (points) {
- (*env)->ReleaseShortArrayElements(env, points, points1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_string
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1string
- (JNIEnv *env, jclass that, jint drawable, jint font, jint gc, jint x, jint y, jbyteArray string)
-{
- jbyte *string1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_string");
-#endif
-
- if (string) {
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- }
- gdk_draw_string((GdkDrawable*)drawable, (GdkFont*)font, (GdkGC*)gc, (gint)x, (gint)y, (gchar*)string1);
- if (string) {
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_pixmap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1pixmap
- (JNIEnv *env, jclass that, jint drawable, jint gc, jint src, jint xsrc, jint ysrc, jint xdest, jint ydest, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_pixmap");
-#endif
-
- gdk_draw_pixmap((GdkDrawable*)drawable, (GdkGC*)gc, (GdkDrawable*)src, (gint)xsrc, (gint)ysrc, (gint)xdest, (gint)ydest, (gint)width, (gint)height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_draw_lines
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1lines
- (JNIEnv *env, jclass that, jint drawable, jint gc, jshortArray points, jint npoints)
-{
- jshort *points1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_draw_lines");
-#endif
-
- if (points) {
- points1 = (*env)->GetShortArrayElements(env, points, NULL);
- }
- gdk_draw_lines((GdkDrawable*)drawable, (GdkGC*)gc, (GdkPoint*)points1, (gint)npoints);
- if (points) {
- (*env)->ReleaseShortArrayElements(env, points, points1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_atom_intern
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1atom_1intern
- (JNIEnv *env, jclass that, jbyteArray atom_name, jint only_if_exists)
-{
- jint rc;
- jbyte *atom_name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_atom_intern");
-#endif
-
- if (atom_name) {
- atom_name1 = (*env)->GetByteArrayElements(env, atom_name, NULL);
- }
- rc = (jint)gdk_atom_intern((gchar*)atom_name1, (gint)only_if_exists);
- if (atom_name) {
- (*env)->ReleaseByteArrayElements(env, atom_name, atom_name1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1new
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_new");
-#endif
-
- return (jint)gdk_region_new();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_destroy
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1destroy
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_destroy");
-#endif
-
- gdk_region_destroy((GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_get_clipbox
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1get_1clipbox
- (JNIEnv *env, jclass that, jint region, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- GdkRectangle rectangle_struct, *rectangle1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_get_clipbox");
-#endif
-
- if (rectangle) {
- rectangle1 = &rectangle_struct;
- cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
- gdk_region_get_clipbox((GdkRegion*)region, (GdkRectangle*)rectangle1);
- if (rectangle) {
- setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_empty
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1empty
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_empty");
-#endif
-
- return (jboolean)gdk_region_empty((GdkRegion*)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_equal
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1equal
- (JNIEnv *env, jclass that, jint region1, jint region2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_equal");
-#endif
-
- return (jboolean)gdk_region_equal((GdkRegion*)region1, (GdkRegion*)region2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_point_in
- * Signature:
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1point_1in
- (JNIEnv *env, jclass that, jint region, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_point_in");
-#endif
-
- return (jboolean)gdk_region_point_in((GdkRegion*)region, (int)x, (int)y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_rect_in
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1rect_1in
- (JNIEnv *env, jclass that, jint region, jobject rect)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkRectangle rect_struct, *rect1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_rect_in");
-#endif
-
- if (rect) {
- rect1 = &rect_struct;
- cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- rc = (jint)gdk_region_rect_in((GdkRegion*)region, (GdkRectangle*)rect1);
- if (rect) {
- setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_region_union_with_rect
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1union_1with_1rect
- (JNIEnv *env, jclass that, jint region, jobject rect)
-{
- DECL_GLOB(pGlob)
- jint rc;
- GdkRectangle rect_struct, *rect1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_region_union_with_rect");
-#endif
-
- if (rect) {
- rect1 = &rect_struct;
- cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- rc = (jint)gdk_region_union_with_rect((GdkRegion*)region, (GdkRectangle*)rect1);
- if (rect) {
- setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_regions_union
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1union
- (JNIEnv *env, jclass that, jint source1, jint source2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_regions_union");
-#endif
-
- return (jint)gdk_regions_union((GdkRegion*)source1, (GdkRegion*)source2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_regions_subtract
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1subtract
- (JNIEnv *env, jclass that, jint source1, jint source2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_regions_subtract");
-#endif
-
- return (jint)gdk_regions_subtract((GdkRegion*)source1, (GdkRegion*)source2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1free
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_free");
-#endif
-
- g_list_free((GList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_append
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1append
- (JNIEnv *env, jclass that, jint list, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_append");
-#endif
-
- return (jint)g_list_append((GList*)list, (gpointer)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_nth");
-#endif
-
- return (jint)g_list_nth((GList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1length
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_length");
-#endif
-
- return (jint)g_list_length((GList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_list_nth_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth_1data
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_list_nth_data");
-#endif
-
- return (jint)g_list_nth_data((GList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_nth
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_nth");
-#endif
-
- return (jint)g_slist_nth((GSList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_length
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1length
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_length");
-#endif
-
- return (jint)g_slist_length((GSList*)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_slist_nth_data
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth_1data
- (JNIEnv *env, jclass that, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_slist_nth_data");
-#endif
-
- return (jint)g_slist_nth_data((GSList*)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_malloc
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1malloc
- (JNIEnv *env, jclass that, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_malloc");
-#endif
-
- return (jint)g_malloc((gulong)size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_free
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1free
- (JNIEnv *env, jclass that, jint mem)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_free");
-#endif
-
- g_free((gpointer)mem);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_strdup
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1strdup
- (JNIEnv *env, jclass that, jbyteArray str)
-{
- jint rc;
- jbyte *str1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_strdup");
-#endif
-
- if (str) {
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
- }
- rc = (jint)g_strdup((gchar*)str1);
- if (str) {
- (*env)->ReleaseByteArrayElements(env, str, str1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: g_get_home_dir
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1get_1home_1dir
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_get_home_dir");
-#endif
-
- return (jint)g_get_home_dir();
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_new
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1new
- (JNIEnv *env, jclass that, jint columns)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_new");
-#endif
-
- return (jint)gtk_clist_new((gint)columns);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_shadow_type
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1shadow_1type
- (JNIEnv *env, jclass that, jint clist, jint type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_shadow_type");
-#endif
-
- gtk_clist_set_shadow_type((GtkCList*)clist, (GtkShadowType)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_selection_mode
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1selection_1mode
- (JNIEnv *env, jclass that, jint clist, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_selection_mode");
-#endif
-
- gtk_clist_set_selection_mode((GtkCList*)clist, (GtkSelectionMode)mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_freeze
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1freeze
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_freeze");
-#endif
-
- gtk_clist_freeze((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_thaw
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1thaw
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_thaw");
-#endif
-
- gtk_clist_thaw((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_show
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1show
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_show");
-#endif
-
- gtk_clist_column_titles_show((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_hide
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1hide
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_hide");
-#endif
-
- gtk_clist_column_titles_hide((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_title_passive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1title_1passive
- (JNIEnv *env, jclass that, jint clist, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_title_passive");
-#endif
-
- gtk_clist_column_title_passive((GtkCList*)clist, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_column_titles_passive
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1passive
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_column_titles_passive");
-#endif
-
- gtk_clist_column_titles_passive((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_title
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1title
- (JNIEnv *env, jclass that, jint clist, jint column, jbyteArray title)
-{
- jbyte *title1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_title");
-#endif
-
- if (title) {
- title1 = (*env)->GetByteArrayElements(env, title, NULL);
- }
- gtk_clist_set_column_title((GtkCList*)clist, (gint)column, (gchar*)title1);
- if (title) {
- (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_justification
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1justification
- (JNIEnv *env, jclass that, jint clist, jint column, jint justification)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_justification");
-#endif
-
- gtk_clist_set_column_justification((GtkCList*)clist, (gint)column, (GtkJustification)justification);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_visibility
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1visibility
- (JNIEnv *env, jclass that, jint clist, jint column, jboolean visible)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_visibility");
-#endif
-
- gtk_clist_set_column_visibility((GtkCList*)clist, (gint)column, (gboolean)visible);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_resizeable
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1resizeable
- (JNIEnv *env, jclass that, jint clist, jint column, jboolean resizeable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_resizeable");
-#endif
-
- gtk_clist_set_column_resizeable((GtkCList*)clist, (gint)column, (gboolean)resizeable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_column_width
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1width
- (JNIEnv *env, jclass that, jint clist, jint column, jint width)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_column_width");
-#endif
-
- gtk_clist_set_column_width((GtkCList*)clist, (gint)column, (gint)width);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_moveto
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1moveto
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jfloat row_align, jfloat col_align)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_moveto");
-#endif
-
- gtk_clist_moveto((GtkCList*)clist, (gint)row, (gint)column, row_align, col_align);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_text
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1text
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_clist_set_text((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_get_text
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1text
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_get_text");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_get_text((GtkCList*)clist, (gint)row, (gint)column, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_pixmap
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixmap
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jint pixmap, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_pixmap");
-#endif
-
- gtk_clist_set_pixmap((GtkCList*)clist, (gint)row, (gint)column, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_set_pixtext
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixtext
- (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text, jbyte spacing, jint pixmap, jint mask)
-{
- jbyte *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_set_pixtext");
-#endif
-
- if (text) {
- text1 = (*env)->GetByteArrayElements(env, text, NULL);
- }
- gtk_clist_set_pixtext((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
- if (text) {
- (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_append
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1append
- (JNIEnv *env, jclass that, jint clist, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_append");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_append((GtkCList*)clist, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_insert
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1insert
- (JNIEnv *env, jclass that, jint clist, jint row, jintArray text)
-{
- jint rc;
- jint *text1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_insert");
-#endif
-
- if (text) {
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
- }
- rc = (jint)gtk_clist_insert((GtkCList*)clist, (gint)row, (gchar**)text1);
- if (text) {
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_remove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1remove
- (JNIEnv *env, jclass that, jint clist, jint row)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_remove");
-#endif
-
- gtk_clist_remove((GtkCList*)clist, (gint)row);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_select_row
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1row
- (JNIEnv *env, jclass that, jint clist, jint row, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_select_row");
-#endif
-
- gtk_clist_select_row((GtkCList*)clist, (gint)row, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_unselect_row
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1row
- (JNIEnv *env, jclass that, jint clist, jint row, jint column)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_unselect_row");
-#endif
-
- gtk_clist_unselect_row((GtkCList*)clist, (gint)row, (gint)column);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_clear
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1clear
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_clear");
-#endif
-
- gtk_clist_clear((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_get_selection_info
- * Signature:
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1selection_1info
- (JNIEnv *env, jclass that, jint clist, jint x, jint y, jintArray row, jintArray column)
-{
- jint rc;
- jint *row1 = NULL;
- jint *column1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_get_selection_info");
-#endif
-
- if (row) {
- row1 = (*env)->GetIntArrayElements(env, row, NULL);
- }
- if (column) {
- column1 = (*env)->GetIntArrayElements(env, column, NULL);
- }
- rc = (jint)gtk_clist_get_selection_info((GtkCList*)clist, (gint)x, (gint)y, (gint*)row1, (gint*)column1);
- if (row) {
- (*env)->ReleaseIntArrayElements(env, row, row1, 0);
- }
- if (column) {
- (*env)->ReleaseIntArrayElements(env, column, column1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_select_all
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1all
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_select_all");
-#endif
-
- gtk_clist_select_all((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clist_unselect_all
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1all
- (JNIEnv *env, jclass that, jint clist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clist_unselect_all");
-#endif
-
- gtk_clist_unselect_all((GtkCList*)clist);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkColor src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkColorFids(env, src, &PGLOB(GdkColorFc));
- getGdkColorFields(env, src, src1, &PGLOB(GdkColorFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkColor dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkColorFids(env, dest, &PGLOB(GdkColorFc));
- setGdkColorFields(env, dest, dest1, &PGLOB(GdkColorFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkDialogFids(env, dest, &PGLOB(GtkDialogFc));
- setGtkDialogFields(env, dest, dest1, &PGLOB(GtkDialogFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyleClass_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyleClass dest_struct, *dest1 = NULL;
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkStyleClassFids(env, dest, &PGLOB(GtkStyleClassFc));
- setGtkStyleClassFields(env, dest, dest1, &PGLOB(GtkStyleClassFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventKeyFids(env, src, &PGLOB(GdkEventKeyFc));
- getGdkEventKeyFields(env, src, src1, &PGLOB(GdkEventKeyFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventKeyFids(env, dest, &PGLOB(GdkEventKeyFc));
- setGdkEventKeyFields(env, dest, dest1, &PGLOB(GdkEventKeyFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventButtonFids(env, src, &PGLOB(GdkEventButtonFc));
- getGdkEventButtonFields(env, src, src1, &PGLOB(GdkEventButtonFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventButtonFids(env, dest, &PGLOB(GdkEventButtonFc));
- setGdkEventButtonFields(env, dest, dest1, &PGLOB(GdkEventButtonFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventMotionFids(env, src, &PGLOB(GdkEventMotionFc));
- getGdkEventMotionFields(env, src, src1, &PGLOB(GdkEventMotionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventMotionFids(env, dest, &PGLOB(GdkEventMotionFc));
- setGdkEventMotionFields(env, dest, dest1, &PGLOB(GdkEventMotionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkEventExposeFids(env, src, &PGLOB(GdkEventExposeFc));
- getGdkEventExposeFields(env, src, src1, &PGLOB(GdkEventExposeFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkEvent dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkEventExposeFids(env, dest, &PGLOB(GdkEventExposeFc));
- setGdkEventExposeFields(env, dest, dest1, &PGLOB(GdkEventExposeFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkFont src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkFontFids(env, src, &PGLOB(GdkFontFc));
- getGdkFontFields(env, src, src1, &PGLOB(GdkFontFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkFont dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkFontFids(env, dest, &PGLOB(GdkFontFc));
- setGdkFontFields(env, dest, dest1, &PGLOB(GdkFontFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkGCValues src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkGCValuesFids(env, src, &PGLOB(GdkGCValuesFc));
- getGdkGCValuesFields(env, src, src1, &PGLOB(GdkGCValuesFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkGCValues dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkGCValuesFids(env, dest, &PGLOB(GdkGCValuesFc));
- setGdkGCValuesFields(env, dest, dest1, &PGLOB(GdkGCValuesFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkImage src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkImageFids(env, src, &PGLOB(GdkImageFc));
- getGdkImageFields(env, src, src1, &PGLOB(GdkImageFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkImage dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkImageFids(env, dest, &PGLOB(GdkImageFc));
- setGdkImageFields(env, dest, dest1, &PGLOB(GdkImageFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkPoint src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkPointFids(env, src, &PGLOB(GdkPointFc));
- getGdkPointFields(env, src, src1, &PGLOB(GdkPointFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkPoint dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkPointFids(env, dest, &PGLOB(GdkPointFc));
- setGdkPointFields(env, dest, dest1, &PGLOB(GdkPointFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkRectangle src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkRectangleFids(env, src, &PGLOB(GdkRectangleFc));
- getGdkRectangleFields(env, src, src1, &PGLOB(GdkRectangleFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkRectangle dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkRectangleFids(env, dest, &PGLOB(GdkRectangleFc));
- setGdkRectangleFields(env, dest, dest1, &PGLOB(GdkRectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkVisual src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGdkVisualFids(env, src, &PGLOB(GdkVisualFc));
- getGdkVisualFields(env, src, src1, &PGLOB(GdkVisualFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GdkVisual dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGdkVisualFids(env, dest, &PGLOB(GdkVisualFc));
- setGdkVisualFields(env, dest, dest1, &PGLOB(GdkVisualFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAllocation src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkAllocationFids(env, src, &PGLOB(GtkAllocationFc));
- getGtkAllocationFields(env, src, src1, &PGLOB(GtkAllocationFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAllocation dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkAllocationFids(env, dest, &PGLOB(GtkAllocationFc));
- setGtkAllocationFields(env, dest, dest1, &PGLOB(GtkAllocationFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkArg src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkArgFids(env, src, &PGLOB(GtkArgFc));
- getGtkArgFields(env, src, src1, &PGLOB(GtkArgFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkArg dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkArgFids(env, dest, &PGLOB(GtkArgFc));
- setGtkArgFields(env, dest, dest1, &PGLOB(GtkArgFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBin src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkBinFids(env, src, &PGLOB(GtkBinFc));
- getGtkBinFields(env, src, src1, &PGLOB(GtkBinFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBin dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkBinFids(env, dest, &PGLOB(GtkBinFc));
- setGtkBinFields(env, dest, dest1, &PGLOB(GtkBinFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCList src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListFids(env, src, &PGLOB(GtkCListFc));
- getGtkCListFields(env, src, src1, &PGLOB(GtkCListFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCList dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListFids(env, dest, &PGLOB(GtkCListFc));
- setGtkCListFields(env, dest, dest1, &PGLOB(GtkCListFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenu src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkMenuFids(env, src, &PGLOB(GtkMenuFc));
- getGtkMenuFields(env, src, src1, &PGLOB(GtkMenuFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenu dest_struct={0}, *dest1 = NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkMenuFids(env, dest, &PGLOB(GtkMenuFc));
- setGtkMenuFields(env, dest, dest1, &PGLOB(GtkMenuFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTree src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCTreeFids(env, src, &PGLOB(GtkCTreeFc));
- getGtkCTreeFields(env, src, src1, &PGLOB(GtkCTreeFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTree dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCTreeFids(env, dest, &PGLOB(GtkCTreeFc));
- setGtkCTreeFields(env, dest, dest1, &PGLOB(GtkCTreeFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkColorSelectionDialog src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkColorSelectionDialogFids(env, src, &PGLOB(GtkColorSelectionDialogFc));
- getGtkColorSelectionDialogFields(env, src, src1, &PGLOB(GtkColorSelectionDialogFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkColorSelectionDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkColorSelectionDialogFids(env, dest, &PGLOB(GtkColorSelectionDialogFc));
- setGtkColorSelectionDialogFields(env, dest, dest1, &PGLOB(GtkColorSelectionDialogFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCombo src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkComboFids(env, src, &PGLOB(GtkComboFc));
- getGtkComboFields(env, src, src1, &PGLOB(GtkComboFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCombo dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkComboFids(env, dest, &PGLOB(GtkComboFc));
- setGtkComboFields(env, dest, dest1, &PGLOB(GtkComboFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkContainer src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkContainerFids(env, src, &PGLOB(GtkContainerFc));
- getGtkContainerFields(env, src, src1, &PGLOB(GtkContainerFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkContainer dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkContainerFids(env, dest, &PGLOB(GtkContainerFc));
- setGtkContainerFields(env, dest, dest1, &PGLOB(GtkContainerFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkData src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkDataFids(env, src, &PGLOB(GtkDataFc));
- getGtkDataFields(env, src, src1, &PGLOB(GtkDataFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkData dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkDataFids(env, dest, &PGLOB(GtkDataFc));
- setGtkDataFields(env, dest, dest1, &PGLOB(GtkDataFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkEditable src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkEditableFids(env, src, &PGLOB(GtkEditableFc));
- getGtkEditableFields(env, src, src1, &PGLOB(GtkEditableFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkEditable dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkEditableFids(env, dest, &PGLOB(GtkEditableFc));
- setGtkEditableFields(env, dest, dest1, &PGLOB(GtkEditableFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkText src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkTextFids(env, src, &PGLOB(GtkTextFc));
- getGtkTextFields(env, src, src1, &PGLOB(GtkTextFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkText dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkTextFids(env, dest, &PGLOB(GtkTextFc));
- setGtkTextFields(env, dest, dest1, &PGLOB(GtkTextFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_text_inquiry
- * Signature:
- * Not implemented yet;
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_text_inquiry__Lorg_eclipse_swt_internal_gtk_GtkText_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFileSelection src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFileSelectionFids(env, src, &PGLOB(GtkFileSelectionFc));
- getGtkFileSelectionFields(env, src, src1, &PGLOB(GtkFileSelectionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFileSelection dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFileSelectionFids(env, dest, &PGLOB(GtkFileSelectionFc));
- setGtkFileSelectionFields(env, dest, dest1, &PGLOB(GtkFileSelectionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFontSelectionDialog src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFontSelectionDialogFids(env, src, &PGLOB(GtkFontSelectionDialogFc));
- getGtkFontSelectionDialogFields(env, src, src1, &PGLOB(GtkFontSelectionDialogFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFontSelectionDialog dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFontSelectionDialogFids(env, dest, &PGLOB(GtkFontSelectionDialogFc));
- setGtkFontSelectionDialogFields(env, dest, dest1, &PGLOB(GtkFontSelectionDialogFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkObject src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkObjectFids(env, src, &PGLOB(GtkObjectFc));
- getGtkObjectFields(env, src, src1, &PGLOB(GtkObjectFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkObject dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkObjectFids(env, dest, &PGLOB(GtkObjectFc));
- setGtkObjectFields(env, dest, dest1, &PGLOB(GtkObjectFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgress src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkProgressFids(env, src, &PGLOB(GtkProgressFc));
- getGtkProgressFields(env, src, src1, &PGLOB(GtkProgressFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgress dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkProgressFids(env, dest, &PGLOB(GtkProgressFc));
- setGtkProgressFields(env, dest, dest1, &PGLOB(GtkProgressFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgressBar src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkProgressBarFids(env, src, &PGLOB(GtkProgressBarFc));
- getGtkProgressBarFields(env, src, src1, &PGLOB(GtkProgressBarFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkProgressBar dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkProgressBarFids(env, dest, &PGLOB(GtkProgressBarFc));
- setGtkProgressBarFields(env, dest, dest1, &PGLOB(GtkProgressBarFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkRequisition src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkRequisitionFids(env, src, &PGLOB(GtkRequisitionFc));
- getGtkRequisitionFields(env, src, src1, &PGLOB(GtkRequisitionFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkRequisition dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkRequisitionFids(env, dest, &PGLOB(GtkRequisitionFc));
- setGtkRequisitionFields(env, dest, dest1, &PGLOB(GtkRequisitionFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyle src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkStyleFids(env, src, &PGLOB(GtkStyleFc));
- getGtkStyleFields(env, src, src1, &PGLOB(GtkStyleFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkStyle dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkStyleFids(env, dest, &PGLOB(GtkStyleFc));
- setGtkStyleFields(env, dest, dest1, &PGLOB(GtkStyleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWidget src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkWidgetFids(env, src, &PGLOB(GtkWidgetFc));
- getGtkWidgetFields(env, src, src1, &PGLOB(GtkWidgetFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWidget dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkWidgetFids(env, dest, &PGLOB(GtkWidgetFc));
- setGtkWidgetFields(env, dest, dest1, &PGLOB(GtkWidgetFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFrame src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkFrameFids(env, src, &PGLOB(GtkFrameFc));
- getGtkFrameFields(env, src, src1, &PGLOB(GtkFrameFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkFrame dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkFrameFids(env, dest, &PGLOB(GtkFrameFc));
- setGtkFrameFields(env, dest, dest1, &PGLOB(GtkFrameFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWindow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkWindowFids(env, src, &PGLOB(GtkWindowFc));
- getGtkWindowFields(env, src, src1, &PGLOB(GtkWindowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkWindow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkWindowFids(env, dest, &PGLOB(GtkWindowFc));
- setGtkWindowFields(env, dest, dest1, &PGLOB(GtkWindowFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCheckMenuItem src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCheckMenuItemFids(env, src, &PGLOB(GtkCheckMenuItemFc));
- getGtkCheckMenuItemFields(env, src, src1, &PGLOB(GtkCheckMenuItemFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCheckMenuItem dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCheckMenuItemFids(env, dest, &PGLOB(GtkCheckMenuItemFc));
- setGtkCheckMenuItemFields(env, dest, dest1, &PGLOB(GtkCheckMenuItemFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAdjustment src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkAdjustmentFids(env, src, &PGLOB(GtkAdjustmentFc));
- getGtkAdjustmentFields(env, src, src1, &PGLOB(GtkAdjustmentFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkAdjustment dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkAdjustmentFids(env, dest, &PGLOB(GtkAdjustmentFc));
- setGtkAdjustmentFields(env, dest, dest1, &PGLOB(GtkAdjustmentFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBox src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkBoxFids(env, src, &PGLOB(GtkBoxFc));
- getGtkBoxFields(env, src, src1, &PGLOB(GtkBoxFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkBox dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkBoxFids(env, dest, &PGLOB(GtkBoxFc));
- setGtkBoxFields(env, dest, dest1, &PGLOB(GtkBoxFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkHBox src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkHBoxFids(env, src, &PGLOB(GtkHBoxFc));
- getGtkHBoxFields(env, src, src1, &PGLOB(GtkHBoxFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkHBox dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkHBoxFids(env, dest, &PGLOB(GtkHBoxFc));
- setGtkHBoxFields(env, dest, dest1, &PGLOB(GtkHBoxFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenuItem src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkMenuItemFids(env, src, &PGLOB(GtkMenuItemFc));
- getGtkMenuItemFields(env, src, src1, &PGLOB(GtkMenuItemFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkMenuItem dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkMenuItemFids(env, dest, &PGLOB(GtkMenuItemFc));
- setGtkMenuItemFields(env, dest, dest1, &PGLOB(GtkMenuItemFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListRow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListRowFids(env, src, &PGLOB(GtkCListRowFc));
- getGtkCListRowFields(env, src, src1, &PGLOB(GtkCListRowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListRow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListRowFids(env, dest, &PGLOB(GtkCListRowFc));
- setGtkCListRowFields(env, dest, dest1, &PGLOB(GtkCListRowFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListColumn src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCListColumnFids(env, src, &PGLOB(GtkCListColumnFc));
- getGtkCListColumnFields(env, src, src1, &PGLOB(GtkCListColumnFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCListColumn dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCListColumnFids(env, dest, &PGLOB(GtkCListColumnFc));
- setGtkCListColumnFields(env, dest, dest1, &PGLOB(GtkCListColumnFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTreeRow src_struct={0}, *src1 = NULL;
- if (src) {
- src1 = &src_struct;
- cacheGtkCTreeRowFids(env, src, &PGLOB(GtkCTreeRowFc));
- getGtkCTreeRowFields(env, src, src1, &PGLOB(GtkCTreeRowFc));
- }
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I\n");
-#endif
-
- memmove((void*)dest, (void*)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: memmove
- * Signature:
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- GtkCTreeRow dest_struct={0}, *dest1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II\n");
-#endif
-
- memmove((void*)&dest_struct, (void*)src, count);
- if (dest) {
- dest1 = &dest_struct;
- cacheGtkCTreeRowFids(env, dest, &PGLOB(GtkCTreeRowFc));
- setGtkCTreeRowFields(env, dest, dest1, &PGLOB(GtkCTreeRowFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3BI
- (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
-{
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3BI\n");
-#endif
-
- if (src) {
- src1 = (*env)->GetByteArrayElements(env, src, NULL);
- memmove((void*)dest, (void*)src1, count);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3II
- (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
-{
- jint *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3II\n");
-#endif
-
- if (src) {
- src1 = (*env)->GetIntArrayElements(env, src, NULL);
- memmove((void*)dest, (void*)src1, count);
- (*env)->ReleaseIntArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3III
- (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
-{
- jint *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__III\n");
-#endif
-
- if (dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3BII
- (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
-{
- jbyte *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BII\n");
-#endif
-
- if (dest) {
- dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src, count);
- (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3I_3BI
- (JNIEnv *env, jclass that, jintArray dest, jbyteArray src, jint count)
-{
- jint *dest1;
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3I_3BI\n");
-#endif
-
- if (src && dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- src1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void*)dest1, (void*)src1, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_strlen
- (JNIEnv *env, jclass that, jint string)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "strlen\n");
-#endif
-
- return (jint)strlen((char*)string);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: XListFonts
- * Signature: ([BI[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_XListFonts
- (JNIEnv *env, jclass that, jbyteArray pattern, jint maxnames, jintArray actual_count_return)
-{
- jbyte *pattern1 = NULL;
- jint *actual_count_return1=NULL;
- jint rc;
-
- if (pattern)
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- if (actual_count_return)
- actual_count_return1 = (*env)->GetIntArrayElements(env, actual_count_return, NULL);
-
- rc = (jint) XListFonts(GDK_DISPLAY(), (char *)pattern1, maxnames, (int *)actual_count_return1);
-
- if (pattern)
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- if (actual_count_return)
- (*env)->ReleaseIntArrayElements(env, actual_count_return, actual_count_return1, 0);
- return rc;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
deleted file mode 100644
index 713ba8d723..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-import org.eclipse.swt.internal.Library;
-
-public class GDKPIXBUF extends OS {
-
- /* GdkColorspace enumeration */
- /* R/G/B additive color space */
- public final static int GDK_COLORSPACE_RGB = 0;
-
- /* GIF-like animation overlay modes for frames */
- public final static int GDK_PIXBUF_FRAME_RETAIN = 0;
- public final static int GDK_PIXBUF_FRAME_DISPOSE = 1;
- public final static int GDK_PIXBUF_FRAME_REVERT = 2;
-
- /* Alpha compositing mode */
- public final static int GDK_PIXBUF_ALPHA_BILEVEL = 0;
- public final static int GDK_PIXBUF_ALPHA_FULL = 1;
-
- /* Interpolation modes */
- public final static int GDK_INTERP_NEAREST = 0;
- public final static int GDK_INTERP_TILES = 1;
- public final static int GDK_INTERP_BILINEAR = 2;
- public final static int GDK_INTERP_HYPER = 3;
-
-
-/*
- * NATIVES
- */
-
-/* GdkPixbuf accessors */
-
-/**
- * Returns the colorspace of the pixbuf argument
- */
-public static final native int gdk_pixbuf_get_colorspace (int pixbuf);
-
-/**
- * Returns the number of channels in the pixbuf argument
- */
-public static final native int gdk_pixbuf_get_n_channels (int pixbuf);
-
-/**
- * Returns true if the pixbuf specified by the argument has an alpha channel
- * (opacity information), and false otherwise.
- */
-public static final native boolean gdk_pixbuf_get_has_alpha (int pixbuf);
-
-/**
- * Returns the number of bits per pixel in each channel.
- * Normally 8.
- */
-public static final native int gdk_pixbuf_get_bits_per_sample (int pixbuf);
-
-/**
- * Returns the address of the actual image data in the OS memory.
- */
-public static final native int gdk_pixbuf_get_pixels (int pixbuf);
-
-/**
- * Returns the width of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_width (int pixbuf);
-
-/**
- * Returns the height of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_height (int pixbuf);
-
-/**
- * Returns the rowstride of the pixbuf specified by the argument.
- */
-public static final native int gdk_pixbuf_get_rowstride (int pixbuf);
-
-
-/* PIXBUF CREATION FROM DATA IN MEMORY */
-
-/**
- * Create a blank pixbuf with an optimal rowstride and a new buffer
- */
-public static final native int gdk_pixbuf_new (
- int colorspace,
- boolean has_alpha,
- int bits_per_sample,
- int width,
- int height);
-
-public static final native int gdk_pixbuf_copy(int source);
-
-public static final native int gdk_pixbuf_new_from_data (
- byte[] data,
- int colorspace,
- boolean has_alpha,
- int bits_per_sample,
- int width,
- int height,
- int rowstride,
- int destroy_fn,
- int destroy_fn_data);
-
-public static final native int gdk_pixbuf_new_from_xpm_data (int pdata);
-
-
-/* PIXBUF CREATION - FILE LOADING */
-
-public static final native int gdk_pixbuf_new_from_file (byte[] filename);
-
-
-
-/* RENDERING TO A DRAWABLE */
-
-
-public static final native void gdk_pixbuf_render_to_drawable_alpha (int pixbuf,
- int drawable,
- int src_x, int src_y,
- int dest_x, int dest_y,
- int width, int height,
- int alpha_mode,
- int alpha_threshold,
- int dither,
- int x_dither, int y_dither);
-
-public static final native void gdk_pixbuf_render_to_drawable (int pixbuf,
- int drawable,
- int gc,
- int src_x, int src_y,
- int dest_x, int dest_y,
- int width, int height,
- int dither,
- int x_dither, int y_dither);
-
-/* SCALING */
-
-public static final native void gdk_pixbuf_scale (
- int src, int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- int interp_type);
-
-public static final native void gdk_pixbuf_composite (
- int src, int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- int interp_type,
- int overall_alpha);
-
-public static final native void gdk_pixbuf_composite_color (
- int src,
- int dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,double scale_y,
- int interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- int color1,
- int color2);
-
-public static final native int gdk_pixbuf_scale_simple (
- int src,
- int dest_width,
- int dest_height,
- int interp_type);
-
-public static final native int gdk_pixbuf_composite_color_simple (
- int src,int dest_width,
- int dest_height,
- int interp_type,
- int overall_alpha,
- int check_size,
- int color1,
- int color2);
-
-
-
-public static final native int gdk_pixbuf_get_from_drawable (
- int dest,
- int src,
- int cmap,
- int src_x,
- int src_y,
- int dest_x,
- int dest_y,
- int width,
- int height);
-
-
-
-/* LOAD THE DLL */
-
-static {
- Library.loadLibrary ("swt-pixbuf");
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java
deleted file mode 100644
index 1db777f4b6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkColor {
- public int pixel;
- public short red;
- public short green;
- public short blue;
- public static final int sizeof = 10;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java
deleted file mode 100644
index 6da6571c0a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEvent {
- public int type;
- public int window;
- public byte send_event;
- public static final int sizeof = 88;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java
deleted file mode 100644
index 17d1febbcf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventButton extends GdkEvent {
- public int time;
- public long x;
- public long y;
- public long pressure;
- public long xtilt;
- public long ytilt;
- public int state;
- public int button;
- public int source;
- public int deviceid;
- public long x_root;
- public long y_root;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java
deleted file mode 100644
index 6fd9920e97..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventExpose extends GdkEvent {
- public short x;
- public short y;
- public short width;
- public short height;
- public int count;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java
deleted file mode 100644
index 6e4acded51..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventKey extends GdkEvent {
- public int time;
- public int state;
- public int keyval;
- public int length;
- public int string;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java
deleted file mode 100644
index 5a8d5b9c16..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkEventMotion extends GdkEvent {
- public int time;
- public long x;
- public long y;
- public long pressure;
- public long xtilt;
- public long ytilt;
- public int state;
- public int is_hint;
- public int source;
- public int deviceid;
- public long x_root;
- public long y_root;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java
deleted file mode 100644
index 6d7df17522..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkFont {
- public int type;
- public int ascent;
- public int descent;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java
deleted file mode 100644
index df0b4d54b5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkGCValues {
- public int foreground_pixel;
- public short foreground_red;
- public short foreground_green;
- public short foreground_blue;
- public int background_pixel;
- public short background_red;
- public short background_green;
- public short background_blue;
- public int font;
- public int function;
- public int fill;
- public int tile;
- public int stipple;
- public int clip_mask;
- public int subwindow_mode;
- public int ts_x_origin;
- public int ts_y_origin;
- public int clip_x_origin;
- public int clip_y_origin;
- public int graphics_exposures;
- public int line_width;
- public int line_style;
- public int cap_style;
- public int join_style;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java
deleted file mode 100644
index 1dad9e7991..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkRectangle {
- public short x;
- public short y;
- public short width;
- public short height;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java
deleted file mode 100644
index 3b0630a614..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkVisual {
- public int type;
- public int depth;
- public int byte_order;
- public int colormap_size;
- public int bits_per_rgb;
- public int red_mask;
- public int red_shift;
- public int red_prec;
- public int green_mask;
- public int green_shift;
- public int green_prec;
- public int blue_mask;
- public int blue_shift;
- public int blue_prec;
- public static final int sizeof = 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java
deleted file mode 100644
index b1a55987f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkAdjustment extends GtkObject {
- public float lower;
- public float upper;
- public float value;
- public float step_increment;
- public float page_increment;
- public float page_size;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java
deleted file mode 100644
index fc264d98b2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkAllocation {
- public short x;
- public short y;
- public short width;
- public short height;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java
deleted file mode 100644
index d408fc5b42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkBin extends GtkContainer {
- public int child;
- public static final int sizeof = 64;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java
deleted file mode 100644
index f948c7e4fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkBox extends GtkContainer {
- public int children;
- public short spacing;
- public int homogeneous;
- public static final int sizeof = 68;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java
deleted file mode 100644
index cb4843b18c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCList extends GtkContainer {
- public short clist_flags;
- public int row_mem_chunk;
- public int cell_mem_chunk;
- public int freeze_count;
- public short internal_allocation_x;
- public short internal_allocation_y;
- public short internal_allocation_width;
- public short internal_allocation_height;
- public int rows;
- public int row_center_offset;
- public int row_height;
- public int row_list;
- public int row_list_end;
- public int columns;
- public short column_title_area_x;
- public short column_title_area_y;
- public short column_title_area_width;
- public short column_title_area_height;
- public int title_window;
- public int column;
- public int clist_window;
- public int clist_window_width;
- public int clist_window_height;
- public int hoffset;
- public int voffset;
- public int shadow_type;
- public int selection_mode;
- public int selection;
- public int selection_end;
- public int undo_selection;
- public int undo_unselection;
- public int undo_anchor;
- public byte button_actions0;
- public byte button_actions1;
- public byte button_actions2;
- public byte button_actions3;
- public byte button_actions4;
- public byte drag_button;
- public int click_cell_row;
- public int click_cell_column;
- public int hadjustment;
- public int vadjustment;
- public int xor_gc;
- public int fg_gc;
- public int bg_gc;
- public int cursor_drag;
- public int x_drag;
- public int focus_row;
- public int anchor;
- public int anchor_state;
- public int drag_pos;
- public int htimer;
- public int vtimer;
- public int sort_type;
- public int compare;
- public int sort_column;
- public static final int sizeof = 252;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java
deleted file mode 100644
index 818924d046..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCListColumn {
- public int title;
- public short area_x;
- public short area_y;
- public short area_width;
- public short area_height;
- public int button;
- public int window;
- public int width;
- public int min_width;
- public int max_width;
- public int justification;
- public int visible;
- public int width_set;
- public int resizeable;
- public int auto_resize;
- public int button_passive;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java
deleted file mode 100644
index 73c9063ebd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCListRow {
- public int cell;
- public int state;
- public short foreground_red;
- public short foreground_green;
- public short foreground_blue;
- public int foreground_pixel;
- public short background_red;
- public short background_green;
- public short background_blue;
- public int background_pixel;
- public int style;
- public int data;
- public int destroy; // bitfield: 1
- public int fg_set; // bitfield: 1
- public int bg_set; // bitfield: 1
- public int selectable; // bitfield: 1
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java
deleted file mode 100644
index 7f6bb8ef21..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCTree extends GtkCList {
- public int tree_indent;
- public int tree_column;
- public static final int sizeof = 276;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
deleted file mode 100644
index ce9e4d6b4f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCTreeRow extends GtkCListRow {
- public int parent;
- public int sibling;
- public int children;
- public int pixmap_closed;
- public int mask_closed;
- public int pixmap_opened;
- public int mask_opened;
- public short level;
- public int is_leaf; // bitfield: 1
- public int expanded; // bitfield: 1
- public static final int sizeof = 80;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
deleted file mode 100644
index ce3c4db9b3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCheckMenuItem extends GtkMenuItem {
- public int active;
- public int always_show_toggle;
- public static final int sizeof = 88;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
deleted file mode 100644
index b677e23d94..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkColorSelectionDialog extends GtkWindow {
- public int colorsel;
- public int main_vbox;
- public int ok_button;
- public int reset_button;
- public int cancel_button;
- public int help_button;
- public static final int sizeof = 120;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java
deleted file mode 100644
index 2b44b570d1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkCombo extends GtkHBox {
- public int entry;
- public int button;
- public int popup;
- public int popwin;
- public int list;
- public int entry_change_id;
- public int list_change_id;
- public int value_in_list; // bitfield : 1
- public int ok_if_empty; // bitfield : 1
- public int case_sensitive; // bitfield : 1
- public int use_arrows; // bitfield : 1
- public int use_arrows_always; // bitfield : 1
- public short current_button;
- public int activate_id;
- public static final int sizeof = 104;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java
deleted file mode 100644
index 52cb47acf2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkContainer extends GtkWidget {
- public int focus_child;
- public int border_width;
- public int need_resize;
- public int resize_mode;
- public int resize_widgets;
- public static final int sizeof = 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java
deleted file mode 100644
index d4f2ddf603..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkDialog extends GtkWindow {
- public int vbox;
- public int action_area;
- public static final int sizeof = 104;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java
deleted file mode 100644
index 8f2b772924..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkEditable extends GtkWidget {
- public int current_pos;
- public int selection_start_pos;
- public int selection_end_pos;
- public int has_selection; // bitfield : 1
- public int editable; // bitfield : 1
- public int visible; // bitfield : 1
- public int ic;
- public int ic_attr;
- public int clipboard_text;
- public static final int sizeof = 76;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java
deleted file mode 100644
index ebaf37d250..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFileSelection extends GtkWindow {
- public int dir_list;
- public int file_list;
- public int selection_entry;
- public int selection_text;
- public int main_vbox;
- public int ok_button;
- public int cancel_button;
- public int help_button;
- public int history_pulldown;
- public int history_menu;
- public int history_list;
- public int fileop_dialog;
- public int fileop_entry;
- public int fileop_file;
- public int cmpl_state;
- public int fileop_c_dir;
- public int fileop_del_file;
- public int fileop_ren_file;
- public int button_area;
- public int action_area;
- public static final int sizeof = 176;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
deleted file mode 100644
index 09ee75981c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFontSelectionDialog extends GtkWindow {
- public int fontsel;
- public int main_vbox;
- public int action_area;
- public int ok_button;
- public int apply_button;
- public int cancel_button;
- public int dialog_width;
- public int auto_resize;
- public static final int sizeof = 132;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java
deleted file mode 100644
index 0541461e5b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkFrame extends GtkBin {
- public int label;
- public short shadow_type;
- public short label_width;
- public short label_height;
- public float label_xalign;
- public float label_yalign;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java
deleted file mode 100644
index 656601480a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkHBox extends GtkBox {
- public static final int sizeof = 68;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java
deleted file mode 100644
index 80db35e791..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkItem extends GtkBin {
- public static final int sizeof = 64;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java
deleted file mode 100644
index ed4542029e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkMenuItem extends GtkItem {
- public int submenu;
- public int accelerator_signal;
- public int toggle_size;
- public int accelerator_width;
- public int show_toggle_indicator;
- public int show_submenu_indicator;
- public int submenu_placement;
- public int submenu_direction;
- public int right_justify;
- public int timer;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java
deleted file mode 100644
index 226d4a7d0c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkObject {
- public int klass;
- public int flags;
- public int ref_count;
- public int object_data;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java
deleted file mode 100644
index 0c12fe44f0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkRequisition {
- public short width;
- public short height;
- public static final int sizeof = 4;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java
deleted file mode 100644
index a07067261a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkStyle {
- public int klass;
- public int fg0_pixel;
- public short fg0_red, fg0_green, fg0_blue;
- public int fg1_pixel;
- public short fg1_red, fg1_green, fg1_blue;
- public int fg2_pixel;
- public short fg2_red, fg2_green, fg2_blue;
- public int fg3_pixel;
- public short fg3_red, fg3_green, fg3_blue;
- public int fg4_pixel;
- public short fg4_red, fg4_green, fg4_blue;
- public int bg0_pixel;
- public short bg0_red, bg0_green, bg0_blue;
- public int bg1_pixel;
- public short bg1_red, bg1_green, bg1_blue;
- public int bg2_pixel;
- public short bg2_red, bg2_green, bg2_blue;
- public int bg3_pixel;
- public short bg3_red, bg3_green, bg3_blue;
- public int bg4_pixel;
- public short bg4_red, bg4_green, bg4_blue;
- public int light0_pixel;
- public short light0_red, light0_green, light0_blue;
- public int light1_pixel;
- public short light1_red, light1_green, light1_blue;
- public int light2_pixel;
- public short light2_red, light2_green, light2_blue;
- public int light3_pixel;
- public short light3_red, light3_green, light3_blue;
- public int light4_pixel;
- public short light4_red, light4_green, light4_blue;
- public int dark0_pixel;
- public short dark0_red, dark0_green, dark0_blue;
- public int dark1_pixel;
- public short dark1_red, dark1_green, dark1_blue;
- public int dark2_pixel;
- public short dark2_red, dark2_green, dark2_blue;
- public int dark3_pixel;
- public short dark3_red, dark3_green, dark3_blue;
- public int dark4_pixel;
- public short dark4_red, dark4_green, dark4_blue;
- public int mid0_pixel;
- public short mid0_red, mid0_green, mid0_blue;
- public int mid1_pixel;
- public short mid1_red, mid1_green, mid1_blue;
- public int mid2_pixel;
- public short mid2_red, mid2_green, mid2_blue;
- public int mid3_pixel;
- public short mid3_red, mid3_green, mid3_blue;
- public int mid4_pixel;
- public short mid4_red, mid4_green, mid4_blue;
- public int text0_pixel;
- public short text0_red, text0_green, text0_blue;
- public int text1_pixel;
- public short text1_red, text1_green, text1_blue;
- public int text2_pixel;
- public short text2_red, text2_green, text2_blue;
- public int text3_pixel;
- public short text3_red, text3_green, text3_blue;
- public int text4_pixel;
- public short text4_red, text4_green, text4_blue;
- public int base0_pixel;
- public short base0_red, base0_green, base0_blue;
- public int base1_pixel;
- public short base1_red, base1_green, base1_blue;
- public int base2_pixel;
- public short base2_red, base2_green, base2_blue;
- public int base3_pixel;
- public short base3_red, base3_green, base3_blue;
- public int base4_pixel;
- public short base4_red, base4_green, base4_blue;
- public int black_pixel;
- public short black_red, black_green, black_blue;
- public int white_pixel;
- public short white_red, white_green, white_blue;
- public int font;
- public int fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4;
- public int bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4;
- public int light_gc0, light_gc1, light_gc2, light_gc3, light_gc4;
- public int dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4;
- public int mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4;
- public int text_gc0, text_gc1, text_gc2, text_gc3, text_gc4;
- public int base_gc0, base_gc1, base_gc2, base_gc3, base_gc4;
- public int black_gc;
- public int white_gc;
- public int bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
- public int ref_count;
- public int attach_count;
- public int depth;
- public int colormap;
- public int engine;
- public int engine_data;
- public int rc_style;
- public int styles;
- public static final int sizeof = 652;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java
deleted file mode 100644
index a086ab46fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkStyleClass {
- public int xthickness;
- public int ythickness;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java
deleted file mode 100644
index fda4196346..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkText extends GtkEditable {
- public int first_line_start_index;
- public int first_onscreen_hor_pixel;
- public int first_onscreen_ver_pixel;
- public int default_tab_width;
- public int cursor_pos_x;
- public int cursor_pos_y;
- public int cursor_virtual_x;
- public static final int sizeof = 244;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java
deleted file mode 100644
index 405fbeb6b2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkWidget extends GtkObject {
- public short private_flags;
- public byte state;
- public byte saved_state;
- public int name;
- public int style;
- public short req_width;
- public short req_height;
- public short alloc_x;
- public short alloc_y;
- public short alloc_width;
- public short alloc_height;
- public int window;
- public int parent;
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java
deleted file mode 100644
index 152dc729f1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GtkWindow extends GtkBin {
- public int title;
- public int wmclass_name;
- public int wmclass_class;
- public int type;
- public int focus_widget;
- public int default_widget;
- public int transient_parent;
- public short resize_count;
- public int allow_shrink;
- public int allow_grow;
- public int auto_shrink;
- public int handling_resize;
- public int position;
- public int use_uposition;
- public int modal;
- public static final int sizeof = 96;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
deleted file mode 100644
index 2433905716..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
+++ /dev/null
@@ -1,663 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-import org.eclipse.swt.internal.Library;
-
-public class OS {
- static {
- Library.loadLibrary("swt-pi");
- }
-
-
- public static final int GDK_NONE = 0;
-
- /* For Display.KeyTable: */
- /* Keyboard and mouse masks */
- public static final int GDK_Alt_L = 0xFFE9;
- public static final int GDK_Alt_R = 0xFFEA;
- public static final int GDK_Shift_L = 0xFFE1;
- public static final int GDK_Shift_R = 0xFFE2;
- public static final int GDK_Control_L = 0xFFE3;
- public static final int GDK_Control_R = 0xFFE4;
- /* Non-numeric keypad constants */
- public static final int GDK_Up = 0xFF52;
- public static final int GDK_Down = 0xFF54;
- public static final int GDK_Left = 0xFF51;
- public static final int GDK_Right = 0xFF53;
- public static final int GDK_Page_Up = 0xFF55;
- public static final int GDK_Page_Down = 0xFF56;
- public static final int GDK_Home = 0xFF50;
- public static final int GDK_End = 0xFF57;
- public static final int GDK_Insert = 0xFF63;
- public static final int GDK_Delete = 0xFFFF;
- /* Functions Keys */
- public static final int GDK_F1 = 0xFFBE;
- public static final int GDK_F2 = 0xFFBF;
- public static final int GDK_F3 = 0xFFC0;
- public static final int GDK_F4 = 0xFFC1;
- public static final int GDK_F5 = 0xFFC2;
- public static final int GDK_F6 = 0xFFC3;
- public static final int GDK_F7 = 0xFFC4;
- public static final int GDK_F8 = 0xFFC5;
- public static final int GDK_F9 = 0xFFC6;
- public static final int GDK_F10 = 0xFFC7;
- public static final int GDK_F11 = 0xFFC8;
- public static final int GDK_F12 = 0xFFC9;
- public static final int GDK_Return = 0xFF0D;
- /* Numeric Keypad */
- public static final int GDK_KP_Add = 0xFFAB;
- public static final int GDK_KP_Subtract = 0xFFAD;
- public static final int GDK_KP_Multiply = 0xFFAA;
- public static final int GDK_KP_Divide = 0xFFAF;
- public static final int GDK_KP_Enter = 0xFF8D;
- public static final int GDK_KP_Decimal = 0xFFAE;
- public static final int GDK_KP_0 = 0xFFB0;
- public static final int GDK_KP_1 = 0xFFB1;
- public static final int GDK_KP_2 = 0xFFB2;
- public static final int GDK_KP_3 = 0xFFB3;
- public static final int GDK_KP_4 = 0xFFB4;
- public static final int GDK_KP_5 = 0xFFB5;
- public static final int GDK_KP_6 = 0xFFB6;
- public static final int GDK_KP_7 = 0xFFB7;
- public static final int GDK_KP_8 = 0xFFB8;
- public static final int GDK_KP_9 = 0xFFB9;
-
- public static final int GDK_FONT_FONT = 0;
- public static final int GDK_FONT_FONTSET = 1;
- public static final int GDK_COPY = 0;
- public static final int GDK_INVERT = 1;
- public static final int GDK_XOR = 2;
- public static final int GDK_STIPPLED = 2;
- public static final int GDK_LINE_SOLID = 0;
- public static final int GDK_LINE_ON_OFF_DASH = 1;
- public static final int GDK_LINE_DOUBLE_DASH = 2;
- public static final int GDK_CAP_BUTT = 1;
- public static final int GDK_JOIN_MITER = 0;
- public static final int GDK_X_CURSOR = 0;
- public static final int GDK_BOTTOM_LEFT_CORNER = 12;
- public static final int GDK_BOTTOM_RIGHT_CORNER = 14;
- public static final int GDK_BOTTOM_SIDE = 16;
- public static final int GDK_CROSS = 30;
- public static final int GDK_DIAMOND_CROSS = 36;
- public static final int GDK_DOUBLE_ARROW = 42;
- public static final int GDK_HAND1 = 58;
- public static final int GDK_LEFT_PTR = 68;
- public static final int GDK_LEFT_SIDE = 70;
- public static final int GDK_QUESTION_ARROW = 92;
- public static final int GDK_RIGHT_PTR = 94;
- public static final int GDK_RIGHT_SIDE = 96;
- public static final int GDK_SB_H_DOUBLE_ARROW = 108;
- public static final int GDK_SB_UP_ARROW = 114;
- public static final int GDK_SB_V_DOUBLE_ARROW = 116;
- public static final int GDK_SIZING = 120;
- public static final int GDK_TOP_LEFT_CORNER = 134;
- public static final int GDK_TOP_RIGHT_CORNER = 136;
- public static final int GDK_TOP_SIDE = 138;
- public static final int GDK_WATCH = 150;
- public static final int GDK_XTERM = 152;
- public static final int GDK_CURSOR_IS_PIXMAP = -1;
- public static final int GDK_MOTION_NOTIFY = 3;
- public static final int GDK_BUTTON_PRESS = 4;
- public static final int GDK_2BUTTON_PRESS = 5;
- public static final int GDK_3BUTTON_PRESS = 6;
- public static final int GDK_BUTTON_RELEASE = 7;
- public static final int GDK_KEY_PRESS = 8;
- public static final int GDK_KEY_RELEASE = 9;
- public static final int GDK_NO_EXPOSE = 30;
- public static final int GDK_EXPOSURE_MASK = 1 << 1;
- public static final int GDK_POINTER_MOTION_MASK = 1 << 2;
- public static final int GDK_POINTER_MOTION_HINT_MASK = 1 << 3;
- public static final int GDK_BUTTON_MOTION_MASK = 1 << 4;
- public static final int GDK_BUTTON1_MOTION_MASK = 1 << 5;
- public static final int GDK_BUTTON2_MOTION_MASK = 1 << 6;
- public static final int GDK_BUTTON3_MOTION_MASK = 1 << 7;
- public static final int GDK_BUTTON_PRESS_MASK = 1 << 8;
- public static final int GDK_BUTTON_RELEASE_MASK = 1 << 9;
- public static final int GDK_KEY_PRESS_MASK = 1 << 10;
- public static final int GDK_KEY_RELEASE_MASK = 1 << 11;
- public static final int GDK_ENTER_NOTIFY_MASK = 1 << 12;
- public static final int GDK_LEAVE_NOTIFY_MASK = 1 << 13;
- public static final int GDK_FOCUS_CHANGE_MASK = 1 << 14;
- public static final int GDK_SHIFT_MASK = 1 << 0;
- public static final int GDK_LOCK_MASK = 1 << 1;
- public static final int GDK_CONTROL_MASK = 1 << 2;
- public static final int GDK_MOD1_MASK = 1 << 3;
- public static final int GDK_BUTTON1_MASK = 1 << 8;
- public static final int GDK_BUTTON2_MASK = 1 << 9;
- public static final int GDK_BUTTON3_MASK = 1 << 10;
- public static final int GDK_RELEASE_MASK = 1 << 13;
- public static final int GDK_MODIFIER_MASK = 0x3fff;
- public static final int GDK_INCLUDE_INFERIORS = 1;
- public static final int GDK_DECOR_ALL = 1 << 0;
- public static final int GDK_DECOR_BORDER = 1 << 1;
- public static final int GDK_DECOR_RESIZEH = 1 << 2;
- public static final int GDK_DECOR_TITLE = 1 << 3;
- public static final int GDK_DECOR_MENU = 1 << 4;
- public static final int GDK_DECOR_MINIMIZE = 1 << 5;
- public static final int GDK_DECOR_MAXIMIZE = 1 << 6;
- public static final int GDK_OVERLAP_RECTANGLE_IN = 0;
- public static final int GDK_OVERLAP_RECTANGLE_OUT = 1;
- public static final int GDK_OVERLAP_RECTANGLE_PART = 2;
- public static final int GDK_RGB_DITHER_NONE = 0;
- public static final int GDK_RGB_DITHER_NORMAL = 1;
- public static final int GDK_RGB_DITHER_MAX = 2;
- public static final int GTK_ARROW_UP = 0;
- public static final int GTK_ARROW_DOWN = 1;
- public static final int GTK_ARROW_LEFT = 2;
- public static final int GTK_ARROW_RIGHT = 3;
- public static final int GTK_JUSTIFY_LEFT = 0;
- public static final int GTK_JUSTIFY_RIGHT = 1;
- public static final int GTK_JUSTIFY_CENTER = 2;
- public static final int GTK_JUSTIFY_FILL = 3;
- public static final int GTK_ORIENTATION_HORIZONTAL = 0;
- public static final int GTK_ORIENTATION_VERTICAL = 1;
- public static final int GTK_POLICY_ALWAYS = 0;
- public static final int GTK_POLICY_AUTOMATIC = 1; // can't fix now
- public static final int GTK_POLICY_NEVER = 2;
- public static final int GTK_RELIEF_NORMAL = 0;
-// public static final int GTK_RELIEF_HALF = 1;
- public static final int GTK_RELIEF_NONE = 2;
- public static final int GTK_SELECTION_SINGLE = 0; // extra code in Table, can't fix now
- public static final int GTK_SELECTION_BROWSE = 1;
- public static final int GTK_SELECTION_MULTIPLE = 2;
- public static final int GTK_SELECTION_EXTENDED = 3;
- public static final int GTK_SHADOW_NONE = 0;
- public static final int GTK_SHADOW_IN = 1;
- public static final int GTK_SHADOW_OUT = 2;
- public static final int GTK_SHADOW_ETCHED_IN = 3;
- public static final int GTK_SHADOW_ETCHED_OUT = 4;
- public static final int GTK_STATE_NORMAL = 0;
- public static final int GTK_STATE_ACTIVE = 1;
- public static final int GTK_STATE_PRELIGHT = 2;
- public static final int GTK_STATE_SELECTED = 3;
- public static final int GTK_STATE_INSENSITIVE = 4;
- public static final int GTK_TOP_BOTTOM = 0;
- public static final int GTK_LEFT_RIGHT = 1;
- public static final int GTK_TOOLBAR_ICONS = 0;
- public static final int GTK_TOOLBAR_TEXT = 1;
- public static final int GTK_TOOLBAR_BOTH = 2;
- public static final int GTK_VISIBILITY_NONE = 0;
- public static final int GTK_VISIBILITY_PARTIAL = 1;
- public static final int GTK_VISIBILITY_FULL = 2;
- public static final int GTK_WINDOW_TOPLEVEL = 0;
- public static final int GTK_WINDOW_DIALOG = 1;
- public static final int GTK_WINDOW_POPUP = 2;
- public static final int GTK_ACCEL_VISIBLE = 1 << 0;
- public static final int GTK_NO_WINDOW = 1 << 5;
- public static final int GTK_MAPPED = 1 << 7;
- public static final int GTK_VISIBLE = 1 << 8;
- public static final int GTK_SENSITIVE = 1 << 9;
- public static final int GTK_CAN_FOCUS = 1 << 11;
- public static final int GTK_HAS_FOCUS = 1 << 12;
- public static final int GTK_CLIST_SHOW_TITLES = 1 << 2;
- public static final int GTK_PROGRESS_CONTINUOUS = 0;
- public static final int GTK_PROGRESS_DISCRETE = 1;
- public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0;
- public static final int GTK_PROGRESS_RIGHT_TO_LEFT = 1;
- public static final int GTK_PROGRESS_BOTTOM_TO_TOP = 2;
- public static final int GTK_PROGRESS_TOP_TO_BOTTOM = 3;
- public static final int GTK_TOOLBAR_CHILD_SPACE = 0;
- public static final int GTK_TOOLBAR_CHILD_BUTTON = 1;
- public static final int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 2;
- public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
- public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
-
- public static final int G_LOG_FLAG_RECURSION = 1 << 0;
- public static final int G_LOG_FLAG_FATAL = 1 << 1;
-// public static final int G_LOG_LEVEL_ERROR = 1 << 2;
-// public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
-// public static final int G_LOG_LEVEL_WARNING = 1 << 4;
-// public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
-// public static final int G_LOG_LEVEL_INFO = 1 << 6;
-// public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
- public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
-
-public static final native int GTK_WIDGET_FLAGS(int wid);
-public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
-public static final native void GTK_WIDGET_UNSET_FLAGS(int wid,int flag);
-public static final native boolean GTK_WIDGET_NO_WINDOW(int wid);
-public static final native void gdk_rgb_init();
-public static final native boolean GTK_WIDGET_SENSITIVE(int wid);
-public static final native boolean GTK_WIDGET_IS_SENSITIVE(int wid);
-public static final native void memmove(GtkStyleClass dest, int src, int size);
-public static final native void gtk_signal_handler_block_by_data(int object, int data);
-public static final native void gtk_signal_handler_unblock_by_data(int object, int data);
-public static final native int gtk_object_get_data_by_id(int object, int data_id);
-public static final native void gtk_object_set_data_by_id(int object, int data_id, int data);
-public static final native int g_quark_from_string(byte [] string);
-public static final native void gtk_object_unref(int object);
-public static final native void gtk_object_destroy(int object);
-public static final native int GTK_WIDGET_TYPE(int wid);
-public static final native int gtk_label_get_type();
-public static final native int g_log_set_handler(byte [] log_domain, int log_levels, int log_func, int user_data);
-public static final native void g_log_remove_handler(byte [] log_domain, int handler_id);
-public static final native void g_log_default_handler(int log_domain, int log_levels, int message, int unused_data);
-public static final native int gtk_clist_row_is_visible(int clist, int row);
-public static final native void gtk_ctree_post_recursive_to_depth(int ctree, int node, int depth, int func, int data);
-public static final native void gtk_draw_check(int style, int window, int state_type, int shadow_type, int x, int y, int width, int height);
-
-public static final native void g_free(int mem);
-public static final native int g_get_home_dir();
-public static final native int g_list_length(int list);
-public static final native int g_list_nth(int list, int n);
-public static final native int g_list_nth_data(int list, int n);
-public static final native void g_list_free(int list);
-public static final native int g_malloc(int size);
-public static final native int g_list_append(int list, int data);
-public static final native int g_slist_length(int list);
-public static final native int g_slist_nth(int list, int n);
-public static final native int g_slist_nth_data(int list, int n);
-public static final native int g_strdup(byte[] str);
-public static final native int gdk_colormap_get_system();
-public static final native void gdk_colors_free(int colormap, int[] pixels, int npixels, int planes);
-public static final native boolean gdk_color_alloc(int colormap, GdkColor color);
-public static final native int gdk_cursor_new(int cursor_type);
-public static final native int gdk_bitmap_create_from_data(int window, byte[] data, int width, int height);
-public static final native int gdk_cursor_new_from_pixmap(int source, int mask, GdkColor fg, GdkColor bg, int x, int y);
-public static final native void gdk_cursor_destroy(int cursor);
-public static final native int gdk_font_load(byte[] font_name);
-public static final native int gdk_font_ref(int font);
-public static final native void gdk_font_unref(int font);
-public static final native boolean gdk_font_equal(int fonta, int fontb);
-public static final native int gdk_char_width(int font, byte character);
-public static final native void gdk_gc_get_values(int gc, GdkGCValues values);
-public static final native void gdk_gc_set_font(int gc, int font);
-public static final native void gdk_gc_set_foreground(int gc, GdkColor color);
-public static final native void gdk_gc_set_background(int gc, GdkColor color);
-public static final native void gdk_gc_set_clip_mask(int gc, int mask);
-public static final native void gdk_gc_set_clip_rectangle(int gc, GdkRectangle rectangle);
-public static final native void gdk_gc_set_clip_region(int gc, int region);
-public static final native void gdk_gc_set_line_attributes(int gc, int line_width, int line_style, int cap_style, int join_style);
-public static final native void gdk_gc_set_dashes(int gc, int dash_offset, byte[] dash_list, int n);
-public static final native void gdk_gc_set_function(int gc, int function);
-public static final native void gdk_draw_line(int drawable, int gc, int x1, int y1, int x2, int y2);
-public static final native void gdk_draw_arc(int drawable, int gc, int filled, int x, int y, int width, int height, int angle1, int angle2);
-public static final native void gdk_draw_rectangle(int drawable, int gc, int filled, int x, int y, int width, int height);
-public static final native void gdk_draw_pixmap(int drawable, int gc, int src, int xsrc, int ysrc, int xdest, int ydest, int width, int height);
-public static final native void gdk_draw_lines(int drawable, int gc, short[] points, int npoints);
-public static final native void gdk_draw_polygon(int drawable, int gc, int filled, short[] points, int npoints);
-public static final native void gdk_draw_string(int drawable, int font, int gc, int x, int y, byte[] string);
-public static final native void gdk_gc_unref(int gc);
-public static final native int gdk_gc_new(int window);
-public static final native void gdk_gc_destroy(int gc);
-public static final native void gdk_bitmap_unref(int pixmap);
-public static final native boolean gdk_color_white(int colormap, GdkColor color);
-public static final native int gdk_image_get(int window, int x, int y, int width, int height);
-public static final native int gdk_image_get_pixel(int image, int x, int y);
-public static final native void gdk_gc_set_exposures(int gc, boolean exposures);
-public static final native int gdk_event_get_graphics_expose(int window);
-public static final native void gdk_event_free(int event);
-public static final native void gdk_flush();
-public static final native void gdk_beep();
-public static final native void gdk_color_free(GdkColor color);
-public static final native int GDK_ROOT_PARENT();
-public static final native void gdk_gc_set_stipple(int gc, int stipple);
-public static final native void gdk_gc_set_subwindow(int gc, int mode);
-public static final native void gdk_gc_set_fill(int gc, int fill);
-public static final native int gdk_atom_intern(byte[] atom_name, int only_if_exists);
-public static final native int gdk_event_get();
-public static final native void gdk_pixmap_unref(int pixmap);
-public static final native void gdk_region_get_clipbox(int region, GdkRectangle rectangle);
-public static final native int gdk_region_new();
-public static final native int gdk_region_union_with_rect(int region, GdkRectangle rect);
-public static final native int gdk_regions_subtract(int source1, int source2);
-public static final native int gdk_regions_union(int source1, int source2);
-public static final native void gdk_region_destroy(int region);
-public static final native int gdk_pixmap_new(int window, int width, int height, int depth);
-public static final native boolean gdk_region_point_in(int region, int x, int y);
-public static final native boolean gdk_region_empty(int region);
-public static final native boolean gdk_region_equal(int region1, int region2);
-public static final native int gdk_screen_height();
-public static final native int gdk_screen_width();
-public static final native int gdk_region_rect_in(int region, GdkRectangle rect);
-public static final native int gdk_visual_get_system();
-public static final native void gdk_string_extents(int font, byte[] string, int[] lbearing, int[] rbearing, int[] width, int[] ascent, int[] descent);
-public static final native int gdk_string_height(int font, byte[] string);
-public static final native int gdk_string_width(int font, byte[] string);
-public static final native void gdk_window_copy_area(int window, int gc, int x, int y, int source_window, int source_x, int source_y, int width, int height);
-public static final native void gdk_window_clear_area(int window, int x, int y, int width, int height);
-public static final native void gdk_window_clear_area_e(int window, int x, int y, int width, int height);
-public static final native void gdk_window_resize(int window, int width, int height);
-public static final native void gdk_window_move (int window, int x, int y);
-public static final native int gdk_window_at_pointer(int[] win_x, int[] win_y);
-public static final native int gdk_time_get();
-public static final native int gdk_screen_width_mm();
-public static final native void gdk_window_get_geometry(int window, int[] x, int[] y, int[] width, int[] height, int[] depth);
-public static final native void gdk_window_raise(int window);
-public static final native void gdk_window_lower(int window);
-public static final native int gdk_window_get_origin(int window, int[] x, int[] y);
-public static final native int gdk_window_get_pointer(int window, int[] x, int[] y, int mask);
-public static final native void gdk_window_set_cursor(int window, int cursor);
-public static final native void gdk_window_set_icon(int window, int icon_window, int pixmap, int mask);
-public static final native void gdk_window_set_user_data(int window, int user_data);
-public static final native void gdk_window_show(int window);
-public static final native void gdk_window_get_user_data(int window, int[] data);
-public static final native void gdk_window_set_decorations(int window, int decorations);
-public static final native int gtk_adjustment_new(float value, float lower, float upper, float step_increment, float page_increment, float page_size);
-public static final native void gtk_adjustment_changed(int adjustment);
-public static final native void gtk_adjustment_set_value(int adjustment, float value);
-public static final native void gtk_adjustment_value_changed(int adjustment);
-public static final native int gtk_accel_group_new();
-public static final native void gtk_accel_group_unref(int accel_group);
-public static final native boolean gtk_accel_groups_activate(int accelGroup, int accelKey, int accelMods); // accelMods is one of GdkModifierType defined in gdk/gdktypes.h
-public static final native int gtk_arrow_new(int arrow_type, int shadow_type);
-public static final native void gtk_arrow_set(int arrow, int arrow_type, int shadow_type);
-public static final native void gtk_box_pack_start(int box, int child, boolean expand, boolean fill, int padding);
-public static final native void gtk_box_pack_end(int box, int child, boolean expand, boolean fill, int padding);
-public static final native int gtk_button_new();
-public static final native int gtk_check_button_new();
-public static final native int gtk_check_version(int required_major, int required_minor, int required_micro);
-public static final native int gtk_clist_append(int clist, int[] text);
-public static final native void gtk_clist_clear(int clist);
-public static final native int gtk_check_menu_item_new_with_label(byte[] label);
-public static final native int gtk_button_new_with_label(byte[] label);
-public static final native void gtk_clist_column_title_passive(int clist, int column);
-public static final native void gtk_clist_column_titles_show(int clist);
-public static final native void gtk_clist_column_titles_hide(int clist);
-public static final native void gtk_clist_freeze(int clist);
-public static final native void gtk_clist_get_pixtext(int clist, int row, int column, int[] text, int[] spacing, int[] pixmap, int[] mask);
-public static final native void gtk_check_menu_item_set_show_toggle(int menu_item, boolean always);
-public static final native void gtk_clist_column_titles_passive(int clist);
-public static final native void gtk_check_menu_item_set_active(int check_menu_item, boolean is_active);
-public static final native int gtk_clist_insert(int clist, int row, int[] text);
-public static final native int gtk_clist_new(int columns);
-public static final native void gtk_clist_set_selection_mode(int clist, int mode);
-public static final native int gtk_clist_get_text(int clist, int row, int column, int[] text);
-public static final native void gtk_clist_remove(int clist, int row);
-public static final native void gtk_clist_select_row(int clist, int row, int column);
-public static final native void gtk_clist_select_all(int clist);
-public static final native void gtk_clist_moveto(int clist, int row, int column, float row_align, float col_align);
-public static final native void gtk_clist_set_column_title(int clist, int column, byte[] title);
-public static final native void gtk_clist_set_column_visibility(int clist, int column, boolean visible);
-public static final native int gtk_clist_get_selection_info(int clist, int x, int y, int[] row, int[] column);
-public static final native void gtk_clist_set_column_justification(int clist, int column, int justification);
-public static final native void gtk_clist_set_column_resizeable(int clist, int column, boolean resizeable);
-public static final native void gtk_clist_set_column_width(int clist, int column, int width);
-public static final native void gtk_clist_set_pixtext(int clist, int row, int column, byte[] text, byte spacing, int pixmap, int mask);
-public static final native void gtk_clist_set_pixmap(int clist, int row, int column, int pixmap, int mask);
-public static final native void gtk_container_add(int container, int widget);
-public static final native int gtk_container_children(int container);
-public static final native int gtk_color_selection_dialog_new(byte[] title);
-public static final native void gtk_color_selection_get_color(int colorsel, double[] color);
-public static final native void gtk_color_selection_set_color(int colorsel, double[] color);
-public static final native int gtk_combo_new();
-public static final native void gtk_combo_set_popdown_strings(int combo, int strings);
-public static final native void gtk_clist_set_shadow_type(int clist, int type);
-public static final native void gtk_clist_unselect_row(int clist, int row, int column);
-public static final native void gtk_clist_unselect_all(int clist);
-public static final native void gtk_clist_set_text(int clist, int row, int column, byte[] text);
-public static final native void gtk_clist_thaw(int clist);
-public static final native void gtk_container_remove(int container, int widget);
-public static final native int gtk_ctree_new(int columns, int tree_column);
-public static final native int gtk_ctree_insert_node(int ctree, int parent, int sibling, int[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
-public static final native int gtk_ctree_node_get_row_data(int ctree, int node);
-public static final native void gtk_ctree_expand(int ctree, int node);
-public static final native boolean gtk_ctree_is_hot_spot(int ctree, int x, int y);
-public static final native boolean gtk_ctree_is_viewable(int ctree, int node);
-public static final native int gtk_ctree_node_get_row_style(int ctree, int node);
-public static final native void gtk_ctree_collapse(int ctree, int node);
-public static final native int gtk_ctree_get_node_info(int ctree, int node, int[] text, byte[] spacing, int[] pixmap_closed, int[] mask_closed, int[] pixmap_opened, int[] mask_opened, boolean[] is_leaf, boolean[] expanded);
-public static final native void gtk_ctree_node_set_row_data(int ctree, int node, int data);
-public static final native void gtk_ctree_select(int ctree, int node);
-public static final native int gtk_ctree_node_nth(int ctree, int row);
-public static final native void gtk_ctree_select_recursive(int ctree, int node);
-public static final native void gtk_ctree_unselect_recursive(int ctree, int node);
-public static final native void gtk_ctree_post_recursive(int ctree, int node, int func, int data);
-public static final native void gtk_ctree_remove_node(int ctree, int node);
-public static final native int gtk_ctree_node_is_visible(int ctree, int node);
-public static final native void gtk_ctree_node_moveto(int ctree, int node, int column, float row_align, float col_align);
-public static final native void gtk_ctree_set_node_info(int ctree, int node, byte[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
-public static final native int gtk_drawing_area_new();
-public static final native int gtk_dialog_new();
-public static final native int gtk_event_box_new();
-public static final native int gtk_editable_get_position(int editable);
-public static final native void gtk_editable_set_position(int editable, int position);
-public static final native int gtk_fixed_new();
-public static final native void gtk_entry_set_editable(int entry, boolean editable);
-public static final native void gtk_fixed_put(int fixed, int widget, short x, short y);
-public static final native int gtk_entry_get_text(int entry);
-public static final native void gtk_entry_set_text(int entry, byte[] text);
-public static final native void gtk_editable_select_region(int editable, int start, int end);
-public static final native void gtk_editable_delete_text(int editable, int start_pos, int end_pos);
-public static final native void gtk_editable_insert_text(int editable, byte[] new_text, int new_text_length, int[] position);
-public static final native void gtk_drawing_area_size(int darea, int width, int height);
-public static final native int gtk_events_pending();
-public static final native int gtk_file_selection_get_filename(int filesel);
-public static final native int gtk_file_selection_new(byte[] title);
-public static final native void gtk_file_selection_set_filename(int filesel, byte[] filename);
-public static final native void gtk_file_selection_complete(int filesel, byte[] pattern);
-public static final native int gtk_font_selection_dialog_get_font_name(int fsd);
-public static final native int gtk_font_selection_dialog_new(byte[] title);
-public static final native boolean gtk_font_selection_dialog_set_font_name(int fsd, byte[] fontname);
-public static final native void gtk_editable_set_editable(int editable, boolean is_editable);
-public static final native boolean gtk_font_selection_set_font_name(int fontsel, byte[] fontname);
-public static final native int gtk_entry_new();
-public static final native void gtk_entry_append_text(int entry, byte[] text);
-public static final native void gtk_editable_delete_selection(int editable);
-public static final native int gtk_editable_get_chars(int editable, int start_pos, int end_pos);
-public static final native void gtk_entry_set_visibility(int entry, boolean visible);
-public static final native void gtk_entry_set_max_length(int entry, short max);
-public static final native void gtk_fixed_move(int fixed, int widget, short x, short y);
-public static final native boolean gtk_init_check(int[] argc, int[] argv);
-public static final native int gtk_frame_new(byte[] label);
-public static final native void gtk_frame_set_shadow_type(int frame, int type);
-public static final native void gtk_frame_set_label(int frame, byte[] label);
-public static final native int gtk_hseparator_new();
-public static final native int gtk_hbox_new(boolean homogeneous, int spacing);
-public static final native void gtk_grab_add(int widget);
-public static final native int gtk_grab_get_current();
-public static final native void gtk_grab_remove(int widget);
-public static final native int gtk_hscale_new(int adjustment);
-public static final native int gtk_hscrollbar_new(int adjustment);
-public static final native void gtk_label_set_justify(int label, int jtype);
-public static final native int gtk_label_new(byte[] str);
-public static final native void gtk_label_set_pattern(int label, byte[] pattern);
-public static final native void gtk_main_quit();
-public static final native void gtk_main();
-public static final native void gtk_list_clear_items(int list, int start, int end);
-public static final native void gtk_list_select_item(int list, int item);
-public static final native int gtk_main_iteration();
-public static final native void gtk_label_set_line_wrap(int label, boolean wrap);
-public static final native int gtk_label_parse_uline(int label, byte[] string);
-public static final native void gtk_label_set_text(int label, byte[] str);
-public static final native void gtk_misc_set_alignment(int misc, float xalign, float yalign);
-public static final native int gtk_menu_bar_new();
-public static final native int gtk_menu_new();
-public static final native void gtk_menu_popdown(int menu);
-public static final native void gtk_menu_popup(int menu, int parent_menu_shell, int parent_menu_item, int func, int data, int button, int activate_time);
-public static final native int gtk_menu_item_new();
-public static final native int gtk_menu_item_new_with_label(byte[] label);
-public static final native void gtk_menu_bar_insert(int menu_bar, int child, int position);
-public static final native void gtk_menu_insert(int menu, int child, int position);
-public static final native void gtk_menu_item_set_submenu(int menu_item, int submenu);
-public static final native void gtk_menu_item_remove_submenu(int menu_item);
-public static final native int gtk_notebook_new();
-public static final native void gtk_notebook_append_page(int notebook, int child, int tab_label);
-public static final native int gtk_notebook_get_current_page(int notebook);
-public static final native void gtk_object_ref(int object);
-public static final native void gtk_notebook_set_show_tabs(int notebook, boolean show_tabs);
-public static final native void gtk_notebook_remove_page(int notebook, int page_num);
-public static final native void gtk_notebook_set_page(int notebook, int page_num);
-public static final native void gtk_object_set_user_data(int object, int data);
-public static final native int gtk_object_get_user_data(int object);
-public static final native int gtk_pixmap_new(int pixmap, int mask);
-public static final native int gtk_progress_bar_new();
-public static final native void gtk_progress_bar_set_orientation(int pbar, int orientation);
-public static final native void gtk_progress_bar_set_bar_style(int pbar, int style);
-public static final native void gtk_progress_configure(int progress, float value, float min, float max);
-public static final native void gtk_pixmap_set(int pixmap, int val, int mask);
-public static final native int gtk_radio_button_new(int group);
-public static final native int gtk_radio_button_group(int radio_button);
-public static final native int gtk_radio_menu_item_new_with_label(int group, byte[] label);
-public static final native int gtk_range_get_adjustment(int range);
-public static final native int gtk_scrolled_window_new(int hadjustment, int vadjustment);
-public static final native void gtk_scale_set_digits(int scale, int digits);
-public static final native void gtk_scale_set_draw_value(int scale, boolean draw_value);
-public static final native void gtk_scale_set_value_pos(int scale, int pos);
-public static final native int gtk_scrolled_window_get_hadjustment(int scrolled_window);
-public static final native void gtk_scrolled_window_set_policy(int scrolled_window, int hscrollbar_policy, int vscrollbar_policy);
-public static final native int gtk_scrolled_window_get_vadjustment(int scrolled_window);
-public static final native int gtk_selection_convert(int widget, int selection, int target, int time);
-public static final native int gtk_signal_connect(int object, byte[] name, int func, int func_data);
-public static final native int gtk_selection_owner_set(int widget, int selection, int time);
-public static final native void gtk_signal_emit_stop_by_name(int object, byte[] name);
-public static final native void gtk_signal_handler_block_by_func(int object, int func, int data);
-public static final native void gtk_signal_handler_unblock_by_func(int object, int func, int data);
-public static final native int gtk_signal_connect_after(int object, byte[] name, int func, int func_data);
-public static final native int gtk_style_copy(int style);
-public static final native void gtk_style_unref(int style);
-public static final native int gtk_toggle_button_new();
-public static final native void gtk_toggle_button_set_active(int toggle_button, boolean is_active);
-public static final native boolean gtk_toggle_button_get_active(int toggle_button);
-public static final native int gtk_timeout_add(int interval, int function, int data);
-public static final native void gtk_timeout_remove(int timeout_handler_id);
-public static final native int gtk_text_new(int hadj, int vadj);
-public static final native void gtk_text_set_word_wrap(int text, int word_wrap);
-public static final native int gtk_text_get_length(int text);
-public static final native int gtk_toolbar_new(int orientation, int style);
-public static final native void gtk_toolbar_set_button_relief(int toolbar, int relief);
-public static final native void gtk_toolbar_insert_widget(int toolbar, int widget, byte[] tooltip_text, byte[] tooltip_private_text, int position);
-public static final native void gtk_toolbar_set_orientation(int toolbar, int orientation);
-public static final native int gtk_toolbar_insert_element(int toolbar, int type, int widget, byte[] text, byte[] tooltip_text, byte[] tooltip_private_text, int icon, int callback, int user_data, int position);
-public static final native int gtk_tooltips_new();
-public static final native int gtk_vseparator_new();
-public static final native int gtk_vbox_new(boolean homogeneous, int spacing);
-public static final native int gtk_vscale_new(int adjustment);
-public static final native int gtk_vscrollbar_new(int adjustment);
-public static final native void gtk_tooltips_set_tip(int tooltips, int widget, byte[] tip_text, byte[] tip_private);
-public static final native int gtk_widget_get_default_style();
-public static final native void gtk_widget_add_events(int widget, int events);
-public static final native void gtk_widget_destroy(int widget);
-public static final native int gtk_widget_event(int widget, int event);
-public static final native void gtk_widget_hide(int widget);
-public static final native void gtk_widget_grab_focus(int widget);
-public static final native int gtk_widget_get_style(int widget);
-public static final native void gtk_widget_add_accelerator(int widget, byte[] accel_signal, int accel_group, int accel_key, int accel_mods, int accel_flags);
-public static final native void gtk_widget_ensure_style(int widget);
-public static final native void gtk_widget_show(int widget);
-public static final native void gtk_widget_realize(int widget);
-static int malloc(String name) {
- int length = name.length();
- char [] unicode = new char [length];
- name.getChars (0, length, unicode, 0);
- byte[] buffer = new byte [length + 1];
- for (int i = 0; i < length; i++) {
- buffer[i] = (byte) unicode[i];
- }
- return OS.g_strdup (buffer);
-}
-
-public static final native void gtk_widget_show_all(int widget);
-public static final native void gtk_widget_show_now(int widget);
-public static final native void gtk_widget_queue_draw(int widget);
-public static final native void gtk_widget_set_style(int widget, int style);
-public static final native void gtk_widget_set_sensitive(int widget, boolean sensitive);
-public static final native void gtk_widget_set_state(int widget, int state);
-public static final native int gtk_window_new(int type);
-public static final native void gtk_widget_size_request(int widget, GtkRequisition requisition);
-public static final native void gtk_widget_set_uposition(int widget, int x, int y);
-public static final native void gtk_widget_set_usize(int widget, int width, int height);
-public static final native void gtk_widget_remove_accelerator(int widget, int accel_group, int accel_key, int accel_mods);
-public static final native void gtk_widget_set_parent(int widget, int parent);
-public static final native void gtk_window_add_accel_group(int window, int accel_group);
-public static final native void gtk_window_set_policy(int window, int allow_shrink, int allow_grow, int auto_shrink);
-public static final native void gtk_window_set_modal(int window, boolean modal);
-public static final native void gtk_window_set_title(int window, byte[] title);
-public static final native void gtk_window_set_transient_for(int window, int parent);
-public static final native void gtk_widget_reparent(int widget, int new_parent);
-public static final native void gtk_widget_size_allocate(int widget, GtkAllocation allocation);
-public static final native int XListFonts(byte[] pattern, int maxFonts, int[] pnum_fonts);
-public static final native void memmove(int[] dest, int src, int size);
-public static final native int strlen (int str);
-
-/* NEW MEMMOVES - doesn't work because of inheritance of natives */
-public static final native void memmove(byte[] dest, int src, int size);
-public static final native void memmove(int dest, GtkStyle src, int size);
-public static final native void memmove(GdkFont dest, int src, int size);
-public static final native void memmove(GtkStyle dest, int src, int size);
-public static final native void memmove(int[] dest, byte[] src, int size);
-public static final native void memmove(int dest, byte[] src, int size);
-public static final native void memmove(GdkColor dest, int src, int size);
-public static final native void memmove(GdkEventButton dest, int src, int size);
-public static final native void memmove(GdkEventExpose dest, int src, int size);
-public static final native void memmove(GdkEventKey dest, int src, int size);
-public static final native void memmove(GdkEventMotion dest, int src, int size);
-public static final native void memmove(int dest, int[] src, int size);
-public static final native void memmove(GdkVisual dest, int src, int size);
-public static final native void memmove(GtkAdjustment dest, int src, int size);
-public static final native void memmove(GtkBin dest, int src, int size);
-public static final native void memmove(GtkCList dest, int src, int size);
-public static final native void memmove(GtkCombo dest, int src, int size);
-public static final native void memmove(GtkContainer dest, int src, int size);
-public static final native void memmove(GtkCTreeRow dest, int src, int size);
-public static final native void memmove(GtkEditable dest, int src, int size);
-public static final native void memmove(GtkDialog dest, int src, int size);
-public static final native void memmove(GtkObject dest, int src, int size);
-public static final native void memmove(GtkWidget dest, int src, int size);
-public static final native void memmove(int dest, GtkAdjustment src, int size);
-public static final native void memmove(int dest, GtkBin src, int size);
-public static final native void memmove(int dest, GtkCListColumn src, int size);
-public static final native void memmove(GtkCListRow dest, int src, int size);
-public static final native void memmove(GtkCListColumn dest, int src, int size);
-public static final native void memmove(int dest, GtkEditable src, int size);
-public static final native void memmove(int dest, GtkText src, int size);
-public static final native void memmove(int dest, GtkObject src, int size);
-
-/* OLD MEMMOVES - these need to be pruned */
-public static final native void memmove(int dest, GdkColor src, int size);
-public static final native void memmove(int dest, GdkEventButton src, int size);
-public static final native void memmove(int dest, GdkEventExpose src, int size);
-public static final native void memmove(int dest, GdkEventKey src, int size);
-public static final native void memmove(int dest, GdkEventMotion src, int size);
-public static final native void memmove(int dest, GdkGCValues src, int size);
-public static final native void memmove(int dest, GdkRectangle src, int size);
-public static final native void memmove(int dest, GdkVisual src, int size);
-public static final native void memmove(int dest, GtkAllocation src, int size);
-//public static final native void memmove(int dest, GtkArg src, int size);
-public static final native void memmove(int dest, GtkBox src, int size);
-public static final native void memmove(int dest, GtkCList src, int size);
-public static final native void memmove(int dest, GtkCListRow src, int size);
-public static final native void memmove(int dest, GtkCTreeRow src, int size);
-public static final native void memmove(int dest, GtkCheckMenuItem src, int size);
-public static final native void memmove(int dest, GtkColorSelectionDialog src, int size);
-public static final native void memmove(int dest, GtkCombo src, int size);
-public static final native void memmove(int dest, GtkContainer src, int size);
-//public static final native void memmove(int dest, GtkData src, int size);
-public static final native void memmove(int dest, GtkFileSelection src, int size);
-public static final native void memmove(int dest, GtkFontSelectionDialog src, int size);
-public static final native void memmove(int dest, GtkHBox src, int size);
-public static final native void memmove(int dest, GtkMenuItem src, int size);
-public static final native void memmove(int dest, GtkRequisition src, int size);
-public static final native void memmove(int dest, GtkWidget src, int size);
-public static final native void memmove(int dest, GtkWindow src, int size);
-public static final native void memmove(int dest, GtkCTree src, int size);
-public static final native void memmove(GdkGCValues dest, int src, int size);
-public static final native void memmove(GdkRectangle dest, int src, int size);
-public static final native void memmove(GtkAllocation dest, int src, int size);
-//public static final native void memmove(GtkArg dest, int src, int size);
-public static final native void memmove(GtkBox dest, int src, int size);
-public static final native void memmove(GtkCheckMenuItem dest, int src, int size);
-public static final native void memmove(GtkColorSelectionDialog dest, int src, int size);
-//public static final native void memmove(GtkData dest, int src, int size);
-public static final native void memmove(GtkFrame dest, int src, int size);
-public static final native void memmove(GtkFileSelection dest, int src, int size);
-public static final native void memmove(GtkFontSelectionDialog dest, int src, int size);
-public static final native void memmove(GtkHBox dest, int src, int size);
-public static final native void memmove(GtkMenuItem dest, int src, int size);
-public static final native void memmove(GtkRequisition dest, int src, int size);
-public static final native void memmove(GtkText dest, int src, int size);
-public static final native void memmove(GtkWindow dest, int src, int size);
-public static final native void memmove(GtkCTree dest, int src, int size);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.csh
deleted file mode 100644
index 6e30058d30..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.csh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/csh
-
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-
-# Some UNIX/Linux compilers don't like <CR>'s in files (DOS format).
-set fixup_files = `grep -l "\ " *.[ch]`
-if ( "$fixup_files" != "" ) then
- echo "Converting files from DOS to UNIX format:"
- foreach file ($fixup_files)
- echo " $file"
- ex $file << EOF >& /dev/null
-g/ \$/s///
-w
-EOF
- end
-endif
-
-# Determine the operating system being built
-set OS=`uname -s`
-switch ($OS )
- case AIX:
- if ( "$1" == "clean" ) then
- make -f make_aix.mak clean
- else
- echo "Building AIX version of SWT and CDE DLLs."
- make -f make_aix.mak make_swt
- make -f make_aix.mak make_cde
- endif
- breaksw
-
- case Linux:
- if ( "$1" == "clean" ) then
- make -f make_linux.mak clean
- else
- echo "Building Linux version of SWT and GNOME DLLs."
- make -f make_linux.mak make_swt make_gnome
-
- set build_kde = `rpm -q kdebase | grep "not installed"`
- if ( "$build_kde" == "" ) then
- echo "Building Linux version of KDE DLL."
- make -f make_linux.mak make_kde
- endif
- endif
- breaksw
-
- case SunOS:
- if ( "$1" == "clean" ) then
- make -f make_solaris.mak clean
- else
- echo "Building Solaris version of SWT and CDE DLLs."
- make -f make_solaris.mak make_swt
- make -f make_solaris.mak make_cde
- endif
- breaksw
-
- default:
- echo "Unknown OS -- build aborted"
- breaksw
-endsw
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/cde.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/cde.c
deleted file mode 100644
index d48f2c743d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/cde.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT CDE natives implementation.
- */
-
-#include "swt.h"
-
-#include <stdio.h>
-#include <assert.h>
-#include <Dt/Dts.h>
-#include <Dt/Action.h>
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtAppInitialize
- * Signature: (III[B[B)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtAppInitialize
- (JNIEnv *env, jclass that, jint appContext, jint display, jint topWidget,
- jbyteArray appName, jbyteArray appClass)
-{
- jbyte* appName1 = NULL;
- jbyte* appClass1 = NULL;
- jboolean status;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtAppInitialize\n");
-#endif
-
- if (appName) appName1 = (*env)->GetByteArrayElements(env, appName, NULL);
- if (appClass) appClass1 = (*env)->GetByteArrayElements(env, appClass, NULL);
-
- status = (jint) DtAppInitialize( (XtAppContext) appContext,
- (Display*) display, (Widget) topWidget, appName1, appClass1 );
-
- if (appClass) (*env)->ReleaseByteArrayElements(env, appClass, appClass1, 0);
- if (appName) (*env)->ReleaseByteArrayElements(env, appName, appName1, 0);
- return status;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDbLoad
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDbLoad
- (JNIEnv *env, jclass that )
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDbLoad\n");
-#endif
-
- DtDbLoad();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeNames
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeNames
- (JNIEnv *env, jclass that)
-{
- jint dataTypeList;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeNames\n");
-#endif
-
- dataTypeList = (jint) DtDtsDataTypeNames();
- return dataTypeList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFileToDataType
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFileToDataType
- (JNIEnv *env, jclass that, jbyteArray fileName)
-{
- jbyte* fileName1 = NULL;
- jint dataType;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFileToDataType\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- dataType = (jint) DtDtsFileToDataType( (char*) fileName1 );
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return dataType;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeIsAction
- * Signature: ([B)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeIsAction
- (JNIEnv *env, jclass that, jbyteArray dataType)
-{
- jbyte* dataType1 = NULL;
- jboolean isAction;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeIsAction\n");
-#endif
-
- if (dataType) dataType1 = (*env)->GetByteArrayElements(env, dataType, NULL);
- isAction = (jboolean) DtDtsDataTypeIsAction( (char*) dataType1 );
- if (dataType) (*env)->ReleaseByteArrayElements(env, dataType, dataType1, 0);
- return isAction;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeToAttributeValue
- * Signature: ([B[B[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeToAttributeValue
- (JNIEnv *env, jclass that, jbyteArray dataType, jbyteArray attrName, jbyteArray optName)
-{
- jbyte* dataType1 = NULL;
- jbyte* attrName1 = NULL;
- jbyte* optName1 = NULL;
- jint attrValue;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeToAttributeValue\n");
-#endif
-
- if (dataType) dataType1 = (*env)->GetByteArrayElements(env, dataType, NULL);
- if (attrName) attrName1 = (*env)->GetByteArrayElements(env, attrName, NULL);
- if (optName) optName1 = (*env)->GetByteArrayElements(env, optName, NULL);
-
- attrValue = (jint) DtDtsDataTypeToAttributeValue( (char*) dataType1,
- (char*) attrName1, (char*) optName1 );
-
- if (optName) (*env)->ReleaseByteArrayElements(env, optName, optName1, 0);
- if (attrName) (*env)->ReleaseByteArrayElements(env, attrName, attrName1, 0);
- if (dataType) (*env)->ReleaseByteArrayElements(env, dataType, dataType1, 0);
- return attrValue;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeDataType
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeDataType
- (JNIEnv *env, jclass that, jint dataType)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeDataType\n");
-#endif
-
- DtDtsFreeDataType( (char*) dataType );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeDataTypeNames
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeDataTypeNames
- (JNIEnv *env, jclass that, jint dataTypeList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeDataTypeNames\n");
-#endif
-
- DtDtsFreeDataTypeNames( (char**) dataTypeList );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeAttributeValue
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeAttributeValue
- (JNIEnv *env, jclass that, jint attrValue)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeAttributeValue\n");
-#endif
-
- DtDtsFreeAttributeValue( (char*) attrValue );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtActionInvoke
- * Signature: (I[B[BI[B[B[BIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtActionInvoke
- (JNIEnv *env, jclass that, jint topWidget, jbyteArray action,
- jbyteArray fileName, jint argCount, jbyteArray termOpts, jbyteArray execHost,
- jbyteArray contextDir, jint useIndicator, jint callback, jint clientData)
-{
- jbyte* action1 = NULL;
- jbyte* fileName1 = NULL;
- jbyte* termOpts1 = NULL;
- jbyte* execHost1 = NULL;
- jbyte* contextDir1 = NULL;
- jint actionID;
- DtActionArg arg; /* Action arguments should really be Java objects. */
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtActionInvoke\n");
-#endif
-
- if (action) action1 = (*env)->GetByteArrayElements(env, action, NULL);
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- if (termOpts) termOpts1 = (*env)->GetByteArrayElements(env, termOpts, NULL);
- if (execHost) execHost1 = (*env)->GetByteArrayElements(env, execHost, NULL);
- if (contextDir) contextDir1 = (*env)->GetByteArrayElements(env, contextDir, NULL);
-
- /* TBD: DtActionArg should be a Java class and the third argument
- * (fileName) should really be an array of DtActionArg.
- *
- * Create the action argument given the file name. This is the only type
- * of action supported by the Program module of SWT. The argCount is
- * ignored because only one file can be passed this way.
- */
- arg.argClass = DtACTION_FILE;
- arg.u.file.name = (char*) fileName1;
-
-/*
- printf("Invoking action: %d %s %s 1 %X %X %X %X %X %X\n", topWidget, action1, fileName1,
- termOpts1, execHost1, contextDir1, useIndicator, callback, clientData );
-*/
- actionID = (jint) DtActionInvoke( (Widget) topWidget, (char*) action1,
- &arg, 1, (char*) termOpts1,(char*) execHost1, (char*) contextDir1,
- useIndicator, (DtActionCallbackProc) callback, (XtPointer) clientData );
-
- if (contextDir) (*env)->ReleaseByteArrayElements(env, contextDir, contextDir1, 0);
- if (execHost) (*env)->ReleaseByteArrayElements(env, execHost, execHost1, 0);
- if (termOpts) (*env)->ReleaseByteArrayElements(env, termOpts, termOpts1, 0);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- if (action) (*env)->ReleaseByteArrayElements(env, action, action1, 0);
-
- return actionID;
-}
-
-/* Utility methods */
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: listElementAt
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_listElementAt
- (JNIEnv *env, jclass that, jint nameList, jint index)
-{
- char** nameList1 = (char**) nameList;
- return (jint) nameList1[ index ];
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c
deleted file mode 100644
index 9fc4934cdf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT GNOME natives implementation.
- */
-
-/* #define PRINT_FAILED_RCODES */
-#define NDEBUG
-
-#include "swt.h"
-#include "structs.h"
-
-#include <stdio.h>
-#include <assert.h>
-#include <gnome.h>
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: g_1get_1home_1dir
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_g_1get_1home_1dir
- (JNIEnv *env, jclass that)
-{
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "g_1get_1home_1dir\n");
-#endif
- rc = (jint) g_get_home_dir();
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1datadir_1file
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1datadir_1file
- (JNIEnv * env, jclass that, jbyteArray fileName)
-{
- jbyte *fileName1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1datadir_1file\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- rc = (jint) gnome_datadir_file(fileName1);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1desktop_1entry_1load
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1desktop_1entry_1load
- (JNIEnv * env, jclass that, jbyteArray fileName)
-{
- jbyte *fileName1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1desktop_1entry_1load\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- rc = (jint) gnome_desktop_entry_load(fileName1);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1desktop_1entry_1free
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1desktop_1entry_1free
- (JNIEnv * env, jclass that, jint entry)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1desktop_1entry_1free\n");
-#endif
-
- gnome_desktop_entry_free((GnomeDesktopEntry*)entry);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1mime_1get_1value
- * Signature: ([B[B)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1mime_1get_1value
- (JNIEnv *env, jclass that, jbyteArray mimeType, jbyteArray key)
-{
- jbyte *mimeType1 = NULL;
- jbyte *key1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1mime_1get_1value\n");
-#endif
-
- if (mimeType) mimeType1 = (*env)->GetByteArrayElements(env, mimeType, NULL);
- if (key) key1 = (*env)->GetByteArrayElements(env, key, NULL);
- rc = (jint) gnome_mime_get_value(mimeType1, key1);
- if (mimeType) (*env)->ReleaseByteArrayElements(env, mimeType, mimeType1, 0);
- if (key) (*env)->ReleaseByteArrayElements(env, key, key1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1mime_1type
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1mime_1type
- (JNIEnv *env, jclass that, jbyteArray fileName)
-{
- jbyte *fileName1 = NULL;
- const char* rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1mime_1type\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- rc = gnome_mime_type(fileName1);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return (jint) rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_GNOME
- * Method: gnome_1pixmap_1file
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1pixmap_1file
- (JNIEnv * env, jclass that, jbyteArray fileName)
-{
- jbyte *fileName1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gnome_1pixmap_1file\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- rc = (jint) gnome_pixmap_file(fileName1);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return rc;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/kde.cc b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/kde.cc
deleted file mode 100644
index b2c4125693..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/kde.cc
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT KDE natives implementation.
- */
-
-/* #define PRINT_FAILED_RCODES */
-#define NDEBUG
-
-#include <stdio.h>
-#include <signal.h>
-#include "swt.h"
-
-#include <kapp.h>
-#include <kservice.h>
-#include <kmimetype.h>
-#include <krun.h>
-#include <kuserprofile.h>
-#include <kurl.h>
-#include <qstring.h>
-
-extern "C" {
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KApplication_1new
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KApplication_1new
- (JNIEnv *env, jclass that, int appName)
-{
- int myArgc = 1;
- char* myArgv[2] = { "SWT", 0 }; // KApplication requires a NULL terminated list
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KApplication_1new\n");
-#endif
- QCString qcString = *((QCString*) appName);
-
- // NOTE: When a KDE application is initialized, it installs its own
- // SIGSEGV signal handler so that it can pop up a dialogue box and
- // display an error message should SIGSEGV occur. After the dialogue
- // box is closed, it terminates the program. The Hursley Java VM (on Linux)
- // happens to catch SIGSEGV signals so that it can throw a null pointer
- // exception. Thus when KDE is initialized, the Java try ... catch
- // mechanism for null pointers does not work. Eclipse code relies upon
- // this try ... catch feature.
- //
- // The solution is to obtain the Java VM's signal handler before initializing
- // KDE and to reinstall that handler after the initialization. The method
- // sigaction() must be used instead of signal() because it returns more
- // information on how to handle the signal.
-
- // Obtain the current signal handling logic for SIGSEGV.
- struct sigaction prev;
- sigaction( SIGSEGV, NULL, &prev );
-
- // Initialize KDE, which installs its own signal handler.
- KApplication* app = new KApplication(myArgc, myArgv, qcString);
-
- // Replace the Java VM signal handler.
- sigaction( SIGSEGV, &prev, NULL );
-
- return (jint) app;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KGlobal_1iconLoader
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KGlobal_1iconLoader
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KGlobal_1iconLoader\n");
-#endif
- return (jint) KGlobal::iconLoader();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KIconLoader_1iconPath
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KIconLoader_1iconPath
- (JNIEnv *env, jclass that, jint kloader, jint iconQString, jint iconType, jint canReturnNull)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KIconLoader_1iconPath\n");
-#endif
- KIconLoader* loader = (KIconLoader*) kloader;
- QString iconName = *((QString*) iconQString);
- QString iconPath = loader->iconPath(iconName, iconType, canReturnNull);
- if (iconPath == 0) return 0;
- QString* answer = new QString();
- *answer = iconPath;
- return (jint) answer;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1mimeType
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1mimeType
- (JNIEnv *env, jclass that, jint mimeTypeName)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1mimeType\n");
-#endif
- KSharedPtr<KMimeType>* mimeType = new KSharedPtr<KMimeType>();
- QString qMimeType = *((QString*) mimeTypeName);
- *mimeType = KMimeType::mimeType( qMimeType );
- return (jint) mimeType;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1icon
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1icon
- (JNIEnv *env, jclass that, jint mimeTypePtr, jint unused1, jint unused2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1icon\n");
-#endif
- KSharedPtr<KMimeType> mimeType = *((KSharedPtr<KMimeType>*) mimeTypePtr);
- QString* answer = new QString();
- *answer = mimeType->icon((const QString&) NULL, 0);
- return (jint) answer;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1name
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1name
- (JNIEnv *env, jclass that, jint mimeTypePtr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1name\n");
-#endif
- KSharedPtr<KMimeType> mimeType = *((KSharedPtr<KMimeType>*) mimeTypePtr);
- QString* name = new QString();
- *name = mimeType->name();
- return (jint) name;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1patterns
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1patterns
- (JNIEnv *env, jclass that, jint mimeTypePtr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1patterns\n");
-#endif
- KSharedPtr<KMimeType> mimeType = *((KSharedPtr<KMimeType>*) mimeTypePtr);
- QStringList* patternList = new QStringList();
- *patternList = mimeType->patterns();
- return (jint) patternList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1offers
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1offers
- (JNIEnv *env, jclass that, jint mimeTypeName)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1offers\n");
-#endif
- QString qMimeType = *((QString*) mimeTypeName);
- KService::List* serviceList = new KService::List();
- *serviceList = KMimeType::offers( qMimeType );
- return (jint) serviceList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeType_1allMimeTypes
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeType_1allMimeTypes
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeType_1allMimeTypes\n");
-#endif
- KMimeType::List* mimeTypeList = new KMimeType::List();
- *mimeTypeList = KMimeType::allMimeTypes();
- return (jint) mimeTypeList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeList_1begin
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeList_1begin
- (JNIEnv *env, jclass that, jint mimeTypeList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeList_1begin\n");
-#endif
- KMimeType::List *list= (KMimeType::List*) mimeTypeList;
- QValueListIterator<KMimeType::Ptr>* iterator = new QValueListIterator<KMimeType::Ptr>();
- *iterator = list->begin();
- return (jint) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeList_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeList_1delete
- (JNIEnv *env, jclass that, jint mimeTypeList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeList_1delete\n");
-#endif
- delete (KMimeType::List*) mimeTypeList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeList_1end
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeList_1end
- (JNIEnv *env, jclass that, jint mimeTypeList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeList_1end\n");
-#endif
- KMimeType::List *list = (KMimeType::List*) mimeTypeList;
- QValueListIterator<KMimeType::Ptr>* iterator = new QValueListIterator<KMimeType::Ptr>();
- *iterator = list->end();
- return (jint) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeListIterator_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeListIterator_1delete
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeListIterator_1delete\n");
-#endif
- delete (QValueListIterator<KMimeType::Ptr>*) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeListIterator_1dereference
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeListIterator_1dereference
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeListIterator_1dereference\n");
-#endif
- KSharedPtr<KMimeType>* mimeType = new KSharedPtr<KMimeType>();
- *mimeType = *(*((QValueListIterator<KMimeType::Ptr>*) iterator));
- return (jint) mimeType;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeListIterator_1equals
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeListIterator_1equals
- (JNIEnv *env, jclass that, jint iterator, jint iterator2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeListIterator_1equals\n");
-#endif
- return *((QValueListIterator<KMimeType::Ptr>*) iterator) ==
- *((QValueListIterator<KMimeType::Ptr>*) iterator2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KMimeTypeListIterator_1increment
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_KMimeTypeListIterator_1increment
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KMimeTypeListIterator_1increment\n");
-#endif
- ++(*((QValueListIterator<KMimeType::Ptr>*) iterator));
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringList_1begin
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringList_1begin
- (JNIEnv *env, jclass that, jint qstringList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringList_1begin\n");
-#endif
- QStringList *list= (QStringList*) qstringList;
- QValueListIterator<QString>* iterator = new QValueListIterator<QString>();
- *iterator = list->begin();
- return (jint) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringList_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringList_1delete
- (JNIEnv *env, jclass that, jint qstringList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringList_1delete\n");
-#endif
- delete (QStringList*) qstringList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringList_1end
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringList_1end
- (JNIEnv *env, jclass that, jint qstringList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringList_1end\n");
-#endif
- QStringList *list = (QStringList*) qstringList;
- QValueListIterator<QString>* iterator = new QValueListIterator<QString>();
- *iterator = list->end();
- return (jint) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringListIterator_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringListIterator_1delete
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringListIterator_1delete\n");
-#endif
- delete (QValueListIterator<QString>*) iterator;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringListIterator_1dereference
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringListIterator_1dereference
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringListIterator_1dereference\n");
-#endif
- QString* qstring = new QString();
- *qstring = *(*((QValueListIterator<QString>*) iterator));
- return (jint) qstring;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringListIterator_1equals
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringListIterator_1equals
- (JNIEnv *env, jclass that, jint iterator, jint iterator2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringListIterator_1equals\n");
-#endif
- return *((QValueListIterator<QString>*) iterator) ==
- *((QValueListIterator<QString>*) iterator2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QStringListIterator_1increment
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_QStringListIterator_1increment
- (JNIEnv *env, jclass that, jint iterator)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QStringListIterator_1increment\n");
-#endif
- ++(*((QValueListIterator<QString>*) iterator));
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KURL_1new
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KURL_1new
- (JNIEnv *env, jclass that, jint qURLString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KURL_1new\n");
-#endif
- QString urlString = *((QString*) qURLString);
- return (jint) new KURL(urlString);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KURL_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_KURL_1delete
- (JNIEnv *env, jclass that, jint url)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KURL_1delete\n");
-#endif
- delete (KURL*) url;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KRun_1runURL
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_KRun_1runURL
- (JNIEnv *env, jclass that, jint kurl, jint mimeTypeName)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KRun_1runURL\n");
-#endif
- KURL url = *((KURL*) kurl);
- QString qMimeType = *((QString*) mimeTypeName);
- return (jint) KRun::runURL( url, qMimeType );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: KServiceList_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_KServiceList_1delete
- (JNIEnv *env, jclass that, jint serviceList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "KServiceList_1delete\n");
-#endif
- delete (KService::List*) serviceList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QCString_1data
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QCString_1data
- (JNIEnv *env, jclass that, jint qcString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QCString_1data\n");
-#endif
- return (jint) ((QCString*) qcString)->data();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QCString_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_QCString_1delete
- (JNIEnv *env, jclass that, jint qcString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QCString_1delete\n");
-#endif
- delete (QCString*) qcString;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QCString_1new
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QCString_1new
- (JNIEnv *env, jclass that, jbyteArray text)
-{
- jbyte *text1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QCString_1new\n");
-#endif
- if (text) text1 = env->GetByteArrayElements(text, NULL);
- QCString* qcString = new QCString((char*) text1);
- if (text) env->ReleaseByteArrayElements(text, text1, 0);
- return (jint) qcString;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QString_1delete
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_KDE_QString_1delete
- (JNIEnv *env, jclass that, jint qString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QString_1delete\n");
-#endif
- delete (QString*) qString;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QString_1equals
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QString_1equals
- (JNIEnv *env, jclass that, jint qString, jint qString2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QString_1equals\n");
-#endif
- return *((QString*) qString) == *((QString*) qString2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QString_1new
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QString_1new
- (JNIEnv *env, jclass that, jbyteArray text)
-{
- jbyte *text1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QString_1new\n");
-#endif
- if (text) text1 = env->GetByteArrayElements(text, NULL);
- QString* qString = new QString((char*) text1);
- if (text) env->ReleaseByteArrayElements(text, text1, 0);
- return (jint) qString;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_KDE
- * Method: QString_1utf8
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_KDE_QString_1utf8
- (JNIEnv *env, jclass that, jint qString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "QString_1utf8\n");
-#endif
- QString string = *((QString*) qString);
- QCString* qcString = new QCString();
- *qcString = string.utf8();
- return (jint) qcString;
-}
-
-
-} /* extern "C" */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_aix.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_aix.mak
deleted file mode 100644
index 3ec5299bd8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_aix.mak
+++ /dev/null
@@ -1,59 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for creating SWT libraries on AIX
-
-include make_common.mak
-
-SWT_VERSION=$(maj_ver)$(min_ver)
-
-CC=cc_r
-
-# Define the installation directories for various products.
-# IVE_HOME - IBM's version of Java (J9)
-# CDE_HOME - CDE includes and libraries
-# MOTIF_HOME - Motif includes and libraries
-IVE_HOME = /bluebird/teamswt/swt-builddir/ive/bin
-MOTIF_HOME = /bluebird/teamswt/swt-builddir/motif21
-CDE_HOME = /usr/dt
-
-# Define the various DLL (shared) libraries to be made.
-
-SWT_PREFIX = swt
-WS_PREFIX = motif
-SWT_DLL = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-SWT_OBJ = callback.o structs.o swt.o
-SWT_LIB = -L$(MOTIF_HOME) -G -bnoentry -lc_r -lC_r -lm -bexpall -lXm -lMrm -lXt -lX11 -lXext
-
-CDE_PREFIX = swt-cde
-CDE_DLL = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-CDE_OBJ = cde.o
-CDE_LIB = -L$(CDE_HOME)/lib -G -bnoentry -bexpall -lDtSvc
-
-#
-# The following CFLAGS are for compiling both the SWT library and the CDE
-# library.
-#
-CFLAGS = -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DAIX -DMOTIF -DCDE -DNO_XPRINTING_EXTENSIONS \
- -q mbcs -qlanglvl=extended -qarch=ppc -qtune=604 -qmaxmem=8192 \
- -I$(IVE_HOME)/include \
- -I$(MOTIF_HOME)/include \
- -I$(CDE_HOME)/include
-
-all: make_swt
-
-make_swt: $(SWT_DLL)
-
-$(SWT_DLL): $(SWT_OBJ)
- ld $(SWT_LIB) -o $(SWT_DLL) $(SWT_OBJ)
-
-make_cde: $(CDE_DLL)
-
-$(CDE_DLL): $(CDE_OBJ)
- ld -o $@ $(CDE_OBJ) $(CDE_LIB)
-
-
-clean:
- rm -f *.o *.so
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak
deleted file mode 100644
index 61b67a33b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak
+++ /dev/null
@@ -1,84 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for creating SWT libraries on Linux
-
-include make_common.mak
-
-SWT_VERSION=$(maj_ver)$(min_ver)
-
-
-# Define the installation directories for various products.
-# IVE_HOME - IBM's version of Java (J9)
-# MOTIF_HOME - Motif includes and libraries
-# QT_HOME - identifier namespace package (used by KDE)
-IVE_HOME = /bluebird/teamswt/swt-builddir/ive/bin
-MOTIF_HOME = /bluebird/teamswt/swt-builddir/motif21
-QT_HOME = /usr/lib/qt-2.3.0
-
-
-# Define the various DLL (shared) libraries to be made.
-
-SWT_PREFIX = swt
-WS_PREFIX = motif
-SWT_DLL = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-SWT_OBJ = callback.o structs.o swt.o
-SWT_LIB = -L$(MOTIF_HOME)/lib -lXm -L/usr/lib -L/usr/X11R6/lib \
- -rpath . -x -shared -lX11 -lm -lXext -lXt -lXp -ldl
-
-GNOME_PREFIX = swt-gnome
-GNOME_DLL = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-GNOME_OBJ = gnome.o
-GNOME_LIB = -x -shared \
- `gnome-config --libs gnome`
-
-KDE_PREFIX = swt-kde
-KDE_DLL = lib$(KDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-KDE_OBJ = kde.o
-KDE_LIB = -L/usr/lib -L$(QT_HOME)/lib \
- -shared -lksycoca -lkdecore -lqt
-
-#
-# The following CFLAGS are for compiling both the SWT library and the GNOME
-# library. The KDE library uses its own (C++) flags.
-#
-CFLAGS = -O -s \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DLINUX -DMOTIF -DGNOME \
- -fpic \
- -I./ \
- -I$(IVE_HOME)/include \
- -I$(MOTIF_HOME)/include \
- -I/usr/X11R6/include \
- `gnome-config --cflags gnome gnomeui`
-
-
-all: make_swt make_gnome
-
-kde: make_kde
-
-
-make_swt: $(SWT_DLL)
-
-$(SWT_DLL): $(SWT_OBJ)
- ld -o $@ $(SWT_OBJ) $(SWT_LIB)
-
-
-make_gnome: $(GNOME_DLL)
-
-$(GNOME_DLL): $(GNOME_OBJ)
- ld -o $@ $(GNOME_OBJ) $(GNOME_LIB)
-
-
-make_kde: $(KDE_DLL)
-
-$(KDE_DLL): $(KDE_OBJ)
- ld -o $@ $(KDE_OBJ) $(KDE_LIB)
-
-$(KDE_OBJ): kde.cc
- g++ -c -O -I/usr/include/kde -I$(QT_HOME)/include -I./ \
- -I../ -I$(IVE_HOME)/include -fno-rtti -o kde.o kde.cc
-
-clean:
- rm -f *.so *.o
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_solaris.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_solaris.mak
deleted file mode 100644
index b72187e8bd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_solaris.mak
+++ /dev/null
@@ -1,70 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for SWT libraries on Solaris
-
-include make_common.mak
-
-SWT_VERSION=$(maj_ver)$(min_ver)
-
-
-# Define the installation directories for various products.
-# JAVA_HOME - Sun's version of Java (JDK2)
-# MOTIF_HOME - Motif includes and libraries
-# CDE_HOME - CDE includes and libraries
-JAVA_HOME = /tools/java1.3
-MOTIF_HOME = /usr/dt
-CDE_HOME = /usr/dt
-
-
-# Define the various DLL (shared) libraries to be made.
-
-SWT_PREFIX = swt
-WS_PREFIX = motif
-SWT_DLL = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-SWT_OBJ = callback.o structs.o swt.o
-SWT_LIB = -L$(MOTIF_HOME)/lib -L/usr/lib \
- -G -lXm -lXt -lX11 -lm
-
-CDE_PREFIX = swt-cde
-CDE_DLL = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-CDE_OBJ = cde.o
-CDE_LIB = -G -L$(CDE_HOME)/lib -lDtSvc
-
-
-#
-# The following CFLAGS are for compiling both the SWT library and the CDE
-# library.
-#
-# Note:
-# The flag -xarch=generic ensure the compiled modules will be targeted
-# for 32-bit architectures. If this flag is not
-#
-CFLAGS = -O -s \
- -xarch=generic \
- -DSWT_VERSION=$(SWT_VERSION) \
- -DSOLARIS -DMOTIF -DCDE \
- -KPIC \
- -I./ \
- -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/solaris \
- -I$(MOTIF_HOME)/include \
- -I$(CDE_HOME)/include
-
-
-all: make_swt make_cde
-
-make_swt: $(SWT_DLL)
-
-$(SWT_DLL): $(SWT_OBJ)
- ld -o $@ $(SWT_OBJ) $(SWT_LIB)
-
-
-make_cde: $(CDE_DLL)
-
-$(CDE_DLL): $(CDE_OBJ)
- ld -o $@ $(CDE_OBJ) $(CDE_LIB)
-
-
-clean:
- rm -f *.so *.o
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.c
deleted file mode 100644
index 1b918b0e4b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.c
+++ /dev/null
@@ -1,1396 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Motif structs.
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Globals */
-VISUAL_FID_CACHE VisualFc;
-XANYEVENT_FID_CACHE XanyeventFc;
-XBUTTONEVENT_FID_CACHE XbuttoneventFc;
-XCHARSTRUCT_FID_CACHE XcharstructFc;
-XCOLOR_FID_CACHE XcolorFc;
-XCONFIGUREEVENT_FID_CACHE XconfigureeventFc;
-XCROSSINGEVENT_FID_CACHE XcrossingeventFc;
-XEXPOSEEVENT_FID_CACHE XexposeeventFc;
-XFOCUSCHANGEEVENT_FID_CACHE XfocuschangeeventFc;
-XFONTSTRUCT_FID_CACHE XfontstructFc;
-XGCVALUES_FID_CACHE XgcvaluesFc;
-XIMAGE_FID_CACHE XimageFc;
-XKEYEVENT_FID_CACHE XkeyeventFc;
-XMANYCALLBACKSTRUCT_FID_CACHE XmanycallbackstructFc;
-XMDRAGPROCCALLBACK_FID_CACHE XmdragproccallbackFc;
-XMDROPFINISHCALLBACK_FID_CACHE XmdropfinishcallbackFc;
-XMDROPPROCCALLBACK_FID_CACHE XmdropproccallbackFc;
-XMOTIONEVENT_FID_CACHE XmotioneventFc;
-XMTEXTBLOCKREC_FID_CACHE XmtextblockrecFc;
-XMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE XmtextverifycallbackstructFc;
-XRECTANGLE_FID_CACHE XrectangleFc;
-XSETWINDOWATTRIBUTES_FID_CACHE XsetwindowattributesFc;
-XTWIDGETGEOMETRY_FID_CACHE XtwidgetgeometryFc;
-XWINDOWATTRIBUTES_FID_CACHE XwindowattributesFc;
-XWINDOWCHANGES_FID_CACHE XwindowchangesFc;
-
-/* ----------- fid and class caches ----------- */
-/*
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-
-void cacheXimageFids(JNIEnv *env, jobject lpXimage, PXIMAGE_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->ximageClass = (*env)->GetObjectClass(env,lpXimage);
-
- lpCache->width = (*env)->GetFieldID(env,lpCache->ximageClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->ximageClass,"height","I");
- lpCache->xoffset = (*env)->GetFieldID(env,lpCache->ximageClass,"xoffset","I");
- lpCache->format = (*env)->GetFieldID(env,lpCache->ximageClass,"format","I");
- lpCache->data = (*env)->GetFieldID(env,lpCache->ximageClass,"data","I");
- lpCache->byte_order = (*env)->GetFieldID(env,lpCache->ximageClass,"byte_order","I");
- lpCache->bitmap_unit = (*env)->GetFieldID(env,lpCache->ximageClass,"bitmap_unit","I");
- lpCache->bitmap_bit_order = (*env)->GetFieldID(env,lpCache->ximageClass,"bitmap_bit_order","I");
- lpCache->bitmap_pad = (*env)->GetFieldID(env,lpCache->ximageClass,"bitmap_pad","I");
- lpCache->depth = (*env)->GetFieldID(env,lpCache->ximageClass,"depth","I");
- lpCache->bytes_per_line = (*env)->GetFieldID(env,lpCache->ximageClass,"bytes_per_line","I");
- lpCache->bits_per_pixel = (*env)->GetFieldID(env,lpCache->ximageClass,"bits_per_pixel","I");
- lpCache->red_mask = (*env)->GetFieldID(env,lpCache->ximageClass,"red_mask","I");
- lpCache->green_mask = (*env)->GetFieldID(env,lpCache->ximageClass,"green_mask","I");
- lpCache->blue_mask = (*env)->GetFieldID(env,lpCache->ximageClass,"blue_mask","I");
- lpCache->obdata = (*env)->GetFieldID(env,lpCache->ximageClass,"obdata","I");
- lpCache->create_image = (*env)->GetFieldID(env,lpCache->ximageClass,"create_image","I");
- lpCache->destroy_image = (*env)->GetFieldID(env,lpCache->ximageClass,"destroy_image","I");
- lpCache->get_pixel = (*env)->GetFieldID(env,lpCache->ximageClass,"get_pixel","I");
- lpCache->put_pixel = (*env)->GetFieldID(env,lpCache->ximageClass,"put_pixel","I");
- lpCache->sub_image = (*env)->GetFieldID(env,lpCache->ximageClass,"sub_image","I");
- lpCache->add_pixel = (*env)->GetFieldID(env,lpCache->ximageClass,"add_pixel","I");
- lpCache->cached = 1;
-}
-
-void cacheVisualFids(JNIEnv *env, jobject lpVisual, PVISUAL_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->visualClass = (*env)->GetObjectClass(env,lpVisual);
-
- lpCache->ext_data = (*env)->GetFieldID(env,lpCache->visualClass,"ext_data","I");
- lpCache->visualid = (*env)->GetFieldID(env,lpCache->visualClass,"visualid","I");
- lpCache->c_class = (*env)->GetFieldID(env,lpCache->visualClass,"c_class","I");
- lpCache->red_mask = (*env)->GetFieldID(env,lpCache->visualClass,"red_mask","I");
- lpCache->green_mask = (*env)->GetFieldID(env,lpCache->visualClass,"green_mask","I");
- lpCache->blue_mask = (*env)->GetFieldID(env,lpCache->visualClass,"blue_mask","I");
- lpCache->bits_per_rgb = (*env)->GetFieldID(env,lpCache->visualClass,"bits_per_rgb","I");
- lpCache->map_entries = (*env)->GetFieldID(env,lpCache->visualClass,"map_entries","I");
- lpCache->cached = 1;
-}
-
-void cacheXanyeventFids(JNIEnv *env, jobject lpXevent, PXANYEVENT_FID_CACHE lpCache)
-{
- int i;
-
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- for (i=0; i<19; i++) {
- char buffer [8];
- sprintf(buffer, "pad%d", i);
- lpCache->pad[i] = (*env)->GetFieldID(env,lpCache->xeventClass,buffer,"I");
- }
- lpCache->cached = 1;
-}
-
-void cacheXbuttoneventFids(JNIEnv *env, jobject lpXevent, PXBUTTONEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->root = (*env)->GetFieldID(env,lpCache->xeventClass,"root","I");
- lpCache->subwindow = (*env)->GetFieldID(env,lpCache->xeventClass,"subwindow","I");
- lpCache->time = (*env)->GetFieldID(env,lpCache->xeventClass,"time","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xeventClass,"y","I");
- lpCache->x_root = (*env)->GetFieldID(env,lpCache->xeventClass,"x_root","I");
- lpCache->y_root = (*env)->GetFieldID(env,lpCache->xeventClass,"y_root","I");
- lpCache->state = (*env)->GetFieldID(env,lpCache->xeventClass,"state","I");
- lpCache->button = (*env)->GetFieldID(env,lpCache->xeventClass,"button","I");
- lpCache->same_screen = (*env)->GetFieldID(env,lpCache->xeventClass,"same_screen","I");
- lpCache->cached = 1;
-}
-
-void cacheXcharstructFids(JNIEnv *env, jobject lpXcharstruct, PXCHARSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xcharstructClass = (*env)->GetObjectClass(env,lpXcharstruct);
-
- lpCache->lbearing = (*env)->GetFieldID(env,lpCache->xcharstructClass,"lbearing","S");
- lpCache->rbearing = (*env)->GetFieldID(env,lpCache->xcharstructClass,"rbearing","S");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xcharstructClass,"width","S");
- lpCache->ascent = (*env)->GetFieldID(env,lpCache->xcharstructClass,"ascent","S");
- lpCache->descent = (*env)->GetFieldID(env,lpCache->xcharstructClass,"descent","S");
- lpCache->attributes = (*env)->GetFieldID(env,lpCache->xcharstructClass,"attributes","S");
- lpCache->cached = 1;
-}
-
-void cacheXconfigureeventFids(JNIEnv *env, jobject lpXevent, PXCONFIGUREEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xeventClass,"y","I");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xeventClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xeventClass,"height","I");
- lpCache->border_width = (*env)->GetFieldID(env,lpCache->xeventClass,"border_width","I");
- lpCache->above = (*env)->GetFieldID(env,lpCache->xeventClass,"above","I");
- lpCache->override_redirect = (*env)->GetFieldID(env,lpCache->xeventClass,"override_redirect","I");
- lpCache->cached = 1;
-}
-
-void cacheXcrossingeventFids(JNIEnv *env, jobject lpXcrossingevent, PXCROSSINGEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xcrossingeventClass = (*env)->GetObjectClass(env,lpXcrossingevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"window","I");
- lpCache->root = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"root","I");
- lpCache->subwindow = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"subwindow","I");
- lpCache->time = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"time","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"y","I");
- lpCache->x_root = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"x_root","I");
- lpCache->y_root = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"y_root","I");
- lpCache->mode = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"mode","I");
- lpCache->detail = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"detail","I");
- lpCache->same_screen = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"same_screen","I");
- lpCache->focus = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"focus","I");
- lpCache->state = (*env)->GetFieldID(env,lpCache->xcrossingeventClass,"state","I");
- lpCache->cached = 1;
-}
-
-void cacheXexposeeventFids(JNIEnv *env, jobject lpXevent, PXEXPOSEEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xeventClass,"y","I");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xeventClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xeventClass,"height","I");
- lpCache->count = (*env)->GetFieldID(env,lpCache->xeventClass,"count","I");
- lpCache->cached = 1;
-}
-
-void cacheXfocuschangeeventFids(JNIEnv *env, jobject lpXevent, PXFOCUSCHANGEEVENT_FID_CACHE lpCache)
-{
- int i;
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->mode = (*env)->GetFieldID(env,lpCache->xeventClass,"mode","I");
- lpCache->detail = (*env)->GetFieldID(env,lpCache->xeventClass,"detail","I");
- for (i=0; i<17; i++) {
- char buffer [8];
- sprintf(buffer, "pad%d", i);
- lpCache->pad[i] = (*env)->GetFieldID(env,lpCache->xeventClass,buffer,"I");
- }
- lpCache->cached = 1;
-}
-
-void cacheXfontstructFids(JNIEnv *env, jobject lpXfontstruct, PXFONTSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xfontstructClass = (*env)->GetObjectClass(env,lpXfontstruct);
-
- lpCache->ext_data = (*env)->GetFieldID(env,lpCache->xfontstructClass,"ext_data","I");
- lpCache->fid = (*env)->GetFieldID(env,lpCache->xfontstructClass,"fid","I");
- lpCache->direction = (*env)->GetFieldID(env,lpCache->xfontstructClass,"direction","I");
- lpCache->min_char_or_byte2 = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_char_or_byte2","I");
- lpCache->max_char_or_byte2 = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_char_or_byte2","I");
- lpCache->min_byte1 = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_byte1","I");
- lpCache->max_byte1 = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_byte1","I");
- lpCache->all_chars_exist = (*env)->GetFieldID(env,lpCache->xfontstructClass,"all_chars_exist","I");
- lpCache->default_char = (*env)->GetFieldID(env,lpCache->xfontstructClass,"default_char","I");
- lpCache->n_properties = (*env)->GetFieldID(env,lpCache->xfontstructClass,"n_properties","I");
- lpCache->properties = (*env)->GetFieldID(env,lpCache->xfontstructClass,"properties","I");
- lpCache->min_bounds_lbearing = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_lbearing","S");
- lpCache->min_bounds_rbearing = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_rbearing","S");
- lpCache->min_bounds_width = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_width","S");
- lpCache->min_bounds_ascent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_ascent","S");
- lpCache->min_bounds_descent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_descent","S");
- lpCache->min_bounds_attributes = (*env)->GetFieldID(env,lpCache->xfontstructClass,"min_bounds_attributes","S");
- lpCache->max_bounds_lbearing = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_lbearing","S");
- lpCache->max_bounds_rbearing = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_rbearing","S");
- lpCache->max_bounds_width = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_width","S");
- lpCache->max_bounds_ascent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_ascent","S");
- lpCache->max_bounds_descent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_descent","S");
- lpCache->max_bounds_attributes = (*env)->GetFieldID(env,lpCache->xfontstructClass,"max_bounds_attributes","S");
- lpCache->per_char = (*env)->GetFieldID(env,lpCache->xfontstructClass,"per_char","I");
- lpCache->ascent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"ascent","I");
- lpCache->descent = (*env)->GetFieldID(env,lpCache->xfontstructClass,"descent","I");
- lpCache->cached = 1;
-}
-
-void cacheXkeyeventFids(JNIEnv *env, jobject lpXevent, PXKEYEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->root = (*env)->GetFieldID(env,lpCache->xeventClass,"root","I");
- lpCache->subwindow = (*env)->GetFieldID(env,lpCache->xeventClass,"subwindow","I");
- lpCache->time = (*env)->GetFieldID(env,lpCache->xeventClass,"time","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xeventClass,"y","I");
- lpCache->x_root = (*env)->GetFieldID(env,lpCache->xeventClass,"x_root","I");
- lpCache->y_root = (*env)->GetFieldID(env,lpCache->xeventClass,"y_root","I");
- lpCache->state = (*env)->GetFieldID(env,lpCache->xeventClass,"state","I");
- lpCache->keycode = (*env)->GetFieldID(env,lpCache->xeventClass,"keycode","I");
- lpCache->same_screen = (*env)->GetFieldID(env,lpCache->xeventClass,"same_screen","I");
- lpCache->cached = 1;
-}
-
-void cacheXmotioneventFids(JNIEnv *env, jobject lpXevent, PXMOTIONEVENT_FID_CACHE lpCache)
-{
- int i;
- if (lpCache->cached) return;
-
- lpCache->xeventClass = (*env)->GetObjectClass(env,lpXevent);
-
- lpCache->type = (*env)->GetFieldID(env,lpCache->xeventClass,"type","I");
- lpCache->serial = (*env)->GetFieldID(env,lpCache->xeventClass,"serial","I");
- lpCache->send_event = (*env)->GetFieldID(env,lpCache->xeventClass,"send_event","I");
- lpCache->display = (*env)->GetFieldID(env,lpCache->xeventClass,"display","I");
- lpCache->window = (*env)->GetFieldID(env,lpCache->xeventClass,"window","I");
- lpCache->root = (*env)->GetFieldID(env,lpCache->xeventClass,"root","I");
- lpCache->subwindow = (*env)->GetFieldID(env,lpCache->xeventClass,"subwindow","I");
- lpCache->time = (*env)->GetFieldID(env,lpCache->xeventClass,"time","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xeventClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xeventClass,"y","I");
- lpCache->x_root = (*env)->GetFieldID(env,lpCache->xeventClass,"x_root","I");
- lpCache->y_root = (*env)->GetFieldID(env,lpCache->xeventClass,"y_root","I");
- lpCache->state = (*env)->GetFieldID(env,lpCache->xeventClass,"state","I");
- lpCache->is_hint = (*env)->GetFieldID(env,lpCache->xeventClass,"is_hint","I");
- lpCache->same_screen = (*env)->GetFieldID(env,lpCache->xeventClass,"same_screen","I");
- for (i=0; i<10; i++) {
- char buffer [8];
- sprintf(buffer, "pad%d", i);
- lpCache->pad[i] = (*env)->GetFieldID(env,lpCache->xeventClass,buffer,"I");
- }
- lpCache->cached = 1;
-}
-
-void cacheXcolorFids(JNIEnv *env, jobject lpXcolor, PXCOLOR_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xcolorClass = (*env)->GetObjectClass(env,lpXcolor);
-
- lpCache->pixel = (*env)->GetFieldID(env,lpCache->xcolorClass,"pixel","I");
- lpCache->red = (*env)->GetFieldID(env,lpCache->xcolorClass,"red","S");
- lpCache->green = (*env)->GetFieldID(env,lpCache->xcolorClass,"green","S");
- lpCache->blue = (*env)->GetFieldID(env,lpCache->xcolorClass,"blue","S");
- lpCache->flags = (*env)->GetFieldID(env,lpCache->xcolorClass,"flags","B");
- lpCache->pad = (*env)->GetFieldID(env,lpCache->xcolorClass,"pad","B");
- lpCache->cached = 1;
-}
-
-void cacheXgcvaluesFids(JNIEnv *env, jobject lpXgcvalues, PXGCVALUES_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xgcvaluesClass = (*env)->GetObjectClass(env,lpXgcvalues);
-
- lpCache->function = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"function","I");
- lpCache->plane_mask = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"plane_mask","I");
- lpCache->foreground = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"foreground","I");
- lpCache->background = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"background","I");
- lpCache->line_width = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"line_width","I");
- lpCache->line_style = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"line_style","I");
- lpCache->cap_style = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"cap_style","I");
- lpCache->join_style = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"join_style","I");
- lpCache->fill_style = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"fill_style","I");
- lpCache->fill_rule = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"fill_rule","I");
- lpCache->arc_mode = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"arc_mode","I");
- lpCache->tile = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"tile","I");
- lpCache->stipple = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"stipple","I");
- lpCache->ts_x_origin = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"ts_x_origin","I");
- lpCache->ts_y_origin = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"ts_y_origin","I");
- lpCache->font = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"font","I");
- lpCache->subwindow_mode = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"subwindow_mode","I");
- lpCache->graphics_exposures = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"graphics_exposures","I");
- lpCache->clip_x_origin = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"clip_x_origin","I");
- lpCache->clip_y_origin = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"clip_y_origin","I");
- lpCache->clip_mask = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"clip_mask","I");
- lpCache->dash_offset = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"dash_offset","I");
-
- lpCache->dashes = (*env)->GetFieldID(env,lpCache->xgcvaluesClass,"dashes","B");
- lpCache->cached = 1;
-}
-
-void cacheXmanycallbackstructFids(JNIEnv *env, jobject lpXmanycallback, PXMANYCALLBACKSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmanycallbackstructClass = (*env)->GetObjectClass(env,lpXmanycallback);
-
- lpCache->reason = (*env)->GetFieldID(env,lpCache->xmanycallbackstructClass,"reason","I");
- lpCache->event = (*env)->GetFieldID(env,lpCache->xmanycallbackstructClass,"event","I");
- lpCache->cached = 1;
-}
-
-void cacheXmdragproccallbackFids(JNIEnv *env, jobject lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmdragproccallbackClass = (*env)->GetObjectClass(env,lpXmdragproccallback);
-
- lpCache->reason = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"reason","I");
- lpCache->event = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"event","I");
- lpCache->timeStamp = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"timeStamp","I");
- lpCache->dragContext = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"dragContext","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"x","S");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"y","S");
- lpCache->dropSiteStatus = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"dropSiteStatus","B");
- lpCache->operation = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"operation","B");
- lpCache->operations = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"operations","B");
- lpCache->animate = (*env)->GetFieldID(env,lpCache->xmdragproccallbackClass,"animate","B");
- lpCache->cached = 1;
-}
-
-void cacheXmdropproccallbackFids(JNIEnv *env, jobject lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmdropproccallbackClass = (*env)->GetObjectClass(env,lpXmdropproccallback);
-
- lpCache->reason = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"reason","I");
- lpCache->event = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"event","I");
- lpCache->timeStamp = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"timeStamp","I");
- lpCache->dragContext = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"dragContext","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"x","S");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"y","S");
- lpCache->dropSiteStatus = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"dropSiteStatus","B");
- lpCache->operation = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"operation","B");
- lpCache->operations = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"operations","B");
- lpCache->dropAction = (*env)->GetFieldID(env,lpCache->xmdropproccallbackClass,"dropAction","B");
- lpCache->cached = 1;
-}
-
-void cacheXmdropfinishcallbackFids(JNIEnv *env, jobject lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmdropfinishcallbackClass = (*env)->GetObjectClass(env,lpXmdropfinishcallback);
-
- lpCache->reason = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"reason","I");
- lpCache->event = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"event","I");
- lpCache->timeStamp = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"timeStamp","I");
- lpCache->operation = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"operation","B");
- lpCache->operations = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"operations","B");
- lpCache->dropSiteStatus = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"dropSiteStatus","B");
- lpCache->dropAction = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"dropAction","B");
- lpCache->completionStatus = (*env)->GetFieldID(env,lpCache->xmdropfinishcallbackClass,"completionStatus","B");
- lpCache->cached = 1;
-}
-
-void cacheXmtextblockrecFids(JNIEnv *env, jobject lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmtextblockrecClass = (*env)->GetObjectClass(env,lpXmtextblockrec);
-
- lpCache->ptr = (*env)->GetFieldID(env,lpCache->xmtextblockrecClass,"ptr","I");
- lpCache->length = (*env)->GetFieldID(env,lpCache->xmtextblockrecClass,"length","I");
- lpCache->format = (*env)->GetFieldID(env,lpCache->xmtextblockrecClass,"format","I");
- lpCache->cached = 1;
-}
-
-void cacheXmtextverifycallbackstructFids(JNIEnv *env, jobject lpXmtextverifycallback, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xmtextverifycallbackstructClass = (*env)->GetObjectClass(env,lpXmtextverifycallback);
-
- lpCache->reason = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"reason","I");
- lpCache->event = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"event","I");
- lpCache->doit = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"doit","B");
- lpCache->currInsert = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"currInsert","I");
- lpCache->newInsert = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"newInsert","I");
- lpCache->startPos = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"startPos","I");
- lpCache->endPos = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"endPos","I");
- lpCache->text = (*env)->GetFieldID(env,lpCache->xmtextverifycallbackstructClass,"text","I");
- lpCache->cached = 1;
-}
-
-void cacheXrectangleFids(JNIEnv *env, jobject lpXrect, PXRECTANGLE_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xrectClass = (*env)->GetObjectClass(env,lpXrect);
-
- lpCache->x = (*env)->GetFieldID(env,lpCache->xrectClass,"x","S");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xrectClass,"y","S");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xrectClass,"width","S");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xrectClass,"height","S");
- lpCache->cached = 1;
-}
-
-void cacheXsetwindowattributesFids(JNIEnv *env, jobject lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xsetwindowattributesClass = (*env)->GetObjectClass(env,lpXsetwindowattributes);
-
- lpCache->background_pixmap = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"background_pixmap","I");
- lpCache->background_pixel = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"background_pixel","I");
- lpCache->border_pixmap = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"border_pixmap","I");
- lpCache->border_pixel = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"border_pixel","I");
- lpCache->bit_gravity = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"bit_gravity","I");
- lpCache->win_gravity = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"win_gravity","I");
- lpCache->backing_store = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"backing_store","I");
- lpCache->backing_planes = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"backing_planes","I");
- lpCache->backing_pixel = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"backing_pixel","I");
- lpCache->save_under = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"save_under","I");
- lpCache->event_mask = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"event_mask","I");
- lpCache->do_not_propagate_mask = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"do_not_propagate_mask","I");
- lpCache->override_redirect = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"override_redirect","I");
- lpCache->colormap = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"colormap","I");
- lpCache->cursor = (*env)->GetFieldID(env,lpCache->xsetwindowattributesClass,"cursor","I");
- lpCache->cached = 1;
-}
-
-void cacheXwindowattributesFids(JNIEnv *env, jobject lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xwindowattributesClass = (*env)->GetObjectClass(env,lpXwindowattributes);
-
- lpCache->x = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"y","I");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"height","I");
- lpCache->border_width = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"border_width","I");
- lpCache->depth = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"depth","I");
- lpCache->visual = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"visual","I");
- lpCache->root = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"root","I");
- lpCache->class = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"c_class","I");
- lpCache->bit_gravity = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"bit_gravity","I");
- lpCache->win_gravity = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"win_gravity","I");
- lpCache->backing_store = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"backing_store","I");
- lpCache->backing_planes = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"backing_planes","I");
- lpCache->backing_pixel = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"backing_pixel","I");
- lpCache->save_under = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"save_under","I");
- lpCache->colormap = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"colormap","I");
- lpCache->map_installed = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"map_installed","I");
- lpCache->map_state = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"map_state","I");
- lpCache->all_event_masks = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"all_event_masks","I");
- lpCache->your_event_mask = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"your_event_mask","I");
- lpCache->do_not_propagate_mask = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"do_not_propagate_mask","I");
- lpCache->override_redirect = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"override_redirect","I");
- lpCache->screen = (*env)->GetFieldID(env,lpCache->xwindowattributesClass,"screen","I");
- lpCache->cached = 1;
-}
-
-void cacheXwindowchangesFids(JNIEnv *env, jobject lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xwindowchangesClass = (*env)->GetObjectClass(env,lpXwindowchanges);
-
- lpCache->x = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"y","I");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"height","I");
- lpCache->border_width = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"border_width","I");
- lpCache->sibling = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"sibling","I");
- lpCache->stack_mode = (*env)->GetFieldID(env,lpCache->xwindowchangesClass,"stack_mode","I");
- lpCache->cached = 1;
-}
-
-void cacheXtwidgetgeometryFids(JNIEnv *env, jobject lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
-
- lpCache->xtwidgetgeometryClass = (*env)->GetObjectClass(env,lpXtwidgetgeometry);
-
- lpCache->request_mode = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"request_mode","I");
- lpCache->x = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"x","I");
- lpCache->y = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"y","I");
- lpCache->width = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"width","I");
- lpCache->height = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"height","I");
- lpCache->border_width = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"border_width","I");
- lpCache->sibling = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"sibling","I");
- lpCache->stack_mode = (*env)->GetFieldID(env,lpCache->xtwidgetgeometryClass,"stack_mode","I");
- lpCache->cached = 1;
-}
-
-/* ----------- getters and setters ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- */
-
-void getVisualFields(JNIEnv *env, jobject lpObject, Visual *lpVisual, VISUAL_FID_CACHE *lpVisualFc)
-{
- lpVisual->ext_data = (XExtData *)(*env)->GetIntField(env,lpObject,lpVisualFc->ext_data);
- lpVisual->visualid = (*env)->GetIntField(env,lpObject,lpVisualFc->visualid);
- lpVisual->class = (*env)->GetIntField(env,lpObject,lpVisualFc->c_class);
- lpVisual->red_mask = (*env)->GetIntField(env,lpObject,lpVisualFc->red_mask);
- lpVisual->green_mask = (*env)->GetIntField(env,lpObject,lpVisualFc->green_mask);
- lpVisual->blue_mask = (*env)->GetIntField(env,lpObject,lpVisualFc->blue_mask);
- lpVisual->bits_per_rgb = (*env)->GetIntField(env,lpObject,lpVisualFc->bits_per_rgb);
- lpVisual->map_entries = (*env)->GetIntField(env,lpObject,lpVisualFc->map_entries);
-}
-
-void setVisualFields(JNIEnv *env, jobject lpObject, Visual *lpVisual, VISUAL_FID_CACHE *lpVisualFc)
-{
- (*env)->SetIntField(env,lpObject,lpVisualFc->ext_data, (jint)lpVisual->ext_data);
- (*env)->SetIntField(env,lpObject,lpVisualFc->visualid, lpVisual->visualid);
- (*env)->SetIntField(env,lpObject,lpVisualFc->c_class, lpVisual->class);
- (*env)->SetIntField(env,lpObject,lpVisualFc->red_mask, (int)lpVisual->red_mask);
- (*env)->SetIntField(env,lpObject,lpVisualFc->green_mask, lpVisual->green_mask);
- (*env)->SetIntField(env,lpObject,lpVisualFc->blue_mask, lpVisual->blue_mask);
- (*env)->SetIntField(env,lpObject,lpVisualFc->bits_per_rgb, (int)lpVisual->bits_per_rgb);
- (*env)->SetIntField(env,lpObject,lpVisualFc->map_entries, lpVisual->map_entries);
-}
-
-void getXanyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XANYEVENT_FID_CACHE *lpXanyeventFc)
-{
- int i;
-
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXanyeventFc->type);
- lpXevent->xany.serial = (*env)->GetIntField(env,lpObject,lpXanyeventFc->serial);
- lpXevent->xany.send_event = (*env)->GetIntField(env,lpObject,lpXanyeventFc->send_event);
- lpXevent->xany.display = (Display *)(*env)->GetIntField(env,lpObject,lpXanyeventFc->display);
- lpXevent->xany.window = (*env)->GetIntField(env,lpObject,lpXanyeventFc->window);
- for (i=0; i<19; i++) {
- lpXevent->pad[i+5] = (*env)->GetIntField(env,lpObject,lpXanyeventFc->pad[i]);
- }
-}
-
-void setXanyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XANYEVENT_FID_CACHE *lpXanyeventFc)
-{
- int i;
-
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->serial, lpXevent->xany.serial);
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->send_event, lpXevent->xany.send_event);
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->display, (int)lpXevent->xany.display);
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->window, lpXevent->xany.window);
- for (i=0; i<19; i++) {
- (*env)->SetIntField(env,lpObject,lpXanyeventFc->pad[i],lpXevent->pad[i+5]);
- }
-}
-
-void getXbuttoneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XBUTTONEVENT_FID_CACHE *lpXbuttoneventFc)
-{
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->type);
- lpXevent->xbutton.serial = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->serial);
- lpXevent->xbutton.send_event = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->send_event);
- lpXevent->xbutton.display = (Display *)(*env)->GetIntField(env,lpObject,lpXbuttoneventFc->display);
- lpXevent->xbutton.window = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->window);
- lpXevent->xbutton.root = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->root);
- lpXevent->xbutton.subwindow = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->subwindow);
- lpXevent->xbutton.time = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->time);
- lpXevent->xbutton.x = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->x);
- lpXevent->xbutton.y = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->y);
- lpXevent->xbutton.x_root = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->x_root);
- lpXevent->xbutton.y_root = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->y_root);
- lpXevent->xbutton.state = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->state);
- lpXevent->xbutton.button = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->button);
- lpXevent->xbutton.same_screen = (*env)->GetIntField(env,lpObject,lpXbuttoneventFc->same_screen);
-}
-
-void setXbuttoneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XBUTTONEVENT_FID_CACHE *lpXbuttoneventFc)
-{
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->serial, lpXevent->xbutton.serial);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->send_event, lpXevent->xbutton.send_event);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->display, (int)lpXevent->xbutton.display);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->window, lpXevent->xbutton.window);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->root, lpXevent->xbutton.root);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->subwindow, lpXevent->xbutton.subwindow);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->time, lpXevent->xbutton.time);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->x, lpXevent->xbutton.x);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->y, lpXevent->xbutton.y);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->x_root, lpXevent->xbutton.x_root);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->y_root, lpXevent->xbutton.y_root);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->state, lpXevent->xbutton.state);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->button, lpXevent->xbutton.button);
- (*env)->SetIntField(env,lpObject,lpXbuttoneventFc->same_screen, lpXevent->xbutton.same_screen);
-}
-
-void getXconfigureeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XCONFIGUREEVENT_FID_CACHE *lpXconfigureeventFc)
-{
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->type);
- lpXevent->xconfigure.serial = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->serial);
- lpXevent->xconfigure.send_event = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->send_event);
- lpXevent->xconfigure.display = (Display *)(*env)->GetIntField(env,lpObject,lpXconfigureeventFc->display);
- lpXevent->xconfigure.window = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->window);
- lpXevent->xconfigure.x = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->x);
- lpXevent->xconfigure.y = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->y);
- lpXevent->xconfigure.width = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->width);
- lpXevent->xconfigure.height = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->height);
- lpXevent->xconfigure.border_width = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->border_width);
- lpXevent->xconfigure.above = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->above);
- lpXevent->xconfigure.override_redirect = (*env)->GetIntField(env,lpObject,lpXconfigureeventFc->override_redirect);
-}
-
-void setXconfigureeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XCONFIGUREEVENT_FID_CACHE *lpXconfigureeventFc)
-{
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->serial, lpXevent->xconfigure.serial);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->send_event, lpXevent->xconfigure.send_event);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->display, (int)lpXevent->xconfigure.display);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->window, lpXevent->xconfigure.window);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->x, lpXevent->xconfigure.x);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->y, lpXevent->xconfigure.y);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->width, lpXevent->xconfigure.width);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->height, lpXevent->xconfigure.height);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->border_width, lpXevent->xconfigure.border_width);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->above, lpXevent->xconfigure.above);
- (*env)->SetIntField(env,lpObject,lpXconfigureeventFc->override_redirect, lpXevent->xconfigure.override_redirect);
-}
-
-void getXcharstructFields(JNIEnv *env, jobject lpObject, XCharStruct *lpXcharstruct, XCHARSTRUCT_FID_CACHE *lpXcharstructFc)
-{
- lpXcharstruct->lbearing = (*env)->GetShortField(env,lpObject,lpXcharstructFc->lbearing);
- lpXcharstruct->rbearing = (*env)->GetShortField(env,lpObject,lpXcharstructFc->rbearing);
- lpXcharstruct->width = (*env)->GetShortField(env,lpObject,lpXcharstructFc->width);
- lpXcharstruct->ascent = (*env)->GetShortField(env,lpObject,lpXcharstructFc->ascent);
- lpXcharstruct->descent = (*env)->GetShortField(env,lpObject,lpXcharstructFc->descent);
- lpXcharstruct->attributes = (*env)->GetShortField(env,lpObject,lpXcharstructFc->attributes);
-}
-
-void setXcharstructFields(JNIEnv *env, jobject lpObject, XCharStruct *lpXcharstruct, XCHARSTRUCT_FID_CACHE *lpXcharstructFc)
-{
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->lbearing, lpXcharstruct->lbearing);
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->rbearing, lpXcharstruct->rbearing);
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->width, lpXcharstruct->width);
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->ascent, lpXcharstruct->ascent);
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->descent, lpXcharstruct->descent);
- (*env)->SetShortField(env,lpObject,lpXcharstructFc->attributes, lpXcharstruct->attributes);
-
-}
-
-void getXcrossingeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXcrossingevent, XCROSSINGEVENT_FID_CACHE *lpXcrossingeventFc)
-{
- int i;
-
- lpXcrossingevent->type = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->type);
- lpXcrossingevent->xcrossing.serial = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->serial);
- lpXcrossingevent->xcrossing.send_event = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->send_event);
- lpXcrossingevent->xcrossing.display = (Display *)(*env)->GetIntField(env,lpObject,lpXcrossingeventFc->display);
- lpXcrossingevent->xcrossing.window = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->window);
- lpXcrossingevent->xcrossing.root = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->root);
- lpXcrossingevent->xcrossing.subwindow = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->subwindow);
- lpXcrossingevent->xcrossing.time = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->time);
- lpXcrossingevent->xcrossing.x = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->x);
- lpXcrossingevent->xcrossing.y = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->y);
- lpXcrossingevent->xcrossing.x_root = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->x_root);
- lpXcrossingevent->xcrossing.y_root = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->y_root);
- lpXcrossingevent->xcrossing.mode = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->mode);
- lpXcrossingevent->xcrossing.detail = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->detail);
- lpXcrossingevent->xcrossing.same_screen = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->same_screen);
- lpXcrossingevent->xcrossing.focus = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->focus);
- lpXcrossingevent->xcrossing.state = (*env)->GetIntField(env,lpObject,lpXcrossingeventFc->state);
-}
-
-void setXcrossingeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXcrossingevent, XCROSSINGEVENT_FID_CACHE *lpXcrossingeventFc)
-{
- int i;
-
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->type, lpXcrossingevent->type);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->serial, lpXcrossingevent->xcrossing.serial);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->send_event, lpXcrossingevent->xcrossing.send_event);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->display, (int)lpXcrossingevent->xcrossing.display);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->window, lpXcrossingevent->xcrossing.window);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->root, lpXcrossingevent->xcrossing.root);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->subwindow, lpXcrossingevent->xcrossing.subwindow);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->time, lpXcrossingevent->xcrossing.time);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->x, lpXcrossingevent->xcrossing.x);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->y, lpXcrossingevent->xcrossing.y);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->x_root, lpXcrossingevent->xcrossing.x_root);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->y_root, lpXcrossingevent->xcrossing.y_root);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->mode, lpXcrossingevent->xcrossing.mode);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->detail, lpXcrossingevent->xcrossing.detail);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->same_screen, lpXcrossingevent->xcrossing.same_screen);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->focus, lpXcrossingevent->xcrossing.focus);
- (*env)->SetIntField(env,lpObject,lpXcrossingeventFc->state, lpXcrossingevent->xcrossing.state);
-}
-
-void getXexposeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XEXPOSEEVENT_FID_CACHE *lpXexposeeventFc)
-{
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->type);
- lpXevent->xexpose.serial = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->serial);
- lpXevent->xexpose.send_event = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->send_event);
- lpXevent->xexpose.display = (Display *)(*env)->GetIntField(env,lpObject,lpXexposeeventFc->display);
- lpXevent->xexpose.window = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->window);
- lpXevent->xexpose.x = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->x);
- lpXevent->xexpose.y = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->y);
- lpXevent->xexpose.width = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->width);
- lpXevent->xexpose.height = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->height);
- lpXevent->xexpose.count = (*env)->GetIntField(env,lpObject,lpXexposeeventFc->count);
-}
-
-void setXexposeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XEXPOSEEVENT_FID_CACHE *lpXexposeeventFc)
-{
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->serial, lpXevent->xexpose.serial);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->send_event, lpXevent->xexpose.send_event);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->display, (int)lpXevent->xexpose.display);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->window, lpXevent->xexpose.window);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->x, lpXevent->xexpose.x);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->y, lpXevent->xexpose.y);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->width, lpXevent->xexpose.width);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->height, lpXevent->xexpose.height);
- (*env)->SetIntField(env,lpObject,lpXexposeeventFc->count, lpXevent->xexpose.count);
-}
-
-void getXfontstructFields(JNIEnv *env, jobject lpObject, XFontStruct *lpXfontstruct, XFONTSTRUCT_FID_CACHE *lpXfontstructFc)
-{
- lpXfontstruct->ext_data = (XExtData *)(*env)->GetIntField(env,lpObject,lpXfontstructFc->ext_data);
- lpXfontstruct->fid = (Font)(*env)->GetIntField(env,lpObject,lpXfontstructFc->fid);
- lpXfontstruct->direction = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->direction);
- lpXfontstruct->min_char_or_byte2 = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->min_char_or_byte2);
- lpXfontstruct->max_char_or_byte2 = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->max_char_or_byte2);
- lpXfontstruct->min_byte1 = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->min_byte1);
- lpXfontstruct->max_byte1 = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->max_byte1);
- lpXfontstruct->all_chars_exist = (Bool)(*env)->GetIntField(env,lpObject,lpXfontstructFc->all_chars_exist);
- lpXfontstruct->default_char = (unsigned)(*env)->GetIntField(env,lpObject,lpXfontstructFc->default_char);
- lpXfontstruct->n_properties = (*env)->GetIntField(env,lpObject,lpXfontstructFc->n_properties);
- lpXfontstruct->properties = (XFontProp *)(*env)->GetIntField(env,lpObject,lpXfontstructFc->properties);
- lpXfontstruct->min_bounds.lbearing = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing);
- lpXfontstruct->min_bounds.rbearing = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_rbearing);
- lpXfontstruct->min_bounds.width = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing);
- lpXfontstruct->min_bounds.ascent = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing);
- lpXfontstruct->min_bounds.descent = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing);
- lpXfontstruct->min_bounds.attributes = (*env)->GetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing);
- lpXfontstruct->max_bounds.lbearing = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_lbearing);
- lpXfontstruct->max_bounds.rbearing = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_rbearing);
- lpXfontstruct->max_bounds.width = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_width);
- lpXfontstruct->max_bounds.ascent = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_ascent);
- lpXfontstruct->max_bounds.descent = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_descent);
- lpXfontstruct->max_bounds.attributes = (*env)->GetShortField(env,lpObject,lpXfontstructFc->max_bounds_attributes);
- lpXfontstruct->per_char = (XCharStruct *)(*env)->GetIntField(env,lpObject,lpXfontstructFc->per_char);
- lpXfontstruct->ascent = (*env)->GetIntField(env,lpObject,lpXfontstructFc->ascent);
- lpXfontstruct->descent = (*env)->GetIntField(env,lpObject,lpXfontstructFc->descent);
-}
-
-void setXfontstructFields(JNIEnv *env, jobject lpObject, XFontStruct *lpXfontstruct, XFONTSTRUCT_FID_CACHE *lpXfontstructFc)
-{
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->ext_data, (jint)lpXfontstruct->ext_data);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->fid, (jint)lpXfontstruct->fid);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->direction, (jint)lpXfontstruct->direction);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->min_char_or_byte2, (jint)lpXfontstruct->min_char_or_byte2);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->max_char_or_byte2, (jint)lpXfontstruct->max_char_or_byte2);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->min_byte1, (jint)lpXfontstruct->min_byte1);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->max_byte1, (jint)lpXfontstruct->max_byte1);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->all_chars_exist, (jint)lpXfontstruct->all_chars_exist);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->default_char, (jint)lpXfontstruct->default_char);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->n_properties, (jint)lpXfontstruct->n_properties);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->properties, (jint)lpXfontstruct->properties);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_lbearing, (jint)lpXfontstruct->min_bounds.lbearing);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_rbearing, (jint)lpXfontstruct->min_bounds.rbearing);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_width, (jint)lpXfontstruct->min_bounds.width);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_ascent, (jint)lpXfontstruct->min_bounds.ascent);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_descent, (jint)lpXfontstruct->min_bounds.descent);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->min_bounds_attributes, (jint)lpXfontstruct->min_bounds.attributes);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_lbearing, (jint)lpXfontstruct->max_bounds.lbearing);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_rbearing, (jint)lpXfontstruct->max_bounds.rbearing);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_width, (jint)lpXfontstruct->max_bounds.width);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_ascent, (jint)lpXfontstruct->max_bounds.ascent);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_descent, (jint)lpXfontstruct->max_bounds.descent);
- (*env)->SetShortField(env,lpObject,lpXfontstructFc->max_bounds_attributes, (jint)lpXfontstruct->max_bounds.attributes);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->per_char, (jint)lpXfontstruct->per_char);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->ascent, (jint)lpXfontstruct->ascent);
- (*env)->SetIntField(env,lpObject,lpXfontstructFc->descent, (jint)lpXfontstruct->descent);
-}
-
-
-void getXfocuschangeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XFOCUSCHANGEEVENT_FID_CACHE *lpXfocuschangeeventFc)
-{
- int i;
-
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->type);
- lpXevent->xfocus.serial = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->serial);
- lpXevent->xfocus.send_event = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->send_event);
- lpXevent->xfocus.display = (Display *)(*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->display);
- lpXevent->xfocus.window = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->window);
- lpXevent->xfocus.mode = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->mode);
- lpXevent->xfocus.detail = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->detail);
- for (i=0; i<17; i++) {
- lpXevent->pad[i+7] = (*env)->GetIntField(env,lpObject,lpXfocuschangeeventFc->pad[i]);
- }
-}
-
-void setXfocuschangeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XFOCUSCHANGEEVENT_FID_CACHE *lpXfocuschangeeventFc)
-{
- int i;
-
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->serial, lpXevent->xfocus.serial);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->send_event, lpXevent->xfocus.send_event);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->display, (int)lpXevent->xfocus.display);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->window, lpXevent->xfocus.window);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->mode, lpXevent->xfocus.mode);
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->detail, lpXevent->xfocus.detail);
- for (i=0; i<17; i++) {
- (*env)->SetIntField(env,lpObject,lpXfocuschangeeventFc->pad[i],lpXevent->pad[i+7]);
- }
-}
-
-void getXimageFields(JNIEnv *env, jobject lpObject, XImage *lpXimage, XIMAGE_FID_CACHE *lpXimageFc)
-{
- lpXimage->width = (*env)->GetIntField(env,lpObject,lpXimageFc->width);
- lpXimage->height = (*env)->GetIntField(env,lpObject,lpXimageFc->height);
- lpXimage->xoffset = (*env)->GetIntField(env,lpObject,lpXimageFc->xoffset);
- lpXimage->format = (*env)->GetIntField(env,lpObject,lpXimageFc->format);
- lpXimage->data = (char *)(*env)->GetIntField(env,lpObject,lpXimageFc->data);
- lpXimage->byte_order = (*env)->GetIntField(env,lpObject,lpXimageFc->byte_order);
- lpXimage->bitmap_unit = (*env)->GetIntField(env,lpObject,lpXimageFc->bitmap_unit);
- lpXimage->bitmap_bit_order = (*env)->GetIntField(env,lpObject,lpXimageFc->bitmap_bit_order);
- lpXimage-> bitmap_pad= (*env)->GetIntField(env,lpObject,lpXimageFc->bitmap_pad);
- lpXimage->depth = (*env)->GetIntField(env,lpObject,lpXimageFc->depth);
- lpXimage->bytes_per_line = (*env)->GetIntField(env,lpObject,lpXimageFc->bytes_per_line);
- lpXimage->bits_per_pixel = (*env)->GetIntField(env,lpObject,lpXimageFc->bits_per_pixel);
- lpXimage->red_mask = (*env)->GetIntField(env,lpObject,lpXimageFc->red_mask);
- lpXimage->green_mask = (*env)->GetIntField(env,lpObject,lpXimageFc->green_mask);
- lpXimage->blue_mask = (*env)->GetIntField(env,lpObject,lpXimageFc->blue_mask);
- lpXimage->obdata = (char *)(*env)->GetIntField(env,lpObject,lpXimageFc->obdata);
- lpXimage->f.create_image = (struct _XImage *(*)())(*env)->GetIntField(env,lpObject,lpXimageFc->create_image);
- lpXimage->f.destroy_image = (int (*)(struct _XImage *))(*env)->GetIntField(env,lpObject,lpXimageFc->destroy_image);
- lpXimage->f.get_pixel = (unsigned long (*)(struct _XImage *, int, int))(*env)->GetIntField(env,lpObject,lpXimageFc->get_pixel);
- lpXimage->f.put_pixel = (int (*)(struct _XImage *, int, int, unsigned long))(*env)->GetIntField(env,lpObject,lpXimageFc->put_pixel);
- lpXimage->f.sub_image = (struct _XImage *(*)(struct _XImage *, int, int, unsigned int, unsigned int))(*env)->GetIntField(env,lpObject,lpXimageFc->sub_image);
- lpXimage->f.add_pixel = (int (*)(struct _XImage *, long))(*env)->GetIntField(env,lpObject,lpXimageFc->add_pixel);
-}
-
-void setXimageFields(JNIEnv *env, jobject lpObject, XImage *lpXimage, XIMAGE_FID_CACHE *lpXimageFc)
-{
- (*env)->SetIntField(env,lpObject,lpXimageFc->width, lpXimage->width);
- (*env)->SetIntField(env,lpObject,lpXimageFc->height, lpXimage->height);
- (*env)->SetIntField(env,lpObject,lpXimageFc->xoffset, lpXimage->xoffset);
- (*env)->SetIntField(env,lpObject,lpXimageFc->format, lpXimage->format);
- (*env)->SetIntField(env,lpObject,lpXimageFc->data, (jint)lpXimage->data);
- (*env)->SetIntField(env,lpObject,lpXimageFc->byte_order, lpXimage->byte_order);
- (*env)->SetIntField(env,lpObject,lpXimageFc->bitmap_unit, lpXimage->bitmap_unit);
- (*env)->SetIntField(env,lpObject,lpXimageFc->bitmap_bit_order, lpXimage->bitmap_bit_order);
- (*env)->SetIntField(env,lpObject,lpXimageFc->bitmap_pad, lpXimage->bitmap_pad);
- (*env)->SetIntField(env,lpObject,lpXimageFc->depth, lpXimage->depth);
- (*env)->SetIntField(env,lpObject,lpXimageFc->bytes_per_line, lpXimage->bytes_per_line);
- (*env)->SetIntField(env,lpObject,lpXimageFc->bits_per_pixel, lpXimage->bits_per_pixel);
- (*env)->SetIntField(env,lpObject,lpXimageFc->red_mask, lpXimage->red_mask);
- (*env)->SetIntField(env,lpObject,lpXimageFc->green_mask, lpXimage->green_mask);
- (*env)->SetIntField(env,lpObject,lpXimageFc->blue_mask, lpXimage->blue_mask);
- (*env)->SetIntField(env,lpObject,lpXimageFc->obdata, (jint)lpXimage->obdata);
- (*env)->SetIntField(env,lpObject,lpXimageFc->create_image, (jint)lpXimage->f.create_image);
- (*env)->SetIntField(env,lpObject,lpXimageFc->destroy_image, (jint)lpXimage->f.destroy_image);
- (*env)->SetIntField(env,lpObject,lpXimageFc->get_pixel, (jint)lpXimage->f.get_pixel);
- (*env)->SetIntField(env,lpObject,lpXimageFc->put_pixel, (jint)lpXimage->f.put_pixel);
- (*env)->SetIntField(env,lpObject,lpXimageFc->sub_image, (jint)lpXimage->f.sub_image);
- (*env)->SetIntField(env,lpObject,lpXimageFc->add_pixel, (jint)lpXimage->f.add_pixel);
-}
-
-void getXkeyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XKEYEVENT_FID_CACHE *lpXkeyeventFc)
-{
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->type);
- lpXevent->xkey.serial = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->serial);
- lpXevent->xkey.send_event = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->send_event);
- lpXevent->xkey.display = (Display *)(*env)->GetIntField(env,lpObject,lpXkeyeventFc->display);
- lpXevent->xkey.window = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->window);
- lpXevent->xkey.root = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->root);
- lpXevent->xkey.subwindow = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->subwindow);
- lpXevent->xkey.time = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->time);
- lpXevent->xkey.x = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->x);
- lpXevent->xkey.y = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->y);
- lpXevent->xkey.x_root = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->x_root);
- lpXevent->xkey.y_root = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->y_root);
- lpXevent->xkey.state = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->state);
- lpXevent->xkey.keycode = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->keycode);
- lpXevent->xkey.same_screen = (*env)->GetIntField(env,lpObject,lpXkeyeventFc->same_screen);
-}
-
-void setXkeyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XKEYEVENT_FID_CACHE *lpXkeyeventFc)
-{
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->serial, lpXevent->xkey.serial);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->send_event, lpXevent->xkey.send_event);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->display, (int)lpXevent->xkey.display);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->window, lpXevent->xkey.window);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->root, lpXevent->xkey.root);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->subwindow, lpXevent->xkey.subwindow);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->time, lpXevent->xkey.time);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->x, lpXevent->xkey.x);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->y, lpXevent->xkey.y);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->x_root, lpXevent->xkey.x_root);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->y_root, lpXevent->xkey.y_root);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->state, lpXevent->xkey.state);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->keycode, lpXevent->xkey.keycode);
- (*env)->SetIntField(env,lpObject,lpXkeyeventFc->same_screen, lpXevent->xkey.same_screen);
-}
-
-void getXmotioneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XMOTIONEVENT_FID_CACHE *lpXmotioneventFc)
-{
- int i;
-
- lpXevent->type = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->type);
- lpXevent->xmotion.serial = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->serial);
- lpXevent->xmotion.send_event = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->send_event);
- lpXevent->xmotion.display = (Display *)(*env)->GetIntField(env,lpObject,lpXmotioneventFc->display);
- lpXevent->xmotion.window = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->window);
- lpXevent->xmotion.root = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->root);
- lpXevent->xmotion.subwindow = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->subwindow);
- lpXevent->xmotion.time = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->time);
- lpXevent->xmotion.x = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->x);
- lpXevent->xmotion.y = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->y);
- lpXevent->xmotion.x_root = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->x_root);
- lpXevent->xmotion.y_root = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->y_root);
- lpXevent->xmotion.state = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->state);
- lpXevent->xmotion.is_hint = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->is_hint);
- lpXevent->xmotion.same_screen = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->same_screen);
- for (i=0; i<10; i++) {
- lpXevent->pad[i+15] = (*env)->GetIntField(env,lpObject,lpXmotioneventFc->pad[i]);
- }
-}
-
-void setXmotioneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XMOTIONEVENT_FID_CACHE *lpXmotioneventFc)
-{
- int i;
-
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->type, lpXevent->type);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->serial, lpXevent->xmotion.serial);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->send_event, lpXevent->xmotion.send_event);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->display, (int)lpXevent->xmotion.display);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->window, lpXevent->xmotion.window);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->root, lpXevent->xmotion.root);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->subwindow, lpXevent->xmotion.subwindow);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->time, lpXevent->xmotion.time);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->x, lpXevent->xmotion.x);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->y, lpXevent->xmotion.y);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->x_root, lpXevent->xmotion.x_root);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->y_root, lpXevent->xmotion.y_root);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->state, lpXevent->xmotion.state);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->is_hint, lpXevent->xmotion.is_hint);
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->same_screen, lpXevent->xmotion.same_screen);
- for (i=0; i<10; i++) {
- (*env)->SetIntField(env,lpObject,lpXmotioneventFc->pad[i],lpXevent->pad[i+15]);
- }
-}
-
-void getXcolorFields(JNIEnv *env, jobject lpObject, XColor *lpXcolor, PXCOLOR_FID_CACHE lpXcolorFc)
-{
- lpXcolor->pixel = (*env)->GetIntField(env,lpObject,lpXcolorFc->pixel);
- lpXcolor->red = (*env)->GetShortField(env,lpObject,lpXcolorFc->red);
- lpXcolor->green = (*env)->GetShortField(env,lpObject,lpXcolorFc->green);
- lpXcolor->blue = (*env)->GetShortField(env,lpObject,lpXcolorFc->blue);
- lpXcolor->flags = (*env)->GetByteField(env,lpObject,lpXcolorFc->flags);
- lpXcolor->pad = (*env)->GetByteField(env,lpObject,lpXcolorFc->pad);
-}
-
-void setXcolorFields(JNIEnv *env, jobject lpObject, XColor *lpXcolor, PXCOLOR_FID_CACHE lpXcolorFc)
-{
- (*env)->SetIntField(env,lpObject,lpXcolorFc->pixel, lpXcolor->pixel);
- (*env)->SetShortField(env,lpObject,lpXcolorFc->red, lpXcolor->red);
- (*env)->SetShortField(env,lpObject,lpXcolorFc->green, lpXcolor->green);
- (*env)->SetShortField(env,lpObject,lpXcolorFc->blue, lpXcolor->blue);
- (*env)->SetByteField(env,lpObject,lpXcolorFc->flags, lpXcolor->flags);
- (*env)->SetByteField(env,lpObject,lpXcolorFc->pad, lpXcolor->pad);
-}
-
-void getXgcvaluesFields(JNIEnv *env, jobject lpObject, XGCValues *lpXgcvalues, PXGCVALUES_FID_CACHE lpXgcvaluesFc)
-{
- lpXgcvalues->function = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->function);
- lpXgcvalues->plane_mask = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->plane_mask);
- lpXgcvalues->foreground = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->foreground);
- lpXgcvalues->background = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->background);
- lpXgcvalues->line_width = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->line_width);
- lpXgcvalues->line_style = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->line_style);
- lpXgcvalues->cap_style = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->cap_style);
- lpXgcvalues->join_style = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->join_style);
- lpXgcvalues->fill_style = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->fill_style);
- lpXgcvalues->fill_rule = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->fill_rule);
- lpXgcvalues->arc_mode = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->arc_mode);
- lpXgcvalues->tile = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->tile);
- lpXgcvalues->stipple = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->stipple);
- lpXgcvalues->ts_x_origin = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->ts_x_origin);
- lpXgcvalues->ts_y_origin = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->ts_y_origin);
- lpXgcvalues->font = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->font);
- lpXgcvalues->subwindow_mode = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->subwindow_mode);
- lpXgcvalues->graphics_exposures = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->graphics_exposures);
- lpXgcvalues->clip_x_origin = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->clip_x_origin);
- lpXgcvalues->clip_y_origin = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->clip_y_origin);
- lpXgcvalues->clip_mask = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->clip_mask);
- lpXgcvalues->dash_offset = (*env)->GetIntField(env,lpObject,lpXgcvaluesFc->dash_offset);
- lpXgcvalues->dashes = (*env)->GetByteField(env,lpObject,lpXgcvaluesFc->dashes);
-}
-
-void setXgcvaluesFields(JNIEnv *env, jobject lpObject, XGCValues *lpXgcvalues, PXGCVALUES_FID_CACHE lpXgcvaluesFc)
-{
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->function, lpXgcvalues->function);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->plane_mask, lpXgcvalues->plane_mask);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->foreground, lpXgcvalues->foreground);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->background, lpXgcvalues->background);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->line_width, lpXgcvalues->line_width);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->line_style, lpXgcvalues->line_style);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->cap_style, lpXgcvalues->cap_style);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->join_style, lpXgcvalues->join_style);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->fill_style, lpXgcvalues->fill_style);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->fill_rule, lpXgcvalues->fill_rule);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->arc_mode, lpXgcvalues->arc_mode);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->tile, lpXgcvalues->tile);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->stipple, lpXgcvalues->stipple);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->ts_x_origin, lpXgcvalues->ts_x_origin);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->ts_y_origin, lpXgcvalues->ts_y_origin);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->font, lpXgcvalues->font);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->subwindow_mode, lpXgcvalues->subwindow_mode);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->graphics_exposures, lpXgcvalues->graphics_exposures);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->clip_x_origin, lpXgcvalues->clip_x_origin);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->clip_y_origin, lpXgcvalues->clip_y_origin);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->clip_mask, lpXgcvalues->clip_mask);
- (*env)->SetIntField(env,lpObject,lpXgcvaluesFc->dash_offset, lpXgcvalues->dash_offset);
-
- (*env)->SetByteField(env,lpObject,lpXgcvaluesFc->dashes, lpXgcvalues->dashes);
-}
-
-void getXmanycallbackstructFields(JNIEnv *env, jobject lpObject, XmAnyCallbackStruct *lpXmanycallbackstruct, PXMANYCALLBACKSTRUCT_FID_CACHE lpXmanycallbackstructFc)
-{
- lpXmanycallbackstruct->reason = (*env)->GetIntField(env,lpObject,lpXmanycallbackstructFc->reason);
- lpXmanycallbackstruct->event = (XEvent *)(*env)->GetIntField(env,lpObject,lpXmanycallbackstructFc->event);
-}
-
-void setXmanycallbackstructFields(JNIEnv *env, jobject lpObject, XmAnyCallbackStruct *lpXmanycallbackstruct, PXMANYCALLBACKSTRUCT_FID_CACHE lpXmanycallbackstructFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmanycallbackstructFc->reason, lpXmanycallbackstruct->reason);
- (*env)->SetIntField(env,lpObject,lpXmanycallbackstructFc->event, (jint)lpXmanycallbackstruct->event);
-}
-
-void getXmdragproccallbackFields(JNIEnv *env, jobject lpObject, XmDragProcCallbackStruct *lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpXmdragproccallbackFc)
-{
- lpXmdragproccallback->reason = (*env)->GetIntField(env,lpObject,lpXmdragproccallbackFc->reason);
- lpXmdragproccallback->event = (XEvent *)(*env)->GetIntField(env,lpObject,lpXmdragproccallbackFc->event);
- lpXmdragproccallback->timeStamp = (*env)->GetIntField(env,lpObject,lpXmdragproccallbackFc->timeStamp);
- lpXmdragproccallback->dragContext = (Widget)(*env)->GetIntField(env,lpObject,lpXmdragproccallbackFc->dragContext);
- lpXmdragproccallback->x = (*env)->GetShortField(env,lpObject,lpXmdragproccallbackFc->x);
- lpXmdragproccallback->y = (*env)->GetShortField(env,lpObject,lpXmdragproccallbackFc->y);
- lpXmdragproccallback->dropSiteStatus = (*env)->GetByteField(env,lpObject,lpXmdragproccallbackFc->dropSiteStatus);
- lpXmdragproccallback->operation = (*env)->GetByteField(env,lpObject,lpXmdragproccallbackFc->operation);
- lpXmdragproccallback->operations = (*env)->GetByteField(env,lpObject,lpXmdragproccallbackFc->operations);
- lpXmdragproccallback->animate = (*env)->GetByteField(env,lpObject,lpXmdragproccallbackFc->animate);
-}
-
-void setXmdragproccallbackFields(JNIEnv *env, jobject lpObject, XmDragProcCallbackStruct *lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpXmdragproccallbackFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmdragproccallbackFc->reason, lpXmdragproccallback->reason);
- (*env)->SetIntField(env,lpObject,lpXmdragproccallbackFc->event, (jint)lpXmdragproccallback->event);
- (*env)->SetIntField(env,lpObject,lpXmdragproccallbackFc->timeStamp, lpXmdragproccallback->timeStamp);
- (*env)->SetIntField(env,lpObject,lpXmdragproccallbackFc->dragContext, (jint)lpXmdragproccallback->dragContext);
- (*env)->SetShortField(env,lpObject,lpXmdragproccallbackFc->x, lpXmdragproccallback->x);
- (*env)->SetShortField(env,lpObject,lpXmdragproccallbackFc->y, lpXmdragproccallback->y);
- (*env)->SetByteField(env,lpObject,lpXmdragproccallbackFc->dropSiteStatus, lpXmdragproccallback->dropSiteStatus);
- (*env)->SetByteField(env,lpObject,lpXmdragproccallbackFc->operation, lpXmdragproccallback->operation);
- (*env)->SetByteField(env,lpObject,lpXmdragproccallbackFc->operations, lpXmdragproccallback->operations);
- (*env)->SetByteField(env,lpObject,lpXmdragproccallbackFc->animate, lpXmdragproccallback->animate);
-}
-
-void getXmdropproccallbackFields(JNIEnv *env, jobject lpObject, XmDropProcCallbackStruct *lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpXmdropproccallbackFc)
-{
- lpXmdropproccallback->reason = (*env)->GetIntField(env,lpObject,lpXmdropproccallbackFc->reason);
- lpXmdropproccallback->event = (XEvent *)(*env)->GetIntField(env,lpObject,lpXmdropproccallbackFc->event);
- lpXmdropproccallback->timeStamp = (*env)->GetIntField(env,lpObject,lpXmdropproccallbackFc->timeStamp);
- lpXmdropproccallback->dragContext = (Widget)(*env)->GetIntField(env,lpObject,lpXmdropproccallbackFc->dragContext);
- lpXmdropproccallback->x = (*env)->GetShortField(env,lpObject,lpXmdropproccallbackFc->x);
- lpXmdropproccallback->y = (*env)->GetShortField(env,lpObject,lpXmdropproccallbackFc->y);
- lpXmdropproccallback->dropSiteStatus = (*env)->GetByteField(env,lpObject,lpXmdropproccallbackFc->dropSiteStatus);
- lpXmdropproccallback->operation = (*env)->GetByteField(env,lpObject,lpXmdropproccallbackFc->operation);
- lpXmdropproccallback->operations = (*env)->GetByteField(env,lpObject,lpXmdropproccallbackFc->operations);
- lpXmdropproccallback->dropAction = (*env)->GetByteField(env,lpObject,lpXmdropproccallbackFc->dropAction);
-}
-
-void setXmdropproccallbackFields(JNIEnv *env, jobject lpObject, XmDropProcCallbackStruct *lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpXmdropproccallbackFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmdropproccallbackFc->reason, lpXmdropproccallback->reason);
- (*env)->SetIntField(env,lpObject,lpXmdropproccallbackFc->event, (jint)lpXmdropproccallback->event);
- (*env)->SetIntField(env,lpObject,lpXmdropproccallbackFc->timeStamp, lpXmdropproccallback->timeStamp);
- (*env)->SetIntField(env,lpObject,lpXmdropproccallbackFc->dragContext, (jint)lpXmdropproccallback->dragContext);
- (*env)->SetShortField(env,lpObject,lpXmdropproccallbackFc->x, lpXmdropproccallback->x);
- (*env)->SetShortField(env,lpObject,lpXmdropproccallbackFc->y, lpXmdropproccallback->y);
- (*env)->SetByteField(env,lpObject,lpXmdropproccallbackFc->dropSiteStatus, lpXmdropproccallback->dropSiteStatus);
- (*env)->SetByteField(env,lpObject,lpXmdropproccallbackFc->operation, lpXmdropproccallback->operation);
- (*env)->SetByteField(env,lpObject,lpXmdropproccallbackFc->operations, lpXmdropproccallback->operations);
- (*env)->SetByteField(env,lpObject,lpXmdropproccallbackFc->dropAction, lpXmdropproccallback->dropAction);
-}
-
-void getXmdropfinishcallbackFields(JNIEnv *env, jobject lpObject, XmDropFinishCallbackStruct *lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpXmdropfinishcallbackFc)
-{
- lpXmdropfinishcallback->reason = (*env)->GetIntField(env,lpObject,lpXmdropfinishcallbackFc->reason);
- lpXmdropfinishcallback->event = (XEvent *)(*env)->GetIntField(env,lpObject,lpXmdropfinishcallbackFc->event);
- lpXmdropfinishcallback->timeStamp = (*env)->GetIntField(env,lpObject,lpXmdropfinishcallbackFc->timeStamp);
- lpXmdropfinishcallback->operation = (*env)->GetByteField(env,lpObject,lpXmdropfinishcallbackFc->operation);
- lpXmdropfinishcallback->operations = (*env)->GetByteField(env,lpObject,lpXmdropfinishcallbackFc->operations);
- lpXmdropfinishcallback->dropSiteStatus = (*env)->GetByteField(env,lpObject,lpXmdropfinishcallbackFc->dropSiteStatus);
- lpXmdropfinishcallback->dropAction = (*env)->GetByteField(env,lpObject,lpXmdropfinishcallbackFc->dropAction);
- lpXmdropfinishcallback->completionStatus = (*env)->GetByteField(env,lpObject,lpXmdropfinishcallbackFc->completionStatus);
-}
-
-void setXmdropfinishcallbackFields(JNIEnv *env, jobject lpObject, XmDropFinishCallbackStruct *lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpXmdropfinishcallbackFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmdropfinishcallbackFc->reason, lpXmdropfinishcallback->reason);
- (*env)->SetIntField(env,lpObject,lpXmdropfinishcallbackFc->event, (jint)lpXmdropfinishcallback->event);
- (*env)->SetIntField(env,lpObject,lpXmdropfinishcallbackFc->timeStamp, lpXmdropfinishcallback->timeStamp);
- (*env)->SetByteField(env,lpObject,lpXmdropfinishcallbackFc->operation, lpXmdropfinishcallback->operation);
- (*env)->SetByteField(env,lpObject,lpXmdropfinishcallbackFc->operations, lpXmdropfinishcallback->operations);
- (*env)->SetByteField(env,lpObject,lpXmdropfinishcallbackFc->dropSiteStatus, lpXmdropfinishcallback->dropSiteStatus);
- (*env)->SetByteField(env,lpObject,lpXmdropfinishcallbackFc->dropAction, lpXmdropfinishcallback->dropAction);
- (*env)->SetByteField(env,lpObject,lpXmdropfinishcallbackFc->completionStatus, lpXmdropfinishcallback->completionStatus);
-}
-
-void getXmtextblockrecFields(JNIEnv *env, jobject lpObject, XmTextBlockRec *lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpXmtextblockrecFc)
-{
- lpXmtextblockrec->ptr = (char *)(*env)->GetIntField(env,lpObject,lpXmtextblockrecFc->ptr);
- lpXmtextblockrec->length = (*env)->GetIntField(env,lpObject,lpXmtextblockrecFc->length);
- lpXmtextblockrec->format = (XmTextFormat)(*env)->GetIntField(env,lpObject,lpXmtextblockrecFc->format);
-}
-
-void setXmtextblockrecFields(JNIEnv *env, jobject lpObject, XmTextBlockRec *lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpXmtextblockrecFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmtextblockrecFc->ptr, (jint)lpXmtextblockrec->ptr);
- (*env)->SetIntField(env,lpObject,lpXmtextblockrecFc->length, lpXmtextblockrec->length);
- (*env)->SetIntField(env,lpObject,lpXmtextblockrecFc->format, (jint)lpXmtextblockrec->format);
-}
-
-void getXmtextverifycallbackstructFields(JNIEnv *env, jobject lpObject, XmTextVerifyCallbackStruct *lpXmtextverifycallbackstruct, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpXmtextverifycallbackstructFc)
-{
- lpXmtextverifycallbackstruct->reason = (*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->reason);
- lpXmtextverifycallbackstruct->event = (XEvent *)(*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->event);
- lpXmtextverifycallbackstruct->doit = (Boolean)(*env)->GetByteField(env,lpObject,lpXmtextverifycallbackstructFc->doit);
- lpXmtextverifycallbackstruct->currInsert = (*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->currInsert);
- lpXmtextverifycallbackstruct->newInsert = (*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->newInsert);
- lpXmtextverifycallbackstruct->startPos = (*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->startPos);
- lpXmtextverifycallbackstruct->endPos = (*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->endPos);
- lpXmtextverifycallbackstruct->text = (XmTextBlock)(*env)->GetIntField(env,lpObject,lpXmtextverifycallbackstructFc->text);
-}
-
-void setXmtextverifycallbackstructFields(JNIEnv *env, jobject lpObject, XmTextVerifyCallbackStruct *lpXmtextverifycallbackstruct, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpXmtextverifycallbackstructFc)
-{
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->reason, lpXmtextverifycallbackstruct->reason);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->event, (jint)lpXmtextverifycallbackstruct->event);
- (*env)->SetByteField(env,lpObject,lpXmtextverifycallbackstructFc->doit, (jint)lpXmtextverifycallbackstruct->doit);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->currInsert, lpXmtextverifycallbackstruct->currInsert);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->newInsert, lpXmtextverifycallbackstruct->newInsert);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->startPos, lpXmtextverifycallbackstruct->startPos);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->endPos, lpXmtextverifycallbackstruct->endPos);
- (*env)->SetIntField(env,lpObject,lpXmtextverifycallbackstructFc->text, (jint)lpXmtextverifycallbackstruct->text);
-}
-
-void getXrectangleFields(JNIEnv *env, jobject lpObject, XRectangle *lpXrect, PXRECTANGLE_FID_CACHE lpXrectFc)
-{
- lpXrect->x = (*env)->GetShortField(env,lpObject,lpXrectFc->x);
- lpXrect->y = (*env)->GetShortField(env,lpObject,lpXrectFc->y);
- lpXrect->width = (*env)->GetShortField(env,lpObject,lpXrectFc->width);
- lpXrect->height = (*env)->GetShortField(env,lpObject,lpXrectFc->height);
-}
-
-void setXrectangleFields(JNIEnv *env, jobject lpObject, XRectangle *lpXrect, PXRECTANGLE_FID_CACHE lpXrectFc)
-{
- (*env)->SetShortField(env,lpObject,lpXrectFc->x, lpXrect->x);
- (*env)->SetShortField(env,lpObject,lpXrectFc->y, lpXrect->y);
- (*env)->SetShortField(env,lpObject,lpXrectFc->width, lpXrect->width);
- (*env)->SetShortField(env,lpObject,lpXrectFc->height, lpXrect->height);
-}
-
-void getXsetwindowattributesFields(JNIEnv *env, jobject lpObject, XSetWindowAttributes *lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpXsetwindowattributesFc)
-{
- lpXsetwindowattributes->background_pixmap = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->background_pixmap);
- lpXsetwindowattributes->background_pixel = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->background_pixel);
- lpXsetwindowattributes->border_pixmap = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->border_pixmap);
- lpXsetwindowattributes->border_pixel = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->border_pixel);
- lpXsetwindowattributes->bit_gravity = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->bit_gravity);
- lpXsetwindowattributes->win_gravity = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->win_gravity);
- lpXsetwindowattributes->backing_store = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->backing_store);
- lpXsetwindowattributes->backing_planes = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->backing_planes);
- lpXsetwindowattributes->backing_pixel = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->backing_pixel);
- lpXsetwindowattributes->save_under = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->save_under);
- lpXsetwindowattributes->event_mask = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->event_mask);
- lpXsetwindowattributes->do_not_propagate_mask = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->do_not_propagate_mask);
- lpXsetwindowattributes->override_redirect = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->override_redirect);
- lpXsetwindowattributes->colormap = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->colormap);
- lpXsetwindowattributes->cursor = (*env)->GetIntField(env,lpObject,lpXsetwindowattributesFc->cursor);
-}
-
-void setXsetwindowattributesFields(JNIEnv *env, jobject lpObject, XSetWindowAttributes *lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpXsetwindowattributesFc)
-{
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->background_pixmap, lpXsetwindowattributes->background_pixmap);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->background_pixel, lpXsetwindowattributes->background_pixel);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->border_pixmap, lpXsetwindowattributes->border_pixmap);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->border_pixel, lpXsetwindowattributes->border_pixel);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->bit_gravity, lpXsetwindowattributes->bit_gravity);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->win_gravity, lpXsetwindowattributes->win_gravity);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->backing_store, lpXsetwindowattributes->backing_store);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->backing_planes, lpXsetwindowattributes->backing_planes);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->backing_pixel, lpXsetwindowattributes->backing_pixel);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->save_under, lpXsetwindowattributes->save_under);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->event_mask, lpXsetwindowattributes->event_mask);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->do_not_propagate_mask, lpXsetwindowattributes->do_not_propagate_mask);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->override_redirect, lpXsetwindowattributes->override_redirect);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->colormap, lpXsetwindowattributes->colormap);
- (*env)->SetIntField(env,lpObject,lpXsetwindowattributesFc->cursor, lpXsetwindowattributes->cursor);
-}
-
-void getXwindowattributesFields(JNIEnv *env, jobject lpObject, XWindowAttributes *lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpXwindowattributesFc)
-{
- lpXwindowattributes->x = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->x);
- lpXwindowattributes->y = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->y);
- lpXwindowattributes->width = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->width);
- lpXwindowattributes->height = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->height);
- lpXwindowattributes->border_width = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->border_width);
- lpXwindowattributes->depth = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->depth);
- lpXwindowattributes->visual = (Visual *)(*env)->GetIntField(env,lpObject,lpXwindowattributesFc->visual);
- lpXwindowattributes->root = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->root);
- lpXwindowattributes->class = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->class);
- lpXwindowattributes->bit_gravity = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->bit_gravity);
- lpXwindowattributes->win_gravity = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->win_gravity);
- lpXwindowattributes->backing_store = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->backing_store);
- lpXwindowattributes->backing_planes = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->backing_planes);
- lpXwindowattributes->backing_pixel = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->backing_pixel);
- lpXwindowattributes->save_under = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->save_under);
- lpXwindowattributes->colormap = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->colormap);
- lpXwindowattributes->map_installed = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->map_installed);
- lpXwindowattributes->map_state = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->map_state);
- lpXwindowattributes->all_event_masks = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->all_event_masks);
- lpXwindowattributes->your_event_mask = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->your_event_mask);
- lpXwindowattributes->do_not_propagate_mask = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->do_not_propagate_mask);
- lpXwindowattributes->override_redirect = (*env)->GetIntField(env,lpObject,lpXwindowattributesFc->override_redirect);
- lpXwindowattributes->screen = (Screen *)(*env)->GetIntField(env,lpObject,lpXwindowattributesFc->screen);
-}
-
-void setXwindowattributesFields(JNIEnv *env, jobject lpObject, XWindowAttributes *lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpXwindowattributesFc)
-{
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->x, lpXwindowattributes->x);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->y, lpXwindowattributes->y);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->width, lpXwindowattributes->width);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->height, lpXwindowattributes->height);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->border_width, lpXwindowattributes->border_width);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->depth, lpXwindowattributes->depth);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->visual, (int)lpXwindowattributes->visual);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->root, lpXwindowattributes->root);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->class, lpXwindowattributes->class);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->bit_gravity, lpXwindowattributes->bit_gravity);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->win_gravity, lpXwindowattributes->win_gravity);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->backing_store, lpXwindowattributes->backing_store);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->backing_planes, lpXwindowattributes->backing_planes);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->backing_pixel, lpXwindowattributes->backing_pixel);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->save_under, lpXwindowattributes->save_under);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->colormap, lpXwindowattributes->colormap);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->map_installed, lpXwindowattributes->map_installed);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->map_state, lpXwindowattributes->map_state);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->all_event_masks, lpXwindowattributes->all_event_masks);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->your_event_mask, lpXwindowattributes->your_event_mask);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->do_not_propagate_mask, lpXwindowattributes->do_not_propagate_mask);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->override_redirect, lpXwindowattributes->override_redirect);
- (*env)->SetIntField(env,lpObject,lpXwindowattributesFc->screen, (int)lpXwindowattributes->screen);
-}
-
-void getXwindowchangesFields(JNIEnv *env, jobject lpObject, XWindowChanges *lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpXwindowchangesFc)
-{
- lpXwindowchanges->x = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->x);
- lpXwindowchanges->y = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->y);
- lpXwindowchanges->width = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->width);
- lpXwindowchanges->height = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->height);
- lpXwindowchanges->border_width = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->border_width);
- lpXwindowchanges->sibling = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->sibling);
- lpXwindowchanges->stack_mode = (*env)->GetIntField(env,lpObject,lpXwindowchangesFc->stack_mode);
-}
-
-void setXwindowchangesFields(JNIEnv *env, jobject lpObject, XWindowChanges *lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpXwindowchangesFc)
-{
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->x, lpXwindowchanges->x);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->y, lpXwindowchanges->y);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->width, lpXwindowchanges->width);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->height, lpXwindowchanges->height);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->border_width, lpXwindowchanges->border_width);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->sibling, lpXwindowchanges->sibling);
- (*env)->SetIntField(env,lpObject,lpXwindowchangesFc->stack_mode, lpXwindowchanges->stack_mode);
-}
-
-void getXtwidgetgeometryFields(JNIEnv *env, jobject lpObject, XtWidgetGeometry *lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpXtwidgetgeometryFc)
-{
- lpXtwidgetgeometry->request_mode = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->request_mode);
- lpXtwidgetgeometry->x = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->x);
- lpXtwidgetgeometry->y = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->y);
- lpXtwidgetgeometry->width = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->width);
- lpXtwidgetgeometry->height = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->height);
- lpXtwidgetgeometry->border_width = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->border_width);
- lpXtwidgetgeometry->sibling = (Widget)(*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->sibling);
- lpXtwidgetgeometry->stack_mode = (*env)->GetIntField(env,lpObject,lpXtwidgetgeometryFc->stack_mode);
-}
-
-void setXtwidgetgeometryFields(JNIEnv *env, jobject lpObject, XtWidgetGeometry *lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpXtwidgetgeometryFc)
-{
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->request_mode, lpXtwidgetgeometry->request_mode);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->x, lpXtwidgetgeometry->x);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->y, lpXtwidgetgeometry->y);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->width, lpXtwidgetgeometry->width);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->height, lpXtwidgetgeometry->height);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->border_width, lpXtwidgetgeometry->border_width);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->sibling, (int)lpXtwidgetgeometry->sibling);
- (*env)->SetIntField(env,lpObject,lpXtwidgetgeometryFc->stack_mode, lpXtwidgetgeometry->stack_mode);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.h
deleted file mode 100644
index aa61e39d84..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/structs.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Motif structs
- */
-
-#ifndef INC_structs_H
-#define INC_structs_H
-
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Intrinsic.h>
-#include <X11/Shell.h>
-#include <X11/keysym.h>
-#include <X11/extensions/Print.h>
-
-#include <Xm/XmAll.h>
-#include <Mrm/MrmPublic.h>
-
-/* ----------- fid and class caches ----------- */
-/**
- * Used for Java objects passed into JNI that are
- * declared like:
- *
- * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
- *
- * and not like this
- *
- * nativeFunction (Object p1, Object p2, Object p3)
- *
- *
- */
-
-/* VISUAL struct */
-typedef struct VISUAL_FID_CACHE {
-
- int cached;
- jclass visualClass;
- jfieldID ext_data, visualid, c_class, red_mask, green_mask, blue_mask, bits_per_rgb, map_entries;
-
-} VISUAL_FID_CACHE;
-
-typedef VISUAL_FID_CACHE *PVISUAL_FID_CACHE;
-
-/* XANYEVENT struct */
-typedef struct XANYEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, pad[19];
-/*
- pad0, pad1, pad2, pad3,
- pad4, pad5, pad6, pad7, pad8, pad9, pad10, pad11, pad12, pad13
- pad14, pad15, pad16, pad17, pad18;
-*/
-
-} XANYEVENT_FID_CACHE;
-
-typedef XANYEVENT_FID_CACHE *PXANYEVENT_FID_CACHE;
-
-/* XBUTTONEVENT struct */
-typedef struct XBUTTONEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, x_root, y_root, state, button, same_screen;
-
-} XBUTTONEVENT_FID_CACHE;
-
-typedef XBUTTONEVENT_FID_CACHE *PXBUTTONEVENT_FID_CACHE;
-
-/* XCHARSTRUCT struct */
-typedef struct XCHARSTRUCT_FID_CACHE {
-
- int cached;
- jclass xcharstructClass;
- jfieldID lbearing, rbearing, width, ascent, descent, attributes;
-
-} XCHARSTRUCT_FID_CACHE;
-
-typedef XCHARSTRUCT_FID_CACHE *PXCHARSTRUCT_FID_CACHE;
-
-/* XCONFIGUREEVENT struct */
-typedef struct XCONFIGUREEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, width, height, border_width, above, override_redirect;
-
-} XCONFIGUREEVENT_FID_CACHE;
-
-typedef XCONFIGUREEVENT_FID_CACHE *PXCONFIGUREEVENT_FID_CACHE;
-
-/* XCROSSINGEVENT struct */
-typedef struct XCROSSINGEVENT_FID_CACHE {
-
- int cached;
- jclass xcrossingeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, x_root, y_root, mode, detail, same_screen, focus,
- state, pad[8];
-/*
- pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7;
-*/
-
-} XCROSSINGEVENT_FID_CACHE;
-
-typedef XCROSSINGEVENT_FID_CACHE *PXCROSSINGEVENT_FID_CACHE;
-
-/* XEXPOSEEVENT struct */
-typedef struct XEXPOSEEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, width, height, count;
-
-} XEXPOSEEVENT_FID_CACHE;
-
-typedef XEXPOSEEVENT_FID_CACHE *PXEXPOSEEVENT_FID_CACHE;
-
-/* XFOCUSCHANGEEVENT struct */
-typedef struct XFOCUSCHANGEEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, mode, detail, pad[17];
-
-} XFOCUSCHANGEEVENT_FID_CACHE;
-
-typedef XFOCUSCHANGEEVENT_FID_CACHE *PXFOCUSCHANGEEVENT_FID_CACHE;
-
-/* XFONTSTRUCT struct */
-typedef struct XFONTSTRUCT_FID_CACHE {
-
- int cached;
- jclass xfontstructClass;
- jfieldID ext_data, fid, direction, min_char_or_byte2, max_char_or_byte2, \
- min_byte1, max_byte1, all_chars_exist, default_char, n_properties, \
- properties, min_bounds_lbearing, min_bounds_rbearing, min_bounds_width, \
- min_bounds_ascent, min_bounds_descent, min_bounds_attributes, \
- max_bounds_lbearing, max_bounds_rbearing, max_bounds_width, \
- max_bounds_ascent, max_bounds_descent, max_bounds_attributes, per_char, \
- ascent, descent;
-
-} XFONTSTRUCT_FID_CACHE;
-
-typedef XFONTSTRUCT_FID_CACHE *PXFONTSTRUCT_FID_CACHE;
-
-/* XIMAGE struct */
-typedef struct XIMAGE_FID_CACHE {
-
- int cached;
- jclass ximageClass;
- jfieldID width, height, xoffset, format, data, byte_order, bitmap_unit,
- bitmap_bit_order, bitmap_pad, depth, bytes_per_line, bits_per_pixel,
- red_mask, green_mask, blue_mask, obdata, create_image, destroy_image,
- get_pixel, put_pixel, sub_image, add_pixel;
-
-} XIMAGE_FID_CACHE;
-
-typedef XIMAGE_FID_CACHE *PXIMAGE_FID_CACHE;
-
-/* XKEYEVENT struct */
-typedef struct XKEYEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, x_root, y_root, state, keycode, same_screen;
-
-} XKEYEVENT_FID_CACHE;
-
-typedef XKEYEVENT_FID_CACHE *PXKEYEVENT_FID_CACHE;
-
-/* XMOTIONEVENT struct */
-typedef struct XMOTIONEVENT_FID_CACHE {
-
- int cached;
- jclass xeventClass;
- jfieldID type, serial, send_event, display, window, root, subwindow, time,
- x, y, x_root, y_root, state, is_hint, same_screen, pad[10];
-
-} XMOTIONEVENT_FID_CACHE;
-
-typedef XMOTIONEVENT_FID_CACHE *PXMOTIONEVENT_FID_CACHE;
-
-/* XCOLOR struct */
-typedef struct XCOLOR_FID_CACHE {
-
- int cached;
- jclass xcolorClass;
- jfieldID pixel, red, green, blue, flags, pad;
-
-} XCOLOR_FID_CACHE;
-
-typedef XCOLOR_FID_CACHE *PXCOLOR_FID_CACHE;
-
-/* XGCVALUES struct */
-typedef struct XGCVALUES_FID_CACHE {
-
- int cached;
- jclass xgcvaluesClass;
- jfieldID function, plane_mask, foreground, background, line_width, line_style, cap_style,
- join_style, fill_style, fill_rule, arc_mode, tile, stipple, ts_x_origin, ts_y_origin,
- font, subwindow_mode, graphics_exposures, clip_x_origin, clip_y_origin, clip_mask,
- dash_offset, dashes;
-
-} XGCVALUES_FID_CACHE;
-
-typedef XGCVALUES_FID_CACHE *PXGCVALUES_FID_CACHE;
-
-/* XMANYCALLBACKSTRUCT struct */
-typedef struct XMANYCALLBACKSTRUCT_FID_CACHE {
-
- int cached;
- jclass xmanycallbackstructClass;
- jfieldID reason, event;
-
-} XMANYCALLBACKSTRUCT_FID_CACHE;
-
-typedef XMANYCALLBACKSTRUCT_FID_CACHE *PXMANYCALLBACKSTRUCT_FID_CACHE;
-
-/* XMDRAGPROCCALLBACK struct */
-typedef struct XMDRAGPROCCALLBACK_FID_CACHE {
-
- int cached;
- jclass xmdragproccallbackClass;
- jfieldID reason, event, timeStamp, dragContext, x, y,
- dropSiteStatus, operation, operations, animate;
-
-} XMDRAGPROCCALLBACK_FID_CACHE;
-
-typedef XMDRAGPROCCALLBACK_FID_CACHE *PXMDRAGPROCCALLBACK_FID_CACHE;
-
-/* XMDROPPROCCALLBACK struct */
-typedef struct XMDROPPROCCALLBACK_FID_CACHE {
-
- int cached;
- jclass xmdropproccallbackClass;
- jfieldID reason, event, timeStamp, dragContext, x, y,
- dropSiteStatus, operation, operations, dropAction;
-
-} XMDROPPROCCALLBACK_FID_CACHE;
-
-typedef XMDROPPROCCALLBACK_FID_CACHE *PXMDROPPROCCALLBACK_FID_CACHE;
-
-/* XMDROPFINISHCALLBACK struct */
-typedef struct XMDROPFINISHCALLBACK_FID_CACHE {
-
- int cached;
- jclass xmdropfinishcallbackClass;
- jfieldID reason, event, timeStamp,
- operation, operations, dropSiteStatus, dropAction, completionStatus;
-
-} XMDROPFINISHCALLBACK_FID_CACHE;
-
-typedef XMDROPFINISHCALLBACK_FID_CACHE *PXMDROPFINISHCALLBACK_FID_CACHE;
-
-/* XMTEXTBLOCKREC struct */
-typedef struct XMTEXTBLOCKREC_FID_CACHE {
-
- int cached;
- jclass xmtextblockrecClass;
- jfieldID ptr, length, format;
-
-} XMTEXTBLOCKREC_FID_CACHE;
-
-typedef XMTEXTBLOCKREC_FID_CACHE *PXMTEXTBLOCKREC_FID_CACHE;
-
-/* XMTEXTVERIFYCALLBACKSTRUCT struct */
-typedef struct XMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE {
-
- int cached;
- jclass xmtextverifycallbackstructClass;
- jfieldID reason, event, doit, currInsert, newInsert, startPos, endPos, text;
-
-} XMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE;
-
-typedef XMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE *PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE;
-
-/* XRECTANGLE struct */
-typedef struct XRECTANGLE_FID_CACHE {
-
- int cached;
- jclass xrectClass;
- jfieldID x, y, width, height;
-
-} XRECTANGLE_FID_CACHE;
-
-typedef XRECTANGLE_FID_CACHE *PXRECTANGLE_FID_CACHE;
-
-/* XWINDOWCHANGES struct */
-typedef struct XWINDOWCHANGES_FID_CACHE {
-
- int cached;
- jclass xwindowchangesClass;
- jfieldID x, y, width, height, border_width, sibling, stack_mode;
-
-} XWINDOWCHANGES_FID_CACHE;
-
-typedef XWINDOWCHANGES_FID_CACHE *PXWINDOWCHANGES_FID_CACHE;
-
-/* XSETWINDOWATTRIBUTES struct */
-typedef struct XSETWINDOWATTRIBUTES_FID_CACHE {
-
- int cached;
- jclass xsetwindowattributesClass;
- jfieldID background_pixmap, background_pixel, border_pixmap, border_pixel, bit_gravity, win_gravity,
- backing_store, backing_planes, backing_pixel, save_under, event_mask, do_not_propagate_mask,
- override_redirect, colormap, cursor;
-
-} XSETWINDOWATTRIBUTES_FID_CACHE;
-
-typedef XSETWINDOWATTRIBUTES_FID_CACHE *PXSETWINDOWATTRIBUTES_FID_CACHE;
-
-/* XWINDOWATTRIBUTES struct */
-typedef struct XWINDOWATTRIBUTES_FID_CACHE {
-
- int cached;
- jclass xwindowattributesClass;
- jfieldID x, y, width, height, border_width, depth, visual, root,
- class, bit_gravity, win_gravity, backing_store, backing_planes,
- backing_pixel, save_under, colormap, map_installed, map_state, all_event_masks,
- your_event_mask, do_not_propagate_mask, override_redirect, screen;
-
-} XWINDOWATTRIBUTES_FID_CACHE;
-
-typedef XWINDOWATTRIBUTES_FID_CACHE *PXWINDOWATTRIBUTES_FID_CACHE;
-
-/* XTWIDGETGEOMETRY struct */
-typedef struct XTWIDGETGEOMETRY_FID_CACHE {
-
- int cached;
- jclass xtwidgetgeometryClass;
- jfieldID request_mode, x, y, width, height, border_width, sibling, stack_mode;
-
-} XTWIDGETGEOMETRY_FID_CACHE;
-
-typedef XTWIDGETGEOMETRY_FID_CACHE *PXTWIDGETGEOMETRY_FID_CACHE;
-
-/* ----------- cache function prototypes ----------- */
-
-void cacheXimageFids(JNIEnv *env, jobject lpXimage, PXIMAGE_FID_CACHE lpCache);
-void cacheVisualFids(JNIEnv *env, jobject lpVisual, PVISUAL_FID_CACHE lpCache);
-void cacheXanyeventFids(JNIEnv *env, jobject lpXevent, PXANYEVENT_FID_CACHE lpCache);
-void cacheXbuttoneventFids(JNIEnv *env, jobject lpXevent, PXBUTTONEVENT_FID_CACHE lpCache);
-void cacheXcharstructFids(JNIEnv *env, jobject lpXcharstruct, PXCHARSTRUCT_FID_CACHE lpCache);
-void cacheXconfigureeventFids(JNIEnv *env, jobject lpXevent, PXCONFIGUREEVENT_FID_CACHE lpCache);
-void cacheXcrossingeventFids(JNIEnv *env, jobject lpXcrossingevent, PXCROSSINGEVENT_FID_CACHE lpCache);
-void cacheXexposeeventFids(JNIEnv *env, jobject lpXevent, PXEXPOSEEVENT_FID_CACHE lpCache);
-void cacheXfocuschangeeventFids(JNIEnv *env, jobject lpXevent, PXFOCUSCHANGEEVENT_FID_CACHE lpCache);
-void cacheXfontstructFids(JNIEnv *env, jobject lpXfontstruct, PXFONTSTRUCT_FID_CACHE lpCache);
-void cacheXkeyeventFids(JNIEnv *env, jobject lpXevent, PXKEYEVENT_FID_CACHE lpCache);
-void cacheXmotioneventFids(JNIEnv *env, jobject lpXevent, PXMOTIONEVENT_FID_CACHE lpCache);
-void cacheXanyeventFids(JNIEnv *env, jobject lpXevent, PXANYEVENT_FID_CACHE lpCache);
-void cacheXcolorFids(JNIEnv *env, jobject lpXcolor, PXCOLOR_FID_CACHE lpCache);
-void cacheXgcvaluesFids(JNIEnv *env, jobject lpXgcvalues, PXGCVALUES_FID_CACHE lpCache);
-void cacheXmanycallbackstructFids(JNIEnv *env, jobject lpXmanycallbackstruct, PXMANYCALLBACKSTRUCT_FID_CACHE lpCache);
-void cacheXmdragproccallbackFids(JNIEnv *env, jobject lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpCache);
-void cacheXmdropproccallbackFids(JNIEnv *env, jobject lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpCache);
-void cacheXmdropfinishcallbackFids(JNIEnv *env, jobject lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpCache);
-void cacheXmtextblockrecFids(JNIEnv *env, jobject lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpCache);
-void cacheXmtextverifycallbackstructFids(JNIEnv *env, jobject lpXmtextverifycallbackstruct, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpCache);
-void cacheXrectangleFids(JNIEnv *env, jobject lpRect, PXRECTANGLE_FID_CACHE lpCache);
-void cacheXwindowchangesFids(JNIEnv *env, jobject lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpCache);
-void cacheXsetwindowattributesFids(JNIEnv *env, jobject lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpCache);
-void cacheXwindowattributesFids(JNIEnv *env, jobject lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpCache);
-void cacheXtwidgetgeometryFids(JNIEnv *env, jobject lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpCache);
-
-/* ----------- getters and setters ----------- */
-/**
- * These functions get or set object field ids assuming that the
- * fids for these objects have already been cached.
- *
- * The header file just contains function prototypes
- */
-
-void getVisualFields(JNIEnv *env, jobject lpObject, Visual *lpVisual, VISUAL_FID_CACHE *lpVisualFc);
-void setVisualFields(JNIEnv *env, jobject lpObject, Visual *lpVisual, VISUAL_FID_CACHE *lpVisualFc);
-void getXanyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XANYEVENT_FID_CACHE *lpXeventFc);
-void setXanyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XANYEVENT_FID_CACHE *lpXeventFc);
-void getXbuttoneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, PXBUTTONEVENT_FID_CACHE lpXbuttoneventFc);
-void setXbuttoneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, PXBUTTONEVENT_FID_CACHE lpXbuttoneventFc);
-void getXcharstructFields(JNIEnv *env, jobject lpObject, XCharStruct *lpXcharstruct, XCHARSTRUCT_FID_CACHE *lpXcharstructFc);
-void setXcharstructFields(JNIEnv *env, jobject lpObject, XCharStruct *lpXcharstruct, XCHARSTRUCT_FID_CACHE *lpXcharstructFc);
-void getXconfigureeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, PXCONFIGUREEVENT_FID_CACHE lpXconfigureeventFc);
-void setXconfigureeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, PXCONFIGUREEVENT_FID_CACHE lpXconfigureeventFc);
-void getXcrossingeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXcrossingevent, PXCROSSINGEVENT_FID_CACHE lpXcrossingeventFc);
-void setXcrossingeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXcrossingevent, PXCROSSINGEVENT_FID_CACHE lpXcrossingeventFc);
-void getXexposeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XEXPOSEEVENT_FID_CACHE *lpXexposeeventFc);
-void setXexposeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XEXPOSEEVENT_FID_CACHE *lpXexposeeventFc);
-void getXfocuschangeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XFOCUSCHANGEEVENT_FID_CACHE *lpXfocuschangeeventFc);
-void setXfocuschangeeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XFOCUSCHANGEEVENT_FID_CACHE *lpXfocuschangeeventFc);
-void getXfontstructFields(JNIEnv *env, jobject lpObject, XFontStruct *lpXfontstruct, XFONTSTRUCT_FID_CACHE *lpXfontstructFc);
-void setXfontstructFields(JNIEnv *env, jobject lpObject, XFontStruct *lpXfontstruct, XFONTSTRUCT_FID_CACHE *lpXfontstructFc);
-void getXimageFields(JNIEnv *env, jobject lpObject, XImage *lpXimage, XIMAGE_FID_CACHE *lpXimageFc);
-void setXimageFields(JNIEnv *env, jobject lpObject, XImage *lpXimage, XIMAGE_FID_CACHE *lpXimageFc);
-void getXkeyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XKEYEVENT_FID_CACHE *lpXkeyeventFc);
-void setXkeyeventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XKEYEVENT_FID_CACHE *lpXkeyeventFc);
-void getXmotioneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XMOTIONEVENT_FID_CACHE *lpXmotioneventFc);
-void setXmotioneventFields(JNIEnv *env, jobject lpObject, XEvent *lpXevent, XMOTIONEVENT_FID_CACHE *lpXmotioneventFc);
-void getXcolorFields(JNIEnv *env, jobject lpObject, XColor *lpXcolor, XCOLOR_FID_CACHE *lpXcolorFc);
-void setXcolorFields(JNIEnv *env, jobject lpObject, XColor *lpXcolor, XCOLOR_FID_CACHE *lpXcolorFc);
-void getXgcvaluesFields(JNIEnv *env, jobject lpObject, XGCValues *lpXgcvalues, PXGCVALUES_FID_CACHE lpXgcvaluesFc);
-void setXgcvaluesFields(JNIEnv *env, jobject lpObject, XGCValues *lpXgcvalues, PXGCVALUES_FID_CACHE lpXgcvaluesFc);
-void getXmanycallbackstructFields(JNIEnv *env, jobject lpObject, XmAnyCallbackStruct *lpXmanycallbackstruct, PXMANYCALLBACKSTRUCT_FID_CACHE lpXmanycallbackstructFc);
-void setXmanycallbackstructFields(JNIEnv *env, jobject lpObject, XmAnyCallbackStruct *lpXmanycallbackstruct, PXMANYCALLBACKSTRUCT_FID_CACHE lpXmanycallbackstructFc);
-void getXmdragproccallbackFields(JNIEnv *env, jobject lpObject, XmDragProcCallbackStruct *lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpXmdragproccallbackFc);
-void setXmdragproccallbackFields(JNIEnv *env, jobject lpObject, XmDragProcCallbackStruct *lpXmdragproccallback, PXMDRAGPROCCALLBACK_FID_CACHE lpXmdragproccallbackFc);
-void getXmdropproccallbackFields(JNIEnv *env, jobject lpObject, XmDropProcCallbackStruct *lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpXmdropproccallbackFc);
-void setXmdropproccallbackFields(JNIEnv *env, jobject lpObject, XmDropProcCallbackStruct *lpXmdropproccallback, PXMDROPPROCCALLBACK_FID_CACHE lpXmdropproccallbackFc);
-void getXmdropfinishcallbackFields(JNIEnv *env, jobject lpObject, XmDropFinishCallbackStruct *lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpXmdropfinishcallbackFc);
-void setXmdropfinishcallbackFields(JNIEnv *env, jobject lpObject, XmDropFinishCallbackStruct *lpXmdropfinishcallback, PXMDROPFINISHCALLBACK_FID_CACHE lpXmdropfinishcallbackFc);
-void getXmtextblockrecFields(JNIEnv *env, jobject lpObject, XmTextBlockRec *lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpXmtextblockrecFc);
-void setXmtextblockrecFields(JNIEnv *env, jobject lpObject, XmTextBlockRec *lpXmtextblockrec, PXMTEXTBLOCKREC_FID_CACHE lpXmtextblockrecFc);
-void getXmtextverifycallbackstructFields(JNIEnv *env, jobject lpObject, XmTextVerifyCallbackStruct *lpXmtextverifycallbackstruct, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpXmtextverifycallbackstructFc);
-void setXmtextverifycallbackstructFields(JNIEnv *env, jobject lpObject, XmTextVerifyCallbackStruct *lpXmtextverifycallbackstruct, PXMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE lpXmtextverifycallbackstructFc);
-void getXrectangleFields(JNIEnv *env, jobject lpObject, XRectangle *lpXrect, PXRECTANGLE_FID_CACHE lpXrectFc);
-void setXrectangleFields(JNIEnv *env, jobject lpObject, XRectangle *lpXrect, PXRECTANGLE_FID_CACHE lpXrectFc);
-void getXsetwindowattributesFields(JNIEnv *env, jobject lpObject, XSetWindowAttributes *lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpXsetwindowattributesFc);
-void setXsetwindowattributesFields(JNIEnv *env, jobject lpObject, XSetWindowAttributes *lpXsetwindowattributes, PXSETWINDOWATTRIBUTES_FID_CACHE lpXsetwindowattributesFc);
-void getXwindowattributesFields(JNIEnv *env, jobject lpObject, XWindowAttributes *lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpXwindowattributesFc);
-void setXwindowattributesFields(JNIEnv *env, jobject lpObject, XWindowAttributes *lpXwindowattributes, PXWINDOWATTRIBUTES_FID_CACHE lpXwindowattributesFc);
-void getXwindowchangesFields(JNIEnv *env, jobject lpObject, XWindowChanges *lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpXwindowchangesFc);
-void setXwindowchangesFields(JNIEnv *env, jobject lpObject, XWindowChanges *lpXwindowchanges, PXWINDOWCHANGES_FID_CACHE lpXwindowchangesFc);
-void getXtwidgetgeometryFields(JNIEnv *env, jobject lpObject, XtWidgetGeometry *lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpXtwidgetgeometryFc);
-void setXtwidgetgeometryFields(JNIEnv *env, jobject lpObject, XtWidgetGeometry *lpXtwidgetgeometry, PXTWIDGETGEOMETRY_FID_CACHE lpXtwidgetgeometryFc);
-
-extern VISUAL_FID_CACHE VisualFc;
-extern XANYEVENT_FID_CACHE XanyeventFc;
-extern XBUTTONEVENT_FID_CACHE XbuttoneventFc;
-extern XCHARSTRUCT_FID_CACHE XcharstructFc;
-extern XCOLOR_FID_CACHE XcolorFc;
-extern XCONFIGUREEVENT_FID_CACHE XconfigureeventFc;
-extern XCROSSINGEVENT_FID_CACHE XcrossingeventFc;
-extern XEXPOSEEVENT_FID_CACHE XexposeeventFc;
-extern XFOCUSCHANGEEVENT_FID_CACHE XfocuschangeeventFc;
-extern XFONTSTRUCT_FID_CACHE XfontstructFc;
-extern XGCVALUES_FID_CACHE XgcvaluesFc;
-extern XIMAGE_FID_CACHE XimageFc;
-extern XKEYEVENT_FID_CACHE XkeyeventFc;
-extern XMANYCALLBACKSTRUCT_FID_CACHE XmanycallbackstructFc;
-extern XMDRAGPROCCALLBACK_FID_CACHE XmdragproccallbackFc;
-extern XMDROPFINISHCALLBACK_FID_CACHE XmdropfinishcallbackFc;
-extern XMDROPPROCCALLBACK_FID_CACHE XmdropproccallbackFc;
-extern XMOTIONEVENT_FID_CACHE XmotioneventFc;
-extern XMTEXTBLOCKREC_FID_CACHE XmtextblockrecFc;
-extern XMTEXTVERIFYCALLBACKSTRUCT_FID_CACHE XmtextverifycallbackstructFc;
-extern XRECTANGLE_FID_CACHE XrectangleFc;
-extern XSETWINDOWATTRIBUTES_FID_CACHE XsetwindowattributesFc;
-extern XTWIDGETGEOMETRY_FID_CACHE XtwidgetgeometryFc;
-extern XWINDOWATTRIBUTES_FID_CACHE XwindowattributesFc;
-extern XWINDOWCHANGES_FID_CACHE XwindowchangesFc;
-
-#endif /* INC_structs_H */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/swt.c
deleted file mode 100644
index ea47c7e87d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/swt.c
+++ /dev/null
@@ -1,8854 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT OS natives implementation.
- */
-
-/* #define PRINT_FAILED_RCODES */
-#define NDEBUG
-
-#include "swt.h"
-#include "structs.h"
-
-#include <stdio.h>
-#include <assert.h>
-#include <langinfo.h>
-#include <iconv.h>
-#include <stdlib.h>
-
-static int RESOURCES_START;
-static int RESOURCES_END;
-
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_getSharedLibraryMajorVersionNumber
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "getSharedLibraryMajorVersionNumber\n");
-#endif
- return SWT_VERSION / 1000;
-}
-
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_getSharedLibraryMinorVersionNumber
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "getSharedLibraryMinorVersionNumber\n");
-#endif
- return SWT_VERSION % 1000;
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_setResourceMem
- (JNIEnv *env, jclass that, jint start, jint end)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "setResourceMem\n");
-#endif
- RESOURCES_START = start;
- RESOURCES_END = end;
-}
-
-/*************************************************************************
-
- Name : sleep_ms( unsigned int nmsecs)
-
- Purpose : sleep for a given number of milli seconds
- Parms : the number of milli seconds to sleep
- Returns :
-
-*************************************************************************/
-/*
-void sleep_ms( unsigned int nmsecs)
-{
- struct timeval tval;
- tval.tv_sec = (nmsecs * 1000) / 1000000;
- tval.tv_usec = (nmsecs * 1000) % 1000000;
- select(0, NULL, NULL, NULL, &tval);
-}
-*/
-
-/* ------------------------------------- */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XInitThreads
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XInitThreads
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XInitThreads\n");
-#endif
-
- return (jint) XInitThreads();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: OverrideShellWidgetClass
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_OverrideShellWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OverrideShellWidgetClass\n");
-#endif
- return (jint) (overrideShellWidgetClass);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: ShellWidgetClass
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_ShellWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "ShellWidgetClass\n");
-#endif
- return (jint) (shellWidgetClass);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_TopLevelShellWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "TopLevelShellWidgetClass\n");
-#endif
- return (jint) (topLevelShellWidgetClass);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: TransientShellWidgetClass
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_TransientShellWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "TransientShellWidgetClass\n");
-#endif
-
- return (jint) (transientShellWidgetClass);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/motif/XButtonEvent;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__ILorg_eclipse_swt_internal_motif_XButtonEvent_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *src1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_motif_XButtonEvent_2I\n");
-#endif
- if (src) {
- src1=&xEvent;
- cacheXbuttoneventFids(env, src, &PGLOB(XbuttoneventFc));
- getXbuttoneventFields(env, src, src1, &PGLOB(XbuttoneventFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/motif/XImage;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__ILorg_eclipse_swt_internal_motif_XImage_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XImage image, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_motif_XImage_2I\n");
-#endif
-
- if (src) {
- src1=&image;
- cacheXimageFids(env, src, &PGLOB(XimageFc));
- getXimageFields(env, src, src1, &PGLOB(XimageFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/motif/XmTextBlockRec;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__ILorg_eclipse_swt_internal_motif_XmTextBlockRec_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XmTextBlockRec xmtextblockrec, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_motif_XmTextBlockRec_2I\n");
-#endif
-
- if (src) {
- src1=&xmtextblockrec;
- cacheXmtextblockrecFids(env, src, &PGLOB(XmtextblockrecFc));
- getXmtextblockrecFields(env, src, src1, &PGLOB(XmtextblockrecFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__ILorg_eclipse_swt_internal_motif_XmTextVerifyCallbackStruct_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XmTextVerifyCallbackStruct xmtextverifycallbackstruct, *src1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_motif_XmTextVerifyCallbackStruct_2I\n");
-#endif
-
- if (src) {
- src1=&xmtextverifycallbackstruct;
- cacheXmtextverifycallbackstructFids(env, src, &PGLOB(XmtextverifycallbackstructFc));
- getXmtextverifycallbackstructFields(env, src, src1, &PGLOB(XmtextverifycallbackstructFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__I_3BI
- (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
-{
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3BI\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetByteArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__I_3CI
- (JNIEnv *env, jclass that, jint dest, jcharArray src, jint count)
-{
- jchar *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3CI\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetCharArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseCharArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__I_3II
- (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
-{
- jint *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3II\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetIntArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseIntArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/Visual;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_Visual_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- Visual visual, *lpxVisual=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_Visual_2II\n");
-#endif
-
- memmove((void *)&visual, (void *)src, count);
- if (dest) {
- lpxVisual=&visual;
- cacheVisualFids(env, dest, &PGLOB(VisualFc));
- setVisualFields(env, dest, lpxVisual, &PGLOB(VisualFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XButtonEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XButtonEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XButtonEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXbuttoneventFids(env, dest, &PGLOB(XbuttoneventFc));
- setXbuttoneventFields(env, dest, lpxEvent, &PGLOB(XbuttoneventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XCharStruct;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XCharStruct_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XCharStruct xCharstruct, *lpxCharstruct=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XCharStruct_2II\n");
-#endif
-
- memmove((void *)&xCharstruct, (void *)src, count);
- if (dest) {
- lpxCharstruct=&xCharstruct;
- cacheXcharstructFids(env, dest, &PGLOB(XcharstructFc));
- setXcharstructFields(env, dest, lpxCharstruct, &PGLOB(XcharstructFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XConfigureEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XConfigureEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XConfigureEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXconfigureeventFids(env, dest, &PGLOB(XconfigureeventFc));
- setXconfigureeventFields(env, dest, lpxEvent, &PGLOB(XconfigureeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XCrossingEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XCrossingEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XCrossingEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXcrossingeventFids(env, dest, &PGLOB(XcrossingeventFc));
- setXcrossingeventFields(env, dest, lpxEvent, &PGLOB(XcrossingeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XExposeEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XExposeEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XExposeEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXexposeeventFids(env, dest, &PGLOB(XexposeeventFc));
- setXexposeeventFields(env, dest, lpxEvent, &PGLOB(XexposeeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XFocusChangeEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XFocusChangeEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XFocusChangeEvent_2II\n");
-#endif
-
- assert(count <= sizeof(XEvent));
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXfocuschangeeventFids(env, dest, &PGLOB(XfocuschangeeventFc));
- setXfocuschangeeventFields(env, dest, lpxEvent, &PGLOB(XfocuschangeeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XFontStruct;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XFontStruct_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XFontStruct fontStruct, *lpxFontStruct=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XFontStruct_2II\n");
-#endif
-
- memmove((void *)&fontStruct, (void *)src, count);
- if (dest) {
- lpxFontStruct=&fontStruct;
- cacheXfontstructFids(env, dest, &PGLOB(XfontstructFc));
- setXfontstructFields(env, dest, lpxFontStruct, &PGLOB(XfontstructFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XImage;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XImage_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XImage image, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XImage_2II\n");
-#endif
-
- memmove((void *)&image, (void *)src, count);
- if (dest) {
- dest1=&image;
- cacheXimageFids(env, dest, &PGLOB(XimageFc));
- setXimageFields(env, dest, dest1, &PGLOB(XimageFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XKeyEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XKeyEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XKeyEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXkeyeventFids(env, dest, &PGLOB(XkeyeventFc));
- setXkeyeventFields(env, dest, lpxEvent, &PGLOB(XkeyeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XKeyEvent;Lorg/eclipse/swt/internal/motif/XAnyEvent;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XKeyEvent_2Lorg_eclipse_swt_internal_motif_XAnyEvent_2I
- (JNIEnv *env, jclass that, jobject dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent1, *src1=NULL, xEvent2, *dest1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XKeyEvent_2Lorg_eclipse_swt_internal_motif_XAnyEvent_2I\n");
-#endif
- if (src) {
- src1=&xEvent1;
- cacheXanyeventFids(env, src, &PGLOB(XanyeventFc));
- getXanyeventFields(env, src, src1, &PGLOB(XanyeventFc));
- }
-
- memmove((void *)&xEvent2, (void *)src1, count);
- if (dest) {
- dest1=&xEvent2;
- cacheXkeyeventFids(env, dest, &PGLOB(XkeyeventFc));
- setXkeyeventFields(env, dest, dest1, &PGLOB(XkeyeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XMotionEvent;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XMotionEvent_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XMotionEvent_2II\n");
-#endif
-
- memmove((void *)&xEvent, (void *)src, count);
- if (dest) {
- lpxEvent=&xEvent;
- cacheXmotioneventFids(env, dest, &PGLOB(XmotioneventFc));
- setXmotioneventFields(env, dest, lpxEvent, &PGLOB(XmotioneventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmAnyCallbackStruct;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmAnyCallbackStruct_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmAnyCallbackStruct xmanycallbackstruct, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmAnyCallbackStruct_2II\n");
-#endif
-
- memmove((void *)&xmanycallbackstruct, (void *)src, count);
- if (dest) {
- dest1=&xmanycallbackstruct;
- cacheXmanycallbackstructFids(env, dest, &PGLOB(XmanycallbackstructFc));
- setXmanycallbackstructFields(env, dest, dest1, &PGLOB(XmanycallbackstructFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/motif/XmDragProcCallback;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__ILorg_eclipse_swt_internal_motif_XmDragProcCallback_2I
- (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- XmDragProcCallbackStruct xmdragproccallback, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_motif_XmDragProcCallback_2I\n");
-#endif
-
- if (src) {
- src1=&xmdragproccallback;
- cacheXmdragproccallbackFids(env, src, &PGLOB(XmdragproccallbackFc));
- getXmdragproccallbackFields(env, src, src1, &PGLOB(XmdragproccallbackFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmDragProcCallback;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmDragProcCallback_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmDragProcCallbackStruct xmdragproccallback, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmDragProcCallback_2II\n");
-#endif
-
- memmove((void *)&xmdragproccallback, (void *)src, count);
- if (dest) {
- dest1=&xmdragproccallback;
- cacheXmdragproccallbackFids(env, dest, &PGLOB(XmdragproccallbackFc));
- setXmdragproccallbackFields(env, dest, dest1, &PGLOB(XmdragproccallbackFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmDropProcCallback;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmDropProcCallback_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmDropProcCallbackStruct xmdropproccallback, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmDropProcCallback_2II\n");
-#endif
-
- memmove((void *)&xmdropproccallback, (void *)src, count);
- if (dest) {
- dest1=&xmdropproccallback;
- cacheXmdropproccallbackFids(env, dest, &PGLOB(XmdropproccallbackFc));
- setXmdropproccallbackFields(env, dest, dest1, &PGLOB(XmdropproccallbackFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmDropFinishCallback;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmDropFinishCallback_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmDropFinishCallbackStruct xmdropfinishcallback, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmDropFinishCallback_2II\n");
-#endif
-
- memmove((void *)&xmdropfinishcallback, (void *)src, count);
- if (dest) {
- dest1=&xmdropfinishcallback;
- cacheXmdropfinishcallbackFids(env, dest, &PGLOB(XmdropfinishcallbackFc));
- setXmdropfinishcallbackFields(env, dest, dest1, &PGLOB(XmdropfinishcallbackFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmTextBlockRec;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmTextBlockRec_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmTextBlockRec xmTextBlockRec, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmTextBlockRec_2II\n");
-#endif
-
- memmove((void *)&xmTextBlockRec, (void *)src, count);
- if (dest) {
- dest1=&xmTextBlockRec;
- cacheXmtextblockrecFids(env, dest, &PGLOB(XmtextblockrecFc));
- setXmtextblockrecFields(env, dest, dest1, &PGLOB(XmtextblockrecFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__Lorg_eclipse_swt_internal_motif_XmTextVerifyCallbackStruct_2II
- (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- XmTextVerifyCallbackStruct xmtextverifycallbackstruct, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_motif_XmTextVerifyCallbackStruct_2II\n");
-#endif
-
- memmove((void *)&xmtextverifycallbackstruct, (void *)src, count);
- if (dest) {
- dest1=&xmtextverifycallbackstruct;
- cacheXmtextverifycallbackstructFids(env, dest, &PGLOB(XmtextverifycallbackstructFc));
- setXmtextverifycallbackstructFields(env, dest, dest1, &PGLOB(XmtextverifycallbackstructFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: ([BII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove___3BII
- (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
-{
- jbyte *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BII\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove___3CII
- (JNIEnv *env, jclass that, jcharArray dest, jint src, jint count)
-{
- jchar *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3CII\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetCharArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseCharArrayElements(env, dest, dest1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: ([III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove___3III
- (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
-{
- jint *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3III\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- }
-}
-
-/* end of custom built crap */
-
-/* ------------------------------------------------------------------------- */
-
-/* the following map directly to X calls */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XAllocColor
- * Signature: (IILorg/eclipse/swt/internal/motif/XColor;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XAllocColor
- (JNIEnv *env, jclass that, jint display, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- XColor xColor, *lpColor=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XAllocColor\n");
-#endif
-
- assert (color != 0);
- if (color) {
- lpColor = &xColor;
- cacheXcolorFids(env, color, &PGLOB(XcolorFc));
- getXcolorFields(env, color, lpColor, &PGLOB(XcolorFc));
- }
- rc = (jint) XAllocColor ((Display *)display, colormap, lpColor);
-
-#ifdef PRINT_FAILED_RCODES
-
- if (rc == 0)
- fprintf(stderr, "XAllocColor: call failed rc = %d\n", rc);
-#endif
-
- if (color) {
- setXcolorFields(env, color, lpColor, &PGLOB(XcolorFc));
- }
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XBell
- * Signature: (II)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XBell
- (JNIEnv *env, jclass that, jint display, jint ms)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XBell\n");
-#endif
- XBell ((Display *)display, ms);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XBitmapBitOrder
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XBitmapBitOrder
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XBitmapBitOrder\n");
-#endif
- return (jint) XBitmapBitOrder((Display *) display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XBlackPixel
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XBlackPixel
- (JNIEnv *env, jclass that, jint display, jint screen_number)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XBlackPixel\n");
-#endif
- return (jint) XBlackPixel((Display *)display, screen_number);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XChangeGC
- * Signature: (IIILorg/eclipse/swt/internal/motif/XGCValues;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XChangeGC
- (JNIEnv *env, jclass that, jint display, jint gc, jint valuemask, jobject values)
-{
- DECL_GLOB(pGlob)
- XGCValues xgcValues, *lpxgcValues=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XChangeGC\n");
-#endif
-
- if (values) {
- lpxgcValues = &xgcValues;
- cacheXgcvaluesFids(env, values, &PGLOB(XgcvaluesFc));
- getXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- rc = (jint) XChangeGC((Display *)display, (GC)gc, valuemask, lpxgcValues);
-
- if (values) {
- setXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XChangeWindowAttributes
- * Signature: (IIILorg/eclipse/swt/internal/motif/XSetWindowAttributes;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XChangeWindowAttributes
- (JNIEnv *env, jclass that, jint display, jint window, jint mask, jobject attributes)
-{
- DECL_GLOB(pGlob)
- XSetWindowAttributes xSetWindowAttributes, *lpxSetWindowAttributes;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XChangeWindowAttributes\n");
-#endif
-
- if (attributes) {
- lpxSetWindowAttributes = &xSetWindowAttributes;
- cacheXsetwindowattributesFids(env, attributes, &PGLOB(XsetwindowattributesFc));
- getXsetwindowattributesFields(env, attributes, lpxSetWindowAttributes, &PGLOB(XsetwindowattributesFc));
- }
-
- XChangeWindowAttributes((Display *)display, window, mask, lpxSetWindowAttributes);
- if (attributes) {
- setXsetwindowattributesFields(env, attributes, lpxSetWindowAttributes, &PGLOB(XsetwindowattributesFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCheckMaskEvent
- * Signature: (IILorg/eclipse/swt/internal/motif/XAnyEvent;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XCheckMaskEvent
- (JNIEnv *env, jclass that, jint display, jint mask, jobject event)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCheckMaskEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- rc = (jboolean) XCheckMaskEvent((Display *)display, mask, lpxEvent);
-
-#ifdef PRINT_FAILED_RCODES
-
- if (rc != True && rc != False)
- fprintf(stderr, "XCheckMaskEvent: call failed rc = %d\n", rc);
-#endif
-
- if (event) {
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCheckWindowEvent
- * Signature: (IIILorg/eclipse/swt/internal/motif/XAnyEvent;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XCheckWindowEvent
- (JNIEnv *env, jclass that, jint display, jint window, jint mask, jobject event)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCheckWindowEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- rc = (jboolean)XCheckWindowEvent((Display *)display, window, mask, lpxEvent);
-
-#ifdef PRINT_FAILED_RCODES
-
- if (rc != True && rc != False)
- fprintf(stderr, "XCheckWindowEvent: call failed rc = %d\n", rc);
-#endif
-
- if (event) {
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XClearArea
- * Signature: (IIIIIIZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XClearArea
- (JNIEnv *env, jclass that, jint display, jint window, jint x, jint y, jint width, jint height, jboolean exposures)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XClearArea\n");
-#endif
- XClearArea((Display *)display, window, x, y, width, height, exposures);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XClipBox
- * Signature: (ILorg/eclipse/swt/internal/motif/XRectangle;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XClipBox
- (JNIEnv *env, jclass that, jint region, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XClipBox\n");
-#endif
-
- if (rectangle) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, rectangle, &PGLOB(XrectangleFc));
- getXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- XClipBox((Region)region, (XRectangle *)lpxRect);
- if (rectangle) {
- setXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCopyArea
- * Signature: (IIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XCopyArea
- (JNIEnv *env, jclass that, jint display, jint src, jint dest, jint gc, jint src_x, jint src_y, jint width, jint height, jint dest_x, jint dest_y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCopyArea\n");
-#endif
- XCopyArea((Display *)display, src, dest, (GC)gc, src_x, src_y, width, height, dest_x, dest_y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCopyPlane
- * Signature: (IIIIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XCopyPlane
- (JNIEnv *env, jclass that, jint display, jint src, jint dest, jint gc, jint src_x, jint src_y, jint width, jint height, jint dest_x, jint dest_y, jint plane)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCopyPlane\n");
-#endif
- XCopyPlane((Display *)display, src, dest, (GC)gc, src_x, src_y, width, height, dest_x, dest_y, plane);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateBitmapFromData
- * Signature: (II[BII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateBitmapFromData
- (JNIEnv *env, jclass that, jint display, jint drawable, jbyteArray data, jint width, jint height)
-{
- jbyte *data1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateBitmapFromData\n");
-#endif
-
- if (data)
- data1 = (*env)->GetByteArrayElements(env, data, NULL);
-
- rc = (jint) XCreateBitmapFromData((Display *)display, drawable, (char *)data1, width, height);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XCreateBitmapFromData: call failed rc = %d\n", rc);
-#endif
-
- if (data)
- (*env)->ReleaseByteArrayElements(env, data, data1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateFontCursor
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateFontCursor
- (JNIEnv *env, jclass that, jint display, jint shape)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateFontCursor\n");
-#endif
- return (jint) XCreateFontCursor((Display *)display, shape);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateGC
- * Signature: (IIILorg/eclipse/swt/internal/motif/XGCValues;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateGC
- (JNIEnv *env, jclass that, jint display, jint window, jint mask, jobject values)
-{
- DECL_GLOB(pGlob)
- XGCValues xgcValues, *lpxgcValues=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateGC\n");
-#endif
-
- if (values) {
- lpxgcValues = &xgcValues;
- cacheXgcvaluesFids(env, values, &PGLOB(XgcvaluesFc));
- getXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- rc = (jint) XCreateGC((Display *)display, window, mask, lpxgcValues);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XCreateGC: call failed rc = %d\n", rc);
-#endif
-
- if (values) {
- setXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateImage
- * Signature: (IIIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateImage
- (JNIEnv *env, jclass that, jint display, jint visual, jint depth, jint format, jint offset, jint data, jint width, jint height, jint bitmap_pad, jint bytes_per_line)
-{
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateImage\n");
-#endif
-
- rc = (jint) XCreateImage((Display *)display, (Visual *)visual, depth, format, offset, (char *)data, width, height, bitmap_pad, bytes_per_line);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XCreateImage: call failed rc = %d\n", rc);
-#endif
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreatePixmap
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreatePixmap
- (JNIEnv *env, jclass that, jint display, jint drawable, jint width, jint height, jint depth)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreatePixmap\n");
-#endif
- return (jint) XCreatePixmap((Display *)display, drawable, width, height, depth);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreatePixmapCursor
- * Signature: (IIILorg/eclipse/swt/internal/motif/XColor;Lorg/eclipse/swt/internal/motif/XColor;II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreatePixmapCursor
- (JNIEnv *env, jclass that, jint display, jint source, jint mask, jobject foreground_color, jobject background_color, jint x, jint y)
-{
- DECL_GLOB(pGlob)
- XColor background_color1, foreground_color1;
- XColor *lp_background_color = NULL, *lp_foreground_color = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreatePixmapCursor\n");
-#endif
-
- assert(foreground_color != 0);
- if (foreground_color) {
- lp_foreground_color = &foreground_color1;
- cacheXcolorFids(env, foreground_color, &PGLOB(XcolorFc));
- getXcolorFields(env, foreground_color, lp_foreground_color, &PGLOB(XcolorFc));
- }
- if (background_color) {
- lp_background_color = &background_color1;
- cacheXcolorFids(env, background_color, &PGLOB(XcolorFc));
- getXcolorFields(env, background_color, lp_background_color, &PGLOB(XcolorFc));
- }
-
- return (jint) XCreatePixmapCursor((Display *)display, (Pixmap)source, (Pixmap)mask, lp_foreground_color, lp_background_color, x, y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateRegion
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateRegion
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateRegion\n");
-#endif
- return (jint) XCreateRegion();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultColormap
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultColormap
- (JNIEnv *env, jclass that, jint display, jint screen_number)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultColormap\n");
-#endif
- return (jint) XDefaultColormap((Display *)display, screen_number);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultDepthOfScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultDepthOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultDepthOfScreen\n");
-#endif
- return (jint) XDefaultDepthOfScreen((Screen *)screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultRootWindow
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultRootWindow
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultRootWindow\n");
-#endif
- return (jint) XDefaultRootWindow((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultScreen
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultScreen\n");
-#endif
- return (jint) XDefaultScreen((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultScreenOfDisplay
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultScreenOfDisplay
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultScreenOfDisplay\n");
-#endif
- return (jint) XDefaultScreenOfDisplay((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultVisual
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultVisual
- (JNIEnv *env, jclass that, jint display, jint screen_number)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultVisual\n");
-#endif
- return (jint) XDefaultVisual((Display *)display, screen_number);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefineCursor
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefineCursor
- (JNIEnv *env, jclass that, jint display, jint window, jint cursor)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefineCursor\n");
-#endif
- XDefineCursor((Display *)display, window, cursor);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDestroyImage
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDestroyImage
- (JNIEnv *env, jclass that, jint ximage)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDestroyImage\n");
-#endif
- return (jint) XDestroyImage((XImage *)ximage);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDestroyRegion
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDestroyRegion
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDestroyRegion\n");
-#endif
- XDestroyRegion((Region)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDisplayHeight
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDisplayHeight
- (JNIEnv *env, jclass that, jint display, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDisplayHeight\n");
-#endif
- return (jint) XDisplayHeight((Display *)display, screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDisplayHeightMM
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDisplayHeightMM
- (JNIEnv *env, jclass that, jint display, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDisplayHeightMM\n");
-#endif
- return (jint) XDisplayHeightMM((Display *)display, screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDisplayWidth
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDisplayWidth
- (JNIEnv *env, jclass that, jint display, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDisplayWidth\n");
-#endif
- return (jint) XDisplayWidth((Display *)display, screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDisplayWidthMM
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDisplayWidthMM
- (JNIEnv *env, jclass that, jint display, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDisplayWidthMM\n");
-#endif
- return (jint) XDisplayWidthMM((Display *)display, screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDrawArc
- * Signature: (IIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDrawArc
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2, jint a1, jint a2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDrawArc\n");
-#endif
- XDrawArc((Display *)display, drawable, (GC)gc, x1, y1, x2, y2, a1, a2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDrawLine
- * Signature: (IIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDrawLine
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDrawLine\n");
-#endif
- XDrawLine((Display *)display, drawable, (GC)gc, x1, y1, x2, y2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDrawLines
- * Signature: (III[SII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDrawLines
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jshortArray xPoints, jint nPoints, jint mode)
-{
- jshort *xPoints1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDrawLines\n");
-#endif
-
- if (xPoints)
- xPoints1 = (*env)->GetShortArrayElements(env, xPoints, NULL);
- XDrawLines((Display *)display, drawable, (GC)gc, (XPoint *)xPoints1, nPoints, mode);
- if (xPoints)
- (*env)->ReleaseShortArrayElements(env, xPoints, xPoints1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDrawRectangle
- * Signature: (IIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDrawRectangle
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "\n");
-#endif
- XDrawRectangle((Display *)display, drawable, (GC)gc, x, y, width, height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XEmptyRegion
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XEmptyRegion
- (JNIEnv *env, jclass that, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XEmptyRegion\n");
-#endif
- return (jboolean) XEmptyRegion((Region)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XEqualRegion
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XEqualRegion
- (JNIEnv *env, jclass that, jint region1, jint region2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XEqualRegion\n");
-#endif
- return (jboolean) XEqualRegion((Region)region1, (Region)region2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFillArc
- * Signature: (IIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFillArc
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2, jint a1, jint a2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFillArc\n");
-#endif
- XFillArc((Display *)display, drawable, (GC)gc, x1, y1, x2, y2, a1, a2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFillPolygon
- * Signature: (III[SIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XFillPolygon
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jshortArray xPoints, jint nPoints, jint mode, jint style)
-{
- jshort *xPoints1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFillPolygon\n");
-#endif
- if (xPoints)
- xPoints1 = (*env)->GetShortArrayElements(env, xPoints, NULL);
- rc = XFillPolygon((Display *)display, drawable, (GC)gc, (XPoint *)xPoints1, nPoints, mode, style);
- if (xPoints)
- (*env)->ReleaseShortArrayElements(env, xPoints, xPoints1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFillRectangle
- * Signature: (IIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFillRectangle
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFillRectangle\n");
-#endif
- XFillRectangle((Display *)display, drawable, (GC)gc, x, y, width, height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFilterEvent
- * Signature: (Lorg/eclipse/swt/internal/motif/XAnyEvent;I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XFilterEvent
- (JNIEnv *env, jclass that, jobject event, jint window)
-{
- DECL_GLOB(pGlob)
- XEvent xanyevent, *event1;
- jboolean rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFilterEvent\n");
-#endif
- if (event) {
- event1=&xanyevent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, event1, &PGLOB(XanyeventFc));
- }
- rc = (jboolean) XFilterEvent(event1, (Window)window);
- if (event) {
- setXanyeventFields(env, event, event1, &PGLOB(XanyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFlush
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFlush
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFlush\n");
-#endif
- XFlush((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFontsOfFontSet
- * Signature: (I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XFontsOfFontSet
- (JNIEnv *env, jclass that, jint fontSet, jintArray fontStructs, jintArray fontNames)
-{
- jint *fontStructs1=NULL,*fontNames1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFontsOfFontSet\n");
-#endif
- if (fontStructs)
- fontStructs1 = (*env)->GetIntArrayElements(env, fontStructs, NULL);
- if (fontNames)
- fontNames1 = (*env)->GetIntArrayElements(env, fontNames, NULL);
-
- rc = (jint) XFontsOfFontSet((XFontSet)fontSet, (XFontStruct ***)fontStructs1, (char ***)fontNames1);
-
- if (fontStructs)
- (*env)->ReleaseIntArrayElements(env, fontStructs, fontStructs1, 0);
- if (fontNames)
- (*env)->ReleaseIntArrayElements(env, fontNames, fontNames1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFree
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XFree
- (JNIEnv *env, jclass that, jint address)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFree\n");
-#endif
- return (jint) XFree((char *)address);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeColors
- * Signature: (II[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeColors
- (JNIEnv *env, jclass that, jint display, jint colormap, jintArray pixels, jint npixels, jint planes)
-{
- jint *pixels1=NULL;
- jint rc;
- jint intArr[2]={250, 250};
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreeColors\n");
-#endif
-
- assert(pixels != 0);
- assert(npixels > 0);
- assert(npixels < 20);
-
- if (pixels) {
- pixels1 = (jint *)&intArr;
- (*env)->GetIntArrayRegion(env, pixels, 0, npixels, pixels1);
- }
-
- assert(*pixels1 >= 0);
- assert(*pixels1 < 65536);
- assert(*(pixels1+1) >= 0);
- assert(*(pixels1+1) < 65536);
-
- rc = (jint) XFreeColors((Display *)display, colormap, (unsigned long *)pixels1, npixels, planes);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XCreateGC: call failed rc = %d\n", rc);
-#endif
-
- assert(rc > 0);
-
- if (pixels) {
- (*env)->SetIntArrayRegion(env, pixels, 0, npixels, pixels1);
- }
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeCursor
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeCursor
- (JNIEnv *env, jclass that, jint display, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreeCursor\n");
-#endif
- XFreeCursor((Display *)display, pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeFont
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeFont
- (JNIEnv *env, jclass that, jint display, jint font_struct)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreeFont\n");
-#endif
- XFreeFont((Display *)display, (XFontStruct *)font_struct);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeFontSet
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeFontSet
- (JNIEnv *env, jclass that, jint display, jint font_set)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreeFontSet\n");
-#endif
- XFreeFontSet((Display *)display, (XFontSet)font_set);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeFontNames
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeFontNames
- (JNIEnv *env, jclass that, jint list)
-{
- XFreeFontNames((char **)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreeGC
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeGC
- (JNIEnv *env, jclass that, jint display, jint gc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreeGC\n");
-#endif
- XFreeGC((Display *)display, (GC)gc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XFreePixmap
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreePixmap
- (JNIEnv *env, jclass that, jint display, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XFreePixmap\n");
-#endif
- XFreePixmap((Display *)display, pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetGCValues
- * Signature: (IIILorg/eclipse/swt/internal/motif/XGCValues;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetGCValues
- (JNIEnv *env, jclass that, jint display, jint gc, jint valuemask, jobject values)
-{
- DECL_GLOB(pGlob)
- XGCValues xgcValues, *lpxgcValues=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetGCValues\n");
-#endif
-
- if (values) {
- lpxgcValues = &xgcValues;
- cacheXgcvaluesFids(env, values, &PGLOB(XgcvaluesFc));
- getXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- rc = (jint) XGetGCValues((Display *)display, (GC)gc, valuemask, lpxgcValues);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XGetGCValues: call failed rc = %d\n", rc);
-#endif
-
- if (values) {
- setXgcvaluesFields(env, values, lpxgcValues, &PGLOB(XgcvaluesFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetGeometry
- * Signature: (II[I[I[I[I[I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetGeometry
- (JNIEnv *env, jclass that, jint display, jint drawable, jintArray root_return, jintArray x_return, jintArray y_return, jintArray width_return, jintArray height_return, jintArray border_width_return, jintArray depth_return)
-{
- jint *root_return1=NULL, *x_return1=NULL, *y_return1=NULL, *width_return1=NULL, *height_return1=NULL, *border_width_return1=NULL, *depth_return1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetGeometry\n");
-#endif
-
- if (root_return)
- root_return1 = (*env)->GetIntArrayElements(env, root_return, NULL);
- if (x_return)
- x_return1 = (*env)->GetIntArrayElements(env, x_return, NULL);
- if (y_return)
- y_return1 = (*env)->GetIntArrayElements(env, y_return, NULL);
- if (width_return)
- width_return1 = (*env)->GetIntArrayElements(env, width_return, NULL);
- if (height_return)
- height_return1 = (*env)->GetIntArrayElements(env, height_return, NULL);
- if (border_width_return)
- border_width_return1 = (*env)->GetIntArrayElements(env, border_width_return, NULL);
- if (depth_return)
- depth_return1 = (*env)->GetIntArrayElements(env, depth_return, NULL);
-
- rc = (jint) XGetGeometry((Display *)display, drawable, (Window *)root_return1, (int *)x_return1, (int *)y_return1, (unsigned int *)width_return1, (unsigned int *)height_return1, (unsigned int *)border_width_return1, (unsigned int *)depth_return1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XGetGeometry: call failed rc = %d\n", rc);
-#endif
-
- if (root_return)
- (*env)->ReleaseIntArrayElements(env, root_return, root_return1, 0);
- if (x_return)
- (*env)->ReleaseIntArrayElements(env, x_return, x_return1, 0);
- if (y_return)
- (*env)->ReleaseIntArrayElements(env, y_return, y_return1, 0);
- if (width_return)
- (*env)->ReleaseIntArrayElements(env, width_return, width_return1, 0);
- if (height_return)
- (*env)->ReleaseIntArrayElements(env, height_return, height_return1, 0);
- if (border_width_return)
- (*env)->ReleaseIntArrayElements(env, border_width_return, border_width_return1, 0);
- if (depth_return)
- (*env)->ReleaseIntArrayElements(env, depth_return, depth_return1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetImage
- * Signature: (IIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetImage
- (JNIEnv *env, jclass that, jint display, jint drawable, jint x, jint y, jint width, jint height, jint plane_mask, jint format)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetImage\n");
-#endif
- return (jint) XGetImage((Display *)display, (Drawable)drawable, x, y, width, height, plane_mask, format);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetInputFocus
- * Signature: (I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetInputFocus
- (JNIEnv *env, jclass that, jint display, jintArray window, jintArray revert)
-{
- jint *window1, *revert1;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetInputFocus\n");
-#endif
-
- if (window)
- window1 = (*env)->GetIntArrayElements(env, window, NULL);
- if (revert)
- revert1 = (*env)->GetIntArrayElements(env, revert, NULL);
- rc = (jint) XGetInputFocus((Display *)display, (Window *)window1, (int *)revert1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XGetInputFocus: call failed rc = %d\n", rc);
-#endif
-
- if (window)
- (*env)->ReleaseIntArrayElements(env, window, window1, 0);
- if (revert)
- (*env)->ReleaseIntArrayElements(env, revert, revert1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetWindowAttributes
- * Signature: (IILorg/eclipse/swt/internal/motif/XWindowAttributes;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetWindowAttributes
- (JNIEnv *env, jclass that, jint display, jint window, jobject attributes)
-{
- DECL_GLOB(pGlob)
- XWindowAttributes xWindowAttributes, *lpxWindowAttributes;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetWindowAttributes\n");
-#endif
-
- if (attributes) {
- lpxWindowAttributes = &xWindowAttributes;
- cacheXwindowattributesFids(env, attributes, &PGLOB(XwindowattributesFc));
- getXwindowattributesFields(env, attributes, lpxWindowAttributes, &PGLOB(XwindowattributesFc));
- }
-
- rc = (jboolean) XGetWindowAttributes((Display *)display, window, lpxWindowAttributes);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XGetWindowAttributes: call failed rc = %d\n", rc);
-#endif
-
- if (attributes) {
- setXwindowattributesFields(env, attributes, lpxWindowAttributes, &PGLOB(XwindowattributesFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGrabPointer
- * Signature: (IIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGrabPointer
- (JNIEnv *env, jclass that, jint display, jint grabWindow, jint ownerEvents, jint eventMask,
- jint PointerMode, jint KeyboardMode, jint confineToWindow, jint cursor, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGrabPointer\n");
-#endif
- return (jint) XGrabPointer((Display *)display, grabWindow, ownerEvents, eventMask, PointerMode,
- KeyboardMode, confineToWindow, cursor, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XInternAtom
- * Signature: (I[BZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XInternAtom
- (JNIEnv *env, jclass that, jint display, jbyteArray name, jboolean ifExists)
-{
- jbyte *name1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XInternAtom\n");
-#endif
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
-
- rc = (jint) XInternAtom((Display *)display, (char *)name1, ifExists);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XInternAtom: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XKeysymToString
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XKeysymToString
- (JNIEnv *env, jclass that, jint keysym)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XKeysymToString\n");
-#endif
- return (jint) XKeysymToString(keysym);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XListFonts
- * Signature: (I[BI[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XListFonts
- (JNIEnv *env, jclass that, jint display, jbyteArray pattern, jint maxnames, jintArray actual_count_return)
-{
- jbyte *pattern1 = NULL;
- jint *actual_count_return1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XListFonts\n");
-#endif
- if (pattern)
- pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
- if (actual_count_return)
- actual_count_return1 = (*env)->GetIntArrayElements(env, actual_count_return, NULL);
-
- rc = (jint) XListFonts((Display *)display, (char *)pattern1, maxnames, (int *)actual_count_return1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XListFonts: call failed rc = %d\n", rc);
-#endif
-
- if (pattern)
- (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
- if (actual_count_return)
- (*env)->ReleaseIntArrayElements(env, actual_count_return, actual_count_return1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XListProperties
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XListProperties
- (JNIEnv *env, jclass that, jint display, jint window, jintArray num_prop_return)
-{
- jint *num_prop_return1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XListProperties\n");
-#endif
- if (num_prop_return)
- num_prop_return1 = (*env)->GetIntArrayElements(env, num_prop_return, NULL);
-
- rc = (jint) XListProperties((Display *)display, (Window)window, (int *)num_prop_return1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XListProperties: call failed rc = %d\n", rc);
-#endif
-
- if (num_prop_return)
- (*env)->ReleaseIntArrayElements(env, num_prop_return, num_prop_return1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XLookupString
- * Signature: (Lorg/eclipse/swt/internal/motif/XKeyEvent;[BI[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XLookupString
- (JNIEnv *env, jclass that, jobject keyEvent, jbyteArray string, jint size, jintArray keysym, jintArray status)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jint *keysym1=NULL, *status1=NULL;
- jbyte *string1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XLookupString\n");
-#endif
-
- if (keyEvent) {
- lpxEvent = &xEvent;
- cacheXkeyeventFids(env, keyEvent, &PGLOB(XkeyeventFc));
- getXkeyeventFields(env, keyEvent, lpxEvent, &PGLOB(XkeyeventFc));
- }
-
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- if (keysym)
- keysym1 = (*env)->GetIntArrayElements(env, keysym, NULL);
- if (status)
- status1 = (*env)->GetIntArrayElements(env, status, NULL);
- rc = (jint) XLookupString((XKeyEvent *)lpxEvent, (char *)string1, size, (KeySym *)keysym1, (XComposeStatus *)status1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc < 0)
- fprintf(stderr, "XLookupString: call failed rc = %d\n", rc);
-#endif
-
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- if (keysym)
- (*env)->ReleaseIntArrayElements(env, keysym, keysym1, 0);
- if (status)
- (*env)->ReleaseIntArrayElements(env, status, status1, 0);
-
- if (keyEvent) {
- setXkeyeventFields(env, keyEvent, lpxEvent, &PGLOB(XkeyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XLowerWindow
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XLowerWindow
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XLowerWindow\n");
-#endif
- return (jint) XLowerWindow((Display *)display, window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XPointInRegion
- * Signature: (III)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XPointInRegion
- (JNIEnv *env, jclass that, jint region, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XPointInRegion\n");
-#endif
- return (jboolean) XPointInRegion((Region)region, x, y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XPutImage
- * Signature: (IIIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XPutImage
- (JNIEnv *env, jclass that, jint display, jint drawable, jint gc, jint image, jint srcX, jint srcY, jint destX, jint destY, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XPutImage\n");
-#endif
- return (jint) XPutImage((Display *)display, drawable, (GC)gc, (XImage *)image, srcX, srcY, destX, destY, width, height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XQueryColor
- * Signature: (IILorg/eclipse/swt/internal/motif/XColor;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XQueryColor
- (JNIEnv *env, jclass that, jint display, jint colormap, jobject color)
-{
- DECL_GLOB(pGlob)
- XColor xColor, *lpColor=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XQueryColor\n");
-#endif
-
- if (color) {
- lpColor = &xColor;
- cacheXcolorFids(env, color, &PGLOB(XcolorFc));
- getXcolorFields(env, color, lpColor, &PGLOB(XcolorFc));
- }
-
- rc = (jint) XQueryColor((Display *)display, colormap, lpColor);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XQueryColor: call failed rc = %d\n", rc);
-#endif
-
- if (color) {
- setXcolorFields(env, color, lpColor, &PGLOB(XcolorFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XQueryPointer
- * Signature: (II[I[I[I[I[I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XQueryPointer
- (JNIEnv *env, jclass that, jint display, jint window, jintArray root, jintArray child,
- jintArray rootX, jintArray rootY, jintArray windowX, jintArray windowY, jintArray mask)
-{
- jint *root1=NULL, *child1=NULL, *rootX1=NULL, *rootY1=NULL, *windowX1=NULL, *windowY1=NULL, *mask1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XQueryPointer\n");
-#endif
-
- if (root)
- root1 = (*env)->GetIntArrayElements(env, root, NULL);
- if (child)
- child1 = (*env)->GetIntArrayElements(env, child, NULL);
- if (rootX)
- rootX1 = (*env)->GetIntArrayElements(env, rootX, NULL);
- if (rootY)
- rootY1 = (*env)->GetIntArrayElements(env, rootY, NULL);
- if (windowX)
- windowX1 = (*env)->GetIntArrayElements(env, windowX, NULL);
- if (windowY)
- windowY1 = (*env)->GetIntArrayElements(env, windowY, NULL);
- if (mask)
- mask1 = (*env)->GetIntArrayElements(env, mask, NULL);
-
- rc = (jint) XQueryPointer((Display *)display, window, (Window *)root1, (Window *)child1, (int *)rootX1, (int *)rootY1, (int *)windowX1, (int *)windowY1, (unsigned int *)mask1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XQueryPointer: call failed rc = %d\n", rc);
-#endif
-
- if (root)
- (*env)->ReleaseIntArrayElements(env, root, root1, 0);
- if (child)
- (*env)->ReleaseIntArrayElements(env, child, child1, 0);
- if (rootX)
- (*env)->ReleaseIntArrayElements(env, rootX, rootX1, 0);
- if (rootY)
- (*env)->ReleaseIntArrayElements(env, rootY, rootY1, 0);
- if (windowX)
- (*env)->ReleaseIntArrayElements(env, windowX, windowX1, 0);
- if (windowY)
- (*env)->ReleaseIntArrayElements(env, windowY, windowY1, 0);
- if (mask)
- (*env)->ReleaseIntArrayElements(env, mask, mask1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XQueryTree
- * Signature: (II[I[I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XQueryTree
- (JNIEnv *env, jclass that, jint display, jint window, jintArray root_return, jintArray parent_return, jintArray children_return, jintArray nChildren_return)
-{
- jint *root_return1=NULL, *parent_return1=NULL, *children_return1=NULL, *nChildren_return1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XQueryTree\n");
-#endif
-
- if (root_return)
- root_return1 = (*env)->GetIntArrayElements(env, root_return, NULL);
- if (parent_return)
- parent_return1 = (*env)->GetIntArrayElements(env, parent_return, NULL);
- if (children_return)
- children_return1 = (*env)->GetIntArrayElements(env, children_return, NULL);
- if (nChildren_return)
- nChildren_return1 = (*env)->GetIntArrayElements(env, nChildren_return, NULL);
-
- rc = (jint) XQueryTree((Display *)display, window, (Window *)root_return1, (Window *)parent_return1, (Window **)children_return1, (unsigned int *)nChildren_return1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XQueryTree: call failed rc = %d\n", rc);
-#endif
-
- if (root_return)
- (*env)->ReleaseIntArrayElements(env, root_return, root_return1, 0);
- if (parent_return)
- (*env)->ReleaseIntArrayElements(env, parent_return, parent_return1, 0);
- if (children_return)
- (*env)->ReleaseIntArrayElements(env, children_return, children_return1, 0);
- if (nChildren_return)
- (*env)->ReleaseIntArrayElements(env, nChildren_return, nChildren_return1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XRaiseWindow
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XRaiseWindow
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XRaiseWindow\n");
-#endif
- return (jint) XRaiseWindow((Display *)display, window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XReconfigureWMWindow
- * Signature: (IIIILorg/eclipse/swt/internal/motif/XWindowChanges;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XReconfigureWMWindow
- (JNIEnv *env, jclass that, jint display, jint window, jint screen, jint valueMask, jobject values)
-{
- DECL_GLOB(pGlob)
- XWindowChanges xWindowChanges, *lpWindowChanges1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XReconfigureWMWindow\n");
-#endif
-
- if (values) {
- lpWindowChanges1 = &xWindowChanges;
- cacheXwindowchangesFids(env, values, &PGLOB(XwindowchangesFc));
- getXwindowchangesFields(env, values, lpWindowChanges1, &PGLOB(XwindowchangesFc));
- }
- rc = (jint) XReconfigureWMWindow((Display *)display, window, screen, valueMask, lpWindowChanges1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XReconfigureWMWindow: call failed rc = %d\n", rc);
-#endif
-
- if (values) {
- setXwindowchangesFields(env, values, lpWindowChanges1, &PGLOB(XwindowchangesFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XRectInRegion
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XRectInRegion
- (JNIEnv *env, jclass that, jint region, jint x, jint y, jint width, jint height)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XRectInRegion\n");
-#endif
- return (jint) XRectInRegion((Region)region, x, y, width, height);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetBackground
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetBackground
- (JNIEnv *env, jclass that, jint display, jint gc, jint background)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetBackground\n");
-#endif
- XSetBackground((Display *)display, (GC)gc, background);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetClipMask
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetClipMask
- (JNIEnv *env, jclass that, jint display, jint gc, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetClipMask\n");
-#endif
- XSetClipMask((Display *)display, (GC)gc, pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetClipRectangles
- * Signature: (IIIILorg/eclipse/swt/internal/motif/XRectangle;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetClipRectangles
- (JNIEnv *env, jclass that, jint display, jint gc, jint clip_x_origin, jint clip_y_origin, jobject rectangle, jint n, jint ordering)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetClipRectangles\n");
-#endif
-
- if (rectangle) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, rectangle, &PGLOB(XrectangleFc));
- getXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- XSetClipRectangles((Display *)display, (GC)gc, clip_x_origin, clip_y_origin, lpxRect, n, ordering);
- if (rectangle) {
- setXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetDashes
- * Signature: (III[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetDashes
- (JNIEnv *env, jclass that, jint display, jint gc, jint dash_offset, jbyteArray dash_list, jint n)
-{
- jbyte *dash_list1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetDashes\n");
-#endif
-
- if (dash_list)
- dash_list1 = (*env)->GetByteArrayElements(env, dash_list, NULL);
- rc = (jint) XSetDashes((Display *)display, (GC)gc, dash_offset, (char *)dash_list1, n);
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XSetDashes: call failed rc = %d\n", rc);
-#endif
- if (dash_list)
- (*env)->ReleaseByteArrayElements(env, dash_list, dash_list1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetErrorHandler
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetErrorHandler
- (JNIEnv *env, jclass that, jint handler)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetErrorHandler\n");
-#endif
- return (jint) XSetErrorHandler((XErrorHandler)handler);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetFillStyle
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetFillStyle
- (JNIEnv *env, jclass that, jint display, jint gc, jint fill_style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetFillStyle\n");
-#endif
- XSetFillStyle((Display*)display, (GC)gc, fill_style);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetFont
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetFont
- (JNIEnv *env, jclass that, jint display, jint gc, jint font)
-{
- return (jint) XSetFont((Display *)display, (GC)gc, (Font)font);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetForeground
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetForeground
- (JNIEnv *env, jclass that, jint display, jint gc, jint foreground)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetForeground\n");
-#endif
- XSetForeground((Display *)display, (GC)gc, foreground);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetFunction
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetFunction
- (JNIEnv *env, jclass that, jint display, jint gc, jint function)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetFunction\n");
-#endif
- XSetFunction((Display *)display, (GC)gc, function);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetGraphicsExposures
- * Signature: (IIZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetGraphicsExposures
- (JNIEnv *env, jclass that, jint display, jint gc, jboolean graphics_exposures)
-{
- XSetGraphicsExposures((Display *)display, (GC)gc, (Bool) graphics_exposures);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetInputFocus
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetInputFocus
- (JNIEnv *env, jclass that, jint display, jint window, jint revert, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetInputFocus\n");
-#endif
-
- return (jint) XSetInputFocus((Display *)display, window, revert, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetLineAttributes
- * Signature: (IIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetLineAttributes
- (JNIEnv *env, jclass that, jint display, jint gc, jint lineWidth, jint lineStyle, jint capStyle, jint joinStyle)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetLineAttributes\n");
-#endif
- return (jint) XSetLineAttributes((Display *)display, (GC)gc, lineWidth, lineStyle, capStyle, joinStyle);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetRegion
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetRegion
- (JNIEnv *env, jclass that, jint display, jint gc, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetRegion\n");
-#endif
- XSetRegion((Display *)display, (GC)gc, (Region)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetStipple
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetStipple
- (JNIEnv *env, jclass that, jint display, jint gc, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetStipple\n");
-#endif
- XSetStipple((Display*)display, (GC)gc, pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetSubwindowMode
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetSubwindowMode
- (JNIEnv *env, jclass that, jint display, jint gc, jint subwindow_mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetSubwindowMode\n");
-#endif
- XSetSubwindowMode((Display*)display, (GC)gc, subwindow_mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetWindowBorderWidth
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetWindowBorderWidth
- (JNIEnv *env, jclass that, jint display, jint window, jint width)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetWindowBorderWidth\n");
-#endif
- XSetWindowBorderWidth((Display *)display, window, width);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSubtractRegion
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSubtractRegion
- (JNIEnv *env, jclass that, jint sra, jint srb, jint da_return)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSubtractRegion\n");
-#endif
- XSubtractRegion((Region)sra, (Region)srb, (Region)da_return);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSync
- * Signature: (IZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSync
- (JNIEnv *env, jclass that, jint display, jboolean discard)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSync\n");
-#endif
- XSync((Display *)display, (Bool)discard);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSynchronize
- * Signature: (IZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSynchronize
- (JNIEnv *env, jclass that, jint display, jboolean onoff)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSynchronize\n");
-#endif
- return (jint) XSynchronize((Display *)display, (Bool)onoff);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XUndefineCursor
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XUndefineCursor
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XUndefineCursor\n");
-#endif
- XUndefineCursor((Display *)display, window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XUngrabPointer
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XUngrabPointer
- (JNIEnv *env, jclass that, jint display, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XUngrabPointer\n");
-#endif
- return (jint) XUngrabPointer((Display *)display, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XUnionRectWithRegion
- * Signature: (Lorg/eclipse/swt/internal/motif/XRectangle;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XUnionRectWithRegion
- (JNIEnv *env, jclass that, jobject rectangle, jint src_region, jint dest_region)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XUnionRectWithRegion\n");
-#endif
-
- if (rectangle) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, rectangle, &PGLOB(XrectangleFc));
- getXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- XUnionRectWithRegion(lpxRect, (Region)src_region, (Region)dest_region);
- if (rectangle) {
- setXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XUnionRegion
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XUnionRegion
- (JNIEnv *env, jclass that, jint sra, jint srb, jint dr_return)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XUnionRegion\n");
-#endif
- XUnionRegion((Region)sra, (Region)srb, (Region)dr_return);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XWarpPointer
- * Signature: (IIIIIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XWarpPointer
- (JNIEnv *env, jclass that, jint display, jint src_w, jint dest_w, jint src_x, jint src_y, jint src_width, jint src_height, jint dest_x, jint dest_y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XWarpPointer\n");
-#endif
- XWarpPointer((Display *)display, src_w, dest_w, src_x, src_y, src_width, src_height, dest_x, dest_y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XWhitePixel
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XWhitePixel
- (JNIEnv *env, jclass that, jint display, jint screenNum)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XWhitePixel\n");
-#endif
- return (jint) XWhitePixel((Display *)display, screenNum);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XWithdrawWindow
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XWithdrawWindow
- (JNIEnv *env, jclass that, jint display, jint window, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XWithdrawWindow\n");
-#endif
- XWithdrawWindow((Display *)display, (Window)window, screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmAddWMProtocolCallback
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmAddWMProtocolCallback
- (JNIEnv *env, jclass that, jint shell, jint protocol, jint callback, jint closure)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmAddWMProtocolCallback\n");
-#endif
- XmAddWMProtocolCallback((Widget)shell, (Atom)protocol, (XtCallbackProc)callback, (XtPointer)closure);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmChangeColor
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmChangeColor
- (JNIEnv *env, jclass that, jint widget, jint pixel)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmChangeColor\n");
-#endif
- XmChangeColor((Widget)widget, pixel);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmComboBoxAddItem
- * Signature: (IIIZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmComboBoxAddItem
- (JNIEnv *env, jclass that, jint combo, jint xmString, jint position, jboolean unique)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmComboBoxAddItem\n");
-#endif
- XmComboBoxAddItem((Widget)combo, (XmString) xmString, position, unique);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmComboBoxDeletePos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmComboBoxDeletePos
- (JNIEnv *env, jclass that, jint combo, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmComboBoxDeletePos\n");
-#endif
- XmComboBoxDeletePos((Widget)combo, position);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmComboBoxSelectItem
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmComboBoxSelectItem
- (JNIEnv *env, jclass that, jint combo, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmComboBoxSelectItem\n");
-#endif
- XmComboBoxSelectItem((Widget)combo, (XmString) xmString);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateArrowButton
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateArrowButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jint *name1=NULL, *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateArrowButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetIntArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateArrowButton((Widget)parent, (char *)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateArrowButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseIntArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateCascadeButtonGadget
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateCascadeButtonGadget
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateCascadeButtonGadget\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateCascadeButtonGadget((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateCascadeButtonGadget: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateComboBox
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateComboBox
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateComboBox\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateComboBox((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateComboBox: call failed rc = %d\n", rc);
-#endif
-
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateDialogShell
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateDialogShell
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateDialogShell\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateDialogShell((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateDialogShell: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateDrawingArea
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateDrawingArea
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateDrawingArea\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateDrawingArea((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateDrawingArea: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateErrorDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateErrorDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateErrorDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateErrorDialog((struct _WidgetRec*)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateErrorDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateFileSelectionDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateFileSelectionDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateFileSelectionDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateFileSelectionDialog((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateFileSelectionDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateForm
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateForm
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateForm\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateForm((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateForm: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateFrame
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateFrame
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateFrame\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateFrame((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateFrame: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateInformationDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateInformationDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateInformationDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
-
- rc = (jint)XmCreateInformationDialog((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateInformationDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateLabel
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateLabel
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateLabel\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateLabel((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateLabel: call failed rc = %d\n", rc);
-#endif
-
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateList
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateList
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jbyte *name1=NULL;
- jint *arglist1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateList\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint) XmCreateList((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateList: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateMainWindow
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateMainWindow
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateMainWindow\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateMainWindow((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateMainWindow: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateMenuBar
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateMenuBar
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateMenuBar\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateMenuBar((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateMenuBar: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateMessageDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateMessageDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateMessageDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateMessageDialog((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateMessageDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreatePopupMenu
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreatePopupMenu
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreatePopupMenu\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreatePopupMenu((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreatePopupMenu: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method:
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreatePulldownMenu
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreatePulldownMenu\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreatePulldownMenu((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreatePulldownMenu: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreatePushButton
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreatePushButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1 = NULL;
- jint *argList1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreatePushButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
-
- rc = (jint) XmCreatePushButton((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreatePushButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreatePushButtonGadget
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreatePushButtonGadget
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreatePushButtonGadget\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreatePushButtonGadget((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreatePushButtonGadget: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateQuestionDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateQuestionDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateQuestionDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateQuestionDialog((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateQuestionDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateScale
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateScale
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateScale\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
-
- rc = (jint) XmCreateScale((Widget)parent, (String)name1, (ArgList) arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateScale: call failed rc = %d\n", rc);
-#endif
-
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateScrollBar
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateScrollBar
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateScrollBar\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateScrollBar((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateScrollBar: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateScrolledList
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateScrolledList
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateScrolledList\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateScrolledList((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateScrolledList: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateScrolledText
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateScrolledText
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateScrolledText\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateScrolledText((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateScrolledText: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateSeparator
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateSeparator
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateSeparator\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateSeparator((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateSeparator: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateSeparatorGadget
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateSeparatorGadget
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateSeparatorGadget\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateSeparatorGadget((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateSeparatorGadget: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateTextField
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateTextField
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateTextField\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateTextField((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateTextField: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateToggleButton
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateToggleButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateToggleButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateToggleButton((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateToggleButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateToggleButtonGadget
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateToggleButtonGadget
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateToggleButtonGadget\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateToggleButtonGadget((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateToggleButtonGadget: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateWarningDialog
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateWarningDialog
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateWarningDialog\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- rc = (jint)XmCreateWarningDialog((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateWarningDialog: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDragCancel
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDragCancel
- (JNIEnv *env, jclass that, jint dragcontext)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDragCancel\n");
-#endif
-
- XmDragCancel((Widget)dragcontext);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDragStart
- * Signature: (II[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDragStart
- (JNIEnv *env, jclass that, jint widget, jobject event, jintArray arglist, jint argcount)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jint *arglist1;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDragStart\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- if (arglist) {
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- }
- rc = (jint) XmDragStart((Widget)widget, (XEvent *)lpxEvent, (ArgList)arglist1, (Cardinal)argcount);
- if (event) {
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- if (arglist) {
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropSiteRegister
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropSiteRegister
- (JNIEnv *env, jclass that, jint widget, jintArray arglist, jint argcount)
-{
- jint *arglist1;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropSiteRegister\n");
-#endif
-
- if (arglist) {
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- }
- XmDropSiteRegister((Widget)widget, (ArgList)arglist1, (Cardinal)argcount);
- if (arglist) {
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropSiteRetrieve
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropSiteRetrieve
- (JNIEnv *env, jclass that, jint widget, jintArray arglist, jint argcount)
-{
- jint *arglist1;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropSiteRetrieve\n");
-#endif
-
- if (arglist) {
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- }
- XmDropSiteRetrieve((Widget)widget, (ArgList)arglist1, (Cardinal)argcount);
- if (arglist) {
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropSiteUnregister
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropSiteUnregister
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropSiteUnregister\n");
-#endif
- XmDropSiteUnregister((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropSiteUpdate
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropSiteUpdate
- (JNIEnv *env, jclass that, jint widget, jintArray arglist, jint argcount)
-{
- jint *arglist1;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropSiteUpdate\n");
-#endif
-
- if (arglist) {
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- }
- XmDropSiteUpdate((Widget)widget, (ArgList)arglist1, (Cardinal)argcount);
- if (arglist) {
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropTransferAdd
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropTransferAdd
- (JNIEnv *env, jclass that, jint drop_transfer, jintArray transfers, jint num_transfers)
-{
- jint *transfers1;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropTransferAdd\n");
-#endif
-
- if (transfers) {
- transfers1 = (*env)->GetIntArrayElements(env, transfers, NULL);
- }
- XmDropTransferAdd((Widget)drop_transfer, (XmDropTransferEntryRec *)transfers1, (Cardinal)num_transfers);
- if (transfers) {
- (*env)->ReleaseIntArrayElements(env, transfers, transfers1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDropTransferStart
- * Signature: (I[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDropTransferStart
- (JNIEnv *env, jclass that, jint widget, jintArray arglist, jint argcount)
-{
- jint *arglist1;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDropTransferStart\n");
-#endif
-
- if (arglist) {
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
- }
- rc = (jint) XmDropTransferStart((Widget)widget, (ArgList)arglist1, (Cardinal)argcount);
- if (arglist) {
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFileSelectionBoxGetChild
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFileSelectionBoxGetChild
- (JNIEnv *env, jclass that, jint widget, jint child)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFileSelectionBoxGetChild\n");
-#endif
- return (jint) XmFileSelectionBoxGetChild((Widget)widget, child);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListAppendEntry
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListAppendEntry
- (JNIEnv *env, jclass that, jint oldlist, jint entry)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListAppendEntry\n");
-#endif
- return (jint) XmFontListAppendEntry((XmFontList)oldlist, (XmFontListEntry)entry);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListEntryFree
- * Signature: ([I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListEntryFree
- (JNIEnv *env, jclass that, jintArray entry)
-{
- jint *entry1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListEntryFree\n");
-#endif
-
- if (entry)
- entry1 = (*env)->GetIntArrayElements(env, entry, NULL);
- XmFontListEntryFree((XmFontListEntry *)entry1);
- if (entry)
- (*env)->ReleaseIntArrayElements(env, entry, entry1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListEntryGetFont
- * Signature: (I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListEntryGetFont
- (JNIEnv *env, jclass that, jint entry, jintArray type_return)
-{
- jint *type_return1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListEntryGetFont\n");
-#endif
-
- if (type_return)
- type_return1 = (*env)->GetIntArrayElements(env, type_return, NULL);
- rc = (jint) XmFontListEntryGetFont((XmFontListEntry)entry, (XmFontType *)type_return1);
- if (type_return)
- (*env)->ReleaseIntArrayElements(env, type_return, type_return1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListEntryCreate
- * Signature: ([BII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListEntryCreate
- (JNIEnv *env, jclass that, jbyteArray tag, jint type, int font)
-{
- char *tag1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListEntryCreate\n");
-#endif
-
- if (tag)
- tag1 = (char *)(*env)->GetByteArrayElements(env, tag, NULL);
- rc = (jint)XmFontListEntryCreate(tag1, (XmFontType)type, (XtPointer)font);
- if (tag)
- (*env)->ReleaseByteArrayElements(env, tag, (jbyte *)tag1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XLoadQueryFont
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XLoadQueryFont
- (JNIEnv *env, jclass that, jint display, jbyteArray fontName)
-{
- char *fontName1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XLoadQueryFont\n");
-#endif
-
- if (fontName)
- fontName1 = (char *)(*env)->GetByteArrayElements(env, fontName, NULL);
- rc = (jint)XLoadQueryFont((Display *)display, fontName1);
- if (fontName)
- (*env)->ReleaseByteArrayElements(env, fontName, (jbyte *)fontName1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListEntryLoad
- * Signature: (I[BI[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListEntryLoad
- (JNIEnv *env, jclass that, jint display, jbyteArray fontName, jint type, jbyteArray tag)
-{
- char *fontName1=NULL, *tag1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListEntryLoad\n");
-#endif
-
- if (fontName)
- fontName1 = (char *)(*env)->GetByteArrayElements(env, fontName, NULL);
- if (tag)
- tag1 = (char *)(*env)->GetByteArrayElements(env, tag, NULL);
- rc = (jint)XmFontListEntryLoad((Display *)display, fontName1, type, tag1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmFontListEntryLoad: call failed rc = %d\n", rc);
-#endif
-
- if (fontName)
- (*env)->ReleaseByteArrayElements(env, fontName, (jbyte *)fontName1, 0);
- if (tag)
- (*env)->ReleaseByteArrayElements(env, tag, (jbyte *)tag1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListFree
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListFree\n");
-#endif
- XmFontListFree((XmFontList)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListFreeFontContext
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListFreeFontContext
- (JNIEnv *env, jclass that, jint context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListFreeFontContext\n");
-#endif
- XmFontListFreeFontContext((XmFontContext)context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListInitFontContext
- * Signature: ([II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListInitFontContext
- (JNIEnv *env, jclass that, jintArray context, jint fontlist)
-{
- jint *context1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListInitFontContext\n");
-#endif
-
- if (context)
- context1 = (*env)->GetIntArrayElements(env, context, NULL);
- rc = XmFontListInitFontContext((XmFontContext *)context1, (XmFontList)fontlist);
- if (context)
- (*env)->ReleaseIntArrayElements(env, context, context1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListNextEntry
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListNextEntry
- (JNIEnv *env, jclass that, jint context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListNextEntry\n");
-#endif
- return (jint) XmFontListNextEntry((XmFontContext) context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmFontListCopy
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListCopy
- (JNIEnv *env, jclass that, jint fontlist)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmFontListCopy\n");
-#endif
- return (jint) XmFontListCopy((XmFontList) fontlist);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetAtomName
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetAtomName
- (JNIEnv *env, jclass that, jint display, jint atom)
-{
- return (jint) XmGetAtomName((Display *)display, (Atom)atom);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetFocusWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetFocusWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmGetFocusWidget\n");
-#endif
- return (jint) XmGetFocusWidget((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetPixmap
- * Signature: (I[BII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetPixmap
- (JNIEnv *env, jclass that, jint screen, jbyteArray name, jint fgPixel, jint bgPixel)
-{
- jbyte* name1 = NULL;
- jint pixmap;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmGetPixmap\n");
-#endif
-
- if (name) name1 = (*env)->GetByteArrayElements(env, name, NULL);
- pixmap = (jint) XmGetPixmap((Screen*)screen, (char*)name1, (Pixel)fgPixel, (Pixel)bgPixel);
- if (name) (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- return pixmap;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetXmDisplay
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetXmDisplay
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmGetXmDisplay\n");
-#endif
- return (jint) XmGetXmDisplay((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetDragContext
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetDragContext
- (JNIEnv *env, jclass that, jint widget, jint timestamp)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmGetDragContext\n");
-#endif
- return (jint) XmGetDragContext((Widget)widget, (Time)timestamp);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImMbLookupString
- * Signature: (ILorg/eclipse/swt/internal/motif/XKeyEvent;[BI[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImMbLookupString
- (JNIEnv *env, jclass that, jint widget, jobject keyEvent, jbyteArray string, jint size, jintArray keysym, jintArray status)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jint *keysym1=NULL, *status1=NULL;
- jbyte *string1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImMbLookupString\n");
-#endif
-
- if (keyEvent) {
- lpxEvent = &xEvent;
- cacheXkeyeventFids(env, keyEvent, &PGLOB(XkeyeventFc));
- getXkeyeventFields(env, keyEvent, lpxEvent, &PGLOB(XkeyeventFc));
- }
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- if (keysym)
- keysym1 = (*env)->GetIntArrayElements(env, keysym, NULL);
- if (status)
- status1 = (*env)->GetIntArrayElements(env, status, NULL);
-
- rc = (jint)XmImMbLookupString((Widget)widget, (XKeyPressedEvent *)lpxEvent, (char *)string1, size, (KeySym *)keysym1, (int *)status1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmImMbLookupString: call failed rc = %d\n", rc);
-#endif
-
- if (keyEvent) {
- setXkeyeventFields(env, keyEvent, lpxEvent, &PGLOB(XkeyeventFc));
- }
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- if (keysym)
- keysym1 = (*env)->GetIntArrayElements(env, keysym, NULL);
- if (status)
- (*env)->ReleaseIntArrayElements(env, status, status1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmInternAtom
- * Signature: (I[BZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmInternAtom
- (JNIEnv *env, jclass that, jint display, jbyteArray name, jboolean only_if_exists)
-{
- jbyte *name1;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmInternAtom\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- rc = (jint) XmInternAtom((Display *)display, (String)name1, only_if_exists);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmInternAtom: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListAddItemUnselected
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListAddItemUnselected
- (JNIEnv *env, jclass that, jint list, jint xmString, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListAddItemUnselected\n");
-#endif
- XmListAddItemUnselected((Widget)list, (XmString)xmString, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeleteAllItems
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeleteAllItems
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeleteAllItems\n");
-#endif
- XmListDeleteAllItems((Widget)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeleteItemsPos
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeleteItemsPos
- (JNIEnv *env, jclass that, jint list, jint item_count, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeleteItemsPos\n");
-#endif
- XmListDeleteItemsPos((Widget)list, item_count, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeletePos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeletePos
- (JNIEnv *env, jclass that, jint list, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeletePos\n");
-#endif
- XmListDeletePos((Widget)list, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeletePositions
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeletePositions
- (JNIEnv *env, jclass that, jint list, jintArray position_list, jint position_count)
-{
- jint *position_list1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeletePositions\n");
-#endif
-
- if (position_list)
- position_list1 = (*env)->GetIntArrayElements(env, position_list, NULL);
- XmListDeletePositions((Widget)list, (int *)position_list1, position_count);
- if (position_list)
- (*env)->ReleaseIntArrayElements(env, position_list, position_list1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeselectAllItems
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeselectAllItems
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeselectAllItems\n");
-#endif
- XmListDeselectAllItems((Widget)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeselectPos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeselectPos
- (JNIEnv *env, jclass that, jint list, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeselectPos\n");
-#endif
- XmListDeselectPos((Widget)list, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListGetKbdItemPos
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListGetKbdItemPos
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListGetKbdItemPos\n");
-#endif
- return (jint)XmListGetKbdItemPos((Widget)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListGetSelectedPos
- * Signature: (I[I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListGetSelectedPos
- (JNIEnv *env, jclass that, jint list, jintArray positions, jintArray count)
-{
- jint *positions1=NULL, *count1=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListGetSelectedPos\n");
-#endif
-
- if (positions)
- positions1 = (*env)->GetIntArrayElements(env, positions, NULL);
- if (count)
- count1 = (*env)->GetIntArrayElements(env, count, NULL);
- rc = (jboolean)XmListGetSelectedPos((Widget)list, (int **)positions1, (int *)count1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc != True && rc != False)
- fprintf(stderr, "XmListGetSelectedPos: call failed rc = %d\n", rc);
-#endif
-
- if (positions)
- (*env)->ReleaseIntArrayElements(env, positions, positions1, 0);
- if (count)
- (*env)->ReleaseIntArrayElements(env, count, count1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListItemPos
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListItemPos
- (JNIEnv *env, jclass that, jint list, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListItemPos\n");
-#endif
- return (jint)XmListItemPos((Widget)list, (XmString)xmString);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListPosSelected
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListPosSelected
- (JNIEnv *env, jclass that, jint list, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListPosSelected\n");
-#endif
- return (jboolean)XmListPosSelected((Widget)list, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListReplaceItemsPosUnselected
- * Signature: (I[III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListReplaceItemsPosUnselected
- (JNIEnv *env, jclass that, jint list, jintArray newItems, jint item_count, jint position)
-{
- jint *newItems1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListReplaceItemsPosUnselected\n");
-#endif
-
- if (newItems)
- newItems1 = (*env)->GetIntArrayElements(env, newItems, NULL);
- XmListReplaceItemsPosUnselected((Widget)list, (XmString *)newItems1, item_count, position);
- if (newItems)
- (*env)->ReleaseIntArrayElements(env, newItems, newItems1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListSelectPos
- * Signature: (IIZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListSelectPos
- (JNIEnv *env, jclass that, jint list, jint position, jboolean notify)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListSelectPos\n");
-#endif
- XmListSelectPos((Widget)list, position, notify);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListSetKbdItemPos
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListSetKbdItemPos
- (JNIEnv *env, jclass that, jint list, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListSetKbdItemPos\n");
-#endif
- return (jboolean)XmListSetKbdItemPos((Widget)list, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListSetPos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListSetPos
- (JNIEnv *env, jclass that, jint list, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListSetPos\n");
-#endif
- XmListSetPos((Widget)list, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListUpdateSelectedList
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListUpdateSelectedList
- (JNIEnv *env, jclass that, jint list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListUpdateSelectedList\n");
-#endif
- XmListUpdateSelectedList((Widget)list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmMainWindowSetAreas
- * Signature: (IIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmMainWindowSetAreas
- (JNIEnv *env, jclass that, jint widget, jint menu, jint command, jint hscroll, jint vscroll, jint wregion)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmMainWindowSetAreas\n");
-#endif
- XmMainWindowSetAreas((Widget)widget, (Widget)menu, (Widget)command, (Widget)hscroll, (Widget)vscroll, (Widget)wregion);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmMenuShellWidgetClass
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmMenuShellWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmMenuShellWidgetClass\n");
-#endif
- return (jint)xmMenuShellWidgetClass;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmMessageBoxGetChild
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmMessageBoxGetChild
- (JNIEnv *env, jclass that, jint widget, jint child)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmMessageBoxGetChild\n");
-#endif
- return (jint)XmMessageBoxGetChild((Widget)widget, child);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmProcessTraversal
- * Signature: (II)
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmProcessTraversal
- (JNIEnv *env, jclass that, jint widget, jint dir)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmProcessTraversal\n");
-#endif
- return (jboolean) XmProcessTraversal((Widget)widget, dir);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmPushButtonWidgetClass
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmPushButtonWidgetClass
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmPushButtonWidgetClass\n");
-#endif
- return (jint)xmPushButtonWidgetClass;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringCompare
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringCompare
- (JNIEnv *env, jclass that, jint xmString1, jint xmString2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringCompare\n");
-#endif
- return (jboolean) XmStringCompare((XmString)xmString1, (XmString)xmString2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringCreate
- * Signature: ([B[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringCreate
- (JNIEnv *env, jclass that, jbyteArray string, jbyteArray charset)
-{
- jbyte *string1=NULL, *charset1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringCreate\n");
-#endif
-
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- if (charset)
- charset1 = (*env)->GetByteArrayElements(env, charset, NULL);
- rc = (jint) XmStringCreate((char *)string1, (char *)charset1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmStringCreate: call failed rc = %d\n", rc);
-#endif
-
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- if (charset)
- (*env)->ReleaseByteArrayElements(env, charset, charset1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringCreateLocalized
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringCreateLocalized
- (JNIEnv *env, jclass that, jbyteArray string)
-{
- jbyte *string1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringCreateLocalized\n");
-#endif
-
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- rc = (jint)XmStringCreateLocalized((char *)string1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmStringCreateLocalized: call failed rc = %d\n", rc);
-#endif
-
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringCreateLtoR
- * Signature: ([B[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringCreateLtoR
- (JNIEnv *env, jclass that, jbyteArray string, jbyteArray charset)
-{
- jbyte *string1=NULL, *charset1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringCreateLtoR\n");
-#endif
-
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- if (charset)
- charset1 = (*env)->GetByteArrayElements(env, charset, NULL);
- rc = (jint) XmStringCreateLtoR((char *)string1, (char *)charset1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmStringCreateLtoR: call failed rc = %d\n", rc);
-#endif
-
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- if (charset)
- (*env)->ReleaseByteArrayElements(env, charset, charset1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringDraw
- * Signature: (IIIIIIIIIILorg/eclipse/swt/internal/motif/XRectangle;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringDraw
- (JNIEnv *env, jclass that, jint display, jint window, jint fontlist, jint xmString, jint gc, jint x, jint y, jint width, jint align, jint lay_dir, jobject clip)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "\n");
-#endif
-
- if (clip) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, clip, &PGLOB(XrectangleFc));
- getXrectangleFields(env, clip, lpxRect, &PGLOB(XrectangleFc));
- }
- XmStringDraw((Display *)display, (Window)window, (XmFontList)fontlist, (XmString)xmString, (GC)gc, x, y, width, align, lay_dir, lpxRect);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringDrawImage
- * Signature: (IIIIIIIIIILorg/eclipse/swt/internal/motif/XRectangle;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringDrawImage
- (JNIEnv *env, jclass that, jint display, jint window, jint fontlist, jint xmString, jint gc, jint x, jint y, jint width, jint align, jint lay_dir, jobject clip)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringDrawImage\n");
-#endif
-
- if (clip) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, clip, &PGLOB(XrectangleFc));
- getXrectangleFields(env, clip, lpxRect, &PGLOB(XrectangleFc));
- }
- XmStringDrawImage((Display *)display, window, (XmFontList)fontlist, (XmString)xmString, (GC)gc, x, y, width, align, lay_dir, lpxRect);
- if (clip) {
- setXrectangleFields(env, clip, lpxRect, &PGLOB(XrectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringEmpty
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringEmpty
- (JNIEnv *env, jclass that, jint s1)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringEmpty\n");
-#endif
- return (jboolean) XmStringEmpty((XmString)s1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringFree
- (JNIEnv *env, jclass that, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringFree\n");
-#endif
- XmStringFree((XmString)xmString);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringGetLtoR
- * Signature: (I[B[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringGetLtoR
- (JNIEnv *env, jclass that, jint xmString, jbyteArray charset, jintArray text)
-{
- jbyte *charset1=NULL;
- jint *text1=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringGetLtoR\n");
-#endif
-
- if (charset)
- charset1 = (*env)->GetByteArrayElements(env, charset, NULL);
- if (text)
- text1 = (*env)->GetIntArrayElements(env, text, NULL);
-
- rc = (jboolean) XmStringGetLtoR((XmString)xmString, (char *)charset1, (char **)text1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmStringGetLtoR: call failed rc = %d\n", rc);
-#endif
-
- if (charset)
- (*env)->ReleaseByteArrayElements(env, charset, charset1, 0);
- if (text)
- (*env)->ReleaseIntArrayElements(env, text, text1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringHeight
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringHeight
- (JNIEnv *env, jclass that, jint fontlist, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringHeight\n");
-#endif
- return (jint) XmStringHeight((XmFontList)fontlist, (XmString)xmString);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringWidth
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringWidth
- (JNIEnv *env, jclass that, jint fontlist, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringWidth\n");
-#endif
- return (jint) XmStringWidth((XmFontList)fontlist, (XmString)xmString);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextClearSelection
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextClearSelection
- (JNIEnv *env, jclass that, jint widget, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextClearSelection\n");
-#endif
- XmTextClearSelection((Widget)widget, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextCopy
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextCopy
- (JNIEnv *env, jclass that, jint widget, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextCopy\n");
-#endif
- return (jboolean)XmTextCopy((Widget)widget, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextCut
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextCut
- (JNIEnv *env, jclass that, jint widget, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextCut\n");
-#endif
- return (jboolean)XmTextCut((Widget)widget, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextDisableRedisplay
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextDisableRedisplay
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextDisableRedisplay\n");
-#endif
- XmTextDisableRedisplay((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextEnableRedisplay
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextEnableRedisplay
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextEnableRedisplay\n");
-#endif
- XmTextEnableRedisplay((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetInsertionPosition
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetInsertionPosition
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetInsertionPosition\n");
-#endif
- return (jint) XmTextGetInsertionPosition((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetLastPosition
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetLastPosition
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetLastPosition\n");
-#endif
- return (jint) XmTextGetLastPosition((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetMaxLength
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetMaxLength
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetMaxLength\n");
-#endif
- return (jint) XmTextGetMaxLength((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetSelection
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetSelection
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetSelection\n");
-#endif
- return (jint) XmTextGetSelection((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetSelectionPosition
- * Signature: (I[I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetSelectionPosition
- (JNIEnv *env, jclass that, jint widget, jintArray left, jintArray right)
-{
- jint *left1=NULL,*right1=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetSelectionPosition\n");
-#endif
-
- if (left)
- left1 = (*env)->GetIntArrayElements(env, left, NULL);
- if (right)
- right1 = (*env)->GetIntArrayElements(env, right, NULL);
- rc = (jboolean) XmTextGetSelectionPosition((Widget)widget, (XmTextPosition *)left1, (XmTextPosition *)right1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc != True && rc != False)
- fprintf(stderr, "XmTextGetSelectionPosition: call failed rc = %d\n", rc);
-#endif
-
- if (left)
- (*env)->ReleaseIntArrayElements(env, left, left1, 0);
- if (right)
- (*env)->ReleaseIntArrayElements(env, right, right1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetString
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetString
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetString\n");
-#endif
- return (jint) XmTextGetString((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetSubstring
- * Signature: (IIII[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetSubstring
- (JNIEnv *env, jclass that, jint widget, jint start, jint num_chars, jint buffer_size, jbyteArray buffer)
-{
- jbyte *buffer1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetSubstring\n");
-#endif
-
- if (buffer)
- buffer1 = (*env)->GetByteArrayElements(env, buffer, NULL);
- rc = (jint)XmTextGetSubstring((Widget)widget, start, num_chars, buffer_size, (char *)buffer1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmTextGetSubstring: call failed rc = %d\n", rc);
-#endif
-
- if (buffer)
- (*env)->ReleaseByteArrayElements(env, buffer, buffer1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextGetSubstringWcs
- * Signature: (IIII[C)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextGetSubstringWcs
- (JNIEnv *env, jclass that, jint widget, jint start, jint num_chars, jint buffer_size, jcharArray buffer)
-{
- jchar *buffer1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextGetSubstringWcs\n");
-#endif
-
- if (buffer)
- buffer1 = (*env)->GetCharArrayElements(env, buffer, NULL);
-
- rc = (jint)XmTextGetSubstringWcs((Widget) widget, (XmTextPosition) start, num_chars, buffer_size, (wchar_t *) buffer1);
-
- if (buffer)
- (*env)->ReleaseCharArrayElements(env, buffer, buffer1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextInsert
- * Signature: (II[B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextInsert
- (JNIEnv *env, jclass that, jint widget, jint position, jbyteArray value)
-{
- jbyte *value1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextInsert\n");
-#endif
-
- if (value)
- value1 = (*env)->GetByteArrayElements(env, value, NULL);
- XmTextInsert((Widget)widget, position, (char *)value1);
- if (value)
- (*env)->ReleaseByteArrayElements(env, value, value1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextPaste
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextPaste
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextPaste\n");
-#endif
- (jboolean) XmTextPaste((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextFieldPaste
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextFieldPaste
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextFieldPaste\n");
-#endif
- (jboolean) XmTextFieldPaste((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextRemove
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextRemove
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextRemove\n");
-#endif
- return (jboolean) XmTextRemove((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextPosToXY
- * Signature: (II[S[S)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextPosToXY
- (JNIEnv *env, jclass that, jint widget, jint position, jshortArray x, jshortArray y)
-{
- jshort *x1=NULL, *y1=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextPosToXY\n");
-#endif
-
- if (x)
- x1 = (*env)->GetShortArrayElements(env, x, NULL);
- if (y)
- y1 = (*env)->GetShortArrayElements(env, y, NULL);
- rc = (jboolean) XmTextPosToXY((Widget)widget, (XmTextPosition)position, (Position *)x1, (Position *)y1);
- if (y)
- (*env)->ReleaseShortArrayElements(env, y, y1, 0);
- if (x)
- (*env)->ReleaseShortArrayElements(env, x, x1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextReplace
- * Signature: (III[B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextReplace
- (JNIEnv *env, jclass that, jint widget, jint from_pos, jint to_pos, jbyteArray value)
-{
- jbyte *value1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextReplace\n");
-#endif
-
- if (value)
- value1 = (*env)->GetByteArrayElements(env, value, NULL);
-
- XmTextReplace((Widget)widget, from_pos, to_pos, (char *)value1);
-
- if (value)
- (*env)->ReleaseByteArrayElements(env, value, value1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextScroll
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextScroll
- (JNIEnv *env, jclass that, jint widget, jint lines)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextScroll\n");
-#endif
- XmTextScroll((Widget)widget, lines);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetEditable
- * Signature: (IZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetEditable
- (JNIEnv *env, jclass that, jint widget, jboolean editable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetEditable\n");
-#endif
- XmTextSetEditable((Widget)widget, editable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetHighlight
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetHighlight
- (JNIEnv *env, jclass that, jint widget, jint left, jint right, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetHighlight\n");
-#endif
- XmTextSetHighlight((Widget)widget, left, right, mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetInsertionPosition
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetInsertionPosition
- (JNIEnv *env, jclass that, jint widget, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetInsertionPosition\n");
-#endif
- XmTextSetInsertionPosition((Widget)widget, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetMaxLength
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetMaxLength
- (JNIEnv *env, jclass that, jint widget, jint max_length)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetMaxLength\n");
-#endif
- XmTextSetMaxLength((Widget)widget, max_length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetSelection
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetSelection
- (JNIEnv *env, jclass that, jint widget, jint first, jint last, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetSelection\n");
-#endif
- XmTextSetSelection((Widget)widget, first, last, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextSetString
- * Signature: (I[B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextSetString
- (JNIEnv *env, jclass that, jint widget, jbyteArray value)
-{
- jbyte *value1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextSetString\n");
-#endif
-
- if (value)
- value1 = (*env)->GetByteArrayElements(env, value, NULL);
- XmTextSetString((Widget)widget, (char *)value1);
- if (value)
- (*env)->ReleaseByteArrayElements(env, value, value1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method:
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextShowPosition
- (JNIEnv *env, jclass that, jint widget, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextShowPosition\n");
-#endif
- XmTextShowPosition((Widget)widget, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmUpdateDisplay
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmUpdateDisplay
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmUpdateDisplay\n");
-#endif
- XmUpdateDisplay((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmWidgetGetDisplayRect
- * Signature: (ILorg/eclipse/swt/internal/motif/XRectangle;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmWidgetGetDisplayRect
- (JNIEnv *env, jclass that, jint region, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmWidgetGetDisplayRect\n");
-#endif
-
- if (rectangle) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, rectangle, &PGLOB(XrectangleFc));
- getXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- rc = (jboolean) XmWidgetGetDisplayRect((Widget)region, (XRectangle *)lpxRect);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmWidgetGetDisplayRect: call failed rc = %d\n", rc);
-#endif
-
- if (rectangle) {
- setXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmbLookupString
- * Signature: (ILorg/eclipse/swt/internal/motif/XInputEvent;[BI[I[I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmbLookupString
- (JNIEnv *env, jclass that, jint ic, jobject event, jbyteArray string, jint size, jintArray keysym, jintArray status)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jint *keysym1=NULL, *status1=NULL;
- jbyte *string1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmbLookupString\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXkeyeventFids(env, event, &PGLOB(XkeyeventFc));
- getXkeyeventFields(env, event, lpxEvent, &PGLOB(XkeyeventFc));
- }
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
- if (keysym)
- keysym1 = (*env)->GetIntArrayElements(env, keysym, NULL);
- if (status)
- status1 = (*env)->GetIntArrayElements(env, status, NULL);
-
- rc = (jint)XmbLookupString((XIC)ic, (XKeyPressedEvent *)lpxEvent, (char *)string1, size, (KeySym *)keysym1, (int *)status1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmbLookupString: call failed rc = %d\n", rc);
-#endif
-
- if (event) {
- setXkeyeventFields(env, event, lpxEvent, &PGLOB(XkeyeventFc));
- }
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- if (keysym)
- keysym1 = (*env)->GetIntArrayElements(env, keysym, NULL);
- if (status)
- (*env)->ReleaseIntArrayElements(env, status, status1, 0);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAddCallback
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAddCallback
- (JNIEnv *env, jclass that, jint widget, jint callback_name, jint callback, jint client_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAddCallback\n");
-#endif
- XtAddCallback((Widget)widget, (String)callback_name, (XtCallbackProc)callback, (XtPointer)client_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAddEventHandler
- * Signature: (IIZII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAddEventHandler
- (JNIEnv *env, jclass that, jint widget, jint event_mask, jboolean nonmaskable, jint proc, jint client_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAddEventHandler\n");
-#endif
- XtAddEventHandler((Widget)widget, event_mask, nonmaskable, (XtEventHandler)proc, (XtPointer)client_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAddExposureToRegion
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAddExposureToRegion
- (JNIEnv *env, jclass that, jint event, jint region)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAddExposureToRegion\n");
-#endif
- XtAddExposureToRegion((XEvent *)event, (Region)region);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppAddTimeOut
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppAddTimeOut
- (JNIEnv *env, jclass that, jint applicationContext, jint interval, jint procedure, jint clientData)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppAddTimeOut\n");
-#endif
- return (jint) XtAppAddTimeOut((XtAppContext)applicationContext, interval, (XtTimerCallbackProc)procedure, (XtPointer)clientData);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppCreateShell
- * Signature: ([B[BII[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppCreateShell
- (JNIEnv *env, jclass that, jbyteArray appName, jbyteArray appClass, jint widgetClass,
- jint display, jintArray argList, jint argCount)
-{
- jbyte *appName1 = NULL;
- jbyte *appClass1 = NULL;
- jint *argList1 = NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppCreateShell\n");
-#endif
-
- if (appName)
- appName1 = (*env)->GetByteArrayElements(env, appName, NULL);
- if (appClass)
- appClass1 = (*env)->GetByteArrayElements(env, appClass, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
-
-/* fprintf(stderr, "XtAppCreateShell: appName1=%d appClass1=%d widgetClass=%d display=%d arglist1=%d argCount=%d\n",
- appName1, appClass1, widgetClass, display, argList1, argCount);
-*/
- rc = (jint) XtAppCreateShell((String)appName1, (String)appClass1, (WidgetClass)widgetClass, (Display *)display, (ArgList)argList1, argCount);
-
-/* fprintf(stderr, "After XtAppCreateShell: rc=%d\n", rc); */
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XtAppCreateShell: call failed rc = %d\n", rc);
-#endif
-
- if (appName)
- (*env)->ReleaseByteArrayElements(env, appName, appName1, 0);
- if (appClass)
- (*env)->ReleaseByteArrayElements(env, appClass, appClass1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppNextEvent
- * Signature: (ILorg/eclipse/swt/internal/motif/XAnyEvent;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppNextEvent
- (JNIEnv *env, jclass that, jint appContext, jobject event)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppNextEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- XtAppNextEvent((XtAppContext)appContext, lpxEvent);
-
-#ifdef EVENT_TRACE
- fprintf(stderr, "type = %d, serial = %d, send_event = %d, display = %x, window = %x \n",
- xEvent.type, xEvent.xany.serial, xEvent.xany.send_event, xEvent.xany.display, xEvent.xany.window);
-#endif
-
- if (event) {
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppPeekEvent
- * Signature: (ILorg/eclipse/swt/internal/motif/XAnyEvent)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppPeekEvent
- (JNIEnv *env, jclass that, jint appContext, jobject event)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppPeekEvent\n");
-#endif
-
- rc = (jboolean) XtAppPeekEvent((XtAppContext)appContext, &xEvent);
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppPending
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppPending
- (JNIEnv *env, jclass that, jint appContext)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppPending\n");
-#endif
- return (jint) XtAppPending((XtAppContext)appContext);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppProcessEvent
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppProcessEvent
- (JNIEnv *env, jclass that, jint appContext, jint inputMask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppProcessEvent\n");
-#endif
- XtAppProcessEvent((XtAppContext)appContext, inputMask);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppSetErrorHandler
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppSetErrorHandler
- (JNIEnv *env, jclass that, jint app_context, jint handler)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppSetErrorHandler\n");
-#endif
- return (jint) XtAppSetErrorHandler((XtAppContext)app_context, (XtErrorHandler)handler);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppSetWarningHandler
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppSetWarningHandler
- (JNIEnv *env, jclass that, jint app_context, jint handler)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppSetWarningHandler\n");
-#endif
- return (jint) XtAppSetWarningHandler((XtAppContext)app_context, (XtErrorHandler)handler);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtBuildEventMask
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtBuildEventMask
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtBuildEventMask\n");
-#endif
- return (jint) XtBuildEventMask((Widget) widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCallActionProc
- * Signature: (I[BLorg/eclipse/swt/internal/motif/XAnyEvent;[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCallActionProc
- (JNIEnv *env, jclass that, jint widget, jbyteArray action, jobject event, jintArray params, jint num_params)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jbyte *action1=NULL;
- jint *params1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCallActionProc\n");
-#endif
- if (action)
- action1 = (*env)->GetByteArrayElements(env, action, NULL);
- if (params)
- params1 = (*env)->GetIntArrayElements(env, params, NULL);
-
- XtCallActionProc((Widget)widget, (String)action1, lpxEvent, (String *)params1, num_params);
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
-
- if (action)
- (*env)->ReleaseByteArrayElements(env, action, action1, 0);
- if (params)
- (*env)->ReleaseIntArrayElements(env, params, params1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtClass
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtClass
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtClass\n");
-#endif
- return (jint) XtClass((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtConfigureWidget
- * Signature: (IIIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtConfigureWidget
- (JNIEnv *env, jclass that, jint widget, jint x, jint y, jint width, jint height, jint borderWidth)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtConfigureWidget\n");
-#endif
- XtConfigureWidget((Widget)widget, x, y, width, height, borderWidth);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCreateApplicationContext
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCreateApplicationContext
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCreateApplicationContext\n");
-#endif
- return (jint) XtCreateApplicationContext();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCreatePopupShell
- * Signature: ([BII[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCreatePopupShell
- (JNIEnv *env, jclass that, jbyteArray name, jint widgetClass, jint parent, jintArray argList, jint argCount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCreatePopupShell\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
-
- rc = (jint) XtCreatePopupShell((String)name1, (WidgetClass)widgetClass, (Widget)parent, (ArgList)argList1, argCount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XtCreatePopupShell: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtDestroyApplicationContext
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtDestroyApplicationContext
- (JNIEnv *env, jclass that, jint appContext)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtDestroyApplicationContext\n");
-#endif
- XtDestroyApplicationContext((XtAppContext)appContext);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtDestroyWidget
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtDestroyWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtDestroyWidget\n");
-#endif
- XtDestroyWidget((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtDispatchEvent
- * Signature: (Lorg/eclipse/swt/internal/motif/XAnyEvent;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtDispatchEvent
- (JNIEnv *env, jclass that, jobject event)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtDispatchEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- #ifdef EVENT_TRACE
- fprintf(stderr, "type = %d, serial = %d, send_event = %d, display = %x, window = %x \n",
- xEvent.type, xEvent.xany.serial, xEvent.xany.send_event, xEvent.xany.display, xEvent.xany.window);
- #endif
- }
- return (jboolean) XtDispatchEvent(lpxEvent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtDisplay
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtDisplay
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtDisplay\n");
-#endif
- return (jint) XtDisplay((Widget)widget);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtDisplayToApplicationContext
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtDisplayToApplicationContext
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtDisplayToApplicationContext\n");
-#endif
- return (jint) XtDisplayToApplicationContext((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtFree
- (JNIEnv *env, jclass that, jint ptr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtFree\n");
-#endif
- XtFree((char *)ptr);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtGetMultiClickTime
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtGetMultiClickTime
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtGetMultiClickTime\n");
-#endif
- return (jint) XtGetMultiClickTime((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtGetValues
- * Signature: (I[II)V
- */
-#define MAX_ARGS 32
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtGetValues
- (JNIEnv *env, jclass that, jint widget, jintArray argList, jint numArgs)
-{
- jint *argList1=NULL;
-
- int valueBuff[MAX_ARGS];
- int zeroBuff[MAX_ARGS];
- int *values = valueBuff;
- int *zeros = zeroBuff;
- int i;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtGetValues\n");
-#endif
-
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
-
-#ifndef SOLARIS
- if (numArgs > MAX_ARGS) {
- values = (int *) XtMalloc (numArgs * sizeof(int));
- zeros = (int *) XtMalloc (numArgs * sizeof(int));
- }
- for (i = 0; i < numArgs; i++) {
- zeros[i] = values[i] = 0;
- if (argList1[i * 2 + 1] == 0) {
- if ((RESOURCES_START <= argList1[i*2]) && (argList1[i*2] <= RESOURCES_END)) {
- zeros[i] = 1;
- argList1[i * 2 + 1] = (int)&values[i];
- }
- }
- }
-#endif
- XtGetValues((Widget)widget, (ArgList)argList1, numArgs);
-#ifndef SOLARIS
- for (i = 0; i < numArgs; i++) {
- if (zeros[i]) {
- char* charPtr = (char *)(argList1[i*2] - 1);
- switch ((int)*charPtr) {
- case 1: argList1[i * 2 + 1] = *(char *)(&values[i]); break;
- case 2: argList1[i * 2 + 1] = *(short *)(&values[i]); break;
- default:
- argList1[i * 2 + 1] = values[i];
- }
- }
- }
- if (numArgs > MAX_ARGS) {
- XtFree((char *)values);
- XtFree((char *)zeros);
- }
-#endif
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsManaged
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsManaged
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsManaged\n");
-#endif
- return (jboolean) XtIsManaged((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsRealized
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsRealized
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsRealized\n");
-#endif
- return (jboolean) XtIsRealized((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsSubclass
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsSubclass
- (JNIEnv *env, jclass that, jint widget, jint widgetClass)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsSubclass\n");
-#endif
- return (jboolean) XtIsSubclass((Widget)widget, (WidgetClass)widgetClass);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsTopLevelShell
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsTopLevelShell
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsTopLevelShell\n");
-#endif
- return (jboolean) XtIsTopLevelShell((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsWidget
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsWidget\n");
-#endif
- return (jboolean)XtIsWidget((Widget)widget);
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtLastTimestampProcessed
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtLastTimestampProcessed
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtLastTimestampProcessed\n");
-#endif
- return (jint)XtLastTimestampProcessed((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtMalloc
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtMalloc
- (JNIEnv *env, jclass that, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtMalloc\n");
-#endif
- return (jint) XtMalloc(size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtManageChild
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtManageChild
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtManageChild\n");
-#endif
- XtManageChild((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtMapWidget
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtMapWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtMapWidget\n");
-#endif
- XtMapWidget((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtMoveWidget
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtMoveWidget
- (JNIEnv *env, jclass that, jint widget, jint x, jint y)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtMoveWidget\n");
-#endif
- XtMoveWidget((Widget)widget, x, y);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtOpenDisplay
- * Signature: (I[B[B[BII[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtOpenDisplay
- (JNIEnv *env, jclass that, jint xtAppContext, jbyteArray displayName, jbyteArray applicationName,
- jbyteArray applicationClass, jint options, jint numOptions, jintArray argc, jint argv)
-{
- jbyte *displayName1 = NULL;
- jbyte *applicationName1 = NULL;
- jbyte *applicationClass1 = NULL;
- jint *argc1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtOpenDisplay\n");
-#endif
- if (displayName)
- displayName1 = (*env)->GetByteArrayElements(env, displayName, NULL);
- if (applicationName)
- applicationName1 = (*env)->GetByteArrayElements(env, applicationName, NULL);
- if (applicationClass)
- applicationClass1 = (*env)->GetByteArrayElements(env, applicationClass, NULL);
- if (argc)
- argc1 = (*env)->GetIntArrayElements(env, argc, NULL);
-
-
- rc = (jint) XtOpenDisplay((XtAppContext)xtAppContext, (String)displayName1, (String)applicationName1, (String)applicationClass1,
- (XrmOptionDescRec *)options, numOptions, (int *)argc1, (char **)argv);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XtOpenDisplay: call failed rc = %d\n", rc);
-#endif
-
- if (displayName)
- (*env)->ReleaseByteArrayElements(env, displayName, displayName1, 0);
- if (applicationName)
- (*env)->ReleaseByteArrayElements(env, applicationName, applicationName1, 0);
- if (applicationClass)
- (*env)->ReleaseByteArrayElements(env, applicationClass, applicationClass1, 0);
- if (argc)
- (*env)->ReleaseIntArrayElements(env, argc, argc1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtParent
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtParent
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtParent\n");
-#endif
- return (jint) XtParent((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtPopdown
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtPopdown
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtPopdown\n");
-#endif
- XtPopdown((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtPopup
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtPopup
- (JNIEnv *env, jclass that, jint widget, jint flags)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtPopup\n");
-#endif
- XtPopup((Widget)widget, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtQueryGeometry
- * Signature: (ILorg/eclipse/swt/internal/motif/XtWidgetGeometryLorg/eclipse/swt/internal/motif/XtWidgetGeometry;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtQueryGeometry
- (JNIEnv *env, jclass that, jint widget, jobject intended, jobject preferred_return)
-{
- DECL_GLOB(pGlob)
-
- XtWidgetGeometry intended1, preferred_return1, *lpIntended=NULL, *lpPreferred_return=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtQueryGeometry\n");
-#endif
- lpPreferred_return = &preferred_return1;
-
- /* The objects passed in here are both XtWidgetGeometry structures
- ** If either or both are passed in, we only want to cache the fids once.
- */
- if (intended)
- cacheXtwidgetgeometryFids(env, intended, &PGLOB(XtwidgetgeometryFc));
- else if (preferred_return)
- cacheXtwidgetgeometryFids(env, preferred_return, &PGLOB(XtwidgetgeometryFc));
-
- if (intended) {
- lpIntended = &intended1;
- /* intended and preferred_return are the same class XtWidgetGeometry */
- getXtwidgetgeometryFields(env, intended, lpIntended, &PGLOB(XtwidgetgeometryFc));
- }
- rc = (jint)XtQueryGeometry((Widget)widget, lpIntended, &preferred_return1);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XtQueryGeometry: call failed rc = %d\n", rc);
-#endif
-
- if (preferred_return) {
- setXtwidgetgeometryFields(env, preferred_return, &preferred_return1, &PGLOB(XtwidgetgeometryFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtRealizeWidget
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtRealizeWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtRealizeWidget\n");
-#endif
- XtRealizeWidget((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtRemoveTimeOut
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtRemoveTimeOut
- (JNIEnv *env, jclass that, jint id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtRemoveTimeOut\n");
-#endif
- XtRemoveTimeOut(id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtResizeWidget
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtResizeWidget
- (JNIEnv *env, jclass that, jint widget, jint width, jint height, jint borderWidth)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtResizeWidget\n");
-#endif
- XtResizeWidget((Widget)widget, width, height, borderWidth);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtResizeWindow
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtResizeWindow
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtResizeWindow\n");
-#endif
- XtResizeWindow((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtSetLanguageProc
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtSetLanguageProc
- (JNIEnv *env, jclass that, jint appContext, jint languageProc, jint pointer)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtSetLanguageProc\n");
-#endif
- return (jint) XtSetLanguageProc((XtAppContext)appContext, (XtLanguageProc)languageProc, (XtPointer)pointer);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtSetMappedWhenManaged
- * Signature: (IZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtSetMappedWhenManaged
- (JNIEnv *env, jclass that, jint widget, jboolean flag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtSetMappedWhenManaged\n");
-#endif
- XtSetMappedWhenManaged((Widget)widget, flag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtSetValues
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtSetValues
- (JNIEnv *env, jclass that, jint widget, jintArray argList, jint numArgs)
-{
- jint *argList1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtSetValues\n");
-#endif
-
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- XtSetValues((Widget)widget, (ArgList)argList1, numArgs);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtToolkitInitialize
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtToolkitInitialize
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtToolkitInitialize\n");
-#endif
- XtToolkitInitialize();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtTranslateCoords
- * Signature: (ISS[S[S)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtTranslateCoords
- (JNIEnv *env, jclass that, jint widget, jshort x, jshort y, jshortArray root_x, jshortArray root_y)
-{
- jshort *root_x1=NULL,*root_y1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtTranslateCoords\n");
-#endif
- if (root_x)
- root_x1 = (*env)->GetShortArrayElements(env, root_x, NULL);
- if (root_y)
- root_y1 = (*env)->GetShortArrayElements(env, root_y, NULL);
- XtTranslateCoords((Widget)widget, x, y, root_x1, root_y1);
- if (root_x)
- (*env)->ReleaseShortArrayElements(env, root_x, root_x1, 0);
- if (root_y)
- (*env)->ReleaseShortArrayElements(env, root_y, root_y1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtUnmanageChild
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtUnmanageChild
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtUnmanageChild\n");
-#endif
- XtUnmanageChild((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtUnmapWidget
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtUnmapWidget
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtUnmapWidget\n");
-#endif
- XtUnmapWidget((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtWindow
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtWindow
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtWindow\n");
-#endif
- return (jint) XtWindow((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtWindowToWidget
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtWindowToWidget
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtWindowToWidget\n");
-#endif
- return (jint) XtWindowToWidget((Display *)display, window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: strlen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_strlen
- (JNIEnv *env, jclass that, jint string)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "strlen\n");
-#endif
- return (jint) strlen((char *)string);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardCopy
- * Signature: (III[B[BII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardCopy
- (JNIEnv *env, jclass that, jint display, jint window, jint item_id, jbyteArray format_name, jbyteArray buffer, jint length, jint private_id, jintArray data_id)
-{
- jbyte *format_name1 = NULL;
- jbyte *buffer1 = NULL;
- jint *data_id1 = NULL;
- jint rc;
-
- if (format_name)
- format_name1 = (*env)->GetByteArrayElements(env, format_name, NULL);
-
- if (buffer)
- buffer1 = (*env)->GetByteArrayElements(env, buffer, NULL);
-
- if (data_id)
- data_id1 = (*env)->GetIntArrayElements(env, data_id, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardCopy\n");
-#endif
-
- rc = (jint) XmClipboardCopy((Display *)display, (Window)window, (long)item_id, (char *)format_name1, (char *)buffer1, (unsigned long)length, private_id, (void *)data_id1);
-
- if (format_name)
- (*env)->ReleaseByteArrayElements(env, format_name, format_name1, 0);
-
- if (buffer)
- (*env)->ReleaseByteArrayElements(env, buffer, buffer1, 0);
-
- if (data_id)
- (*env)->ReleaseIntArrayElements(env, data_id, data_id1, 0);
-
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardEndCopy
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardEndCopy
- (JNIEnv *env, jclass that, jint display, jint window, jint item_id)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardEndCopy\n");
-#endif
-
- return (jint) XmClipboardEndCopy((Display *)display, (Window)window, (long)item_id );
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardStartCopy
- * Signature: (IIIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardStartCopy
- (JNIEnv *env, jclass that, jint display, jint window, jint clip_label, jint timestamp, jint widget, jint callback, jintArray item_id)
-{
- jint *item_id1 = NULL;
- jint rc;
-
- if (item_id)
- item_id1 = (*env)->GetIntArrayElements(env, item_id, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardStartCopy\n");
-#endif
-
- rc = (jint) XmClipboardStartCopy((Display *)display, (Window)window, (XmString)clip_label, timestamp, (Widget)widget, (XmCutPasteProc)callback, (long *)item_id1);
-
- if (item_id)
- (*env)->ReleaseIntArrayElements(env, item_id, item_id1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardInquireLength
- * Signature: (II[B[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardInquireLength
- (JNIEnv *env, jclass that, jint display, jint window, jbyteArray format_name, jintArray length)
-{
- jbyte *format_name1 = NULL;
- jint *length1 = NULL;
- jint rc;
-
- if (format_name)
- format_name1 = (*env)->GetByteArrayElements(env, format_name, NULL);
-
- if (length)
- length1 = (*env)->GetIntArrayElements(env, length, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardInquireLength\n");
-#endif
- rc = (jint) XmClipboardInquireLength((Display *)display, (Window)window, (char *)format_name1, (unsigned long *)length1);
-
- if (format_name)
- (*env)->ReleaseByteArrayElements(env, format_name, format_name1, 0);
-
- if (length)
- (*env)->ReleaseIntArrayElements(env, length, length1, 0);
-
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardInquireFormat
- * Signature: (III[BI[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardInquireFormat
- (JNIEnv *env, jclass that, jint display, jint window, int index, jbyteArray format_name_buf, int buffer_len, jintArray copied_len)
-{
- jbyte *format_name_buf1 = NULL;
- jint *copied_len1 = NULL;
- jint rc;
-
- if (format_name_buf)
- format_name_buf1 = (*env)->GetByteArrayElements(env, format_name_buf, NULL);
-
- if (copied_len)
- copied_len1 = (*env)->GetIntArrayElements(env, copied_len, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardInquireFormat\n");
-#endif
- rc = (jint) XmClipboardInquireFormat((Display *)display, (Window)window, index, (char *)format_name_buf1, buffer_len, (unsigned long *)copied_len1);
-
- if (format_name_buf)
- (*env)->ReleaseByteArrayElements(env, format_name_buf, format_name_buf1, 0);
-
- if (copied_len)
- (*env)->ReleaseIntArrayElements(env, copied_len, copied_len1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardInquireCount
- * Signature: (II[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardInquireCount
- (JNIEnv *env, jclass that, jint display, jint window, jintArray count, jintArray max_format_name_length)
-{
- jint *count1 = NULL;
- jint *max_format_name_length1 = NULL;
- jint rc;
-
- if (count)
- count1 = (*env)->GetIntArrayElements(env, count, NULL);
-
- if (max_format_name_length)
- max_format_name_length1 = (*env)->GetIntArrayElements(env, max_format_name_length, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardInquireCount\n");
-#endif
- rc = (jint) XmClipboardInquireCount((Display *)display, (Window)window, (int *)count1, (unsigned long *)max_format_name_length1);
-
- if (count)
- (*env)->ReleaseIntArrayElements(env, count, count1, 0);
-
- if (max_format_name_length)
- (*env)->ReleaseIntArrayElements(env, max_format_name_length, max_format_name_length1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardStartRetrieve
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardStartRetrieve
- (JNIEnv *env, jclass that, jint display, jint window, jint timestamp)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardStartRetrieve\n");
-#endif
- return (jint) XmClipboardStartRetrieve((Display *)display, (Window)window, timestamp);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardRetrieve
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardRetrieve
- (JNIEnv *env, jclass that, jint display, jint window, jbyteArray format_name, jbyteArray buffer, jint length, jintArray num_bytes, jintArray private_id)
-{
- jbyte *format_name1 = NULL;
- jbyte *buffer1 = NULL;
- jint *num_bytes1 = NULL;
- jint *private_id1 = NULL;
- jint rc;
-
- if (format_name)
- format_name1 = (*env)->GetByteArrayElements(env, format_name, NULL);
-
- if (buffer)
- buffer1 = (*env)->GetByteArrayElements(env, buffer, NULL);
-
- if (num_bytes)
- num_bytes1 = (*env)->GetIntArrayElements(env, num_bytes, NULL);
-
- if (private_id)
- private_id1 = (*env)->GetIntArrayElements(env, private_id, NULL);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardRetrieve\n");
-#endif
-
- rc = (jint) XmClipboardRetrieve((Display *)display, (Window)window, (char *)format_name1, (char *)buffer1, (unsigned long)length, (unsigned long *)num_bytes1, (void *)private_id1);
-
- if (format_name)
- (*env)->ReleaseByteArrayElements(env, format_name, format_name1, 0);
-
- if (buffer)
- (*env)->ReleaseByteArrayElements(env, buffer, buffer1, 0);
-
- if (num_bytes)
- (*env)->ReleaseIntArrayElements(env, num_bytes, num_bytes1, 0);
-
- if (private_id)
- (*env)->ReleaseIntArrayElements(env, private_id, private_id1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmClipboardEndRetrieve
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmClipboardEndRetrieve
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmClipboardEndRetrieve\n");
-#endif
- return (jint) XmClipboardEndRetrieve((Display *)display, (Window)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateDrawnButton
- * Signature: (I[B[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateDrawnButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateDrawnButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
-
- rc = (jint)XmCreateDrawnButton((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateDrawnButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringGenerate
- * Signature: ([B[BI[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringGenerate
- (JNIEnv *env, jclass that, jbyteArray text, jbyteArray tag, jint type, jbyteArray rendition)
-{
- jbyte *text1 = NULL;
- jbyte *tag1 = NULL;
- jbyte *rendition1 = NULL;
- jint rc = 0;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringGenerate\n");
-#endif
- if (text) text1 = (*env)->GetByteArrayElements(env, text, NULL);
- if (tag) tag1 = (*env)->GetByteArrayElements(env, tag, NULL);
- if (rendition) rendition1 = (*env)->GetByteArrayElements(env, rendition, NULL);
-
- rc = (jint) XmStringGenerate((XtPointer) text1, (XmStringTag) tag1, type, (XmStringTag) rendition1);
-
- if (text) (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- if (tag) (*env)->ReleaseByteArrayElements(env, tag, tag1, 0);
- if (rendition) (*env)->ReleaseByteArrayElements(env, rendition, rendition1, 0);
- return rc;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmRenderTableAddRenditions
- * Signature: (I[III)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_XmRenderTableAddRenditions
- (JNIEnv *env, jclass that, jint oldTable, jintArray renditions, jint renditionCount, jint mergeMode)
-{
- jint *renditionArray = NULL;
- jint renderTable = 0;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmRenderTableAddRenditions\n");
-#endif
- if (renditions) renditionArray = (*env)->GetIntArrayElements(env, renditions, NULL);
- renderTable = (int) XmRenderTableAddRenditions((XmRenderTable) oldTable, (XmRendition*) renditionArray, renditionCount, mergeMode);
- if (renditions) (*env)->ReleaseIntArrayElements(env, renditions, renditionArray, 0);
- return renderTable;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmRenderTableFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmRenderTableFree
- (JNIEnv *env, jclass that, jint renderTable)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmRenderTableFree\n");
-#endif
- XmRenderTableFree((XmRenderTable) renderTable);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmRenditionCreate
- * Signature: (I[B[II)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_XmRenditionCreate
- (JNIEnv *env, jclass that, jint widget, jbyteArray renditionTag, jintArray argList, jint argCount)
-{
- jbyte *renditionTag1 = NULL;
- jint *argList1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmRenditionCreate\n");
-#endif
- if (renditionTag) renditionTag1 = (*env)->GetByteArrayElements(env, renditionTag, NULL);
- if (argList) argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmRenditionCreate((Widget) widget, (XmStringTag) renditionTag1, (ArgList) argList1, argCount);
- if (renditionTag) (*env)->ReleaseByteArrayElements(env, renditionTag, renditionTag1, 0);
- if (argList) (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmRenditionFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmRenditionFree
- (JNIEnv *env, jclass that, jint rendition)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmRenditionFree\n");
-#endif
- XmRenditionFree((XmRendition) rendition);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTabCreate
- * Signature: (IBBB[B)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTabCreate
- (JNIEnv *env, jclass that, jint value, jbyte units, jbyte offsetModel, jbyte alignment, jbyteArray decimal)
-{
- jbyte *decimal1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTabCreate\n");
-#endif
- if (decimal) decimal1 = (*env)->GetByteArrayElements(env, decimal, NULL);
- rc = (jint) XmTabCreate(value, units, offsetModel, alignment, (char*) decimal1);
- if (decimal) (*env)->ReleaseByteArrayElements(env, decimal, decimal1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTabFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTabFree
- (JNIEnv *env, jclass that, jint tab)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTabFree\n");
-#endif
- XmTabFree((XmTab) tab);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTabListFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTabListFree
- (JNIEnv *env, jclass that, jint tabList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTabListFree\n");
-#endif
- XmTabListFree((XmTabList) tabList);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTabListInsertTabs
- * Signature: (I[III)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTabListInsertTabs
- (JNIEnv *env, jclass that, jint oldList, jintArray tabs, jint tab_count, jint position)
-{
- jint *tabs1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTabListInsertTabs\n");
-#endif
- if (tabs) tabs1 = (*env)->GetIntArrayElements(env, tabs, NULL);
- rc = (jint) XmTabListInsertTabs((XmTabList) oldList, (XmTab*) tabs1, tab_count, position);
- if (tabs) (*env)->ReleaseIntArrayElements(env, tabs, tabs1, 0);
- return rc;
-}
-
-
-/* ---- unused OS calls, kept here in case we use them later ---- */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XBlackPixel
- * Signature: (II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XBlackPixel
- (JNIEnv *env, jclass that, jint display, jint screenNum)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XBlackPixel\n");
-#endif
- return (jint) XBlackPixel((Display *)display, screenNum);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XChangeActivePointerGrab
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XChangeActivePointerGrab
- (JNIEnv *env, jclass that, jint display, jint eventMask, jint cursor, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XChangeActivePointerGrab\n");
-#endif
- XChangeActivePointerGrab((Display *)display, eventMask, (Cursor)cursor, (Time)time);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultGC
- * Signature: (II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultGC
- (JNIEnv *env, jclass that, jint display, jint screen_number)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultGC\n");
-#endif
- return (jint) XDefaultGC((Display *)display, screen_number);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XNoOp
- * Signature: (I)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XNoOp
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XNoOp\n");
-#endif
- XNoOp((Display *)display);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XRootWindowOfScreen
- * Signature: (I)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XRootWindowOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XRootWindowOfScreen\n");
-#endif
- return (jint) XRootWindowOfScreen((Screen *)screen);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSendEvent
- * Signature: (Lorg/eclipse/swt/internal/motif/XAnyEvent;)Z
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSendEvent
- (JNIEnv *env, jclass that, jint display, jint w, jboolean propagate, jint event_mask, jobject event)
-{
- XEvent xEvent, *lpxEvent=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSendEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &XanyeventFc);
- getXanyeventFields(env, event, lpxEvent, &XanyeventFc);
- }
- return (jint) XSendEvent((Display *)display, w, propagate, event_mask, lpxEvent);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateCascadeButton
- * Signature: (I[B[II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateCascadeButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateCascadeButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateCascadeButton((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateCascadeButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateDrawnButton
- * Signature: (I[B[II)I
- */
-/*JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateDrawnButton
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateDrawnButton\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
-
- rc = (jint)XmCreateDrawnButton((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateDrawnButton: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}*/
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateRowColumn
- * Signature: (I[B[II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateRowColumn
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray arglist, jint argcount)
-{
- jint *arglist1=NULL;
- jbyte *name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateRowColumn\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (arglist)
- arglist1 = (*env)->GetIntArrayElements(env, arglist, NULL);
-
- rc = (jint)XmCreateRowColumn((Widget)parent, (String)name1, (ArgList)arglist1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateRowColumn: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (arglist)
- (*env)->ReleaseIntArrayElements(env, arglist, arglist1, 0);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmCreateScrolledWindow
- * Signature: (I[B[II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmCreateScrolledWindow
- (JNIEnv *env, jclass that, jint parent, jbyteArray name, jintArray argList, jint argcount)
-{
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmCreateScrolledWindow\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmCreateScrolledWindow((Widget)parent, (String)name1, (ArgList)argList1, argcount);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmCreateScrolledWindow: call failed rc = %d\n", rc);
-#endif
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmDestroyPixmap
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmDestroyPixmap
- (JNIEnv *env, jclass that, jint screen, jint pixmap)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmDestroyPixmap\n");
-#endif
- return (jboolean) XmDestroyPixmap((Screen *)screen, pixmap);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmGetPixmapByDepth
- * Signature: (I[BIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmGetPixmapByDepth
- (JNIEnv *env, jclass that, jint screen, jbyteArray image_name, jint foreground, jint background, jint depth)
-{
- jbyte *image_name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmGetPixmapByDepth\n");
-#endif
-
- if (image_name)
- image_name1 = (*env)->GetByteArrayElements(env, image_name, NULL);
-
- rc = (jint)XmGetPixmapByDepth((Screen *)screen, (char *)image_name1, foreground, background, depth);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XmGetPixmapByDepth: call failed rc = %d\n", rc);
-#endif
-
- if (image_name)
- (*env)->ReleaseByteArrayElements(env, image_name, image_name1, 0);
- return rc;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListAddItemsUnselected
- * Signature: (IIII)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListAddItemsUnselected
- (JNIEnv *env, jclass that, jint list, jint xmStringTable, jint item_count, jint position)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListAddItemsUnselected\n");
-#endif
- XmListAddItemsUnselected((Widget)list, (XmString *)xmStringTable, item_count, position);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeleteItem
- * Signature: (II)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeleteItem
- (JNIEnv *env, jclass that, jint list, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeleteItem\n");
-#endif
- XmListDeleteItem((Widget)list, (XmString)item);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListDeselectItem
- * Signature: (II)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListDeselectItem
- (JNIEnv *env, jclass that, jint list, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListDeselectItem\n");
-#endif
- XmListDeselectItem((Widget)list, (XmString)xmString);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmListSelectItem
- * Signature: (IIZ)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmListSelectItem
- (JNIEnv *env, jclass that, jint list, jint xmString, jboolean notify)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmListSelectItem\n");
-#endif
- XmListSelectItem((Widget)list, (XmString)xmString, notify);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringDrawUnderline
- * Signature: (IIIIIIIIIILorg/eclipse/swt/internal/motif/XRectangle;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringDrawUnderline
- (JNIEnv *env, jclass that, jint display, jint window, jint fontlist, jint xmString, jint gc, jint x, jint y, jint width, jint align, jint lay_dir, jobject clip, jint xmStringUnderline)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringDrawUnderline\n");
-#endif
-
- if (clip) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, clip, &PGLOB(XrectangleFc));
- getXrectangleFields(env, clip, lpxRect, &PGLOB(XrectangleFc));
- }
- XmStringDrawUnderline((Display *)display, window, (XmFontList)fontlist, (XmString)xmString, (GC)gc, x, y, width, align, lay_dir, lpxRect, (XmString)xmStringUnderline);
- if (clip) {
- setXrectangleFields(env, clip, lpxRect, &PGLOB(XrectangleFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringLineCount
- * Signature: (I)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringLineCount
- (JNIEnv *env, jclass that, jint xmString)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringLineCount\n");
-#endif
- return (jint) XmStringLineCount((XmString)xmString);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmTextRemove
- * Signature: (I)Z
- */
-/* JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XmTextRemove
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmTextRemove\n");
-#endif
- return (jboolean) XmTextRemove((Widget)widget);
-}
-*/
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCloseDisplay
- * Signature: (I)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCloseDisplay
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCloseDisplay\n");
-#endif
- XtCloseDisplay((Display *)display);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCallActionProc
- * Signature: (I[BLorg/eclipse/swt/internal/motif/XAnyEvent;[BI)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCallActionProc
- (JNIEnv *env, jclass that, jint widget, jbyteArray action, jobject event, jbyteArray params, jint num_params)
-{
- XEvent xEvent, *lpxEvent=NULL;
- jbyte *action1, *params1;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCallActionProc\n");
-#endif
- if (action)
- action1 = (*env)->GetByteArrayElements(env, action, NULL);
- if (params)
- params1 = (*env)->GetByteArrayElements(env, params, NULL);
-
- XtCallActionProc((Widget)widget, (String)action1, lpxEvent, (String *)params1, num_params);
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &XanyeventFc);
- setXanyeventFields(env, event, lpxEvent, &XanyeventFc);
- }
-
- if (action)
- (*env)->ReleaseByteArrayElements(env, action, action1, 0);
- if (params)
- (*env)->ReleaseByteArrayElements(env, params, params1, 0);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCloseDisplay
- * Signature: (I)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCloseDisplay
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCloseDisplay\n");
-#endif
- XtCloseDisplay((Display *)display);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtCreateWidget
- * Signature: ([BII[II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtCreateWidget
- (JNIEnv *env, jclass that, jbyteArray name, jint widgetClass, jint parent, jintArray argList, jint argCount)
-{
-
- jbyte *name1=NULL;
- jint *argList1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtCreateWidget\n");
-#endif
-
- if (name)
- name1 = (*env)->GetByteArrayElements(env, name, NULL);
- if (argList)
- argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XtCreateWidget((String)name1, (WidgetClass)widgetClass, (Widget)parent, (ArgList)argList1, argCount);
-#ifdef PRINT_FAILED_RCODES
- if (rc == 0)
- fprintf(stderr, "XtCreateWidget: call failed rc = %d\n", rc);
-#endif
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, name1, 0);
- if (argList)
- (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtRemoveCallback
- * Signature: (IIII)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtRemoveCallback
- (JNIEnv *env, jclass that, jint widget, jint callback_name, jint callback, jint client_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtRemoveCallback\n");
-#endif
- XtRemoveCallback((Widget)widget, (char *)callback_name, (XtCallbackProc)callback, (XtPointer)client_data);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtRemoveEventHandler
- * Signature: (IIZII)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtRemoveEventHandler
- (JNIEnv *env, jclass that, jint widget, jint event_mask, jboolean nonmaskable, jint proc, jint client_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtRemoveEventHandler\n");
-#endif
- XtRemoveEventHandler((Widget)widget, event_mask, nonmaskable, (XtEventHandler)proc, (XtPointer)client_data);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtScreen
- * Signature: (I)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtScreen
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtScreen\n");
-#endif
- return (jint) XtScreen((Widget)widget);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSelectInput
- * Signature: (III)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSelectInput
- (JNIEnv *env, jclass that, jint display, jint window, jint mask)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSelectInput\n");
-#endif
- XSelectInput((Display *)display, (Window)window, mask);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtIsSensitive
- * Signature: (I)Z
- */
-/* JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtIsSensitive
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtIsSensitive\n");
-#endif
- return (jboolean) XtIsSensitive((Widget)widget);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtSetSensitive
- * Signature: (IZ)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtSetSensitive
- (JNIEnv *env, jclass that, jint widget, jboolean sensitive)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtSetSensitive\n");
-#endif
- XtSetSensitive((Widget)widget, sensitive);
-}
-*/
-
-/* ---- unused OS calls end here ---- */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmParseMappingCreate
- * Signature: ([II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmParseMappingCreate
- (JNIEnv *env, jclass that, jintArray argList, jint numArgs)
-{
- jint *argList1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmParseMappingCreate\n");
-#endif
- if (argList) argList1 = (*env)->GetIntArrayElements(env, argList, NULL);
- rc = (jint) XmParseMappingCreate((ArgList)argList1, numArgs);
- if (argList) (*env)->ReleaseIntArrayElements(env, argList, argList1, 0);
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmParseMappingFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmParseMappingFree
- (JNIEnv *env, jclass that, jint parseMapping)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmParseMappingFree\n");
-#endif
- XmParseMappingFree((XmParseMapping) parseMapping);
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmParseTableFree
- * Signature: ([II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmParseTableFree
- (JNIEnv *env, jclass that, jintArray parseTable, jint mappingCount)
-{
- jint *parseTable1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmParseTableFree\n");
-#endif
- if (parseTable) {
- parseTable1 = (*env)->GetIntArrayElements(env, parseTable, NULL);
- XmParseTableFree((XmParseTable) parseTable1, mappingCount);
- (*env)->ReleaseIntArrayElements(env, parseTable, parseTable1, 0);
- }
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringComponentCreate
- * Signature: (II[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringComponentCreate
- (JNIEnv *env, jclass that, jint type, jint length, jbyteArray value)
-{
- jbyte* value1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringComponentCreate\n");
-#endif
- if (value) value1 = (*env)->GetByteArrayElements(env, value, NULL);
- rc = (jint) XmStringComponentCreate(type, length, (XtPointer) value1);
- if (value) (*env)->ReleaseByteArrayElements(env, value, value1, 0);
-
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringParseText
- * Signature: ([BI[BI[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringParseText
- (JNIEnv *env, jclass that, jbyteArray text, jint textEnd, jbyteArray tag, jint tagType, jintArray parseTable, jint parseCount, jint callData)
-{
- jbyte* text1 = NULL;
- jbyte* tag1 = NULL;
- jint* parseTable1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringParseText\n");
-#endif
- if (text) text1 = (*env)->GetByteArrayElements(env, text, NULL);
- if (tag) tag1 = (*env)->GetByteArrayElements(env, tag, NULL);
- if (parseTable) parseTable1 = (*env)->GetIntArrayElements(env, parseTable, NULL);
- rc = (jint) XmStringParseText(
- (XtPointer) text1,
- (XtPointer*) textEnd,
- (XmStringTag) tag1,
- tagType,
- (XmParseTable) parseTable1,
- parseCount,
- (XtPointer) callData);
- if (text) (*env)->ReleaseByteArrayElements(env, text, text1, 0);
- if (tag) (*env)->ReleaseByteArrayElements(env, tag, tag1, 0);
- if (parseTable) (*env)->ReleaseIntArrayElements(env, parseTable, parseTable1, 0);
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmStringUnparse
- * Signature: (I[BII[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmStringUnparse
- (JNIEnv *env, jclass that, jint xmString, jbyteArray tag, jint tagType, jint outputType, jintArray parseTable, jint parseCount, jint parseModel)
-{
- jbyte* tag1 = NULL;
- jint* parseTable1 = NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmStringUnparse\n");
-#endif
- if (tag) tag1 = (*env)->GetByteArrayElements(env, tag, NULL);
- if (parseTable) parseTable1 = (*env)->GetIntArrayElements(env, parseTable, NULL);
- rc = (jint) XmStringUnparse((XmString) xmString,
- (XmStringTag) tag1,
- tagType,
- outputType,
- (XmParseTable) parseTable1,
- parseCount,
- parseModel);
- if (tag) (*env)->ReleaseByteArrayElements(env, tag, tag1, 0);
- if (parseTable) (*env)->ReleaseIntArrayElements(env, parseTable, parseTable1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtParseTranslationTable
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtParseTranslationTable
- (JNIEnv *env, jclass that, jbyteArray string)
-{
- jint rc;
- jbyte *string1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtParseTranslationTable\n");
-#endif
- if (string) string1 = (*env)->GetByteArrayElements(env, string, NULL);
- rc = (jint) XtParseTranslationTable((String) string1);
- if (string) (*env)->ReleaseByteArrayElements(env, string, string1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtOverrideTranslations
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtOverrideTranslations
- (JNIEnv *env, jclass that, jint w, jint translations)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtOverrideTranslations\n");
-#endif
- XtOverrideTranslations((Widget) w, (XtTranslations) translations);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCheckIfEvent
- * Signature: (ILorg/eclipse/swt/internal/motif/XAnyEvent;II)Z
- */
-typedef Bool (*PredicateFunc)();
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XCheckIfEvent
- (JNIEnv *env, jclass that, jint display, jobject event, jint predicate, jint arg)
-{
- DECL_GLOB(pGlob)
- XEvent xEvent, *lpxEvent=NULL;
- jboolean rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCheckIfEvent\n");
-#endif
-
- if (event) {
- lpxEvent = &xEvent;
- cacheXanyeventFids(env, event, &PGLOB(XanyeventFc));
- getXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- rc = (jboolean)XCheckIfEvent((Display *)display, lpxEvent, (PredicateFunc) predicate, (void *) arg);
-
-#ifdef PRINT_FAILED_RCODES
- if (rc != True && rc != False)
- fprintf(stderr, "XCheckIfEvent: call failed rc = %d\n", rc);
-#endif
-
- if (event) {
- setXanyeventFields(env, event, lpxEvent, &PGLOB(XanyeventFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtToolkitThreadInitialize
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_XtToolkitThreadInitialize
- (JNIEnv *env, jclass that)
-{
- DECL_GLOB(pGlob)
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtToolkitThreadInitialize\n");
-#endif
- return (jboolean) XtToolkitThreadInitialize ();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: Call
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_Call
- (JNIEnv *env, jclass that, jint proc, jint arg0, jint arg1)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "Call\n");
-#endif
- return (*((jint (*)(jint, jint))proc)) (arg0, arg1);
-}
-
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetErrorText
- (JNIEnv *env, jclass that, jint display, jint code, jbyteArray buffer_return, jint length)
-{
- jint rc;
- jbyte *buffer_return1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtParseTranslationTable\n");
-#endif
- if (buffer_return) buffer_return1 = (*env)->GetByteArrayElements(env, buffer_return, NULL);
- XGetErrorText ((Display *)display, code, buffer_return1, length);
- if (buffer_return) (*env)->ReleaseByteArrayElements(env, buffer_return, buffer_return1, 0);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetIOErrorHandler
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetIOErrorHandler
- (JNIEnv *env, jclass that, jint handler)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetIOErrorHandler\n");
-#endif
- return (jint) XSetIOErrorHandler((XIOErrorHandler)handler);
-}
-
-/*
- * ======== Start printing functions ========
- */
-
-#ifndef NO_XPRINTING_EXTENSIONS
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpCreateContext
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpCreateContext
- (JNIEnv *env, jclass that, jint display, jbyteArray printer_name)
-{
- jbyte *printer_name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpCreateContext\n");
-#endif
- if (printer_name)
- printer_name1 = (*env)->GetByteArrayElements(env, printer_name, NULL);
- rc = (jint) XpCreateContext((Display *)display, (char *)printer_name1);
- if (printer_name)
- (*env)->ReleaseByteArrayElements(env, printer_name, printer_name1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpGetPrinterList
- * Signature: (I[B[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpGetPrinterList
- (JNIEnv *env, jclass that, jint display, jbyteArray printer_name, jintArray list_count)
-{
- jbyte *printer_name1=NULL;
- jint *list_count1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpGetPrinterList\n");
-#endif
- if (printer_name)
- printer_name1 = (*env)->GetByteArrayElements(env, printer_name, NULL);
- if (list_count)
- list_count1 = (*env)->GetIntArrayElements(env, list_count, NULL);
- rc = (jint) XpGetPrinterList((Display *)display, (char *)printer_name1, (int *)list_count1);
- if (printer_name)
- (*env)->ReleaseByteArrayElements(env, printer_name, printer_name1, 0);
- if (list_count)
- (*env)->ReleaseIntArrayElements(env, list_count, list_count1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpFreePrinterList
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpFreePrinterList
- (JNIEnv *env, jclass that, jint printer_list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpFreePrinterList\n");
-#endif
- XpFreePrinterList((XPPrinterList)printer_list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpGetAttributes
- * Signature: (IIB)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpGetAttributes
- (JNIEnv *env, jclass that, jint display, jint print_context, jbyte type)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpGetAttributes\n");
-#endif
- return (jint) XpGetAttributes((Display *)display, (XPContext)print_context, (XPAttributes)type);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpGetOneAttribute
- * Signature: (IIB[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpGetOneAttribute
- (JNIEnv *env, jclass that, jint display, jint print_context, jbyte type, jbyteArray attribute_name)
-{
- jbyte *attribute_name1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpGetOneAttribute\n");
-#endif
- if (attribute_name)
- attribute_name1 = (*env)->GetByteArrayElements(env, attribute_name, NULL);
- rc = (jint) XpGetOneAttribute((Display *)display, (XPContext)print_context, (XPAttributes)type, (char *)attribute_name1);
- if (attribute_name)
- (*env)->ReleaseByteArrayElements(env, attribute_name, attribute_name1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpSetAttributes
- * Signature: (IIB[BB)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpSetAttributes
- (JNIEnv *env, jclass that, jint display, jint print_context, jbyte type, jbyteArray pool, jbyte replacement_rule)
-{
- jbyte *pool1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpSetAttributes\n");
-#endif
- if (pool)
- pool1 = (*env)->GetByteArrayElements(env, pool, NULL);
- XpSetAttributes((Display *)display, (XPContext)print_context, (XPAttributes)type, (char *)pool1, (XPAttrReplacement)replacement_rule);
- if (pool)
- (*env)->ReleaseByteArrayElements(env, pool, pool1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpSetContext
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpSetContext
- (JNIEnv *env, jclass that, jint display, jint print_context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpSetContext\n");
-#endif
- XpSetContext((Display *)display, (XPContext)print_context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpGetScreenOfContext
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpGetScreenOfContext
- (JNIEnv *env, jclass that, jint display, jint print_context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpGetScreenOfContext\n");
-#endif
- return (jint) XpGetScreenOfContext((Display *)display, (XPContext)print_context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpDestroyContext
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpDestroyContext
- (JNIEnv *env, jclass that, jint display, jint print_context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpDestroyContext\n");
-#endif
- XpDestroyContext((Display *)display, (XPContext)print_context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpGetPageDimensions
- * Signature: (II[S[SLorg/eclipse/swt/internal/motif/XRectangle;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpGetPageDimensions
- (JNIEnv *env, jclass that, jint display, jint print_context, jshortArray width, jshortArray height, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- XRectangle xRect, *lpxRect=NULL;
- jshort *width1=NULL, *height1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpGetPageDimensions\n");
-#endif
-
- if (rectangle) {
- lpxRect = &xRect;
- cacheXrectangleFids(env, rectangle, &PGLOB(XrectangleFc));
- getXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- if (width)
- width1 = (*env)->GetShortArrayElements(env, width, NULL);
- if (height)
- height1 = (*env)->GetShortArrayElements(env, height, NULL);
- rc = (jint) XpGetPageDimensions((Display *)display, (XPContext)print_context,
- (unsigned short *)width1, (unsigned short *)height1, (XRectangle *)lpxRect);
- if (rectangle) {
- setXrectangleFields(env, rectangle, lpxRect, &PGLOB(XrectangleFc));
- }
- if (width)
- (*env)->ReleaseShortArrayElements(env, width, width1, 0);
- if (height)
- (*env)->ReleaseShortArrayElements(env, height, height1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpStartJob
- * Signature: (IB)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpStartJob
- (JNIEnv *env, jclass that, jint display, jbyte save_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpStartJob\n");
-#endif
- XpStartJob((Display *)display, (XPSaveData)save_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpStartPage
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpStartPage
- (JNIEnv *env, jclass that, jint display, jint window)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpStartPage\n");
-#endif
- XpStartPage((Display *)display, (Window)window);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpEndPage
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpEndPage
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpEndPage\n");
-#endif
- XpEndPage((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpEndJob
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpEndJob
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpEndJob\n");
-#endif
- XpEndJob((Display *)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpCancelJob
- * Signature: (IZ)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XpCancelJob
- (JNIEnv *env, jclass that, jint display, jboolean discard)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpCancelJob\n");
-#endif
- XpCancelJob((Display *)display, discard);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XpQueryVersion
- * Signature: (I[S[S)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpQueryVersion
- (JNIEnv *env, jclass that, jint display, jshortArray major_version, jshortArray minor_version)
-{
- jshort *major_version1=NULL, *minor_version1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XpQueryVersion\n");
-#endif
-
- if (major_version)
- major_version1 = (*env)->GetShortArrayElements(env, major_version, NULL);
- if (minor_version)
- minor_version1 = (*env)->GetShortArrayElements(env, minor_version, NULL);
- rc = (jint) XpQueryVersion((Display *)display, (short *)major_version1, (short *)minor_version1);
- if (major_version)
- (*env)->ReleaseShortArrayElements(env, major_version, major_version1, 0);
- if (minor_version)
- (*env)->ReleaseShortArrayElements(env, minor_version, minor_version1, 0);
-
- return rc;
-}
-
-#endif /* ! NO_XPRINTING_EXTENSIONS */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultGCOfScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultGCOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultGCOfScreen\n");
-#endif
- return (jint) XDefaultGCOfScreen((Screen *)screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDefaultColormapOfScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XDefaultColormapOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDefaultColormapOfScreen\n");
-#endif
- return (jint) XDefaultColormapOfScreen((Screen *)screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XRootWindowOfScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XRootWindowOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XRootWindowOfScreen\n");
-#endif
- return (jint) XRootWindowOfScreen((Screen *)screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XScreenNumberOfScreen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XScreenNumberOfScreen
- (JNIEnv *env, jclass that, jint screen)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XScreenNumberOfScreen\n");
-#endif
- return (jint) XScreenNumberOfScreen((Screen *)screen);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateWindow
- * Signature: (IIIIIIIIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateWindow
- (JNIEnv *env, jclass that, jint display, jint parent, jint x, jint y, jint width, jint height,
- jint border_width, jint depth, jint class, jint visual, jint value_mask, jint attributes)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateWindow\n");
-#endif
- return (jint) XCreateWindow((Display *)display, (Window)parent, x, y, width, height,
- border_width, depth, class, (Visual *)visual, (long)value_mask, (XSetWindowAttributes *)attributes);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XDestroyWindow
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XDestroyWindow
- (JNIEnv *env, jclass that, jint display, jint w)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XDestroyWindow\n");
-#endif
- XDestroyWindow((Display *)display, (Window)w);
-}
-
-/*
- * ======== End printing functions ========
- */
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: pipe
- * Signature: ([I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_pipe
- (JNIEnv *env, jclass that, jintArray filedes)
-{
- jint *filedes1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "pipe\n");
-#endif
-
- if (filedes)
- filedes1 = (*env)->GetIntArrayElements(env, filedes, NULL);
- rc = (jint) pipe((int *)filedes1);
- if (filedes)
- (*env)->ReleaseIntArrayElements(env, filedes, filedes1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: read
- * Signature: (I[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_read
- (JNIEnv *env, jclass that, int filedes, jbyteArray buf, int nbyte)
-{
- jbyte *buf1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "read\n");
-#endif
-
- if (buf)
- buf1 = (*env)->GetByteArrayElements(env, buf, NULL);
- rc = (jint) read(filedes, (char *)buf1, nbyte);
- if (buf)
- (*env)->ReleaseByteArrayElements(env, buf, buf1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: write
- * Signature: (I[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_write
- (JNIEnv *env, jclass that, int filedes, jbyteArray buf, int nbyte)
-{
- jbyte *buf1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "write\n");
-#endif
-
- if (buf)
- buf1 = (*env)->GetByteArrayElements(env, buf, NULL);
- rc = (jint) write(filedes, (char *)buf1, nbyte);
- if (buf)
- (*env)->ReleaseByteArrayElements(env, buf, buf1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: FD_SETSIZE
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_FD_1SETSIZE
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "FD_SETSIZE\n");
-#endif
-
- return FD_SETSIZE;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: NFDBITS
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_NFDBITS
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "NFDBITS\n");
-#endif
-
- return NFDBITS;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: FD_SET
- * Signature: (I[B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_FD_1SET
- (JNIEnv *env, jclass that, jint fd, jbyteArray set)
-{
- jbyte *set1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "FD_SET\n");
-#endif
-
- if (set) set1 = (*env)->GetByteArrayElements(env, set, NULL);
- FD_SET(fd, (fd_set*)set1);
- if (set) (*env)->ReleaseByteArrayElements(env, set, set1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: FD_ISSET
- * Signature: (I[B)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_OS_FD_1ISSET
- (JNIEnv *env, jclass that, jint fd, jbyteArray set)
-{
- jbyte *set1=NULL;
- jboolean rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "FD_ISSET\n");
-#endif
-
- if (set) set1 = (*env)->GetByteArrayElements(env, set, NULL);
- rc = (jboolean)FD_ISSET(fd, (fd_set*)set1);
- if (set) (*env)->ReleaseByteArrayElements(env, set, set1, 0);
- return rc;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: FD_ZERO
- * Signature: ([B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_FD_1ZERO
- (JNIEnv *env, jclass that, jbyteArray set)
-{
- jbyte *set1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "FD_ZERO\n");
-#endif
-
- if (set) set1 = (*env)->GetByteArrayElements(env, set, NULL);
- FD_ZERO((fd_set*)set1);
- if (set) (*env)->ReleaseByteArrayElements(env, set, set1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: ConnectionNumber
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_ConnectionNumber
- (JNIEnv *env, jclass that, jint display)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "ConnectionNumber\n");
-#endif
-
- return (jint)ConnectionNumber((Display*)display);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: select
- * Signature: (I[B[B[B[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_select__I_3B_3B_3B_3I
- (JNIEnv *env, jclass that, int n, jbyteArray readfds, jbyteArray writefds, jbyteArray exceptfds, jintArray timeout)
-{
- jbyte *readfds1=NULL;
- jbyte *writefds1=NULL;
- jbyte *exceptfds1=NULL;
- jint *timeout1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "select\n");
-#endif
-
- if (readfds) readfds1 = (*env)->GetByteArrayElements(env, readfds, NULL);
- if (writefds) writefds1 = (*env)->GetByteArrayElements(env, writefds, NULL);
- if (exceptfds) exceptfds1 = (*env)->GetByteArrayElements(env, exceptfds, NULL);
- if (timeout) timeout1 = (*env)->GetIntArrayElements(env, timeout, NULL);
- rc = (jint) select(n, (fd_set*)readfds1, (fd_set*)writefds1, (fd_set*)exceptfds1, (struct timeval*)timeout1);
- if (readfds) (*env)->ReleaseByteArrayElements(env, readfds, readfds1, 0);
- if (writefds) (*env)->ReleaseByteArrayElements(env, writefds, writefds1, 0);
- if (exceptfds) (*env)->ReleaseByteArrayElements(env, exceptfds, exceptfds1, 0);
- if (timeout) (*env)->ReleaseIntArrayElements(env, timeout, timeout1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: close
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_close
- (JNIEnv *env, jclass that, int filedes)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "close\n");
-#endif
-
- return (jint) close(filedes);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtAppAddInput
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XtAppAddInput
- (JNIEnv *env, jclass that, jint app_context, jint source, jint condition, jint proc, jint client_data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtAppAddInput\n");
-#endif
-
- return (jint) XtAppAddInput((XtAppContext)app_context, source, (XtPointer)condition, (XtInputCallbackProc)proc, (XtPointer)client_data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtRemoveInput
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtRemoveInput
- (JNIEnv *env, jclass that, jint id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtRemoveInput\n");
-#endif
-
- XtRemoveInput((XtInputId)id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImGetXIC
- * Signature: (II[II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImGetXIC
- (JNIEnv *env, jclass that, jint widget, jint input_policy, jintArray args, jint num_args)
-{
- jint *args1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImGetXIC\n");
-#endif
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
- rc = (jint) XmImGetXIC((Widget)widget, (XmInputPolicy)input_policy, (ArgList)args1, num_args);
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImGetXIM
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImGetXIM
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImGetXIM\n");
-#endif
-
- return (jint) XmImGetXIM((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImRegister
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImRegister
- (JNIEnv *env, jclass that, jint widget, jint reserved)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImRegister\n");
-#endif
-
- XmImRegister((Widget)widget, reserved);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImSetFocusValues
- * Signature: (I[II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImSetFocusValues
- (JNIEnv *env, jclass that, jint widget, jintArray args, jint num_args)
-{
- jint *args1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImSetFocusValues\n");
-#endif
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
- XmImSetFocusValues((Widget)widget, (ArgList)args1, num_args);
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImVaSetFocusValues
- * Signature: (IIIIIIIIII)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImVaSetFocusValues
- (JNIEnv *env, jclass that, jint widget, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImVaSetFocusValues\n");
-#endif
- XmImVaSetFocusValues((Widget)widget, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImSetValues
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImSetValues
- (JNIEnv *env, jclass that, jint widget, jintArray args, jint num_args)
-{
- jint *args1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImSetValues\n");
-#endif
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
- XmImSetValues((Widget)widget, (ArgList)args1, num_args);
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImUnregister
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImUnregister
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImUnregister\n");
-#endif
-
- XmImUnregister((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmImUnsetFocus
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmImUnsetFocus
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmImUnsetFocus\n");
-#endif
-
- XmImUnsetFocus((Widget)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateIC
- * Signature: (IIIIIIII)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateIC
- (JNIEnv *env, jclass that, jint im, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateIC\n");
-#endif
-
- return (jint)XCreateIC((XIM)im, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetICValues
- * Signature: (IIII)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetICValues
- (JNIEnv *env, jclass that, jint ic, jint arg1, jint arg2, jint arg3)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetICValues\n");
-#endif
-
- return (jint)XSetICValues((XIC)ic, arg1, arg2, arg3);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetICValues
- * Signature: (IIII)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetICValues
- (JNIEnv *env, jclass that, jint ic, jint arg1, jint arg2, jint arg3)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetICValues\n");
-#endif
-
- return (jint)XGetICValues((XIC)ic, arg1, arg2, arg3);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XSetICFocus
- * Signature: (I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XSetICFocus
- (JNIEnv *env, jclass that, jint ic)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XSetICFocus\n");
-#endif
-
- XSetICFocus((XIC)ic);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XUnsetICFocus
- * Signature: (I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XUnsetICFocus
- (JNIEnv *env, jclass that, jint ic)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XUnsetICFocus\n");
-#endif
-
- XUnsetICFocus((XIC)ic);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XGetIMValues
- * Signature: (IIII)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XGetIMValues
- (JNIEnv *env, jclass that, jint im, jint arg1, jint arg2, jint arg3)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XGetIMValues\n");
-#endif
-
- return (jint)XGetIMValues((XIM)im, arg1, arg2, arg3);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: memmove
- * Signature: (I[SI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_memmove__I_3SI
- (JNIEnv *env, jclass that, jint dest, jshortArray src, jint count)
-{
- jshort *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3SI\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetShortArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseShortArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: nl_langinfo
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_nl_1langinfo
- (JNIEnv *env, jclass that, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "nl_langinfo\n");
-#endif
-
- return (jint)nl_langinfo(item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: iconv_open
- * Signature: ([B[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_iconv_1open
- (JNIEnv *env, jclass that, jbyteArray tocode, jbyteArray fromcode)
-{
- jbyte *tocode1=NULL, *fromcode1=NULL;
- jint result;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "iconv_open\n");
-#endif
- if (tocode)
- tocode1 = (*env)->GetByteArrayElements(env, tocode, NULL);
- if (fromcode)
- fromcode1 = (*env)->GetByteArrayElements(env, fromcode, NULL);
- result = (jint)iconv_open(tocode1, fromcode1);
- if (tocode)
- (*env)->ReleaseByteArrayElements(env, tocode, tocode1, 0);
- if (fromcode)
- (*env)->ReleaseByteArrayElements(env, fromcode, fromcode1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: iconv_close
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_iconv_1close
- (JNIEnv *env, jclass that, jint cd)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "iconv_close\n");
-#endif
-
- return (jint)iconv_close((iconv_t)cd);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: iconv
- * Signature: (I[BI[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_iconv
- (JNIEnv *env, jclass that, jint cd, jintArray inBuf, jintArray inBytesLeft, jintArray outBuf, jintArray outBytesLeft)
-{
- jint *inBuf1=NULL, *outBuf1=NULL, *inBytesLeft1=NULL, *outBytesLeft1=NULL;
- jint result;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "iconv\n");
-#endif
- if (inBuf)
- inBuf1 = (*env)->GetIntArrayElements(env, inBuf, NULL);
- if (outBuf)
- outBuf1 = (*env)->GetIntArrayElements(env, outBuf, NULL);
- if (inBytesLeft)
- inBytesLeft1 = (*env)->GetIntArrayElements(env, inBytesLeft, NULL);
- if (outBytesLeft)
- outBytesLeft1 = (*env)->GetIntArrayElements(env, outBytesLeft, NULL);
- result = (jint)iconv((iconv_t)cd, (void *)inBuf1, (size_t *)inBytesLeft1, (char **)outBuf1, (size_t *)outBytesLeft1);
- if (inBuf)
- (*env)->ReleaseIntArrayElements(env, inBuf, inBuf1, 0);
- if (outBuf)
- (*env)->ReleaseIntArrayElements(env, outBuf, outBuf1, 0);
- if (inBytesLeft)
- (*env)->ReleaseIntArrayElements(env, inBytesLeft, inBytesLeft1, 0);
- if (outBytesLeft)
- (*env)->ReleaseIntArrayElements(env, outBytesLeft, outBytesLeft1, 0);
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: MB_1CUR_1MAX
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_MB_1CUR_1MAX
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "MB_1CUR_1MAX\n");
-#endif
-
- return (jint)MB_CUR_MAX;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XCreateFontSet
- * Signature: (I[B[I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XCreateFontSet
- (JNIEnv *env, jclass that, jint display, jbyteArray base_font_name_list, jintArray missing_charset_list_return, jintArray missing_charset_count_return, jintArray def_string_return)
-{
- jbyte *base_font_name_list1=NULL;
- jint *missing_charset_list_return1=NULL, *missing_charset_count_return1=NULL, *def_string_return1=NULL;
- jint result;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XCreateFontSet\n");
-#endif
- if (base_font_name_list)
- base_font_name_list1 = (*env)->GetByteArrayElements(env, base_font_name_list, NULL);
- if (missing_charset_list_return)
- missing_charset_list_return1 = (*env)->GetIntArrayElements(env, missing_charset_list_return, NULL);
- if (missing_charset_count_return)
- missing_charset_count_return1 = (*env)->GetIntArrayElements(env, missing_charset_count_return, NULL);
- if (def_string_return)
- def_string_return1 = (*env)->GetIntArrayElements(env, def_string_return, NULL);
- result = (jint)XCreateFontSet((Display *)display, (char *)base_font_name_list1, (char ***)missing_charset_list_return1, (int *)missing_charset_count_return1, (char **)def_string_return1);
- if (base_font_name_list)
- (*env)->ReleaseByteArrayElements(env, base_font_name_list, base_font_name_list1, 0);
- if (missing_charset_list_return)
- (*env)->ReleaseIntArrayElements(env, missing_charset_list_return, missing_charset_list_return1, 0);
- if (missing_charset_count_return)
- (*env)->ReleaseIntArrayElements(env, missing_charset_count_return, missing_charset_count_return1, 0);
- if (def_string_return)
- (*env)->ReleaseIntArrayElements(env, def_string_return, def_string_return1, 0);
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XLocaleOfFontSet
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XLocaleOfFontSet
- (JNIEnv *env, jclass that, jint fontSet)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XLocaleOfFontSet\n");
-#endif
-
- return (jint)XLocaleOfFontSet((XFontSet)fontSet);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: setlocale
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_setlocale
- (JNIEnv *env, jclass that, int category, jbyteArray locale)
-{
- jbyte *locale1=NULL;
- jint rc;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "setlocale\n");
-#endif
-
- if (locale)
- locale1 = (*env)->GetByteArrayElements(env, locale, NULL);
- rc = (jint) setlocale(category, (char *)locale1);
- if (locale)
- (*env)->ReleaseByteArrayElements(env, locale, locale1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XtInsertEventHandler
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XtInsertEventHandler
- (JNIEnv *env, jclass that, jint w, jint event_mask, jboolean nonmaskable, jint proc, jint client_data, jint position)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XtInsertEventHandler\n");
-#endif
-
- XtInsertEventHandler ((Widget) w, (EventMask) event_mask, (Boolean) nonmaskable, (XtEventHandler) proc, (XtPointer) client_data, (XtListPosition) position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmAddToPostFromList
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmAddToPostFromList
- (JNIEnv *env, jclass that, jint menu, jint post_from_widget)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmAddToPostFromList\n");
-#endif
-
- XmAddToPostFromList ((Widget) menu, (Widget) post_from_widget);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmRemoveFromPostFromList
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmRemoveFromPostFromList
- (JNIEnv *env, jclass that, jint menu, jint post_from_widget)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmRemoveFromPostFromList\n");
-#endif
-
- XmRemoveFromPostFromList ((Widget) menu, (Widget) post_from_widget);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: XmMenuPosition
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XmMenuPosition
- (JNIEnv *env, jclass that, jint menu, jint event)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "XmMenuPosition\n");
-#endif
-
- XmMenuPosition ((Widget) menu, (XButtonPressedEvent *) event);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_motif_OS
- * Method: _XmSetMenuTraversal
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS__1XmSetMenuTraversal
- (JNIEnv *env, jclass that, jint menu, jboolean traversal)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "_XmSetMenuTraversal\n");
-#endif
-
- _XmSetMenuTraversal ((Widget) menu, traversal);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/CDE.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/CDE.java
deleted file mode 100644
index bae2681133..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/CDE.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class CDE extends OS {
-
-public static final String DtDTS_DA_ACTION_LIST = "ACTIONS";
-public static final String DtDTS_DA_ICON = "ICON";
-public static final String DtDTS_DA_MIME_TYPE = "MIME_TYPE";
-public static final String DtDTS_DA_NAME_TEMPLATE = "NAME_TEMPLATE";
-
-
-public static final native boolean DtAppInitialize(
- int appContext,
- int display,
- int topWiget,
- byte[] appName,
- byte[] appClass );
-public static final native void DtDbLoad();
-public static final native int DtDtsDataTypeNames();
-public static final native int DtDtsFileToDataType( byte[] fileName );
-public static final native boolean DtDtsDataTypeIsAction( byte[] dataType );
-public static final native int DtDtsDataTypeToAttributeValue(
- byte[] dataType,
- byte[] attrName,
- byte[] optName );
-public static final native void DtDtsFreeDataType(int dataType);
-public static final native void DtDtsFreeDataTypeNames( int dataTypeList );
-public static final native void DtDtsFreeAttributeValue( int attrValue );
-public static final native int DtActionInvoke(
- int topWidget,
- byte[] action,
- byte[] fileName, // TBD: argument should be: DtActionArg[] args
- int argCount,
- byte[] termOpts,
- byte[] execHost,
- byte[] contextDir,
- int useIndicator,
- int callback,
- int clientData );
-
-// Utility methods for processing CDE related structures.
-
-public static final native int listElementAt( int nameList, int index );
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java
deleted file mode 100644
index aff863b710..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class GNOME extends OS {
-
-public static final native int g_get_home_dir();
-public static final native int gnome_datadir_file(byte[] fileName);
-public static final native void gnome_desktop_entry_free(int entry);
-public static final native int gnome_desktop_entry_load(byte[] fileName);
-public static final native int gnome_mime_get_value(byte[] mimeType, byte[] key);
-public static final native int gnome_mime_type(byte[] fileName);
-public static final native int gnome_pixmap_file(byte[] fileName);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/KDE.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/KDE.java
deleted file mode 100644
index eeb4c65232..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/KDE.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class KDE extends OS {
-
-public static final int KICON_SMALL = 0;
-
-public static final native int KApplication_new(int qcString);
-
-public static final native int KGlobal_iconLoader();
-
-public static final native int KIconLoader_iconPath(int loader, int iconQString, int iconType, int canReturnNull);
-
-public static final native int KMimeType_mimeType(int mimeTypeName);
-public static final native int KMimeType_icon(int mimeType, int unused1, int unused2);
-public static final native int KMimeType_name(int mimeType);
-public static final native int KMimeType_patterns(int mimeType);
-public static final native int KMimeType_offers(int mimeTypeName);
-public static final native int KMimeType_allMimeTypes();
-
-public static final native int KMimeTypeList_begin(int mimeTypeList);
-public static final native int KMimeTypeList_delete(int mimeTypeList);
-public static final native int KMimeTypeList_end(int mimeTypeList);
-
-public static final native int KMimeTypeListIterator_delete(int iterator);
-public static final native int KMimeTypeListIterator_dereference(int iterator);
-public static final native int KMimeTypeListIterator_equals(int iterator, int iterator2);
-public static final native void KMimeTypeListIterator_increment(int iterator);
-
-public static final native int QStringList_begin(int qstringList);
-public static final native int QStringList_delete(int qstringList);
-public static final native int QStringList_end(int qstringList);
-
-public static final native int QStringListIterator_delete(int iterator);
-public static final native int QStringListIterator_dereference(int iterator);
-public static final native int QStringListIterator_equals(int iterator, int iterator2);
-public static final native void QStringListIterator_increment(int iterator);
-
-public static final native int KURL_new( int qURLString );
-public static final native void KURL_delete( int url );
-public static final native int KRun_runURL( int url, int mimeTypeName );
-
-public static final native int KServiceList_delete(int serviceList);
-
-public static final native int QCString_data(int qcString);
-public static final native int QCString_delete(int qcString);
-public static final native int QCString_new(byte[] string);
-
-public static final native int QString_delete(int qString);
-public static final native int QString_equals(int qString, int qString2);
-public static final native int QString_new(byte[] string);
-public static final native int QString_utf8(int qString);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
deleted file mode 100644
index 237be6fb3c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
+++ /dev/null
@@ -1,1394 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-import org.eclipse.swt.internal.*;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class OS {
-
- /* Load the SWT library. */
- static {
- Library.loadLibrary ("swt");
- }
-
- /* OS and locale Constants*/
- public static final boolean IsAIX, IsSunOS, IsLinux;
- static {
-
- /* Initialize the OS flags and locale constants */
- String osName = System.getProperty ("os.name");
- boolean isAIX = false, isSunOS = false, isLinux = false;
- if (osName.equals ("Linux")) isLinux = true;
- if (osName.equals ("AIX")) isAIX = true;
- if (osName.equals ("Solaris")) isSunOS = true;
- if (osName.equals ("SunOS")) isSunOS = true;
- IsAIX = isAIX; IsSunOS = isSunOS; IsLinux = isLinux;
- }
- public static final int CODESET = OS.IsLinux ? 14 : 49;
- public static final int LC_CTYPE = OS.IsAIX ? 1 : 0;
-
- static final int RESOURCE_LENGTH = 1024 * 3;
- static final int RESOURCE_START = OS.XtMalloc (RESOURCE_LENGTH);
- static int NextResourceStart = RESOURCE_START;
- static {
- OS.setResourceMem (RESOURCE_START, RESOURCE_START + RESOURCE_LENGTH);
- }
-
- /*
- * Added for XmNpopupEnabled.
- */
-// public static final int XmPOPUP_DISABLED = 0;
-// public static final int XmPOPUP_KEYBBOARD = 1;
-// public static final int XmPOPUP_AUTOMATIC = 2;
-// public static final int XmPOPUP_AUTOMATIC_RECURSIVE = 3;
-
- /*
- * Added for XmNnavigationType.
- */
-// public static final int XmSTICKY_TAB_GROUP = 0x2;
-// public static final int XmEXCLUSIVE_TAB_GROUP = 0x3;
-
- /*
- * Added for XtInsertEventHandler.
- */
-// public static final int XtListHead = 0x0;
- public static final int XtListTail = 0x1;
-
- /* BEGIN Visual classes */
- //public static final int StaticGray = 0;
- //public static final int GrayScale = 1;
- //public static final int StaticColor = 2;
- //public static final int PseudoColor = 3;
- //public static final int TrueColor = 4;
- //public static final int DirectColor = 5;
- /* END Visual clases */
-
- /* X/Xt/Xm Constants */
- public static final byte [] XmFONTLIST_DEFAULT_TAG = {0x46, 0x4F, 0x4E, 0x54, 0x4C, 0x49, 0x53, 0x54, 0x5F, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4C, 0x54, 0x5F, 0x54, 0x41, 0x47, 0x5F, 0x53, 0x54, 0x52, 0x49, 0x4E, 0x47, 0x0};
- public static final int Above = 0;
- public static final int AllPlanes = 0xFFFFFFFF;
- public static final int AlreadyGrabbed = 1;
-// public static final int ArcChord = 0x0;
-// public static final int ArcPieSlice = 0x1;
- public static final int Below = 1;
-// public static final int BottomIf = 3;
- public static final int Button1Mask = (1<<8);
-// public static final int Button1MotionMask = 1 << 8;
- public static final int Button2Mask = (1<<9);
-// public static final int Button2MotionMask = 1 << 9;
- public static final int Button3Mask = (1<<10);
-// public static final int Button3MotionMask = 1 << 10;
-// public static final int Button4Mask = (1<<11);
-// public static final int Button4MotionMask = 1 << 11;
-// public static final int Button5Mask = (1<<12);
-// public static final int Button5MotionMask = 1 << 12;
-// public static final int ButtonMotionMask = 1 << 13;
- public static final int ButtonPress = 4;
- public static final int ButtonPressMask = 1 << 2;
- public static final int ButtonRelease = 5;
- public static final int ButtonReleaseMask = 1 << 3;
- public static final int CapButt = 0x1;
-// public static final int CapNotLast = 0x0;
-// public static final int CapProjecting = 0x3;
-// public static final int CapRound = 0x2;
-// public static final int CenterGravity = 5;
-// public static final int CirculateNotify = 26;
-// public static final int CirculateRequest = 27;
-// public static final int ClientMessage = 33;
-// public static final int ClipByChildren = 0x0;
-// public static final int ColormapChangeMask = 1 << 23;
-// public static final int ColormapNotify = 32;
- public static final int Complex = 0;
- public static final int ConfigureNotify = 22;
-// public static final int ConfigureRequest = 23;
- public static final int ControlMask = (1<<2);
- public static final int Convex = 2;
- public static final int CoordModeOrigin = 0x0;
-// public static final int CoordModePrevious = 0x1;
-// public static final int CreateNotify = 16;
- public static final int CurrentTime = 0;
-// public static final int CWBackingPixel = 0x100;
-// public static final int CWBackingPlanes = 0x80;
-// public static final int CWBackingStore = 0x40;
-// public static final int CWBackPixel = 0x2;
- public static final int CWBackPixmap = 0x1;
- public static final int CWBitGravity = 0x10;
-// public static final int CWBorderPixel = 0x8;
-// public static final int CWBorderPixmap = 0x4;
-// public static final int CWBorderWidth = 0x10;
-// public static final int CWColormap = 0x2000;
-// public static final int CWCursor = 0x4000;
- public static final int CWDontPropagate = 0x1000;
- public static final int CWEventMask = 0x800;
- public static final int CWHeight = 0x8;
-// public static final int CWOverrideRedirect = 0x200;
-// public static final int CWSaveUnder = 0x400;
- public static final int CWSibling = 0x20;
- public static final int CWStackMode = 0x40;
- public static final int CWWidth = 0x4;
-// public static final int CWWinGravity = 0x20;
-// public static final int CWX = 0x1;
-// public static final int CWY = 0x2;
-// public static final int DestroyNotify = 17;
-// public static final int EastGravity = 6;
- public static final int EnterNotify = 7;
- public static final int EnterWindowMask = 1 << 4;
-// public static final int EvenOddRule = 0x0;
- public static final int Expose = 12;
- public static final int ExposureMask = 1 << 15;
-// public static final int FillOpaqueStippled = 0x3;
-// public static final int FillSolid = 0x0;
- public static final int FillStippled = 0x2;
-// public static final int FillTiled = 0x1;
- public static final int FocusChangeMask = 1 << 21;
- public static final int FocusIn = 9;
- public static final int FocusOut = 10;
- public static final int ForgetGravity = 0;
-// public static final int GCArcMode = 0x400000;
- public static final int GCBackground = 0x8;
-// public static final int GCCapStyle = 0x40;
-// public static final int GCClipMask = 0x80000;
-// public static final int GCClipXOrigin = 0x20000;
-// public static final int GCClipYOrigin = 0x40000;
-// public static final int GCDashList = 0x200000;
-// public static final int GCDashOffset = 0x100000;
-// public static final int GCFillRule = 0x200;
-// public static final int GCFillStyle = 0x100;
-// public static final int GCFont = 0x4000;
- public static final int GCForeground = 0x4;
- public static final int GCFunction = 0x1;
-// public static final int GCGraphicsExposures = 0x10000;
-// public static final int GCJoinStyle = 0x80;
-// public static final int GCLastBit = 0x16;
-// public static final int GCLineStyle = 0x20;
- public static final int GCLineWidth = 0x10;
-// public static final int GCPlaneMask = 0x2;
-// public static final int GCStipple = 0x800;
- public static final int GCSubwindowMode = 0x8000;
-// public static final int GCTile = 0x400;
-// public static final int GCTileStipXOrigin = 0x1000;
-// public static final int GCTileStipYOrigin = 0x2000;
-// public static final int GrabFrozen = 4;
-// public static final int GrabInvalidTime = 2;
- public static final int GrabModeAsync = 1;
-// public static final int GrabModeSync = 0;
-// public static final int GrabNotViewable = 3;
-// public static final int GrabSuccess = 0;
- public static final int GraphicsExpose = 13;
-// public static final int GravityNotify = 24;
- public static final int GXand = 0x1;
-// public static final int GXandInverted = 0x4;
-// public static final int GXandReverse = 0x2;
-// public static final int GXclear = 0x0;
- public static final int GXcopy = 0x3;
-// public static final int GXcopy = 0x3;
-// public static final int GXcopyInverted = 0xC;
-// public static final int GXequiv = 0x9;
-// public static final int GXinvert = 0xA;
-// public static final int GXnand = 0xE;
-// public static final int GXnoop = 0x5;
-// public static final int GXnor = 0x8;
- public static final int GXor = 0x7;
-// public static final int GXorInverted = 0xD;
-// public static final int GXorReverse = 0xB;
-// public static final int GXset = 0xF;
- public static final int GXxor = 0x6;
- public static final int IncludeInferiors = 0x1;
-// public static final int IsUnmapped = 0x0;
- public static final int IsUnviewable = 0x1;
- public static final int IsViewable = 0x2;
-// public static final int JoinBevel = 0x2;
- public static final int JoinMiter = 0x0;
-// public static final int JoinRound = 0x1;
-// public static final int KeymapNotify = 11;
-// public static final int KeymapStateMask = 1 << 14;
- public static final int KeyPress = 2;
- public static final int KeyPressMask = 1 << 0;
- public static final int KeyRelease = 3;
- public static final int KeyReleaseMask = 1 << 1;
- public static final int LeaveNotify = 8;
- public static final int LeaveWindowMask = 1 << 5;
- public static final int LineDoubleDash = 0x2;
- public static final int LineOnOffDash = 0x1;
- public static final int LineSolid = 0x0;
-// public static final int LockMask = (1<<1);
- public static final int LSBFirst = 0;
- public static final int MapNotify = 19;
-// public static final int MappingNotify = 34;
-// public static final int MapRequest = 20;
- public static final int Mod1Mask = (1<<3);
-// public static final int Mod2Mask = (1<<4);
-// public static final int Mod3Mask = (1<<5);
-// public static final int Mod4Mask = (1<<6);
-// public static final int Mod5Mask = (1<<7);
- public static final int MotionNotify = 6;
- public static final int MSBFirst = 1;
-// public static final int MWM_DECOR_ALL = 0x1;
- public static final int MWM_DECOR_BORDER = 0x2;
- public static final int MWM_DECOR_MAXIMIZE = 0x40;
- public static final int MWM_DECOR_MENU = 0x10;
- public static final int MWM_DECOR_MINIMIZE = 0x20;
- public static final int MWM_DECOR_RESIZEH = 0x4;
- public static final int MWM_DECOR_TITLE = 0x8;
-// public static final int MWM_FUNC_ALL = 0x1;
-// public static final int MWM_FUNC_CLOSE = 0x20;
-// public static final int MWM_FUNC_MAXIMIZE = 0x10;
-// public static final int MWM_FUNC_MINIMIZE = 0x8;
-// public static final int MWM_FUNC_MOVE = 0x4;
-// public static final int MWM_FUNC_RESIZE = 0x2;
-// public static final int MWM_HINTS_DECORATIONS = 0x2;
-// public static final int MWM_HINTS_FUNCTIONS = 0x1;
-// public static final int MWM_HINTS_INPUT_MODE = 0x4;
-// public static final int MWM_HINTS_STATUS = 0x8;
-// public static final int MWM_INFO_STARTUP_CUSTOM = 0x2;
-// public static final int MWM_INFO_STARTUP_STANDARD = 0x1;
- public static final int MWM_INPUT_FULL_APPLICATION_MODAL = 0x3;
- public static final int MWM_INPUT_MODELESS = 0x0;
- public static final int MWM_INPUT_PRIMARY_APPLICATION_MODAL = 0x1;
- public static final int MWM_INPUT_SYSTEM_MODAL = 0x2;
-// public static final int MWM_TEAR_OFF_WINDOW = 0x1;
-// public static final int NoEventMask = 0;
-// public static final int NoExpose = 14;
-// public static final int Nonconvex = 1;
- public static final int None = 0;
-// public static final int NorthEastGravity = 3;
-// public static final int NorthGravity = 2;
- public static final int NorthWestGravity = 1;
-// public static final int NorthWestGravity = 1;
- public static final int NotifyAncestor = 0x0;
-// public static final int NotifyDetailNone = 0x7;
-// public static final int NotifyGrab = 0x1;
-// public static final int NotifyHint = 0x1;
- public static final int NotifyInferior = 0x2;
- public static final int NotifyNonlinear = 0x3;
-// public static final int NotifyNonlinearVirtual = 0x4;
- public static final int NotifyNormal = 0x0;
-// public static final int NotifyPointer = 0x5;
-// public static final int NotifyPointerRoot = 0x6;
-// public static final int NotifyUngrab = 0x2;
-// public static final int NotifyVirtual = 0x1;
-// public static final int NotifyWhileGrabbed = 0x3;
-// public static final int Opposite = 4;
-// public static final int OwnerGrabButtonMask = 1 << 24;
-// public static final int PointerMotionHintMask = 1 << 7;
- public static final int PointerMotionMask = 1 << 6;
-// public static final int PropertyChangeMask = 1 << 22;
-// public static final int PropertyNotify = 28;
-// public static final int RectangleIn = 0x1;
- public static final int RectangleOut = 0x0;
-// public static final int RectanglePart = 0x2;
- public static final int ReparentNotify = 21;
- public static final int ResizeRedirectMask = 1 << 18;
-// public static final int ResizeRequest = 25;
-// public static final int RevertToNone = 0x0;
- public static final int RevertToParent = 0x2;
-// public static final int RevertToPointerRoot = 0x1;
-// public static final int SelectionClear = 29;
-// public static final int SelectionNotify = 31;
-// public static final int SelectionRequest = 30;
- public static final int ShiftMask = (1<<0);
-// public static final int SouthEastGravity = 9;
-// public static final int SouthGravity = 8;
-// public static final int SouthWestGravity = 7;
-// public static final int StaticGravity = 10;
- public static final int StructureNotifyMask = 1 << 17;
- public static final int SubstructureNotifyMask = 1 << 19;
- public static final int SubstructureRedirectMask = 1 << 20;
-// public static final int TopIf = 2;
- public static final int UnmapNotify = 18;
- public static final int Unsorted = 0x0;
-// public static final int VisibilityChangeMask = 1 << 16;
-// public static final int VisibilityNotify = 15;
-// public static final int WestGravity = 4;
-// public static final int WindingRule = 0x1;
- public static final int XA_FONT = 18;
- public static final int XBufferOverflow = 0xFFFFFFFF;
-// public static final int XC_arrow = 2;
-// public static final int XC_based_arrow_down = 4;
-// public static final int XC_based_arrow_up = 6;
-// public static final int XC_boat = 8;
-// public static final int XC_bogosity= 10;
- public static final int XC_bottom_left_corner = 12;
- public static final int XC_bottom_right_corner = 14;
- public static final int XC_bottom_side = 16;
-// public static final int XC_bottom_tee = 18;
-// public static final int XC_box_spiral = 20;
-// public static final int XC_center_ptr = 22;
-// public static final int XC_circle = 24;
-// public static final int XC_clock = 26;
-// public static final int XC_coffee_mug = 28;
- public static final int XC_cross = 30;
-// public static final int XC_cross_reverse = 32;
-// public static final int XC_crosshair = 34;
- public static final int XC_diamond_cross = 36;
-// public static final int XC_dot = 38;
-// public static final int XC_dotbox = 40;
- public static final int XC_double_arrow = 42;
-// public static final int XC_draft_large = 44;
-// public static final int XC_draft_small = 46;
-// public static final int XC_draped_box = 48;
-// public static final int XC_exchange = 50;
-// public static final int XC_fleur = 52;
-// public static final int XC_gobbler = 54;
-// public static final int XC_gumby = 56;
-// public static final int XC_hand1 = 58;
- public static final int XC_hand2 = 60;
-// public static final int XC_heart = 62;
-// public static final int XC_icon = 64;
-// public static final int XC_iron_cross = 66;
- public static final int XC_left_ptr = 68;
- public static final int XC_left_side = 70;
-// public static final int XC_left_tee = 72;
-// public static final int XC_leftbutton = 74;
-// public static final int XC_ll_angle = 76;
-// public static final int XC_lr_angle = 78;
-// public static final int XC_man = 80;
-// public static final int XC_middlebutton = 82;
-// public static final int XC_mouse = 84;
-// public static final int XC_num_glyphs = 154;
-// public static final int XC_pencil = 86;
-// public static final int XC_pirate = 88;
-// public static final int XC_plus = 90;
- public static final int XC_question_arrow = 92;
-// public static final int XC_right_ptr = 94;
- public static final int XC_right_side = 96;
-// public static final int XC_right_tee = 98;
-// public static final int XC_rightbutton = 100;
-// public static final int XC_rtl_logo = 102;
-// public static final int XC_sailboat = 104;
-// public static final int XC_sb_down_arrow = 106;
- public static final int XC_sb_h_double_arrow = 108;
-// public static final int XC_sb_left_arrow = 110;
-// public static final int XC_sb_right_arrow = 112;
- public static final int XC_sb_up_arrow = 114;
- public static final int XC_sb_v_double_arrow = 116;
-// public static final int XC_shuttle = 118;
- public static final int XC_sizing = 120;
-// public static final int XC_spider = 122;
-// public static final int XC_spraycan = 124;
-// public static final int XC_star = 126;
-// public static final int XC_target = 128;
-// public static final int XC_tcross = 130;
-// public static final int XC_top_left_arrow = 132;
- public static final int XC_top_left_corner = 134;
- public static final int XC_top_right_corner = 136;
- public static final int XC_top_side = 138;
-// public static final int XC_top_tee = 140;
-// public static final int XC_trek = 142;
-// public static final int XC_ul_angle = 144;
-// public static final int XC_umbrella = 146;
-// public static final int XC_ur_angle = 148;
- public static final int XC_watch = 150;
- public static final int XC_X_cursor = 0;
- public static final int XC_xterm = 152;
- public static final int XK_Alt_L = 0xFFE9;
- public static final int XK_Alt_R = 0xFFEA;
- public static final int XK_Cancel = 0xFF69;
- public static final int XK_Control_L = 0xFFE3;
- public static final int XK_Control_R = 0xFFE4;
-// public static final int XK_Delete = 0xFFFF;
- public static final int XK_Down = 0xFF54;
- public static final int XK_End = 0xFF57;
- public static final int XK_Escape = 0xFF1B;
- public static final int XK_F1 = 0xFFBE;
- public static final int XK_F10 = 0xFFC7;
- public static final int XK_F11 = 0xFFC8;
- public static final int XK_F12 = 0xFFC9;
- public static final int XK_F2 = 0xFFBF;
- public static final int XK_F3 = 0xFFC0;
- public static final int XK_F4 = 0xFFC1;
- public static final int XK_F5 = 0xFFC2;
- public static final int XK_F6 = 0xFFC3;
- public static final int XK_F7 = 0xFFC4;
- public static final int XK_F8 = 0xFFC5;
- public static final int XK_F9 = 0xFFC6;
- public static final int XK_Home = 0xFF50;
- public static final int XK_Insert = 0xFF63;
- public static final int XK_ISO_Left_Tab = 0xFE20;
-// public static final int XK_KP_0 = 0xFFB0;
-// public static final int XK_KP_1 = 0xFFB1;
-// public static final int XK_KP_2 = 0xFFB2;
-// public static final int XK_KP_3 = 0xFFB3;
-// public static final int XK_KP_4 = 0xFFB4;
-// public static final int XK_KP_5 = 0xFFB5;
-// public static final int XK_KP_6 = 0xFFB6;
-// public static final int XK_KP_7 = 0xFFB7;
-// public static final int XK_KP_8 = 0xFFB8;
-// public static final int XK_KP_9 = 0xFFB9;
-// public static final int XK_KP_Add = 0xFFAB;
-// public static final int XK_KP_Decimal = 0xFFAE;
-// public static final int XK_KP_Divide = 0xFFAF;
-// public static final int XK_KP_Enter = 0xFF8D;
-// public static final int XK_KP_Multiply = 0xFFAA;
-// public static final int XK_KP_Subtract = 0xFFAD;
- public static final int XK_Left = 0xFF51;
- public static final int XK_Page_Down = 0xFF56;
- public static final int XK_Page_Up = 0xFF55;
- public static final int XK_Right = 0xFF53;
- public static final int XK_Return = 0xFF0D;
- public static final int XK_Shift_L = 0xFFE1;
- public static final int XK_Shift_R = 0xFFE2;
- public static final int XK_space = 0x20;
- public static final int XK_Tab = 0xFF09;
- public static final int XK_Up = 0xFF52;
- public static final int XK_VoidSymbol = 0xFFFFFF;
-// public static final int XLookupBoth = 0x4;
-// public static final int XLookupChars = 0x2;
-// public static final int XLookupKeySym = 0x3;
-// public static final int XLookupNone = 0x1;
- public static final int XmALIGNMENT_BEGINNING = 0x0;
- public static final int XmALIGNMENT_CENTER = 0x1;
- public static final int XmALIGNMENT_END = 0x2;
- public static final int XmARROW_DOWN = 0x1;
- public static final int XmARROW_LEFT = 0x2;
- public static final int XmARROW_RIGHT = 0x3;
- public static final int XmARROW_UP = 0x0;
-// public static final int XmARROWS_END = 0x0;
-// public static final int XmAS_NEEDED = 0x1;
-// public static final int XmATTACH_CENTER = 0x8;
-// public static final int XmATTACH_EAST = 0x3;
- public static final int XmATTACH_FORM = 0x1;
-// public static final int XmATTACH_HOT = 0x9;
-// public static final int XmATTACH_NONE = 0x0;
-// public static final int XmATTACH_NORTH = 0x1;
-// public static final int XmATTACH_NORTH_EAST = 0x2;
-// public static final int XmATTACH_NORTH_WEST = 0x0;
-// public static final int XmATTACH_OPPOSITE_FORM = 0x2;
-// public static final int XmATTACH_OPPOSITE_WIDGET = 0x4;
-// public static final int XmATTACH_POSITION = 0x5;
-// public static final int XmATTACH_SELF = 0x6;
-// public static final int XmATTACH_SOUTH = 0x5;
-// public static final int XmATTACH_SOUTH_EAST = 0x4;
-// public static final int XmATTACH_SOUTH_WEST = 0x6;
-// public static final int XmATTACH_WEST = 0x7;
-// public static final int XmATTACH_WIDGET = 0x3;
- public static final int XmBLEND_ALL = 0x0;
- public static final int XmBROWSE_SELECT = 0x3;
- public static final int XmCHARSET_TEXT = 0x0;
- public static final int XmClipboardFail = 0x0;
- public static final int XmClipboardSuccess = 0x1;
- public static final int XmClipboardLocked = 0x4;
- public static final int XmClipboardNoData = 0x6;
- public static final int XmCOMBO_BOX = 0x0;
- public static final int XmCONSTANT = 0x1;
- public static final int XmCOPY_FAILED = 0x0;
-// public static final int XmCOPY_SUCCEEDED = 0x1;
- public static final int XmCOPY_TRUNCATED = 0x2;
-// public static final int XmCR_ACTIVATE = 0xA;
-// public static final int XmCR_APPLY = 0x22;
-// public static final int XmCR_ARM = 0xB;
-// public static final int XmCR_BROWSE_SELECT = 0x1A;
-// public static final int XmCR_CANCEL = 0x20;
-// public static final int XmCR_CASCADING = 0x1E;
-// public static final int XmCR_CLIPBOARD_DATA_DELETE = 0x1D;
-// public static final int XmCR_CLIPBOARD_DATA_REQUEST = 0x1C;
-// public static final int XmCR_COMMAND_CHANGED = 0x25;
-// public static final int XmCR_COMMAND_ENTERED = 0x24;
-// public static final int XmCR_CREATE = 0x2B;
- public static final int XmCR_DECREMENT = 0x4;
-// public static final int XmCR_DEFAULT_ACTION = 0x1B;
-// public static final int XmCR_DISARM = 0xC;
- public static final int XmCR_DRAG = 0x9;
-// public static final int XmCR_DRAGDROP_FINISH = 0x7;
-// public static final int XmCR_DRAG_MOTION = 0x2;
-// public static final int XmCR_DROP_FINISH = 0x6;
-// public static final int XmCR_DROP_MESSAGE = 0x4;
-// public static final int XmCR_DROP_SITE_ENTER = 0x3;
- public static final int XmCR_DROP_SITE_ENTER_MESSAGE = 0x2;
-// public static final int XmCR_DROP_SITE_LEAVE = 0x4;
- public static final int XmCR_DROP_SITE_LEAVE_MESSAGE = 0x1;
- public static final int XmCR_DROP_SITE_MOTION_MESSAGE = 0x3;
-// public static final int XmCR_DROP_START = 0x5;
-// public static final int XmCR_EXECUTE = 0x16;
-// public static final int XmCR_EXPOSE = 0x26;
-// public static final int XmCR_EXTENDED_SELECT = 0x19;
-// public static final int XmCR_FOCUS = 0x12;
-// public static final int XmCR_GAIN_PRIMARY = 0x29;
-// public static final int XmCR_HELP = 0x1;
- public static final int XmCR_INCREMENT = 0x3;
-// public static final int XmCR_INPUT = 0x28;
-// public static final int XmCR_LOSE_PRIMARY = 0x2A;
-// public static final int XmCR_LOSING_FOCUS = 0x13;
-// public static final int XmCR_MAP = 0x10;
-// public static final int XmCR_MODIFYING_TEXT_VALUE = 0x14;
-// public static final int XmCR_MOVING_INSERT_CURSOR = 0x15;
-// public static final int XmCR_MULTIPLE_SELECT = 0x18;
-// public static final int XmCR_NO_MATCH = 0x23;
-// public static final int XmCR_NONE = 0x0;
-// public static final int XmCR_OBSCURED_TRAVERSAL = 0x2E;
-// public static final int XmCR_OK = 0x1F;
- public static final int XmCR_OPERATION_CHANGED = 0x8;
- public static final int XmCR_PAGE_DECREMENT = 0x6;
- public static final int XmCR_PAGE_INCREMENT = 0x5;
-// public static final int XmCR_PROTOCOLS = 0x2F;
-// public static final int XmCR_RESIZE = 0x27;
-// public static final int XmCR_SINGLE_SELECT = 0x17;
-// public static final int XmCR_TEAR_OFF_ACTIVATE = 0x2C;
-// public static final int XmCR_TEAR_OFF_DEACTIVATE = 0x2D;
- public static final int XmCR_TO_BOTTOM = 0x8;
-// public static final int XmCR_TOP_LEVEL_ENTER = 0x0;
-// public static final int XmCR_TOP_LEVEL_LEAVE = 0x1;
- public static final int XmCR_TO_TOP = 0x7;
-// public static final int XmCR_UNMAP = 0x11;
- public static final int XmCR_VALUE_CHANGED = 0x2;
-// public static final int XmCR_WMPROTOCOLS = 0x1A0A;
- public static final int XmDEFAULT_SELECT_COLOR = -1;
-// public static final int XmDESTROY = 0x0;
- public static final int XmDIALOG_APPLICATION_MODAL = 0x1;
- public static final int XmDIALOG_APPLY_BUTTON = 0x1;
- public static final int XmDIALOG_CANCEL_BUTTON = 0x2;
-// public static final int XmDIALOG_COMMAND = 0x3;
-// public static final int XmDIALOG_COMMAND_TEXT = 0xD;
-// public static final int XmDIALOG_DEFAULT_BUTTON = 0x3;
-// public static final int XmDIALOG_DIR_LIST = 0xF;
-// public static final int XmDIALOG_DIR_LIST_LABEL = 0x10;
-// public static final int XmDIALOG_ERROR = 0x1;
-// public static final int XmDIALOG_FILE_LIST = 0x8;
-// public static final int XmDIALOG_FILE_LIST_LABEL = 0x9;
-// public static final int XmDIALOG_FILE_SELECTION = 0x4;
- public static final int XmDIALOG_FILTER_LABEL = 0x5;
- public static final int XmDIALOG_FILTER_TEXT = 0x6;
- public static final int XmDIALOG_FULL_APPLICATION_MODAL = 0x2;
- public static final int XmDIALOG_HELP_BUTTON = 0x7;
-// public static final int XmDIALOG_HISTORY_LIST = 0x8;
-// public static final int XmDIALOG_INFORMATION = 0x2;
- public static final int XmDIALOG_LIST = 0x8;
- public static final int XmDIALOG_LIST_LABEL = 0x9;
-// public static final int XmDIALOG_MESSAGE = 0x3;
- public static final int XmDIALOG_MESSAGE_LABEL = 0xA;
- public static final int XmDIALOG_MODELESS = 0x0;
-// public static final int XmDIALOG_NONE = 0x0;
- public static final int XmDIALOG_OK_BUTTON = 0x4;
- public static final int XmDIALOG_PRIMARY_APPLICATION_MODAL = 0x1;
-// public static final int XmDIALOG_PROMPT = 0x1;
-// public static final int XmDIALOG_PROMPT_LABEL = 0xB;
-// public static final int XmDIALOG_QUESTION = 0x4;
-// public static final int XmDIALOG_SELECTION = 0x2;
- public static final int XmDIALOG_SELECTION_LABEL = 0xB;
-// public static final int XmDIALOG_SEPARATOR = 0xE;
-// public static final int XmDIALOG_SYMBOL_LABEL = 0xC;
- public static final int XmDIALOG_SYSTEM_MODAL = 0x3;
-// public static final int XmDIALOG_TEMPLATE = 0x0;
- public static final int XmDIALOG_TEXT = 0xD;
-// public static final int XmDIALOG_VALUE_TEXT = 0xD;
-// public static final int XmDIALOG_WARNING = 0x5;
-// public static final int XmDIALOG_WORK_AREA = 0x0;
-// public static final int XmDIALOG_WORKING = 0x6;
- public static final int XmDO_NOTHING = 0x2;
-// public static final int XmDOUBLE_DASHED_LINE = 0x4;
-// public static final int XmDOUBLE_LINE = 0x2;
- public static final int XmDRAG_DYNAMIC = 5;
- public static final int XmDRAG_UNDER_NONE = 0;
- public static final byte XmDROP_COPY = (1 << 1);
- public static final int XmDROP_DOWN_COMBO_BOX = 0x1;
- public static final int XmDROP_DOWN_LIST = 0x2;
- public static final byte XmDROP_LINK = (1 << 2);
- public static final byte XmDROP_MOVE = (1 << 0);
- public static final byte XmDROP_NOOP = 0;
- public static final int XmDROP_SITE_ACTIVE = 0;
- public static final int XmDROP_SITE_INVALID = 2;
- public static final int XmDROP_SITE_VALID = 3;
- public static final int XmDROP_SITE_COMPOSITE = 1;
- public static final byte XmDROP = 0;
- public static final int XmEXTENDED_SELECT = 0x2;
- public static final int XmFONT_IS_FONT = 0x0;
- public static final int XmFONT_IS_FONTSET = 0x1;
-// public static final int XmFRAME_GENERIC_CHILD = 0x0;
- public static final int XmFRAME_TITLE_CHILD = 0x2;
-// public static final int XmFRAME_WORKAREA_CHILD = 0x1;
- public static final int XmHIGHLIGHT_COLOR = -3;
- public static final int XmHIGHLIGHT_NORMAL = 0x0;
-// public static final int XmHIGHLIGHT_SECONDARY_SELECTED = 0x2;
-// public static final int XmHIGHLIGHT_SELECTED = 0x1;
- public static final int XmHORIZONTAL = 0x2;
- public static final int XmLAST_POSITION = -1;
- public static final int XmMAX_ON_BOTTOM = 0x1;
-// public static final int XmMAX_ON_LEFT = 0x2;
- public static final int XmMAX_ON_RIGHT = 0x3;
- public static final int XmMAX_ON_TOP = 0x0;
- public static final int XmMERGE_REPLACE = 0x1;
- public static final int XmMULTI_LINE_EDIT = 0x0;
- public static final int XmMULTIPLE_SELECT = 0x1;
- public static final int XmN_OF_MANY = 0x1;
- public static final int XmNONE = 0x0;
-// public static final int XmNUMERIC = 0x3;
-
- /* byte */
- public static final int XmNancestorSensitive = malloc ("ancestorSensitive", 1);
- public static final int XmNanimationStyle = malloc ("animationStyle", 1);
- public static final int XmNalignment = malloc ("alignment", 1);
- public static final int XmNallowShellResize = malloc ("allowShellResize", 1);
- public static final int XmNarrowDirection = malloc ("arrowDirection", 1);
- public static final int XmNblendModel = malloc ("blendModel", 1);
- public static final int XmNbottomAttachment = malloc ("bottomAttachment", 1);
- public static final int XmNchildType = malloc ("childType", 1);
- public static final int XmNcomboBoxType = malloc ("comboBoxType", 1);
- public static final int XmNdialogStyle = malloc ("dialogStyle", 1);
- public static final int XmNcursorPositionVisible = malloc ("cursorPositionVisible", 1);
- public static final int XmNdeleteResponse = malloc ("deleteResponse", 1);
- public static final int XmNdragInitiatorProtocolStyle = malloc ("dragInitiatorProtocolStyle", 1);
- public static final int XmNdragReceiverProtocolStyle = malloc ("dragReceiverProtocolStyle", 1);
- public static final int XmNdragOperations = malloc ("dragOperations", 1);
- public static final int XmNdropSiteActivity = malloc ("dropSiteActivity", 1);
- public static final int XmNdropSiteOperations = malloc ("dropSiteOperations", 1);
- public static final int XmNdropSiteType = malloc ("dropSiteType", 1);
- public static final int XmNeditable = malloc ("editable", 1);
- public static final int XmNenableThinThickness = malloc ("enableThinThickness", 1);
- public static final int XmNiconic = malloc ("iconic", 1);
- public static final int XmNlabelType = malloc ("labelType", 1);
- public static final int XmNleftAttachment = malloc ("leftAttachment", 1);
- public static final int XmNlistSizePolicy = malloc ("listSizePolicy", 1);
- public static final int XmNindicatorOn = malloc ("indicatorOn", 1);
- public static final int XmNindicatorType = malloc ("indicatorType", 1);
- public static final int XmNnoResize = malloc ("noResize", 1);
- public static final int XmNorientation = malloc ("orientation", 1);
- public static final int XmNoverrideRedirect = malloc ("overrideRedirect", 1);
- public static final int XmNprocessingDirection = malloc ("processingDirection", 1);
- public static final int XmNrecomputeSize = malloc ("recomputeSize", 1);
- public static final int XmNpushButtonEnabled = malloc ("pushButtonEnabled", 1);
- public static final int XmNresizable = malloc ("resizable", 1);
- public static final int XmNresizePolicy = malloc ("resizePolicy", 1);
- public static final int XmNrightAttachment = malloc ("rightAttachment", 1);
- public static final int XmNscrollHorizontal = malloc ("scrollHorizontal", 1);
- public static final int XmNscrollVertical = malloc ("scrollVertical", 1);
- public static final int XmNselectColor = malloc ("selectColor", 1);
- public static final int XmNselectionPolicy = malloc ("selectionPolicy", 1);
- public static final int XmNsensitive = malloc ("sensitive", 1);
- public static final int XmNseparatorType = malloc ("separatorType", 1);
- public static final int XmNset = malloc ("set", 1);
- public static final int XmNshadowType = malloc ("shadowType", 1);
- public static final int XmNtraversalOn = malloc ("traversalOn", 1);
- public static final int XmNtopAttachment = malloc ("topAttachment", 1);
- public static final int XmNverifyBell = malloc ("verifyBell", 1);
- public static final int XmNwordWrap = malloc ("wordWrap", 1);
- public static final int XmNnavigationType = malloc ("navigationType", 1);
-
- /* short */
- public static final int XmNarrowSize = malloc ("arrowSize", 2);
- public static final int XmNarrowSpacing = malloc ("arrowSpacing", 2);
- public static final int XmNborderWidth = malloc ("borderWidth", 2);
- public static final int XmNheight = malloc ("height", 2);
- public static final int XmNhighlightThickness = malloc ("highlightThickness", 2);
- public static final int XmNlistMarginHeight = malloc ("listMarginHeight", 2);
- public static final int XmNlistMarginWidth = malloc ("listMarginWidth", 2);
- public static final int XmNlistSpacing = malloc ("listSpacing", 2);
- public static final int XmNmarginBottom = malloc ("marginBottom", 2);
- public static final int XmNmarginHeight = malloc ("marginHeight", 2);
- public static final int XmNmarginLeft = malloc ("marginLeft", 2);
- public static final int XmNmarginRight = malloc ("marginRight", 2);
- public static final int XmNmarginTop = malloc ("marginTop", 2);
- public static final int XmNmarginWidth = malloc ("marginWidth", 2);
- public static final int XmNpositionIndex = malloc ("positionIndex", 2);
- public static final int XmNrows = malloc ("rows", 2);
- public static final int XmNshadowThickness = malloc ("shadowThickness", 2);
- public static final int XmNshowAsDefault = malloc ("showAsDefault", 2);
- public static final int XmNwidth = malloc ("width", 2);
- public static final int XmNx = malloc ("x", 2);
- public static final int XmNy = malloc ("y", 2);
-
- /* int */
- public static final int XmNaccelerator = malloc ("accelerator", 4);
- public static final int XmNacceleratorText = malloc ("acceleratorText", 4);
- public static final int XmNactivateCallback = malloc ("activateCallback", 4);
- public static final int XmNarmCallback = malloc ("armCallback", 4);
- public static final int XmNbackground = malloc ("background", 4);
- public static final int XmNborderColor = malloc ("borderColor", 4);
- public static final int XmNbottomShadowColor = malloc ("bottomShadowColor", 4);
- public static final int XmNbrowseSelectionCallback = malloc ("browseSelectionCallback", 4);
- public static final int XmNcancelCallback = malloc ("cancelCallback", 4);
- public static final int XmNcancelLabelString = malloc ("cancelLabelString", 4);
- public static final int XmNcascadingCallback = malloc ("cascadingCallback", 4);
- public static final int XmNchildren = malloc ("children", 4);
- public static final int XmNclientData = malloc ("clientData", 4);
- public static final int XmNcolormap = malloc ("colormap", 4);
- public static final int XmNconvertProc = malloc ("convertProc", 4);
- public static final int XmNdecrementCallback = malloc ("decrementCallback", 4);
- public static final int XmNdefaultActionCallback = malloc ("defaultActionCallback", 4);
- public static final int XmNdefaultButtonShadowThickness = malloc ("defaultButtonShadowThickness", 4);
- public static final int XmNdialogTitle = malloc ("dialogTitle", 4);
- public static final int XmNdirectory = malloc ("directory", 4);
- public static final int XmNdirSpec = malloc ("dirSpec", 4);
- public static final int XmNdirMask = malloc ("dirMask", 4);
- public static final int XmNdragCallback = malloc ("dragCallback", 4);
- public static final int XmNdragDropFinishCallback = malloc ("dragDropFinishCallback", 4);
- public static final int XmNdragProc = malloc ("dragProc", 4);
- public static final int XmNdropFinishCallback = malloc ("dropFinishCallback", 4);
- public static final int XmNdropProc = malloc("dropProc", 4);
- public static final int XmNeditMode = malloc ("editMode", 4);
- public static final int XmNexportTargets = malloc ("exportTargets", 4);
- public static final int XmNexposeCallback = malloc ("exposeCallback", 4);
- public static final int XmNextendedSelectionCallback = malloc ("extendedSelectionCallback", 4);
- public static final int XmNfilterLabelString = malloc ("filterLabelString", 4);
- public static final int XmNfont = malloc ("font", 4);
- public static final int XmNfontList = malloc ("fontList", 4);
- public static final int XmNfontType = malloc ("fontType", 4);
- public static final int XmNforeground = malloc ("foreground", 4);
- public static final int XmNhelpCallback = malloc ("helpCallback", 4);
- public static final int XmNhelpLabelString = malloc ("helpLabelString", 4);
- public static final int XmNhighlightColor = malloc ("highlightColor", 4);
- public static final int XmNhorizontalScrollBar = malloc ("horizontalScrollBar", 4);
- public static final int XmNiconMask = malloc ("iconMask", 4);
- public static final int XmNiconPixmap = malloc ("iconPixmap", 4);
- public static final int XmNincrement = malloc ("increment", 4);
- public static final int XmNincrementCallback = malloc ("incrementCallback", 4);
- public static final int XmNitemCount = malloc ("itemCount", 4);
- public static final int XmNitems = malloc ("items", 4);
- public static final int XmNlabelInsensitivePixmap = malloc ("labelInsensitivePixmap", 4);
- public static final int XmNlabelPixmap = malloc ("labelPixmap", 4);
- public static final int XmNlabelString = malloc ("labelString", 4);
- public static final int XmNlist = malloc ("list", 4);
- public static final int XmNmapCallback = malloc ("mapCallback", 4);
- public static final int XmNmappedWhenManaged = malloc ("mappedWhenManaged", 4);
- public static final int XmNmaximum = malloc ("maximum", 4);
- public static final int XmNmenuBar = malloc ("menuBar", 4);
- public static final int XmNmessageString = malloc ("messageString", 4);
- public static final int XmNminimum = malloc ("minimum", 4);
- public static final int XmNmodifyVerifyCallback = malloc ("modifyVerifyCallback", 4);
- public static final int XmNmwmDecorations = malloc ("mwmDecorations", 4);
- public static final int XmNmwmInputMode = malloc ("mwmInputMode", 4);
- public static final int XmNnumChildren = malloc ("numChildren", 4);
- public static final int XmNnumDropTransfers = malloc ("numDropTransfers", 4);
- public static final int XmNnumExportTargets = malloc ("numExportTargets", 4);
- public static final int XmNnumImportTargets = malloc("numImportTargets", 4);
- public static final int XmNmnemonic = malloc ("mnemonic", 4);
- public static final int XmNimportTargets = malloc("importTargets", 4);
- public static final int XmNokCallback = malloc ("okCallback", 4);
- public static final int XmNokLabelString = malloc ("okLabelString", 4);
- public static final int XmNoperationCursorIcon = malloc ("operationCursorIcon", 4);
- public static final int XmNselectionCallback = malloc ("selectionCallback", 4);
- public static final int XmNsourceCursorIcon = malloc ("sourceCursorIcon", 4);
- public static final int XmNstateCursorIcon = malloc ("stateCursorIcon", 4);
- public static final int XmNsubstitute = malloc ("substitute", 4);
- public static final int XmNpageDecrementCallback = malloc ("pageDecrementCallback", 4);
- public static final int XmNpageIncrement = malloc ("pageIncrement", 4);
- public static final int XmNpageIncrementCallback = malloc ("pageIncrementCallback", 4);
- public static final int XmNpattern = malloc ("pattern", 4);
-// public static final int XmNpopupEnabled = malloc ("popupEnabled", 4);
-// public static final int XmNpopupHandlerCallback = malloc ("popupHandlerCallback", 4);
- public static final int XmNrenderTable = malloc ("renderTable", 4);
- public static final int XmNscaleMultiple = malloc ("scaleMultiple", 4);
- public static final int XmNselectedItemCount = malloc ("selectedItemCount", 4);
- public static final int XmNselectedItems = malloc ("selectedItems", 4);
- public static final int XmNselectedPosition = malloc ("selectedPosition", 4);
- public static final int XmNselectionArrayCount = malloc ("selectionArrayCount", 4);
- public static final int XmNsliderSize = malloc ("sliderSize", 4);
- public static final int XmNsubMenuId = malloc ("subMenuId", 4);
- public static final int XmNtabList = malloc ("tabList", 4);
- public static final int XmNtextField = malloc ("textField", 4);
- public static final int XmNtitle = malloc ("title", 4);
- public static final int XmNtitleString = malloc ("titleString", 4);
- public static final int XmNtoBottomCallback = malloc ("toBottomCallback", 4);
- public static final int XmNtoTopCallback = malloc ("toTopCallback", 4);
-// public static final int XmNtopCharacter = malloc ("topCharacter", 4);
- public static final int XmNtopItemPosition = malloc ("topItemPosition", 4);
- public static final int XmNtopShadowColor = malloc ("topShadowColor", 4);
- public static final int XmNtransferProc = malloc ("transferProc", 4);
- public static final int XmNtransferStatus = malloc ("transferStatus", 4);
- public static final int XmNtroughColor = malloc ("troughColor", 4);
- public static final int XmNunmapCallback = malloc ("unmapCallback", 4);
- public static final int XmNuserData = malloc ("userData", 4);
- public static final int XmNvalue = malloc ("value", 4);
- public static final int XmNvalueChangedCallback = malloc ("valueChangedCallback", 4);
- public static final int XmNverticalScrollBar = malloc ("verticalScrollBar", 4);
- public static final int XmNvisibleItemCount = malloc ("visibleItemCount", 4);
- public static final int XmNdropTransfers = malloc ("dropTransfers", 4);
- public static final int XmNshowArrows = malloc ("showArrows", 4);
- public static final int XmNspotLocation = malloc ("spotLocation", 4);
-// public static final int XNFocusWindow = malloc ("focusWindow", 4);
-// public static final int XNInputStyle = malloc ("inputStyle", 4);
-// public static final int XNClientWindow = malloc ("clientWindow", 4);
-// public static final int XNQueryInputStyle = malloc ("queryInputStyle", 4);
-
- public static final int XmNO_LINE = 0x0;
- public static final int XmONE_OF_MANY = 0x2;
- public static final int XmOUTPUT_ALL = 0x0;
- public static final int XmPIXELS = 0x0;
- public static final int XmPIXMAP = 0x1;
- public static final int XmRELATIVE = 0x1;
-// public static final int XmRESIZE_ANY = 0x2;
-// public static final int XmRESIZE_GROW = 0x1;
-// public static final int XmRESIZE_IF_POSSIBLE = 0x2;
- public static final int XmRESIZE_NONE = 0x0;
- public static final int XmREVERSED_GROUND_COLORS = -2;
- public static final int XmSHADOW_ETCHED_IN = 0x5;
-// public static final int XmSHADOW_ETCHED_IN_DASH = 0x7;
- public static final int XmSHADOW_ETCHED_OUT = 0x6;
-// public static final int XmSHADOW_ETCHED_OUT_DASH = 0x8;
- public static final int XmSHADOW_IN = 0x7;
- public static final int XmSHADOW_OUT = 0x8;
-// public static final int XmSINGLE_DASHED_LINE = 0x3;
-// public static final int XmSINGLE_LINE = 0x1;
- public static final int XmSINGLE_LINE_EDIT = 0x1;
-// public static final int XmSINGLE_SELECT = 0x0;
-// public static final int XmSPIN_NEXT = 0x3E;
-// public static final int XmSPIN_PRIOR = 0x3F;
-// public static final int XmSTATIC = 0x0;
- public static final int XmSTRING = 0x2;
- public static final int XmSTRING_COMPONENT_SEPARATOR = 0x4;
- public static final int XmSTRING_COMPONENT_TAB = 0xC;
-// public static final int XmTAB_GROUP = 0x1;
- public static final int XmTRANSFER_FAILURE = 0;
- public static final int XmTRAVERSE_CURRENT = 0x0;
-// public static final int XmTRAVERSE_DOWN = 0x7;
-// public static final int XmTRAVERSE_HOME = 0x3;
-// public static final int XmTRAVERSE_LEFT = 0x8;
-// public static final int XmTRAVERSE_NEXT = 0x1;
-// public static final int XmTRAVERSE_NEXT_TAB_GROUP = 0x4;
-// public static final int XmTRAVERSE_PREV = 0x2;
-// public static final int XmTRAVERSE_PREV_TAB_GROUP = 0x5;
-// public static final int XmTRAVERSE_RIGHT = 0x9;
-// public static final int XmTRAVERSE_UP = 0x6;
-// public static final int XmUNMAP = 0x1;
- public static final int XmUNSPECIFIED_PIXMAP = 0x2;
- public static final int XmVARIABLE = 0x0;
- public static final int XmVERTICAL = 0x1;
-// public static final int XtCWQueryOnly = 128;
-// public static final int XtGeometryAlmost = 0x2;
-// public static final int XtGeometryDone = 0x3;
-// public static final int XtGeometryNo = 0x1;
-// public static final int XtGeometryYes = 0x0;
-// public static final int XtGrabExclusive = 0x2;
- public static final int XtGrabNone = 0x0;
-// public static final int XtGrabNonexclusive = 0x1;
-// public static final int XtIMAll = 0x7;
- public static final int XtIMAlternateInput = 0x4;
- public static final int XtIMTimer = 0x2;
- public static final int XtIMXEvent = 0x1;
- public static final int XYBitmap = 0;
-// public static final int XYPixmap = 1;
-// public static final int YSorted = 0x1;
-// public static final int YXBanded = 0x3;
-// public static final int YXSorted = 0x2;
- public static final int ZPixmap = 2;
-
- /* Unused X Structs */
- /*
- public class XPoint {
- public short x, y;
- public static final int sizeof = 4;
- }
- */
-
- /* Unused Natives */
- /*
- public static final synchronized native int XBlackPixel (int display, int screenNum);
- public static final synchronized native void XChangeActivePointerGrab (int display, int eventMask, int cursor, int time);
- public static final synchronized native int XDefaultGC (int display, int screen_number);
- public static final synchronized native void XNoOp (int display);
- public static final synchronized native int XRootWindowOfScreen (int screen);
- public static final synchronized native int XSendEvent (int display, int w, boolean propagate, int event_mask, XAnyEvent event);
- public static final synchronized native int XmCreateCascadeButton (int parent, byte [] name, int [] arglist, int argcount);
- public static final synchronized native int XmCreateDrawnButton (int parent, byte [] name, int [] arglist, int argcount);
- public static final synchronized native int XmCreateRowColumn (int parent, byte [] name, int [] arglist, int argcount);
- public static final synchronized native int XmCreateScrolledWindow (int parent, byte [] name, int [] arglist, int argcount);
- public static final synchronized native int XmGetFocusWidget (int widget);
- public static final synchronized native void XmListAddItemsUnselected (int list, int xmStringTable, int item_count, int position);
- public static final synchronized native void XmListDeleteItem (int list, int item);
- public static final synchronized native void XmListDeselectItem (int list, int xmString);
- public static final synchronized native void XmListSelectItem (int list, int xmString, boolean notify);
- public static final synchronized native int XmPushButtonWidgetClass ();
- public static final synchronized native int XmStringLineCount (int xmString);
- public static final synchronized native boolean XmTextRemove (int widget);
- public static final synchronized native int XtAppSetErrorHandler (int app_context, int handler);
- public static final synchronized native int XtAppSetWarningHandler (int app_context, int handler);
- public static final synchronized native void XtCallActionProc (int widget, byte [] action, XAnyEvent event, byte [] params, int num_params);
- public static final synchronized native void XtCloseDisplay (int display);
- public static final synchronized native int XtCreateWidget (byte [] name, int widgetClass, int parent, int [] argList, int argCount);
- public static final synchronized native void XtRemoveCallback (int widget, int callback_name, int callback, int client_data);
- public static final synchronized native void XtRemoveEventHandler (int widget, int event_mask, boolean nonmaskable, int proc, int client_data);
- public static final synchronized native int XtScreen (int widget);
- */
-public static final synchronized native int OverrideShellWidgetClass ();
-public static final synchronized native int ShellWidgetClass ();
-public static final synchronized native int TopLevelShellWidgetClass ();
-public static final synchronized native int TransientShellWidgetClass ();
-public static final synchronized native int XAllocColor (int display, int colormap, XColor color);
-public static final synchronized native void XBell (int display, int ms);
-public static final synchronized native int XBitmapBitOrder (int display);
-public static final synchronized native int XBlackPixel (int display, int screenNum);
-public static final synchronized native int XChangeActivePointerGrab(int display, int event_mask, int cursor, int time);
-public static final synchronized native int XChangeGC (int display, int gc, int valuemask, XGCValues values);
-public static final synchronized native void XChangeWindowAttributes (int display, int window, int mask, XSetWindowAttributes attributes);
-public static final synchronized native boolean XCheckMaskEvent (int display, int mask, XAnyEvent event);
-public static final synchronized native boolean XCheckWindowEvent (int display, int window, int mask, XAnyEvent event);
-public static final synchronized native void XClearArea (int display, int window, int x, int y, int width, int height, boolean exposures);
-public static final synchronized native void XClipBox (int region, XRectangle rectangle);
-public static final synchronized native void XCopyArea (int display, int src, int dest, int gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y);
-public static final synchronized native void XCopyPlane (int display, int src, int dest, int gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y, int plane);
-public static final synchronized native int XCreateBitmapFromData (int display, int drawable, byte [] data, int width, int height);
-public static final synchronized native int XCreateFontCursor (int display, int shape);
-public static final synchronized native int XCreateGC (int display, int window, int mask, XGCValues values);
-public static final synchronized native int XCreateImage (int display, int visual, int depth, int format, int offset, int data, int width, int height, int bitmap_pad, int bytes_per_line);
-public static final synchronized native int XCreatePixmap (int display, int drawable, int width, int height, int depth);
-public static final synchronized native int XCreatePixmapCursor (int display, int source, int mask, XColor foreground_color, XColor background_color, int x, int y);
-public static final synchronized native int XCreateRegion ();
-public static final synchronized native int XDefaultColormap (int display, int screen_number);
-public static final synchronized native int XDefaultDepthOfScreen (int screen);
-public static final synchronized native int XDefaultRootWindow (int display);
-public static final synchronized native int XDefaultScreen (int display);
-public static final synchronized native int XDefaultScreenOfDisplay (int display);
-public static final synchronized native int XDefaultVisual (int display, int screen_number);
-public static final synchronized native void XDefineCursor (int display, int window, int cursor);
-public static final synchronized native int XDestroyImage(int ximage);
-public static final synchronized native void XDestroyRegion (int region);
-public static final synchronized native int XDisplayHeight (int display, int screen);
-public static final synchronized native int XDisplayHeightMM (int display, int screen);
-public static final synchronized native int XDisplayWidth (int display, int screen);
-public static final synchronized native int XDisplayWidthMM (int display, int screen);
-public static final synchronized native void XDrawArc (int display, int drawable, int gc, int x1, int y1, int x2, int y2, int a1, int a2);
-public static final synchronized native void XDrawLine (int display, int drawable, int gc, int x1, int y1, int x2, int y2);
-public static final synchronized native void XDrawLines (int display, int drawable, int gc, short[] xPoints, int nPoints, int mode);
-public static final synchronized native void XDrawRectangle (int display, int drawable, int gc, int x, int y, int width, int height);
-public static final synchronized native boolean XEmptyRegion (int region);
-public static final synchronized native boolean XEqualRegion (int region1, int region2);
-public static final synchronized native void XFillArc (int display, int drawable, int gc, int x1, int y1, int x2, int y2, int a1, int a2);
-public static final synchronized native int XFillPolygon (int display, int drawable, int gc, short[] xPoints, int nPoints, int mode, int style);
-public static final synchronized native void XFillRectangle (int display, int drawable, int gc, int x, int y, int width, int height);
-public static final synchronized native boolean XFilterEvent (XAnyEvent event, int window);
-public static final synchronized native void XFlush (int display);
-public static final synchronized native int XFontsOfFontSet (int fontSet, int[] fontStructs, int[] fontNames);
-public static final synchronized native int XFree (int address);
-public static final synchronized native int XFreeColors (int display, int colormap, int [] pixels, int npixels, int planes);
-public static final synchronized native void XFreeCursor (int display, int pixmap);
-public static final synchronized native void XFreeFontNames(int list);
-public static final synchronized native void XFreeFont(int display, int font_struct);
-public static final synchronized native void XFreeFontSet(int display, int font_set);
-public static final synchronized native void XFreeGC (int display, int gc);
-public static final synchronized native void XFreePixmap (int display, int pixmap);
-public static final synchronized native int XGetGCValues (int display, int gc, int valuemask, XGCValues values);
-public static final synchronized native int XGetGeometry (int display, int drawable, int [] root_return, int [] x_return, int [] y_return, int [] width_return, int [] height_return, int [] border_width_return, int [] depth_return);
-public static final synchronized native int XGetImage (int display, int drawable, int x, int y, int width, int height, int plane_mask, int format);
-public static final synchronized native int XGetInputFocus (int display, int [] window, int [] revert);
-public static final synchronized native boolean XGetWindowAttributes (int display, int window, XWindowAttributes attributes);
-public static final synchronized native int XGrabPointer (
- int display,
- int grabWindow,
- int ownerEvents,
- int eventMask,
- int pointerMode,
- int keyboardMode,
- int confineToWindow,
- int cursor,
- int time);
-public static final synchronized native int XInitThreads ();
-public static final synchronized native int XInternAtom( int display, byte [] name, boolean ifExists );
-public static final synchronized native int XKeysymToString (int keysym);
-public static final synchronized native int XListFonts(int display, byte[] pattern, int maxnames, int[] actual_count_return);
-public static final synchronized native int XListProperties(int display, int window, int[] num_prop_return);
-public static final synchronized native int XLookupString (XKeyEvent event, byte [] string, int size, int [] keysym, int [] status);
-public static final synchronized native int XLowerWindow (int display, int window);
-public static final synchronized native boolean XPointInRegion (int region, int x, int y);
-public static final synchronized native int XPutImage (int display, int drawable, int gc, int image, int srcX, int srcY, int destX, int destY, int width, int height);
-public static final synchronized native int XQueryColor (int display, int colormap, XColor color);
-public static final synchronized native int XQueryPointer (
- int display,
- int window,
- int [] root,
- int [] child,
- int [] rootX,
- int [] rootY,
- int [] windowX,
- int [] windowY,
- int [] mask);
-public static final synchronized native int XQueryTree (int display, int window, int [] root_return, int [] parent_return, int [] children_return, int [] nChildren_return);
-public static final synchronized native int XRaiseWindow (int display, int window);
-public static final synchronized native int XReconfigureWMWindow (int display, int window, int screen, int valueMask, XWindowChanges values);
-public static final synchronized native int XRectInRegion (int region, int x, int y, int width, int height);
-public static final synchronized native void XSetBackground (int display, int gc, int background);
-public static final synchronized native void XSetClipMask (int display, int gc, int pixmap);
-public static final synchronized native void XSetClipRectangles (int display, int gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles, int n, int ordering);
-public static final synchronized native int XSetDashes (int display, int gc, int dash_offset, byte[] dash_list, int n);
-public static final synchronized native int XSetErrorHandler (int handler);
-public static final synchronized native void XSetFillStyle (int display, int gc, int fill_style);
-public static final synchronized native int XSetFont (int display, int gc, int font);
-public static final synchronized native void XSetForeground (int display, int gc, int foreground);
-public static final synchronized native void XSetFunction (int display, int gc, int function);
-public static final synchronized native void XSetGraphicsExposures (int display, int gc, boolean graphics_exposures);
-public static final synchronized native int XSetInputFocus (int display, int window, int revert, int time);
-public static final synchronized native int XSetLineAttributes (int display, int gc, int lineWidth, int lineStyle, int capStyle, int joinStyle);
-public static final synchronized native void XSetRegion (int display, int gc, int region);
-public static final synchronized native void XSetStipple (int display, int gc, int pixmap);
-public static final synchronized native void XSetSubwindowMode (int display, int gc, int subwindow_mode);
-public static final synchronized native void XSetWindowBorderWidth (int display, int window, int width);
-public static final synchronized native void XSubtractRegion (int sra, int srb, int dr_return);
-public static final synchronized native void XSync (int display, boolean discard);
-public static final synchronized native int XSynchronize (int display, boolean onoff);
-public static final synchronized native void XUndefineCursor (int display, int window);
-public static final synchronized native int XUngrabPointer (int display, int time);
-public static final synchronized native void XUnionRectWithRegion (XRectangle rectangle, int src_region, int dest_region_return);
-public static final synchronized native void XUnionRegion (int sra, int srb, int dr_return);
-public static final synchronized native int XWarpPointer (int display, int sourceWindow, int destWindow, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY);
-public static final synchronized native int XWhitePixel (int display, int screenNum);
-public static final synchronized native void XWithdrawWindow (int display, int window, int screen);
-public static final synchronized native void XmAddWMProtocolCallback (int shell, int protocol, int callback, int closure);
-public static final synchronized native void XmChangeColor (int widget, int pixel);
-public static final synchronized native int XmClipboardCopy(int display, int window, int item_id, byte[] format_name, byte[] buffer, int length, int private_id, int[] data_id);
-public static final synchronized native int XmClipboardEndCopy(int display, int window, int item_id);
-public static final synchronized native int XmClipboardStartCopy(int display, int window, int clip_label, int timestamp, int widget, int callback, int[] item_id);
-public static final synchronized native int XmClipboardInquireLength(int display, int widget, byte[] format_name, int[] length);
-public static final synchronized native int XmClipboardInquireFormat(int display, int window, int index, byte[] format_name_buf, int buffer_len, int[]copied_len);
-public static final synchronized native int XmClipboardInquireCount(int display, int window, int[] count, int[] max_format_name_length);
-public static final synchronized native int XmClipboardStartRetrieve(int display, int window, int timestamp);
-public static final synchronized native int XmClipboardRetrieve(int display, int window, byte[] format_name, byte[] buffer, int length, int[] num_bytes, int[] private_id);
-public static final synchronized native int XmClipboardEndRetrieve(int display, int window);
-public static final synchronized native void XmComboBoxAddItem(int widget, int xmString, int position, boolean unique);
-public static final synchronized native void XmComboBoxDeletePos(int widget, int position);
-public static final synchronized native void XmComboBoxSelectItem(int widget, int xmString);
-public static final synchronized native int XmCreateArrowButton (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateCascadeButtonGadget (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateComboBox(int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateDialogShell (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateDrawingArea (int parent, byte [] name, int [] arglist, int argcount);
-//public static final synchronized native int XmCreateDrawnButton (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateErrorDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateFileSelectionDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateForm (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateFrame (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateInformationDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateLabel (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateList (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateMainWindow (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateMenuBar (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateMessageDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreatePopupMenu (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreatePulldownMenu (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreatePushButton (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreatePushButtonGadget (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateQuestionDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateScale (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateScrollBar (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateScrolledList (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateScrolledText (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateSeparator (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateSeparatorGadget (int parent, byte [] name, int [] arglist, int argcount);
-//public static final synchronized native int XmCreateSimpleSpinBox (int parent, byte [] name, int [] arglist, int argcount);
-//public static final synchronized native int XmCreateSpinBox (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateTextField (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateToggleButton (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateToggleButtonGadget (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XmCreateWarningDialog (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native boolean XmDestroyPixmap (int screen, int pixmap);
-public static final synchronized native void XmDragCancel(int dragcontext);
-public static final synchronized native int XmDragStart(int widget, XAnyEvent event, int[] arglist, int argcount);
-public static final synchronized native void XmDropSiteRegister(int widget, int [] arglist, int argcount);
-public static final synchronized native void XmDropSiteUnregister(int widget);
-public static final synchronized native void XmDropSiteUpdate(int widget, int [] arglist, int argcount);
-public static final synchronized native void XmDropTransferAdd(int drop_transfer, int [] transfers, int num_transfers);
-public static final synchronized native int XmDropTransferStart(int widget, int [] arglist, int argcount);
-public static final synchronized native int XmFileSelectionBoxGetChild (int widget, int child);
-public static final synchronized native int XmFontListAppendEntry (int oldList, int entry);
-public static final synchronized native int XmFontListCopy (int fontlist);
-public static final synchronized native void XmFontListEntryFree (int[] entry);
-public static final synchronized native int XmFontListEntryGetFont (int entry, int[] type_return);
-public static final synchronized native int XmFontListEntryLoad (int display, byte [] fontName, int type, byte[] tag);
-public static final synchronized native void XmFontListFree (int list);
-public static final synchronized native void XmFontListFreeFontContext (int context);
-public static final synchronized native boolean XmFontListInitFontContext (int[] context,int fontList);
-public static final synchronized native int XmFontListNextEntry (int context);
-public static final synchronized native int XmGetAtomName (int display, int atom);
-public static final synchronized native int XmGetDragContext (int widget, int timestamp);
-public static final synchronized native int XmGetFocusWidget (int widget);
-public static final synchronized native int XmGetPixmap( int screen, byte [] name, int fgPixel, int bgPixel );
-public static final synchronized native int XmGetPixmapByDepth (int screen, byte [] image_name, int foreground, int background, int depth);
-public static final synchronized native int XmGetXmDisplay (int display);
-public static final synchronized native int XmImMbLookupString (int widget, XKeyEvent event, byte [] string, int size, int [] keysym, int [] status);
-public static final synchronized native int XmInternAtom (int display, byte [] name, boolean only_if_exists);
-public static final synchronized native void XmListAddItemUnselected (int list, int xmString, int position);
-public static final synchronized native void XmListDeleteAllItems (int list);
-public static final synchronized native void XmListDeleteItemsPos (int list, int item_count, int position);
-public static final synchronized native void XmListDeletePos (int list, int position);
-public static final synchronized native void XmListDeletePositions (int list, int [] position_list, int position_count);
-public static final synchronized native void XmListDeselectAllItems (int list);
-public static final synchronized native void XmListDeselectPos (int list, int position);
-public static final synchronized native int XmListGetKbdItemPos (int list);
-public static final synchronized native boolean XmListGetSelectedPos (int list, int [] positions, int [] count);
-public static final synchronized native int XmListItemPos (int list, int xmString);
-public static final synchronized native boolean XmListPosSelected (int list, int position);
-public static final synchronized native void XmListReplaceItemsPosUnselected (int list, int [] new_items, int item_count, int position);
-public static final synchronized native void XmListSelectPos (int list, int position, boolean notify);
-public static final synchronized native boolean XmListSetKbdItemPos (int list, int position);
-public static final synchronized native void XmListSetPos (int list, int position);
-public static final synchronized native void XmListUpdateSelectedList (int list);
-public static final synchronized native void XmMainWindowSetAreas (int widget, int menu, int command, int hscroll, int vscroll, int wregion);
-public static final synchronized native int XmMenuShellWidgetClass ();
-public static final synchronized native int XmMessageBoxGetChild (int widget, int child);
-public static final synchronized native int XmParseMappingCreate (int [] argList, int argCount);
-public static final synchronized native void XmParseMappingFree (int parseMapping);
-public static final synchronized native void XmParseTableFree (int [] parseTable, int mappingCount);
-public static final synchronized native boolean XmProcessTraversal (int widget, int dir);
-public static final synchronized native int XmRenderTableAddRenditions(int oldTable, int[] renditions, int renditionCount, int mergeMode);
-public static final synchronized native void XmRenderTableFree(int renderTable);
-public static final synchronized native int XmRenditionCreate(int widget, byte[] tag, int[] argList, int argCount);
-public static final synchronized native void XmRenditionFree(int rendition);
-public static final synchronized native boolean XmStringCompare (int xmString1, int xmString2);
-public static final synchronized native int XmStringComponentCreate (int type, int length, byte[] value);
-public static final synchronized native int XmStringCreate (byte [] string, byte [] charset);
-public static final synchronized native int XmStringCreateLocalized (byte [] string);
-public static final synchronized native int XmStringCreateLtoR (byte [] string, byte [] charset);
-public static final synchronized native void XmStringDraw (int display, int window, int renderTable, int xmString, int gc, int x, int y, int width, int align, int lay_dir, XRectangle clip);
-public static final synchronized native void XmStringDrawImage (int display, int window, int renderTable, int xmString, int gc, int x, int y, int width, int align, int lay_dir, XRectangle clip);
-public static final synchronized native void XmStringDrawUnderline (int display, int window, int fontlist, int xmString, int gc, int x, int y, int width, int align, int lay_dir, XRectangle clip, int xmStringUnderline);
-public static final synchronized native boolean XmStringEmpty (int s1);
-public static final synchronized native void XmStringFree (int xmString);
-public static final synchronized native boolean XmStringGetLtoR (int xmString, byte [] charset, int [] text);
-public static final synchronized native int XmStringGenerate(byte[] text, byte[] tag, int type, byte[] rendition);
-public static final synchronized native int XmStringHeight (int fontList, int xmString);
-public static final synchronized native int XmStringParseText (byte[] text, int textEnd, byte [] tag, int tagType, int [] parseTable, int parseCount, int callData);
-public static final synchronized native int XmStringWidth (int fontList, int xmString);
-public static final synchronized native int XmStringUnparse (int xmString, byte [] tag, int tagType, int outputType, int [] parseTable, int parseCount, int parseModel);
-public static final synchronized native int XmTabCreate(int value, byte units, byte offsetModel, byte alignment, byte[] decimal);
-public static final synchronized native void XmTabFree(int tab);
-public static final synchronized native void XmTabListFree(int tabList);
-public static final synchronized native int XmTabListInsertTabs(int oldList, int[] tabs, int tab_count, int position);
-public static final synchronized native void XmTextClearSelection (int widget, int time);
-public static final synchronized native boolean XmTextCopy (int widget, int time);
-public static final synchronized native boolean XmTextCut (int widget, int time);
-public static final synchronized native void XmTextDisableRedisplay (int widget);
-public static final synchronized native void XmTextEnableRedisplay (int widget);
-public static final synchronized native int XmTextGetInsertionPosition (int widget);
-public static final synchronized native int XmTextGetLastPosition (int widget);
-public static final synchronized native int XmTextGetMaxLength (int widget);
-public static final synchronized native int XmTextGetSelection (int widget);
-public static final synchronized native boolean XmTextGetSelectionPosition (int widget, int [] left, int [] right);
-public static final synchronized native int XmTextGetString (int widget);
-public static final synchronized native int XmTextGetSubstring (int widget, int start, int num_chars, int buffer_size, byte [] buffer);
-public static final synchronized native int XmTextGetSubstringWcs (int widget, int start, int num_chars, int buffer_size, char [] buffer);
-public static final synchronized native void XmTextInsert (int widget, int position, byte [] value);
-public static final synchronized native boolean XmTextPaste (int widget);
-public static final synchronized native boolean XmTextPosToXY (int widget, int position, short [] x, short [] y);
-public static final synchronized native void XmTextReplace (int widget, int from_pos, int to_pos, byte [] value);
-public static final synchronized native void XmTextScroll (int widget, int lines);
-public static final synchronized native void XmTextSetEditable (int widget, boolean editable);
-public static final synchronized native void XmTextSetHighlight (int widget, int left, int right, int mode);
-public static final synchronized native void XmTextSetInsertionPosition (int widget, int position);
-public static final synchronized native void XmTextSetMaxLength (int widget, int max_length);
-public static final synchronized native void XmTextSetSelection (int widget, int first, int last, int time);
-public static final synchronized native void XmTextSetString (int widget, byte [] value);
-public static final synchronized native void XmTextShowPosition (int widget, int position);
-public static final synchronized native void XmUpdateDisplay (int widget);
-public static final synchronized native boolean XmWidgetGetDisplayRect (int region, XRectangle rectangle);
-//public static final synchronized native int XmbLookupString (int ic, XKeyEvent event, byte [] string, int size, int [] keysym, int [] status);
-public static final synchronized native void XtAddCallback (int widget, int callback_name, int callback, int client_data);
-public static final synchronized native void XtAddEventHandler (int widget, int event_mask, boolean nonmaskable, int proc, int client_data);
-public static final synchronized native void XtAddExposureToRegion (int event, int region);
-public static final synchronized native int XtAppAddTimeOut (int app_context, int interval, int proc, int client_data);
-public static final synchronized native int XtAppCreateShell (
- byte [] appName,
- byte [] appClass,
- int widgetClass,
- int display,
- int [] argList,
- int argCount);
-public static final synchronized native void XtAppNextEvent (int appContext, XAnyEvent event);
-public static final synchronized native boolean XtAppPeekEvent (int appContext, XAnyEvent event);
-public static final synchronized native int XtAppPending (int appContext);
-public static final synchronized native void XtAppProcessEvent (int appContext, int inputMask);
-public static final synchronized native int XtAppSetErrorHandler (int app_context, int msg_handler);
-public static final synchronized native int XtAppSetWarningHandler (int app_context, int msg_handler);
-public static final synchronized native int XtBuildEventMask (int widget);
-public static final synchronized native void XtCallActionProc (int widget, byte [] action, XAnyEvent event, int [] params, int num_params);
-public static final synchronized native int XtClass (int widget);
-public static final synchronized native void XtConfigureWidget (int widget, int x, int y, int width, int height, int borderWidth);
-public static final synchronized native int XtCreateApplicationContext ();
-public static final synchronized native int XtCreatePopupShell (byte [] name, int widgetClass, int parent, int [] argList, int argCount);
-public static final synchronized native void XtDestroyApplicationContext (int appContext);
-public static final synchronized native void XtDestroyWidget (int widget);
-public static final synchronized native boolean XtDispatchEvent (XAnyEvent event);
-public static final synchronized native int XtDisplay (int widget);
-public static final synchronized native int XtDisplayToApplicationContext (int display);
-public static final synchronized native void XtFree (int ptr);
-public static final synchronized native int XtGetMultiClickTime (int display);
-public static final synchronized native void XtGetValues (int widget, int [] argList, int numArgs);
-public static final synchronized native boolean XtIsManaged (int widget);
-public static final synchronized native boolean XtIsRealized (int widget);
-public static final synchronized native boolean XtIsSubclass (int widget, int widgetClass);
-public static final synchronized native boolean XtIsTopLevelShell (int widget);
-public static final synchronized native boolean XtIsWidget (int widget);
-public static final synchronized native int XtLastTimestampProcessed (int display);
-public static final synchronized native int XtMalloc (int size);
-public static final synchronized native void XtManageChild (int widget);
-public static final synchronized native void XtMapWidget (int widget);
-public static final synchronized native void XtMoveWidget (int widget, int x, int y);
-public static final synchronized native int XtOpenDisplay (
- int xtAppContext,
- byte [] displayName,
- byte [] applicationName,
- byte [] applicationClass,
- int options,
- int numOptions,
- int [] argc,
- int argv);
-public static final synchronized native void XtOverrideTranslations (int w, int translations);
-public static final synchronized native int XtParent (int widget);
-public static final synchronized native int XtParseTranslationTable (byte [] string);
-public static final synchronized native void XtPopdown (int widget);
-public static final synchronized native void XtPopup (int widget, int flags);
-public static final synchronized native int XtQueryGeometry (int widget, XtWidgetGeometry intended, XtWidgetGeometry preferred_return);
-public static final synchronized native void XtRealizeWidget (int widget);
-public static final synchronized native void XtRemoveTimeOut (int id);
-public static final synchronized native void XtResizeWidget (int widget, int width, int height, int borderWidth);
-public static final synchronized native void XtResizeWindow (int widget);
-public static final synchronized native int XtSetLanguageProc (int appContext, int languageProc, int pointer);
-public static final synchronized native void XtSetMappedWhenManaged (int widget, boolean flag);
-public static final synchronized native void XtSetValues (int widget, int [] argList, int numArgs);
-public static final synchronized native void XtToolkitInitialize ();
-public static final synchronized native void XtTranslateCoords (int widget, short x, short y, short [] root_x, short [] root_y);
-public static final synchronized native void XtUnmanageChild (int widget);
-public static final synchronized native void XtUnmapWidget (int widget);
-public static final synchronized native int XtWindow (int widget);
-public static final synchronized native int XtWindowToWidget (int display, int widget);
-
-static int malloc (String name, int length) {
- int strLen = name.length ();
- if (NextResourceStart + strLen + 2 > RESOURCE_START + RESOURCE_LENGTH) {
- System.out.println ("*** Warning : SWT - Resource overrun. Increase OS.RESOURCE_LENGTH.");
- System.out.println ("*** Warning : Exiting ...");
- System.exit (0);
- }
- char [] unicode = new char [strLen];
- name.getChars (0, strLen, unicode, 0);
- byte[] buffer = new byte [strLen + 2];
- buffer [0] = (byte) length;
- for (int i = 0; i < strLen; i++) {
- buffer [i+1] = (byte) unicode[i];
- }
- OS.memmove (NextResourceStart, buffer, strLen + 2);
- int result = NextResourceStart + 1;
- NextResourceStart += strLen + 2;
- return result;
-}
-
-public static final native void memmove (int dest, XImage src, int count);
-public static final native void memmove (int dest, XmDragProcCallback src, int count);
-public static final native void memmove (int dest, XmTextBlockRec src, int count);
-public static final native void memmove (int dest, XmTextVerifyCallbackStruct src, int count);
-public static final native void memmove (int dest, byte [] src, int count);
-public static final native void memmove (int dest, char [] src, int count);
-public static final native void memmove (int dest, int [] src, int count);
-public static final native void memmove (Visual dest, int src, int count);
-public static final native void memmove (XButtonEvent dest, int src, int count);
-public static final native void memmove (int dest, XButtonEvent src, int count);
-public static final native void memmove (XCharStruct dest, int src, int count);
-public static final native void memmove (XConfigureEvent dest, int src, int count);
-public static final native void memmove (XCrossingEvent dest, int src, int count);
-public static final native void memmove (XExposeEvent dest, int src, int count);
-public static final native void memmove (XFocusChangeEvent dest, int src, int count);
-public static final native void memmove (XFontStruct dest, int src, int count);
-public static final native void memmove (XImage dest, int src, int count);
-public static final native void memmove (XKeyEvent dest, int src, int count);
-public static final native void memmove (XKeyEvent dest, XAnyEvent src, int count);
-public static final native void memmove (XMotionEvent dest, int src, int count);
-public static final native void memmove (XmAnyCallbackStruct dest, int src, int count);
-public static final native void memmove (XmDragProcCallback dest, int src, int count);
-public static final native void memmove (XmDropFinishCallback dest, int src, int count);
-public static final native void memmove (XmDropProcCallback dest, int src, int count);
-public static final native void memmove (XmTextBlockRec dest, int src, int count);
-public static final native void memmove (XmTextVerifyCallbackStruct dest, int src, int count);
-public static final native void memmove (byte [] dest, int src, int count);
-public static final native void memmove (char [] dest, int src, int count);
-public static final native void memmove (int [] dest, int src, int count);
-public static final native int strlen (int string);
-public static final synchronized native int XmCreateDrawnButton (int parent, byte [] name, int [] arglist, int argcount);
-public static final synchronized native int XCheckIfEvent (int display, XAnyEvent event_return, int predicate, int arg);
-public static final synchronized native boolean XtToolkitThreadInitialize ();
-public static final synchronized native int Call (int proc, int arg1, int arg2);
-public static final synchronized native int XSetIOErrorHandler (int handler);
-public static final synchronized native boolean XmTextFieldPaste (int widget);
-
-/*
- * ======== Start of printing constants and functions ========
- */
- public static final byte XPJobAttr = 1;
- public static final byte XPDocAttr = 2;
- public static final byte XPPrinterAttr = 4;
- public static final byte XPAttrMerge = 2;
- public static final byte XPSpool = 1;
- public static final int CopyFromParent = 0;
-
-public static final synchronized native int XpCreateContext(int display, byte [] printer_name);
-public static final synchronized native int XpGetPrinterList(int display, byte [] printer_name, int [] list_count);
-public static final synchronized native void XpFreePrinterList(int printer_list);
-public static final synchronized native int XpGetAttributes(int display, int print_context, byte type);
-public static final synchronized native void XpSetAttributes(int display, int print_context, byte type, byte [] pool, byte replacement_rule);
-public static final synchronized native int XpGetOneAttribute(int display, int print_context, byte type, byte [] attribute_name);
-public static final synchronized native void XpSetContext(int display, int print_context);
-public static final synchronized native int XpGetScreenOfContext(int display, int print_context);
-public static final synchronized native void XpDestroyContext(int display, int print_context);
-public static final synchronized native int XpGetPageDimensions(int display, int print_context, short [] width, short [] height, XRectangle reproducible_area);
-public static final synchronized native void XpStartJob(int display, byte save_data);
-public static final synchronized native void XpStartPage(int display, int window);
-public static final synchronized native void XpEndPage(int display);
-public static final synchronized native void XpEndJob(int display);
-public static final synchronized native void XpCancelJob(int display, boolean discard);
-public static final synchronized native int XpQueryVersion(int display, short[] major_version, short[] minor_version);
-public static final synchronized native int XDefaultGCOfScreen(int screen);
-public static final synchronized native int XDefaultColormapOfScreen(int screen);
-public static final synchronized native int XRootWindowOfScreen(int screen);
-public static final synchronized native int XScreenNumberOfScreen(int screen);
-public static final synchronized native int XCreateWindow(int display, int parent, int x, int y, int width, int height,
- int border_width, int depth, int clazz, int visual, long value_mask, int attributes);
-public static final synchronized native void XDestroyWindow(int display, int w);
-
-/*
- * ======== End of printing constants and functions ========
- */
-
-public static final native int pipe (int [] filedes);
-public static final native int read (int filedes, byte [] buf, int nbyte);
-public static final native int write (int filedes, byte [] buf, int nbyte);
-public static final native int close (int filedes);
-public static final native int select (int n, byte [] readfds, byte [] writefds, byte [] exceptfds, int [] timeout);
-public static final native void FD_ZERO (byte [] fd_set);
-public static final native void FD_SET (int fd, byte [] fd_set);
-public static final native boolean FD_ISSET (int fd, byte [] fd_set);
-public static final native int FD_SETSIZE ();
-public static final native int NFDBITS ();
-public static final synchronized native int ConnectionNumber (int display);
-public static final synchronized native int XtAppAddInput (int app_context, int source, int condition, int proc, int client_data);
-public static final synchronized native void XtRemoveInput (int id);
-// public static final int XtInputNoneMask = 0;
- public static final int XtInputReadMask = 1;
-// public static final int XtInputWriteMask = 2;
-// public static final int XtInputExceptMask = 4;
-
-public static final synchronized native int XLoadQueryFont (int display, byte[] name);
-public static final synchronized native int XmFontListEntryCreate (byte[] tag, int type, int font);
-
-public static final synchronized native int XmImGetXIC (int widget, int input_policy, int[] args, int num_args);
-public static final synchronized native int XmImGetXIM (int widget);
-public static final synchronized native void XmImRegister (int widget, int reserved);
-//public static final synchronized native int XmImSetFocusValues (int widget, int[] args, int num_args);
-public static final synchronized native int XmImVaSetFocusValues(int widget, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9);
-public static final synchronized native int XmImSetValues (int widget, int[] args, int num_args);
-public static final synchronized native void XmImUnregister (int widget);
-public static final synchronized native void XmImUnsetFocus (int widget);
-//public static final synchronized native void XSetICFocus (int ic);
-//public static final synchronized native void XUnsetICFocus (int ic);
-//public static final synchronized native int XCreateIC (int im, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7);
-//public static final synchronized native int XSetICValues (int ic, int arg1, int arg2, int arg3);
-//public static final synchronized native int XGetICValues (int ic, int arg1, int arg2, int arg3);
-//public static final synchronized native int XGetIMValues (int im, int arg1, int arg2, int arg3);
-public static final native void memmove (int dest, short [] src, int count);
-//public static final native void memmove (char[] dest, int src, int count);
-//public static final native void memmove ( int dest, char[] src,int count);
-
-public static final native int nl_langinfo (int item);
-public static final native int iconv_open (byte[] tocode, byte[] fromcode);
-public static final native int iconv_close (int cd);
-public static final native int iconv (int cd, int[] inBuf, int[] inBytesLeft, int[] outBuf, int[] outBytesLeft);
-public static final native int MB_CUR_MAX ();
-public static final native int setlocale (int category, byte[] locale);
-static final native int setResourceMem (int start, int end);
-
-public static final synchronized native int XCreateFontSet (int display, byte [] base_font_name_list, int [] missing_charset_list_return, int [] missing_charset_count_return, int [] def_string_return);
-public static final synchronized native int XLocaleOfFontSet (int fontSet);
-
-public static final synchronized native void XtInsertEventHandler (int w, int event_mask, boolean nonmaskable, int proc, int client_data, int position);
-//public static final synchronized native void XmAddToPostFromList (int menu, int post_from_list);
-//public static final synchronized native void XmRemoveFromPostFromList (int menu, int post_from_list);
-//public static final synchronized native void XmMenuPosition (int menu, int event);
-public static final synchronized native void _XmSetMenuTraversal (int menu, boolean traversal);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/Visual.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/Visual.java
deleted file mode 100644
index def3fb5860..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/Visual.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class Visual {
- public int ext_data;
- public int visualid;
- public int c_class;
- public int red_mask, green_mask, blue_mask;
- public int bits_per_rgb;
- public int map_entries;
- public static final int sizeof = 32;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XAnyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XAnyEvent.java
deleted file mode 100644
index 4e2936a376..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XAnyEvent.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XAnyEvent extends XEvent {
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
- public int pad10, pad11, pad12, pad13, pad14, pad15, pad16, pad17, pad18;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XButtonEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XButtonEvent.java
deleted file mode 100644
index 2f8234ce5d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XButtonEvent.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XButtonEvent extends XInputEvent {
- public int button; /* detail */
- public int same_screen; /* same screen flag */
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCharStruct.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCharStruct.java
deleted file mode 100644
index a9c92b492b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCharStruct.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XCharStruct {
- public short lbearing;
- public short rbearing;
- public short width;
- public short ascent;
- public short descent;
- public short attributes;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XColor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XColor.java
deleted file mode 100644
index bd9c4a306d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XColor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XColor {
- public int pixel;
- public short red, green, blue;
- public byte flags;
- public byte pad;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java
deleted file mode 100644
index c8d58b705f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XConfigureEvent extends XEvent {
- public int x, y;
- public int width, height;
- public int border_width;
- public int above;
- public int override_redirect;
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
- public int pad10, pad11;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java
deleted file mode 100644
index ad59913ffc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XCrossingEvent extends XWindowEvent {
- public int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
- public int detail;
- /*
- * NotifyAncestor, NotifyVirtual, NotifyInferior,
- * NotifyNonlinear, NotifyNonlinearVirtual
- */
- public int same_screen; /* same screen flag */
- public int focus; /* boolean focus */
- public int state; /* key or button mask */
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XEvent.java
deleted file mode 100644
index 1b20cb2be8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public abstract class XEvent {
- public int type;
- public int serial;
- public int send_event;
- public int display;
- public int window;
- public static final int sizeof = 96;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XExposeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XExposeEvent.java
deleted file mode 100644
index 25fc25485d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XExposeEvent.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XExposeEvent extends XEvent {
- public int x, y;
- public int width, height;
- public int count;
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
- public int pad10, pad11, pad12, pad13;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java
deleted file mode 100644
index c46dcfafd9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XFocusChangeEvent extends XEvent {
- public int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
- public int detail;
- /*
- * NotifyAncestor, NotifyVirtual, NotifyInferior,
- * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
- * NotifyPointerRoot, NotifyDetailNone
- */
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
- public int pad10, pad11, pad12, pad13, pad14, pad15, pad16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFontStruct.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFontStruct.java
deleted file mode 100644
index e03dad6fec..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XFontStruct.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XFontStruct {
- public int ext_data;
- public int fid;
- public int direction;
- public int min_char_or_byte2;
- public int max_char_or_byte2;
- public int min_byte1;
- public int max_byte1;
- public int all_chars_exist;
- public int default_char;
- public int n_properties;
- public int properties;
- public short min_bounds_lbearing;
- public short min_bounds_rbearing;
- public short min_bounds_width;
- public short min_bounds_ascent;
- public short min_bounds_descent;
- public short min_bounds_attributes;
- public short max_bounds_lbearing;
- public short max_bounds_rbearing;
- public short max_bounds_width;
- public short max_bounds_ascent;
- public short max_bounds_descent;
- public short max_bounds_attributes;
- public int per_char;
- public int ascent;
- public int descent;
- public static final int sizeof = 80;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XGCValues.java
deleted file mode 100644
index df6eb2db1e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XGCValues.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XGCValues {
- public int function; /* logical operation */
- public int plane_mask;/* plane mask */
- public int foreground;/* foreground pixel */
- public int background;/* background pixel */
- public int line_width; /* line width */
- public int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
- public int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */
- public int join_style; /* JoinMiter, JoinRound, JoinBevel */
- public int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */
- public int fill_rule; /* EvenOddRule, WindingRule */
- public int arc_mode; /* ArcChord, ArcPieSlice */
- public int tile; /* tile pixmap for tiling operations */
- public int stipple; /* stipple 1 plane pixmap for stipping */
- public int ts_x_origin; /* offset for tile or stipple operations */
- public int ts_y_origin;
- public int font; /* default text font for text operations */
- public int subwindow_mode; /* ClipByChildren, IncludeInferiors */
- public int graphics_exposures;/* boolean, should exposures be generated */
- public int clip_x_origin; /* origin for clipping */
- public int clip_y_origin;
- public int clip_mask; /* bitmap clipping; other calls for rects */
- public int dash_offset; /* patterned/dashed line information */
- public byte dashes;
- public static final int sizeof = 92;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XImage.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XImage.java
deleted file mode 100644
index 56f8e4f268..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XImage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XImage {
- public int width, height;
- public int xoffset, format;
- public int data;
- public int byte_order, bitmap_unit, bitmap_bit_order, bitmap_pad;
- public int depth, bytes_per_line, bits_per_pixel;
- public int red_mask, green_mask, blue_mask;
- public int obdata;
-// struct funcs {
- public int create_image;
- public int destroy_image;
- public int get_pixel;
- public int put_pixel;
- public int sub_image;
- public int add_pixel;
-// } f;
- public static final int sizeof = 88;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XInputEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XInputEvent.java
deleted file mode 100644
index 553d7a6bd7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XInputEvent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public abstract class XInputEvent extends XWindowEvent {
- public int state; /* key or button mask */
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XKeyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XKeyEvent.java
deleted file mode 100644
index 3323552e5f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XKeyEvent.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XKeyEvent extends XInputEvent {
- public int keycode; /* detail */
- public int same_screen; /* same screen flag */
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XMotionEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XMotionEvent.java
deleted file mode 100644
index d25e8a2a26..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XMotionEvent.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XMotionEvent extends XInputEvent {
- public int is_hint; /* detail */
- public int same_screen; /* same screen flag */
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XRectangle.java
deleted file mode 100644
index 5badc8584c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XRectangle.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XRectangle {
- public short x, y, width, height;
- public static final int sizeof = 8;
-public String toString () {
- return "XRectangle {" + x + ", " + y + ", " + width + ", " + height + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java
deleted file mode 100644
index faae3320f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XSetWindowAttributes {
- public int background_pixmap; /* background or None or ParentRelative */
- public int background_pixel; /* background pixel */
- public int border_pixmap; /* border of the window */
- public int border_pixel; /* border pixel value */
- public int bit_gravity; /* one of bit gravity values */
- public int win_gravity; /* one of the window gravity values */
- public int backing_store; /* NotUseful, WhenMapped, Always */
- public int backing_planes;/* planes to be preseved if possible */
- public int backing_pixel;/* value to use in restoring planes */
- public int save_under; /* should bits under be saved? (popups) */
- public int event_mask; /* set of events that should be saved */
- public int do_not_propagate_mask; /* set of events that should not propagate */
- public int override_redirect; /* boolean value for override-redirect */
- public int colormap; /* color map to be associated with window */
- public int cursor; /* cursor to be displayed (or None) */
- public static final int sizeof = 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java
deleted file mode 100644
index 26fae4cbc5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XWindowAttributes {
- public int x, y; /* location of window */
- public int width, height; /* width and height of window */
- public int border_width; /* border width of window */
- public int depth; /* depth of window */
- public int visual; /* the associated visual structure */
- public int root; /* root of screen containing window */
- public int c_class; /* InputOutput, InputOnly*/
- public int bit_gravity; /* one of bit gravity values */
- public int win_gravity; /* one of the window gravity values */
- public int backing_store; /* NotUseful, WhenMapped, Always */
- public int backing_planes;/* planes to be preserved if possible */
- public int backing_pixel;/* value to be used when restoring planes */
- public int save_under; /* boolean, should bits under be saved? */
- public int colormap; /* color map to be associated with window */
- public int map_installed; /* boolean, is color map currently installed*/
- public int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
- public int all_event_masks; /* set of events all people have interest in*/
- public int your_event_mask; /* my event mask */
- public int do_not_propagate_mask; /* set of events that should not propagate */
- public int override_redirect; /* boolean value for override-redirect */
- public int screen; /* back pointer to correct screen */
- public static final int sizeof = 92;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowChanges.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowChanges.java
deleted file mode 100644
index 329f8a8c53..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowChanges.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XWindowChanges {
- public int x, y;
- public int width, height;
- public int border_width;
- public int sibling;
- public int stack_mode;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowEvent.java
deleted file mode 100644
index 2084e1ab85..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XWindowEvent.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public abstract class XWindowEvent extends XEvent {
- public int root; /* root window that the event occured on */
- public int subwindow; /* child window */
- public int time; /* milliseconds */
- public int x, y; /* pointer x, y coordinates in event window */
- public int x_root, y_root; /* coordinates relative to root */
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java
deleted file mode 100644
index 351cb19066..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmAnyCallbackStruct {
- public int reason; // 0
- public int event; // 4
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java
deleted file mode 100644
index f4a0c6f254..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmDragProcCallback {
- public int reason; // the reason callback was called
- public int event; // event structure that triggered callback
- public int timeStamp; // timestamp of ;logical event
- public int dragContext; // DragContext widget associated with operation
- public short x; // x-coordinate of pointer
- public short y; // y-coordinate of pointer
- public byte dropSiteStatus; // valid or invalid
- public byte operation; // current operation
- public byte operations; // supported operations
- public byte animate; // toolkit or receiver does animation
-
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java
deleted file mode 100644
index d5a9660286..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmDropFinishCallback {
- public int reason; // the reason callback was called
- public int event; // event structure that triggered callback
- public int timeStamp; // time at which drop completed
- public byte operation; // current operation
- public byte operations; // supported operations
- public byte dropSiteStatus; // valid, invalid or none
- public byte dropAction; // drop, cancel, help or interrupt
- public byte completionStatus; // success or failure
-
- public static final int sizeof = 17;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java
deleted file mode 100644
index 5b7a9d1b51..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmDropProcCallback {
- public int reason; // the reason callback was called
- public int event; // event structure that triggered callback
- public int timeStamp; // timestamp of ;logical event
- public int dragContext; // DragContext widget associated with operation
- public short x; // x-coordinate of pointer
- public short y; // y-coordinate of pointer
- public byte dropSiteStatus; // valid or invalid
- public byte operation; // current operation
- public byte operations; // supported operations
- public byte dropAction; // drop or help
-
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java
deleted file mode 100644
index 4094f36e81..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmTextBlockRec {
- public int ptr; // 0
- public int length; // 4
- public int format; // 8
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java
deleted file mode 100644
index 4d14db1da1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XmTextVerifyCallbackStruct extends XmAnyCallbackStruct {
- public byte doit; // 8
- public int currInsert; // 12
- public int newInsert; // 16
- public int startPos; // 20
- public int endPos; // 24
- public int text; // 28
- public static final int sizeof = 32;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java
deleted file mode 100644
index 785d28bb72..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.motif;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class XtWidgetGeometry {
- public int request_mode;
- public int x, y;
- public int width, height, border_width;
- public int sibling;
- public int stack_mode;
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/build.sh
deleted file mode 100644
index ba823ee205..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/build.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-
-export IVE_HOME=~/ive/bin
-
-make -f make_photon.mak $1 $2 $3 $4 \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/make_photon.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/make_photon.mak
deleted file mode 100644
index 354afbb8b3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/make_photon.mak
+++ /dev/null
@@ -1,30 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for SWT libraries on Photon
-
-include make_common.mak
-
-#assumes IVE_HOME is set in the environment
-
-SWT_PREFIX=swt
-WS_PREFIX=photon
-SWT_VERSION=$(maj_ver)$(min_ver)
-SWT_LIB=lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
-
-DEBUG =
-CFLAGS = -c -shared -DSWT_VERSION=$(SWT_VERSION) -w8 $(DEBUG) -DPHOTON -I$(IVE_HOME)/include
-LFLAGS = -shared -lph -lphrender
-
-SWT_OBJS = swt.o structs.o callback.o
-
-all: $(SWT_LIB)
-
-.c.o:
- cc $(CFLAGS) $*.c
-
-$(SWT_LIB): $(SWT_OBJS)
- cc -o $(SWT_LIB) $(LFLAGS) $(SWT_OBJS)
-
-clean:
- rm -f *.so *.o \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.c
deleted file mode 100644
index 2b85d31fb5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.c
+++ /dev/null
@@ -1,1380 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
- /**
- * JNI SWT object field getters and setters declarations for Motif structs.
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Globals */
-PhPoint_t_FID_CACHE PhPoint_tFc;
-PhRect_t_FID_CACHE PhRect_tFc;
-PhTile_t_FID_CACHE PhTile_tFc;
-PtCallbackInfo_t_FID_CACHE PtCallbackInfo_tFc;
-PhWindowEvent_t_FID_CACHE PhWindowEvent_tFc;
-PhEvent_t_FID_CACHE PhEvent_tFc;
-FontQueryInfo_FID_CACHE FontQueryInfoFc;
-PhDim_t_FID_CACHE PhDim_tFc;
-PhImage_t_FID_CACHE PhImage_tFc;
-PhPointerEvent_t_FID_CACHE PhPointerEvent_tFc;
-PhKeyEvent_t_FID_CACHE PhKeyEvent_tFc;
-PtScrollbarCallback_t_FID_CACHE PtScrollbarCallback_tFc;
-PhCursorInfo_t_FID_CACHE PhCursorInfo_tFc;
-FontDetails_FID_CACHE FontDetailsFc;
-PhArea_t_FID_CACHE PhArea_tFc;
-PtFileSelectionInfo_t_FID_CACHE PtFileSelectionInfo_tFc;
-PgAlpha_t_FID_CACHE PgAlpha_tFc;
-PtTextCallback_t_FID_CACHE PtTextCallback_tFc;
-PtTreeItem_t_FID_CACHE PtTreeItem_tFc;
-PgMap_t_FID_CACHE PgMap_tFc;
-PtColorSelectInfo_t_FID_CACHE PtColorSelectInfo_tFc;
-PhRegion_t_FID_CACHE PhRegion_tFc;
-PtContainerCallback_t_FID_CACHE PtContainerCallback_tFc;
-PhCursorDef_t_FID_CACHE PhCursorDef_tFc;
-PgDisplaySettings_t_FID_CACHE PgDisplaySettings_tFc;
-PgVideoModeInfo_t_FID_CACHE PgVideoModeInfo_tFc;
-PhClipHeader_FID_CACHE PhClipHeaderFc;
-
-void cachePhPoint_tFids(JNIEnv *env, jobject lpObject, PPhPoint_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "S");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "S");
- lpCache->cached = 1;
-}
-
-void getPhPoint_tFields(JNIEnv *env, jobject lpObject, PhPoint_t *lpStruct, PPhPoint_t_FID_CACHE lpCache)
-{
- lpStruct->x = (*env)->GetShortField(env, lpObject, lpCache->x);
- lpStruct->y = (*env)->GetShortField(env, lpObject, lpCache->y);
-}
-
-void setPhPoint_tFields(JNIEnv *env, jobject lpObject, PhPoint_t *lpStruct, PPhPoint_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->x, lpStruct->x);
- (*env)->SetShortField(env, lpObject, lpCache->y, lpStruct->y);
-}
-
-void cachePhRect_tFids(JNIEnv *env, jobject lpObject, PPhRect_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->ul_x = (*env)->GetFieldID(env, lpCache->clazz, "ul_x", "S");
- lpCache->ul_y = (*env)->GetFieldID(env, lpCache->clazz, "ul_y", "S");
- lpCache->lr_x = (*env)->GetFieldID(env, lpCache->clazz, "lr_x", "S");
- lpCache->lr_y = (*env)->GetFieldID(env, lpCache->clazz, "lr_y", "S");
- lpCache->cached = 1;
-}
-
-void getPhRect_tFields(JNIEnv *env, jobject lpObject, PhRect_t *lpStruct, PPhRect_t_FID_CACHE lpCache)
-{
- lpStruct->ul.x = (*env)->GetShortField(env, lpObject, lpCache->ul_x);
- lpStruct->ul.y = (*env)->GetShortField(env, lpObject, lpCache->ul_y);
- lpStruct->lr.x = (*env)->GetShortField(env, lpObject, lpCache->lr_x);
- lpStruct->lr.y = (*env)->GetShortField(env, lpObject, lpCache->lr_y);
-}
-
-void setPhRect_tFields(JNIEnv *env, jobject lpObject, PhRect_t *lpStruct, PPhRect_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->ul_x, lpStruct->ul.x);
- (*env)->SetShortField(env, lpObject, lpCache->ul_y, lpStruct->ul.y);
- (*env)->SetShortField(env, lpObject, lpCache->lr_x, lpStruct->lr.x);
- (*env)->SetShortField(env, lpObject, lpCache->lr_y, lpStruct->lr.y);
-}
-
-void cachePhTile_tFids(JNIEnv *env, jobject lpObject, PPhTile_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->rect_ul_x = (*env)->GetFieldID(env, lpCache->clazz, "rect_ul_x", "S");
- lpCache->rect_ul_y = (*env)->GetFieldID(env, lpCache->clazz, "rect_ul_y", "S");
- lpCache->rect_lr_x = (*env)->GetFieldID(env, lpCache->clazz, "rect_lr_x", "S");
- lpCache->rect_lr_y = (*env)->GetFieldID(env, lpCache->clazz, "rect_lr_y", "S");
- lpCache->next = (*env)->GetFieldID(env, lpCache->clazz, "next", "I");
- lpCache->cached = 1;
-}
-
-void getPhTile_tFields(JNIEnv *env, jobject lpObject, PhTile_t *lpStruct, PPhTile_t_FID_CACHE lpCache)
-{
- lpStruct->rect.ul.x = (*env)->GetShortField(env, lpObject, lpCache->rect_ul_x);
- lpStruct->rect.ul.y = (*env)->GetShortField(env, lpObject, lpCache->rect_ul_y);
- lpStruct->rect.lr.x = (*env)->GetShortField(env, lpObject, lpCache->rect_lr_x);
- lpStruct->rect.lr.y = (*env)->GetShortField(env, lpObject, lpCache->rect_lr_y);
- lpStruct->next = (PhTile_t *)(*env)->GetIntField(env, lpObject, lpCache->next);
-}
-
-void setPhTile_tFields(JNIEnv *env, jobject lpObject, PhTile_t *lpStruct, PPhTile_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->rect_ul_x, lpStruct->rect.ul.x);
- (*env)->SetShortField(env, lpObject, lpCache->rect_ul_y, lpStruct->rect.ul.y);
- (*env)->SetShortField(env, lpObject, lpCache->rect_lr_x, lpStruct->rect.lr.x);
- (*env)->SetShortField(env, lpObject, lpCache->rect_lr_y, lpStruct->rect.lr.y);
- (*env)->SetIntField(env, lpObject, lpCache->next, (jint)lpStruct->next);
-}
-
-void cachePtCallbackInfo_tFids(JNIEnv *env, jobject lpObject, PPtCallbackInfo_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->reason = (*env)->GetFieldID(env, lpCache->clazz, "reason", "I");
- lpCache->reason_subtype = (*env)->GetFieldID(env, lpCache->clazz, "reason_subtype", "I");
- lpCache->event = (*env)->GetFieldID(env, lpCache->clazz, "event", "I");
- lpCache->cbdata = (*env)->GetFieldID(env, lpCache->clazz, "cbdata", "I");
- lpCache->cached = 1;
-}
-
-void getPtCallbackInfo_tFields(JNIEnv *env, jobject lpObject, PtCallbackInfo_t *lpStruct, PPtCallbackInfo_t_FID_CACHE lpCache)
-{
- lpStruct->reason = (*env)->GetIntField(env, lpObject, lpCache->reason);
- lpStruct->reason_subtype = (*env)->GetIntField(env, lpObject, lpCache->reason_subtype);
- lpStruct->event = (PhEvent_t *)(*env)->GetIntField(env, lpObject, lpCache->event);
- lpStruct->cbdata = (void *)(*env)->GetIntField(env, lpObject, lpCache->cbdata);
-}
-
-void setPtCallbackInfo_tFields(JNIEnv *env, jobject lpObject, PtCallbackInfo_t *lpStruct, PPtCallbackInfo_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->reason, lpStruct->reason);
- (*env)->SetIntField(env, lpObject, lpCache->reason_subtype, lpStruct->reason_subtype);
- (*env)->SetIntField(env, lpObject, lpCache->event, (jint)lpStruct->event);
- (*env)->SetIntField(env, lpObject, lpCache->cbdata, (jint)lpStruct->cbdata);
-}
-
-void cachePhWindowEvent_tFids(JNIEnv *env, jobject lpObject, PPhWindowEvent_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->event_f = (*env)->GetFieldID(env, lpCache->clazz, "event_f", "I");
- lpCache->state_f = (*env)->GetFieldID(env, lpCache->clazz, "state_f", "I");
- lpCache->rid = (*env)->GetFieldID(env, lpCache->clazz, "rid", "I");
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->size_w = (*env)->GetFieldID(env, lpCache->clazz, "size_w", "S");
- lpCache->size_h = (*env)->GetFieldID(env, lpCache->clazz, "size_h", "S");
- lpCache->event_state = (*env)->GetFieldID(env, lpCache->clazz, "event_state", "S");
- lpCache->input_group = (*env)->GetFieldID(env, lpCache->clazz, "input_group", "S");
- lpCache->rsvd0 = (*env)->GetFieldID(env, lpCache->clazz, "rsvd0", "I");
- lpCache->rsvd1 = (*env)->GetFieldID(env, lpCache->clazz, "rsvd1", "I");
- lpCache->rsvd2 = (*env)->GetFieldID(env, lpCache->clazz, "rsvd2", "I");
- lpCache->rsvd3 = (*env)->GetFieldID(env, lpCache->clazz, "rsvd3", "I");
- lpCache->cached = 1;
-}
-
-void getPhWindowEvent_tFields(JNIEnv *env, jobject lpObject, PhWindowEvent_t *lpStruct, PPhWindowEvent_t_FID_CACHE lpCache)
-{
- lpStruct->event_f = (*env)->GetIntField(env, lpObject, lpCache->event_f);
- lpStruct->state_f = (*env)->GetIntField(env, lpObject, lpCache->state_f);
- lpStruct->rid = (*env)->GetIntField(env, lpObject, lpCache->rid);
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->size.w = (*env)->GetShortField(env, lpObject, lpCache->size_w);
- lpStruct->size.h = (*env)->GetShortField(env, lpObject, lpCache->size_h);
- lpStruct->event_state = (*env)->GetShortField(env, lpObject, lpCache->event_state);
- lpStruct->input_group = (*env)->GetShortField(env, lpObject, lpCache->input_group);
- lpStruct->rsvd[0] = (*env)->GetIntField(env, lpObject, lpCache->rsvd0);
- lpStruct->rsvd[1] = (*env)->GetIntField(env, lpObject, lpCache->rsvd1);
- lpStruct->rsvd[2] = (*env)->GetIntField(env, lpObject, lpCache->rsvd2);
- lpStruct->rsvd[3] = (*env)->GetIntField(env, lpObject, lpCache->rsvd3);
-}
-
-void setPhWindowEvent_tFields(JNIEnv *env, jobject lpObject, PhWindowEvent_t *lpStruct, PPhWindowEvent_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->event_f, lpStruct->event_f);
- (*env)->SetIntField(env, lpObject, lpCache->state_f, lpStruct->state_f);
- (*env)->SetIntField(env, lpObject, lpCache->rid, lpStruct->rid);
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetShortField(env, lpObject, lpCache->size_w, lpStruct->size.w);
- (*env)->SetShortField(env, lpObject, lpCache->size_h, lpStruct->size.h);
- (*env)->SetShortField(env, lpObject, lpCache->event_state, lpStruct->event_state);
- (*env)->SetShortField(env, lpObject, lpCache->input_group, lpStruct->input_group);
- (*env)->SetIntField(env, lpObject, lpCache->rsvd0, lpStruct->rsvd[0]);
- (*env)->SetIntField(env, lpObject, lpCache->rsvd1, lpStruct->rsvd[1]);
- (*env)->SetIntField(env, lpObject, lpCache->rsvd2, lpStruct->rsvd[2]);
- (*env)->SetIntField(env, lpObject, lpCache->rsvd3, lpStruct->rsvd[3]);
-}
-
-
-void cachePhEvent_tFids(JNIEnv *env, jobject lpObject, PPhEvent_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->type = (*env)->GetFieldID(env, lpCache->clazz, "type", "I");
- lpCache->subtype = (*env)->GetFieldID(env, lpCache->clazz, "subtype", "S");
- lpCache->processing_flags = (*env)->GetFieldID(env, lpCache->clazz, "processing_flags", "S");
- lpCache->emitter_rid = (*env)->GetFieldID(env, lpCache->clazz, "emitter_rid", "I");
- lpCache->emitter_handle = (*env)->GetFieldID(env, lpCache->clazz, "emitter_handle", "I");
- lpCache->collector_rid = (*env)->GetFieldID(env, lpCache->clazz, "collector_rid", "I");
- lpCache->collector_handle = (*env)->GetFieldID(env, lpCache->clazz, "collector_handle", "I");
- lpCache->input_group = (*env)->GetFieldID(env, lpCache->clazz, "input_group", "S");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "S");
- lpCache->timestamp = (*env)->GetFieldID(env, lpCache->clazz, "timestamp", "I");
- lpCache->translation_x = (*env)->GetFieldID(env, lpCache->clazz, "translation_x", "S");
- lpCache->translation_y = (*env)->GetFieldID(env, lpCache->clazz, "translation_y", "S");
- lpCache->num_rects = (*env)->GetFieldID(env, lpCache->clazz, "num_rects", "S");
- lpCache->data_len = (*env)->GetFieldID(env, lpCache->clazz, "data_len", "S");
- lpCache->cached = 1;
-}
-
-void getPhEvent_tFields(JNIEnv *env, jobject lpObject, PhEvent_t *lpStruct, PPhEvent_t_FID_CACHE lpCache)
-{
- lpStruct->type = (*env)->GetIntField(env, lpObject, lpCache->type);
- lpStruct->subtype = (*env)->GetShortField(env, lpObject, lpCache->subtype);
- lpStruct->processing_flags = (*env)->GetShortField(env, lpObject, lpCache->processing_flags);
- lpStruct->emitter.rid = (*env)->GetIntField(env, lpObject, lpCache->emitter_rid);
- lpStruct->emitter.handle = (*env)->GetIntField(env, lpObject, lpCache->emitter_handle);
- lpStruct->collector.rid = (*env)->GetIntField(env, lpObject, lpCache->collector_rid);
- lpStruct->collector.handle = (*env)->GetIntField(env, lpObject, lpCache->collector_handle);
- lpStruct->input_group = (*env)->GetShortField(env, lpObject, lpCache->input_group);
- lpStruct->flags = (*env)->GetShortField(env, lpObject, lpCache->flags);
- lpStruct->timestamp = (*env)->GetIntField(env, lpObject, lpCache->timestamp);
- lpStruct->translation.x = (*env)->GetShortField(env, lpObject, lpCache->translation_x);
- lpStruct->translation.y = (*env)->GetShortField(env, lpObject, lpCache->translation_y);
- lpStruct->num_rects = (*env)->GetShortField(env, lpObject, lpCache->num_rects);
- lpStruct->data_len = (*env)->GetShortField(env, lpObject, lpCache->data_len);
-}
-
-void setPhEvent_tFields(JNIEnv *env, jobject lpObject, PhEvent_t *lpStruct, PPhEvent_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->type, lpStruct->type);
- (*env)->SetShortField(env, lpObject, lpCache->subtype, lpStruct->subtype);
- (*env)->SetShortField(env, lpObject, lpCache->processing_flags, lpStruct->processing_flags);
- (*env)->SetIntField(env, lpObject, lpCache->emitter_rid, lpStruct->emitter.rid);
- (*env)->SetIntField(env, lpObject, lpCache->emitter_handle, lpStruct->emitter.handle);
- (*env)->SetIntField(env, lpObject, lpCache->collector_rid, lpStruct->collector.rid);
- (*env)->SetIntField(env, lpObject, lpCache->collector_handle, lpStruct->collector.handle);
- (*env)->SetShortField(env, lpObject, lpCache->input_group, lpStruct->input_group);
- (*env)->SetShortField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetIntField(env, lpObject, lpCache->timestamp, lpStruct->timestamp);
- (*env)->SetShortField(env, lpObject, lpCache->translation_x, lpStruct->translation.x);
- (*env)->SetShortField(env, lpObject, lpCache->translation_y, lpStruct->translation.y);
- (*env)->SetShortField(env, lpObject, lpCache->num_rects, lpStruct->num_rects);
- (*env)->SetShortField(env, lpObject, lpCache->data_len, lpStruct->data_len);
-}
-
-void cacheFontQueryInfoFids(JNIEnv *env, jobject lpObject, PFontQueryInfo_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->font = (*env)->GetFieldID(env, lpCache->clazz, "font", "[B");
- lpCache->desc = (*env)->GetFieldID(env, lpCache->clazz, "desc", "[B");
- lpCache->size = (*env)->GetFieldID(env, lpCache->clazz, "size", "S");
- lpCache->style = (*env)->GetFieldID(env, lpCache->clazz, "style", "S");
- lpCache->ascender = (*env)->GetFieldID(env, lpCache->clazz, "ascender", "S");
- lpCache->descender = (*env)->GetFieldID(env, lpCache->clazz, "descender", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->clazz, "width", "S");
- lpCache->lochar = (*env)->GetFieldID(env, lpCache->clazz, "lochar", "I");
- lpCache->hichar = (*env)->GetFieldID(env, lpCache->clazz, "hichar", "I");
- lpCache->cached = 1;
-}
-
-void getFontQueryInfoFields(JNIEnv *env, jobject lpObject, FontQueryInfo *lpStruct, PFontQueryInfo_FID_CACHE lpCache)
-{
- jbyteArray desc, font = (*env)->GetObjectField(env, lpObject, lpCache->font);
- if (font) {
- jbyte *font1 = (*env)->GetByteArrayElements(env, font, NULL);
- memcpy(lpStruct->font, font1, MAX_FONT_TAG);
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- }
- desc = (*env)->GetObjectField(env, lpObject, lpCache->desc);
- if (desc) {
- jbyte *desc1 = (*env)->GetByteArrayElements(env, desc, NULL);
- memcpy(lpStruct->desc, desc1, MAX_DESC_LENGTH);
- (*env)->ReleaseByteArrayElements(env, desc, desc1, JNI_ABORT);
- }
- lpStruct->size = (*env)->GetShortField(env, lpObject, lpCache->size);
- lpStruct->style = (*env)->GetShortField(env, lpObject, lpCache->style);
- lpStruct->ascender = (*env)->GetShortField(env, lpObject, lpCache->ascender);
- lpStruct->descender = (*env)->GetShortField(env, lpObject, lpCache->descender);
- lpStruct->width = (*env)->GetShortField(env, lpObject, lpCache->width);
- lpStruct->lochar = (*env)->GetIntField(env, lpObject, lpCache->lochar);
- lpStruct->hichar = (*env)->GetIntField(env, lpObject, lpCache->hichar);
-}
-
-void setFontQueryInfoFields(JNIEnv *env, jobject lpObject, FontQueryInfo *lpStruct, PFontQueryInfo_FID_CACHE lpCache)
-{
- jbyteArray desc, font = (*env)->GetObjectField(env, lpObject, lpCache->font);
- if (font) {
- jbyte *font1 = (*env)->GetByteArrayElements(env, font, NULL);
- memcpy(font1, lpStruct->font, MAX_FONT_TAG);
- (*env)->ReleaseByteArrayElements(env, font, font1, 0);
- }
- desc = (*env)->GetObjectField(env, lpObject, lpCache->desc);
- if (desc) {
- jbyte *desc1 = (*env)->GetByteArrayElements(env, desc, NULL);
- memcpy(desc1, lpStruct->desc, MAX_DESC_LENGTH);
- (*env)->ReleaseByteArrayElements(env, desc, desc1, 0);
- }
- (*env)->SetShortField(env, lpObject, lpCache->size, lpStruct->size);
- (*env)->SetShortField(env, lpObject, lpCache->style, lpStruct->style);
- (*env)->SetShortField(env, lpObject, lpCache->ascender, lpStruct->ascender);
- (*env)->SetShortField(env, lpObject, lpCache->descender, lpStruct->descender);
- (*env)->SetShortField(env, lpObject, lpCache->width, lpStruct->width);
- (*env)->SetIntField(env, lpObject, lpCache->lochar, lpStruct->lochar);
- (*env)->SetIntField(env, lpObject, lpCache->hichar, lpStruct->hichar);
-}
-
-void cachePhDim_tFids(JNIEnv *env, jobject lpObject, PPhDim_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->w = (*env)->GetFieldID(env, lpCache->clazz, "w", "S");
- lpCache->h = (*env)->GetFieldID(env, lpCache->clazz, "h", "S");
- lpCache->cached = 1;
-}
-
-void getPhDim_tFields(JNIEnv *env, jobject lpObject, PhDim_t *lpStruct, PPhDim_t_FID_CACHE lpCache)
-{
- lpStruct->w = (*env)->GetShortField(env, lpObject, lpCache->w);
- lpStruct->h = (*env)->GetShortField(env, lpObject, lpCache->h);
-}
-
-void setPhDim_tFields(JNIEnv *env, jobject lpObject, PhDim_t *lpStruct, PPhDim_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->w, lpStruct->w);
- (*env)->SetShortField(env, lpObject, lpCache->h, lpStruct->h);
-}
-
-void cachePhImage_tFids(JNIEnv *env, jobject lpObject, PPhImage_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->type = (*env)->GetFieldID(env, lpCache->clazz, "type", "I");
- lpCache->image_tag = (*env)->GetFieldID(env, lpCache->clazz, "image_tag", "I");
- lpCache->bpl = (*env)->GetFieldID(env, lpCache->clazz, "bpl", "I");
- lpCache->size_w = (*env)->GetFieldID(env, lpCache->clazz, "size_w", "S");
- lpCache->size_h = (*env)->GetFieldID(env, lpCache->clazz, "size_h", "S");
- lpCache->palette_tag = (*env)->GetFieldID(env, lpCache->clazz, "palette_tag", "I");
- lpCache->colors = (*env)->GetFieldID(env, lpCache->clazz, "colors", "I");
- lpCache->alpha = (*env)->GetFieldID(env, lpCache->clazz, "alpha", "I");
- lpCache->transparent = (*env)->GetFieldID(env, lpCache->clazz, "transparent", "I");
- lpCache->format = (*env)->GetFieldID(env, lpCache->clazz, "format", "B");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "B");
- lpCache->ghost_bpl = (*env)->GetFieldID(env, lpCache->clazz, "ghost_bpl", "B");
- lpCache->spare1 = (*env)->GetFieldID(env, lpCache->clazz, "spare1", "B");
- lpCache->ghost_bitmap = (*env)->GetFieldID(env, lpCache->clazz, "ghost_bitmap", "I");
- lpCache->mask_bpl = (*env)->GetFieldID(env, lpCache->clazz, "mask_bpl", "I");
- lpCache->mask_bm = (*env)->GetFieldID(env, lpCache->clazz, "mask_bm", "I");
- lpCache->palette = (*env)->GetFieldID(env, lpCache->clazz, "palette", "I");
- lpCache->image = (*env)->GetFieldID(env, lpCache->clazz, "image", "I");
- lpCache->cached = 1;
-}
-
-void getPhImage_tFields(JNIEnv *env, jobject lpObject, PhImage_t *lpStruct, PPhImage_t_FID_CACHE lpCache)
-{
- lpStruct->type = (*env)->GetIntField(env, lpObject, lpCache->type);
- lpStruct->image_tag = (*env)->GetIntField(env, lpObject, lpCache->image_tag);
- lpStruct->bpl = (*env)->GetIntField(env, lpObject, lpCache->bpl);
- lpStruct->size.w = (*env)->GetShortField(env, lpObject, lpCache->size_w);
- lpStruct->size.h = (*env)->GetShortField(env, lpObject, lpCache->size_h);
- lpStruct->palette_tag = (*env)->GetIntField(env, lpObject, lpCache->palette_tag);
- lpStruct->colors = (*env)->GetIntField(env, lpObject, lpCache->colors);
- lpStruct->alpha = (PgAlpha_t *)(*env)->GetIntField(env, lpObject, lpCache->alpha);
- lpStruct->transparent = (PgColor_t)(*env)->GetIntField(env, lpObject, lpCache->transparent);
- lpStruct->format = (*env)->GetByteField(env, lpObject, lpCache->format);
- lpStruct->flags = (*env)->GetByteField(env, lpObject, lpCache->flags);
- lpStruct->ghost_bpl = (*env)->GetByteField(env, lpObject, lpCache->ghost_bpl);
- lpStruct->spare1 = (*env)->GetByteField(env, lpObject, lpCache->spare1);
- lpStruct->ghost_bitmap = (char *)(*env)->GetIntField(env, lpObject, lpCache->ghost_bitmap);
- lpStruct->mask_bpl = (*env)->GetIntField(env, lpObject, lpCache->mask_bpl);
- lpStruct->mask_bm = (char *)(*env)->GetIntField(env, lpObject, lpCache->mask_bm);
- lpStruct->palette = (PgColor_t *)(*env)->GetIntField(env, lpObject, lpCache->palette);
- lpStruct->image = (char *)(*env)->GetIntField(env, lpObject, lpCache->image);
-}
-
-void setPhImage_tFields(JNIEnv *env, jobject lpObject, PhImage_t *lpStruct, PPhImage_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->type, lpStruct->type);
- (*env)->SetIntField(env, lpObject, lpCache->image_tag, lpStruct->image_tag);
- (*env)->SetIntField(env, lpObject, lpCache->bpl, lpStruct->bpl);
- (*env)->SetShortField(env, lpObject, lpCache->size_w, lpStruct->size.w);
- (*env)->SetShortField(env, lpObject, lpCache->size_h, lpStruct->size.h);
- (*env)->SetIntField(env, lpObject, lpCache->palette_tag, lpStruct->palette_tag);
- (*env)->SetIntField(env, lpObject, lpCache->colors, lpStruct->colors);
- (*env)->SetIntField(env, lpObject, lpCache->alpha, (jint)lpStruct->alpha);
- (*env)->SetIntField(env, lpObject, lpCache->transparent, (jint)lpStruct->transparent);
- (*env)->SetByteField(env, lpObject, lpCache->format, lpStruct->format);
- (*env)->SetByteField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetByteField(env, lpObject, lpCache->ghost_bpl, lpStruct->ghost_bpl);
- (*env)->SetByteField(env, lpObject, lpCache->spare1, lpStruct->spare1);
- (*env)->SetIntField(env, lpObject, lpCache->ghost_bitmap, (jint)lpStruct->ghost_bitmap);
- (*env)->SetIntField(env, lpObject, lpCache->mask_bpl, lpStruct->mask_bpl);
- (*env)->SetIntField(env, lpObject, lpCache->mask_bm, (jint)lpStruct->mask_bm);
- (*env)->SetIntField(env, lpObject, lpCache->palette, (jint)lpStruct->palette);
- (*env)->SetIntField(env, lpObject, lpCache->image, (jint)lpStruct->image);
-}
-
-
-void cachePhPointerEvent_tFids(JNIEnv *env, jobject lpObject, PPhPointerEvent_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->buttons = (*env)->GetFieldID(env, lpCache->clazz, "buttons", "S");
- lpCache->button_state = (*env)->GetFieldID(env, lpCache->clazz, "button_state", "S");
- lpCache->click_count = (*env)->GetFieldID(env, lpCache->clazz, "click_count", "B");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "B");
- lpCache->z = (*env)->GetFieldID(env, lpCache->clazz, "z", "S");
- lpCache->key_mods = (*env)->GetFieldID(env, lpCache->clazz, "key_mods", "I");
- lpCache->zero = (*env)->GetFieldID(env, lpCache->clazz, "zero", "I");
- lpCache->cached = 1;
-}
-
-void getPhPointerEvent_tFields(JNIEnv *env, jobject lpObject, PhPointerEvent_t *lpStruct, PPhPointerEvent_t_FID_CACHE lpCache)
-{
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->buttons = (*env)->GetShortField(env, lpObject, lpCache->buttons);
- lpStruct->button_state = (*env)->GetShortField(env, lpObject, lpCache->button_state);
- lpStruct->click_count = (*env)->GetByteField(env, lpObject, lpCache->click_count);
- lpStruct->flags = (*env)->GetByteField(env, lpObject, lpCache->flags);
- lpStruct->z = (*env)->GetShortField(env, lpObject, lpCache->z);
- lpStruct->key_mods = (*env)->GetIntField(env, lpObject, lpCache->key_mods);
- lpStruct->zero = (*env)->GetIntField(env, lpObject, lpCache->zero);
-}
-
-void setPhPointerEvent_tFields(JNIEnv *env, jobject lpObject, PhPointerEvent_t *lpStruct, PPhPointerEvent_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetShortField(env, lpObject, lpCache->buttons, lpStruct->buttons);
- (*env)->SetShortField(env, lpObject, lpCache->button_state, lpStruct->button_state);
- (*env)->SetByteField(env, lpObject, lpCache->click_count, lpStruct->click_count);
- (*env)->SetByteField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetShortField(env, lpObject, lpCache->z, lpStruct->z);
- (*env)->SetIntField(env, lpObject, lpCache->key_mods, lpStruct->key_mods);
- (*env)->SetIntField(env, lpObject, lpCache->zero, lpStruct->zero);
-}
-
-void cachePhKeyEvent_tFids(JNIEnv *env, jobject lpObject, PPhKeyEvent_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->key_flags = (*env)->GetFieldID(env, lpCache->clazz, "key_flags", "I");
- lpCache->key_mods = (*env)->GetFieldID(env, lpCache->clazz, "key_mods", "I");
- lpCache->key_sym = (*env)->GetFieldID(env, lpCache->clazz, "key_sym", "I");
- lpCache->key_cap = (*env)->GetFieldID(env, lpCache->clazz, "key_cap", "I");
- lpCache->key_scan = (*env)->GetFieldID(env, lpCache->clazz, "key_scan", "S");
- lpCache->key_zero = (*env)->GetFieldID(env, lpCache->clazz, "key_zero", "S");
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->button_state = (*env)->GetFieldID(env, lpCache->clazz, "button_state", "S");
- lpCache->cached = 1;
-}
-
-void getPhKeyEvent_tFields(JNIEnv *env, jobject lpObject, PhKeyEvent_t *lpStruct, PPhKeyEvent_t_FID_CACHE lpCache)
-{
- lpStruct->key_flags = (*env)->GetIntField(env, lpObject, lpCache->key_flags);
- lpStruct->key_mods = (*env)->GetIntField(env, lpObject, lpCache->key_mods);
- lpStruct->key_sym = (*env)->GetIntField(env, lpObject, lpCache->key_sym);
- lpStruct->key_cap = (*env)->GetIntField(env, lpObject, lpCache->key_cap);
- lpStruct->key_scan = (*env)->GetShortField(env, lpObject, lpCache->key_scan);
-#if _NTO_VERSION+0 >= 610
- lpStruct->key_zero = (*env)->GetShortField(env, lpObject, lpCache->key_zero);
-#endif
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->button_state = (*env)->GetShortField(env, lpObject, lpCache->button_state);
-}
-
-void setPhKeyEvent_tFields(JNIEnv *env, jobject lpObject, PhKeyEvent_t *lpStruct, PPhKeyEvent_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->key_flags, lpStruct->key_flags);
- (*env)->SetIntField(env, lpObject, lpCache->key_mods, lpStruct->key_mods);
- (*env)->SetIntField(env, lpObject, lpCache->key_sym, lpStruct->key_sym);
- (*env)->SetIntField(env, lpObject, lpCache->key_cap, lpStruct->key_cap);
- (*env)->SetShortField(env, lpObject, lpCache->key_scan, lpStruct->key_scan);
-#if _NTO_VERSION+0 >= 610
- (*env)->SetShortField(env, lpObject, lpCache->key_zero, lpStruct->key_zero);
-#endif
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetShortField(env, lpObject, lpCache->button_state, lpStruct->button_state);
-}
-
-void cachePtScrollbarCallback_tFids(JNIEnv *env, jobject lpObject, PPtScrollbarCallback_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->action = (*env)->GetFieldID(env, lpCache->clazz, "action", "I");
- lpCache->position = (*env)->GetFieldID(env, lpCache->clazz, "position", "I");
- lpCache->cached = 1;
-}
-
-void getPtScrollbarCallback_tFields(JNIEnv *env, jobject lpObject, PtScrollbarCallback_t *lpStruct, PPtScrollbarCallback_t_FID_CACHE lpCache)
-{
- lpStruct->action = (*env)->GetIntField(env, lpObject, lpCache->action);
- lpStruct->position = (*env)->GetIntField(env, lpObject, lpCache->position);
-}
-
-void setPtScrollbarCallback_tFields(JNIEnv *env, jobject lpObject, PtScrollbarCallback_t *lpStruct, PPtScrollbarCallback_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->action, lpStruct->action);
- (*env)->SetIntField(env, lpObject, lpCache->position, lpStruct->position);
-}
-
-void cachePhCursorInfo_tFids(JNIEnv *env, jobject lpObject, PPhCursorInfo_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->region = (*env)->GetFieldID(env, lpCache->clazz, "region", "I");
- lpCache->ig_region = (*env)->GetFieldID(env, lpCache->clazz, "ig_region", "I");
- lpCache->color = (*env)->GetFieldID(env, lpCache->clazz, "color", "I");
- lpCache->last_press_x = (*env)->GetFieldID(env, lpCache->clazz, "last_press_x", "S");
- lpCache->last_press_y = (*env)->GetFieldID(env, lpCache->clazz, "last_press_y", "S");
- lpCache->msec = (*env)->GetFieldID(env, lpCache->clazz, "msec", "I");
- lpCache->steady_x = (*env)->GetFieldID(env, lpCache->clazz, "steady_x", "I");
- lpCache->steady_y = (*env)->GetFieldID(env, lpCache->clazz, "steady_y", "I");
- lpCache->dragger = (*env)->GetFieldID(env, lpCache->clazz, "dragger", "I");
- lpCache->drag_boundary_xUL = (*env)->GetFieldID(env, lpCache->clazz, "drag_boundary_xUL", "S");
- lpCache->drag_boundary_yUL = (*env)->GetFieldID(env, lpCache->clazz, "drag_boundary_yUL", "S");
- lpCache->drag_boundary_xLR = (*env)->GetFieldID(env, lpCache->clazz, "drag_boundary_xLR", "S");
- lpCache->drag_boundary_yLR = (*env)->GetFieldID(env, lpCache->clazz, "drag_boundary_yLR", "S");
- lpCache->phantom_rid = (*env)->GetFieldID(env, lpCache->clazz, "phantom_rid", "I");
- lpCache->type = (*env)->GetFieldID(env, lpCache->clazz, "type", "S");
- lpCache->ig = (*env)->GetFieldID(env, lpCache->clazz, "ig", "S");
- lpCache->button_state = (*env)->GetFieldID(env, lpCache->clazz, "button_state", "S");
- lpCache->click_count = (*env)->GetFieldID(env, lpCache->clazz, "click_count", "B");
- lpCache->zero10 = (*env)->GetFieldID(env, lpCache->clazz, "zero10", "B");
- lpCache->zero11 = (*env)->GetFieldID(env, lpCache->clazz, "zero11", "B");
- lpCache->zero12 = (*env)->GetFieldID(env, lpCache->clazz, "zero12", "B");
- lpCache->key_mods = (*env)->GetFieldID(env, lpCache->clazz, "key_mods", "I");
- lpCache->zero2 = (*env)->GetFieldID(env, lpCache->clazz, "zero2", "I");
- lpCache->cached = 1;
-}
-
-void getPhCursorInfo_tFields(JNIEnv *env, jobject lpObject, PhCursorInfo_t *lpStruct, PPhCursorInfo_t_FID_CACHE lpCache)
-{
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->region = (*env)->GetIntField(env, lpObject, lpCache->region);
- lpStruct->ig_region = (*env)->GetIntField(env, lpObject, lpCache->ig_region);
- lpStruct->color = (*env)->GetIntField(env, lpObject, lpCache->color);
- lpStruct->last_press.x = (*env)->GetShortField(env, lpObject, lpCache->last_press_x);
- lpStruct->last_press.y = (*env)->GetShortField(env, lpObject, lpCache->last_press_y);
- lpStruct->msec = (*env)->GetIntField(env, lpObject, lpCache->msec);
- lpStruct->steady.x = (*env)->GetIntField(env, lpObject, lpCache->steady_x);
- lpStruct->steady.y = (*env)->GetIntField(env, lpObject, lpCache->steady_y);
- lpStruct->dragger = (*env)->GetIntField(env, lpObject, lpCache->dragger);
- lpStruct->drag_boundary.ul.x = (*env)->GetShortField(env, lpObject, lpCache->drag_boundary_xUL);
- lpStruct->drag_boundary.ul.y = (*env)->GetShortField(env, lpObject, lpCache->drag_boundary_yUL);
- lpStruct->drag_boundary.lr.x = (*env)->GetShortField(env, lpObject, lpCache->drag_boundary_xLR);
- lpStruct->drag_boundary.lr.y = (*env)->GetShortField(env, lpObject, lpCache->drag_boundary_yLR);
- lpStruct->phantom_rid = (*env)->GetIntField(env, lpObject, lpCache->phantom_rid);
- lpStruct->type = (*env)->GetShortField(env, lpObject, lpCache->type);
- lpStruct->ig = (*env)->GetShortField(env, lpObject, lpCache->ig);
- lpStruct->button_state = (*env)->GetShortField(env, lpObject, lpCache->button_state);
- lpStruct->click_count = (*env)->GetByteField(env, lpObject, lpCache->click_count);
-// lpStruct->zero10 = (*env)->GetByteField(env, lpObject, lpCache->zero10);
-// lpStruct->zero11 = (*env)->GetByteField(env, lpObject, lpCache->zero11);
-// lpStruct->zero12 = (*env)->GetByteField(env, lpObject, lpCache->zero12);
- lpStruct->key_mods = (*env)->GetIntField(env, lpObject, lpCache->key_mods);
- lpStruct->zero2 = (*env)->GetIntField(env, lpObject, lpCache->zero2);
-}
-
-void setPhCursorInfo_tFields(JNIEnv *env, jobject lpObject, PhCursorInfo_t *lpStruct, PPhCursorInfo_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetIntField(env, lpObject, lpCache->region, lpStruct->region);
- (*env)->SetIntField(env, lpObject, lpCache->ig_region, lpStruct->ig_region);
- (*env)->SetIntField(env, lpObject, lpCache->color, lpStruct->color);
- (*env)->SetShortField(env, lpObject, lpCache->last_press_x, lpStruct->last_press.x);
- (*env)->SetShortField(env, lpObject, lpCache->last_press_y, lpStruct->last_press.y);
- (*env)->SetIntField(env, lpObject, lpCache->msec, lpStruct->msec);
- (*env)->SetIntField(env, lpObject, lpCache->steady_x, lpStruct->steady.x);
- (*env)->SetIntField(env, lpObject, lpCache->steady_y, lpStruct->steady.y);
- (*env)->SetIntField(env, lpObject, lpCache->dragger, lpStruct->dragger);
- (*env)->SetShortField(env, lpObject, lpCache->drag_boundary_xUL, lpStruct->drag_boundary.ul.x);
- (*env)->SetShortField(env, lpObject, lpCache->drag_boundary_yUL, lpStruct->drag_boundary.ul.y);
- (*env)->SetShortField(env, lpObject, lpCache->drag_boundary_xLR, lpStruct->drag_boundary.lr.x);
- (*env)->SetShortField(env, lpObject, lpCache->drag_boundary_yLR, lpStruct->drag_boundary.lr.y);
- (*env)->SetIntField(env, lpObject, lpCache->phantom_rid, lpStruct->phantom_rid);
- (*env)->SetShortField(env, lpObject, lpCache->type, lpStruct->type);
- (*env)->SetShortField(env, lpObject, lpCache->ig, lpStruct->ig);
- (*env)->SetShortField(env, lpObject, lpCache->button_state, lpStruct->button_state);
- (*env)->SetByteField(env, lpObject, lpCache->click_count, lpStruct->click_count);
-// (*env)->SetByteField(env, lpObject, lpCache->zero10, lpStruct->zero10);
-// (*env)->SetByteField(env, lpObject, lpCache->zero11, lpStruct->zero11);
-// (*env)->SetByteField(env, lpObject, lpCache->zero12, lpStruct->zero12);
- (*env)->SetIntField(env, lpObject, lpCache->key_mods, lpStruct->key_mods);
- (*env)->SetIntField(env, lpObject, lpCache->zero2, lpStruct->zero2);
-}
-
-void cacheFontDetailsFids(JNIEnv *env, jobject lpObject, PFontDetails_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->desc = (*env)->GetFieldID(env, lpCache->clazz, "desc", "[B");
- lpCache->stem = (*env)->GetFieldID(env, lpCache->clazz, "stem", "[B");
- lpCache->losize = (*env)->GetFieldID(env, lpCache->clazz, "losize", "S");
- lpCache->hisize = (*env)->GetFieldID(env, lpCache->clazz, "hisize", "S");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "S");
- lpCache->cached = 1;
-}
-
-void getFontDetailsFields(JNIEnv *env, jobject lpObject, FontDetails *lpStruct, PFontDetails_FID_CACHE lpCache)
-{
- jbyteArray desc, stem = (*env)->GetObjectField(env, lpObject, lpCache->stem);
- if (stem) {
- jbyte *stem1 = (*env)->GetByteArrayElements(env, stem, NULL);
- memcpy(lpStruct->stem, stem1, MAX_FONT_TAG);
- (*env)->ReleaseByteArrayElements(env, stem, stem1, JNI_ABORT);
- }
- desc = (*env)->GetObjectField(env, lpObject, lpCache->desc);
- if (desc) {
- jbyte *desc1 = (*env)->GetByteArrayElements(env, desc, NULL);
- memcpy(lpStruct->desc, desc1, MAX_DESC_LENGTH);
- (*env)->ReleaseByteArrayElements(env, desc, desc1, JNI_ABORT);
- }
- lpStruct->losize = (*env)->GetShortField(env, lpObject, lpCache->losize);
- lpStruct->hisize = (*env)->GetShortField(env, lpObject, lpCache->hisize);
- lpStruct->flags = (*env)->GetShortField(env, lpObject, lpCache->flags);
-}
-
-void setFontDetailsFields(JNIEnv *env, jobject lpObject, FontDetails *lpStruct, PFontDetails_FID_CACHE lpCache)
-{
- jbyteArray desc, stem = (*env)->GetObjectField(env, lpObject, lpCache->stem);
- if (stem) {
- jbyte *stem1 = (*env)->GetByteArrayElements(env, stem, NULL);
- memcpy(stem1, lpStruct->stem, MAX_FONT_TAG);
- (*env)->ReleaseByteArrayElements(env, stem, stem1, 0);
- }
- desc = (*env)->GetObjectField(env, lpObject, lpCache->desc);
- if (desc) {
- jbyte *desc1 = (*env)->GetByteArrayElements(env, desc, NULL);
- memcpy(desc1, lpStruct->desc, MAX_DESC_LENGTH);
- (*env)->ReleaseByteArrayElements(env, desc, desc1, 0);
- }
- (*env)->SetShortField(env, lpObject, lpCache->losize, lpStruct->losize);
- (*env)->SetShortField(env, lpObject, lpCache->hisize, lpStruct->hisize);
- (*env)->SetShortField(env, lpObject, lpCache->flags, lpStruct->flags);
-}
-
-void cachePhArea_tFids(JNIEnv *env, jobject lpObject, PPhArea_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->size_w = (*env)->GetFieldID(env, lpCache->clazz, "size_w", "S");
- lpCache->size_h = (*env)->GetFieldID(env, lpCache->clazz, "size_h", "S");
- lpCache->cached = 1;
-}
-
-void getPhArea_tFields(JNIEnv *env, jobject lpObject, PhArea_t *lpStruct, PPhArea_t_FID_CACHE lpCache)
-{
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->size.w = (*env)->GetShortField(env, lpObject, lpCache->size_w);
- lpStruct->size.h = (*env)->GetShortField(env, lpObject, lpCache->size_h);
-}
-
-void setPhArea_tFields(JNIEnv *env, jobject lpObject, PhArea_t *lpStruct, PPhArea_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetShortField(env, lpObject, lpCache->size_w, lpStruct->size.w);
- (*env)->SetShortField(env, lpObject, lpCache->size_h, lpStruct->size.h);
-}
-
-void cachePtFileSelectionInfo_tFids(JNIEnv *env, jobject lpObject, PPtFileSelectionInfo_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->ret = (*env)->GetFieldID(env, lpCache->clazz, "ret", "S");
- lpCache->path = (*env)->GetFieldID(env, lpCache->clazz, "path", "[B");
- lpCache->dim = (*env)->GetFieldID(env, lpCache->clazz, "dim", "Lorg/eclipse/swt/internal/photon/PhDim_t;");
- lpCache->pos = (*env)->GetFieldID(env, lpCache->clazz, "pos", "Lorg/eclipse/swt/internal/photon/PhPoint_t;");
- lpCache->format = (*env)->GetFieldID(env, lpCache->clazz, "format", "[B");
- lpCache->fspec = (*env)->GetFieldID(env, lpCache->clazz, "fspec", "[B");
- lpCache->user_data = (*env)->GetFieldID(env, lpCache->clazz, "user_data", "I");
- lpCache->confirm_display = (*env)->GetFieldID(env, lpCache->clazz, "confirm_display", "I");
- lpCache->confirm_selection = (*env)->GetFieldID(env, lpCache->clazz, "confirm_selection", "I");
- lpCache->new_directory = (*env)->GetFieldID(env, lpCache->clazz, "new_directory", "I");
- lpCache->btn1 = (*env)->GetFieldID(env, lpCache->clazz, "btn1", "I");
- lpCache->btn2 = (*env)->GetFieldID(env, lpCache->clazz, "btn2", "I");
- lpCache->num_args = (*env)->GetFieldID(env, lpCache->clazz, "num_args", "I");
- lpCache->args = (*env)->GetFieldID(env, lpCache->clazz, "args", "I");
- lpCache->spare = (*env)->GetFieldID(env, lpCache->clazz, "spare", "[I");
- lpCache->cached = 1;
-}
-
-void getPtFileSelectionInfo_tFields(JNIEnv *env, jobject lpObject, PtFileSelectionInfo_t *lpStruct, PPtFileSelectionInfo_t_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
-
- lpStruct->ret = (*env)->GetShortField(env, lpObject, lpCache->ret);
- {
- jbyteArray path = (*env)->GetObjectField(env, lpObject, lpCache->path);
- if (path) {
- jbyte *path1 = (*env)->GetByteArrayElements(env, path, NULL);
- memcpy(lpStruct->path, path1, sizeof (lpStruct->path));
- (*env)->ReleaseByteArrayElements(env, path, path1, 0);
- }
- }
- {
- jobject dim = (*env)->GetObjectField(env, lpObject, lpCache->dim);
- if (dim) {
- cachePhDim_tFids(env, dim, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, dim, &lpStruct->dim, &PGLOB(PhDim_tFc));
- }
- }
- {
- jobject pos = (*env)->GetObjectField(env, lpObject, lpCache->pos);
- if (pos) {
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, &lpStruct->pos, &PGLOB(PhPoint_tFc));
- }
- }
- {
- jbyteArray format = (*env)->GetObjectField(env, lpObject, lpCache->format);
- if (format) {
- jbyte *format1 = (*env)->GetByteArrayElements(env, format, NULL);
- memcpy(lpStruct->format, format1, sizeof (lpStruct->format));
- (*env)->ReleaseByteArrayElements(env, format, format1, 0);
- }
- }
- {
- jbyteArray fspec = (*env)->GetObjectField(env, lpObject, lpCache->fspec);
- if (fspec) {
- jbyte *fspec1 = (*env)->GetByteArrayElements(env, fspec, NULL);
- memcpy(lpStruct->fspec, fspec1, sizeof (lpStruct->fspec));
- (*env)->ReleaseByteArrayElements(env, fspec, fspec1, 0);
- }
- }
- lpStruct->user_data = (void *) (*env)->GetIntField(env, lpObject, lpCache->user_data);
- lpStruct->confirm_display = (void *) (*env)->GetIntField(env, lpObject, lpCache->confirm_display);
- lpStruct->confirm_selection = (void *) (*env)->GetIntField(env, lpObject, lpCache->confirm_selection);
- lpStruct->new_directory = (void *) (*env)->GetIntField(env, lpObject, lpCache->new_directory);
- lpStruct->btn1 = (char *) (*env)->GetIntField(env, lpObject, lpCache->btn1);
- lpStruct->btn2 = (char *) (*env)->GetIntField(env, lpObject, lpCache->btn2);
- lpStruct->num_args = (*env)->GetIntField(env, lpObject, lpCache->num_args);
- lpStruct->args = (void *)(*env)->GetIntField(env, lpObject, lpCache->args);
- {
- jintArray spare = (*env)->GetObjectField(env, lpObject, lpCache->spare);
- if (spare) {
- jint *spare1 = (*env)->GetIntArrayElements(env, spare, NULL);
- memcpy(lpStruct->spare, spare1, sizeof (lpStruct->spare));
- (*env)->ReleaseIntArrayElements(env, spare, spare1, 0);
- }
- }
-}
-
-void setPtFileSelectionInfo_tFields(JNIEnv *env, jobject lpObject, PtFileSelectionInfo_t *lpStruct, PPtFileSelectionInfo_t_FID_CACHE lpCache)
-{
- DECL_GLOB(pGlob)
-
- (*env)->SetShortField(env, lpObject, lpCache->ret, lpStruct->ret);
- {
- jbyteArray path = (*env)->GetObjectField(env, lpObject, lpCache->path);
- if (path) {
- jbyte *path1 = (*env)->GetByteArrayElements(env, path, NULL);
- memcpy(path1, lpStruct->path, sizeof (lpStruct->path));
- (*env)->ReleaseByteArrayElements(env, path, path1, 0);
- }
- }
- {
- jobject dim = (*env)->GetObjectField(env, lpObject, lpCache->dim);
- if (dim) {
- cachePhDim_tFids(env, dim, &PGLOB(PhDim_tFc));
- setPhDim_tFields(env, dim, &lpStruct->dim, &PGLOB(PhDim_tFc));
- }
- }
- {
- jobject pos = (*env)->GetObjectField(env, lpObject, lpCache->pos);
- if (pos) {
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- setPhPoint_tFields(env, pos, &lpStruct->pos, &PGLOB(PhPoint_tFc));
- }
- }
- {
- jbyteArray format = (*env)->GetObjectField(env, lpObject, lpCache->format);
- if (format) {
- jbyte *format1 = (*env)->GetByteArrayElements(env, format, NULL);
- memcpy(format1, lpStruct->format, sizeof (lpStruct->format));
- (*env)->ReleaseByteArrayElements(env, format, format1, 0);
- }
- }
- {
- jbyteArray fspec = (*env)->GetObjectField(env, lpObject, lpCache->fspec);
- if (fspec) {
- jbyte *fspec1 = (*env)->GetByteArrayElements(env, fspec, NULL);
- memcpy(fspec1, lpStruct->fspec, sizeof (lpStruct->fspec));
- (*env)->ReleaseByteArrayElements(env, fspec, fspec1, 0);
- }
- }
- (*env)->SetIntField(env, lpObject, lpCache->user_data, (int) lpStruct->user_data);
- (*env)->SetIntField(env, lpObject, lpCache->confirm_display, (int) lpStruct->confirm_display);
- (*env)->SetIntField(env, lpObject, lpCache->confirm_selection, (int) lpStruct->confirm_selection);
- (*env)->SetIntField(env, lpObject, lpCache->new_directory, (int) lpStruct->new_directory);
- (*env)->SetIntField(env, lpObject, lpCache->btn1, (int) lpStruct->btn1);
- (*env)->SetIntField(env, lpObject, lpCache->btn2, (int) lpStruct->btn2);
- (*env)->SetIntField(env, lpObject, lpCache->num_args, lpStruct->num_args);
- (*env)->SetIntField(env, lpObject, lpCache->args, (int) lpStruct->args);
- {
- jintArray spare = (*env)->GetObjectField(env, lpObject, lpCache->spare);
- if (spare) {
- jint *spare1 = (*env)->GetIntArrayElements(env, spare, NULL);
- memcpy(spare1, lpStruct->spare, sizeof (lpStruct->spare));
- (*env)->ReleaseIntArrayElements(env, spare, spare1, 0);
- }
- }
-}
-
-void cachePgAlpha_tFids(JNIEnv *env, jobject lpObject, PPgAlpha_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->alpha_op = (*env)->GetFieldID(env, lpCache->clazz, "alpha_op", "I");
- lpCache->src_alpha_map_dim_w = (*env)->GetFieldID(env, lpCache->clazz, "src_alpha_map_dim_w", "S");
- lpCache->src_alpha_map_dim_h = (*env)->GetFieldID(env, lpCache->clazz, "src_alpha_map_dim_h", "S");
- lpCache->src_alpha_map_bpl = (*env)->GetFieldID(env, lpCache->clazz, "src_alpha_map_bpl", "S");
- lpCache->src_alpha_map_bpp = (*env)->GetFieldID(env, lpCache->clazz, "src_alpha_map_bpp", "S");
- lpCache->src_alpha_map_map = (*env)->GetFieldID(env, lpCache->clazz, "src_alpha_map_map", "I");
- lpCache->src_global_alpha = (*env)->GetFieldID(env, lpCache->clazz, "src_global_alpha", "B");
- lpCache->dest_global_alpha = (*env)->GetFieldID(env, lpCache->clazz, "dest_global_alpha", "B");
- lpCache->cached = 1;
-}
-
-void getPgAlpha_tFields(JNIEnv *env, jobject lpObject, PgAlpha_t *lpStruct, PPgAlpha_t_FID_CACHE lpCache)
-{
- lpStruct->alpha_op = (*env)->GetIntField(env, lpObject, lpCache->alpha_op);
- lpStruct->src_alpha_map.dim.w = (*env)->GetShortField(env, lpObject, lpCache->src_alpha_map_dim_w);
- lpStruct->src_alpha_map.dim.h = (*env)->GetShortField(env, lpObject, lpCache->src_alpha_map_dim_h);
- lpStruct->src_alpha_map.bpl = (*env)->GetShortField(env, lpObject, lpCache->src_alpha_map_bpl);
- lpStruct->src_alpha_map.bpp = (*env)->GetShortField(env, lpObject, lpCache->src_alpha_map_bpp);
- lpStruct->src_alpha_map.map = (char *)(*env)->GetIntField(env, lpObject, lpCache->src_alpha_map_map);
- lpStruct->src_global_alpha = (*env)->GetByteField(env, lpObject, lpCache->src_global_alpha);
- lpStruct->dest_global_alpha = (*env)->GetByteField(env, lpObject, lpCache->dest_global_alpha);
-}
-
-void setPgAlpha_tFields(JNIEnv *env, jobject lpObject, PgAlpha_t *lpStruct, PPgAlpha_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->alpha_op, lpStruct->alpha_op);
- (*env)->SetShortField(env, lpObject, lpCache->src_alpha_map_dim_w, lpStruct->src_alpha_map.dim.w);
- (*env)->SetShortField(env, lpObject, lpCache->src_alpha_map_dim_h, lpStruct->src_alpha_map.dim.h);
- (*env)->SetShortField(env, lpObject, lpCache->src_alpha_map_bpl, lpStruct->src_alpha_map.bpl);
- (*env)->SetShortField(env, lpObject, lpCache->src_alpha_map_bpp, lpStruct->src_alpha_map.bpp);
- (*env)->SetIntField(env, lpObject, lpCache->src_alpha_map_map, (jint)lpStruct->src_alpha_map.map);
- (*env)->SetByteField(env, lpObject, lpCache->src_global_alpha, lpStruct->src_global_alpha);
- (*env)->SetByteField(env, lpObject, lpCache->dest_global_alpha, lpStruct->dest_global_alpha);
-}
-
-void cachePtTextCallback_tFids(JNIEnv *env, jobject lpObject, PPtTextCallback_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->start_pos = (*env)->GetFieldID(env, lpCache->clazz, "start_pos", "I");
- lpCache->end_pos = (*env)->GetFieldID(env, lpCache->clazz, "end_pos", "I");
- lpCache->cur_insert = (*env)->GetFieldID(env, lpCache->clazz, "cur_insert", "I");
- lpCache->new_insert = (*env)->GetFieldID(env, lpCache->clazz, "new_insert", "I");
- lpCache->length = (*env)->GetFieldID(env, lpCache->clazz, "length", "I");
- lpCache->reserved = (*env)->GetFieldID(env, lpCache->clazz, "reserved", "S");
- lpCache->text = (*env)->GetFieldID(env, lpCache->clazz, "text", "I");
- lpCache->doit = (*env)->GetFieldID(env, lpCache->clazz, "doit", "I");
- lpCache->cached = 1;
-}
-
-void getPtTextCallback_tFields(JNIEnv *env, jobject lpObject, PtTextCallback_t *lpStruct, PPtTextCallback_t_FID_CACHE lpCache)
-{
- lpStruct->start_pos = (*env)->GetIntField(env, lpObject, lpCache->start_pos);
- lpStruct->end_pos = (*env)->GetIntField(env, lpObject, lpCache->end_pos);
- lpStruct->cur_insert = (*env)->GetIntField(env, lpObject, lpCache->cur_insert);
- lpStruct->new_insert = (*env)->GetIntField(env, lpObject, lpCache->new_insert);
- lpStruct->length = (*env)->GetIntField(env, lpObject, lpCache->length);
- lpStruct->reserved = (*env)->GetShortField(env, lpObject, lpCache->reserved);
- lpStruct->text = (char *)(*env)->GetIntField(env, lpObject, lpCache->text);
- lpStruct->doit = (*env)->GetIntField(env, lpObject, lpCache->doit);
-}
-
-void setPtTextCallback_tFields(JNIEnv *env, jobject lpObject, PtTextCallback_t *lpStruct, PPtTextCallback_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->start_pos, lpStruct->start_pos);
- (*env)->SetIntField(env, lpObject, lpCache->end_pos, lpStruct->end_pos);
- (*env)->SetIntField(env, lpObject, lpCache->cur_insert, lpStruct->cur_insert);
- (*env)->SetIntField(env, lpObject, lpCache->new_insert, lpStruct->new_insert);
- (*env)->SetIntField(env, lpObject, lpCache->length, lpStruct->length);
- (*env)->SetShortField(env, lpObject, lpCache->reserved, lpStruct->reserved);
- (*env)->SetIntField(env, lpObject, lpCache->text, (jint)lpStruct->text);
- (*env)->SetIntField(env, lpObject, lpCache->doit, lpStruct->doit);
-}
-void cachePtTreeItem_tFids(JNIEnv *env, jobject lpObject, PPtTreeItem_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->list_flags = (*env)->GetFieldID(env, lpCache->clazz, "list_flags", "I");
- lpCache->list_size_w = (*env)->GetFieldID(env, lpCache->clazz, "list_size_w", "S");
- lpCache->list_size_h = (*env)->GetFieldID(env, lpCache->clazz, "list_size_h", "S");
- lpCache->list_next = (*env)->GetFieldID(env, lpCache->clazz, "list_next", "I");
- lpCache->list_prev = (*env)->GetFieldID(env, lpCache->clazz, "list_prev", "I");
- lpCache->father = (*env)->GetFieldID(env, lpCache->clazz, "father", "I");
- lpCache->son = (*env)->GetFieldID(env, lpCache->clazz, "son", "I");
- lpCache->brother = (*env)->GetFieldID(env, lpCache->clazz, "brother", "I");
- lpCache->dim_w = (*env)->GetFieldID(env, lpCache->clazz, "dim_w", "S");
- lpCache->dim_h = (*env)->GetFieldID(env, lpCache->clazz, "dim_h", "S");
- lpCache->img_set = (*env)->GetFieldID(env, lpCache->clazz, "img_set", "S");
- lpCache->img_unset = (*env)->GetFieldID(env, lpCache->clazz, "img_unset", "S");
- lpCache->data = (*env)->GetFieldID(env, lpCache->clazz, "data", "I");
- lpCache->cached = 1;
-}
-
-void getPtTreeItem_tFields(JNIEnv *env, jobject lpObject, PtTreeItem_t *lpStruct, PPtTreeItem_t_FID_CACHE lpCache)
-{
- lpStruct->gen.list.flags = (*env)->GetIntField(env, lpObject, lpCache->list_flags);
- lpStruct->gen.list.size.w = (*env)->GetShortField(env, lpObject, lpCache->list_size_w);
- lpStruct->gen.list.size.h = (*env)->GetShortField(env, lpObject, lpCache->list_size_h);
- lpStruct->gen.list.next = (void *) (*env)->GetIntField(env, lpObject, lpCache->list_next);
- lpStruct->gen.list.prev = (void *) (*env)->GetIntField(env, lpObject, lpCache->list_prev);
- lpStruct->gen.father = (void *) (*env)->GetIntField(env, lpObject, lpCache->father);
- lpStruct->gen.son = (void *) (*env)->GetIntField(env, lpObject, lpCache->son);
- lpStruct->gen.brother = (void *) (*env)->GetIntField(env, lpObject, lpCache->brother);
- lpStruct->gen.dim.w = (*env)->GetShortField(env, lpObject, lpCache->dim_w);
- lpStruct->gen.dim.h = (*env)->GetShortField(env, lpObject, lpCache->dim_h);
- lpStruct->attr.img.set = (*env)->GetShortField(env, lpObject, lpCache->img_set);
- lpStruct->attr.img.unset = (*env)->GetShortField(env, lpObject, lpCache->img_unset);
- lpStruct->data = (void *)(*env)->GetIntField(env, lpObject, lpCache->data);
-}
-
-void setPtTreeItem_tFields(JNIEnv *env, jobject lpObject, PtTreeItem_t *lpStruct, PPtTreeItem_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->list_flags, lpStruct->gen.list.flags);
- (*env)->SetShortField(env, lpObject, lpCache->list_size_w, lpStruct->gen.list.size.w);
- (*env)->SetShortField(env, lpObject, lpCache->list_size_h, lpStruct->gen.list.size.h);
- (*env)->SetIntField(env, lpObject, lpCache->list_next, (int) lpStruct->gen.list.next);
- (*env)->SetIntField(env, lpObject, lpCache->list_prev, (int) lpStruct->gen.list.prev);
- (*env)->SetIntField(env, lpObject, lpCache->father, (int) lpStruct->gen.father);
- (*env)->SetIntField(env, lpObject, lpCache->son, (int) lpStruct->gen.son);
- (*env)->SetIntField(env, lpObject, lpCache->brother, (int) lpStruct->gen.brother);
- (*env)->SetShortField(env, lpObject, lpCache->dim_w, lpStruct->gen.dim.w);
- (*env)->SetShortField(env, lpObject, lpCache->dim_h, lpStruct->gen.dim.h);
- (*env)->SetShortField(env, lpObject, lpCache->img_set, lpStruct->attr.img.set);
- (*env)->SetShortField(env, lpObject, lpCache->img_unset, lpStruct->attr.img.unset);
- (*env)->SetIntField(env, lpObject, lpCache->data, (int) lpStruct->data);
-}
-
-void cachePgMap_tFids(JNIEnv *env, jobject lpObject, PPgMap_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dim_w = (*env)->GetFieldID(env, lpCache->clazz, "dim_w", "S");
- lpCache->dim_h = (*env)->GetFieldID(env, lpCache->clazz, "dim_h", "S");
- lpCache->bpl = (*env)->GetFieldID(env, lpCache->clazz, "bpl", "S");
- lpCache->bpp = (*env)->GetFieldID(env, lpCache->clazz, "bpp", "S");
- lpCache->map = (*env)->GetFieldID(env, lpCache->clazz, "map", "I");
- lpCache->cached = 1;
-}
-
-void getPgMap_tFields(JNIEnv *env, jobject lpObject, PgMap_t *lpStruct, PPgMap_t_FID_CACHE lpCache)
-{
- lpStruct->dim.w = (*env)->GetShortField(env, lpObject, lpCache->dim_w);
- lpStruct->dim.h = (*env)->GetShortField(env, lpObject, lpCache->dim_h);
- lpStruct->bpl = (*env)->GetShortField(env, lpObject, lpCache->bpl);
- lpStruct->bpp = (*env)->GetShortField(env, lpObject, lpCache->bpp);
- lpStruct->map = (char *)(*env)->GetIntField(env, lpObject, lpCache->map);
-}
-
-void setPgMap_tFields(JNIEnv *env, jobject lpObject, PgMap_t *lpStruct, PPgMap_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->dim_w, lpStruct->dim.w);
- (*env)->SetShortField(env, lpObject, lpCache->dim_h, lpStruct->dim.h);
- (*env)->SetShortField(env, lpObject, lpCache->bpl, lpStruct->bpl);
- (*env)->SetShortField(env, lpObject, lpCache->bpp, lpStruct->bpp);
- (*env)->SetIntField(env, lpObject, lpCache->map, (jint)lpStruct->map);
-}
-
-void cachePtColorSelectInfo_tFids(JNIEnv *env, jobject lpObject, PPtColorSelectInfo_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "S");
- lpCache->nselectors = (*env)->GetFieldID(env, lpCache->clazz, "nselectors", "B");
- lpCache->ncolor_models = (*env)->GetFieldID(env, lpCache->clazz, "ncolor_models", "B");
- lpCache->color_models = (*env)->GetFieldID(env, lpCache->clazz, "color_models", "I");
- lpCache->selectors = (*env)->GetFieldID(env, lpCache->clazz, "selectors", "I");
- lpCache->pos_x = (*env)->GetFieldID(env, lpCache->clazz, "pos_x", "S");
- lpCache->pos_y = (*env)->GetFieldID(env, lpCache->clazz, "pos_y", "S");
- lpCache->size_w = (*env)->GetFieldID(env, lpCache->clazz, "size_w", "S");
- lpCache->size_h = (*env)->GetFieldID(env, lpCache->clazz, "size_h", "S");
- lpCache->palette = (*env)->GetFieldID(env, lpCache->clazz, "palette", "I");
- lpCache->accept_text = (*env)->GetFieldID(env, lpCache->clazz, "accept_text", "I");
- lpCache->dismiss_text = (*env)->GetFieldID(env, lpCache->clazz, "dismiss_text", "I");
- lpCache->accept_dismiss_text = (*env)->GetFieldID(env, lpCache->clazz, "accept_dismiss_text", "I");
- lpCache->apply_f = (*env)->GetFieldID(env, lpCache->clazz, "apply_f", "I");
- lpCache->data = (*env)->GetFieldID(env, lpCache->clazz, "data", "I");
- lpCache->rgb = (*env)->GetFieldID(env, lpCache->clazz, "rgb", "I");
- lpCache->dialog = (*env)->GetFieldID(env, lpCache->clazz, "dialog", "I");
- lpCache->cached = 1;
-}
-
-void getPtColorSelectInfo_tFields(JNIEnv *env, jobject lpObject, PtColorSelectInfo_t *lpStruct, PPtColorSelectInfo_t_FID_CACHE lpCache)
-{
- lpStruct->flags = (*env)->GetShortField(env, lpObject, lpCache->flags);
- lpStruct->nselectors = (*env)->GetByteField(env, lpObject, lpCache->nselectors);
- lpStruct->ncolor_models = (*env)->GetByteField(env, lpObject, lpCache->ncolor_models);
- lpStruct->color_models = (PgColorModel_t **)(*env)->GetIntField(env, lpObject, lpCache->color_models);
- lpStruct->selectors = (PtColorSelectorSpec_t *)(*env)->GetIntField(env, lpObject, lpCache->selectors);
- lpStruct->pos.x = (*env)->GetShortField(env, lpObject, lpCache->pos_x);
- lpStruct->pos.y = (*env)->GetShortField(env, lpObject, lpCache->pos_y);
- lpStruct->size.w = (*env)->GetShortField(env, lpObject, lpCache->size_w);
- lpStruct->size.h = (*env)->GetShortField(env, lpObject, lpCache->size_h);
- lpStruct->palette.instance = (void *)(*env)->GetIntField(env, lpObject, lpCache->palette);
- lpStruct->accept_text = (char *)(*env)->GetIntField(env, lpObject, lpCache->accept_text);
- lpStruct->dismiss_text = (char *)(*env)->GetIntField(env, lpObject, lpCache->dismiss_text);
- lpStruct->accept_dismiss_text = (char *)(*env)->GetIntField(env, lpObject, lpCache->accept_dismiss_text);
- lpStruct->apply_f = (void (*))(*env)->GetIntField(env, lpObject, lpCache->apply_f);
- lpStruct->data = (void *)(*env)->GetIntField(env, lpObject, lpCache->data);
- lpStruct->rgb = (*env)->GetIntField(env, lpObject, lpCache->rgb);
- lpStruct->dialog = (PtWidget_t *)(*env)->GetIntField(env, lpObject, lpCache->dialog);
-}
-
-void setPtColorSelectInfo_tFields(JNIEnv *env, jobject lpObject, PtColorSelectInfo_t *lpStruct, PPtColorSelectInfo_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetByteField(env, lpObject, lpCache->nselectors, lpStruct->nselectors);
- (*env)->SetByteField(env, lpObject, lpCache->ncolor_models, lpStruct->ncolor_models);
- (*env)->SetIntField(env, lpObject, lpCache->color_models, (jint)lpStruct->color_models);
- (*env)->SetIntField(env, lpObject, lpCache->selectors, (jint)lpStruct->selectors);
- (*env)->SetShortField(env, lpObject, lpCache->pos_x, lpStruct->pos.x);
- (*env)->SetShortField(env, lpObject, lpCache->pos_y, lpStruct->pos.y);
- (*env)->SetShortField(env, lpObject, lpCache->size_w, lpStruct->size.w);
- (*env)->SetShortField(env, lpObject, lpCache->size_h, lpStruct->size.h);
- (*env)->SetIntField(env, lpObject, lpCache->palette, (jint)lpStruct->palette.instance);
- (*env)->SetIntField(env, lpObject, lpCache->accept_text, (jint)lpStruct->accept_text);
- (*env)->SetIntField(env, lpObject, lpCache->dismiss_text, (jint)lpStruct->dismiss_text);
- (*env)->SetIntField(env, lpObject, lpCache->accept_dismiss_text, (jint)lpStruct->accept_dismiss_text);
- (*env)->SetIntField(env, lpObject, lpCache->apply_f, (jint)lpStruct->apply_f);
- (*env)->SetIntField(env, lpObject, lpCache->data, (jint)lpStruct->data);
- (*env)->SetIntField(env, lpObject, lpCache->rgb, lpStruct->rgb);
- (*env)->SetIntField(env, lpObject, lpCache->dialog, (jint)lpStruct->dialog);
-}
-
-void cachePhRegion_tFids(JNIEnv *env, jobject lpObject, PPhRegion_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->rid = (*env)->GetFieldID(env, lpCache->clazz, "rid", "I");
- lpCache->handle = (*env)->GetFieldID(env, lpCache->clazz, "handle", "I");
- lpCache->owner = (*env)->GetFieldID(env, lpCache->clazz, "owner", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->clazz, "state", "S");
- lpCache->events_sense = (*env)->GetFieldID(env, lpCache->clazz, "events_sense", "I");
- lpCache->events_opaque = (*env)->GetFieldID(env, lpCache->clazz, "events_opaque", "I");
- lpCache->origin_x = (*env)->GetFieldID(env, lpCache->clazz, "origin_x", "S");
- lpCache->origin_y = (*env)->GetFieldID(env, lpCache->clazz, "origin_y", "S");
- lpCache->parent = (*env)->GetFieldID(env, lpCache->clazz, "parent", "I");
- lpCache->child = (*env)->GetFieldID(env, lpCache->clazz, "child", "I");
- lpCache->bro_in_front = (*env)->GetFieldID(env, lpCache->clazz, "bro_in_front", "I");
- lpCache->bro_behind = (*env)->GetFieldID(env, lpCache->clazz, "bro_behind", "I");
- lpCache->cursor_color = (*env)->GetFieldID(env, lpCache->clazz, "cursor_color", "I");
- lpCache->input_group = (*env)->GetFieldID(env, lpCache->clazz, "input_group", "S");
- lpCache->data_len = (*env)->GetFieldID(env, lpCache->clazz, "data_len", "S");
- lpCache->cursor_type = (*env)->GetFieldID(env, lpCache->clazz, "cursor_type", "S");
- lpCache->cached = 1;
-}
-
-void getPhRegion_tFields(JNIEnv *env, jobject lpObject, PhRegion_t *lpStruct, PPhRegion_t_FID_CACHE lpCache)
-{
- lpStruct->rid = (*env)->GetIntField(env, lpObject, lpCache->rid);
- lpStruct->handle = (*env)->GetIntField(env, lpObject, lpCache->handle);
- lpStruct->owner = (*env)->GetIntField(env, lpObject, lpCache->owner);
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- lpStruct->state = (*env)->GetShortField(env, lpObject, lpCache->state);
- lpStruct->events_sense = (*env)->GetIntField(env, lpObject, lpCache->events_sense);
- lpStruct->events_opaque = (*env)->GetIntField(env, lpObject, lpCache->events_opaque);
- lpStruct->origin.x = (*env)->GetShortField(env, lpObject, lpCache->origin_x);
- lpStruct->origin.y = (*env)->GetShortField(env, lpObject, lpCache->origin_y);
- lpStruct->parent = (*env)->GetIntField(env, lpObject, lpCache->parent);
- lpStruct->child = (*env)->GetIntField(env, lpObject, lpCache->child);
- lpStruct->bro_in_front = (*env)->GetIntField(env, lpObject, lpCache->bro_in_front);
- lpStruct->bro_behind = (*env)->GetIntField(env, lpObject, lpCache->bro_behind);
- lpStruct->cursor_color = (*env)->GetIntField(env, lpObject, lpCache->cursor_color);
- lpStruct->input_group = (*env)->GetShortField(env, lpObject, lpCache->input_group);
- lpStruct->data_len = (*env)->GetShortField(env, lpObject, lpCache->data_len);
- lpStruct->cursor_type = (*env)->GetShortField(env, lpObject, lpCache->cursor_type);
-}
-
-void setPhRegion_tFields(JNIEnv *env, jobject lpObject, PhRegion_t *lpStruct, PPhRegion_t_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->rid, lpStruct->rid);
- (*env)->SetIntField(env, lpObject, lpCache->handle, lpStruct->handle);
- (*env)->SetIntField(env, lpObject, lpCache->owner, lpStruct->owner);
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetShortField(env, lpObject, lpCache->state, lpStruct->state);
- (*env)->SetIntField(env, lpObject, lpCache->events_sense, lpStruct->events_sense);
- (*env)->SetIntField(env, lpObject, lpCache->events_opaque, lpStruct->events_opaque);
- (*env)->SetShortField(env, lpObject, lpCache->origin_x, lpStruct->origin.x);
- (*env)->SetShortField(env, lpObject, lpCache->origin_y, lpStruct->origin.y);
- (*env)->SetIntField(env, lpObject, lpCache->parent, lpStruct->parent);
- (*env)->SetIntField(env, lpObject, lpCache->child, lpStruct->child);
- (*env)->SetIntField(env, lpObject, lpCache->bro_in_front, lpStruct->bro_in_front);
- (*env)->SetIntField(env, lpObject, lpCache->bro_behind, lpStruct->bro_behind);
- (*env)->SetIntField(env, lpObject, lpCache->cursor_color, lpStruct->cursor_color);
- (*env)->SetShortField(env, lpObject, lpCache->input_group, lpStruct->input_group);
- (*env)->SetShortField(env, lpObject, lpCache->data_len, lpStruct->data_len);
- (*env)->SetShortField(env, lpObject, lpCache->cursor_type, lpStruct->cursor_type);
-}
-
-void cachePtContainerCallback_tFids(JNIEnv *env, jobject lpObject, PPtContainerCallback_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->new_size_ul_x = (*env)->GetFieldID(env, lpCache->clazz, "new_size_ul_x", "S");
- lpCache->new_size_ul_y = (*env)->GetFieldID(env, lpCache->clazz, "new_size_ul_y", "S");
- lpCache->new_size_lr_x = (*env)->GetFieldID(env, lpCache->clazz, "new_size_lr_x", "S");
- lpCache->new_size_lr_y = (*env)->GetFieldID(env, lpCache->clazz, "new_size_lr_y", "S");
- lpCache->old_size_ul_x = (*env)->GetFieldID(env, lpCache->clazz, "old_size_ul_x", "S");
- lpCache->old_size_ul_y = (*env)->GetFieldID(env, lpCache->clazz, "old_size_ul_y", "S");
- lpCache->old_size_lr_x = (*env)->GetFieldID(env, lpCache->clazz, "old_size_lr_x", "S");
- lpCache->old_size_lr_y = (*env)->GetFieldID(env, lpCache->clazz, "old_size_lr_y", "S");
- lpCache->new_dim_w = (*env)->GetFieldID(env, lpCache->clazz, "new_dim_w", "S");
- lpCache->new_dim_h = (*env)->GetFieldID(env, lpCache->clazz, "new_dim_h", "S");
- lpCache->old_dim_w = (*env)->GetFieldID(env, lpCache->clazz, "old_dim_w", "S");
- lpCache->old_dim_h = (*env)->GetFieldID(env, lpCache->clazz, "old_dim_h", "S");
- lpCache->cached = 1;
-}
-
-void getPtContainerCallback_tFields(JNIEnv *env, jobject lpObject, PtContainerCallback_t *lpStruct, PPtContainerCallback_t_FID_CACHE lpCache)
-{
- lpStruct->new_size.ul.x = (*env)->GetShortField(env, lpObject, lpCache->new_size_ul_x);
- lpStruct->new_size.ul.y = (*env)->GetShortField(env, lpObject, lpCache->new_size_ul_y);
- lpStruct->new_size.lr.x = (*env)->GetShortField(env, lpObject, lpCache->new_size_lr_x);
- lpStruct->new_size.lr.y = (*env)->GetShortField(env, lpObject, lpCache->new_size_lr_y);
- lpStruct->old_size.ul.x = (*env)->GetShortField(env, lpObject, lpCache->old_size_ul_x);
- lpStruct->old_size.ul.y = (*env)->GetShortField(env, lpObject, lpCache->old_size_ul_y);
- lpStruct->old_size.lr.x = (*env)->GetShortField(env, lpObject, lpCache->old_size_lr_x);
- lpStruct->old_size.lr.y = (*env)->GetShortField(env, lpObject, lpCache->old_size_lr_y);
- lpStruct->new_dim.w = (*env)->GetShortField(env, lpObject, lpCache->new_dim_w);
- lpStruct->new_dim.h = (*env)->GetShortField(env, lpObject, lpCache->new_dim_h);
- lpStruct->old_dim.w = (*env)->GetShortField(env, lpObject, lpCache->old_dim_w);
- lpStruct->old_dim.h = (*env)->GetShortField(env, lpObject, lpCache->old_dim_h);
-}
-
-void setPtContainerCallback_tFields(JNIEnv *env, jobject lpObject, PtContainerCallback_t *lpStruct, PPtContainerCallback_t_FID_CACHE lpCache)
-{
- (*env)->SetShortField(env, lpObject, lpCache->new_size_ul_x, lpStruct->new_size.ul.x);
- (*env)->SetShortField(env, lpObject, lpCache->new_size_ul_y, lpStruct->new_size.ul.y);
- (*env)->SetShortField(env, lpObject, lpCache->new_size_lr_x, lpStruct->new_size.lr.x);
- (*env)->SetShortField(env, lpObject, lpCache->new_size_lr_y, lpStruct->new_size.lr.y);
- (*env)->SetShortField(env, lpObject, lpCache->old_size_ul_x, lpStruct->old_size.ul.x);
- (*env)->SetShortField(env, lpObject, lpCache->old_size_ul_y, lpStruct->old_size.ul.y);
- (*env)->SetShortField(env, lpObject, lpCache->old_size_lr_x, lpStruct->old_size.lr.x);
- (*env)->SetShortField(env, lpObject, lpCache->old_size_lr_y, lpStruct->old_size.lr.y);
- (*env)->SetShortField(env, lpObject, lpCache->new_dim_w, lpStruct->new_dim.w);
- (*env)->SetShortField(env, lpObject, lpCache->new_dim_h, lpStruct->new_dim.h);
- (*env)->SetShortField(env, lpObject, lpCache->old_dim_w, lpStruct->old_dim.w);
- (*env)->SetShortField(env, lpObject, lpCache->old_dim_h, lpStruct->old_dim.h);
-}
-
-void cachePhCursorDef_tFids(JNIEnv *env, jobject lpObject, PPhCursorDef_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->bytesperline2 = (*env)->GetFieldID(env, lpCache->clazz, "bytesperline2", "B");
- lpCache->color2 = (*env)->GetFieldID(env, lpCache->clazz, "color2", "I");
- lpCache->offset2_y = (*env)->GetFieldID(env, lpCache->clazz, "offset2_y", "S");
- lpCache->offset2_x = (*env)->GetFieldID(env, lpCache->clazz, "offset2_x", "S");
- lpCache->size2_y = (*env)->GetFieldID(env, lpCache->clazz, "size2_y", "S");
- lpCache->size2_x = (*env)->GetFieldID(env, lpCache->clazz, "size2_x", "S");
- lpCache->bytesperline1 = (*env)->GetFieldID(env, lpCache->clazz, "bytesperline1", "B");
- lpCache->color1 = (*env)->GetFieldID(env, lpCache->clazz, "color1", "I");
- lpCache->offset1_y = (*env)->GetFieldID(env, lpCache->clazz, "offset1_y", "S");
- lpCache->offset1_x = (*env)->GetFieldID(env, lpCache->clazz, "offset1_x", "S");
- lpCache->size1_y = (*env)->GetFieldID(env, lpCache->clazz, "size1_y", "S");
- lpCache->size1_x = (*env)->GetFieldID(env, lpCache->clazz, "size1_x", "S");
- lpCache->hdr_type = (*env)->GetFieldID(env, lpCache->clazz, "hdr_type", "S");
- lpCache->hdr_len = (*env)->GetFieldID(env, lpCache->clazz, "hdr_len", "S");
- lpCache->cached = 1;
-}
-
-void getPhCursorDef_tFields(JNIEnv *env, jobject lpObject, PhCursorDef_t *lpStruct, PPhCursorDef_t_FID_CACHE lpCache)
-{
- lpStruct->bytesperline2 = (*env)->GetByteField(env, lpObject, lpCache->bytesperline2);
- lpStruct->color2 = (*env)->GetIntField(env, lpObject, lpCache->color2);
- lpStruct->offset2.y = (*env)->GetShortField(env, lpObject, lpCache->offset2_y);
- lpStruct->offset2.x = (*env)->GetShortField(env, lpObject, lpCache->offset2_x);
- lpStruct->size2.y = (*env)->GetShortField(env, lpObject, lpCache->size2_y);
- lpStruct->size2.x = (*env)->GetShortField(env, lpObject, lpCache->size2_x);
- lpStruct->bytesperline1 = (*env)->GetByteField(env, lpObject, lpCache->bytesperline1);
- lpStruct->color1 = (*env)->GetIntField(env, lpObject, lpCache->color1);
- lpStruct->offset1.y = (*env)->GetShortField(env, lpObject, lpCache->offset1_y);
- lpStruct->offset1.x = (*env)->GetShortField(env, lpObject, lpCache->offset1_x);
- lpStruct->size1.y = (*env)->GetShortField(env, lpObject, lpCache->size1_y);
- lpStruct->size1.x = (*env)->GetShortField(env, lpObject, lpCache->size1_x);
- lpStruct->hdr.type = (*env)->GetShortField(env, lpObject, lpCache->hdr_type);
- lpStruct->hdr.len = (*env)->GetShortField(env, lpObject, lpCache->hdr_len);
-}
-
-void setPhCursorDef_tFields(JNIEnv *env, jobject lpObject, PhCursorDef_t *lpStruct, PPhCursorDef_t_FID_CACHE lpCache)
-{
- (*env)->SetByteField(env, lpObject, lpCache->bytesperline2, lpStruct->bytesperline2);
- (*env)->SetIntField(env, lpObject, lpCache->color2, lpStruct->color2);
- (*env)->SetShortField(env, lpObject, lpCache->offset2_y, lpStruct->offset2.y);
- (*env)->SetShortField(env, lpObject, lpCache->offset2_x, lpStruct->offset2.x);
- (*env)->SetShortField(env, lpObject, lpCache->size2_y, lpStruct->size2.y);
- (*env)->SetShortField(env, lpObject, lpCache->size2_x, lpStruct->size2.x);
- (*env)->SetByteField(env, lpObject, lpCache->bytesperline1, lpStruct->bytesperline1);
- (*env)->SetIntField(env, lpObject, lpCache->color1, lpStruct->color1);
- (*env)->SetShortField(env, lpObject, lpCache->offset1_y, lpStruct->offset1.y);
- (*env)->SetShortField(env, lpObject, lpCache->offset1_x, lpStruct->offset1.x);
- (*env)->SetShortField(env, lpObject, lpCache->size1_y, lpStruct->size1.y);
- (*env)->SetShortField(env, lpObject, lpCache->size1_x, lpStruct->size1.x);
- (*env)->SetShortField(env, lpObject, lpCache->hdr_type, lpStruct->hdr.type);
- (*env)->SetShortField(env, lpObject, lpCache->hdr_len, lpStruct->hdr.len);
-}
-
-void cachePgDisplaySettings_tFids(JNIEnv *env, jobject lpObject, PPgDisplaySettings_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->reserved = (*env)->GetFieldID(env, lpCache->clazz, "reserved", "[I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->refresh = (*env)->GetFieldID(env, lpCache->clazz, "refresh", "I");
- lpCache->yres = (*env)->GetFieldID(env, lpCache->clazz, "yres", "I");
- lpCache->xres = (*env)->GetFieldID(env, lpCache->clazz, "xres", "I");
- lpCache->mode = (*env)->GetFieldID(env, lpCache->clazz, "mode", "I");
- lpCache->cached = 1;
-}
-
-void getPgDisplaySettings_tFields(JNIEnv *env, jobject lpObject, PgDisplaySettings_t *lpStruct, PPgDisplaySettings_t_FID_CACHE lpCache)
-{
- jintArray reserved = (*env)->GetObjectField(env, lpObject, lpCache->reserved);
- if (reserved) {
- jint *reserved1 = (*env)->GetIntArrayElements(env, reserved, NULL);
- memcpy(lpStruct->reserved, reserved1, sizeof (lpStruct->reserved));
- (*env)->ReleaseIntArrayElements(env, reserved, reserved1, JNI_ABORT);
- }
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- lpStruct->refresh = (*env)->GetIntField(env, lpObject, lpCache->refresh);
- lpStruct->yres = (*env)->GetIntField(env, lpObject, lpCache->yres);
- lpStruct->xres = (*env)->GetIntField(env, lpObject, lpCache->xres);
- lpStruct->mode = (*env)->GetIntField(env, lpObject, lpCache->mode);
-}
-
-void setPgDisplaySettings_tFields(JNIEnv *env, jobject lpObject, PgDisplaySettings_t *lpStruct, PPgDisplaySettings_t_FID_CACHE lpCache)
-{
- jintArray reserved = (*env)->GetObjectField(env, lpObject, lpCache->reserved);
- if (reserved) {
- jint *reserved1 = (*env)->GetIntArrayElements(env, reserved, NULL);
- memcpy(reserved1, lpStruct->reserved, sizeof (lpStruct->reserved));
- (*env)->ReleaseIntArrayElements(env, reserved, reserved1, 0);
- }
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetIntField(env, lpObject, lpCache->refresh, lpStruct->refresh);
- (*env)->SetIntField(env, lpObject, lpCache->yres, lpStruct->yres);
- (*env)->SetIntField(env, lpObject, lpCache->xres, lpStruct->xres);
- (*env)->SetIntField(env, lpObject, lpCache->mode, lpStruct->mode);
-}
-
-void cachePgVideoModeInfo_tFids(JNIEnv *env, jobject lpObject, PPgVideoModeInfo_t_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->refresh_rates = (*env)->GetFieldID(env, lpCache->clazz, "refresh_rates", "[B");
- lpCache->mode_capabilities6 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities6", "I");
- lpCache->mode_capabilities5 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities5", "I");
- lpCache->mode_capabilities4 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities4", "I");
- lpCache->mode_capabilities3 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities3", "I");
- lpCache->mode_capabilities2 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities2", "I");
- lpCache->mode_capabilities1 = (*env)->GetFieldID(env, lpCache->clazz, "mode_capabilities1", "I");
- lpCache->type = (*env)->GetFieldID(env, lpCache->clazz, "type", "I");
- lpCache->bytes_per_scanline = (*env)->GetFieldID(env, lpCache->clazz, "bytes_per_scanline", "S");
- lpCache->bits_per_pixel = (*env)->GetFieldID(env, lpCache->clazz, "bits_per_pixel", "S");
- lpCache->height = (*env)->GetFieldID(env, lpCache->clazz, "height", "S");
- lpCache->width = (*env)->GetFieldID(env, lpCache->clazz, "width", "S");
- lpCache->cached = 1;
-}
-
-void getPgVideoModeInfo_tFields(JNIEnv *env, jobject lpObject, PgVideoModeInfo_t *lpStruct, PPgVideoModeInfo_t_FID_CACHE lpCache)
-{
- jbyteArray refresh_rates = (*env)->GetObjectField(env, lpObject, lpCache->refresh_rates);
- if (refresh_rates) {
- jbyte *refresh_rates1 = (*env)->GetByteArrayElements(env, refresh_rates, NULL);
- memcpy(lpStruct->refresh_rates, refresh_rates1, sizeof(lpStruct->refresh_rates));
- (*env)->ReleaseByteArrayElements(env, refresh_rates, refresh_rates1, JNI_ABORT);
- }
- lpStruct->mode_capabilities6 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities6);
- lpStruct->mode_capabilities5 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities5);
- lpStruct->mode_capabilities4 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities4);
- lpStruct->mode_capabilities3 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities3);
- lpStruct->mode_capabilities2 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities2);
- lpStruct->mode_capabilities1 = (*env)->GetIntField(env, lpObject, lpCache->mode_capabilities1);
- lpStruct->type = (*env)->GetIntField(env, lpObject, lpCache->type);
- lpStruct->bytes_per_scanline = (*env)->GetShortField(env, lpObject, lpCache->bytes_per_scanline);
- lpStruct->bits_per_pixel = (*env)->GetShortField(env, lpObject, lpCache->bits_per_pixel);
- lpStruct->height = (*env)->GetShortField(env, lpObject, lpCache->height);
- lpStruct->width = (*env)->GetShortField(env, lpObject, lpCache->width);
-}
-
-void setPgVideoModeInfo_tFields(JNIEnv *env, jobject lpObject, PgVideoModeInfo_t *lpStruct, PPgVideoModeInfo_t_FID_CACHE lpCache)
-{
- jbyteArray refresh_rates = (*env)->GetObjectField(env, lpObject, lpCache->refresh_rates);
- if (refresh_rates) {
- jbyte *refresh_rates1 = (*env)->GetByteArrayElements(env, refresh_rates, NULL);
- memcpy(refresh_rates1, lpStruct->refresh_rates, sizeof(lpStruct->refresh_rates));
- (*env)->ReleaseByteArrayElements(env, refresh_rates, refresh_rates1, 0);
- }
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities6, lpStruct->mode_capabilities6);
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities5, lpStruct->mode_capabilities5);
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities4, lpStruct->mode_capabilities4);
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities3, lpStruct->mode_capabilities3);
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities2, lpStruct->mode_capabilities2);
- (*env)->SetIntField(env, lpObject, lpCache->mode_capabilities1, lpStruct->mode_capabilities1);
- (*env)->SetIntField(env, lpObject, lpCache->type, lpStruct->type);
- (*env)->SetShortField(env, lpObject, lpCache->bytes_per_scanline, lpStruct->bytes_per_scanline);
- (*env)->SetShortField(env, lpObject, lpCache->bits_per_pixel, lpStruct->bits_per_pixel);
- (*env)->SetShortField(env, lpObject, lpCache->height, lpStruct->height);
- (*env)->SetShortField(env, lpObject, lpCache->width, lpStruct->width);
-}
-
-void cachePhClipHeaderFids(JNIEnv *env, jobject lpObject, PPhClipHeader_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->data = (*env)->GetFieldID(env, lpCache->clazz, "data", "I");
- lpCache->length = (*env)->GetFieldID(env, lpCache->clazz, "length", "S");
- lpCache->type_7 = (*env)->GetFieldID(env, lpCache->clazz, "type_7", "B");
- lpCache->type_6 = (*env)->GetFieldID(env, lpCache->clazz, "type_6", "B");
- lpCache->type_5 = (*env)->GetFieldID(env, lpCache->clazz, "type_5", "B");
- lpCache->type_4 = (*env)->GetFieldID(env, lpCache->clazz, "type_4", "B");
- lpCache->type_3 = (*env)->GetFieldID(env, lpCache->clazz, "type_3", "B");
- lpCache->type_2 = (*env)->GetFieldID(env, lpCache->clazz, "type_2", "B");
- lpCache->type_1 = (*env)->GetFieldID(env, lpCache->clazz, "type_1", "B");
- lpCache->type_0 = (*env)->GetFieldID(env, lpCache->clazz, "type_0", "B");
- lpCache->cached = 1;
-}
-
-void getPhClipHeaderFields(JNIEnv *env, jobject lpObject, PhClipHeader *lpStruct, PPhClipHeader_FID_CACHE lpCache)
-{
- lpStruct->data = (void *)(*env)->GetIntField(env, lpObject, lpCache->data);
- lpStruct->length = (*env)->GetShortField(env, lpObject, lpCache->length);
- lpStruct->type[7] = (*env)->GetByteField(env, lpObject, lpCache->type_7);
- lpStruct->type[6] = (*env)->GetByteField(env, lpObject, lpCache->type_6);
- lpStruct->type[5] = (*env)->GetByteField(env, lpObject, lpCache->type_5);
- lpStruct->type[4] = (*env)->GetByteField(env, lpObject, lpCache->type_4);
- lpStruct->type[3] = (*env)->GetByteField(env, lpObject, lpCache->type_3);
- lpStruct->type[2] = (*env)->GetByteField(env, lpObject, lpCache->type_2);
- lpStruct->type[1] = (*env)->GetByteField(env, lpObject, lpCache->type_1);
- lpStruct->type[0] = (*env)->GetByteField(env, lpObject, lpCache->type_0);
-}
-
-void setPhClipHeaderFields(JNIEnv *env, jobject lpObject, PhClipHeader *lpStruct, PPhClipHeader_FID_CACHE lpCache)
-{
- (*env)->SetIntField(env, lpObject, lpCache->data, (jint)lpStruct->data);
- (*env)->SetShortField(env, lpObject, lpCache->length, lpStruct->length);
- (*env)->SetByteField(env, lpObject, lpCache->type_7, lpStruct->type[7]);
- (*env)->SetByteField(env, lpObject, lpCache->type_6, lpStruct->type[6]);
- (*env)->SetByteField(env, lpObject, lpCache->type_5, lpStruct->type[5]);
- (*env)->SetByteField(env, lpObject, lpCache->type_4, lpStruct->type[4]);
- (*env)->SetByteField(env, lpObject, lpCache->type_3, lpStruct->type[3]);
- (*env)->SetByteField(env, lpObject, lpCache->type_2, lpStruct->type[2]);
- (*env)->SetByteField(env, lpObject, lpCache->type_1, lpStruct->type[1]);
- (*env)->SetByteField(env, lpObject, lpCache->type_0, lpStruct->type[0]);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.h
deleted file mode 100644
index 7753c21935..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/structs.h
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
- /**
- * JNI SWT object field getters and setters declarations for Photon structs
- */
-
-#ifndef INC_structs_H
-#define INC_structs_H
-
-#include <Ph.h>
-#include <Pt.h>
-#include <photon/PhRender.h>
-
-/* PhPoint_t struct */
-typedef struct PhPoint_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x, y;
-} PhPoint_t_FID_CACHE;
-typedef PhPoint_t_FID_CACHE *PPhPoint_t_FID_CACHE;
-
-void cachePhPoint_tFids(JNIEnv *env, jobject lpObject, PPhPoint_t_FID_CACHE lpCache);
-void getPhPoint_tFields(JNIEnv *env, jobject lpObject, PhPoint_t *lpStruct, PPhPoint_t_FID_CACHE lpCache);
-void setPhPoint_tFields(JNIEnv *env, jobject lpObject, PhPoint_t *lpStruct, PPhPoint_t_FID_CACHE lpCache);
-
-/* PhRect_t struct */
-typedef struct PhRect_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID ul_x, ul_y, lr_x, lr_y;
-} PhRect_t_FID_CACHE;
-typedef PhRect_t_FID_CACHE *PPhRect_t_FID_CACHE;
-
-void cachePhRect_tFids(JNIEnv *env, jobject lpObject, PPhRect_t_FID_CACHE lpCache);
-void getPhRect_tFields(JNIEnv *env, jobject lpObject, PhRect_t *lpStruct, PPhRect_t_FID_CACHE lpCache);
-void setPhRect_tFields(JNIEnv *env, jobject lpObject, PhRect_t *lpStruct, PPhRect_t_FID_CACHE lpCache);
-
-typedef struct PhTile_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID rect_ul_x, rect_ul_y, rect_lr_x, rect_lr_y, next;
-} PhTile_t_FID_CACHE;
-typedef PhTile_t_FID_CACHE *PPhTile_t_FID_CACHE;
-
-void cachePhTile_tFids(JNIEnv *env, jobject lpObject, PPhTile_t_FID_CACHE lpCache);
-void getPhTile_tFields(JNIEnv *env, jobject lpObject, PhTile_t *lpStruct, PPhTile_t_FID_CACHE lpCache);
-void setPhTile_tFields(JNIEnv *env, jobject lpObject, PhTile_t *lpStruct, PPhTile_t_FID_CACHE lpCache);
-
-typedef struct PtCallbackInfo_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID reason, reason_subtype, event, cbdata;
-} PtCallbackInfo_t_FID_CACHE;
-typedef PtCallbackInfo_t_FID_CACHE *PPtCallbackInfo_t_FID_CACHE;
-
-void cachePtCallbackInfo_tFids(JNIEnv *env, jobject lpObject, PPtCallbackInfo_t_FID_CACHE lpCache);
-void getPtCallbackInfo_tFields(JNIEnv *env, jobject lpObject, PtCallbackInfo_t *lpStruct, PPtCallbackInfo_t_FID_CACHE lpCache);
-void setPtCallbackInfo_tFields(JNIEnv *env, jobject lpObject, PtCallbackInfo_t *lpStruct, PPtCallbackInfo_t_FID_CACHE lpCache);
-
-typedef struct PhWindowEvent_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID event_f, state_f, rid, pos_x, pos_y, size_w, size_h, event_state, input_group, rsvd0, rsvd1, rsvd2, rsvd3;
-} PhWindowEvent_t_FID_CACHE;
-typedef PhWindowEvent_t_FID_CACHE *PPhWindowEvent_t_FID_CACHE;
-
-void cachePhWindowEvent_tFids(JNIEnv *env, jobject lpObject, PPhWindowEvent_t_FID_CACHE lpCache);
-void getPhWindowEvent_tFields(JNIEnv *env, jobject lpObject, PhWindowEvent_t *lpStruct, PPhWindowEvent_t_FID_CACHE lpCache);
-void setPhWindowEvent_tFields(JNIEnv *env, jobject lpObject, PhWindowEvent_t *lpStruct, PPhWindowEvent_t_FID_CACHE lpCache);
-
-/* PhEvent_t struct */
-typedef struct PhEvent_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID type, subtype, processing_flags, emitter_rid, emitter_handle, collector_rid, collector_handle, input_group, flags, timestamp, translation_x, translation_y, num_rects, data_len;
-} PhEvent_t_FID_CACHE;
-typedef PhEvent_t_FID_CACHE *PPhEvent_t_FID_CACHE;
-
-void cachePhEvent_tFids(JNIEnv *env, jobject lpObject, PPhEvent_t_FID_CACHE lpCache);
-void getPhEvent_tFields(JNIEnv *env, jobject lpObject, PhEvent_t *lpStruct, PPhEvent_t_FID_CACHE lpCache);
-void setPhEvent_tFields(JNIEnv *env, jobject lpObject, PhEvent_t *lpStruct, PPhEvent_t_FID_CACHE lpCache);
-
-/* FontQueryInfo struct */
-typedef struct FontQueryInfo_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID font, desc, size, style, ascender, descender, width, lochar, hichar;
-} FontQueryInfo_FID_CACHE;
-typedef FontQueryInfo_FID_CACHE *PFontQueryInfo_FID_CACHE;
-
-void cacheFontQueryInfoFids(JNIEnv *env, jobject lpObject, PFontQueryInfo_FID_CACHE lpCache);
-void getFontQueryInfoFields(JNIEnv *env, jobject lpObject, FontQueryInfo *lpStruct, PFontQueryInfo_FID_CACHE lpCache);
-void setFontQueryInfoFields(JNIEnv *env, jobject lpObject, FontQueryInfo *lpStruct, PFontQueryInfo_FID_CACHE lpCache);
-
-/* PhDim_t struct */
-typedef struct PhDim_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID w, h;
-} PhDim_t_FID_CACHE;
-typedef PhDim_t_FID_CACHE *PPhDim_t_FID_CACHE;
-
-void cachePhDim_tFids(JNIEnv *env, jobject lpObject, PPhDim_t_FID_CACHE lpCache);
-void getPhDim_tFields(JNIEnv *env, jobject lpObject, PhDim_t *lpStruct, PPhDim_t_FID_CACHE lpCache);
-void setPhDim_tFields(JNIEnv *env, jobject lpObject, PhDim_t *lpStruct, PPhDim_t_FID_CACHE lpCache);
-
-/* PhImage_t struct */
-typedef struct PhImage_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID type, image_tag, bpl, size_w, size_h, palette_tag, colors, alpha, transparent, format, flags, ghost_bpl, spare1, ghost_bitmap, mask_bpl, mask_bm, palette, image;
-} PhImage_t_FID_CACHE;
-typedef PhImage_t_FID_CACHE *PPhImage_t_FID_CACHE;
-
-void cachePhImage_tFids(JNIEnv *env, jobject lpObject, PPhImage_t_FID_CACHE lpCache);
-void getPhImage_tFields(JNIEnv *env, jobject lpObject, PhImage_t *lpStruct, PPhImage_t_FID_CACHE lpCache);
-void setPhImage_tFields(JNIEnv *env, jobject lpObject, PhImage_t *lpStruct, PPhImage_t_FID_CACHE lpCache);
-
-/* PhPointerEvent_t struct */
-typedef struct PhPointerEvent_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID pos_x, pos_y, buttons, button_state, click_count, flags, z, key_mods, zero;
-} PhPointerEvent_t_FID_CACHE;
-typedef PhPointerEvent_t_FID_CACHE *PPhPointerEvent_t_FID_CACHE;
-
-void cachePhPointerEvent_tFids(JNIEnv *env, jobject lpObject, PPhPointerEvent_t_FID_CACHE lpCache);
-void getPhPointerEvent_tFields(JNIEnv *env, jobject lpObject, PhPointerEvent_t *lpStruct, PPhPointerEvent_t_FID_CACHE lpCache);
-void setPhPointerEvent_tFields(JNIEnv *env, jobject lpObject, PhPointerEvent_t *lpStruct, PPhPointerEvent_t_FID_CACHE lpCache);
-
-/* PhKeyEvent_t struct */
-typedef struct PhKeyEvent_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID key_flags, key_mods, key_sym, key_cap, key_scan, key_zero, pos_x, pos_y, button_state;
-} PhKeyEvent_t_FID_CACHE;
-typedef PhKeyEvent_t_FID_CACHE *PPhKeyEvent_t_FID_CACHE;
-
-void cachePhKeyEvent_tFids(JNIEnv *env, jobject lpObject, PPhKeyEvent_t_FID_CACHE lpCache);
-void getPhKeyEvent_tFields(JNIEnv *env, jobject lpObject, PhKeyEvent_t *lpStruct, PPhKeyEvent_t_FID_CACHE lpCache);
-void setPhKeyEvent_tFields(JNIEnv *env, jobject lpObject, PhKeyEvent_t *lpStruct, PPhKeyEvent_t_FID_CACHE lpCache);
-
-/* PtScrollbarCallback_t struct */
-typedef struct PtScrollbarCallback_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID action, position;
-} PtScrollbarCallback_t_FID_CACHE;
-typedef PtScrollbarCallback_t_FID_CACHE *PPtScrollbarCallback_t_FID_CACHE;
-
-void cachePtScrollbarCallback_tFids(JNIEnv *env, jobject lpObject, PPtScrollbarCallback_t_FID_CACHE lpCache);
-void getPtScrollbarCallback_tFields(JNIEnv *env, jobject lpObject, PtScrollbarCallback_t *lpStruct, PPtScrollbarCallback_t_FID_CACHE lpCache);
-void setPtScrollbarCallback_tFields(JNIEnv *env, jobject lpObject, PtScrollbarCallback_t *lpStruct, PPtScrollbarCallback_t_FID_CACHE lpCache);
-
-/* PhCursorInfo_t struct */
-typedef struct PhCursorInfo_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID pos_x, pos_y, region, ig_region, color, last_press_x, last_press_y, msec, steady_x, steady_y, dragger, drag_boundary_xUL, drag_boundary_yUL, drag_boundary_xLR, drag_boundary_yLR, phantom_rid, type, ig, button_state, click_count, zero10, zero11, zero12, key_mods, zero2;
-} PhCursorInfo_t_FID_CACHE;
-typedef PhCursorInfo_t_FID_CACHE *PPhCursorInfo_t_FID_CACHE;
-
-void cachePhCursorInfo_tFids(JNIEnv *env, jobject lpObject, PPhCursorInfo_t_FID_CACHE lpCache);
-void getPhCursorInfo_tFields(JNIEnv *env, jobject lpObject, PhCursorInfo_t *lpStruct, PPhCursorInfo_t_FID_CACHE lpCache);
-void setPhCursorInfo_tFields(JNIEnv *env, jobject lpObject, PhCursorInfo_t *lpStruct, PPhCursorInfo_t_FID_CACHE lpCache);
-
-/* FontDetails struct */
-typedef struct FontDetails_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID desc, stem, losize, hisize, flags;
-} FontDetails_FID_CACHE;
-typedef FontDetails_FID_CACHE *PFontDetails_FID_CACHE;
-
-void cacheFontDetailsFids(JNIEnv *env, jobject lpObject, PFontDetails_FID_CACHE lpCache);
-void getFontDetailsFields(JNIEnv *env, jobject lpObject, FontDetails *lpStruct, PFontDetails_FID_CACHE lpCache);
-void setFontDetailsFields(JNIEnv *env, jobject lpObject, FontDetails *lpStruct, PFontDetails_FID_CACHE lpCache);
-
-/* PhArea_t struct */
-typedef struct PhArea_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID pos_x, pos_y, size_w, size_h;
-} PhArea_t_FID_CACHE;
-typedef PhArea_t_FID_CACHE *PPhArea_t_FID_CACHE;
-
-void cachePhArea_tFids(JNIEnv *env, jobject lpObject, PPhArea_t_FID_CACHE lpCache);
-void getPhArea_tFields(JNIEnv *env, jobject lpObject, PhArea_t *lpStruct, PPhArea_t_FID_CACHE lpCache);
-void setPhArea_tFields(JNIEnv *env, jobject lpObject, PhArea_t *lpStruct, PPhArea_t_FID_CACHE lpCache);
-
-/* PtFileSelectionInfo_t struct */
-typedef struct PtFileSelectionInfo_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID ret, path, dim, pos, format, fspec, user_data, confirm_display, confirm_selection, new_directory, btn1, btn2, num_args, args, spare;
-} PtFileSelectionInfo_t_FID_CACHE;
-typedef PtFileSelectionInfo_t_FID_CACHE *PPtFileSelectionInfo_t_FID_CACHE;
-
-void cachePtFileSelectionInfo_tFids(JNIEnv *env, jobject lpObject, PPtFileSelectionInfo_t_FID_CACHE lpCache);
-void getPtFileSelectionInfo_tFields(JNIEnv *env, jobject lpObject, PtFileSelectionInfo_t *lpStruct, PPtFileSelectionInfo_t_FID_CACHE lpCache);
-void setPtFileSelectionInfo_tFields(JNIEnv *env, jobject lpObject, PtFileSelectionInfo_t *lpStruct, PPtFileSelectionInfo_t_FID_CACHE lpCache);
-
-/* PgAlpha_t struct */
-typedef struct PgAlpha_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID alpha_op, src_alpha_map_dim_w, src_alpha_map_dim_h, src_alpha_map_bpl, src_alpha_map_bpp, src_alpha_map_map, src_global_alpha, dest_global_alpha;
-} PgAlpha_t_FID_CACHE;
-typedef PgAlpha_t_FID_CACHE *PPgAlpha_t_FID_CACHE;
-
-void cachePgAlpha_tFids(JNIEnv *env, jobject lpObject, PPgAlpha_t_FID_CACHE lpCache);
-void getPgAlpha_tFields(JNIEnv *env, jobject lpObject, PgAlpha_t *lpStruct, PPgAlpha_t_FID_CACHE lpCache);
-void setPgAlpha_tFields(JNIEnv *env, jobject lpObject, PgAlpha_t *lpStruct, PPgAlpha_t_FID_CACHE lpCache);
-
-/* PtTextCallback_t struct */
-typedef struct PtTextCallback_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID start_pos, end_pos, cur_insert, new_insert, length, reserved, text, doit;
-} PtTextCallback_t_FID_CACHE;
-typedef PtTextCallback_t_FID_CACHE *PPtTextCallback_t_FID_CACHE;
-
-void cachePtTextCallback_tFids(JNIEnv *env, jobject lpObject, PPtTextCallback_t_FID_CACHE lpCache);
-void getPtTextCallback_tFields(JNIEnv *env, jobject lpObject, PtTextCallback_t *lpStruct, PPtTextCallback_t_FID_CACHE lpCache);
-void setPtTextCallback_tFields(JNIEnv *env, jobject lpObject, PtTextCallback_t *lpStruct, PPtTextCallback_t_FID_CACHE lpCache);
-
-/* PtTreeItem_t struct */
-typedef struct PtTreeItem_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID list_flags, list_size_w, list_size_h, list_next, list_prev, father, son, brother, dim_w, dim_h, img_set, img_unset, data;
-} PtTreeItem_t_FID_CACHE;
-typedef PtTreeItem_t_FID_CACHE *PPtTreeItem_t_FID_CACHE;
-
-void cachePtTreeItem_tFids(JNIEnv *env, jobject lpObject, PPtTreeItem_t_FID_CACHE lpCache);
-void getPtTreeItem_tFields(JNIEnv *env, jobject lpObject, PtTreeItem_t *lpStruct, PPtTreeItem_t_FID_CACHE lpCache);
-void setPtTreeItem_tFields(JNIEnv *env, jobject lpObject, PtTreeItem_t *lpStruct, PPtTreeItem_t_FID_CACHE lpCache);
-
-/* PgMap_t struct */
-typedef struct PgMap_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dim_w, dim_h, bpl, bpp, map;
-} PgMap_t_FID_CACHE;
-typedef PgMap_t_FID_CACHE *PPgMap_t_FID_CACHE;
-
-void cachePgMap_tFids(JNIEnv *env, jobject lpObject, PPgMap_t_FID_CACHE lpCache);
-void getPgMap_tFields(JNIEnv *env, jobject lpObject, PgMap_t *lpStruct, PPgMap_t_FID_CACHE lpCache);
-void setPgMap_tFields(JNIEnv *env, jobject lpObject, PgMap_t *lpStruct, PPgMap_t_FID_CACHE lpCache);
-
-/* PtColorSelectInfo_t struct */
-typedef struct PtColorSelectInfo_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID flags, nselectors, ncolor_models, color_models, selectors, pos_x, pos_y, size_w, size_h, palette, accept_text, dismiss_text, accept_dismiss_text, apply_f, data, rgb, dialog;
- } PtColorSelectInfo_t_FID_CACHE;
-typedef PtColorSelectInfo_t_FID_CACHE *PPtColorSelectInfo_t_FID_CACHE;
-
-void cachePtColorSelectInfo_tFids(JNIEnv *env, jobject lpObject, PPtColorSelectInfo_t_FID_CACHE lpCache);
-void getPtColorSelectInfo_tFields(JNIEnv *env, jobject lpObject, PtColorSelectInfo_t *lpStruct, PPtColorSelectInfo_t_FID_CACHE lpCache);
-void setPtColorSelectInfo_tFields(JNIEnv *env, jobject lpObject, PtColorSelectInfo_t *lpStruct, PPtColorSelectInfo_t_FID_CACHE lpCache);
-
-/* PhRegion_t struct */
-typedef struct PhRegion_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID rid, handle, owner, flags, state, events_sense, events_opaque, origin_x, origin_y, parent, child, bro_in_front, bro_behind, cursor_color, input_group, data_len, cursor_type;
-} PhRegion_t_FID_CACHE;
-typedef PhRegion_t_FID_CACHE *PPhRegion_t_FID_CACHE;
-
-void cachePhRegion_tFids(JNIEnv *env, jobject lpObject, PPhRegion_t_FID_CACHE lpCache);
-void getPhRegion_tFields(JNIEnv *env, jobject lpObject, PhRegion_t *lpStruct, PPhRegion_t_FID_CACHE lpCache);
-void setPhRegion_tFields(JNIEnv *env, jobject lpObject, PhRegion_t *lpStruct, PPhRegion_t_FID_CACHE lpCache);
-
-/* PtContainerCallback_t struct */
-typedef struct PtContainerCallback_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID new_size_ul_x, new_size_ul_y, new_size_lr_x, new_size_lr_y, old_size_ul_x, old_size_ul_y, old_size_lr_x, old_size_lr_y, new_dim_w, new_dim_h, old_dim_w, old_dim_h;
-} PtContainerCallback_t_FID_CACHE;
-typedef PtContainerCallback_t_FID_CACHE *PPtContainerCallback_t_FID_CACHE;
-
-void cachePtContainerCallback_tFids(JNIEnv *env, jobject lpObject, PPtContainerCallback_t_FID_CACHE lpCache);
-void getPtContainerCallback_tFields(JNIEnv *env, jobject lpObject, PtContainerCallback_t *lpStruct, PPtContainerCallback_t_FID_CACHE lpCache);
-void setPtContainerCallback_tFields(JNIEnv *env, jobject lpObject, PtContainerCallback_t *lpStruct, PPtContainerCallback_t_FID_CACHE lpCache);
-
-/* PhCursorDef_t struct */
-typedef struct PhCursorDef_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID bytesperline2, color2, offset2_y, offset2_x, size2_y, size2_x, bytesperline1, color1, offset1_y, offset1_x, size1_y, size1_x, hdr_type, hdr_len;
-} PhCursorDef_t_FID_CACHE;
-typedef PhCursorDef_t_FID_CACHE *PPhCursorDef_t_FID_CACHE;
-
-void cachePhCursorDef_tFids(JNIEnv *env, jobject lpObject, PPhCursorDef_t_FID_CACHE lpCache);
-void getPhCursorDef_tFields(JNIEnv *env, jobject lpObject, PhCursorDef_t *lpStruct, PPhCursorDef_t_FID_CACHE lpCache);
-void setPhCursorDef_tFields(JNIEnv *env, jobject lpObject, PhCursorDef_t *lpStruct, PPhCursorDef_t_FID_CACHE lpCache);
-
-/* PgDisplaySettings_t struct */
-typedef struct PgDisplaySettings_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID reserved, flags, refresh, yres, xres, mode;
-} PgDisplaySettings_t_FID_CACHE;
-typedef PgDisplaySettings_t_FID_CACHE *PPgDisplaySettings_t_FID_CACHE;
-
-void cachePgDisplaySettings_tFids(JNIEnv *env, jobject lpObject, PPgDisplaySettings_t_FID_CACHE lpCache);
-void getPgDisplaySettings_tFields(JNIEnv *env, jobject lpObject, PgDisplaySettings_t *lpStruct, PPgDisplaySettings_t_FID_CACHE lpCache);
-void setPgDisplaySettings_tFields(JNIEnv *env, jobject lpObject, PgDisplaySettings_t *lpStruct, PPgDisplaySettings_t_FID_CACHE lpCache);
-
-typedef struct PgVideoModeInfo_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID refresh_rates, mode_capabilities6, mode_capabilities5, mode_capabilities4, mode_capabilities3, mode_capabilities2, mode_capabilities1, type, bytes_per_scanline, bits_per_pixel, height, width;
-} PgVideoModeInfo_t_FID_CACHE;
-typedef PgVideoModeInfo_t_FID_CACHE *PPgVideoModeInfo_t_FID_CACHE;
-
-void cachePgVideoModeInfo_tFids(JNIEnv *env, jobject lpObject, PPgVideoModeInfo_t_FID_CACHE lpCache);
-void getPgVideoModeInfo_tFields(JNIEnv *env, jobject lpObject, PgVideoModeInfo_t *lpStruct, PPgVideoModeInfo_t_FID_CACHE lpCache);
-void setPgVideoModeInfo_tFields(JNIEnv *env, jobject lpObject, PgVideoModeInfo_t *lpStruct, PPgVideoModeInfo_t_FID_CACHE lpCache);
-
-/* PhClipHeader struct */
-typedef struct PhClipHeader_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID data, length, type_7, type_6, type_5, type_4, type_3, type_2, type_1, type_0;
-} PhClipHeader_FID_CACHE;
-typedef PhClipHeader_FID_CACHE *PPhClipHeader_FID_CACHE;
-
-void cachePhClipHeaderFids(JNIEnv *env, jobject lpObject, PPhClipHeader_FID_CACHE lpCache);
-void getPhClipHeaderFields(JNIEnv *env, jobject lpObject, PhClipHeader *lpStruct, PPhClipHeader_FID_CACHE lpCache);
-void setPhClipHeaderFields(JNIEnv *env, jobject lpObject, PhClipHeader *lpStruct, PPhClipHeader_FID_CACHE lpCache);
-
-extern PhPoint_t_FID_CACHE PhPoint_tFc;
-extern PhRect_t_FID_CACHE PhRect_tFc;
-extern PhTile_t_FID_CACHE PhTile_tFc;
-extern PtCallbackInfo_t_FID_CACHE PtCallbackInfo_tFc;
-extern PhWindowEvent_t_FID_CACHE PhWindowEvent_tFc;
-extern PhEvent_t_FID_CACHE PhEvent_tFc;
-extern FontQueryInfo_FID_CACHE FontQueryInfoFc;
-extern PhDim_t_FID_CACHE PhDim_tFc;
-extern PhImage_t_FID_CACHE PhImage_tFc;
-extern PhPointerEvent_t_FID_CACHE PhPointerEvent_tFc;
-extern PhKeyEvent_t_FID_CACHE PhKeyEvent_tFc;
-extern PtScrollbarCallback_t_FID_CACHE PtScrollbarCallback_tFc;
-extern PhCursorInfo_t_FID_CACHE PhCursorInfo_tFc;
-extern FontDetails_FID_CACHE FontDetailsFc;
-extern PhArea_t_FID_CACHE PhArea_tFc;
-extern PtFileSelectionInfo_t_FID_CACHE PtFileSelectionInfo_tFc;
-extern PgAlpha_t_FID_CACHE PgAlpha_tFc;
-extern PtTextCallback_t_FID_CACHE PtTextCallback_tFc;
-extern PtTreeItem_t_FID_CACHE PtTreeItem_tFc;
-extern PgMap_t_FID_CACHE PgMap_tFc;
-extern PtColorSelectInfo_t_FID_CACHE PtColorSelectInfo_tFc;
-extern PhRegion_t_FID_CACHE PhRegion_tFc;
-extern PtContainerCallback_t_FID_CACHE PtContainerCallback_tFc;
-extern PhCursorDef_t_FID_CACHE PhCursorDef_tFc;
-extern PgDisplaySettings_t_FID_CACHE PgDisplaySettings_tFc;
-extern PgVideoModeInfo_t_FID_CACHE PgVideoModeInfo_tFc;
-extern PhClipHeader_FID_CACHE PhClipHeaderFc;
-
-#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/swt.c
deleted file mode 100644
index 1d2d5a3f46..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/library/swt.c
+++ /dev/null
@@ -1,6737 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT OS natives implementation.
- */
-
-// #define PRINT_FAILED_RCODES
-#define NDEBUG
-
-#include "swt.h"
-#include "structs.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <malloc.h>
-
-
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_photon_OS_getSharedLibraryMajorVersionNumber
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "getSharedLibraryMajorVersionNumber\n");
-#endif
- return SWT_VERSION / 1000;
-}
-
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_photon_OS_getSharedLibraryMinorVersionNumber
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "getSharedLibraryMinorVersionNumber\n");
-#endif
- return SWT_VERSION % 1000;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindow
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWindow
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWindow\n");
-#endif
-
- return (jint)PtWindow;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtList
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtList
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtList\n");
-#endif
-
- return (jint)PtList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtLabel
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtLabel
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtLabel\n");
-#endif
-
- return (jint)PtLabel;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtInit
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtInit
- (JNIEnv *env, jobject that, jbyteArray name)
-{
- char *name1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtInit\n");
-#endif
-
- if (name)
- name1 = (char *)(*env)->GetByteArrayElements(env, name, NULL);
-
- result = (jint)PtInit(name1);
-
- if (name)
- (*env)->ReleaseByteArrayElements(env, name, (jbyte *)name1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtCreateWidget
- * Signature: (III[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtCreateWidget
- (JNIEnv *env, jobject that, jint clazz, jint parent, jint n_args, jintArray args)
-{
- PtArg_t *args1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtCreateWidget\n");
-#endif
-
- if (args)
- args1 = (PtArg_t *)(*env)->GetIntArrayElements(env, args, NULL);
-
- result = (jint)PtCreateWidget((PtWidgetClassRef_t *)clazz, (PtWidget_t *)parent, n_args, args1);
-
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, (jint *)args1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSetResources
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSetResources
- (JNIEnv *env, jobject that, jint widget, jint n_args, jintArray args)
-{
- jint *args1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSetResources\n");
-#endif
-
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
-
- result = (jint)PtSetResources((PtWidget_t *)widget, n_args, (PtArg_t *)args1);
-
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtRealizeWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtRealizeWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtRealizeWidget\n");
-#endif
-
- return (jint)PtRealizeWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAddEventHandler
- * Signature: (IIII)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAddEventHandler
- (JNIEnv *env, jobject that, jint widget, jint event_mask, jint callback, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAddEventHandler\n");
-#endif
-
- PtAddEventHandler((PtWidget_t *)widget, (unsigned long)event_mask, (PtCallbackF_t *)callback, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetRid
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetRid
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetRid\n");
-#endif
-
- return (jint)PtWidgetRid((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtMainLoop
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtMainLoop
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtMainLoop\n");
-#endif
-
- PtMainLoop();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgFlush
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgFlush
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgFlush\n");
-#endif
-
- return (jint)PgFlush();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgCreateGC
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgCreateGC
- (JNIEnv *env, jobject that, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgCreateGC\n");
-#endif
-
- return (jint)PgCreateGC(size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetGC
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetGC
- (JNIEnv *env, jobject that, jint GC)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetGC\n");
-#endif
-
- return (jint)PgSetGC((PhGC_t *)GC);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetRegion
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetRegion
- (JNIEnv *env, jobject that, jint rid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetRegion\n");
-#endif
-
- PgSetRegion(rid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetFillColor
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetFillColor
- (JNIEnv *env, jobject that, jint color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetFillColor\n");
-#endif
-
- return (jint)PgSetFillColor(color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetStrokeColor
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetStrokeColor
- (JNIEnv *env, jobject that, jint color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetStrokeColor\n");
-#endif
-
- return (jint)PgSetStrokeColor(color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetTextColor
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetTextColor
- (JNIEnv *env, jobject that, jint color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetTextColor\n");
-#endif
-
- return (jint)PgSetTextColor(color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetFont
- * Signature: ([B)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetFont
- (JNIEnv *env, jobject that, jbyteArray ff)
-{
- jbyte *ff1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetFont\n");
-#endif
-
- if (ff)
- ff1 = (*env)->GetByteArrayElements(env, ff, NULL);
-
- PgSetFont(ff1);
-
- if (ff)
- (*env)->ReleaseByteArrayElements(env, ff, ff1, JNI_ABORT);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetStrokeDash
- * Signature: ([BII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetStrokeDash
- (JNIEnv *env, jobject that, jbyteArray DashList, jint ListLen, jint DashScale)
-{
- jbyte *DashList1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetStrokeDash\n");
-#endif
-
- if (DashList)
- DashList1 = (*env)->GetByteArrayElements(env, DashList, NULL);
-
- PgSetStrokeDash(DashList1, ListLen, DashScale);
-
- if (DashList)
- (*env)->ReleaseByteArrayElements(env, DashList, DashList1, JNI_ABORT);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetStrokeWidth
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetStrokeWidth
- (JNIEnv *env, jobject that, jint width)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetStrokeWidth\n");
-#endif
-
- return (jint)PgSetStrokeWidth(width);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetDrawMode
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetDrawMode
- (JNIEnv *env, jobject that, jint mode)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetDrawMode\n");
-#endif
-
- return (jint)PgSetDrawMode(mode);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetClipping
- * Signature: (SI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetClipping
- (JNIEnv *env, jobject that, jshort n, jint rects)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetClipping\n");
-#endif
-
- PgSetClipping(n, (PhRect_t *)rects);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetPalette
- * Signature: (IISSII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetPalette
- (JNIEnv *env, jobject that, jint palette, jint palette_id, jshort first_color, jshort num_colors, jint flags, jint tag)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetPalette\n");
-#endif
-
- return (jint)PgSetPalette((PgColor_t *)palette, palette_id, first_color, num_colors, flags, tag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawArc
- * Signature: (Lorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhPoint_t;III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawArc
- (JNIEnv *env, jobject that, jobject center, jobject radii, jint start, jint end, jint flags)
-{
- DECL_GLOB(pGlob)
- PhPoint_t center1, *lpCenter1=NULL, radii1, *lpRadii1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawArc\n");
-#endif
-
- if (center) {
- lpCenter1 = &center1;
- cachePhPoint_tFids(env, center, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, center, lpCenter1, &PGLOB(PhPoint_tFc));
- }
- if (radii) {
- lpRadii1 = &radii1;
- cachePhPoint_tFids(env, radii, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, radii, lpRadii1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PgDrawArc(lpCenter1, lpRadii1, start, end, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawEllipse
- * Signature: (Lorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhPoint_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawEllipse
- (JNIEnv *env, jobject that, jobject center, jobject radii, jint flags)
-{
- DECL_GLOB(pGlob)
- PhPoint_t center1, *lpCenter1=NULL, radii1, *lpRadii1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawEllipse\n");
-#endif
-
- if (center) {
- lpCenter1 = &center1;
- cachePhPoint_tFids(env, center, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, center, lpCenter1, &PGLOB(PhPoint_tFc));
- }
- if (radii) {
- lpRadii1 = &radii1;
- cachePhPoint_tFids(env, radii, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, radii, lpRadii1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PgDrawEllipse(lpCenter1, lpRadii1, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawGradient
- * Signature: (Lorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhPoint_t;IIIIIIII[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawGradient
- (JNIEnv *env, jobject that, jobject ul, jobject lr, jint gradient_type, jint transition_type, jint num_color_pts, jint color1, jint color2, jint color3, jint color4, jint table_size, jbyteArray transition_table)
-{
- DECL_GLOB(pGlob)
- jbyte *transition_table1=NULL;
- PhPoint_t ul1, *lpUl1 = NULL, lr1, *lpLr1 = NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawGradient\n");
-#endif
-
- if (ul) {
- lpUl1 = &ul1;
- cachePhPoint_tFids(env, ul, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, ul, lpUl1, &PGLOB(PhPoint_tFc));
- }
- if (lr) {
- lpLr1 = &lr1;
- cachePhPoint_tFids(env, ul, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, lr, lpLr1, &PGLOB(PhPoint_tFc));
- }
- if (transition_table)
- transition_table1 = (*env)->GetByteArrayElements(env, transition_table, NULL);
-
- result = (jint) PgDrawGradient(lpUl1, lpLr1,
- (unsigned long) gradient_type, (unsigned long) transition_type, (unsigned long) num_color_pts,
- (PgColor_t) color1, (PgColor_t) color2, (PgColor_t) color3, (PgColor_t) color4,
- (unsigned long) table_size, (unsigned char*) transition_table1);
-
- if (transition_table)
- (*env)->ReleaseByteArrayElements(env, transition_table, transition_table1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawRoundRect
- * Signature: (Lorg/eclipse/swt/photon/PhRect_t;Lorg/eclipse/swt/photon/PhPoint_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawRoundRect
- (JNIEnv *env, jobject that, jobject rect, jobject radii, jint flags)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
- PhPoint_t radii1, *lpRadii1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawRoundRect\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- if (radii) {
- lpRadii1 = &radii1;
- cachePhPoint_tFids(env, radii, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, radii, lpRadii1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PgDrawRoundRect(lpRect1, lpRadii1, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawPolygon
- * Signature: ([SI;Lorg/eclipse/swt/photon/PhPoint_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawPolygon
- (JNIEnv *env, jobject that, jshortArray ptr, jint num, jobject pos, jint flags)
-{
- DECL_GLOB(pGlob)
- jshort *ptr1=NULL;
- PhPoint_t pos1, *lpPos1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawPolygon\n");
-#endif
-
- if (ptr)
- ptr1 = (*env)->GetShortArrayElements(env, ptr, NULL);
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
-
- result = (jint) PgDrawPolygon((PhPoint_t *)ptr1, num, lpPos1, flags);
-
- if (ptr)
- (*env)->ReleaseShortArrayElements(env, ptr, ptr1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawILine
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawILine
- (JNIEnv *env, jobject that, jint x1, jint y1, jint x2, jint y2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawILine\n");
-#endif
-
- return (jint)PgDrawILine(x1, y1, x2, y2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawIRect
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawIRect
- (JNIEnv *env, jobject that, jint ulx, jint uly, jint lrx, jint lry, jint flags)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawIRect\n");
-#endif
-
- return (jint)PgDrawIRect(ulx, uly, lrx, lry, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetMultiClip
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetMultiClip
- (JNIEnv *env, jobject that, jint num, jint clip_list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetMultiClip\n");
-#endif
-
- return (jint)PgSetMultiClip(num, (PhRect_t *)clip_list);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetUserClip
- * Signature: (I)I
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetUserClip__I
- (JNIEnv *env, jobject that, jint ClipRect)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetUserClip\n");
-#endif
-
- PgSetUserClip((PhRect_t *)ClipRect);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetUserClip
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetUserClip__Lorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jobject ClipRect)
-{
- DECL_GLOB(pGlob)
- PhRect_t ClipRect1, *lpClipRect1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetUserClip\n");
-#endif
-
- if (ClipRect) {
- lpClipRect1 = &ClipRect1;
- cachePhRect_tFids(env, ClipRect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, ClipRect, lpClipRect1, &PGLOB(PhRect_tFc));
- }
- PgSetUserClip(lpClipRect1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetDrawBufferSize
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetDrawBufferSize
- (JNIEnv *env, jobject that, jint cmd_buf_len)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetDrawBufferSize\n");
-#endif
-
- return (jint)PgSetDrawBufferSize(cmd_buf_len);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDestroyGC
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDestroyGC
- (JNIEnv *env, jobject that, jint GC)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDestroyGC\n");
-#endif
-
- PgDestroyGC((PhGC_t *)GC);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawImage
- * Signature: (IILorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhDim_t;II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawImage
- (JNIEnv *env, jobject that, jint ptr, jint type, jobject pos, jobject size, jint bpl, jint tag)
-{
- DECL_GLOB(pGlob)
- PhPoint_t pos1, *lpPos1=NULL;
- PhDim_t size1, *lpSize1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawImage\n");
-#endif
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (size) {
- lpSize1 = &size1;
- cachePhDim_tFids(env, size, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, size, lpSize1, &PGLOB(PhDim_tFc));
- }
- return (jint) PgDrawImage((void *)ptr, type, lpPos1, lpSize1, bpl, tag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawTImage
- * Signature: (IILorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhDim_t;IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawTImage
- (JNIEnv *env, jobject that, jint ptr, jint type, jobject pos, jobject size, jint bpl, jint tag, jint TransPtr, jint TransBPL)
-{
- DECL_GLOB(pGlob)
- PhPoint_t pos1, *lpPos1=NULL;
- PhDim_t size1, *lpSize1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawTImage\n");
-#endif
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (size) {
- lpSize1 = &size1;
- cachePhDim_tFids(env, size, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, size, lpSize1, &PGLOB(PhDim_tFc));
- }
- return (jint) PgDrawTImage((void *)ptr, type, lpPos1, lpSize1, bpl, tag, (void *)TransPtr, TransBPL);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PiCropImage
- * Signature: (ILorg/eclipse/swt/photon/PhRect_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PiCropImage
- (JNIEnv *env, jobject that, jint image, jobject bounds, jint flags)
-{
- DECL_GLOB(pGlob)
- PhRect_t bounds1, *lpBounds1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PiCropImage\n");
-#endif
-
- if (bounds) {
- lpBounds1 = &bounds1;
- cachePhRect_tFids(env, bounds, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, bounds, lpBounds1, &PGLOB(PhRect_tFc));
- }
- return (jint) PiCropImage((PhImage_t *)image, lpBounds1, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawBitmap
- * Signature: (IILorg/eclipse/swt/photon/PhPoint_t;Lorg/eclipse/swt/photon/PhDim_t;II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawBitmap
- (JNIEnv *env, jobject that, jint ptr, jint flags, jobject pos, jobject size, jint bpl, jint tag)
-{
- DECL_GLOB(pGlob)
- PhPoint_t pos1, *lpPos1=NULL;
- PhDim_t size1, *lpSize1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawBitmap\n");
-#endif
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (size) {
- lpSize1 = &size1;
- cachePhDim_tFids(env, size, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, size, lpSize1, &PGLOB(PhDim_tFc));
- }
- return (jint) PgDrawBitmap((void *)ptr, flags, lpPos1, (PhPoint_t *)lpSize1, bpl, tag);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawPhImageRectmx
- * Signature: (Lorg/eclipse/swt/photon/PhPoint_t;ILorg/eclipse/swt/photon/PhRect_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawPhImageRectmx
- (JNIEnv *env, jobject that, jobject pos, int image, jobject rect, jint flags)
-{
- DECL_GLOB(pGlob)
- PhPoint_t pos1, *lpPos1=NULL;
- PhRect_t rect1, *lpRect1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawPhImageRectmx\n");
-#endif
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- return (jint) PgDrawPhImageRectmx(lpPos1, (PhImage_t *)image, lpRect1, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawPhImagemx
- * Signature: (Lorg/eclipse/swt/photon/PhPoint_t;ILorg/eclipse/swt/photon/PhRect_t;I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawPhImagemx
- (JNIEnv *env, jobject that, jobject pos, int image, jint flags)
-{
- DECL_GLOB(pGlob)
- PhPoint_t pos1, *lpPos1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawPhImagemx\n");
-#endif
-
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PgDrawPhImagemx(lpPos1, (PhImage_t *)image, flags);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhBlit
- * Signature: (ILorg/eclipse/swt/photon/PhRect_t;ILorg/eclipse/swt/photon/PhPoint_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhBlit
- (JNIEnv *env, jobject that, jint rid, jobject rect, jobject offset)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
- PhPoint_t offset1, *lpOffset1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhBlit\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- if (offset) {
- lpOffset1 = &offset1;
- cachePhPoint_tFids(env, offset, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, offset, lpOffset1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PhBlit((PhRid_t)rid, lpRect1, lpOffset1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhMakeTransBitmap
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhMakeTransBitmap
- (JNIEnv *env, jobject that, jint image, jint trans_color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhMakeTransBitmap\n");
-#endif
-
- return (jint) PhMakeTransBitmap((PhImage_t *)image, (PgColor_t)trans_color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtEnter
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtEnter
- (JNIEnv *env, jobject that, jint flags)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtEnter\n");
-#endif
-
- return (jint)PtEnter(flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtLeave
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtLeave
- (JNIEnv *env, jobject that, jint flags)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtLeave\n");
-#endif
-
- return (jint)PtLeave(flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGetResources
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGetResources
- (JNIEnv *env, jobject that, jint widget, jint n_args, jintArray args)
-{
- jint *args1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGetResources\n");
-#endif
-
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
-
- result = (jint)PtGetResources((PtWidget_t *)widget, n_args, (PtArg_t *)args1);
-
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtDestroyWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtDestroyWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtDestroyWidget\n");
-#endif
-
- return (jint)PtDestroyWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhEventPeek
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhEventPeek
- (JNIEnv *env, jobject that, jint buffer, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhEventPeek\n");
-#endif
-
- return (jint)PhEventPeek((void *)buffer, size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhEventNext
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhEventNext
- (JNIEnv *env, jobject that, jint buffer, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhEventNext\n");
-#endif
-
- return (jint)PhEventNext((void *)buffer, size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhGetMsgSize
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhGetMsgSize
- (JNIEnv *env, jobject that, jint event_buf)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhGetMsgSize\n");
-#endif
-
- return (jint)PhGetMsgSize((PhEvent_t *)event_buf);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhGetTile
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhGetTile
- (JNIEnv *env, jobject that)
-{
- PhTile_t *tile;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhGetTile\n");
-#endif
-
- tile = PhGetTile();
- memset(tile, 0, sizeof(PhTile_t));
- return (jint)tile;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhTranslateTiles
- * Signature: (ILorg/eclipse/swt/internal/photon/PhPoint_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhTranslateTiles
- (JNIEnv *env, jobject that, jint tile, jobject point_add)
-{
-
- DECL_GLOB(pGlob)
-
- PhPoint_t point_add1, *lpPoint_add1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhTranslateTiles\n");
-#endif
-
- if (point_add) {
- lpPoint_add1= &point_add1;
- cachePhPoint_tFids(env, point_add, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, point_add, lpPoint_add1, &PGLOB(PhPoint_tFc));
- }
- result = (jint)PhTranslateTiles((PhTile_t *)tile, lpPoint_add1);
-
- if (point_add) {
- setPhPoint_tFields(env, point_add, lpPoint_add1, &PGLOB(PhPoint_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhDeTranslateTiles
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhDeTranslateTiles
- (JNIEnv *env, jobject that, jint tile, jint point_sutract)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhDeTranslateTiles\n");
-#endif
-
- return (jint)PhDeTranslateTiles((PhTile_t *)tile, (PhPoint_t *)point_sutract);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhAddMergeTiles
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhAddMergeTiles
- (JNIEnv *env, jobject that, jint tiles, jint add_tiles, jintArray added)
-{
- jint *added1 = NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhAddMergeTiles\n");
-#endif
-
- if (added)
- added1 = (*env)->GetIntArrayElements(env, added, NULL);
-
- result = (jint)PhAddMergeTiles((PhTile_t *)tiles, (PhTile_t *)add_tiles, added1);
-
- if (added)
- (*env)->ReleaseIntArrayElements(env, added, added1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhIntersectTilings
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhIntersectTilings
- (JNIEnv *env, jobject that, jint tile1, jint tile2, jshortArray num_intersect_tiles)
-{
- jshort *num_intersect_tiles1 = NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhIntersectTilings\n");
-#endif
-
- if (num_intersect_tiles)
- num_intersect_tiles1 = (*env)->GetShortArrayElements(env, num_intersect_tiles, NULL);
-
- result = (jint)PhIntersectTilings((PhTile_t *)tile1, (PhTile_t *)tile2, num_intersect_tiles1);
-
- if (num_intersect_tiles)
- (*env)->ReleaseShortArrayElements(env, num_intersect_tiles, num_intersect_tiles1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhCoalesceTiles
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhCoalesceTiles
- (JNIEnv *env, jobject that, jint tiles)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhCoalesceTiles\n");
-#endif
-
- return (jint)PhCoalesceTiles((PhTile_t *)tiles);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhMergeTiles
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhMergeTiles
- (JNIEnv *env, jobject that, jint tiles)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhMergeTiles\n");
-#endif
-
- return (jint)PhMergeTiles((PhTile_t *)tiles);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhRectUnion
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhRectUnion__II
- (JNIEnv *env, jobject that, jint rect1, jint rect2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhRectUnion__II\n");
-#endif
-
- return (jint)PhRectUnion((PhRect_t *)rect1, (PhRect_t *)rect2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhRectIntersect
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhRectIntersect
- (JNIEnv *env, jobject that, jint rect1, jint rect2)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhRectIntersect\n");
-#endif
-
- return (jint)PhRectIntersect((PhRect_t *)rect1, (PhRect_t *)rect2);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipTilings
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipTilings
- (JNIEnv *env, jobject that, jint tiles, jint clip_tiles, jintArray intersection)
-{
- jint *intersection1 = NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipTilings\n");
-#endif
-
- if (intersection)
- intersection1 = (*env)->GetIntArrayElements(env, intersection, NULL);
-
- result = (jint)PhClipTilings((PhTile_t *)tiles, (PhTile_t *)clip_tiles, (PhTile_t **)intersection1);
-
- if (intersection)
- (*env)->ReleaseIntArrayElements(env, intersection, intersection1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhTilesToRects
- * Signature: (I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhTilesToRects
- (JNIEnv *env, jobject that, jint tiles, jintArray num_rects)
-{
- jint *num_rects1 = NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhTilesToRects\n");
-#endif
-
- if (num_rects)
- num_rects1 = (*env)->GetIntArrayElements(env, num_rects, NULL);
-
- result = (jint)PhTilesToRects((PhTile_t *)tiles, (int *)num_rects1);
-
- if (num_rects)
- (*env)->ReleaseIntArrayElements(env, num_rects, num_rects1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhRectsToTiles
- * Signature: (I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhRectsToTiles
- (JNIEnv *env, jobject that, jint rects, jint num_rects)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhRectsToTiles\n");
-#endif
-
- return (jint)PhRectsToTiles((PhRect_t *)rects, num_rects);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhFreeTiles
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PhFreeTiles
- (JNIEnv *env, jobject that, jint tiles)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhFreeTiles\n");
-#endif
-
- PhFreeTiles((PhTile_t *)tiles);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhCopyTiles
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhCopyTiles
- (JNIEnv *env, jobject that, jint tile)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhCopyTiles\n");
-#endif
-
- return (jint) PhCopyTiles((PhTile_t *)tile);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtEventHandler
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtEventHandler
- (JNIEnv *env, jobject that, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtEventHandler\n");
-#endif
-
- return (jint)PtEventHandler((PhEvent_t *)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: malloc
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_malloc
- (JNIEnv *env, jclass that, jint size)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "malloc\n");
-#endif
-
- return (jint)calloc(1, (size_t)size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: free
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_free
- (JNIEnv *env, jclass that, jint ptr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "free\n");
-#endif
-
- free((void *)ptr);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhPoint_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhPoint_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhPoint_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhPoint_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhPoint_tFids(env, src, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, src, src1, &PGLOB(PhPoint_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhPoint_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhPoint_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhPoint_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhPoint_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhPoint_tFids(env, dest, &PGLOB(PhPoint_tFc));
- setPhPoint_tFields(env, dest, dest1, &PGLOB(PhPoint_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhWindowQueryVisible
- * Signature: (IIILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhWindowQueryVisible
- (JNIEnv *env, jobject that, jint flag, jint rid, jint input_group, jobject rectangle)
-{
- DECL_GLOB(pGlob)
- int result;
- PhRect_t rect, *lpRect=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhWindowQueryVisible\n");
-#endif
-
- if (rectangle) {
- lpRect = &rect;
- cachePhRect_tFids(env, rectangle, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rectangle, lpRect, &PGLOB(PhRect_tFc));
- }
- result =PhWindowQueryVisible(flag, rid, input_group, lpRect);
- if (rectangle) {
- setPhRect_tFields(env, rectangle, lpRect, &PGLOB(PhRect_tFc));
- }
-
- return (jint) result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (I[II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__I_3II
- (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
-{
- jint *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3II\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetIntArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseIntArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: ([III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___3III
- (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
-{
- jint *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3III\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawText
- * Signature: ([CISSI)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawText
- (JNIEnv *env, jclass that, jcharArray ptr, jint len, jshort x, jshort y, jint flags)
-{
- jint result = 0;
- jchar * ptr1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawText\n");
-#endif
-
- if (ptr) {
- PhPoint_t pos;
-
- pos.x = x;
- pos.y = y;
- ptr1 = (*env)->GetCharArrayElements(env, ptr, NULL);
-
- result = (jint)PgDrawText((char *)ptr1, len, &pos, (int)flags);
-
- (*env)->ReleaseCharArrayElements(env, ptr, ptr1, JNI_ABORT);
- }
-
- return result;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawText
- * Signature: ([BISSI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawText
- (JNIEnv *env, jclass that, jbyteArray ptr, jint len, jshort x, jshort y, jint flags)
-{
- jint result = 0;
- jbyte * ptr1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawText\n");
-#endif
-
- /* don't do anything if ptr is NULL */
- if (ptr) {
- PhPoint_t pos;
-
- pos.x = x;
- pos.y = y;
- ptr1 = (*env)->GetByteArrayElements(env, ptr, NULL);
-
- result = (jint)PgDrawText((char *)ptr1, len, &pos, (int)flags);
-
- (*env)->ReleaseByteArrayElements(env, ptr, ptr1, JNI_ABORT);
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawMultiTextArea
- * Signature: ([BILorg/eclipse/swt/photon/PhRect_t;III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawMultiTextArea
- (JNIEnv *env, jclass that, jbyteArray ptr, jint len, jobject canvas, jint text_flags, jint canvas_flags, int linespacing)
-{
- DECL_GLOB(pGlob)
- jint result = 0;
- jbyte * ptr1 = NULL;
- PhRect_t canvas1, *lpCanvas1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawMultiTextArea\n");
-#endif
-
- /* don't do anything if ptr is NULL */
- if (!ptr) return 0;
-
- if (canvas) {
- lpCanvas1 = &canvas1;
- cachePhRect_tFids(env, canvas, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, canvas, lpCanvas1, &PGLOB(PhRect_tFc));
- }
- ptr1 = (*env)->GetByteArrayElements(env, ptr, NULL);
-
- result = (jint)PgDrawMultiTextArea((char *)ptr1, len, lpCanvas1, text_flags, canvas_flags, linespacing);
-
- (*env)->ReleaseByteArrayElements(env, ptr, ptr1, JNI_ABORT);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetExtent
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetExtent__II
- (JNIEnv *env, jobject that, jint widget, jint extent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetExtent\n");
-#endif
-
- return (jint)PtWidgetExtent((PtWidget_t *)widget, (PhRect_t *)extent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetChildBack
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetChildBack
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetChildBack\n");
-#endif
-
- return (jint)PtWidgetChildBack((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetIsRealized
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetIsRealized
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetIsRealized\n");
-#endif
-
- return (jint)PtWidgetIsRealized((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetBrotherInFront
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetBrotherInFront
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetBrotherInFront\n");
-#endif
-
- return (jint)PtWidgetBrotherInFront((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetParent
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetParent
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetParent\n");
-#endif
-
- return (jint)PtWidgetParent((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhTile_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhTile_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhTile_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhTile_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhTile_tFids(env, src, &PGLOB(PhTile_tFc));
- getPhTile_tFields(env, src, src1, &PGLOB(PhTile_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhTile_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhTile_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhTile_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhTile_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhTile_tFids(env, dest, &PGLOB(PhTile_tFc));
- setPhTile_tFields(env, dest, dest1, &PGLOB(PhTile_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PtCallbackInfo_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PtCallbackInfo_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PtCallbackInfo_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PtCallbackInfo_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePtCallbackInfo_tFids(env, src, &PGLOB(PtCallbackInfo_tFc));
- getPtCallbackInfo_tFields(env, src, src1, &PGLOB(PtCallbackInfo_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PtCallbackInfo_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PtCallbackInfo_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PtCallbackInfo_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PtCallbackInfo_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePtCallbackInfo_tFids(env, dest, &PGLOB(PtCallbackInfo_tFc));
- setPtCallbackInfo_tFields(env, dest, dest1, &PGLOB(PtCallbackInfo_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhWindowEvent_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhWindowEvent_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhWindowEvent_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhWindowEvent_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhWindowEvent_tFids(env, src, &PGLOB(PhWindowEvent_tFc));
- getPhWindowEvent_tFields(env, src, src1, &PGLOB(PhWindowEvent_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhWindowEvent_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhWindowEvent_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhWindowEvent_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhWindowEvent_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhWindowEvent_tFids(env, dest, &PGLOB(PhWindowEvent_tFc));
- setPhWindowEvent_tFields(env, dest, dest1, &PGLOB(PhWindowEvent_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAddCallback
- * Signature: (IIII)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAddCallback
- (JNIEnv *env, jobject that, jint widget, jint callback_type, jint callback, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAddEventHandler\n");
-#endif
-
- PtAddCallback((PtWidget_t *)widget, (unsigned long)callback_type, (PtCallbackF_t *)callback, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetChildFront
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetChildFront
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetChildFront\n");
-#endif
-
- return (jint) PtWidgetChildFront((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetBrotherBehind
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetBrotherBehind
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetBrotherBehind\n");
-#endif
-
- return (jint) PtWidgetBrotherBehind((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (I[BI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__I_3BI
- (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
-{
- jbyte *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3BI\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetByteArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseByteArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: ([BII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___3BII
- (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
-{
- jbyte *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BII\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindow
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtButton
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtButton\n");
-#endif
-
- return (jint)PtButton;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhRect_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhRect_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhPoint_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhRect_tFids(env, src, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, src, src1, &PGLOB(PhRect_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhRect_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhRect_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhPoint_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhRect_tFids(env, dest, &PGLOB(PhRect_tFc));
- setPhRect_tFields(env, dest, dest1, &PGLOB(PhRect_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtUnrealizeWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtUnrealizeWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtUnrealizeWidget\n");
-#endif
-
- return (jint)PtUnrealizeWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSyncWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSyncWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSyncWidget\n");
-#endif
-
- return (jint)PtSyncWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtFlush
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFlush
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtFlush\n");
-#endif
-
- return (jint)PtFlush();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerGiveFocus
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerGiveFocus
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerGiveFocus\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtContainerGiveFocus((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerFocusNext
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerFocusNext
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerFocusNext\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtContainerFocusNext((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerFocusPrev
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerFocusPrev
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerFocusPrev\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtContainerFocusPrev((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGlobalFocusNext
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGlobalFocusNext
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGlobalFocusNext\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtGlobalFocusNext((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGlobalFocusPrev
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGlobalFocusPrev
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGlobalFocusPrev\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtGlobalFocusPrev((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGlobalFocusNextContainer
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGlobalFocusNextContainer
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGlobalFocusNextContainer\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtGlobalFocusNextContainer((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGlobalFocusPrevContainer
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGlobalFocusPrevContainer
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGlobalFocusPrevContainer\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- result = (jint) PtGlobalFocusPrevContainer((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetToFront
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetToFront
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetToFront\n");
-#endif
-
- return (jint) PtWidgetToFront((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetToBack
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetToBack
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetToBack\n");
-#endif
-
- return (jint) PtWidgetToBack((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetInsert
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetInsert
- (JNIEnv *env, jobject that, jint widget, jint new_sibling, jint behind)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetInsert\n");
-#endif
-
- return (jint) PtWidgetInsert((PtWidget_t *)widget, (PtWidget_t *)new_sibling, behind);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtDamageExtent
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtDamageExtent
- (JNIEnv *env, jobject that, jint widget, jobject extent)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerGiveFocus\n");
-#endif
-
- if (extent) {
- lpObject = &object;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpObject, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtDamageExtent((PtWidget_t *)widget, lpObject);
- if (extent) {
- setPhRect_tFields(env, extent, lpObject, &PGLOB(PhRect_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__III
- (JNIEnv *env, jobject that, jint dest, jint src, jint size)
-{
- return (jint)memmove((void *)dest, (void *)src, size);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfQueryFontInfo
- * Signature: ([BLorg/eclipse/swt/internal/photon/FontQueryInfo;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfQueryFontInfo
- (JNIEnv *env, jobject that, jbyteArray font, jobject info)
-{
- DECL_GLOB(pGlob)
- jbyte *font1=NULL;
- FontQueryInfo info1, *lpInfo1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfQueryFontInfo\n");
-#endif
-
- if (font)
- font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (info) {
- lpInfo1 = &info1;
- cacheFontQueryInfoFids(env, info, &PGLOB(FontQueryInfoFc));
- getFontQueryInfoFields(env, info, lpInfo1, &PGLOB(FontQueryInfoFc));
- }
-
- result = (jint)PfQueryFontInfo(font1, lpInfo1);
-
- if (font)
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- if (info) {
- setFontQueryInfoFields(env, info, lpInfo1, &PGLOB(FontQueryInfoFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfQueryFonts
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfQueryFonts
- (JNIEnv *env, jobject that, jint symbol, jint flags, jint list, jint n)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfQueryFonts\n");
-#endif
-
- return (jint)PfQueryFonts(symbol, flags, (FontDetails *)list, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfExtentWideText
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhPoint_t;[B[CI)Lorg/eclipse/swt/internal/photon/PhRect_t;
- */
-JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PfExtentWideText
- (JNIEnv *env, jobject that, jobject extent, jobject pos, jbyteArray font, jcharArray str, jint len)
-{
- DECL_GLOB(pGlob)
- PhRect_t extent1, *lpExtent1=NULL;
- PhPoint_t pos1, *lpPos1=NULL;
- jbyte *font1=NULL;
- jchar *str1=NULL;
- PhRect_t * result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfExtentWideText\n");
-#endif
-
- if (extent) {
- lpExtent1 = &extent1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (str)
- str1 = (*env)->GetCharArrayElements(env, str, NULL);
-
- result = PfExtentWideText(lpExtent1, lpPos1, font1, str1, len);
-
- if (extent) {
- setPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- if (str)
- (*env)->ReleaseCharArrayElements(env, str, str1, JNI_ABORT);
-
- return result != NULL ? extent : NULL;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgExtentMultiText
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhPoint_t;[B[BII)Lorg/eclipse/swt/internal/photon/PhRect_t;
- */
-JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PgExtentMultiText
- (JNIEnv *env, jobject that, jobject extent, jobject pos, jbyteArray font, jbyteArray str, jint n, int linespacing)
-{
- DECL_GLOB(pGlob)
- PhRect_t extent1, *lpExtent1=NULL;
- PhPoint_t pos1, *lpPos1=NULL;
- jbyte *font1=NULL;
- jbyte *str1=NULL;
- PhRect_t * result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgExtentMultiText\n");
-#endif
-
- if (extent) {
- lpExtent1 = &extent1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = PgExtentMultiText(lpExtent1, lpPos1, font1, str1, n, linespacing);
-
- if (extent) {
- setPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return result != NULL ? extent : NULL;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfExtentText
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhPoint_t;[B[BI)Lorg/eclipse/swt/internal/photon/PhRect_t;
- */
-JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PfExtentText__Lorg_eclipse_swt_internal_photon_PhRect_1t_2Lorg_eclipse_swt_internal_photon_PhPoint_1t_2_3B_3BI
- (JNIEnv *env, jclass that, jobject extent, jobject pos, jbyteArray font, jbyteArray str, jint len)
-{
- DECL_GLOB(pGlob)
- PhRect_t extent1, *lpExtent1=NULL;
- PhPoint_t pos1, *lpPos1=NULL;
- jbyte *str1=NULL;
- jbyte *font1=NULL;
- PhRect_t * result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfExtentText\n");
-#endif
-
- if (extent) {
- lpExtent1 = &extent1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = PfExtentText(lpExtent1, lpPos1, font1, str1, len);
-
- if (extent) {
- setPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (font)
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return result != NULL ? extent : NULL;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfExtentText
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhPoint_t;III)Lorg/eclipse/swt/internal/photon/PhRect_t;
- */
-JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PfExtentText__Lorg_eclipse_swt_internal_photon_PhRect_1t_2Lorg_eclipse_swt_internal_photon_PhPoint_1t_2III
- (JNIEnv *env, jclass that, jobject extent, jobject pos, jint font, jint str, jint len)
-{
- DECL_GLOB(pGlob)
- PhRect_t extent1, *lpExtent1=NULL;
- PhPoint_t pos1, *lpPos1=NULL;
- PhRect_t * result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfExtentText\n");
-#endif
-
- if (extent) {
- lpExtent1 = &extent1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- lpPos1 = &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
-
- result = PfExtentText(lpExtent1, lpPos1, (char *)font, (char *)str, len);
-
- if (extent) {
- setPhRect_tFields(env, extent, lpExtent1, &PGLOB(PhRect_tFc));
- }
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
-
- return result != NULL ? extent : NULL;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhDim_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhDim_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhDim_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhDim_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhDim_tFids(env, src, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, src, src1, &PGLOB(PhDim_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhDim_t;II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhDim_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhDim_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhDim_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhDim_tFids(env, dest, &PGLOB(PhDim_tFc));
- setPhDim_tFields(env, dest, dest1, &PGLOB(PhDim_tFc));
- }
-
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhImage_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhImage_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhImage_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhImage_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhImage_tFids(env, src, &PGLOB(PhImage_tFc));
- getPhImage_tFields(env, src, src1, &PGLOB(PhImage_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhImage_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhImage_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhImage_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhImage_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhImage_tFids(env, dest, &PGLOB(PhImage_tFc));
- setPhImage_tFields(env, dest, dest1, &PGLOB(PhImage_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhCreateImage
- * Signature: (Lorg/eclipse/swt/photon/PhImage_t;SSI[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhCreateImage__Lorg_eclipse_swt_internal_photon_PhImage_1t_2SSI_3III
- (JNIEnv *env, jobject that, jobject buffer, jshort width, jshort height, jint type, jintArray palette, jint ncolors, jint tag)
-{
- DECL_GLOB(pGlob)
- jint result;
- jint *palette1 = NULL;
- PhImage_t buffer1, *lpBuffer1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhCreateImage\n");
-#endif
-
- if (buffer) {
- lpBuffer1 = &buffer1;
- cachePhImage_tFids(env, buffer, &PGLOB(PhImage_tFc));
- getPhImage_tFields(env, buffer, lpBuffer1, &PGLOB(PhImage_tFc));
- }
- if (palette)
- palette1 = (*env)->GetIntArrayElements(env, palette, NULL);
-
- result = (jint)PhCreateImage(lpBuffer1, width, height, type, (PgColor_t *)palette1, ncolors, tag);
-
- if (buffer) {
- setPhImage_tFields(env, buffer, lpBuffer1, &PGLOB(PhImage_tFc));
- }
- if (palette)
- (*env)->ReleaseIntArrayElements(env, palette, palette1, JNI_ABORT);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhCreateImage
- * Signature: (Lorg/eclipse/swt/photon/PhImage_t;SSIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhCreateImage__Lorg_eclipse_swt_internal_photon_PhImage_1t_2SSIIII
- (JNIEnv *env, jobject that, jobject buffer, jshort width, jshort height, jint type, jint palette, jint ncolors, jint tag)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhImage_t buffer1, *lpBuffer1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhCreateImage\n");
-#endif
-
- if (buffer) {
- lpBuffer1 = &buffer1;
- cachePhImage_tFids(env, buffer, &PGLOB(PhImage_tFc));
- getPhImage_tFields(env, buffer, lpBuffer1, &PGLOB(PhImage_tFc));
- }
-
- result = (jint)PhCreateImage(lpBuffer1, width, height, type, (PgColor_t *)palette, ncolors, tag);
-
- if (buffer) {
- setPhImage_tFields(env, buffer, lpBuffer1, &PGLOB(PhImage_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhReleaseImage
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PhReleaseImage
- (JNIEnv *env, jobject that, jint image)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhReleaseImage\n");
-#endif
-
- PhReleaseImage((PhImage_t *)image);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PmMemCreateMC
- * Signature: (ILorg/eclipse/swt/photon/PhDim_t;Lorg/eclipse/swt/photon/PhPoint_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PmMemCreateMC
- (JNIEnv *env, jobject that, jint image, jobject dim, jobject translation)
-{
- DECL_GLOB(pGlob)
- PhDim_t dim1, *lpDim1=NULL;
- PhPoint_t translation1, *lpTranslation1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PmMemCreateMC\n");
-#endif
-
- if (dim) {
- lpDim1 = &dim1;
- cachePhDim_tFids(env, dim, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, dim, lpDim1, &PGLOB(PhDim_tFc));
- }
- if (translation) {
- lpTranslation1 = &translation1;
- cachePhPoint_tFids(env, translation, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, translation, lpTranslation1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PmMemCreateMC((PhImage_t *)image, lpDim1, lpTranslation1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PmMemReleaseMC
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PmMemReleaseMC
- (JNIEnv *env, jobject that, jint mc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PmMemReleaseMC\n");
-#endif
-
- PmMemReleaseMC((PmMemoryContext_t *)mc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PmMemStart
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PmMemStart
- (JNIEnv *env, jobject that, jint mc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PmMemStart\n");
-#endif
-
- return (jint)PmMemStart((PmMemoryContext_t *)mc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PmMemStop
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PmMemStop
- (JNIEnv *env, jobject that, jint mc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PmMemStop\n");
-#endif
-
- return (jint)PmMemStop((PmMemoryContext_t *)mc);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PmMemFlush
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PmMemFlush
- (JNIEnv *env, jobject that, jint mc, jint image)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PmMemFlush\n");
-#endif
-
- return (jint)PmMemFlush((PmMemoryContext_t *)mc, (PhImage_t *)image);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtCreateWidgetClass
- * Signature: (III[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtCreateWidgetClass
- (JNIEnv *env, jobject that, jint superclass_ref, jint size, jint n_args, jintArray args)
-{
- jint *args1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtCreateWidgetClass\n");
-#endif
-
- if (args)
- args1 = (*env)->GetIntArrayElements(env, args, NULL);
-
- result = (jint)PtCreateWidgetClass((PtWidgetClassRef_t *)superclass_ref, size, n_args, (PtArg_t *)args1);
-
- if (args)
- (*env)->ReleaseIntArrayElements(env, args, args1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSuperClassDraw
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSuperClassDraw
- (JNIEnv *env, jobject that, jint wc_ref, jint widget, jint damage)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSuperClassDraw\n");
-#endif
-
- PtSuperClassDraw((PtWidgetClassRef_t *) wc_ref, (PtWidget_t *)widget, (PhTile_t *)damage);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtToggleButton
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtToggleButton
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtToggleButton\n");
-#endif
-
- return (jint)PtToggleButton;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtOnOffButton
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtOnOffButton
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtOnOffButton\n");
-#endif
-
- return (jint)PtOnOffButton;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtOnOffButton
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtComboBox
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtComboBox\n");
-#endif
-
- return (jint)PtComboBox;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtText
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtText
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtText\n");
-#endif
-
- return (jint)PtText;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtMultiText
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtMultiText
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtMultiText\n");
-#endif
-
- return (jint)PtMultiText;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtMenu
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtMenu
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtMenu\n");
-#endif
-
- return (jint)PtMenu;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtMenuBar
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtMenuBar
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtMenuBar\n");
-#endif
-
- return (jint)PtMenuBar;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtMenuButton
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtMenuButton
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtMenuButton\n");
-#endif
-
- return (jint)PtMenuButton;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtScrollbar
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtScrollbar
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtScrollbar\n");
-#endif
-
- return (jint)PtScrollbar;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSeparator
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSeparator
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSeparator\n");
-#endif
-
- return (jint)PtSeparator;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListAddItems
- * Signature: (I[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListAddItems
- (JNIEnv *env, jobject that, jint widget, jintArray items, jint item_count, jint position)
-{
- jint *items1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListAddItems\n");
-#endif
-
- if (items)
- items1 = (*env)->GetIntArrayElements(env, items, NULL);
-
- result = (jint)PtListAddItems((PtWidget_t *)widget, (void *)items1, item_count, position);
-
- if (items)
- (*env)->ReleaseIntArrayElements(env, items, items1, 0);
-
- return result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListUnselectPos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListUnselectPos
- (JNIEnv *env, jobject that, jint widget, jint pos)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListUnselectPos\n");
-#endif
-
- PtListUnselectPos((PtWidget_t *)widget, pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (I[SI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__I_3SI
- (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
-{
- jshort *src1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__I_3SI\n");
-#endif
-
- /* don't do anything if src pointer is NULL */
- if (src) {
- src1 = (*env)->GetShortArrayElements(env, src, NULL);
- memmove((void *)dest, (void *)src1, count);
- (*env)->ReleaseShortArrayElements(env, src, src1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: ([SII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___3SII
- (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
-{
- jshort *dest1;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3SII\n");
-#endif
-
- /* don't do anything if dest pointer is NULL */
- if (dest) {
- dest1 = (*env)->GetShortArrayElements(env, dest, NULL);
- memmove((void *)dest1, (void *)src, count);
- (*env)->ReleaseShortArrayElements(env, dest, dest1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: strlen
- * Signature: (II)V
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_photon_OS_strlen
- (JNIEnv *env, jobject that, jint string)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "strlen\n");
-#endif
-
- return (jint) strlen((char *) string);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListDeleteItemPos
- * Signature: (III)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListDeleteItemPos
- (JNIEnv *env, jobject that, jint widget, jint item_count, jint position)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListDeleteItemPos\n");
-#endif
-
- PtListDeleteItemPos((PtWidget_t *)widget, item_count, position);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListDeleteAllItems
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListDeleteAllItems
- (JNIEnv *env, jobject that, jint widget)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListDeleteAllItems\n");
-#endif
-
- PtListDeleteAllItems((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListSelectPos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListSelectPos
- (JNIEnv *env, jobject that, jint widget, jint pos)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListSelectPos\n");
-#endif
-
- PtListSelectPos((PtWidget_t *)widget, pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListReplaceItemPos
- * Signature: (I[III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListReplaceItemPos
- (JNIEnv *env, jobject that, jint widget, jintArray items, jint item_count, jint position)
-{
- jint *items1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListReplaceItemPos\n");
-#endif
-
- if (items)
- items1 = (*env)->GetIntArrayElements(env, items, NULL);
-
- result = (jint)PtListReplaceItemPos((PtWidget_t *)widget, (void *)items1, item_count, position);
-
- if (items)
- (*env)->ReleaseIntArrayElements(env, items, items1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListGotoPos
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListGotoPos
- (JNIEnv *env, jobject that, jint widget, jint pos)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListGotoPos\n");
-#endif
-
- PtListGotoPos((PtWidget_t *)widget, pos);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtListItemPos
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtListItemPos
- (JNIEnv *env, jobject that, jint widget, jbyteArray item)
-{
- char *item1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtListItemPos\n");
-#endif
-
- if (item)
- item1 = (char *)(*env)->GetByteArrayElements(env, item, NULL);
-
- result = PtListItemPos((PtWidget_t *)widget, item1);
-
- if (item)
- (*env)->ReleaseByteArrayElements(env, item, (jbyte *)item1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTextModifyText
- * Signature: (IIII[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTextModifyText__IIII_3BI
- (JNIEnv *env, jobject that, jint widget, jint start, jint end, jint insert_pos, jbyteArray text, jint length)
-{
- char *text1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTextModifyText\n");
-#endif
-
- if (text)
- text1 = (char *)(*env)->GetByteArrayElements(env, text, NULL);
-
- result = (jint)PtTextModifyText((PtWidget_t *)widget, start, end, insert_pos, text1, length);
-
- if (text)
- (*env)->ReleaseByteArrayElements(env, text, (jbyte *)text1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTextModifyText
- * Signature: (IIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTextModifyText__IIIIII
- (JNIEnv *env, jobject that, jint widget, jint start, jint end, jint insert_pos, jint text, jint length)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTextModifyText\n");
-#endif
-
- return (jint)PtTextModifyText((PtWidget_t *)widget, start, end, insert_pos, (char *)text, length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTextGetSelection
- * Signature: (I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTextGetSelection
- (JNIEnv *env, jobject that, jint widget, jintArray start, jintArray end)
-{
- int *start1=NULL, *end1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTextGetSelection\n");
-#endif
-
- if (start)
- start1 = (int *)(*env)->GetIntArrayElements(env, start, NULL);
- if (end)
- end1 = (int *)(*env)->GetIntArrayElements(env, end, NULL);
-
- result = (jint)PtTextGetSelection((PtWidget_t *)widget, start1, end1);
-
- if (start)
- (*env)->ReleaseIntArrayElements(env, start, (jint *)start1, 0);
- if (end)
- (*env)->ReleaseIntArrayElements(env, end, (jint *)end1, 0);
-
- return result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTextSetSelection
- * Signature: (I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTextSetSelection
- (JNIEnv *env, jobject that, jint widget, jintArray start, jintArray end)
-{
- int *start1=NULL, *end1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTextSetSelection\n");
-#endif
-
- if (start)
- start1 = (int *)(*env)->GetIntArrayElements(env, start, NULL);
- if (end)
- end1 = (int *)(*env)->GetIntArrayElements(env, end, NULL);
-
- result = (jint)PtTextSetSelection((PtWidget_t *)widget, start1, end1);
-
- if (start)
- (*env)->ReleaseIntArrayElements(env, start, (jint *)start1, 0);
- if (end)
- (*env)->ReleaseIntArrayElements(env, end, (jint *)end1, 0);
-
- return result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtPositionMenu
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtPositionMenu
- (JNIEnv *env, jobject that, jint widget, jobject event)
-{
- DECL_GLOB(pGlob)
- PhEvent_t object, *lpObject=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtPositionMenu\n");
-#endif
- if (event) {
- lpObject = &object;
- cachePhEvent_tFids(env, event, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
- PtPositionMenu((PtWidget_t *)widget, lpObject);
- if (event) {
- setPhEvent_tFields(env, event, lpObject, &PGLOB(PhEvent_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtReParentWidget
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtReParentWidget
- (JNIEnv *env, jobject that, jint widget, jint parent)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtReParentWidget\n");
-#endif
-
- return (jint) PtReParentWidget((PtWidget_t *)widget, (PtWidget_t *)parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtForwardWindowEvent
- * Signature: (Lorg/eclipse/swt/internal/photon/PhWindowEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtForwardWindowEvent
- (JNIEnv *env, jobject that, jobject event)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhWindowEvent_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtForwardWindowEvent\n");
-#endif
-
- if (event) {
- lpObject = &object;
- cachePhWindowEvent_tFids(env, event, &PGLOB(PhWindowEvent_tFc));
- getPhWindowEvent_tFields(env, event, lpObject, &PGLOB(PhWindowEvent_tFc));
- }
- result = (jint) PtForwardWindowEvent(lpObject);
- if (event) {
- setPhWindowEvent_tFields(env, event, lpObject, &PGLOB(PhWindowEvent_tFc));
- }
-
- return result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetOffset
- * Signature: (ILorg/eclipse/swt/internal/photon/PhPoint_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetOffset
- (JNIEnv *env, jobject that, jint widget, jobject offset)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhPoint_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetOffset\n");
-#endif
-
- if (offset) {
- lpObject = &object;
- cachePhPoint_tFids(env, offset, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, offset, lpObject, &PGLOB(PhPoint_tFc));
- }
- result = (jint) PtWidgetOffset((PtWidget_t *)widget, lpObject);
- if (offset) {
- setPhPoint_tFields(env, offset, lpObject, &PGLOB(PhPoint_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtRemoveCallback
- * Signature: (IIII)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtRemoveCallback
- (JNIEnv *env, jobject that, jint widget, jint callback_type, jint callback, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtRemoveCallback\n");
-#endif
-
- PtRemoveCallback((PtWidget_t *)widget, (unsigned long)callback_type, (PtCallbackF_t *)callback, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindow
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtScrollContainer
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtScrollContainer\n");
-#endif
-
- return (jint)PtScrollContainer;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetCanvas
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetCanvas__II
- (JNIEnv *env, jobject that, jint widget, jint canvas_rect)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetCanvas\n");
-#endif
-
- return (jint) PtWidgetCanvas((PtWidget_t *)widget, (PhRect_t *)canvas_rect);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetCanvas
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetCanvas__ILorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jint widget, jobject canvas_rect)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetCanvas\n");
-#endif
-
- if (canvas_rect) {
- lpObject = &object;
- cachePhRect_tFids(env, canvas_rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtWidgetCanvas((PtWidget_t *)widget, lpObject);
- if (canvas_rect) {
- setPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtLabelWidgetCanvas
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtLabelWidgetCanvas__ILorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jint widget, jobject canvas_rect)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtLabelWidgetCanvas\n");
-#endif
-
- if (canvas_rect) {
- lpObject = &object;
- cachePhRect_tFids(env, canvas_rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtLabelWidgetCanvas((PtWidget_t *)widget, lpObject);
- if (canvas_rect) {
- setPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetClass
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetClass
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetClass\n");
-#endif
-
- return (jint) PtWidgetClass ((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhPointerEvent_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhPointerEvent_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhPointerEvent_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhPointerEvent_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhPointerEvent_tFids(env, src, &PGLOB(PhPointerEvent_tFc));
- getPhPointerEvent_tFields(env, src, src1, &PGLOB(PhPointerEvent_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhPointerEvent_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhPointerEvent_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhPointerEvent_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhPointerEvent_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhPointerEvent_tFids(env, dest, &PGLOB(PhPointerEvent_tFc));
- setPhPointerEvent_tFields(env, dest, dest1, &PGLOB(PhPointerEvent_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhGetData
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhGetData
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhGetData\n");
-#endif
-
- return (jint)PhGetData((PhEvent_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhGetRects
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhGetRects
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhGetRects\n");
-#endif
-
- return (jint)PhGetRects((PhEvent_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhEvent_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhEvent_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhEvent_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhEvent_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhEvent_tFids(env, dest, &PGLOB(PhEvent_tFc));
- setPhEvent_tFields(env, dest, dest1, &PGLOB(PhEvent_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhEvent_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhEvent_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhEvent_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhEvent_tFids(env, src, &PGLOB(PhEvent_tFc));
- getPhEvent_tFields(env, src, src1, &PGLOB(PhEvent_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtExtentWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtExtentWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtExtentWidget\n");
-#endif
-
- return (jint)PtExtentWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtExtentWidgetFamily
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtExtentWidgetFamily
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtExtentWidgetFamily\n");
-#endif
-
- return (jint)PtExtentWidgetFamily((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGetAbsPosition
- * Signature: ([S[S)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGetAbsPosition
- (JNIEnv *env, jobject that, jint widget, jshortArray x, jshortArray y)
-{
- jshort *x1=NULL, *y1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGetAbsPosition\n");
-#endif
-
- if (x)
- x1 = (*env)->GetShortArrayElements(env, x, NULL);
- if (y)
- y1 = (*env)->GetShortArrayElements(env, y, NULL);
-
- PtGetAbsPosition((PtWidget_t *)widget, x1, y1);
-
- if (x)
- (*env)->ReleaseShortArrayElements(env, x, x1, 0);
- if (y)
- (*env)->ReleaseShortArrayElements(env, y, y1, 0);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSetAreaFromExtent
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhArea_t;)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSetAreaFromExtent
- (JNIEnv *env, jobject that, jint widget, jobject extent, jobject area)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object1, *lpObject1=NULL;
- PhArea_t object2, *lpObject2=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSetAreaFromExtent\n");
-#endif
-
- if (extent) {
- lpObject1 = &object1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpObject1, &PGLOB(PhRect_tFc));
- }
- if (area) {
- lpObject2 = &object2;
- cachePhArea_tFids(env, area, &PGLOB(PhArea_tFc));
- getPhArea_tFields(env, area, lpObject2, &PGLOB(PhArea_tFc));
- }
- result = (jint) PtSetAreaFromExtent((PtWidget_t *)widget, lpObject1, (PhArea_t *)lpObject2);
- if (extent) {
- setPhRect_tFields(env, extent, lpObject1, &PGLOB(PhRect_tFc));
- }
- if (area) {
- setPhArea_tFields(env, area, lpObject2, &PGLOB(PhArea_tFc));
- }
-
- return result;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSetAreaFromWidgetCanvas
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhArea_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSetAreaFromWidgetCanvas
- (JNIEnv *env, jobject that, jint widget, jobject extent, jobject area)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object1, *lpObject1=NULL;
- PhArea_t object2, *lpObject2=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSetAreaFromWidgetCanvas\n");
-#endif
-
- if (extent) {
- lpObject1 = &object1;
- cachePhRect_tFids(env, extent, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, extent, lpObject1, &PGLOB(PhRect_tFc));
- }
- if (area) {
- lpObject2 = &object2;
- cachePhArea_tFids(env, area, &PGLOB(PhArea_tFc));
- getPhArea_tFields(env, area, lpObject2, &PGLOB(PhArea_tFc));
- }
- result = (jint) PtSetAreaFromWidgetCanvas((PtWidget_t *)widget, lpObject1, lpObject2);
- if (extent) {
- setPhRect_tFields(env, extent, lpObject1, &PGLOB(PhRect_tFc));
- }
- if (area) {
- setPhArea_tFields(env, area, lpObject2, &PGLOB(PhArea_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhKeyEvent_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhKeyEvent_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhKeyEvent_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhKeyEvent_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhKeyEvent_tFids(env, src, &PGLOB(PhKeyEvent_tFc));
- getPhKeyEvent_tFields(env, src, src1, &PGLOB(PhKeyEvent_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhKeyEvent_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhKeyEvent_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhKeyEvent_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhKeyEvent_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhKeyEvent_tFids(env, dest, &PGLOB(PhKeyEvent_tFc));
- setPhKeyEvent_tFields(env, dest, dest1, &PGLOB(PhKeyEvent_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhTo8859_1
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhTo8859_11
- (JNIEnv *env, jobject that, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhTo8859_1\n");
-#endif
-
- return (jint)PhTo8859_1((PhKeyEvent_t *)event);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhKeyToMb_1
- * Signature: ([BI)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhKeyToMb
- (JNIEnv *env, jobject that, jbyteArray buffer, jint event)
-{
- jbyte *buffer1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhKeyToMb\n");
-#endif
-
- if (buffer)
- buffer1 = (*env)->GetByteArrayElements(env, buffer, NULL);
-
- result = PhKeyToMb(buffer1, (PhKeyEvent_t *)event);
-
- if (buffer)
- (*env)->ReleaseByteArrayElements(env, buffer, buffer1, 0);
-
- return result;
-}
-*/
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PtScrollbarCallback_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PtScrollbarCallback_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PtScrollbarCallback_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhPoint_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePtScrollbarCallback_tFids(env, src, &PGLOB(PtScrollbarCallback_tFc));
- getPtScrollbarCallback_tFields(env, src, src1, &PGLOB(PtScrollbarCallback_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PtScrollbarCallback_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PtScrollbarCallback_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PtScrollbarCallback_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhPoint_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePtScrollbarCallback_tFids(env, dest, &PGLOB(PtScrollbarCallback_tFc));
- setPtScrollbarCallback_tFields(env, dest, dest1, &PGLOB(PtScrollbarCallback_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSetParentWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSetParentWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSetParentWidget\n");
-#endif
-
- return (jint)PtSetParentWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtFrameSize
- * Signature: (II[I[I[I[I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFrameSize
- (JNIEnv *env, jobject that, jint render, jint border_size, jintArray left_border, jintArray top_border, jintArray right_border, jintArray bottom_border)
-{
- int *left_border1=NULL;
- int *top_border1=NULL;
- int *right_border1=NULL;
- int *bottom_border1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtFrameSize\n");
-#endif
-
- if (left_border)
- left_border1 = (*env)->GetIntArrayElements(env, left_border, NULL);
- if (top_border)
- top_border1 = (*env)->GetIntArrayElements(env, top_border, NULL);
- if (right_border)
- right_border1 = (*env)->GetIntArrayElements(env, right_border, NULL);
- if (bottom_border)
- bottom_border1 = (*env)->GetIntArrayElements(env, bottom_border, NULL);
-
- PtFrameSize (render, border_size, left_border1, top_border1, right_border1, bottom_border1);
-
- if (left_border)
- (*env)->ReleaseIntArrayElements(env, left_border, left_border1, 0);
- if (top_border)
- (*env)->ReleaseIntArrayElements(env, top_border, top_border1, 0);
- if (right_border)
- (*env)->ReleaseIntArrayElements(env, right_border, right_border1, 0);
- if (bottom_border)
- (*env)->ReleaseIntArrayElements(env, bottom_border, bottom_border1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtCreateAppContext
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtCreateAppContext
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtCreateAppContext\n");
-#endif
-
- return (jint)PtCreateAppContext();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppProcessEvent ()
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppProcessEvent
- (JNIEnv *env, jobject that, jint app_context)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppProcessEvent \n");
-#endif
-
- PtAppProcessEvent ((PtAppContext_t)app_context);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppAddWorkProc
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppAddWorkProc
- (JNIEnv *env, jobject that, jint app_context, jint work_func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppAddWorkProc\n");
-#endif
-
- return (jint)PtAppAddWorkProc ((PtAppContext_t)app_context, (PtWorkProc_t) work_func, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppRemoveWorkProc()
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppRemoveWorkProc
- (JNIEnv *env, jobject that, jint app_context, jint WorkProc_id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppRemoveWorkProc\n");
-#endif
-
- PtAppRemoveWorkProc((PtAppContext_t)app_context, (PtWorkProcId_t *) WorkProc_id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetExtent
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetExtent__ILorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jint widget, jobject rect)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetExtent\n");
-#endif
-
- if (rect) {
- lpRect = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtWidgetExtent((PtWidget_t *) widget, lpRect);
- if (rect) {
- setPhRect_tFields(env, rect, lpRect, &PGLOB(PhRect_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetArea
- * Signature: (ILorg/eclipse/swt/internal/photon/PhArea_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetArea
- (JNIEnv *env, jobject that, jint widget, jobject area)
-{
- DECL_GLOB(pGlob)
- PhArea_t area1, *lpArea=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetArea\n");
-#endif
-
- if (area) {
- lpArea = &area1;
- cachePhArea_tFids(env, area, &PGLOB(PhArea_tFc));
- getPhArea_tFields(env, area, lpArea, &PGLOB(PhArea_tFc));
- }
- result = (jint) PtWidgetArea((PtWidget_t *) widget, lpArea);
- if (area) {
- setPhArea_tFields(env, area, lpArea, &PGLOB(PhArea_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhQueryCursor
- * Signature: (ILorg/eclipse/swt/internal/photon/PhCursorInfo_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhQueryCursor
- (JNIEnv *env, jobject that, jshort ig, jobject buf)
-{
- DECL_GLOB(pGlob)
- PhCursorInfo_t buf1, *lpBuf1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhQueryCursor\n");
-#endif
-
- if (buf) {
- lpBuf1 = &buf1;
- cachePhCursorInfo_tFids(env, buf, &PGLOB(PhCursorInfo_tFc));
- getPhCursorInfo_tFields(env, buf, lpBuf1, &PGLOB(PhCursorInfo_tFc));
- }
- result = (jint) PhQueryCursor(ig, lpBuf1);
- if (buf) {
- setPhCursorInfo_tFields(env, buf, lpBuf1, &PGLOB(PhCursorInfo_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhInputGroup
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhInputGroup
- (JNIEnv *env, jobject that, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhInputGroup\n");
-#endif
-
- return (jint) PhInputGroup ((PhEvent_t *) event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainer
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainer
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainer\n");
-#endif
-
- return (jint)PtContainer;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtScrollArea
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtScrollArea
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtScrollArea\n");
-#endif
-
- return (jint)PtScrollArea;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAddClassStyle
- * Signature: (II)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAddClassStyle
- (JNIEnv *env, jobject that, jint wclass, jint style)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAddClassStyle\n");
-#endif
-
- return (jint)PtAddClassStyle((PtWidgetClassRef_t *)wclass, (PtWidgetClassStyle_t *)style);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtClippedBlit
- * Signature: (IILorg/eclipse/swt/photon/PhPoint_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtClippedBlit
- (JNIEnv *env, jobject that, jint widget, jint src, jobject delta, jint clip)
-{
- DECL_GLOB(pGlob)
- PhPoint_t delta1, *lpDelta1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtClippedBlit\n");
-#endif
- if (delta) {
- lpDelta1 = &delta1;
- cachePhPoint_tFids(env, delta, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, delta, lpDelta1, &PGLOB(PhPoint_tFc));
- }
-
- return (jint)PtClippedBlit((PtWidget_t *)widget, (PhTile_t *)src, lpDelta1, (PhTile_t *)clip);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/FontDetails;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_FontDetails_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- FontDetails object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_FontDetails_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cacheFontDetailsFids(env, src, &PGLOB(FontDetailsFc));
- getFontDetailsFields(env, src, src1, &PGLOB(FontDetailsFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/FontDetails;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_FontDetails_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- FontDetails object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_FontDetails_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cacheFontDetailsFids(env, dest, &PGLOB(FontDetailsFc));
- setFontDetailsFields(env, dest, dest1, &PGLOB(FontDetailsFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhArea_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhArea_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhArea_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhArea_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhArea_tFids(env, src, &PGLOB(PhArea_tFc));
- getPhArea_tFields(env, src, src1, &PGLOB(PhArea_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhArea_t;II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhArea_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhArea_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhArea_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhArea_tFids(env, dest, &PGLOB(PhArea_tFc));
- setPhArea_tFields(env, dest, dest1, &PGLOB(PhArea_tFc));
- }
-
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtFileSelection
- * Signature: (ILorg/eclipse/swt/photon/PhPoint_t;[B[B[B[B[BLorg/eclipse/swt/photon/PtFileSelectionInfo_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFileSelection
- (JNIEnv *env, jobject that, jint widget, jobject pos, jbyteArray title, jbyteArray root_dir, jbyteArray file_spec, jbyteArray btn1, jbyteArray btn2, jbyteArray format, jobject info, jint flags)
-{
- DECL_GLOB(pGlob)
-
- PhPoint_t pos1, *lpPos1=NULL;
- PtFileSelectionInfo_t info1, *lpInfo1=NULL;
-
- char *title1=NULL;
- char *root_dir1=NULL;
- char *file_spec1=NULL;
- char *btn11=NULL;
- char *btn21=NULL;
- char *format1=NULL;
-
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtFileSelection\n");
-#endif
-
- if (pos) {
- lpPos1= &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (info) {
- memset (&info1, 0, sizeof (PtFileSelectionInfo_t));
- lpInfo1= &info1;
- cachePtFileSelectionInfo_tFids(env, info, &PGLOB(PtFileSelectionInfo_tFc));
- getPtFileSelectionInfo_tFields(env, info, lpInfo1, &PGLOB(PtFileSelectionInfo_tFc));
- }
- if (title) title1 = (*env)->GetByteArrayElements(env, title, NULL);
- if (root_dir) root_dir1 = (*env)->GetByteArrayElements(env, root_dir, NULL);
- if (file_spec) file_spec1 = (*env)->GetByteArrayElements(env, file_spec, NULL);
- if (btn1) btn11 = (*env)->GetByteArrayElements(env, btn1, NULL);
- if (btn2) btn21 = (*env)->GetByteArrayElements(env, btn2, NULL);
- if (format) format1 = (*env)->GetByteArrayElements(env, format, NULL);
-
- result = (jint) PtFileSelection ((PtWidget_t *)widget, lpPos1, title1, root_dir1, file_spec1, btn11, btn21, format1, lpInfo1, flags);
-
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (info) {
- setPtFileSelectionInfo_tFields(env, info, lpInfo1, &PGLOB(PtFileSelectionInfo_tFc));
- }
- if (title) (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- if (root_dir) (*env)->ReleaseByteArrayElements(env, root_dir, root_dir1, 0);
- if (file_spec) (*env)->ReleaseByteArrayElements(env, file_spec, file_spec1, 0);
- if (btn1) (*env)->ReleaseByteArrayElements(env, btn1, btn11, 0);
- if (btn2) (*env)->ReleaseByteArrayElements(env, btn2, btn21, 0);
- if (format) (*env)->ReleaseByteArrayElements(env, format, format1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetPreferredSize
- * Signature: (ILorg/eclipse/swt/photon/PhDim_t;)Lorg/eclipse/swt/photon/PhDim_t;
- */
-JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetPreferredSize
- (JNIEnv *env, jobject that, jint widget, jobject dim)
-{
- DECL_GLOB(pGlob)
- PhDim_t dim1, *result, *lpDim1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetPreferredSize\n");
-#endif
-
- if (dim) {
- lpDim1 = &dim1;
- cachePhDim_tFids(env, dim, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, dim, lpDim1, &PGLOB(PhDim_tFc));
- }
- result = PtWidgetPreferredSize((PtWidget_t *)widget, lpDim1);
- if (dim) {
- setPhDim_tFields(env, dim, lpDim1, &PGLOB(PhDim_tFc));
- }
- return result == NULL ? NULL : dim;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppCreatePulse
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppCreatePulse
- (JNIEnv *env, jobject that, jint app, jint priority)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppCreatePulse\n");
-#endif
-
- return (jint)PtAppCreatePulse((PtAppContext_t)app, priority);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppAddInput
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppAddInput
- (JNIEnv *env, jobject that, jint app_context, jint pid, jint input_func, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppAddInput\n");
-#endif
-
- return (jint)PtAppAddInput((PtAppContext_t)app_context, (pid_t)pid, (PtInputCallbackProc_t)input_func, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppRemoveInput
- * Signature: (II)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppRemoveInput
- (JNIEnv *env, jobject that, jint app_context, jint input_id)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppRemoveInput\n");
-#endif
-
- PtAppRemoveInput((PtAppContext_t)app_context, (PtInputId_t *)input_id);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppDeletePulse
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppDeletePulse
- (JNIEnv *env, jobject that, jint app, jint pulse_pid)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppDeletePulse\n");
-#endif
-
- return (jint)PtAppDeletePulse((PtAppContext_t)app, (pid_t)pulse_pid);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAppPulseTrigger
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAppPulseTrigger
- (JNIEnv *env, jobject that, jint app, jint pulse)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAppPulseTrigger\n");
-#endif
-
- return (jint)PtAppPulseTrigger((PtAppContext_t)app, (pid_t)pulse);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerFindFocus
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerFindFocus
- (JNIEnv *env, jobject that, jint family_member)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerFindFocus\n");
-#endif
-
- return (jint)PtContainerFindFocus((PtWidget_t *)family_member);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtIsFocused
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtIsFocused
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtIsFocused\n");
-#endif
-
- return (jint)PtIsFocused((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindowFocus
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWindowFocus
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWindowFocus\n");
-#endif
-
- return (jint)PtWindowFocus((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindowToFront
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWindowToFront
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWindowToFront\n");
-#endif
-
- PtWindowToFront((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindowToBack
- * Signature: (I)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWindowToBack
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWindowToBack\n");
-#endif
-
- PtWindowToBack((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtFindDisjoint
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFindDisjoint
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtFindDisjoint\n");
-#endif
-
- return (jint) PtFindDisjoint((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardCopyString
- * Signature: (SI)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardCopyString__SI
- (JNIEnv *env, jobject that, jshort ig, jint string)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardCopyString\n");
-#endif
-
- return (jint) PhClipboardCopyString(ig, (char *)string);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardCopyString
- * Signature: (S[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardCopyString__S_3B
- (JNIEnv *env, jclass that, jshort ig, jbyteArray string)
-{
- jbyte *string1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardCopyString\n");
-#endif
-
- if (string)
- string1 = (*env)->GetByteArrayElements(env, string, NULL);
-
- result = (jint)PhClipboardCopyString(ig, (char *)string1);
-
- if (string)
- (*env)->ReleaseByteArrayElements(env, string, string1, 0);
-
- return result;
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardPasteString
- * Signature: (S)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardPasteString
- (JNIEnv *env, jobject that, jshort ig)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardPasteString\n");
-#endif
-
- return (jint) PhClipboardPasteString(ig);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtBlockAllWindows
- * Signature: (ISI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtBlockAllWindows
- (JNIEnv *env, jobject that, jint skip, jshort cursor, jint cursor_color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtBlockAllWindows\n");
-#endif
-
- return (jint) PtBlockAllWindows((PtWidget_t *)skip, cursor, (PgColor_t)cursor_color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtBlockWindow
- * Signature: (ISI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtBlockWindow
- (JNIEnv *env, jobject that, jint window, jshort cursor, jint cursor_color)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtBlockWindow\n");
-#endif
-
- return (jint) PtBlockWindow((PtWidget_t *)window, cursor, (PgColor_t)cursor_color);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtUnblockWindows
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtUnblockWindows
- (JNIEnv *env, jobject that, jint bl)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtUnblockWindows\n");
-#endif
-
- PtUnblockWindows((PtBlockedList_t *)bl);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtNextTopLevelWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtNextTopLevelWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtNextTopLevelWidget\n");
-#endif
-
- return (jint) PtNextTopLevelWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWindowGetState
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWindowGetState
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWindowGetState\n");
-#endif
-
- return (jint) PtWindowGetState((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAddHotkeyHandler
- * Signature: (IIISII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAddHotkeyHandler
- (JNIEnv *env, jobject that, jint widget, jint key_sym_cap, jint key_mods, jshort flags, jint data, jint callback)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAddHotkeyHandler\n");
-#endif
-
- PtAddHotkeyHandler((PtWidget_t *)widget, key_sym_cap, key_mods, flags, (void *)data, (PtCallbackF_t *)callback);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtRemoveHotkeyHandler
- * Signature: (IIISII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtRemoveHotkeyHandler
- (JNIEnv *env, jobject that, jint widget, jint key_sym_cap, jint key_mods, jshort flags, jint data, jint callback)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtRemoveHotkeyHandler\n");
-#endif
-
- PtRemoveHotkeyHandler((PtWidget_t *)widget, key_sym_cap, key_mods, flags, (void *)data, (PtCallbackF_t *)callback);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PgAlpha_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PgAlpha_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- /* Some fields of the structure are not represented in Java.
- * Make the are set to zero.
- */
- PgAlpha_t object = {0}, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PgAlpha_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePgAlpha_tFids(env, src, &PGLOB(PgAlpha_tFc));
- getPgAlpha_tFields(env, src, src1, &PGLOB(PgAlpha_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PgAlpha_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PgAlpha_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- /* Some fields of the structure are not represented in Java.
- * Make the are set to zero.
- */
- PgAlpha_t object = {0}, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PgAlpha_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePgAlpha_tFids(env, dest, &PGLOB(PgAlpha_tFc));
- setPgAlpha_tFields(env, dest, dest1, &PGLOB(PgAlpha_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetAlpha
- * Signature: (IIIBB)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetAlpha
- (JNIEnv *env, jobject that, jint alpha_op, jobject src_alpha_map, jint src_alpha_gradient, jbyte src_global_alpha, jbyte dst_global_alpha)
-{
- DECL_GLOB(pGlob)
- PgMap_t map1, *lpMap1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetAlpha\n");
-#endif
-
- if (src_alpha_map) {
- lpMap1 = &map1;
- cachePgMap_tFids(env, src_alpha_map, &PGLOB(PgMap_tFc));
- getPgMap_tFields(env, src_alpha_map, lpMap1, &PGLOB(PgMap_tFc));
- }
- PgSetAlpha(alpha_op, lpMap1, (PgGradient_t *)src_alpha_gradient, (char unsigned)src_global_alpha, (char unsigned)dst_global_alpha);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetAlpha
- * Signature: (IIIBB)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetAlpha
- (JNIEnv *env, jobject that, jint alpha_op, jint src_alpha_map, jint src_alpha_gradient, jbyte src_global_alpha, jbyte dst_global_alpha)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetAlpha\n");
-#endif
-
- PgSetAlpha(alpha_op, (PgMap_t *)src_alpha_map, (PgGradient_t *)src_alpha_gradient, (char unsigned)src_global_alpha, (char unsigned)dst_global_alpha);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgAlphaOn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgAlphaOn
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgAlphaOn\n");
-#endif
-
- PgAlphaOn();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgAlphaOff
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgAlphaOff
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgAlphaOff\n");
-#endif
-
- PgAlphaOff();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PtTextCallback_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PtTextCallback_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PtTextCallback_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PtTextCallback_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePtTextCallback_tFids(env, src, &PGLOB(PtTextCallback_tFc));
- getPtTextCallback_tFields(env, src, src1, &PGLOB(PtTextCallback_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PtTextCallback_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PtTextCallback_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PtTextCallback_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PtTextCallback_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePtTextCallback_tFids(env, dest, &PGLOB(PtTextCallback_tFc));
- setPtTextCallback_tFields(env, dest, dest1, &PGLOB(PtTextCallback_tFc));
- }
-
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhInitDrag
- * Signature: (IILorg/eclipse/swt/photon/PhRect_t;Lorg/eclipse/swt/photon/PhRect_t;ILorg/eclipse/swt/photon/PhDim_t;Lorg/eclipse/swt/photon/PhDim_t;Lorg/eclipse/swt/photon/PhDim_t;Lorg/eclipse/swt/photon/PhPoint_t;[I;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhInitDrag
- (JNIEnv *env, jobject that, jint rid, jint flags, jobject rect, jobject boundary, jint input_group, jobject min, jobject max, jobject step, jobject ptrpos, jshortArray cursor)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, rect2, *lpRect1=NULL, *lpRect2=NULL;
- PhDim_t dim1, dim2, dim3, *lpDim1=NULL, *lpDim2=NULL, *lpDim3=NULL;
- PhPoint_t point1, *lpPoint1=NULL;
- jshort *cursor1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhInitDrag\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- if (boundary) {
- lpRect2 = &rect2;
- cachePhRect_tFids(env, boundary, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, boundary, lpRect2, &PGLOB(PhRect_tFc));
- }
- if (min) {
- lpDim1 = &dim1;
- cachePhDim_tFids(env, min, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, min, lpDim1, &PGLOB(PhDim_tFc));
- }
- if (max) {
- lpDim2 = &dim2;
- cachePhDim_tFids(env, max, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, max, lpDim2, &PGLOB(PhDim_tFc));
- }
- if (step) {
- lpDim3 = &dim3;
- cachePhDim_tFids(env, step, &PGLOB(PhDim_tFc));
- getPhDim_tFields(env, step, lpDim3, &PGLOB(PhDim_tFc));
- }
- if (ptrpos) {
- lpPoint1 = &point1;
- cachePhPoint_tFids(env, ptrpos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, ptrpos, lpPoint1, &PGLOB(PhPoint_tFc));
- }
- if (cursor)
- cursor1 = (*env)->GetShortArrayElements(env, cursor, NULL);
-
- result = (jint) PhInitDrag(rid, flags, lpRect1, lpRect2, input_group, lpDim1, lpDim2, lpDim3, lpPoint1, (PhCursorDescription_t *)cursor1);
-
- if (cursor)
- (*env)->ReleaseShortArrayElements(env, cursor, cursor1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtProgress
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtProgress
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtProgress\n");
-#endif
-
- return (jint)PtProgress;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtPanelGroup
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtPanelGroup
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtPanelGroup\n");
-#endif
-
- return (jint)PtPanelGroup;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhAreaToRect
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhArea_t;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PhAreaToRect
- (JNIEnv *env, jobject that, jobject area, jobject rect)
-{
- DECL_GLOB(pGlob)
- PhArea_t object1, *lpObject1=NULL;
- PhRect_t object2, *lpObject2=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhAreaToRect\n");
-#endif
-
- if (area) {
- lpObject1 = &object1;
- cachePhArea_tFids(env, area, &PGLOB(PhArea_tFc));
- getPhArea_tFields(env, area, lpObject1, &PGLOB(PhArea_tFc));
- }
- if (rect) {
- lpObject2 = &object2;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpObject2, &PGLOB(PhRect_tFc));
- }
- PhAreaToRect(lpObject1, lpObject2);
- if (area) {
- setPhArea_tFields(env, area, lpObject1, &PGLOB(PhArea_tFc));
- }
- if (rect) {
- setPhRect_tFields(env, rect, lpObject2, &PGLOB(PhRect_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtCalcCanvas
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtCalcCanvas__ILorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jint widget, jobject canvas_rect)
-{
- DECL_GLOB(pGlob)
- jint result;
- PhRect_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtCalcCanvas\n");
-#endif
-
- if (canvas_rect) {
- lpObject = &object;
- cachePhRect_tFids(env, canvas_rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtCalcCanvas((PtWidget_t *)widget, lpObject);
- if (canvas_rect) {
- setPhRect_tFields(env, canvas_rect, lpObject, &PGLOB(PhRect_tFc));
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtValidParent
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtValidParent
- (JNIEnv *env, jobject that, jint widget, jint class_ref)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtValidParent\n");
-#endif
-
- return (jint)PtValidParent((PtWidget_t *)widget, (PtWidgetClassRef_t *) class_ref);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtCalcBorder
- * Signature: (ILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtCalcBorder__ILorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv *env, jobject that, jint widget, jobject rect)
-{
- DECL_GLOB(pGlob)
- PhRect_t object, *lpObject=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtCalcBorder\n");
-#endif
-
- if (rect) {
- lpObject = &object;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpObject, &PGLOB(PhRect_tFc));
- }
- PtCalcBorder((PtWidget_t *)widget, lpObject);
- if (rect) {
- setPhRect_tFields(env, rect, lpObject, &PGLOB(PhRect_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtPane
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtPane
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtPane\n");
-#endif
-
- return (jint)PtPane;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTree
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTree
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTree\n");
-#endif
-
- return (jint)PtTree;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeAllocItem
- * Signature: (I[BSS)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeAllocItem
- (JNIEnv *env, jobject that, jint widget, jbyteArray str, jshort set_img, jshort unset_img)
-{
- PtTreeItem_t *result;
- jbyte *str1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeAllocItem\n");
-#endif
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = PtTreeAllocItem((PtWidget_t *)widget, str1, set_img, unset_img);
-
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return (jint) result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeModifyItem
- * Signature: (II[BSS)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeModifyItem
- (JNIEnv *env, jobject that, jint widget, jint item, jbyteArray str, jshort set_img, jshort unset_img)
-{
- PtTreeItem_t *result;
- jbyte *str1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeModifyItem\n");
-#endif
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = PtTreeModifyItem((PtWidget_t *)widget, (PtTreeItem_t *) item, str1, set_img, unset_img);
-
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return (jint) result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeModifyItemString
- * Signature: (II[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeModifyItemString
- (JNIEnv *env, jobject that, jint widget, jint item, jbyteArray str)
-{
- PtTreeItem_t *result;
- jbyte *str1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeModifyItemString\n");
-#endif
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = PtTreeModifyItemString((PtWidget_t *)widget, (PtTreeItem_t *) item, str1);
-
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return (jint) result;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeAddFirst
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeAddFirst
- (JNIEnv *env, jobject that, jint widget, jint item, jint parent)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeAddFirst\n");
-#endif
-
- return (jint)PtTreeAddFirst((PtWidget_t *)widget, (PtTreeItem_t *) item, (PtTreeItem_t *) parent);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeAddAfter
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeAddAfter
- (JNIEnv *env, jobject that, jint widget, jint item, jint brother)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeAddAfter\n");
-#endif
-
- return (jint)PtTreeAddAfter((PtWidget_t *)widget, (PtTreeItem_t *) item, (PtTreeItem_t *) brother);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeRemoveItem
- * Signature: (II)
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeRemoveItem
- (JNIEnv *env, jobject that, jint widget, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeRemoveItem\n");
-#endif
-
- PtTreeRemoveItem((PtWidget_t *)widget, (PtTreeItem_t *) item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeRootItem
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeRootItem
- (JNIEnv *env, jobject that, jint tree)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeRootItem\n");
-#endif
-
- return (jint) PtTreeRootItem((PtWidget_t *)tree);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PtTreeItem_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PtTreeItem_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PtTreeItem_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PtTreeItem_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePtTreeItem_tFids(env, src, &PGLOB(PtTreeItem_tFc));
- getPtTreeItem_tFields(env, src, src1, &PGLOB(PtTreeItem_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PtTreeItem_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PtTreeItem_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PtTreeItem_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PtTreeItem_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePtTreeItem_tFids(env, dest, &PGLOB(PtTreeItem_tFc));
- setPtTreeItem_tFields(env, dest, dest1, &PGLOB(PtTreeItem_tFc));
- }
-
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeClearSelection
- * Signature: (I)
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeClearSelection
- (JNIEnv *env, jobject that, jint tree)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeClearSelection\n");
-#endif
-
- PtTreeClearSelection((PtWidget_t *)tree);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeSelect
- * Signature: (II)
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeSelect
- (JNIEnv *env, jobject that, jint widget, jint item)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeSelect\n");
-#endif
-
- PtTreeSelect((PtWidget_t *)widget, (PtTreeItem_t *) item);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeExpand
- * Signature: (III)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeExpand
- (JNIEnv *env, jobject that, jint widget, jint item, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeExpand\n");
-#endif
-
- return PtTreeExpand((PtWidget_t *)widget, (PtTreeItem_t *) item, (PhEvent_t *) event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeCollapse
- * Signature: (III)I
- */
-JNIEXPORT int JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeCollapse
- (JNIEnv *env, jobject that, jint widget, jint item, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeCollapse\n");
-#endif
-
- return PtTreeCollapse((PtWidget_t *)widget, (PtTreeItem_t *) item, (PhEvent_t *) event);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTreeFreeAllItems
- * Signature: (I)
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTreeFreeAllItems
- (JNIEnv *env, jobject that, jint tree)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTreeFreeAllItems \n");
-#endif
-
- PtTreeFreeAllItems ((PtWidget_t *)tree);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PgMap_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PgMap_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PgMap_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PgMap_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePgMap_tFids(env, src, &PGLOB(PgMap_tFc));
- getPgMap_tFields(env, src, src1, &PGLOB(PgMap_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PgMap_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PgMap_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PgMap_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PgMap_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePgMap_tFids(env, dest, &PGLOB(PgMap_tFc));
- setPgMap_tFields(env, dest, dest1, &PGLOB(PgMap_tFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtDamageWidget
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtDamageWidget
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtDamageWidget\n");
-#endif
-
- return (jint)PtDamageWidget((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtBlit
- * Signature: (ILorg/eclipse/swt/photon/PhRect_t;ILorg/eclipse/swt/photon/PhPoint_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtBlit
- (JNIEnv *env, jobject that, jint widget, jobject rect, jobject offset)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
- PhPoint_t offset1, *lpOffset1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtBlit\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- if (offset) {
- lpOffset1 = &offset1;
- cachePhPoint_tFids(env, offset, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, offset, lpOffset1, &PGLOB(PhPoint_tFc));
- }
- return (jint) PtBlit((PtWidget_t *)widget, lpRect1, lpOffset1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerHold
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerHold
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerHold\n");
-#endif
-
- return (jint)PtContainerHold((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtContainerRelease
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerRelease
- (JNIEnv *env, jobject that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtContainerRelease\n");
-#endif
-
- return (jint)PtContainerRelease((PtWidget_t *)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtFontSelection
- * Signature: (ILorg/eclipse/swt/photon/PhPoint_t;[B[BII[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFontSelection
- (JNIEnv *env, jobject that, jint parent, jobject pos, jbyteArray title, jbyteArray font, jint symbol, jint flags, jbyteArray sample)
-{
- DECL_GLOB(pGlob)
-
- PhPoint_t pos1, *lpPos1=NULL;
-
- char *title1=NULL;
- char *font1=NULL;
- char *sample1=NULL;
-
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtFontSelection\n");
-#endif
-
- if (pos) {
- lpPos1= &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (title) title1 = (*env)->GetByteArrayElements(env, title, NULL);
- if (font) font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (sample) sample1 = (*env)->GetByteArrayElements(env, sample, NULL);
-
- result = (jint) PtFontSelection ((PtWidget_t *)parent, lpPos1, title1, font1, symbol, flags, sample1);
-
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (title) (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- if (font) (*env)->ReleaseByteArrayElements(env, font, font1, 0);
- if (sample) (*env)->ReleaseByteArrayElements(env, sample, sample1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfGenerateFontName
- * Signature: ([BII[B)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_org_eclipse_swt_internal_photon_OS_PfGenerateFontName
- (JNIEnv *env, jobject that, jbyteArray pkucDescription, jint kuiFlags, jint kuiSize, jbyteArray pucBuff)
-{
- char *pkucDescription1=NULL;
- char *pucBuff1=NULL;
-
- uchar_t *result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfGenerateFontName\n");
-#endif
-
- if (pkucDescription) pkucDescription1 = (*env)->GetByteArrayElements(env, pkucDescription, NULL);
- if (pucBuff) pucBuff1 = (*env)->GetByteArrayElements(env, pucBuff, NULL);
-
- result = PfGenerateFontName(pkucDescription1, kuiFlags, kuiSize, pucBuff1);
-
- if (pkucDescription) (*env)->ReleaseByteArrayElements(env, pkucDescription, pkucDescription1, 0);
- if (pucBuff) (*env)->ReleaseByteArrayElements(env, pucBuff, pucBuff1, 0);
-
- return result == NULL ? NULL : pucBuff;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfFindFont
- * Signature: ([BII)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfFindFont
- (JNIEnv *env, jobject that, jbyteArray pkucDescription, jint kulFlags, jint kulSize)
-{
- char *pkucDescription1=NULL;
-
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfFindFont\n");
-#endif
-
- if (pkucDescription) pkucDescription1 = (*env)->GetByteArrayElements(env, pkucDescription, NULL);
-
- result = (jint)PfFindFont(pkucDescription1, kulFlags, kulSize);
-
- if (pkucDescription) (*env)->ReleaseByteArrayElements(env, pkucDescription, pkucDescription1, 0);
-
- return result;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfFreeFont
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfFreeFont
- (JNIEnv *env, jobject that, jint ptsID)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfFreeFont\n");
-#endif
-
- return PfFreeFont((FontID *)ptsID);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfFontDescription
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfFontDescription
- (JNIEnv *env, jobject that, jint ptsID)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfFontDescription\n");
-#endif
-
- return (jint)PfFontDescription((FontID *)ptsID);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfFontFlags
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfFontFlags
- (JNIEnv *env, jobject that, jint ptsID)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfFontFlags\n");
-#endif
-
- return PfFontFlags((FontID *)ptsID);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfFontSize
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfFontSize
- (JNIEnv *env, jobject that, jint ptsID)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfFontSize\n");
-#endif
-
- return PfFontSize((FontID *)ptsID);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PfConvertFontID
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PfConvertFontID
- (JNIEnv *env, jobject that, jint ptsID)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PfConvertFontID\n");
-#endif
-
- return (jint)PfConvertFontID((FontID *)ptsID);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtToolbar
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtToolbar
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtToolbar\n");
-#endif
-
- return (jint)PtToolbar;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtColorSelGroup
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtColorSelGroup
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtColorSelGroup\n");
-#endif
-
- return (jint)PtColorSelGroup;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtColorPatch
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtColorPatch
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtColorPatch\n");
-#endif
-
- return (jint)PtColorPatch;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtColorPalette
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtColorPalette
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtColorPalette\n");
-#endif
-
- return (jint)PtColorPalette;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtGroup
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGroup
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtGroup\n");
-#endif
-
- return (jint)PtGroup;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: Pg_CM_RGB
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_Pg_1CM_1RGB
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "Pg_CM_RGB\n");
-#endif
-
- return (jint)Pg_CM_RGB;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: Pg_CM_HSB
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_Pg_1CM_1HSB
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "Pg_CM_HSB\n");
-#endif
-
- return (jint)Pg_CM_HSB;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: Pg_CM_HLS
- * Signature: ()I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_Pg_1CM_1HLS
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "Pg_CM_HLS\n");
-#endif
-
- return (jint)Pg_CM_HLS;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhRectUnion
- * Signature: (Lorg/eclipse/swt/internal/photon/PhRect_t;Lorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhRectUnion__Lorg_eclipse_swt_internal_photon_PhRect_1t_2Lorg_eclipse_swt_internal_photon_PhRect_1t_2
- (JNIEnv * env, jobject that, jobject rect1, jobject rect2)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect11, *lpRect11=NULL;
- PhRect_t rect21, *lpRect21=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhRectUnion__Lorg_eclipse_swt_internal_photon_PhRect_1t_2Lorg_eclipse_swt_internal_photon_PhRect_1t_2\n");
-#endif
-
- if (rect1) {
- lpRect11 = &rect11;
- cachePhRect_tFids(env, rect1, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect1, lpRect11, &PGLOB(PhRect_tFc));
- }
- if (rect2) {
- lpRect21 = &rect21;
- cachePhRect_tFids(env, rect2, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect2, lpRect21, &PGLOB(PhRect_tFc));
- }
- result = PhRectUnion(lpRect11, lpRect21);
- if (rect1) {
- setPhRect_tFields(env, rect1, lpRect11, &PGLOB(PhRect_tFc));
- }
- if (rect2) {
- setPhRect_tFields(env, rect2, lpRect21, &PGLOB(PhRect_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtRegion
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtRegion
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtRegion\n");
-#endif
-
- return (jint)PtRegion;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAddFilterCallback
- * Signature: (IIII)I
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAddFilterCallback
- (JNIEnv *env, jobject that, jint widget, jint callback_type, jint callback, jint data)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAddFilterCallback\n");
-#endif
-
- PtAddFilterCallback((PtWidget_t *)widget, (unsigned long)callback_type, (PtCallbackF_t *)callback, (void *)data);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtTimer
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtTimer
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtTimer\n");
-#endif
-
- return (jint)PtTimer;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtHit
- * Signature: (IILorg/eclipse/swt/internal/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtHit
- (JNIEnv * env, jobject that, jint container, jint n, jobject rect)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtHit\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- result = (jint) PtHit ((PtWidget_t *) container, n, lpRect1);
- if (rect) {
- setPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtColorSelect
- * Signature: (I[BLorg/eclipse/swt/internal/photon/PtColorSelectInfo_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtColorSelect
- (JNIEnv *env, jobject that, jint parent, jbyteArray title, jobject info)
-{
- DECL_GLOB(pGlob)
- PtColorSelectInfo_t info1, *lpInfo1=NULL;
- jbyte *title1=NULL;
- jint result;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtColorSelect\n");
-#endif
-
- if (title) title1 = (*env)->GetByteArrayElements(env, title, NULL);
- if (info) {
- lpInfo1 = &info1;
- cachePtColorSelectInfo_tFids(env, info, &PGLOB(PtColorSelectInfo_tFc));
- getPtColorSelectInfo_tFields(env, info, lpInfo1, &PGLOB(PtColorSelectInfo_tFc));
- }
- result = PtColorSelect((PtWidget_t *)parent, (char *)title1, lpInfo1);
- if (title) (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- if (info) {
- setPtColorSelectInfo_tFields(env, info, lpInfo1, &PGLOB(PtColorSelectInfo_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgDrawArrow
- * Signature: (Lorg/eclipse/swt/photon/PhRect_t;SII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawArrow
- (JNIEnv *env, jobject that, jobject rect, jshort unknown, jint color, jint flags)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgDrawArrow\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- PgDrawArrow(lpRect1, unknown, (PgColor_t)color, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtWidgetIsClassMember
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetIsClassMember
- (JNIEnv *env, jobject that, jint widget, jint clazz)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtWidgetIsClassMember\n");
-#endif
-
- return (jint)PtWidgetIsClassMember((PtWidget_t *)widget, (PtWidgetClassRef_t *)clazz);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtBeep
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtBeep
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtBeep\n");
-#endif
-
- return (jint)PtBeep();
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtAlert
- * Signature: (ILorg/eclipse/swt/photon/PhPoint_t;[BI[B[BII[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtAlert
- (JNIEnv *env, jobject that, jint parent, jobject pos, jbyteArray title, int image, jbyteArray message,
- jbyteArray msgFont, int btnCount, jintArray buttons, jintArray btnFonts,
- int defBtn, int escBtn, int flags)
-{
- DECL_GLOB(pGlob)
-
- PhPoint_t pos1, *lpPos1=NULL;
-
- char *title1=NULL;
- char *message1=NULL;
- char *msgFont1=NULL;
- jint *buttons1=NULL;
- jint *btnFonts1=NULL;
-
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtAlert\n");
-#endif
-
- if (pos) {
- lpPos1= &pos1;
- cachePhPoint_tFids(env, pos, &PGLOB(PhPoint_tFc));
- getPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (title) title1 = (*env)->GetByteArrayElements(env, title, NULL);
- if (message) message1 = (*env)->GetByteArrayElements(env, message, NULL);
- if (msgFont) msgFont1 = (*env)->GetByteArrayElements(env, msgFont, NULL);
- if (buttons) buttons1 = (*env)->GetIntArrayElements(env, buttons, NULL);
- if (btnFonts) btnFonts1 = (*env)->GetIntArrayElements(env, btnFonts, NULL);
-
- result = (jint) PtAlert ((PtWidget_t *)parent, lpPos1, title1, (PhImage_t *)image, message1, msgFont1, btnCount, (char const**)buttons1, (char const**)btnFonts1, defBtn, escBtn, flags);
-
- if (pos) {
- setPhPoint_tFields(env, pos, lpPos1, &PGLOB(PhPoint_tFc));
- }
- if (title) (*env)->ReleaseByteArrayElements(env, title, title1, 0);
- if (msgFont) (*env)->ReleaseByteArrayElements(env, msgFont, msgFont1, 0);
- if (message) (*env)->ReleaseByteArrayElements(env, message, message1, 0);
- if (buttons) (*env)->ReleaseIntArrayElements(env, buttons, buttons1, 0);
- if (btnFonts) (*env)->ReleaseIntArrayElements(env, btnFonts, btnFonts1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSlider
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSlider
- (JNIEnv *env, jobject that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSlider\n");
-#endif
-
- return (jint)PtSlider;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PiDuplicateImage
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PiDuplicateImage
- (JNIEnv *env, jobject that, jint image, jint flags)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PiDuplicateImage\n");
-#endif
-
- return (jint)PiDuplicateImage ((PhImage_t *)image, flags);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhMakeGhostBitmap
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhMakeGhostBitmap
- (JNIEnv *env, jobject that, jint image)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhMakeGhostBitmap\n");
-#endif
-
- return (jint) PhMakeGhostBitmap((PhImage_t *)image);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgReadScreen
- * Signature: (Lorg/eclipse/swt/photon/PhRect_t;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgReadScreen
- (JNIEnv *env, jobject that, jobject rect, jint buffer)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgReadScreen\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- return (jint) PgReadScreen(lpRect1, (void *) buffer);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgReadScreenSize
- * Signature: (Lorg/eclipse/swt/photon/PhRect_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgReadScreenSize
- (JNIEnv *env, jobject that, jobject rect)
-{
- DECL_GLOB(pGlob)
- PhRect_t rect1, *lpRect1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgReadScreenSize\n");
-#endif
-
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- return (jint) PgReadScreenSize(lpRect1);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgShmemDestroy
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgShmemDestroy
- (JNIEnv *env, jobject that, jint addr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgShmemDestroy\n");
-#endif
-
- return (jint) PgShmemDestroy((void *)addr);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgShmemDetach
- * Signature: (I)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgShmemDetach
- (JNIEnv *env, jobject that, jint addr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgShmemDetach\n");
-#endif
-
- return (jint) PgShmemDetach((void *)addr);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgShmemCreate
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgShmemCreate
- (JNIEnv *env, jobject that, jint size, jbyteArray name)
-{
- jint result;
- char *name1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgShmemCreate\n");
-#endif
-
- if (name) name1 = (*env)->GetByteArrayElements(env, name, NULL);
- result = (jint) PgShmemCreate(size, name1);
- if (name) (*env)->ReleaseByteArrayElements(env, name, name1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgShmemCleanup
- * Signature: ()V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgShmemCleanup
- (JNIEnv *env, jobject that, jint addr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgShmemCleanup\n");
-#endif
-
- PgShmemCleanup();
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhRegionQuery
- * Signature: (ILorg/eclipse/swt/photon/PhRegion_t;Lorg/eclipse/swt/photon/PhRect_t;II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhRegionQuery
- (JNIEnv *env, jobject that, jint rid, jobject region, jobject rect, jint data, jint data_len)
-{
- DECL_GLOB(pGlob)
- PhRegion_t region1, *lpRegion1=NULL;
- PhRect_t rect1, *lpRect1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhRegionQuery\n");
-#endif
-
- if (region) {
- lpRegion1 = &region1;
- cachePhRegion_tFids(env, region, &PGLOB(PhRegion_tFc));
- getPhRegion_tFields(env, region, lpRegion1, &PGLOB(PhRegion_tFc));
- }
- if (rect) {
- lpRect1 = &rect1;
- cachePhRect_tFids(env, rect, &PGLOB(PhRect_tFc));
- getPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- result = (jint) PhRegionQuery((PhRid_t)rid, lpRegion1, lpRect1, (void *) data, data_len);
- if (region) {
- setPhRegion_tFields(env, region, lpRegion1, &PGLOB(PhRegion_tFc));
- }
- if (rect) {
- setPhRect_tFields(env, rect, lpRect1, &PGLOB(PhRect_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PiGetPixelRGB
- * Signature: (II)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PiGetPixelRGB
- (JNIEnv *env, jobject that, jint image, jint x, jint y, jintArray value)
-{
- jint result;
- jint *value1 = NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PiGetPixelRGB\n");
-#endif
-
- if (value) value1 = (*env)->GetIntArrayElements(env, value, NULL);
-
- result = (jint)PiGetPixelRGB ((PhImage_t *)image, x, y, (PgColor_t *)value1);
-
- if (value) (*env)->ReleaseIntArrayElements(env, value, value1, 0);
-
- return result;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PtContainerCallback_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PtContainerCallback_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PtContainerCallback_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PtContainerCallback_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePtContainerCallback_tFids(env, src, &PGLOB(PtContainerCallback_tFc));
- getPtContainerCallback_tFields(env, src, src1, &PGLOB(PtContainerCallback_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PtContainerCallback_t;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PtContainerCallback_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PtContainerCallback_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PtContainerCallback_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePtContainerCallback_tFids(env, dest, &PGLOB(PtContainerCallback_tFc));
- setPtContainerCallback_tFields(env, dest, dest1, &PGLOB(PtContainerCallback_tFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtSendEventToWidget
- * Signature: (ILorg/eclipse/swt/internal/photon/PhEvent_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtSendEventToWidget
- (JNIEnv *env, jobject that, jint widget, jint event)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtSendEventToWidget\n");
-#endif
-
- return (jint) PtSendEventToWidget((PtWidget_t *)widget, (void *)event);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhCursorDef_t;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PhCursorDef_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PhCursorDef_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PhCursorDef_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhCursorDef_tFids(env, src, &PGLOB(PhCursorDef_tFc));
- getPhCursorDef_tFields(env, src, src1, &PGLOB(PhCursorDef_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhCursorDef_t;II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhCursorDef_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhCursorDef_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhCursorDef_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhCursorDef_tFids(env, dest, &PGLOB(PhCursorDef_tFc));
- setPhCursorDef_tFields(env, dest, dest1, &PGLOB(PhCursorDef_tFc));
- }
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgSetFillTransPat
- * Signature: ([B)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetFillTransPat
- (JNIEnv *env, jobject that, jbyteArray pat)
-{
- char *pat1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgSetFillTransPat\n");
-#endif
-
- if (pat)
- pat1 = (char *)(*env)->GetByteArrayElements(env, pat, NULL);
-
- PgSetFillTransPat(pat1);
-
- if (pat)
- (*env)->ReleaseByteArrayElements(env, pat, (jbyte *)pat1, 0);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PtInflateBalloon
- * Signature: (III[B[BII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtInflateBalloon
- (JNIEnv *env, jobject that, jint win, jint me, jint position, jbyteArray str, jbyteArray font, int fill, int text_color)
-{
- jbyte *font1=NULL;
- jbyte *str1=NULL;
- int result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PtInflateBalloon\n");
-#endif
-
- if (font)
- font1 = (*env)->GetByteArrayElements(env, font, NULL);
- if (str)
- str1 = (*env)->GetByteArrayElements(env, str, NULL);
-
- result = (jint) PtInflateBalloon((PtWidget_t *)win, (PtWidget_t *)me, position, str1, font1, fill, text_color);
-
- if (font)
- (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT);
- if (str)
- (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PgDisplaySettings_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PgDisplaySettings_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PgDisplaySettings_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PgDisplaySettings_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePgDisplaySettings_tFids(env, src, &PGLOB(PgDisplaySettings_tFc));
- getPgDisplaySettings_tFields(env, src, src1, &PGLOB(PgDisplaySettings_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PgDisplaySettings_t;II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PgDisplaySettings_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PgDisplaySettings_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PgDisplaySettings_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePgDisplaySettings_tFids(env, dest, &PGLOB(PgDisplaySettings_tFc));
- setPgDisplaySettings_tFields(env, dest, dest1, &PGLOB(PgDisplaySettings_tFc));
- }
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PgVideoModeInfo_t;I)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_eclipse_swt_internal_photon_PgVideoModeInfo_1t_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
-
- PgVideoModeInfo_t object, *src1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_photon_PgVideoModeInfo_1t_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePgVideoModeInfo_tFids(env, src, &PGLOB(PgVideoModeInfo_tFc));
- getPgVideoModeInfo_tFields(env, src, src1, &PGLOB(PgVideoModeInfo_tFc));
- }
- memmove((void *)dest, (void *)src1, count);
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PgVideoModeInfo_t;II)V
- */
-/*
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PgVideoModeInfo_1t_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PgVideoModeInfo_t object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PgVideoModeInfo_1t_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePgVideoModeInfo_tFids(env, dest, &PGLOB(PgVideoModeInfo_tFc));
- setPgVideoModeInfo_tFields(env, dest, dest1, &PGLOB(PgVideoModeInfo_tFc));
- }
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgGetVideoMode
- * Signature: (Lorg/eclipse/swt/internal/photon/PgDisplaySettings_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgGetVideoMode
- (JNIEnv *env, jobject that, jobject settings)
-{
- DECL_GLOB(pGlob)
- PgDisplaySettings_t settings1 = {0}, *lpSettings1=&settings1;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgGetVideoMode\n");
-#endif
-
- result = (jint)PgGetVideoMode(lpSettings1);
-
- if (settings) {
- cachePgDisplaySettings_tFids(env, settings, &PGLOB(PgDisplaySettings_tFc));
- setPgDisplaySettings_tFields(env, settings, lpSettings1, &PGLOB(PgDisplaySettings_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PgGetVideoModeInfo
- * Signature: (ILorg/eclipse/swt/internal/photon/PgVideoModeInfo_t;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgGetVideoModeInfo
- (JNIEnv *env, jobject that, jint mode_number, jobject mode_info)
-{
- DECL_GLOB(pGlob)
- PgVideoModeInfo_t mode_info1, *lpmode_info1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PgGetVideoModeInfo\n");
-#endif
-
- if (mode_info) {
- lpmode_info1 = &mode_info1;
- cachePgVideoModeInfo_tFids(env, mode_info, &PGLOB(PgVideoModeInfo_tFc));
- getPgVideoModeInfo_tFields(env, mode_info, lpmode_info1, &PGLOB(PgVideoModeInfo_tFc));
- }
- result = (jint)PgGetVideoModeInfo(mode_number, lpmode_info1);
-
- if (mode_info) {
- setPgVideoModeInfo_tFields(env, mode_info, lpmode_info1, &PGLOB(PgVideoModeInfo_tFc));
- }
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardCopy
- * Signature: (SI[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardCopy
- (JNIEnv *env, jclass that, jshort ig, jint n, jbyteArray clip)
-{
- jbyte *clip1;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardCopy\n");
-#endif
-
- if (clip) {
- clip1 = (*env)->GetByteArrayElements(env, clip, NULL);
- }
-
- result = (jint)PhClipboardCopy(ig, n, (PhClipHeader const *)clip1);
-
- if (clip) {
- (*env)->ReleaseByteArrayElements(env, clip, clip1, 0);
- }
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardPasteStart
- * Signature: (S)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardPasteStart
- (JNIEnv *env, jobject that, jshort ig)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardPasteStart\n");
-#endif
-
- return (jint) PhClipboardPasteStart(ig);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardPasteType
- * Signature: (I[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardPasteType
- (JNIEnv *env, jobject that, jint cbdata, jbyteArray type)
-{
- char *type1=NULL;
- jint result;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardPasteType\n");
-#endif
-
- if (type)
- type1 = (char *)(*env)->GetByteArrayElements(env, type, NULL);
-
- result = (jint) PhClipboardPasteType((void *)cbdata, type1);
-
- if (type)
- (*env)->ReleaseByteArrayElements(env, type, (jbyte *)type1, 0);
-
- return result;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardPasteTypeN
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardPasteTypeN
- (JNIEnv *env, jobject that, jint cbdata, jint n)
-{
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardPasteTypeN\n");
-#endif
- return (jint) PhClipboardPasteTypeN((void *)cbdata, n);
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: PhClipboardPasteFinish
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardPasteFinish
- (JNIEnv *env, jobject that, jint cbdata)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardPasteFinish\n");
-#endif
-
- PhClipboardPasteFinish((void *)cbdata);
-
- return;
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (Lorg/eclipse/swt/internal/photon/PhClipHeader;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_eclipse_swt_internal_photon_PhClipHeader_2II
- (JNIEnv *env, jobject that, jobject dest, jint src, jint count)
-{
- DECL_GLOB(pGlob)
- PhClipHeader object, *dest1=NULL;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_photon_PhClipHeader_2II\n");
-#endif
-
- memmove((void *)&object, (void *)src, count);
- if (dest) {
- dest1=&object;
- cachePhClipHeaderFids(env, dest, &PGLOB(PhClipHeaderFc));
- setPhClipHeaderFields(env, dest, dest1, &PGLOB(PhClipHeaderFc));
- }
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: ([BLorg/eclipse/swt/internal/photon/PhClipHeader;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I
- (JNIEnv *env, jobject that, jbyteArray dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- jbyte *dest1=NULL;
- PhClipHeader object, *src1= NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhClipHeaderFids(env, src, &PGLOB(PhClipHeaderFc));
- getPhClipHeaderFields(env, src, src1, &PGLOB(PhClipHeaderFc));
- }
-
- if (dest) {
- dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
- }
-
- memmove((void *)dest1, (void *)src1, count);
-
- if (dest) {
- (*env)->ReleaseByteArrayElements(env, dest, (jbyte *)dest1, 0);
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_photon_OS
- * Method: memmove
- * Signature: (ILorg/eclipse/swt/internal/photon/PhClipHeader;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___ILorg_eclipse_swt_internal_photon_PhClipHeader_2I
- (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
-{
- DECL_GLOB(pGlob)
- PhClipHeader object, *src1= NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I\n");
-#endif
-
- if (src) {
- src1=&object;
- cachePhClipHeaderFids(env, src, &PGLOB(PhClipHeaderFc));
- getPhClipHeaderFields(env, src, src1, &PGLOB(PhClipHeaderFc));
- }
-
- memmove((void *)dest, (void *)src1, count);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontDetails.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontDetails.java
deleted file mode 100644
index 04879a4ab9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontDetails.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class FontDetails {
- public byte[] desc = new byte[OS.MAX_DESC_LENGTH];
- public byte[] stem = new byte[OS.MAX_FONT_TAG];
- public short losize;
- public short hisize;
- public short flags;
- public static final int sizeof = 128;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java
deleted file mode 100644
index 90cf14d8d8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class FontQueryInfo {
- public byte[] font = new byte[OS.MAX_FONT_TAG];
- public byte[] desc = new byte[OS.MAX_DESC_LENGTH];
- public short size;
- public short style;
- public short ascender;
- public short descender;
- public short width;
- public int lochar;
- public int hichar;
- public static final int sizeof = 140;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java
deleted file mode 100644
index 87a03222fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java
+++ /dev/null
@@ -1,2971 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-
-public class OS {
-
- /* Load the SWT library. */
- static {
- Library.loadLibrary ("swt");
- }
-
-/**** BEGIN MANUALLY ADDED/FIXED ***/
- public static final int Pt_SET_DRAW_F = 1507348;
- public static final int Pt_ARG_ORIENTATION = ( 21 * 1000 + 5 );
- public static final int Pt_ARG_SCROLL_POSITION = ( 21 * 1000 + 4 );
- public static final int Pt_ARG_MAXIMUM = ( 21 * 1000 + 3 );
- public static final int Pt_ARG_MINIMUM = ( 21 * 1000 + 2 );
- public static final int Pt_ARG_WIDTH = ( 1 * 1000 + 23 );
- public static final int Pt_ARG_HEIGHT = ( 1 * 1000 + 24 );
-// public static final int Pt_ARG_STYLE = ( 2 * 1000 + 18 );
-// public static final int Ph_USE_TRANSPARENCY = 0x80;
- public static final int Ph_RELEASE_IMAGE_ALL = 0x1F;
-
- public static final int Pt_TOP_ETCH = 0x00000001;
- public static final int Pt_BOTTOM_ETCH = 0x00000002;
- public static final int Pt_LEFT_ETCH = 0x00000004;
- public static final int Pt_RIGHT_ETCH = 0x00000008;
- public static final int Pt_TOP_OUTLINE = 0x00000010;
- public static final int Pt_BOTTOM_OUTLINE = 0x00000020;
- public static final int Pt_LEFT_OUTLINE = 0x00000040;
- public static final int Pt_RIGHT_OUTLINE = 0x00000080;
- public static final int Pt_TOP_BEVEL = 0x00000100;
- public static final int Pt_BOTTOM_BEVEL = 0x00000200;
- public static final int Pt_LEFT_BEVEL = 0x00000400;
- public static final int Pt_RIGHT_BEVEL = 0x00000800;
- public static final int Pt_TOP_INLINE = 0x00001000;
- public static final int Pt_BOTTOM_INLINE = 0x00002000;
- public static final int Pt_LEFT_INLINE = 0x00004000;
- public static final int Pt_RIGHT_INLINE = 0x00008000;
-// public static final int Pt_FLAT_FILL = 0x00010000;
-// public static final int Pt_FULL_BORDERS = 0x00020000;
-// public static final int Pt_FULL_BEVELS = 0x00020000;
- public static final int Pt_HORIZONTAL_GRADIENT = 0x00040000;
-// public static final int Pt_REVERSE_GRADIENT = 0x00080000;
- public static final int Pt_STATIC_GRADIENT = 0x00100000;
-// public static final int Pt_STATIC_BORDERS = 0x00200000;
-// public static final int Pt_STATIC_BEVELS = 0x00200000;
-// public static final int Pt_STATIC_BORDER_COLORS = 0x00400000;
-// public static final int Pt_STATIC_BEVEL_COLORS = 0x00400000;
-// public static final int Pt_BASIC_ARMED = 0x80000000;
-// public static final int Pt_BASIC_RO_FLAGS = 0x80000000;
-// public static final int Pt_TOP_LEFT_ETCH = (Pt_TOP_ETCH | Pt_LEFT_ETCH);
-// public static final int Pt_BOTTOM_RIGHT_ETCH = (Pt_BOTTOM_ETCH | Pt_RIGHT_ETCH);
-// public static final int Pt_ALL_ETCHED = (Pt_TOP_LEFT_ETCH | Pt_BOTTOM_RIGHT_ETCH);
- public static final int Pt_ALL_ETCHES = (Pt_TOP_ETCH | Pt_BOTTOM_ETCH | Pt_LEFT_ETCH | Pt_RIGHT_ETCH );
-// public static final int Pt_TOP_LEFT_OUTLINE = (Pt_TOP_OUTLINE | Pt_LEFT_OUTLINE);
-// public static final int Pt_BOTTOM_RIGHT_OUTLINE = (Pt_BOTTOM_OUTLINE | Pt_RIGHT_OUTLINE );
- public static final int Pt_ALL_OUTLINES = (Pt_TOP_OUTLINE | Pt_BOTTOM_OUTLINE | Pt_LEFT_OUTLINE | Pt_RIGHT_OUTLINE);
-// public static final int Pt_TOP_LEFT_INLINE = (Pt_TOP_INLINE | Pt_LEFT_INLINE);
-// public static final int Pt_BOTTOM_RIGHT_INLINE = (Pt_BOTTOM_INLINE | Pt_RIGHT_INLINE );
- public static final int Pt_ALL_INLINES = (Pt_TOP_INLINE | Pt_BOTTOM_INLINE | Pt_LEFT_INLINE | Pt_RIGHT_INLINE);
-// public static final int Pt_TOP_LEFT_BEVEL = (Pt_TOP_BEVEL | Pt_LEFT_BEVEL);
-// public static final int Pt_BOTTOM_RIGHT_BEVEL = (Pt_BOTTOM_BEVEL | Pt_RIGHT_BEVEL );
-// public static final int Pt_ALL_BEVELS = (Pt_TOP_BEVEL | Pt_BOTTOM_BEVEL | Pt_LEFT_BEVEL | Pt_RIGHT_BEVEL);
-// public static final int Pt_ALL_TOP = (Pt_TOP_ETCH | Pt_TOP_OUTLINE | Pt_TOP_BEVEL | Pt_TOP_INLINE);
-// public static final int Pt_ALL_BOTTOM = (Pt_BOTTOM_ETCH | Pt_BOTTOM_OUTLINE | Pt_BOTTOM_BEVEL | Pt_BOTTOM_INLINE);
-// public static final int Pt_ALL_LEFT = (Pt_LEFT_ETCH | Pt_LEFT_OUTLINE | Pt_LEFT_BEVEL | Pt_LEFT_INLINE);
-// public static final int Pt_ALL_RIGHT = (Pt_RIGHT_ETCH | Pt_RIGHT_OUTLINE | Pt_RIGHT_BEVEL | Pt_RIGHT_INLINE);
-// public static final int Pt_ALL = (Pt_ALL_TOP | Pt_ALL_BOTTOM | Pt_ALL_LEFT | Pt_ALL_RIGHT);
-
- public static final int NAME_MAX = 255;
- public static final int PATH_MAX = 1024;
- public static final int Pt_FSR_NO_FCHECK = 0x000100;
-// public static final int Pt_FSR_NO_FSPEC = 0x000200;
-// public static final int Pt_FSR_NO_UP_BUTTON = 0x000400;
-// public static final int Pt_FSR_NO_NEW = 0x000800;
-// public static final int Pt_FSR_NO_NEW_BUTTON = 0x001000;
- public static final int Pt_FSR_NO_SELECT_FILES = 0x002000;
- public static final int Pt_FSR_SELECT_DIRS = 0x004000;
-// public static final int Pt_FSR_CREATE_PATH = 0x008000;
-// public static final int Pt_FSR_NO_CONFIRM_CREATE_PATH = 0x010000;
-// public static final int Pt_FSR_NO_DELETE = 0x020000;
-// public static final int Pt_FSR_NO_CONFIRM_DELETE = 0x040000;
-// public static final int Pt_FSR_RECURSIVE_DELETE = 0x080000;
-// public static final int Pt_FSR_CONFIRM_EXISTING = 0x100000;
-// public static final int Pt_FSR_CENTER = 0x200000;
-
- public static final int Pt_ARG_BEVEL_WIDTH = ( 1 * 1000 + 1 );
- public static final int Pt_ARG_INLINE_COLOR = ( 2 * 1000 + 23 );
- public static final int Pt_ARG_OUTLINE_COLOR = ( 2 * 1000 + 22 );
- public static final int Pt_ARG_LIGHT_FILL_COLOR = ( 2 * 1000 + 24 );
- public static final int Pt_ARG_DARK_FILL_COLOR = ( 2 * 1000 + 25 );
- public static final int Pt_ARG_DARK_BEVEL_COLOR = ( 2 * 1000 + 6 );
- public static final int Pt_ARG_LIGHT_BEVEL_COLOR = ( 2 * 1000 + 0 );
- public static final int Pt_ARG_BEVEL_COLOR = ( 2 * 1000 + 21 );
-
- public static final int Pt_INDEX_COLOR = 0x2000000;
-
-// public static final int Pg_ALPHA_VALID = 0x80000000;
-// public static final int Pg_ALPHA_OP_TEST = 0x00010000;
-// public static final int Pg_ALPHA_OP_DEST_GLOBAL = 0x00020000;
- public static final int Pg_ALPHA_OP_SRC_GLOBAL = 0x00040000;
- public static final int Pg_ALPHA_OP_SRC_MAP = 0x00080000;
-// public static final int Pg_ALPHA_OP_SRC_GRADIENT = 0x00100000;
-// public static final int Pg_BLEND_SRC_ZERO = 0x0000; // (0,0,0,0)
-// public static final int Pg_BLEND_SRC_ONE = 0x0100; // (1,1,1,1)
-// public static final int Pg_BLEND_SRC_DST_COLOR = 0x0200; // (Ad,Rd,Gd,Bd)
-// public static final int Pg_BLEND_SRC_ONE_MINUS_DST_ALPHA = 0x0300; // (1,1,1,1)-(Ad,Rd,Gd,Bd)
- public static final int Pg_BLEND_SRC_SRC_ALPHA = 0x0400; // (As,As,As,As)
-// public static final int Pg_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 0x0500; // (1,1,1,1)-(As,As,As,As)
-// public static final int Pg_BLEND_SRC_DST_ALPHA = 0x0600; // (Ad,Ad,Ad,Ad)
-// public static final int Pg_BLEND_ONE_MINUS_DST_ALPHA = 0x0700; // (1,1,1,1)-(Ad,Ad,Ad,Ad)
-// public static final int Pg_BLEND_DST_ZERO = 0x00; // (0,0,0,0)
-// public static final int Pg_BLEND_DST_ONE = 0x01; // (1,1,1,1)
-// public static final int Pg_BLEND_DST_SRC_COLOR = 0x02; // (As,Rs,Gs,Bs)
-// public static final int Pg_BLEND_DST_ONE_MINUS_SRC = 0x03; // (1,1,1,1)-(As,Rs,Gs,Bs)
-// public static final int Pg_BLEND_DST_SRC_ALPHA = 0x04; // (As,As,As,As)
- public static final int Pg_BLEND_DST_ONE_MINUS_SRC_ALPHA = 0x05; // (1,1,1,1)-(As,As,As,As)
-// public static final int Pg_BLEND_DST_DST_ALPHA = 0x06; // (Ad,Ad,Ad,Ad)
-// public static final int Pg_BLEND_DST_ONE_MINUS_DST_ALPHA = 0x07; // (1,1,1,1)-(Ad,Ad,Ad,Ad)
-
-// public static final int Pg_GRAD_BYTES_PER_PIXEL = 3;
-// public static final int Pg_GRAD_IMAGE_TYPE = Pg_IMAGE_DIRECT_888;
-// public static final int Pg_GRAD_BOXY = 0x80000000;
-// public static final int Pg_GRAD_NOGRADIENT = 0;
-// public static final int Pg_GRAD_VECTOR = 1;
-// public static final int Pg_GRAD_RADIAL = 2;
- public static final int Pg_GRAD_HORIZONTAL = 3;
- public static final int Pg_GRAD_VERTICAL = 4;
-// public static final int Pg_GRAD_FAST_VECTOR = 5;
-// public static final int Pg_GRAD_DIAGF = 6;
-// public static final int Pg_GRAD_DIAGB = 7;
-// public static final int Pg_GRAD_4POINT = 8;
-// public static final int Pg_GRAD_BOX_DIAGF = Pg_GRAD_DIAGF | Pg_GRAD_BOXY;
-// public static final int Pg_GRAD_BOX_DIAGB = Pg_GRAD_DIAGB | Pg_GRAD_BOXY;
-// public static final int Pg_GRAD_BOX_4POINT = Pg_GRAD_4POINT | Pg_GRAD_BOXY;
-// public static final int Pg_GRAD_TABLE = 100;
- public static final int Pg_GRAD_LINEAR = 0;
-// public static final int Pg_GRAD_HILL = 1;
-// public static final int Pg_GRAD_HILL2 = 2;
-// public static final int Pg_GRAD_EXP = 3;
-
-// public static final int Pt_ARG_PG_FLAGS = 64 * 1000 + 0;
-// public static final int Pt_ARG_PG_CURRENT = 64 * 1000 + 1;
- public static final int Pt_ARG_PG_PANEL_TITLES = 64 * 1000 + 2;
-// public static final int Pt_ARG_PG_CONTAINERS = 64 * 1000 + 3;
-// public static final int Pt_ARG_PG_SELECTION_MODE = 64 * 1000 + 4;
- public static final int Pt_ARG_PG_CURRENT_INDEX = 64 * 1000 + 5;
-// public static final int Pt_ARG_PG_OVERLAP_THRESHOLD = 64 * 1000 + 6;
-// public static final int Pt_ARG_PG_DEFAULT_TAB_COLOR = 64 * 1000 + 7;
- public static final int Pt_CB_PG_PANEL_SWITCHING = 64 * 1000 + 10;
- public static final int Pt_PG_INVALID = 65535;
-
- public static final int Pt_ARG_TITLE = 10 * 1000 + 7;
- public static final int Pt_ARG_TITLE_FONT = 10 * 1000 + 8;
- public static final int Pt_SHOW_TITLE = 0x00000100;
- public static final int Pt_ETCH_TITLE_AREA = 0x00000200;
- public static final int Pt_GRADIENT_TITLE_AREA = 0x00000400;
-
- public static final int PF_STYLE_BOLD = 0x1;
- public static final int PF_STYLE_ITALIC = 0x2;
-
- public static final int PFFONT_DONT_SHOW_LEGACY = 0x40;
-
-// public static final int Pt_ARG_CS_COLOR = ( 150 * 1000 + 1 );
-// public static final int Pt_ARG_CS_COLOR_MODELS = ( 150 * 1000 + 2 );
-// public static final int Pt_ARG_CS_PALETTE = ( 150 * 1000 + 4 );
-
- public static final int Ph_WM_RENDER_COLLAPSE = 0x00004000;
-
- public static final int Pt_ARG_LABEL_IMAGE = ( 3 * 1000 + 1 );
-
- public static final int Pt_ARG_TOOLBAR_FLAGS = ( 61 * 1000 + 0 );
- public static final int Pt_ARG_TOOLBAR_SPACING = ( 61 * 1000 + 1 );
- public static final int Pt_TOOLBAR_DRAGGABLE = 0x0001;
- public static final int Pt_TOOLBAR_ITEM_SEPARATORS = 0x0020;
- public static final int Pt_TOOLBAR_END_SEPARATOR = 0x0040;
-
- public static final int Pt_COLORSELECT_MODAL = 0x4;
- public static final int Pt_COLORSELECT_ACCEPT = 0x8000;
-
- public static final int Pt_PROCESS = 0;
-// public static final int Pt_IGNORE = 1;
- public static final int Pt_CONSUME = 2;
- public static final int Pt_CB_FILTER = ( 1 * 1000 + 26 );
-
- public static final int Pt_ALL_BUTTONS = 0x00800000;
- public static final int Pt_MENUABLE = 0x08000000;
-
- public static final int Ph_CONSUMED = 0x0004;
-
- public static final int Pt_ARG_MODIFIER_KEYS = ( 7 * 1000 + 4 );
-
- public static final byte [] Pg_PAT_HALF = {(byte)0xAA, (byte)0x55, (byte)0xAA, (byte)0x55, (byte)0xAA, (byte)0x55, (byte)0xAA, (byte)0x55};
-
- public static final int Pt_ARG_BEVEL_CONTRAST = ( 2 * 1000 + 20 );
-
- public static final int Pt_NO_PARENT = 1;
-
-/*** END MANUALLY ADDED/FIXED ***/
-
-//public static final int Aw_ARG_ONOFF_STATE = ( 5 * 1000 + 1 );
-//public static final int Aw_CB_ONOFF_NEW_VALUE = ( 5 * 1000 + 0 );
-//public static final int DEV_CTRL_DEVICE_LAYER = 1;
-//public static final int DEV_CTRL_INPUT = 1;
-//public static final int DEV_CTRL_LAYER_MASK = 0xf0000000;
-//public static final int DEV_CTRL_OUTPUT = 2;
-//public static final int DEV_CTRL_PROTOCOL_LAYER = 2;
-//public static final int DEV_CTRL_SWITCH_MASK = 0x0f000000;
-//public static final int DEV_CTRL_TRANSLATE = 4;
-//public static final int DEV_CTRL_TYPE_MASK = 0x000000ff;
-//public static final int IsBorder = 0x00000200;
-//public static final int IsColorMode = 0x00010000;
-//public static final int IsColors = 0x04000000;
-//public static final int IsCopies = 0x00008000;
-//public static final int IsDither = 0x00400000;
-//public static final int IsDuplex = 0x00200000;
-//public static final int IsInkType = 0x01000000;
-//public static final int IsIntensity = 0x00800000;
-//public static final int IsMargins = 0x00000100;
-//public static final int IsOrientation = 0x00020000;
-//public static final int IsPageRange = 0x10000000;
-//public static final int IsPaperCollate = 0x00100000;
-//public static final int IsPaperSize = 0x00000040;
-//public static final int IsPaperSource = 0x00040000;
-//public static final int IsPaperType = 0x00080000;
-//public static final int IsPrinterDpi = 0x00000010;
-//public static final int IsScale = 0x00004000;
-//public static final int IsSrcColors = 0x02000000;
-//public static final int IsSrcDim = 0x00000001;
-//public static final int IsSrcDpi = 0x00001000;
-//public static final int IsSrcOff = 0x00000004;
-//public static final int KEY_CAP_VALID = 0x00000080;
-//public static final int KEY_DEAD = 0x40000000;
-//public static final int KEY_DEAD_FLAG = 0x80;
-//public static final int KEY_DOWN = 0x00000001;
-//public static final int KEY_MASK = 0x03ff;
-//public static final int KEY_NOSYM_FLAG = 0x40;
-//public static final int KEY_OEM_CAP = 0x80000000;
-//public static final int KEY_REPEAT = 0x00000002;
-//public static final int KEY_SCAN_VALID = 0x00000020;
-//public static final int KEY_SYM_VALID = 0x00000040;
-//public static final int KEYBOARD_CTRL_ATTR_MASK = 0x000f0000;
-//public static final int KEYBOARD_CTRL_DELAY = 0x00001000;
-//public static final int KEYBOARD_CTRL_DISPLAY = 0x00000400;
-//public static final int KEYBOARD_CTRL_DISPLAY_OFF = 0x00020000;
-//public static final int KEYBOARD_CTRL_DISPLAY_ON = 0x00010000;
-//public static final int KEYBOARD_CTRL_FILENAME = 0x00002000;
-//public static final int KEYBOARD_CTRL_LAYER = 0x00040000;
-//public static final int KEYBOARD_CTRL_LAYER_MASK = DEV_CTRL_LAYER_MASK;
-//public static final int KEYBOARD_CTRL_OFF = 0x00000200;
-//public static final int KEYBOARD_CTRL_ON = 0x00000100;
-//public static final int KEYBOARD_CTRL_RATE = 0x00000800;
-//public static final int KEYBOARD_CTRL_SWITCH_MASK = DEV_CTRL_SWITCH_MASK;
-//public static final int KEYBOARD_CTRL_TYPE_MASK = (DEV_CTRL_TYPE_MASK << 8);
-//public static final int KEYCAP = 0x0400;
-//public static final int KEYCODE_PC_KEYS = 0xF000;
-//public static final int KEYCODE_CAPS_LOCK = (KEYCODE_PC_KEYS + 0xe5);
-//public static final int KEYCODE_DELETE = (KEYCODE_PC_KEYS + 0xff);
-//public static final int KEYCODE_DOWN = (KEYCODE_PC_KEYS + 0x54);
-//public static final int KEYCODE_END = (KEYCODE_PC_KEYS + 0x57);
-//public static final int KEYCODE_ESCAPE = (KEYCODE_PC_KEYS + 0x1b);
-//public static final int KEYCODE_F1 = (KEYCODE_PC_KEYS + 0xbe);
-//public static final int KEYCODE_F10 = (KEYCODE_PC_KEYS + 0xc7);
-//public static final int KEYCODE_F11 = (KEYCODE_PC_KEYS + 0xc8);
-//public static final int KEYCODE_F12 = (KEYCODE_PC_KEYS + 0xc9);
-//public static final int KEYCODE_F2 = (KEYCODE_PC_KEYS + 0xbf);
-//public static final int KEYCODE_F3 = (KEYCODE_PC_KEYS + 0xc0);
-//public static final int KEYCODE_F4 = (KEYCODE_PC_KEYS + 0xc1);
-//public static final int KEYCODE_F5 = (KEYCODE_PC_KEYS + 0xc2);
-//public static final int KEYCODE_F6 = (KEYCODE_PC_KEYS + 0xc3);
-//public static final int KEYCODE_F7 = (KEYCODE_PC_KEYS + 0xc4);
-//public static final int KEYCODE_F8 = (KEYCODE_PC_KEYS + 0xc5);
-//public static final int KEYCODE_F9 = (KEYCODE_PC_KEYS + 0xc6);
-//public static final int KEYCODE_HOME = (KEYCODE_PC_KEYS + 0x50);
-//public static final int KEYCODE_INSERT = (KEYCODE_PC_KEYS + 0x63);
-//public static final int KEYCODE_KP_DELETE = (KEYCODE_PC_KEYS + 0xae);
-//public static final int KEYCODE_KP_DIVIDE = (KEYCODE_PC_KEYS + 0xaf);
-//public static final int KEYCODE_KP_DOWN = (KEYCODE_PC_KEYS + 0xb2);
-//public static final int KEYCODE_KP_END = (KEYCODE_PC_KEYS + 0xb1);
-//public static final int KEYCODE_KP_ENTER = (KEYCODE_PC_KEYS + 0x8d);
-//public static final int KEYCODE_KP_FIVE = (KEYCODE_PC_KEYS + 0xb5);
-//public static final int KEYCODE_KP_HOME = (KEYCODE_PC_KEYS + 0xb7);
-//public static final int KEYCODE_KP_INSERT = (KEYCODE_PC_KEYS + 0xb0);
-//public static final int KEYCODE_KP_LEFT = (KEYCODE_PC_KEYS + 0xb4);
-//public static final int KEYCODE_KP_MINUS = (KEYCODE_PC_KEYS + 0xad);
-//public static final int KEYCODE_KP_MULTIPLY = (KEYCODE_PC_KEYS + 0xaa);
-//public static final int KEYCODE_KP_PG_DOWN = (KEYCODE_PC_KEYS + 0xb3);
-//public static final int KEYCODE_KP_PG_UP = (KEYCODE_PC_KEYS + 0xb9);
-//public static final int KEYCODE_KP_PLUS = (KEYCODE_PC_KEYS + 0xab);
-//public static final int KEYCODE_KP_RIGHT = (KEYCODE_PC_KEYS + 0xb6);
-//public static final int KEYCODE_KP_UP = (KEYCODE_PC_KEYS + 0xb8);
-//public static final int KEYCODE_LEFT = (KEYCODE_PC_KEYS + 0x51);
-//public static final int KEYCODE_LEFT_ALT = (KEYCODE_PC_KEYS + 0xe9);
-//public static final int KEYCODE_LEFT_CTRL = (KEYCODE_PC_KEYS + 0xe3);
-//public static final int KEYCODE_LEFT_HYPER = (KEYCODE_PC_KEYS + 0xed);
-//public static final int KEYCODE_LEFT_SHIFT = (KEYCODE_PC_KEYS + 0xe1);
-//public static final int KEYCODE_MENU = (KEYCODE_PC_KEYS + 0x67);
-//public static final int KEYCODE_NUM_LOCK = (KEYCODE_PC_KEYS + 0x7f);
-//public static final int KEYCODE_PAUSE = (KEYCODE_PC_KEYS + 0x13);
-//public static final int KEYCODE_PG_DOWN = (KEYCODE_PC_KEYS + 0x56);
-//public static final int KEYCODE_PG_UP = (KEYCODE_PC_KEYS + 0x55);
-//public static final int KEYCODE_PRINT = (KEYCODE_PC_KEYS + 0x61);
-//public static final int KEYCODE_RETURN = (KEYCODE_PC_KEYS + 0x0d);
-//public static final int KEYCODE_RIGHT = (KEYCODE_PC_KEYS + 0x53);
-//public static final int KEYCODE_RIGHT_ALT = (KEYCODE_PC_KEYS + 0xea);
-//public static final int KEYCODE_RIGHT_CTRL = (KEYCODE_PC_KEYS + 0xe4);
-//public static final int KEYCODE_RIGHT_HYPER = (KEYCODE_PC_KEYS + 0xee);
-//public static final int KEYCODE_RIGHT_SHIFT = (KEYCODE_PC_KEYS + 0xe2);
-//public static final int KEYCODE_SCROLL_LOCK = (KEYCODE_PC_KEYS + 0x14);
-//public static final int KEYCODE_SYSREQ = (KEYCODE_PC_KEYS + 0x6a);
-//public static final int KEYCODE_TAB = (KEYCODE_PC_KEYS + 0x09);
-//public static final int KEYCODE_UP = (KEYCODE_PC_KEYS + 0x52);
-//public static final int KEYCOMPOSE_CODE = 0x0000;
-//public static final int KEYCOMPOSE_LAST = 0x8000;
-//public static final int KEYCOMPOSE_SIZE = 0x3fff;
-//public static final int KEYCOMPOSE_TABLE = 0x4000;
-//public static final int KEYGRP_MAX = 15;
-//public static final int KEYIND_CAPS_LOCK = 0x04;
-//public static final int KEYIND_NUM_LOCK = 0x02;
-//public static final int KEYIND_SCROLL_LOCK = 0x01;
-//public static final int KEYINDICATOR_MAX = 7;
-//public static final int KEYMAP_COMPOSE = 5;
-//public static final int KEYMAP_EXTENDED_MAP = 1;
-//public static final int KEYMAP_GEOMETRY = 7;
-//public static final int KEYMAP_GROUPS = 2;
-//public static final int KEYMAP_INDICATORS = 6;
-//public static final int KEYMAP_KEYS = 3;
-//public static final int KEYMAP_MAGIC = 0x2044424b;
-//public static final int KEYMAP_MODIFIERS = 4;
-//public static final int KEYMAP_NAME = 0;
-//public static final int KEYMODBIT_ALT = 2;
-//public static final int KEYMODBIT_ALT_LOCK = 10;
-//public static final int KEYMODBIT_ALTGR = 3;
-//public static final int KEYMODBIT_ALTGR_LOCK = 11;
-//public static final int KEYMODBIT_CAPS_LOCK = 16;
-//public static final int KEYMODBIT_CTRL = 1;
-//public static final int KEYMODBIT_CTRL_LOCK = 9;
-//public static final int KEYMODBIT_MASK = 0x3f;
-//public static final int KEYMODBIT_MOD6 = 5;
-//public static final int KEYMODBIT_MOD6_LOCK = 13;
-//public static final int KEYMODBIT_MOD7 = 6;
-//public static final int KEYMODBIT_MOD7_LOCK = 14;
-//public static final int KEYMODBIT_MOD8 = 7;
-//public static final int KEYMODBIT_MOD8_LOCK = 15;
-//public static final int KEYMODBIT_NUM_LOCK = 17;
-//public static final int KEYMODBIT_SCROLL_LOCK = 18;
-//public static final int KEYMODBIT_SHIFT = 0;
-//public static final int KEYMODBIT_SHIFT_LOCK = 8;
-//public static final int KEYMODBIT_SHL3 = 4;
-//public static final int KEYMODBIT_SHL3_LOCK = 12;
-//public static final int KEYMOD = 0x0800;
-//public static final int KEYMOD_ALT = (1 << KEYMODBIT_ALT);
-//public static final int KEYMOD_ALT_LOCK = (1 << KEYMODBIT_ALT_LOCK);
-//public static final int KEYMOD_ALTGR = (1 << KEYMODBIT_ALTGR);
-//public static final int KEYMOD_ALTGR_LOCK = (1 << KEYMODBIT_ALTGR_LOCK);
-//public static final int KEYMOD_AND = 0x80;
-//public static final int KEYMOD_CAPS_LOCK = (1 << KEYMODBIT_CAPS_LOCK);
-//public static final int KEYMOD_CTRL = (1 << KEYMODBIT_CTRL);
-//public static final int KEYMOD_CTRL_LOCK = (1 << KEYMODBIT_CTRL_LOCK);
-//public static final int KEYMOD_DOWN = 0x40;
-//public static final int KEYMOD_MOD6 = (1 << KEYMODBIT_MOD6);
-//public static final int KEYMOD_MOD6_LOCK = (1 << KEYMODBIT_MOD6_LOCK);
-//public static final int KEYMOD_MOD7 = (1 << KEYMODBIT_MOD7);
-//public static final int KEYMOD_MOD7_LOCK = (1 << KEYMODBIT_MOD7_LOCK);
-//public static final int KEYMOD_MOD8 = (1 << KEYMODBIT_MOD8);
-//public static final int KEYMOD_MOD8_LOCK = (1 << KEYMODBIT_MOD8_LOCK);
-//public static final int KEYMOD_NUM_LOCK = (1 << KEYMODBIT_NUM_LOCK);
-//public static final int KEYMOD_OR = 0x00;
-//public static final int KEYMOD_PRESS = 0xc0;
-//public static final int KEYMOD_RELEASE = 0x80;
-//public static final int KEYMOD_SCROLL_LOCK = (1 << KEYMODBIT_SCROLL_LOCK);
-//public static final int KEYMOD_SHIFT = (1 << KEYMODBIT_SHIFT);
-//public static final int KEYMOD_SHIFT_LOCK = (1 << KEYMODBIT_SHIFT_LOCK);
-//public static final int KEYMOD_SHL3 = (1 << KEYMODBIT_SHL3);
-//public static final int KEYMOD_SHL3_LOCK = (1 << KEYMODBIT_SHL3_LOCK);
-//public static final int KEYMOD_UP = 0x00;
-//public static final int MAX_FONT_TAG = 80;
-//public static final int NAME_MAX = 48;
-//public static final int NUMERIC_BUF = 40;
-//public static final int PaperCollateAAABBBCCC = 0x0002;
-//public static final int PaperCollateABCABCABC = 0x0001;
-//public static final int PaperCollateDefault = 0x0000;
-//public static final int PaperSourceAuto = 0x0001;
-//public static final int PaperSourceDefault = 0x0000;
-//public static final int PaperSourceEnvelope = 0x0005;
-//public static final int PaperSourceLower = 0x0003;
-//public static final int PaperSourceManual = 0x0004;
-//public static final int PaperSourceManualEnv = 0x0006;
-//public static final int PaperSourceUpper = 0x0002;
-//public static final int PaperTypeDefault = 0x0000;
-//public static final int PaperTypeDraftQuality = 0x0003;
-//public static final int PaperTypeEnvelope = 0x0005;
-//public static final int PaperTypeHighQuality = 0x0002;
-//public static final int PaperTypeNormal = 0x0001;
-//public static final int PaperTypeTransparency = 0x0004;
-//public static final int PaperTypeTShirt = 0x0006;
-//public static final int PFR_STATS = 0x02;
-//public static final int Pg_DRAW_ARC = 0x44;
-//public static final int Pg_DRAW_BEVELBOX = 0x45;
-//public static final int Pg_DRAW_BEZIER = 0x47;
-//public static final int Pg_DRAW_BITBLIT = 0x46;
-//public static final int Pg_DRAW_BITBLT = 0x46;
-//public static final int Pg_DRAW_BITBLT_CHROMA = 0x4A;
-//public static final int Pg_DRAW_BITMAP = 0x44;
-//public static final int Pg_DRAW_ELLIPSE = 0x43;
- public static final int Pg_DRAW_FILL = 0x20;
- public static final int Pg_DRAW_STROKE = 0x10;
-//public static final int Pg_DRAW_FILL_STROKE = (Pg_DRAW_FILL | Pg_DRAW_STROKE);
-//public static final int Pg_DRAW_GETIMAGE = 0x4F;
-//public static final int Pg_DRAW_GRADIENT = 0xD2;
-//public static final int Pg_DRAW_GRID = 0x47;
-//public static final int Pg_DRAW_IMAGE = 0x45;
-//public static final int Pg_DRAW_LINE = 0x42;
-//public static final int Pg_DRAW_POINT = 0x40;
-//public static final int Pg_DRAW_POINT_ARRAY = 0x41;
-//public static final int Pg_DRAW_POLYGON = 0x40;
-//public static final int Pg_DRAW_RECT = 0x41;
-//public static final int Pg_DRAW_RRECT = 0x42;
-//public static final int Pg_DRAW_SPAN = 0x46;
-//public static final int Pg_DRAW_STROKE_FILL = Pg_DRAW_FILL_STROKE;
-//public static final int Pg_DRAW_TEXT = 0x43;
-//public static final int Pg_DRAW_TREND = 0x48;
-//public static final int Pg_DRAW_VECTOR = 0x49;
- public static final int Pg_ARC = (0x20 << 8);
-//public static final int Pg_ARC_CHORD = (0x00 << 8);
- public static final int Pg_ARC_PIE = (0x10 << 8);
-//public static final int Pg_ARC_FILL = Pg_DRAW_FILL;
-//public static final int Pg_ARC_FILL_CHORD = Pg_DRAW_STROKE | Pg_ARC_CHORD;
-//public static final int Pg_ARC_FILL_PIE = Pg_DRAW_FILL | Pg_ARC_PIE;
-//public static final int Pg_ARC_STROKE = Pg_DRAW_STROKE;
-//public static final int Pg_ARC_STROKE_ARC = Pg_DRAW_STROKE | Pg_ARC;
-//public static final int Pg_ARC_STROKE_CHORD = Pg_DRAW_STROKE | Pg_ARC_CHORD;
-//public static final int Pg_ARC_STROKE_PIE = Pg_DRAW_STROKE | Pg_ARC_PIE;
- public static final int Pg_BACK_FILL = (0x01 << 8);
-//public static final int Pg_BEVEL_ADOWN = 0xE000;
-//public static final int Pg_BEVEL_ALEFT = 0x2000;
-//public static final int Pg_BEVEL_ARIGHT = 0x6000;
-//public static final int Pg_BEVEL_ARROW = 0x2000;
-//public static final int Pg_BEVEL_AUP = 0xA000;
-//public static final int Pg_BEVEL_CLIP = 0x8000;
-//public static final int Pg_BEVEL_JOIN = 0x02;
-//public static final int Pg_BEVEL_MAX = 15;
-//public static final int Pg_BEVEL_ROUND = 0xC000;
-//public static final int Pg_BEVEL_SET = 0x1000;
-//public static final int Pg_BEVEL_SQUARE = 0x0000;
-//public static final int Pg_BEVEL_TYPE_MASK = 0xE000;
-public static final int Pg_BITMAP_BACKFILL = 0xFE;
-public static final int Pg_BITMAP_TRANSPARENT = 0xFF;
-//public static final int Pg_BUTT_CAP = 0x00;
-//public static final int Pg_BUTT_JOIN = 0x04;
-//public static final int Pg_CAH_INLINE_OFF_SIZE = 0x00000040;
-//public static final int Pg_CAH_RECORD_SIZE_MASK = 0x0000003F;
-//public static final int Pg_CAH_RELAY_TAGGED = 0x00002000;
-//public static final int Pg_CAH_SHMEM_LIMIT = 0x00000100;
-//public static final int Pg_CAH_SHMEM_NAME = 0x00000080;
-//public static final int Pg_CAH_SHMEM_OFFSET = 0x00000200;
-//public static final int Pg_CAH_SRCE_OFFSET = 0x00000800;
-//public static final int Pg_CAH_SRCE_SIZE = 0x00001000;
-//public static final int Pg_CAH_SRCE_TAG = 0x00000400;
-//public static final int Pg_CENTER_BASED = (0x00 << 8);
-//public static final int Pg_CHROMA_DEST_KEY = 0x00000001;
-//public static final int Pg_CHROMA_DEST_MATCH = 1;
-//public static final int Pg_CHROMA_DRAW = 0;
-//public static final int Pg_CHROMA_NODRAW = 2;
-//public static final int Pg_CHROMA_NOT_DST_KEY = 0x00000003;
-//public static final int Pg_CHROMA_NOT_SRC_KEY = 0x00000002;
-//public static final int Pg_CHROMA_SRC_KEY = 0x00000000;
-//public static final int Pg_CHROMA_SRC_MATCH = 0;
-//public static final int Pg_CLIPTEST_CURSOR_HIDE = 0x0020;
- public static final int Pg_CLOSED = (0x10 << 8);
-//public static final int Pg_CMD_CAH_COUNT_1 = 0x00010000;
-//public static final int Pg_CMD_CAH_COUNT_2 = 0x00020000;
-//public static final int Pg_CMD_CAH_COUNT_3 = 0x00030000;
-//public static final int Pg_CMD_CAH_COUNT_MASK = 0x00030000;
-//public static final int Pg_CMD_CAH_COUNT_UNIT = 0x00010000;
-//public static final int Pg_CMD_CMD_SIZE_MASK = 0xFFFC0000;
- public static final int Pg_TRANSPARENT = 0xFFFFFFFF;
-//public static final int Pg_INVERT_COLOR = 0xFFFFFFFE;
-//public static final int Pg_CURSOR_SHOW = 0x0080;
-//public static final int Pg_DASH_INVERT = 0x40;
-//public static final int Pg_DASH_SLOPE_ADJ = 0x80;
-//public static final int Pg_DELETE_CURSOR = 0x80;
-//public static final int Pg_DLL_CMDS = 0xD0;
-//public static final int Pg_DO_EXTENT = 0x0002;
-//public static final int Pg_DOUBLE_UNDERLINE = 0x10;
-//public static final int Pg_DRAWMODE_AND = 2;
-//public static final int Pg_DRAWMODE_ANDINV = 6;
-//public static final int Pg_DRAWMODE_ANDREV = 0xA;
-//public static final int Pg_DRAWMODE_CLEAR = 8;
-//public static final int Pg_DRAWMODE_COPYINV = 4;
-//public static final int Pg_DRAWMODE_INVERT = 0xD;
-//public static final int Pg_DRAWMODE_NAND = 0xF;
-//public static final int Pg_DRAWMODE_NOP = 9;
-//public static final int Pg_DRAWMODE_NOR = 0xE;
- public static final int Pg_DRAWMODE_OPAQUE = 0;
-//public static final int Pg_DRAWMODE_OR = 3;
-//public static final int Pg_DRAWMODE_ORINV = 7;
-//public static final int Pg_DRAWMODE_ORREV = 0xB;
-//public static final int Pg_DRAWMODE_SET = 0xC;
-//public static final int Pg_DRAWMODE_XNOR = 5;
- public static final int Pg_DRAWMODE_XOR = 1;
-//public static final int Pg_ENABLE_CHROMA = 0x00000004;
-//public static final int Pg_END_OF_DRAW = 0x00;
-//public static final int Pg_ENDIAN_TEST = 0xD5;
-//public static final int Pg_EXPOSE_SOURCE = (0x02 << 8);
- public static final int Pg_EXTENT_BASED = (0x01 << 8);
-//public static final int Pg_GHOST = 0x01000000;
- public static final int Pg_IMAGE_PALETTE_BYTE = 0x10;
-//public static final int Pg_IMAGE_BYTE_PALETTE = Pg_IMAGE_PALETTE_BYTE;
-//public static final int Pg_IMAGE_CLASS_BLEND = 0x08;
- public static final int Pg_IMAGE_CLASS_DIRECT = 0x20;
-//public static final int Pg_IMAGE_CLASS_GRADIENT = 0x18;
- public static final int Pg_IMAGE_CLASS_MASK = 0x38;
- public static final int Pg_IMAGE_CLASS_PALETTE = 0x10;
-//public static final int Pg_IMAGE_DBLEND_LONG = 0x0B;
-//public static final int Pg_IMAGE_DBLEND_SHORT = 0x0A;
- public static final int Pg_IMAGE_DIRECT_444 = 0x24;
- public static final int Pg_IMAGE_DIRECT_555 = 0x23;
- public static final int Pg_IMAGE_DIRECT_565 = 0x22;
- public static final int Pg_IMAGE_DIRECT_888 = 0x21;
- public static final int Pg_IMAGE_DIRECT_8888 = 0x20;
-//public static final int Pg_IMAGE_GBLEND_BYTE = 0x08;
-//public static final int Pg_IMAGE_GBLEND_NIBBLE = 0x09;
-//public static final int Pg_IMAGE_GRADIENT_BYTE = 0x18;
-//public static final int Pg_IMAGE_GRADIENT_NIBBLE = 0x19;
- public static final int Pg_IMAGE_PALETTE_NIBBLE = 0x11;
-//public static final int Pg_IMAGE_NIBBLE_PALETTE = Pg_IMAGE_PALETTE_NIBBLE;
-//public static final int Pg_ITEST_CURSOR_HIDE = 0x0010;
-//public static final int Pg_MITER_JOIN = 0x00;
-//public static final int Pg_MOVE_DISPLAY = 0x4D;
-//public static final int Pg_OVRFN_EQ = 5;
-//public static final int Pg_OVRFN_FALSE = 0;
-//public static final int Pg_OVRFN_GE = 2;
-//public static final int Pg_OVRFN_GT = 7;
-//public static final int Pg_OVRFN_LE = 6;
-//public static final int Pg_OVRFN_LT = 3;
-//public static final int Pg_OVRFN_NE = 4;
-//public static final int Pg_OVRFN_TRUE = 1;
-//public static final int Pg_PALSET_FORCE_EXPOSE = 0x80;
-//public static final int Pg_PALSET_GLOBAL = 0x03;
-//public static final int Pg_PALSET_HARD = 0x01;
-//public static final int Pg_PALSET_HARDINACTIVE = 0x05;
-//public static final int Pg_PALSET_HARDLOCKED = 0x02;
- public static final int Pg_PALSET_SOFT = 0x00;
-//public static final int Pg_PALSET_TYPEMASK = 0x0F;
-//public static final int Pg_POINT_CAP = 0x03;
-//public static final int Pg_RELATIVE = (0x01 << 8);
-//public static final int Pg_REPBM_ALTERNATE = (0x10 <<16);
-//public static final int Pg_POLY_FILL = Pg_DRAW_FILL;
-//public static final int Pg_POLY_RELATIVE = Pg_RELATIVE;
-//public static final int Pg_POLY_STROKE = Pg_DRAW_STROKE;
-//public static final int Pg_POLY_STROKE_CLOSED = Pg_DRAW_STROKE | Pg_CLOSED;
-//public static final int Pg_PRINTER_CMD = 0xF1;
-//public static final int Pg_QROUND_JOIN = 0x03;
-//public static final int Pg_REL_POLY_FILL = (Pg_POLY_FILL | Pg_POLY_RELATIVE);
-//public static final int Pg_REL_POLY_STROKE = (Pg_POLY_STROKE | Pg_POLY_RELATIVE);
-//public static final int Pg_REL_POLY_STROKE_CLOSED = (Pg_POLY_STROKE_CLOSED | Pg_POLY_RELATIVE);
-//public static final int Pg_ROUND_CAP = 0x01;
-//public static final int Pg_ROUND_JOIN = 0x01;
-//public static final int Pg_SET = 1;
-//public static final int Pg_SET_AUX_CLIP = 0x07;
-//public static final int Pg_SET_CURSOR_BITMAP = 0x83;
-//public static final int Pg_SET_CURSOR_CHAR = 0x82;
-//public static final int Pg_SET_CURSOR_POSITION = 0x81;
-//public static final int Pg_SET_DEFAULT_STATE = 0x01;
-//public static final int Pg_SET_DRAG_CURSOR = 0x84;
-//public static final int Pg_SET_DRAW_MODE = 0x02;
-//public static final int Pg_SET_FILL_COLOR = 0x20;
-//public static final int Pg_SET_FILL_DITHER = 0x22;
-//public static final int Pg_SET_FILL_TRANSP = 0x23;
-//public static final int Pg_SET_FILL_XOR_COLOR = 0x21;
-//public static final int Pg_SET_PALETTE = 0x08;
-//public static final int Pg_SET_PLANE_MASK = 0x03;
-//public static final int Pg_SET_ROTATION = 0x0B;
-//public static final int Pg_SET_SCALE = 0x0A;
-//public static final int Pg_SET_STROKE_CAP = 0x15;
-//public static final int Pg_SET_STROKE_COLOR = 0x10;
-//public static final int Pg_SET_STROKE_DASH = 0x17;
-//public static final int Pg_SET_STROKE_DITHER = 0x12;
-//public static final int Pg_SET_STROKE_JOIN = 0x16;
-//public static final int Pg_SET_STROKE_TRANSP = 0x13;
-//public static final int Pg_SET_STROKE_WIDTH = 0x14;
-//public static final int Pg_SET_STROKE_XOR_COLOR = 0x11;
-//public static final int Pg_SET_TEXT_COLOR = 0x30;
-//public static final int Pg_SET_TEXT_DITHER = 0x32;
-//public static final int Pg_SET_TEXT_FONT = 0x34;
-//public static final int Pg_SET_TEXT_TRANSP = 0x33;
-//public static final int Pg_SET_TEXT_UNDERLINE = 0x35;
-//public static final int Pg_SET_TEXT_XOR_COLOR = 0x31;
-//public static final int Pg_SET_TRANSLATION = 0x09;
-//public static final int Pg_SET_USER_CLIP = 0x06;
-//public static final int Pg_SETGAMMA_CBlack = 0x0004;
-//public static final int Pg_SETGAMMA_CFactor = 0x0002;
-//public static final int Pg_SETGAMMA_CWhite = 0x0008;
-//public static final int Pg_SETGAMMA_Factor = 0x0001;
-//public static final int Pg_SMART_BLIT = (0x01 << 8);
-//public static final int Pg_SQUARE_CAP = 0x02;
-//public static final int Pg_STRETCH_BLT = 0x00000008;
-//public static final int Pg_SWAP_DISPLAY = 0xD4;
-//public static final int Pg_SYNC = 0xD3;
-//public static final int Pg_TARGET_STREAM = 0xD1;
-//public static final int Pg_TEST_BITMAP = 2;
-//public static final int Pg_TEST_FILL = (Pg_DRAW_FILL);
-//public static final int Pg_TEST_FILL_STROKE = (Pg_DRAW_FILL | Pg_DRAW_STROKE);
-//public static final int Pg_TEST_STROKE = (Pg_DRAW_STROKE);
-//public static final int Pg_TEST_TEXT = 1;
-//public static final int Pg_TEXT_AREA = (0x08 << 8);
-//public static final int Pg_TEXT_BOTTOM = (0x80 << 8);
- public static final int Pg_TEXT_LEFT = (0x10 << 8);
-//public static final int Pg_TEXT_RIGHT = (0x20 << 8);
- public static final int Pg_TEXT_TOP = (0x40 << 8);
-//public static final int Pg_TEXT_CENTER = ( Pg_TEXT_LEFT | Pg_TEXT_RIGHT );
-//public static final int Pg_TEXT_MIDDLE = ( Pg_TEXT_TOP | Pg_TEXT_BOTTOM );
-//public static final int Pg_TEXT_SIZE_HINT = (0x02 << 8);
- public static final int Pg_TEXT_UTF2CHAR = (0x04 << 8);
- public static final int Pg_TEXT_WIDECHAR = (Pg_TEXT_UTF2CHAR);
-//public static final int Pg_TREND_HORIZ = 0x00;
-//public static final int Pg_TREND_VERT = 0x01;
-//public static final int Pg_UNSET = 0;
-//public static final int Pg_WAIT_VSYNC = 0x00000010;
-//public static final int Pg_XADDR_INLINE = 1;
-//public static final int Pg_XADDR_SHMEM = 0;
-//public static final int Pgrs_RelBehind = 0x0002;
-//public static final int Pgrs_RelInFront = 0x0001;
-//public static final int Pgrs_RelParent = 0x0000;
-//public static final int PgrsI_CreatedShmem = 0x0001;
-//public static final int Pgv_C_ByteFlag = 0x00000800;
-//public static final int Pgv_C_ByteIndex = 0x00000600;
-//public static final int Pgv_C_Direct = 0x00000400;
-//public static final int Pgv_C_DStrokePen = 0x00000200;
-//public static final int Pgv_C_MASK = 0x00000E00;
-//public static final int Pgv_C_StrokePen = 0x00000000;
-//public static final int Pgv_O_FixedLine = 0x00000000;
-//public static final int Pgv_O_MASK = 0x03000000;
-//public static final int Pgv_O_Variable = 0x01000000;
-//public static final int Pgv_OP_Glyph = 0x80;
-//public static final int Pgv_OP_Line = 0x01;
-//public static final int Pgv_OP_NOP = 0x00;
-//public static final int Pgv_OP_Point = 0x02;
-//public static final int Pgv_P_Color = 0x00200000;
-//public static final int Pgv_P_MASK = 0x00F00000;
-//public static final int Pgv_P_Simple = 0x00100000;
-//public static final int Pgv_T_MASK = 0x00003000;
-//public static final int Pgv_T_PostTrans = 0x00002000;
-//public static final int Pgv_T_PreTrans = 0x00001000;
-//public static final int Pgv_T_ZTrans = 0x00004000;
-//public static final int Pgv_X_Char = 0x00000002;
-//public static final int Pgv_X_LFixed = 0x00000004;
-//public static final int Pgv_X_MASK = 0x00000007;
-//public static final int Pgv_X_Short = 0x00000003;
-//public static final int Pgv_X_UseDelta = 0x00000001;
-//public static final int Pgv_Y_Char = (Pgv_X_Char << 3);
-//public static final int Pgv_Y_LFixed = (Pgv_X_LFixed << 3);
-//public static final int Pgv_Y_MASK = (Pgv_X_MASK << 3);
-//public static final int Pgv_Y_Short = (Pgv_X_Short << 3);
-//public static final int Pgv_Y_UseDelta = (Pgv_X_UseDelta << 3);
-//public static final int Pgv_Z_Char = (Pgv_X_Char << 6);
-//public static final int Pgv_Z_LFixed = (Pgv_X_LFixed << 6);
-//public static final int Pgv_Z_MASK = (Pgv_X_MASK << 6);
-//public static final int Pgv_Z_Short = (Pgv_X_Short << 6);
-//public static final int Pgv_Z_UseDelta = (Pgv_X_UseDelta << 6);
-//public static final int Ph_ACTIVATE_DC = 0;
-//public static final int Ph_AUDIO_REGION = 0x00000100;
-//public static final int Ph_AUXPTR_REGION = 0x00000080;
-//public static final int Ph_BACK_EVENT = 0x0002;
-//public static final int Ph_BAUD_CONSOLE = 100000000;
-//public static final int Ph_BAUD_NETWORK = 10000000;
-//public static final int Ph_BAUD_SLOW = 100000;
-//public static final int Ph_BLIT_REGION = 0x00008000;
-//public static final int Ph_BLOCK_OVERFLOW = 0x00000001;
- public static final int Ph_BUTTON_ADJUST = 0x0002;
- public static final int Ph_BUTTON_MENU = 0x0001;
- public static final int Ph_BUTTON_SELECT = 0x0004;
-// public static final int Ph_BUTTON_1 = Ph_BUTTON_MENU;
-// public static final int Ph_BUTTON_2 = Ph_BUTTON_ADJUST;
-// public static final int Ph_BUTTON_3 = Ph_BUTTON_SELECT;
-//public static final int Ph_CAPTURE_EXPOSE = 4;
-//public static final int Ph_CLIPBOARD_MAX_TYPES = 5;
-//public static final int Ph_COMPOUND_REPLY = 0x00000020;
-//public static final int Ph_CURSOR_BACK = 2;
-//public static final int Ph_CURSOR_BIG_POINTER = 0xE902;
- public static final int Ph_CURSOR_BITMAP = 0xFB;
- public static final int Ph_CURSOR_CLOCK = 0xE908;
- public static final int Ph_CURSOR_CROSSHAIR = 0xE906;
- public static final int Ph_CURSOR_DEFAULT_COLOR = 0xFFFFE0;
- public static final int Ph_CURSOR_DONT = 0xE90A;
-//public static final int Ph_CURSOR_DRAG_BACKDIAG = 0xE914;
- public static final int Ph_CURSOR_DRAG_BL = 0xE916;
- public static final int Ph_CURSOR_DRAG_BOTTOM = 0xE910;
- public static final int Ph_CURSOR_DRAG_BR = 0xE914;
-//public static final int Ph_CURSOR_DRAG_FOREDIAG = 0xE916;
- public static final int Ph_CURSOR_DRAG_HORIZONTAL = 0xE912;
- public static final int Ph_CURSOR_DRAG_LEFT = 0xE912;
- public static final int Ph_CURSOR_DRAG_RIGHT = 0xE912;
- public static final int Ph_CURSOR_DRAG_TL = 0xE914;
- public static final int Ph_CURSOR_DRAG_TOP = 0xE910;
- public static final int Ph_CURSOR_DRAG_TR = 0xE916;
- public static final int Ph_CURSOR_DRAG_VERTICAL = 0xE910;
- public static final int Ph_CURSOR_FINGER = 0xE90C;
-//public static final int Ph_CURSOR_FRONT = 1;
- public static final int Ph_CURSOR_INHERIT = 0x00;
- public static final int Ph_CURSOR_INSERT = 0xE90E;
-//public static final int Ph_CURSOR_LONG_WAIT = 0xE91A;
-//public static final int Ph_CURSOR_MANUAL_CONTROL = 0xFF;
- public static final int Ph_CURSOR_MOVE = 0xE904;
- public static final int Ph_CURSOR_NO_INHERIT = 0x01;
-//public static final int Ph_CURSOR_NOINPUT = 0xE90A;
-//public static final int Ph_CURSOR_NONE = 0xFD;
-//public static final int Ph_CURSOR_PASTE = 0xE91E;
- public static final int Ph_CURSOR_POINT_WAIT = 0xE918;
- public static final int Ph_CURSOR_POINTER = 0xE900;
- public static final int Ph_CURSOR_QUESTION_POINT = 0xE91C;
-//public static final int Ph_CURSOR_SET = 0x01000000;
-//public static final int Ph_CURSOR_WAIT = 0xE908;
-//public static final int Ph_DEACTIVATE_DC = 1;
-//public static final int Ph_DESTROYING_DC = 2;
- public static final int Ph_DEV_RID = 1;
-//public static final int Ph_DIRECTED_FOCUS = 0x0004;
-//public static final int Ph_DONE_DRAW = 0x8000;
-//public static final int Ph_DRAG_ABSOLUTE = 0x0080;
-//public static final int Ph_DRAG_CURSOR_EXACT = 0x0400;
-//public static final int Ph_DRAG_DRAW_RECT = 0x0100;
-//public static final int Ph_DRAG_DRAW_RECT_INITIAL = 0x0200;
- public static final int Ph_DRAG_KEY_MOTION = 0x0020;
- public static final int Ph_DRAG_NOBUTTON = 0x0040;
- public static final int Ph_DRAG_TRACK = 0x0010;
-//public static final int Ph_DRAW_TO_MEMORY_CONTEXT = 2;
-//public static final int Ph_DRAW_TO_PHOTON = 0;
-//public static final int Ph_DRAW_TO_PRINT_CONTEXT = 1;
-//public static final int Ph_DRAW_TO_SERVICE = 3;
-//public static final int Ph_DYNAMIC_BUFFER = 0x00000010;
-//public static final int Ph_EMIT_TOWARD = 0x0001;
-//public static final int Ph_ESCAPE_COUNT_MASK = 0x000F;
-//public static final int Ph_EV_ADMIN_FILE_SENT = 1;
-//public static final int Ph_EV_ADMIN_SEND_FILE = 0;
-//public static final int Ph_EV_AMIN = 0x00000100;
-//public static final int Ph_EV_AUDIO = 0x00100000;
-//public static final int Ph_EV_BLIT = 0x00000800;
- public static final int Ph_EV_BOUNDARY = 0x00000020;
- public static final int Ph_EV_BUT_PRESS = 0x00000002;
- public static final int Ph_EV_BUT_RELEASE = 0x00000004;
-//public static final int Ph_EV_BUT_REPEAT = 0x00004000;
-//public static final int Ph_EV_CONFIG = 3;
-//public static final int Ph_EV_COVERED = 0x00000400;
-//public static final int Ph_EV_DND_ACK = 4;
-//public static final int Ph_EV_DND_CANCEL = 1;
-//public static final int Ph_EV_DND_COMPLETE = 7;
-//public static final int Ph_EV_DND_DELIVERED = 8;
-//public static final int Ph_EV_DND_DROP = 6;
-//public static final int Ph_EV_DND_ENTER = 2;
-//public static final int Ph_EV_DND_INIT = 0;
-//public static final int Ph_EV_DND_LEAVE = 3;
-//public static final int Ph_EV_DND_MOTION = 5;
-//public static final int Ph_EV_DNDROP = 0x00200000;
- public static final int Ph_EV_DRAG = 0x00000200;
-//public static final int Ph_EV_DRAG_BOUNDARY = 5;
- public static final int Ph_EV_DRAG_COMPLETE = 2;
-//public static final int Ph_EV_DRAG_INIT = 0;
- public static final int Ph_EV_DRAG_KEY_EVENT = 3;
- public static final int Ph_EV_DRAG_MOTION_EVENT = 4;
-//public static final int Ph_EV_DRAG_MOVE = 1;
-//public static final int Ph_EV_DRAG_START = 6;
-//public static final int Ph_EV_DRAW = 0x00000080;
-//public static final int Ph_EV_EXPOSE = 0x00000040;
-//public static final int Ph_EV_FEP = 4;
-//public static final int Ph_EV_INFO = 0x00080000;
-//public static final int Ph_EV_INVALIDATE_FONTINFO = 1;
-//public static final int Ph_EV_INVALIDATE_SYSINFO = 0;
- public static final int Ph_EV_KEY = 0x00000001;
-//public static final int Ph_EV_KEY_NORMAL = 0;
-//public static final int Ph_EV_KEYBOARD_CTRL = 3;
-//public static final int Ph_EV_LB_SYSTEM = 0x00020000;
-//public static final int Ph_EV_MOTION_NORMAL = 0;
-//public static final int Ph_EV_MOTION_STEADY = 1;
-//public static final int Ph_EV_NEW_TIMEZONE = 2;
-//public static final int Ph_EV_POINTER_CTRL = 2;
-//public static final int Ph_EV_PRINTER = 5;
- public static final int Ph_EV_PTR_ENTER = 0;
- public static final int Ph_EV_PTR_ENTER_FROM_CHILD = 4;
-//public static final int Ph_EV_PTR_ENTER_FROM_PARENT = 0;
- public static final int Ph_EV_PTR_LEAVE = 1;
- public static final int Ph_EV_PTR_LEAVE_TO_CHILD = 5;
-//public static final int Ph_EV_PTR_LEAVE_TO_PARENT = 1;
- public static final int Ph_EV_PTR_MOTION_BUTTON = 0x00000010;
- public static final int Ph_EV_PTR_MOTION_NOBUTTON = 0x00000008;
-//public static final int Ph_EV_PTR_RECT_ENTER = 0x10;
-//public static final int Ph_EV_PTR_RECT_LEAVE = 0x11;
- public static final int Ph_EV_PTR_STEADY = 2;
-//public static final int Ph_EV_PTR_TRANSIENT_ENTER = 8;
-//public static final int Ph_EV_PTR_TRANSIENT_LEAVE = 9;
- public static final int Ph_EV_PTR_UNSTEADY = 3;
- public static final int Ph_EV_PTR_MOTION = ( Ph_EV_PTR_MOTION_NOBUTTON | Ph_EV_PTR_MOTION_BUTTON );
-//public static final int Ph_EV_PTR_ALL = ( Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION | Ph_EV_BUT_REPEAT );
-//public static final int Ph_EV_RAW = 0x00008000;
-//public static final int Ph_EV_RAW_AUXPTR = 2;
-//public static final int Ph_EV_RAW_KEY = 0;
-//public static final int Ph_EV_RAW_PTR = 1;
-//public static final int Ph_EV_RELEASE_ENDCLICK = 2;
-//public static final int Ph_EV_RELEASE_OUTBOUND = 3;
- public static final int Ph_EV_RELEASE_PHANTOM = 1;
- public static final int Ph_EV_RELEASE_REAL = 0;
-//public static final int Ph_EV_REMOTE_WM = 1;
-//public static final int Ph_EV_SERVICE = 0x00040000;
-//public static final int Ph_EV_SYSTEM = 0x00001000;
- public static final int Ph_EV_TIMER = 0x00010000;
-//public static final int Ph_EV_WIDGET_SENSE = ( Ph_EV_KEY | Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_DRAG | Ph_EV_BOUNDARY );
-//public static final int Ph_EV_WIDGET_OPAQUE = ( Ph_EV_WIDGET_SENSE | Ph_EV_PTR_ALL | Ph_EV_KEY );
-//public static final int Ph_EV_WIN_SENSE = ( Ph_EV_KEY | Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_EXPOSE | Ph_EV_DRAG | Ph_EV_TIMER );
-//public static final int Ph_EV_WIN_OPAQUE = ( Ph_EV_WIN_SENSE | Ph_EV_PTR_ALL | Ph_EV_BOUNDARY | Ph_EV_DRAW | Ph_EV_COVERED | Ph_EV_KEY | Ph_EV_BUT_REPEAT );
-//public static final int Ph_EV_WM = 0x00002000;
-//public static final int _Ph_REGION_OPEN = 0;
-//public static final int _Ph_REGION_SET = 1;
-//public static final int _Ph_REGION_CLOSE = 2;
-//public static final int _Ph_REGION_WM_BASE = 8;
-//public static final int Ph_EV_WM_CLOSE = _Ph_REGION_CLOSE;
-//public static final int Ph_EV_WM_CONFIG = (_Ph_REGION_WM_BASE+3);
-//public static final int Ph_EV_WM_CONSWITCH = (_Ph_REGION_WM_BASE+5);
-//public static final int Ph_EV_WM_EVENT = (_Ph_REGION_WM_BASE+0);
-//public static final int Ph_EV_WM_MENUREAD = (_Ph_REGION_WM_BASE+6);
-//public static final int Ph_EV_WM_OPEN = _Ph_REGION_OPEN;
-//public static final int Ph_EV_WM_SET = _Ph_REGION_SET;
-//public static final int Ph_EV_WM_TASKEVENT = (_Ph_REGION_WM_BASE+4);
-//public static final int Ph_EV_WM_TRANSPORT = (_Ph_REGION_WM_BASE+2);
-//public static final int Ph_EV_WM_VISIBLE = (_Ph_REGION_WM_BASE+1);
-//public static final int Ph_EV_ICON_OPAQUE = ( Ph_EV_WM | Ph_EV_EXPOSE | Ph_EV_DRAW );
-//public static final int Ph_EV_ICON_SENSE = ( Ph_EV_WM | Ph_EV_EXPOSE );
-//public static final int Ph_EVENT_ABSOLUTE = 0x0004;
- public static final int Ph_EVENT_DIRECT = 0x0010;
-//public static final int Ph_EVENT_INCLUSIVE = 0x0008;
- public static final int Ph_EVENT_MSG = 1;
-//public static final int Ph_EVENT_NO_RECT = 0x0002;
-//public static final int Ph_EVENT_REDIRECTED = 0x0020;
-//public static final int Ph_EVENT_RSRV1 = 0x8000;
-//public static final int Ph_EXPOSE_FAMILY = 0x00002000;
-//public static final int Ph_EXPOSE_REGION = 0x00004000;
- public static final int Ph_FAKE_EVENT = 0x0001;
-//public static final int Ph_FEP_ACTIVATE = 0x00000003;
-//public static final int Ph_FEP_BROADCAST = 0x00000000;
-//public static final int Ph_FEP_CHINESE = 0x00000002;
-//public static final int Ph_FEP_DEACTIVATE = 0x00000004;
-//public static final int Ph_FEP_DEREGISTER = 1;
-//public static final int Ph_FEP_JAPANESE = 0x00000001;
-//public static final int Ph_FEP_KOREAN = 0x00000003;
-//public static final int Ph_FEP_NORECT = 0x00000002;
-//public static final int Ph_FEP_RECT = 0x00000001;
-//public static final int Ph_FEP_REGISTER = 0;
-//public static final int Ph_FOCUS_BRANCH = 0x0008;
-//public static final int Ph_FOLLOW_IG_SIZE = 0x00200000;
-//public static final int Ph_FORCE_BOUNDARY = 0x00400000;
-//public static final int Ph_FORCE_FRONT = 0x00100000;
-//public static final int Ph_GCAP_BLIT = 0x00000001;
-//public static final int Ph_GCAP_DIRECTCOLOR = 0x00000100;
-//public static final int Ph_GCAP_DRAW_OFFSCREEN = 0x00004000;
-//public static final int Ph_GCAP_FRAME_READ = 0x00001000;
-//public static final int Ph_GCAP_FutureSupported = 0xFF000000;
-//public static final int Ph_GCAP_LOCALHW = 0x00000040;
-//public static final int Ph_GCAP_MASKED_BLIT = 0x00000002;
-//public static final int Ph_GCAP_NONINTERLACED = 0x00000400;
-//public static final int Ph_GCAP_PALETTE = 0x00000008;
-//public static final int Ph_GCAP_PHINDOWS = 0x00000020;
-//public static final int Ph_GCAP_RELAY = 0x00000010;
-//public static final int Ph_GCAP_SHMEM = 0x00000004;
-//public static final int Ph_GCAP_SHMEM_FLUSH = 0x00002000;
-//public static final int Ph_GCAP_TEXT_AREA = 0x00000800;
-//public static final int Ph_GCAP_VIDEO_READABLE = 0x00000200;
-//public static final int Ph_GEN_INFO_BANDWIDTH = 0x000000001;
-//public static final int Ph_GEN_INFO_CAPABILITIES = 0x000000002;
-//public static final int Ph_GEN_INFO_NUM_GFX = 0x000000004;
-//public static final int Ph_GEN_INFO_NUM_IG = 0x000000020;
-//public static final int Ph_GEN_INFO_NUM_KBD = 0x000000008;
-//public static final int Ph_GEN_INFO_NUM_PTR = 0x000000010;
-//public static final int Ph_GFX_BANDWIDTH = 0x00000001;
-//public static final int Ph_GFX_CAPABILITIES = 0x00000002;
-//public static final int Ph_GFX_COLOR_BITS = 0x00000004;
-//public static final int Ph_GFX_POSSIBILITIES = 0x00000008;
-//public static final int Ph_GFXD_DITHERSTROKE = 0x00000008;
-//public static final int Ph_GFXD_HARDROT = 0x00000002;
-//public static final int Ph_GFXD_SCALEING = 0x00000004;
-//public static final int Ph_GFXD_VPANNING = 0x00000001;
-//public static final int Ph_GFXG_DMANDOR = 0x00000020;
-//public static final int Ph_GFXG_DMEXTENDED = 0x00000040;
-//public static final int Ph_GFXG_DMXOR = 0x00000010;
-//public static final int Ph_GFXG_HWBITBLT = 0x00000002;
-//public static final int Ph_GFXG_HWBITBLT_CHROMA = 0x00000080;
-//public static final int Ph_GFXG_HWBITBLT_STRETCH = 0x00000100;
-//public static final int Ph_GFXG_HWCURSOR = 0x00000001;
-//public static final int Ph_GFXG_MASKBLIT = 0x00000004;
-//public static final int Ph_GFXG_OFFSCREENMEM = 0x00000008;
-//public static final int Ph_GFXV_DIRECT = 0x00000010;
-//public static final int Ph_GFXV_MONOCHROME = 0x00000001;
-//public static final int Ph_GFXV_NONINTERLACED = 0x00002000;
-//public static final int Ph_GFXV_OVERLAY = 0x00000020;
-//public static final int Ph_GFXV_PALETTE16 = 0x00000002;
-//public static final int Ph_GFXV_PALETTE256 = 0x00000004;
-//public static final int Ph_GFXV_VIDEO_READABLE = 0x00001000;
-//public static final int Ph_GFXVAL_BITPOS = 0x00400000;
-//public static final int Ph_GFXVAL_BPL = 0x00100000;
-//public static final int Ph_GFXVAL_BPP = 0x00200000;
-//public static final int Ph_GFXVAL_CARDSUBTYPE = 0x00000020;
-//public static final int Ph_GFXVAL_CARDTYPE = 0x00000010;
-//public static final int Ph_GFXVAL_COPT = 0x00000008;
-//public static final int Ph_GFXVAL_DACSIZE = 0x00800000;
-//public static final int Ph_GFXVAL_DOPT = 0x00000002;
-//public static final int Ph_GFXVAL_GOPT = 0x00000004;
-//public static final int Ph_GFXVAL_NCURSOR = 0x00001000;
-//public static final int Ph_GFXVAL_NPALETTE = 0x00002000;
-//public static final int Ph_GFXVAL_POINTBS = 0x00004000;
-//public static final int Ph_GFXVAL_PRES = 0x00000100;
-//public static final int Ph_GFXVAL_VOPT = 0x00000001;
-//public static final int Ph_GFXVAL_VRAMSIZE = 0x00000800;
-//public static final int Ph_GFXVAL_VRES = 0x00000200;
-//public static final int Ph_GFXVAL_WORKSPACES = 0x00008000;
-//public static final int Ph_GRAFX_REGION = 0x00000004;
-//public static final int Ph_GRAPHIC_EXPOSE = 2;
-//public static final int Ph_INFO_CTRL_BUF_GC = 6;
-//public static final int Ph_INFO_CTRL_DFLT_GC = 5;
-//public static final int Ph_INFO_CTRL_FD = 0;
-//public static final int Ph_INFO_CTRL_GC = 4;
-//public static final int Ph_INFO_CTRL_GIN = 3;
-//public static final int Ph_INFO_CTRL_PROXY = 1;
-//public static final int Ph_INFO_CTRL_REM_PROXY = 2;
-//public static final int Ph_INLINE_SHMEM_OBJECTS = 0x00000001;
-//public static final int Ph_INPUTGROUP_REGION = 0x00000040;
-//public static final int Ph_KBD_CAPABILITIES = 0x00000001;
-//public static final int Ph_KBD_REGION = 0x00000010;
-//public static final int Ph_LIB_VERSION = 114;
-//public static final int Ph_MAX_FONT_LEN = 16;
-//public static final int Ph_NO_COMPRESSION = 0x00800000;
-//public static final int Ph_NO_HOLD = 0x00000008;
-//public static final int Ph_NO_PROXY = 0x00000004;
-//public static final int Ph_NORMAL_DRAW = 0x0000;
-//public static final int Ph_NORMAL_EXPOSE = 0;
- public static final int Ph_NOT_CUAKEY = 0x10;
-//public static final int Ph_NOT_HOTKEY = 0x20;
-//public static final int Ph_PRINT_REGION = 0x00000020;
-//public static final int Ph_PRINTER_EXPOSE = 1;
-//public static final int Ph_PROC_ARMED = 0x0002;
-//public static final int Ph_PROC_BLOCKED = 0x0004;
-//public static final int Ph_PROC_CATCH_UP = 0x0010;
-//public static final int Ph_PROC_DYNAMIC_BUF = 0x0020;
-//public static final int Ph_PROC_HELD = 0x0008;
-//public static final int Ph_PROC_VIRTUAL = 0x0001;
-//public static final int Ph_PTR_CAPABILITIES = 0x00000001;
-//public static final int Ph_PTR_FLAG_PROG = 0x04;
-//public static final int Ph_PTR_FLAG_Z_ABS = 0x02;
-//public static final int Ph_PTR_FLAG_Z_MASK = 0x03;
-//public static final int Ph_PTR_FLAG_Z_NONE = 0x00;
-//public static final int Ph_PTR_FLAG_Z_PRESSURE = 0x03;
-//public static final int Ph_PTR_FLAG_Z_REL = 0x01;
-//public static final int Ph_PTR_RAW_FLAG_NO_BUTTONS = 0x01;
-//public static final int Ph_PTR_RAW_FLAG_XY_REL = 0x02;
-//public static final int Ph_PTR_REGION = 0x00000008;
-//public static final int Ph_QUERY_DC_GRAFX_INFO = 0x80000000;
-//public static final int Ph_QUERY_EXACT = 0x0100;
- public static final int Ph_QUERY_GRAPHICS = 0x0004;
-//public static final int Ph_QUERY_IG_POINTER = 0x1000;
-//public static final int Ph_QUERY_IG_REGION = 0x2000;
-//public static final int Ph_QUERY_INPUT_GROUP = 0x0040;
-//public static final int Ph_QUERY_MEMORY_GRAFX_INFO = 0x80000000;
-//public static final int Ph_RDATA_CLIPBOARD = 0x000A;
-//public static final int Ph_RDATA_CURSOR = 0x0002;
-//public static final int Ph_RDATA_GFXDETAIL = 0x0008;
-//public static final int Ph_RDATA_GFXINFO = 0x0004;
-//public static final int Ph_RDATA_IG = 0x0003;
-//public static final int Ph_RDATA_INPMGRINFO = 0x0009;
-//public static final int Ph_RDATA_KBDINFO = 0x0005;
-//public static final int Ph_RDATA_PTRINFO = 0x0006;
-//public static final int Ph_RDATA_USER = 0xFFFF;
-//public static final int Ph_RDATA_WINDOW = 0x0001;
-//public static final int Ph_RDATA_WMCONFIG = 0x0007;
-//public static final int Ph_RECT_BOUNDARY = 0x02000000;
-//public static final int Ph_REGION_BEHIND = 0x00000200;
-//public static final int Ph_REGION_CURSOR = 0x00001000;
-//public static final int Ph_REGION_DATA = 0x00000800;
-//public static final int Ph_REGION_EV_OPAQUE = 0x00000008;
-//public static final int Ph_REGION_EV_OPAQUE_AND = 0x00010000;
-//public static final int Ph_REGION_EV_OPAQUE_OR = 0x00040000;
-//public static final int Ph_REGION_EV_OPAQUE_SET = 0x00000008;
-//public static final int Ph_REGION_EV_SENSE = 0x00000010;
-//public static final int Ph_REGION_EV_SENSE_AND = 0x00020000;
-//public static final int Ph_REGION_EV_SENSE_OR = 0x00080000;
-//public static final int Ph_REGION_EV_SENSE_SET = 0x00000010;
-//public static final int Ph_REGION_FLAGS = 0x00000004;
-//public static final int Ph_REGION_HANDLE = 0x00000002;
-//public static final int Ph_REGION_IN_FRONT = 0x00000100;
-//public static final int Ph_REGION_INPUT_GROUP = 0x00008000;
-//public static final int Ph_REGION_ORIGIN = 0x00000040;
-//public static final int Ph_REGION_OWNER = 0x00000001;
-//public static final int Ph_REGION_PARENT = 0x00000080;
-//public static final int Ph_REGION_RECT = 0x00000400;
-//public static final int Ph_REGION_STATE = 0x00000020;
-//public static final int Ph_REGION_TYPE_MASK = 0x000FFFFF;
-//public static final int Ph_RELEASE_GHOST_BITMAP = 0x08;
-//public static final int Ph_RELEASE_IMAGE = 0x01;
-//public static final int Ph_RELEASE_IMAGE_ALL = 0x0F;
-//public static final int Ph_RELEASE_PALETTE = 0x02;
-//public static final int Ph_RELEASE_TRANSPARENCY_MASK = 0x04;
- public static final int Ph_RESIZE_MSG = 3;
-//public static final int Ph_RIDQUERY_IG_POINTER = 0x1000;
-//public static final int Ph_RIDQUERY_TOWARD = 0x2000;
-//public static final int Ph_ROOT_RID = 0;
-//public static final int Ph_START_DRAW = 0x4000;
-//public static final int Ph_SUPRESS_PARENT_CLIP = 0x00000004;
-//public static final int Ph_SYNC_GCS = 0x00000008;
-//public static final int Ph_SYSTEM_CON_SWITCHABS = 0x0101;
-//public static final int Ph_SYSTEM_CON_SWITCHREL = 0x0102;
-//public static final int Ph_SYSTEM_GRAPHIC_ROTATE = 0x0201;
-//public static final int Ph_SYSTEM_GRAPHIC_ZOOM = 0x0202;
-//public static final int Ph_SYSTEM_MOUSE_ACCEL = 0x0342;
-//public static final int Ph_SYSTEM_MOUSE_DCLICK = 0x0341;
-//public static final int Ph_SYSTEM_NEWMANAGER = 0x0002;
-//public static final int Ph_SYSTEM_PTR_REGION_CHANGE = 0x0301;
-//public static final int Ph_SYSTEM_REGION_CHANGE = 0x0004;
-//public static final int Ph_SYSTEM_ROTATE = 0x0003;
-//public static final int Ph_SYSTEM_SHUTDOWN = 0x0001;
-//public static final int Ph_TEXT_EXTENTS = 0x00000002;
- public static final int Ph_TRACK_BOTTOM = 0x0008;
- public static final int Ph_TRACK_LEFT = 0x0001;
- public static final int Ph_TRACK_RIGHT = 0x0002;
- public static final int Ph_TRACK_TOP = 0x0004;
- public static final int Ph_TRACK_DRAG = (Ph_TRACK_LEFT|Ph_TRACK_RIGHT|Ph_TRACK_TOP|Ph_TRACK_BOTTOM);
-//public static final int Ph_TYPE_SPECIFIC = 0x0FF0;
-//public static final int Ph_USER_RSRVD_BITS = 0xF000;
-//public static final int Ph_WINDOW_REGION = 0x00000001;
-//public static final int Ph_WM_ALL_FLAGS = 0x00003F3D;
-//
-//public static final int Ph_WM_BACKDROP = 0x00001000;
- public static final int Ph_WM_CLOSE = 0x00000001;
-//public static final int Ph_WM_CONSWITCH = 0x00000080;
-//public static final int Ph_WM_EVSTATE_DEICONIFY = 1;
-//public static final int Ph_WM_EVSTATE_FFRONT = 0;
-//public static final int Ph_WM_EVSTATE_FFRONT_DISABLE = 1;
- public static final int Ph_WM_EVSTATE_FOCUS = 0;
- public static final int Ph_WM_EVSTATE_FOCUSLOST = 1;
- public static final int Ph_WM_EVSTATE_HIDE = 0;
-// public static final int Ph_WM_EVSTATE_ICONIFY = 0;
-//public static final int Ph_WM_EVSTATE_INVERSE = 1;
-//public static final int Ph_WM_EVSTATE_MENU = 0;
-//public static final int Ph_WM_EVSTATE_MENU_FINISH = 1;
-//public static final int Ph_WM_EVSTATE_PERFORM = 0;
- public static final int Ph_WM_EVSTATE_UNHIDE = 1;
-//public static final int Ph_WM_FFRONT = 0x00010000;
- public static final int Ph_WM_FOCUS = 0x00000004;
- public static final int Ph_WM_HELP = 0x00002000;
- public static final int Ph_WM_HIDE = 0x00000040;
- public static final int Ph_WM_ICON = 0x00000400;
- public static final int Ph_WM_MAX = 0x00000800;
-//public static final int Ph_WM_MENU = 0x00000008;
- public static final int Ph_WM_MOVE = 0x00000200;
-//public static final int Ph_WM_RENDER_ASAPP = 0x00000000;
-//public static final int Ph_WM_RENDER_ASICON = 0x00000001;
-//public static final int Ph_WM_RENDER_ASMASK = 0x0000000F;
- public static final int Ph_WM_RENDER_BORDER = 0x00000010;
-//public static final int Ph_WM_RENDER_CLOSE = 0x00000200;
-//public static final int Ph_WM_RENDER_HELP = 0x00000400;
- public static final int Ph_WM_RENDER_MAX = 0x00002000;
- public static final int Ph_WM_RENDER_MENU = 0x00000100;
- public static final int Ph_WM_RENDER_MIN = 0x00001000;
-//public static final int Ph_WM_RENDER_MOVE = 0x00000040;
- public static final int Ph_WM_RENDER_RESIZE = 0x00000020;
-//public static final int Ph_WM_RENDER_RETURN = 0x00008000;
- public static final int Ph_WM_RENDER_TITLE = 0x00000080;
- public static final int Ph_WM_RESIZE = 0x00000100;
- public static final int Ph_WM_RESTORE = 0x00008000;
-//public static final int Ph_WM_SET_CHILD_COUNT = 0x0200;
-//public static final int Ph_WM_SET_CONVERSE_LINK = 0x8000;
-//public static final int Ph_WM_SET_FLAGS = 0x0001;
-//public static final int Ph_WM_SET_FRAME_ATTRIB = 0x0400;
-//public static final int Ph_WM_SET_FRONT_WINDOW = 0x0800;
-//public static final int Ph_WM_SET_ICON_POS = 0x0040;
-//public static final int Ph_WM_SET_ICON_SIZE = 0x0020;
-//public static final int Ph_WM_SET_ICON_TITLE = 0x0010;
-//public static final int Ph_WM_SET_LINK = 0x0080;
-//public static final int Ph_WM_SET_RELATION = 0x0100;
-//public static final int Ph_WM_SET_RENDER = 0x0004;
-//public static final int Ph_WM_SET_STATE = 0x0002;
-//public static final int Ph_WM_SET_TITLE = 0x0008;
-//public static final int Ph_WM_STATE_ISALTKEY = 0x00000200;
-//public static final int Ph_WM_STATE_ISBACKDROP = 0x00000004;
-//public static final int Ph_WM_STATE_ISBLOCKED = 0x00000008;
- public static final int Ph_WM_STATE_ISFOCUS = 0x00008000;
- public static final int Ph_WM_STATE_ISFRONT = 0x00000100;
- public static final int Ph_WM_STATE_ISHIDDEN = 0x00000001;
-//public static final int Ph_WM_STATE_ISICON = 0x00000080;
- public static final int Ph_WM_STATE_ISICONIFIED = 0x00000040;
-//public static final int Ph_WM_STATE_ISMASK = 0x0000FFFF;
- public static final int Ph_WM_STATE_ISMAX = 0x00000002;
- public static final int Ph_WM_STATE_ISMAXING = 0x00004000;
-//public static final int Ph_WM_STATE_ISNORMAL = 0x00000000;
-//public static final int Ph_WM_STATE_ISPDM = 0x00000020;
-//public static final int Ph_WM_STATE_ISREMOTE = 0x00000400;
-//public static final int Ph_WM_STATE_ISTASKBAR = 0x00000010;
-//public static final int Ph_WM_SUPERSELECT = ~0;
-//public static final int Ph_WM_TASKBAR = 0x00004000;
-//public static final int Ph_WM_TERMINATE = 0x00000002;
-//public static final int Ph_WM_TOBACK = 0x00000020;
-//public static final int Ph_WM_TOFRONT = 0x00000010;
-//public static final int Ph_WND_MGR_REGION = 0x00000002;
-//public static final int PHF_STATS = 0x01;
- public static final int PHFONT_ALL_FONTS = 0x33;
- public static final int PHFONT_ALL_SYMBOLS = (-1);
- public static final int PHFONT_BITMAP = 0x02;
- public static final int PHFONT_FIXED = 0x20;
- public static final int PHFONT_INFO_BLDITC = 0x08;
- public static final int PHFONT_INFO_BOLD = 0x02;
- public static final int PHFONT_INFO_FIXED = 0x10;
- public static final int PHFONT_INFO_ITALIC = 0x04;
- public static final int PHFONT_INFO_PLAIN = 0x01;
- public static final int PHFONT_INFO_PROP = 0x20;
-//public static final int PHFONT_LOAD_IMAGES = 0x02;
-//public static final int PHFONT_LOAD_METRICS = 0x01;
-//public static final int PHFONT_MSG_ANTIALIAS = 12;
-//public static final int PHFONT_MSG_CEXTENT1 = 6;
-//public static final int PHFONT_MSG_CEXTENT2 = 14;
-//public static final int PHFONT_MSG_DYNAMIC_LOAD = 0x1000;
-//public static final int PHFONT_MSG_DYNAMIC_UNLOAD = 0x1001;
-//public static final int PHFONT_MSG_EXTENT = 5;
-//public static final int PHFONT_MSG_FEXTENT = 18;
-//public static final int PHFONT_MSG_FEXTENT_WIDE = 26;
-//public static final int PHFONT_MSG_FRENDER = 19;
-//public static final int PHFONT_MSG_FRENDER2 = 20;
-//public static final int PHFONT_MSG_FRENDER_WIDE = 25;
-//public static final int PHFONT_MSG_FRENDER_WIDE2 = 27;
-//public static final int PHFONT_MSG_GLYPH = 9;
-//public static final int PHFONT_MSG_LIST = 3;
-//public static final int PHFONT_MSG_LOAD = 2;
-//public static final int PHFONT_MSG_LOCAL1 = 10;
-//public static final int PHFONT_MSG_LOCAL2 = 11;
-//public static final int PHFONT_MSG_LOCAL2_V20 = 31;
-//public static final int PHFONT_MSG_QUERY = 4;
-//public static final int PHFONT_MSG_RENDER = 7;
-//public static final int PHFONT_MSG_RENDER2 = 13;
-//public static final int PHFONT_MSG_SHMEM = 8;
-//public static final int PHFONT_MSG_STAT_PFR = 29;
-//public static final int PHFONT_MSG_STAT_PHF = 28;
-//public static final int PHFONT_MSG_STAT_TTF = 30;
-//public static final int PHFONT_MSG_WEXTENT = 15;
-//public static final int PHFONT_MSG_WRENDER = 16;
-//public static final int PHFONT_MSG_WRENDER2 = 17;
- public static final int PHFONT_PROP = 0x10;
- public static final int PHFONT_SCALABLE = 0x01;
-//
- public static final int Pk_KF_Key_Down = 0x00000001;
- public static final int Pk_KF_Key_Repeat = 0x00000002;
- public static final int Pk_KF_Scan_Valid = 0x00000020;
- public static final int Pk_KF_Sym_Valid = 0x00000040;
- public static final int Pk_KF_Cap_Valid = 0x00000080;
-//public static final int Pk_KF_Compose = 0x40000000;
- public static final int Pk_KM_Shift = 0x00000001;
- public static final int Pk_KM_Ctrl = 0x00000002;
- public static final int Pk_KM_Alt = 0x00000004;
-//public static final int Pk_KM_AltGr = 0x00000008;
-//public static final int Pk_KM_Shl3 = 0x00000010;
-//
-//public static final int Pk_KM_Shift_Lock = 0x00000100;
-//public static final int Pk_KM_Ctrl_Lock = 0x00000200;
-//public static final int Pk_KM_Alt_Lock = 0x00000400;
-//public static final int Pk_KM_AltGr_Lock = 0x00000800;
-//
-//public static final int Pk_KM_Caps_Lock = 0x00010000;
-//public static final int Pk_KM_Num_Lock = 0x00020000;
-//public static final int Pk_KM_Scroll_Lock = 0x00040000;
-//
-//
- public static final int Pk_BackSpace = 0xF008; /* back space, back char */
- public static final int Pk_Tab = 0xF009;
- public static final int Pk_Linefeed = 0xF00A; /* Linefeed, LF */
- public static final int Pk_Clear = 0xF00B;
- public static final int Pk_Return = 0xF00D; /* Return, enter */
- public static final int Pk_Pause = 0xF013; /* Pause, hold */
- public static final int Pk_Scroll_Lock = 0xF014;
- public static final int Pk_Escape = 0xF01B;
- public static final int Pk_Delete = 0xF0FF; /* Delete, rubout */
-//
-//public static final int Pk_Multi_key = 0xF020; /* Multi-key character compose */
-//
-//public static final int Pk_Kanji = 0xF021; /* Kanji, Kanji convert */
-//public static final int Pk_Muhenkan = 0xF022; /* Cancel Conversion */
-//public static final int Pk_Henkan_Mode = 0xF023; /* Start/Stop Conversion */
-//public static final int Pk_Henkan = 0xF023; /* Alias for Henkan_Mode */
-//public static final int Pk_Romaji = 0xF024; /* to Romaji */
-//public static final int Pk_Hiragana = 0xF025; /* to Hiragana */
-//public static final int Pk_Katakana = 0xF026; /* to Katakana */
-//public static final int Pk_Hiragana_Katakana = 0xF027; /* Hiragana/Katakana toggle */
-//public static final int Pk_Zenkaku = 0xF028; /* to Zenkaku */
-//public static final int Pk_Hankaku = 0xF029; /* to Hankaku */
-//public static final int Pk_Zenkaku_Hankaku = 0xF02A; /* Zenkaku/Hankaku toggle */
-//public static final int Pk_Touroku = 0xF02B; /* Add to Dictionary */
-//public static final int Pk_Massyo = 0xF02C; /* Delete from Dictionary */
-//public static final int Pk_Kana_Lock = 0xF02D; /* Kana Lock */
-//public static final int Pk_Kana_Shift = 0xF02E; /* Kana Shift */
-//public static final int Pk_Eisu_Shift = 0xF02F; /* Alphanumeric Shift */
-//public static final int Pk_Eisu_toggle = 0xF030; /* Alphanumeric toggle */
-//
- public static final int Pk_Home = 0xF050;
- public static final int Pk_Left = 0xF051; /* Move left, left arrow */
- public static final int Pk_Up = 0xF052; /* Move up, up arrow */
- public static final int Pk_Right = 0xF053; /* Move right, right arrow */
- public static final int Pk_Down = 0xF054; /* Move down, down arrow */
- public static final int Pk_Prior = 0xF055; /* Prior, previous */
- public static final int Pk_Pg_Up = 0xF055; /* Prior, previous */
- public static final int Pk_Next = 0xF056; /* Next */
- public static final int Pk_Pg_Down = 0xF056; /* Next */
- public static final int Pk_End = 0xF057; /* EOL */
-//public static final int Pk_Begin = 0xF058; /* BOL */
-//
-//public static final int Pk_Select = 0xF060; /* Select, mark */
-//public static final int Pk_Print = 0xF061;
-//public static final int Pk_Execute = 0xF062; /* Execute, run, do */
- public static final int Pk_Insert = 0xF063; /* Insert, insert here */
-//public static final int Pk_Undo = 0xF065; /* Undo, oops */
-//public static final int Pk_Redo = 0xF066; /* redo, again */
-//public static final int Pk_Menu = 0xF067;
-//public static final int Pk_Find = 0xF068; /* Find, search */
-//public static final int Pk_Cancel = 0xF069; /* Cancel, stop, abort, exit */
-//public static final int Pk_Help = 0xF06A; /* Help, ? */
-//public static final int Pk_Break = 0xF06B;
-//public static final int Pk_Mode_switch = 0xF07E; /* Character set switch */
-//public static final int Pk_script_switch = 0xF07E; /* Alias for mode_switch */
-//public static final int Pk_Num_Lock = 0xF07F;
-//
-//public static final int Pk_KP_Space = 0xF080; /* space */
- public static final int Pk_KP_Tab = 0xF089;
-//public static final int Pk_KP_Enter = 0xF08D; /* enter */
-//public static final int Pk_KP_F1 = 0xF091; /* PF1, KP_A, ... */
-//public static final int Pk_KP_F2 = 0xF092;
-//public static final int Pk_KP_F3 = 0xF093;
-//public static final int Pk_KP_F4 = 0xF094;
-//public static final int Pk_KP_Equal = 0xF0BD; /* equals */
-//public static final int Pk_KP_Multiply = 0xF0AA;
-//public static final int Pk_KP_Add = 0xF0AB;
-//public static final int Pk_KP_Separator = 0xF0AC; /* separator, often comma */
-//public static final int Pk_KP_Subtract = 0xF0AD;
-//public static final int Pk_KP_Decimal = 0xF0AE;
-//public static final int Pk_KP_Divide = 0xF0AF;
-//
-//public static final int Pk_KP_0 = 0xF0B0;
-//public static final int Pk_KP_1 = 0xF0B1;
-//public static final int Pk_KP_2 = 0xF0B2;
-//public static final int Pk_KP_3 = 0xF0B3;
-//public static final int Pk_KP_4 = 0xF0B4;
-//public static final int Pk_KP_5 = 0xF0B5;
-//public static final int Pk_KP_6 = 0xF0B6;
-//public static final int Pk_KP_7 = 0xF0B7;
-//public static final int Pk_KP_8 = 0xF0B8;
-//public static final int Pk_KP_9 = 0xF0B9;
-//
- public static final int Pk_F1 = 0xF0BE;
- public static final int Pk_F2 = 0xF0BF;
- public static final int Pk_F3 = 0xF0C0;
- public static final int Pk_F4 = 0xF0C1;
- public static final int Pk_F5 = 0xF0C2;
- public static final int Pk_F6 = 0xF0C3;
- public static final int Pk_F7 = 0xF0C4;
- public static final int Pk_F8 = 0xF0C5;
- public static final int Pk_F9 = 0xF0C6;
- public static final int Pk_F10 = 0xF0C7;
- public static final int Pk_F11 = 0xF0C8;
- public static final int Pk_F12 = 0xF0C9;
-//
- public static final int Pk_Shift_L = 0xF0E1; /* Left shift */
- public static final int Pk_Shift_R = 0xF0E2; /* Right shift */
- public static final int Pk_Control_L = 0xF0E3; /* Left control */
- public static final int Pk_Control_R = 0xF0E4; /* Right control */
-//public static final int Pk_Caps_Lock = 0xF0E5; /* Caps lock */
-//public static final int Pk_Shift_Lock = 0xF0E6; /* Shift lock */
-//
-//public static final int Pk_Meta_L = 0xF0E7; /* Left meta */
-//public static final int Pk_Meta_R = 0xF0E8; /* Right meta */
- public static final int Pk_Alt_L = 0xF0E9; /* Left alt */
- public static final int Pk_Alt_R = 0xF0EA; /* Right alt */
-//
-//public static final int Pm_CONTEXT_FLUSHED = 0x00000001;
-//public static final int Pm_IMAGE_CONTEXT = 1;
-//public static final int Pm_PHS_CONTEXT = 0;
-//public static final int POINTER_CTRL_ATTR_MASK = 0x00000f00;
-//public static final int POINTER_CTRL_BUTTONS = 0x00000010;
-//public static final int POINTER_CTRL_DEVMATRIX = 0x00000200;
-//public static final int POINTER_CTRL_FILENAME = 0x00000080;
-//public static final int POINTER_CTRL_GAIN = 0x00000004;
-//public static final int POINTER_CTRL_GETCTRL = 0x00000000;
-//public static final int POINTER_CTRL_GETMATRIX = 0x00000040;
-//public static final int POINTER_CTRL_LAYER = 0x00000800;
-//public static final int POINTER_CTRL_LAYER_MASK = DEV_CTRL_LAYER_MASK;
-//public static final int POINTER_CTRL_OFF = 0x00000002;
-//public static final int POINTER_CTRL_ON = 0x00000001;
-//public static final int POINTER_CTRL_SCRNMATRIX = 0x00000400;
-//public static final int POINTER_CTRL_SETMATRIX = 0x00000020;
-//public static final int POINTER_CTRL_SWAP = 0x00000100;
-//public static final int POINTER_CTRL_SWITCH_MASK = DEV_CTRL_SWITCH_MASK;
-//public static final int POINTER_CTRL_THRESHOLD = 0x00000008;
-//public static final int POINTER_CTRL_TYPE_MASK = DEV_CTRL_TYPE_MASK;
-//public static final int Pp_DOCUMENT_COMPLETE = 0x00000001;
-//public static final int Pp_LANDSCAPE = 1;
-//public static final int Pp_LANDSCAPE_TSHIRT = 3;
-//public static final int Pp_PAGE_COMPLETE = 0x00000002;
-//public static final int Pp_PORTRAIT = 0;
-//public static final int Pp_TSHIRT = 2;
-//public static final int Pt_ALIGN_BOTTOM = 0x20;
-//public static final int Pt_ALIGN_CENTER = 0x2;
-//public static final int Pt_ALIGN_LEFT = 0x40;
-//public static final int Pt_ALIGN_RIGHT = 0x80;
-//public static final int Pt_ALIGN_TOP = 0x10;
-//public static final int Pt_ALL_BUTTONS = 0x00800000;
- public static final int Pt_ALWAYS = 0x01;
-//public static final int Pt_ANCHORS_INVALID = 0x40000000;
- public static final int Pt_ANCHORS_LOCKED = 0x04000000;
-//public static final int Pt_ARC_CHORD = Pg_ARC_CHORD;
-//public static final int Pt_ARC_CURVE = Pg_ARC;
-//public static final int Pt_ARC_PIE = Pg_ARC_PIE;
-//public static final int Pt_ARG_ACCEL_FONT = ( 7 * 1000 + 1 );
- public static final int Pt_ARG_ACCEL_KEY = ( 3 * 1000 + 18 );
- public static final int Pt_ARG_ACCEL_TEXT = ( 7 * 1000 + 0 );
- public static final int Pt_ARG_ANCHOR_FLAGS = ( 10 * 1000 + 1 );
-//public static final int Pt_ARG_ANCHOR_OFFSETS = ( 10 * 1000 + 0 );
-//public static final int Pt_ARG_ARC_END = ( 26 * 1000 + 0 );
-//public static final int Pt_ARG_ARC_START = ( 26 * 1000 + 1 );
-//public static final int Pt_ARG_ARC_TYPE = ( 26 * 1000 + 2 );
- public static final int Pt_ARG_AREA = ( 1 * 1000 + 0 );
-//public static final int Pt_ARG_ARM_COLOR = ( 6 * 1000 + 0 );
-//public static final int Pt_ARG_ARM_DATA = ( 6 * 1000 + 1 );
-//public static final int Pt_ARG_ARM_FILL = ( 6 * 1000 + 2 );
- public static final int Pt_ARG_BALLOON_COLOR = ( 3 * 1000 + 20 );
- public static final int Pt_ARG_BALLOON_FILL_COLOR = ( 3 * 1000 + 19 );
- public static final int Pt_ARG_BALLOON_POSITION = ( 3 * 1000 + 16 );
-//public static final int Pt_ARG_BANDWIDTH_THRESHOLD = ( 2 * 1000 + 17 );
- public static final int Pt_ARG_BASIC_FLAGS = ( 2 * 1000 + 15 );
-//public static final int Pt_ARG_BEZIER_FLAGS = ( 42 * 1000 + 1 );
-//public static final int Pt_ARG_BITMAP_BALLOON = ( 20 * 1000 + 9 );
-//public static final int Pt_ARG_BITMAP_BALLOON_COLOR = ( 20 * 1000 + 11 );
-//public static final int Pt_ARG_BITMAP_BALLOON_FILL_COLOR = ( 20 * 1000 + 10 );
-//public static final int Pt_ARG_BITMAP_BALLOON_POSITION = ( 20 * 1000 + 8 );
-//public static final int Pt_ARG_BITMAP_COLORS = ( 20 * 1000 + 0 );
- public static final int Pt_ARG_BITMAP_CURSOR = ( 1 * 1000 + 17 );
-//public static final int Pt_ARG_BITMAP_DATA = ( 20 * 1000 + 1 );
-//public static final int Pt_ARG_BITMAP_FLAGS = ( 20 * 1000 + 7 );
-//public static final int Pt_ARG_BITMAP_TEXT = ( 20 * 1000 + 2 );
-//public static final int Pt_ARG_BKGD_BRT_FROM = ( 14 * 1000 + 0 );
-//public static final int Pt_ARG_BKGD_BRT_TO = ( 14 * 1000 + 1 );
-//public static final int Pt_ARG_BKGD_HUE_FROM = ( 14 * 1000 + 2 );
-//public static final int Pt_ARG_BKGD_HUE_TO = ( 14 * 1000 + 3 );
-//public static final int Pt_ARG_BKGD_IMAGE = ( 14 * 1000 + 15 );
-//public static final int Pt_ARG_BKGD_MIX = ( 14 * 1000 + 4 );
-//public static final int Pt_ARG_BKGD_ORIENTATION = ( 14 * 1000 + 5 );
-//public static final int Pt_ARG_BKGD_PIX_HEIGHT = ( 14 * 1000 + 8 );
-//public static final int Pt_ARG_BKGD_PIX_WIDTH = ( 14 * 1000 + 9 );
-//public static final int Pt_ARG_BKGD_PIXCOLORS = ( 14 * 1000 + 6 );
-//public static final int Pt_ARG_BKGD_PIXMAP = ( 14 * 1000 + 7 );
-//public static final int Pt_ARG_BKGD_SAT_FROM = ( 14 * 1000 + 10 );
-//public static final int Pt_ARG_BKGD_SAT_TO = ( 14 * 1000 + 11 );
-//public static final int Pt_ARG_BKGD_SPACING = ( 14 * 1000 + 16 );
-//public static final int Pt_ARG_BKGD_STEPS = ( 14 * 1000 + 12 );
-//public static final int Pt_ARG_BKGD_TILE = ( 14 * 1000 + 13 );
-//public static final int Pt_ARG_BKGD_TYPE = ( 14 * 1000 + 14 );
-//public static final int Pt_ARG_BMP_SET_BG_COLOR = ( 20 * 1000 + 3 );
-//public static final int Pt_ARG_BMP_SET_BG_FILL = ( 20 * 1000 + 4 );
- public static final int Pt_ARG_BORDER_WIDTH = ( 1 * 1000 + 1 );
-//public static final int Pt_ARG_BOT_BORDER_COLOR = ( 2 * 1000 + 0 );
- public static final int Pt_ARG_BUTTON_TYPE = ( 7 * 1000 + 2 );
-//public static final int Pt_ARG_CALENDAR_COLOR1 = ( 56 * 1000 + 2 );
-//public static final int Pt_ARG_CALENDAR_COLOR2 = ( 56 * 1000 + 4 );
-//public static final int Pt_ARG_CALENDAR_COLOR3 = ( 56 * 1000 + 6 );
-//public static final int Pt_ARG_CALENDAR_COLOR4 = ( 56 * 1000 + 8 );
-//public static final int Pt_ARG_CALENDAR_COLOR5 = ( 56 * 1000 + 10 );
-//public static final int Pt_ARG_CALENDAR_DATE = ( 56 * 1000 + 0 );
-//public static final int Pt_ARG_CALENDAR_FLAGS = ( 56 * 1000 + 14 );
-//public static final int Pt_ARG_CALENDAR_FONT1 = ( 56 * 1000 + 1 );
-//public static final int Pt_ARG_CALENDAR_FONT2 = ( 56 * 1000 + 3 );
-//public static final int Pt_ARG_CALENDAR_FONT3 = ( 56 * 1000 + 5 );
-//public static final int Pt_ARG_CALENDAR_FONT4 = ( 56 * 1000 + 7 );
-//public static final int Pt_ARG_CALENDAR_FONT5 = ( 56 * 1000 + 9 );
-//public static final int Pt_ARG_CALENDAR_HIGHLIGHT = ( 56 * 1000 + 15 );
-//public static final int Pt_ARG_CALENDAR_MONTH_BTN_COLOR = ( 56 * 1000 + 19 );
-//public static final int Pt_ARG_CALENDAR_MONTH_NAMES = ( 56 * 1000 + 13 );
-//public static final int Pt_ARG_CALENDAR_SEL_COLOR = ( 56 * 1000 + 11 );
-//public static final int Pt_ARG_CALENDAR_TIME_T = ( 56 * 1000 + 17 );
-//public static final int Pt_ARG_CALENDAR_WDAY_NAMES = ( 56 * 1000 + 12 );
-//public static final int Pt_ARG_CALENDAR_YEAR_BTN_COLOR = ( 56 * 1000 + 18 );
-//public static final int Pt_ARG_CBOX_BUTTON_BORDER_WIDTH = ( 31 * 1000 + 15 );
-//public static final int Pt_ARG_CBOX_BUTTON_BOT_BORDER_COLOR = ( 31 * 1000 + 17 );
-//public static final int Pt_ARG_CBOX_BUTTON_COLOR = ( 31 * 1000 + 18 );
-//public static final int Pt_ARG_CBOX_BUTTON_TOP_BORDER_COLOR = ( 31 * 1000 + 16 );
-//public static final int Pt_ARG_CBOX_BUTTON_WIDTH = ( 31 * 1000 + 6 );
- public static final int Pt_ARG_CBOX_FLAGS = ( 31 * 1000 + 0 );
- public static final int Pt_ARG_CBOX_MAX_VISIBLE_COUNT = ( 31 * 1000 + 19);
-//public static final int Pt_ARG_CBOX_SEL_ITEM = ( 31 * 1000 + 1 );
- public static final int Pt_ARG_CBOX_SELECTION_ITEM = ( 31 * 1000 + 1 );
-//public static final int Pt_ARG_CLIENT_FLAGS = ( 99 * 1000 + 7 );
-//public static final int Pt_ARG_CLIENT_NAME = ( 99 * 1000 + 4 );
-//public static final int Pt_ARG_CLIENT_REPLY_LEN = ( 99 * 1000 + 2 );
-//public static final int Pt_ARG_CLIENT_SEND = ( 99 * 1000 + 1 );
-//public static final int Pt_ARG_CLIENT_SERVER = ( 99 * 1000 + 0 );
-//public static final int Pt_ARG_CLOCK_FACE_COLOR = (57 * 1000 +6);
-//public static final int Pt_ARG_CLOCK_FACE_OUTLINE_COLOR = (57 * 1000 +5);
-//public static final int Pt_ARG_CLOCK_FLAGS = (57 * 1000 +1);
-//public static final int Pt_ARG_CLOCK_FONT = (57 * 1000 +17);
-//public static final int Pt_ARG_CLOCK_HOUR = (57 * 1000 +2);
-//public static final int Pt_ARG_CLOCK_HOUR_COLOR = (57 * 1000 +7);
-//public static final int Pt_ARG_CLOCK_HOUR_OFFSET = (57 * 1000 +14);
-//public static final int Pt_ARG_CLOCK_MINUTE = (57 * 1000 +3);
-//public static final int Pt_ARG_CLOCK_MINUTE_COLOR = (57 * 1000 +8);
-//public static final int Pt_ARG_CLOCK_MINUTE_OFFSET = (57 * 1000 +15);
-//public static final int Pt_ARG_CLOCK_SECOND = (57 * 1000 +4);
-//public static final int Pt_ARG_CLOCK_SECOND_COLOR = (57 * 1000 +9);
-//public static final int Pt_ARG_CLOCK_SECOND_OFFSET = (57 * 1000 +16);
-//public static final int Pt_ARG_CLOCK_SEP1 = (57 * 1000 +10);
-//public static final int Pt_ARG_CLOCK_SEP1_COLOR = (57 * 1000 +12);
-//public static final int Pt_ARG_CLOCK_SEP2 = (57 * 1000 +11);
-//public static final int Pt_ARG_CLOCK_SEP2_COLOR = (57 * 1000 +13);
-//public static final int Pt_ARG_CLOCK_TYPE = (57 * 1000 +0);
- public static final int Pt_ARG_COLOR = ( 2 * 1000 + 1 );
-//public static final int Pt_ARG_COLUMNS = ( 4 * 1000 + 1 );
- public static final int Pt_ARG_CONTAINER_FLAGS = ( 10 * 1000 + 5 );
-//public static final int Pt_ARG_CURRENT_FRAME = ( 101 * 1000 + 3 );
- public static final int Pt_ARG_CURSOR_COLOR = ( 1 * 1000 + 3 );
-//public static final int Pt_ARG_CURSOR_OFFSET = ( 4 * 1000 + 19);
- public static final int Pt_ARG_CURSOR_POSITION = ( 4 * 1000 + 3 );
- public static final int Pt_ARG_CURSOR_TYPE = ( 1 * 1000 + 2 );
-//public static final int Pt_ARG_DASH_LIST = ( 25 * 1000 + 0 );
-//public static final int Pt_ARG_DASH_SCALE = ( 25 * 1000 + 8 );
-//public static final int Pt_ARG_DATA = ( 1 * 1000 + 4 );
-//public static final int Pt_ARG_DB_IMAGE_TYPE = ( 48 * 1000 + 0 );
-//public static final int Pt_ARG_DB_MEMORY_CONTEXT_TYPE = ( 48 * 1000 + 1 );
-//public static final int Pt_ARG_DEFAULT_ACTION = ( 18 * 1000 + 0 );
- public static final int Pt_ARG_DIM = ( 1 * 1000 + 5 );
-//public static final int Pt_ARG_DIRECTION = ( 29 * 1000 + 0 );
-//public static final int Pt_ARG_DIVIDER_FLAGS = ( 44 * 1000 + 1 );
-//public static final int Pt_ARG_DIVIDER_OFFSET = ( 44 * 1000 + 4 );
-//public static final int Pt_ARG_DIVIDER_SIZES = ( 44 * 1000 + 2 );
-//public static final int Pt_ARG_EDIT_MASK = ( 4 * 1000 + 4 );
-//public static final int Pt_ARG_EFLAGS = ( 1 * 1000 + 18 );
-//public static final int Pt_ARG_EXTENDED_SHIFT = 20;
-//public static final int Pt_ARG_EXTENDED_TYPES_MASK = 0x00300000;
- public static final int Pt_ARG_FILL_COLOR = ( 2 * 1000 + 2 );
-//public static final int Pt_ARG_FILL_PATTERN = ( 2 * 1000 + 3 );
- public static final int Pt_ARG_FLAGS = ( 1 * 1000 + 6 );
-//public static final int Pt_ARG_FOCUS = ( 10 * 1000 + 2 );
-//public static final int Pt_ARG_FONT_DISPLAY = (38 * 1000 + 5);
-//public static final int Pt_ARG_FONT_FLAGS = (38 * 1000 + 3);
-//public static final int Pt_ARG_FONT_NAME = (38 * 1000 + 0);
-//public static final int Pt_ARG_FONT_SAMPLE = (38 * 1000 + 1);
-//public static final int Pt_ARG_FONT_SYMBOL = (38 * 1000 + 2);
-//public static final int Pt_ARG_FRAME_DATA = ( 101 * 1000 + 0 );
-//public static final int Pt_ARG_FRAME_INTERVAL = ( 101 * 1000 + 2 );
-//public static final int Pt_ARG_FS_FILE_SPEC = ( 47 * 1000 + 5 );
-//public static final int Pt_ARG_FS_FLAGS = ( 47 * 1000 + 2 );
-//public static final int Pt_ARG_FS_FORMAT = ( 47 * 1000 + 5 );
-//public static final int Pt_ARG_FS_IMAGES = ( 47 * 1000 + 1 );
-//public static final int Pt_ARG_FS_REFRESH = ( 47 * 1000 + 3 );
-//public static final int Pt_ARG_FS_ROOT_DIR = ( 47 * 1000 + 0 );
-//public static final int Pt_ARG_FS_TIMER_INITIAL = ( 47 * 1000 + 4 );
-//public static final int Pt_ARG_GAUGE_FLAGS = ( 21 * 1000 + 0 );
-//public static final int Pt_ARG_GAUGE_FONT = ( 21 * 1000 + 1 );
-//public static final int Pt_ARG_GAUGE_H_ALIGN = ( 21 * 1000 + 8 );
- public static final int Pt_ARG_GAUGE_MAXIMUM = ( 21 * 1000 + 3 );
- public static final int Pt_ARG_GAUGE_MINIMUM = ( 21 * 1000 + 2 );
- public static final int Pt_ARG_GAUGE_ORIENTATION = ( 21 * 1000 + 5 );
-//public static final int Pt_ARG_GAUGE_V_ALIGN = ( 21 * 1000 + 9 );
- public static final int Pt_ARG_GAUGE_VALUE = ( 21 * 1000 + 4 );
-//public static final int Pt_ARG_GAUGE_VALUE_PREFIX = ( 21 * 1000 + 6 );
-//public static final int Pt_ARG_GAUGE_VALUE_SUFFIX = ( 21 * 1000 + 7 );
-//public static final int Pt_ARG_GRAPHIC_FLAGS = ( 25 * 1000 + 1 );
-//public static final int Pt_ARG_GRID_HORIZONTAL = ( 43 * 1000 + 0 );
-//public static final int Pt_ARG_GRID_VERTICAL = ( 43 * 1000 + 1 );
- public static final int Pt_ARG_GROUP_FLAGS = ( 11 * 1000 + 0 );
- public static final int Pt_ARG_GROUP_HORZ_ALIGN = ( 11 * 1000 + 1 );
- public static final int Pt_ARG_GROUP_ORIENTATION = ( 11 * 1000 + 2 );
-//public static final int Pt_ARG_GROUP_ROWS_COLS = ( 11 * 1000 + 5 );
- public static final int Pt_ARG_GROUP_SPACING = ( 11 * 1000 + 3 );
-//public static final int Pt_ARG_GROUP_SPACING_X = ( 11 * 1000 + 6 );
-//public static final int Pt_ARG_GROUP_SPACING_Y = ( 11 * 1000 + 7 );
- public static final int Pt_ARG_GROUP_VERT_ALIGN = ( 11 * 1000 + 4 );
-//public static final int Pt_ARG_HELP_TOPIC = ( 1 * 1000 + 15 );
-//public static final int Pt_ARG_HIGHLIGHT_COLOR = ( 4 * 1000 + 15 );
-//public static final int Pt_ARG_HIGHLIGHT_ROUNDNESS = ( 2 * 1000 + 14 );
- public static final int Pt_ARG_HORIZONTAL_ALIGNMENT = ( 3 * 1000 + 0 );
-//public static final int Pt_ARG_HTML_BORDER_WIDTH = ( 45 * 1000 + 26 );
-//public static final int Pt_ARG_HTML_CURSOR_BUSY = ( 45 * 1000 + 11 );
-//public static final int Pt_ARG_HTML_CURSOR_DEFAULT = ( 45 * 1000 + 9 );
-//public static final int Pt_ARG_HTML_CURSOR_LINK = ( 45 * 1000 + 10 );
-//public static final int Pt_ARG_HTML_FILL_COLOR = ( 45 * 1000 + 27 );
-//public static final int Pt_ARG_HTML_FLAGS = ( 45 * 1000 + 31 );
-//public static final int Pt_ARG_HTML_H1_FONT = ( 45 * 1000 + 2 );
-//public static final int Pt_ARG_HTML_H2_FONT = ( 45 * 1000 + 3 );
-//public static final int Pt_ARG_HTML_H3_FONT = ( 45 * 1000 + 4 );
-//public static final int Pt_ARG_HTML_H4_FONT = ( 45 * 1000 + 5 );
-//public static final int Pt_ARG_HTML_H5_FONT = ( 45 * 1000 + 6 );
-//public static final int Pt_ARG_HTML_H6_FONT = ( 45 * 1000 + 7 );
-//public static final int Pt_ARG_HTML_INCREMENT = ( 45 * 1000 + 32 );
-//public static final int Pt_ARG_HTML_LINK_COLOR = ( 45 * 1000 + 8 );
-//public static final int Pt_ARG_HTML_PAGE_BM = ( 45 * 1000 + 24 );
-//public static final int Pt_ARG_HTML_PAGE_H = ( 45 * 1000 + 20 );
-//public static final int Pt_ARG_HTML_PAGE_INCREMENT = ( 45 * 1000 + 33 );
-//public static final int Pt_ARG_HTML_PAGE_LM = ( 45 * 1000 + 25 );
-//public static final int Pt_ARG_HTML_PAGE_N = ( 45 * 1000 + 35 );
-//public static final int Pt_ARG_HTML_PAGE_RM = ( 45 * 1000 + 23 );
-//public static final int Pt_ARG_HTML_PAGE_TM = ( 45 * 1000 + 22 );
-//public static final int Pt_ARG_HTML_PAGE_W = ( 45 * 1000 + 21 );
-//public static final int Pt_ARG_HTML_PAGE_X = ( 45 * 1000 + 18 );
-//public static final int Pt_ARG_HTML_PAGE_Y = ( 45 * 1000 + 19 );
-//public static final int Pt_ARG_HTML_PAGES = ( 45 * 1000 + 34 );
-//public static final int Pt_ARG_HTML_SCROLL_COLOR = ( 45 * 1000 + 28 );
-//public static final int Pt_ARG_HTML_SCROLL_FILL_COLOR = ( 45 * 1000 + 29 );
-//public static final int Pt_ARG_HTML_SCROLL_HORIZONTAL = ( 45 * 1000 + 13 );
-//public static final int Pt_ARG_HTML_SCROLL_VERTICAL = ( 45 * 1000 + 12 );
-//public static final int Pt_ARG_HTML_SCROLL_WIDTH = ( 45 * 1000 + 14 );
-//public static final int Pt_ARG_HTML_TEXT_FONT = ( 45 * 1000 + 1 );
-//public static final int Pt_ARG_HTML_URL = ( 45 * 1000 + 0 );
-//public static final int Pt_ARG_ICON_FLAGS = ( 18 * 1000 + 1 );
-//public static final int Pt_ARG_ICON_POS = ( 18 * 1000 + 2 );
-//public static final int Pt_ARG_ICON_WINDOW = ( 18 * 1000 + 3 );
-//public static final int Pt_ARG_IMAGEAREA_FLAGS = ( 103 * 1000 + 8 );
-//public static final int Pt_ARG_IMAGEAREA_GRID_COLOR = ( 103 * 1000 + 14 );
-//public static final int Pt_ARG_IMAGEAREA_GRID_THRESHOLD = ( 103 * 1000 + 13 );
-//public static final int Pt_ARG_IMAGEAREA_IMAGE = ( 103 * 1000 + 0 );
-//public static final int Pt_ARG_IMAGEAREA_LEFT = ( 103 * 1000 + 6 );
-//public static final int Pt_ARG_IMAGEAREA_SELECTION = ( 103 * 1000 + 12 );
-//public static final int Pt_ARG_IMAGEAREA_TOP = ( 103 * 1000 + 5 );
-//public static final int Pt_ARG_IMAGEAREA_ZOOM = ( 103 * 1000 + 7 );
-//public static final int Pt_ARG_IMAGETREE_COLUMNS = ( 49 * 1000 + 2 );
-//public static final int Pt_ARG_IN_EXDATA = 0x00100000;
-//public static final int Pt_ARG_IN_WDATA = 0x00200000;
- public static final int Pt_ARG_INCREMENT = ( 29 * 1000 + 1 );
-//public static final int Pt_ARG_INDICATOR_COLOR = ( 9 * 1000 + 0 );
-//public static final int Pt_ARG_INDICATOR_DEPTH = ( 9 * 1000 + 6 );
-//public static final int Pt_ARG_INDICATOR_HEIGHT = ( 9 * 1000 + 8 );
- public static final int Pt_ARG_INDICATOR_TYPE = ( 9 * 1000 + 2 );
-//public static final int Pt_ARG_INDICATOR_WIDTH = ( 9 * 1000 + 7 );
- public static final int Pt_ARG_ITEMS = ( 23 * 1000 + 1 );
-//public static final int Pt_ARG_LABEL_BALLOON = ( 3 * 1000 + 17 );
-//public static final int Pt_ARG_LABEL_DATA = ( 3 * 1000 + 1 );
-//public static final int Pt_ARG_LABEL_FLAGS = ( 3 * 1000 + 2 );
- public static final int Pt_ARG_LABEL_TYPE = ( 3 * 1000 + 3 );
-//public static final int Pt_ARG_LINE_CAP = ( 25 * 1000 + 4 );
-//public static final int Pt_ARG_LINE_JOIN = ( 25 * 1000 + 3 );
- public static final int Pt_ARG_LINE_SPACING = ( 3 * 1000 + 21 );
-//public static final int Pt_ARG_LINE_WIDTH = ( 25 * 1000 + 2 );
-//public static final int Pt_ARG_LIST_BALLOON = ( 23 * 1000 + 31 );
-//public static final int Pt_ARG_LIST_COLUMN_ATTR = ( 23 * 1000 + 28 );
-//public static final int Pt_ARG_LIST_COLUMN_POS = ( 23 * 1000 + 27 );
-//public static final int Pt_ARG_LIST_FLAGS = ( 23 * 1000 + 2 );
- public static final int Pt_ARG_LIST_FONT = ( 23 * 1000 + 3 );
- public static final int Pt_ARG_LIST_ITEM_COUNT = ( 23 * 1000 + 14 );
-//public static final int Pt_ARG_LIST_SB_RES = ( 23 * 1000 + 25 );
-//public static final int Pt_ARG_LIST_SCROLL_RATE = ( 23 * 1000 + 26 );
- public static final int Pt_ARG_LIST_SEL_COUNT = ( 23 * 1000 + 15 );
-//public static final int Pt_ARG_LIST_SPACING = ( 23 * 1000 + 4 );
- public static final int Pt_ARG_LIST_TOTAL_HEIGHT = ( 23 * 1000 + 16 );
- public static final int Pt_ARG_MARGIN_BOTTOM = ( 3 * 1000 + 4 );
- public static final int Pt_ARG_MARGIN_HEIGHT = ( 2 * 1000 + 4 );
- public static final int Pt_ARG_MARGIN_LEFT = ( 3 * 1000 + 5 );
- public static final int Pt_ARG_MARGIN_RIGHT = ( 3 * 1000 + 6 );
- public static final int Pt_ARG_MARGIN_TOP = ( 3 * 1000 + 7 );
- public static final int Pt_ARG_MARGIN_WIDTH = ( 2 * 1000 + 5 );
-//public static final int Pt_ARG_MAX_HEIGHT = ( 18 * 1000 + 4 );
- public static final int Pt_ARG_MAX_LENGTH = ( 4 * 1000 + 5 );
-//public static final int Pt_ARG_MAX_WIDTH = ( 18 * 1000 + 5 );
- public static final int Pt_ARG_MENU_FLAGS = ( 19 * 1000 + 0 );
-//public static final int Pt_ARG_MENU_SPACING = ( 19 * 1000 + 1 );
-//public static final int Pt_ARG_MENU_TEXT_FONT = ( 19 * 1000 + 2 );
-//public static final int Pt_ARG_MENU_TITLE = ( 19 * 1000 + 3 );
-//public static final int Pt_ARG_MENU_TITLE_FONT = ( 19 * 1000 + 4 );
-//public static final int Pt_ARG_MENUBAR_FLAGS = ( 37 * 1000 + 0 );
-//public static final int Pt_ARG_MIN_HEIGHT = ( 18 * 1000 + 6 );
-//public static final int Pt_ARG_MIN_SLIDER_SIZE = ( 29 * 1000 + 11 );
-//public static final int Pt_ARG_MIN_WIDTH = ( 18 * 1000 + 7 );
-//public static final int Pt_ARG_MLTITXT_FLAGS = ( 5 * 1000 + 2 );
-//public static final int Pt_ARG_MODE_ALLOC = 0x000A0000;
-//public static final int Pt_ARG_MODE_ARRAY = 0x000C0000;
-//public static final int Pt_ARG_MODE_BOOLEAN = 0x00080000;
-//public static final int Pt_ARG_MODE_CHAR = 0x00010000;
-//public static final int Pt_ARG_MODE_CHAR_FLAGS = 0x00040000;
-//public static final int Pt_ARG_MODE_LONG = 0x00030000;
-//public static final int Pt_ARG_MODE_INT = Pt_ARG_MODE_LONG;
-//public static final int Pt_ARG_MODE_LINKED = 0x000D0000;
-//public static final int Pt_ARG_MODE_LONG_FLAGS = 0x00060000;
-//public static final int Pt_ARG_MODE_MASK = 0x000F0000;
-//public static final int Pt_ARG_MODE_PTR = 0x00070000;
-//public static final int Pt_ARG_MODE_SHORT = 0x00020000;
-//public static final int Pt_ARG_MODE_SHORT_FLAGS = 0x00050000;
-//public static final int Pt_ARG_MODE_STRALLOC = 0x000B0000;
-//public static final int Pt_ARG_MODE_STRING = 0x000B0000;
-//public static final int Pt_ARG_MODE_STRUCT = 0x00090000;
-//public static final int Pt_ARG_MODE_VARIABLE = 0x00090000;
-//public static final int Pt_ARG_MODIFY_ITEMS = ( 23 * 1000 + 29 );
-//public static final int Pt_ARG_MSG_BUTTON1 = ( 32 * 1000 + 4 );
-//public static final int Pt_ARG_MSG_BUTTON2 = ( 32 * 1000 + 5 );
-//public static final int Pt_ARG_MSG_BUTTON3 = ( 32 * 1000 + 6 );
-//public static final int Pt_ARG_MSG_DEFAULT = ( 32 * 1000 + 7 );
-//public static final int Pt_ARG_MSG_ESCAPE = ( 32 * 1000 + 2 );
-//public static final int Pt_ARG_MSG_FLAGS = ( 32 * 1000 + 11 );
-//public static final int Pt_ARG_MSG_FONT = ( 32 * 1000 + 3 );
-//public static final int Pt_ARG_MSG_TEXT = ( 32 * 1000 + 1 );
-//public static final int Pt_ARG_MSG_TITLE = ( 32 * 1000 + 0 );
-//public static final int Pt_ARG_MULTITEXT_BOTTOM_LINE = ( 5 * 1000 + 8 );
-//public static final int Pt_ARG_MULTITEXT_FLAGS = ( 5 * 1000 + 15 );
- public static final int Pt_ARG_MULTITEXT_LINE_SPACING = ( 5 * 1000 + 3 );
- public static final int Pt_ARG_MULTITEXT_NUM_LINES = ( 5 * 1000 + 6 );
-//public static final int Pt_ARG_MULTITEXT_NUM_LINES_VISIBLE = ( 5 * 1000 + 5 );
-//public static final int Pt_ARG_MULTITEXT_QUERY_CHARACTER = ( 5 * 1000 + 11 );
- public static final int Pt_ARG_MULTITEXT_QUERY_LINE = ( 5 * 1000 + 10 );
-//public static final int Pt_ARG_MULTITEXT_RANGE_ATTRIBUTES = ( 5 * 1000 + 0 );
-//public static final int Pt_ARG_MULTITEXT_ROWS = ( 5 * 1000 + 12 );
-//public static final int Pt_ARG_MULTITEXT_SEGMENTS = ( 5 * 1000 + 4 );
- public static final int Pt_ARG_MULTITEXT_TABS = ( 5 * 1000 + 13 );
- public static final int Pt_ARG_MULTITEXT_TOP_LINE = ( 5 * 1000 + 7 );
- public static final int Pt_ARG_MULTITEXT_WRAP_FLAGS = ( 5 * 1000 + 1 );
-//public static final int Pt_ARG_MULTITEXT_X_SCROLL_POS = ( 5 * 1000 + 9 );
-//public static final int Pt_ARG_MULTITEXT_Y_SCROLL_POS = ( 5 * 1000 + 7 );
-//public static final int Pt_ARG_NUM_FRAMES = ( 101 * 1000 + 1 );
-//public static final int Pt_ARG_NUMERIC_FLAGS = ( 53 * 1000 + 1 );
-//public static final int Pt_ARG_NUMERIC_INCREMENT = ( 53 * 1000 + 3 );
-//public static final int Pt_ARG_NUMERIC_MAX = ( 53 * 1000 + 6 );
-//public static final int Pt_ARG_NUMERIC_MIN = ( 53 * 1000 + 5 );
-//public static final int Pt_ARG_NUMERIC_PRECISION = ( 53 * 1000 + 16 );
-//public static final int Pt_ARG_NUMERIC_PREFIX = ( 53 * 1000 + 7 );
-//public static final int Pt_ARG_NUMERIC_SPACING = ( 53 * 1000 + 17 );
-//public static final int Pt_ARG_NUMERIC_SUFFIX = ( 53 * 1000 + 8 );
-//public static final int Pt_ARG_NUMERIC_TEXT_BORDER = ( 53 * 1000 + 9 );
-//public static final int Pt_ARG_NUMERIC_TEXT_BOT_BORDER_COLOR = ( 53 * 1000 + 14 );
-//public static final int Pt_ARG_NUMERIC_TEXT_COLOR = ( 53 * 1000 + 11 );
-//public static final int Pt_ARG_NUMERIC_TEXT_FILL_COLOR = ( 53 * 1000 + 12 );
-//public static final int Pt_ARG_NUMERIC_TEXT_FLAGS = ( 53 * 1000 + 19 );
-//public static final int Pt_ARG_NUMERIC_TEXT_FONT = ( 53 * 1000 + 10 );
-//public static final int Pt_ARG_NUMERIC_TEXT_TOP_BORDER_COLOR = ( 53 * 1000 + 13 );
-//public static final int Pt_ARG_NUMERIC_UPDOWN_BORDER_WIDTH = ( 53 * 1000 + 18 );
-//public static final int Pt_ARG_NUMERIC_UPDOWN_WIDTH = ( 53 * 1000 + 2 );
-//public static final int Pt_ARG_NUMERIC_VALUE = ( 53 * 1000 + 4 );
-//public static final int Pt_ARG_OFFSET = ( 7 * 1000 + 3 );
-//public static final int Pt_ARG_OFFSET_MASK = 0x0000FFFF;
-//public static final int Pt_ARG_ONOFF_STATE = ( 8 * 1000 + 0 );
-//public static final int Pt_ARG_ORIGIN = ( 25 * 1000 + 5 );
- public static final int Pt_ARG_PAGE_INCREMENT = ( 29 * 1000 + 5 );
-//public static final int Pt_ARG_PANE_FLAGS = ( 12 * 1000 + 0 );
-//public static final int Pt_ARG_PANE_RECT = ( 12 * 1000 + 1 );
-//public static final int Pt_ARG_POINTS = ( 25 * 1000 + 6 );
-//public static final int Pt_ARG_POLYGON_FLAGS = ( 27 * 1000 + 1 );
- public static final int Pt_ARG_POS = ( 1 * 1000 + 7 );
-//public static final int Pt_ARG_PRINT_CONTEXT = (46 * 1000 + 0);
-//public static final int Pt_ARG_PRINT_FLAGS = (46 * 1000 + 1);
-//public static final int Pt_ARG_PS_ALL_PAGES_LABEL = (46 * 1000 + 12);
-//public static final int Pt_ARG_PS_COLLATE_METHOD_LABEL = (46 * 1000 + 6);
-//public static final int Pt_ARG_PS_COPIES_LABEL = (46 * 1000 + 10);
-//public static final int Pt_ARG_PS_FILENAME_LABEL = (46 * 1000 + 16);
-//public static final int Pt_ARG_PS_LOCATION_LABEL = (46 * 1000 + 7);
-//public static final int Pt_ARG_PS_NUM_COPIES_LABEL = (46 * 1000 + 5);
-//public static final int Pt_ARG_PS_PAGES_LABEL = (46 * 1000 + 13);
-//public static final int Pt_ARG_PS_PRINT_RANGE_LABEL = (46 * 1000 + 9);
-//public static final int Pt_ARG_PS_PRINTER_LABEL = (46 * 1000 + 8);
-//public static final int Pt_ARG_PS_PROPERTIES_LABEL = (46 * 1000 + 11);
-//public static final int Pt_ARG_PS_SEL_TITLE = (46 * 1000 + 4);
-//public static final int Pt_ARG_PS_SELECTION_LABEL = (46 * 1000 + 15);
-//public static final int Pt_ARG_PS_TOFILE_LABEL = (46 * 1000 + 14);
-//public static final int Pt_ARG_RAW_CALLBACKS = ( 1 * 1000 + 11 );
-//public static final int Pt_ARG_RAW_CONNECT_F = ( 24 * 1000 + 1 );
-//public static final int Pt_ARG_RAW_DRAW_F = ( 24 * 1000 + 0 );
-//public static final int Pt_ARG_RAW_EXTENT_F = ( 24 * 1000 + 2 );
-//public static final int Pt_ARG_RAW_INIT_F = ( 24 * 1000 + 3 );
-//public static final int Pt_ARG_RECT_ROUNDNESS = ( 28 * 1000 + 0 );
-//public static final int Pt_ARG_REGION_CURSOR = ( 1 * 1000 + 2 );
-//public static final int Pt_ARG_REGION_CURSOR_COLOR = ( 1 * 1000 + 3 );
-//public static final int Pt_ARG_REGION_DATA = ( 15 * 1000 + 9 );
-//public static final int Pt_ARG_REGION_FIELDS = ( 15 * 1000 + 2 );
-//public static final int Pt_ARG_REGION_FLAGS = ( 15 * 1000 + 3 );
-//public static final int Pt_ARG_REGION_HANDLE = ( 15 * 1000 + 4 );
-//public static final int Pt_ARG_REGION_INFRONT = ( 15 * 1000 + 10 );
-//public static final int Pt_ARG_REGION_INPUT_GROUP = ( 15 * 1000 + 11 );
- public static final int Pt_ARG_REGION_OPAQUE = ( 15 * 1000 + 5 );
-//public static final int Pt_ARG_REGION_OWNER = ( 15 * 1000 + 6 );
-//public static final int Pt_ARG_REGION_PARENT = ( 15 * 1000 + 7 );
- public static final int Pt_ARG_REGION_SENSE = ( 15 * 1000 + 8 );
- public static final int Pt_ARG_RESIZE_FLAGS = ( 1 * 1000 + 8 );
-//public static final int Pt_ARG_SCROLL_AREA_FLAGS = ( 13 * 1000 + 12 );
-//public static final int Pt_ARG_SCROLL_AREA_INCREMENT_X = ( 13 * 1000 + 0 );
-//public static final int Pt_ARG_SCROLL_AREA_INCREMENT_Y = ( 13 * 1000 + 1 );
- public static final int Pt_ARG_SCROLL_AREA_MAX_X = ( 13 * 1000 + 2 );
- public static final int Pt_ARG_SCROLL_AREA_MAX_Y = ( 13 * 1000 + 3 );
-//public static final int Pt_ARG_SCROLL_AREA_POS_X = ( 13 * 1000 + 5 );
-//public static final int Pt_ARG_SCROLL_AREA_POS_Y = ( 13 * 1000 + 4 );
-//public static final int Pt_ARG_SCROLLBAR = ( 23 * 1000 + 11 );
-//public static final int Pt_ARG_SCROLLBAR_FLAGS = ( 29 * 1000 + 9 );
- public static final int Pt_ARG_SCROLLBAR_WIDTH = ( 23 * 1000 + 5 );
- public static final int Pt_ARG_SCROLLBAR_X_DISPLAY = ( 13 * 1000 + 6 );
-//public static final int Pt_ARG_SCROLLBAR_X_HEIGHT = ( 13 * 1000 + 7 );
- public static final int Pt_ARG_SCROLLBAR_Y_DISPLAY = ( 13 * 1000 + 8 );
-//public static final int Pt_ARG_SCROLLBAR_Y_WIDTH = ( 13 * 1000 + 9 );
-//public static final int Pt_ARG_SEL_INDEXES = ( 23 * 1000 + 6 );
-//public static final int Pt_ARG_SEL_MODE = ( 23 * 1000 + 7 );
-//public static final int Pt_ARG_SELECT_SHIFT = ( 3 * 1000 + 9 );
- public static final int Pt_ARG_SELECTION_FILL_COLOR = ( 23 * 1000 + 12 );
- public static final int Pt_ARG_SELECTION_INDEXES = ( 23 * 1000 + 6 );
- public static final int Pt_ARG_SELECTION_MODE = ( 23 * 1000 + 7 );
- public static final int Pt_ARG_SELECTION_RANGE = ( 4 * 1000 + 12 );
- public static final int Pt_ARG_SELECTION_TEXT_COLOR = ( 23 * 1000 + 13 );
- public static final int Pt_ARG_SEP_FLAGS = ( 30 * 1000 + 0 );
-//public static final int Pt_ARG_SEP_ORIENTATION = ( 30 * 1000 + 1 );
- public static final int Pt_ARG_SEP_TYPE = ( 30 * 1000 + 2 );
-//public static final int Pt_ARG_SERVER_CONNECTION = ( 98 * 1000 + 6 );
-//public static final int Pt_ARG_SERVER_NAME = ( 98 * 1000 + 7 );
-//public static final int Pt_ARG_SERVER_SEND = ( 98 * 1000 + 2 );
-//public static final int Pt_ARG_SET_BITMAP_COLORS = ( 20 * 1000 + 5 );
-//public static final int Pt_ARG_SET_BITMAP_DATA = ( 20 * 1000 + 6 );
-//public static final int Pt_ARG_SET_COLOR = ( 9 * 1000 + 3 );
-//public static final int Pt_ARG_SET_FILL = ( 9 * 1000 + 4 );
-//public static final int Pt_ARG_SHOW_ARROWS = ( 29 * 1000 + 6 );
-//public static final int Pt_ARG_SIZE_MASK = 0xFFC00000;
-//public static final int Pt_ARG_SIZE_SHIFT = 22;
-//public static final int Pt_ARG_SLIDER_FLAGS = ( 22 * 1000 + 0 );
-//public static final int Pt_ARG_SLIDER_HANDLE_HEIGHT = ( 22 * 1000 + 8 );
-//public static final int Pt_ARG_SLIDER_HANDLE_WIDTH = ( 22 * 1000 + 7 );
-//public static final int Pt_ARG_SLIDER_IMAGE = ( 22 * 1000 + 9 );
-//public static final int Pt_ARG_SLIDER_INCREMENT = ( 22 * 1000 + 1 );
-//public static final int Pt_ARG_SLIDER_LABEL_BR = ( 22 * 1000 + 3 );
-//public static final int Pt_ARG_SLIDER_LABEL_BR_COL = ( 22 * 1000 + 5 );
-//public static final int Pt_ARG_SLIDER_LABEL_TL = ( 22 * 1000 + 2 );
-//public static final int Pt_ARG_SLIDER_LABEL_TL_COL = ( 22 * 1000 + 4 );
-//public static final int Pt_ARG_SLIDER_MULTIPLE = ( 22 * 1000 + 6 );
-//public static final int Pt_ARG_SLIDER_ORIENTATION = ( 22 * 1000 + 19 );
- public static final int Pt_ARG_SLIDER_SIZE = ( 29 * 1000 + 7 );
-//public static final int Pt_ARG_SLIDER_TICK_MAJOR_COL = ( 22 * 1000 + 10 );
-//public static final int Pt_ARG_SLIDER_TICK_MAJOR_DIV = ( 22 * 1000 + 13 );
-//public static final int Pt_ARG_SLIDER_TICK_MAJOR_LEN = ( 22 * 1000 + 14 );
-//public static final int Pt_ARG_SLIDER_TICK_MINOR_COL = ( 22 * 1000 + 11 );
-//public static final int Pt_ARG_SLIDER_TICK_MINOR_DIV = ( 22 * 1000 + 12 );
-//public static final int Pt_ARG_SLIDER_TICK_MINOR_LEN = ( 22 * 1000 + 15 );
-//public static final int Pt_ARG_SLIDER_TROUGH_COL = ( 22 * 1000 + 18 );
-//public static final int Pt_ARG_SLIDER_TROUGH_SIZE = ( 22 * 1000 + 16 );
-//public static final int Pt_ARG_SPACING = ( 9 * 1000 + 5 );
-//public static final int Pt_ARG_TAB_FLAGS = ( 58 * 1000 + 0 );
-//public static final int Pt_ARG_TEMPLATE_1 = ( 5001 * 1000 + 0 );
-//public static final int Pt_ARG_TEMPLATE_2 = ( 5001 * 1000 + 1 );
-//public static final int Pt_ARG_TEXT_CURSOR_WIDTH = ( 4 * 1000 + 18 );
- public static final int Pt_ARG_TEXT_FLAGS = ( 4 * 1000 + 8 );
- public static final int Pt_ARG_TEXT_FONT = ( 3 * 1000 + 10 );
-//public static final int Pt_ARG_TEXT_HIGHLIGHT_BACKGROUND_COLOR = ( 4 * 1000 + 17 );
-//public static final int Pt_ARG_TEXT_HIGHLIGHT_TEXT_COLOR = ( 4 * 1000 + 16 );
- public static final int Pt_ARG_TEXT_STRING = ( 3 * 1000 + 11 );
-//public static final int Pt_ARG_TEXT_SUBSTRING = ( 4 * 1000 + 13 );
- public static final int Pt_ARG_TIMER_INITIAL = ( 41 * 1000 + 0 );
-//public static final int Pt_ARG_TIMER_REPEAT = ( 41 * 1000 + 1 );
-//public static final int Pt_ARG_TOP_BORDER_COLOR = ( 2 * 1000 + 6 );
- public static final int Pt_ARG_TOP_ITEM_POS = ( 23 * 1000 + 8 );
-//public static final int Pt_ARG_TRANS_PATTERN = ( 2 * 1000 + 13 );
-//public static final int Pt_ARG_TREE_BALLOON = ( 23 * 1000 + 30 );
-//public static final int Pt_ARG_TREE_FLAGS = ( 23 * 1000 + 18 );
- public static final int Pt_ARG_TREE_IMAGES = ( 23 * 1000 + 19 );
-//public static final int Pt_ARG_TREE_IMGMASK = ( 23 * 1000 + 20 );
-//public static final int Pt_ARG_UNDERLINE1 = ( 3 * 1000 + 12 );
-//public static final int Pt_ARG_UNDERLINE2 = ( 3 * 1000 + 13 );
-//public static final int Pt_ARG_UNDERLINE_TYPE = ( 3 * 1000 + 14 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_BOT = ( 52 * 1000 + 8 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_BOTTOM = ( 52 * 1000 + 8 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_LEF = ( 52 * 1000 + 9 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_LEFT = ( 52 * 1000 + 9 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_RIGHT = ( 52 * 1000 + 10 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_RIT = ( 52 * 1000 + 10 );
-//public static final int Pt_ARG_UPDOWN_ARM_DATA_TOP = ( 52 * 1000 + 7 );
-//public static final int Pt_ARG_UPDOWN_BOT_BDR_COLOR = ( 52 * 1000 + 12 );
-//public static final int Pt_ARG_UPDOWN_BOTTOM_BORDER_COLOR = ( 52 * 1000 + 12 );
-//public static final int Pt_ARG_UPDOWN_DATA_BOT = ( 52 * 1000 + 4 );
-//public static final int Pt_ARG_UPDOWN_DATA_BOTTOM = ( 52 * 1000 + 4 );
-//public static final int Pt_ARG_UPDOWN_DATA_LEF = ( 52 * 1000 + 5 );
-//public static final int Pt_ARG_UPDOWN_DATA_LEFT = ( 52 * 1000 + 5 );
-//public static final int Pt_ARG_UPDOWN_DATA_RIGHT = ( 52 * 1000 + 6 );
-//public static final int Pt_ARG_UPDOWN_DATA_RIT = ( 52 * 1000 + 6 );
-//public static final int Pt_ARG_UPDOWN_DATA_TOP = ( 52 * 1000 + 3 );
-//public static final int Pt_ARG_UPDOWN_FILL_COLOR = ( 52 * 1000 + 16 );
-//public static final int Pt_ARG_UPDOWN_FLAGS = ( 52 * 1000 + 15 );
-//public static final int Pt_ARG_UPDOWN_HIGHLGHT_ROUND = ( 52 * 1000 + 14 );
-//public static final int Pt_ARG_UPDOWN_HIGHLIGHT_ROUND = ( 52 * 1000 + 14 );
-//public static final int Pt_ARG_UPDOWN_MARGIN_HEIGHT = ( 52 * 1000 + 17 );
-//public static final int Pt_ARG_UPDOWN_MARGIN_WIDTH = ( 52 * 1000 + 18 );
-//public static final int Pt_ARG_UPDOWN_ORIENTATION = ( 52 * 1000 + 1 );
-//public static final int Pt_ARG_UPDOWN_SPACING = ( 52 * 1000 + 2 );
-//public static final int Pt_ARG_UPDOWN_TOP_BDR_COLOR = ( 52 * 1000 + 13 );
-//public static final int Pt_ARG_UPDOWN_TOP_BORDER_COLOR = ( 52 * 1000 + 13 );
- public static final int Pt_ARG_USER_DATA = ( 1 * 1000 + 14 );
- public static final int Pt_ARG_VERTICAL_ALIGNMENT = ( 3 * 1000 + 15 );
- public static final int Pt_ARG_VISIBLE_COUNT = ( 23 * 1000 + 9 );
-//public static final int Pt_ARG_WIN_PARENT = ( 18 * 1000 + 8 );
-//public static final int Pt_ARG_WINDOW_ACTIVE_COLOR = ( 18 * 1000 + 18 );
-//public static final int Pt_ARG_WINDOW_CURSOR_OVERRIDE = ( 18 * 1000 + 9 );
-//public static final int Pt_ARG_WINDOW_FORCE_FRONT = ( 18 * 1000 + 10 );
-//public static final int Pt_ARG_WINDOW_FRONT_WINDOW = ( 18 * 1000 + 22 );
-//public static final int Pt_ARG_WINDOW_HELP_ROOT = ( 18 * 1000 + 20 );
-//public static final int Pt_ARG_WINDOW_INACTIVE_COLOR = ( 18 * 1000 + 19 );
- public static final int Pt_ARG_WINDOW_MANAGED_FLAGS = ( 18 * 1000 + 11 );
- public static final int Pt_ARG_WINDOW_NOTIFY_FLAGS = ( 18 * 1000 + 12 );
- public static final int Pt_ARG_WINDOW_RENDER_FLAGS = ( 18 * 1000 + 13 );
- public static final int Pt_ARG_WINDOW_STATE = ( 18 * 1000 + 14 );
- public static final int Pt_ARG_WINDOW_TITLE = ( 18 * 1000 + 15 );
-//public static final int Pt_ARG_WINDOW_TITLE_COLOR = ( 18 * 1000 + 16 );
- public static final int Pt_AS_REQUIRED = 0x02;
- public static final int Pt_AUTO_EXTENT = 0x00000002;
- public static final int Pt_AUTOHIGHLIGHT = 0x00000004;
-//public static final int Pt_BACKFILL_TEXT = 0x10;
-//public static final int Pt_BALLOON_AS_REQUIRED = 0x08;
- public static final int Pt_BALLOON_BOTTOM = 3;
-//public static final int Pt_BALLOON_INPLACE = 4;
-//public static final int Pt_BALLOON_LEFT = 1;
-//public static final int Pt_BALLOON_PROPAGATE = 0x00000040;
-//public static final int Pt_BALLOON_REGISTERED = 0x80;
- public static final int Pt_BALLOON_RIGHT = 0;
-//public static final int Pt_BALLOON_TOP = 2;
-//public static final int Pt_BALLOONS_ACTIVE = 0x02000000;
-//public static final int Pt_BALLOONS_LOCKED = 0x80000000;
-//public static final int Pt_BALLOONS_ON = 0x00001000;
-//public static final int Pt_BASIC_RO_FLAGS = 0xffffffff;
-//public static final int Pt_BITMAP = 0x02;
-//public static final int Pt_BITMAP_BALLOON_BOTTOM = 3;
-//public static final int Pt_BITMAP_BALLOON_INPLACE = 4;
-//public static final int Pt_BITMAP_BALLOON_LEFT = 1;
-//public static final int Pt_BITMAP_BALLOON_RIGHT = 0;
-//public static final int Pt_BITMAP_BALLOON_TOP = 2;
-//public static final int Pt_BITMAP_SHOW_BALLOON = 0x04;
-//public static final int Pt_BKGD_ALT = 2;
-//public static final int Pt_BKGD_BRIGHTNESS = 3;
-//public static final int Pt_BKGD_CENTER = 3;
-//public static final int Pt_BKGD_CENTER_GRID = 4;
-//public static final int Pt_BKGD_GRID = 1;
-//public static final int Pt_BKGD_HORIZONTAL = 1;
-//public static final int Pt_BKGD_HUE = 1;
-//public static final int Pt_BKGD_IMAGE = 5;
-//public static final int Pt_BKGD_NONE = 0;
-//public static final int Pt_BKGD_PIXMAP = 4;
-//public static final int Pt_BKGD_SATURATION = 2;
-//public static final int Pt_BKGD_VERTICAL = 2;
-//public static final int Pt_BLIT = 0xFFFF;
-//public static final int Pt_BLIT_FORCE = 0xFFFE;
-//public static final int Pt_BLOCK_CUA_FOCUS = 0x00000001;
- public static final int Pt_BLOCKED = 0x00020000;
-//public static final int Pt_BOTTOM = 1;
- public static final int Pt_BOTTOM_ANCHORED_BOTTOM = 0x00000080;
- public static final int Pt_BOTTOM_ANCHORED_RELATIVE = 0x00000008;
- public static final int Pt_BOTTOM_ANCHORED_TOP = 0x00000800;
- public static final int Pt_BOTTOM_IS_ANCHORED = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_BOTTOM_ANCHORED_RELATIVE | Pt_BOTTOM_ANCHORED_TOP;
-//public static final int Pt_BROWSE_MODE = 3;
-//public static final int Pt_CALENDAR_DATE_SELECTED = 1;
-//public static final int Pt_CALENDAR_ID = 56;
-//public static final int Pt_CALENDAR_MONTH_BTNS = 2;
-//public static final int Pt_CALENDAR_MONTH_SELECTED = 3;
-//public static final int Pt_CALENDAR_SHOW_GRID = 16;
-//public static final int Pt_CALENDAR_SHOW_NEXT = 8;
-//public static final int Pt_CALENDAR_SHOW_PREV = 4;
-//public static final int Pt_CALENDAR_WDAY_SELECTED = 2;
-//public static final int Pt_CALENDAR_YEAR_BTNS = 1;
-//public static final int Pt_CALENDAR_YEAR_SELECTED = 4;
- public static final int Pt_CALLBACKS_ACTIVE = 0x04000000;
-//public static final int Pt_CANVAS_INVALID = 0x00004000;
- public static final int Pt_CB_ACTIVATE = ( 2 * 1000 + 9 );
- public static final int Pt_CB_ARM = ( 2 * 1000 + 7 );
-//public static final int Pt_CB_BALLOONS = ( 10 * 1000 + 4 );
-//public static final int Pt_CB_BLOCKED = ( 1 * 1000 + 16 );
-//public static final int Pt_CB_CALENDAR_SELECT = ( 56 * 1000 + 16 );
-//public static final int Pt_CB_CBOX_ACTIVATE = ( 31 * 1000 + 14 );
-//public static final int Pt_CB_CBOX_CLOSE = ( 31 * 1000 + 20 );
-//public static final int Pt_CB_CLIENT_CONNECTED = ( 99 * 1000 + 6 );
-//public static final int Pt_CB_CLIENT_EVENT = ( 99 * 1000 + 3 );
-//public static final int Pt_CB_CLIENT_NOT_FOUND = ( 99 * 1000 + 8 );
-//public static final int Pt_CB_CLOCK_TIME_CHANGED = (57 * 1000 +18);
-//public static final int Pt_CB_DESTROYED = ( 1 * 1000 + 9 );
-//public static final int Pt_CB_DISARM = ( 2 * 1000 + 8 );
-//public static final int Pt_CB_DIVIDER_DRAG = ( 44 * 1000 + 3 );
-//public static final int Pt_CB_DIVIDER_SETRESOURCES = 9;
-//public static final int Pt_CB_FONT_MODIFY = (38 * 1000 + 4);
-//public static final int Pt_CB_FS_BKGD_HANDLER = ( 47 * 1000 + 8 );
-//public static final int Pt_CB_FS_SELECTION = ( 47 * 1000 + 7 );
-//public static final int Pt_CB_FS_STATE = ( 47 * 1000 + 6 );
-//public static final int Pt_CB_GEN_TREE_INPUT = ( 23 * 1000 + 23 );
- public static final int Pt_CB_GOT_FOCUS = ( 2 * 1000 + 10 );
-//public static final int Pt_CB_HOTKEY = ( 1 * 1000 + 10);
-//public static final int Pt_CB_HTML_ERROR = ( 45 * 1000 + 30 );
-//public static final int Pt_CB_HTML_FILE_POST = ( 45 * 1000 + 16 );
-//public static final int Pt_CB_HTML_FILE_PRE = ( 45 * 1000 + 15 );
-//public static final int Pt_CB_HTML_IMAGE = ( 45 * 1000 + 17 );
-//public static final int Pt_CB_IMAGEAREA_DRAG = ( 103 * 1000 + 15 );
-//public static final int Pt_CB_IMAGEAREA_MOVEMENT = ( 103 * 1000 + 10 );
-//public static final int Pt_CB_IMAGEAREA_SCROLLED = ( 103 * 1000 + 9 );
-//public static final int Pt_CB_IMAGEAREA_SELECTION = ( 103 * 1000 + 11 );
-//public static final int Pt_CB_IMAGETREE_COLUMN_SEL = ( 49 * 1000 + 3 );
-//public static final int Pt_CB_IS_DESTROYED = ( 1 * 1000 + 19 );
-//public static final int Pt_CB_LIST_INPUT = ( 23 * 1000 + 24 );
- public static final int Pt_CB_LOST_FOCUS = ( 2 * 1000 + 11 );
- public static final int Pt_CB_MENU = ( 2 * 1000 + 16 );
-//public static final int Pt_CB_MODIFY_NOTIFY = ( 4 * 1000 + 10);
- public static final int Pt_CB_MODIFY_VERIFY = ( 4 * 1000 + 9 );
-//public static final int Pt_CB_MOTION_NOTIFY = ( 4 * 1000 + 14);
-//public static final int Pt_CB_MOTION_VERIFY = ( 4 * 1000 + 11);
-//public static final int Pt_CB_MSG_BUTTON1 = ( 32 * 1000 + 8 );
-//public static final int Pt_CB_MSG_BUTTON2 = ( 32 * 1000 + 9 );
-//public static final int Pt_CB_MSG_BUTTON3 = ( 32 * 1000 +10 );
-//public static final int Pt_CB_MULTITEXT_SCROLLUPDATE = ( 5 * 1000 + 14 );
-//public static final int Pt_CB_NUMERIC_CHANGED = ( 53 * 1000 + 15 );
-//public static final int Pt_CB_ONOFF_NEW_VALUE = ( 8 * 1000 + 1 );
-//public static final int Pt_CB_PRINT_PROPS = (46 * 1000 + 2);
-//public static final int Pt_CB_PRINT_TOFILE = (46 * 1000 + 3);
-//public static final int Pt_CB_RAW = ( 1 * 1000 + 11 );
-//public static final int Pt_CB_RAW_EVENT = ( 1 * 1000 + 11 );
- public static final int Pt_CB_REALIZED = ( 1 * 1000 + 12 );
-//public static final int Pt_CB_REPEAT = ( 2 * 1000 + 12 );
-//public static final int Pt_CB_RESCALE = ( 25 * 1000 + 7 );
- public static final int Pt_CB_RESIZE = ( 10 * 1000 + 3 );
- public static final int Pt_CB_SCROLL_MOVE = ( 29 * 1000 + 10 );
-//public static final int Pt_CB_SCROLLED_X = ( 13 * 1000 + 10 );
-//public static final int Pt_CB_SCROLLED_Y = ( 13 * 1000 + 11 );
- public static final int Pt_CB_SELECTION = ( 23 * 1000 + 10 );
-//public static final int Pt_CB_SERVER_CONNECTED = ( 98 * 1000 + 8 );
-//public static final int Pt_CB_SERVER_RECEIVE = ( 98 * 1000 + 3 );
-//public static final int Pt_CB_SERVER_TRANSPORT = ( 98 * 1000 + 4 );
- public static final int Pt_CB_SLIDER_MOVE = ( 22 * 1000 + 17 );
-//public static final int Pt_CB_STRING_CHANGED = ( 4 * 1000 + 10);
- public static final int Pt_CB_TEXT_CHANGED = ( 4 * 1000 + 10);
- public static final int Pt_CB_TIMER_ACTIVATE = ( 41 * 1000 + 2 );
-//public static final int Pt_CB_TREE_SELECTION = ( 23 * 1000 + 22 );
-//public static final int Pt_CB_TREE_STATE = ( 23 * 1000 + 21 );
- public static final int Pt_CB_UNREALIZED = ( 1 * 1000 + 13 );
- public static final int Pt_CB_WINDOW = ( 18 * 1000 + 17 );
-//public static final int Pt_CB_WINDOW_CLOSING = ( 18 * 1000 + 24 );
-//public static final int Pt_CB_WINDOW_OPENING = ( 18 * 1000 + 23 );
-//public static final int Pt_CB_WINDOW_TRANSPORT = ( 18 * 1000 + 21 );
- public static final int Pt_CENTER = 2;
-//public static final int Pt_CHANGE_ACTIVATE = 0x00000020;
-//public static final int Pt_CHANGE_INVISIBLE = 0;
-//public static final int Pt_CHECK = 5;
-//public static final int Pt_CHILD_CREATED = 0x01000000;
-//public static final int Pt_CHILD_DESTROYED = 0x00800000;
-//public static final int Pt_CHILD_GETTING_FOCUS = 0x10000000;
-//public static final int Pt_CHILD_GETTING_RESOURCE = 0x80000000;
-//public static final int Pt_CHILD_LOSING_FOCUS = 0x20000000;
-//public static final int Pt_CHILD_LOST_FOCUS = 0x20000000;
-//public static final int Pt_CHILD_MOVED_RESIZED = 0x08000000;
-//public static final int Pt_CHILD_REALIZED = 0x02000000;
-//public static final int Pt_CHILD_REDIRECTOR = 0x00400000;
-//public static final int Pt_CHILD_SETTING_RESOURCE = 0x40000000;
-//public static final int Pt_CHILD_UNREALIZED = 0x04000000;
-//public static final int Pt_CLEAN_RESOURCES = 0x00000010;
-//public static final int Pt_CLEAR = 0x00010000;
-//public static final int Pt_CLIENT_GETEVENTS = 0x0001;
-//public static final int Pt_CLIENT_NEEDEVENTS = 0x0002;
-//public static final int Pt_CLIENT_NOEVENTS = 0x0002;
-//public static final int Pt_CLIENT_NONBLOCK = 0x0001;
-//public static final int Pt_CLIP_HIGHLIGHT = 0x00000010;
-//public static final int Pt_CLOCK_24_HOUR = 4;
-//public static final int Pt_CLOCK_ANALOG = 1;
-//public static final int Pt_CLOCK_CURRENT = -1;
-//public static final int Pt_CLOCK_DIGITAL = 0;
-//public static final int Pt_CLOCK_HOUR_CHANGED = 1;
-//public static final int Pt_CLOCK_LED = 2;
-//public static final int Pt_CLOCK_MINUTE_CHANGED = 2;
-//public static final int Pt_CLOCK_PAD_HOURS = 32;
-//public static final int Pt_CLOCK_SECOND_CHANGED = 4;
-//public static final int Pt_CLOCK_SHOW_AMPM = 16;
-//public static final int Pt_CLOCK_SHOW_NUMBERS = 8;
-//public static final int Pt_CLOCK_SHOW_SECONDS = 2;
-//public static final int Pt_CLOCK_TRACK_TIME = 1;
-//public static final int Pt_CMT_IN_UPDATE = 0x80000000;
-//public static final int Pt_CMT_SCROLL_CB_ACTIVE = 0x40000000;
-//public static final int Pt_COMBOBOX_ALT_DOWN = 0x00000100;
-//public static final int Pt_COMBOBOX_EXTENTING = 0x20000000;
-//public static final int Pt_COMBOBOX_MAX_WIDTH = 0x00000080;
-//public static final int Pt_COMBOBOX_ON_BOTTOM = 0x40000000;
-//public static final int Pt_COMBOBOX_OPEN = 0x80000000;
- public static final int Pt_COMBOBOX_STATIC = 0x00000020;
-//public static final int Pt_COMBOBOX_TOP = 0x00000040;
-//public static final int Pt_COMPOUND = 0x00000100;
-//public static final int Pt_CONNECTION_NOTIFY_FLUSH = 4;
-//public static final int Pt_CONNECTION_NOTIFY_NOFLUSH = 2;
-//public static final int Pt_CONNECTION_NOTIFY_RESIZE = 1;
-//public static final int Pt_CONSUME_EVENTS = 0x0001;
-//public static final int Pt_CONTAINER = 0x00000001;
-//public static final int Pt_CONTAINER_ANCHORING = 0x20000000;
-//public static final int Pt_CONTAINER_CONSTRAINT_BITS = 0xFFFF0000;
-//public static final int Pt_CONTAINER_FLAGS_MASK = 0x00001fff;
-//public static final int Pt_CONTAINER_RESIZING = 0x01000000;
- public static final int Pt_CONTINUE = 0;
-//public static final int Pt_CURSOR_IN_CONTAINER = 0x00001000;
-//public static final int Pt_CURSOR_VISIBLE = 0x00000001;
-//public static final int Pt_DAMAGE_FAMILY = 0x00040000;
-//public static final int Pt_DAMAGE_ON_FOCUS = 0x8000;
-//public static final int Pt_DAMAGE_PARENT = 0x4000;
-//public static final int Pt_DAMAGED = 0x00002000;
-//public static final int Pt_DB_INLINE_IMAGE = 0x00000001;
- public static final int Pt_DEFAULT_COLOR = (-3);
-//public static final int Pt_DEFAULT_FONT = (0);
- public static final int Pt_DELAY_ACTIVATION = 0x00000040;
- public static final int Pt_DELAY_REALIZE = Pt_DELAY_ACTIVATION;
-//public static final int Pt_DESTROYED = 0x00001000;
-//public static final int Pt_DISABLE_BALLOONS = 0x00000008;
-//public static final int Pt_DISCONTINUOUS = 0x00000004;
-//public static final int Pt_DISJOINT = 0x00000080;
-//public static final int Pt_DIVIDER_CASCADE = 0x0008;
-//public static final int Pt_DIVIDER_INVISIBLE = 0x0004;
-//public static final int Pt_DIVIDER_NORESIZE = 0x0001;
-//public static final int Pt_DIVIDER_RESIZE_BOTH = 0x0002;
-//public static final int Pt_DOOMED = 0x0800;
-//public static final int Pt_DOUBLE_DASH_LINE = 3;
-//public static final int Pt_DOUBLE_LINE = 1;
-//public static final int Pt_DOUBLE_ULINE = 2;
-//public static final int Pt_DRAW_COPY_RECTS = 0x0010;
-//public static final int Pt_DRAW_DEFAULT = 0x0000;
-//public static final int Pt_DRAW_MODE_MASK = 0x000F;
-//public static final int Pt_DRAW_OVERWRITE = 0x0001;
-//public static final int Pt_DRAW_RAW = 0x0002;
-//public static final int Pt_DRAW_START = 0x0003;
-//public static final int Pt_DYNAMIC = 0;
-//public static final int Pt_EDIT_ACTIVATE = 1;
- public static final int Pt_EDITABLE = 0x00000002;
-//public static final int Pt_EMT_AUTOINDENT = 0x00000010;
- public static final int Pt_EMT_CHAR = 0x02;
-//public static final int Pt_EMT_DISABLE_PURGE = 0x40000000;
-//public static final int Pt_EMT_FOCUSED = 0x20000000;
-//public static final int Pt_EMT_FORCED_SCROLL = 0x00000040;
-//public static final int Pt_EMT_FULL_LINES = 0x00000020;
- public static final int Pt_EMT_NEWLINE = 0x04;
-//public static final int Pt_EMT_NO_TABS = 0x00000080;
-//public static final int Pt_EMT_READ_ONLY_FLAGS = Pt_EMT_DISABLE_PURGE | Pt_EMT_FOCUSED;
-//public static final int Pt_EMT_SCROLL_TO_CURSOR = 0x80000000;
- public static final int Pt_EMT_WORD = 0x01;
- public static final int Pt_ENABLE_CUA = 0x00000010;
- public static final int Pt_ENABLE_CUA_ARROWS = 0x00000020;
- public static final int Pt_END = 2;
-//public static final int Pt_ESC_DISABLE = 0x8;
-//public static final int Pt_ETCH_HIGHLIGHT = 0x00000200;
- public static final int Pt_ETCHED_IN = 4;
- public static final int Pt_ETCHED_OUT = 5;
-//public static final int Pt_EV_REDIRECTED = (Ph_EV_BUT_PRESS|Ph_EV_BUT_RELEASE|Ph_EV_KEY|Ph_EV_BUT_REPEAT);
- public static final int Pt_EXTENDED_MODE = 4;
-//public static final int Pt_FALSE = 0;
-//public static final int Pt_FD_DRAIN = 0x00000001;
-//public static final int Pt_FD_NOPOLL = 0x8;
-//public static final int Pt_FD_OBAND = 0x40000000;
-//public static final int Pt_FD_READ = 0x10000000;
-//public static final int Pt_FD_WRITE = 0x20000000;
-//public static final int Pt_FEP_PRESENT = 0x00000002;
-//public static final int Pt_FEP_QUERIED = 0x00000004;
-//public static final int Pt_FLOAT_ORIGIN = 0x02;
-//public static final int Pt_FLOAT_POS = 0x01;
-//public static final int Pt_FOCUS_RENDER = 0x02000000;
-//public static final int Pt_FONTSEL_AA_CHECK = 0x01;
-//public static final int Pt_FONTSEL_ALL_FONTS = PHFONT_ALL_FONTS;
-//public static final int Pt_FONTSEL_ALL_SYMBOLS = PHFONT_ALL_SYMBOLS;
-//public static final int Pt_FONTSEL_BITMAP = PHFONT_BITMAP;
-//public static final int Pt_FONTSEL_FIXED = PHFONT_FIXED;
-//public static final int Pt_FONTSEL_PROP = PHFONT_PROP;
-//public static final int Pt_FONTSEL_SAMPLE = 0x02;
-//public static final int Pt_FONTSEL_SCALABLE = PHFONT_SCALABLE;
-//public static final int Pt_FORCE_UNREALIZE = 0x00000040;
-//public static final int Pt_FREE_MEMORY = 0x20000000;
-//public static final int Pt_FS_DIR_CL = 1;
-//public static final int Pt_FS_DIR_OP = 0;
-//public static final int Pt_FS_DLINK_CL = 3;
-//public static final int Pt_FS_DLINK_OP = 2;
-//public static final int Pt_FS_ERROR = 6;
-//public static final int Pt_FS_FILE = 4;
-//public static final int Pt_FS_FLINK = 5;
-//public static final int Pt_FS_FREE_ON_COLLAPSE = 0x10;
-//public static final int Pt_FS_NEW_DIR = 0;
-//public static final int Pt_FS_NEW_ITEM = 1;
-//public static final int Pt_FS_NO_ROOT_DISPLAY = 0x80;
-//public static final int Pt_FS_OLD_DIR = 1;
-//public static final int Pt_FS_OLD_ITEM = -1;
-//public static final int Pt_FS_SEEK_KEY = 0x30;
-//public static final int Pt_FS_SHOW_DIRS = 0x1;
-//public static final int Pt_FS_SHOW_ERRORS = 0x8;
-//public static final int Pt_FS_SHOW_FILES = 0x2;
-//public static final int Pt_FS_SHOW_HIDDEN = 0x4;
-//public static final int Pt_FS_SINGLE_LEVEL = 0x20;
-//public static final int Pt_FS_ALL_FLAGS = Pt_FS_SHOW_DIRS|Pt_FS_SHOW_FILES|Pt_FS_SHOW_HIDDEN|Pt_FS_SHOW_ERRORS|Pt_FS_FREE_ON_COLLAPSE|Pt_FS_SINGLE_LEVEL|Pt_FS_SEEK_KEY;
-//public static final int Pt_FS_STATE_END = 2;
-//public static final int Pt_FS_STATE_START = 1;
-//public static final int Pt_FSDIALOG_BTN1 = 1;
- public static final int Pt_FSDIALOG_BTN2 = 2;
-//public static final int Pt_FSDIALOG_CANCEL = 1;
-//public static final int Pt_FSDIALOG_NO_DIRS = 0x10;
-//public static final int Pt_FSDIALOG_NO_FCHECK = 0x1;
-//public static final int Pt_FSDIALOG_NO_FILES = 0x20;
-//public static final int Pt_FSDIALOG_NO_FSPEC = 0x4;
-//public static final int Pt_FSDIALOG_NO_UP_BUTTON = 0x4;
-//public static final int Pt_FSDIALOG_OPEN = 2;
-//public static final int Pt_FSDIALOG_SHOW_HIDDEN = 0x8;
-//public static final int Pt_GAUGE_MAX_ON_BOTTOM = 1;
-//public static final int Pt_GAUGE_MAX_ON_LEFT = 1;
-//public static final int Pt_GAUGE_MAX_ON_RIGHT = 0;
-//public static final int Pt_GAUGE_MAX_ON_TOP = 0;
-//public static final int Pt_GAUGE_LIVE = 0x40;
-//public static final int Pt_GEN_LIST_FULL_WIDTH = 0x08;
-//public static final int Pt_GEN_LIST_ITEM_BACKGROUND = 0x20;
-//public static final int Pt_GEN_LIST_NO_AUTOFOCUS = 0x10;
-//public static final int Pt_GEN_LIST_NO_BACKGROUND = 0x01;
-//public static final int Pt_GEN_LIST_NO_CLIPPING = 0x02;
-//public static final int Pt_GEN_LIST_SHOW_DAMAGED = 0x04;
- public static final int Pt_GETS_FOCUS = 0x00000400;
- public static final int Pt_GHOST = 0x01000000;
-//public static final int Pt_GROUP_ASIS = 2;
- public static final int Pt_GROUP_EQUAL_SIZE = 0x00000002;
-//public static final int Pt_GROUP_EQUAL_SIZE_HORIZONTAL = 0x00000100;
- public static final int Pt_GROUP_EQUAL_SIZE_VERTICAL = 0x00000200;
-//public static final int Pt_GROUP_EXCLUSIVE = 0x00000001;
- public static final int Pt_GROUP_HORIZONTAL = 0;
-//public static final int Pt_GROUP_HORZ_CENTER = 0;
-//public static final int Pt_GROUP_HORZ_LEFT = 1;
-//public static final int Pt_GROUP_HORZ_NONE = -1;
- public static final int Pt_GROUP_HORZ_RIGHT = 2;
-//public static final int Pt_GROUP_NO_KEY_WRAP_HORIZONTAL = 0x00000010;
-//public static final int Pt_GROUP_NO_KEY_WRAP_VERTICAL = 0x00000020;
-//public static final int Pt_GROUP_NO_KEY_WRAP = (Pt_GROUP_NO_KEY_WRAP_HORIZONTAL | Pt_GROUP_NO_KEY_WRAP_VERTICAL );
-//public static final int Pt_GROUP_NO_KEYS = 0x00000008;
-//public static final int Pt_GROUP_NO_SELECT_ALLOWED = 0x00000004;
-//public static final int Pt_GROUP_STRETCH_FILL = 0x00001000;
-//public static final int Pt_GROUP_STRETCH_HORIZONTAL = 0x00000400;
-//public static final int Pt_GROUP_STRETCH_VERTICAL = 0x00000800;
-//public static final int Pt_GROUP_STRETCH = (Pt_GROUP_STRETCH_VERTICAL|Pt_GROUP_STRETCH_HORIZONTAL);
-//public static final int Pt_GROUP_VERT_BOTTOM = 2;
- public static final int Pt_GROUP_VERT_CENTER = 0;
-//public static final int Pt_GROUP_VERT_NONE = -1;
-//public static final int Pt_GROUP_VERT_TOP = 1;
-//public static final int Pt_GROUP_VERTICAL = 1;
-//public static final int Pt_HALT = 1;
- public static final int Pt_HIGHLIGHTED = 0x00000100;
- public static final int Pt_HORIZONTAL = 1;
-//public static final int Pt_HOTKEY_IGNORE_MODS = 0x0002;
-//public static final int Pt_HOTKEY_SYM = 0x0001;
-//public static final int Pt_HOTKEY_TERMINATOR = 0x00000004;
-//public static final int Pt_HOTKEYS_FIRST = 0x00000080;
-//public static final int Pt_HTML_DISPLAY = 0x01;
-//public static final int Pt_HTML_LOAD = 0x08;
-//public static final int Pt_HTML_PAGE = 0x10;
-//public static final int Pt_HTML_PAGE_MODE = 0x2;
-//public static final int Pt_HTML_REDIRECT = 0x04;
-//public static final int Pt_HTML_RELOAD = 0x1;
-//public static final int Pt_HTML_RESIZE = 0x02;
-//public static final int Pt_IGNORE_CONSTRAINTS = 0x00008000;
- public static final int Pt_IMAGE = 0x04;
-//public static final int Pt_IMAGEAREA_AUTOSCALE = 0x2;
-//public static final int Pt_IMAGEAREA_COMPLETE = 3;
-//public static final int Pt_IMAGEAREA_DRAG = 2;
-//public static final int Pt_IMAGEAREA_EDITABLE_SELECTION = 0x8;
-//public static final int Pt_IMAGEAREA_ENABLE_SELECTION = 0x4;
-//public static final int Pt_IMAGEAREA_IMGCRC_VALID = 0x1;
-//public static final int Pt_IMAGEAREA_INIT = 1;
-//public static final int Pt_IMAGEAREA_NO_MEMORY = 0x10;
-//public static final int Pt_IMAGEAREA_PALCRC_VALID = 0x2;
-//public static final int Pt_IMAGEAREA_RENDERED = 0x1;
-//public static final int Pt_IMAGEAREA_SCROLLED_X = 1;
-//public static final int Pt_IMAGEAREA_SCROLLED_Y = 2;
-//public static final int Pt_IMMEDIATE_CHILD = 1;
-//public static final int Pt_IN_EXPOSE = 0x00000008;
-//public static final int Pt_IN_FLUX = 0x00008000;
-//public static final int Pt_INDEX_RESOURCES = 0x00000020;
-//public static final int Pt_INFLATE_BALLOON = 0;
-//public static final int Pt_INHERIT_COLOR = (-4);
-//public static final int Pt_INHERIT_FONT = (-1);
- public static final int Pt_INITIAL = 0x04;
-//public static final int Pt_INITIALIZED = 0x04000000;
-//public static final int PT_INPUT_ID = 1;
-//public static final int Pt_INSERT_MODE = 0x00000008;
-//public static final int Pt_INTERNAL_HELP = 0x0002;
-//public static final int Pt_LABEL_SELECT_SHIFT = 0x01;
- public static final int Pt_LEFT = 0;
- public static final int Pt_LEFT_ANCHORED_LEFT = 0x00000100;
- public static final int Pt_LEFT_ANCHORED_RELATIVE = 0x00000001;
- public static final int Pt_LEFT_ANCHORED_RIGHT = 0x00000010;
- public static final int Pt_LEFT_IS_ANCHORED = Pt_LEFT_ANCHORED_LEFT | Pt_LEFT_ANCHORED_RELATIVE | Pt_LEFT_ANCHORED_RIGHT;
-//public static final int Pt_LINK_DELETE = -2;
-//public static final int Pt_LINK_INSERT = -1;
-//public static final int Pt_LIST_BALLOON_AS_REQUIRED = 0x0040;
-//public static final int Pt_LIST_BALLOON_CENTER = (-3);
-//public static final int Pt_LIST_BALLOON_LEFT = (-1);
-//public static final int Pt_LIST_BALLOON_MASK = 0x0060;
-//public static final int Pt_LIST_BALLOON_NEVER = 0x0000;
-//public static final int Pt_LIST_BALLOON_REGISTERED = 0x0080;
-//public static final int Pt_LIST_BALLOON_RIGHT = (-2);
-//public static final int Pt_LIST_BALLOONS_IN_COLUMNS = 0x1000;
-//public static final int Pt_LIST_BOUNDARY_KEY_EVENTS = 0x2000;
-//public static final int Pt_LIST_COLUMN_ALIGNMENT = ( Pg_TEXT_LEFT | Pg_TEXT_RIGHT | Pg_TEXT_CENTER );
-//public static final int Pt_LIST_COLUMN_CENTER = Pg_TEXT_CENTER;
-//public static final int Pt_LIST_COLUMN_DAMAGE_ALWAYS = 0x0001;
-//public static final int Pt_LIST_COLUMN_LEFT = Pg_TEXT_LEFT;
-//public static final int Pt_LIST_COLUMN_RIGHT = Pg_TEXT_RIGHT;
-//public static final int Pt_LIST_FIND_STRING = 6;
-//public static final int Pt_LIST_GOTO_POS = 10;
-//public static final int Pt_LIST_HEADER_AUTORESIZE = 0x0400;
-//public static final int Pt_LIST_INACTIVE = 0x0004;
-//public static final int Pt_LIST_INSERT_ITEMS = 1;
-//public static final int Pt_LIST_ITEM_ABOVE = 0x010;
-//public static final int Pt_LIST_ITEM_BELOW = 0x020;
-//public static final int Pt_LIST_ITEM_CURRENT = 0x002;
-//public static final int Pt_LIST_ITEM_DAMAGED = 0x008;
-//public static final int Pt_LIST_ITEM_DISABLED = 0x004;
-//public static final int Pt_LIST_ITEM_NOCOLUMNS = 0x200;
-//public static final int Pt_LIST_ITEM_SAVED = 0x100;
-//public static final int Pt_LIST_ITEM_SELECTED = 0x001;
-//public static final int Pt_LIST_ITEM_USED_FLAGS = 0x33F;
-//public static final int Pt_LIST_MOD_LONG_POSITIONS = 5;
-//public static final int Pt_LIST_MOD_RANGE = 3;
-//public static final int Pt_LIST_MOD_SHORT_POSITIONS = 4;
-//public static final int Pt_LIST_MOD_STRINGS = 2;
-//public static final int Pt_LIST_NOBLIT = 0x0200;
-//public static final int Pt_LIST_NON_SELECT = 0x0008;
-//public static final int Pt_LIST_REMOVE_ALL_ITEMS = 0;
-//public static final int Pt_LIST_SCROLL_LIST = 0x00;
-//public static final int Pt_LIST_SCROLL_SCROLLBAR = 0x01;
-//public static final int Pt_LIST_SCROLLBAR_ALWAYS = 0x0001;
-//public static final int Pt_LIST_SCROLLBAR_AS_REQUIRED = 0x0002;
-//public static final int Pt_LIST_SCROLLBAR_AUTORESIZE = 0x0800;
-//public static final int Pt_LIST_SCROLLBAR_GETS_FOCUS = 0x0100;
-//public static final int Pt_LIST_SCROLLBAR_MASK = 0x0003;
-//public static final int Pt_LIST_SCROLLBAR_NEVER = 0x0000;
-//public static final int Pt_LIST_SELECT_POS = 7;
-//public static final int Pt_LIST_SELECTION_BROWSE = 0x01;
-//public static final int Pt_LIST_SELECTION_CANCEL = 0x02;
- public static final int Pt_LIST_SELECTION_FINAL = 0x00;
-//public static final int Pt_LIST_SHOW_BALLOON = 0x0020;
-//public static final int Pt_LIST_SHOW_POS = 9;
-//public static final int Pt_LIST_SNAP = 0x0010;
-//public static final int Pt_LIST_UNSELECT_POS = 8;
-//public static final int Pt_MAX_ON_BOTTOM = 1;
-//public static final int Pt_MAX_ON_LEFT = 0;
-//public static final int Pt_MAX_ON_RIGHT = 1;
-//public static final int Pt_MAX_ON_TOP = 0;
- public static final int Pt_MENU_AUTO = 0x00000001;
-//public static final int Pt_MENU_BAR = 1;
- public static final int Pt_MENU_BUTTON = 0x00000800;
- public static final int Pt_MENU_CHILD = 0x00000008;
- public static final int Pt_MENU_DOWN = 3;
-//public static final int Pt_MENU_END_RELEASE = 0x40000000;
-//public static final int Pt_MENU_FOCUS = 0x20000000;
-//public static final int Pt_MENU_GOT_FOCUS = 0x10000000;
-//public static final int Pt_MENU_NAVIGATE = 1;
-//public static final int Pt_MENU_ON_LEFT = 0x08000000;
-//public static final int Pt_MENU_ON_TOP = 0x04000000;
-//public static final int Pt_MENU_PDR_ON = 0x80000000;
- public static final int Pt_MENU_RIGHT = 2;
-//public static final int Pt_MENU_TEAR_OFF = 0x00000004;
- public static final int Pt_MENU_TEXT = 0;
-//public static final int Pt_MENU_TRANSIENT = 0x00000002;
-//public static final int Pt_MENU_UP = 4;
-//public static final int Pt_MENUABLE = 0x08000000;
-//public static final int Pt_MENUBAR_LAST_R_ALIGNED = 0x0001;
-//public static final int Pt_MENUBAR_MENU_OPEN = 0x8000;
-//public static final int Pt_MERGE_NEXT = 0x80000000;
-//public static final int Pt_MERGE_PREV = 0x40000000;
- public static final int Pt_MODAL = 0x4;
-//public static final int Pt_MSG_CENTER_ON_PARENT = 0x1;
-//public static final int Pt_MSG_FONT_ON_BUTTONS = 0x2;
-//public static final int Pt_MT_ALIGN_BITS = 0x00000007;
-//public static final int Pt_MT_BACKGROUND = 0x0004;
-//public static final int Pt_MT_BACKGROUND_COLOR = 0x0004;
-//public static final int Pt_MT_CENTER = 0x00000002;
-//public static final int Pt_MT_FLAGS = 0x0010;
-//public static final int Pt_MT_FONT = 0x0001;
-//public static final int Pt_MT_FOREGROUND = 0x0002;
-//public static final int Pt_MT_LEFT = 0x00000004;
-//public static final int Pt_MT_QUERY_CHAR = 0;
-//public static final int Pt_MT_QUERY_LINE = 1;
-//public static final int Pt_MT_RIGHT = 0x00000001;
-//public static final int Pt_MT_TAG = 0x0008;
-//public static final int Pt_MT_TEXT_COLOR = 0x0002;
-//public static final int Pt_MT_UPDATE_POS_ONLY = 4;
-//public static final int Pt_MT_UPDATE_X_SCROLLBAR = 2;
-//public static final int Pt_MT_UPDATE_Y_SCROLLBAR = 1;
- public static final int Pt_MULTIPLE_MODE = 2;
-//public static final int Pt_MULTITEXT = 0x20;
- public static final int Pt_N_OF_MANY = 0;
- public static final int Pt_NEVER = 0x00;
-//public static final int Pt_NO_INHERITED_RESOURCES = 0x00000400;
-//public static final int Pt_NO_RANGE_SELECTION = 0x00000040;
-//public static final int Pt_NO_ULINE = 0;
- public static final int Pt_NOLINE = 6;
-//public static final int Pt_NOREDRAW_SET = 0x10000000;
-//public static final int Pt_NUMERIC_ACTIVATE = 0x2;
-//public static final int Pt_NUMERIC_AUTO_HIGHLIGHT = 0x08;
-//public static final int Pt_NUMERIC_CHANGED = 0x1;
-//public static final int Pt_NUMERIC_ENABLE_UPDOWN = 0x01;
-//public static final int Pt_NUMERIC_HEXADECIMAL = 0x10;
-//public static final int Pt_NUMERIC_UPDOWN_ACTIVATE = 0x8;
-//public static final int Pt_NUMERIC_UPDOWN_REPEAT = 0x4;
-//public static final int Pt_NUMERIC_USE_SEPARATORS = 0x02;
-//public static final int Pt_NUMERIC_VALUE_CHANGED = 0x80000000;
-//public static final int Pt_NUMERIC_WRAP = 0x04;
-//public static final int Pt_OBSCURED = 0x00004000;
-//public static final int Pt_OCCLUSIVE = 0x00000800;
- public static final int Pt_ONE_OF_MANY = 1;
-//public static final int Pt_OPAQUE = 0x00000020;
-//public static final int Pt_PANE_XLR_ANCHOR_RIGHT = 0x0020;
-//public static final int Pt_PANE_XLR_REL = 0x0002;
-//public static final int Pt_PANE_XUL_ANCHOR_RIGHT = 0x0010;
-//public static final int Pt_PANE_XUL_REL = 0x0001;
-//public static final int Pt_PANE_YLR_ANCHOR_BOTTOM = 0x0080;
-//public static final int Pt_PANE_YLR_REL = 0x0008;
-//public static final int Pt_PANE_YUL_ANCHOR_BOTTOM = 0x0040;
-//public static final int Pt_PANE_YUL_REL = 0x0004;
-//public static final int Pt_PASS_END = 3;
-//public static final int Pt_PEN_PRESENT = 0x00000001;
-//public static final int Pt_POP_BALLOON = 1;
-//public static final int Pt_POSITIONING = 1;
-//public static final int Pt_PP_NO_RESIZE = 2;
-//public static final int Pt_PP_RESIZE_PC = 1;
-//public static final int Pt_PP_RESIZE_WIDGET = 0;
-//public static final int Pt_PROCREATED = 0x00400000;
- public static final int Pt_RADIO = 2;
- public static final int Pt_RANGE_MODE = 5;
-//public static final int Pt_REALIZED = 0x00000001;
-//public static final int Pt_REALIZING = 0x80000000;
-//public static final int Pt_RECTANGULAR = 0x00000002;
-//public static final int Pt_REGION = 0x40000000;
-//public static final int Pt_RELATIVE = 0x10;
- public static final int Pt_RESIZE_BITS = 0x07;
-//public static final int Pt_RESIZE_WIDTH = 0x00000004;
- public static final int Pt_RESIZE_Y_SHIFT = 20;
- public static final int Pt_RESIZE_X_SHIFT = 23;
- public static final int Pt_RESIZE_X_ALWAYS = (Pt_ALWAYS << Pt_RESIZE_X_SHIFT);
- public static final int Pt_RESIZE_X_AS_REQUIRED = (Pt_AS_REQUIRED << Pt_RESIZE_X_SHIFT);
- public static final int Pt_RESIZE_X_BITS = (Pt_RESIZE_BITS << Pt_RESIZE_X_SHIFT);
- public static final int Pt_RESIZE_X_INITIAL = (Pt_INITIAL << Pt_RESIZE_X_SHIFT);
- public static final int Pt_RESIZE_Y_ALWAYS = (Pt_ALWAYS << Pt_RESIZE_Y_SHIFT);
- public static final int Pt_RESIZE_Y_AS_REQUIRED = (Pt_AS_REQUIRED << Pt_RESIZE_Y_SHIFT);
- public static final int Pt_RESIZE_Y_BITS = (Pt_RESIZE_BITS << Pt_RESIZE_Y_SHIFT);
- public static final int Pt_RESIZE_Y_INITIAL = (Pt_INITIAL << Pt_RESIZE_Y_SHIFT);
-//public static final int Pt_RESIZE_XY_ALWAYS = (Pt_RESIZE_X_ALWAYS |Pt_RESIZE_Y_ALWAYS);
- public static final int Pt_RESIZE_XY_AS_REQUIRED = (Pt_RESIZE_X_AS_REQUIRED|Pt_RESIZE_Y_AS_REQUIRED);
- public static final int Pt_RESIZE_XY_BITS = (Pt_RESIZE_X_BITS |Pt_RESIZE_Y_BITS);
-//public static final int Pt_RESIZE_XY_INITIAL = (Pt_RESIZE_X_INITIAL |Pt_RESIZE_Y_INITIAL);
- public static final int Pt_RIGHT = 1;
- public static final int Pt_RIGHT_ANCHORED_LEFT = 0x00000200;
- public static final int Pt_RIGHT_ANCHORED_RELATIVE = 0x00000002;
- public static final int Pt_RIGHT_ANCHORED_RIGHT = 0x00000020;
- public static final int Pt_RIGHT_IS_ANCHORED = Pt_RIGHT_ANCHORED_LEFT | Pt_RIGHT_ANCHORED_RELATIVE | Pt_RIGHT_ANCHORED_RIGHT;
-//public static final int Pt_ROUND = 3;
-//public static final int Pt_SCROLL_AREA_IGNORE_KEYS = 0x0001;
-//public static final int Pt_SCROLL_AREA_RO_FLAGS = 0x0000;
-//public static final int Pt_SCROLL_AREA_TRACK_FOCUS = 0x0002;
- public static final int Pt_SCROLL_DECREMENT = 1;
-//public static final int Pt_SCROLL_DECREMENT_PRESSED = 0x2000;
- public static final int Pt_SCROLL_DRAGGED = 7;
-//public static final int Pt_SCROLL_HORIZONTAL = 0;
- public static final int Pt_SCROLL_INCREMENT = 2;
-//public static final int Pt_SCROLL_INCREMENT_PRESSED = 0x4000;
-//public static final int Pt_SCROLL_INVERTED = 2;
- public static final int Pt_SCROLL_PAGE_DECREMENT = 4;
- public static final int Pt_SCROLL_PAGE_INCREMENT = 3;
-//public static final int Pt_SCROLL_PRESSED_MASK = 0xe000;
-//public static final int Pt_SCROLL_RELEASED = 8;
-//public static final int Pt_SCROLL_RESTART_DRAG = 0x1000;
-//public static final int Pt_SCROLL_SET = 9;
-//public static final int Pt_SCROLL_SHOW_ARROWS = 1;
-//public static final int Pt_SCROLL_SLIDER_PRESSED = 0x8000;
- public static final int Pt_SCROLL_TO_MAX = 5;
- public static final int Pt_SCROLL_TO_MIN = 6;
-//public static final int Pt_SCROLLAREA_EXTENTING = 0x8000;
-//public static final int Pt_SCROLLBAR_FOCUSED = 0x0080;
-//public static final int Pt_SCROLLBAR_HORIZONTAL = 0x0001;
-//public static final int Pt_SCROLLBAR_INVERTED = 0x0004;
-//public static final int Pt_SCROLLBAR_NOTIFY_ONLY = 0x0008;
-//public static final int Pt_SCROLLBAR_SHOW_ARROWS = 0x0002;
- public static final int Pt_SELECT_NOREDRAW = 0x00080000;
- public static final int Pt_SELECTABLE = 0x00000080;
- public static final int Pt_SELECTION_MODE_AUTO = 0x8200;
-//public static final int Pt_SELECTION_MODE_COMPOSE_FLAG = 0x8000;
-//public static final int Pt_SELECTION_MODE_COMPOSE_MASK = 0x9FF0;
- public static final int Pt_SELECTION_MODE_MULTIPLE = 0x8000;
- public static final int Pt_SELECTION_MODE_NOCLEAR = 0x8400;
- public static final int Pt_SELECTION_MODE_NOFOCUS = 0x9000;
- public static final int Pt_SELECTION_MODE_NOMOVE = 0x8080;
-//public static final int Pt_SELECTION_MODE_NONE = 0x8030;
-//public static final int Pt_SELECTION_MODE_NOREST = 0x8100;
- public static final int Pt_SELECTION_MODE_NOSCROLL = 0x8040;
- public static final int Pt_SELECTION_MODE_RANGE = 0x8010;
- public static final int Pt_SELECTION_MODE_SINGLE = 0x8020;
- public static final int Pt_SELECTION_MODE_TOGGLE = 0x8800;
- public static final int Pt_SEP_HORIZONTAL = 1;
-//public static final int Pt_SEP_HORIZONTAL_F = 1;
-//public static final int Pt_SEP_ORIENTATION = 0x01;
- public static final int Pt_SEP_VERTICAL = 0;
- public static final int Pt_SET = 0x00000002;
-//public static final int Pt_SHOW_BALLOON = 0x04;
-//public static final int Pt_SHOW_VALUE = 0x10;
-//public static final int Pt_SHOW_VALUE_BOTTOM = 0x20;
-//public static final int Pt_SHOW_VALUE_CENTER = 0xc0;
-//public static final int Pt_SHOW_VALUE_LEFT = 0x40;
-//public static final int Pt_SHOW_VALUE_MASK = 0xf0;
-//public static final int Pt_SHOW_VALUE_RIGHT = 0x80;
-//public static final int Pt_SHOW_VALUE_TOP = 0x10;
-//public static final int Pt_SINGLE_DASH_LINE = 2;
-//public static final int Pt_SINGLE_LINE = 0;
-//public static final int Pt_SINGLE_MODE = 1;
-//public static final int Pt_SINGLE_ULINE = 1;
-//public static final int Pt_SKIP_CHILDREN = 0x2000;
-//public static final int Pt_SLIDER_IMAGE = 0x80;
-//public static final int Pt_SLIDER_MASK = 0x70;
-//public static final int Pt_SLIDER_MIN_ON_BOTTOM = 1;
-//public static final int Pt_SLIDER_MIN_ON_LEFT = 0;
-//public static final int Pt_SLIDER_MIN_ON_RIGHT = 1;
-//public static final int Pt_SLIDER_MIN_ON_TOP = 0;
-//public static final int Pt_SLIDER_POINT_DOWN = 0x40;
-//public static final int Pt_SLIDER_POINT_LEFT = 0x20;
-//public static final int Pt_SLIDER_POINT_RIGHT = 0x40;
-//public static final int Pt_SLIDER_POINT_UP = 0x20;
-//public static final int Pt_SLIDER_X1_RESOURCES = 1;
-//public static final int Pt_SUBORDINATES_CHILD = 2;
-//public static final int Pt_SUPER_CONSTRAINTS = 0x00000800;
-//public static final int Pt_SYSINFO_VALID = 0x00002000;
-//public static final int Pt_TAB_UPSIDE_DOWN = 0x1;
-//public static final int Pt_TEXT_AUTO_HIGHLIGHT = 0x00000080;
-//public static final int Pt_TEXT_CHANGED = 0x80000000;
-//public static final int Pt_TEXT_FULL = 0x00000010;
- public static final int Pt_TEXT_IMAGE = 0x08;
-//public static final int Pt_TEXT_RANGE_ACTIVE = 0x40000000;
-//public static final int Pt_TEXT_X1_RESOURCES = 1;
- public static final int Pt_TICK = 4;
-//public static final int Pt_TICKS_ETCHED_IN = 0x10;
-//public static final int Pt_TICKS_ETCHED_OUT = 0x08;
-//public static final int Pt_TICKS_MASK = 0x03;
-//public static final int Pt_TICKS_ON_BOTTOM = 0x02;
-//public static final int Pt_TICKS_ON_LEFT = 0x01;
-//public static final int Pt_TICKS_ON_RIGHT = 0x02;
-//public static final int Pt_TICKS_ON_TOP = 0x01;
-//public static final int Pt_TICKS_TOUCH_TROUGH = 0x04;
-//public static final int Pt_TIMER_INITIAL = 1;
-//public static final int Pt_TIMER_REPEAT = 2;
- public static final int Pt_TOGGLE = 0x00000008;
- public static final int Pt_TOP = 0;
- public static final int Pt_TOP_ANCHORED_BOTTOM = 0x00000040;
-//public static final int Pt_TOP_ANCHORED_RELATIVE = 0x00000004;
- public static final int Pt_TOP_ANCHORED_TOP = 0x00000400;
-//public static final int Pt_TOP_IS_ANCHORED = Pt_TOP_ANCHORED_BOTTOM | Pt_TOP_ANCHORED_RELATIVE | Pt_TOP_ANCHORED_TOP;
-//public static final int Pt_TRAVERSE_BACK = 0x00000004;
-//public static final int Pt_TRAVERSE_DONE = 0;
-//public static final int Pt_TRAVERSE_FORCE = 0x00000008;
-//public static final int Pt_TRAVERSE_LAST = 0x00000002;
-//public static final int Pt_TRAVERSE_ROOT = 0x00000001;
-//public static final int Pt_TRAVERSE_START = 0;
-//public static final int Pt_TREE_BALLOON_ON_IMAGE = 0x0100;
-//public static final int Pt_TREE_BALLOON_ON_TREE = 0x0200;
-//public static final int Pt_TREE_COLLAPSING = 0;
-//public static final int Pt_TREE_EXPANDING = 1;
-//public static final int Pt_TREE_HAS_BUTTONS = 0x0001;
-//public static final int Pt_TREE_HAS_LINES = 0x0002;
-//public static final int Pt_TREE_ITEM_EXPANDABLE = 0x0040;
- public static final int Pt_TREE_ITEM_EXPANDED = 0x0080;
-//public static final int Pt_TREE_ROOT_LINES = 0x0004;
-//public static final int Pt_TREE_TO_LEFT = 0x0010;
-//public static final int Pt_TREE_TO_RIGHT = 0x0008;
-//public static final int Pt_TRUE = -1;
-//public static final int Pt_UCLIP = 0x08000000;
-//public static final int Pt_ULINE_ETCHED_IN = 3;
-//public static final int Pt_ULINE_ETCHED_OUT = 4;
-//public static final int Pt_UNCLEAN_RESOURCES = 0x00000200;
-//public static final int Pt_UNUSED = 0x00000008;
-//public static final int Pt_USE_ELLIPSIS = 0x20;
-//public static final int Pt_VALUE_XOR = 0x20;
-//public static final int Pt_VERSION = 1;
-public static final int Pt_VERTICAL = 0;
-//public static final int Pt_WIDGET_REBUILD = 0x00100000;
-//public static final int Pt_WIDGET_RESIZE = 0x00200000;
-//public static final int Pt_WIN_REQUEST = 0x1000;
-//public static final int Pt_WINDOW_CURSOR_OVERRIDE = 0x0002;
-//public static final int Pt_WINDOW_EXTENTING = 0x0008;
-//public static final int Pt_WINDOW_FORCE_FRONT = 0x0001;
-//public static final int Pt_WINDOW_MAXING = 0x8000;
-//public static final int Pt_WINDOW_SETTING = 0x0010;
-//public static final int Pt_WINDOW_TASKBAR = 0x0004;
-//
-//public static final int Ph_WM_APP_DEF_MANAGED = ( Ph_WM_CLOSE | Ph_WM_FOCUS | Ph_WM_MENU | Ph_WM_TOFRONT | Ph_WM_TOBACK |
-// Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_HIDE | Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_TASKBAR );
-//
-//public static final int Ph_WM_APP_DEF_NOTIFY = ( 0 );
-//public static final int Ph_WM_APP_DEF_RENDER = ( Ph_WM_RENDER_ASAPP | Ph_WM_RENDER_BORDER |
-// Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MOVE |
-// Ph_WM_RENDER_TITLE | Ph_WM_RENDER_MENU |
-// Ph_WM_RENDER_MIN | Ph_WM_RENDER_MAX );
-//
-//public static final int Ph_WM_ICON_DEF_MANAGED = ( Ph_WM_CLOSE | Ph_WM_FOCUS | Ph_WM_MENU | Ph_WM_TOFRONT | Ph_WM_TOBACK | Ph_WM_MOVE | Ph_WM_ICON | Ph_WM_RESTORE );
-//public static final int Ph_WM_ICON_DEF_NOTIFY = ( 0 );
-//public static final int Ph_WM_ICON_DEF_RENDER = ( Ph_WM_RENDER_ASICON | Ph_WM_RENDER_BORDER );
-//
-//public static final int Pt_RO_EFLAGS = (Pt_DAMAGE_ON_FOCUS | Pt_SKIP_CHILDREN | Pt_WIN_REQUEST | Pt_DOOMED );
-//public static final int Pt_CONTAINER_RO_FLAGS = (Pt_IGNORE_CONSTRAINTS | Pt_CANVAS_INVALID | Pt_CONTAINER_CONSTRAINT_BITS);
-//
-//public static final int PT_WORKPROC_ID = 2;
- public static final int Pt_Z_STRING = 0x01;
-//public static final int PX_DIRECT_COLOR = 0x04;
-//public static final int PX_DODITHER = 0x40;
-//public static final int PX_IMAGE = 0x01;
-//public static final int PX_IMAGE_BMP = 0x00;
-//public static final int PX_IMAGE_GIF = 0x01;
-//public static final int PX_IMAGE_JPG = 0x02;
-//public static final int PX_IMAGE_PCX = 0x03;
-//public static final int PX_IMAGE_PNG = 0x05;
-//public static final int PX_IMAGE_TGA = 0x04;
-//public static final int PX_IMAGE_TIFF = 0x06;
-//public static final int PX_IMAGE_XBM = 0x07;
-//public static final int PX_LOAD = 0x00;
-//public static final int PX_METHODS = 0x80000000;
-//public static final int PX_NORMAL = 0x00;
-//public static final int PX_PALETTE = 0x02;
-//public static final int PX_QUERY = 0x01;
-//public static final int PX_SUPPRESS_CRC = 0x02;
-//public static final int PX_SUPPRESS_TAG = 0x02;
-//public static final int PX_TRANSPARENT = 0x08;
-//public static final int PX_USECOLORS = 0x20;
-//public static final int PXCONFIG_CREATE = 0x4;
-//public static final int PXCONFIG_FMT_BOOL_ON = 1;
-//public static final int PXCONFIG_FMT_BOOL_TRUE = 3;
-//public static final int PXCONFIG_FMT_BOOL_YES = 2;
-//public static final int PXCONFIG_FMT_CHAR_CHAR = 11;
-//public static final int PXCONFIG_FMT_CHAR_HEX = 12;
-//public static final int PXCONFIG_FMT_INT_DECIMAL = 21;
-//public static final int PXCONFIG_FMT_INT_HEX = 22;
-//public static final int PXCONFIG_FMT_STRING = 31;
-//public static final int PXCONFIG_READ = 0x0;
-//public static final int PXCONFIG_WRITE = 0x1;
-//public static final int REMOTE_FLAG_FIXED = 0x0001;
-//public static final int REMOTE_FLAG_INITIAL = 0x0002;
-//public static final int REMOTE_FLAG_IS_ORIGIN = 0x0004;
-//public static final int REMOTE_FLAG_NO_DIM = 0x0008;
-//public static final int REMOTE_WM_TITLE = 2;
-//public static final int REMOTE_WM_WINDOW = 1;
-//public static final int RF_BUF_MALLOCED = 0x0020;
-//public static final int RF_CTRL_MALLOCED = 0x0080;
-//public static final int RF_DO_PALETTE = 0x0001;
-//public static final int RF_DO_RAM = 0x0002;
-//public static final int RF_DONT_COPY = 0x0010;
-//public static final int RF_DONT_FONTMAP = 0x0008;
-//public static final int RF_DRAWFUNCS_AVAILABLE = 0x0400;
-//public static final int RF_DRAWFUNCS_MALLOCED = 0x0800;
-//public static final int RF_FORCE_ANTIALIAS = 0x0004;
-//public static final int RF_FUNCS_LOADED = 0x0040;
-//public static final int RF_NEVER_ANTIALIAS = 0x0200;
-//public static final int RF_ONE2ONE = 0x0100;
-//public static final int TTF_STATS = 0x03;
-//public static final int UPDOWN_BOT = 2;
-//public static final int UPDOWN_BOTTOM = 2;
-//public static final int UPDOWN_LEF = 3;
-//public static final int UPDOWN_LEFT = 3;
-//public static final int UPDOWN_RIGHT = 4;
-//public static final int UPDOWN_RIT = 4;
-//public static final int UPDOWN_TOP = 1;
-//public static final int VKEYMODBIT = 32;
-//public static final int WM_CONSWITCH_BACK = 1;
-//public static final int WM_CONSWITCH_CONSOLE = 0;
-//public static final int WM_CONSWITCH_FWD = 2;
-//public static final int WM_CONSWITCH_RID = 3;
-//public static final int WM_VERSION = 8;
-//
-//public static final String Ph_CLIPBOARD_TYPE_TEXT = "TEXT";
-//public static final String Ph_CURSOR_DEFAULT_FONT = "phcursor";
-//public static final String PHFONT_ENVVAR = "PHFONT";
-//public static final String PHFONT_FDNAME = "/dev/phfont";
-
-public static final int MAX_DESC_LENGTH = 32;
-public static final int MAX_FONT_TAG = 80;
-
-public static final native int PfQueryFontInfo (byte[] font, FontQueryInfo info);
-public static final native PhRect_t PfExtentWideText(PhRect_t extent, PhPoint_t pos, byte[] font, char[] str, int len);
-public static final native PhRect_t PfExtentText(PhRect_t extent, PhPoint_t pos, int font, int str, int len);
-public static final native PhRect_t PfExtentText(PhRect_t extent, PhPoint_t pos, byte[] font, byte[] str, int len);
-public static final native int PfQueryFonts(int symbol, int flags, int list, int n);
-public static final native byte[] PfGenerateFontName(byte[] pkucDescription, int kuiFlags, int kuiSize, byte[] pucBuff);
-//public static final native int PfFindFont(byte[] pkucDescription, int kulFlags, int kulSize);
-//public static final native int PfFreeFont(int ptsID);
-//public static final native int PfFontDescription(int ptsID);
-//public static final native int PfFontSize(int ptsID);
-//public static final native int PfFontFlags(int ptsID);
-//public static final native int PfConvertFontID(int ptsID);
-
-public static final native PhRect_t PgExtentMultiText(PhRect_t extent, PhPoint_t pos, byte[] font, byte[] str, int n, int linespacing);
-
-public static final native int PgCreateGC (int size);
-public static final native void PgDestroyGC (int GC);
-public static final native int PgDrawArc (PhPoint_t center, PhPoint_t radii, int start, int end, int flags);
-public static final native int PgDrawEllipse (PhPoint_t center, PhPoint_t radii, int flags);
-public static final native int PgDrawGradient (PhPoint_t ul, PhPoint_t lr, int gradient_type, int transition_type, int num_color_pts, int color1, int color2, int color3, int color4, int table_size, byte[] transition_table);
-public static final native int PgDrawPolygon (short[] ptr, int num, PhPoint_t pos, int flags);
-public static final native int PgDrawRoundRect (PhRect_t rect, PhPoint_t radii, int flags);
-public static final native int PgDrawILine (int x1, int y1, int x2, int y2);
-public static final native int PgDrawIRect (int ulx, int uly, int lrx, int lry, int flags);
-//public static final native int PgDrawText (char[] ptr, int len, short x, short y, int flags);
-public static final native int PgDrawText (byte[] ptr, int len, short x, short y, int flags);
-public static final native int PgDrawMultiTextArea (byte[] text, int len, PhRect_t canvas, int text_flags, int canvas_flags, int linespacing);
-public static final native int PgFlush ();
-public static final native int PgSetFillColor (int color);
-public static final native int PgSetStrokeColor (int color);
-public static final native int PgSetTextColor (int color);
-public static final native void PgSetFont (byte[] ff);
-public static final native int PgSetStrokeDash (byte[] DashList, int ListLen, int DashScale);
-public static final native int PgSetStrokeWidth (int width);
-public static final native int PgSetDrawMode (int mode);
-public static final native int PgSetClipping (short n, int rects);
-public static final native int PgSetPalette (int palette, int palette_id, short first_color, short num_colors, int flags, int tag);
-public static final native int PgSetGC (int GC);
-public static final native void PgSetRegion (int rid);
-public static final native int PgSetMultiClip (int num, int clip_list);
-//public static final native void PgSetUserClip (int ClipRect);
-public static final native void PgSetUserClip (PhRect_t ClipRect);
-public static final native int PgDrawImage (int ptr, int type, PhPoint_t pos, PhDim_t size, int bpl, int tag);
-public static final native int PgDrawBitmap (int ptr, int flags, PhPoint_t pos, PhDim_t size, int bpl, int tag);
-public static final native int PgDrawTImage (int ptr, int type, PhPoint_t pos, PhDim_t size, int bpl, int tag, int TransPtr, int TransBPl);
-public static final native int PgDrawPhImageRectmx (PhPoint_t pos, int image, PhRect_t rect, int flags);
-public static final native int PhMakeTransBitmap (int image, int trans_color);
-public static final native int PiCropImage (int image, PhRect_t bounds, int flags);
-public static final native void PhBlit (int rid, PhRect_t rect, PhPoint_t offset);
-public static final native int PtClippedBlit (int widget, int src, PhPoint_t delta, int clip);
-public static final native int PgSetDrawBufferSize (int cmd_buf_len);
-
-public static final native int PhEventPeek (int buffer, int size);
-public static final native int PhEventNext (int buffer, int size);
-public static final native int PhGetMsgSize (int event_buf);
-public static final native int PhGetTile ();
-public static final native int PhAddMergeTiles (int tiles, int add_tiles, int[] added);
-public static final native int PhIntersectTilings (int tile1, int tile2, short[] num_intersect_tiles);
-public static final native int PhCoalesceTiles (int tiles);
-public static final native int PhMergeTiles (int tiles);
-public static final native int PhRectUnion (int rect1, int rect2);
-public static final native int PhRectIntersect (int rect1, int rect2);
-public static final native int PhTranslateTiles (int tile, PhPoint_t point_add);
-public static final native int PhDeTranslateTiles (int tile, int point_subtract);
-public static final native int PhClipTilings (int tiles, int clip_tiles, int[] intersection);
-public static final native int PhTilesToRects (int tiles, int[] num_rects);
-public static final native int PhRectsToTiles (int rects, int num_rects);
-public static final native void PhFreeTiles (int tiles);
-public static final native int PhWindowQueryVisible (int flag, int rid, int input_group, PhRect_t rect);
-//public static final native int PhCreateImage(PhImage_t buffer, short width, short height, int type, int[] palette, int ncolors, int shmem);
-public static final native int PhCreateImage(PhImage_t buffer, short width, short height, int type, int palette, int ncolors, int shmem);
-public static final native void PhReleaseImage(int image);
-
-public static final native int PmMemCreateMC(int image, PhDim_t dim, PhPoint_t translation);
-public static final native void PmMemReleaseMC(int mc);
-public static final native int PmMemStart(int mc);
-public static final native int PmMemStop(int mc);
-public static final native int PmMemFlush(int mc, int image);
-
-public static final native int PtList ();
-public static final native int PtLabel ();
-public static final native int PtWindow ();
-public static final native int PtInit (byte [] name);
-public static final native int PtEnter (int flags);
-public static final native int PtLeave (int flags);
-public static final native int PtCreateWidget (int clazz, int parent, int n_args, int [] args);
-public static final native int PtGetResources (int widget, int n_args, int [] args);
-public static final native int PtSetResources (int widget, int n_args, int [] args);
-public static final native int PtRealizeWidget (int widget);
-public static final native void PtAddEventHandler (int widget, int event_mask, int callback, int data);
-public static final native int PtWidgetRid (int widget);
-public static final native void PtMainLoop ();
-public static final native int PtEventHandler (int event);
-public static final native int PtDestroyWidget (int widget);
-public static final native int PtWidgetCanvas (int widget, int canvas_rect);
-public static final native int PtLabelWidgetCanvas (int widget, PhRect_t canvas_rect);
-public static final native int PtWidgetExtent (int widget, int extent);
-public static final native int PtWidgetChildBack (int widget);
-public static final native boolean PtWidgetIsRealized (int widget);
-public static final native int PtWidgetBrotherInFront (int widget);
-public static final native int PtWidgetParent (int widget);
-
-public static final native int malloc (int size);
-public static final native void free (int ptr);
-
-public static final native void memmove (int address, PhPoint_t point, int size);
-public static final native void memmove (PhPoint_t point, int address, int size);
-
-public static final native void memmove (int [] buffer, int address, int size);
-public static final native void memmove (int address, int [] buffer, int size);
-
-public static final native void memmove (int address, PhTile_t tile, int size);
-public static final native void memmove (PhTile_t tile, int address, int size);
-
-//public static final native void memmove (int address, PtCallbackInfo_t callack, int size);
-public static final native void memmove (PtCallbackInfo_t callack, int address, int size);
-
-//public static final native void memmove (int address, PhWindowEvent_t event, int size);
-public static final native void memmove (PhWindowEvent_t event, int address, int size);
-
-public static final native void PtAddCallback (int widget, int callback_type, int callback, int data);
-
-public static final native int PtWidgetChildFront (int widget);
-public static final native int PtWidgetBrotherBehind (int widget);
-
-public static final native void memmove (byte [] buffer, int address, int size);
-public static final native void memmove (int address, byte [] buffer, int size);
-
-public static final native int PtButton ();
-
-public static final native void memmove (int address, PhRect_t rect, int size);
-public static final native void memmove (PhRect_t rect, int address, int size);
-
-public static final native int PtUnrealizeWidget (int widget);
-
-public static final native int PtSyncWidget (int widget);
-public static final native int PtFlush ();
-
-public static final native int PtContainerGiveFocus (int widget, PhEvent_t event);
-public static final native int PtContainerFocusNext (int widget, PhEvent_t event);
-public static final native int PtContainerFocusPrev (int widget, PhEvent_t event);
-public static final native int PtGlobalFocusNext (int widget, PhEvent_t event);
-public static final native int PtGlobalFocusPrev (int widget, PhEvent_t event);
-public static final native int PtGlobalFocusNextContainer (int widget, PhEvent_t event);
-public static final native int PtGlobalFocusPrevContainer (int widget, PhEvent_t event);
-
-public static final native int PtWidgetToBack (int widget);
-public static final native int PtWidgetToFront (int widget);
-public static final native int PtWidgetInsert (int widget, int new_sibling, int behind);
-
-public static final native int PtDamageExtent (int widget, PhRect_t extent);
-
-public static final native int PtCreateWidgetClass (int superclass_ref, int size, int num_args, int [] arg);
-public static final native void PtSuperClassDraw (int wc_ref, int widget, int damage);
-
-public static final native int PtToggleButton ();
-public static final native int PtComboBox ();
-public static final native int PtText ();
-public static final native int PtMultiText ();
-public static final native int PtMenu ();
-public static final native int PtMenuBar ();
-public static final native int PtMenuButton ();
-public static final native int PtScrollbar ();
-public static final native int PtSeparator ();
-
-public static final native int PtListAddItems (int widget, int [] items, int item_count, int position);
-public static final native void PtListUnselectPos (int widget, int pos);
-
-public static final native void memmove (short [] buffer, int address, int size);
-public static final native void memmove (int address, short [] buffer, int size);
-public static final native int strlen (int string);
-
-public static final native int PtListDeleteItemPos (int widget, int item_count, int position);
-public static final native int PtListDeleteAllItems (int widget);
-public static final native void PtListSelectPos (int widget, int pos);
-public static final native int PtListReplaceItemPos (int widget, int [] new_items, int item_count, int position);
-public static final native void PtListGotoPos (int widget, int pos);
-
-public static final native int PtTextModifyText (int widget, int start, int end, int insert_pos, byte [] text, int length);
-public static final native int PtTextModifyText (int widget, int start, int end, int insert_pos, int text, int length);
-public static final native int PtTextGetSelection (int widget, int [] start, int [] end);
-public static final native int PtTextSetSelection (int widget, int [] start, int [] end);
-
-public static final native int PtPositionMenu (int widget, PhEvent_t event);
-public static final native int PtReParentWidget (int widget, int parent);
-
-public static final native int PtForwardWindowEvent (PhWindowEvent_t event);
-
-public static final native int PtWidgetOffset (int widget, PhPoint_t offset);
-
-public static final native void PtRemoveCallback (int widget, int callback_type, int callback, int data);
-
-public static final native int PtScrollContainer ();
-
-public static final native int PtWidgetCanvas (int widget, PhRect_t canvas_rect);
-//public static final native int PtAddClassStyle (int wclass, int style);
-public static final native int PtWidgetClass (int widget);
-public static final native int PtWidgetIsClassMember (int widget, int clazz);
-
-public static final native void memmove (int dest, int src, int size);
-
-public static final native void memmove (int address, PhImage_t image, int size);
-public static final native void memmove (PhImage_t image, int address, int size);
-
-//public static final native void memmove (int address, FontDetails details, int size);
-public static final native void memmove (FontDetails details, int address, int size);
-
-public static final native void memmove (int address, PhPointerEvent_t image, int size);
-public static final native void memmove (PhPointerEvent_t dest, int src, int size);
-
-public static final native int PhGetData (int event);
-public static final native int PhGetRects (int event);
-
-//public static final native void memmove (int address, PhWindowEvent_t event, int size);
-public static final native void memmove (PhEvent_t event, int address, int size);
-public static final native void memmove (int address, PhEvent_t event, int size);
-
-public static final native int PtExtentWidget (int widget);
-public static final native int PtExtentWidgetFamily (int widget);
-
-public static final native void PtGetAbsPosition (int widget, short [] x, short [] y);
-
-//public static final native int PtSetAreaFromExtent (int widget, PhRect_t extent_rect, PhArea_t area);
-public static final native int PtSetAreaFromWidgetCanvas (int widget, PhRect_t canvas_rect, PhArea_t area);
-
-//NOT THE SAME
-//public static final native int PtSetAreaFromCanvas (int widget, PhRect_t canvas_rect, PhArea_t area);
-
-//public static final native void memmove (int address, PhImage_t image, int size);
-public static final native void memmove (PhKeyEvent_t dest, int src, int size);
-
-//public static final native int PhTo8859_1 (int event);
-//public static final native int PhKeyToMb (byte [] buffer, int event);
-
-//public static final native void memmove (int dest, PhImage_t src, int size);
-public static final native void memmove (PtScrollbarCallback_t dest, int src, int size);
-
-public static final native void memmove (int dest, PhArea_t src, int size);
-//public static final native void memmove (PhArea_t dest, int src, int size);
-
-public static final native int PtSetParentWidget (int widget);
-public static final native void PtFrameSize (int widget, int border_width, int [] left_border, int [] top_border, int [] right_border, int [] bottom_border);
-
-public static final native int PtCreateAppContext ();
-public static final native void PtAppProcessEvent (int app_context);
-public static final native int PtAppAddWorkProc (int app_context, int work_func, int data);
-public static final native void PtAppRemoveWorkProc (int app_context, int WorkProc_id);
-
-public static final native int PtWidgetExtent (int widget, PhRect_t extent);
-public static final native int PtWidgetArea (int widget, PhArea_t area);
-public static final native int PhQueryCursor (short ig, PhCursorInfo_t buf);
-public static final native int PhInputGroup (int event);
-
-public static final native int PtContainer ();
-public static final native int PtDisjoint ();
-public static final native int PtScrollArea ();
-public static final native int PhCopyTiles (int tile);
-
-public static final native int PtFileSelection (int parent, PhPoint_t pos, byte [] title, byte [] root_dir, byte [] file_spec, byte [] btn1, byte [] btn2, byte [] format, PtFileSelectionInfo_t info, int flags);
-
-public static final native int PtWidgetPreferredSize (int widget, PhDim_t dim);
-
-public static final native int PtAppCreatePulse (int app, int priority);
-public static final native int PtAppAddInput (int app_context, int pid, int input_func, int data);
-public static final native void PtAppRemoveInput (int app_context, int input_id);
-public static final native int PtAppDeletePulse (int app, int pulse_pid);
-public static final native int PtAppPulseTrigger (int app, int pulse);
-
-public static final native int PtContainerFindFocus (int family_member);
-public static final native int PtIsFocused (int widget);
-public static final native int PtWindowFocus (int widget);
-public static final native void PtWindowToBack (int widget);
-public static final native void PtWindowToFront (int widget);
-public static final native int PtFindDisjoint (int widget);
-
-public static final native int PtBlockAllWindows(int skip, short cursor, int cursor_color);
-public static final native int PtBlockWindow(int window, short cursor, int cursor_color);
-public static final native void PtUnblockWindows(int bl);
-public static final native int PtNextTopLevelWidget(int widget);
-public static final native int PtWindowGetState(int widget);
-
-public static final native void PtAddHotkeyHandler(int widget, int key_sym_cap, int key_mods, short flags, int data, int callback);
-public static final native void PtRemoveHotkeyHandler(int widget, int key_sym_cap, int key_mods, short flags, int data, int callback);
-
-public static final native void memmove (PgAlpha_t dest, int src, int size);
-public static final native void memmove (int dest, PgAlpha_t src, int size);
-
-public static final native void PgAlphaOn();
-public static final native void PgAlphaOff();
-//public static final native void PgSetAlpha(int alpha_op, int src_alpha_map, int src_alpha_gradient, byte src_global_alpha, byte dst_global_alpha);
-public static final native void PgSetAlpha(int alpha_op, PgMap_t src_alpha_map, int src_alpha_gradient, byte src_global_alpha, byte dst_global_alpha);
-
-public static final native void memmove (PtTextCallback_t dest, int src, int size);
-public static final native void memmove (int dest, PtTextCallback_t src, int size);
-
-public static final native int PhInitDrag (int rid, int flags, PhRect_t rect, PhRect_t boundary, int input_group, PhDim_t min, PhDim_t max, PhDim_t step, PhPoint_t ptrpos, short [] cursor);
-
-public static final native int PtProgress ();
-public static final native int PtPanelGroup ();
-
-public static final native void PhAreaToRect (PhArea_t area, PhRect_t rect);
-public static final native int PtCalcCanvas (int widget, PhRect_t canvas_rect);
-public static final native int PtValidParent (int widget_parent, int class_ref);
-public static final native void PtCalcBorder (int widget, PhRect_t rect);
-
-public static final native int PtPane ();
-
-public static final native int PtTree ();
-public static final native int PtTreeAllocItem (int tree, byte[] str, short set_img, short unset_img);
-public static final native int PtTreeModifyItem (int tree, int item, byte[] str, short set_img, short unset_img);
-public static final native int PtTreeModifyItemString (int tree, int item, byte[] string);
-public static final native int PtTreeFreeItems (int items);
-public static final native int PtTreeAddFirst (int tree, int item, int parent);
-public static final native int PtTreeAddAfter (int tree, int item, int brother);
-public static final native int PtTreeExpand (int tree, int item, int event);
-public static final native int PtTreeCollapse (int tree, int item, int event);
-public static final native void PtTreeRemoveItem (int tree, int item);
-public static final native void PtTreeFreeAllItems (int tree);
-public static final native int PtTreeRootItem (int tree);
-public static final native void PtTreeClearSelection (int tree);
-public static final native void PtTreeSelect (int tree, int item);
-
-public static final native void memmove (PtTreeItem_t dest, int src, int size);
-public static final native void memmove (int dest, PtTreeItem_t src, int size);
-
-public static final native void memmove (PgMap_t dest, int src, int size);
-public static final native void memmove (int dest, PgMap_t src, int size);
-
-public static final native int PtDamageWidget (int widget);
-public static final native int PtBlit (int widget, PhRect_t source, PhPoint_t delta);
-public static final native int PtContainerHold (int container_widget);
-public static final native int PtContainerRelease (int container_widget);
-
-public static final native int PtFontSelection (int parent, PhPoint_t pos, byte[] title, byte[] font, int symbol, int flags, byte[] sample);
-
-public static final native int PtToolbar ();
-
-//public static final native int PtColorSelGroup ();
-//public static final native int PtColorPatch ();
-//public static final native int PtColorPalette ();
-
-public static final native int PtGroup ();
-
-//public static final native int Pg_CM_RGB ();
-//public static final native int Pg_CM_HSB ();
-//public static final native int Pg_CM_HLS ();
-
-public static final native int PhRectUnion (PhRect_t rect1, PhRect_t rect2);
-public static final native int PtRegion ();
-public static final native void PtAddFilterCallback (int widget, int event_mask, int callback, int data);
-
-public static final native int PtListItemPos (int widget, byte[] item);
-
-public static final native int PtTimer ();
-public static final native int PtHit (int container, int n, PhRect_t rect);
-
-public static final native int PtColorSelect (int parent, byte[] title, PtColorSelectInfo_t info);
-
-public static final native void PgDrawArrow (PhRect_t rect, short unknown, int color, int flags);
-
-public static final native int PtBeep ();
-
-public static final native int PtAlert (int parent, PhPoint_t location, byte[] title, int image, byte[] message, byte[] msgFont, int btnCount, int[] buttons, int[] btnFonts, int defBtn, int escBtn, int flags);
-
-public static final native int PtSlider ();
-
-public static final native int PiDuplicateImage (int image, int flags);
-
-public static final native int PhMakeGhostBitmap (int image);
-
-public static final native int PgReadScreen (PhRect_t rect, int buffer);
-public static final native int PgReadScreenSize (PhRect_t rect);
-public static final native int PgShmemCreate (int size, byte[] name);
-//public static final native int PgShmemDetach (int addr);
-public static final native int PgShmemDestroy (int addr);
-//public static final native void PgShmemCleanup ();
-public static final native int PhRegionQuery (int rid, PhRegion_t region, PhRect_t rect, int data, int data_len);
-//public static final native int PiGetPixelRGB (int image, short x, short y, int[] value);
-
-public static final native void memmove (PtContainerCallback_t dest, int src, int size);
-//public static final native void memmove (int dest, PtContainerCallback_t src, int size);
-
-public static final native void PtSendEventToWidget (int widget, int event);
-
-//public static final native void memmove (PhCursorDef_t dest, int src, int size);
-public static final native void memmove (int dest, PhCursorDef_t src, int size);
-
-public static final native void PgSetFillTransPat (byte [] pat);
-
-public static final native int PtInflateBalloon (int win, int me, int position, byte [] string, byte [] font, int fill, int text_color);
-
-//public static final native void memmove (PgDisplaySettings_t dest, int src, int size);
-//public static final native void memmove (int dest, PgDisplaySettings_t src, int size);
-
-//public static final native void memmove (PgVideoModeInfo_t dest, int src, int size);
-//public static final native void memmove (int dest, PgVideoModeInfo_t src, int size);
-
-public static final native int PgGetVideoMode (PgDisplaySettings_t settings);
-public static final native int PgGetVideoModeInfo (short mode_number, PgVideoModeInfo_t mode_info);
-
-public static final native void memmove (PhClipHeader dest, int src, int size);
-public static final native void memmove (int dest, PhClipHeader src, int size);
-public static final native void memmove (byte[] dest, PhClipHeader src, int size);
-
-public static final native int PhClipboardCopyString (short ig, byte [] string);
-public static final native int PhClipboardPasteString (short ig);
-public static final native int PhClipboardCopy (short ig, int n, byte[] clip);
-public static final native int PhClipboardPasteStart (short ig);
-public static final native int PhClipboardPasteType (int cbdata, byte[] type);
-public static final native int PhClipboardPasteTypeN (int cbdata, int n);
-public static final native void PhClipboardPasteFinish (int cbdata);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java
deleted file mode 100644
index 7485fdfd4c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgAlpha_t {
-
- public int alpha_op;
- // PgMap_t src_alpha_map;
- public short src_alpha_map_dim_w;
- public short src_alpha_map_dim_h;
- public short src_alpha_map_bpl;
- public short src_alpha_map_bpp;
- public int src_alpha_map_map;
- // PgGradient_t src_alpha_gradient; *** unused
- // PgMap_t dest_alpha_map; *** unused
- // PgGradient_t dest_alpha_gradient; *** unused
- public byte src_global_alpha;
- public byte dest_global_alpha;
- // char spare[2]; *** unused
- public static final int sizeof = 104;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java
deleted file mode 100644
index 89c384775e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgDisplaySettings_t {
- public int mode;
- public int xres;
- public int yres;
- public int refresh;
- public int flags;
- public int [] reserved = new int [22];
- public static final int sizeof = 108;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgMap_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgMap_t.java
deleted file mode 100644
index d25f90f9bf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgMap_t.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgMap_t {
-
- public short dim_w;
- public short dim_h;
- public short bpl;
- public short bpp;
- public int map;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java
deleted file mode 100644
index 61494500ac..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgVideoModeInfo_t {
- public short width;
- public short height;
- public short bits_per_pixel;
- public short bytes_per_scanline;
- public int type;
- public int mode_capabilities1;
- public int mode_capabilities2;
- public int mode_capabilities3;
- public int mode_capabilities4;
- public int mode_capabilities5;
- public int mode_capabilities6;
- public byte [] refresh_rates = new byte [20];
- public static final int sizeof = 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhArea_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhArea_t.java
deleted file mode 100644
index 0a09362a26..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhArea_t.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhArea_t {
- public short pos_x;
- public short pos_y;
- public short size_w;
- public short size_h;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhClipHeader.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhClipHeader.java
deleted file mode 100644
index b7379fc9ca..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhClipHeader.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhClipHeader {
-
- public byte type_0;
- public byte type_1;
- public byte type_2;
- public byte type_3;
- public byte type_4;
- public byte type_5;
- public byte type_6;
- public byte type_7;
- public short length;
- public short zero;
- public int data;
-
- public static final int sizeof = 16;
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java
deleted file mode 100644
index 1bfe5c26cd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.internal.photon;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- public class PhCursorDef_t {
-// PhRegionDataHdr_t hdr;
- public short hdr_len;
- public short hdr_type;
-
-// PhPoint_t size1;
- public short size1_x;
- public short size1_y;
-// PhPoint_t offset1;
- public short offset1_x;
- public short offset1_y;
- public int color1;
- public byte bytesperline1;
-
-// byte zero1; // 3 bytes
-
-// PhPoint_t size2;
- public short size2_x;
- public short size2_y;
-// PhPoint_t offset2;
- public short offset2_x;
- public short offset2_y;
- public int color2;
- public byte bytesperline2;
-
-// byte Spare; // 14 bytes
-
-// byte images; // variable number of bytes
-
- public static final int sizeof = 47;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java
deleted file mode 100644
index ad22c1e0ee..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhCursorInfo_t {
-// PhPoint_t pos;
- public short pos_x;
- public short pos_y;
- public int region;
- public int ig_region;
- public int color;
-// PhPoint_t last_press;
- public short last_press_x;
- public short last_press_y;
- public int msec;
-// PhPoint_t steady;
- public int steady_x;
- public int steady_y;
- public int dragger;
-// PhRect_t drag_boundary;
- public short drag_boundary_xUL;
- public short drag_boundary_yUL;
- public short drag_boundary_xLR;
- public short drag_boundary_yLR;
- public int phantom_rid;
- public short type;
- public short ig;
- public short button_state;
- public byte click_count;
- public byte zero10, zero11,zero12;
- public int key_mods;
- public int zero2;
- public static final int sizeof = 60;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhDim_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhDim_t.java
deleted file mode 100644
index 66021b3848..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhDim_t.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhDim_t {
- public short w;
- public short h;
- public static final int sizeof = 4;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhEvent_t.java
deleted file mode 100644
index 4b0461f844..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhEvent_t.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhEvent_t {
- public int type;
- public short subtype;
- public short processing_flags;
-// public PhEventRegion_t emitter;
- public int emitter_rid;
- public int emitter_handle;
-// public PhEventRegion_t collector;
- public int collector_rid;
- public int collector_handle;
- public short input_group;
- public short flags;
- public int timestamp;
-// public PhPoint_t translation;
- public short translation_x;
- public short translation_y;
- public short num_rects;
- public short data_len;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhImage_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhImage_t.java
deleted file mode 100644
index 539c1dee07..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhImage_t.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhImage_t {
- public int type;
- public int image_tag;
- public int bpl;
- public short size_w;
- public short size_h;
- public int palette_tag;
- public int colors;
- public int alpha;
- public int transparent;
- public byte format;
- public byte flags;
- public byte ghost_bpl;
- public byte spare1;
- public int ghost_bitmap;
- public int mask_bpl;
- public int mask_bm;
- public int palette;
- public int image;
- public static final int sizeof = 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java
deleted file mode 100644
index 4aa5622ceb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhKeyEvent_t {
- public int key_mods;
- public int key_flags;
- public int key_cap;
- public int key_sym;
- public short key_scan;
- public short key_zero;
-// PhPoint_t pos;
- public short pos_x;
- public short pos_y;
- public short button_state;
- public static final int sizeof = 26;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPoint_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPoint_t.java
deleted file mode 100644
index 5bcca4457f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPoint_t.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhPoint_t {
- public short x;
- public short y;
- public static final int sizeof = 4;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java
deleted file mode 100644
index 07c8cd3491..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhPointerEvent_t {
-// public PhPoint_t pos;
- public short pos_x;
- public short pos_y;
- public short buttons;
- public short button_state;
- public byte click_count;
- public byte flags;
- public short z;
- public int key_mods;
- public int zero;
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRect_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRect_t.java
deleted file mode 100644
index 0fe5db44e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRect_t.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhRect_t {
- public short ul_x;
- public short ul_y;
- public short lr_x;
- public short lr_y;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRegion_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRegion_t.java
deleted file mode 100644
index b7012858f1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhRegion_t.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhRegion_t {
- public int rid;
- public int handle;
- public int owner;
- public int flags;
- public short state;
-// public short zero1;
- public int events_sense;
- public int events_opaque;
- public short origin_x;
- public short origin_y;
- public int parent;
- public int child;
- public int bro_in_front;
- public int bro_behind;
- public int cursor_color;
- public short input_group;
- public short data_len;
-// public int zero21;
-// public int zero22;
- public short cursor_type;
-// public short zero3;
-
- public static final int sizeof = 68;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhTile_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhTile_t.java
deleted file mode 100644
index 92f270ca42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhTile_t.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhTile_t {
- // PhRect_t rect;
- public short rect_ul_x;
- public short rect_ul_y;
- public short rect_lr_x;
- public short rect_lr_y;
- public int next;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java
deleted file mode 100644
index 4084fa5911..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PhWindowEvent_t {
- public int event_f;
- public int state_f;
- public int rid;
-// PhPoint_t pos;
- public short pos_x;
- public short pos_y;
-// PhDim_t size;
- public short size_w;
- public short size_h;
- public short event_state;
- public short input_group;
- public int rsvd0, rsvd1, rsvd2, rsvd3;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java
deleted file mode 100644
index 04b970a3fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtCallbackInfo_t {
- public int reason;
- public int reason_subtype;
- public int event;
- public int cbdata;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java
deleted file mode 100644
index bab9c5b694..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtColorSelectInfo_t {
- public short flags;
- public byte nselectors;
- public byte ncolor_models;
- public int color_models;
- public int selectors;
- public short pos_x;
- public short pos_y;
- public short size_w;
- public short size_h;
- public int palette;
- public int accept_text;
- public int dismiss_text;
- public int accept_dismiss_text;
- public int apply_f;
- public int data;
- public int rgb;
- public int dialog;
- public static final int sizeof = 52;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java
deleted file mode 100644
index a6d14e8f5e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtContainerCallback_t {
- public short new_size_ul_x;
- public short new_size_ul_y;
- public short new_size_lr_x;
- public short new_size_lr_y;
- public short old_size_ul_x;
- public short old_size_ul_y;
- public short old_size_lr_x;
- public short old_size_lr_y;
- public short new_dim_w;
- public short new_dim_h;
- public short old_dim_w;
- public short old_dim_h;
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java
deleted file mode 100644
index 852218383d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtFileSelectionInfo_t {
- public short ret;
- public byte [] path = new byte [(OS.PATH_MAX + OS.NAME_MAX + 4) & (~3)];
- public PhDim_t dim = new PhDim_t ();
- public PhPoint_t pos = new PhPoint_t ();
- public byte [] format = new byte [80];
- public byte [] fspec = new byte [80];
- public int user_data;
- public int confirm_display;
- public int confirm_selection;
- public int new_directory;
- public int btn1;
- public int btn2;
- public int num_args;
- public int args;
- public int [] spare = new int [4];
- public static final int sizeof = 1500;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java
deleted file mode 100644
index 3185fabfb1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtScrollbarCallback_t {
- public int action;
- public int position;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java
deleted file mode 100644
index 77def5959a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtTextCallback_t {
- public int start_pos;
- public int end_pos;
- public int cur_insert;
- public int new_insert;
- public int length;
- public short reserved;
- public int text;
- public int doit;
- public static final int sizeof = 30;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java
deleted file mode 100644
index d411b93bd9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PtTreeItem_t {
- public int list_flags;
- public short list_size_w;
- public short list_size_h;
- public int list_next;
- public int list_prev;
- public int father;
- public int son;
- public int brother;
- public short dim_w;
- public short dim_h;
- public short img_set;
- public short img_unset;
- public int data;
-// char string [1];
-// byte string;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build-ce.bat b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build-ce.bat
deleted file mode 100644
index a65d75d306..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build-ce.bat
+++ /dev/null
@@ -1,28 +0,0 @@
-@echo off
-
-rem (c) Copyright IBM Corp., 2000, 2001
-rem All Rights Reserved.
-
-IF NOT "%JAVA_HOME%"=="" GOTO MAKE
-
-rem *****
-rem Javah
-rem *****
-set JAVA_HOME=j:\teamswt\swt-builddir\ive\bin
-set path=%JAVA_HOME%;%path%
-
-rem ********
-rem MSVC 6.0
-rem ********
-rem call k:\dev\products\msvc60\vc98\bin\vcvars32.bat
-
-rem ******
-rem MS-SDK
-rem ******
-rem set Mssdk=j:\teamswt\swt-builddir\mssdk
-rem call %mssdk%\setenv.bat
-
-call j:\j9\tools\config\ppcarm.bat
-
-:MAKE
-nmake -f make_wince.mak %1 %2 %3 %4
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
deleted file mode 100644
index 9b07fba0d7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
+++ /dev/null
@@ -1,26 +0,0 @@
-@echo off
-
-rem (c) Copyright IBM Corp., 2000, 2001
-rem All Rights Reserved.
-
-IF NOT "%JAVA_HOME%"=="" GOTO MAKE
-
-rem *****
-rem Javah
-rem *****
-set JAVA_HOME=j:\teamswt\swt-builddir\ive\bin
-set path=%JAVA_HOME%;%path%
-
-rem ********
-rem MSVC 6.0
-rem ********
-call k:\dev\products\msvc60\vc98\bin\vcvars32.bat
-
-rem ******
-rem MS-SDK
-rem ******
-set Mssdk=j:\teamswt\swt-builddir\mssdk
-call %mssdk%\setenv.bat
-
-:MAKE
-nmake -f make_win32.mak %1 %2 %3 %4
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
deleted file mode 100644
index 66da6d475c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
+++ /dev/null
@@ -1,50 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for SWT libraries on Windows
-
-# assumes JAVA_HOME is set in the environment from which nmake is run
-
-APPVER=5.0
-!include <make_common.mak>
-!include <win32.mak>
-
-pgm_ver_str="SWT $(maj_ver).$(min_ver) for Windows"
-timestamp_str=__DATE__\" \"__TIME__\" (EST)\"
-copyright = "Copyright (C) IBM Corporation 1999, 2000. All rights reserved."
-
-SWT_PREFIX=swt
-WS_PREFIX=win32
-SWT_VERSION = $(maj_ver)$(min_ver)
-SWT_LIB = $(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
-
-LINK_LIBS = ole32.lib comctl32.lib user32.lib gdi32.lib comdlg32.lib kernel32.lib shell32.lib oleaut32.lib advapi32.lib imm32.lib winspool.lib
-
-# note: thoroughly test all examples after changing any optimization flags
-CFLAGS = -c -W3 -G6 -GD -O1 -DSWT_VERSION=$(SWT_VERSION) -DSWT_BUILD_NUM=$(bld_num) -nologo -D_X86_=1 -D_WIN32 -D_WIN95 -D_WIN32_WINDOWS=0x0400 -D_MT -MT -DWIN32 -D_WIN32_DCOM /I$(JAVA_HOME)\include /I.
-RCFLAGS = -DSWT_FILE_VERSION=\"$(maj_ver).$(min_ver)\" -DSWT_COMMA_VERSION=$(comma_ver)
-LFLAGS = /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO -entry:_DllMainCRTStartup@12 -dll /BASE:0x10000000 /comment:$(pgm_ver_str) /comment:$(copyright) /DLL
-
-SWT_OBJS = swt.obj structs.obj callback.obj swtole.obj
-
-all: $(SWT_LIB)
-
-.c.obj:
- cl $(CFLAGS) $*.c
-
-$(SWT_LIB): $(SWT_OBJS) swt.res
- echo $(LFLAGS) >templrf
- echo $(LINK_LIBS) >>templrf
- echo -machine:IX86 >>templrf
- echo -subsystem:windows >>templrf
- echo -out:$(SWT_LIB) >>templrf
- echo $(SWT_OBJS) >>templrf
- echo swt.res >>templrf
- link @templrf
- del templrf
-
-swt.res:
- rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(SWT_LIB)\" -r -fo swt.res swt.rc
-
-clean:
- del *.obj *.res *.dll *.lib *.exp
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_wince.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_wince.mak
deleted file mode 100644
index 155a677319..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_wince.mak
+++ /dev/null
@@ -1,41 +0,0 @@
-# (c) Copyright IBM Corp., 2000, 2001
-# All Rights Reserved.
-#
-# Makefile for SWT libraries on Windows CE
-
-# assumes JAVA_HOME is set in the environment from which nmake is run
-
-!include <make_common.mak>
-
-CPU=ARM
-
-SWT_PREFIX = swt
-WS_PREFIX = win32
-SWT_VERSION = $(maj_ver)$(min_ver)
-SWT_LIB = $(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
-
-LINK_LIBS = aygshell.lib corelibc.lib coredll.lib commdlg.lib commctrl.lib ceshell.lib
-
-CFLAGS = /nologo /c /W3 -DSWT_VERSION=$(SWT_VERSION) -DSWT_BUILD_NUM=$(bld_num) -DJ9WINCE -D_WIN32_WCE=300 -D"MS Pocket PC" /DUNDER_CE=300 /D"UNICODE" /D"_MBCS" /Zm200 -DARM -D_ARM_ -DFIXUP_UNALIGNED /I. /I$(JAVA_HOME)\include $*.c
-RCFLAGS = -DSWT_FILE_VERSION=\"$(maj_ver).$(min_ver)\" -DSWT_COMMA_VERSION=$(comma_ver)
-LFLAGS = $(dlllflags) /dll /entry:"_DllMainCRTStartup" /NODEFAULTLIB:libc.lib /nodefaultlib:oldnames.lib
-
-SWT_OBJS = swt.obj structs.obj callback.obj # swtole.obj
-
-all: $(SWT_LIB)
-
-.c.obj:
- clarm $(CFLAGS) $*.c
-
-$(SWT_LIB): $(SWT_OBJS) swt.res
- link $(LFLAGS) $(LINK_LIBS) \
- -machine:$(CPU) \
- -subsystem:windowsce,3.00 \
- -out:$(SWT_LIB) \
- $(SWT_OBJS) swt.res
-
-swt.res:
- rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(SWT_LIB)\" -r -fo swt.res swt.rc
-
-clean:
- del *.obj *.res *.dll *.lib *.exp \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.c
deleted file mode 100644
index ff4f52aa6c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.c
+++ /dev/null
@@ -1,4006 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Windows structs
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Win32 globals */
-ACCEL_FID_CACHE ACCELFc;
-BITMAP_FID_CACHE BITMAPFc;
-CHOOSECOLOR_FID_CACHE CHOOSECOLORFc;
-COMPOSITIONFORM_FID_CACHE COMPOSITIONFORMFc;
-CREATESTRUCT_FID_CACHE CREATESTRUCTFc;
-DIBSECTION_FID_CACHE DIBSECTIONFc;
-DLLVERSIONINFO_FID_CACHE DLLVERSIONINFOFc;
-DRAWITEMSTRUCT_FID_CACHE DRAWITEMSTRUCTFc;
-FILETIME_FID_CACHE FILETIMEFc;
-HDITEM_FID_CACHE HDITEMFc;
-ICONINFO_FID_CACHE ICONINFOFc;
-INITCOMMONCONTROLSEX_FID_CACHE INITCOMMONCONTROLSEXFc;
-LOGBRUSH_FID_CACHE LOGBRUSHFc;
-LOGFONT_FID_CACHE LOGFONTFc;
-LOGPEN_FID_CACHE LOGPENFc;
-LVCOLUMN_FID_CACHE LVCOLUMNFc;
-LVHITTESTINFO_FID_CACHE LVHITTESTINFOFc;
-LVITEM_FID_CACHE LVITEMFc;
-MEASUREITEMSTRUCT_FID_CACHE MEASUREITEMSTRUCTFc;
-MENUITEMINFO_FID_CACHE MENUITEMINFOFc;
-MSG_FID_CACHE MSGFc;
-NMHDR_FID_CACHE NMHDRFc;
-NMHEADER_FID_CACHE NMHEADERFc;
-NMLISTVIEW_FID_CACHE NMLISTVIEWFc;
-NMTOOLBAR_FID_CACHE NMTOOLBARFc;
-OPENFILENAME_FID_CACHE OPENFILENAMEFc;
-OSVERSIONINFO_FID_CACHE OSVERSIONINFOFc;
-PAINTSTRUCT_FID_CACHE PAINTSTRUCTFc;
-POINT_FID_CACHE POINTFc;
-REBARBANDINFO_FID_CACHE REBARBANDINFOFc;
-RECT_FID_CACHE RECTFc;
-SCROLLINFO_FID_CACHE SCROLLINFOFc;
-SHELLEXECUTEINFO_FID_CACHE SHELLEXECUTEINFOFc;
-SIZE_FID_CACHE SIZEFc;
-TBBUTTON_FID_CACHE TBBUTTONFc;
-TBBUTTONINFO_FID_CACHE TBBUTTONINFOFc;
-TCITEM_FID_CACHE TCITEMFc;
-TEXTMETRIC_FID_CACHE TEXTMETRICFc;
-TVHITTESTINFO_FID_CACHE TVHITTESTINFOFc;
-TVINSERTSTRUCT_FID_CACHE TVINSERTSTRUCTFc;
-TVITEM_FID_CACHE TVITEMFc;
-WINDOWPOS_FID_CACHE WINDOWPOSFc;
-WNDCLASS_FID_CACHE WNDCLASSFc;
-#ifdef _WIN32_WCE
- SHMENUBARINFO_FID_CACHE SHMENUBARINFOFc;
-#endif // _WIN32_WCE
-#ifndef _WIN32_WCE
- BROWSEINFO_FID_CACHE BROWSEINFOFc;
- CHOOSEFONT_FID_CACHE CHOOSEFONTFc;
- DOCINFO_FID_CACHE DOCINFOFc;
- GCP_RESULTS_FID_CACHE GCP_RESULTSFc;
- GRADIENT_RECT_FID_CACHE GRADIENT_RECTFc;
- HELPINFO_FID_CACHE HELPINFOFc;
- MENUINFO_FID_CACHE MENUINFOFc;
- NMTTDISPINFO_FID_CACHE NMTTDISPINFOFc;
- NONCLIENTMETRICS_FID_CACHE NONCLIENTMETRICSFc;
- PRINTDLG_FID_CACHE PRINTDLGFc;
- TOOLINFO_FID_CACHE TOOLINFOFc;
- TRACKMOUSEEVENT_FID_CACHE TRACKMOUSEEVENTFc;
- TRIVERTEX_FID_CACHE TRIVERTEXFc;
- WINDOWPLACEMENT_FID_CACHE WINDOWPLACEMENTFc;
- DROPFILES_FID_CACHE DROPFILESFc;
- OLECMD_FID_CACHE OLECMDFc;
- OLECMDTEXT_FID_CACHE OLECMDTEXTFc;
-#endif
-
-/* OLE globals */
-CAUUID_FID_CACHE CAUUIDFc;
-CONTROLINFO_FID_CACHE CONTROLINFOFc;
-COSERVERINFO_FID_CACHE COSERVERINFOFc;
-DISPPARAMS_FID_CACHE DISPPARAMSFc;
-DVTARGETDEVICE_FID_CACHE DVTARGETDEVICEFc;
-EXCEPINFO_FID_CACHE EXCEPINFOFc;
-FORMATETC_FID_CACHE FORMATETCFc;
-FUNCDESC1_FID_CACHE FUNCDESC1Fc;
-FUNCDESC2_FID_CACHE FUNCDESC2Fc;
-GUID_FID_CACHE GUIDFc;
-LICINFO_FID_CACHE LICINFOFc;
-OLEINPLACEFRAMEINFO_FID_CACHE OLEINPLACEFRAMEINFOFc;
-STATSTG_FID_CACHE STATSTGFc;
-STGMEDIUM_FID_CACHE STGMEDIUMFc;
-TYPEATTR_FID_CACHE TYPEATTRFc;
-VARDESC1_FID_CACHE VARDESC1Fc;
-VARDESC2_FID_CACHE VARDESC2Fc;
-
-void cacheACCELFids(JNIEnv *env, jobject lpObject, PACCEL_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->fVirt = (*env)->GetFieldID(env, lpCache->clazz, "fVirt", "B");
- lpCache->key = (*env)->GetFieldID(env, lpCache->clazz, "key", "S");
- lpCache->cmd = (*env)->GetFieldID(env, lpCache->clazz, "cmd", "S");
- lpCache->cached = 1;
-}
-
-ACCEL* getACCELFields(JNIEnv *env, jobject lpObject, ACCEL *lpStruct, PACCEL_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheACCELFids(env, lpObject, lpCache);
- lpStruct->fVirt = (*env)->GetByteField(env, lpObject, lpCache->fVirt);
- lpStruct->key = (*env)->GetShortField(env, lpObject, lpCache->key);
- lpStruct->cmd = (*env)->GetShortField(env, lpObject, lpCache->cmd);
- return lpStruct;
-}
-
-void setACCELFields(JNIEnv *env, jobject lpObject, ACCEL *lpStruct, PACCEL_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheACCELFids(env, lpObject, lpCache);
- (*env)->SetByteField(env, lpObject, lpCache->fVirt, lpStruct->fVirt);
- (*env)->SetShortField(env, lpObject, lpCache->key, lpStruct->key);
- (*env)->SetShortField(env, lpObject, lpCache->cmd, lpStruct->cmd);
-}
-
-void cacheBITMAPFids(JNIEnv *env, jobject lpObject, PBITMAP_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->bmType = (*env)->GetFieldID(env, lpCache->clazz, "bmType", "I");
- lpCache->bmWidth = (*env)->GetFieldID(env, lpCache->clazz, "bmWidth", "I");
- lpCache->bmHeight = (*env)->GetFieldID(env, lpCache->clazz, "bmHeight", "I");
- lpCache->bmWidthBytes = (*env)->GetFieldID(env, lpCache->clazz, "bmWidthBytes", "I");
- lpCache->bmPlanes = (*env)->GetFieldID(env, lpCache->clazz, "bmPlanes", "S");
- lpCache->bmBitsPixel = (*env)->GetFieldID(env, lpCache->clazz, "bmBitsPixel", "S");
- lpCache->bmBits = (*env)->GetFieldID(env, lpCache->clazz, "bmBits", "I");
- lpCache->cached = 1;
-}
-
-BITMAP* getBITMAPFields(JNIEnv *env, jobject lpObject, BITMAP *lpStruct, PBITMAP_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheBITMAPFids(env, lpObject, lpCache);
- lpStruct->bmType = (*env)->GetIntField(env, lpObject, lpCache->bmType);
- lpStruct->bmWidth = (*env)->GetIntField(env, lpObject, lpCache->bmWidth);
- lpStruct->bmHeight = (*env)->GetIntField(env, lpObject, lpCache->bmHeight);
- lpStruct->bmWidthBytes = (*env)->GetIntField(env, lpObject, lpCache->bmWidthBytes);
- lpStruct->bmPlanes = (*env)->GetShortField(env, lpObject, lpCache->bmPlanes);
- lpStruct->bmBitsPixel = (*env)->GetShortField(env, lpObject, lpCache->bmBitsPixel);
- lpStruct->bmBits = (LPVOID)(*env)->GetIntField(env, lpObject, lpCache->bmBits);
- return lpStruct;
-}
-
-void setBITMAPFields(JNIEnv *env, jobject lpObject, BITMAP *lpStruct, PBITMAP_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheBITMAPFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->bmType, lpStruct->bmType);
- (*env)->SetIntField(env, lpObject, lpCache->bmWidth, lpStruct->bmWidth);
- (*env)->SetIntField(env, lpObject, lpCache->bmHeight, lpStruct->bmHeight);
- (*env)->SetIntField(env, lpObject, lpCache->bmWidthBytes, lpStruct->bmWidthBytes);
- (*env)->SetShortField(env, lpObject, lpCache->bmPlanes, lpStruct->bmPlanes);
- (*env)->SetShortField(env, lpObject, lpCache->bmBitsPixel, lpStruct->bmBitsPixel);
- (*env)->SetIntField(env, lpObject, lpCache->bmBits, (jint)lpStruct->bmBits);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheBROWSEINFOFids(JNIEnv *env, jobject lpObject, PBROWSEINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndOwner = (*env)->GetFieldID(env, lpCache->clazz, "hwndOwner", "I");
- lpCache->pidlRoot = (*env)->GetFieldID(env, lpCache->clazz, "pidlRoot", "I");
- lpCache->pszDisplayName = (*env)->GetFieldID(env, lpCache->clazz, "pszDisplayName", "I");
- lpCache->lpszTitle = (*env)->GetFieldID(env, lpCache->clazz, "lpszTitle", "I");
- lpCache->ulFlags = (*env)->GetFieldID(env, lpCache->clazz, "ulFlags", "I");
- lpCache->lpfn = (*env)->GetFieldID(env, lpCache->clazz, "lpfn", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->cached = 1;
-}
-
-BROWSEINFO* getBROWSEINFOFields(JNIEnv *env, jobject lpObject, BROWSEINFO *lpStruct, PBROWSEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheBROWSEINFOFids(env, lpObject, lpCache);
- lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndOwner);
- lpStruct->pidlRoot = (LPCITEMIDLIST)(*env)->GetIntField(env, lpObject, lpCache->pidlRoot);
- lpStruct->pszDisplayName = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszDisplayName);
- lpStruct->lpszTitle = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszTitle);
- lpStruct->ulFlags = (*env)->GetIntField(env, lpObject, lpCache->ulFlags);
- lpStruct->lpfn = (BFFCALLBACK)(*env)->GetIntField(env, lpObject, lpCache->lpfn);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- return lpStruct;
-}
-
-void setBROWSEINFOFields(JNIEnv *env, jobject lpObject, BROWSEINFO *lpStruct, PBROWSEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheBROWSEINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndOwner, (jint)lpStruct->hwndOwner);
- (*env)->SetIntField(env, lpObject, lpCache->pidlRoot, (jint)lpStruct->pidlRoot);
- (*env)->SetIntField(env, lpObject, lpCache->pszDisplayName, (jint)lpStruct->pszDisplayName);
- (*env)->SetIntField(env, lpObject, lpCache->lpszTitle, (jint)lpStruct->lpszTitle);
- (*env)->SetIntField(env, lpObject, lpCache->ulFlags, lpStruct->ulFlags);
- (*env)->SetIntField(env, lpObject, lpCache->lpfn, (jint)lpStruct->lpfn);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
-}
-
-#endif // _WIN32_WCE
-
-void cacheCHOOSECOLORFids(JNIEnv *env, jobject lpObject, PCHOOSECOLOR_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lStructSize = (*env)->GetFieldID(env, lpCache->clazz, "lStructSize", "I");
- lpCache->hwndOwner = (*env)->GetFieldID(env, lpCache->clazz, "hwndOwner", "I");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->rgbResult = (*env)->GetFieldID(env, lpCache->clazz, "rgbResult", "I");
- lpCache->lpCustColors = (*env)->GetFieldID(env, lpCache->clazz, "lpCustColors", "I");
- lpCache->Flags = (*env)->GetFieldID(env, lpCache->clazz, "Flags", "I");
- lpCache->lCustData = (*env)->GetFieldID(env, lpCache->clazz, "lCustData", "I");
- lpCache->lpfnHook = (*env)->GetFieldID(env, lpCache->clazz, "lpfnHook", "I");
- lpCache->lpTemplateName = (*env)->GetFieldID(env, lpCache->clazz, "lpTemplateName", "I");
- lpCache->cached = 1;
-}
-
-CHOOSECOLOR* getCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct, PCHOOSECOLOR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCHOOSECOLORFids(env, lpObject, lpCache);
- lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, lpCache->lStructSize);
- lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndOwner);
- lpStruct->hInstance = (HANDLE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->rgbResult = (*env)->GetIntField(env, lpObject, lpCache->rgbResult);
- lpStruct->lpCustColors = (COLORREF *)(*env)->GetIntField(env, lpObject, lpCache->lpCustColors);
- lpStruct->Flags = (*env)->GetIntField(env, lpObject, lpCache->Flags);
- lpStruct->lCustData = (*env)->GetIntField(env, lpObject, lpCache->lCustData);
- lpStruct->lpfnHook = (LPCCHOOKPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnHook);
- lpStruct->lpTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpTemplateName);
- return lpStruct;
-}
-
-void setCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct, PCHOOSECOLOR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCHOOSECOLORFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lStructSize, lpStruct->lStructSize);
- (*env)->SetIntField(env, lpObject, lpCache->hwndOwner, (jint)lpStruct->hwndOwner);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->rgbResult, lpStruct->rgbResult);
- (*env)->SetIntField(env, lpObject, lpCache->lpCustColors, (jint)lpStruct->lpCustColors);
- (*env)->SetIntField(env, lpObject, lpCache->Flags, lpStruct->Flags);
- (*env)->SetIntField(env, lpObject, lpCache->lCustData, lpStruct->lCustData);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnHook, (jint)lpStruct->lpfnHook);
- (*env)->SetIntField(env, lpObject, lpCache->lpTemplateName, (jint)lpStruct->lpTemplateName);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheCHOOSEFONTFids(JNIEnv *env, jobject lpObject, PCHOOSEFONT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lStructSize = (*env)->GetFieldID(env, lpCache->clazz, "lStructSize", "I");
- lpCache->hwndOwner = (*env)->GetFieldID(env, lpCache->clazz, "hwndOwner", "I");
- lpCache->hDC = (*env)->GetFieldID(env, lpCache->clazz, "hDC", "I");
- lpCache->lpLogFont = (*env)->GetFieldID(env, lpCache->clazz, "lpLogFont", "I");
- lpCache->iPointSize = (*env)->GetFieldID(env, lpCache->clazz, "iPointSize", "I");
- lpCache->Flags = (*env)->GetFieldID(env, lpCache->clazz, "Flags", "I");
- lpCache->rgbColors = (*env)->GetFieldID(env, lpCache->clazz, "rgbColors", "I");
- lpCache->lCustData = (*env)->GetFieldID(env, lpCache->clazz, "lCustData", "I");
- lpCache->lpfnHook = (*env)->GetFieldID(env, lpCache->clazz, "lpfnHook", "I");
- lpCache->lpTemplateName = (*env)->GetFieldID(env, lpCache->clazz, "lpTemplateName", "I");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->lpszStyle = (*env)->GetFieldID(env, lpCache->clazz, "lpszStyle", "I");
- lpCache->nFontType = (*env)->GetFieldID(env, lpCache->clazz, "nFontType", "S");
- lpCache->nSizeMin = (*env)->GetFieldID(env, lpCache->clazz, "nSizeMin", "I");
- lpCache->nSizeMax = (*env)->GetFieldID(env, lpCache->clazz, "nSizeMax", "I");
- lpCache->cached = 1;
-}
-
-CHOOSEFONT* getCHOOSEFONTFields(JNIEnv *env, jobject lpObject, CHOOSEFONT *lpStruct, PCHOOSEFONT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCHOOSEFONTFids(env, lpObject, lpCache);
- lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, lpCache->lStructSize);
- lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndOwner);
- lpStruct->hDC = (HDC)(*env)->GetIntField(env, lpObject, lpCache->hDC);
- lpStruct->lpLogFont = (LPLOGFONT)(*env)->GetIntField(env, lpObject, lpCache->lpLogFont);
- lpStruct->iPointSize = (*env)->GetIntField(env, lpObject, lpCache->iPointSize);
- lpStruct->Flags = (*env)->GetIntField(env, lpObject, lpCache->Flags);
- lpStruct->rgbColors = (*env)->GetIntField(env, lpObject, lpCache->rgbColors);
- lpStruct->lCustData = (*env)->GetIntField(env, lpObject, lpCache->lCustData);
- lpStruct->lpfnHook = (LPCFHOOKPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnHook);
- lpStruct->lpTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpTemplateName);
- lpStruct->hInstance = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->lpszStyle = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszStyle);
- lpStruct->nFontType = (*env)->GetShortField(env, lpObject, lpCache->nFontType);
- lpStruct->nSizeMin = (*env)->GetIntField(env, lpObject, lpCache->nSizeMin);
- lpStruct->nSizeMax = (*env)->GetIntField(env, lpObject, lpCache->nSizeMax);
- return lpStruct;
-}
-
-void setCHOOSEFONTFields(JNIEnv *env, jobject lpObject, CHOOSEFONT *lpStruct, PCHOOSEFONT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCHOOSEFONTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lStructSize, lpStruct->lStructSize);
- (*env)->SetIntField(env, lpObject, lpCache->hwndOwner, (jint)lpStruct->hwndOwner);
- (*env)->SetIntField(env, lpObject, lpCache->hDC, (jint)lpStruct->hDC);
- (*env)->SetIntField(env, lpObject, lpCache->lpLogFont, (jint)lpStruct->lpLogFont);
- (*env)->SetIntField(env, lpObject, lpCache->iPointSize, lpStruct->iPointSize);
- (*env)->SetIntField(env, lpObject, lpCache->Flags, lpStruct->Flags);
- (*env)->SetIntField(env, lpObject, lpCache->rgbColors, lpStruct->rgbColors);
- (*env)->SetIntField(env, lpObject, lpCache->lCustData, lpStruct->lCustData);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnHook, (jint)lpStruct->lpfnHook);
- (*env)->SetIntField(env, lpObject, lpCache->lpTemplateName, (jint)lpStruct->lpTemplateName);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->lpszStyle, (jint)lpStruct->lpszStyle);
- (*env)->SetShortField(env, lpObject, lpCache->nFontType, lpStruct->nFontType);
- (*env)->SetIntField(env, lpObject, lpCache->nSizeMin, lpStruct->nSizeMin);
- (*env)->SetIntField(env, lpObject, lpCache->nSizeMax, lpStruct->nSizeMax);
-}
-
-#endif // _WIN32_WCE
-
-void cacheCOMPOSITIONFORMFids(JNIEnv *env, jobject lpObject, PCOMPOSITIONFORM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwStyle = (*env)->GetFieldID(env, lpCache->clazz, "dwStyle", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->cached = 1;
-}
-
-COMPOSITIONFORM* getCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct, PCOMPOSITIONFORM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCOMPOSITIONFORMFids(env, lpObject, lpCache);
- lpStruct->dwStyle = (*env)->GetIntField(env, lpObject, lpCache->dwStyle);
- lpStruct->ptCurrentPos.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->ptCurrentPos.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->rcArea.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rcArea.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rcArea.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->rcArea.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- return lpStruct;
-}
-
-void setCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct, PCOMPOSITIONFORM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCOMPOSITIONFORMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwStyle, lpStruct->dwStyle);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->ptCurrentPos.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->ptCurrentPos.y);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rcArea.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rcArea.top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rcArea.right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rcArea.bottom);
-}
-
-void cacheCREATESTRUCTFids(JNIEnv *env, jobject lpObject, PCREATESTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lpCreateParams = (*env)->GetFieldID(env, lpCache->clazz, "lpCreateParams", "I");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->hMenu = (*env)->GetFieldID(env, lpCache->clazz, "hMenu", "I");
- lpCache->hwndParent = (*env)->GetFieldID(env, lpCache->clazz, "hwndParent", "I");
- lpCache->cy = (*env)->GetFieldID(env, lpCache->clazz, "cy", "I");
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->style = (*env)->GetFieldID(env, lpCache->clazz, "style", "I");
- lpCache->lpszName = (*env)->GetFieldID(env, lpCache->clazz, "lpszName", "I");
- lpCache->lpszClass = (*env)->GetFieldID(env, lpCache->clazz, "lpszClass", "I");
- lpCache->dwExStyle = (*env)->GetFieldID(env, lpCache->clazz, "dwExStyle", "I");
- lpCache->cached = 1;
-}
-
-CREATESTRUCT* getCREATESTRUCTFields(JNIEnv *env, jobject lpObject, CREATESTRUCT *lpStruct, PCREATESTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCREATESTRUCTFids(env, lpObject, lpCache);
- lpStruct->lpCreateParams = (LPVOID)(*env)->GetIntField(env, lpObject, lpCache->lpCreateParams);
- lpStruct->hInstance = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->hMenu = (HMENU)(*env)->GetIntField(env, lpObject, lpCache->hMenu);
- lpStruct->hwndParent = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndParent);
- lpStruct->cy = (*env)->GetIntField(env, lpObject, lpCache->cy);
- lpStruct->cx = (*env)->GetIntField(env, lpObject, lpCache->cx);
- lpStruct->y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->style = (*env)->GetIntField(env, lpObject, lpCache->style);
- lpStruct->lpszName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszName);
- lpStruct->lpszClass = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszClass);
- lpStruct->dwExStyle = (*env)->GetIntField(env, lpObject, lpCache->dwExStyle);
- return lpStruct;
-}
-
-void setCREATESTRUCTFields(JNIEnv *env, jobject lpObject, CREATESTRUCT *lpStruct, PCREATESTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCREATESTRUCTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lpCreateParams, (jint)lpStruct->lpCreateParams);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->hMenu, (jint)lpStruct->hMenu);
- (*env)->SetIntField(env, lpObject, lpCache->hwndParent, (jint)lpStruct->hwndParent);
- (*env)->SetIntField(env, lpObject, lpCache->cy, lpStruct->cy);
- (*env)->SetIntField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->y);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->x);
- (*env)->SetIntField(env, lpObject, lpCache->style, lpStruct->style);
- (*env)->SetIntField(env, lpObject, lpCache->lpszName, (jint)lpStruct->lpszName);
- (*env)->SetIntField(env, lpObject, lpCache->lpszClass, (jint)lpStruct->lpszClass);
- (*env)->SetIntField(env, lpObject, lpCache->dwExStyle, lpStruct->dwExStyle);
-}
-
-void cacheDIBSECTIONFids(JNIEnv *env, jobject lpObject, PDIBSECTION_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->bmType = (*env)->GetFieldID(env, lpCache->clazz, "bmType", "I");
- lpCache->bmWidth = (*env)->GetFieldID(env, lpCache->clazz, "bmWidth", "I");
- lpCache->bmHeight = (*env)->GetFieldID(env, lpCache->clazz, "bmHeight", "I");
- lpCache->bmWidthBytes = (*env)->GetFieldID(env, lpCache->clazz, "bmWidthBytes", "I");
- lpCache->bmPlanes = (*env)->GetFieldID(env, lpCache->clazz, "bmPlanes", "S");
- lpCache->bmBitsPixel = (*env)->GetFieldID(env, lpCache->clazz, "bmBitsPixel", "S");
- lpCache->bmBits = (*env)->GetFieldID(env, lpCache->clazz, "bmBits", "I");
- lpCache->biSize = (*env)->GetFieldID(env, lpCache->clazz, "biSize", "I");
- lpCache->biWidth = (*env)->GetFieldID(env, lpCache->clazz, "biWidth", "I");
- lpCache->biHeight = (*env)->GetFieldID(env, lpCache->clazz, "biHeight", "I");
- lpCache->biPlanes = (*env)->GetFieldID(env, lpCache->clazz, "biPlanes", "S");
- lpCache->biBitCount = (*env)->GetFieldID(env, lpCache->clazz, "biBitCount", "S");
- lpCache->biCompression = (*env)->GetFieldID(env, lpCache->clazz, "biCompression", "I");
- lpCache->biSizeImage = (*env)->GetFieldID(env, lpCache->clazz, "biSizeImage", "I");
- lpCache->biXPelsPerMeter = (*env)->GetFieldID(env, lpCache->clazz, "biXPelsPerMeter", "I");
- lpCache->biYPelsPerMeter = (*env)->GetFieldID(env, lpCache->clazz, "biYPelsPerMeter", "I");
- lpCache->biClrUsed = (*env)->GetFieldID(env, lpCache->clazz, "biClrUsed", "I");
- lpCache->biClrImportant = (*env)->GetFieldID(env, lpCache->clazz, "biClrImportant", "I");
- lpCache->dsBitfields0 = (*env)->GetFieldID(env, lpCache->clazz, "dsBitfields0", "I");
- lpCache->dsBitfields1 = (*env)->GetFieldID(env, lpCache->clazz, "dsBitfields1", "I");
- lpCache->dsBitfields2 = (*env)->GetFieldID(env, lpCache->clazz, "dsBitfields2", "I");
- lpCache->dshSection = (*env)->GetFieldID(env, lpCache->clazz, "dshSection", "I");
- lpCache->dsOffset = (*env)->GetFieldID(env, lpCache->clazz, "dsOffset", "I");
- lpCache->cached = 1;
-}
-
-DIBSECTION* getDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct, PDIBSECTION_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDIBSECTIONFids(env, lpObject, lpCache);
- lpStruct->dsBm.bmType = (*env)->GetIntField(env, lpObject, lpCache->bmType);
- lpStruct->dsBm.bmWidth = (*env)->GetIntField(env, lpObject, lpCache->bmWidth);
- lpStruct->dsBm.bmHeight = (*env)->GetIntField(env, lpObject, lpCache->bmHeight);
- lpStruct->dsBm.bmWidthBytes = (*env)->GetIntField(env, lpObject, lpCache->bmWidthBytes);
- lpStruct->dsBm.bmPlanes = (*env)->GetShortField(env, lpObject, lpCache->bmPlanes);
- lpStruct->dsBm.bmBitsPixel = (*env)->GetShortField(env, lpObject, lpCache->bmBitsPixel);
- lpStruct->dsBm.bmBits = (LPVOID)(*env)->GetIntField(env, lpObject, lpCache->bmBits);
- lpStruct->dsBmih.biSize = (*env)->GetIntField(env, lpObject, lpCache->biSize);
- lpStruct->dsBmih.biWidth = (*env)->GetIntField(env, lpObject, lpCache->biWidth);
- lpStruct->dsBmih.biHeight = (*env)->GetIntField(env, lpObject, lpCache->biHeight);
- lpStruct->dsBmih.biPlanes = (*env)->GetShortField(env, lpObject, lpCache->biPlanes);
- lpStruct->dsBmih.biBitCount = (*env)->GetShortField(env, lpObject, lpCache->biBitCount);
- lpStruct->dsBmih.biCompression = (*env)->GetIntField(env, lpObject, lpCache->biCompression);
- lpStruct->dsBmih.biSizeImage = (*env)->GetIntField(env, lpObject, lpCache->biSizeImage);
- lpStruct->dsBmih.biXPelsPerMeter = (*env)->GetIntField(env, lpObject, lpCache->biXPelsPerMeter);
- lpStruct->dsBmih.biYPelsPerMeter = (*env)->GetIntField(env, lpObject, lpCache->biYPelsPerMeter);
- lpStruct->dsBmih.biClrUsed = (*env)->GetIntField(env, lpObject, lpCache->biClrUsed);
- lpStruct->dsBmih.biClrImportant = (*env)->GetIntField(env, lpObject, lpCache->biClrImportant);
- lpStruct->dsBitfields[0] = (*env)->GetIntField(env, lpObject, lpCache->dsBitfields0);
- lpStruct->dsBitfields[1] = (*env)->GetIntField(env, lpObject, lpCache->dsBitfields1);
- lpStruct->dsBitfields[2] = (*env)->GetIntField(env, lpObject, lpCache->dsBitfields2);
- lpStruct->dshSection = (HANDLE)(*env)->GetIntField(env, lpObject, lpCache->dshSection);
- lpStruct->dsOffset = (*env)->GetIntField(env, lpObject, lpCache->dsOffset);
- return lpStruct;
-}
-
-void setDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct, PDIBSECTION_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDIBSECTIONFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->bmType, lpStruct->dsBm.bmType);
- (*env)->SetIntField(env, lpObject, lpCache->bmWidth, lpStruct->dsBm.bmWidth);
- (*env)->SetIntField(env, lpObject, lpCache->bmHeight, lpStruct->dsBm.bmHeight);
- (*env)->SetIntField(env, lpObject, lpCache->bmWidthBytes, lpStruct->dsBm.bmWidthBytes);
- (*env)->SetShortField(env, lpObject, lpCache->bmPlanes, lpStruct->dsBm.bmPlanes);
- (*env)->SetShortField(env, lpObject, lpCache->bmBitsPixel, lpStruct->dsBm.bmBitsPixel);
- (*env)->SetIntField(env, lpObject, lpCache->bmBits, (jint)lpStruct->dsBm.bmBits);
- (*env)->SetIntField(env, lpObject, lpCache->biSize, lpStruct->dsBmih.biSize);
- (*env)->SetIntField(env, lpObject, lpCache->biWidth, lpStruct->dsBmih.biWidth);
- (*env)->SetIntField(env, lpObject, lpCache->biHeight, lpStruct->dsBmih.biHeight);
- (*env)->SetShortField(env, lpObject, lpCache->biPlanes, lpStruct->dsBmih.biPlanes);
- (*env)->SetShortField(env, lpObject, lpCache->biBitCount, lpStruct->dsBmih.biBitCount);
- (*env)->SetIntField(env, lpObject, lpCache->biCompression, lpStruct->dsBmih.biCompression);
- (*env)->SetIntField(env, lpObject, lpCache->biSizeImage, lpStruct->dsBmih.biSizeImage);
- (*env)->SetIntField(env, lpObject, lpCache->biXPelsPerMeter, lpStruct->dsBmih.biXPelsPerMeter);
- (*env)->SetIntField(env, lpObject, lpCache->biYPelsPerMeter, lpStruct->dsBmih.biYPelsPerMeter);
- (*env)->SetIntField(env, lpObject, lpCache->biClrUsed, lpStruct->dsBmih.biClrUsed);
- (*env)->SetIntField(env, lpObject, lpCache->biClrImportant, lpStruct->dsBmih.biClrImportant);
- (*env)->SetIntField(env, lpObject, lpCache->dsBitfields0, lpStruct->dsBitfields[0]);
- (*env)->SetIntField(env, lpObject, lpCache->dsBitfields1, lpStruct->dsBitfields[1]);
- (*env)->SetIntField(env, lpObject, lpCache->dsBitfields2, lpStruct->dsBitfields[2]);
- (*env)->SetIntField(env, lpObject, lpCache->dshSection, (jint)lpStruct->dshSection);
- (*env)->SetIntField(env, lpObject, lpCache->dsOffset, lpStruct->dsOffset);
-}
-
-void cacheDLLVERSIONINFOFids(JNIEnv *env, jobject lpObject, PDLLVERSIONINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->dwMajorVersion = (*env)->GetFieldID(env, lpCache->clazz, "dwMajorVersion", "I");
- lpCache->dwMinorVersion = (*env)->GetFieldID(env, lpCache->clazz, "dwMinorVersion", "I");
- lpCache->dwBuildNumber = (*env)->GetFieldID(env, lpCache->clazz, "dwBuildNumber", "I");
- lpCache->dwPlatformID = (*env)->GetFieldID(env, lpCache->clazz, "dwPlatformID", "I");
- lpCache->cached = 1;
-}
-
-DLLVERSIONINFO* getDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct, PDLLVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDLLVERSIONINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMajorVersion);
- lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMinorVersion);
- lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, lpCache->dwBuildNumber);
- lpStruct->dwPlatformID = (*env)->GetIntField(env, lpObject, lpCache->dwPlatformID);
- return lpStruct;
-}
-
-void setDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct, PDLLVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDLLVERSIONINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwMajorVersion, lpStruct->dwMajorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwMinorVersion, lpStruct->dwMinorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwBuildNumber, lpStruct->dwBuildNumber);
- (*env)->SetIntField(env, lpObject, lpCache->dwPlatformID, lpStruct->dwPlatformID);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheDOCINFOFids(JNIEnv *env, jobject lpObject, PDOCINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->lpszDocName = (*env)->GetFieldID(env, lpCache->clazz, "lpszDocName", "I");
- lpCache->lpszOutput = (*env)->GetFieldID(env, lpCache->clazz, "lpszOutput", "I");
- lpCache->lpszDatatype = (*env)->GetFieldID(env, lpCache->clazz, "lpszDatatype", "I");
- lpCache->fwType = (*env)->GetFieldID(env, lpCache->clazz, "fwType", "I");
- lpCache->cached = 1;
-}
-
-DOCINFO* getDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct, PDOCINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDOCINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->lpszDocName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszDocName);
- lpStruct->lpszOutput = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszOutput);
- lpStruct->lpszDatatype = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszDatatype);
- lpStruct->fwType = (*env)->GetIntField(env, lpObject, lpCache->fwType);
- return lpStruct;
-}
-
-void setDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct, PDOCINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDOCINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->lpszDocName, (jint)lpStruct->lpszDocName);
- (*env)->SetIntField(env, lpObject, lpCache->lpszOutput, (jint)lpStruct->lpszOutput);
- (*env)->SetIntField(env, lpObject, lpCache->lpszDatatype, (jint)lpStruct->lpszDatatype);
- (*env)->SetIntField(env, lpObject, lpCache->fwType, lpStruct->fwType);
-}
-
-#endif // _WIN32_WCE
-
-void cacheDRAWITEMSTRUCTFids(JNIEnv *env, jobject lpObject, PDRAWITEMSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->CtlType = (*env)->GetFieldID(env, lpCache->clazz, "CtlType", "I");
- lpCache->CtlID = (*env)->GetFieldID(env, lpCache->clazz, "CtlID", "I");
- lpCache->itemID = (*env)->GetFieldID(env, lpCache->clazz, "itemID", "I");
- lpCache->itemAction = (*env)->GetFieldID(env, lpCache->clazz, "itemAction", "I");
- lpCache->itemState = (*env)->GetFieldID(env, lpCache->clazz, "itemState", "I");
- lpCache->hwndItem = (*env)->GetFieldID(env, lpCache->clazz, "hwndItem", "I");
- lpCache->hDC = (*env)->GetFieldID(env, lpCache->clazz, "hDC", "I");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->itemData = (*env)->GetFieldID(env, lpCache->clazz, "itemData", "I");
- lpCache->cached = 1;
-}
-
-DRAWITEMSTRUCT* getDRAWITEMSTRUCTFields(JNIEnv *env, jobject lpObject, DRAWITEMSTRUCT *lpStruct, PDRAWITEMSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDRAWITEMSTRUCTFids(env, lpObject, lpCache);
- lpStruct->CtlType = (*env)->GetIntField(env, lpObject, lpCache->CtlType);
- lpStruct->CtlID = (*env)->GetIntField(env, lpObject, lpCache->CtlID);
- lpStruct->itemID = (*env)->GetIntField(env, lpObject, lpCache->itemID);
- lpStruct->itemAction = (*env)->GetIntField(env, lpObject, lpCache->itemAction);
- lpStruct->itemState = (*env)->GetIntField(env, lpObject, lpCache->itemState);
- lpStruct->hwndItem = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndItem);
- lpStruct->hDC = (HDC)(*env)->GetIntField(env, lpObject, lpCache->hDC);
- lpStruct->rcItem.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rcItem.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rcItem.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- lpStruct->rcItem.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->itemData = (*env)->GetIntField(env, lpObject, lpCache->itemData);
- return lpStruct;
-}
-
-void setDRAWITEMSTRUCTFields(JNIEnv *env, jobject lpObject, DRAWITEMSTRUCT *lpStruct, PDRAWITEMSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDRAWITEMSTRUCTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->CtlType, lpStruct->CtlType);
- (*env)->SetIntField(env, lpObject, lpCache->CtlID, lpStruct->CtlID);
- (*env)->SetIntField(env, lpObject, lpCache->itemID, lpStruct->itemID);
- (*env)->SetIntField(env, lpObject, lpCache->itemAction, lpStruct->itemAction);
- (*env)->SetIntField(env, lpObject, lpCache->itemState, lpStruct->itemState);
- (*env)->SetIntField(env, lpObject, lpCache->hwndItem, (jint)lpStruct->hwndItem);
- (*env)->SetIntField(env, lpObject, lpCache->hDC, (jint)lpStruct->hDC);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rcItem.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rcItem.top);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rcItem.bottom);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rcItem.right);
- (*env)->SetIntField(env, lpObject, lpCache->itemData, lpStruct->itemData);
-}
-
-void cacheFILETIMEFids(JNIEnv *env, jobject lpObject, PFILETIME_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwLowDateTime = (*env)->GetFieldID(env, lpCache->clazz, "dwLowDateTime", "I");
- lpCache->dwHighDateTime = (*env)->GetFieldID(env, lpCache->clazz, "dwHighDateTime", "I");
- lpCache->cached = 1;
-}
-
-FILETIME* getFILETIMEFields(JNIEnv *env, jobject lpObject, FILETIME *lpStruct, PFILETIME_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFILETIMEFids(env, lpObject, lpCache);
- lpStruct->dwLowDateTime = (*env)->GetIntField(env, lpObject, lpCache->dwLowDateTime);
- lpStruct->dwHighDateTime = (*env)->GetIntField(env, lpObject, lpCache->dwHighDateTime);
- return lpStruct;
-}
-
-void setFILETIMEFields(JNIEnv *env, jobject lpObject, FILETIME *lpStruct, PFILETIME_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFILETIMEFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwLowDateTime, lpStruct->dwLowDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->dwHighDateTime, lpStruct->dwHighDateTime);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheGCP_RESULTSFids(JNIEnv *env, jobject lpObject, PGCP_RESULTS_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lStructSize = (*env)->GetFieldID(env, lpCache->clazz, "lStructSize", "I");
- lpCache->lpOutString = (*env)->GetFieldID(env, lpCache->clazz, "lpOutString", "I");
- lpCache->lpOrder = (*env)->GetFieldID(env, lpCache->clazz, "lpOrder", "I");
- lpCache->lpDx = (*env)->GetFieldID(env, lpCache->clazz, "lpDx", "I");
- lpCache->lpCaretPos = (*env)->GetFieldID(env, lpCache->clazz, "lpCaretPos", "I");
- lpCache->lpClass = (*env)->GetFieldID(env, lpCache->clazz, "lpClass", "I");
- lpCache->lpGlyphs = (*env)->GetFieldID(env, lpCache->clazz, "lpGlyphs", "I");
- lpCache->nGlyphs = (*env)->GetFieldID(env, lpCache->clazz, "nGlyphs", "I");
- lpCache->nMaxFit = (*env)->GetFieldID(env, lpCache->clazz, "nMaxFit", "I");
- lpCache->cached = 1;
-}
-
-GCP_RESULTS* getGCP_RESULTSFields(JNIEnv *env, jobject lpObject, GCP_RESULTS *lpStruct, PGCP_RESULTS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGCP_RESULTSFids(env, lpObject, lpCache);
- lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, lpCache->lStructSize);
- lpStruct->lpOutString = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpOutString);
- lpStruct->lpOrder = (UINT *)(*env)->GetIntField(env, lpObject, lpCache->lpOrder);
- lpStruct->lpDx = (int *)(*env)->GetIntField(env, lpObject, lpCache->lpDx);
- lpStruct->lpCaretPos = (int *)(*env)->GetIntField(env, lpObject, lpCache->lpCaretPos);
- lpStruct->lpClass = (LPSTR)(*env)->GetIntField(env, lpObject, lpCache->lpClass);
- lpStruct->lpGlyphs = (LPWSTR)(*env)->GetIntField(env, lpObject, lpCache->lpGlyphs);
- lpStruct->nGlyphs = (*env)->GetIntField(env, lpObject, lpCache->nGlyphs);
- lpStruct->nMaxFit = (*env)->GetIntField(env, lpObject, lpCache->nMaxFit);
- return lpStruct;
-}
-
-void setGCP_RESULTSFields(JNIEnv *env, jobject lpObject, GCP_RESULTS *lpStruct, PGCP_RESULTS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGCP_RESULTSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lStructSize, lpStruct->lStructSize);
- (*env)->SetIntField(env, lpObject, lpCache->lpOutString, (jint)lpStruct->lpOutString);
- (*env)->SetIntField(env, lpObject, lpCache->lpOrder, (jint)lpStruct->lpOrder);
- (*env)->SetIntField(env, lpObject, lpCache->lpDx, (jint)lpStruct->lpDx);
- (*env)->SetIntField(env, lpObject, lpCache->lpCaretPos, (jint)lpStruct->lpCaretPos);
- (*env)->SetIntField(env, lpObject, lpCache->lpClass, (jint)lpStruct->lpClass);
- (*env)->SetIntField(env, lpObject, lpCache->lpGlyphs, (jint)lpStruct->lpGlyphs);
- (*env)->SetIntField(env, lpObject, lpCache->nGlyphs, lpStruct->nGlyphs);
- (*env)->SetIntField(env, lpObject, lpCache->nMaxFit, lpStruct->nMaxFit);
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-void cacheGRADIENT_RECTFids(JNIEnv *env, jobject lpObject, PGRADIENT_RECT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->UpperLeft = (*env)->GetFieldID(env, lpCache->clazz, "UpperLeft", "I");
- lpCache->LowerRight = (*env)->GetFieldID(env, lpCache->clazz, "LowerRight", "I");
- lpCache->cached = 1;
-}
-
-GRADIENT_RECT* getGRADIENT_RECTFields(JNIEnv *env, jobject lpObject, GRADIENT_RECT *lpStruct, PGRADIENT_RECT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGRADIENT_RECTFids(env, lpObject, lpCache);
- lpStruct->UpperLeft = (*env)->GetIntField(env, lpObject, lpCache->UpperLeft);
- lpStruct->LowerRight = (*env)->GetIntField(env, lpObject, lpCache->LowerRight);
- return lpStruct;
-}
-
-void setGRADIENT_RECTFields(JNIEnv *env, jobject lpObject, GRADIENT_RECT *lpStruct, PGRADIENT_RECT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGRADIENT_RECTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->UpperLeft, lpStruct->UpperLeft);
- (*env)->SetIntField(env, lpObject, lpCache->LowerRight, lpStruct->LowerRight);
-}
-
-#endif // _WIN32_WCE
-
-void cacheHDITEMFids(JNIEnv *env, jobject lpObject, PHDITEM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->cxy = (*env)->GetFieldID(env, lpCache->clazz, "cxy", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->hbm = (*env)->GetFieldID(env, lpCache->clazz, "hbm", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->fmt = (*env)->GetFieldID(env, lpCache->clazz, "fmt", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->iOrder = (*env)->GetFieldID(env, lpCache->clazz, "iOrder", "I");
- lpCache->cached = 1;
-}
-
-HDITEM* getHDITEMFields(JNIEnv *env, jobject lpObject, HDITEM *lpStruct, PHDITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheHDITEMFids(env, lpObject, lpCache);
- lpStruct->mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->cxy = (*env)->GetIntField(env, lpObject, lpCache->cxy);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->hbm = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbm);
- lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->fmt = (*env)->GetIntField(env, lpObject, lpCache->fmt);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->iOrder = (*env)->GetIntField(env, lpObject, lpCache->iOrder);
- return lpStruct;
-}
-
-void setHDITEMFields(JNIEnv *env, jobject lpObject, HDITEM *lpStruct, PHDITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheHDITEMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->mask);
- (*env)->SetIntField(env, lpObject, lpCache->cxy, lpStruct->cxy);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->hbm, (jint)lpStruct->hbm);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->fmt, lpStruct->fmt);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->iOrder, lpStruct->iOrder);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheHELPINFOFids(JNIEnv *env, jobject lpObject, PHELPINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->iContextType = (*env)->GetFieldID(env, lpCache->clazz, "iContextType", "I");
- lpCache->iCtrlId = (*env)->GetFieldID(env, lpCache->clazz, "iCtrlId", "I");
- lpCache->hItemHandle = (*env)->GetFieldID(env, lpCache->clazz, "hItemHandle", "I");
- lpCache->dwContextId = (*env)->GetFieldID(env, lpCache->clazz, "dwContextId", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->cached = 1;
-}
-
-HELPINFO* getHELPINFOFields(JNIEnv *env, jobject lpObject, HELPINFO *lpStruct, PHELPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheHELPINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->iContextType = (*env)->GetIntField(env, lpObject, lpCache->iContextType);
- lpStruct->iCtrlId = (*env)->GetIntField(env, lpObject, lpCache->iCtrlId);
- lpStruct->hItemHandle = (HANDLE)(*env)->GetIntField(env, lpObject, lpCache->hItemHandle);
- lpStruct->dwContextId = (*env)->GetIntField(env, lpObject, lpCache->dwContextId);
- lpStruct->MousePos.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->MousePos.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- return lpStruct;
-}
-
-void setHELPINFOFields(JNIEnv *env, jobject lpObject, HELPINFO *lpStruct, PHELPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheHELPINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->iContextType, lpStruct->iContextType);
- (*env)->SetIntField(env, lpObject, lpCache->iCtrlId, lpStruct->iCtrlId);
- (*env)->SetIntField(env, lpObject, lpCache->hItemHandle, (jint)lpStruct->hItemHandle);
- (*env)->SetIntField(env, lpObject, lpCache->dwContextId, lpStruct->dwContextId);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->MousePos.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->MousePos.y);
-}
-
-#endif // _WIN32_WCE
-
-void cacheICONINFOFids(JNIEnv *env, jobject lpObject, PICONINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->fIcon = (*env)->GetFieldID(env, lpCache->clazz, "fIcon", "Z");
- lpCache->xHotspot = (*env)->GetFieldID(env, lpCache->clazz, "xHotspot", "I");
- lpCache->yHotspot = (*env)->GetFieldID(env, lpCache->clazz, "yHotspot", "I");
- lpCache->hbmMask = (*env)->GetFieldID(env, lpCache->clazz, "hbmMask", "I");
- lpCache->hbmColor = (*env)->GetFieldID(env, lpCache->clazz, "hbmColor", "I");
- lpCache->cached = 1;
-}
-
-ICONINFO* getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct, PICONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheICONINFOFids(env, lpObject, lpCache);
- lpStruct->fIcon = (*env)->GetBooleanField(env, lpObject, lpCache->fIcon);
- lpStruct->xHotspot = (*env)->GetIntField(env, lpObject, lpCache->xHotspot);
- lpStruct->yHotspot = (*env)->GetIntField(env, lpObject, lpCache->yHotspot);
- lpStruct->hbmMask = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmMask);
- lpStruct->hbmColor = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmColor);
- return lpStruct;
-}
-
-void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct, PICONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheICONINFOFids(env, lpObject, lpCache);
- (*env)->SetBooleanField(env, lpObject, lpCache->fIcon, (jboolean)lpStruct->fIcon);
- (*env)->SetIntField(env, lpObject, lpCache->xHotspot, lpStruct->xHotspot);
- (*env)->SetIntField(env, lpObject, lpCache->yHotspot, lpStruct->yHotspot);
- (*env)->SetIntField(env, lpObject, lpCache->hbmMask, (jint)lpStruct->hbmMask);
- (*env)->SetIntField(env, lpObject, lpCache->hbmColor, (jint)lpStruct->hbmColor);
-}
-
-void cacheINITCOMMONCONTROLSEXFids(JNIEnv *env, jobject lpObject, PINITCOMMONCONTROLSEX_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwSize = (*env)->GetFieldID(env, lpCache->clazz, "dwSize", "I");
- lpCache->dwICC = (*env)->GetFieldID(env, lpCache->clazz, "dwICC", "I");
- lpCache->cached = 1;
-}
-
-INITCOMMONCONTROLSEX* getINITCOMMONCONTROLSEXFields(JNIEnv *env, jobject lpObject, INITCOMMONCONTROLSEX *lpStruct, PINITCOMMONCONTROLSEX_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheINITCOMMONCONTROLSEXFids(env, lpObject, lpCache);
- lpStruct->dwSize = (*env)->GetIntField(env, lpObject, lpCache->dwSize);
- lpStruct->dwICC = (*env)->GetIntField(env, lpObject, lpCache->dwICC);
- return lpStruct;
-}
-
-void setINITCOMMONCONTROLSEXFields(JNIEnv *env, jobject lpObject, INITCOMMONCONTROLSEX *lpStruct, PINITCOMMONCONTROLSEX_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheINITCOMMONCONTROLSEXFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwSize, lpStruct->dwSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwICC, lpStruct->dwICC);
-}
-
-void cacheLOGBRUSHFids(JNIEnv *env, jobject lpObject, PLOGBRUSH_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lbStyle = (*env)->GetFieldID(env, lpCache->clazz, "lbStyle", "I");
- lpCache->lbColor = (*env)->GetFieldID(env, lpCache->clazz, "lbColor", "I");
- lpCache->lbHatch = (*env)->GetFieldID(env, lpCache->clazz, "lbHatch", "I");
- lpCache->cached = 1;
-}
-
-LOGBRUSH* getLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct, PLOGBRUSH_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGBRUSHFids(env, lpObject, lpCache);
- lpStruct->lbStyle = (*env)->GetIntField(env, lpObject, lpCache->lbStyle);
- lpStruct->lbColor = (*env)->GetIntField(env, lpObject, lpCache->lbColor);
- lpStruct->lbHatch = (*env)->GetIntField(env, lpObject, lpCache->lbHatch);
- return lpStruct;
-}
-
-void setLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct, PLOGBRUSH_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGBRUSHFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lbStyle, lpStruct->lbStyle);
- (*env)->SetIntField(env, lpObject, lpCache->lbColor, lpStruct->lbColor);
- (*env)->SetIntField(env, lpObject, lpCache->lbHatch, lpStruct->lbHatch);
-}
-
-void cacheLOGFONTFids(JNIEnv *env, jobject lpObject, PLOGFONT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lfHeight = (*env)->GetFieldID(env, lpCache->clazz, "lfHeight", "I");
- lpCache->lfWidth = (*env)->GetFieldID(env, lpCache->clazz, "lfWidth", "I");
- lpCache->lfEscapement = (*env)->GetFieldID(env, lpCache->clazz, "lfEscapement", "I");
- lpCache->lfOrientation = (*env)->GetFieldID(env, lpCache->clazz, "lfOrientation", "I");
- lpCache->lfWeight = (*env)->GetFieldID(env, lpCache->clazz, "lfWeight", "I");
- lpCache->lfItalic = (*env)->GetFieldID(env, lpCache->clazz, "lfItalic", "B");
- lpCache->lfUnderline = (*env)->GetFieldID(env, lpCache->clazz, "lfUnderline", "B");
- lpCache->lfStrikeOut = (*env)->GetFieldID(env, lpCache->clazz, "lfStrikeOut", "B");
- lpCache->lfCharSet = (*env)->GetFieldID(env, lpCache->clazz, "lfCharSet", "B");
- lpCache->lfOutPrecision = (*env)->GetFieldID(env, lpCache->clazz, "lfOutPrecision", "B");
- lpCache->lfClipPrecision = (*env)->GetFieldID(env, lpCache->clazz, "lfClipPrecision", "B");
- lpCache->lfQuality = (*env)->GetFieldID(env, lpCache->clazz, "lfQuality", "B");
- lpCache->lfPitchAndFamily = (*env)->GetFieldID(env, lpCache->clazz, "lfPitchAndFamily", "B");
- lpCache->lfFaceName0 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName0", "C");
- lpCache->lfFaceName1 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName1", "C");
- lpCache->lfFaceName2 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName2", "C");
- lpCache->lfFaceName3 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName3", "C");
- lpCache->lfFaceName4 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName4", "C");
- lpCache->lfFaceName5 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName5", "C");
- lpCache->lfFaceName6 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName6", "C");
- lpCache->lfFaceName7 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName7", "C");
- lpCache->lfFaceName8 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName8", "C");
- lpCache->lfFaceName9 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName9", "C");
- lpCache->lfFaceName10 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName10", "C");
- lpCache->lfFaceName11 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName11", "C");
- lpCache->lfFaceName12 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName12", "C");
- lpCache->lfFaceName13 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName13", "C");
- lpCache->lfFaceName14 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName14", "C");
- lpCache->lfFaceName15 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName15", "C");
- lpCache->lfFaceName16 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName16", "C");
- lpCache->lfFaceName17 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName17", "C");
- lpCache->lfFaceName18 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName18", "C");
- lpCache->lfFaceName19 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName19", "C");
- lpCache->lfFaceName20 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName20", "C");
- lpCache->lfFaceName21 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName21", "C");
- lpCache->lfFaceName22 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName22", "C");
- lpCache->lfFaceName23 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName23", "C");
- lpCache->lfFaceName24 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName24", "C");
- lpCache->lfFaceName25 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName25", "C");
- lpCache->lfFaceName26 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName26", "C");
- lpCache->lfFaceName27 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName27", "C");
- lpCache->lfFaceName28 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName28", "C");
- lpCache->lfFaceName29 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName29", "C");
- lpCache->lfFaceName30 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName30", "C");
- lpCache->lfFaceName31 = (*env)->GetFieldID(env, lpCache->clazz, "lfFaceName31", "C");
- lpCache->cached = 1;
-}
-
-#ifndef _WIN32_WCE
-
-LOGFONTA* getLOGFONTAFields(JNIEnv *env, jobject lpObject, LOGFONTA *lpStruct, LOGFONT_FID_CACHE *lpCache)
-{
- if (!lpCache->cached) cacheLOGFONTFids(env, lpObject, lpCache);
- lpStruct->lfHeight = (*env)->GetIntField(env,lpObject,lpCache->lfHeight);
- lpStruct->lfWidth = (*env)->GetIntField(env,lpObject,lpCache->lfWidth);
- lpStruct->lfEscapement = (*env)->GetIntField(env,lpObject,lpCache->lfEscapement);
- lpStruct->lfOrientation = (*env)->GetIntField(env,lpObject,lpCache->lfOrientation);
- lpStruct->lfWeight = (*env)->GetIntField(env,lpObject,lpCache->lfWeight);
- lpStruct->lfItalic = (*env)->GetByteField(env,lpObject,lpCache->lfItalic);
- lpStruct->lfUnderline = (*env)->GetByteField(env,lpObject,lpCache->lfUnderline);
- lpStruct->lfStrikeOut = (*env)->GetByteField(env,lpObject,lpCache->lfStrikeOut);
- lpStruct->lfCharSet = (*env)->GetByteField(env,lpObject,lpCache->lfCharSet);
- lpStruct->lfOutPrecision = (*env)->GetByteField(env,lpObject,lpCache->lfOutPrecision);
- lpStruct->lfClipPrecision = (*env)->GetByteField(env,lpObject,lpCache->lfClipPrecision);
- lpStruct->lfQuality = (*env)->GetByteField(env,lpObject,lpCache->lfQuality);
- lpStruct->lfPitchAndFamily = (*env)->GetByteField(env,lpObject,lpCache->lfPitchAndFamily);
- {
- WCHAR lfFaceName [32];
- lfFaceName[0] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName0);
- lfFaceName[1] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName1);
- lfFaceName[2] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName2);
- lfFaceName[3] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName3);
- lfFaceName[4] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName4);
- lfFaceName[5] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName5);
- lfFaceName[6] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName6);
- lfFaceName[7] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName7);
- lfFaceName[8] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName8);
- lfFaceName[9] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName9);
- lfFaceName[10] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName10);
- lfFaceName[11] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName11);
- lfFaceName[12] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName12);
- lfFaceName[13] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName13);
- lfFaceName[14] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName14);
- lfFaceName[15] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName15);
- lfFaceName[16] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName16);
- lfFaceName[17] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName17);
- lfFaceName[18] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName18);
- lfFaceName[19] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName19);
- lfFaceName[20] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName20);
- lfFaceName[21] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName21);
- lfFaceName[22] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName22);
- lfFaceName[23] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName23);
- lfFaceName[24] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName24);
- lfFaceName[25] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName25);
- lfFaceName[26] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName26);
- lfFaceName[27] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName27);
- lfFaceName[28] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName28);
- lfFaceName[29] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName29);
- lfFaceName[30] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName30);
- lfFaceName[31] = (*env)->GetCharField(env,lpObject,lpCache->lfFaceName31);
- WideCharToMultiByte (CP_ACP, 0, lfFaceName, 32, lpStruct->lfFaceName, 32, NULL, NULL);
- }
- return lpStruct;
-}
-
-void setLOGFONTAFields(JNIEnv *env, jobject lpObject, LOGFONTA *lpStruct, LOGFONT_FID_CACHE *lpCache)
-{
- if (!lpCache->cached) cacheLOGFONTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env,lpObject,lpCache->lfHeight, lpStruct->lfHeight);
- (*env)->SetIntField(env,lpObject,lpCache->lfWidth, lpStruct->lfWidth);
- (*env)->SetIntField(env,lpObject,lpCache->lfEscapement, lpStruct->lfEscapement);
- (*env)->SetIntField(env,lpObject,lpCache->lfOrientation, lpStruct->lfOrientation);
- (*env)->SetIntField(env,lpObject,lpCache->lfWeight, lpStruct->lfWeight);
- (*env)->SetByteField(env,lpObject,lpCache->lfItalic, lpStruct->lfItalic);
- (*env)->SetByteField(env,lpObject,lpCache->lfUnderline, lpStruct->lfUnderline);
- (*env)->SetByteField(env,lpObject,lpCache->lfStrikeOut, lpStruct->lfStrikeOut);
- (*env)->SetByteField(env,lpObject,lpCache->lfCharSet, lpStruct->lfCharSet);
- (*env)->SetByteField(env,lpObject,lpCache->lfOutPrecision, lpStruct->lfOutPrecision);
- (*env)->SetByteField(env,lpObject,lpCache->lfClipPrecision, lpStruct->lfClipPrecision);
- (*env)->SetByteField(env,lpObject,lpCache->lfQuality, lpStruct->lfQuality);
- (*env)->SetByteField(env,lpObject,lpCache->lfPitchAndFamily, lpStruct->lfPitchAndFamily);
- {
- WCHAR lfFaceName [32] = {0};
- MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, lpStruct->lfFaceName, -1, lfFaceName, 32);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName0, lfFaceName[0]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName1, lfFaceName[1]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName2, lfFaceName[2]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName3, lfFaceName[3]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName4, lfFaceName[4]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName5, lfFaceName[5]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName6, lfFaceName[6]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName7, lfFaceName[7]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName8, lfFaceName[8]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName9, lfFaceName[9]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName10, lfFaceName[10]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName11, lfFaceName[11]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName12, lfFaceName[12]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName13, lfFaceName[13]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName14, lfFaceName[14]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName15, lfFaceName[15]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName16, lfFaceName[16]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName17, lfFaceName[17]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName18, lfFaceName[18]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName19, lfFaceName[19]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName20, lfFaceName[20]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName21, lfFaceName[21]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName22, lfFaceName[22]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName23, lfFaceName[23]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName24, lfFaceName[24]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName25, lfFaceName[25]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName26, lfFaceName[26]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName27, lfFaceName[27]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName28, lfFaceName[28]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName29, lfFaceName[29]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName30, lfFaceName[30]);
- (*env)->SetCharField(env,lpObject,lpCache->lfFaceName31, lfFaceName[31]);
- }
-}
-
-#endif // _WIN32_WCE
-
-LOGFONTW* getLOGFONTWFields(JNIEnv *env, jobject lpObject, LOGFONTW *lpStruct, PLOGFONT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGFONTFids(env, lpObject, lpCache);
- lpStruct->lfHeight = (*env)->GetIntField(env, lpObject, lpCache->lfHeight);
- lpStruct->lfWidth = (*env)->GetIntField(env, lpObject, lpCache->lfWidth);
- lpStruct->lfEscapement = (*env)->GetIntField(env, lpObject, lpCache->lfEscapement);
- lpStruct->lfOrientation = (*env)->GetIntField(env, lpObject, lpCache->lfOrientation);
- lpStruct->lfWeight = (*env)->GetIntField(env, lpObject, lpCache->lfWeight);
- lpStruct->lfItalic = (*env)->GetByteField(env, lpObject, lpCache->lfItalic);
- lpStruct->lfUnderline = (*env)->GetByteField(env, lpObject, lpCache->lfUnderline);
- lpStruct->lfStrikeOut = (*env)->GetByteField(env, lpObject, lpCache->lfStrikeOut);
- lpStruct->lfCharSet = (*env)->GetByteField(env, lpObject, lpCache->lfCharSet);
- lpStruct->lfOutPrecision = (*env)->GetByteField(env, lpObject, lpCache->lfOutPrecision);
- lpStruct->lfClipPrecision = (*env)->GetByteField(env, lpObject, lpCache->lfClipPrecision);
- lpStruct->lfQuality = (*env)->GetByteField(env, lpObject, lpCache->lfQuality);
- lpStruct->lfPitchAndFamily = (*env)->GetByteField(env, lpObject, lpCache->lfPitchAndFamily);
- lpStruct->lfFaceName[0] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName0);
- lpStruct->lfFaceName[1] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName1);
- lpStruct->lfFaceName[2] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName2);
- lpStruct->lfFaceName[3] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName3);
- lpStruct->lfFaceName[4] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName4);
- lpStruct->lfFaceName[5] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName5);
- lpStruct->lfFaceName[6] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName6);
- lpStruct->lfFaceName[7] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName7);
- lpStruct->lfFaceName[8] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName8);
- lpStruct->lfFaceName[9] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName9);
- lpStruct->lfFaceName[10] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName10);
- lpStruct->lfFaceName[11] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName11);
- lpStruct->lfFaceName[12] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName12);
- lpStruct->lfFaceName[13] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName13);
- lpStruct->lfFaceName[14] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName14);
- lpStruct->lfFaceName[15] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName15);
- lpStruct->lfFaceName[16] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName16);
- lpStruct->lfFaceName[17] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName17);
- lpStruct->lfFaceName[18] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName18);
- lpStruct->lfFaceName[19] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName19);
- lpStruct->lfFaceName[20] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName20);
- lpStruct->lfFaceName[21] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName21);
- lpStruct->lfFaceName[22] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName22);
- lpStruct->lfFaceName[23] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName23);
- lpStruct->lfFaceName[24] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName24);
- lpStruct->lfFaceName[25] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName25);
- lpStruct->lfFaceName[26] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName26);
- lpStruct->lfFaceName[27] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName27);
- lpStruct->lfFaceName[28] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName28);
- lpStruct->lfFaceName[29] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName29);
- lpStruct->lfFaceName[30] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName30);
- lpStruct->lfFaceName[31] = (*env)->GetCharField(env, lpObject, lpCache->lfFaceName31);
- return lpStruct;
-}
-
-void setLOGFONTWFields(JNIEnv *env, jobject lpObject, LOGFONTW *lpStruct, PLOGFONT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGFONTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lfHeight, lpStruct->lfHeight);
- (*env)->SetIntField(env, lpObject, lpCache->lfWidth, lpStruct->lfWidth);
- (*env)->SetIntField(env, lpObject, lpCache->lfEscapement, lpStruct->lfEscapement);
- (*env)->SetIntField(env, lpObject, lpCache->lfOrientation, lpStruct->lfOrientation);
- (*env)->SetIntField(env, lpObject, lpCache->lfWeight, lpStruct->lfWeight);
- (*env)->SetByteField(env, lpObject, lpCache->lfItalic, lpStruct->lfItalic);
- (*env)->SetByteField(env, lpObject, lpCache->lfUnderline, lpStruct->lfUnderline);
- (*env)->SetByteField(env, lpObject, lpCache->lfStrikeOut, lpStruct->lfStrikeOut);
- (*env)->SetByteField(env, lpObject, lpCache->lfCharSet, lpStruct->lfCharSet);
- (*env)->SetByteField(env, lpObject, lpCache->lfOutPrecision, lpStruct->lfOutPrecision);
- (*env)->SetByteField(env, lpObject, lpCache->lfClipPrecision, lpStruct->lfClipPrecision);
- (*env)->SetByteField(env, lpObject, lpCache->lfQuality, lpStruct->lfQuality);
- (*env)->SetByteField(env, lpObject, lpCache->lfPitchAndFamily, lpStruct->lfPitchAndFamily);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName0, lpStruct->lfFaceName[0]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName1, lpStruct->lfFaceName[1]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName2, lpStruct->lfFaceName[2]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName3, lpStruct->lfFaceName[3]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName4, lpStruct->lfFaceName[4]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName5, lpStruct->lfFaceName[5]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName6, lpStruct->lfFaceName[6]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName7, lpStruct->lfFaceName[7]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName8, lpStruct->lfFaceName[8]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName9, lpStruct->lfFaceName[9]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName10, lpStruct->lfFaceName[10]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName11, lpStruct->lfFaceName[11]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName12, lpStruct->lfFaceName[12]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName13, lpStruct->lfFaceName[13]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName14, lpStruct->lfFaceName[14]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName15, lpStruct->lfFaceName[15]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName16, lpStruct->lfFaceName[16]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName17, lpStruct->lfFaceName[17]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName18, lpStruct->lfFaceName[18]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName19, lpStruct->lfFaceName[19]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName20, lpStruct->lfFaceName[20]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName21, lpStruct->lfFaceName[21]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName22, lpStruct->lfFaceName[22]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName23, lpStruct->lfFaceName[23]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName24, lpStruct->lfFaceName[24]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName25, lpStruct->lfFaceName[25]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName26, lpStruct->lfFaceName[26]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName27, lpStruct->lfFaceName[27]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName28, lpStruct->lfFaceName[28]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName29, lpStruct->lfFaceName[29]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName30, lpStruct->lfFaceName[30]);
- (*env)->SetCharField(env, lpObject, lpCache->lfFaceName31, lpStruct->lfFaceName[31]);
-}
-
-void cacheLOGPENFids(JNIEnv *env, jobject lpObject, PLOGPEN_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lopnStyle = (*env)->GetFieldID(env, lpCache->clazz, "lopnStyle", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->lopnColor = (*env)->GetFieldID(env, lpCache->clazz, "lopnColor", "I");
- lpCache->cached = 1;
-}
-
-LOGPEN* getLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct, PLOGPEN_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGPENFids(env, lpObject, lpCache);
- lpStruct->lopnStyle = (*env)->GetIntField(env, lpObject, lpCache->lopnStyle);
- lpStruct->lopnWidth.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->lopnWidth.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->lopnColor = (*env)->GetIntField(env, lpObject, lpCache->lopnColor);
- return lpStruct;
-}
-
-void setLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct, PLOGPEN_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLOGPENFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lopnStyle, lpStruct->lopnStyle);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->lopnWidth.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->lopnWidth.y);
- (*env)->SetIntField(env, lpObject, lpCache->lopnColor, lpStruct->lopnColor);
-}
-
-void cacheLVCOLUMNFids(JNIEnv *env, jobject lpObject, PLVCOLUMN_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->fmt = (*env)->GetFieldID(env, lpCache->clazz, "fmt", "I");
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->iSubItem = (*env)->GetFieldID(env, lpCache->clazz, "iSubItem", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->iOrder = (*env)->GetFieldID(env, lpCache->clazz, "iOrder", "I");
- lpCache->cached = 1;
-}
-
-LVCOLUMN* getLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct, PLVCOLUMN_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVCOLUMNFids(env, lpObject, lpCache);
- lpStruct->mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->fmt = (*env)->GetIntField(env, lpObject, lpCache->fmt);
- lpStruct->cx = (*env)->GetIntField(env, lpObject, lpCache->cx);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, lpCache->iSubItem);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->iOrder = (*env)->GetIntField(env, lpObject, lpCache->iOrder);
- return lpStruct;
-}
-
-void setLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct, PLVCOLUMN_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVCOLUMNFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->mask);
- (*env)->SetIntField(env, lpObject, lpCache->fmt, lpStruct->fmt);
- (*env)->SetIntField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->iSubItem, lpStruct->iSubItem);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->iOrder, lpStruct->iOrder);
-}
-
-void cacheLVHITTESTINFOFids(JNIEnv *env, jobject lpObject, PLVHITTESTINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->iItem = (*env)->GetFieldID(env, lpCache->clazz, "iItem", "I");
- lpCache->iSubItem = (*env)->GetFieldID(env, lpCache->clazz, "iSubItem", "I");
- lpCache->cached = 1;
-}
-
-LVHITTESTINFO* getLVHITTESTINFOFields(JNIEnv *env, jobject lpObject, LVHITTESTINFO *lpStruct, PLVHITTESTINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVHITTESTINFOFids(env, lpObject, lpCache);
- lpStruct->pt.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->pt.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- lpStruct->iItem = (*env)->GetIntField(env, lpObject, lpCache->iItem);
- lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, lpCache->iSubItem);
- return lpStruct;
-}
-
-void setLVHITTESTINFOFields(JNIEnv *env, jobject lpObject, LVHITTESTINFO *lpStruct, PLVHITTESTINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVHITTESTINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->pt.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->pt.y);
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetIntField(env, lpObject, lpCache->iItem, lpStruct->iItem);
- (*env)->SetIntField(env, lpObject, lpCache->iSubItem, lpStruct->iSubItem);
-}
-
-void cacheLVITEMFids(JNIEnv *env, jobject lpObject, PLVITEM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->iItem = (*env)->GetFieldID(env, lpCache->clazz, "iItem", "I");
- lpCache->iSubItem = (*env)->GetFieldID(env, lpCache->clazz, "iSubItem", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->clazz, "state", "I");
- lpCache->stateMask = (*env)->GetFieldID(env, lpCache->clazz, "stateMask", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->iIndent = (*env)->GetFieldID(env, lpCache->clazz, "iIndent", "I");
- lpCache->cached = 1;
-}
-
-LVITEM* getLVITEMFields(JNIEnv *env, jobject lpObject, LVITEM *lpStruct, PLVITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVITEMFids(env, lpObject, lpCache);
- lpStruct->mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->iItem = (*env)->GetIntField(env, lpObject, lpCache->iItem);
- lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, lpCache->iSubItem);
- lpStruct->state = (*env)->GetIntField(env, lpObject, lpCache->state);
- lpStruct->stateMask = (*env)->GetIntField(env, lpObject, lpCache->stateMask);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->iIndent = (*env)->GetIntField(env, lpObject, lpCache->iIndent);
- return lpStruct;
-}
-
-void setLVITEMFields(JNIEnv *env, jobject lpObject, LVITEM *lpStruct, PLVITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLVITEMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->mask);
- (*env)->SetIntField(env, lpObject, lpCache->iItem, lpStruct->iItem);
- (*env)->SetIntField(env, lpObject, lpCache->iSubItem, lpStruct->iSubItem);
- (*env)->SetIntField(env, lpObject, lpCache->state, lpStruct->state);
- (*env)->SetIntField(env, lpObject, lpCache->stateMask, lpStruct->stateMask);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->iIndent, lpStruct->iIndent);
-}
-
-void cacheMEASUREITEMSTRUCTFids(JNIEnv *env, jobject lpObject, PMEASUREITEMSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->CtlType = (*env)->GetFieldID(env, lpCache->clazz, "CtlType", "I");
- lpCache->CtlID = (*env)->GetFieldID(env, lpCache->clazz, "CtlID", "I");
- lpCache->itemID = (*env)->GetFieldID(env, lpCache->clazz, "itemID", "I");
- lpCache->itemWidth = (*env)->GetFieldID(env, lpCache->clazz, "itemWidth", "I");
- lpCache->itemHeight = (*env)->GetFieldID(env, lpCache->clazz, "itemHeight", "I");
- lpCache->itemData = (*env)->GetFieldID(env, lpCache->clazz, "itemData", "I");
- lpCache->cached = 1;
-}
-
-MEASUREITEMSTRUCT* getMEASUREITEMSTRUCTFields(JNIEnv *env, jobject lpObject, MEASUREITEMSTRUCT *lpStruct, PMEASUREITEMSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMEASUREITEMSTRUCTFids(env, lpObject, lpCache);
- lpStruct->CtlType = (*env)->GetIntField(env, lpObject, lpCache->CtlType);
- lpStruct->CtlID = (*env)->GetIntField(env, lpObject, lpCache->CtlID);
- lpStruct->itemID = (*env)->GetIntField(env, lpObject, lpCache->itemID);
- lpStruct->itemWidth = (*env)->GetIntField(env, lpObject, lpCache->itemWidth);
- lpStruct->itemHeight = (*env)->GetIntField(env, lpObject, lpCache->itemHeight);
- lpStruct->itemData = (*env)->GetIntField(env, lpObject, lpCache->itemData);
- return lpStruct;
-}
-
-void setMEASUREITEMSTRUCTFields(JNIEnv *env, jobject lpObject, MEASUREITEMSTRUCT *lpStruct, PMEASUREITEMSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMEASUREITEMSTRUCTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->CtlType, lpStruct->CtlType);
- (*env)->SetIntField(env, lpObject, lpCache->CtlID, lpStruct->CtlID);
- (*env)->SetIntField(env, lpObject, lpCache->itemID, lpStruct->itemID);
- (*env)->SetIntField(env, lpObject, lpCache->itemWidth, lpStruct->itemWidth);
- (*env)->SetIntField(env, lpObject, lpCache->itemHeight, lpStruct->itemHeight);
- (*env)->SetIntField(env, lpObject, lpCache->itemData, lpStruct->itemData);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheMENUINFOFids(JNIEnv *env, jobject lpObject, PMENUINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->fMask = (*env)->GetFieldID(env, lpCache->clazz, "fMask", "I");
- lpCache->dwStyle = (*env)->GetFieldID(env, lpCache->clazz, "dwStyle", "I");
- lpCache->cyMax = (*env)->GetFieldID(env, lpCache->clazz, "cyMax", "I");
- lpCache->hbrBack = (*env)->GetFieldID(env, lpCache->clazz, "hbrBack", "I");
- lpCache->dwContextHelpID = (*env)->GetFieldID(env, lpCache->clazz, "dwContextHelpID", "I");
- lpCache->dwMenuData = (*env)->GetFieldID(env, lpCache->clazz, "dwMenuData", "I");
- lpCache->cached = 1;
-}
-
-MENUINFO* getMENUINFOFields(JNIEnv *env, jobject lpObject, MENUINFO *lpStruct, PMENUINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMENUINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->fMask = (*env)->GetIntField(env, lpObject, lpCache->fMask);
- lpStruct->dwStyle = (*env)->GetIntField(env, lpObject, lpCache->dwStyle);
- lpStruct->cyMax = (*env)->GetIntField(env, lpObject, lpCache->cyMax);
- lpStruct->hbrBack = (HBRUSH)(*env)->GetIntField(env, lpObject, lpCache->hbrBack);
- lpStruct->dwContextHelpID = (*env)->GetIntField(env, lpObject, lpCache->dwContextHelpID);
- lpStruct->dwMenuData = (*env)->GetIntField(env, lpObject, lpCache->dwMenuData);
- return lpStruct;
-}
-
-void setMENUINFOFields(JNIEnv *env, jobject lpObject, MENUINFO *lpStruct, PMENUINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMENUINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->fMask, lpStruct->fMask);
- (*env)->SetIntField(env, lpObject, lpCache->dwStyle, lpStruct->dwStyle);
- (*env)->SetIntField(env, lpObject, lpCache->cyMax, lpStruct->cyMax);
- (*env)->SetIntField(env, lpObject, lpCache->hbrBack, (jint)lpStruct->hbrBack);
- (*env)->SetIntField(env, lpObject, lpCache->dwContextHelpID, lpStruct->dwContextHelpID);
- (*env)->SetIntField(env, lpObject, lpCache->dwMenuData, lpStruct->dwMenuData);
-}
-
-#endif // _WIN32_WCE
-
-void cacheMENUITEMINFOFids(JNIEnv *env, jobject lpObject, PMENUITEMINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->fMask = (*env)->GetFieldID(env, lpCache->clazz, "fMask", "I");
- lpCache->fType = (*env)->GetFieldID(env, lpCache->clazz, "fType", "I");
- lpCache->fState = (*env)->GetFieldID(env, lpCache->clazz, "fState", "I");
- lpCache->wID = (*env)->GetFieldID(env, lpCache->clazz, "wID", "I");
- lpCache->hSubMenu = (*env)->GetFieldID(env, lpCache->clazz, "hSubMenu", "I");
- lpCache->hbmpChecked = (*env)->GetFieldID(env, lpCache->clazz, "hbmpChecked", "I");
- lpCache->hbmpUnchecked = (*env)->GetFieldID(env, lpCache->clazz, "hbmpUnchecked", "I");
- lpCache->dwItemData = (*env)->GetFieldID(env, lpCache->clazz, "dwItemData", "I");
- lpCache->dwTypeData = (*env)->GetFieldID(env, lpCache->clazz, "dwTypeData", "I");
- lpCache->cch = (*env)->GetFieldID(env, lpCache->clazz, "cch", "I");
- lpCache->hbmpItem = (*env)->GetFieldID(env, lpCache->clazz, "hbmpItem", "I");
- lpCache->cached = 1;
-}
-
-MENUITEMINFO* getMENUITEMINFOFields(JNIEnv *env, jobject lpObject, MENUITEMINFO *lpStruct, PMENUITEMINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMENUITEMINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->fMask = (*env)->GetIntField(env, lpObject, lpCache->fMask);
- lpStruct->fType = (*env)->GetIntField(env, lpObject, lpCache->fType);
- lpStruct->fState = (*env)->GetIntField(env, lpObject, lpCache->fState);
- lpStruct->wID = (*env)->GetIntField(env, lpObject, lpCache->wID);
- lpStruct->hSubMenu = (HMENU)(*env)->GetIntField(env, lpObject, lpCache->hSubMenu);
- lpStruct->hbmpChecked = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmpChecked);
- lpStruct->hbmpUnchecked = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmpUnchecked);
- lpStruct->dwItemData = (*env)->GetIntField(env, lpObject, lpCache->dwItemData);
- lpStruct->dwTypeData = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->dwTypeData);
- lpStruct->cch = (*env)->GetIntField(env, lpObject, lpCache->cch);
-#ifndef _WIN32_WCE
- lpStruct->hbmpItem = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmpItem);
-#endif
- return lpStruct;
-}
-
-void setMENUITEMINFOFields(JNIEnv *env, jobject lpObject, MENUITEMINFO *lpStruct, PMENUITEMINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMENUITEMINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->fMask, lpStruct->fMask);
- (*env)->SetIntField(env, lpObject, lpCache->fType, lpStruct->fType);
- (*env)->SetIntField(env, lpObject, lpCache->fState, lpStruct->fState);
- (*env)->SetIntField(env, lpObject, lpCache->wID, lpStruct->wID);
- (*env)->SetIntField(env, lpObject, lpCache->hSubMenu, (jint)lpStruct->hSubMenu);
- (*env)->SetIntField(env, lpObject, lpCache->hbmpChecked, (jint)lpStruct->hbmpChecked);
- (*env)->SetIntField(env, lpObject, lpCache->hbmpUnchecked, (jint)lpStruct->hbmpUnchecked);
- (*env)->SetIntField(env, lpObject, lpCache->dwItemData, lpStruct->dwItemData);
- (*env)->SetIntField(env, lpObject, lpCache->dwTypeData, (jint)lpStruct->dwTypeData);
- (*env)->SetIntField(env, lpObject, lpCache->cch, lpStruct->cch);
-#ifndef _WIN32_WCE
- (*env)->SetIntField(env, lpObject, lpCache->hbmpItem, (jint)lpStruct->hbmpItem);
-#endif
-}
-
-void cacheMSGFids(JNIEnv *env, jobject lpObject, PMSG_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwnd = (*env)->GetFieldID(env, lpCache->clazz, "hwnd", "I");
- lpCache->message = (*env)->GetFieldID(env, lpCache->clazz, "message", "I");
- lpCache->wParam = (*env)->GetFieldID(env, lpCache->clazz, "wParam", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->time = (*env)->GetFieldID(env, lpCache->clazz, "time", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->cached = 1;
-}
-
-MSG* getMSGFields(JNIEnv *env, jobject lpObject, MSG *lpStruct, PMSG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMSGFids(env, lpObject, lpCache);
- lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwnd);
- lpStruct->message = (*env)->GetIntField(env, lpObject, lpCache->message);
- lpStruct->wParam = (*env)->GetIntField(env, lpObject, lpCache->wParam);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->time = (*env)->GetIntField(env, lpObject, lpCache->time);
- lpStruct->pt.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->pt.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- return lpStruct;
-}
-
-void setMSGFields(JNIEnv *env, jobject lpObject, MSG *lpStruct, PMSG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheMSGFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwnd, (jint)lpStruct->hwnd);
- (*env)->SetIntField(env, lpObject, lpCache->message, lpStruct->message);
- (*env)->SetIntField(env, lpObject, lpCache->wParam, lpStruct->wParam);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->time, lpStruct->time);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->pt.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->pt.y);
-}
-
-void cacheNMHDRFids(JNIEnv *env, jobject lpObject, PNMHDR_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndFrom = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrom", "I");
- lpCache->idFrom = (*env)->GetFieldID(env, lpCache->clazz, "idFrom", "I");
- lpCache->code = (*env)->GetFieldID(env, lpCache->clazz, "code", "I");
- lpCache->cached = 1;
-}
-
-NMHDR* getNMHDRFields(JNIEnv *env, jobject lpObject, NMHDR *lpStruct, PNMHDR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMHDRFids(env, lpObject, lpCache);
- lpStruct->hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->code = (*env)->GetIntField(env, lpObject, lpCache->code);
- return lpStruct;
-}
-
-void setNMHDRFields(JNIEnv *env, jobject lpObject, NMHDR *lpStruct, PNMHDR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMHDRFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->code);
-}
-
-void cacheNMHEADERFids(JNIEnv *env, jobject lpObject, PNMHEADER_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndFrom = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrom", "I");
- lpCache->idFrom = (*env)->GetFieldID(env, lpCache->clazz, "idFrom", "I");
- lpCache->code = (*env)->GetFieldID(env, lpCache->clazz, "code", "I");
- lpCache->iItem = (*env)->GetFieldID(env, lpCache->clazz, "iItem", "I");
- lpCache->iButton = (*env)->GetFieldID(env, lpCache->clazz, "iButton", "I");
- lpCache->pitem = (*env)->GetFieldID(env, lpCache->clazz, "pitem", "I");
- lpCache->cached = 1;
-}
-
-NMHEADER* getNMHEADERFields(JNIEnv *env, jobject lpObject, NMHEADER *lpStruct, PNMHEADER_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMHEADERFids(env, lpObject, lpCache);
- lpStruct->hdr.hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->hdr.idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->hdr.code = (*env)->GetIntField(env, lpObject, lpCache->code);
- lpStruct->iItem = (*env)->GetIntField(env, lpObject, lpCache->iItem);
- lpStruct->iButton = (*env)->GetIntField(env, lpObject, lpCache->iButton);
- lpStruct->pitem = (HDITEM FAR *)(*env)->GetIntField(env, lpObject, lpCache->pitem);
- return lpStruct;
-}
-
-void setNMHEADERFields(JNIEnv *env, jobject lpObject, NMHEADER *lpStruct, PNMHEADER_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMHEADERFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hdr.hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->hdr.idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->hdr.code);
- (*env)->SetIntField(env, lpObject, lpCache->iItem, lpStruct->iItem);
- (*env)->SetIntField(env, lpObject, lpCache->iButton, lpStruct->iButton);
- (*env)->SetIntField(env, lpObject, lpCache->pitem, (jint)lpStruct->pitem);
-}
-
-void cacheNMLISTVIEWFids(JNIEnv *env, jobject lpObject, PNMLISTVIEW_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndFrom = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrom", "I");
- lpCache->idFrom = (*env)->GetFieldID(env, lpCache->clazz, "idFrom", "I");
- lpCache->code = (*env)->GetFieldID(env, lpCache->clazz, "code", "I");
- lpCache->iItem = (*env)->GetFieldID(env, lpCache->clazz, "iItem", "I");
- lpCache->iSubItem = (*env)->GetFieldID(env, lpCache->clazz, "iSubItem", "I");
- lpCache->uNewState = (*env)->GetFieldID(env, lpCache->clazz, "uNewState", "I");
- lpCache->uOldState = (*env)->GetFieldID(env, lpCache->clazz, "uOldState", "I");
- lpCache->uChanged = (*env)->GetFieldID(env, lpCache->clazz, "uChanged", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-NMLISTVIEW* getNMLISTVIEWFields(JNIEnv *env, jobject lpObject, NMLISTVIEW *lpStruct, PNMLISTVIEW_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMLISTVIEWFids(env, lpObject, lpCache);
- lpStruct->hdr.hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->hdr.idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->hdr.code = (*env)->GetIntField(env, lpObject, lpCache->code);
- lpStruct->iItem = (*env)->GetIntField(env, lpObject, lpCache->iItem);
- lpStruct->iSubItem = (*env)->GetIntField(env, lpObject, lpCache->iSubItem);
- lpStruct->uNewState = (*env)->GetIntField(env, lpObject, lpCache->uNewState);
- lpStruct->uOldState = (*env)->GetIntField(env, lpObject, lpCache->uOldState);
- lpStruct->uChanged = (*env)->GetIntField(env, lpObject, lpCache->uChanged);
- lpStruct->ptAction.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->ptAction.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setNMLISTVIEWFields(JNIEnv *env, jobject lpObject, NMLISTVIEW *lpStruct, PNMLISTVIEW_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMLISTVIEWFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hdr.hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->hdr.idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->hdr.code);
- (*env)->SetIntField(env, lpObject, lpCache->iItem, lpStruct->iItem);
- (*env)->SetIntField(env, lpObject, lpCache->iSubItem, lpStruct->iSubItem);
- (*env)->SetIntField(env, lpObject, lpCache->uNewState, lpStruct->uNewState);
- (*env)->SetIntField(env, lpObject, lpCache->uOldState, lpStruct->uOldState);
- (*env)->SetIntField(env, lpObject, lpCache->uChanged, lpStruct->uChanged);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->ptAction.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->ptAction.y);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-void cacheNMTOOLBARFids(JNIEnv *env, jobject lpObject, PNMTOOLBAR_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndFrom = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrom", "I");
- lpCache->idFrom = (*env)->GetFieldID(env, lpCache->clazz, "idFrom", "I");
- lpCache->code = (*env)->GetFieldID(env, lpCache->clazz, "code", "I");
- lpCache->iItem = (*env)->GetFieldID(env, lpCache->clazz, "iItem", "I");
- lpCache->iBitmap = (*env)->GetFieldID(env, lpCache->clazz, "iBitmap", "I");
- lpCache->idCommand = (*env)->GetFieldID(env, lpCache->clazz, "idCommand", "I");
- lpCache->fsState = (*env)->GetFieldID(env, lpCache->clazz, "fsState", "B");
- lpCache->fsStyle = (*env)->GetFieldID(env, lpCache->clazz, "fsStyle", "B");
- lpCache->dwData = (*env)->GetFieldID(env, lpCache->clazz, "dwData", "I");
- lpCache->iString = (*env)->GetFieldID(env, lpCache->clazz, "iString", "I");
- lpCache->cchText = (*env)->GetFieldID(env, lpCache->clazz, "cchText", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->cached = 1;
-}
-
-NMTOOLBAR* getNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct, PNMTOOLBAR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTOOLBARFids(env, lpObject, lpCache);
- lpStruct->hdr.hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->hdr.idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->hdr.code = (*env)->GetIntField(env, lpObject, lpCache->code);
- lpStruct->iItem = (*env)->GetIntField(env, lpObject, lpCache->iItem);
- lpStruct->tbButton.iBitmap = (*env)->GetIntField(env, lpObject, lpCache->iBitmap);
- lpStruct->tbButton.idCommand = (*env)->GetIntField(env, lpObject, lpCache->idCommand);
- lpStruct->tbButton.fsState = (*env)->GetByteField(env, lpObject, lpCache->fsState);
- lpStruct->tbButton.fsStyle = (*env)->GetByteField(env, lpObject, lpCache->fsStyle);
- lpStruct->tbButton.dwData = (*env)->GetIntField(env, lpObject, lpCache->dwData);
- lpStruct->tbButton.iString = (*env)->GetIntField(env, lpObject, lpCache->iString);
- lpStruct->cchText = (*env)->GetIntField(env, lpObject, lpCache->cchText);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
-#ifndef _WIN32_WCE
- lpStruct->rcButton.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rcButton.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rcButton.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->rcButton.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
-#endif
- return lpStruct;
-}
-
-void setNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct, PNMTOOLBAR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTOOLBARFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hdr.hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->hdr.idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->hdr.code);
- (*env)->SetIntField(env, lpObject, lpCache->iItem, lpStruct->iItem);
- (*env)->SetIntField(env, lpObject, lpCache->iBitmap, lpStruct->tbButton.iBitmap);
- (*env)->SetIntField(env, lpObject, lpCache->idCommand, lpStruct->tbButton.idCommand);
- (*env)->SetByteField(env, lpObject, lpCache->fsState, lpStruct->tbButton.fsState);
- (*env)->SetByteField(env, lpObject, lpCache->fsStyle, lpStruct->tbButton.fsStyle);
- (*env)->SetIntField(env, lpObject, lpCache->dwData, lpStruct->tbButton.dwData);
- (*env)->SetIntField(env, lpObject, lpCache->iString, lpStruct->tbButton.iString);
- (*env)->SetIntField(env, lpObject, lpCache->cchText, lpStruct->cchText);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
-#ifndef _WIN32_WCE
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rcButton.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rcButton.top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rcButton.right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rcButton.bottom);
-#endif
-}
-
-#ifndef _WIN32_WCE
-
-void cacheNMTTDISPINFOFids(JNIEnv *env, jobject lpObject, PNMTTDISPINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwndFrom = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrom", "I");
- lpCache->idFrom = (*env)->GetFieldID(env, lpCache->clazz, "idFrom", "I");
- lpCache->code = (*env)->GetFieldID(env, lpCache->clazz, "code", "I");
- lpCache->lpszText = (*env)->GetFieldID(env, lpCache->clazz, "lpszText", "I");
- lpCache->hinst = (*env)->GetFieldID(env, lpCache->clazz, "hinst", "I");
- lpCache->uFlags = (*env)->GetFieldID(env, lpCache->clazz, "uFlags", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-NMTTDISPINFOA* getNMTTDISPINFOAFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOA *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTTDISPINFOFids(env, lpObject, lpCache);
- lpStruct->hdr.hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->hdr.idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->hdr.code = (*env)->GetIntField(env, lpObject, lpCache->code);
- lpStruct->lpszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszText);
- lpStruct->hinst = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hinst);
- lpStruct->uFlags = (*env)->GetIntField(env, lpObject, lpCache->uFlags);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setNMTTDISPINFOAFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOA *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTTDISPINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hdr.hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->hdr.idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->hdr.code);
- (*env)->SetIntField(env, lpObject, lpCache->lpszText, (jint)lpStruct->lpszText);
- (*env)->SetIntField(env, lpObject, lpCache->hinst, (jint)lpStruct->hinst);
- (*env)->SetIntField(env, lpObject, lpCache->uFlags, lpStruct->uFlags);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-NMTTDISPINFOW* getNMTTDISPINFOWFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOW *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTTDISPINFOFids(env, lpObject, lpCache);
- lpStruct->hdr.hwndFrom = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrom);
- lpStruct->hdr.idFrom = (*env)->GetIntField(env, lpObject, lpCache->idFrom);
- lpStruct->hdr.code = (*env)->GetIntField(env, lpObject, lpCache->code);
- lpStruct->lpszText = (LPWSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszText);
- lpStruct->hinst = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hinst);
- lpStruct->uFlags = (*env)->GetIntField(env, lpObject, lpCache->uFlags);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setNMTTDISPINFOWFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOW *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNMTTDISPINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrom, (jint)lpStruct->hdr.hwndFrom);
- (*env)->SetIntField(env, lpObject, lpCache->idFrom, lpStruct->hdr.idFrom);
- (*env)->SetIntField(env, lpObject, lpCache->code, lpStruct->hdr.code);
- (*env)->SetIntField(env, lpObject, lpCache->lpszText, (jint)lpStruct->lpszText);
- (*env)->SetIntField(env, lpObject, lpCache->hinst, (jint)lpStruct->hinst);
- (*env)->SetIntField(env, lpObject, lpCache->uFlags, lpStruct->uFlags);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-NONCLIENTMETRICSA* getNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNONCLIENTMETRICSFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->iBorderWidth = (*env)->GetIntField(env, lpObject, lpCache->iBorderWidth);
- lpStruct->iScrollWidth = (*env)->GetIntField(env, lpObject, lpCache->iScrollWidth);
- lpStruct->iScrollHeight = (*env)->GetIntField(env, lpObject, lpCache->iScrollHeight);
- lpStruct->iCaptionWidth = (*env)->GetIntField(env, lpObject, lpCache->iCaptionWidth);
- lpStruct->iCaptionHeight = (*env)->GetIntField(env, lpObject, lpCache->iCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfCaptionFont);
- getLOGFONTAFields(env, lpLogfont, &lpStruct->lfCaptionFont, &PGLOB(LOGFONTFc));
- }
- lpStruct->iSmCaptionWidth = (*env)->GetIntField(env, lpObject, lpCache->iSmCaptionWidth);
- lpStruct->iSmCaptionHeight = (*env)->GetIntField(env, lpObject, lpCache->iSmCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfSmCaptionFont);
- getLOGFONTAFields(env, lpLogfont, &lpStruct->lfSmCaptionFont, &PGLOB(LOGFONTFc));
- }
- lpStruct->iMenuWidth = (*env)->GetIntField(env, lpObject, lpCache->iMenuWidth);
- lpStruct->iMenuHeight = (*env)->GetIntField(env, lpObject, lpCache->iMenuHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMenuFont);
- getLOGFONTAFields(env, lpLogfont, &lpStruct->lfMenuFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfStatusFont);
- getLOGFONTAFields(env, lpLogfont, &lpStruct->lfStatusFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMessageFont);
- getLOGFONTAFields(env, lpLogfont, &lpStruct->lfMessageFont, &PGLOB(LOGFONTFc));
- }
- return lpStruct;
-}
-
-void setNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNONCLIENTMETRICSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->iBorderWidth, lpStruct->iBorderWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iScrollWidth, lpStruct->iScrollWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iScrollHeight, lpStruct->iScrollHeight);
- (*env)->SetIntField(env, lpObject, lpCache->iCaptionWidth, lpStruct->iCaptionWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iCaptionHeight, lpStruct->iCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfCaptionFont);
- setLOGFONTAFields(env, lpLogfont, &lpStruct->lfCaptionFont, &PGLOB(LOGFONTFc));
- }
- (*env)->SetIntField(env, lpObject, lpCache->iSmCaptionWidth, lpStruct->iSmCaptionWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iSmCaptionHeight, lpStruct->iSmCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfSmCaptionFont);
- setLOGFONTAFields(env, lpLogfont, &lpStruct->lfSmCaptionFont, &PGLOB(LOGFONTFc));
- }
- (*env)->SetIntField(env, lpObject, lpCache->iMenuWidth, lpStruct->iMenuWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iMenuHeight, lpStruct->iMenuHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMenuFont);
- setLOGFONTAFields(env, lpLogfont, &lpStruct->lfMenuFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfStatusFont);
- setLOGFONTAFields(env, lpLogfont, &lpStruct->lfStatusFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMessageFont);
- setLOGFONTAFields(env, lpLogfont, &lpStruct->lfMessageFont, &PGLOB(LOGFONTFc));
- }
-}
-
-NONCLIENTMETRICSW* getNONCLIENTMETRICSWFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSW *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNONCLIENTMETRICSFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->iBorderWidth = (*env)->GetIntField(env, lpObject, lpCache->iBorderWidth);
- lpStruct->iScrollWidth = (*env)->GetIntField(env, lpObject, lpCache->iScrollWidth);
- lpStruct->iScrollHeight = (*env)->GetIntField(env, lpObject, lpCache->iScrollHeight);
- lpStruct->iCaptionWidth = (*env)->GetIntField(env, lpObject, lpCache->iCaptionWidth);
- lpStruct->iCaptionHeight = (*env)->GetIntField(env, lpObject, lpCache->iCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfCaptionFont);
- getLOGFONTWFields(env, lpLogfont, &lpStruct->lfCaptionFont, &PGLOB(LOGFONTFc));
- }
- lpStruct->iSmCaptionWidth = (*env)->GetIntField(env, lpObject, lpCache->iSmCaptionWidth);
- lpStruct->iSmCaptionHeight = (*env)->GetIntField(env, lpObject, lpCache->iSmCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfSmCaptionFont);
- getLOGFONTWFields(env, lpLogfont, &lpStruct->lfSmCaptionFont, &PGLOB(LOGFONTFc));
- }
- lpStruct->iMenuWidth = (*env)->GetIntField(env, lpObject, lpCache->iMenuWidth);
- lpStruct->iMenuHeight = (*env)->GetIntField(env, lpObject, lpCache->iMenuHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMenuFont);
- getLOGFONTWFields(env, lpLogfont, &lpStruct->lfMenuFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfStatusFont);
- getLOGFONTWFields(env, lpLogfont, &lpStruct->lfStatusFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMessageFont);
- getLOGFONTWFields(env, lpLogfont, &lpStruct->lfMessageFont, &PGLOB(LOGFONTFc));
- }
- return lpStruct;
-}
-
-void setNONCLIENTMETRICSWFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSW *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheNONCLIENTMETRICSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->iBorderWidth, lpStruct->iBorderWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iScrollWidth, lpStruct->iScrollWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iScrollHeight, lpStruct->iScrollHeight);
- (*env)->SetIntField(env, lpObject, lpCache->iCaptionWidth, lpStruct->iCaptionWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iCaptionHeight, lpStruct->iCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfCaptionFont);
- setLOGFONTWFields(env, lpLogfont, &lpStruct->lfCaptionFont, &PGLOB(LOGFONTFc));
- }
- (*env)->SetIntField(env, lpObject, lpCache->iSmCaptionWidth, lpStruct->iSmCaptionWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iSmCaptionHeight, lpStruct->iSmCaptionHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfSmCaptionFont);
- setLOGFONTWFields(env, lpLogfont, &lpStruct->lfSmCaptionFont, &PGLOB(LOGFONTFc));
- }
- (*env)->SetIntField(env, lpObject, lpCache->iMenuWidth, lpStruct->iMenuWidth);
- (*env)->SetIntField(env, lpObject, lpCache->iMenuHeight, lpStruct->iMenuHeight);
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMenuFont);
- setLOGFONTWFields(env, lpLogfont, &lpStruct->lfMenuFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfStatusFont);
- setLOGFONTWFields(env, lpLogfont, &lpStruct->lfStatusFont, &PGLOB(LOGFONTFc));
- }
- {
- jobject lpLogfont = (*env)->GetObjectField(env, lpObject, lpCache->lfMessageFont);
- setLOGFONTWFields(env, lpLogfont, &lpStruct->lfMessageFont, &PGLOB(LOGFONTFc));
- }
-}
-
-#endif _WIN32_WCE
-
-void cacheOPENFILENAMEFids(JNIEnv *env, jobject lpObject, POPENFILENAME_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lStructSize = (*env)->GetFieldID(env, lpCache->clazz, "lStructSize", "I");
- lpCache->hwndOwner = (*env)->GetFieldID(env, lpCache->clazz, "hwndOwner", "I");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->lpstrFilter = (*env)->GetFieldID(env, lpCache->clazz, "lpstrFilter", "I");
- lpCache->lpstrCustomFilter = (*env)->GetFieldID(env, lpCache->clazz, "lpstrCustomFilter", "I");
- lpCache->nMaxCustFilter = (*env)->GetFieldID(env, lpCache->clazz, "nMaxCustFilter", "I");
- lpCache->nFilterIndex = (*env)->GetFieldID(env, lpCache->clazz, "nFilterIndex", "I");
- lpCache->lpstrFile = (*env)->GetFieldID(env, lpCache->clazz, "lpstrFile", "I");
- lpCache->nMaxFile = (*env)->GetFieldID(env, lpCache->clazz, "nMaxFile", "I");
- lpCache->lpstrFileTitle = (*env)->GetFieldID(env, lpCache->clazz, "lpstrFileTitle", "I");
- lpCache->nMaxFileTitle = (*env)->GetFieldID(env, lpCache->clazz, "nMaxFileTitle", "I");
- lpCache->lpstrInitialDir = (*env)->GetFieldID(env, lpCache->clazz, "lpstrInitialDir", "I");
- lpCache->lpstrTitle = (*env)->GetFieldID(env, lpCache->clazz, "lpstrTitle", "I");
- lpCache->Flags = (*env)->GetFieldID(env, lpCache->clazz, "Flags", "I");
- lpCache->nFileOffset = (*env)->GetFieldID(env, lpCache->clazz, "nFileOffset", "S");
- lpCache->nFileExtension = (*env)->GetFieldID(env, lpCache->clazz, "nFileExtension", "S");
- lpCache->lpstrDefExt = (*env)->GetFieldID(env, lpCache->clazz, "lpstrDefExt", "I");
- lpCache->lCustData = (*env)->GetFieldID(env, lpCache->clazz, "lCustData", "I");
- lpCache->lpfnHook = (*env)->GetFieldID(env, lpCache->clazz, "lpfnHook", "I");
- lpCache->lpTemplateName = (*env)->GetFieldID(env, lpCache->clazz, "lpTemplateName", "I");
- lpCache->cached = 1;
-}
-
-OPENFILENAME* getOPENFILENAMEFields(JNIEnv *env, jobject lpObject, OPENFILENAME *lpStruct, POPENFILENAME_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOPENFILENAMEFids(env, lpObject, lpCache);
- lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, lpCache->lStructSize);
- lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndOwner);
- lpStruct->hInstance = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->lpstrFilter = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrFilter);
- lpStruct->lpstrCustomFilter = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrCustomFilter);
- lpStruct->nMaxCustFilter = (*env)->GetIntField(env, lpObject, lpCache->nMaxCustFilter);
- lpStruct->nFilterIndex = (*env)->GetIntField(env, lpObject, lpCache->nFilterIndex);
- lpStruct->lpstrFile = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrFile);
- lpStruct->nMaxFile = (*env)->GetIntField(env, lpObject, lpCache->nMaxFile);
- lpStruct->lpstrFileTitle = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrFileTitle);
- lpStruct->nMaxFileTitle = (*env)->GetIntField(env, lpObject, lpCache->nMaxFileTitle);
- lpStruct->lpstrInitialDir = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrInitialDir);
- lpStruct->lpstrTitle = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrTitle);
- lpStruct->Flags = (*env)->GetIntField(env, lpObject, lpCache->Flags);
- lpStruct->nFileOffset = (*env)->GetShortField(env, lpObject, lpCache->nFileOffset);
- lpStruct->nFileExtension = (*env)->GetShortField(env, lpObject, lpCache->nFileExtension);
- lpStruct->lpstrDefExt = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpstrDefExt);
- lpStruct->lCustData = (*env)->GetIntField(env, lpObject, lpCache->lCustData);
- lpStruct->lpfnHook = (LPOFNHOOKPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnHook);
- lpStruct->lpTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpTemplateName);
- return lpStruct;
-}
-
-void setOPENFILENAMEFields(JNIEnv *env, jobject lpObject, OPENFILENAME *lpStruct, POPENFILENAME_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOPENFILENAMEFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lStructSize, lpStruct->lStructSize);
- (*env)->SetIntField(env, lpObject, lpCache->hwndOwner, (jint)lpStruct->hwndOwner);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrFilter, (jint)lpStruct->lpstrFilter);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrCustomFilter, (jint)lpStruct->lpstrCustomFilter);
- (*env)->SetIntField(env, lpObject, lpCache->nMaxCustFilter, lpStruct->nMaxCustFilter);
- (*env)->SetIntField(env, lpObject, lpCache->nFilterIndex, lpStruct->nFilterIndex);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrFile, (jint)lpStruct->lpstrFile);
- (*env)->SetIntField(env, lpObject, lpCache->nMaxFile, lpStruct->nMaxFile);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrFileTitle, (jint)lpStruct->lpstrFileTitle);
- (*env)->SetIntField(env, lpObject, lpCache->nMaxFileTitle, lpStruct->nMaxFileTitle);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrInitialDir, (jint)lpStruct->lpstrInitialDir);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrTitle, (jint)lpStruct->lpstrTitle);
- (*env)->SetIntField(env, lpObject, lpCache->Flags, lpStruct->Flags);
- (*env)->SetShortField(env, lpObject, lpCache->nFileOffset, lpStruct->nFileOffset);
- (*env)->SetShortField(env, lpObject, lpCache->nFileExtension, lpStruct->nFileExtension);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrDefExt, (jint)lpStruct->lpstrDefExt);
- (*env)->SetIntField(env, lpObject, lpCache->lCustData, lpStruct->lCustData);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnHook, (jint)lpStruct->lpfnHook);
- (*env)->SetIntField(env, lpObject, lpCache->lpTemplateName, (jint)lpStruct->lpTemplateName);
-}
-
-void cacheOSVERSIONINFOFids(JNIEnv *env, jobject lpObject, POSVERSIONINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwOSVersionInfoSize = (*env)->GetFieldID(env, lpCache->clazz, "dwOSVersionInfoSize", "I");
- lpCache->dwMajorVersion = (*env)->GetFieldID(env, lpCache->clazz, "dwMajorVersion", "I");
- lpCache->dwMinorVersion = (*env)->GetFieldID(env, lpCache->clazz, "dwMinorVersion", "I");
- lpCache->dwBuildNumber = (*env)->GetFieldID(env, lpCache->clazz, "dwBuildNumber", "I");
- lpCache->dwPlatformId = (*env)->GetFieldID(env, lpCache->clazz, "dwPlatformId", "I");
- lpCache->cached = 1;
-}
-
-#ifndef _WIN32_WCE
-
-OSVERSIONINFOA* getOSVERSIONINFOAFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOA *lpStruct, POSVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOSVERSIONINFOFids(env, lpObject, lpCache);
- lpStruct->dwOSVersionInfoSize = (*env)->GetIntField(env, lpObject, lpCache->dwOSVersionInfoSize);
- lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMajorVersion);
- lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMinorVersion);
- lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, lpCache->dwBuildNumber);
- lpStruct->dwPlatformId = (*env)->GetIntField(env, lpObject, lpCache->dwPlatformId);
- return lpStruct;
-}
-
-void setOSVERSIONINFOAFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOA *lpStruct, POSVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOSVERSIONINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwOSVersionInfoSize, lpStruct->dwOSVersionInfoSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwMajorVersion, lpStruct->dwMajorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwMinorVersion, lpStruct->dwMinorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwBuildNumber, lpStruct->dwBuildNumber);
- (*env)->SetIntField(env, lpObject, lpCache->dwPlatformId, lpStruct->dwPlatformId);
-}
-
-#endif // _WIN32_WCE
-
-
-OSVERSIONINFOW* getOSVERSIONINFOWFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOW *lpStruct, POSVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOSVERSIONINFOFids(env, lpObject, lpCache);
- lpStruct->dwOSVersionInfoSize = (*env)->GetIntField(env, lpObject, lpCache->dwOSVersionInfoSize);
- lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMajorVersion);
- lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, lpCache->dwMinorVersion);
- lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, lpCache->dwBuildNumber);
- lpStruct->dwPlatformId = (*env)->GetIntField(env, lpObject, lpCache->dwPlatformId);
- return lpStruct;
-}
-
-void setOSVERSIONINFOWFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOW *lpStruct, POSVERSIONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOSVERSIONINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwOSVersionInfoSize, lpStruct->dwOSVersionInfoSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwMajorVersion, lpStruct->dwMajorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwMinorVersion, lpStruct->dwMinorVersion);
- (*env)->SetIntField(env, lpObject, lpCache->dwBuildNumber, lpStruct->dwBuildNumber);
- (*env)->SetIntField(env, lpObject, lpCache->dwPlatformId, lpStruct->dwPlatformId);
-}
-
-void cachePAINTSTRUCTFids(JNIEnv *env, jobject lpObject, PPAINTSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hdc = (*env)->GetFieldID(env, lpCache->clazz, "hdc", "I");
- lpCache->fErase = (*env)->GetFieldID(env, lpCache->clazz, "fErase", "Z");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->fRestore = (*env)->GetFieldID(env, lpCache->clazz, "fRestore", "Z");
- lpCache->fIncUpdate = (*env)->GetFieldID(env, lpCache->clazz, "fIncUpdate", "Z");
- lpCache->cached = 1;
-}
-
-PAINTSTRUCT* getPAINTSTRUCTFields(JNIEnv *env, jobject lpObject, PAINTSTRUCT *lpStruct, PPAINTSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePAINTSTRUCTFids(env, lpObject, lpCache);
- lpStruct->hdc = (HDC)(*env)->GetIntField(env, lpObject, lpCache->hdc);
- lpStruct->fErase = (*env)->GetBooleanField(env, lpObject, lpCache->fErase);
- lpStruct->rcPaint.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rcPaint.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rcPaint.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->rcPaint.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- lpStruct->fRestore = (*env)->GetBooleanField(env, lpObject, lpCache->fRestore);
- lpStruct->fIncUpdate = (*env)->GetBooleanField(env, lpObject, lpCache->fIncUpdate);
- return lpStruct;
-}
-
-void setPAINTSTRUCTFields(JNIEnv *env, jobject lpObject, PAINTSTRUCT *lpStruct, PPAINTSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePAINTSTRUCTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hdc, (jint)lpStruct->hdc);
- (*env)->SetBooleanField(env, lpObject, lpCache->fErase, (jboolean)lpStruct->fErase);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rcPaint.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rcPaint.top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rcPaint.right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rcPaint.bottom);
- (*env)->SetBooleanField(env, lpObject, lpCache->fRestore, (jboolean)lpStruct->fRestore);
- (*env)->SetBooleanField(env, lpObject, lpCache->fIncUpdate, (jboolean)lpStruct->fIncUpdate);
-}
-
-void cachePOINTFids(JNIEnv *env, jobject lpObject, PPOINT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->cached = 1;
-}
-
-POINT* getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct, PPOINT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePOINTFids(env, lpObject, lpCache);
- lpStruct->x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->y = (*env)->GetIntField(env, lpObject, lpCache->y);
- return lpStruct;
-}
-
-void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct, PPOINT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePOINTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->y);
-}
-
-#ifndef _WIN32_WCE
-
-void cachePRINTDLGFids(JNIEnv *env, jobject lpObject, PPRINTDLG_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->lStructSize = (*env)->GetFieldID(env, lpCache->clazz, "lStructSize", "I");
- lpCache->hwndOwner = (*env)->GetFieldID(env, lpCache->clazz, "hwndOwner", "I");
- lpCache->hDevMode = (*env)->GetFieldID(env, lpCache->clazz, "hDevMode", "I");
- lpCache->hDevNames = (*env)->GetFieldID(env, lpCache->clazz, "hDevNames", "I");
- lpCache->hDC = (*env)->GetFieldID(env, lpCache->clazz, "hDC", "I");
- lpCache->Flags = (*env)->GetFieldID(env, lpCache->clazz, "Flags", "I");
- lpCache->nFromPage = (*env)->GetFieldID(env, lpCache->clazz, "nFromPage", "S");
- lpCache->nToPage = (*env)->GetFieldID(env, lpCache->clazz, "nToPage", "S");
- lpCache->nMinPage = (*env)->GetFieldID(env, lpCache->clazz, "nMinPage", "S");
- lpCache->nMaxPage = (*env)->GetFieldID(env, lpCache->clazz, "nMaxPage", "S");
- lpCache->nCopies = (*env)->GetFieldID(env, lpCache->clazz, "nCopies", "S");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->lCustData = (*env)->GetFieldID(env, lpCache->clazz, "lCustData", "I");
- lpCache->lpfnPrintHook = (*env)->GetFieldID(env, lpCache->clazz, "lpfnPrintHook", "I");
- lpCache->lpfnSetupHook = (*env)->GetFieldID(env, lpCache->clazz, "lpfnSetupHook", "I");
- lpCache->lpPrintTemplateName = (*env)->GetFieldID(env, lpCache->clazz, "lpPrintTemplateName", "I");
- lpCache->lpSetupTemplateName = (*env)->GetFieldID(env, lpCache->clazz, "lpSetupTemplateName", "I");
- lpCache->hPrintTemplate = (*env)->GetFieldID(env, lpCache->clazz, "hPrintTemplate", "I");
- lpCache->hSetupTemplate = (*env)->GetFieldID(env, lpCache->clazz, "hSetupTemplate", "I");
- lpCache->cached = 1;
-}
-
-PRINTDLG* getPRINTDLGFields(JNIEnv *env, jobject lpObject, PRINTDLG *lpStruct, PPRINTDLG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePRINTDLGFids(env, lpObject, lpCache);
- lpStruct->lStructSize = (*env)->GetIntField(env, lpObject, lpCache->lStructSize);
- lpStruct->hwndOwner = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndOwner);
- lpStruct->hDevMode = (HGLOBAL)(*env)->GetIntField(env, lpObject, lpCache->hDevMode);
- lpStruct->hDevNames = (HGLOBAL)(*env)->GetIntField(env, lpObject, lpCache->hDevNames);
- lpStruct->hDC = (HDC)(*env)->GetIntField(env, lpObject, lpCache->hDC);
- lpStruct->Flags = (*env)->GetIntField(env, lpObject, lpCache->Flags);
- lpStruct->nFromPage = (*env)->GetShortField(env, lpObject, lpCache->nFromPage);
- lpStruct->nToPage = (*env)->GetShortField(env, lpObject, lpCache->nToPage);
- lpStruct->nMinPage = (*env)->GetShortField(env, lpObject, lpCache->nMinPage);
- lpStruct->nMaxPage = (*env)->GetShortField(env, lpObject, lpCache->nMaxPage);
- lpStruct->nCopies = (*env)->GetShortField(env, lpObject, lpCache->nCopies);
- lpStruct->hInstance = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->lCustData = (*env)->GetIntField(env, lpObject, lpCache->lCustData);
- lpStruct->lpfnPrintHook = (LPPRINTHOOKPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnPrintHook);
- lpStruct->lpfnSetupHook = (LPPRINTHOOKPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnSetupHook);
- lpStruct->lpPrintTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpPrintTemplateName);
- lpStruct->lpSetupTemplateName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpSetupTemplateName);
- lpStruct->hPrintTemplate = (HGLOBAL)(*env)->GetIntField(env, lpObject, lpCache->hPrintTemplate);
- lpStruct->hSetupTemplate = (HGLOBAL)(*env)->GetIntField(env, lpObject, lpCache->hSetupTemplate);
- return lpStruct;
-}
-
-void setPRINTDLGFields(JNIEnv *env, jobject lpObject, PRINTDLG *lpStruct, PPRINTDLG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cachePRINTDLGFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->lStructSize, lpStruct->lStructSize);
- (*env)->SetIntField(env, lpObject, lpCache->hwndOwner, (jint)lpStruct->hwndOwner);
- (*env)->SetIntField(env, lpObject, lpCache->hDevMode, (jint)lpStruct->hDevMode);
- (*env)->SetIntField(env, lpObject, lpCache->hDevNames, (jint)lpStruct->hDevNames);
- (*env)->SetIntField(env, lpObject, lpCache->hDC, (jint)lpStruct->hDC);
- (*env)->SetIntField(env, lpObject, lpCache->Flags, lpStruct->Flags);
- (*env)->SetShortField(env, lpObject, lpCache->nFromPage, lpStruct->nFromPage);
- (*env)->SetShortField(env, lpObject, lpCache->nToPage, lpStruct->nToPage);
- (*env)->SetShortField(env, lpObject, lpCache->nMinPage, lpStruct->nMinPage);
- (*env)->SetShortField(env, lpObject, lpCache->nMaxPage, lpStruct->nMaxPage);
- (*env)->SetShortField(env, lpObject, lpCache->nCopies, lpStruct->nCopies);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->lCustData, lpStruct->lCustData);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnPrintHook, (jint)lpStruct->lpfnPrintHook);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnSetupHook, (jint)lpStruct->lpfnSetupHook);
- (*env)->SetIntField(env, lpObject, lpCache->lpPrintTemplateName, (jint)lpStruct->lpPrintTemplateName);
- (*env)->SetIntField(env, lpObject, lpCache->lpSetupTemplateName, (jint)lpStruct->lpSetupTemplateName);
- (*env)->SetIntField(env, lpObject, lpCache->hPrintTemplate, (jint)lpStruct->hPrintTemplate);
- (*env)->SetIntField(env, lpObject, lpCache->hSetupTemplate, (jint)lpStruct->hSetupTemplate);
-}
-
-#endif // _WIN32_WCE
-
-void cacheREBARBANDINFOFids(JNIEnv *env, jobject lpObject, PREBARBANDINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->fMask = (*env)->GetFieldID(env, lpCache->clazz, "fMask", "I");
- lpCache->fStyle = (*env)->GetFieldID(env, lpCache->clazz, "fStyle", "I");
- lpCache->clrFore = (*env)->GetFieldID(env, lpCache->clazz, "clrFore", "I");
- lpCache->clrBack = (*env)->GetFieldID(env, lpCache->clazz, "clrBack", "I");
- lpCache->lpText = (*env)->GetFieldID(env, lpCache->clazz, "lpText", "I");
- lpCache->cch = (*env)->GetFieldID(env, lpCache->clazz, "cch", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->hwndChild = (*env)->GetFieldID(env, lpCache->clazz, "hwndChild", "I");
- lpCache->cxMinChild = (*env)->GetFieldID(env, lpCache->clazz, "cxMinChild", "I");
- lpCache->cyMinChild = (*env)->GetFieldID(env, lpCache->clazz, "cyMinChild", "I");
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "I");
- lpCache->hbmBack = (*env)->GetFieldID(env, lpCache->clazz, "hbmBack", "I");
- lpCache->wID = (*env)->GetFieldID(env, lpCache->clazz, "wID", "I");
-#ifndef _WIN32_WCE
- lpCache->cyChild = (*env)->GetFieldID(env, lpCache->clazz, "cyChild", "I");
- lpCache->cyMaxChild = (*env)->GetFieldID(env, lpCache->clazz, "cyMaxChild", "I");
- lpCache->cyIntegral = (*env)->GetFieldID(env, lpCache->clazz, "cyIntegral", "I");
- lpCache->cxIdeal = (*env)->GetFieldID(env, lpCache->clazz, "cxIdeal", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cxHeader = (*env)->GetFieldID(env, lpCache->clazz, "cxHeader", "I");
-#endif // _WIN32_WCE
- lpCache->cached = 1;
-}
-
-REBARBANDINFO* getREBARBANDINFOFields(JNIEnv *env, jobject lpObject, REBARBANDINFO *lpStruct, PREBARBANDINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheREBARBANDINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->fMask = (*env)->GetIntField(env, lpObject, lpCache->fMask);
- lpStruct->fStyle = (*env)->GetIntField(env, lpObject, lpCache->fStyle);
- lpStruct->clrFore = (*env)->GetIntField(env, lpObject, lpCache->clrFore);
- lpStruct->clrBack = (*env)->GetIntField(env, lpObject, lpCache->clrBack);
- lpStruct->lpText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpText);
- lpStruct->cch = (*env)->GetIntField(env, lpObject, lpCache->cch);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->hwndChild = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndChild);
- lpStruct->cxMinChild = (*env)->GetIntField(env, lpObject, lpCache->cxMinChild);
- lpStruct->cyMinChild = (*env)->GetIntField(env, lpObject, lpCache->cyMinChild);
- lpStruct->cx = (*env)->GetIntField(env, lpObject, lpCache->cx);
- lpStruct->hbmBack = (HBITMAP)(*env)->GetIntField(env, lpObject, lpCache->hbmBack);
- lpStruct->wID = (*env)->GetIntField(env, lpObject, lpCache->wID);
-#ifndef _WIN32_WCE
- lpStruct->cyChild = (*env)->GetIntField(env, lpObject, lpCache->cyChild);
- lpStruct->cyMaxChild = (*env)->GetIntField(env, lpObject, lpCache->cyMaxChild);
- lpStruct->cyIntegral = (*env)->GetIntField(env, lpObject, lpCache->cyIntegral);
- lpStruct->cxIdeal = (*env)->GetIntField(env, lpObject, lpCache->cxIdeal);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->cxHeader = (*env)->GetIntField(env, lpObject, lpCache->cxHeader);
-#endif // _WIN32_WCE
- return lpStruct;
-}
-
-void setREBARBANDINFOFields(JNIEnv *env, jobject lpObject, REBARBANDINFO *lpStruct, PREBARBANDINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheREBARBANDINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->fMask, lpStruct->fMask);
- (*env)->SetIntField(env, lpObject, lpCache->fStyle, lpStruct->fStyle);
- (*env)->SetIntField(env, lpObject, lpCache->clrFore, lpStruct->clrFore);
- (*env)->SetIntField(env, lpObject, lpCache->clrBack, lpStruct->clrBack);
- (*env)->SetIntField(env, lpObject, lpCache->lpText, (jint)lpStruct->lpText);
- (*env)->SetIntField(env, lpObject, lpCache->cch, lpStruct->cch);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->hwndChild, (jint)lpStruct->hwndChild);
- (*env)->SetIntField(env, lpObject, lpCache->cxMinChild, lpStruct->cxMinChild);
- (*env)->SetIntField(env, lpObject, lpCache->cyMinChild, lpStruct->cyMinChild);
- (*env)->SetIntField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->hbmBack, (jint)lpStruct->hbmBack);
- (*env)->SetIntField(env, lpObject, lpCache->wID, lpStruct->wID);
-#ifndef _WIN32_WCE
- (*env)->SetIntField(env, lpObject, lpCache->cyChild, lpStruct->cyChild);
- (*env)->SetIntField(env, lpObject, lpCache->cyMaxChild, lpStruct->cyMaxChild);
- (*env)->SetIntField(env, lpObject, lpCache->cyIntegral, lpStruct->cyIntegral);
- (*env)->SetIntField(env, lpObject, lpCache->cxIdeal, lpStruct->cxIdeal);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->cxHeader, lpStruct->cxHeader);
-#endif // _WIN32_WCE
-}
-
-void cacheRECTFids(JNIEnv *env, jobject lpObject, PRECT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->cached = 1;
-}
-
-RECT* getRECTFields(JNIEnv *env, jobject lpObject, RECT *lpStruct, PRECT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheRECTFids(env, lpObject, lpCache);
- lpStruct->left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- return lpStruct;
-}
-
-void setRECTFields(JNIEnv *env, jobject lpObject, RECT *lpStruct, PRECT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheRECTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->bottom);
-}
-
-void cacheSCROLLINFOFids(JNIEnv *env, jobject lpObject, PSCROLLINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->fMask = (*env)->GetFieldID(env, lpCache->clazz, "fMask", "I");
- lpCache->nMin = (*env)->GetFieldID(env, lpCache->clazz, "nMin", "I");
- lpCache->nMax = (*env)->GetFieldID(env, lpCache->clazz, "nMax", "I");
- lpCache->nPage = (*env)->GetFieldID(env, lpCache->clazz, "nPage", "I");
- lpCache->nPos = (*env)->GetFieldID(env, lpCache->clazz, "nPos", "I");
- lpCache->nTrackPos = (*env)->GetFieldID(env, lpCache->clazz, "nTrackPos", "I");
- lpCache->cached = 1;
-}
-
-SCROLLINFO* getSCROLLINFOFields(JNIEnv *env, jobject lpObject, SCROLLINFO *lpStruct, PSCROLLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSCROLLINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->fMask = (*env)->GetIntField(env, lpObject, lpCache->fMask);
- lpStruct->nMin = (*env)->GetIntField(env, lpObject, lpCache->nMin);
- lpStruct->nMax = (*env)->GetIntField(env, lpObject, lpCache->nMax);
- lpStruct->nPage = (*env)->GetIntField(env, lpObject, lpCache->nPage);
- lpStruct->nPos = (*env)->GetIntField(env, lpObject, lpCache->nPos);
- lpStruct->nTrackPos = (*env)->GetIntField(env, lpObject, lpCache->nTrackPos);
- return lpStruct;
-}
-
-void setSCROLLINFOFields(JNIEnv *env, jobject lpObject, SCROLLINFO *lpStruct, PSCROLLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSCROLLINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->fMask, lpStruct->fMask);
- (*env)->SetIntField(env, lpObject, lpCache->nMin, lpStruct->nMin);
- (*env)->SetIntField(env, lpObject, lpCache->nMax, lpStruct->nMax);
- (*env)->SetIntField(env, lpObject, lpCache->nPage, lpStruct->nPage);
- (*env)->SetIntField(env, lpObject, lpCache->nPos, lpStruct->nPos);
- (*env)->SetIntField(env, lpObject, lpCache->nTrackPos, lpStruct->nTrackPos);
-}
-
-void cacheSHELLEXECUTEINFOFids(JNIEnv *env, jobject lpObject, PSHELLEXECUTEINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->fMask = (*env)->GetFieldID(env, lpCache->clazz, "fMask", "I");
- lpCache->hwnd = (*env)->GetFieldID(env, lpCache->clazz, "hwnd", "I");
- lpCache->lpVerb = (*env)->GetFieldID(env, lpCache->clazz, "lpVerb", "I");
- lpCache->lpFile = (*env)->GetFieldID(env, lpCache->clazz, "lpFile", "I");
- lpCache->lpParameters = (*env)->GetFieldID(env, lpCache->clazz, "lpParameters", "I");
- lpCache->lpDirectory = (*env)->GetFieldID(env, lpCache->clazz, "lpDirectory", "I");
- lpCache->nShow = (*env)->GetFieldID(env, lpCache->clazz, "nShow", "I");
- lpCache->hInstApp = (*env)->GetFieldID(env, lpCache->clazz, "hInstApp", "I");
- lpCache->lpIDList = (*env)->GetFieldID(env, lpCache->clazz, "lpIDList", "I");
- lpCache->lpClass = (*env)->GetFieldID(env, lpCache->clazz, "lpClass", "I");
- lpCache->hkeyClass = (*env)->GetFieldID(env, lpCache->clazz, "hkeyClass", "I");
- lpCache->dwHotKey = (*env)->GetFieldID(env, lpCache->clazz, "dwHotKey", "I");
- lpCache->hIcon = (*env)->GetFieldID(env, lpCache->clazz, "hIcon", "I");
- lpCache->hProcess = (*env)->GetFieldID(env, lpCache->clazz, "hProcess", "I");
- lpCache->cached = 1;
-}
-
-SHELLEXECUTEINFO* getSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO *lpStruct, PSHELLEXECUTEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSHELLEXECUTEINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->fMask = (*env)->GetIntField(env, lpObject, lpCache->fMask);
- lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwnd);
- lpStruct->lpVerb = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpVerb);
- lpStruct->lpFile = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpFile);
- lpStruct->lpParameters = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpParameters);
- lpStruct->lpDirectory = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpDirectory);
- lpStruct->nShow = (*env)->GetIntField(env, lpObject, lpCache->nShow);
- lpStruct->hInstApp = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstApp);
- lpStruct->lpIDList = (LPVOID)(*env)->GetIntField(env, lpObject, lpCache->lpIDList);
- lpStruct->lpClass = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpClass);
- lpStruct->hkeyClass = (HKEY)(*env)->GetIntField(env, lpObject, lpCache->hkeyClass);
- lpStruct->dwHotKey = (*env)->GetIntField(env, lpObject, lpCache->dwHotKey);
- lpStruct->hIcon = (HANDLE)(*env)->GetIntField(env, lpObject, lpCache->hIcon);
- lpStruct->hProcess = (HANDLE)(*env)->GetIntField(env, lpObject, lpCache->hProcess);
- return lpStruct;
-}
-
-void setSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO *lpStruct, PSHELLEXECUTEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSHELLEXECUTEINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->fMask, lpStruct->fMask);
- (*env)->SetIntField(env, lpObject, lpCache->hwnd, (jint)lpStruct->hwnd);
- (*env)->SetIntField(env, lpObject, lpCache->lpVerb, (jint)lpStruct->lpVerb);
- (*env)->SetIntField(env, lpObject, lpCache->lpFile, (jint)lpStruct->lpFile);
- (*env)->SetIntField(env, lpObject, lpCache->lpParameters, (jint)lpStruct->lpParameters);
- (*env)->SetIntField(env, lpObject, lpCache->lpDirectory, (jint)lpStruct->lpDirectory);
- (*env)->SetIntField(env, lpObject, lpCache->nShow, lpStruct->nShow);
- (*env)->SetIntField(env, lpObject, lpCache->hInstApp, (jint)lpStruct->hInstApp);
- (*env)->SetIntField(env, lpObject, lpCache->lpIDList, (jint)lpStruct->lpIDList);
- (*env)->SetIntField(env, lpObject, lpCache->lpClass, (jint)lpStruct->lpClass);
- (*env)->SetIntField(env, lpObject, lpCache->hkeyClass, (jint)lpStruct->hkeyClass);
- (*env)->SetIntField(env, lpObject, lpCache->dwHotKey, lpStruct->dwHotKey);
- (*env)->SetIntField(env, lpObject, lpCache->hIcon, (jint)lpStruct->hIcon);
- (*env)->SetIntField(env, lpObject, lpCache->hProcess, (jint)lpStruct->hProcess);
-}
-
-#ifdef _WIN32_WCE
-void cacheSHMENUBARINFOFids(JNIEnv *env, jobject lpObject, PSHMENUBARINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->hwndParent = (*env)->GetFieldID(env, lpCache->clazz, "hwndParent", "I");
- lpCache->dwFlags = (*env)->GetFieldID(env, lpCache->clazz, "dwFlags", "I");
- lpCache->nToolBarId = (*env)->GetFieldID(env, lpCache->clazz, "nToolBarId", "I");
- lpCache->hInstRes = (*env)->GetFieldID(env, lpCache->clazz, "hInstRes", "I");
- lpCache->nBmpId = (*env)->GetFieldID(env, lpCache->clazz, "nBmpId", "I");
- lpCache->cBmpImages = (*env)->GetFieldID(env, lpCache->clazz, "cBmpImages", "I");
- lpCache->hwndMB = (*env)->GetFieldID(env, lpCache->clazz, "hwndMB", "I");
- lpCache->cached = 1;
-}
-
-SHMENUBARINFO* getSHMENUBARINFOFields(JNIEnv *env, jobject lpObject, SHMENUBARINFO *lpStruct, PSHMENUBARINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSHMENUBARINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (DWORD)(*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->hwndParent = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndParent);
- lpStruct->dwFlags = (DWORD)(*env)->GetIntField(env, lpObject, lpCache->dwFlags);
- lpStruct->nToolBarId = (UINT)(*env)->GetIntField(env, lpObject, lpCache->nToolBarId);
- lpStruct->hInstRes = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstRes);
- lpStruct->nBmpId = (*env)->GetIntField(env, lpObject, lpCache->nBmpId);
- lpStruct->cBmpImages = (*env)->GetIntField(env, lpObject, lpCache->cBmpImages);
- lpStruct->hwndMB = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndMB);
- return lpStruct;
-}
-
-void setSHMENUBARINFOFields(JNIEnv *env, jobject lpObject, SHMENUBARINFO *lpStruct, PSHMENUBARINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSHMENUBARINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, (jint)lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->hwndParent, (jint)lpStruct->hwndParent);
- (*env)->SetIntField(env, lpObject, lpCache->dwFlags, (jint)lpStruct->dwFlags);
- (*env)->SetIntField(env, lpObject, lpCache->nToolBarId, (jint)lpStruct->nToolBarId);
- (*env)->SetIntField(env, lpObject, lpCache->hInstRes, (jint)lpStruct->hInstRes);
- (*env)->SetIntField(env, lpObject, lpCache->nBmpId, (jint)lpStruct->nBmpId);
- (*env)->SetIntField(env, lpObject, lpCache->cBmpImages, (jint)lpStruct->cBmpImages);
- (*env)->SetIntField(env, lpObject, lpCache->hwndMB, (jint)lpStruct->hwndMB);
-}
-#endif // _WIN32_WCE
-
-void cacheSIZEFids(JNIEnv *env, jobject lpObject, PSIZE_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "I");
- lpCache->cy = (*env)->GetFieldID(env, lpCache->clazz, "cy", "I");
- lpCache->cached = 1;
-}
-
-SIZE* getSIZEFields(JNIEnv *env, jobject lpObject, SIZE *lpStruct, PSIZE_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSIZEFids(env, lpObject, lpCache);
- lpStruct->cx = (*env)->GetIntField(env, lpObject, lpCache->cx);
- lpStruct->cy = (*env)->GetIntField(env, lpObject, lpCache->cy);
- return lpStruct;
-}
-
-void setSIZEFields(JNIEnv *env, jobject lpObject, SIZE *lpStruct, PSIZE_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSIZEFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->cy, lpStruct->cy);
-}
-
-void cacheTBBUTTONFids(JNIEnv *env, jobject lpObject, PTBBUTTON_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->iBitmap = (*env)->GetFieldID(env, lpCache->clazz, "iBitmap", "I");
- lpCache->idCommand = (*env)->GetFieldID(env, lpCache->clazz, "idCommand", "I");
- lpCache->fsState = (*env)->GetFieldID(env, lpCache->clazz, "fsState", "B");
- lpCache->fsStyle = (*env)->GetFieldID(env, lpCache->clazz, "fsStyle", "B");
- lpCache->dwData = (*env)->GetFieldID(env, lpCache->clazz, "dwData", "I");
- lpCache->iString = (*env)->GetFieldID(env, lpCache->clazz, "iString", "I");
- lpCache->cached = 1;
-}
-
-TBBUTTON* getTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct, PTBBUTTON_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTBBUTTONFids(env, lpObject, lpCache);
- lpStruct->iBitmap = (*env)->GetIntField(env, lpObject, lpCache->iBitmap);
- lpStruct->idCommand = (*env)->GetIntField(env, lpObject, lpCache->idCommand);
- lpStruct->fsState = (*env)->GetByteField(env, lpObject, lpCache->fsState);
- lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, lpCache->fsStyle);
- lpStruct->dwData = (*env)->GetIntField(env, lpObject, lpCache->dwData);
- lpStruct->iString = (*env)->GetIntField(env, lpObject, lpCache->iString);
- return lpStruct;
-}
-
-void setTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct, PTBBUTTON_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTBBUTTONFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->iBitmap, lpStruct->iBitmap);
- (*env)->SetIntField(env, lpObject, lpCache->idCommand, lpStruct->idCommand);
- (*env)->SetByteField(env, lpObject, lpCache->fsState, lpStruct->fsState);
- (*env)->SetByteField(env, lpObject, lpCache->fsStyle, lpStruct->fsStyle);
- (*env)->SetIntField(env, lpObject, lpCache->dwData, lpStruct->dwData);
- (*env)->SetIntField(env, lpObject, lpCache->iString, lpStruct->iString);
-}
-
-void cacheTBBUTTONINFOFids(JNIEnv *env, jobject lpObject, PTBBUTTONINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->dwMask = (*env)->GetFieldID(env, lpCache->clazz, "dwMask", "I");
- lpCache->idCommand = (*env)->GetFieldID(env, lpCache->clazz, "idCommand", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->fsState = (*env)->GetFieldID(env, lpCache->clazz, "fsState", "B");
- lpCache->fsStyle = (*env)->GetFieldID(env, lpCache->clazz, "fsStyle", "B");
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "S");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchText = (*env)->GetFieldID(env, lpCache->clazz, "cchText", "I");
- lpCache->cached = 1;
-}
-
-TBBUTTONINFO* getTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct, PTBBUTTONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTBBUTTONINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->dwMask = (*env)->GetIntField(env, lpObject, lpCache->dwMask);
- lpStruct->idCommand = (*env)->GetIntField(env, lpObject, lpCache->idCommand);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->fsState = (*env)->GetByteField(env, lpObject, lpCache->fsState);
- lpStruct->fsStyle = (*env)->GetByteField(env, lpObject, lpCache->fsStyle);
- lpStruct->cx = (*env)->GetShortField(env, lpObject, lpCache->cx);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->cchText = (*env)->GetIntField(env, lpObject, lpCache->cchText);
- return lpStruct;
-}
-
-void setTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct, PTBBUTTONINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTBBUTTONINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwMask, lpStruct->dwMask);
- (*env)->SetIntField(env, lpObject, lpCache->idCommand, lpStruct->idCommand);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetByteField(env, lpObject, lpCache->fsState, lpStruct->fsState);
- (*env)->SetByteField(env, lpObject, lpCache->fsStyle, lpStruct->fsStyle);
- (*env)->SetShortField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchText, lpStruct->cchText);
-}
-
-void cacheTCITEMFids(JNIEnv *env, jobject lpObject, PTCITEM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->dwState = (*env)->GetFieldID(env, lpCache->clazz, "dwState", "I");
- lpCache->dwStateMask = (*env)->GetFieldID(env, lpCache->clazz, "dwStateMask", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-TCITEM* getTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct, PTCITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTCITEMFids(env, lpObject, lpCache);
- lpStruct->mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->dwState = (*env)->GetIntField(env, lpObject, lpCache->dwState);
- lpStruct->dwStateMask = (*env)->GetIntField(env, lpObject, lpCache->dwStateMask);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct, PTCITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTCITEMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->mask);
- (*env)->SetIntField(env, lpObject, lpCache->dwState, lpStruct->dwState);
- (*env)->SetIntField(env, lpObject, lpCache->dwStateMask, lpStruct->dwStateMask);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-void cacheTEXTMETRICFids(JNIEnv *env, jobject lpObject, PTEXTMETRIC_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->tmHeight = (*env)->GetFieldID(env, lpCache->clazz, "tmHeight", "I");
- lpCache->tmAscent = (*env)->GetFieldID(env, lpCache->clazz, "tmAscent", "I");
- lpCache->tmDescent = (*env)->GetFieldID(env, lpCache->clazz, "tmDescent", "I");
- lpCache->tmInternalLeading = (*env)->GetFieldID(env, lpCache->clazz, "tmInternalLeading", "I");
- lpCache->tmExternalLeading = (*env)->GetFieldID(env, lpCache->clazz, "tmExternalLeading", "I");
- lpCache->tmAveCharWidth = (*env)->GetFieldID(env, lpCache->clazz, "tmAveCharWidth", "I");
- lpCache->tmMaxCharWidth = (*env)->GetFieldID(env, lpCache->clazz, "tmMaxCharWidth", "I");
- lpCache->tmWeight = (*env)->GetFieldID(env, lpCache->clazz, "tmWeight", "I");
- lpCache->tmOverhang = (*env)->GetFieldID(env, lpCache->clazz, "tmOverhang", "I");
- lpCache->tmDigitizedAspectX = (*env)->GetFieldID(env, lpCache->clazz, "tmDigitizedAspectX", "I");
- lpCache->tmDigitizedAspectY = (*env)->GetFieldID(env, lpCache->clazz, "tmDigitizedAspectY", "I");
- lpCache->tmItalic = (*env)->GetFieldID(env, lpCache->clazz, "tmItalic", "B");
- lpCache->tmUnderlined = (*env)->GetFieldID(env, lpCache->clazz, "tmUnderlined", "B");
- lpCache->tmStruckOut = (*env)->GetFieldID(env, lpCache->clazz, "tmStruckOut", "B");
- lpCache->tmPitchAndFamily = (*env)->GetFieldID(env, lpCache->clazz, "tmPitchAndFamily", "B");
- lpCache->tmCharSet = (*env)->GetFieldID(env, lpCache->clazz, "tmCharSet", "B");
- lpCache->cached = 1;
-}
-
-#ifndef _WIN32_WCE
-
-TEXTMETRICA* getTEXTMETRICAFields(JNIEnv *env, jobject lpObject, TEXTMETRICA *lpStruct, PTEXTMETRIC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTEXTMETRICFids(env, lpObject, lpCache);
- lpStruct->tmHeight = (*env)->GetIntField(env, lpObject, lpCache->tmHeight);
- lpStruct->tmAscent = (*env)->GetIntField(env, lpObject, lpCache->tmAscent);
- lpStruct->tmDescent = (*env)->GetIntField(env, lpObject, lpCache->tmDescent);
- lpStruct->tmInternalLeading = (*env)->GetIntField(env, lpObject, lpCache->tmInternalLeading);
- lpStruct->tmExternalLeading = (*env)->GetIntField(env, lpObject, lpCache->tmExternalLeading);
- lpStruct->tmAveCharWidth = (*env)->GetIntField(env, lpObject, lpCache->tmAveCharWidth);
- lpStruct->tmMaxCharWidth = (*env)->GetIntField(env, lpObject, lpCache->tmMaxCharWidth);
- lpStruct->tmWeight = (*env)->GetIntField(env, lpObject, lpCache->tmWeight);
- lpStruct->tmOverhang = (*env)->GetIntField(env, lpObject, lpCache->tmOverhang);
- lpStruct->tmDigitizedAspectX = (*env)->GetIntField(env, lpObject, lpCache->tmDigitizedAspectX);
- lpStruct->tmDigitizedAspectY = (*env)->GetIntField(env, lpObject, lpCache->tmDigitizedAspectY);
- lpStruct->tmItalic = (*env)->GetByteField(env, lpObject, lpCache->tmItalic);
- lpStruct->tmUnderlined = (*env)->GetByteField(env, lpObject, lpCache->tmUnderlined);
- lpStruct->tmStruckOut = (*env)->GetByteField(env, lpObject, lpCache->tmStruckOut);
- lpStruct->tmPitchAndFamily = (*env)->GetByteField(env, lpObject, lpCache->tmPitchAndFamily);
- lpStruct->tmCharSet = (*env)->GetByteField(env, lpObject, lpCache->tmCharSet);
- return lpStruct;
-}
-
-void setTEXTMETRICAFields(JNIEnv *env, jobject lpObject, TEXTMETRICA *lpStruct, PTEXTMETRIC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTEXTMETRICFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->tmHeight, lpStruct->tmHeight);
- (*env)->SetIntField(env, lpObject, lpCache->tmAscent, lpStruct->tmAscent);
- (*env)->SetIntField(env, lpObject, lpCache->tmDescent, lpStruct->tmDescent);
- (*env)->SetIntField(env, lpObject, lpCache->tmInternalLeading, lpStruct->tmInternalLeading);
- (*env)->SetIntField(env, lpObject, lpCache->tmExternalLeading, lpStruct->tmExternalLeading);
- (*env)->SetIntField(env, lpObject, lpCache->tmAveCharWidth, lpStruct->tmAveCharWidth);
- (*env)->SetIntField(env, lpObject, lpCache->tmMaxCharWidth, lpStruct->tmMaxCharWidth);
- (*env)->SetIntField(env, lpObject, lpCache->tmWeight, lpStruct->tmWeight);
- (*env)->SetIntField(env, lpObject, lpCache->tmOverhang, lpStruct->tmOverhang);
- (*env)->SetIntField(env, lpObject, lpCache->tmDigitizedAspectX, lpStruct->tmDigitizedAspectX);
- (*env)->SetIntField(env, lpObject, lpCache->tmDigitizedAspectY, lpStruct->tmDigitizedAspectY);
- (*env)->SetByteField(env, lpObject, lpCache->tmItalic, lpStruct->tmItalic);
- (*env)->SetByteField(env, lpObject, lpCache->tmUnderlined, lpStruct->tmUnderlined);
- (*env)->SetByteField(env, lpObject, lpCache->tmStruckOut, lpStruct->tmStruckOut);
- (*env)->SetByteField(env, lpObject, lpCache->tmPitchAndFamily, lpStruct->tmPitchAndFamily);
- (*env)->SetByteField(env, lpObject, lpCache->tmCharSet, lpStruct->tmCharSet);
-}
-
-#endif // _WIN32_WCE
-
-TEXTMETRICW* getTEXTMETRICWFields(JNIEnv *env, jobject lpObject, TEXTMETRICW *lpStruct, PTEXTMETRIC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTEXTMETRICFids(env, lpObject, lpCache);
- lpStruct->tmHeight = (*env)->GetIntField(env, lpObject, lpCache->tmHeight);
- lpStruct->tmAscent = (*env)->GetIntField(env, lpObject, lpCache->tmAscent);
- lpStruct->tmDescent = (*env)->GetIntField(env, lpObject, lpCache->tmDescent);
- lpStruct->tmInternalLeading = (*env)->GetIntField(env, lpObject, lpCache->tmInternalLeading);
- lpStruct->tmExternalLeading = (*env)->GetIntField(env, lpObject, lpCache->tmExternalLeading);
- lpStruct->tmAveCharWidth = (*env)->GetIntField(env, lpObject, lpCache->tmAveCharWidth);
- lpStruct->tmMaxCharWidth = (*env)->GetIntField(env, lpObject, lpCache->tmMaxCharWidth);
- lpStruct->tmWeight = (*env)->GetIntField(env, lpObject, lpCache->tmWeight);
- lpStruct->tmOverhang = (*env)->GetIntField(env, lpObject, lpCache->tmOverhang);
- lpStruct->tmDigitizedAspectX = (*env)->GetIntField(env, lpObject, lpCache->tmDigitizedAspectX);
- lpStruct->tmDigitizedAspectY = (*env)->GetIntField(env, lpObject, lpCache->tmDigitizedAspectY);
- lpStruct->tmItalic = (*env)->GetByteField(env, lpObject, lpCache->tmItalic);
- lpStruct->tmUnderlined = (*env)->GetByteField(env, lpObject, lpCache->tmUnderlined);
- lpStruct->tmStruckOut = (*env)->GetByteField(env, lpObject, lpCache->tmStruckOut);
- lpStruct->tmPitchAndFamily = (*env)->GetByteField(env, lpObject, lpCache->tmPitchAndFamily);
- lpStruct->tmCharSet = (*env)->GetByteField(env, lpObject, lpCache->tmCharSet);
- return lpStruct;
-}
-
-void setTEXTMETRICWFields(JNIEnv *env, jobject lpObject, TEXTMETRICW *lpStruct, PTEXTMETRIC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTEXTMETRICFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->tmHeight, lpStruct->tmHeight);
- (*env)->SetIntField(env, lpObject, lpCache->tmAscent, lpStruct->tmAscent);
- (*env)->SetIntField(env, lpObject, lpCache->tmDescent, lpStruct->tmDescent);
- (*env)->SetIntField(env, lpObject, lpCache->tmInternalLeading, lpStruct->tmInternalLeading);
- (*env)->SetIntField(env, lpObject, lpCache->tmExternalLeading, lpStruct->tmExternalLeading);
- (*env)->SetIntField(env, lpObject, lpCache->tmAveCharWidth, lpStruct->tmAveCharWidth);
- (*env)->SetIntField(env, lpObject, lpCache->tmMaxCharWidth, lpStruct->tmMaxCharWidth);
- (*env)->SetIntField(env, lpObject, lpCache->tmWeight, lpStruct->tmWeight);
- (*env)->SetIntField(env, lpObject, lpCache->tmOverhang, lpStruct->tmOverhang);
- (*env)->SetIntField(env, lpObject, lpCache->tmDigitizedAspectX, lpStruct->tmDigitizedAspectX);
- (*env)->SetIntField(env, lpObject, lpCache->tmDigitizedAspectY, lpStruct->tmDigitizedAspectY);
- (*env)->SetByteField(env, lpObject, lpCache->tmItalic, lpStruct->tmItalic);
- (*env)->SetByteField(env, lpObject, lpCache->tmUnderlined, lpStruct->tmUnderlined);
- (*env)->SetByteField(env, lpObject, lpCache->tmStruckOut, lpStruct->tmStruckOut);
- (*env)->SetByteField(env, lpObject, lpCache->tmPitchAndFamily, lpStruct->tmPitchAndFamily);
- (*env)->SetByteField(env, lpObject, lpCache->tmCharSet, lpStruct->tmCharSet);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheTOOLINFOFids(JNIEnv *env, jobject lpObject, PTOOLINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->uFlags = (*env)->GetFieldID(env, lpCache->clazz, "uFlags", "I");
- lpCache->hwnd = (*env)->GetFieldID(env, lpCache->clazz, "hwnd", "I");
- lpCache->uId = (*env)->GetFieldID(env, lpCache->clazz, "uId", "I");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->hinst = (*env)->GetFieldID(env, lpCache->clazz, "hinst", "I");
- lpCache->lpszText = (*env)->GetFieldID(env, lpCache->clazz, "lpszText", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-TOOLINFO* getTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct, PTOOLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTOOLINFOFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->uFlags = (*env)->GetIntField(env, lpObject, lpCache->uFlags);
- lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwnd);
- lpStruct->uId = (*env)->GetIntField(env, lpObject, lpCache->uId);
- lpStruct->rect.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rect.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rect.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->rect.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- lpStruct->hinst = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hinst);
- lpStruct->lpszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszText);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct, PTOOLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTOOLINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->uFlags, lpStruct->uFlags);
- (*env)->SetIntField(env, lpObject, lpCache->hwnd, (jint)lpStruct->hwnd);
- (*env)->SetIntField(env, lpObject, lpCache->uId, lpStruct->uId);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rect.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rect.top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rect.right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rect.bottom);
- (*env)->SetIntField(env, lpObject, lpCache->hinst, (jint)lpStruct->hinst);
- (*env)->SetIntField(env, lpObject, lpCache->lpszText, (jint)lpStruct->lpszText);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-void cacheTRACKMOUSEEVENTFids(JNIEnv *env, jobject lpObject, PTRACKMOUSEEVENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->dwFlags = (*env)->GetFieldID(env, lpCache->clazz, "dwFlags", "I");
- lpCache->hwndTrack = (*env)->GetFieldID(env, lpCache->clazz, "hwndTrack", "I");
- lpCache->dwHoverTime = (*env)->GetFieldID(env, lpCache->clazz, "dwHoverTime", "I");
- lpCache->cached = 1;
-}
-
-TRACKMOUSEEVENT* getTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct, PTRACKMOUSEEVENT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTRACKMOUSEEVENTFids(env, lpObject, lpCache);
- lpStruct->cbSize = (*env)->GetIntField(env, lpObject, lpCache->cbSize);
- lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, lpCache->dwFlags);
- lpStruct->hwndTrack = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndTrack);
- lpStruct->dwHoverTime = (*env)->GetIntField(env, lpObject, lpCache->dwHoverTime);
- return lpStruct;
-}
-
-void setTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct, PTRACKMOUSEEVENT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTRACKMOUSEEVENTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cbSize, lpStruct->cbSize);
- (*env)->SetIntField(env, lpObject, lpCache->dwFlags, lpStruct->dwFlags);
- (*env)->SetIntField(env, lpObject, lpCache->hwndTrack, (jint)lpStruct->hwndTrack);
- (*env)->SetIntField(env, lpObject, lpCache->dwHoverTime, lpStruct->dwHoverTime);
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-void cacheTRIVERTEXFids(JNIEnv *env, jobject lpObject, PTRIVERTEX_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->Red = (*env)->GetFieldID(env, lpCache->clazz, "Red", "S");
- lpCache->Green = (*env)->GetFieldID(env, lpCache->clazz, "Green", "S");
- lpCache->Blue = (*env)->GetFieldID(env, lpCache->clazz, "Blue", "S");
- lpCache->Alpha = (*env)->GetFieldID(env, lpCache->clazz, "Alpha", "S");
- lpCache->cached = 1;
-}
-
-TRIVERTEX* getTRIVERTEXFields(JNIEnv *env, jobject lpObject, TRIVERTEX *lpStruct, PTRIVERTEX_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTRIVERTEXFids(env, lpObject, lpCache);
- lpStruct->x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->Red = (*env)->GetShortField(env, lpObject, lpCache->Red);
- lpStruct->Green = (*env)->GetShortField(env, lpObject, lpCache->Green);
- lpStruct->Blue = (*env)->GetShortField(env, lpObject, lpCache->Blue);
- lpStruct->Alpha = (*env)->GetShortField(env, lpObject, lpCache->Alpha);
- return lpStruct;
-}
-
-void setTRIVERTEXFields(JNIEnv *env, jobject lpObject, TRIVERTEX *lpStruct, PTRIVERTEX_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTRIVERTEXFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->y);
- (*env)->SetShortField(env, lpObject, lpCache->Red, lpStruct->Red);
- (*env)->SetShortField(env, lpObject, lpCache->Green, lpStruct->Green);
- (*env)->SetShortField(env, lpObject, lpCache->Blue, lpStruct->Blue);
- (*env)->SetShortField(env, lpObject, lpCache->Alpha, lpStruct->Alpha);
-}
-
-#endif // _WIN32_WCE
-
-void cacheTVHITTESTINFOFids(JNIEnv *env, jobject lpObject, PTVHITTESTINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->hItem = (*env)->GetFieldID(env, lpCache->clazz, "hItem", "I");
- lpCache->cached = 1;
-}
-
-TVHITTESTINFO* getTVHITTESTINFOFields(JNIEnv *env, jobject lpObject, TVHITTESTINFO *lpStruct, PTVHITTESTINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVHITTESTINFOFids(env, lpObject, lpCache);
- lpStruct->pt.x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->pt.y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- lpStruct->hItem = (HTREEITEM)(*env)->GetIntField(env, lpObject, lpCache->hItem);
- return lpStruct;
-}
-
-void setTVHITTESTINFOFields(JNIEnv *env, jobject lpObject, TVHITTESTINFO *lpStruct, PTVHITTESTINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVHITTESTINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->pt.x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->pt.y);
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetIntField(env, lpObject, lpCache->hItem, (jint)lpStruct->hItem);
-}
-
-void cacheTVINSERTSTRUCTFids(JNIEnv *env, jobject lpObject, PTVINSERTSTRUCT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hParent = (*env)->GetFieldID(env, lpCache->clazz, "hParent", "I");
- lpCache->hInsertAfter = (*env)->GetFieldID(env, lpCache->clazz, "hInsertAfter", "I");
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->hItem = (*env)->GetFieldID(env, lpCache->clazz, "hItem", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->clazz, "state", "I");
- lpCache->stateMask = (*env)->GetFieldID(env, lpCache->clazz, "stateMask", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->iSelectedImage = (*env)->GetFieldID(env, lpCache->clazz, "iSelectedImage", "I");
- lpCache->cChildren = (*env)->GetFieldID(env, lpCache->clazz, "cChildren", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-TVINSERTSTRUCT* getTVINSERTSTRUCTFields(JNIEnv *env, jobject lpObject, TVINSERTSTRUCT *lpStruct, PTVINSERTSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVINSERTSTRUCTFids(env, lpObject, lpCache);
- lpStruct->hParent = (HTREEITEM)(*env)->GetIntField(env, lpObject, lpCache->hParent);
- lpStruct->hInsertAfter = (HTREEITEM)(*env)->GetIntField(env, lpObject, lpCache->hInsertAfter);
- lpStruct->item.mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->item.hItem = (HTREEITEM)(*env)->GetIntField(env, lpObject, lpCache->hItem);
- lpStruct->item.state = (*env)->GetIntField(env, lpObject, lpCache->state);
- lpStruct->item.stateMask = (*env)->GetIntField(env, lpObject, lpCache->stateMask);
- lpStruct->item.pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->item.cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->item.iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->item.iSelectedImage = (*env)->GetIntField(env, lpObject, lpCache->iSelectedImage);
- lpStruct->item.cChildren = (*env)->GetIntField(env, lpObject, lpCache->cChildren);
- lpStruct->item.lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setTVINSERTSTRUCTFields(JNIEnv *env, jobject lpObject, TVINSERTSTRUCT *lpStruct, PTVINSERTSTRUCT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVINSERTSTRUCTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hParent, (jint)lpStruct->hParent);
- (*env)->SetIntField(env, lpObject, lpCache->hInsertAfter, (jint)lpStruct->hInsertAfter);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->item.mask);
- (*env)->SetIntField(env, lpObject, lpCache->hItem, (jint)lpStruct->item.hItem);
- (*env)->SetIntField(env, lpObject, lpCache->state, lpStruct->item.state);
- (*env)->SetIntField(env, lpObject, lpCache->stateMask, lpStruct->item.stateMask);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->item.pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->item.cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->item.iImage);
- (*env)->SetIntField(env, lpObject, lpCache->iSelectedImage, lpStruct->item.iSelectedImage);
- (*env)->SetIntField(env, lpObject, lpCache->cChildren, lpStruct->item.cChildren);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->item.lParam);
-}
-
-void cacheTVITEMFids(JNIEnv *env, jobject lpObject, PTVITEM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->mask = (*env)->GetFieldID(env, lpCache->clazz, "mask", "I");
- lpCache->hItem = (*env)->GetFieldID(env, lpCache->clazz, "hItem", "I");
- lpCache->state = (*env)->GetFieldID(env, lpCache->clazz, "state", "I");
- lpCache->stateMask = (*env)->GetFieldID(env, lpCache->clazz, "stateMask", "I");
- lpCache->pszText = (*env)->GetFieldID(env, lpCache->clazz, "pszText", "I");
- lpCache->cchTextMax = (*env)->GetFieldID(env, lpCache->clazz, "cchTextMax", "I");
- lpCache->iImage = (*env)->GetFieldID(env, lpCache->clazz, "iImage", "I");
- lpCache->iSelectedImage = (*env)->GetFieldID(env, lpCache->clazz, "iSelectedImage", "I");
- lpCache->cChildren = (*env)->GetFieldID(env, lpCache->clazz, "cChildren", "I");
- lpCache->lParam = (*env)->GetFieldID(env, lpCache->clazz, "lParam", "I");
- lpCache->cached = 1;
-}
-
-TVITEM* getTVITEMFields(JNIEnv *env, jobject lpObject, TVITEM *lpStruct, PTVITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVITEMFids(env, lpObject, lpCache);
- lpStruct->mask = (*env)->GetIntField(env, lpObject, lpCache->mask);
- lpStruct->hItem = (HTREEITEM)(*env)->GetIntField(env, lpObject, lpCache->hItem);
- lpStruct->state = (*env)->GetIntField(env, lpObject, lpCache->state);
- lpStruct->stateMask = (*env)->GetIntField(env, lpObject, lpCache->stateMask);
- lpStruct->pszText = (LPTSTR)(*env)->GetIntField(env, lpObject, lpCache->pszText);
- lpStruct->cchTextMax = (*env)->GetIntField(env, lpObject, lpCache->cchTextMax);
- lpStruct->iImage = (*env)->GetIntField(env, lpObject, lpCache->iImage);
- lpStruct->iSelectedImage = (*env)->GetIntField(env, lpObject, lpCache->iSelectedImage);
- lpStruct->cChildren = (*env)->GetIntField(env, lpObject, lpCache->cChildren);
- lpStruct->lParam = (*env)->GetIntField(env, lpObject, lpCache->lParam);
- return lpStruct;
-}
-
-void setTVITEMFields(JNIEnv *env, jobject lpObject, TVITEM *lpStruct, PTVITEM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTVITEMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->mask, lpStruct->mask);
- (*env)->SetIntField(env, lpObject, lpCache->hItem, (jint)lpStruct->hItem);
- (*env)->SetIntField(env, lpObject, lpCache->state, lpStruct->state);
- (*env)->SetIntField(env, lpObject, lpCache->stateMask, lpStruct->stateMask);
- (*env)->SetIntField(env, lpObject, lpCache->pszText, (jint)lpStruct->pszText);
- (*env)->SetIntField(env, lpObject, lpCache->cchTextMax, lpStruct->cchTextMax);
- (*env)->SetIntField(env, lpObject, lpCache->iImage, lpStruct->iImage);
- (*env)->SetIntField(env, lpObject, lpCache->iSelectedImage, lpStruct->iSelectedImage);
- (*env)->SetIntField(env, lpObject, lpCache->cChildren, lpStruct->cChildren);
- (*env)->SetIntField(env, lpObject, lpCache->lParam, lpStruct->lParam);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheWINDOWPLACEMENTFids(JNIEnv *env, jobject lpObject, PWINDOWPLACEMENT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->length = (*env)->GetFieldID(env, lpCache->clazz, "length", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->showCmd = (*env)->GetFieldID(env, lpCache->clazz, "showCmd", "I");
- lpCache->ptMinPosition_x = (*env)->GetFieldID(env, lpCache->clazz, "ptMinPosition_x", "I");
- lpCache->ptMinPosition_y = (*env)->GetFieldID(env, lpCache->clazz, "ptMinPosition_y", "I");
- lpCache->ptMaxPosition_x = (*env)->GetFieldID(env, lpCache->clazz, "ptMaxPosition_x", "I");
- lpCache->ptMaxPosition_y = (*env)->GetFieldID(env, lpCache->clazz, "ptMaxPosition_y", "I");
- lpCache->left = (*env)->GetFieldID(env, lpCache->clazz, "left", "I");
- lpCache->top = (*env)->GetFieldID(env, lpCache->clazz, "top", "I");
- lpCache->right = (*env)->GetFieldID(env, lpCache->clazz, "right", "I");
- lpCache->bottom = (*env)->GetFieldID(env, lpCache->clazz, "bottom", "I");
- lpCache->cached = 1;
-}
-
-WINDOWPLACEMENT* getWINDOWPLACEMENTFields(JNIEnv *env, jobject lpObject, WINDOWPLACEMENT *lpStruct, PWINDOWPLACEMENT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWINDOWPLACEMENTFids(env, lpObject, lpCache);
- lpStruct->length = (*env)->GetIntField(env, lpObject, lpCache->length);
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- lpStruct->showCmd = (*env)->GetIntField(env, lpObject, lpCache->showCmd);
- lpStruct->ptMinPosition.x = (*env)->GetIntField(env, lpObject, lpCache->ptMinPosition_x);
- lpStruct->ptMinPosition.y = (*env)->GetIntField(env, lpObject, lpCache->ptMinPosition_y);
- lpStruct->ptMaxPosition.x = (*env)->GetIntField(env, lpObject, lpCache->ptMaxPosition_x);
- lpStruct->ptMaxPosition.y = (*env)->GetIntField(env, lpObject, lpCache->ptMaxPosition_y);
- lpStruct->rcNormalPosition.left = (*env)->GetIntField(env, lpObject, lpCache->left);
- lpStruct->rcNormalPosition.top = (*env)->GetIntField(env, lpObject, lpCache->top);
- lpStruct->rcNormalPosition.right = (*env)->GetIntField(env, lpObject, lpCache->right);
- lpStruct->rcNormalPosition.bottom = (*env)->GetIntField(env, lpObject, lpCache->bottom);
- return lpStruct;
-}
-
-void setWINDOWPLACEMENTFields(JNIEnv *env, jobject lpObject, WINDOWPLACEMENT *lpStruct, PWINDOWPLACEMENT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWINDOWPLACEMENTFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->length, lpStruct->length);
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
- (*env)->SetIntField(env, lpObject, lpCache->showCmd, lpStruct->showCmd);
- (*env)->SetIntField(env, lpObject, lpCache->ptMinPosition_x, lpStruct->ptMinPosition.x);
- (*env)->SetIntField(env, lpObject, lpCache->ptMinPosition_y, lpStruct->ptMinPosition.y);
- (*env)->SetIntField(env, lpObject, lpCache->ptMaxPosition_x, lpStruct->ptMaxPosition.x);
- (*env)->SetIntField(env, lpObject, lpCache->ptMaxPosition_y, lpStruct->ptMaxPosition.y);
- (*env)->SetIntField(env, lpObject, lpCache->left, lpStruct->rcNormalPosition.left);
- (*env)->SetIntField(env, lpObject, lpCache->top, lpStruct->rcNormalPosition.top);
- (*env)->SetIntField(env, lpObject, lpCache->right, lpStruct->rcNormalPosition.right);
- (*env)->SetIntField(env, lpObject, lpCache->bottom, lpStruct->rcNormalPosition.bottom);
-}
-
-#endif // _WIN32_WCE
-
-void cacheWINDOWPOSFids(JNIEnv *env, jobject lpObject, PWINDOWPOS_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->hwnd = (*env)->GetFieldID(env, lpCache->clazz, "hwnd", "I");
- lpCache->hwndInsertAfter = (*env)->GetFieldID(env, lpCache->clazz, "hwndInsertAfter", "I");
- lpCache->x = (*env)->GetFieldID(env, lpCache->clazz, "x", "I");
- lpCache->y = (*env)->GetFieldID(env, lpCache->clazz, "y", "I");
- lpCache->cx = (*env)->GetFieldID(env, lpCache->clazz, "cx", "I");
- lpCache->cy = (*env)->GetFieldID(env, lpCache->clazz, "cy", "I");
- lpCache->flags = (*env)->GetFieldID(env, lpCache->clazz, "flags", "I");
- lpCache->cached = 1;
-}
-
-WINDOWPOS* getWINDOWPOSFields(JNIEnv *env, jobject lpObject, WINDOWPOS *lpStruct, PWINDOWPOS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWINDOWPOSFids(env, lpObject, lpCache);
- lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwnd);
- lpStruct->hwndInsertAfter = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndInsertAfter);
- lpStruct->x = (*env)->GetIntField(env, lpObject, lpCache->x);
- lpStruct->y = (*env)->GetIntField(env, lpObject, lpCache->y);
- lpStruct->cx = (*env)->GetIntField(env, lpObject, lpCache->cx);
- lpStruct->cy = (*env)->GetIntField(env, lpObject, lpCache->cy);
- lpStruct->flags = (*env)->GetIntField(env, lpObject, lpCache->flags);
- return lpStruct;
-}
-
-void setWINDOWPOSFields(JNIEnv *env, jobject lpObject, WINDOWPOS *lpStruct, PWINDOWPOS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWINDOWPOSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->hwnd, (jint)lpStruct->hwnd);
- (*env)->SetIntField(env, lpObject, lpCache->hwndInsertAfter, (jint)lpStruct->hwndInsertAfter);
- (*env)->SetIntField(env, lpObject, lpCache->x, lpStruct->x);
- (*env)->SetIntField(env, lpObject, lpCache->y, lpStruct->y);
- (*env)->SetIntField(env, lpObject, lpCache->cx, lpStruct->cx);
- (*env)->SetIntField(env, lpObject, lpCache->cy, lpStruct->cy);
- (*env)->SetIntField(env, lpObject, lpCache->flags, lpStruct->flags);
-}
-
-void cacheWNDCLASSFids(JNIEnv *env, jobject lpObject, PWNDCLASS_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->style = (*env)->GetFieldID(env, lpCache->clazz, "style", "I");
- lpCache->lpfnWndProc = (*env)->GetFieldID(env, lpCache->clazz, "lpfnWndProc", "I");
- lpCache->cbClsExtra = (*env)->GetFieldID(env, lpCache->clazz, "cbClsExtra", "I");
- lpCache->cbWndExtra = (*env)->GetFieldID(env, lpCache->clazz, "cbWndExtra", "I");
- lpCache->hInstance = (*env)->GetFieldID(env, lpCache->clazz, "hInstance", "I");
- lpCache->hIcon = (*env)->GetFieldID(env, lpCache->clazz, "hIcon", "I");
- lpCache->hCursor = (*env)->GetFieldID(env, lpCache->clazz, "hCursor", "I");
- lpCache->hbrBackground = (*env)->GetFieldID(env, lpCache->clazz, "hbrBackground", "I");
- lpCache->lpszMenuName = (*env)->GetFieldID(env, lpCache->clazz, "lpszMenuName", "I");
- lpCache->lpszClassName = (*env)->GetFieldID(env, lpCache->clazz, "lpszClassName", "I");
- lpCache->cached = 1;
-}
-
-WNDCLASS* getWNDCLASSFields(JNIEnv *env, jobject lpObject, WNDCLASS *lpStruct, PWNDCLASS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWNDCLASSFids(env, lpObject, lpCache);
- lpStruct->style = (*env)->GetIntField(env, lpObject, lpCache->style);
- lpStruct->lpfnWndProc = (WNDPROC)(*env)->GetIntField(env, lpObject, lpCache->lpfnWndProc);
- lpStruct->cbClsExtra = (*env)->GetIntField(env, lpObject, lpCache->cbClsExtra);
- lpStruct->cbWndExtra = (*env)->GetIntField(env, lpObject, lpCache->cbWndExtra);
- lpStruct->hInstance = (HINSTANCE)(*env)->GetIntField(env, lpObject, lpCache->hInstance);
- lpStruct->hIcon = (HICON)(*env)->GetIntField(env, lpObject, lpCache->hIcon);
- lpStruct->hCursor = (HCURSOR)(*env)->GetIntField(env, lpObject, lpCache->hCursor);
- lpStruct->hbrBackground = (HBRUSH)(*env)->GetIntField(env, lpObject, lpCache->hbrBackground);
- lpStruct->lpszMenuName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszMenuName);
- lpStruct->lpszClassName = (LPCTSTR)(*env)->GetIntField(env, lpObject, lpCache->lpszClassName);
- return lpStruct;
-}
-
-void setWNDCLASSFields(JNIEnv *env, jobject lpObject, WNDCLASS *lpStruct, PWNDCLASS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheWNDCLASSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->style, lpStruct->style);
- (*env)->SetIntField(env, lpObject, lpCache->lpfnWndProc, (jint)lpStruct->lpfnWndProc);
- (*env)->SetIntField(env, lpObject, lpCache->cbClsExtra, lpStruct->cbClsExtra);
- (*env)->SetIntField(env, lpObject, lpCache->cbWndExtra, lpStruct->cbWndExtra);
- (*env)->SetIntField(env, lpObject, lpCache->hInstance, (jint)lpStruct->hInstance);
- (*env)->SetIntField(env, lpObject, lpCache->hIcon, (jint)lpStruct->hIcon);
- (*env)->SetIntField(env, lpObject, lpCache->hCursor, (jint)lpStruct->hCursor);
- (*env)->SetIntField(env, lpObject, lpCache->hbrBackground, (jint)lpStruct->hbrBackground);
- (*env)->SetIntField(env, lpObject, lpCache->lpszMenuName, (jint)lpStruct->lpszMenuName);
- (*env)->SetIntField(env, lpObject, lpCache->lpszClassName, (jint)lpStruct->lpszClassName);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheNONCLIENTMETRICSFids(JNIEnv *env, jobject lpObject, PNONCLIENTMETRICS_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "I");
- lpCache->iBorderWidth = (*env)->GetFieldID(env, lpCache->clazz, "iBorderWidth", "I");
- lpCache->iScrollWidth = (*env)->GetFieldID(env, lpCache->clazz, "iScrollWidth", "I");
- lpCache->iScrollHeight = (*env)->GetFieldID(env, lpCache->clazz, "iScrollHeight", "I");
- lpCache->iCaptionWidth = (*env)->GetFieldID(env, lpCache->clazz, "iCaptionWidth", "I");
- lpCache->iCaptionHeight = (*env)->GetFieldID(env, lpCache->clazz, "iCaptionHeight", "I");
- lpCache->lfCaptionFont = (*env)->GetFieldID(env, lpCache->clazz, "lfCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONT;");
- lpCache->iSmCaptionWidth = (*env)->GetFieldID(env, lpCache->clazz, "iSmCaptionWidth", "I");
- lpCache->iSmCaptionHeight = (*env)->GetFieldID(env, lpCache->clazz, "iSmCaptionHeight", "I");
- lpCache->lfSmCaptionFont = (*env)->GetFieldID(env, lpCache->clazz, "lfSmCaptionFont", "Lorg/eclipse/swt/internal/win32/LOGFONT;");
- lpCache->iMenuWidth = (*env)->GetFieldID(env, lpCache->clazz, "iMenuWidth", "I");
- lpCache->iMenuHeight = (*env)->GetFieldID(env, lpCache->clazz, "iMenuHeight", "I");
- lpCache->lfMenuFont = (*env)->GetFieldID(env, lpCache->clazz, "lfMenuFont", "Lorg/eclipse/swt/internal/win32/LOGFONT;");
- lpCache->lfStatusFont = (*env)->GetFieldID(env, lpCache->clazz, "lfStatusFont", "Lorg/eclipse/swt/internal/win32/LOGFONT;");
- lpCache->lfMessageFont = (*env)->GetFieldID(env, lpCache->clazz, "lfMessageFont", "Lorg/eclipse/swt/internal/win32/LOGFONT;");
- lpCache->cached = 1;
-}
-
-#endif // _WIN32_WCE
-
-/************************ OLE ***************************/
-
-void cacheCAUUIDFids(JNIEnv *env, jobject lpObject, PCAUUID_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->pElems = (*env)->GetFieldID(env, lpCache->clazz, "pElems", "I");
- lpCache->cElems = (*env)->GetFieldID(env, lpCache->clazz, "cElems", "I");
- lpCache->cached = 1;
-}
-
-CAUUID* getCAUUIDFields(JNIEnv *env, jobject lpObject, CAUUID *lpStruct, PCAUUID_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCAUUIDFids(env, lpObject, lpCache);
- lpStruct->pElems = (GUID FAR *)(*env)->GetIntField(env, lpObject, lpCache->pElems);
- lpStruct->cElems = (*env)->GetIntField(env, lpObject, lpCache->cElems);
- return lpStruct;
-}
-
-void setCAUUIDFields(JNIEnv *env, jobject lpObject, CAUUID *lpStruct, PCAUUID_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCAUUIDFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->pElems, (jint)lpStruct->pElems);
- (*env)->SetIntField(env, lpObject, lpCache->cElems, lpStruct->cElems);
-}
-
-void cacheCONTROLINFOFids(JNIEnv *env, jobject lpObject, PCONTROLINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwFlags = (*env)->GetFieldID(env, lpCache->clazz, "dwFlags", "I");
- lpCache->cAccel = (*env)->GetFieldID(env, lpCache->clazz, "cAccel", "S");
- lpCache->hAccel = (*env)->GetFieldID(env, lpCache->clazz, "hAccel", "I");
- lpCache->cb = (*env)->GetFieldID(env, lpCache->clazz, "cb", "I");
- lpCache->cached = 1;
-}
-
-CONTROLINFO* getCONTROLINFOFields(JNIEnv *env, jobject lpObject, CONTROLINFO *lpStruct, PCONTROLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCONTROLINFOFids(env, lpObject, lpCache);
- lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, lpCache->dwFlags);
- lpStruct->cAccel = (*env)->GetShortField(env, lpObject, lpCache->cAccel);
- lpStruct->hAccel = (HACCEL)(*env)->GetIntField(env, lpObject, lpCache->hAccel);
- lpStruct->cb = (*env)->GetIntField(env, lpObject, lpCache->cb);
- return lpStruct;
-}
-
-void setCONTROLINFOFields(JNIEnv *env, jobject lpObject, CONTROLINFO *lpStruct, PCONTROLINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCONTROLINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwFlags, lpStruct->dwFlags);
- (*env)->SetShortField(env, lpObject, lpCache->cAccel, lpStruct->cAccel);
- (*env)->SetIntField(env, lpObject, lpCache->hAccel, (jint)lpStruct->hAccel);
- (*env)->SetIntField(env, lpObject, lpCache->cb, lpStruct->cb);
-}
-
-void cacheCOSERVERINFOFids(JNIEnv *env, jobject lpObject, PCOSERVERINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->dwReserved2 = (*env)->GetFieldID(env, lpCache->clazz, "dwReserved2", "I");
- lpCache->pAuthInfo = (*env)->GetFieldID(env, lpCache->clazz, "pAuthInfo", "I");
- lpCache->pwszName = (*env)->GetFieldID(env, lpCache->clazz, "pwszName", "I");
- lpCache->dwReserved1 = (*env)->GetFieldID(env, lpCache->clazz, "dwReserved1", "I");
- lpCache->cached = 1;
-}
-
-COSERVERINFO* getCOSERVERINFOFields(JNIEnv *env, jobject lpObject, COSERVERINFO *lpStruct, PCOSERVERINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCOSERVERINFOFids(env, lpObject, lpCache);
- lpStruct->dwReserved2 = (*env)->GetIntField(env, lpObject, lpCache->dwReserved2);
- lpStruct->pAuthInfo = (COAUTHINFO *)(*env)->GetIntField(env, lpObject, lpCache->pAuthInfo);
- lpStruct->pwszName = (LPWSTR)(*env)->GetIntField(env, lpObject, lpCache->pwszName);
- lpStruct->dwReserved1 = (*env)->GetIntField(env, lpObject, lpCache->dwReserved1);
- return lpStruct;
-}
-
-void setCOSERVERINFOFields(JNIEnv *env, jobject lpObject, COSERVERINFO *lpStruct, PCOSERVERINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheCOSERVERINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->dwReserved2, lpStruct->dwReserved2);
- (*env)->SetIntField(env, lpObject, lpCache->pAuthInfo, (jint)lpStruct->pAuthInfo);
- (*env)->SetIntField(env, lpObject, lpCache->pwszName, (jint)lpStruct->pwszName);
- (*env)->SetIntField(env, lpObject, lpCache->dwReserved1, lpStruct->dwReserved1);
-}
-
-void cacheDISPPARAMSFids(JNIEnv *env, jobject lpObject, PDISPPARAMS_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cNamedArgs = (*env)->GetFieldID(env, lpCache->clazz, "cNamedArgs", "I");
- lpCache->cArgs = (*env)->GetFieldID(env, lpCache->clazz, "cArgs", "I");
- lpCache->rgdispidNamedArgs = (*env)->GetFieldID(env, lpCache->clazz, "rgdispidNamedArgs", "I");
- lpCache->rgvarg = (*env)->GetFieldID(env, lpCache->clazz, "rgvarg", "I");
- lpCache->cached = 1;
-}
-
-DISPPARAMS* getDISPPARAMSFields(JNIEnv *env, jobject lpObject, DISPPARAMS *lpStruct, PDISPPARAMS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDISPPARAMSFids(env, lpObject, lpCache);
- lpStruct->cNamedArgs = (*env)->GetIntField(env, lpObject, lpCache->cNamedArgs);
- lpStruct->cArgs = (*env)->GetIntField(env, lpObject, lpCache->cArgs);
- lpStruct->rgdispidNamedArgs = (DISPID FAR *)(*env)->GetIntField(env, lpObject, lpCache->rgdispidNamedArgs);
- lpStruct->rgvarg = (VARIANTARG FAR *)(*env)->GetIntField(env, lpObject, lpCache->rgvarg);
- return lpStruct;
-}
-
-void setDISPPARAMSFields(JNIEnv *env, jobject lpObject, DISPPARAMS *lpStruct, PDISPPARAMS_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDISPPARAMSFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cNamedArgs, lpStruct->cNamedArgs);
- (*env)->SetIntField(env, lpObject, lpCache->cArgs, lpStruct->cArgs);
- (*env)->SetIntField(env, lpObject, lpCache->rgdispidNamedArgs, (jint)lpStruct->rgdispidNamedArgs);
- (*env)->SetIntField(env, lpObject, lpCache->rgvarg, (jint)lpStruct->rgvarg);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheDROPFILESFids(JNIEnv *env, jobject lpObject, PDROPFILES_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->fWide = (*env)->GetFieldID(env, lpCache->clazz, "fWide", "I");
- lpCache->fNC = (*env)->GetFieldID(env, lpCache->clazz, "fNC", "I");
- lpCache->pt_y = (*env)->GetFieldID(env, lpCache->clazz, "pt_y", "I");
- lpCache->pt_x = (*env)->GetFieldID(env, lpCache->clazz, "pt_x", "I");
- lpCache->pFiles = (*env)->GetFieldID(env, lpCache->clazz, "pFiles", "I");
- lpCache->cached = 1;
-}
-
-DROPFILES* getDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct, PDROPFILES_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDROPFILESFids(env, lpObject, lpCache);
- lpStruct->fWide = (*env)->GetIntField(env, lpObject, lpCache->fWide);
- lpStruct->fNC = (*env)->GetIntField(env, lpObject, lpCache->fNC);
- lpStruct->pt.y = (*env)->GetIntField(env, lpObject, lpCache->pt_y);
- lpStruct->pt.x = (*env)->GetIntField(env, lpObject, lpCache->pt_x);
- lpStruct->pFiles = (*env)->GetIntField(env, lpObject, lpCache->pFiles);
- return lpStruct;
-}
-
-void setDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct, PDROPFILES_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDROPFILESFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->fWide, lpStruct->fWide);
- (*env)->SetIntField(env, lpObject, lpCache->fNC, lpStruct->fNC);
- (*env)->SetIntField(env, lpObject, lpCache->pt_y, lpStruct->pt.y);
- (*env)->SetIntField(env, lpObject, lpCache->pt_x, lpStruct->pt.x);
- (*env)->SetIntField(env, lpObject, lpCache->pFiles, lpStruct->pFiles);
-}
-
-#endif // _WIN32_WCE
-
-void cacheDVTARGETDEVICEFids(JNIEnv *env, jobject lpObject, PDVTARGETDEVICE_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->tdData = (*env)->GetFieldID(env, lpCache->clazz, "tdData", "B");
- lpCache->tdExtDevmodeOffset = (*env)->GetFieldID(env, lpCache->clazz, "tdExtDevmodeOffset", "S");
- lpCache->tdPortNameOffset = (*env)->GetFieldID(env, lpCache->clazz, "tdPortNameOffset", "S");
- lpCache->tdDeviceNameOffset = (*env)->GetFieldID(env, lpCache->clazz, "tdDeviceNameOffset", "S");
- lpCache->tdDriverNameOffset = (*env)->GetFieldID(env, lpCache->clazz, "tdDriverNameOffset", "S");
- lpCache->tdSize = (*env)->GetFieldID(env, lpCache->clazz, "tdSize", "I");
- lpCache->cached = 1;
-}
-
-DVTARGETDEVICE* getDVTARGETDEVICEFields(JNIEnv *env, jobject lpObject, DVTARGETDEVICE *lpStruct, PDVTARGETDEVICE_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDVTARGETDEVICEFids(env, lpObject, lpCache);
- *lpStruct->tdData = (*env)->GetByteField(env, lpObject, lpCache->tdData);
- lpStruct->tdExtDevmodeOffset = (*env)->GetShortField(env, lpObject, lpCache->tdExtDevmodeOffset);
- lpStruct->tdPortNameOffset = (*env)->GetShortField(env, lpObject, lpCache->tdPortNameOffset);
- lpStruct->tdDeviceNameOffset = (*env)->GetShortField(env, lpObject, lpCache->tdDeviceNameOffset);
- lpStruct->tdDriverNameOffset = (*env)->GetShortField(env, lpObject, lpCache->tdDriverNameOffset);
- lpStruct->tdSize = (*env)->GetIntField(env, lpObject, lpCache->tdSize);
- return lpStruct;
-}
-
-void setDVTARGETDEVICEFields(JNIEnv *env, jobject lpObject, DVTARGETDEVICE *lpStruct, PDVTARGETDEVICE_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheDVTARGETDEVICEFids(env, lpObject, lpCache);
- (*env)->SetByteField(env, lpObject, lpCache->tdData, *lpStruct->tdData);
- (*env)->SetShortField(env, lpObject, lpCache->tdExtDevmodeOffset, lpStruct->tdExtDevmodeOffset);
- (*env)->SetShortField(env, lpObject, lpCache->tdPortNameOffset, lpStruct->tdPortNameOffset);
- (*env)->SetShortField(env, lpObject, lpCache->tdDeviceNameOffset, lpStruct->tdDeviceNameOffset);
- (*env)->SetShortField(env, lpObject, lpCache->tdDriverNameOffset, lpStruct->tdDriverNameOffset);
- (*env)->SetIntField(env, lpObject, lpCache->tdSize, lpStruct->tdSize);
-}
-
-void cacheEXCEPINFOFids(JNIEnv *env, jobject lpObject, PEXCEPINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->scode = (*env)->GetFieldID(env, lpCache->clazz, "scode", "I");
- lpCache->pfnDeferredFillIn = (*env)->GetFieldID(env, lpCache->clazz, "pfnDeferredFillIn", "I");
- lpCache->pvReserved = (*env)->GetFieldID(env, lpCache->clazz, "pvReserved", "I");
- lpCache->dwHelpContext = (*env)->GetFieldID(env, lpCache->clazz, "dwHelpContext", "I");
- lpCache->bstrHelpFile = (*env)->GetFieldID(env, lpCache->clazz, "bstrHelpFile", "I");
- lpCache->bstrDescription = (*env)->GetFieldID(env, lpCache->clazz, "bstrDescription", "I");
- lpCache->bstrSource = (*env)->GetFieldID(env, lpCache->clazz, "bstrSource", "I");
- lpCache->wReserved = (*env)->GetFieldID(env, lpCache->clazz, "wReserved", "S");
- lpCache->wCode = (*env)->GetFieldID(env, lpCache->clazz, "wCode", "S");
- lpCache->cached = 1;
-}
-
-EXCEPINFO* getEXCEPINFOFields(JNIEnv *env, jobject lpObject, EXCEPINFO *lpStruct, PEXCEPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheEXCEPINFOFids(env, lpObject, lpCache);
- lpStruct->scode = (*env)->GetIntField(env, lpObject, lpCache->scode);
- lpStruct->pfnDeferredFillIn = (HRESULT (STDAPICALLTYPE FAR* )(struct tagEXCEPINFO FAR*))(*env)->GetIntField(env, lpObject, lpCache->pfnDeferredFillIn);
- lpStruct->pvReserved = (void FAR *)(*env)->GetIntField(env, lpObject, lpCache->pvReserved);
- lpStruct->dwHelpContext = (*env)->GetIntField(env, lpObject, lpCache->dwHelpContext);
- lpStruct->bstrHelpFile = (BSTR)(*env)->GetIntField(env, lpObject, lpCache->bstrHelpFile);
- lpStruct->bstrDescription = (BSTR)(*env)->GetIntField(env, lpObject, lpCache->bstrDescription);
- lpStruct->bstrSource = (BSTR)(*env)->GetIntField(env, lpObject, lpCache->bstrSource);
- lpStruct->wReserved = (*env)->GetShortField(env, lpObject, lpCache->wReserved);
- lpStruct->wCode = (*env)->GetShortField(env, lpObject, lpCache->wCode);
- return lpStruct;
-}
-
-void setEXCEPINFOFields(JNIEnv *env, jobject lpObject, EXCEPINFO *lpStruct, PEXCEPINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheEXCEPINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->scode, lpStruct->scode);
- (*env)->SetIntField(env, lpObject, lpCache->pfnDeferredFillIn, (jint)lpStruct->pfnDeferredFillIn);
- (*env)->SetIntField(env, lpObject, lpCache->pvReserved, (jint)lpStruct->pvReserved);
- (*env)->SetIntField(env, lpObject, lpCache->dwHelpContext, lpStruct->dwHelpContext);
- (*env)->SetIntField(env, lpObject, lpCache->bstrHelpFile, (jint)lpStruct->bstrHelpFile);
- (*env)->SetIntField(env, lpObject, lpCache->bstrDescription, (jint)lpStruct->bstrDescription);
- (*env)->SetIntField(env, lpObject, lpCache->bstrSource, (jint)lpStruct->bstrSource);
- (*env)->SetShortField(env, lpObject, lpCache->wReserved, lpStruct->wReserved);
- (*env)->SetShortField(env, lpObject, lpCache->wCode, lpStruct->wCode);
-}
-
-void cacheFORMATETCFids(JNIEnv *env, jobject lpObject, PFORMATETC_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->tymed = (*env)->GetFieldID(env, lpCache->clazz, "tymed", "I");
- lpCache->lindex = (*env)->GetFieldID(env, lpCache->clazz, "lindex", "I");
- lpCache->dwAspect = (*env)->GetFieldID(env, lpCache->clazz, "dwAspect", "I");
- lpCache->ptd = (*env)->GetFieldID(env, lpCache->clazz, "ptd", "I");
- lpCache->cfFormat = (*env)->GetFieldID(env, lpCache->clazz, "cfFormat", "I");
- lpCache->cached = 1;
-}
-
-FORMATETC* getFORMATETCFields(JNIEnv *env, jobject lpObject, FORMATETC *lpStruct, PFORMATETC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFORMATETCFids(env, lpObject, lpCache);
- lpStruct->tymed = (*env)->GetIntField(env, lpObject, lpCache->tymed);
- lpStruct->lindex = (*env)->GetIntField(env, lpObject, lpCache->lindex);
- lpStruct->dwAspect = (*env)->GetIntField(env, lpObject, lpCache->dwAspect);
- lpStruct->ptd = (DVTARGETDEVICE *)(*env)->GetIntField(env, lpObject, lpCache->ptd);
- lpStruct->cfFormat = (CLIPFORMAT)(*env)->GetIntField(env, lpObject, lpCache->cfFormat);
- return lpStruct;
-}
-
-void setFORMATETCFields(JNIEnv *env, jobject lpObject, FORMATETC *lpStruct, PFORMATETC_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFORMATETCFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->tymed, lpStruct->tymed);
- (*env)->SetIntField(env, lpObject, lpCache->lindex, lpStruct->lindex);
- (*env)->SetIntField(env, lpObject, lpCache->dwAspect, lpStruct->dwAspect);
- (*env)->SetIntField(env, lpObject, lpCache->ptd, (jint)lpStruct->ptd);
- (*env)->SetIntField(env, lpObject, lpCache->cfFormat, (jint)lpStruct->cfFormat);
-}
-
-void cacheFUNCDESC1Fids(JNIEnv *env, jobject lpObject, PFUNCDESC1_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->wFuncFlags = (*env)->GetFieldID(env, lpCache->clazz, "wFuncFlags", "S");
- lpCache->elemdescFunc_paramdesc_wParamFlags = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_paramdesc_wParamFlags", "S");
- lpCache->elemdescFunc_paramdesc_pparamdescex = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_paramdesc_pparamdescex", "I");
- lpCache->elemdescFunc_tdesc_vt = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_tdesc_vt", "S");
- lpCache->elemdescFunc_tdesc_union = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_tdesc_union", "I");
- lpCache->cScodes = (*env)->GetFieldID(env, lpCache->clazz, "cScodes", "S");
- lpCache->oVft = (*env)->GetFieldID(env, lpCache->clazz, "oVft", "S");
- lpCache->cParamsOpt = (*env)->GetFieldID(env, lpCache->clazz, "cParamsOpt", "S");
- lpCache->cParams = (*env)->GetFieldID(env, lpCache->clazz, "cParams", "S");
- lpCache->callconv = (*env)->GetFieldID(env, lpCache->clazz, "callconv", "I");
- lpCache->invkind = (*env)->GetFieldID(env, lpCache->clazz, "invkind", "I");
- lpCache->funckind = (*env)->GetFieldID(env, lpCache->clazz, "funckind", "I");
- lpCache->lprgelemdescParam = (*env)->GetFieldID(env, lpCache->clazz, "lprgelemdescParam", "I");
- lpCache->lprgscode = (*env)->GetFieldID(env, lpCache->clazz, "lprgscode", "I");
- lpCache->memid = (*env)->GetFieldID(env, lpCache->clazz, "memid", "I");
- lpCache->cached = 1;
-}
-
-FUNCDESC* getFUNCDESC1Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC1_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFUNCDESC1Fids(env, lpObject, lpCache);
- lpStruct->wFuncFlags = (*env)->GetShortField(env, lpObject, lpCache->wFuncFlags);
- lpStruct->elemdescFunc.paramdesc.wParamFlags = (*env)->GetShortField(env, lpObject, lpCache->elemdescFunc_paramdesc_wParamFlags);
- lpStruct->elemdescFunc.paramdesc.pparamdescex = (LPPARAMDESCEX)(*env)->GetIntField(env, lpObject, lpCache->elemdescFunc_paramdesc_pparamdescex);
- lpStruct->elemdescFunc.tdesc.vt = (*env)->GetShortField(env, lpObject, lpCache->elemdescFunc_tdesc_vt);
- lpStruct->elemdescFunc.tdesc.lptdesc = (struct FARSTRUCT tagTYPEDESC FAR* )(*env)->GetIntField(env, lpObject, lpCache->elemdescFunc_tdesc_union);
- lpStruct->cScodes = (*env)->GetShortField(env, lpObject, lpCache->cScodes);
- lpStruct->oVft = (*env)->GetShortField(env, lpObject, lpCache->oVft);
- lpStruct->cParamsOpt = (*env)->GetShortField(env, lpObject, lpCache->cParamsOpt);
- lpStruct->cParams = (*env)->GetShortField(env, lpObject, lpCache->cParams);
- lpStruct->callconv = (*env)->GetIntField(env, lpObject, lpCache->callconv);
- lpStruct->invkind = (*env)->GetIntField(env, lpObject, lpCache->invkind);
- lpStruct->funckind = (*env)->GetIntField(env, lpObject, lpCache->funckind);
- lpStruct->lprgelemdescParam = (ELEMDESC FAR *)(*env)->GetIntField(env, lpObject, lpCache->lprgelemdescParam);
- lpStruct->lprgscode = (SCODE FAR *)(*env)->GetIntField(env, lpObject, lpCache->lprgscode);
- lpStruct->memid = (*env)->GetIntField(env, lpObject, lpCache->memid);
- return lpStruct;
-}
-
-void setFUNCDESC1Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC1_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFUNCDESC1Fids(env, lpObject, lpCache);
- (*env)->SetShortField(env, lpObject, lpCache->wFuncFlags, lpStruct->wFuncFlags);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescFunc_paramdesc_wParamFlags, lpStruct->elemdescFunc.paramdesc.wParamFlags);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescFunc_paramdesc_pparamdescex, (jint)lpStruct->elemdescFunc.paramdesc.pparamdescex);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescFunc_tdesc_vt, lpStruct->elemdescFunc.tdesc.vt);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescFunc_tdesc_union, (jint)lpStruct->elemdescFunc.tdesc.lptdesc);
- (*env)->SetShortField(env, lpObject, lpCache->cScodes, lpStruct->cScodes);
- (*env)->SetShortField(env, lpObject, lpCache->oVft, lpStruct->oVft);
- (*env)->SetShortField(env, lpObject, lpCache->cParamsOpt, lpStruct->cParamsOpt);
- (*env)->SetShortField(env, lpObject, lpCache->cParams, lpStruct->cParams);
- (*env)->SetIntField(env, lpObject, lpCache->callconv, lpStruct->callconv);
- (*env)->SetIntField(env, lpObject, lpCache->invkind, lpStruct->invkind);
- (*env)->SetIntField(env, lpObject, lpCache->funckind, lpStruct->funckind);
- (*env)->SetIntField(env, lpObject, lpCache->lprgelemdescParam, (jint)lpStruct->lprgelemdescParam);
- (*env)->SetIntField(env, lpObject, lpCache->lprgscode, (jint)lpStruct->lprgscode);
- (*env)->SetIntField(env, lpObject, lpCache->memid, lpStruct->memid);
-}
-
-void cacheFUNCDESC2Fids(JNIEnv *env, jobject lpObject, PFUNCDESC2_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->wFuncFlags = (*env)->GetFieldID(env, lpCache->clazz, "wFuncFlags", "S");
- lpCache->elemdescFunc_idldesc_wIDLFlags = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_idldesc_wIDLFlags", "S");
- lpCache->elemdescFunc_idldesc_dwReserved = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_idldesc_dwReserved", "I");
- lpCache->elemdescFunc_tdesc_vt = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_tdesc_vt", "S");
- lpCache->elemdescFunc_tdesc_union = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_tdesc_union", "I");
- lpCache->cScodes = (*env)->GetFieldID(env, lpCache->clazz, "cScodes", "S");
- lpCache->oVft = (*env)->GetFieldID(env, lpCache->clazz, "oVft", "S");
- lpCache->cParamsOpt = (*env)->GetFieldID(env, lpCache->clazz, "cParamsOpt", "S");
- lpCache->cParams = (*env)->GetFieldID(env, lpCache->clazz, "cParams", "S");
- lpCache->callconv = (*env)->GetFieldID(env, lpCache->clazz, "callconv", "I");
- lpCache->invkind = (*env)->GetFieldID(env, lpCache->clazz, "invkind", "I");
- lpCache->funckind = (*env)->GetFieldID(env, lpCache->clazz, "funckind", "I");
- lpCache->lprgelemdescParam = (*env)->GetFieldID(env, lpCache->clazz, "lprgelemdescParam", "I");
- lpCache->lprgscode = (*env)->GetFieldID(env, lpCache->clazz, "lprgscode", "I");
- lpCache->memid = (*env)->GetFieldID(env, lpCache->clazz, "memid", "I");
- lpCache->cached = 1;
-}
-
-FUNCDESC* getFUNCDESC2Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC2_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFUNCDESC2Fids(env, lpObject, lpCache);
- lpStruct->wFuncFlags = (*env)->GetShortField(env, lpObject, lpCache->wFuncFlags);
- lpStruct->elemdescFunc.idldesc.wIDLFlags = (*env)->GetShortField(env, lpObject, lpCache->elemdescFunc_idldesc_wIDLFlags);
- lpStruct->elemdescFunc.idldesc.dwReserved = (*env)->GetIntField(env, lpObject, lpCache->elemdescFunc_idldesc_dwReserved);
- lpStruct->elemdescFunc.tdesc.vt = (*env)->GetShortField(env, lpObject, lpCache->elemdescFunc_tdesc_vt);
- lpStruct->elemdescFunc.tdesc.lptdesc = (struct FARSTRUCT tagTYPEDESC FAR* )(*env)->GetIntField(env, lpObject, lpCache->elemdescFunc_tdesc_union);
- lpStruct->cScodes = (*env)->GetShortField(env, lpObject, lpCache->cScodes);
- lpStruct->oVft = (*env)->GetShortField(env, lpObject, lpCache->oVft);
- lpStruct->cParamsOpt = (*env)->GetShortField(env, lpObject, lpCache->cParamsOpt);
- lpStruct->cParams = (*env)->GetShortField(env, lpObject, lpCache->cParams);
- lpStruct->callconv = (*env)->GetIntField(env, lpObject, lpCache->callconv);
- lpStruct->invkind = (*env)->GetIntField(env, lpObject, lpCache->invkind);
- lpStruct->funckind = (*env)->GetIntField(env, lpObject, lpCache->funckind);
- lpStruct->lprgelemdescParam = (ELEMDESC FAR *)(*env)->GetIntField(env, lpObject, lpCache->lprgelemdescParam);
- lpStruct->lprgscode = (SCODE FAR *)(*env)->GetIntField(env, lpObject, lpCache->lprgscode);
- lpStruct->memid = (*env)->GetIntField(env, lpObject, lpCache->memid);
- return lpStruct;
-}
-
-void setFUNCDESC2Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC2_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheFUNCDESC2Fids(env, lpObject, lpCache);
- (*env)->SetShortField(env, lpObject, lpCache->wFuncFlags, lpStruct->wFuncFlags);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescFunc_idldesc_wIDLFlags, lpStruct->elemdescFunc.idldesc.wIDLFlags);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescFunc_idldesc_dwReserved, lpStruct->elemdescFunc.idldesc.dwReserved);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescFunc_tdesc_vt, lpStruct->elemdescFunc.tdesc.vt);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescFunc_tdesc_union, (jint)lpStruct->elemdescFunc.tdesc.lptdesc);
- (*env)->SetShortField(env, lpObject, lpCache->cScodes, lpStruct->cScodes);
- (*env)->SetShortField(env, lpObject, lpCache->oVft, lpStruct->oVft);
- (*env)->SetShortField(env, lpObject, lpCache->cParamsOpt, lpStruct->cParamsOpt);
- (*env)->SetShortField(env, lpObject, lpCache->cParams, lpStruct->cParams);
- (*env)->SetIntField(env, lpObject, lpCache->callconv, lpStruct->callconv);
- (*env)->SetIntField(env, lpObject, lpCache->invkind, lpStruct->invkind);
- (*env)->SetIntField(env, lpObject, lpCache->funckind, lpStruct->funckind);
- (*env)->SetIntField(env, lpObject, lpCache->lprgelemdescParam, (jint)lpStruct->lprgelemdescParam);
- (*env)->SetIntField(env, lpObject, lpCache->lprgscode, (jint)lpStruct->lprgscode);
- (*env)->SetIntField(env, lpObject, lpCache->memid, lpStruct->memid);
-}
-
-void cacheGUIDFids(JNIEnv *env, jobject lpObject, PGUID_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->b7 = (*env)->GetFieldID(env, lpCache->clazz, "b7", "B");
- lpCache->b6 = (*env)->GetFieldID(env, lpCache->clazz, "b6", "B");
- lpCache->b5 = (*env)->GetFieldID(env, lpCache->clazz, "b5", "B");
- lpCache->b4 = (*env)->GetFieldID(env, lpCache->clazz, "b4", "B");
- lpCache->b3 = (*env)->GetFieldID(env, lpCache->clazz, "b3", "B");
- lpCache->b2 = (*env)->GetFieldID(env, lpCache->clazz, "b2", "B");
- lpCache->b1 = (*env)->GetFieldID(env, lpCache->clazz, "b1", "B");
- lpCache->b0 = (*env)->GetFieldID(env, lpCache->clazz, "b0", "B");
- lpCache->data3 = (*env)->GetFieldID(env, lpCache->clazz, "data3", "S");
- lpCache->data2 = (*env)->GetFieldID(env, lpCache->clazz, "data2", "S");
- lpCache->data1 = (*env)->GetFieldID(env, lpCache->clazz, "data1", "I");
- lpCache->cached = 1;
-}
-
-GUID* getGUIDFields(JNIEnv *env, jobject lpObject, GUID *lpStruct, PGUID_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGUIDFids(env, lpObject, lpCache);
- lpStruct->Data4[7] = (*env)->GetByteField(env, lpObject, lpCache->b7);
- lpStruct->Data4[6] = (*env)->GetByteField(env, lpObject, lpCache->b6);
- lpStruct->Data4[5] = (*env)->GetByteField(env, lpObject, lpCache->b5);
- lpStruct->Data4[4] = (*env)->GetByteField(env, lpObject, lpCache->b4);
- lpStruct->Data4[3] = (*env)->GetByteField(env, lpObject, lpCache->b3);
- lpStruct->Data4[2] = (*env)->GetByteField(env, lpObject, lpCache->b2);
- lpStruct->Data4[1] = (*env)->GetByteField(env, lpObject, lpCache->b1);
- lpStruct->Data4[0] = (*env)->GetByteField(env, lpObject, lpCache->b0);
- lpStruct->Data3 = (*env)->GetShortField(env, lpObject, lpCache->data3);
- lpStruct->Data2 = (*env)->GetShortField(env, lpObject, lpCache->data2);
- lpStruct->Data1 = (*env)->GetIntField(env, lpObject, lpCache->data1);
- return lpStruct;
-}
-
-void setGUIDFields(JNIEnv *env, jobject lpObject, GUID *lpStruct, PGUID_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGUIDFids(env, lpObject, lpCache);
- (*env)->SetByteField(env, lpObject, lpCache->b7, lpStruct->Data4[7]);
- (*env)->SetByteField(env, lpObject, lpCache->b6, lpStruct->Data4[6]);
- (*env)->SetByteField(env, lpObject, lpCache->b5, lpStruct->Data4[5]);
- (*env)->SetByteField(env, lpObject, lpCache->b4, lpStruct->Data4[4]);
- (*env)->SetByteField(env, lpObject, lpCache->b3, lpStruct->Data4[3]);
- (*env)->SetByteField(env, lpObject, lpCache->b2, lpStruct->Data4[2]);
- (*env)->SetByteField(env, lpObject, lpCache->b1, lpStruct->Data4[1]);
- (*env)->SetByteField(env, lpObject, lpCache->b0, lpStruct->Data4[0]);
- (*env)->SetShortField(env, lpObject, lpCache->data3, lpStruct->Data3);
- (*env)->SetShortField(env, lpObject, lpCache->data2, lpStruct->Data2);
- (*env)->SetIntField(env, lpObject, lpCache->data1, lpStruct->Data1);
-}
-
-void cacheLICINFOFids(JNIEnv *env, jobject lpObject, PLICINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->fLicVerified = (*env)->GetFieldID(env, lpCache->clazz, "fLicVerified", "I");
- lpCache->fRuntimeKeyAvail = (*env)->GetFieldID(env, lpCache->clazz, "fRuntimeKeyAvail", "I");
- lpCache->cbLicInfo = (*env)->GetFieldID(env, lpCache->clazz, "cbLicInfo", "I");
- lpCache->cached = 1;
-}
-
-LICINFO* getLICINFOFields(JNIEnv *env, jobject lpObject, LICINFO *lpStruct, PLICINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLICINFOFids(env, lpObject, lpCache);
- lpStruct->fLicVerified = (*env)->GetIntField(env, lpObject, lpCache->fLicVerified);
- lpStruct->fRuntimeKeyAvail = (*env)->GetIntField(env, lpObject, lpCache->fRuntimeKeyAvail);
- lpStruct->cbLicInfo = (*env)->GetIntField(env, lpObject, lpCache->cbLicInfo);
- return lpStruct;
-}
-
-void setLICINFOFields(JNIEnv *env, jobject lpObject, LICINFO *lpStruct, PLICINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheLICINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->fLicVerified, lpStruct->fLicVerified);
- (*env)->SetIntField(env, lpObject, lpCache->fRuntimeKeyAvail, lpStruct->fRuntimeKeyAvail);
- (*env)->SetIntField(env, lpObject, lpCache->cbLicInfo, lpStruct->cbLicInfo);
-}
-
-#ifndef _WIN32_WCE
-
-void cacheOLECMDFids(JNIEnv *env, jobject lpObject, POLECMD_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cmdf = (*env)->GetFieldID(env, lpCache->clazz, "cmdf", "I");
- lpCache->cmdID = (*env)->GetFieldID(env, lpCache->clazz, "cmdID", "I");
- lpCache->cached = 1;
-}
-
-OLECMD* getOLECMDFields(JNIEnv *env, jobject lpObject, OLECMD *lpStruct, POLECMD_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLECMDFids(env, lpObject, lpCache);
- lpStruct->cmdf = (*env)->GetIntField(env, lpObject, lpCache->cmdf);
- lpStruct->cmdID = (*env)->GetIntField(env, lpObject, lpCache->cmdID);
- return lpStruct;
-}
-
-void setOLECMDFields(JNIEnv *env, jobject lpObject, OLECMD *lpStruct, POLECMD_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLECMDFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cmdf, lpStruct->cmdf);
- (*env)->SetIntField(env, lpObject, lpCache->cmdID, lpStruct->cmdID);
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-void cacheOLECMDTEXTFids(JNIEnv *env, jobject lpObject, POLECMDTEXT_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->rgwz = (*env)->GetFieldID(env, lpCache->clazz, "rgwz", "S");
- lpCache->cwBuf = (*env)->GetFieldID(env, lpCache->clazz, "cwBuf", "I");
- lpCache->cwActual = (*env)->GetFieldID(env, lpCache->clazz, "cwActual", "I");
- lpCache->cmdtextf = (*env)->GetFieldID(env, lpCache->clazz, "cmdtextf", "I");
- lpCache->cached = 1;
-}
-
-OLECMDTEXT* getOLECMDTEXTFields(JNIEnv *env, jobject lpObject, OLECMDTEXT *lpStruct, POLECMDTEXT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLECMDTEXTFids(env, lpObject, lpCache);
- lpStruct->rgwz[0] = (*env)->GetShortField(env, lpObject, lpCache->rgwz);
- lpStruct->cwBuf = (*env)->GetIntField(env, lpObject, lpCache->cwBuf);
- lpStruct->cwActual = (*env)->GetIntField(env, lpObject, lpCache->cwActual);
- lpStruct->cmdtextf = (*env)->GetIntField(env, lpObject, lpCache->cmdtextf);
- return lpStruct;
-}
-
-void setOLECMDTEXTFields(JNIEnv *env, jobject lpObject, OLECMDTEXT *lpStruct, POLECMDTEXT_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLECMDTEXTFids(env, lpObject, lpCache);
- (*env)->SetShortField(env, lpObject, lpCache->rgwz, lpStruct->rgwz[0]);
- (*env)->SetIntField(env, lpObject, lpCache->cwBuf, lpStruct->cwBuf);
- (*env)->SetIntField(env, lpObject, lpCache->cwActual, lpStruct->cwActual);
- (*env)->SetIntField(env, lpObject, lpCache->cmdtextf, lpStruct->cmdtextf);
-}
-
-#endif // _WIN32_WCE
-
-void cacheOLEINPLACEFRAMEINFOFids(JNIEnv *env, jobject lpObject, POLEINPLACEFRAMEINFO_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->cAccelEntries = (*env)->GetFieldID(env, lpCache->clazz, "cAccelEntries", "I");
- lpCache->haccel = (*env)->GetFieldID(env, lpCache->clazz, "haccel", "I");
- lpCache->hwndFrame = (*env)->GetFieldID(env, lpCache->clazz, "hwndFrame", "I");
- lpCache->fMDIApp = (*env)->GetFieldID(env, lpCache->clazz, "fMDIApp", "I");
- lpCache->cb = (*env)->GetFieldID(env, lpCache->clazz, "cb", "I");
- lpCache->cached = 1;
-}
-
-OLEINPLACEFRAMEINFO* getOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAMEINFO *lpStruct, POLEINPLACEFRAMEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLEINPLACEFRAMEINFOFids(env, lpObject, lpCache);
- lpStruct->cAccelEntries = (*env)->GetIntField(env, lpObject, lpCache->cAccelEntries);
- lpStruct->haccel = (HACCEL)(*env)->GetIntField(env, lpObject, lpCache->haccel);
- lpStruct->hwndFrame = (HWND)(*env)->GetIntField(env, lpObject, lpCache->hwndFrame);
- lpStruct->fMDIApp = (*env)->GetIntField(env, lpObject, lpCache->fMDIApp);
- lpStruct->cb = (*env)->GetIntField(env, lpObject, lpCache->cb);
- return lpStruct;
-}
-
-void setOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAMEINFO *lpStruct, POLEINPLACEFRAMEINFO_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheOLEINPLACEFRAMEINFOFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->cAccelEntries, lpStruct->cAccelEntries);
- (*env)->SetIntField(env, lpObject, lpCache->haccel, (jint)lpStruct->haccel);
- (*env)->SetIntField(env, lpObject, lpCache->hwndFrame, (jint)lpStruct->hwndFrame);
- (*env)->SetIntField(env, lpObject, lpCache->fMDIApp, lpStruct->fMDIApp);
- (*env)->SetIntField(env, lpObject, lpCache->cb, lpStruct->cb);
-}
-
-void cacheSTATSTGFids(JNIEnv *env, jobject lpObject, PSTATSTG_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->reserved = (*env)->GetFieldID(env, lpCache->clazz, "reserved", "I");
- lpCache->grfStateBits = (*env)->GetFieldID(env, lpCache->clazz, "grfStateBits", "I");
- lpCache->clsid_b7 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b7", "B");
- lpCache->clsid_b6 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b6", "B");
- lpCache->clsid_b5 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b5", "B");
- lpCache->clsid_b4 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b4", "B");
- lpCache->clsid_b3 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b3", "B");
- lpCache->clsid_b2 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b2", "B");
- lpCache->clsid_b1 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b1", "B");
- lpCache->clsid_b0 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_b0", "B");
- lpCache->clsid_data3 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_data3", "S");
- lpCache->clsid_data2 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_data2", "S");
- lpCache->clsid_data1 = (*env)->GetFieldID(env, lpCache->clazz, "clsid_data1", "I");
- lpCache->grfLocksSupported = (*env)->GetFieldID(env, lpCache->clazz, "grfLocksSupported", "I");
- lpCache->grfMode = (*env)->GetFieldID(env, lpCache->clazz, "grfMode", "I");
- lpCache->atime_dwHighDateTime = (*env)->GetFieldID(env, lpCache->clazz, "atime_dwHighDateTime", "I");
- lpCache->atime_dwLowDateTime = (*env)->GetFieldID(env, lpCache->clazz, "atime_dwLowDateTime", "I");
- lpCache->ctime_dwHighDateTime = (*env)->GetFieldID(env, lpCache->clazz, "ctime_dwHighDateTime", "I");
- lpCache->ctime_dwLowDateTime = (*env)->GetFieldID(env, lpCache->clazz, "ctime_dwLowDateTime", "I");
- lpCache->mtime_dwHighDateTime = (*env)->GetFieldID(env, lpCache->clazz, "mtime_dwHighDateTime", "I");
- lpCache->mtime_dwLowDateTime = (*env)->GetFieldID(env, lpCache->clazz, "mtime_dwLowDateTime", "I");
- lpCache->cbSize = (*env)->GetFieldID(env, lpCache->clazz, "cbSize", "J");
- lpCache->type = (*env)->GetFieldID(env, lpCache->clazz, "type", "I");
- lpCache->pwcsName = (*env)->GetFieldID(env, lpCache->clazz, "pwcsName", "I");
- lpCache->cached = 1;
-}
-
-STATSTG* getSTATSTGFields(JNIEnv *env, jobject lpObject, STATSTG *lpStruct, PSTATSTG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSTATSTGFids(env, lpObject, lpCache);
- lpStruct->reserved = (*env)->GetIntField(env, lpObject, lpCache->reserved);
- lpStruct->grfStateBits = (*env)->GetIntField(env, lpObject, lpCache->grfStateBits);
- lpStruct->clsid.Data4[7] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b7);
- lpStruct->clsid.Data4[6] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b6);
- lpStruct->clsid.Data4[5] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b5);
- lpStruct->clsid.Data4[4] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b4);
- lpStruct->clsid.Data4[3] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b3);
- lpStruct->clsid.Data4[2] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b2);
- lpStruct->clsid.Data4[1] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b1);
- lpStruct->clsid.Data4[0] = (*env)->GetByteField(env, lpObject, lpCache->clsid_b0);
- lpStruct->clsid.Data3 = (*env)->GetShortField(env, lpObject, lpCache->clsid_data3);
- lpStruct->clsid.Data2 = (*env)->GetShortField(env, lpObject, lpCache->clsid_data2);
- lpStruct->clsid.Data1 = (*env)->GetIntField(env, lpObject, lpCache->clsid_data1);
- lpStruct->grfLocksSupported = (*env)->GetIntField(env, lpObject, lpCache->grfLocksSupported);
- lpStruct->grfMode = (*env)->GetIntField(env, lpObject, lpCache->grfMode);
- lpStruct->atime.dwHighDateTime = (*env)->GetIntField(env, lpObject, lpCache->atime_dwHighDateTime);
- lpStruct->atime.dwLowDateTime = (*env)->GetIntField(env, lpObject, lpCache->atime_dwLowDateTime);
- lpStruct->ctime.dwHighDateTime = (*env)->GetIntField(env, lpObject, lpCache->ctime_dwHighDateTime);
- lpStruct->ctime.dwLowDateTime = (*env)->GetIntField(env, lpObject, lpCache->ctime_dwLowDateTime);
- lpStruct->mtime.dwHighDateTime = (*env)->GetIntField(env, lpObject, lpCache->mtime_dwHighDateTime);
- lpStruct->mtime.dwLowDateTime = (*env)->GetIntField(env, lpObject, lpCache->mtime_dwLowDateTime);
- lpStruct->cbSize.QuadPart = (*env)->GetLongField(env, lpObject, lpCache->cbSize);
- lpStruct->type = (*env)->GetIntField(env, lpObject, lpCache->type);
- lpStruct->pwcsName = (LPWSTR)(*env)->GetIntField(env, lpObject, lpCache->pwcsName);
- return lpStruct;
-}
-
-void setSTATSTGFields(JNIEnv *env, jobject lpObject, STATSTG *lpStruct, PSTATSTG_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSTATSTGFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->reserved, lpStruct->reserved);
- (*env)->SetIntField(env, lpObject, lpCache->grfStateBits, lpStruct->grfStateBits);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b7, lpStruct->clsid.Data4[7]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b6, lpStruct->clsid.Data4[6]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b5, lpStruct->clsid.Data4[5]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b4, lpStruct->clsid.Data4[4]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b3, lpStruct->clsid.Data4[3]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b2, lpStruct->clsid.Data4[2]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b1, lpStruct->clsid.Data4[1]);
- (*env)->SetByteField(env, lpObject, lpCache->clsid_b0, lpStruct->clsid.Data4[0]);
- (*env)->SetShortField(env, lpObject, lpCache->clsid_data3, lpStruct->clsid.Data3);
- (*env)->SetShortField(env, lpObject, lpCache->clsid_data2, lpStruct->clsid.Data2);
- (*env)->SetIntField(env, lpObject, lpCache->clsid_data1, lpStruct->clsid.Data1);
- (*env)->SetIntField(env, lpObject, lpCache->grfLocksSupported, lpStruct->grfLocksSupported);
- (*env)->SetIntField(env, lpObject, lpCache->grfMode, lpStruct->grfMode);
- (*env)->SetIntField(env, lpObject, lpCache->atime_dwHighDateTime, lpStruct->atime.dwHighDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->atime_dwLowDateTime, lpStruct->atime.dwLowDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->ctime_dwHighDateTime, lpStruct->ctime.dwHighDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->ctime_dwLowDateTime, lpStruct->ctime.dwLowDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->mtime_dwHighDateTime, lpStruct->mtime.dwHighDateTime);
- (*env)->SetIntField(env, lpObject, lpCache->mtime_dwLowDateTime, lpStruct->mtime.dwLowDateTime);
- (*env)->SetLongField(env, lpObject, lpCache->cbSize, lpStruct->cbSize.QuadPart);
- (*env)->SetIntField(env, lpObject, lpCache->type, lpStruct->type);
- (*env)->SetIntField(env, lpObject, lpCache->pwcsName, (jint)lpStruct->pwcsName);
-}
-
-void cacheSTGMEDIUMFids(JNIEnv *env, jobject lpObject, PSTGMEDIUM_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->pUnkForRelease = (*env)->GetFieldID(env, lpCache->clazz, "pUnkForRelease", "I");
- lpCache->unionField = (*env)->GetFieldID(env, lpCache->clazz, "unionField", "I");
- lpCache->tymed = (*env)->GetFieldID(env, lpCache->clazz, "tymed", "I");
- lpCache->cached = 1;
-}
-
-STGMEDIUM* getSTGMEDIUMFields(JNIEnv *env, jobject lpObject, STGMEDIUM *lpStruct, PSTGMEDIUM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSTGMEDIUMFids(env, lpObject, lpCache);
- lpStruct->pUnkForRelease = (IUnknown *)(*env)->GetIntField(env, lpObject, lpCache->pUnkForRelease);
- lpStruct->hGlobal = (HGLOBAL)(*env)->GetIntField(env, lpObject, lpCache->unionField);
- lpStruct->tymed = (*env)->GetIntField(env, lpObject, lpCache->tymed);
- return lpStruct;
-}
-
-void setSTGMEDIUMFields(JNIEnv *env, jobject lpObject, STGMEDIUM *lpStruct, PSTGMEDIUM_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheSTGMEDIUMFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->pUnkForRelease, (jint)lpStruct->pUnkForRelease);
- (*env)->SetIntField(env, lpObject, lpCache->unionField, (jint)lpStruct->hGlobal);
- (*env)->SetIntField(env, lpObject, lpCache->tymed, lpStruct->tymed);
-}
-
-void cacheTYPEATTRFids(JNIEnv *env, jobject lpObject, PTYPEATTR_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->idldescType_wIDLFlags = (*env)->GetFieldID(env, lpCache->clazz, "idldescType_wIDLFlags", "S");
- lpCache->idldescType_dwReserved = (*env)->GetFieldID(env, lpCache->clazz, "idldescType_dwReserved", "I");
- lpCache->tdescAlias_vt = (*env)->GetFieldID(env, lpCache->clazz, "tdescAlias_vt", "S");
- lpCache->tdescAlias_unionField = (*env)->GetFieldID(env, lpCache->clazz, "tdescAlias_unionField", "I");
- lpCache->wMinorVerNum = (*env)->GetFieldID(env, lpCache->clazz, "wMinorVerNum", "S");
- lpCache->wMajorVerNum = (*env)->GetFieldID(env, lpCache->clazz, "wMajorVerNum", "S");
- lpCache->wTypeFlags = (*env)->GetFieldID(env, lpCache->clazz, "wTypeFlags", "S");
- lpCache->cbAlignment = (*env)->GetFieldID(env, lpCache->clazz, "cbAlignment", "S");
- lpCache->cbSizeVft = (*env)->GetFieldID(env, lpCache->clazz, "cbSizeVft", "S");
- lpCache->cImplTypes = (*env)->GetFieldID(env, lpCache->clazz, "cImplTypes", "S");
- lpCache->cVars = (*env)->GetFieldID(env, lpCache->clazz, "cVars", "S");
- lpCache->cFuncs = (*env)->GetFieldID(env, lpCache->clazz, "cFuncs", "S");
- lpCache->typekind = (*env)->GetFieldID(env, lpCache->clazz, "typekind", "I");
- lpCache->cbSizeInstance = (*env)->GetFieldID(env, lpCache->clazz, "cbSizeInstance", "I");
- lpCache->lpstrSchema = (*env)->GetFieldID(env, lpCache->clazz, "lpstrSchema", "I");
- lpCache->memidDestructor = (*env)->GetFieldID(env, lpCache->clazz, "memidDestructor", "I");
- lpCache->memidConstructor = (*env)->GetFieldID(env, lpCache->clazz, "memidConstructor", "I");
- lpCache->dwReserved = (*env)->GetFieldID(env, lpCache->clazz, "dwReserved", "I");
- lpCache->lcid = (*env)->GetFieldID(env, lpCache->clazz, "lcid", "I");
- lpCache->guid_b7 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b7", "B");
- lpCache->guid_b6 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b6", "B");
- lpCache->guid_b5 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b5", "B");
- lpCache->guid_b4 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b4", "B");
- lpCache->guid_b3 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b3", "B");
- lpCache->guid_b2 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b2", "B");
- lpCache->guid_b1 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b1", "B");
- lpCache->guid_b0 = (*env)->GetFieldID(env, lpCache->clazz, "guid_b0", "B");
- lpCache->guid_data3 = (*env)->GetFieldID(env, lpCache->clazz, "guid_data3", "S");
- lpCache->guid_data2 = (*env)->GetFieldID(env, lpCache->clazz, "guid_data2", "S");
- lpCache->guid_data1 = (*env)->GetFieldID(env, lpCache->clazz, "guid_data1", "I");
- lpCache->cached = 1;
-}
-
-TYPEATTR* getTYPEATTRFields(JNIEnv *env, jobject lpObject, TYPEATTR *lpStruct, PTYPEATTR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTYPEATTRFids(env, lpObject, lpCache);
- lpStruct->idldescType.wIDLFlags = (*env)->GetShortField(env, lpObject, lpCache->idldescType_wIDLFlags);
- lpStruct->idldescType.dwReserved = (*env)->GetIntField(env, lpObject, lpCache->idldescType_dwReserved);
- lpStruct->tdescAlias.vt = (*env)->GetShortField(env, lpObject, lpCache->tdescAlias_vt);
- lpStruct->tdescAlias.lptdesc = (struct FARSTRUCT tagTYPEDESC FAR *)(*env)->GetIntField(env, lpObject, lpCache->tdescAlias_unionField);
- lpStruct->wMinorVerNum = (*env)->GetShortField(env, lpObject, lpCache->wMinorVerNum);
- lpStruct->wMajorVerNum = (*env)->GetShortField(env, lpObject, lpCache->wMajorVerNum);
- lpStruct->wTypeFlags = (*env)->GetShortField(env, lpObject, lpCache->wTypeFlags);
- lpStruct->cbAlignment = (*env)->GetShortField(env, lpObject, lpCache->cbAlignment);
- lpStruct->cbSizeVft = (*env)->GetShortField(env, lpObject, lpCache->cbSizeVft);
- lpStruct->cImplTypes = (*env)->GetShortField(env, lpObject, lpCache->cImplTypes);
- lpStruct->cVars = (*env)->GetShortField(env, lpObject, lpCache->cVars);
- lpStruct->cFuncs = (*env)->GetShortField(env, lpObject, lpCache->cFuncs);
- lpStruct->typekind = (*env)->GetIntField(env, lpObject, lpCache->typekind);
- lpStruct->cbSizeInstance = (*env)->GetIntField(env, lpObject, lpCache->cbSizeInstance);
- lpStruct->lpstrSchema = (OLECHAR FAR *)(*env)->GetIntField(env, lpObject, lpCache->lpstrSchema);
- lpStruct->memidDestructor = (*env)->GetIntField(env, lpObject, lpCache->memidDestructor);
- lpStruct->memidConstructor = (*env)->GetIntField(env, lpObject, lpCache->memidConstructor);
- lpStruct->dwReserved = (*env)->GetIntField(env, lpObject, lpCache->dwReserved);
- lpStruct->lcid = (*env)->GetIntField(env, lpObject, lpCache->lcid);
- lpStruct->guid.Data4[7] = (*env)->GetByteField(env, lpObject, lpCache->guid_b7);
- lpStruct->guid.Data4[6] = (*env)->GetByteField(env, lpObject, lpCache->guid_b6);
- lpStruct->guid.Data4[5] = (*env)->GetByteField(env, lpObject, lpCache->guid_b5);
- lpStruct->guid.Data4[4] = (*env)->GetByteField(env, lpObject, lpCache->guid_b4);
- lpStruct->guid.Data4[3] = (*env)->GetByteField(env, lpObject, lpCache->guid_b3);
- lpStruct->guid.Data4[2] = (*env)->GetByteField(env, lpObject, lpCache->guid_b2);
- lpStruct->guid.Data4[1] = (*env)->GetByteField(env, lpObject, lpCache->guid_b1);
- lpStruct->guid.Data4[0] = (*env)->GetByteField(env, lpObject, lpCache->guid_b0);
- lpStruct->guid.Data3 = (*env)->GetShortField(env, lpObject, lpCache->guid_data3);
- lpStruct->guid.Data2 = (*env)->GetShortField(env, lpObject, lpCache->guid_data2);
- lpStruct->guid.Data1 = (*env)->GetIntField(env, lpObject, lpCache->guid_data1);
- return lpStruct;
-}
-
-void setTYPEATTRFields(JNIEnv *env, jobject lpObject, TYPEATTR *lpStruct, PTYPEATTR_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheTYPEATTRFids(env, lpObject, lpCache);
- (*env)->SetShortField(env, lpObject, lpCache->idldescType_wIDLFlags, lpStruct->idldescType.wIDLFlags);
- (*env)->SetIntField(env, lpObject, lpCache->idldescType_dwReserved, lpStruct->idldescType.dwReserved);
- (*env)->SetShortField(env, lpObject, lpCache->tdescAlias_vt, lpStruct->tdescAlias.vt);
- (*env)->SetIntField(env, lpObject, lpCache->tdescAlias_unionField, (jint)lpStruct->tdescAlias.lptdesc);
- (*env)->SetShortField(env, lpObject, lpCache->wMinorVerNum, lpStruct->wMinorVerNum);
- (*env)->SetShortField(env, lpObject, lpCache->wMajorVerNum, lpStruct->wMajorVerNum);
- (*env)->SetShortField(env, lpObject, lpCache->wTypeFlags, lpStruct->wTypeFlags);
- (*env)->SetShortField(env, lpObject, lpCache->cbAlignment, lpStruct->cbAlignment);
- (*env)->SetShortField(env, lpObject, lpCache->cbSizeVft, lpStruct->cbSizeVft);
- (*env)->SetShortField(env, lpObject, lpCache->cImplTypes, lpStruct->cImplTypes);
- (*env)->SetShortField(env, lpObject, lpCache->cVars, lpStruct->cVars);
- (*env)->SetShortField(env, lpObject, lpCache->cFuncs, lpStruct->cFuncs);
- (*env)->SetIntField(env, lpObject, lpCache->typekind, lpStruct->typekind);
- (*env)->SetIntField(env, lpObject, lpCache->cbSizeInstance, lpStruct->cbSizeInstance);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrSchema, (jint)lpStruct->lpstrSchema);
- (*env)->SetIntField(env, lpObject, lpCache->memidDestructor, lpStruct->memidDestructor);
- (*env)->SetIntField(env, lpObject, lpCache->memidConstructor, lpStruct->memidConstructor);
- (*env)->SetIntField(env, lpObject, lpCache->dwReserved, lpStruct->dwReserved);
- (*env)->SetIntField(env, lpObject, lpCache->lcid, lpStruct->lcid);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b7, lpStruct->guid.Data4[7]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b6, lpStruct->guid.Data4[6]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b5, lpStruct->guid.Data4[5]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b4, lpStruct->guid.Data4[4]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b3, lpStruct->guid.Data4[3]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b2, lpStruct->guid.Data4[2]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b1, lpStruct->guid.Data4[1]);
- (*env)->SetByteField(env, lpObject, lpCache->guid_b0, lpStruct->guid.Data4[0]);
- (*env)->SetShortField(env, lpObject, lpCache->guid_data3, lpStruct->guid.Data3);
- (*env)->SetShortField(env, lpObject, lpCache->guid_data2, lpStruct->guid.Data2);
- (*env)->SetIntField(env, lpObject, lpCache->guid_data1, lpStruct->guid.Data1);
-}
-
-void cacheVARDESC1Fids(JNIEnv *env, jobject lpObject, PVARDESC1_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->varkind = (*env)->GetFieldID(env, lpCache->clazz, "varkind", "I");
- lpCache->wVarFlags = (*env)->GetFieldID(env, lpCache->clazz, "wVarFlags", "S");
- lpCache->elemdescVar_paramdesc_wParamFlags = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_paramdesc_wParamFlags", "S");
- lpCache->elemdescVar_paramdesc_pparamdescex = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_paramdesc_pparamdescex", "I");
- lpCache->elemdescVar_tdesc_vt = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_tdesc_vt", "S");
- lpCache->elemdescVar_tdesc_union = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_tdesc_union", "I");
- lpCache->unionField = (*env)->GetFieldID(env, lpCache->clazz, "unionField", "I");
- lpCache->lpstrSchema = (*env)->GetFieldID(env, lpCache->clazz, "lpstrSchema", "I");
- lpCache->memid = (*env)->GetFieldID(env, lpCache->clazz, "memid", "I");
- lpCache->cached = 1;
-}
-
-VARDESC* getVARDESC1Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC1_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheVARDESC1Fids(env, lpObject, lpCache);
- lpStruct->varkind = (*env)->GetIntField(env, lpObject, lpCache->varkind);
- lpStruct->wVarFlags = (*env)->GetShortField(env, lpObject, lpCache->wVarFlags);
- lpStruct->elemdescVar.paramdesc.wParamFlags = (*env)->GetShortField(env, lpObject, lpCache->elemdescVar_paramdesc_wParamFlags);
- lpStruct->elemdescVar.paramdesc.pparamdescex = (LPPARAMDESCEX)(*env)->GetIntField(env, lpObject, lpCache->elemdescVar_paramdesc_pparamdescex);
- lpStruct->elemdescVar.tdesc.vt = (*env)->GetShortField(env, lpObject, lpCache->elemdescVar_tdesc_vt);
- lpStruct->elemdescVar.tdesc.lptdesc = (struct FARSTRUCT tagTYPEDESC FAR *)(*env)->GetIntField(env, lpObject, lpCache->elemdescVar_tdesc_union);
- lpStruct->oInst = (*env)->GetIntField(env, lpObject, lpCache->unionField);
- lpStruct->lpstrSchema = (OLECHAR FAR *)(*env)->GetIntField(env, lpObject, lpCache->lpstrSchema);
- lpStruct->memid = (*env)->GetIntField(env, lpObject, lpCache->memid);
- return lpStruct;
-}
-
-void setVARDESC1Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC1_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheVARDESC1Fids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->varkind, lpStruct->varkind);
- (*env)->SetShortField(env, lpObject, lpCache->wVarFlags, lpStruct->wVarFlags);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescVar_paramdesc_wParamFlags, lpStruct->elemdescVar.paramdesc.wParamFlags);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescVar_paramdesc_pparamdescex, (jint)lpStruct->elemdescVar.paramdesc.pparamdescex);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescVar_tdesc_vt, lpStruct->elemdescVar.tdesc.vt);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescVar_tdesc_union, (jint)lpStruct->elemdescVar.tdesc.lptdesc);
- (*env)->SetIntField(env, lpObject, lpCache->unionField, lpStruct->oInst);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrSchema, (jint)lpStruct->lpstrSchema);
- (*env)->SetIntField(env, lpObject, lpCache->memid, lpStruct->memid);
-}
-
-void cacheVARDESC2Fids(JNIEnv *env, jobject lpObject, PVARDESC2_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->varkind = (*env)->GetFieldID(env, lpCache->clazz, "varkind", "I");
- lpCache->wVarFlags = (*env)->GetFieldID(env, lpCache->clazz, "wVarFlags", "S");
- lpCache->elemdescFunc_idldesc_wIDLFlags = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_idldesc_wIDLFlags", "S");
- lpCache->elemdescFunc_idldesc_dwReserved = (*env)->GetFieldID(env, lpCache->clazz, "elemdescFunc_idldesc_dwReserved", "I");
- lpCache->elemdescVar_tdesc_vt = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_tdesc_vt", "S");
- lpCache->elemdescVar_tdesc_union = (*env)->GetFieldID(env, lpCache->clazz, "elemdescVar_tdesc_union", "I");
- lpCache->unionField = (*env)->GetFieldID(env, lpCache->clazz, "unionField", "I");
- lpCache->lpstrSchema = (*env)->GetFieldID(env, lpCache->clazz, "lpstrSchema", "I");
- lpCache->memid = (*env)->GetFieldID(env, lpCache->clazz, "memid", "I");
- lpCache->cached = 1;
-}
-
-VARDESC* getVARDESC2Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC2_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheVARDESC2Fids(env, lpObject, lpCache);
- lpStruct->varkind = (*env)->GetIntField(env, lpObject, lpCache->varkind);
- lpStruct->wVarFlags = (*env)->GetShortField(env, lpObject, lpCache->wVarFlags);
- lpStruct->elemdescVar.idldesc.wIDLFlags = (*env)->GetShortField(env, lpObject, lpCache->elemdescFunc_idldesc_wIDLFlags);
- lpStruct->elemdescVar.idldesc.dwReserved = (*env)->GetIntField(env, lpObject, lpCache->elemdescFunc_idldesc_dwReserved);
- lpStruct->elemdescVar.tdesc.vt = (*env)->GetShortField(env, lpObject, lpCache->elemdescVar_tdesc_vt);
- lpStruct->elemdescVar.tdesc.lptdesc = (struct FARSTRUCT tagTYPEDESC FAR *)(*env)->GetIntField(env, lpObject, lpCache->elemdescVar_tdesc_union);
- lpStruct->oInst = (*env)->GetIntField(env, lpObject, lpCache->unionField);
- lpStruct->lpstrSchema = (OLECHAR FAR *)(*env)->GetIntField(env, lpObject, lpCache->lpstrSchema);
- lpStruct->memid = (*env)->GetIntField(env, lpObject, lpCache->memid);
- return lpStruct;
-}
-
-void setVARDESC2Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC2_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheVARDESC2Fids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->varkind, lpStruct->varkind);
- (*env)->SetShortField(env, lpObject, lpCache->wVarFlags, lpStruct->wVarFlags);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescFunc_idldesc_wIDLFlags, lpStruct->elemdescVar.idldesc.wIDLFlags);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescFunc_idldesc_dwReserved, lpStruct->elemdescVar.idldesc.dwReserved);
- (*env)->SetShortField(env, lpObject, lpCache->elemdescVar_tdesc_vt, lpStruct->elemdescVar.tdesc.vt);
- (*env)->SetIntField(env, lpObject, lpCache->elemdescVar_tdesc_union, (jint)lpStruct->elemdescVar.tdesc.lptdesc);
- (*env)->SetIntField(env, lpObject, lpCache->unionField, lpStruct->oInst);
- (*env)->SetIntField(env, lpObject, lpCache->lpstrSchema, (jint)lpStruct->lpstrSchema);
- (*env)->SetIntField(env, lpObject, lpCache->memid, lpStruct->memid);
-}
-
-/**************************** END OLE ****************************/
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h
deleted file mode 100644
index 771565f98b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h
+++ /dev/null
@@ -1,1160 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * JNI SWT object field getters and setters declarations for Windows structs.
- */
-
-#ifndef INC_structs_H
-#define INC_structs_H
-
-#define WINVER 0x0500
-#define _WIN32_IE 0x0500
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#define VC_EXTRALEAN
-
-#include <windows.h>
-#include <winuser.h>
-#include <commctrl.h>
-#include <commdlg.h>
-#include <oaidl.h>
-#include <shlobj.h>
-#include <ole2.h>
-#include <olectl.h>
-#include <objbase.h>
-#include <shlwapi.h>
-#include <shellapi.h>
-
-#ifdef _WIN32_WCE
-#include <aygshell.h>
-#endif // _WIN_32_WCE
-
-/** Structs */
-
-/* ACCEL struct */
-typedef struct ACCEL_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID fVirt, key, cmd;
-} ACCEL_FID_CACHE;
-typedef ACCEL_FID_CACHE *PACCEL_FID_CACHE;
-
-void cacheACCELFids(JNIEnv *env, jobject lpObject, PACCEL_FID_CACHE lpCache);
-ACCEL* getACCELFields(JNIEnv *env, jobject lpObject, ACCEL *lpStruct, PACCEL_FID_CACHE lpCache);
-void setACCELFields(JNIEnv *env, jobject lpObject, ACCEL *lpStruct, PACCEL_FID_CACHE lpCache);
-
-/* BITMAP struct */
-typedef struct BITMAP_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID bmType, bmWidth, bmHeight, bmWidthBytes, bmPlanes, bmBitsPixel, bmBits;
-} BITMAP_FID_CACHE;
-typedef BITMAP_FID_CACHE *PBITMAP_FID_CACHE;
-
-void cacheBITMAPFids(JNIEnv *env, jobject lpObject, PBITMAP_FID_CACHE lpCache);
-BITMAP* getBITMAPFields(JNIEnv *env, jobject lpObject, BITMAP *lpStruct, PBITMAP_FID_CACHE lpCache);
-void setBITMAPFields(JNIEnv *env, jobject lpObject, BITMAP *lpStruct, PBITMAP_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* BROWSEINFO struct */
-typedef struct BROWSEINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndOwner, pidlRoot, pszDisplayName, lpszTitle, ulFlags, lpfn, lParam, iImage;
-} BROWSEINFO_FID_CACHE;
-typedef BROWSEINFO_FID_CACHE *PBROWSEINFO_FID_CACHE;
-
-void cacheBROWSEINFOFids(JNIEnv *env, jobject lpObject, PBROWSEINFO_FID_CACHE lpCache);
-BROWSEINFO* getBROWSEINFOFields(JNIEnv *env, jobject lpObject, BROWSEINFO *lpStruct, PBROWSEINFO_FID_CACHE lpCache);
-void setBROWSEINFOFields(JNIEnv *env, jobject lpObject, BROWSEINFO *lpStruct, PBROWSEINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* CHOOSECOLOR struct */
-typedef struct CHOOSECOLOR_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lStructSize, hwndOwner, hInstance, rgbResult, lpCustColors, Flags, lCustData, lpfnHook, lpTemplateName;
-} CHOOSECOLOR_FID_CACHE;
-typedef CHOOSECOLOR_FID_CACHE *PCHOOSECOLOR_FID_CACHE;
-
-void cacheCHOOSECOLORFids(JNIEnv *env, jobject lpObject, PCHOOSECOLOR_FID_CACHE lpCache);
-CHOOSECOLOR* getCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct, PCHOOSECOLOR_FID_CACHE lpCache);
-void setCHOOSECOLORFields(JNIEnv *env, jobject lpObject, CHOOSECOLOR *lpStruct, PCHOOSECOLOR_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* CHOOSEFONT struct */
-typedef struct CHOOSEFONT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lStructSize, hwndOwner, hDC, lpLogFont, iPointSize, Flags, rgbColors, lCustData, lpfnHook, lpTemplateName, hInstance, lpszStyle, nFontType, nSizeMin, nSizeMax;
-} CHOOSEFONT_FID_CACHE;
-typedef CHOOSEFONT_FID_CACHE *PCHOOSEFONT_FID_CACHE;
-
-void cacheCHOOSEFONTFids(JNIEnv *env, jobject lpObject, PCHOOSEFONT_FID_CACHE lpCache);
-CHOOSEFONT* getCHOOSEFONTFields(JNIEnv *env, jobject lpObject, CHOOSEFONT *lpStruct, PCHOOSEFONT_FID_CACHE lpCache);
-void setCHOOSEFONTFields(JNIEnv *env, jobject lpObject, CHOOSEFONT *lpStruct, PCHOOSEFONT_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* COMPOSITIONFORM struct */
-typedef struct COMPOSITIONFORM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwStyle, x, y, left, top, right, bottom;
-} COMPOSITIONFORM_FID_CACHE;
-typedef COMPOSITIONFORM_FID_CACHE *PCOMPOSITIONFORM_FID_CACHE;
-
-void cacheCOMPOSITIONFORMFids(JNIEnv *env, jobject lpObject, PCOMPOSITIONFORM_FID_CACHE lpCache);
-COMPOSITIONFORM* getCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct, PCOMPOSITIONFORM_FID_CACHE lpCache);
-void setCOMPOSITIONFORMFields(JNIEnv *env, jobject lpObject, COMPOSITIONFORM *lpStruct, PCOMPOSITIONFORM_FID_CACHE lpCache);
-
-/* CREATESTRUCT struct */
-typedef struct CREATESTRUCT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lpCreateParams, hInstance, hMenu, hwndParent, cy, cx, y, x, style, lpszName, lpszClass, dwExStyle;
-} CREATESTRUCT_FID_CACHE;
-typedef CREATESTRUCT_FID_CACHE *PCREATESTRUCT_FID_CACHE;
-
-void cacheCREATESTRUCTFids(JNIEnv *env, jobject lpObject, PCREATESTRUCT_FID_CACHE lpCache);
-CREATESTRUCT* getCREATESTRUCTFields(JNIEnv *env, jobject lpObject, CREATESTRUCT *lpStruct, PCREATESTRUCT_FID_CACHE lpCache);
-void setCREATESTRUCTFields(JNIEnv *env, jobject lpObject, CREATESTRUCT *lpStruct, PCREATESTRUCT_FID_CACHE lpCache);
-
-/* DIBSECTION struct */
-typedef struct DIBSECTION_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID bmType, bmWidth, bmHeight, bmWidthBytes, bmPlanes, bmBitsPixel, bmBits, biSize, biWidth, biHeight, biPlanes, biBitCount, biCompression, biSizeImage, biXPelsPerMeter, biYPelsPerMeter, biClrUsed, biClrImportant, dsBitfields0, dsBitfields1, dsBitfields2, dshSection, dsOffset;
-} DIBSECTION_FID_CACHE;
-typedef DIBSECTION_FID_CACHE *PDIBSECTION_FID_CACHE;
-
-void cacheDIBSECTIONFids(JNIEnv *env, jobject lpObject, PDIBSECTION_FID_CACHE lpCache);
-DIBSECTION* getDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct, PDIBSECTION_FID_CACHE lpCache);
-void setDIBSECTIONFields(JNIEnv *env, jobject lpObject, DIBSECTION *lpStruct, PDIBSECTION_FID_CACHE lpCache);
-
-/* DLLVERSIONINFO struct */
-typedef struct DLLVERSIONINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformID;
-} DLLVERSIONINFO_FID_CACHE;
-typedef DLLVERSIONINFO_FID_CACHE *PDLLVERSIONINFO_FID_CACHE;
-
-void cacheDLLVERSIONINFOFids(JNIEnv *env, jobject lpObject, PDLLVERSIONINFO_FID_CACHE lpCache);
-DLLVERSIONINFO* getDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct, PDLLVERSIONINFO_FID_CACHE lpCache);
-void setDLLVERSIONINFOFields(JNIEnv *env, jobject lpObject, DLLVERSIONINFO *lpStruct, PDLLVERSIONINFO_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* DOCINFO struct */
-typedef struct DOCINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, lpszDocName, lpszOutput, lpszDatatype, fwType;
-} DOCINFO_FID_CACHE;
-typedef DOCINFO_FID_CACHE *PDOCINFO_FID_CACHE;
-
-void cacheDOCINFOFids(JNIEnv *env, jobject lpObject, PDOCINFO_FID_CACHE lpCache);
-DOCINFO* getDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct, PDOCINFO_FID_CACHE lpCache);
-void setDOCINFOFields(JNIEnv *env, jobject lpObject, DOCINFO *lpStruct, PDOCINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* DRAWITEMSTRUCT struct */
-typedef struct DRAWITEMSTRUCT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID CtlType, CtlID, itemID, itemAction, itemState, hwndItem, hDC, left, top, bottom, right, itemData;
-} DRAWITEMSTRUCT_FID_CACHE;
-typedef DRAWITEMSTRUCT_FID_CACHE *PDRAWITEMSTRUCT_FID_CACHE;
-
-void cacheDRAWITEMSTRUCTFids(JNIEnv *env, jobject lpObject, PDRAWITEMSTRUCT_FID_CACHE lpCache);
-DRAWITEMSTRUCT* getDRAWITEMSTRUCTFields(JNIEnv *env, jobject lpObject, DRAWITEMSTRUCT *lpStruct, PDRAWITEMSTRUCT_FID_CACHE lpCache);
-void setDRAWITEMSTRUCTFields(JNIEnv *env, jobject lpObject, DRAWITEMSTRUCT *lpStruct, PDRAWITEMSTRUCT_FID_CACHE lpCache);
-
-/* FILETIME struct */
-typedef struct FILETIME_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwLowDateTime, dwHighDateTime;
-} FILETIME_FID_CACHE;
-typedef FILETIME_FID_CACHE *PFILETIME_FID_CACHE;
-
-void cacheFILETIMEFids(JNIEnv *env, jobject lpObject, PFILETIME_FID_CACHE lpCache);
-FILETIME* getFILETIMEFields(JNIEnv *env, jobject lpObject, FILETIME *lpStruct, PFILETIME_FID_CACHE lpCache);
-void setFILETIMEFields(JNIEnv *env, jobject lpObject, FILETIME *lpStruct, PFILETIME_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* GCP_RESULTS struct */
-typedef struct GCP_RESULTS_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lStructSize, lpOutString, lpOrder, lpDx, lpCaretPos, lpClass, lpGlyphs, nGlyphs, nMaxFit;
-} GCP_RESULTS_FID_CACHE;
-typedef GCP_RESULTS_FID_CACHE *PGCP_RESULTS_FID_CACHE;
-
-void cacheGCP_RESULTSFids(JNIEnv *env, jobject lpObject, PGCP_RESULTS_FID_CACHE lpCache);
-GCP_RESULTS* getGCP_RESULTSFields(JNIEnv *env, jobject lpObject, GCP_RESULTS *lpStruct, PGCP_RESULTS_FID_CACHE lpCache);
-void setGCP_RESULTSFields(JNIEnv *env, jobject lpObject, GCP_RESULTS *lpStruct, PGCP_RESULTS_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-/* GRADIENT_RECT struct */
-typedef struct GRADIENT_RECT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID UpperLeft, LowerRight;
-} GRADIENT_RECT_FID_CACHE;
-typedef GRADIENT_RECT_FID_CACHE *PGRADIENT_RECT_FID_CACHE;
-
-void cacheGRADIENT_RECTFids(JNIEnv *env, jobject lpObject, PGRADIENT_RECT_FID_CACHE lpCache);
-GRADIENT_RECT* getGRADIENT_RECTFields(JNIEnv *env, jobject lpObject, GRADIENT_RECT *lpStruct, PGRADIENT_RECT_FID_CACHE lpCache);
-void setGRADIENT_RECTFields(JNIEnv *env, jobject lpObject, GRADIENT_RECT *lpStruct, PGRADIENT_RECT_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* HDITEM struct */
-typedef struct HDITEM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID mask, cxy, pszText, hbm, cchTextMax, fmt, lParam, iImage, iOrder;
-} HDITEM_FID_CACHE;
-typedef HDITEM_FID_CACHE *PHDITEM_FID_CACHE;
-
-void cacheHDITEMFids(JNIEnv *env, jobject lpObject, PHDITEM_FID_CACHE lpCache);
-HDITEM* getHDITEMFields(JNIEnv *env, jobject lpObject, HDITEM *lpStruct, PHDITEM_FID_CACHE lpCache);
-void setHDITEMFields(JNIEnv *env, jobject lpObject, HDITEM *lpStruct, PHDITEM_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* HELPINFO struct */
-typedef struct HELPINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, iContextType, iCtrlId, hItemHandle, dwContextId, x, y;
-} HELPINFO_FID_CACHE;
-typedef HELPINFO_FID_CACHE *PHELPINFO_FID_CACHE;
-
-void cacheHELPINFOFids(JNIEnv *env, jobject lpObject, PHELPINFO_FID_CACHE lpCache);
-HELPINFO* getHELPINFOFields(JNIEnv *env, jobject lpObject, HELPINFO *lpStruct, PHELPINFO_FID_CACHE lpCache);
-void setHELPINFOFields(JNIEnv *env, jobject lpObject, HELPINFO *lpStruct, PHELPINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* ICONINFO struct */
-typedef struct ICONINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID fIcon, xHotspot, yHotspot, hbmMask, hbmColor;
-} ICONINFO_FID_CACHE;
-typedef ICONINFO_FID_CACHE *PICONINFO_FID_CACHE;
-
-void cacheICONINFOFids(JNIEnv *env, jobject lpObject, PICONINFO_FID_CACHE lpCache);
-ICONINFO* getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct, PICONINFO_FID_CACHE lpCache);
-void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct, PICONINFO_FID_CACHE lpCache);
-
-/* INITCOMMONCONTROLSEX struct */
-typedef struct INITCOMMONCONTROLSEX_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwSize, dwICC;
-} INITCOMMONCONTROLSEX_FID_CACHE;
-typedef INITCOMMONCONTROLSEX_FID_CACHE *PINITCOMMONCONTROLSEX_FID_CACHE;
-
-void cacheINITCOMMONCONTROLSEXFids(JNIEnv *env, jobject lpObject, PINITCOMMONCONTROLSEX_FID_CACHE lpCache);
-INITCOMMONCONTROLSEX* getINITCOMMONCONTROLSEXFields(JNIEnv *env, jobject lpObject, INITCOMMONCONTROLSEX *lpStruct, PINITCOMMONCONTROLSEX_FID_CACHE lpCache);
-void setINITCOMMONCONTROLSEXFields(JNIEnv *env, jobject lpObject, INITCOMMONCONTROLSEX *lpStruct, PINITCOMMONCONTROLSEX_FID_CACHE lpCache);
-
-/* LOGBRUSH struct */
-typedef struct LOGBRUSH_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lbStyle, lbColor, lbHatch;
-} LOGBRUSH_FID_CACHE;
-typedef LOGBRUSH_FID_CACHE *PLOGBRUSH_FID_CACHE;
-
-void cacheLOGBRUSHFids(JNIEnv *env, jobject lpObject, PLOGBRUSH_FID_CACHE lpCache);
-LOGBRUSH* getLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct, PLOGBRUSH_FID_CACHE lpCache);
-void setLOGBRUSHFields(JNIEnv *env, jobject lpObject, LOGBRUSH *lpStruct, PLOGBRUSH_FID_CACHE lpCache);
-
-/* LOGFONT struct */
-typedef struct LOGFONT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lfHeight, lfWidth, lfEscapement, lfOrientation, lfWeight, lfItalic, lfUnderline, lfStrikeOut, lfCharSet, lfOutPrecision, lfClipPrecision, lfQuality, lfPitchAndFamily, lfFaceName0, lfFaceName1, lfFaceName2, lfFaceName3, lfFaceName4, lfFaceName5, lfFaceName6, lfFaceName7, lfFaceName8, lfFaceName9, lfFaceName10, lfFaceName11, lfFaceName12, lfFaceName13, lfFaceName14, lfFaceName15, lfFaceName16, lfFaceName17, lfFaceName18, lfFaceName19, lfFaceName20, lfFaceName21, lfFaceName22, lfFaceName23, lfFaceName24, lfFaceName25, lfFaceName26, lfFaceName27, lfFaceName28, lfFaceName29, lfFaceName30, lfFaceName31;
-} LOGFONT_FID_CACHE;
-typedef LOGFONT_FID_CACHE *PLOGFONT_FID_CACHE;
-
-void cacheLOGFONTFids(JNIEnv *env, jobject lpObject, PLOGFONT_FID_CACHE lpCache);
-#ifndef _WIN32_WCE
-LOGFONTA* getLOGFONTAFields(JNIEnv *env, jobject lpObject, LOGFONTA *lpStruct, PLOGFONT_FID_CACHE lpCache);
-void setLOGFONTAFields(JNIEnv *env, jobject lpObject, LOGFONTA *lpStruct, PLOGFONT_FID_CACHE lpCache);
-#endif // _WIN32_WCE
-LOGFONTW* getLOGFONTWFields(JNIEnv *env, jobject lpObject, LOGFONTW *lpStruct, PLOGFONT_FID_CACHE lpCache);
-void setLOGFONTWFields(JNIEnv *env, jobject lpObject, LOGFONTW *lpStruct, PLOGFONT_FID_CACHE lpCache);
-
-/* LOGPEN struct */
-typedef struct LOGPEN_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lopnStyle, x, y, lopnColor;
-} LOGPEN_FID_CACHE;
-typedef LOGPEN_FID_CACHE *PLOGPEN_FID_CACHE;
-
-void cacheLOGPENFids(JNIEnv *env, jobject lpObject, PLOGPEN_FID_CACHE lpCache);
-LOGPEN* getLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct, PLOGPEN_FID_CACHE lpCache);
-void setLOGPENFields(JNIEnv *env, jobject lpObject, LOGPEN *lpStruct, PLOGPEN_FID_CACHE lpCache);
-
-/* LVCOLUMN struct */
-typedef struct LVCOLUMN_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID mask, fmt, cx, pszText, cchTextMax, iSubItem, iImage, iOrder;
-} LVCOLUMN_FID_CACHE;
-typedef LVCOLUMN_FID_CACHE *PLVCOLUMN_FID_CACHE;
-
-void cacheLVCOLUMNFids(JNIEnv *env, jobject lpObject, PLVCOLUMN_FID_CACHE lpCache);
-LVCOLUMN* getLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct, PLVCOLUMN_FID_CACHE lpCache);
-void setLVCOLUMNFields(JNIEnv *env, jobject lpObject, LVCOLUMN *lpStruct, PLVCOLUMN_FID_CACHE lpCache);
-
-/* LVHITTESTINFO struct */
-typedef struct LVHITTESTINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x, y, flags, iItem, iSubItem;
-} LVHITTESTINFO_FID_CACHE;
-typedef LVHITTESTINFO_FID_CACHE *PLVHITTESTINFO_FID_CACHE;
-
-void cacheLVHITTESTINFOFids(JNIEnv *env, jobject lpObject, PLVHITTESTINFO_FID_CACHE lpCache);
-LVHITTESTINFO* getLVHITTESTINFOFields(JNIEnv *env, jobject lpObject, LVHITTESTINFO *lpStruct, PLVHITTESTINFO_FID_CACHE lpCache);
-void setLVHITTESTINFOFields(JNIEnv *env, jobject lpObject, LVHITTESTINFO *lpStruct, PLVHITTESTINFO_FID_CACHE lpCache);
-
-/* LVITEM struct */
-typedef struct LVITEM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID mask, iItem, iSubItem, state, stateMask, pszText, cchTextMax, iImage, lParam, iIndent;
-} LVITEM_FID_CACHE;
-typedef LVITEM_FID_CACHE *PLVITEM_FID_CACHE;
-
-void cacheLVITEMFids(JNIEnv *env, jobject lpObject, PLVITEM_FID_CACHE lpCache);
-LVITEM* getLVITEMFields(JNIEnv *env, jobject lpObject, LVITEM *lpStruct, PLVITEM_FID_CACHE lpCache);
-void setLVITEMFields(JNIEnv *env, jobject lpObject, LVITEM *lpStruct, PLVITEM_FID_CACHE lpCache);
-
-/* MEASUREITEMSTRUCT struct */
-typedef struct MEASUREITEMSTRUCT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID CtlType, CtlID, itemID, itemWidth, itemHeight, itemData;
-} MEASUREITEMSTRUCT_FID_CACHE;
-typedef MEASUREITEMSTRUCT_FID_CACHE *PMEASUREITEMSTRUCT_FID_CACHE;
-
-void cacheMEASUREITEMSTRUCTFids(JNIEnv *env, jobject lpObject, PMEASUREITEMSTRUCT_FID_CACHE lpCache);
-MEASUREITEMSTRUCT* getMEASUREITEMSTRUCTFields(JNIEnv *env, jobject lpObject, MEASUREITEMSTRUCT *lpStruct, PMEASUREITEMSTRUCT_FID_CACHE lpCache);
-void setMEASUREITEMSTRUCTFields(JNIEnv *env, jobject lpObject, MEASUREITEMSTRUCT *lpStruct, PMEASUREITEMSTRUCT_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* MENUINFO struct */
-typedef struct MENUINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, fMask, dwStyle, cyMax, hbrBack, dwContextHelpID, dwMenuData;
-} MENUINFO_FID_CACHE;
-typedef MENUINFO_FID_CACHE *PMENUINFO_FID_CACHE;
-
-void cacheMENUINFOFids(JNIEnv *env, jobject lpObject, PMENUINFO_FID_CACHE lpCache);
-MENUINFO* getMENUINFOFields(JNIEnv *env, jobject lpObject, MENUINFO *lpStruct, PMENUINFO_FID_CACHE lpCache);
-void setMENUINFOFields(JNIEnv *env, jobject lpObject, MENUINFO *lpStruct, PMENUINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* MENUITEMINFO struct */
-typedef struct MENUITEMINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, fMask, fType, fState, wID, hSubMenu, hbmpChecked, hbmpUnchecked, dwItemData, dwTypeData, cch, hbmpItem;
-} MENUITEMINFO_FID_CACHE;
-typedef MENUITEMINFO_FID_CACHE *PMENUITEMINFO_FID_CACHE;
-
-void cacheMENUITEMINFOFids(JNIEnv *env, jobject lpObject, PMENUITEMINFO_FID_CACHE lpCache);
-MENUITEMINFO* getMENUITEMINFOFields(JNIEnv *env, jobject lpObject, MENUITEMINFO *lpStruct, PMENUITEMINFO_FID_CACHE lpCache);
-void setMENUITEMINFOFields(JNIEnv *env, jobject lpObject, MENUITEMINFO *lpStruct, PMENUITEMINFO_FID_CACHE lpCache);
-
-/* MSG struct */
-typedef struct MSG_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwnd, message, wParam, lParam, time, x, y;
-} MSG_FID_CACHE;
-typedef MSG_FID_CACHE *PMSG_FID_CACHE;
-
-void cacheMSGFids(JNIEnv *env, jobject lpObject, PMSG_FID_CACHE lpCache);
-MSG* getMSGFields(JNIEnv *env, jobject lpObject, MSG *lpStruct, PMSG_FID_CACHE lpCache);
-void setMSGFields(JNIEnv *env, jobject lpObject, MSG *lpStruct, PMSG_FID_CACHE lpCache);
-
-/* NMHDR struct */
-typedef struct NMHDR_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndFrom, idFrom, code;
-} NMHDR_FID_CACHE;
-typedef NMHDR_FID_CACHE *PNMHDR_FID_CACHE;
-
-void cacheNMHDRFids(JNIEnv *env, jobject lpObject, PNMHDR_FID_CACHE lpCache);
-NMHDR* getNMHDRFields(JNIEnv *env, jobject lpObject, NMHDR *lpStruct, PNMHDR_FID_CACHE lpCache);
-void setNMHDRFields(JNIEnv *env, jobject lpObject, NMHDR *lpStruct, PNMHDR_FID_CACHE lpCache);
-
-/* NMHEADER struct */
-typedef struct NMHEADER_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndFrom, idFrom, code, iItem, iButton, pitem;
-} NMHEADER_FID_CACHE;
-typedef NMHEADER_FID_CACHE *PNMHEADER_FID_CACHE;
-
-void cacheNMHEADERFids(JNIEnv *env, jobject lpObject, PNMHEADER_FID_CACHE lpCache);
-NMHEADER* getNMHEADERFields(JNIEnv *env, jobject lpObject, NMHEADER *lpStruct, PNMHEADER_FID_CACHE lpCache);
-void setNMHEADERFields(JNIEnv *env, jobject lpObject, NMHEADER *lpStruct, PNMHEADER_FID_CACHE lpCache);
-
-/* NMLISTVIEW struct */
-typedef struct NMLISTVIEW_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndFrom, idFrom, code, iItem, iSubItem, uNewState, uOldState, uChanged, x, y, lParam;
-} NMLISTVIEW_FID_CACHE;
-typedef NMLISTVIEW_FID_CACHE *PNMLISTVIEW_FID_CACHE;
-
-void cacheNMLISTVIEWFids(JNIEnv *env, jobject lpObject, PNMLISTVIEW_FID_CACHE lpCache);
-NMLISTVIEW* getNMLISTVIEWFields(JNIEnv *env, jobject lpObject, NMLISTVIEW *lpStruct, PNMLISTVIEW_FID_CACHE lpCache);
-void setNMLISTVIEWFields(JNIEnv *env, jobject lpObject, NMLISTVIEW *lpStruct, PNMLISTVIEW_FID_CACHE lpCache);
-
-/* NMTOOLBAR struct */
-typedef struct NMTOOLBAR_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndFrom, idFrom, code, iItem, iBitmap, idCommand, fsState, fsStyle, dwData, iString, cchText, pszText, left, top, right, bottom;
-} NMTOOLBAR_FID_CACHE;
-typedef NMTOOLBAR_FID_CACHE *PNMTOOLBAR_FID_CACHE;
-
-void cacheNMTOOLBARFids(JNIEnv *env, jobject lpObject, PNMTOOLBAR_FID_CACHE lpCache);
-NMTOOLBAR* getNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct, PNMTOOLBAR_FID_CACHE lpCache);
-void setNMTOOLBARFields(JNIEnv *env, jobject lpObject, NMTOOLBAR *lpStruct, PNMTOOLBAR_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* NMTTDISPINFO struct */
-typedef struct NMTTDISPINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwndFrom, idFrom, code, lpszText, hinst, uFlags, lParam;
-} NMTTDISPINFO_FID_CACHE;
-typedef NMTTDISPINFO_FID_CACHE *PNMTTDISPINFO_FID_CACHE;
-
-void cacheNMTTDISPINFOFids(JNIEnv *env, jobject lpObject, PNMTTDISPINFO_FID_CACHE lpCache);
-NMTTDISPINFOW* getNMTTDISPINFOWFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOW *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache);
-void setNMTTDISPINFOWFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOW *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache);
-NMTTDISPINFOA* getNMTTDISPINFOAFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOA *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache);
-void setNMTTDISPINFOAFields(JNIEnv *env, jobject lpObject, NMTTDISPINFOA *lpStruct, PNMTTDISPINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-/* NONCLIENTMETRICS struct */
-typedef struct NONCLIENTMETRICS_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, iBorderWidth, iScrollWidth, iScrollHeight, iCaptionWidth, iCaptionHeight, iSmCaptionWidth, iSmCaptionHeight, iMenuWidth, iMenuHeight;
- jfieldID lfCaptionFont, lfSmCaptionFont, lfMenuFont, lfStatusFont, lfMessageFont;
-} NONCLIENTMETRICS_FID_CACHE;
-typedef NONCLIENTMETRICS_FID_CACHE *PNONCLIENTMETRICS_FID_CACHE;
-
-void cacheNONCLIENTMETRICSFids(JNIEnv *env, jobject lpObject, PNONCLIENTMETRICS_FID_CACHE lpCache);
-NONCLIENTMETRICSA* getNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache);
-void setNONCLIENTMETRICSAFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSA *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache);
-NONCLIENTMETRICSW* getNONCLIENTMETRICSWFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSW *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache);
-void setNONCLIENTMETRICSWFields(JNIEnv *env, jobject lpObject, NONCLIENTMETRICSW *lpStruct, PNONCLIENTMETRICS_FID_CACHE lpCache);
-#endif // _WIN32_WCE
-
-/* OPENFILENAME struct */
-typedef struct OPENFILENAME_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lStructSize, hwndOwner, hInstance, lpstrFilter, lpstrCustomFilter, nMaxCustFilter, nFilterIndex, lpstrFile, nMaxFile, lpstrFileTitle, nMaxFileTitle, lpstrInitialDir, lpstrTitle, Flags, nFileOffset, nFileExtension, lpstrDefExt, lCustData, lpfnHook, lpTemplateName;
-} OPENFILENAME_FID_CACHE;
-typedef OPENFILENAME_FID_CACHE *POPENFILENAME_FID_CACHE;
-
-void cacheOPENFILENAMEFids(JNIEnv *env, jobject lpObject, POPENFILENAME_FID_CACHE lpCache);
-OPENFILENAME* getOPENFILENAMEFields(JNIEnv *env, jobject lpObject, OPENFILENAME *lpStruct, POPENFILENAME_FID_CACHE lpCache);
-void setOPENFILENAMEFields(JNIEnv *env, jobject lpObject, OPENFILENAME *lpStruct, POPENFILENAME_FID_CACHE lpCache);
-
-/* OSVERSIONINFO struct */
-typedef struct OSVERSIONINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformId;
-} OSVERSIONINFO_FID_CACHE;
-typedef OSVERSIONINFO_FID_CACHE *POSVERSIONINFO_FID_CACHE;
-
-void cacheOSVERSIONINFOFids(JNIEnv *env, jobject lpObject, POSVERSIONINFO_FID_CACHE lpCache);
-OSVERSIONINFOA* getOSVERSIONINFOAFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOA *lpStruct, POSVERSIONINFO_FID_CACHE lpCache);
-void setOSVERSIONINFOAFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOA *lpStruct, POSVERSIONINFO_FID_CACHE lpCache);
-OSVERSIONINFOW* getOSVERSIONINFOWFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOW *lpStruct, POSVERSIONINFO_FID_CACHE lpCache);
-void setOSVERSIONINFOWFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOW *lpStruct, POSVERSIONINFO_FID_CACHE lpCache);
-
-/* PAINTSTRUCT struct */
-typedef struct PAINTSTRUCT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hdc, fErase, left, top, right, bottom, fRestore, fIncUpdate/*, pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7*/;
-} PAINTSTRUCT_FID_CACHE;
-typedef PAINTSTRUCT_FID_CACHE *PPAINTSTRUCT_FID_CACHE;
-
-void cachePAINTSTRUCTFids(JNIEnv *env, jobject lpObject, PPAINTSTRUCT_FID_CACHE lpCache);
-PAINTSTRUCT* getPAINTSTRUCTFields(JNIEnv *env, jobject lpObject, PAINTSTRUCT *lpStruct, PPAINTSTRUCT_FID_CACHE lpCache);
-void setPAINTSTRUCTFields(JNIEnv *env, jobject lpObject, PAINTSTRUCT *lpStruct, PPAINTSTRUCT_FID_CACHE lpCache);
-
-/* POINT struct */
-typedef struct POINT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x, y;
-} POINT_FID_CACHE;
-typedef POINT_FID_CACHE *PPOINT_FID_CACHE;
-
-void cachePOINTFids(JNIEnv *env, jobject lpObject, PPOINT_FID_CACHE lpCache);
-POINT* getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct, PPOINT_FID_CACHE lpCache);
-void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct, PPOINT_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* PRINTDLG struct */
-typedef struct PRINTDLG_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID lStructSize, hwndOwner, hDevMode, hDevNames, hDC, Flags, nFromPage, nToPage, nMinPage, nMaxPage, nCopies, hInstance, lCustData, lpfnPrintHook, lpfnSetupHook, lpPrintTemplateName, lpSetupTemplateName, hPrintTemplate, hSetupTemplate;
-} PRINTDLG_FID_CACHE;
-typedef PRINTDLG_FID_CACHE *PPRINTDLG_FID_CACHE;
-
-void cachePRINTDLGFids(JNIEnv *env, jobject lpObject, PPRINTDLG_FID_CACHE lpCache);
-PRINTDLG* getPRINTDLGFields(JNIEnv *env, jobject lpObject, PRINTDLG *lpStruct, PPRINTDLG_FID_CACHE lpCache);
-void setPRINTDLGFields(JNIEnv *env, jobject lpObject, PRINTDLG *lpStruct, PPRINTDLG_FID_CACHE lpCache);
-
-#endif _WIN32_WCE
-
-/* REBARBANDINFO struct */
-typedef struct REBARBANDINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, fMask, fStyle, clrFore, clrBack, lpText, cch, iImage, hwndChild, cxMinChild, cyMinChild, cx, hbmBack, wID, cyChild, cyMaxChild, cyIntegral, cxIdeal, lParam, cxHeader;
-} REBARBANDINFO_FID_CACHE;
-typedef REBARBANDINFO_FID_CACHE *PREBARBANDINFO_FID_CACHE;
-
-void cacheREBARBANDINFOFids(JNIEnv *env, jobject lpObject, PREBARBANDINFO_FID_CACHE lpCache);
-REBARBANDINFO* getREBARBANDINFOFields(JNIEnv *env, jobject lpObject, REBARBANDINFO *lpStruct, PREBARBANDINFO_FID_CACHE lpCache);
-void setREBARBANDINFOFields(JNIEnv *env, jobject lpObject, REBARBANDINFO *lpStruct, PREBARBANDINFO_FID_CACHE lpCache);
-
-/* RECT struct */
-typedef struct RECT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID left, top, right, bottom;
-} RECT_FID_CACHE;
-typedef RECT_FID_CACHE *PRECT_FID_CACHE;
-
-void cacheRECTFids(JNIEnv *env, jobject lpObject, PRECT_FID_CACHE lpCache);
-RECT* getRECTFields(JNIEnv *env, jobject lpObject, RECT *lpStruct, PRECT_FID_CACHE lpCache);
-void setRECTFields(JNIEnv *env, jobject lpObject, RECT *lpStruct, PRECT_FID_CACHE lpCache);
-
-/* SCROLLINFO struct */
-typedef struct SCROLLINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, fMask, nMin, nMax, nPage, nPos, nTrackPos;
-} SCROLLINFO_FID_CACHE;
-typedef SCROLLINFO_FID_CACHE *PSCROLLINFO_FID_CACHE;
-
-void cacheSCROLLINFOFids(JNIEnv *env, jobject lpObject, PSCROLLINFO_FID_CACHE lpCache);
-SCROLLINFO* getSCROLLINFOFields(JNIEnv *env, jobject lpObject, SCROLLINFO *lpStruct, PSCROLLINFO_FID_CACHE lpCache);
-void setSCROLLINFOFields(JNIEnv *env, jobject lpObject, SCROLLINFO *lpStruct, PSCROLLINFO_FID_CACHE lpCache);
-
-/* SHELLEXECUTEINFO struct */
-typedef struct SHELLEXECUTEINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, fMask, hwnd, lpVerb, lpFile, lpParameters, lpDirectory, nShow, hInstApp, lpIDList, lpClass, hkeyClass, dwHotKey, hIcon, hProcess;
-} SHELLEXECUTEINFO_FID_CACHE;
-typedef SHELLEXECUTEINFO_FID_CACHE *PSHELLEXECUTEINFO_FID_CACHE;
-
-void cacheSHELLEXECUTEINFOFids(JNIEnv *env, jobject lpObject, PSHELLEXECUTEINFO_FID_CACHE lpCache);
-SHELLEXECUTEINFO* getSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO *lpStruct, PSHELLEXECUTEINFO_FID_CACHE lpCache);
-void setSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO *lpStruct, PSHELLEXECUTEINFO_FID_CACHE lpCache);
-
-#ifdef _WIN32_WCE
-/* SHMENUBARINFO struct */
-typedef struct SHMENUBARINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, hwndParent, dwFlags, nToolBarId, hInstRes, nBmpId, cBmpImages, hwndMB;
-} SHMENUBARINFO_FID_CACHE;
-typedef SHMENUBARINFO_FID_CACHE *PSHMENUBARINFO_FID_CACHE;
-
-void cacheSHMENUBARINFOFids(JNIEnv *env, jobject lpObject, PSHMENUBARINFO_FID_CACHE lpCache);
-SHMENUBARINFO* getSHMENUBARINFOFields(JNIEnv *env, jobject lpObject, SHMENUBARINFO *lpStruct, PSHMENUBARINFO_FID_CACHE lpCache);
-void setSHMENUBARINFOFields(JNIEnv *env, jobject lpObject, SHMENUBARINFO *lpStruct, PSHMENUBARINFO_FID_CACHE lpCache);
-#endif // _WIN32_WCE
-
-/* SIZE struct */
-typedef struct SIZE_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cx, cy;
-} SIZE_FID_CACHE;
-typedef SIZE_FID_CACHE *PSIZE_FID_CACHE;
-
-void cacheSIZEFids(JNIEnv *env, jobject lpObject, PSIZE_FID_CACHE lpCache);
-SIZE* getSIZEFields(JNIEnv *env, jobject lpObject, SIZE *lpStruct, PSIZE_FID_CACHE lpCache);
-void setSIZEFields(JNIEnv *env, jobject lpObject, SIZE *lpStruct, PSIZE_FID_CACHE lpCache);
-
-/* TBBUTTON struct */
-typedef struct TBBUTTON_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID iBitmap, idCommand, fsState, fsStyle, dwData, iString;
-} TBBUTTON_FID_CACHE;
-typedef TBBUTTON_FID_CACHE *PTBBUTTON_FID_CACHE;
-
-void cacheTBBUTTONFids(JNIEnv *env, jobject lpObject, PTBBUTTON_FID_CACHE lpCache);
-TBBUTTON* getTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct, PTBBUTTON_FID_CACHE lpCache);
-void setTBBUTTONFields(JNIEnv *env, jobject lpObject, TBBUTTON *lpStruct, PTBBUTTON_FID_CACHE lpCache);
-
-/* TBBUTTONINFO struct */
-typedef struct TBBUTTONINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, dwMask, idCommand, iImage, fsState, fsStyle, cx, lParam, pszText, cchText;
-} TBBUTTONINFO_FID_CACHE;
-typedef TBBUTTONINFO_FID_CACHE *PTBBUTTONINFO_FID_CACHE;
-
-void cacheTBBUTTONINFOFids(JNIEnv *env, jobject lpObject, PTBBUTTONINFO_FID_CACHE lpCache);
-TBBUTTONINFO* getTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct, PTBBUTTONINFO_FID_CACHE lpCache);
-void setTBBUTTONINFOFields(JNIEnv *env, jobject lpObject, TBBUTTONINFO *lpStruct, PTBBUTTONINFO_FID_CACHE lpCache);
-
-/* TCITEM struct */
-typedef struct TCITEM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID mask, dwState, dwStateMask, pszText, cchTextMax, iImage, lParam;
-} TCITEM_FID_CACHE;
-typedef TCITEM_FID_CACHE *PTCITEM_FID_CACHE;
-
-void cacheTCITEMFids(JNIEnv *env, jobject lpObject, PTCITEM_FID_CACHE lpCache);
-TCITEM* getTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct, PTCITEM_FID_CACHE lpCache);
-void setTCITEMFields(JNIEnv *env, jobject lpObject, TCITEM *lpStruct, PTCITEM_FID_CACHE lpCache);
-
-/* TEXTMETRIC struct */
-typedef struct TEXTMETRIC_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID tmHeight, tmAscent, tmDescent, tmInternalLeading, tmExternalLeading, tmAveCharWidth, tmMaxCharWidth, tmWeight, tmOverhang, tmDigitizedAspectX, tmDigitizedAspectY, tmItalic, tmUnderlined, tmStruckOut, tmPitchAndFamily, tmCharSet;
-} TEXTMETRIC_FID_CACHE;
-typedef TEXTMETRIC_FID_CACHE *PTEXTMETRIC_FID_CACHE;
-
-void cacheTEXTMETRICFids(JNIEnv *env, jobject lpObject, PTEXTMETRIC_FID_CACHE lpCache);
-#ifndef _WIN32_WCE
-TEXTMETRICA* getTEXTMETRICAFields(JNIEnv *env, jobject lpObject, TEXTMETRICA *lpStruct, PTEXTMETRIC_FID_CACHE lpCache);
-void setTEXTMETRICAFields(JNIEnv *env, jobject lpObject, TEXTMETRICA *lpStruct, PTEXTMETRIC_FID_CACHE lpCache);
-#endif // _WIN32_WCE
-TEXTMETRICW* getTEXTMETRICWFields(JNIEnv *env, jobject lpObject, TEXTMETRICW *lpStruct, PTEXTMETRIC_FID_CACHE lpCache);
-void setTEXTMETRICWFields(JNIEnv *env, jobject lpObject, TEXTMETRICW *lpStruct, PTEXTMETRIC_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* TOOLINFO struct */
-typedef struct TOOLINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, uFlags, hwnd, uId, left, top, right, bottom, hinst, lpszText, lParam;
-} TOOLINFO_FID_CACHE;
-typedef TOOLINFO_FID_CACHE *PTOOLINFO_FID_CACHE;
-
-void cacheTOOLINFOFids(JNIEnv *env, jobject lpObject, PTOOLINFO_FID_CACHE lpCache);
-TOOLINFO* getTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct, PTOOLINFO_FID_CACHE lpCache);
-void setTOOLINFOFields(JNIEnv *env, jobject lpObject, TOOLINFO *lpStruct, PTOOLINFO_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-/* TRACKMOUSEEVENT struct */
-typedef struct TRACKMOUSEEVENT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cbSize, dwFlags, hwndTrack, dwHoverTime;
-} TRACKMOUSEEVENT_FID_CACHE;
-typedef TRACKMOUSEEVENT_FID_CACHE *PTRACKMOUSEEVENT_FID_CACHE;
-
-void cacheTRACKMOUSEEVENTFids(JNIEnv *env, jobject lpObject, PTRACKMOUSEEVENT_FID_CACHE lpCache);
-TRACKMOUSEEVENT* getTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct, PTRACKMOUSEEVENT_FID_CACHE lpCache);
-void setTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct, PTRACKMOUSEEVENT_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-/* TRIVERTEX struct */
-typedef struct TRIVERTEX_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x, y, Red, Green, Blue, Alpha;
-} TRIVERTEX_FID_CACHE;
-typedef TRIVERTEX_FID_CACHE *PTRIVERTEX_FID_CACHE;
-
-void cacheTRIVERTEXFids(JNIEnv *env, jobject lpObject, PTRIVERTEX_FID_CACHE lpCache);
-TRIVERTEX* getTRIVERTEXFields(JNIEnv *env, jobject lpObject, TRIVERTEX *lpStruct, PTRIVERTEX_FID_CACHE lpCache);
-void setTRIVERTEXFields(JNIEnv *env, jobject lpObject, TRIVERTEX *lpStruct, PTRIVERTEX_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* TVHITTESTINFO struct */
-typedef struct TVHITTESTINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x, y, flags, hItem;
-} TVHITTESTINFO_FID_CACHE;
-typedef TVHITTESTINFO_FID_CACHE *PTVHITTESTINFO_FID_CACHE;
-
-void cacheTVHITTESTINFOFids(JNIEnv *env, jobject lpObject, PTVHITTESTINFO_FID_CACHE lpCache);
-TVHITTESTINFO* getTVHITTESTINFOFields(JNIEnv *env, jobject lpObject, TVHITTESTINFO *lpStruct, PTVHITTESTINFO_FID_CACHE lpCache);
-void setTVHITTESTINFOFields(JNIEnv *env, jobject lpObject, TVHITTESTINFO *lpStruct, PTVHITTESTINFO_FID_CACHE lpCache);
-
-/* TVINSERTSTRUCT struct */
-typedef struct TVINSERTSTRUCT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hParent, hInsertAfter, mask, hItem, state, stateMask, pszText, cchTextMax, iImage, iSelectedImage, cChildren, lParam;
-} TVINSERTSTRUCT_FID_CACHE;
-typedef TVINSERTSTRUCT_FID_CACHE *PTVINSERTSTRUCT_FID_CACHE;
-
-void cacheTVINSERTSTRUCTFids(JNIEnv *env, jobject lpObject, PTVINSERTSTRUCT_FID_CACHE lpCache);
-TVINSERTSTRUCT* getTVINSERTSTRUCTFields(JNIEnv *env, jobject lpObject, TVINSERTSTRUCT *lpStruct, PTVINSERTSTRUCT_FID_CACHE lpCache);
-void setTVINSERTSTRUCTFields(JNIEnv *env, jobject lpObject, TVINSERTSTRUCT *lpStruct, PTVINSERTSTRUCT_FID_CACHE lpCache);
-
-/* TVITEM struct */
-typedef struct TVITEM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID mask, hItem, state, stateMask, pszText, cchTextMax, iImage, iSelectedImage, cChildren, lParam;
-} TVITEM_FID_CACHE;
-typedef TVITEM_FID_CACHE *PTVITEM_FID_CACHE;
-
-void cacheTVITEMFids(JNIEnv *env, jobject lpObject, PTVITEM_FID_CACHE lpCache);
-TVITEM* getTVITEMFields(JNIEnv *env, jobject lpObject, TVITEM *lpStruct, PTVITEM_FID_CACHE lpCache);
-void setTVITEMFields(JNIEnv *env, jobject lpObject, TVITEM *lpStruct, PTVITEM_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* WINDOWPLACEMENT struct */
-typedef struct WINDOWPLACEMENT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID length, flags, showCmd, ptMinPosition_x, ptMinPosition_y, ptMaxPosition_x, ptMaxPosition_y, left, top, right, bottom;
-} WINDOWPLACEMENT_FID_CACHE;
-typedef WINDOWPLACEMENT_FID_CACHE *PWINDOWPLACEMENT_FID_CACHE;
-
-void cacheWINDOWPLACEMENTFids(JNIEnv *env, jobject lpObject, PWINDOWPLACEMENT_FID_CACHE lpCache);
-WINDOWPLACEMENT* getWINDOWPLACEMENTFields(JNIEnv *env, jobject lpObject, WINDOWPLACEMENT *lpStruct, PWINDOWPLACEMENT_FID_CACHE lpCache);
-void setWINDOWPLACEMENTFields(JNIEnv *env, jobject lpObject, WINDOWPLACEMENT *lpStruct, PWINDOWPLACEMENT_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* WINDOWPOS struct */
-typedef struct WINDOWPOS_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID hwnd, hwndInsertAfter, x, y, cx, cy, flags;
-} WINDOWPOS_FID_CACHE;
-typedef WINDOWPOS_FID_CACHE *PWINDOWPOS_FID_CACHE;
-
-void cacheWINDOWPOSFids(JNIEnv *env, jobject lpObject, PWINDOWPOS_FID_CACHE lpCache);
-WINDOWPOS* getWINDOWPOSFields(JNIEnv *env, jobject lpObject, WINDOWPOS *lpStruct, PWINDOWPOS_FID_CACHE lpCache);
-void setWINDOWPOSFields(JNIEnv *env, jobject lpObject, WINDOWPOS *lpStruct, PWINDOWPOS_FID_CACHE lpCache);
-
-/* WNDCLASS struct */
-typedef struct WNDCLASS_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID style, lpfnWndProc, cbClsExtra, cbWndExtra, hInstance, hIcon, hCursor, hbrBackground, lpszMenuName, lpszClassName;
-} WNDCLASS_FID_CACHE;
-typedef WNDCLASS_FID_CACHE *PWNDCLASS_FID_CACHE;
-
-void cacheWNDCLASSFids(JNIEnv *env, jobject lpObject, PWNDCLASS_FID_CACHE lpCache);
-WNDCLASS* getWNDCLASSFields(JNIEnv *env, jobject lpObject, WNDCLASS *lpStruct, PWNDCLASS_FID_CACHE lpCache);
-void setWNDCLASSFields(JNIEnv *env, jobject lpObject, WNDCLASS *lpStruct, PWNDCLASS_FID_CACHE lpCache);
-
-/************************ OLE ***************************/
-
-/* used to cast Vtabl entries */
-
-/* P_OLE_FN_x typedef for an OLE function returning int with x params*/
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_9)(jint, jint, jint, jint, jint, jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_8)(jint, jint, jint, jint, jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_7)(jint, jint, jint, jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_6)(jint, jint, jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_5)(jint, jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_4)(jint, jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_3)(jint, jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_2)(jint, jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_1)(jint);
-typedef jint (STDMETHODCALLTYPE *P_OLE_FN_0)(void);
-
-/* CAUUID struct */
-typedef struct CAUUID_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID pElems, cElems;
-} CAUUID_FID_CACHE;
-typedef CAUUID_FID_CACHE *PCAUUID_FID_CACHE;
-
-void cacheCAUUIDFids(JNIEnv *env, jobject lpObject, PCAUUID_FID_CACHE lpCache);
-CAUUID* getCAUUIDFields(JNIEnv *env, jobject lpObject, CAUUID *lpStruct, PCAUUID_FID_CACHE lpCache);
-void setCAUUIDFields(JNIEnv *env, jobject lpObject, CAUUID *lpStruct, PCAUUID_FID_CACHE lpCache);
-
-/* CONTROLINFO struct */
-typedef struct CONTROLINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwFlags, /*filler,*/ cAccel, hAccel, cb;
-} CONTROLINFO_FID_CACHE;
-typedef CONTROLINFO_FID_CACHE *PCONTROLINFO_FID_CACHE;
-
-void cacheCONTROLINFOFids(JNIEnv *env, jobject lpObject, PCONTROLINFO_FID_CACHE lpCache);
-CONTROLINFO* getCONTROLINFOFields(JNIEnv *env, jobject lpObject, CONTROLINFO *lpStruct, PCONTROLINFO_FID_CACHE lpCache);
-void setCONTROLINFOFields(JNIEnv *env, jobject lpObject, CONTROLINFO *lpStruct, PCONTROLINFO_FID_CACHE lpCache);
-
-/* COSERVERINFO struct */
-typedef struct COSERVERINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwReserved2, pAuthInfo, pwszName, dwReserved1;
-} COSERVERINFO_FID_CACHE;
-typedef COSERVERINFO_FID_CACHE *PCOSERVERINFO_FID_CACHE;
-
-void cacheCOSERVERINFOFids(JNIEnv *env, jobject lpObject, PCOSERVERINFO_FID_CACHE lpCache);
-COSERVERINFO* getCOSERVERINFOFields(JNIEnv *env, jobject lpObject, COSERVERINFO *lpStruct, PCOSERVERINFO_FID_CACHE lpCache);
-void setCOSERVERINFOFields(JNIEnv *env, jobject lpObject, COSERVERINFO *lpStruct, PCOSERVERINFO_FID_CACHE lpCache);
-
-/* DISPPARAMS struct */
-typedef struct DISPPARAMS_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cNamedArgs, cArgs, rgdispidNamedArgs, rgvarg;
-} DISPPARAMS_FID_CACHE;
-typedef DISPPARAMS_FID_CACHE *PDISPPARAMS_FID_CACHE;
-
-void cacheDISPPARAMSFids(JNIEnv *env, jobject lpObject, PDISPPARAMS_FID_CACHE lpCache);
-DISPPARAMS* getDISPPARAMSFields(JNIEnv *env, jobject lpObject, DISPPARAMS *lpStruct, PDISPPARAMS_FID_CACHE lpCache);
-void setDISPPARAMSFields(JNIEnv *env, jobject lpObject, DISPPARAMS *lpStruct, PDISPPARAMS_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* DROPFILES struct */
-typedef struct DROPFILES_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID fWide, fNC, pt_y, pt_x, pFiles;
-} DROPFILES_FID_CACHE;
-typedef DROPFILES_FID_CACHE *PDROPFILES_FID_CACHE;
-
-void cacheDROPFILESFids(JNIEnv *env, jobject lpObject, PDROPFILES_FID_CACHE lpCache);
-DROPFILES* getDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct, PDROPFILES_FID_CACHE lpCache);
-void setDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct, PDROPFILES_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* DVTARGETDEVICE struct */
-typedef struct DVTARGETDEVICE_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID tdData, tdExtDevmodeOffset, tdPortNameOffset, tdDeviceNameOffset, tdDriverNameOffset, tdSize;
-} DVTARGETDEVICE_FID_CACHE;
-typedef DVTARGETDEVICE_FID_CACHE *PDVTARGETDEVICE_FID_CACHE;
-
-void cacheDVTARGETDEVICEFids(JNIEnv *env, jobject lpObject, PDVTARGETDEVICE_FID_CACHE lpCache);
-DVTARGETDEVICE* getDVTARGETDEVICEFields(JNIEnv *env, jobject lpObject, DVTARGETDEVICE *lpStruct, PDVTARGETDEVICE_FID_CACHE lpCache);
-void setDVTARGETDEVICEFields(JNIEnv *env, jobject lpObject, DVTARGETDEVICE *lpStruct, PDVTARGETDEVICE_FID_CACHE lpCache);
-
-/* EXCEPINFO struct */
-typedef struct EXCEPINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID scode, pfnDeferredFillIn, pvReserved, dwHelpContext, bstrHelpFile, bstrDescription, bstrSource, wReserved, wCode;
-} EXCEPINFO_FID_CACHE;
-typedef EXCEPINFO_FID_CACHE *PEXCEPINFO_FID_CACHE;
-
-void cacheEXCEPINFOFids(JNIEnv *env, jobject lpObject, PEXCEPINFO_FID_CACHE lpCache);
-EXCEPINFO* getEXCEPINFOFields(JNIEnv *env, jobject lpObject, EXCEPINFO *lpStruct, PEXCEPINFO_FID_CACHE lpCache);
-void setEXCEPINFOFields(JNIEnv *env, jobject lpObject, EXCEPINFO *lpStruct, PEXCEPINFO_FID_CACHE lpCache);
-
-/* FORMATETC struct */
-typedef struct FORMATETC_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID tymed, lindex, dwAspect, ptd, cfFormat;
-} FORMATETC_FID_CACHE;
-typedef FORMATETC_FID_CACHE *PFORMATETC_FID_CACHE;
-
-void cacheFORMATETCFids(JNIEnv *env, jobject lpObject, PFORMATETC_FID_CACHE lpCache);
-FORMATETC* getFORMATETCFields(JNIEnv *env, jobject lpObject, FORMATETC *lpStruct, PFORMATETC_FID_CACHE lpCache);
-void setFORMATETCFields(JNIEnv *env, jobject lpObject, FORMATETC *lpStruct, PFORMATETC_FID_CACHE lpCache);
-
-/* FUNCDESC1 struct */
-typedef struct FUNCDESC1_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID wFuncFlags, elemdescFunc_paramdesc_wParamFlags, elemdescFunc_paramdesc_pparamdescex, elemdescFunc_tdesc_filler, elemdescFunc_tdesc_vt, elemdescFunc_tdesc_union, cScodes, oVft, cParamsOpt, cParams, callconv, invkind, funckind, lprgelemdescParam, lprgscode, memid;
-} FUNCDESC1_FID_CACHE;
-typedef FUNCDESC1_FID_CACHE *PFUNCDESC1_FID_CACHE;
-
-void cacheFUNCDESC1Fids(JNIEnv *env, jobject lpObject, PFUNCDESC1_FID_CACHE lpCache);
-FUNCDESC* getFUNCDESC1Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC1_FID_CACHE lpCache);
-void setFUNCDESC1Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC1_FID_CACHE lpCache);
-
-/* FUNCDESC2 struct */
-typedef struct FUNCDESC2_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID wFuncFlags, elemdescFunc_idldesc_filler, elemdescFunc_idldesc_wIDLFlags, elemdescFunc_idldesc_dwReserved, elemdescFunc_tdesc_filler, elemdescFunc_tdesc_vt, elemdescFunc_tdesc_union, cScodes, oVft, cParamsOpt, cParams, callconv, invkind, funckind, lprgelemdescParam, lprgscode, memid;
-} FUNCDESC2_FID_CACHE;
-typedef FUNCDESC2_FID_CACHE *PFUNCDESC2_FID_CACHE;
-
-void cacheFUNCDESC2Fids(JNIEnv *env, jobject lpObject, PFUNCDESC2_FID_CACHE lpCache);
-FUNCDESC* getFUNCDESC2Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC2_FID_CACHE lpCache);
-void setFUNCDESC2Fields(JNIEnv *env, jobject lpObject, FUNCDESC *lpStruct, PFUNCDESC2_FID_CACHE lpCache);
-
-/* GUID struct */
-typedef struct GUID_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID b7, b6, b5, b4, b3, b2, b1, b0, data3, data2, data1;
-} GUID_FID_CACHE;
-typedef GUID_FID_CACHE *PGUID_FID_CACHE;
-
-void cacheGUIDFids(JNIEnv *env, jobject lpObject, PGUID_FID_CACHE lpCache);
-GUID* getGUIDFields(JNIEnv *env, jobject lpObject, GUID *lpStruct, PGUID_FID_CACHE lpCache);
-void setGUIDFields(JNIEnv *env, jobject lpObject, GUID *lpStruct, PGUID_FID_CACHE lpCache);
-
-/* LICINFO struct */
-typedef struct LICINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID fLicVerified, fRuntimeKeyAvail, cbLicInfo;
-} LICINFO_FID_CACHE;
-typedef LICINFO_FID_CACHE *PLICINFO_FID_CACHE;
-
-void cacheLICINFOFids(JNIEnv *env, jobject lpObject, PLICINFO_FID_CACHE lpCache);
-LICINFO* getLICINFOFields(JNIEnv *env, jobject lpObject, LICINFO *lpStruct, PLICINFO_FID_CACHE lpCache);
-void setLICINFOFields(JNIEnv *env, jobject lpObject, LICINFO *lpStruct, PLICINFO_FID_CACHE lpCache);
-
-#ifndef _WIN32_WCE
-
-/* OLECMD struct */
-typedef struct OLECMD_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cmdf, cmdID;
-} OLECMD_FID_CACHE;
-typedef OLECMD_FID_CACHE *POLECMD_FID_CACHE;
-
-void cacheOLECMDFids(JNIEnv *env, jobject lpObject, POLECMD_FID_CACHE lpCache);
-OLECMD* getOLECMDFields(JNIEnv *env, jobject lpObject, OLECMD *lpStruct, POLECMD_FID_CACHE lpCache);
-void setOLECMDFields(JNIEnv *env, jobject lpObject, OLECMD *lpStruct, POLECMD_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-
-/* OLECMDTEXT struct */
-typedef struct OLECMDTEXT_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID rgwz, cwBuf, cwActual, cmdtextf;
-} OLECMDTEXT_FID_CACHE;
-typedef OLECMDTEXT_FID_CACHE *POLECMDTEXT_FID_CACHE;
-
-void cacheOLECMDTEXTFids(JNIEnv *env, jobject lpObject, POLECMDTEXT_FID_CACHE lpCache);
-OLECMDTEXT* getOLECMDTEXTFields(JNIEnv *env, jobject lpObject, OLECMDTEXT *lpStruct, POLECMDTEXT_FID_CACHE lpCache);
-void setOLECMDTEXTFields(JNIEnv *env, jobject lpObject, OLECMDTEXT *lpStruct, POLECMDTEXT_FID_CACHE lpCache);
-
-#endif // _WIN32_WCE
-
-/* OLEINPLACEFRAMEINFO struct */
-typedef struct OLEINPLACEFRAMEINFO_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID cAccelEntries, haccel, hwndFrame, fMDIApp, cb;
-} OLEINPLACEFRAMEINFO_FID_CACHE;
-typedef OLEINPLACEFRAMEINFO_FID_CACHE *POLEINPLACEFRAMEINFO_FID_CACHE;
-
-void cacheOLEINPLACEFRAMEINFOFids(JNIEnv *env, jobject lpObject, POLEINPLACEFRAMEINFO_FID_CACHE lpCache);
-OLEINPLACEFRAMEINFO* getOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAMEINFO *lpStruct, POLEINPLACEFRAMEINFO_FID_CACHE lpCache);
-void setOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAMEINFO *lpStruct, POLEINPLACEFRAMEINFO_FID_CACHE lpCache);
-
-/* STATSTG struct */
-typedef struct STATSTG_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID reserved, grfStateBits, clsid_b7, clsid_b6, clsid_b5, clsid_b4, clsid_b3, clsid_b2, clsid_b1, clsid_b0, clsid_data3, clsid_data2, clsid_data1, grfLocksSupported, grfMode, atime_dwHighDateTime, atime_dwLowDateTime, ctime_dwHighDateTime, ctime_dwLowDateTime, mtime_dwHighDateTime, mtime_dwLowDateTime, cbSize, type, pwcsName;
-} STATSTG_FID_CACHE;
-typedef STATSTG_FID_CACHE *PSTATSTG_FID_CACHE;
-
-void cacheSTATSTGFids(JNIEnv *env, jobject lpObject, PSTATSTG_FID_CACHE lpCache);
-STATSTG* getSTATSTGFields(JNIEnv *env, jobject lpObject, STATSTG *lpStruct, PSTATSTG_FID_CACHE lpCache);
-void setSTATSTGFields(JNIEnv *env, jobject lpObject, STATSTG *lpStruct, PSTATSTG_FID_CACHE lpCache);
-
-/* STGMEDIUM struct */
-typedef struct STGMEDIUM_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID pUnkForRelease, unionField, tymed;
-} STGMEDIUM_FID_CACHE;
-typedef STGMEDIUM_FID_CACHE *PSTGMEDIUM_FID_CACHE;
-
-void cacheSTGMEDIUMFids(JNIEnv *env, jobject lpObject, PSTGMEDIUM_FID_CACHE lpCache);
-STGMEDIUM* getSTGMEDIUMFields(JNIEnv *env, jobject lpObject, STGMEDIUM *lpStruct, PSTGMEDIUM_FID_CACHE lpCache);
-void setSTGMEDIUMFields(JNIEnv *env, jobject lpObject, STGMEDIUM *lpStruct, PSTGMEDIUM_FID_CACHE lpCache);
-
-/* TYPEATTR struct */
-typedef struct TYPEATTR_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID idldescType_wIDLFlags, idldescType_dwReserved, filler, tdescAlias_vt, tdescAlias_unionField, wMinorVerNum, wMajorVerNum, wTypeFlags, cbAlignment, cbSizeVft, cImplTypes, cVars, cFuncs, typekind, cbSizeInstance, lpstrSchema, memidDestructor, memidConstructor, dwReserved, lcid, guid_b7, guid_b6, guid_b5, guid_b4, guid_b3, guid_b2, guid_b1, guid_b0, guid_data3, guid_data2, guid_data1;
-} TYPEATTR_FID_CACHE;
-typedef TYPEATTR_FID_CACHE *PTYPEATTR_FID_CACHE;
-
-void cacheTYPEATTRFids(JNIEnv *env, jobject lpObject, PTYPEATTR_FID_CACHE lpCache);
-TYPEATTR* getTYPEATTRFields(JNIEnv *env, jobject lpObject, TYPEATTR *lpStruct, PTYPEATTR_FID_CACHE lpCache);
-void setTYPEATTRFields(JNIEnv *env, jobject lpObject, TYPEATTR *lpStruct, PTYPEATTR_FID_CACHE lpCache);
-
-/* VARDESC1 struct */
-typedef struct VARDESC1_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID varkind, filler, wVarFlags, elemdescVar_paramdesc_filler, elemdescVar_paramdesc_wParamFlags, elemdescVar_paramdesc_pparamdescex, elemdescVar_tdesc_filler, elemdescVar_tdesc_vt, elemdescVar_tdesc_union, unionField, lpstrSchema, memid;
-} VARDESC1_FID_CACHE;
-typedef VARDESC1_FID_CACHE *PVARDESC1_FID_CACHE;
-
-void cacheVARDESC1Fids(JNIEnv *env, jobject lpObject, PVARDESC1_FID_CACHE lpCache);
-VARDESC* getVARDESC1Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC1_FID_CACHE lpCache);
-void setVARDESC1Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC1_FID_CACHE lpCache);
-
-/* VARDESC2 struct */
-typedef struct VARDESC2_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID varkind, filler, wVarFlags, elemdescFunc_idldesc_filler, elemdescFunc_idldesc_wIDLFlags, elemdescFunc_idldesc_dwReserved, elemdescVar_tdesc_filler, elemdescVar_tdesc_vt, elemdescVar_tdesc_union, unionField, lpstrSchema, memid;
-} VARDESC2_FID_CACHE;
-typedef VARDESC2_FID_CACHE *PVARDESC2_FID_CACHE;
-
-void cacheVARDESC2Fids(JNIEnv *env, jobject lpObject, PVARDESC2_FID_CACHE lpCache);
-VARDESC* getVARDESC2Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC2_FID_CACHE lpCache);
-void setVARDESC2Fields(JNIEnv *env, jobject lpObject, VARDESC *lpStruct, PVARDESC2_FID_CACHE lpCache);
-
-/**************************** END OLE ****************************/
-
-/* Win32 globals */
-extern ACCEL_FID_CACHE ACCELFc;
-extern BITMAP_FID_CACHE BITMAPFc;
-extern CHOOSECOLOR_FID_CACHE CHOOSECOLORFc;
-extern COMPOSITIONFORM_FID_CACHE COMPOSITIONFORMFc;
-extern CREATESTRUCT_FID_CACHE CREATESTRUCTFc;
-extern DIBSECTION_FID_CACHE DIBSECTIONFc;
-extern DLLVERSIONINFO_FID_CACHE DLLVERSIONINFOFc;
-extern DRAWITEMSTRUCT_FID_CACHE DRAWITEMSTRUCTFc;
-extern FILETIME_FID_CACHE FILETIMEFc;
-extern HDITEM_FID_CACHE HDITEMFc;
-extern ICONINFO_FID_CACHE ICONINFOFc;
-extern INITCOMMONCONTROLSEX_FID_CACHE INITCOMMONCONTROLSEXFc;
-extern LOGBRUSH_FID_CACHE LOGBRUSHFc;
-extern LOGFONT_FID_CACHE LOGFONTFc;
-extern LOGPEN_FID_CACHE LOGPENFc;
-extern LVCOLUMN_FID_CACHE LVCOLUMNFc;
-extern LVHITTESTINFO_FID_CACHE LVHITTESTINFOFc;
-extern LVITEM_FID_CACHE LVITEMFc;
-extern MEASUREITEMSTRUCT_FID_CACHE MEASUREITEMSTRUCTFc;
-extern MENUITEMINFO_FID_CACHE MENUITEMINFOFc;
-extern MSG_FID_CACHE MSGFc;
-extern NMHDR_FID_CACHE NMHDRFc;
-extern NMHEADER_FID_CACHE NMHEADERFc;
-extern NMLISTVIEW_FID_CACHE NMLISTVIEWFc;
-extern NMTOOLBAR_FID_CACHE NMTOOLBARFc;
-extern OPENFILENAME_FID_CACHE OPENFILENAMEFc;
-extern OSVERSIONINFO_FID_CACHE OSVERSIONINFOFc;
-extern PAINTSTRUCT_FID_CACHE PAINTSTRUCTFc;
-extern POINT_FID_CACHE POINTFc;
-extern REBARBANDINFO_FID_CACHE REBARBANDINFOFc;
-extern RECT_FID_CACHE RECTFc;
-extern SCROLLINFO_FID_CACHE SCROLLINFOFc;
-extern SHELLEXECUTEINFO_FID_CACHE SHELLEXECUTEINFOFc;
-extern SIZE_FID_CACHE SIZEFc;
-extern TBBUTTON_FID_CACHE TBBUTTONFc;
-extern TBBUTTONINFO_FID_CACHE TBBUTTONINFOFc;
-extern TCITEM_FID_CACHE TCITEMFc;
-extern TEXTMETRIC_FID_CACHE TEXTMETRICFc;
-extern TVHITTESTINFO_FID_CACHE TVHITTESTINFOFc;
-extern TVINSERTSTRUCT_FID_CACHE TVINSERTSTRUCTFc;
-extern TVITEM_FID_CACHE TVITEMFc;
-extern WINDOWPOS_FID_CACHE WINDOWPOSFc;
-extern WNDCLASS_FID_CACHE WNDCLASSFc;
-#ifndef _WIN32_WCE
-extern BROWSEINFO_FID_CACHE BROWSEINFOFc;
-extern CHOOSEFONT_FID_CACHE CHOOSEFONTFc;
-extern DOCINFO_FID_CACHE DOCINFOFc;
-extern GCP_RESULTS_FID_CACHE GCP_RESULTSFc;
-extern GRADIENT_RECT_FID_CACHE GRADIENT_RECTFc;
-extern HELPINFO_FID_CACHE HELPINFOFc;
-extern MENUINFO_FID_CACHE MENUINFOFc;
-extern NMTTDISPINFO_FID_CACHE NMTTDISPINFOFc;
-extern NONCLIENTMETRICS_FID_CACHE NONCLIENTMETRICSFc;
-extern PRINTDLG_FID_CACHE PRINTDLGFc;
-extern TOOLINFO_FID_CACHE TOOLINFOFc;
-extern TRACKMOUSEEVENT_FID_CACHE TRACKMOUSEEVENTFc;
-extern TRIVERTEX_FID_CACHE TRIVERTEXFc;
-extern WINDOWPLACEMENT_FID_CACHE WINDOWPLACEMENTFc;
-extern DROPFILES_FID_CACHE DROPFILESFc;
-extern OLECMD_FID_CACHE OLECMDFc;
-extern OLECMDTEXT_FID_CACHE OLECMDTEXTFc;
-#endif
-
-/* OLE globals */
-extern CAUUID_FID_CACHE CAUUIDFc;
-extern CONTROLINFO_FID_CACHE CONTROLINFOFc;
-extern COSERVERINFO_FID_CACHE COSERVERINFOFc;
-extern DISPPARAMS_FID_CACHE DISPPARAMSFc;
-extern DVTARGETDEVICE_FID_CACHE DVTARGETDEVICEFc;
-extern EXCEPINFO_FID_CACHE EXCEPINFOFc;
-extern FORMATETC_FID_CACHE FORMATETCFc;
-extern FUNCDESC1_FID_CACHE FUNCDESC1Fc;
-extern FUNCDESC2_FID_CACHE FUNCDESC2Fc;
-extern GUID_FID_CACHE GUIDFc;
-extern LICINFO_FID_CACHE LICINFOFc;
-extern OLEINPLACEFRAMEINFO_FID_CACHE OLEINPLACEFRAMEINFOFc;
-extern STATSTG_FID_CACHE STATSTGFc;
-extern STGMEDIUM_FID_CACHE STGMEDIUMFc;
-extern TYPEATTR_FID_CACHE TYPEATTRFc;
-extern VARDESC1_FID_CACHE VARDESC1Fc;
-extern VARDESC2_FID_CACHE VARDESC2Fc;
-
-#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c
deleted file mode 100644
index 22f0e17224..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c
+++ /dev/null
@@ -1,6826 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT OS natives implementation.
- */
-
-#include "swt.h"
-#include "structs.h"
-
-/* Export the dll version info call */
-
-__declspec(dllexport) HRESULT DllGetVersion(DLLVERSIONINFO *dvi);
-
-HRESULT DllGetVersion(DLLVERSIONINFO *dvi)
-{
- dvi->dwMajorVersion = SWT_VERSION / 1000;
- dvi->dwMinorVersion = SWT_VERSION % 1000;
- dvi->dwBuildNumber = SWT_BUILD_NUM;
- dvi->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
- return 1;
-}
-
-/* Cache the handle to the library */
-HINSTANCE g_hInstance = NULL;
-
-BOOL WINAPI DllMain(HANDLE hInstDLL, DWORD dwReason, LPVOID lpvReserved)
-{
- if (dwReason == DLL_PROCESS_ATTACH) {
- if (g_hInstance == NULL) g_hInstance = hInstDLL;
- }
- return TRUE;
-}
-
-/* Natives */
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_AbortDoc
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("AbortDoc\n")
-
- return (jint)AbortDoc((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ActivateKeyboardLayout
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ActivateKeyboardLayout\n")
-
- return (jint)ActivateKeyboardLayout((HKL)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_AdjustWindowRectEx
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jboolean arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("AdjustWindowRectEx\n")
-
- if (arg0) lparg0 = getRECTFields(env, arg0, &_arg0, &PGLOB(RECTFc));
-
- rc = (jboolean)AdjustWindowRectEx(lparg0, arg1, arg2, arg3);
-
- if (arg0) setRECTFields(env, arg0, lparg0, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Arc
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8)
-{
- DEBUG_CALL("Arc\n")
-
- return (jboolean)Arc((HDC)arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_BeginDeferWindowPos
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("BeginDeferWindowPos\n")
-
- return (jint)BeginDeferWindowPos(arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_BeginPaint
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- PAINTSTRUCT _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("BeginPaint\n")
-
- if (arg1) lparg1 = &_arg1;
-
- rc = (jint)BeginPaint((HWND)arg0, lparg1);
-
- if (arg1) setPAINTSTRUCTFields(env, arg1, lparg1, &PGLOB(PAINTSTRUCTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_BitBlt
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8)
-{
- DEBUG_CALL("BitBlt\n")
-
- return (jboolean)BitBlt((HDC)arg0, arg1, arg2, arg3, arg4, (HDC)arg5, arg6, arg7, arg8);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_BringWindowToTop
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("BringWindowToTop\n")
-
- return (jboolean)BringWindowToTop((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_Call
- (JNIEnv *env, jclass that, jint address, jobject arg0)
-{
- DECL_GLOB(pGlob)
- DLLVERSIONINFO _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("Call\n")
-
- if (arg0) lparg0 = getDLLVERSIONINFOFields(env, arg0, &_arg0, &PGLOB(DLLVERSIONINFOFc));
-
- rc = (jint)((DLLGETVERSIONPROC)address)(lparg0);
-
- if (arg0) setDLLVERSIONINFOFields(env, arg0, lparg0, &PGLOB(DLLVERSIONINFOFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CallNextHookEx
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("CallNextHookEx\n")
-
- return (jint)CallNextHookEx((HHOOK)arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CallWindowProcA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("CallWindowProcA\n")
-
- return (jint)CallWindowProcA((WNDPROC)arg0, (HWND)arg1, arg2, arg3, arg4);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CallWindowProcW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("CallWindowProcW\n")
-
- return (jint)CallWindowProcW((WNDPROC)arg0, (HWND)arg1, arg2, arg3, arg4);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_CharLowerA
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("CharLowerA\n")
-
- return (jshort)CharLowerA((LPSTR)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_CharLowerW
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("CharLowerW\n")
-
- return (jshort)CharLowerW((LPWSTR)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_CharUpperA
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("CharUpperA\n")
-
- return (jshort)CharUpperA((LPSTR)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_CharUpperW
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("CharUpperW\n")
-
- return (jshort)CharUpperW((LPWSTR)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_CheckMenuItem
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("CheckMenuItem\n")
-
- return (jboolean)CheckMenuItem((HMENU)arg0, (UINT)arg1, (UINT)arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ChooseColorA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- CHOOSECOLOR _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ChooseColorA\n")
-
- if (arg0) lparg0 = getCHOOSECOLORFields(env, arg0, &_arg0, &PGLOB(CHOOSECOLORFc));
-
- rc = (jboolean)ChooseColorA(lparg0);
-
- if (arg0) setCHOOSECOLORFields(env, arg0, lparg0, &PGLOB(CHOOSECOLORFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifdef _WIN32_WCE
-#define ChooseColorW ChooseColor
-#define CHOOSECOLORW CHOOSECOLOR
-#define LPCHOOSECOLORW LPCHOOSECOLOR
-#endif
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ChooseColorW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- CHOOSECOLOR _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ChooseColorW\n")
-
- if (arg0) lparg0 = getCHOOSECOLORFields(env, arg0, &_arg0, &PGLOB(CHOOSECOLORFc));
-
- rc = (jboolean)ChooseColorW((LPCHOOSECOLORW)lparg0);
-
- if (arg0) setCHOOSECOLORFields(env, arg0, lparg0, &PGLOB(CHOOSECOLORFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ChooseFontA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- CHOOSEFONT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ChooseFontA\n")
-
- if (arg0) lparg0 = getCHOOSEFONTFields(env, arg0, &_arg0, &PGLOB(CHOOSEFONTFc));
-
- rc = (jboolean)ChooseFontA(lparg0);
-
- if (arg0) setCHOOSEFONTFields(env, arg0, lparg0, &PGLOB(CHOOSEFONTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ChooseFontW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- CHOOSEFONT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ChooseFontW\n")
-
- if (arg0) lparg0 = getCHOOSEFONTFields(env, arg0, &_arg0, &PGLOB(CHOOSEFONTFc));
-
- rc = (jboolean)ChooseFontW((LPCHOOSEFONTW)lparg0);
-
- if (arg0) setCHOOSEFONTFields(env, arg0, lparg0, &PGLOB(CHOOSEFONTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ClientToScreen
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- POINT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ClientToScreen\n")
-
- if (arg1) lparg1 = getPOINTFields(env, arg1, &_arg1, &PGLOB(POINTFc));
-
- rc = (jboolean)ClientToScreen((HWND)arg0, lparg1);
-
- if (arg1) setPOINTFields(env, arg1, lparg1, &PGLOB(POINTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_CloseClipboard
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("CloseClipboard\n")
-
- return (jboolean)CloseClipboard();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CombineRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("CombineRgn\n")
-
- return (jint)CombineRgn((HRGN)arg0, (HRGN)arg1, (HRGN)arg2, arg3);
-}
-
-#ifdef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_CommandBar_1Destroy
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CommandBar_Destroy\n")
-
- return (jboolean)CommandBar_Destroy((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CommDlgExtendedError
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("CommDlgExtendedError\n")
-
- return (jint)CommDlgExtendedError();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CopyImage
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("CopyImage\n")
-
- return (jint)CopyImage((HANDLE)arg0, arg1, arg2, arg3, arg4);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateAcceleratorTableA
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreateAcceleratorTableA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)CreateAcceleratorTableA((LPACCEL)lparg0, arg1);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateAcceleratorTableW
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreateAcceleratorTableW\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)CreateAcceleratorTableW((LPACCEL)lparg0, arg1);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateBitmap
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4)
-{
- jbyte *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("CreateBitmap\n")
-
- if (arg4) lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL);
-
- rc = (jint)CreateBitmap(arg0, arg1, arg2, arg3, (CONST VOID *)lparg4);
-
- if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateCaret
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("CreateCaret\n")
-
- return (jboolean)CreateCaret((HWND)arg0, (HBITMAP)arg1, arg2, arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateCompatibleBitmap
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("CreateCompatibleBitmap\n")
-
- return (jint)CreateCompatibleBitmap((HDC)arg0, arg1, arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateCompatibleDC
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CreateCompatibleDC\n")
-
- return (jint)CreateCompatibleDC((HDC)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateCursor
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6)
-{
- jbyte *lparg5=NULL;
- jbyte *lparg6=NULL;
- jint rc;
-
- DEBUG_CALL("CreateCursor\n")
-
- if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL);
- if (arg6) lparg6 = (*env)->GetByteArrayElements(env, arg6, NULL);
-
- rc = (jint)CreateCursor((HINSTANCE)arg0, arg1, arg2, arg3, arg4, (CONST VOID *)lparg5, (CONST VOID *)lparg6);
-
- if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
- if (arg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateDCA
- (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2, jint arg3)
-{
- jbyte *lparg0=NULL;
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("CreateDCA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)CreateDCA((LPSTR)lparg0, (LPSTR)lparg1, (LPSTR)arg2, (CONST DEVMODE *)arg3);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateDCW
- (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1, jint arg2, jint arg3)
-{
- jchar *lparg0=NULL;
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("CreateDCW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)CreateDCW((LPWSTR)lparg0, (LPWSTR)lparg1, (LPWSTR)arg2, (CONST DEVMODEW *)arg3);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateDIBSection
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jintArray arg3, jint arg4, jint arg5)
-{
- jbyte *lparg1=NULL;
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("CreateDIBSection\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)CreateDIBSection((HDC)arg0, (BITMAPINFO *)lparg1, arg2, (VOID **)lparg3, (HANDLE)arg4, arg5);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectA__Lorg_eclipse_swt_internal_win32_LOGFONT_2
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreateFontIndirectA\n")
-
- if (arg0) lparg0 = getLOGFONTAFields(env, arg0, &_arg0, &PGLOB(LOGFONTFc));
-
- rc = (jint)CreateFontIndirectA(lparg0);
-
- if (arg0) setLOGFONTAFields(env, arg0, lparg0, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectA__I
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CreateFontIndirectA\n")
-
- return (jint)CreateFontIndirectA((LPLOGFONTA)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONT_2
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreateFontIndirectW\n")
-
- if (arg0) lparg0 = getLOGFONTWFields(env, arg0, &_arg0, &PGLOB(LOGFONTFc));
-
- rc = (jint)CreateFontIndirectW(lparg0);
-
- if (arg0) setLOGFONTWFields(env, arg0, lparg0, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__I
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CreateFontIndirectW\n")
-
- return (jint)CreateFontIndirectW((LPLOGFONTW)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateIconIndirect
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- ICONINFO _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreateIconIndirect\n")
-
- if (arg0) lparg0 = getICONINFOFields(env, arg0, &_arg0, &PGLOB(ICONINFOFc));
-
- rc = (jint)CreateIconIndirect(lparg0);
-
- if (arg0) setICONINFOFields(env, arg0, lparg0, &PGLOB(ICONINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateMenu
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("CreateMenu\n")
-
- return (jint)CreateMenu();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreatePalette
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("CreatePalette\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)CreatePalette((LOGPALETTE *)lparg0);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreatePatternBrush
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CreatePatternBrush\n")
-
- return (jint)CreatePatternBrush((HBITMAP)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreatePen
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("CreatePen\n")
-
- return (jint)CreatePen(arg0, arg1, (COLORREF)arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreatePopupMenu
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("CreatePopupMenu\n")
-
- return (jint)CreatePopupMenu();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateRectRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("CreateRectRgn\n")
-
- return (jint)CreateRectRgn(arg0, arg1, arg2, arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateSolidBrush
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("CreateSolidBrush\n")
-
- return (jint)CreateSolidBrush((COLORREF)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateWindowExA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jbyteArray arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jobject arg11)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg1=NULL;
- jbyte *lparg2=NULL;
- CREATESTRUCT _arg11, *lparg11=NULL;
- jint rc;
-
- DEBUG_CALL("CreateWindowExA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg11) lparg11 = getCREATESTRUCTFields(env, arg11, &_arg11, &PGLOB(CREATESTRUCTFc));
-
- rc = (jint)CreateWindowExA(arg0, (LPSTR)lparg1, (LPSTR)lparg2, arg3, arg4, arg5, arg6, arg7, (HWND)arg8, (HMENU)arg9, (HINSTANCE)arg10, lparg11);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg11) setCREATESTRUCTFields(env, arg11, lparg11, &PGLOB(CREATESTRUCTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateWindowExW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jcharArray arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jobject arg11)
-{
- DECL_GLOB(pGlob)
- jchar *lparg1=NULL;
- jchar *lparg2=NULL;
- CREATESTRUCT _arg11, *lparg11=NULL;
- jint rc;
-
- DEBUG_CALL("CreateWindowExW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
- if (arg11) lparg11 = getCREATESTRUCTFields(env, arg11, &_arg11, &PGLOB(CREATESTRUCTFc));
-
- rc = (jint)CreateWindowExW(arg0, (LPWSTR)lparg1, (LPWSTR)lparg2, arg3, arg4, arg5, arg6, arg7, (HWND)arg8, (HMENU)arg9, (HINSTANCE)arg10, lparg11);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
- if (arg11) setCREATESTRUCTFields(env, arg11, lparg11, &PGLOB(CREATESTRUCTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DefWindowProcA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("DefWindowProcA\n")
-
- return (jint)DefWindowProcA((HWND)arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DefWindowProcW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("DefWindowProcW\n")
-
- return (jint)DefWindowProcW((HWND)arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DeferWindowPos
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7)
-{
- DEBUG_CALL("DeferWindowPos\n")
-
- return (jint)DeferWindowPos((HDWP)arg0, (HWND)arg1, (HWND)arg2, arg3, arg4, arg5, arg6, arg7);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DeleteDC
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DeleteDC\n")
-
- return (jboolean)DeleteDC((HDC)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DeleteMenu
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("DeleteMenu\n")
-
- return (jboolean)DeleteMenu((HMENU)arg0, arg1, arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DeleteObject
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DeleteObject\n")
-
- return (jboolean)DeleteObject((HGDIOBJ)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyAcceleratorTable
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DestroyAcceleratorTable\n")
-
- return (jboolean)DestroyAcceleratorTable((HACCEL)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyCaret
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("DestroyCaret\n")
-
- return (jboolean)DestroyCaret();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyCursor
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DestroyCursor\n")
-
- return (jboolean)DestroyCursor((HCURSOR)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyIcon
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DestroyIcon\n")
-
- return (jboolean)DestroyIcon((HICON)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyMenu
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DestroyMenu\n")
-
- return (jboolean)DestroyMenu((HMENU)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DestroyWindow
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DestroyWindow\n")
-
- return (jboolean)DestroyWindow((HWND)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DispatchMessageA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
-
- DEBUG_CALL("DispatchMessageA\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- return (jint)DispatchMessageA(lparg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DispatchMessageW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
-
- DEBUG_CALL("DispatchMessageW\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- return (jint)DispatchMessageW(lparg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DragDetect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- POINT _arg1, *lparg1=NULL;
-
- DEBUG_CALL("DragDetect\n")
-
- if (arg1) lparg1 = getPOINTFields(env, arg1, &_arg1, &PGLOB(POINTFc));
-
- return (jboolean)DragDetect((HWND)arg0, *lparg1);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_DragFinish
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DragFinish\n")
-
- DragFinish((HDROP)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DragQueryFileA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3)
-{
- jbyte *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("DragQueryFileA\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
-
- rc = (jint)DragQueryFileA((HDROP)arg0, arg1, (LPTSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DragQueryFileW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jcharArray arg2, jint arg3)
-{
- jchar *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("DragQueryFileW\n")
-
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
-
- rc = (jint)DragQueryFileW((HDROP)arg0, arg1, (LPWSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawEdge
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("DrawEdge\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)DrawEdge((HDC)arg0, lparg1, arg2, arg3);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawFocusRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("DrawFocusRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)DrawFocusRect((HDC)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawFrameControl
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("DrawFrameControl\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)DrawFrameControl((HDC)arg0, lparg1, arg2, arg3);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawIconEx
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8)
-{
- DEBUG_CALL("DrawIconEx\n")
-
- return (jboolean)DrawIconEx((HDC)arg0, arg1, arg2, (HICON)arg3, arg4, arg5, arg6, (HBRUSH)arg7, arg8);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawMenuBar
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("DrawMenuBar\n")
-
- return (jboolean)DrawMenuBar((HWND)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawStateA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9)
-{
- DEBUG_CALL("DrawStateA\n")
-
- return (jboolean)DrawStateA((HDC)arg0, (HBRUSH)arg1, (DRAWSTATEPROC)arg2, (LPARAM)arg3, (WPARAM)arg4, arg5, arg6, arg7, arg8, arg9);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawStateW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9)
-{
- DEBUG_CALL("DrawStateW\n")
-
- return (jboolean)DrawStateW((HDC)arg0, (HBRUSH)arg1, (DRAWSTATEPROC)arg2, (LPARAM)arg3, (WPARAM)arg4, arg5, arg6, arg7, arg8, arg9);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawTextA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jobject arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg1=NULL;
- RECT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("DrawTextA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = getRECTFields(env, arg3, &_arg3, &PGLOB(RECTFc));
-
- rc = (jint)DrawTextA((HDC)arg0, (LPSTR)lparg1, arg2, lparg3, arg4);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg3) setRECTFields(env, arg3, lparg3, &PGLOB(RECTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_DrawTextW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jobject arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- jchar *lparg1=NULL;
- RECT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("DrawTextW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = getRECTFields(env, arg3, &_arg3, &PGLOB(RECTFc));
-
- rc = (jint)DrawTextW((HDC)arg0, (LPWSTR)lparg1, arg2, lparg3, arg4);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg3) setRECTFields(env, arg3, lparg3, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Ellipse
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("Ellipse\n")
-
- return (jboolean)Ellipse((HDC)arg0, arg1, arg2, arg3, arg4);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EnableMenuItem
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("EnableMenuItem\n")
-
- return (jboolean)EnableMenuItem((HMENU)arg0, arg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EnableScrollBar
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("EnableScrollBar\n")
-
- return (jboolean)EnableScrollBar((HWND)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EnableWindow
- (JNIEnv *env, jclass that, jint arg0, jboolean arg1)
-{
- DEBUG_CALL("EnableWindow\n")
-
- return (jboolean)EnableWindow((HWND)arg0, arg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EndDeferWindowPos
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("EndDeferWindowPos\n")
-
- return (jboolean)EndDeferWindowPos((HDWP)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_EndDoc
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("EndDoc\n")
-
- return (jint)EndDoc((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_EndPage
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("EndPage\n")
-
- return (jint)EndPage((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_EndPaint
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- PAINTSTRUCT _arg1, *lparg1=NULL;
-
- DEBUG_CALL("EndPaint\n")
-
- if (arg1) lparg1 = getPAINTSTRUCTFields(env, arg1, &_arg1, &PGLOB(PAINTSTRUCTFc));
-
- return (jint)EndPaint((HWND)arg0, lparg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_EnumFontFamiliesA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3)
-{
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("EnumFontFamiliesA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)EnumFontFamiliesA((HDC)arg0, (LPSTR)lparg1, (FONTENUMPROC)arg2, (LPARAM)arg3);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifdef _WIN32_WCE
-#define FONTENUMPROCW FONTENUMPROC
-#endif // _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_EnumFontFamiliesW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3)
-{
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("EnumFontFamiliesW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)EnumFontFamiliesW((HDC)arg0, (LPCWSTR)lparg1, (FONTENUMPROCW)arg2, (LPARAM)arg3);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EnumSystemLocalesA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("EnumSystemLocalesA\n")
-
- return (jboolean)EnumSystemLocalesA((LOCALE_ENUMPROCA)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EnumSystemLocalesW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("EnumSystemLocalesW\n")
-
- return (jboolean)EnumSystemLocalesW((LOCALE_ENUMPROCW)arg0, arg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_EqualRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("EqualRgn\n")
-
- return (jboolean)EqualRgn((HRGN)arg0, (HRGN)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ExtTextOutA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jobject arg4, jbyteArray arg5, jint arg6, jintArray arg7)
-{
- DECL_GLOB(pGlob)
- RECT _arg4, *lparg4=NULL;
- jbyte *lparg5=NULL;
- jint *lparg7=NULL;
- jboolean rc;
-
- DEBUG_CALL("ExtTextOutA\n")
-
- if (arg4) lparg4 = getRECTFields(env, arg4, &_arg4, &PGLOB(RECTFc));
- if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL);
- if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL);
-
- rc = (jboolean)ExtTextOutA((HDC)arg0, arg1, arg2, arg3, lparg4, (LPSTR)lparg5, arg6, (CONST INT*)lparg7);
-
- if (arg4) setRECTFields(env, arg4, &_arg4, &PGLOB(RECTFc));
- if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
- if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ExtTextOutW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jobject arg4, jcharArray arg5, jint arg6, jintArray arg7)
-{
- DECL_GLOB(pGlob)
- RECT _arg4, *lparg4=NULL;
- jchar *lparg5=NULL;
- jint *lparg7=NULL;
- jboolean rc;
-
- DEBUG_CALL("ExtTextOutW\n")
-
- if (arg4) lparg4 = getRECTFields(env, arg4, &_arg4, &PGLOB(RECTFc));
- if (arg5) lparg5 = (*env)->GetCharArrayElements(env, arg5, NULL);
- if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL);
-
- rc = (jboolean)ExtTextOutW((HDC)arg0, arg1, arg2, arg3, lparg4, (LPWSTR)lparg5, arg6, (CONST INT*)lparg7);
-
- if (arg4) setRECTFields(env, arg4, &_arg4, &PGLOB(RECTFc));
- if (arg5) (*env)->ReleaseCharArrayElements(env, arg5, lparg5, 0);
- if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ExtractIconExA
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1, jintArray arg2, jintArray arg3, jint arg4)
-{
- jbyte *lparg0=NULL;
- jint *lparg2=NULL;
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("ExtractIconExA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)ExtractIconExA((LPSTR)lparg0, arg1, (HICON FAR *)lparg2, (HICON FAR *)lparg3, arg4);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ExtractIconExW
- (JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jintArray arg2, jintArray arg3, jint arg4)
-{
- jchar *lparg0=NULL;
- jint *lparg2=NULL;
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("ExtractIconExW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)ExtractIconExW((LPWSTR)lparg0, arg1, (HICON FAR *)lparg2, (HICON FAR *)lparg3, arg4);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_FillRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("FillRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jint)FillRect((HDC)arg0, lparg1, (HBRUSH)arg2);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_FindWindowA
- (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1)
-{
- jbyte *lparg0=NULL;
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("FindWindowA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)FindWindowA((LPSTR)lparg0, (LPSTR)lparg1);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_FindWindowW
- (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1)
-{
- jchar *lparg0=NULL;
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("FindWindowW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)FindWindowW((LPWSTR)lparg0, (LPWSTR)lparg1);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_FreeLibrary
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("FreeLibrary\n")
-
- return (jboolean)FreeLibrary((HMODULE)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetACP
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetACP\n")
-
- return (jint)GetACP();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetActiveWindow
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetActiveWindow\n")
-
- return (jint)GetActiveWindow();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetBkColor
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetBkColor\n")
-
- return (jint)GetBkColor((HDC)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCapture
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetCapture\n")
-
- return (jint)GetCapture();
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCaretPos
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- POINT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCaretPos\n")
-
- if (arg0) lparg0 = getPOINTFields(env, arg0, &_arg0, &PGLOB(POINTFc));
-
- rc = (jboolean)GetCaretPos(lparg0);
-
- if (arg0) setPOINTFields(env, arg0, lparg0, &PGLOB(POINTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharABCWidthsA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCharABCWidthsA\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jboolean)GetCharABCWidthsA((HDC)arg0, arg1, arg2, (LPABC)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharABCWidthsW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCharABCWidthsW\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jboolean)GetCharABCWidthsW((HDC)arg0, arg1, arg2, (LPABC)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharWidthA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCharWidthA\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jboolean)GetCharWidthA((HDC)arg0, arg1, arg2, (LPINT)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharWidthW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCharWidthW\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jboolean)GetCharWidthW((HDC)arg0, arg1, arg2, (LPINT)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharacterPlacementA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3, jobject arg4, jint arg5)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg1=NULL;
- GCP_RESULTS _arg4, *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("GetCharacterPlacementA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg4) lparg4 = getGCP_RESULTSFields(env, arg4, &_arg4, &PGLOB(GCP_RESULTSFc));
-
- rc = (jint)GetCharacterPlacementA((HDC)arg0, (LPSTR)lparg1, arg2, arg3, lparg4, arg5);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg4) setGCP_RESULTSFields(env, arg4, lparg4, &PGLOB(GCP_RESULTSFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCharacterPlacementW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jobject arg4, jint arg5)
-{
- DECL_GLOB(pGlob)
- jchar *lparg1=NULL;
- GCP_RESULTS _arg4, *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("GetCharacterPlacementW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg4) lparg4 = getGCP_RESULTSFields(env, arg4, &_arg4, &PGLOB(GCP_RESULTSFc));
-
- rc = (jint)GetCharacterPlacementW((HDC)arg0, (LPWSTR)lparg1, arg2, arg3, (LPGCP_RESULTSW)lparg4, arg5);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg4) setGCP_RESULTSFields(env, arg4, lparg4, &PGLOB(GCP_RESULTSFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClassInfoA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg1=NULL;
- WNDCLASS _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetClassInfoA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = getWNDCLASSFields(env, arg2, &_arg2, &PGLOB(WNDCLASSFc));
-
- rc = (jboolean)GetClassInfoA((HINSTANCE)arg0, (LPSTR)lparg1, lparg2);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg2) setWNDCLASSFields(env, arg2, lparg2, &PGLOB(WNDCLASSFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClassInfoW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- jchar *lparg1=NULL;
- WNDCLASS _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetClassInfoW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = getWNDCLASSFields(env, arg2, &_arg2, &PGLOB(WNDCLASSFc));
-
- rc = (jboolean)GetClassInfoW((HINSTANCE)arg0, (LPWSTR)lparg1, (LPWNDCLASSW)lparg2);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg2) setWNDCLASSFields(env, arg2, lparg2, &PGLOB(WNDCLASSFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClientRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetClientRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)GetClientRect((HWND)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClipBox
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetClipBox\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jint)GetClipBox((HDC)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClipRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetClipRgn\n")
-
- return (jint)GetClipRgn((HDC)arg0, (HRGN)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClipboardData
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetClipboardData\n")
-
- return (jint)GetClipboardData(arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClipboardFormatNameA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2)
-{
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetClipboardFormatNameA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)GetClipboardFormatNameA(arg0, (LPTSTR)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetClipboardFormatNameW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2)
-{
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetClipboardFormatNameW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)GetClipboardFormatNameW(arg0, (LPWSTR)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCurrentObject
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetCurrentObject\n")
-
- return (jint)GetCurrentObject((HDC)arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCurrentProcessId
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetCurrentProcessId\n")
-
- return (jint)GetCurrentProcessId();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCurrentThreadId
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetCurrentThreadId\n")
-
- return (jint)GetCurrentThreadId();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCursor
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetCursor\n")
-
- return (jint)GetCursor();
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetCursorPos
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- POINT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetCursorPos\n")
-
- if (arg0) lparg0 = getPOINTFields(env, arg0, &_arg0, &PGLOB(POINTFc));
-
- rc = (jboolean)GetCursorPos(lparg0);
-
- if (arg0) setPOINTFields(env, arg0, lparg0, &PGLOB(POINTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDC
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetDC\n")
-
- return (jint)GetDC((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDCEx
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("GetDCEx\n")
-
- return (jint)GetDCEx((HWND)arg0, (HRGN)arg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDIBColorTable
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("GetDIBColorTable\n")
-
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)GetDIBColorTable((HDC)arg0, arg1, arg2, (RGBQUAD *)lparg3);
-
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDIBits
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jint arg6)
-{
- jbyte *lparg5=NULL;
- jint rc;
-
- DEBUG_CALL("GetDIBits\n")
-
- if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL);
-
- rc = (jint)GetDIBits((HDC)arg0, (HBITMAP)arg1, arg2, arg3, (LPVOID)arg4, (LPBITMAPINFO)lparg5, arg6);
-
- if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDesktopWindow
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetDesktopWindow\n")
-
- return (jint)GetDesktopWindow();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDeviceCaps
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetDeviceCaps\n")
-
- return (jint)GetDeviceCaps((HDC)arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDialogBaseUnits
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetDialogBaseUnits\n")
-
- return (jint)GetDialogBaseUnits();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDlgItem
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetDlgItem\n")
-
- return (jint)GetDlgItem((HWND)arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetDoubleClickTime
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetDoubleClickTime\n")
-
- return (jint)GetDoubleClickTime();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_GetFileTitleA
- (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jshort arg2)
-{
- jbyte *lparg0=NULL;
- jbyte *lparg1=NULL;
- jshort rc;
-
- DEBUG_CALL("GetFileTitleA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jshort)GetFileTitleA((LPSTR)lparg0, (LPSTR)lparg1, arg2);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_GetFileTitleW
- (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1, jshort arg2)
-{
- jchar *lparg0=NULL;
- jchar *lparg1=NULL;
- jshort rc;
-
- DEBUG_CALL("GetFileTitleW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jshort)GetFileTitleW((LPWSTR)lparg0, (LPWSTR)lparg1, arg2);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetFocus
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetFocus\n")
-
- return (jint)GetFocus();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetFontLanguageInfo
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetFontLanguageInfo\n")
-
- return (jint)GetFontLanguageInfo((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetIconInfo
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- ICONINFO _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetIconInfo\n")
-
- if (arg1) lparg1 = getICONINFOFields(env, arg1, &_arg1, &PGLOB(ICONINFOFc));
-
- rc = (jboolean)GetIconInfo((HICON)arg0, lparg1);
-
- if (arg1) setICONINFOFields(env, arg1, lparg1, &PGLOB(ICONINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_GetKeyState
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetKeyState\n")
-
- return (jshort)GetKeyState(arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetKeyboardLayout
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetKeyboardLayout\n")
-
- return (jint)GetKeyboardLayout(arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetKeyboardLayoutList
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1)
-{
- jint *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetKeyboardLayoutList\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = (jint)GetKeyboardLayoutList(arg0, (HKL FAR *)lparg1);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetKeyboardState
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetKeyboardState\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jboolean)GetKeyboardState((PBYTE)lparg0);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetLastActivePopup
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetLastActivePopup\n")
-
- return (jint)GetLastActivePopup((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetLastError
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetLastError\n")
-
- return (jint)GetLastError();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetLibraryHandle
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetLibraryHandle\n")
-
- return (jint)g_hInstance;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetLocaleInfoA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3)
-{
- jbyte *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetLocaleInfoA\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
-
- rc = (jint)GetLocaleInfoA(arg0, arg1, (LPSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetLocaleInfoW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jcharArray arg2, jint arg3)
-{
- jchar *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetLocaleInfoW\n")
-
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
-
- rc = (jint)GetLocaleInfoW(arg0, arg1, (LPWSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenu
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetMenu\n")
-
- return (jint)GetMenu((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenuDefaultItem
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("GetMenuDefaultItem\n")
-
- return (jint)GetMenuDefaultItem((HMENU)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenuInfo
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- MENUINFO _arg1, *lparg1=NULL;
- jboolean rc = (jboolean)FALSE;
- HMODULE hm;
- FARPROC fp;
-
- DEBUG_CALL("GetMenuInfo\n")
-
- /*
- * GetMenuInfo is a Win2000 and Win98 specific call
- * If you link it into swt.dll a system modal entry point not found dialog will
- * appear as soon as swt.dll is loaded. Here we check for the entry point and
- * only do the call if it exists.
- */
- if ((hm=GetModuleHandle("user32.dll")) && (fp=GetProcAddress(hm, "GetMenuInfo"))) {
-
- if (arg1) lparg1 = getMENUINFOFields(env, arg1, &_arg1, &PGLOB(MENUINFOFc));
-
- rc = (jboolean) (fp)((HMENU)arg0, lparg1);
-// rc = (jboolean)GetMenuInfo(arg0, lparg1);
-
- if (arg1) setMENUINFOFields(env, arg1, lparg1, &PGLOB(MENUINFOFc));
- }
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenuItemCount
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetMenuItemCount\n")
-
- return (jint)GetMenuItemCount((HMENU)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenuItemInfoA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetMenuItemInfoA\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)GetMenuItemInfoA((HMENU)arg0, arg1, arg2, lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMenuItemInfoW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetMenuItemInfoW\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)GetMenuItemInfoW((HMENU)arg0, arg1, arg2, (LPMENUITEMINFOW)lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMessageA
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetMessageA\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- rc = (jboolean)GetMessageA(lparg0, (HWND)arg1, arg2, arg3);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMessagePos
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetMessagePos\n")
-
- return (jint)GetMessagePos();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMessageTime
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetMessageTime\n")
-
- return (jint)GetMessageTime();
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetMessageW
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetMessageW\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- rc = (jboolean)GetMessageW(lparg0, (HWND)arg1, arg2, arg3);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetModuleHandleA
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("GetModuleHandleA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)GetModuleHandleA((LPSTR)lparg0);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetModuleHandleW
- (JNIEnv *env, jclass that, jcharArray arg0)
-{
- jchar *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("GetModuleHandleW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = (jint)GetModuleHandleW((LPWSTR)lparg0);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetNearestPaletteIndex
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetNearestPaletteIndex\n")
-
- return (jint)GetNearestPaletteIndex((HPALETTE)arg0, (COLORREF)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectA__IILorg_eclipse_swt_internal_win32_LOGPEN_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGPEN _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectA\n")
-
- if (arg2) lparg2 = getLOGPENFields(env, arg2, &_arg2, &PGLOB(LOGPENFc));
-
- rc = (jint)GetObjectA((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGPENFields(env, arg2, lparg2, &PGLOB(LOGPENFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectA__IILorg_eclipse_swt_internal_win32_LOGFONT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectA\n")
-
- if (arg2) lparg2 = getLOGFONTAFields(env, arg2, &_arg2, &PGLOB(LOGFONTFc));
-
- rc = (jint)GetObjectA((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGFONTAFields(env, arg2, lparg2, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectA__IILorg_eclipse_swt_internal_win32_LOGBRUSH_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGBRUSH _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectA\n")
-
- if (arg2) lparg2 = getLOGBRUSHFields(env, arg2, &_arg2, &PGLOB(LOGBRUSHFc));
-
- rc = (jint)GetObjectA((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGBRUSHFields(env, arg2, lparg2, &PGLOB(LOGBRUSHFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectA__IILorg_eclipse_swt_internal_win32_DIBSECTION_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- DIBSECTION _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectA\n")
-
- if (arg2) lparg2 = getDIBSECTIONFields(env, arg2, &_arg2, &PGLOB(DIBSECTIONFc));
-
- rc = (jint)GetObjectA((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setDIBSECTIONFields(env, arg2, lparg2, &PGLOB(DIBSECTIONFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectA__IILorg_eclipse_swt_internal_win32_BITMAP_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- BITMAP _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectA\n")
-
- if (arg2) lparg2 = getBITMAPFields(env, arg2, &_arg2, &PGLOB(BITMAPFc));
-
- rc = (jint)GetObjectA((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setBITMAPFields(env, arg2, lparg2, &PGLOB(BITMAPFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectW__IILorg_eclipse_swt_internal_win32_LOGPEN_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGPEN _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectW\n")
-
- if (arg2) lparg2 = getLOGPENFields(env, arg2, &_arg2, &PGLOB(LOGPENFc));
-
- rc = (jint)GetObjectW((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGPENFields(env, arg2, lparg2, &PGLOB(LOGPENFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectW__IILorg_eclipse_swt_internal_win32_LOGFONT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectW\n")
-
- if (arg2) lparg2 = getLOGFONTWFields(env, arg2, &_arg2, &PGLOB(LOGFONTFc));
-
- rc = (jint)GetObjectW((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGFONTWFields(env, arg2, lparg2, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectW__IILorg_eclipse_swt_internal_win32_LOGBRUSH_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- LOGBRUSH _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectW\n")
-
- if (arg2) lparg2 = getLOGBRUSHFields(env, arg2, &_arg2, &PGLOB(LOGBRUSHFc));
-
- rc = (jint)GetObjectW((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setLOGBRUSHFields(env, arg2, lparg2, &PGLOB(LOGBRUSHFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectW__IILorg_eclipse_swt_internal_win32_DIBSECTION_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- DIBSECTION _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectW\n")
-
- if (arg2) lparg2 = getDIBSECTIONFields(env, arg2, &_arg2, &PGLOB(DIBSECTIONFc));
-
- rc = (jint)GetObjectW((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setDIBSECTIONFields(env, arg2, lparg2, &PGLOB(DIBSECTIONFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetObjectW__IILorg_eclipse_swt_internal_win32_BITMAP_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- BITMAP _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetObjectW\n")
-
- if (arg2) lparg2 = getBITMAPFields(env, arg2, &_arg2, &PGLOB(BITMAPFc));
-
- rc = (jint)GetObjectW((HGDIOBJ)arg0, arg1, lparg2);
-
- if (arg2) setBITMAPFields(env, arg2, lparg2, &PGLOB(BITMAPFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetOpenFileNameA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OPENFILENAME _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetOpenFileNameA\n")
-
- if (arg0) lparg0 = getOPENFILENAMEFields(env, arg0, &_arg0, &PGLOB(OPENFILENAMEFc));
-
- rc = (jboolean)GetOpenFileNameA(lparg0);
-
- if (arg0) setOPENFILENAMEFields(env, arg0, lparg0, &PGLOB(OPENFILENAMEFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetOpenFileNameW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OPENFILENAME _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetOpenFileNameW\n")
-
- if (arg0) lparg0 = getOPENFILENAMEFields(env, arg0, &_arg0, &PGLOB(OPENFILENAMEFc));
-
- rc = (jboolean)GetOpenFileNameW((LPOPENFILENAMEW)lparg0);
-
- if (arg0) setOPENFILENAMEFields(env, arg0, lparg0, &PGLOB(OPENFILENAMEFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetPaletteEntries
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("GetPaletteEntries\n")
-
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)GetPaletteEntries((HPALETTE)arg0, arg1, arg2, (LPPALETTEENTRY)lparg3);
-
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetParent
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetParent\n")
-
- return (jint)GetParent((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetPixel
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("GetPixel\n")
-
- return (jint)GetPixel((HDC)arg0, arg1, arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetProcAddress
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetProcAddress\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)GetProcAddress((HMODULE)arg0, (LPCTSTR)lparg1);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetProcessHeap
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetProcessHeap\n")
-
- return (jint)GetProcessHeap();
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetProfileStringA
- (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jbyteArray arg2, jbyteArray arg3, jint arg4)
-{
- jbyte *lparg0=NULL;
- jbyte *lparg1=NULL;
- jbyte *lparg2=NULL;
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("GetProfileStringA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)GetProfileStringA((LPSTR)lparg0, (LPSTR)lparg1, (LPSTR)lparg2, (LPSTR)lparg3, arg4);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetProfileStringW
- (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1, jcharArray arg2, jcharArray arg3, jint arg4)
-{
- jchar *lparg0=NULL;
- jchar *lparg1=NULL;
- jchar *lparg2=NULL;
- jchar *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("GetProfileStringW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetCharArrayElements(env, arg3, NULL);
-
- rc = (jint)GetProfileStringW((LPWSTR)lparg0, (LPWSTR)lparg1, (LPWSTR)lparg2, (LPWSTR)lparg3, arg4);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseCharArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetROP2
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetROP2\n")
-
- return (jint)GetROP2((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetRegionData
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2)
-{
- jint *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("GetRegionData\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jint)GetRegionData((HRGN)arg0, arg1, (RGNDATA *)lparg2);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetRgnBox
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetRgnBox\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jint)GetRgnBox((HRGN)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSaveFileNameA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OPENFILENAME _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetSaveFileNameA\n")
-
- if (arg0) lparg0 = getOPENFILENAMEFields(env, arg0, &_arg0, &PGLOB(OPENFILENAMEFc));
-
- rc = (jboolean)GetSaveFileNameA(lparg0);
-
- if (arg0) setOPENFILENAMEFields(env, arg0, lparg0, &PGLOB(OPENFILENAMEFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSaveFileNameW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OPENFILENAME _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetSaveFileNameW\n")
-
- if (arg0) lparg0 = getOPENFILENAMEFields(env, arg0, &_arg0, &PGLOB(OPENFILENAMEFc));
-
- rc = (jboolean)GetSaveFileNameW((LPOPENFILENAMEW)lparg0);
-
- if (arg0) setOPENFILENAMEFields(env, arg0, lparg0, &PGLOB(OPENFILENAMEFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetScrollInfo
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- SCROLLINFO _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetScrollInfo\n")
-
- if (arg2) lparg2 = getSCROLLINFOFields(env, arg2, &_arg2, &PGLOB(SCROLLINFOFc));
-
- rc = (jboolean)GetScrollInfo((HWND)arg0, arg1, lparg2);
-
- if (arg2) setSCROLLINFOFields(env, arg2, lparg2, &PGLOB(SCROLLINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetStockObject
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetStockObject\n")
-
- return (jint)GetStockObject(arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSysColor
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetSysColor\n")
-
- return (jint)GetSysColor(arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSysColorBrush
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetSysColorBrush\n")
-
- return (jint)GetSysColorBrush(arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSystemMenu
- (JNIEnv *env, jclass that, jint arg0, jboolean arg1)
-{
- DEBUG_CALL("GetSystemMenu\n")
-
- return (jint)GetSystemMenu((HWND)arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetSystemMetrics
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetSystemMetrics\n")
-
- return (jint)GetSystemMetrics(arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextCharset
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetTextCharset\n")
-
- return (jint)GetTextCharset((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextColor
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetTextColor\n")
-
- return (jint)GetTextColor((HDC)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextExtentPoint32A
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg1=NULL;
- SIZE _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetTextExtentPoint32A\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = getSIZEFields(env, arg3, &_arg3, &PGLOB(SIZEFc));
-
- rc = (jboolean)GetTextExtentPoint32A((HDC)arg0, (LPSTR)lparg1, arg2, lparg3);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg3) setSIZEFields(env, arg3, lparg3, &PGLOB(SIZEFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextExtentPoint32W
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- jchar *lparg1=NULL;
- SIZE _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetTextExtentPoint32W\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = getSIZEFields(env, arg3, &_arg3, &PGLOB(SIZEFc));
-
- rc = (jboolean)GetTextExtentPoint32W((HDC)arg0, (LPWSTR)lparg1, arg2, lparg3);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg3) setSIZEFields(env, arg3, lparg3, &PGLOB(SIZEFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextMetricsA
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- TEXTMETRICA _arg1={0}, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetTextMetricsA\n")
-
- if (arg1) lparg1 = &_arg1;
-
- rc = (jboolean)GetTextMetricsA((HDC)arg0, lparg1);
-
- if (arg1) setTEXTMETRICAFields(env, arg1, lparg1, &PGLOB(TEXTMETRICFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTextMetricsW
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- TEXTMETRICW _arg1={0}, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetTextMetricsW\n")
-
- if (arg1) lparg1 = &_arg1;
-
- rc = (jboolean)GetTextMetricsW((HDC)arg0, lparg1);
-
- if (arg1) setTEXTMETRICWFields(env, arg1, lparg1, &PGLOB(TEXTMETRICFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetTickCount
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("GetTickCount\n")
-
- return (jint)GetTickCount();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetUpdateRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2)
-{
- DEBUG_CALL("GetUpdateRgn\n")
-
- return (jint)GetUpdateRgn((HWND)arg0, (HRGN)arg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetVersionExA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OSVERSIONINFOA _arg0={0}, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetVersionExA\n")
-
- if (arg0) lparg0 = getOSVERSIONINFOAFields(env, arg0, &_arg0, &PGLOB(OSVERSIONINFOFc));
-
- rc = (jboolean)GetVersionExA(lparg0);
-
- if (arg0) setOSVERSIONINFOAFields(env, arg0, lparg0, &PGLOB(OSVERSIONINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetVersionExW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- OSVERSIONINFOW _arg0={0}, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetVersionExW\n")
-
- if (arg0) lparg0 = getOSVERSIONINFOWFields(env, arg0, &_arg0, &PGLOB(OSVERSIONINFOFc));
-
- rc = (jboolean)GetVersionExW(lparg0);
-
- if (arg0) setOSVERSIONINFOWFields(env, arg0, lparg0, &PGLOB(OSVERSIONINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindow
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetWindow\n")
-
- return (jint)GetWindow((HWND)arg0, arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowLongA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetWindowLongA\n")
-
- return (jint)GetWindowLongA((HWND)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowLongW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GetWindowLongW\n")
-
- return (jint)GetWindowLongW((HWND)arg0, arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowPlacement
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- WINDOWPLACEMENT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetWindowPlacement\n")
-
- if (arg1) lparg1 = getWINDOWPLACEMENTFields(env, arg1, &_arg1, &PGLOB(WINDOWPLACEMENTFc));
-
- rc = (jboolean)GetWindowPlacement((HWND)arg0, lparg1);
-
- if (arg1) setWINDOWPLACEMENTFields(env, arg1, lparg1, &PGLOB(WINDOWPLACEMENTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("GetWindowRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)GetWindowRect((HWND)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowTextA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2)
-{
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetWindowTextA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)GetWindowTextA((HWND)arg0, (LPSTR)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowTextLengthA
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetWindowTextLengthA\n")
-
- return (jint)GetWindowTextLengthA((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowTextLengthW
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GetWindowTextLengthW\n")
-
- return (jint)GetWindowTextLengthW((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowTextW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2)
-{
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetWindowTextW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)GetWindowTextW((HWND)arg0, (LPWSTR)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GetWindowThreadProcessId
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1)
-{
- jint *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("GetWindowThreadProcessId\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = (jint)GetWindowThreadProcessId((HWND)arg0, (LPDWORD)lparg1);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GlobalAlloc
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("GlobalAlloc\n")
-
- return (jint)GlobalAlloc(arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GlobalFree
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GlobalFree\n")
-
- return (jint)GlobalFree((HANDLE)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GlobalLock
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GlobalLock\n")
-
- return (jint)GlobalLock((HANDLE)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_GlobalSize
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GlobalSize\n")
-
- return (jint)GlobalSize((HANDLE)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GlobalUnlock
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("GlobalUnlock\n")
-
- return (jboolean)GlobalUnlock((HANDLE)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_GradientFill
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5)
-{
- HMODULE hm;
- FARPROC fp;
-
- DEBUG_CALL("GradientFill\n")
-
- /*
- * GradientFill is a Win2000 and Win98 specific call
- * If you link it into swt.dll, a system modal entry point not found dialog will
- * appear as soon as swt.dll is loaded. Here we check for the entry point and
- * only do the call if it exists.
- */
- if (!(hm = GetModuleHandle("msimg32.dll"))) hm = LoadLibrary("msimg32.dll");
- if (hm && (fp = GetProcAddress(hm, "GradientFill"))) {
-// return (jboolean)GradientFill((HDC)arg0, (PTRIVERTEX)arg1, (ULONG)arg2, (PVOID)arg3, (ULONG)arg4, (ULONG)arg5);
- return (jboolean)fp(arg0, arg1, arg2, arg3, arg4, arg5);
- }
- return (jboolean)FALSE;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_HeapAlloc
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("HeapAlloc\n")
-
- return (jint)HeapAlloc((HANDLE)arg0, arg1, arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_HeapFree
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("HeapFree\n")
-
- return (jboolean)HeapFree((HANDLE)arg0, arg1, (LPVOID)arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_HideCaret
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("HideCaret\n")
-
- return (jboolean)HideCaret((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1Add
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImageList_Add\n")
-
- return (jint)ImageList_Add((HIMAGELIST)arg0, (HBITMAP)arg1, (HBITMAP)arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1AddMasked
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImageList_AddMasked\n")
-
- return (jint)ImageList_AddMasked((HIMAGELIST)arg0, (HBITMAP)arg1, (COLORREF)arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1Create
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("ImageList_Create\n")
-
- return (jint)ImageList_Create(arg0, arg1, arg2, arg3, arg4);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1Destroy
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImageList_Destroy\n")
-
- return (jboolean)ImageList_Destroy((HIMAGELIST)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1GetIcon
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImageList_GetIcon\n")
-
- return (jint)ImageList_GetIcon((HIMAGELIST)arg0, arg1, arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1GetIconSize
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2)
-{
- jint *lparg1=NULL;
- jint *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("ImageList_GetIconSize\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jboolean)ImageList_GetIconSize((HIMAGELIST)arg0, lparg1, lparg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1GetImageCount
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImageList_GetImageCount\n")
-
- return (jint)ImageList_GetImageCount((HIMAGELIST)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1Remove
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ImageList_Remove\n")
-
- return (jboolean)ImageList_Remove((HIMAGELIST)arg0, arg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1Replace
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("ImageList_Replace\n")
-
- return (jboolean)ImageList_Replace((HIMAGELIST)arg0, arg1, (HBITMAP)arg2, (HBITMAP)arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1ReplaceIcon
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImageList_ReplaceIcon\n")
-
- return (jint)ImageList_ReplaceIcon((HIMAGELIST)arg0, arg1, (HICON)arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImageList_1SetIconSize
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImageList_SetIconSize\n")
-
- return (jboolean)ImageList_SetIconSize((HIMAGELIST)arg0, arg1, arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmAssociateContext
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ImmAssociateContext\n")
-
- return (jint)ImmAssociateContext((HWND)arg0, (HIMC)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmCreateContext
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("ImmCreateContext\n")
-
- return (jint)ImmCreateContext();
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmDestroyContext
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImmDestroyContext\n")
-
- return (jboolean)ImmDestroyContext((HIMC)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetCompositionFontA
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ImmGetCompositionFontA\n")
-
- if (arg1) lparg1 = getLOGFONTAFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- rc = (jboolean)ImmGetCompositionFontA((HIMC)arg0, lparg1);
-
- if (arg1) setLOGFONTAFields(env, arg1, lparg1, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetCompositionFontW
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ImmGetCompositionFontW\n")
-
- if (arg1) lparg1 = getLOGFONTWFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- rc = (jboolean)ImmGetCompositionFontW((HIMC)arg0, lparg1);
-
- if (arg1) setLOGFONTWFields(env, arg1, lparg1, &PGLOB(LOGFONTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetCompositionStringA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3)
-{
- jbyte *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("ImmGetCompositionStringA\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
-
- rc = (jint)ImmGetCompositionStringA((HIMC)arg0, arg1, (LPSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetCompositionStringW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jcharArray arg2, jint arg3)
-{
- jchar *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("ImmGetCompositionStringW\n")
-
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
-
- rc = (jint)ImmGetCompositionStringW((HIMC)arg0, arg1, (LPWSTR)lparg2, arg3);
-
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetContext
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImmGetContext\n")
-
- return (jint)ImmGetContext((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetConversionStatus
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2)
-{
- jint *lparg1=NULL;
- jint *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("ImmGetConversionStatus\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jboolean)ImmGetConversionStatus((HIMC)arg0, lparg1, lparg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetDefaultIMEWnd
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImmGetDefaultIMEWnd\n")
-
- return (jint)ImmGetDefaultIMEWnd((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmGetOpenStatus
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ImmGetOpenStatus\n")
-
- return (jboolean)ImmGetOpenStatus((HIMC)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmReleaseContext
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ImmReleaseContext\n")
-
- return (jboolean)ImmReleaseContext((HWND)arg0, (HIMC)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmSetCompositionFontA
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg1, *lparg1=NULL;
-
- DEBUG_CALL("ImmSetCompositionFontA\n")
-
- if (arg1) lparg1 = getLOGFONTAFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- return (jboolean)ImmSetCompositionFontA((HIMC)arg0, lparg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmSetCompositionFontW
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg1, *lparg1=NULL;
-
- DEBUG_CALL("ImmSetCompositionFontW\n")
-
- if (arg1) lparg1 = getLOGFONTWFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- return (jboolean)ImmSetCompositionFontW((HIMC)arg0, lparg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmSetCompositionWindow
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- COMPOSITIONFORM _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ImmSetCompositionWindow\n")
-
- if (arg1) lparg1 = getCOMPOSITIONFORMFields(env, arg1, &_arg1, &PGLOB(COMPOSITIONFORMFc));
-
- rc = (jboolean)ImmSetCompositionWindow((HIMC)arg0, lparg1);
-
- if (arg1) setCOMPOSITIONFORMFields(env, arg1, lparg1, &PGLOB(COMPOSITIONFORMFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmSetConversionStatus
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("ImmSetConversionStatus\n")
-
- return (jboolean)ImmSetConversionStatus((HIMC)arg0, arg1, arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ImmSetOpenStatus
- (JNIEnv *env, jclass that, jint arg0, jboolean arg1)
-{
- DEBUG_CALL("ImmSetOpenStatus\n")
-
- return (jboolean)ImmSetOpenStatus((HIMC)arg0, arg1);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_InitCommonControls
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("InitCommonControls\n")
-
- InitCommonControls();
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InitCommonControlsEx
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- INITCOMMONCONTROLSEX _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("InitCommonControlsEx\n")
-
- if (arg0) lparg0 = getINITCOMMONCONTROLSEXFields(env, arg0, &_arg0, &PGLOB(INITCOMMONCONTROLSEXFc));
-
- rc = (jboolean)InitCommonControlsEx(lparg0);
-
- if (arg0) setINITCOMMONCONTROLSEXFields(env, arg0, lparg0, &PGLOB(INITCOMMONCONTROLSEXFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InsertMenuA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4)
-{
- jbyte *lparg4=NULL;
- jboolean rc;
-
- DEBUG_CALL("InsertMenuA\n")
-
- if (arg4) lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL);
-
- rc = (jboolean)InsertMenuA((HMENU)arg0, arg1, arg2, arg3, lparg4);
-
- if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InsertMenuItemA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("InsertMenuItemA\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)InsertMenuItemA((HMENU)arg0, arg1, arg2, lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InsertMenuItemW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("InsertMenuItemW\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)InsertMenuItemW((HMENU)arg0, arg1, arg2, (LPMENUITEMINFOW)lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InsertMenuW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jcharArray arg4)
-{
- jchar *lparg4=NULL;
- jboolean rc;
-
- DEBUG_CALL("InsertMenuW\n")
-
- if (arg4) lparg4 = (*env)->GetCharArrayElements(env, arg4, NULL);
-
- rc = (jboolean)InsertMenuW((HMENU)arg0, arg1, arg2, arg3, lparg4);
-
- if (arg4) (*env)->ReleaseCharArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InvalidateRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jboolean arg2)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("InvalidateRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)InvalidateRect((HWND)arg0, lparg1, arg2);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_InvalidateRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2)
-{
- DEBUG_CALL("InvalidateRgn\n")
-
- return (jboolean)InvalidateRgn((HWND)arg0, (HRGN)arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_IsDBCSLeadByte
- (JNIEnv *env, jclass that, jbyte arg0)
-{
- DEBUG_CALL("IsDBCSLeadByte\n")
-
- return (jboolean)IsDBCSLeadByte(arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_IsIconic
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("IsIconic\n")
-
- return (jboolean)IsIconic((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_IsWindowEnabled
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("IsWindowEnabled\n")
-
- return (jboolean)IsWindowEnabled((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_IsWindowVisible
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("IsWindowVisible\n")
-
- return (jboolean)IsWindowVisible((HWND)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_IsZoomed
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("IsZoomed\n")
-
- return (jboolean)IsZoomed((HWND)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_KillTimer
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("KillTimer\n")
-
- return (jboolean)KillTimer((HWND)arg0, arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_LineTo
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("LineTo\n")
-
- return (jboolean)LineTo((HDC)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadBitmapA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadBitmapA\n")
-
- return (jint)LoadBitmapA((HINSTANCE)arg0, (LPSTR)arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadBitmapW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadBitmapW\n")
-
- return (jint)LoadBitmapW((HINSTANCE)arg0, (LPWSTR)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadCursorA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadCursorA\n")
-
- return (jint)LoadCursorA((HINSTANCE)arg0, (LPSTR)arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadCursorW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadCursorW\n")
-
- return (jint)LoadCursorW((HINSTANCE)arg0, (LPWSTR)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadIconA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadIconA\n")
-
- return (jint)LoadIconA((HINSTANCE)arg0, (LPSTR)arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadIconW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("LoadIconW\n")
-
- return (jint)LoadIconW((HINSTANCE)arg0, (LPWSTR)arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadImageA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3, jint arg4, jint arg5)
-{
- jbyte *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("LoadImageA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jint)LoadImageA((HINSTANCE)arg0, (LPSTR)lparg1, arg2, arg3, arg4, arg5);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadImageW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jint arg4, jint arg5)
-{
- jchar *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("LoadImageW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jint)LoadImageW((HINSTANCE)arg0, (LPWSTR)lparg1, arg2, arg3, arg4, arg5);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadLibraryA
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("LoadLibraryA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)LoadLibraryA((LPSTR)lparg0);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_LoadLibraryW
- (JNIEnv *env, jclass that, jcharArray arg0)
-{
- jchar *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("LoadLibraryW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = (jint)LoadLibraryW((LPWSTR)lparg0);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MapVirtualKeyA
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("MapVirtualKeyA\n")
-
- return (jint)MapVirtualKeyA(arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MapVirtualKeyW
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("MapVirtualKeyW\n")
-
- return (jint)MapVirtualKeyW(arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MapWindowPoints__IILorg_eclipse_swt_internal_win32_RECT_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("MapWindowPoints\n")
-
- if (arg2) lparg2 = getRECTFields(env, arg2, &_arg2, &PGLOB(RECTFc));
-
- rc = (jint)MapWindowPoints((HWND)arg0, (HWND)arg1, (LPPOINT)lparg2, arg3);
-
- if (arg2) setRECTFields(env, arg2, lparg2, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MapWindowPoints__IILorg_eclipse_swt_internal_win32_POINT_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- POINT _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("MapWindowPoints\n")
-
- if (arg2) lparg2 = getPOINTFields(env, arg2, &_arg2, &PGLOB(POINTFc));
-
- rc = (jint)MapWindowPoints((HWND)arg0, (HWND)arg1, (LPPOINT)lparg2, arg3);
-
- if (arg2) setPOINTFields(env, arg2, lparg2, &PGLOB(POINTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_MessageBeep
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("MessageBeep\n")
-
- return (jboolean)MessageBeep(arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MessageBoxA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jbyteArray arg2, jint arg3)
-{
- jbyte *lparg1=NULL;
- jbyte *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("MessageBoxA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
-
- rc = (jint)MessageBoxA((HWND)arg0, (LPSTR)lparg1, (LPSTR)lparg2, arg3);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MessageBoxW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jcharArray arg2, jint arg3)
-{
- jchar *lparg1=NULL;
- jchar *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("MessageBoxW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
-
- rc = (jint)MessageBoxW((HWND)arg0, (LPWSTR)lparg1, (LPWSTR)lparg2, arg3);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3SI
- (JNIEnv *env, jclass that, jint arg0, jshortArray arg1, jint arg2)
-{
- jshort *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetShortArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseShortArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3FI
- (JNIEnv *env, jclass that, jint arg0, jfloatArray arg1, jint arg2)
-{
- jfloat *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetFloatArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseFloatArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3DI
- (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jint arg2)
-{
- jdouble *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3SII
- (JNIEnv *env, jclass that, jshortArray arg0, jint arg1, jint arg2)
-{
- jshort *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetShortArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseShortArrayElements(env, arg0, lparg0, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3FII
- (JNIEnv *env, jclass that, jfloatArray arg0, jint arg1, jint arg2)
-{
- jfloat *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetFloatArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseFloatArrayElements(env, arg0, lparg0, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3DII
- (JNIEnv *env, jclass that, jdoubleArray arg0, jint arg1, jint arg2)
-{
- jdouble *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetDoubleArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseDoubleArrayElements(env, arg0, lparg0, 0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_DROPFILES_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- DROPFILES _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getDROPFILESFields(env, arg1, &_arg1, &PGLOB(DROPFILESFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) setDROPFILESFields(env, arg1, lparg1, &PGLOB(DROPFILESFc));
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_MSG_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_WINDOWPOS_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- WINDOWPOS _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setWINDOWPOSFields(env, arg0, lparg0, &PGLOB(WINDOWPOSFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_TVITEM_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- TVITEM _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setTVITEMFields(env, arg0, lparg0, &PGLOB(TVITEMFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTOOLBAR_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMTOOLBAR _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMTOOLBARFields(env, arg0, lparg0, &PGLOB(NMTOOLBARFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMLISTVIEW_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMLISTVIEW _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMLISTVIEWFields(env, arg0, lparg0, &PGLOB(NMLISTVIEWFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMHEADER_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMHEADER _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMHEADERFields(env, arg0, lparg0, &PGLOB(NMHEADERFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMHDR_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMHDR _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMHDRFields(env, arg0, lparg0, &PGLOB(NMHDRFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_MEASUREITEMSTRUCT_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- MEASUREITEMSTRUCT _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setMEASUREITEMSTRUCTFields(env, arg0, lparg0, &PGLOB(MEASUREITEMSTRUCTFc));
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_HELPINFO_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- HELPINFO _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setHELPINFOFields(env, arg0, lparg0, &PGLOB(HELPINFOFc));
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_HDITEM_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- HDITEM _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setHDITEMFields(env, arg0, lparg0, &PGLOB(HDITEMFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_DRAWITEMSTRUCT_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- DRAWITEMSTRUCT _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setDRAWITEMSTRUCTFields(env, arg0, lparg0, &PGLOB(DRAWITEMSTRUCTFc));
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_TRIVERTEX_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- TRIVERTEX _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getTRIVERTEXFields(env, arg1, &_arg1, &PGLOB(TRIVERTEXFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_RECT_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_WINDOWPOS_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- WINDOWPOS _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getWINDOWPOSFields(env, arg1, &_arg1, &PGLOB(WINDOWPOSFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_MEASUREITEMSTRUCT_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- MEASUREITEMSTRUCT _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getMEASUREITEMSTRUCTFields(env, arg1, &_arg1, &PGLOB(MEASUREITEMSTRUCTFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__ILorg_eclipse_swt_internal_win32_GRADIENT_1RECT_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- GRADIENT_RECT _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = getGRADIENT_RECTFields(env, arg1, &_arg1, &PGLOB(GRADIENT_RECTFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3II
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jint arg2)
-{
- jint *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3CI
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2)
-{
- jchar *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__I_3BI
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2)
-{
- jbyte *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3III
- (JNIEnv *env, jclass that, jintArray arg0, jint arg1, jint arg2)
-{
- jint *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3BLorg_eclipse_swt_internal_win32_ACCEL_2I
- (JNIEnv *env, jclass that, jbyteArray arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg0=NULL;
- ACCEL _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
- if (arg1) lparg1 = getACCELFields(env, arg1, &_arg1, &PGLOB(ACCELFc));
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)lparg1, arg2);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3BII
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1, jint arg2)
-{
- jbyte *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory___3CII
- (JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jint arg2)
-{
- jchar *lparg0=NULL;
-
- DEBUG_CALL("MoveMemory\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryA__Lorg_eclipse_swt_internal_win32_NMTTDISPINFO_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMTTDISPINFOA _arg0={0}, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemoryA\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMTTDISPINFOAFields(env, arg0, lparg0, &PGLOB(NMTTDISPINFOFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryA__Lorg_eclipse_swt_internal_win32_LOGFONT_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemoryA\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setLOGFONTAFields(env, arg0, lparg0, &PGLOB(LOGFONTFc));
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryA__ILorg_eclipse_swt_internal_win32_NMTTDISPINFO_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMTTDISPINFOA _arg1={0}, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemoryA\n")
-
- if (arg1) lparg1 = getNMTTDISPINFOAFields(env, arg1, &_arg1, &PGLOB(NMTTDISPINFOFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryA__ILorg_eclipse_swt_internal_win32_LOGFONT_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTA _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemoryA\n")
-
- if (arg1) lparg1 = getLOGFONTAFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryW__Lorg_eclipse_swt_internal_win32_NMTTDISPINFO_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMTTDISPINFOW _arg0={0}, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemoryW\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setNMTTDISPINFOWFields(env, arg0, lparg0, &PGLOB(NMTTDISPINFOFc));
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryW__Lorg_eclipse_swt_internal_win32_LOGFONT_2II
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg0, *lparg0=NULL;
-
- DEBUG_CALL("MoveMemoryW\n")
-
- if (arg0) lparg0 = &_arg0;
-
- MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
-
- if (arg0) setLOGFONTWFields(env, arg0, lparg0, &PGLOB(LOGFONTFc));
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryW__ILorg_eclipse_swt_internal_win32_NMTTDISPINFO_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- NMTTDISPINFOW _arg1={0}, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemoryW\n")
-
- if (arg1) lparg1 = getNMTTDISPINFOWFields(env, arg1, &_arg1, &PGLOB(NMTTDISPINFOFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemoryW__ILorg_eclipse_swt_internal_win32_LOGFONT_2I
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2)
-{
- DECL_GLOB(pGlob)
- LOGFONTW _arg1, *lparg1=NULL;
-
- DEBUG_CALL("MoveMemoryW\n")
-
- if (arg1) lparg1 = getLOGFONTWFields(env, arg1, &_arg1, &PGLOB(LOGFONTFc));
-
- MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveToEx
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("MoveToEx\n")
-
- return (jboolean)MoveToEx((HDC)arg0, arg1, arg2, (LPPOINT)arg3);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_MultiByteToWideChar
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jint arg3, jcharArray arg4, jint arg5)
-{
- jbyte *lparg2=NULL;
- jchar *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("MultiByteToWideChar\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg4) lparg4 = (*env)->GetCharArrayElements(env, arg4, NULL);
-
- rc = (jint)MultiByteToWideChar(arg0, arg1, (LPCSTR)lparg2, arg3, (LPWSTR)lparg4, arg5);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg4) (*env)->ReleaseCharArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_OleInitialize
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("OleInitialize\n")
-
- return (jint)OleInitialize((LPVOID)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_OleUninitialize
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("OleUninitialize\n")
-
- OleUninitialize();
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_OpenClipboard
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("OpenClipboard\n")
-
- return (jboolean)OpenClipboard((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PatBlt
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5)
-{
- DEBUG_CALL("PatBlt\n")
-
- return (jboolean)PatBlt((HDC)arg0, arg1, arg2, arg3, arg4, arg5);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PeekMessageA
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("PeekMessageA\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- rc = (jboolean)PeekMessageA(lparg0, (HWND)arg1, arg2, arg3, arg4);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PeekMessageW
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("PeekMessageW\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- rc = (jboolean)PeekMessageW(lparg0, (HWND)arg1, arg2, arg3, arg4);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Pie
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8)
-{
- DEBUG_CALL("Pie\n")
-
- return (jboolean)Pie((HDC)arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Polygon
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jint arg2)
-{
- jint *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("Polygon\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = (jboolean)Polygon((HDC)arg0, (CONST POINT *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Polyline
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jint arg2)
-{
- jint *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("Polyline\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = (jboolean)Polyline((HDC)arg0, (CONST POINT *)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PostMessageA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("PostMessageA\n")
-
- return (jboolean)PostMessageA((HWND)arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PostMessageW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("PostMessageW\n")
-
- return (jboolean)PostMessageW((HWND)arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PostThreadMessageA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("PostThreadMessageA\n")
-
- return (jboolean)PostThreadMessageA(arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PostThreadMessageW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("PostThreadMessageW\n")
-
- return (jboolean)PostThreadMessageW(arg0, arg1, (WPARAM)arg2, (LPARAM)arg3);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PrintDlgA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- PRINTDLG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("PrintDlgA\n")
-
- if (arg0) lparg0 = getPRINTDLGFields(env, arg0, &_arg0, &PGLOB(PRINTDLGFc));
-
- rc = (jboolean)PrintDlgA(lparg0);
-
- if (arg0) setPRINTDLGFields(env, arg0, lparg0, &PGLOB(PRINTDLGFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PrintDlgW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- PRINTDLG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("PrintDlgW\n")
-
- if (arg0) lparg0 = getPRINTDLGFields(env, arg0, &_arg0, &PGLOB(PRINTDLGFc));
-
- rc = (jboolean)PrintDlgW((LPPRINTDLGW)lparg0);
-
- if (arg0) setPRINTDLGFields(env, arg0, lparg0, &PGLOB(PRINTDLGFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PtInRect
- (JNIEnv *env, jclass that, jobject arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg0, *lparg0=NULL;
- POINT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("PtInRect\n")
-
- if (arg0) lparg0 = getRECTFields(env, arg0, &_arg0, &PGLOB(RECTFc));
- if (arg1) lparg1 = getPOINTFields(env, arg1, &_arg1, &PGLOB(POINTFc));
-
- rc = (jboolean)PtInRect(lparg0, *lparg1);
-
- if (arg0) setRECTFields(env, arg0, lparg0, &PGLOB(RECTFc));
- if (arg1) setPOINTFields(env, arg1, lparg1, &PGLOB(POINTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_PtInRegion
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("PtInRegion\n")
-
- return (jboolean)PtInRegion((HRGN)arg0, arg1, arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RealizePalette
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("RealizePalette\n")
-
- return (jint)RealizePalette((HDC)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_RectInRegion
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("RectInRegion\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)RectInRegion((HRGN)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_Rectangle
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("Rectangle\n")
-
- return (jboolean)Rectangle((HDC)arg0, arg1, arg2, arg3, arg4);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_RedrawWindow
- (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("RedrawWindow\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)RedrawWindow((HWND)arg0, lparg1, (HRGN)arg2, arg3);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegCloseKey
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("RegCloseKey\n")
-
- return (jint)RegCloseKey((HKEY)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegEnumKeyExA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jintArray arg3, jintArray arg4, jbyteArray arg5, jintArray arg6, jobject arg7)
-{
- DECL_GLOB(pGlob)
- jbyte *lparg2=NULL;
- jint *lparg3=NULL;
- jint *lparg4=NULL;
- jbyte *lparg5=NULL;
- jint *lparg6=NULL;
- FILETIME _arg7, *lparg7=NULL;
- jint rc;
-
- DEBUG_CALL("RegEnumKeyExA\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL);
- if (arg6) lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL);
- if (arg7) lparg7 = getFILETIMEFields(env, arg7, &_arg7, &PGLOB(FILETIMEFc));
-
- rc = (jint)RegEnumKeyExA((HKEY)arg0, arg1, (LPSTR)lparg2, lparg3, lparg4, (LPSTR)lparg5, lparg6, lparg7);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
- if (arg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
- if (arg7) setFILETIMEFields(env, arg7, lparg7, &PGLOB(FILETIMEFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegEnumKeyExW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jcharArray arg2, jintArray arg3, jintArray arg4, jcharArray arg5, jintArray arg6, jobject arg7)
-{
- DECL_GLOB(pGlob)
- jchar *lparg2=NULL;
- jint *lparg3=NULL;
- jint *lparg4=NULL;
- jchar *lparg5=NULL;
- jint *lparg6=NULL;
- FILETIME _arg7, *lparg7=NULL;
- jint rc;
-
- DEBUG_CALL("RegEnumKeyExW\n")
-
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetCharArrayElements(env, arg5, NULL);
- if (arg6) lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL);
- if (arg7) lparg7 = getFILETIMEFields(env, arg7, &_arg7, &PGLOB(FILETIMEFc));
-
- rc = (jint)RegEnumKeyExW((HKEY)arg0, arg1, (LPWSTR)lparg2, lparg3, lparg4, (LPWSTR)lparg5, lparg6, lparg7);
-
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseCharArrayElements(env, arg5, lparg5, 0);
- if (arg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
- if (arg7) setFILETIMEFields(env, arg7, lparg7, &PGLOB(FILETIMEFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegOpenKeyExA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3, jintArray arg4)
-{
- jbyte *lparg1=NULL;
- jint *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("RegOpenKeyExA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = (jint)RegOpenKeyExA((HKEY)arg0, (LPSTR)lparg1, arg2, arg3, (PHKEY)lparg4);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegOpenKeyExW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jintArray arg4)
-{
- jchar *lparg1=NULL;
- jint *lparg4=NULL;
- jint rc;
-
- DEBUG_CALL("RegOpenKeyExW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = (jint)RegOpenKeyExW((HKEY)arg0, (LPWSTR)lparg1, arg2, arg3, (PHKEY)lparg4);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegQueryInfoKeyA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3, jintArray arg4, jintArray arg5, jintArray arg6, jintArray arg7, jintArray arg8, jintArray arg9, jintArray arg10, jint arg11)
-{
- jint *lparg2=NULL;
- jint *lparg4=NULL;
- jint *lparg5=NULL;
- jint *lparg6=NULL;
- jint *lparg7=NULL;
- jint *lparg8=NULL;
- jint *lparg9=NULL;
- jint *lparg10=NULL;
- jint rc;
-
- DEBUG_CALL("RegQueryInfoKeyA\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL);
- if (arg6) lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL);
- if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL);
- if (arg8) lparg8 = (*env)->GetIntArrayElements(env, arg8, NULL);
- if (arg9) lparg9 = (*env)->GetIntArrayElements(env, arg9, NULL);
- if (arg10) lparg10 = (*env)->GetIntArrayElements(env, arg10, NULL);
-
- rc = (jint)RegQueryInfoKeyA((HKEY)arg0, (LPTSTR)arg1, lparg2, (LPDWORD)arg3, lparg4, lparg5, lparg6, lparg7, lparg8, lparg9, lparg10, (PFILETIME)arg11);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
- if (arg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
- if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0);
- if (arg8) (*env)->ReleaseIntArrayElements(env, arg8, lparg8, 0);
- if (arg9) (*env)->ReleaseIntArrayElements(env, arg9, lparg9, 0);
- if (arg10) (*env)->ReleaseIntArrayElements(env, arg10, lparg10, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegQueryInfoKeyW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3, jintArray arg4, jintArray arg5, jintArray arg6, jintArray arg7, jintArray arg8, jintArray arg9, jintArray arg10, jint arg11)
-{
- jint *lparg2=NULL;
- jint *lparg4=NULL;
- jint *lparg5=NULL;
- jint *lparg6=NULL;
- jint *lparg7=NULL;
- jint *lparg8=NULL;
- jint *lparg9=NULL;
- jint *lparg10=NULL;
- jint rc;
-
- DEBUG_CALL("RegQueryInfoKeyW\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL);
- if (arg6) lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL);
- if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL);
- if (arg8) lparg8 = (*env)->GetIntArrayElements(env, arg8, NULL);
- if (arg9) lparg9 = (*env)->GetIntArrayElements(env, arg9, NULL);
- if (arg10) lparg10 = (*env)->GetIntArrayElements(env, arg10, NULL);
-
- rc = (jint)RegQueryInfoKeyW((HKEY)arg0, (LPWSTR)arg1, lparg2, (LPDWORD)arg3, lparg4, lparg5, lparg6, lparg7, lparg8, lparg9, lparg10, (PFILETIME)arg11);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
- if (arg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
- if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0);
- if (arg8) (*env)->ReleaseIntArrayElements(env, arg8, lparg8, 0);
- if (arg9) (*env)->ReleaseIntArrayElements(env, arg9, lparg9, 0);
- if (arg10) (*env)->ReleaseIntArrayElements(env, arg10, lparg10, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegQueryValueExA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jintArray arg3, jbyteArray arg4, jintArray arg5)
-{
- jbyte *lparg1=NULL;
- jint *lparg3=NULL;
- jbyte *lparg4=NULL;
- jint *lparg5=NULL;
- jint rc;
-
- DEBUG_CALL("RegQueryValueExA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
- if (arg4) lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL);
-
- rc = (jint)RegQueryValueExA((HKEY)arg0, (LPSTR)lparg1, (LPDWORD)arg2, lparg3, (LPBYTE)lparg4, lparg5);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegQueryValueExW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jintArray arg3, jcharArray arg4, jintArray arg5)
-{
- jchar *lparg1=NULL;
- jint *lparg3=NULL;
- jchar *lparg4=NULL;
- jint *lparg5=NULL;
- jint rc;
-
- DEBUG_CALL("RegQueryValueExW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
- if (arg4) lparg4 = (*env)->GetCharArrayElements(env, arg4, NULL);
- if (arg5) lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL);
-
- rc = (jint)RegQueryValueExW((HKEY)arg0, (LPWSTR)lparg1, (LPDWORD)arg2, lparg3, (LPBYTE)lparg4, lparg5);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg4) (*env)->ReleaseCharArrayElements(env, arg4, lparg4, 0);
- if (arg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegisterClassA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- WNDCLASS _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("RegisterClassA\n")
-
- if (arg0) lparg0 = getWNDCLASSFields(env, arg0, &_arg0, &PGLOB(WNDCLASSFc));
-
- rc = (jint)RegisterClassA(lparg0);
-
- if (arg0) setWNDCLASSFields(env, arg0, lparg0, &PGLOB(WNDCLASSFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegisterClassW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- WNDCLASS _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("RegisterClassW\n")
-
- if (arg0) lparg0 = getWNDCLASSFields(env, arg0, &_arg0, &PGLOB(WNDCLASSFc));
-
- rc = (jint)RegisterClassW((LPWNDCLASSW)lparg0);
-
- if (arg0) setWNDCLASSFields(env, arg0, lparg0, &PGLOB(WNDCLASSFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegisterClipboardFormatA
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("RegisterClipboardFormatA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jint)RegisterClipboardFormatA((LPTSTR)lparg0);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_RegisterClipboardFormatW
- (JNIEnv *env, jclass that, jcharArray arg0)
-{
- jchar *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("RegisterClipboardFormatW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = (jint)RegisterClipboardFormatW((LPWSTR)lparg0);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ReleaseCapture
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("ReleaseCapture\n")
-
- return (jboolean)ReleaseCapture();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ReleaseDC
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ReleaseDC\n")
-
- return (jint)ReleaseDC((HWND)arg0, (HDC)arg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_RemoveMenu
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("RemoveMenu\n")
-
- return (jboolean)RemoveMenu((HMENU)arg0, arg1, arg2);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_RoundRect
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6)
-{
- DEBUG_CALL("RoundRect\n")
-
- return (jboolean)RoundRect((HDC)arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SHBrowseForFolderA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- BROWSEINFO _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("SHBrowseForFolderA\n")
-
- if (arg0) lparg0 = getBROWSEINFOFields(env, arg0, &_arg0, &PGLOB(BROWSEINFOFc));
-
- rc = (jint)SHBrowseForFolderA(lparg0);
-
- if (arg0) setBROWSEINFOFields(env, arg0, lparg0, &PGLOB(BROWSEINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SHBrowseForFolderW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- BROWSEINFO _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("SHBrowseForFolderW\n")
-
- if (arg0) lparg0 = getBROWSEINFOFields(env, arg0, &_arg0, &PGLOB(BROWSEINFOFc));
-
- rc = (jint)SHBrowseForFolderW((LPBROWSEINFOW)lparg0);
-
- if (arg0) setBROWSEINFOFields(env, arg0, lparg0, &PGLOB(BROWSEINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifdef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SHCreateMenuBar
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- SHMENUBARINFO _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("SHCreateMenuBar\n")
-
- if (arg0) lparg0 = getSHMENUBARINFOFields(env, arg0, &_arg0, &PGLOB(SHMENUBARINFOFc));
-
- rc = (jboolean) SHCreateMenuBar((PSHMENUBARINFO)lparg0);
-
- if (arg0) setSHMENUBARINFOFields(env, arg0, lparg0, &PGLOB(SHMENUBARINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SHGetMalloc
- (JNIEnv *env, jclass that, jintArray arg0)
-{
- jint *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("SHGetMalloc\n")
-
- if (arg0) lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL);
-
- rc = (jint)SHGetMalloc((LPMALLOC *)lparg0);
-
- if (arg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SHGetPathFromIDListA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("SHGetPathFromIDListA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jboolean)SHGetPathFromIDListA((LPCITEMIDLIST)arg0, (LPSTR)lparg1);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SHGetPathFromIDListW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1)
-{
- jchar *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("SHGetPathFromIDListW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jboolean)SHGetPathFromIDListW((LPCITEMIDLIST)arg0, (LPWSTR)lparg1);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifdef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SHSetAppKeyWndAssoc
- (JNIEnv *env, jclass that, jbyte arg0, jint arg1)
-{
- DEBUG_CALL("SHSetAppKeyWndAssoc\n")
-
- return (jboolean) SHSetAppKeyWndAssoc((BYTE)arg0, (HWND)arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ScreenToClient
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- POINT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ScreenToClient\n")
-
- if (arg1) lparg1 = getPOINTFields(env, arg1, &_arg1, &PGLOB(POINTFc));
-
- rc = (jboolean)ScreenToClient((HWND)arg0, lparg1);
-
- if (arg1) setPOINTFields(env, arg1, lparg1, &PGLOB(POINTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ScrollWindowEx
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3, jobject arg4, jint arg5, jobject arg6, jint arg7)
-{
- DECL_GLOB(pGlob)
- RECT _arg3, *lparg3=NULL;
- RECT _arg4, *lparg4=NULL;
- RECT _arg6, *lparg6=NULL;
- jint rc;
-
- DEBUG_CALL("ScrollWindowEx\n")
-
- if (arg3) lparg3 = getRECTFields(env, arg3, &_arg3, &PGLOB(RECTFc));
- if (arg4) lparg4 = getRECTFields(env, arg4, &_arg4, &PGLOB(RECTFc));
- if (arg6) lparg6 = getRECTFields(env, arg6, &_arg6, &PGLOB(RECTFc));
-
- rc = (jint)ScrollWindowEx((HWND)arg0, arg1, arg2, lparg3, lparg4, (HRGN)arg5, lparg6, arg7);
-
- if (arg3) setRECTFields(env, arg3, lparg3, &PGLOB(RECTFc));
- if (arg4) setRECTFields(env, arg4, lparg4, &PGLOB(RECTFc));
- if (arg6) setRECTFields(env, arg6, lparg6, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SelectClipRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SelectClipRgn\n")
-
- return (jint)SelectClipRgn((HDC)arg0, (HRGN)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SelectObject
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SelectObject\n")
-
- return (jint)SelectObject((HDC)arg0, (HGDIOBJ)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SelectPalette
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2)
-{
- DEBUG_CALL("SelectPalette\n")
-
- return (jint)SelectPalette((HDC)arg0, (HPALETTE)arg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TVITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTVITEMFields(env, arg3, &_arg3, &PGLOB(TVITEMFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVITEMFields(env, arg3, lparg3, &PGLOB(TVITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TVINSERTSTRUCT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVINSERTSTRUCT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTVINSERTSTRUCTFields(env, arg3, &_arg3, &PGLOB(TVINSERTSTRUCTFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVINSERTSTRUCTFields(env, arg3, lparg3, &PGLOB(TVINSERTSTRUCTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TVHITTESTINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVHITTESTINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTVHITTESTINFOFields(env, arg3, &_arg3, &PGLOB(TVHITTESTINFOFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVHITTESTINFOFields(env, arg3, lparg3, &PGLOB(TVHITTESTINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TOOLINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TOOLINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTOOLINFOFields(env, arg3, &_arg3, &PGLOB(TOOLINFOFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTOOLINFOFields(env, arg3, lparg3, &PGLOB(TOOLINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TCITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TCITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTCITEMFields(env, arg3, &_arg3, &PGLOB(TCITEMFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTCITEMFields(env, arg3, lparg3, &PGLOB(TCITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TBBUTTONINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TBBUTTONINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTBBUTTONINFOFields(env, arg3, &_arg3, &PGLOB(TBBUTTONINFOFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTBBUTTONINFOFields(env, arg3, lparg3, &PGLOB(TBBUTTONINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_TBBUTTON_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TBBUTTON _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getTBBUTTONFields(env, arg3, &_arg3, &PGLOB(TBBUTTONFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTBBUTTONFields(env, arg3, lparg3, &PGLOB(TBBUTTONFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_RECT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getRECTFields(env, arg3, &_arg3, &PGLOB(RECTFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setRECTFields(env, arg3, lparg3, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_REBARBANDINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- REBARBANDINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getREBARBANDINFOFields(env, arg3, &_arg3, &PGLOB(REBARBANDINFOFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setREBARBANDINFOFields(env, arg3, lparg3, &PGLOB(REBARBANDINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_LVITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getLVITEMFields(env, arg3, &_arg3, &PGLOB(LVITEMFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVITEMFields(env, arg3, lparg3, &PGLOB(LVITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_LVHITTESTINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVHITTESTINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getLVHITTESTINFOFields(env, arg3, &_arg3, &PGLOB(LVHITTESTINFOFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVHITTESTINFOFields(env, arg3, lparg3, &PGLOB(LVHITTESTINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIILorg_eclipse_swt_internal_win32_LVCOLUMN_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVCOLUMN _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = getLVCOLUMNFields(env, arg3, &_arg3, &PGLOB(LVCOLUMNFc));
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVCOLUMNFields(env, arg3, lparg3, &PGLOB(LVCOLUMNFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__IIII
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SendMessageA\n")
-
- return (jint)SendMessageA((HWND)arg0, arg1, arg2, arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__III_3S
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jshortArray arg3)
-{
- jshort *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = (*env)->GetShortArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__III_3I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__III_3B
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__II_3II
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
-{
- jint *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, (WPARAM)lparg2, (LPARAM)arg3);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageA__II_3I_3I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jintArray arg3)
-{
- jint *lparg2=NULL;
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageA\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageA((HWND)arg0, arg1, (WPARAM)lparg2, (LPARAM)lparg3);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TVITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTVITEMFields(env, arg3, &_arg3, &PGLOB(TVITEMFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVITEMFields(env, arg3, lparg3, &PGLOB(TVITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TVINSERTSTRUCT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVINSERTSTRUCT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTVINSERTSTRUCTFields(env, arg3, &_arg3, &PGLOB(TVINSERTSTRUCTFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVINSERTSTRUCTFields(env, arg3, lparg3, &PGLOB(TVINSERTSTRUCTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TVHITTESTINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TVHITTESTINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTVHITTESTINFOFields(env, arg3, &_arg3, &PGLOB(TVHITTESTINFOFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTVHITTESTINFOFields(env, arg3, lparg3, &PGLOB(TVHITTESTINFOFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TOOLINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TOOLINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTOOLINFOFields(env, arg3, &_arg3, &PGLOB(TOOLINFOFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTOOLINFOFields(env, arg3, lparg3, &PGLOB(TOOLINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TCITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TCITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTCITEMFields(env, arg3, &_arg3, &PGLOB(TCITEMFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTCITEMFields(env, arg3, lparg3, &PGLOB(TCITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TBBUTTONINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TBBUTTONINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTBBUTTONINFOFields(env, arg3, &_arg3, &PGLOB(TBBUTTONINFOFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTBBUTTONINFOFields(env, arg3, lparg3, &PGLOB(TBBUTTONINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_TBBUTTON_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- TBBUTTON _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getTBBUTTONFields(env, arg3, &_arg3, &PGLOB(TBBUTTONFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setTBBUTTONFields(env, arg3, lparg3, &PGLOB(TBBUTTONFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_RECT_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getRECTFields(env, arg3, &_arg3, &PGLOB(RECTFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setRECTFields(env, arg3, lparg3, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_REBARBANDINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- REBARBANDINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getREBARBANDINFOFields(env, arg3, &_arg3, &PGLOB(REBARBANDINFOFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setREBARBANDINFOFields(env, arg3, lparg3, &PGLOB(REBARBANDINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_LVITEM_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVITEM _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getLVITEMFields(env, arg3, &_arg3, &PGLOB(LVITEMFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVITEMFields(env, arg3, lparg3, &PGLOB(LVITEMFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_LVHITTESTINFO_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVHITTESTINFO _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getLVHITTESTINFOFields(env, arg3, &_arg3, &PGLOB(LVHITTESTINFOFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVHITTESTINFOFields(env, arg3, lparg3, &PGLOB(LVHITTESTINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIILorg_eclipse_swt_internal_win32_LVCOLUMN_2
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- LVCOLUMN _arg3, *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = getLVCOLUMNFields(env, arg3, &_arg3, &PGLOB(LVCOLUMNFc));
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) setLVCOLUMNFields(env, arg3, lparg3, &PGLOB(LVCOLUMNFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__IIII
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SendMessageW\n")
-
- return (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__III_3S
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jshortArray arg3)
-{
- jshort *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = (*env)->GetShortArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__III_3I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__III_3C
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jcharArray arg3)
-{
- jchar *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg3) lparg3 = (*env)->GetCharArrayElements(env, arg3, NULL);
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, arg2, (LPARAM)lparg3);
-
- if (arg3) (*env)->ReleaseCharArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__II_3II
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
-{
- jint *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jint)SendMessageW((HWND)arg0, arg1, (WPARAM)lparg2, (LPARAM)arg3);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessageW__II_3I_3I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jintArray arg3)
-{
- jint *lparg2=NULL;
- jint *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SendMessageW\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
-#ifdef _WIN32_WCE
- /*
- * Bug on WinCE. SendMessage can fail (return 0) when being passed references
- * to parameters allocated from the heap. The workaround is to allocate
- * the parameters on the stack and to copy them back to the java array.
- * Observed on Pocket PC WinCE 3.0 with EM_GETSEL and CB_GETEDITSEL messages.
- */
- switch (arg1) {
- case EM_GETSEL:
- case CB_GETEDITSEL: {
- jint wParam = 0, lParam = 0;
- jint *lpwParam = NULL, *lplParam = NULL;
- if (lparg2 != NULL) lpwParam = &wParam;
- if (lparg3 != NULL) lplParam = &lParam;
- rc = (jint)SendMessageW((HWND)arg0, arg1, (WPARAM)lpwParam, (LPARAM)lplParam);
- if (lparg2 != NULL) lparg2[0] = wParam;
- if (lparg3 != NULL) lparg3[0] = lParam;
- break;
- }
- default:
- rc = (jint)SendMessageW((HWND)arg0, arg1, (WPARAM)lparg2, (LPARAM)lparg3);
- }
-#else
- rc = (jint)SendMessageW((HWND)arg0, arg1, (WPARAM)lparg2, (LPARAM)lparg3);
-#endif /* _WIN32_WCE */
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetActiveWindow
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("SetActiveWindow\n")
-
- return (jint)SetActiveWindow((HWND)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetBkColor
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetBkColor\n")
-
- return (jint)SetBkColor((HDC)arg0, (COLORREF)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetBkMode
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetBkMode\n")
-
- return (jint)SetBkMode((HDC)arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetCapture
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("SetCapture\n")
-
- return (jint)SetCapture((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetCaretPos
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetCaretPos\n")
-
- return (jboolean)SetCaretPos(arg0, arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetClipboardData
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetClipboardData\n")
-
- return (jint)SetClipboardData(arg0, (HANDLE)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetCursor
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("SetCursor\n")
-
- return (jint)SetCursor((HCURSOR)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetCursorPos
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetCursorPos\n")
-
- return (jboolean)SetCursorPos(arg0, arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetDIBColorTable
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SetDIBColorTable\n")
-
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)SetDIBColorTable((HDC)arg0, arg1, arg2, (RGBQUAD *)lparg3);
-
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetFocus
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("SetFocus\n")
-
- return (jint)SetFocus((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetForegroundWindow
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("SetForegroundWindow\n")
-
- return (jboolean)SetForegroundWindow((HWND)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetMenu
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetMenu\n")
-
- return (jboolean)SetMenu((HWND)arg0, (HMENU)arg1);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetMenuDefaultItem
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("SetMenuDefaultItem\n")
-
- return (jboolean)SetMenuDefaultItem((HMENU)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetMenuInfo
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- MENUINFO _arg1, *lparg1=NULL;
- jboolean rc = (jboolean)FALSE;
- HMODULE hm;
- FARPROC fp;
-
- DEBUG_CALL("SetMenuInfo\n")
-
- /*
- * SetMenuInfo is a Win2000 and Win98 specific call
- * If you link it into swt.dll a system modal entry point not found dialog will
- * appear as soon as swt.dll is loaded. Here we check for the entry point and
- * only do the call if it exists.
- */
- if ((hm=GetModuleHandle("user32.dll")) && (fp=GetProcAddress(hm, "SetMenuInfo"))) {
-
- if (arg1) lparg1 = getMENUINFOFields(env, arg1, &_arg1, &PGLOB(MENUINFOFc));
-
- rc = (jboolean) (fp)((HMENU)arg0, lparg1);
-// rc = (jboolean)SetMenuInfo(arg0, lparg1);
-
- if (arg1) setMENUINFOFields(env, arg1, lparg1, &PGLOB(MENUINFOFc));
- }
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetMenuItemInfoA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetMenuItemInfoA\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)SetMenuItemInfoA((HMENU)arg0, arg1, arg2, lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetMenuItemInfoW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- MENUITEMINFO _arg3, *lparg3=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetMenuItemInfoW\n")
-
- if (arg3) lparg3 = getMENUITEMINFOFields(env, arg3, &_arg3, &PGLOB(MENUITEMINFOFc));
-
- rc = (jboolean)SetMenuItemInfoW((HMENU)arg0, arg1, arg2, (LPMENUITEMINFOW)lparg3);
-
- if (arg3) setMENUITEMINFOFields(env, arg3, lparg3, &PGLOB(MENUITEMINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetPaletteEntries
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("SetPaletteEntries\n")
-
- if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL);
-
- rc = (jint)SetPaletteEntries((HPALETTE)arg0, arg1, arg2, (PALETTEENTRY *)lparg3);
-
- if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetParent
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetParent\n")
-
- return (jint)SetParent((HWND)arg0, (HWND)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetPixel
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SetPixel\n")
-
- return (jint)SetPixel((HDC)arg0, arg1, arg2, arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetROP2
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetROP2\n")
-
- return (jint)SetROP2((HDC)arg0, arg1);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetRect
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- RECT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetRect\n")
-
- if (arg0) lparg0 = getRECTFields(env, arg0, &_arg0, &PGLOB(RECTFc));
-
- rc = (jboolean)SetRect(lparg0, arg1, arg2, arg3, arg4);
-
- if (arg0) setRECTFields(env, arg0, lparg0, &PGLOB(RECTFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetRectRgn
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DEBUG_CALL("SetRectRgn\n")
-
- return (jboolean)SetRectRgn((HRGN)arg0, arg1, arg2, arg3, arg4);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetScrollInfo
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jboolean arg3)
-{
- DECL_GLOB(pGlob)
- SCROLLINFO _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetScrollInfo\n")
-
- if (arg2) lparg2 = getSCROLLINFOFields(env, arg2, &_arg2, &PGLOB(SCROLLINFOFc));
-
- rc = (jboolean)SetScrollInfo((HWND)arg0, arg1, lparg2, arg3);
-
- if (arg2) setSCROLLINFOFields(env, arg2, lparg2, &PGLOB(SCROLLINFOFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetStretchBltMode
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetStretchBltMode\n")
-
- return (jint)SetStretchBltMode((HDC)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetTextAlign
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetTextAlign\n")
-
- return (jint)SetTextAlign((HDC)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetTextColor
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("SetTextColor\n")
-
- return (jint)SetTextColor((HDC)arg0, (COLORREF)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetTimer
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SetTimer\n")
-
- return (jint)SetTimer((HWND)arg0, arg1, arg2, (TIMERPROC)arg3);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowLongA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("SetWindowLongA\n")
-
- return (jint)SetWindowLongA((HWND)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowLongW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- DEBUG_CALL("SetWindowLongW\n")
-
- return (jint)SetWindowLongW((HWND)arg0, arg1, arg2);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowPlacement
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- WINDOWPLACEMENT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetWindowPlacement\n")
-
- if (arg1) lparg1 = getWINDOWPLACEMENTFields(env, arg1, &_arg1, &PGLOB(WINDOWPLACEMENTFc));
-
- rc = (jboolean)SetWindowPlacement((HWND)arg0, lparg1);
-
- if (arg1) setWINDOWPLACEMENTFields(env, arg1, lparg1, &PGLOB(WINDOWPLACEMENTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowPos
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6)
-{
- DEBUG_CALL("SetWindowPos\n")
-
- return (jboolean)SetWindowPos((HWND)arg0, (HWND)arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowTextA
- (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetWindowTextA\n")
-
- if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL);
-
- rc = (jboolean)SetWindowTextA((HWND)arg0, (LPSTR)lparg1);
-
- if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowTextW
- (JNIEnv *env, jclass that, jint arg0, jcharArray arg1)
-{
- jchar *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("SetWindowTextW\n")
-
- if (arg1) lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = (jboolean)SetWindowTextW((HWND)arg0, (LPWSTR)lparg1);
-
- if (arg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowsHookExA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SetWindowsHookExA\n")
-
- return (jint)SetWindowsHookExA(arg0, (HOOKPROC)arg1, (HINSTANCE)arg2, arg3);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowsHookExW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
-{
- DEBUG_CALL("SetWindowsHookExW\n")
-
- return (jint)SetWindowsHookExW(arg0, (HOOKPROC)arg1, (HINSTANCE)arg2, arg3);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShellExecuteExA
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- SHELLEXECUTEINFO _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ShellExecuteExA\n")
-
- if (arg0) lparg0 = getSHELLEXECUTEINFOFields(env, arg0, &_arg0, &PGLOB(SHELLEXECUTEINFOFc));
-
- rc = (jboolean)ShellExecuteExA(lparg0);
-
- if (arg0) setSHELLEXECUTEINFOFields(env, arg0, lparg0, &PGLOB(SHELLEXECUTEINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifdef _WIN32_WCE
-#define ShellExecuteExW ShellExecuteEx
-#define LPSHELLEXECUTEINFOW LPSHELLEXECUTEINFO
-#endif // _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShellExecuteExW
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- SHELLEXECUTEINFO _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("ShellExecuteExW\n")
-
- if (arg0) lparg0 = getSHELLEXECUTEINFOFields(env, arg0, &_arg0, &PGLOB(SHELLEXECUTEINFOFc));
-
- rc = (jboolean)ShellExecuteExW((LPSHELLEXECUTEINFOW)lparg0);
-
- if (arg0) setSHELLEXECUTEINFOFields(env, arg0, lparg0, &PGLOB(SHELLEXECUTEINFOFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShowCaret
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("ShowCaret\n")
-
- return (jboolean)ShowCaret((HWND)arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShowOwnedPopups
- (JNIEnv *env, jclass that, jint arg0, jboolean arg1)
-{
- DEBUG_CALL("ShowOwnedPopups\n")
-
- return (jboolean)ShowOwnedPopups((HWND)arg0, arg1);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShowScrollBar
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jboolean arg2)
-{
- DEBUG_CALL("ShowScrollBar\n")
-
- return (jboolean)ShowScrollBar((HWND)arg0, arg1, arg2);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ShowWindow
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- DEBUG_CALL("ShowWindow\n")
-
- return (jboolean)ShowWindow((HWND)arg0, arg1);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_StartDocA
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- DOCINFO _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("StartDocA\n")
-
- if (arg1) lparg1 = getDOCINFOFields(env, arg1, &_arg1, &PGLOB(DOCINFOFc));
-
- rc = (jint)StartDocA((HDC)arg0, lparg1);
-
- if (arg1) setDOCINFOFields(env, arg1, lparg1, &PGLOB(DOCINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_StartDocW
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- DOCINFO _arg1, *lparg1=NULL;
- jint rc;
-
- DEBUG_CALL("StartDocW\n")
-
- if (arg1) lparg1 = getDOCINFOFields(env, arg1, &_arg1, &PGLOB(DOCINFOFc));
-
- rc = (jint)StartDocW((HDC)arg0, (LPDOCINFOW)lparg1);
-
- if (arg1) setDOCINFOFields(env, arg1, lparg1, &PGLOB(DOCINFOFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_StartPage
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("StartPage\n")
-
- return (jint)StartPage((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_StretchBlt
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10)
-{
- DEBUG_CALL("StretchBlt\n")
-
- return (jboolean)StretchBlt((HDC)arg0, arg1, arg2, arg3, arg4, (HDC)arg5, arg6, arg7, arg8, arg9, arg10);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoA__IILorg_eclipse_swt_internal_win32_RECT_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoA__IILorg_eclipse_swt_internal_win32_RECT_2I\n")
-
- if (arg2) lparg2 = getRECTFields(env, arg2, &_arg2, &PGLOB(RECTFc));
-
- rc = (jboolean)SystemParametersInfoA(arg0, arg1, lparg2, arg3);
-
- if (arg2) setRECTFields(env, arg2, lparg2, &PGLOB(RECTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoW__IILorg_eclipse_swt_internal_win32_RECT_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- RECT _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoW__IILorg_eclipse_swt_internal_win32_RECT_2I\n")
-
- if (arg2) lparg2 = getRECTFields(env, arg2, &_arg2, &PGLOB(RECTFc));
-
- rc = (jboolean)SystemParametersInfoW(arg0, arg1, lparg2, arg3);
-
- if (arg2) setRECTFields(env, arg2, lparg2, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoA__IILorg_eclipse_swt_internal_win32_NONCLIENTMETRICS_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- NONCLIENTMETRICSA _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoA__IILorg_eclipse_swt_internal_win32_NONCLIENTMETRICS_2I\n")
-
- if (arg2) lparg2 = getNONCLIENTMETRICSAFields(env, arg2, &_arg2, &PGLOB(NONCLIENTMETRICSFc));
-
- rc = (jboolean)SystemParametersInfoA(arg0, arg1, lparg2, arg3);
-
- if (arg2) setNONCLIENTMETRICSAFields(env, arg2, lparg2, &PGLOB(NONCLIENTMETRICSFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoW__IILorg_eclipse_swt_internal_win32_NONCLIENTMETRICS_2I
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- NONCLIENTMETRICSW _arg2, *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoW__IILorg_eclipse_swt_internal_win32_NONCLIENTMETRICS_2I\n")
-
- if (arg2) lparg2 = getNONCLIENTMETRICSWFields(env, arg2, &_arg2, &PGLOB(NONCLIENTMETRICSFc));
-
- rc = (jboolean)SystemParametersInfoW(arg0, arg1, lparg2, arg3);
-
- if (arg2) setNONCLIENTMETRICSWFields(env, arg2, lparg2, &PGLOB(NONCLIENTMETRICSFc));
-
- return rc;
-}
-
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoA__II_3II
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- jint *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoA__II_3II\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jboolean)SystemParametersInfoA(arg0, arg1, lparg2, arg3);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_SystemParametersInfoW__II_3II
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- jint *lparg2=NULL;
- jboolean rc;
-
- DEBUG_CALL("SystemParametersInfoW__II_3II\n")
-
- if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = (jboolean)SystemParametersInfoW(arg0, arg1, lparg2, arg3);
-
- if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ToAscii
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jshortArray arg3, jint arg4)
-{
- jbyte *lparg2=NULL;
- jshort *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("ToAscii\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetShortArrayElements(env, arg3, NULL);
-
- rc = (jint)ToAscii(arg0, arg1, (PBYTE)lparg2, (LPWORD)lparg3, arg4);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_ToUnicode
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jcharArray arg3, jint arg4, jint arg5)
-{
- jbyte *lparg2=NULL;
- jchar *lparg3=NULL;
- jint rc;
-
- DEBUG_CALL("ToUnicode\n")
-
- if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL);
- if (arg3) lparg3 = (*env)->GetCharArrayElements(env, arg3, NULL);
-
- rc = (jint)ToUnicode(arg0, arg1, (PBYTE)lparg2, (LPWSTR)lparg3, arg4, arg5);
-
- if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
- if (arg3) (*env)->ReleaseCharArrayElements(env, arg3, lparg3, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_TrackMouseEvent
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- TRACKMOUSEEVENT _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("TrackMouseEvent\n")
-
- if (arg0) lparg0 = getTRACKMOUSEEVENTFields(env, arg0, &_arg0, &PGLOB(TRACKMOUSEEVENTFc));
-
- rc = (jboolean)_TrackMouseEvent(lparg0);
-
- if (arg0) setTRACKMOUSEEVENTFields(env, arg0, lparg0, &PGLOB(TRACKMOUSEEVENTFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_TrackPopupMenu
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jobject arg6)
-{
- DECL_GLOB(pGlob)
- RECT _arg6, *lparg6=NULL;
- jboolean rc;
-
- DEBUG_CALL("TrackPopupMenu\n")
-
- if (arg6) lparg6 = getRECTFields(env, arg6, &_arg6, &PGLOB(RECTFc));
-
- rc = (jboolean)TrackPopupMenu((HMENU)arg0, arg1, arg2, arg3, arg4, (HWND)arg5, lparg6);
-
- if (arg6) setRECTFields(env, arg6, lparg6, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_TranslateAcceleratorA
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- MSG _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("TranslateAcceleratorA\n")
-
- if (arg2) lparg2 = getMSGFields(env, arg2, &_arg2, &PGLOB(MSGFc));
-
- rc = (jint)TranslateAcceleratorA((HWND)arg0, (HACCEL)arg1, lparg2);
-
- if (arg2) setMSGFields(env, arg2, lparg2, &PGLOB(MSGFc));
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_TranslateAcceleratorW
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
-{
- DECL_GLOB(pGlob)
- MSG _arg2, *lparg2=NULL;
- jint rc;
-
- DEBUG_CALL("TranslateAcceleratorW\n")
-
- if (arg2) lparg2 = getMSGFields(env, arg2, &_arg2, &PGLOB(MSGFc));
-
- rc = (jint)TranslateAcceleratorW((HWND)arg0, (HACCEL)arg1, lparg2);
-
- if (arg2) setMSGFields(env, arg2, lparg2, &PGLOB(MSGFc));
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_TranslateCharsetInfo
- (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jint arg2)
-{
- jint *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("TranslateCharsetInfo\n")
-
- if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = (jboolean)TranslateCharsetInfo((DWORD *)arg0, (LPCHARSETINFO)lparg1, arg2);
-
- if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_TranslateMessage
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- MSG _arg0, *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("TranslateMessage\n")
-
- if (arg0) lparg0 = getMSGFields(env, arg0, &_arg0, &PGLOB(MSGFc));
-
- rc = (jboolean)TranslateMessage(lparg0);
-
- if (arg0) setMSGFields(env, arg0, lparg0, &PGLOB(MSGFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_UnhookWindowsHookEx
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("UnhookWindowsHookEx\n")
-
- return (jboolean)UnhookWindowsHookEx((HHOOK)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_UnregisterClassA
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
-{
- jbyte *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("UnregisterClassA\n")
-
- if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
-
- rc = (jboolean)UnregisterClassA((LPSTR)lparg0, (HINSTANCE)arg1);
-
- if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_UnregisterClassW
- (JNIEnv *env, jclass that, jcharArray arg0, jint arg1)
-{
- jchar *lparg0=NULL;
- jboolean rc;
-
- DEBUG_CALL("UnregisterClassW\n")
-
- if (arg0) lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = (jboolean)UnregisterClassW((LPWSTR)lparg0, (HINSTANCE)arg1);
-
- if (arg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0);
-
- return rc;
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_UpdateWindow
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("UpdateWindow\n")
-
- return (jboolean)UpdateWindow((HWND)arg0);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_ValidateRect
- (JNIEnv *env, jclass that, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT _arg1, *lparg1=NULL;
- jboolean rc;
-
- DEBUG_CALL("ValidateRect\n")
-
- if (arg1) lparg1 = getRECTFields(env, arg1, &_arg1, &PGLOB(RECTFc));
-
- rc = (jboolean)ValidateRect((HWND)arg0, lparg1);
-
- if (arg1) setRECTFields(env, arg1, lparg1, &PGLOB(RECTFc));
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_VkKeyScanA
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("VkKeyScanA\n")
-
- return (jshort)VkKeyScanA((TCHAR)arg0);
-}
-#endif // _WIN32_WCE
-
-#ifndef _WIN32_WCE
-JNIEXPORT jshort JNICALL Java_org_eclipse_swt_internal_win32_OS_VkKeyScanW
- (JNIEnv *env, jclass that, jshort arg0)
-{
- DEBUG_CALL("VkKeyScanW\n")
-
- return (jshort)VkKeyScanW((WCHAR)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_VtblCall
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0)
-{
- P_OLE_FN_2 fn;
-
- DEBUG_CALL("VtblCall\n")
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- return fn(ppVtbl, arg0);
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_WaitMessage
- (JNIEnv *env, jclass that)
-{
- DEBUG_CALL("WaitMessage\n")
-
- return (jboolean)WaitMessage();
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_WideCharToMultiByte
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jcharArray arg2, jint arg3, jbyteArray arg4, jint arg5, jbyteArray arg6, jbooleanArray arg7)
-{
- jchar *lparg2=NULL;
- jbyte *lparg4=NULL;
- jbyte *lparg6=NULL;
- jboolean *lparg7=NULL;
- jint rc;
-
- DEBUG_CALL("WideCharToMultiByte\n")
-
- if (arg2) lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL);
- if (arg4) lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL);
- if (arg6) lparg6 = (*env)->GetByteArrayElements(env, arg6, NULL);
- if (arg7) lparg7 = (*env)->GetBooleanArrayElements(env, arg7, NULL);
-
- rc = (jint)WideCharToMultiByte(arg0, arg1, (LPCWSTR)lparg2, arg3, (LPSTR)lparg4, arg5, (LPCSTR)lparg6, (LPBOOL)lparg7);
-
- if (arg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
- if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
- if (arg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
- if (arg7) (*env)->ReleaseBooleanArrayElements(env, arg7, lparg7, 0);
-
- return rc;
-}
-
-#ifndef _WIN32_WCE
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_WindowFromDC
- (JNIEnv *env, jclass that, jint arg0)
-{
- DEBUG_CALL("WindowFromDC\n")
-
- return (jint)WindowFromDC((HDC)arg0);
-}
-#endif // _WIN32_WCE
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_WindowFromPoint
- (JNIEnv *env, jclass that, jobject arg0)
-{
- DECL_GLOB(pGlob)
- POINT _arg0, *lparg0=NULL;
- jint rc;
-
- DEBUG_CALL("WindowFromPoint\n")
-
- if (arg0) lparg0 = getPOINTFields(env, arg0, &_arg0, &PGLOB(POINTFc));
-
- rc = (jint)WindowFromPoint(*lparg0);
-
- if (arg0) setPOINTFields(env, arg0, lparg0, &PGLOB(POINTFc));
-
- return rc;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.rc b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.rc
deleted file mode 100644
index 6e8ec46b78..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.rc
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-#include "windows.h"
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION SWT_COMMA_VERSION
- PRODUCTVERSION 0,0,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40000L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "IBM Corporation\0"
- VALUE "FileDescription", "Standard Widget Toolkit\0"
- VALUE "FileVersion", SWT_FILE_VERSION
- VALUE "InternalName", "SWT\0"
- VALUE "LegalCopyright", "© Copyright IBM Corp. 2000, 2001. All Rights Reserved.\0"
- VALUE "OriginalFilename", SWT_ORG_FILENAME
- VALUE "ProductName", "\0"
- VALUE "ProductVersion", "0,0,0,0\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-/* SHMENUBAR Pocket PC
- * ID_MENU SHMENUBAR DISCARDABLE
- * BEGIN
- * ID_MENU, 1,
- * IMAGE_NONE, ID_MENU_ITEM1, 0, 0,
- * 0, 0, 0,
- * END
- * ID_MENU MENU DISCARDABLE
- * BEGIN
- * MENUITEM "", ID_MENU_ITEM1
- * END
- */
-100 RCDATA DISCARDABLE
-BEGIN
- 100, 1,
- -2, 101, 0, 0,
- 0, 0, 0,
-END
-
-100 MENU DISCARDABLE
-BEGIN
- MENUITEM "", 101
-END \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c
deleted file mode 100644
index 32081cc98a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c
+++ /dev/null
@@ -1,3256 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-#include "swt.h"
-#include "structs.h"
-
-#define cacheGuidFids cacheGUIDFids
-#define getGuidFields getGUIDFields
-#define setGuidFields setGUIDFields
-#define GuidFc GUIDFc
-#define cacheDropfilesFids cacheDROPFILESFids
-#define getDropfilesFields getDROPFILESFields
-#define setDropfilesFields setDROPFILESFields
-#define DropfilesFc DROPFILESFc
-#define cacheFormatetcFids cacheFORMATETCFids
-#define getFormatetcFields getFORMATETCFields
-#define setFormatetcFields setFORMATETCFields
-#define FormatetcFc FORMATETCFc
-#define cacheOleinplaceframeinfoFids cacheOLEINPLACEFRAMEINFOFids
-#define getOleinplaceframeinfoFields getOLEINPLACEFRAMEINFOFields
-#define setOleinplaceframeinfoFields setOLEINPLACEFRAMEINFOFields
-#define OleinplaceframeinfoFc OLEINPLACEFRAMEINFOFc
-#define cacheStatstgFids cacheSTATSTGFids
-#define getStatstgFields getSTATSTGFields
-#define setStatstgFields setSTATSTGFields
-#define StatstgFc STATSTGFc
-#define cacheStgmediumFids cacheSTGMEDIUMFids
-#define getStgmediumFields getSTGMEDIUMFields
-#define setStgmediumFields setSTGMEDIUMFields
-#define StgmediumFc STGMEDIUMFc
-#define cacheDispparamsFids cacheDISPPARAMSFids
-#define getDispparamsFields getDISPPARAMSFields
-#define setDispparamsFields setDISPPARAMSFields
-#define DispparamsFc DISPPARAMSFc
-#define cacheTypeattrFids cacheTYPEATTRFids
-#define getTypeattrFields getTYPEATTRFields
-#define setTypeattrFields setTYPEATTRFields
-#define TypeattrFc TYPEATTRFc
-#define cacheRectFids cacheRECTFids
-#define getRectFields getRECTFields
-#define setRectFields setRECTFields
-#define RectFc RECTFc
-#define cacheFuncdesc1Fids cacheFUNCDESC1Fids
-#define getFuncdesc1Fields getFUNCDESC1Fields
-#define setFuncdesc1Fields setFUNCDESC1Fields
-#define Funcdesc1Fc FUNCDESC1Fc
-#define cacheFuncdesc2Fids cacheFUNCDESC2Fids
-#define getFuncdesc2Fields getFUNCDESC2Fields
-#define setFuncdesc2Fields setFUNCDESC2Fields
-#define Funcdesc2Fc FUNCDESC2Fc
-#define cacheVardesc1Fids cacheVARDESC1Fids
-#define getVardesc1Fields getVARDESC1Fields
-#define setVardesc1Fields setVARDESC1Fields
-#define Vardesc1Fc VARDESC1Fc
-#define cacheVardesc2Fids cacheVARDESC2Fids
-#define getVardesc2Fields getVARDESC2Fields
-#define setVardesc2Fields setVARDESC2Fields
-#define Vardesc2Fc VARDESC2Fc
-#define cacheDvtargetdeviceFids cacheDVTARGETDEVICEFids
-#define getDvtargetdeviceFields getDVTARGETDEVICEFields
-#define setDvtargetdeviceFields setDVTARGETDEVICEFields
-#define DvtargetdeviceFc DVTARGETDEVICEFc
-#define cacheSizeFids cacheSIZEFids
-#define getSizeFields getSIZEFields
-#define setSizeFields setSIZEFields
-#define SizeFc SIZEFc
-#define cacheExcepinfoFids cacheEXCEPINFOFids
-#define getExcepinfoFields getEXCEPINFOFields
-#define setExcepinfoFields setEXCEPINFOFields
-#define ExcepinfoFc EXCEPINFOFc
-#define cacheMsgFids cacheMSGFids
-#define getMsgFields getMSGFields
-#define setMsgFields setMSGFields
-#define MsgFc MSGFc
-#define cacheCauuidFids cacheCAUUIDFids
-#define getCauuidFields getCAUUIDFields
-#define setCauuidFields setCAUUIDFields
-#define CauuidFc CAUUIDFc
-#define cacheControlinfoFids cacheCONTROLINFOFids
-#define getControlinfoFields getCONTROLINFOFields
-#define setControlinfoFields setCONTROLINFOFields
-#define ControlinfoFc CONTROLINFOFc
-#define cacheOlecmdFids cacheOLECMDFids
-#define getOlecmdFields getOLECMDFields
-#define setOlecmdFields setOLECMDFields
-#define OlecmdFc OLECMDFc
-#define cacheOlecmdtextFids cacheOLECMDTEXTFids
-#define getOlecmdtextFields getOLECMDTEXTFields
-#define setOlecmdtextFields setOLECMDTEXTFields
-#define OlecmdtextFc OLECMDTEXTFc
-#define cacheLicinfoFids cacheLICINFOFids
-#define getLicinfoFields getLICINFOFields
-#define setLicinfoFields setLICINFOFields
-#define LicinfoFc LICINFOFc
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CLSIDFromProgID
- * Signature: ([CLorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CLSIDFromProgID
- (JNIEnv *env, jclass that, jcharArray lpszProgID, jobject pclsid)
-{
- DECL_GLOB(pGlob)
- LPCOLESTR lpszProgID1=NULL;
- GUID guid, *pclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CLSIDFromProgID\n");
-#endif
-
- if (pclsid) {
- pclsid1=&guid;
- cacheGuidFids(env, pclsid, &PGLOB(GuidFc));
- getGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
-
- if (lpszProgID)
- lpszProgID1 = (LPCOLESTR)(*env)->GetCharArrayElements(env, lpszProgID, NULL);
-
- rc = (jint) CLSIDFromProgID(lpszProgID1, pclsid1);
-
- if (lpszProgID)
- (*env)->ReleaseCharArrayElements(env, lpszProgID, (jchar *)lpszProgID1, 0);
-
- if (pclsid) {
- setGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CLSIDFromString
- * Signature: ([CLorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CLSIDFromString
- (JNIEnv *env, jclass that, jcharArray lpsz, jobject pclsid)
-{
- DECL_GLOB(pGlob)
- LPOLESTR lpsz1=NULL;
- GUID guid, *pclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CLSIDFromString\n");
-#endif
- if (pclsid) {
- pclsid1=&guid;
- cacheGuidFids(env, pclsid, &PGLOB(GuidFc));
- getGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
-
- if (lpsz)
- lpsz1 = (LPOLESTR)(*env)->GetCharArrayElements(env, lpsz, NULL);
-
- rc = CLSIDFromString(lpsz1, pclsid1);
-
- if (lpsz)
- (*env)->ReleaseCharArrayElements(env, lpsz, lpsz1, 0);
-
- if (pclsid) {
- setGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoCreateInstance
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;IILorg/eclipse/swt/internal/ole/win32/GUID;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoCreateInstance
- (JNIEnv *env, jclass that, jobject rclsid, jint pUnkOuter, jint dwClsContext, jobject riid, jintArray ppv)
-{
- DECL_GLOB(pGlob)
- LPVOID *ppv1=NULL;
- GUID guid1, guid2, *riid1=NULL, *rclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoCreateInstance\n");
-#endif
-
- if (rclsid) {
- rclsid1=&guid2;
- cacheGuidFids(env, rclsid, &PGLOB(GuidFc));
- getGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- if (riid) {
- riid1=&guid1;
- cacheGuidFids(env, riid, &PGLOB(GuidFc));
- getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
-
- if (ppv)
- ppv1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppv, NULL);
-
- rc = (jint) CoCreateInstance(rclsid1, (LPUNKNOWN)pUnkOuter, dwClsContext, riid1, ppv1);
-
- if (ppv)
- (*env)->ReleaseIntArrayElements(env, ppv, (jint *)ppv1, 0);
-
- if (rclsid) {
- setGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- if (riid) {
- setGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoFreeUnusedLibraries
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoFreeUnusedLibraries
- (JNIEnv *env, jclass that)
-{
- CoFreeUnusedLibraries();
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoGetClassObject
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;IILorg/eclipse/swt/internal/ole/win32/GUID;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoGetClassObject
- (JNIEnv *env, jclass that, jobject rclsid, jint dwClsContext, jint pServerInfo,
- jobject riid, jintArray ppv)
-{
- DECL_GLOB(pGlob)
- LPVOID *ppv1=NULL;
- GUID guid1, *rclsid1=NULL;
- GUID guid2, *riid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoGetClassObject\n");
-#endif
-
- if (rclsid) {
- rclsid1=&guid1;
- cacheGuidFids(env, rclsid, &PGLOB(GuidFc));
- getGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- if (riid) {
- riid1=&guid2;
- cacheGuidFids(env, riid, &PGLOB(GuidFc));
- getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- if (ppv)
- ppv1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppv, NULL);
-
- rc = (jint) CoGetClassObject(rclsid1, dwClsContext, (COSERVERINFO *)pServerInfo, riid1, ppv1);
- if (ppv)
- (*env)->ReleaseIntArrayElements(env, ppv, (jint *)ppv1, 0);
-
- if (rclsid) {
- setGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- if (riid) {
- setGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoLockObjectExternal
- * Signature: (IZZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoLockObjectExternal
- (JNIEnv *env, jclass that, jint pUnk, jboolean fLock, jboolean fLastUnlockReleases)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoLockObjectExternal\n");
-#endif
- return (jint) CoLockObjectExternal((IUnknown *)pUnk, (BOOL)fLock, (BOOL)fLastUnlockReleases);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoTaskMemAlloc
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoTaskMemAlloc
- (JNIEnv *env, jclass that, jint cb)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoTaskMemAlloc\n");
-#endif
- return (jint) CoTaskMemAlloc((ULONG)cb);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoTaskMemFree
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoTaskMemFree
- (JNIEnv *env, jclass that, jint pv)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoTaskMemFree\n");
-#endif
- CoTaskMemFree((LPVOID)pv);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: DoDragDrop
- * Signature: (III[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_DoDragDrop
- (JNIEnv *env, jclass that, jint pDataObject, jint pDropSource, jint dwOKEffect, jintArray pdwEffect)
-{
- jint *pdwEffect1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DoDragDrop\n");
-#endif
-
- if (pdwEffect)
- pdwEffect1 = (*env)->GetIntArrayElements(env, pdwEffect, NULL);
-
- rc = DoDragDrop((IDataObject *)pDataObject, (IDropSource *)pDropSource, dwOKEffect, pdwEffect1);
-
- if (pdwEffect)
- (*env)->ReleaseIntArrayElements(env, pdwEffect, pdwEffect1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: GetClassFile
- * Signature: ([CLorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_GetClassFile
- (JNIEnv *env, jclass that, jcharArray szFileName, jobject clsid)
-{
- DECL_GLOB(pGlob)
- LPCWSTR szFileName1=NULL;
- GUID guid, *clsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "GetClassFile\n");
-#endif
- if (clsid) {
- clsid1=&guid;
- cacheGuidFids(env, clsid, &PGLOB(GuidFc));
- getGuidFields(env, clsid, clsid1, &PGLOB(GuidFc));
- }
-
- if (szFileName)
- szFileName1 = (LPCWSTR)(*env)->GetCharArrayElements(env, szFileName, NULL);
-
- rc = GetClassFile(szFileName1, clsid1);
-
- if (szFileName)
- (*env)->ReleaseCharArrayElements(env, szFileName, (jchar *)szFileName1, 0);
-
- if (clsid) {
- setGuidFields(env, clsid, clsid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: IIDFromString
- * Signature: ([CLorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_IIDFromString
- (JNIEnv *env, jclass that, jcharArray lpsz, jobject lpiid)
-{
- DECL_GLOB(pGlob)
- LPOLESTR lpsz1=NULL;
- GUID guid, *lpiid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "IIDFromString\n");
-#endif
-
- if (lpsz)
- lpsz1 = (LPOLESTR)(*env)->GetCharArrayElements(env, lpsz, NULL);
-
- if (lpiid) {
- lpiid1=&guid;
- cacheGuidFids(env, lpiid, &PGLOB(GuidFc));
- getGuidFields(env, lpiid, lpiid1, &PGLOB(GuidFc));
- }
-
- rc = (jint) IIDFromString(lpsz1, lpiid1);
-
- if (lpiid) {
- setGuidFields(env, lpiid, lpiid1, &PGLOB(GuidFc));
- }
-
- if (lpsz)
- (*env)->ReleaseCharArrayElements(env, lpsz, (jchar *)lpsz1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: IsEqualGUID
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;Lorg/eclipse/swt/internal/ole/win32/GUID;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_IsEqualGUID
- (JNIEnv *env, jclass that, jobject rguid1, jobject rguid2)
-{
- DECL_GLOB(pGlob)
- GUID guid1, *rguid11=NULL;
- GUID guid2, *rguid21=NULL;
- jboolean rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "IsEqualGUID\n");
-#endif
-
- if (rguid1) {
- rguid11=&guid1;
- cacheGuidFids(env, rguid1, &PGLOB(GuidFc));
- getGuidFields(env, rguid1, rguid11, &PGLOB(GuidFc));
- }
-
- if (rguid2) {
- rguid21=&guid2;
- cacheGuidFids(env, rguid2, &PGLOB(GuidFc));
- getGuidFields(env, rguid2, rguid21, &PGLOB(GuidFc));
- }
-
- rc = (jboolean) IsEqualGUID(rguid11, rguid21);
-
- if (rguid1) {
- setGuidFields(env, rguid1, rguid11, &PGLOB(GuidFc));
- }
- if (rguid2) {
- setGuidFields(env, rguid2, rguid21, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/FORMATETC;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_FORMATETC_2I
- (JNIEnv *env, jclass that, jint Destination, jobject Source, jint Length)
-{
- DECL_GLOB(pGlob)
- FORMATETC formatetc, *Source1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_FORMATETC_2I\n");
-#endif
-
- if (Source) {
- Source1=&formatetc;
- cacheFormatetcFids(env, Source, &PGLOB(FormatetcFc));
- getFormatetcFields(env, Source, Source1, &PGLOB(FormatetcFc));
- }
- MoveMemory((PVOID)Destination, Source1, Length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/GUID;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_GUID_2I
- (JNIEnv *env, jclass that, jint DestinationPtr, jobject Source, jint Length)
-{
- DECL_GLOB(pGlob)
- GUID guid, *Source1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "MoveMemory__ILorg_eclipse_swt_internal_ole_win32_GUID_2I\n");
-#endif
-
- if (Source) {
- Source1=&guid;
- cacheGuidFids(env, Source, &PGLOB(GuidFc));
- getGuidFields(env, Source, Source1, &PGLOB(GuidFc));
- }
- MoveMemory((PVOID)DestinationPtr, Source1, Length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_OLEINPLACEFRAMEINFO_2I
- (JNIEnv *env, jclass that, jint DestinationPtr, jobject Source, jint Length)
-{
- DECL_GLOB(pGlob)
- OLEINPLACEFRAMEINFO oleinplaceframeinfo, *Source1=&oleinplaceframeinfo;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_OLEINPLACEFRAMEINFO_2I\n");
-#endif
-
- if (Source) {
- cacheOleinplaceframeinfoFids(env, Source, &PGLOB(OleinplaceframeinfoFc));
- getOleinplaceframeinfoFields(env, Source, Source1, &PGLOB(OleinplaceframeinfoFc));
- }
-
- MoveMemory((PVOID)DestinationPtr, Source1, Length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/STATSTG;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_STATSTG_2I
- (JNIEnv *env, jclass that, jint Destination, jobject Source, jint Length)
-{
- DECL_GLOB(pGlob)
- STATSTG statstg, *Source1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_STATSTG_2I\n");
-#endif
-
- if (Source) {
- Source1=&statstg;
- cacheStatstgFids(env, Source, &PGLOB(StatstgFc));
- getStatstgFields(env, Source, Source1, &PGLOB(StatstgFc));
- }
- MoveMemory((PVOID)Destination, Source1, Length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/STGMEDIUM;I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2I
- (JNIEnv *env, jclass that, jint Destination, jobject Source, jint Length)
-{
- DECL_GLOB(pGlob)
- STGMEDIUM stgmedium, *Source1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2I\n");
-#endif
-
- if (Source) {
- Source1=&stgmedium;
- cacheStgmediumFids(env, Source, &PGLOB(StgmediumFc));
- getStgmediumFields(env, Source, Source1, &PGLOB(StgmediumFc));
- }
- MoveMemory((PVOID)Destination, Source1, Length);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/STGMEDIUM;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2II
- (JNIEnv *env, jclass that, jobject Destination, jint SourcePtr, jint Length)
-{
- DECL_GLOB(pGlob)
- STGMEDIUM stgmedium, *Destination1=&stgmedium;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2II\n");
-#endif
-
- MoveMemory((PVOID)Destination1, (CONST VOID *)SourcePtr, Length);
-
- if (Destination) {
- cacheStgmediumFids(env, Destination, &PGLOB(StgmediumFc));
- setStgmediumFields(env, Destination, Destination1, &PGLOB(StgmediumFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/DISPPARAMS;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_DISPPARAMS_2II
- (JNIEnv *env, jclass that, jobject Destination, jint SourcePtr, jint Length)
-{
- DECL_GLOB(pGlob)
- DISPPARAMS dispparams, *Destination1=&dispparams;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_DISPPARAMS_2II\n");
-#endif
-
- MoveMemory((PVOID)Destination1, (CONST VOID *)SourcePtr, Length);
-
- if (Destination) {
- cacheDispparamsFids(env, Destination, &PGLOB(DispparamsFc));
- setDispparamsFields(env, Destination, Destination1, &PGLOB(DispparamsFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/FORMATETC;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FORMATETC_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- FORMATETC formatetc, *Destination1=&formatetc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FORMATETC_2II\n");
-#endif
-
- MoveMemory((PVOID)Destination1, (CONST VOID *)Source, Length);
-
- if (Destination) {
- cacheFormatetcFids(env, Destination, &PGLOB(FormatetcFc));
- setFormatetcFields(env, Destination, Destination1, &PGLOB(FormatetcFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_GUID_2II
- (JNIEnv *env, jclass that, jobject Destination, jint SourcePtr, jint Length)
-{
- DECL_GLOB(pGlob)
- GUID guid, *Destination1=&guid;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_GUID_2II\n");
-#endif
-
- MoveMemory((PVOID)Destination1, (CONST VOID *)SourcePtr, Length);
-
- if (Destination) {
- cacheGuidFids(env, Destination, &PGLOB(GuidFc));
- setGuidFields(env, Destination, Destination1, &PGLOB(GuidFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/STATSTG;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_STATSTG_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- STATSTG statstg, *Destination1=&statstg;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_STATSTG_2II\n");
-#endif
-
- MoveMemory((PVOID)Destination1, (CONST VOID *)Source, Length);
-
- if (Destination) {
- cacheStatstgFids(env, Destination, &PGLOB(StatstgFc));
- setStatstgFields(env, Destination, Destination1, &PGLOB(StatstgFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/TYPEATTR;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_TYPEATTR_2II
- (JNIEnv *env, jclass that, jobject Destination, jint SourcePtr, jint Length)
-{
- DECL_GLOB(pGlob)
- TYPEATTR typeattr, *Destination1=&typeattr;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_TYPEATTR_2II\n");
-#endif
- MoveMemory((PVOID)Destination1, (CONST VOID *)SourcePtr, Length);
- if (Destination) {
- cacheTypeattrFids(env, Destination, &PGLOB(TypeattrFc));
- setTypeattrFields(env, Destination, Destination1, &PGLOB(TypeattrFc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/win32/RECT;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_win32_RECT_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- RECT rect, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_win32_RECT_2II\n");
-#endif
-
- MoveMemory((PVOID)&rect, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &rect;
- cacheRectFids(env, Destination, &PGLOB(RectFc));
- setRectFields(env, Destination, lpDestination1, &PGLOB(RectFc));
- }
-}
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/FUNCDESC1;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FUNCDESC1_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- FUNCDESC funcdesc, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FUNCDESC1_2II\n");
-#endif
-
- MoveMemory((PVOID)&funcdesc, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &funcdesc;
- cacheFuncdesc1Fids(env, Destination, &PGLOB(Funcdesc1Fc));
- setFuncdesc1Fields(env, Destination, lpDestination1, &PGLOB(Funcdesc1Fc));
- }
-}
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/FUNCDESC2;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FUNCDESC2_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- FUNCDESC funcdesc, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_FUNCDESC2_2II\n");
-#endif
-
- MoveMemory((PVOID)&funcdesc, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &funcdesc;
- cacheFuncdesc2Fids(env, Destination, &PGLOB(Funcdesc2Fc));
- setFuncdesc2Fields(env, Destination, lpDestination1, &PGLOB(Funcdesc2Fc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/VARDESC1;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_VARDESC1_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- VARDESC vardesc, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_VARDESC1_2II\n");
-#endif
-
- MoveMemory((PVOID)&vardesc, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &vardesc;
- cacheVardesc1Fids(env, Destination, &PGLOB(Vardesc1Fc));
- setVardesc1Fields(env, Destination, lpDestination1, &PGLOB(Vardesc1Fc));
- }
-}
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/VARDESC2;II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_VARDESC2_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- DECL_GLOB(pGlob)
- VARDESC vardesc, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__Lorg_eclipse_swt_internal_ole_win32_VARDESC2_2II\n");
-#endif
-
- MoveMemory((PVOID)&vardesc, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &vardesc;
- cacheVardesc2Fids(env, Destination, &PGLOB(Vardesc2Fc));
- setVardesc2Fields(env, Destination, lpDestination1, &PGLOB(Vardesc2Fc));
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleCreate
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;Lorg/eclipse/swt/internal/ole/win32/GUID;ILorg/eclipse/swt/internal/ole/win32/FORMATETC;II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleCreate
- (JNIEnv *env, jclass that, jobject rclsid, jobject riid, jint renderopt,
- jobject pFormatEtc, jint pClientSite, jint pStg, jintArray ppvObject)
-{
- DECL_GLOB(pGlob)
- LPVOID *ppvObject1=NULL;
- GUID guid1, *rclsid1=NULL;
- GUID guid2, *riid1=NULL;
- FORMATETC formatec, *pFormatEtc1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleCreate\n");
-#endif
-
- if (rclsid) {
- rclsid1=&guid1;
- cacheGuidFids(env, rclsid, &PGLOB(GuidFc));
- getGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- if (riid) {
- riid1=&guid2;
- cacheGuidFids(env, riid, &PGLOB(GuidFc));
- getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- if (pFormatEtc) {
- pFormatEtc1 = &formatec;
- cacheFormatetcFids(env, pFormatEtc, &PGLOB(FormatetcFc));
- getFormatetcFields(env, pFormatEtc, pFormatEtc1, &PGLOB(FormatetcFc));
- }
-
- if (ppvObject)
- ppvObject1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppvObject, NULL);
-
- rc = (jint) OleCreate(rclsid1, riid1, renderopt, pFormatEtc1, (IOleClientSite * )pClientSite, (IStorage * )pStg, ppvObject1);
-
- if (ppvObject)
- (*env)->ReleaseIntArrayElements(env, ppvObject, (jint *)ppvObject1, 0);
-
-/* all of these objects are inputs so we don't not need to set the
- fields back
-*/
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleCreateFromFile
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;[CLorg/eclipse/swt/internal/ole/win32/GUID;ILorg/eclipse/swt/internal/ole/win32/FORMATETC;II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleCreateFromFile
- (JNIEnv *env, jclass that, jobject rclsid, jcharArray lpszFileName, jobject riid, jint renderopt,
- jobject pFormatEtc, jint pClientSite, jint pStg, jintArray ppvObj)
-{
- DECL_GLOB(pGlob)
- LPVOID *ppvObj1=NULL;
- LPCOLESTR lpszFileName1=NULL;
- GUID guid1, *rclsid1=NULL;
- GUID guid2, *riid1=NULL;
- FORMATETC formatec, *pFormatEtc1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleCreateFromFile\n");
-#endif
-
- if (rclsid) {
- rclsid1=&guid1;
- cacheGuidFids(env, rclsid, &PGLOB(GuidFc));
- getGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
-
- if (riid) {
- riid1=&guid2;
- cacheGuidFids(env, riid, &PGLOB(GuidFc));
- getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- if (pFormatEtc) {
- pFormatEtc1 = &formatec;
- cacheFormatetcFids(env, pFormatEtc, &PGLOB(FormatetcFc));
- getFormatetcFields(env, pFormatEtc, pFormatEtc1, &PGLOB(FormatetcFc));
- }
-
- if (lpszFileName)
- lpszFileName1 = (LPCOLESTR)(*env)->GetCharArrayElements(env, lpszFileName, NULL);
-
- if (ppvObj)
- ppvObj1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppvObj, NULL);
-
- rc = (jint) OleCreateFromFile(rclsid1, lpszFileName1, riid1, renderopt, pFormatEtc1, (LPOLECLIENTSITE)pClientSite, (LPSTORAGE)pStg, ppvObj1);
-
- if (ppvObj)
- (*env)->ReleaseIntArrayElements(env, ppvObj, (jint *)ppvObj1, 0);
-
- if (lpszFileName)
- (*env)->ReleaseCharArrayElements(env, lpszFileName, (jchar *)lpszFileName1, 0);
-
-/* all of these objects are inputs so we don't not need to set the
- fields back
-*/
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleCreatePropertyFrame
- * Signature: (III[CI[IIIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleCreatePropertyFrame
- (JNIEnv *env, jclass that, jint hwndOwner, jint x, jint y, jcharArray lpszCaption, jint cObjects, jintArray lplpUnk, jint cPages, jint lpPageClsID, jint lcid, jint dwReserved, jint lpvReserved)
-{
- LPCOLESTR lpszCaption1=NULL;
- jint *lplpUnk1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleCreatePropertyFrame\n");
-#endif
-
- if (lpszCaption)
- lpszCaption1 = (LPCOLESTR)(*env)->GetCharArrayElements(env, lpszCaption, NULL);
-
- if (lplpUnk)
- lplpUnk1 = (*env)->GetIntArrayElements(env, lplpUnk, NULL);
-
- rc = (jint) OleCreatePropertyFrame((HWND)hwndOwner, x, y, lpszCaption1, cObjects, (LPUNKNOWN FAR*)lplpUnk1, cPages, (LPCLSID)lpPageClsID, (LCID)lcid, dwReserved, (LPVOID)lpvReserved);
-
- if (lplpUnk)
- (*env)->ReleaseIntArrayElements(env, lplpUnk, (jint *)lplpUnk1, 0);
-
- if (lpszCaption)
- (*env)->ReleaseCharArrayElements(env, lpszCaption, (jchar *)lpszCaption1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleIsRunning
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleIsRunning
- (JNIEnv *env, jclass that, jint pObject)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleIsRunning\n");
-#endif
- return (jboolean) OleIsRunning((LPOLEOBJECT)pObject);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleLoad
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/GUID;I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleLoad
- (JNIEnv *env, jclass that, jint pStg, jobject riid, jint pClientSite, jintArray ppvObj)
-{
- DECL_GLOB(pGlob)
- LPVOID *ppvObj1=NULL;
- GUID guid, *riid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleLoad\n");
-#endif
- if (riid) {
- riid1=&guid;
- cacheGuidFids(env, riid, &PGLOB(GuidFc));
- getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
-
- if (ppvObj)
- ppvObj1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppvObj, NULL);
-
- rc = (jint) OleLoad((IStorage *)pStg, riid1, (IOleClientSite *)pClientSite, ppvObj1); /* cast it to an OLE function returning int */
-
- if (ppvObj)
- (*env)->ReleaseIntArrayElements(env, ppvObj, (jint *)ppvObj1, 0);
-
- if (riid) {
- setGuidFields(env, riid, riid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleRun
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleRun
- (JNIEnv *env, jclass that, jint pUnknown)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleRun\n");
-#endif
- return (jint) OleRun((LPUNKNOWN)pUnknown);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleSave
- * Signature: (IIZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleSave
- (JNIEnv *env, jclass that, jint pPS, jint pStg, jboolean fSameAsLoad)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleSave\n");
-#endif
- return (jint) OleSave((IPersistStorage *)pPS, (IStorage *)pStg, fSameAsLoad);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleSetContainedObject
- * Signature: (IZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleSetContainedObject
- (JNIEnv *env, jclass that, jint pUnk, jboolean fContained)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleSetContainedObject\n");
-#endif
- return (jint) OleSetContainedObject((LPUNKNOWN)pUnk, fContained);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleSetMenuDescriptor
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleSetMenuDescriptor
- (JNIEnv *env, jclass that, jint holemenu, jint hwndFrame, jint hwndActiveObject, jint lpFrame, jint lpActiveObj)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleSetMenuDescriptor\n");
-#endif
- return (jint) OleSetMenuDescriptor((HOLEMENU)holemenu, (HWND)hwndFrame, (HWND)hwndActiveObject, (LPOLEINPLACEFRAME)lpFrame, (LPOLEINPLACEACTIVEOBJECT)lpActiveObj);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleTranslateColor
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleTranslateColor
- (JNIEnv *env, jclass that, jint clr, jint hpal, jintArray pcolorref)
-{
- jint *pcolorref1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleTranslateColor\n");
-#endif
-
- if (pcolorref)
- pcolorref1 = (*env)->GetIntArrayElements(env, pcolorref, NULL);
-
- rc = (jint) OleTranslateColor((OLE_COLOR)clr, (HPALETTE)hpal, (COLORREF *)pcolorref1);
-
- if (pcolorref)
- (*env)->ReleaseIntArrayElements(env, pcolorref, pcolorref1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: RegisterDragDrop
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_RegisterDragDrop
- (JNIEnv *env, jclass that, jint hwnd, jint pDropTarget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "RegisterDragDrop\n");
-#endif
- return (jint) RegisterDragDrop((HWND)hwnd, (IDropTarget *)pDropTarget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: RevokeDragDrop
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_RevokeDragDrop
- (JNIEnv *env, jclass that, jint hwnd)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "RevokeDragDrop\n");
-#endif
- return (jint) RevokeDragDrop((HWND)hwnd);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: StgCreateDocfile
- * Signature: ([CII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_StgCreateDocfile
- (JNIEnv *env, jclass that, jcharArray pwcsName, jint grfMode, jint reserved, jintArray ppstgOpen)
-{
- jchar *pwcsName1=NULL;
- IStorage **ppstgOpen1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "StgCreateDocfile\n");
-#endif
-
- if (pwcsName)
- pwcsName1 = (*env)->GetCharArrayElements(env, pwcsName, NULL);
-
- if (ppstgOpen)
- ppstgOpen1 = (IStorage **)(*env)->GetIntArrayElements(env, ppstgOpen, NULL);
-
- rc = (jint) StgCreateDocfile(pwcsName1, grfMode, reserved, ppstgOpen1);
-
- if (ppstgOpen)
- (*env)->ReleaseIntArrayElements(env, ppstgOpen, (jint *)ppstgOpen1, 0);
-
- if (pwcsName)
- (*env)->ReleaseCharArrayElements(env, pwcsName, pwcsName1, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: StgIsStorageFile
- * Signature: ([C)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_StgIsStorageFile
- (JNIEnv *env, jclass that, jcharArray pwcsName)
-{
- const WCHAR *pwcsName1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "StgIsStorageFile\n");
-#endif
-
- if (pwcsName)
- pwcsName1 = (const WCHAR *)(*env)->GetCharArrayElements(env, pwcsName, NULL);
-
- rc = (jint)StgIsStorageFile(pwcsName1);
-
- if (pwcsName)
- (*env)->ReleaseCharArrayElements(env, pwcsName, (jchar *)pwcsName1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: StgOpenStorage
- * Signature: ([CIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_StgOpenStorage
- (JNIEnv *env, jclass that, jcharArray pwcsName, jint pstgPriority, jint grfMode, jint snbExclude, jint reserved, jintArray ppstgOpen)
-{
- const WCHAR *pwcsName1=NULL;
- IStorage **ppstgOpen1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "StgOpenStorage\n");
-#endif
-
- if (pwcsName)
- pwcsName1 = (const WCHAR *)(*env)->GetCharArrayElements(env, pwcsName, NULL);
-
- if (ppstgOpen)
- ppstgOpen1 = (IStorage **)(*env)->GetIntArrayElements(env, ppstgOpen, NULL);
-
- rc = (jint) StgOpenStorage(pwcsName1, (IStorage *)pstgPriority, grfMode, (SNB)snbExclude, reserved, ppstgOpen1);
-
- if (ppstgOpen)
- (*env)->ReleaseIntArrayElements(env, ppstgOpen, (jint *)ppstgOpen1, 0);
-
- if (pwcsName)
- (*env)->ReleaseCharArrayElements(env, pwcsName, (jchar *)pwcsName1, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: SysAllocString
- * Signature: ([C)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_SysAllocString
- (JNIEnv *env, jclass that, jcharArray sz0)
-{
- jchar *sz01=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "SysAllocString\n");
-#endif
- if (sz0)
- sz01 = (*env)->GetCharArrayElements(env, sz0, NULL);
- rc = (jint) SysAllocString( (OLECHAR *) sz01);
- if (sz0)
- (*env)->ReleaseCharArrayElements(env, sz0, sz01, 0);
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: SysFreeString
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_SysFreeString
- (JNIEnv *env, jclass that, jint bstr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "SysFreeString\n");
-#endif
- SysFreeString((BSTR)bstr);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: SysStringByteLen
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_SysStringByteLen
- (JNIEnv *env, jclass that, jint bstr)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "SysStringByteLen\n");
-#endif
- return (jint) SysStringByteLen((BSTR)bstr);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VariantChangeType
- * Signature: (IISS)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VariantChangeType
- (JNIEnv *env, jclass that, jint pvargDest, jint pvarSrc, jshort wFlags, jshort vt)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VariantChangeType\n");
-#endif
- return (jint) VariantChangeType((VARIANTARG FAR* )pvargDest, (VARIANTARG FAR* )pvarSrc, wFlags, (VARTYPE) vt);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VariantClear
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VariantClear
- (JNIEnv *env, jclass that, jint pvarg)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VariantClear\n");
-#endif
- return (jint) VariantClear((VARIANTARG FAR* ) pvarg);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VariantInit
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VariantInit
- (JNIEnv *env, jclass that, jint pvarg)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VariantInit\n");
-#endif
- VariantInit((VARIANTARG FAR*)pvarg);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl)
-{
- P_OLE_FN_1 fn; /* this is a function that returns int */
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II\n");
-#endif
- fn = (P_OLE_FN_1)(*(int **)ppVtbl)[fnNumber];
- return fn(ppVtbl); /* cast it to an OLE function returning int */
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[C)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3C
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0)
-{
- P_OLE_FN_2 fn;
- jchar *arg01=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3C\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = fn(ppVtbl, (jint)arg01);
-
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[C[C)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3C_3C
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0, jcharArray arg1)
-{
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jchar *arg01=NULL, *arg11=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3C_3C\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- if (arg1)
- arg11 = (*env)->GetCharArrayElements(env, arg1, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, (jint)arg11); /* cast it to an OLE function returning int */
-
- if (arg1)
- (*env)->ReleaseCharArrayElements(env, arg1, arg11, 0);
-
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[CI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3CI
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0, jint arg1)
-{
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jchar *arg01=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3CI\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, arg1);
-
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[CIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3CIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0, jint arg1, jint arg2, jint arg3, jintArray arg4)
-{
- P_OLE_FN_6 fn; /* this is a function that returns int */
- jchar *arg01=NULL;
- jint *arg41=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3CIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg4)
- arg41 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, arg1, arg2, arg3, (jint)arg41); /* cast it to an OLE function returning int */
-
- if (arg4)
- (*env)->ReleaseIntArrayElements(env, arg4, arg41, 0);
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[CIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3CIIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0, jint arg1, jint arg2, jint arg3, jint arg4, jintArray arg5)
-{
- P_OLE_FN_7 fn; /* this is a function that returns int */ jchar *arg01=NULL;
- jint *arg51=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3CIIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_7)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
- if (arg5)
- arg51 = (*env)->GetIntArrayElements(env, arg5, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, arg1, arg2, arg3, arg4, (jint)arg51); /* cast it to an OLE function returning int */
-
- if (arg5)
- (*env)->ReleaseIntArrayElements(env, arg5, arg51, 0);
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jintArray arg0)
-{
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint *arg01=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3I\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetIntArrayElements(env, arg0, NULL);
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0)
- (*env)->ReleaseIntArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__III
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0)
-{
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__III\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- rc = fn(ppVtbl, arg0); /* cast it to an OLE function returning int */
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIII
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1)
-{
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIII\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- rc = fn(ppVtbl, arg0, arg1); /* cast it to an OLE function returning int */
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (III[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__III_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jintArray arg1)
-{
- P_OLE_FN_3 fn;
-
- jint *arg11=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__III_3I\n");
-#endif
-
- fn = (P_OLE_FN_3)(*((jint **)ppVtbl))[fnNumber];
-
- if (arg1)
- arg11 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11);
-
- if (arg1)
- (*env)->ReleaseIntArrayElements(env, arg1, arg11, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jintArray arg2)
-{
- P_OLE_FN_4 fn; /* this is a function that returns int */
- jint *arg21=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
-
- if (arg2)
- arg21 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = fn(ppVtbl, arg0, arg1, (jint)arg21); /* cast it to an OLE function returning int */
-
- if (arg2)
- (*env)->ReleaseIntArrayElements(env, arg2, arg21, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIII
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2)
-{
- P_OLE_FN_4 fn; /* this is a function that returns int */
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIII\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
- return fn(ppVtbl, arg0, arg1, arg2);;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jintArray arg3)
-{
- P_OLE_FN_5 fn; /* this is a function that returns int */
- jint *arg31=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VtblCall__IIIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
-
- if (arg3)
- arg31 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = fn(ppVtbl, arg0, arg1, arg2, (jint)arg31);
-
- if (arg3)
- (*env)->ReleaseIntArrayElements(env, arg3, arg31, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3, jintArray arg4)
-{
- P_OLE_FN_6 fn;
- jint *arg41=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3CIIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
- if (arg4)
- arg41 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = fn(ppVtbl, arg0, arg1, arg2, arg3, (jint)arg41);
-
- if (arg4)
- (*env)->ReleaseIntArrayElements(env, arg4, arg41, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIIIII[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIIII_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jintArray arg5)
-{
- P_OLE_FN_7 fn;
-
- jint *arg51=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIIIII_3I\n");
-#endif
-
- fn = (P_OLE_FN_7)(*((jint **)ppVtbl))[fnNumber];
-
- if (arg5)
- arg51 = (*env)->GetIntArrayElements(env, arg5, NULL);
-
- rc = fn(ppVtbl, arg0, arg1, arg2, arg3, arg4, (jint)arg51);
-
- if (arg5)
- (*env)->ReleaseIntArrayElements(env, arg5, arg51, 0);
-
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIILorg/eclipse/swt/internal/ole/win32/DVTARGETDEVICE;Lorg/eclipse/swt/internal/win32/SIZE;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIILorg_eclipse_swt_internal_ole_win32_DVTARGETDEVICE_2Lorg_eclipse_swt_internal_win32_SIZE_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jobject arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- DVTARGETDEVICE dvtargetdevice, *arg21=NULL;
- SIZE size, *arg31=NULL;
- P_OLE_FN_5 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIILorg_eclipse_swt_internal_ole_win32_DVTARGETDEVICE_2Lorg_eclipse_swt_internal_win32_SIZE_2\n");
-#endif
-
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
- if (arg2) {
- arg21=&dvtargetdevice;
- cacheDvtargetdeviceFids(env, arg2, &PGLOB(DvtargetdeviceFc));
- getDvtargetdeviceFields(env, arg2, arg21, &PGLOB(DvtargetdeviceFc));
- }
- if (arg3) {
- arg31=&size;
- cacheSizeFids(env, arg3, &PGLOB(SizeFc));
- getSizeFields(env, arg3, arg31, &PGLOB(SizeFc));
- }
-
- rc = fn(ppVtbl, arg0, arg1, (jint)arg21, (jint)arg31); /* cast it to an OLE function returning int */
-
- if (arg2) {
- setDvtargetdeviceFields(env, arg2, arg21, &PGLOB(DvtargetdeviceFc));
- }
- if (arg3) {
- setSizeFields(env, arg3, arg31, &PGLOB(SizeFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIILorg/eclipse/swt/internal/ole/win32/GUID;I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIILorg_eclipse_swt_internal_ole_win32_GUID_2I_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jobject arg2, jint arg3, jintArray arg4)
-{
- DECL_GLOB(pGlob)
- jint *arg41=NULL;
- GUID guid, *arg21=NULL;
- P_OLE_FN_6 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIILorg_eclipse_swt_internal_ole_win32_GUID_2I_3I\n");
-#endif
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
- if (arg2) {
- arg21=&guid;
- cacheGuidFids(env, arg2, &PGLOB(GuidFc));
- getGuidFields(env, arg2, arg21, &PGLOB(GuidFc));
- }
-
- if (arg4)
- arg41 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = fn(ppVtbl, arg0, arg1, (jint)arg21, arg3, (jint)arg41); /* cast it to an OLE function returning int */
-
- if (arg4)
- (*env)->ReleaseIntArrayElements(env, arg4, arg41, 0);
-
- if (arg2) {
- setGuidFields(env, arg2, arg21, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/FORMATETC;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jintArray arg2)
-{
- DECL_GLOB(pGlob)
- P_OLE_FN_4 fn;
- FORMATETC formatetc, *arg11=NULL;
- jint *arg21=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3I\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
-
- if (arg1) {
- arg11 = &formatetc;
- cacheFormatetcFids(env, arg1, &PGLOB(FormatetcFc));
- getFormatetcFields(env, arg1, arg11, &PGLOB(FormatetcFc));
- }
- if (arg2)
- arg21 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, (jint)arg21);
-
- if (arg2)
- (*env)->ReleaseIntArrayElements(env, arg2, arg21, 0);
-
- if (arg1) {
- setFormatetcFields(env, arg1, arg11, &PGLOB(FormatetcFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- GUID guid, *arg11=NULL;
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIILorg_eclipse_swt_internal_ole_win32_GUID_2n");
-#endif
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&guid;
- cacheGuidFids(env, arg1, &PGLOB(GuidFc));
- getGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
-
- rc = fn(ppVtbl, arg0, (jint)arg11); /* cast it to an COM function returning int */
-
- if (arg1) {
- setGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/GUID;II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2II
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jint arg2, jint arg3)
-{
- DECL_GLOB(pGlob)
- GUID guid, *arg11=NULL;
- P_OLE_FN_5 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2II\n");
-#endif
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&guid;
- cacheGuidFids(env, arg1, &PGLOB(GuidFc));
- getGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
-
- rc = fn(ppVtbl, arg0, (jint)arg11, arg2, arg3); /* cast it to an OLE function returning int */
-
- if (arg1) {
- setGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/GUID;IILorg/eclipse/swt/internal/ole/win32/DISPPARAMS;ILorg/eclipse/swt/internal/ole/win32/EXCEPINFO;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2IILorg_eclipse_swt_internal_ole_win32_DISPPARAMS_2ILorg_eclipse_swt_internal_ole_win32_EXCEPINFO_2_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jint arg2, jint arg3, jobject arg4, jint arg5, jobject arg6, jintArray arg7)
-{
- DECL_GLOB(pGlob)
- jint *arg71=NULL;
- GUID guid, *arg11=NULL;
- EXCEPINFO excepinfo, *arg61=NULL;
- DISPPARAMS dispparams, *arg41=NULL;
- P_OLE_FN_9 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2IILorg_eclipse_swt_internal_ole_win32_DISPPARAMS_2ILorg_eclipse_swt_internal_ole_win32_EXCEPINFO_2_3I\n");
-#endif
-
- fn = (P_OLE_FN_9)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&guid;
- cacheGuidFids(env, arg1, &PGLOB(GuidFc));
- getGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
- if (arg4) {
- arg41=&dispparams;
- cacheDispparamsFids(env, arg4, &PGLOB(DispparamsFc));
- getDispparamsFields(env, arg4, arg41, &PGLOB(DispparamsFc));
- }
-
- if (arg6) {
- arg61=&excepinfo;
- cacheExcepinfoFids(env, arg6, &PGLOB(ExcepinfoFc));
- getExcepinfoFields(env, arg6, arg61, &PGLOB(ExcepinfoFc));
- }
-
- if (arg7)
- arg71 = (*env)->GetIntArrayElements(env, arg7, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, arg2, arg3, (jint)arg41, arg5, (jint)arg61, (jint)arg71); /* cast it to an OLE function returning int */
-
- if (arg7)
- (*env)->ReleaseIntArrayElements(env, arg7, arg71, 0);
-
- if (arg6) {
- setExcepinfoFields(env, arg6, arg61, &PGLOB(ExcepinfoFc));
- }
-
- if (arg4) {
- setDispparamsFields(env, arg4, arg41, &PGLOB(DispparamsFc));
- }
-
- if (arg1) {
- setGuidFields(env, arg1, arg11, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/STATSTG;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_STATSTG_2_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jintArray arg2)
-{
- DECL_GLOB(pGlob)
- jint *arg21=NULL;
- STATSTG statstg, *arg11=NULL;
- P_OLE_FN_4 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VtblCall__IIILorg_eclipse_swt_internal_ole_win32_STATSTG_2_3I\n");
-#endif
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&statstg;
- cacheStatstgFids(env, arg1, &PGLOB(StatstgFc));
- getStatstgFields(env, arg1, arg11, &PGLOB(StatstgFc));
- }
-
- if (arg2)
- arg21 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, (jint)arg21); /* cast it to an OLE function returning int */
-
- if (arg2)
- (*env)->ReleaseIntArrayElements(env, arg2, arg21, 0);
-
- if (arg1) {
- setStatstgFields(env, arg1, arg11, &PGLOB(StatstgFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/win32/MSG;IIILorg/eclipse/swt/internal/win32/RECT;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_win32_MSG_2IIILorg_eclipse_swt_internal_win32_RECT_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jint arg2, jint arg3, jint arg4, jobject arg5)
-{
- DECL_GLOB(pGlob)
- MSG msg, *arg11=NULL;
- RECT rect, *arg51=NULL;
- P_OLE_FN_7 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIILorg_eclipse_swt_internal_win32_MSG_2IIILorg_eclipse_swt_internal_win32_RECT_2\n");
-#endif
-
- fn = (P_OLE_FN_7)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&msg;
- cacheMsgFids(env, arg1, &PGLOB(MsgFc));
- getMsgFields(env, arg1, arg11, &PGLOB(MsgFc));
- }
- if (arg5) {
- arg51=&rect;
- cacheRectFids(env, arg5, &PGLOB(RectFc));
- getRectFields(env, arg5, arg51, &PGLOB(RectFc));
- }
-
- rc = fn(ppVtbl, arg0, (jint)arg11, arg2, arg3, arg4, (jint)arg51); /* cast it to an OLE function returning int */
-
- if (arg1) {
- setMsgFields(env, arg1, arg11, &PGLOB(MsgFc));
- }
- if (arg5) {
- setRectFields(env, arg5, arg51, &PGLOB(RectFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/win32/MSG;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- MSG msg, *arg01=NULL;
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&msg;
- cacheMsgFids(env, arg0, &PGLOB(MsgFc));
- getMsgFields(env, arg0, arg01, &PGLOB(MsgFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setMsgFields(env, arg0, arg01, &PGLOB(MsgFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/win32/SIZE;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_win32_SIZE_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- SIZE size, *arg11=NULL;
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIILorg_eclipse_swt_internal_win32_SIZE_2\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&size;
- cacheSizeFids(env, arg1, &PGLOB(SizeFc));
- getSizeFields(env, arg1, arg11, &PGLOB(SizeFc));
- }
-
- rc = fn(ppVtbl, arg0, (jint)arg11); /* cast it to an COM function returning int */
-
- if (arg1) {
- setSizeFields(env, arg1, arg11, &PGLOB(SizeFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIIZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIZ
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jboolean arg1)
-{
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIIZ\n");
-#endif
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- rc = fn(ppVtbl, arg0, arg1); /* cast it to an OLE function returning int */
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/CAUUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_CAUUID_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- P_OLE_FN_2 fn; /* this is a function that returns int */
- CAUUID cauuid, *arg01=&cauuid;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3C\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0) {
- cacheCauuidFids(env, arg0, &PGLOB(CauuidFc));
- getCauuidFields(env, arg0, arg01, &PGLOB(CauuidFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setCauuidFields(env, arg0, arg01, &PGLOB(CauuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/CONTROLINFO;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_CONTROLINFO_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- CONTROLINFO controlinfo, *arg01=NULL;
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_CONTROLINFO_2\n");
-#endif
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&controlinfo;
- cacheControlinfoFids(env, arg0, &PGLOB(ControlinfoFc));
- getControlinfoFields(env, arg0, arg01, &PGLOB(ControlinfoFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setControlinfoFields(env, arg0, arg01, &PGLOB(ControlinfoFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/FORMATETC;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- P_OLE_FN_2 fn;
- FORMATETC formatetc, *arg01=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2\n");
-#endif
-
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0) {
- arg01 = &formatetc;
- cacheFormatetcFids(env, arg0, &PGLOB(FormatetcFc));
- getFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- rc = fn(ppVtbl, (jint)arg01);
-
- if (arg0) {
- setFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/FORMATETC;Lorg/eclipse/swt/internal/ole/win32/STGMEDIUM;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- P_OLE_FN_3 fn;
- FORMATETC formatetc, *arg01=NULL;
- STGMEDIUM stgmedium, *arg11=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0) {
- arg01 = &formatetc;
- cacheFormatetcFids(env, arg0, &PGLOB(FormatetcFc));
- getFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- if (arg1) {
- arg11 = &stgmedium;
- cacheStgmediumFids(env, arg1, &PGLOB(StgmediumFc));
- getStgmediumFields(env, arg1, arg11, &PGLOB(StgmediumFc));
- }
- rc = fn(ppVtbl, (jint)arg01, (jint)arg11);
-
- if (arg0) {
- setFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- if (arg1) {
- setStgmediumFields(env, arg1, arg11, &PGLOB(StgmediumFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/FORMATETC;Lorg/eclipse/swt/internal/ole/win32/STGMEDIUM;Z)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2Z
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jobject arg1, jboolean arg2)
-{
- DECL_GLOB(pGlob)
- P_OLE_FN_4 fn;
- FORMATETC formatetc, *arg01=NULL;
- STGMEDIUM stgmedium, *arg11=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_FORMATETC_2Lorg_eclipse_swt_internal_ole_win32_STGMEDIUM_2Z\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0) {
- arg01 = &formatetc;
- cacheFormatetcFids(env, arg0, &PGLOB(FormatetcFc));
- getFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- if (arg1) {
- arg11 = &stgmedium;
- cacheStgmediumFids(env, arg1, &PGLOB(StgmediumFc));
- getStgmediumFields(env, arg1, arg11, &PGLOB(StgmediumFc));
- }
- rc = fn(ppVtbl, (jint)arg01, (jint)arg11, (jint)arg2);
-
- if (arg0) {
- setFormatetcFields(env, arg0, arg01, &PGLOB(FormatetcFc));
- }
- if (arg1) {
- setStgmediumFields(env, arg1, arg11, &PGLOB(StgmediumFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- GUID guid, *arg01=NULL;
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2\n");
-#endif
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&guid;
- cacheGuidFids(env, arg0, &PGLOB(GuidFc));
- getGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jintArray arg1)
-{
- DECL_GLOB(pGlob)
- jint *arg11=NULL;
- GUID guid, *arg01=NULL;
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2_3I\n");
-#endif
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0) {
- arg01=&guid;
- cacheGuidFids(env, arg0, &PGLOB(GuidFc));
- getGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
-
- if (arg1)
- arg11 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, (jint)arg11); /* cast it to an OLE function returning int */
-
- if (arg1)
- (*env)->ReleaseIntArrayElements(env, arg1, arg11, 0);
-
- if (arg0) {
- setGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;III[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2III_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jint arg1, jint arg2, jint arg3, jintArray arg4)
-{
- DECL_GLOB(pGlob)
- jint *arg41=NULL;
- GUID guid, *arg01=NULL;
- P_OLE_FN_6 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2III_3I\n");
-#endif
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&guid;
- cacheGuidFids(env, arg0, &PGLOB(GuidFc));
- getGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
-
- if (arg4)
- arg41 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, arg1, arg2, arg3, (jint)arg41); /* cast it to an OLE function returning int */
-
- if (arg4)
- (*env)->ReleaseIntArrayElements(env, arg4, arg41, 0);
-
- if (arg0) {
- setGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2IIII
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- DECL_GLOB(pGlob)
- GUID guid, *arg01=NULL;
- P_OLE_FN_6 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2IIII\n");
-#endif
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&guid;
- cacheGuidFids(env, arg0, &PGLOB(GuidFc));
- getGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01, arg1, arg2, arg3, arg4);
-
- if (arg0) {
- setGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;ILorg/eclipse/swt/internal/ole/win32/OLECMD;Lorg/eclipse/swt/internal/ole/win32/OLECMDTEXT;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2ILorg_eclipse_swt_internal_ole_win32_OLECMD_2Lorg_eclipse_swt_internal_ole_win32_OLECMDTEXT_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jint arg1, jobject arg2, jobject arg3)
-{
- DECL_GLOB(pGlob)
- GUID guid, *arg01=NULL;
- OLECMD olecmd, *arg21=NULL;
- OLECMDTEXT olecmdtext, *arg31=NULL;
-
- P_OLE_FN_5 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2ILorg_eclipse_swt_internal_ole_win32_OLECMD_2Lorg_eclipse_swt_internal_ole_win32_OLECMDTEXT_2\n");
-#endif
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&guid;
- cacheGuidFids(env, arg0, &PGLOB(GuidFc));
- getGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- if (arg2) {
- arg21=&olecmd;
- cacheOlecmdFids(env, arg2, &PGLOB(OlecmdFc));
- getOlecmdFields(env, arg2, arg21, &PGLOB(OlecmdFc));
- }
- if (arg3) {
- arg31=&olecmdtext;
- cacheOlecmdtextFids(env, arg3, &PGLOB(OlecmdtextFc));
- getOlecmdtextFields(env, arg3, arg31, &PGLOB(OlecmdtextFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01, arg1, (jint)arg21, (jint)arg31);
-
- if (arg0) {
- setGuidFields(env, arg0, arg01, &PGLOB(GuidFc));
- }
- if (arg2) {
- setOlecmdFields(env, arg2, arg21, &PGLOB(OlecmdFc));
- }
- if (arg3) {
- setOlecmdtextFields(env, arg3, arg31, &PGLOB(OlecmdtextFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/LICINFO;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_LICINFO_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- DECL_GLOB(pGlob)
- LICINFO licinfo, *arg01=NULL;
- P_OLE_FN_2 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_LICINFO_2\n");
-#endif
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&licinfo;
- cacheLicinfoFids(env, arg0, &PGLOB(LicinfoFc));
- getLicinfoFields(env, arg0, arg01, &PGLOB(LicinfoFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setLicinfoFields(env, arg0, arg01, &PGLOB(LicinfoFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/win32/RECT;IZ)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jint arg1, jboolean arg2)
-{
- DECL_GLOB(pGlob)
- RECT rect, *arg01=NULL;
- P_OLE_FN_4 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&rect;
- cacheRectFids(env, arg0, &PGLOB(RectFc));
- getRectFields(env, arg0, arg01, &PGLOB(RectFc));
- }
-
- rc = fn(ppVtbl, (jint)arg01, arg1, arg2); /* cast it to an OLE function returning int */
-
- if (arg0) {
- setRectFields(env, arg0, arg01, &PGLOB(RectFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/win32/RECT;Lorg/eclipse/swt/internal/win32/RECT;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2Lorg_eclipse_swt_internal_win32_RECT_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0, jobject arg1)
-{
- DECL_GLOB(pGlob)
- RECT rect0, *arg01=NULL;
- RECT rect1, *arg11=NULL;
- P_OLE_FN_3 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2Lorg_eclipse_swt_internal_win32_RECT_2\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&rect0;
- cacheRectFids(env, arg0, &PGLOB(RectFc));
- getRectFields(env, arg0, arg01, &PGLOB(RectFc));
- }
- if (arg1) {
- arg11=&rect1;
- cacheRectFids(env, arg1, &PGLOB(RectFc));
- getRectFields(env, arg1, arg11, &PGLOB(RectFc));
- }
- rc = fn(ppVtbl, (jint)arg01, (jint)arg11); /* cast it to an OLE function returning int */
-
- if (arg1) {
- setRectFields(env, arg1, arg11, &PGLOB(RectFc));
- }
- if (arg0) {
- setRectFields(env, arg0, arg01, &PGLOB(RectFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (III[I[I[I[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__III_3I_3I_3I_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jintArray arg1, jintArray arg2, jintArray arg3, jintArray arg4)
-{
- DECL_GLOB(pGlob)
- jint *arg11=NULL;
- jint *arg21=NULL;
- jint *arg31=NULL;
- jint *arg41=NULL;
- P_OLE_FN_6 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__III_3I_3I_3I_31\n");
-#endif
- fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
- if (arg1)
- arg11 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- if (arg2)
- arg21 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- if (arg3)
- arg31 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- if (arg4)
- arg41 = (*env)->GetIntArrayElements(env, arg4, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, (jint)arg21, (jint)arg31, (jint)arg41); /* cast it to an OLE function returning int */
-
- if (arg1)
- (*env)->ReleaseIntArrayElements(env, arg1, arg11, 0);
-
- if (arg2)
- (*env)->ReleaseIntArrayElements(env, arg2, arg21, 0);
-
- if (arg3)
- (*env)->ReleaseIntArrayElements(env, arg3, arg31, 0);
-
- if (arg4)
- (*env)->ReleaseIntArrayElements(env, arg4, arg41, 0);
-
-
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (III[II[I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__III_3II_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jintArray arg1, jint arg2, jintArray arg3)
-{
- DECL_GLOB(pGlob)
- jint *arg11=NULL;
- jint *arg31=NULL;
- P_OLE_FN_5 fn; /* this is a function that returns int */
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__III_3II_3I\n");
-#endif
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
- if (arg1)
- arg11 = (*env)->GetIntArrayElements(env, arg1, NULL);
-
- if (arg3)
- arg31 = (*env)->GetIntArrayElements(env, arg3, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, arg2, (jint)arg31); /* cast it to an OLE function returning int */
-
- if (arg1)
- (*env)->ReleaseIntArrayElements(env, arg1, arg11, 0);
-
- if (arg3)
- (*env)->ReleaseIntArrayElements(env, arg3, arg31, 0);
-
- return rc;
-}
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: WriteClassStg
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/GUID;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_WriteClassStg
- (JNIEnv *env, jclass that, jint pStg, jobject rclsid)
-{
- DECL_GLOB(pGlob)
- GUID guid, *rclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "WriteClassStg\n");
-#endif
- if (rclsid) {
- rclsid1=&guid;
- cacheGuidFids(env, rclsid, &PGLOB(GuidFc));
- getGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- rc = (jint) WriteClassStg((IStorage *)pStg, rclsid1);
-
- if (rclsid) {
- setGuidFields(env, rclsid, rclsid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleGetClipboard
- * Signature: ([I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleGetClipboard
- (JNIEnv *env, jclass that, jintArray ppDataObj)
-{
- IDataObject **ppDataObj1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleGetClipboard\n");
-#endif
- if (ppDataObj)
- ppDataObj1 = (IDataObject **)(*env)->GetIntArrayElements(env, ppDataObj, NULL);
-
- rc = (jint) OleGetClipboard(ppDataObj1);
-
- if (ppDataObj)
- (*env)->ReleaseIntArrayElements(env, ppDataObj, (jint *)ppDataObj1, 0);
-
- return rc;
-}
-
- /*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleIsCurrentClipboard
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleIsCurrentClipboard
- (JNIEnv *env, jclass that, jint pDataObj)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleIsCurrentClipboard\n");
-#endif
- return (jint) OleIsCurrentClipboard((IDataObject *)pDataObj);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleSetClipboard
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleSetClipboard
- (JNIEnv *env, jclass that, jint pDataObj)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleSetClipboard\n");
-#endif
- return (jint) OleSetClipboard((IDataObject *)pDataObj);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleFlushClipboard
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleFlushClipboard
- (JNIEnv *env, jclass that)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleFlushClipboard\n");
-#endif
- return (jint) OleFlushClipboard();
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: OleDraw
- * Signature: (IIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_OleDraw
- (JNIEnv *env, jclass that, jint pUnk, jint dwAspect, jint hdcDraw, jint lprcBounds)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "OleDraw\n");
-#endif
- return (jint) OleDraw((LPUNKNOWN)pUnk, (DWORD)dwAspect, (HDC)hdcDraw, (LPRECT)lprcBounds);
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: ReleaseStgMedium
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_ReleaseStgMedium
- (JNIEnv *env, jclass that, jint pmedium)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "ReleaseStgMedium\n");
-#endif
- ReleaseStgMedium((STGMEDIUM *)pmedium);
-}
-
-/* ------------- obsolete OLE calls ------------- */
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: DispGetParam
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/DISPPARAMS;III[I)I
- */
-/*JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_DispGetParam
- (JNIEnv *env, jclass that, jobject pdispparams, jint position, jint vtTarg, jint pvarResult, jintArray puArgErr)
-{
- unsigned int FAR *puArgErr1=NULL;
- DISPPARAMS dispparams, *pdispparams1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DispGetParam\n");
-#endif
-
- if (pdispparams) {
- pdispparams1=&dispparams;
- cacheDispparamsFids(env, pdispparams, &DispparamsFc);
- getDispparamsFields(env, pdispparams, pdispparams1, &DispparamsFc);
- }
- if (puArgErr)
- puArgErr1 = (*env)->GetIntArrayElements(env, puArgErr, NULL);
-
- rc = (jint) DispGetParam(pdispparams1, position, (VARTYPE)vtTarg, (VARIANT FAR *)pvarResult, puArgErr1);
-
- if (puArgErr)
- (*env)->ReleaseIntArrayElements(env, puArgErr, puArgErr1, 0);
-
- if (pdispparams) {
- setDispparamsFields(env, pdispparams, pdispparams1, &DispparamsFc);
- }
- return rc;
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/win32/SIZE;I)V
- */
-/*JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_win32_SIZE_2I
- (JNIEnv *env, jclass that, jint DestinationPtr, jobject Source, jint Length)
-{
- SIZE size, *Source1=&size;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_win32_SIZE_2I\n");
-#endif
-
- if (Source) {
- cacheSizeFids(env, Source, &SizeFc);
- getSizeFields(env, Source, Source1, &SizeFc);
- }
-
- MoveMemory((PVOID)DestinationPtr, Source1, Length);
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (II[CI[CI)I
- */
-/*JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__II_3CI_3CI
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jcharArray arg0, jint arg1, jcharArray arg2, jint arg3)
-{
- P_OLE_FN_5 fn;
- jchar *arg01=NULL, *arg21=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__II_3CI_3CI\n");
-#endif
-
- fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
-
- if (arg0)
- arg01 = (*env)->GetCharArrayElements(env, arg0, NULL);
-
- if (arg2)
- arg21 = (*env)->GetCharArrayElements(env, arg2, NULL);
-
- rc = fn(ppVtbl, (jint)arg01, arg1, (jint)arg21, arg3);
-
- if (arg2)
- (*env)->ReleaseCharArrayElements(env, arg2, arg21, 0);
-
- if (arg0)
- (*env)->ReleaseCharArrayElements(env, arg0, arg01, 0);
-
- return rc;
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIILorg/eclipse/swt/internal/ole/win32/GUID;[I)I
- */
-/*JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2_3I
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jobject arg1, jintArray arg2)
-{
- jint *arg21=NULL;
- GUID guid, *arg11=NULL;
- P_OLE_FN_4 fn;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIILorg_eclipse_swt_internal_ole_win32_GUID_2I_3I\n");
-#endif
-
- fn = (P_OLE_FN_4)(*(int **)ppVtbl)[fnNumber];
- if (arg1) {
- arg11=&guid;
- cacheGuidFids(env, arg1, &GuidFc);
- getGuidFields(env, arg1, arg11, &GuidFc);
- }
-
- if (arg2)
- arg21 = (*env)->GetIntArrayElements(env, arg2, NULL);
-
- rc = fn(ppVtbl, arg0, (jint)arg11, (jint)arg21);
-
- if (arg2)
- (*env)->ReleaseIntArrayElements(env, arg2, arg21, 0);
-
- if (arg1) {
- setGuidFields(env, arg1, arg11, &GuidFc);
- }
- return rc;
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IIII)I
- */
-/*JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIII
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1)
-{
- P_OLE_FN_3 fn;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IIII\n");
-#endif
-
- fn = (P_OLE_FN_3)(*(int **)ppVtbl)[fnNumber];
- rc = fn(ppVtbl, arg0, arg1);
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/win32/MSG;)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- MSG msg, *arg01=NULL;
- P_OLE_FN_2 fn;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_MSG_2\n");
-#endif
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&msg;
- cacheMsgFids(env, arg0, &MsgFc);
- getMsgFields(env, arg0, arg01, &MsgFc);
- }
-
- rc = fn(ppVtbl, (jint)arg01);
-
- if (arg0) {
- setMsgFields(env, arg0, arg01, &MsgFc);
- }
- return rc;
-}
-*/
-/* ------------- end obsolote OLE calls ------------- */
-
-/* ------------- deleted OLE calls ------------- */
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VtblCall
- * Signature: (IILorg/eclipse/swt/internal/ole/win32/TYPEATTR;)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_TYPEATTR_2
- (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jobject arg0)
-{
- TYPEATTR typeattr, *arg01=NULL;
- P_OLE_FN_2 fn;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_VtblCall__IILorg_eclipse_swt_internal_ole_win32_TYPEATTR_2\n");
-#endif
- fn = (P_OLE_FN_2)(*(int **)ppVtbl)[fnNumber];
- if (arg0) {
- arg01=&typeattr;
- cacheTypeattrFids(env, arg0, &TypeattrFc);
- getTypeattrFields(env, arg0, arg01, &TypeattrFc);
- }
-
- rc = fn(ppVtbl, (jint)arg01);
- if (arg0) {
- setTypeattrFields(env, arg0, arg01, &TypeattrFc);
- }
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: MoveMemory
- * Signature: (ILorg/eclipse/swt/internal/ole/win32/EXCEPINFO;I)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_EXCEPINFO_2I
- (JNIEnv *env, jclass that, jint Destination, jobject SourcePtr, jint Length)
-{
- EXCEPINFO excepinfo, *SourcePtr1=&excepinfo;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_MoveMemory__ILorg_eclipse_swt_internal_ole_win32_EXCEPINFO_2I\n");
-#endif
-
- if (SourcePtr) {
- cacheExcepinfoFids(env, SourcePtr, &ExcepinfoFc);
- getExcepinfoFields(env, SourcePtr, SourcePtr1, &ExcepinfoFc);
- }
-
- MoveMemory((PVOID)Destination, SourcePtr1, Length);
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: ProgIDFromCLSID
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;[C)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_ProgIDFromCLSID__Lorg_eclipse_swt_internal_ole_win32_GUID_2_3C
- (JNIEnv *env, jclass that, jobject pclsid, jcharArray lplpszProgID)
-{
- LPOLESTR *lplpszProgID1=NULL;
- GUID guid, *pclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_ProgIDFromCLSID__Lorg_eclipse_swt_internal_ole_win32_GUID_2_3C\n");
-#endif
-
- if (pclsid) {
- pclsid1=&guid;
- cacheGuidFids(env, pclsid, &GuidFc);
- getGuidFields(env, pclsid, pclsid1, &GuidFc);
- }
-
- if (lplpszProgID)
- lplpszProgID1 = (LPOLESTR *)(*env)->GetCharArrayElements(env, lplpszProgID, NULL);
-
- rc = (jint) ProgIDFromCLSID(pclsid1, lplpszProgID1);
-
- if (lplpszProgID)
- (*env)->ReleaseCharArrayElements(env, lplpszProgID, (jchar *)lplpszProgID1, 0);
-
- if (pclsid) {
- setGuidFields(env, pclsid, pclsid1, &GuidFc);
- }
- return rc;
-}
-*/
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: ProgIDFromCLSID
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;[I)I
- */
- JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_ProgIDFromCLSID__Lorg_eclipse_swt_internal_ole_win32_GUID_2_3I
- (JNIEnv *env, jclass that, jobject pclsid, jintArray lplpszProgID)
-{
- DECL_GLOB(pGlob)
- LPOLESTR *lplpszProgID1=NULL;
- GUID guid, *pclsid1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "COM_ProgIDFromCLSID__Lorg_eclipse_swt_internal_ole_win32_GUID_2_3I\n");
-#endif
-
- if (pclsid) {
- pclsid1=&guid;
- cacheGuidFids(env, pclsid, &PGLOB(GuidFc));
- getGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
-
- if (lplpszProgID)
- lplpszProgID1 = (LPOLESTR *)(*env)->GetIntArrayElements(env, lplpszProgID, NULL);
-
- rc = (jint) ProgIDFromCLSID(pclsid1, lplpszProgID1);
-
- if (lplpszProgID)
- (*env)->ReleaseIntArrayElements(env, lplpszProgID, (jint *)lplpszProgID1, 0);
-
- if (pclsid) {
- setGuidFields(env, pclsid, pclsid1, &PGLOB(GuidFc));
- }
- return rc;
-}
-
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: VariantCopyInd
- * Signature: (II)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VariantCopyInd
- (JNIEnv *env, jclass that, jint pvarDest, jint pvarSrc)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "VariantCopyInd\n");
-#endif
- return (jint) VariantCopyInd((VARIANT FAR*)pvarDest, (VARIANTARG FAR*)pvarSrc);
-}
-*/
-
-
-/* MoveMemory__Lorg_eclipse_swt_internal_win32_NMHEADER_2II removed after OS version 0.80 */
-/*
- * Class: org_eclipse_swt_internal_win32_OS
- * Method: MoveMemory
- * Signature: (Lorg/eclipse/swt/internal/win32/NMHEADER;II)V
- */
-/* JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMHEADER_2II
- (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
-{
- NMHEADER nmheader, *lpDestination1=NULL;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "MoveMemory__Lorg_eclipse_swt_internal_win32_NMHEADER_2II\n");
-#endif
-
- MoveMemory((PVOID)&nmheader, (CONST VOID *)Source, Length);
-
- if (Destination) {
- lpDestination1 = &nmheader;
- cacheNmheaderFids(env, Destination, &NmheaderFc);
- setNmheaderFields(env, Destination, lpDestination1, &NmheaderFc);
- }
-}
-*/
-
-/* SendMessage__IIILorg_eclipse_swt_internal_win32_HDITEM_2 removed after OS version 0.80 */
-/*
- * Class: org_eclipse_swt_internal_win32_OS
- * Method: SendMessage
- * Signature: (IIILorg/eclipse/swt/internal/win32/HDITEM;)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessage__IIILorg_eclipse_swt_internal_win32_HDITEM_2
- (JNIEnv *env, jclass that, jint hWnd, jint Msg, jint wParam, jobject lParam)
-{
- HDITEM hditem, *lpParam1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "SendMessage__IIILorg_eclipse_swt_internal_win32_HDITEM_2\n");
-#endif
-
- if (lParam) {
- lpParam1 = &hditem;
- cacheHditemFids(env, lParam, &HditemFc);
- getHditemFields(env, lParam, lpParam1, &HditemFc);
- }
- rc = (jint) SendMessage((HWND)hWnd, Msg, wParam, (LPARAM)lpParam1);
- if (lParam) {
- setHditemFields(env, lParam, lpParam1, &HditemFc);
- }
- return rc;
-}
-*/
-
-/* SendMessage__IIILorg_eclipse_swt_internal_win32_HDLAYOUT_2 removed after OS version 0.80 */
-/*
- * Class: org_eclipse_swt_internal_win32_OS
- * Method: SendMessage
- * Signature: (IIILorg/eclipse/swt/internal/win32/HDLAYOUT;)I
- */
-/* JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SendMessage__IIILorg_eclipse_swt_internal_win32_HDLAYOUT_2
- (JNIEnv *env, jclass that, jint hWnd, jint Msg, jint wParam, jobject lParam)
-{
- HDLAYOUT hdlayout, *lpParam1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "SendMessage__IIILorg_eclipse_swt_internal_win32_HDLAYOUT_2\n");
-#endif
-
- if (lParam) {
- lpParam1 = &hdlayout;
- cacheHdlayoutFids(env, lParam, &HdlayoutFc);
- getHdlayoutFields(env, lParam, lpParam1, &HdlayoutFc);
- }
- rc = (jint) SendMessage((HWND)hWnd, Msg, wParam, (LPARAM)lpParam1);
- if (lParam) {
- setHdlayoutFields(env, lParam, lpParam1, &HdlayoutFc);
- }
- return rc;
-}
-*/
-/*
- * Class: org_eclipse_swt_internal_ole_win32_COM
- * Method: CoGetInstanceFromIStorage
- * Signature: (Lorg/eclipse/swt/internal/ole/win32/COSERVERINFO;Lorg/eclipse/swt/internal/ole/win32/GUID;IIIILorg/eclipse/swt/internal/ole/win32/MULTI_QI;)I
- */
-/*
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoGetInstanceFromIStorage
- (JNIEnv *env, jclass that, jobject pServerInfo, jobject pclsid, jint punkOuter, jint dwClsCtx,
- jint pstg, jint cmq, jobject rgmqResults)
-{
- GUID guid, *pclsid1=NULL;
- COSERVERINFO coserverinfo, *pServerInfo1=NULL;
- MULTI_QI multi_qi, *rgmqResults1=NULL;
- jint rc;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "CoGetInstanceFromIStorage\n");
-#endif
-
- if (pclsid) {
- pclsid1=&guid;
- cacheGuidFids(env, pclsid, &GuidFc);
- getGuidFields(env, pclsid, pclsid1, &GuidFc);
- }
- if (pServerInfo) {
- pServerInfo1=&coserverinfo;
- cacheCoserverinfoFids(env, pServerInfo, &CoserverinfoFc);
- getCoserverinfoFields(env, pServerInfo, pServerInfo1, &CoserverinfoFc);
- }
- if (rgmqResults) {
- rgmqResults1=&multi_qi;
- cacheMulti_qiFids(env, rgmqResults, &MultiqiFc);
- getMulti_qiFields(env, rgmqResults, rgmqResults1, &MultiqiFc);
- }
-
- rc = CoGetInstanceFromIStorage(pServerInfo1, pclsid1, (IUnknown *)punkOuter, dwClsCtx, (IStorage *)pstg, cmq, rgmqResults1);
-
- if (pclsid) {
- setGuidFields(env, pclsid, pclsid1, &GuidFc);
- }
- if (pServerInfo) {
- setCoserverinfoFields(env, pServerInfo, pServerInfo1, &CoserverinfoFc);
- }
- if (rgmqResults) {
- setMulti_qiFields(env, rgmqResults, rgmqResults1, &MultiqiFc);
- }
- return rc;
-}
-*/
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
deleted file mode 100644
index 7e471056c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class CAUUID {
-
- public int cElems;
- public int pElems;
-
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
deleted file mode 100644
index c6a2e06213..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
+++ /dev/null
@@ -1,541 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class COM extends OS {
-
- static {
- /* Initialize OLE */
- // OleInitialize Initializes the COM library on the current apartment
- // and identifies the concurrency model as single-thread apartment (STA).
- // To use any other threading model, you must call CoInitializeEx
- OS.OleInitialize(0);
- }
-
- /* Constants */
-
- // GUIDs for Home Page Browser
- public static final GUID IIDIEditorSiteTime = IIDFromString("{6BD2AEFE-7876-45e6-A6E7-3BFCDF6540AA}");
- public static final GUID IIDIEditorSiteProperty = IIDFromString("{D381A1F4-2326-4f3c-AFB9-B7537DB9E238}");
- public static final GUID IIDIEditorBaseProperty = IIDFromString("{61E55B0B-2647-47c4-8C89-E736EF15D636}");
- public static final GUID IIDIEditorSite = IIDFromString("{CDD88AB9-B01D-426E-B0F0-30973E9A074B}");
- public static final GUID IIDIEditorService = IIDFromString("{BEE283FE-7B42-4FF3-8232-0F07D43ABCF1}");
- public static final GUID IIDIEditorManager = IIDFromString("{EFDE08C4-BE87-4B1A-BF84-15FC30207180}");
-
-
- public static final GUID IIDIAdviseSink = IIDFromString("{0000010F-0000-0000-C000-000000000046}");
- //public static final GUID IIDIAdviseSink2 = IIDFromString("{00000125-0000-0000-C000-000000000046}");
- //public static final GUID IIDIBindCtx = IIDFromString("{0000000E-0000-0000-C000-000000000046}");
- //public static final GUID IIDIClassFactory = IIDFromString("{00000001-0000-0000-C000-000000000046}");
- public static final GUID IIDIClassFactory2 = IIDFromString("{B196B28F-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIConnectionPoint = IIDFromString("{B196B286-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIConnectionPointContainer = IIDFromString("{B196B284-BAB4-101A-B69C-00AA00341D07}");
- //public static final GUID IIDICreateErrorInfo = IIDFromString("{22F03340-547D-101B-8E65-08002B2BD119}");
- //public static final GUID IIDICreateTypeInfo = IIDFromString("{00020405-0000-0000-C000-000000000046}");
- //public static final GUID IIDICreateTypeLib = IIDFromString("{00020406-0000-0000-C000-000000000046}");
- //public static final GUID IIDIDataAdviseHolder = IIDFromString("{00000110-0000-0000-C000-000000000046}");
- public static final GUID IIDIDataObject = IIDFromString("{0000010E-0000-0000-C000-000000000046}");
- public static final GUID IIDIDispatch = IIDFromString("{00020400-0000-0000-C000-000000000046}");
- public static final GUID IIDIDropSource = IIDFromString("{00000121-0000-0000-C000-000000000046}");
- public static final GUID IIDIDropTarget = IIDFromString("{00000122-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumConnectionPoints = IIDFromString("{B196B285-BAB4-101A-B69C-00AA00341D07}");
- //public static final GUID IIDIEnumConnections = IIDFromString("{B196B287-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIEnumFORMATETC = IIDFromString("{00000103-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumMoniker = IIDFromString("{00000102-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumOLEVERB = IIDFromString("{00000104-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumSTATDATA = IIDFromString("{00000105-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumSTATSTG = IIDFromString("{0000000D-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumString = IIDFromString("{00000101-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumUnknown = IIDFromString("{00000100-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumVARIANT = IIDFromString("{00020404-0000-0000-C000-000000000046}");
- //public static final GUID IIDIErrorInfo = IIDFromString("{1CF2B120-547D-101B-8E65-08002B2BD119}");
- //public static final GUID IIDIErrorLog = IIDFromString("{3127CA40-446E-11CE-8135-00AA004BB851}");
- //public static final GUID IIDIExternalConnection = IIDFromString("{00000019-0000-0000-C000-000000000046}");
- public static final GUID IIDIFont = IIDFromString("{BEF6E002-A874-101A-8BBA-00AA00300CAB}");
- //public static final GUID IIDIFontDisp = IIDFromString("{BEF6E003-A874-101A-8BBA-00AA00300CAB}");
- //public static final GUID IIDILockBytes = IIDFromString("{0000000A-0000-0000-C000-000000000046}");
- //public static final GUID IIDIMalloc = IIDFromString("{00000002-0000-0000-C000-000000000046}");
- //public static final GUID IIDIMallocSpy = IIDFromString("{0000001D-0000-0000-C000-000000000046}");
- //public static final GUID IIDIMarshal = IIDFromString("{00000003-0000-0000-C000-000000000046}");
- //public static final GUID IIDIMessageFilter = IIDFromString("{00000016-0000-0000-C000-000000000046}");
- //public static final GUID IIDIMoniker = IIDFromString("{0000000F-0000-0000-C000-000000000046}");
- //public static final GUID IIDIOleAdviseHolder = IIDFromString("{00000111-0000-0000-C000-000000000046}");
- //public static final GUID IIDIOleCache = IIDFromString("{0000011E-0000-0000-C000-000000000046}");
- //public static final GUID IIDIOleCache2 = IIDFromString("{00000128-0000-0000-C000-000000000046}");
- //public static final GUID IIDIOleCacheControl = IIDFromString("{00000129-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleClientSite = IIDFromString("{00000118-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleCommandTarget = IIDFromString("{B722BCCB-4E68-101B-A2BC-00AA00404770}");
- public static final GUID IIDIOleContainer = IIDFromString("{0000011B-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleControl = IIDFromString("{B196B288-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIOleControlSite = IIDFromString("{B196B289-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIOleInPlaceActiveObject = IIDFromString("{00000117-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleInPlaceFrame = IIDFromString("{00000116-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleInPlaceObject = IIDFromString("{00000113-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleInPlaceSite = IIDFromString("{00000119-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleInPlaceUIWindow = IIDFromString("{00000115-0000-0000-C000-000000000046}");
- //public static final GUID IIDIOleItemContainer = IIDFromString("{0000011C-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleLink = IIDFromString("{0000011D-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleObject = IIDFromString("{00000112-0000-0000-C000-000000000046}");
- public static final GUID IIDIOleWindow = IIDFromString("{00000114-0000-0000-C000-000000000046}");
- //public static final GUID IIDIParseDisplayName = IIDFromString("{0000011A-0000-0000-C000-000000000046}");
- //public static final GUID IIDIPerPropertyBrowsing = IIDFromString("{376BD3AA-3845-101B-84ED-08002B2EC713}");
- public static final GUID IIDIPersist = IIDFromString("{0000010C-0000-0000-C000-000000000046}");
- public static final GUID IIDIPersistFile = IIDFromString("{0000010B-0000-0000-C000-000000000046}");
- //public static final GUID IIDIPersistMemory = IIDFromString("{BD1AE5E0-A6AE-11CE-BD37-504200C10000}");
- //public static final GUID IIDIPersistPropertyBag = IIDFromString("{37D84F60-42CB-11CE-8135-00AA004BB851}");
- public static final GUID IIDIPersistStorage = IIDFromString("{0000010A-0000-0000-C000-000000000046}");
- public static final GUID IIDIPersistStream = IIDFromString("{00000109-0000-0000-C000-000000000046}");
- //public static final GUID IIDIPersistStreamInit = IIDFromString("{7FD52380-4E07-101B-AE2D-08002B2EC713}");
- //public static final GUID IIDIPicture = IIDFromString("{7BF80980-BF32-101A-8BBB-00AA00300CAB}");
- //public static final GUID IIDIPictureDisp = IIDFromString("{7BF80981-BF32-101A-8BBB-00AA00300CAB}");
- //public static final GUID IIDIPropertyBag = IIDFromString("{55272A00-42CB-11CE-8135-00AA004BB851}");
- public static final GUID IIDIPropertyNotifySink = IIDFromString("{9BFBBC02-EFF1-101A-84ED-00AA00341D07}");
- //public static final GUID IIDIPropertyPage = IIDFromString("{B196B28D-BAB4-101A-B69C-00AA00341D07}");
- //public static final GUID IIDIPropertyPage2 = IIDFromString("{01E44665-24AC-101B-84ED-08002B2EC713}");
- //public static final GUID IIDIPropertyPageSite = IIDFromString("{B196B28C-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIProvideClassInfo = IIDFromString("{B196B283-BAB4-101A-B69C-00AA00341D07}");
- public static final GUID IIDIProvideClassInfo2 = IIDFromString("{A6BC3AC0-DBAA-11CE-9DE3-00AA004BB851}");
- //public static final GUID IIDIPSFactoryBuffer = IIDFromString("{D5F569D0-593B-101A-B569-08002B2DBF7A}");
- //public static final GUID IIDIRootStorage = IIDFromString("{00000012-0000-0000-C000-000000000046}");
- //public static final GUID IIDIROTData = IIDFromString("{F29F6BC0-5021-11CE-AA15-00006901293F}");
- //public static final GUID IIDIRpcChannelBuffer = IIDFromString("{D5F56B60-593B-101A-B569-08002B2DBF7A}");
- //public static final GUID IIDIRpcProxyBuffer = IIDFromString("{D5F56A34-593B-101A-B569-08002B2DBF7A}");
- //public static final GUID IIDIRpcStubBuffer = IIDFromString("{D5F56AFC-593B-101A-B569-08002B2DBF7A}");
- //public static final GUID IIDIRunnableObject = IIDFromString("{00000126-0000-0000-C000-000000000046}");
- //public static final GUID IIDIRunningObjectTable = IIDFromString("{00000010-0000-0000-C000-000000000046}");
- //public static final GUID IIDISimpleFrameSite = IIDFromString("{742B0E01-14E6-101B-914E-00AA00300CAB}");
- public static final GUID IIDISpecifyPropertyPages = IIDFromString("{B196B28B-BAB4-101A-B69C-00AA00341D07}");
- //public static final GUID IIDIStdMarshalInfo = IIDFromString("{00000018-0000-0000-C000-000000000046}");
- public static final GUID IIDIStorage = IIDFromString("{0000000B-0000-0000-C000-000000000046}");
- public static final GUID IIDIStream = IIDFromString("{0000000C-0000-0000-C000-000000000046}");
- //public static final GUID IIDISupportErrorInfo = IIDFromString("{DF0B3D60-548F-101B-8E65-08002B2BD119}");
- //public static final GUID IIDITypeComp = IIDFromString("{00020403-0000-0000-C000-000000000046}");
- //public static final GUID IIDITypeLib = IIDFromString("{00020402-0000-0000-C000-000000000046}");
- public static final GUID IIDIUnknown = IIDFromString("{00000000-0000-0000-C000-000000000046}");
- //public static final GUID IIDIViewObject = IIDFromString("{0000010D-0000-0000-C000-000000000046}");
- public static final GUID IIDIViewObject2 = IIDFromString("{00000127-0000-0000-C000-000000000046}");
-
- //public static final int ADVF_DATAONSTOP = 64;
- //public static final int ADVF_NODATA = 1;
- //public static final int ADVF_ONLYONCE = 2;
- //public static final int ADVF_PRIMEFIRST = 4;
- //public static final int ADVFCACHE_FORCEBUILTIN = 16;
- //public static final int ADVFCACHE_NOHANDLER = 8;
- //public static final int ADVFCACHE_ONSAVE = 32;
- public static final int CF_TEXT = 1;
- public static final int CF_BITMAP = 2;
- public static final int CF_METAFILEPICT = 3;
- public static final int CF_SYLK = 4;
- public static final int CF_DIF = 5;
- public static final int CF_TIFF = 6;
- public static final int CF_OEMTEXT = 7;
- public static final int CF_DIB = 8;
- public static final int CF_PALETTE = 9;
- public static final int CF_PENDATA = 10;
- public static final int CF_RIFF = 11;
- public static final int CF_WAVE = 12;
- public static final int CF_UNICODETEXT = 13;
- public static final int CF_ENHMETAFILE = 14;
- public static final int CF_HDROP = 15;
- public static final int CF_LOCALE = 16;
- public static final int CF_MAX = 17;
- public static final int CLSCTX_INPROC_HANDLER = 2;
- public static final int CLSCTX_INPROC_SERVER = 1;
- public static final int CLSCTX_LOCAL_SERVER = 4;
- public static final int CLSCTX_REMOTE_SERVER = 16;
- public static final int CO_E_CLASSSTRING = -2147221005;
- //public static final int COINIT_APARTMENTTHREADED = 2; Apartment model
- //public static final int COINIT_DISABLE_OLE1DDE = 4; Don't use DDE for Ole1 support.
- //public static final int COINIT_MULTITHREADED = 0; OLE calls objects on any thread.
- //public static final int COINIT_SPEED_OVER_MEMORY = 8; Trade memory for speed.
- public static final int DATADIR_GET = 1;
- public static final int DATADIR_SET = 2;
- public static final int DISP_E_EXCEPTION = 0x80020009;
- public static final int DISP_E_MEMBERNOTFOUND = -2147352573;
- public static final int DISP_E_UNKNOWNINTERFACE = 0x80020001;
- //public static final int DISPID_AMBIENT_APPEARANCE = -716;
- //public static final int DISPID_AMBIENT_AUTOCLIP = -715;
- public static final int DISPID_AMBIENT_BACKCOLOR = -701;
- //public static final int DISPID_AMBIENT_CHARSET = -727;
- //public static final int DISPID_AMBIENT_CODEPAGE = -725;
- //public static final int DISPID_AMBIENT_DISPLAYASDEFAULT = -713;
- //public static final int DISPID_AMBIENT_DISPLAYNAME = -702;
- public static final int DISPID_AMBIENT_FONT = -703;
- public static final int DISPID_AMBIENT_FORECOLOR = -704;
- public static final int DISPID_AMBIENT_LOCALEID = -705;
- public static final int DISPID_AMBIENT_MESSAGEREFLECT = -706;
- public static final int DISPID_AMBIENT_OFFLINEIFNOTCONNECTED = -5501;
- //public static final int DISPID_AMBIENT_PALETTE = -726;
- //public static final int DISPID_AMBIENT_RIGHTTOLEFT = -732;
- //public static final int DISPID_AMBIENT_SCALEUNITS = -707;
- public static final int DISPID_AMBIENT_SHOWGRABHANDLES = -711;
- public static final int DISPID_AMBIENT_SHOWHATCHING = -712;
- public static final int DISPID_AMBIENT_SILENT = -5502;
- public static final int DISPID_AMBIENT_SUPPORTSMNEMONICS = -714;
- //public static final int DISPID_AMBIENT_TEXTALIGN = -708;
- //public static final int DISPID_AMBIENT_TOPTOBOTTOM = -733;
- //public static final int DISPID_AMBIENT_TRANSFERPRIORITY = -728;
- public static final int DISPID_AMBIENT_UIDEAD = -710;
- public static final int DISPID_AMBIENT_USERMODE = -709;
- public static final int DISPID_BACKCOLOR = -501;
- public static final int DISPID_FONT = -512;
- public static final int DISPID_FONT_BOLD = 3;
- public static final int DISPID_FONT_CHARSET = 8;
- public static final int DISPID_FONT_ITALIC = 4;
- public static final int DISPID_FONT_NAME = 0;
- public static final int DISPID_FONT_SIZE = 2;
- public static final int DISPID_FONT_STRIKE = 6;
- public static final int DISPID_FONT_UNDER = 5;
- public static final int DISPID_FONT_WEIGHT = 7;
- public static final int DISPID_FORECOLOR = -513;
- //public static final int DISPID_READYSTATE = -525;
- //public static final int DISPID_READYSTATECHANGE = -609;
- public static final int DRAGDROP_S_DROP = 0x00040100; //Successful drop took place
- public static final int DRAGDROP_S_CANCEL = 0x00040101; // Drag-drop operation canceled
- public static final int DRAGDROP_S_USEDEFAULTCURSORS = 0x00040102; // Use the default cursor
- public static final int DROPEFFECT_NONE = 0; // Drop target cannot accept the data.
- public static final int DROPEFFECT_COPY = 1; // Drop results in a copy. The original data is untouched by
- // the drag source.
- public static final int DROPEFFECT_MOVE = 2; // Drag source should remove the data.
- public static final int DROPEFFECT_LINK = 4; // Drag source should create a link to the original data.
- public static final int DROPEFFECT_SCROLL = 0x80000000; // Scrolling is about to start or is currently
- // occurring in the target. This value is used in
- // addition to the other values.
- public static final int DV_E_FORMATETC = -2147221404;
- public static final int DV_E_STGMEDIUM = -2147221402;
- public static final int DV_E_TYMED = -2147221399;
- public static final int DVASPECT_CONTENT = 1;
- //public static final int DVASPECT_DOCPRINT = 8;
- //public static final int DVASPECT_ICON = 4;
- //public static final int DVASPECT_THUMBNAIL = 2;
- public static final int E_FAIL = -2147467259; //Unspecified failure.
- public static final int E_INVALIDARG = -2147024809;
- public static final int E_NOINTERFACE = -2147467262; //QueryInterface did not recognize the requested interface.
- public static final int E_NOTIMPL = -2147467263; //Member function contains no implementation.
- //public static final int E_NOTLICENSED = -2147221230;
- //public static final int E_OUTOFMEMORY = -2147024882; //Function failed to allocate necessary memory.
- //public static final int E_POINTER = -2147467261;
- public static final int GMEM_FIXED = 0; //Global Memory Constants
- //public static final int GMEM_MOVABLE = 2;
- //public static final int GMEM_NODISCARD = 32;
- public static final int GMEM_ZEROINIT = 64;
- public static final int GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1;
- public static final int IMPLTYPEFLAG_FDEFAULT = 1;
- //public static final int IMPLTYPEFLAG_FDEFAULTVTABLE = 2048;
- public static final int IMPLTYPEFLAG_FRESTRICTED = 4;
- public static final int IMPLTYPEFLAG_FSOURCE = 2;
- public static final int LOCALE_SYSTEM_DEFAULT = 1024; //Locale Constants
- public static final int LOCALE_USER_DEFAULT = 2048;
- //public static final int MEMCTX_TASK = 1; //dwMemContext values for COM's task memory allocation service
- //public static final int OLEACTIVATEAUTO = 3; //Object is activated based on the object's default method of activation
- //public static final int OLEACTIVATEDOUBLECLICK = 2; //Object is activated when the OLE container control is double-clicked
- //public static final int OLEACTIVATEGETFOCUS = 1; //Object is activated when the OLE container control gets the focus
- //public static final int OLEACTIVATEMANUAL = 0; //OLE object isn't automatically activated
- //public static final int OLEAUTOMATIC = 0; //Object is updated each time the linked data changes
- //public static final int OLECHANGED = 0; //Object's data has changed
- public static final int OLECLOSE_NOSAVE = 1;
- //public static final int OLECLOSE_PROMPTSAVE = 2;
- public static final int OLECLOSE_SAVEIFDIRTY = 0;
- //public static final int OLECLOSED = 2; //Application file containing the linked object's data has been closed
- //public static final int OLECONTF_EMBEDDINGS = 1; //The OLECONTF enumeration indicates the kind of objects to be enumerated by the returned IEnumUnknown interface
- //public static final int OLECONTF_LINKS = 2;
- //public static final int OLECONTF_ONLYIFRUNNING = 16;
- //public static final int OLECONTF_ONLYUSER = 8;
- //public static final int OLECONTF_OTHERS = 4;
- //public static final int OLEDEACTIVATEMANUAL = 1; //The OLE object can only be deactivated programatically via the #doVerb: method."
- //public static final int OLEDEACTIVATEONLOSEFOCUS = 0; //The OLE object is deactivated whenever focus is given to another widget in the receiver's shell.
- //public static final int OLEDECBORDER = 1; //a border is displayed around the receiver.
- //public static final int OLEDECBORDERANDNIBS = 3; //border and resize nibs are displayed.
- //public static final int OLEDECNIBS = 2; //resize nibs are displayed around the reciever.
- //public static final int OLEDECNONE = 0; //no special trimmings are displayed around the receiver.
- //public static final int OLEDISPLAYCONTENT = 0; //Object's data is displayed in the OLE container control
- //public static final int OLEDISPLAYICON = 1; //Object's icon is displayed in the OLE container control
- //public static final int OLEEITHER = 2; //OLE container control can contain either a linked or an embedded object
- public static final int OLEEMBEDDED = 1; //OLE container control contains an embedded object
- //public static final int OLEFROZEN = 1; //Object is updated whenever the user saves the linked document from within the application in which it was created
- public static final int OLEIVERB_DISCARDUNDOSTATE = -6; //close the OLE object and discard the undo state
- //public static final int OLEIVERB_HIDE = -3; //hide the OLE object
- public static final int OLEIVERB_INPLACEACTIVATE = -5; //open the OLE for editing in-place
- //public static final int OLEIVERB_OPEN = -2; //open the OLE object for editing in a separate window
- public static final int OLEIVERB_PRIMARY = 0; //opens the OLE object for editing
- //public static final int OLEIVERB_PROPERTIES = -7; //request the OLE object properties dialog
- //public static final int OLEIVERB_SHOW = -1; //show the OLE object
- //public static final int OLEIVERB_UIACTIVATE = -4; //activate the UI for the OLE object
- public static final int OLELINKED = 0; //OLE container control contains a linked object
- //public static final int OLEMANUAL = 2; //Object is updated only when the Action property is set to 6 (Update)
- //public static final int OLEMISC_ACTIVATEWHENVISIBLE = 256;
- //public static final int OLEMISC_ACTSLIKEBUTTON = 4096;
- //public static final int OLEMISC_ACTSLIKELABEL = 8192;
- //public static final int OLEMISC_ALIGNABLE = 32768;
- //public static final int OLEMISC_ALWAYSRUN = 2048;
- //public static final int OLEMISC_CANLINKBYOLE1 = 32;
- //public static final int OLEMISC_CANTLINKINSIDE = 16;
- //public static final int OLEMISC_IGNOREACTIVATEWHENVISIBLE = 524288;
- //public static final int OLEMISC_IMEMODE = 262144;
- //public static final int OLEMISC_INSERTNOTREPLACE = 4;
- //public static final int OLEMISC_INSIDEOUT = 128;
- //public static final int OLEMISC_INVISIBLEATRUNTIME = 1024;
- //public static final int OLEMISC_ISLINKOBJECT = 64;
- //public static final int OLEMISC_NOUIACTIVATE = 16384;
- //public static final int OLEMISC_ONLYICONIC = 2;
- //public static final int OLEMISC_RECOMPOSEONRESIZE = 1;
- //public static final int OLEMISC_RENDERINGISDEVICEINDEPENDENT = 512;
- //public static final int OLEMISC_SETCLIENTSITEFIRST = 131072;
- //public static final int OLEMISC_SIMPLEFRAME = 65536;
- //public static final int OLEMISC_STATIC = 8;
- //public static final int OLEMISC_SUPPORTSMULTILEVELUNDO = 2097152;
- //public static final int OLEMISC_WANTSTOMENUMERGE = 1048576;
- //public static final int OLENONE = 3; //OLE container control doesn't contain an object
- //public static final int OLERENAMED = 3; //Application file containing the linked object's data has been renamed
- //public static final int OLERENDER_ASIS = 3; //Ole Create rendering formats
- public static final int OLERENDER_DRAW = 1;
- //public static final int OLERENDER_FORMAT = 2;
- //public static final int OLERENDER_NONE = 0;
- //public static final int OLESAVED = 1; //Object's data has been saved by the application that created the object
- //public static final int OLESIZEAUTOSIZE = 2; //OLE container control is automatically resized to display the entire object
- //public static final int OLESIZECLIP = 0; //Object's image is clipped by the OLE container control's borders
- //public static final int OLESIZESTRETCH = 1; //Object's image is sized to fill the OLE container control
- //public static final int OLESIZEZOOM = 3; //Object's image is stretched but in proportion
- //public static final int OLEWHICHMK_CONTAINER = 1;
- //public static final int OLEWHICHMK_OBJFULL = 3;
- //public static final int OLEWHICHMK_OBJREL = 2;
- public static final int S_FALSE = 1; //Used for functions that semantically return a Boolean FALSE result to indicate that the function succeeded.
- public static final int S_OK = 0; //Function succeeded.
- public static final int STG_E_FILENOTFOUND = 0x80030002;
- public static final int STG_S_CONVERTED = 0x00030200;
- //public static final int STGC_CONSOLIDATE = 8;
- //public static final int STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4;
- public static final int STGC_DEFAULT = 0;
- //public static final int STGC_ONLYIFCURRENT = 2;
- //public static final int STGC_OVERWRITE = 1;
- public static final int STGM_CONVERT = 0x00020000;
- public static final int STGM_CREATE = 0x00001000;
- public static final int STGM_DELETEONRELEASE = 0x04000000;
- public static final int STGM_DIRECT = 0x00000000;
- public static final int STGM_DIRECT_SWMR = 0x00400000;
- public static final int STGM_FAILIFTHERE = 0x00000000;
- public static final int STGM_NOSCRATCH = 0x00100000;
- public static final int STGM_NOSNAPSHOT = 0x00200000;
- public static final int STGM_PRIORITY = 0x00040000;
- public static final int STGM_READ = 0x00000000;
- public static final int STGM_READWRITE = 0x00000002;
- public static final int STGM_SHARE_DENY_NONE = 0x00000040;
- public static final int STGM_SHARE_DENY_READ = 0x00000030;
- public static final int STGM_SHARE_DENY_WRITE = 0x00000020;
- public static final int STGM_SHARE_EXCLUSIVE = 0x00000010;
- public static final int STGM_SIMPLE = 0x08000000;
- public static final int STGM_TRANSACTED = 0x00010000;
- public static final int STGM_WRITE = 0x00000001;
- public static final int STGTY_STORAGE = 1;
- public static final int STGTY_STREAM = 2;
- public static final int STGTY_LOCKBYTES = 3;
- public static final int STGTY_PROPERTY = 4;
- //public static final int TYMED_ENHMF = 64; //Values for tymed
- //public static final int TYMED_FILE = 2;
- //public static final int TYMED_GDI = 16;
- public static final int TYMED_HGLOBAL = 1;
- //public static final int TYMED_ISTORAGE = 8;
- //public static final int TYMED_ISTREAM = 4;
- //public static final int TYMED_MFPICT = 32;
- //public static final int TYMED_NULL = 0;
-
- public static final short DISPATCH_METHOD = 0x1; //Dispatch Constants
- public static final short DISPATCH_PROPERTYGET = 0x2;
- public static final short DISPATCH_PROPERTYPUT = 0x4;
- public static final short DISPATCH_PROPERTYPUTREF = 0x8;
- //public static final short DISPID_CONSTRUCTOR = -6;
- //public static final short DISPID_DESTRUCTOR = -7;
- //public static final short DISPID_EVALUATE = -5;
- //public static final short DISPID_NEWENUM = -4;
- public static final short DISPID_PROPERTYPUT = -3;
- //public static final short DISPID_UNKNOWN = -1;
- //public static final short DISPID_VALUE = 0;
-
- // Variant types
- public static final short VT_BOOL = 11; // Boolean; True=-1, False=0.
- public static final short VT_BSTR = 8; // Binary String.
- public static final short VT_BYREF = 16384; // By reference - must be combined with one of the othre VT values
- public static final short VT_CY = 6; // Currency.
- public static final short VT_DATE = 7; // Date.
- public static final short VT_DISPATCH = 9; // IDispatch
- public static final short VT_EMPTY = 0; // Not specified.
- public static final short VT_ERROR = 10; // Scodes.
- public static final short VT_I2 = 2; // 2-byte signed int.
- public static final short VT_I4 = 3; // 4-byte signed int.
- public static final short VT_NULL = 1; // Null.
- public static final short VT_R4 = 4; // 4-byte real.
- public static final short VT_R8 = 5; // 8-byte real.
- public static final short VT_UI1 = 17; // Unsigned char.
- public static final short VT_UI4 = 19; // Unsigned int.
- public static final short VT_UNKNOWN = 13; // IUnknown FAR*.
- public static final short VT_VARIANT = 12; // VARIANT FAR*.
-
-public static final native int CLSIDFromProgID(char[] lpszProgID, GUID pclsid);
-public static final native int CLSIDFromString(char[] lpsz, GUID pclsid);
-public static final native int CoCreateInstance(
- GUID rclsid,
- int pUnkOuter,
- int dwClsContext,
- GUID riid,
- int[] ppv
-);
-
-public static final native void CoFreeUnusedLibraries();
-public static final native int CoGetClassObject(GUID rclsid, int dwClsContext, int pServerInfo, GUID riid, int[] ppv);
-public static final native int CoLockObjectExternal(
- int pUnk, //Pointer to object to be locked or unlocked
- boolean fLock, //TRUE = lock, FALSE = unlock
- boolean fLastUnlockReleases //TRUE = release all pointers to object
-);
-public static final native int CoTaskMemAlloc(int cb); //Size in bytes of memory block to be allocated
-public static final native void CoTaskMemFree(int pv);
-public static final native int DoDragDrop(
- int pDataObject, //Pointer to the data object
- int pDropSource, //Pointer to the source
- int dwOKEffect, //Effects allowed by the source
- int[] pdwEffect //Pointer to effects on the source
-);
-
-public static final native int GetClassFile(
- char[] szFileName, //Pointer to filename for which you are requesting a CLSID
- GUID clsid //Pointer to location for returning the CLSID
-);
-public static final native int IIDFromString(char[] lpsz, GUID lpiid);
-private static GUID IIDFromString(String lpsz) {
- // create a null terminated array of char
- char[] buffer = (lpsz +"\0").toCharArray();
-
- // invoke system method
- GUID lpiid = new GUID();
- if (COM.IIDFromString(buffer, lpiid) == COM.S_OK)
- return lpiid;
- return null;
-}
-public static final native boolean IsEqualGUID(GUID rguid1, GUID rguid2);
-public static final native void MoveMemory(int Destination, FORMATETC Source, int Length);
-public static final native void MoveMemory(int DestinationPtr, GUID Source, int Length);
-public static final native void MoveMemory(int DestinationPtr, OLEINPLACEFRAMEINFO Source, int Length);
-public static final native void MoveMemory(int Destination, STATSTG Source, int Length);
-public static final native void MoveMemory(int Destination, STGMEDIUM Source, int Length);
-public static final native void MoveMemory(STGMEDIUM Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(DISPPARAMS Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(FORMATETC Destination, int Source, int Length);
-public static final native void MoveMemory(GUID Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(STATSTG Destination, int Source, int Length);
-public static final native void MoveMemory(TYPEATTR Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(RECT Destination, int Source, int Length);
-public static final native void MoveMemory(FUNCDESC1 Destination, int Source, int Length);
-public static final native void MoveMemory(VARDESC1 Destination, int Source, int Length);
-public static final native void MoveMemory(FUNCDESC2 Destination, int Source, int Length);
-public static final native void MoveMemory(VARDESC2 Destination, int Source, int Length);
-
-public static final native int OleCreate(GUID rclsid, GUID riid, int renderopt, FORMATETC pFormatEtc, int pClientSite, int pStg, int[] ppvObject);
-public static final native int OleCreateFromFile(
- GUID rclsid, //Reserved. Must be CLSID_NULL
- char[] lpszFileName, //Pointer to full path of file used to create object
- GUID riid, //Reference to the identifier of the interface to be used to
- // communicate with new object
- int renderopt, //Value from OLERENDER
- FORMATETC pFormatEtc, //Pointer to the FORMATETC structure
- int pClientSite, //Pointer to an interface
- int pStg, //Pointer tothe interface to be used as object storage
- int[] ppvObj); //Address of output variable that receives the interface pointer
- // requested in riid
-public static final native int OleCreatePropertyFrame(int hwndOwner,int x, int y, char[] lpszCaption, int cObjects, int[] lplpUnk, int cPages, int lpPageClsID, int lcid, int dwReserved, int lpvReserved);
-public static final native int OleDraw(int pUnk, //Pointer to the view object to be drawn
- int dwAspect, //How the object is to be represented
- int hdcDraw, //Device context on which to draw
- int lprcBounds);//Pointer to the rectangle in which the object is drawn
-public static final native int OleFlushClipboard();
-public static final native int OleGetClipboard(int[] ppDataObject);
-public static final native int OleIsCurrentClipboard(int pDataObject);
-public static final native boolean OleIsRunning(int pObject);
-public static final native int OleLoad(
- int pStg, //Pointer to the storage object from which to load
- GUID riid, //Reference to the identifier of the interface
- int pClientSite, //Pointer to the client site for the object
- int[] ppvObj //Address of output variable that receives the interface pointer requested in riid
-);
-public static final native int OleRun(int pUnknown);
-public static final native int OleSave(int pPS, int pStg,boolean fSameAsLoad);
-public static final native int OleSetClipboard(int pDataObject);
-public static final native int OleSetContainedObject(int pUnk, boolean fContained);
-public static final native int OleSetMenuDescriptor(int holemenu, int hwndFrame, int hwndActiveObject, int lpFrame, int lpActiveObj);
-public static final native int OleTranslateColor(int clr, int hpal, int[] pcolorref);
-public static final native int ProgIDFromCLSID(
- GUID clsid, //CLSID for which the ProgID is requested
- int[] lplpszProgID //Address of output variable that receives a pointer to the requested ProgID string
-);
-public static final native int RegisterDragDrop(
- int hwnd, //Handle to a window that can accept drops
- int pDropTarget //Pointer to object that is to be target of drop
-);
-public static final native void ReleaseStgMedium(
- int pmedium //Pointer to storage medium to be freed
-);
-public static final native int RevokeDragDrop(
- int hwnd //Handle to a window that can accept drops
-);
-public static final native int StgCreateDocfile(char[] pwcsName, int grfMode, int reserved, int[] ppstgOpen);
-public static final native int StgIsStorageFile(
- char[] pwcsName //Points to a path of the file to check
-);
-public static final native int StgOpenStorage(
- char[] pwcsName, //Points to the path of the file containing storage object
- int pstgPriority, //Points to a previous opening of a root storage object
- int grfMode, //Specifies the access mode for the object
- int snbExclude, //Points to an SNB structure specifying elements to be excluded
- int reserved, //Reserved; must be zero
- int[] ppstgOpen //Address of output variable that receives the IStorage interface pointer
-);
-public static final native int SysAllocString(char [] sz);
-public static final native void SysFreeString(int bstr);
-public static final native int SysStringByteLen(int bstr);
-public static final native int VariantChangeType(int pvargDest, int pvarSrc, short wFlags, short vt);
-public static final native int VariantClear(int pvarg);
-public static final native void VariantInit(int pvarg);
-public static final native int VtblCall(int fnNumber, int ppVtbl);
-public static final native int VtblCall(int fnNumber, int ppVtbl, char[] arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, char[] arg0, char[] arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, char[] arg0, int arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int[] arg4);
-public static final native int VtblCall(int fnNumber, int ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int arg4, int[] arg5);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int[] arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int[] arg2);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int[] arg3);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, DVTARGETDEVICE arg2, SIZE arg3);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, GUID arg2, int arg3, int[] arg4);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, FORMATETC arg1, int[] arg2);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, GUID arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, GUID arg1, int arg2, int arg3);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, GUID arg1, int arg2, int arg3, DISPPARAMS arg4, int arg5, EXCEPINFO arg6, int[] arg7);
-public static final native int VtblCall(int ppVtbl, int fnNumber, int arg0, STATSTG arg1, int[] arg2);
-public static final native int VtblCall(int fnNumber, int ppVtbl, MSG arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, MSG arg1, int arg2, int arg3, int arg4, RECT arg5);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, SIZE arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, boolean arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, CAUUID arg0);
-public static final native int VtblCall(int ppVtbl, int fnNumber, CONTROLINFO arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, FORMATETC arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, FORMATETC arg0, STGMEDIUM arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, FORMATETC arg0, STGMEDIUM arg1, boolean arg2);
-public static final native int VtblCall(int ppVtbl, int fnNumber, GUID arg0);
-public static final native int VtblCall(int ppVtbl, int fnNumber, GUID arg0, int[] arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int[] arg4);
-public static final native int VtblCall(int fnNumber, int ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int arg4);
-public static final native int VtblCall(int fnNumber, int ppVtbl, GUID arg0, int arg1, OLECMD arg2, OLECMDTEXT arg3);
-public static final native int VtblCall(int fnNumber, int ppVtbl, LICINFO arg0);
-public static final native int VtblCall(int fnNumber, int ppVtbl, RECT arg0, int arg1, boolean arg2);
-public static final native int VtblCall(int fnNumber, int ppVtbl, RECT arg0, RECT arg1);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1, int[] arg2, int[] arg3, int[] arg4);
-public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1, int arg2, int[] arg3);
-
-public static final native int WriteClassStg(int pStg, GUID rclsid);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
deleted file mode 100644
index b7581ed5d6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class CONTROLINFO
-{
- public int cb;
- public int hAccel;
- public short cAccel;
- public short filler;
- public int dwFlags;
-
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
deleted file mode 100644
index 72a3e944bc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class COSERVERINFO {
- public int dwReserved1;
- public int pwszName;
- public int pAuthInfo;
- public int dwReserved2;
-
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
deleted file mode 100644
index 95ee285d78..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class DISPPARAMS
-{
- public int rgvarg;
- public int rgdispidNamedArgs;
- public int cArgs;
- public int cNamedArgs;
-
- public static final int sizeof = 16;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
deleted file mode 100644
index f95abbfcac..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class DVTARGETDEVICE
-{
- public int tdSize;
- public short tdDriverNameOffset;
- public short tdDeviceNameOffset;
- public short tdPortNameOffset;
- public short tdExtDevmodeOffset;
- public byte tdData;
-
- public static final int sizeof = 13;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
deleted file mode 100644
index 2f4ceda693..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class EXCEPINFO
-{
- public short wCode;
- public short wReserved;
- public int bstrSource;
- public int bstrDescription;
- public int bstrHelpFile;
- public int dwHelpContext;
- public int pvReserved;
- public int pfnDeferredFillIn;
- public int scode;
-
- public static final int sizeof = 32;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
deleted file mode 100644
index 5dc80509d4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class FORMATETC
-{
- public int cfFormat;
- public int ptd;
- public int dwAspect;
- public int lindex;
- public int tymed;
-
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
deleted file mode 100644
index ed25a01c40..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class FUNCDESC1 {
- public int memid;
- public int lprgscode;
- public int lprgelemdescParam;
- public int funckind;
- public int invkind;
- public int callconv;
- public short cParams;
- public short cParamsOpt;
- public short oVft;
- public short cScodes;
- //ELEMDESC elemdescFunc;
- //TYPEDESC elemdescFunc.tdesc
- public int elemdescFunc_tdesc_union;
- public short elemdescFunc_tdesc_vt;
- public short elemdescFunc_tdesc_filler;
- //PARAMDESC elemdescFunc.paramdesc
- public int elemdescFunc_paramdesc_pparamdescex;
- public short elemdescFunc_paramdesc_wParamFlags;
- public short elemdescFunc_paramdesc_filler;
- public short wFuncFlags;
-
- public static final int sizeof = 50;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
deleted file mode 100644
index 501465932e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class FUNCDESC2 {
- public int memid;
- public int lprgscode;
- public int lprgelemdescParam;
- public int funckind;
- public int invkind;
- public int callconv;
- public short cParams;
- public short cParamsOpt;
- public short oVft;
- public short cScodes;
- //ELEMDESC elemdescFunc;
- //TYPEDESC elemdescFunc.tdesc
- public int elemdescFunc_tdesc_union;
- public short elemdescFunc_tdesc_vt;
- public short elemdescFunc_tdesc_filler;
- //IDLDESC elemdescFunc.idldesc
- public int elemdescFunc_idldesc_dwReserved;
- public short elemdescFunc_idldesc_wIDLFlags;
- public short elemdescFunc_idldesc_filler;
- public short wFuncFlags;
-
- public static final int sizeof = 50;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java
deleted file mode 100644
index c11d9bd26f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class GUID
-{
- public int data1;
- public short data2;
- public short data3;
- public byte b0;
- public byte b1;
- public byte b2;
- public byte b3;
- public byte b4;
- public byte b5;
- public byte b6;
- public byte b7;
-
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
deleted file mode 100644
index 8ddc0b578b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IClassFactory2 extends IUnknown
-{
-public IClassFactory2(int address) {
- super(address);
-}
-public int CreateInstanceLic(int pUnkOuter, int pUnkReserved, GUID riid, int bstrKey, int ppvObject[]) {
- return COM.VtblCall(7, address, pUnkOuter, pUnkReserved, riid, bstrKey, ppvObject);
-}
-public int GetLicInfo(LICINFO licInfo) {
- return COM.VtblCall(5, address, licInfo);
-}
-public int RequestLicKey(int dwReserved, int[] pBstrKey) {
- return COM.VtblCall(6, address, dwReserved, pBstrKey);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
deleted file mode 100644
index 5098b0e9b1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IConnectionPoint extends IUnknown
-{
-public IConnectionPoint(int address) {
- super(address);
-}
-public int Advise(int pUnk, int[] pdwCookie) {
- return COM.VtblCall(5, address, pUnk, pdwCookie);
-}
-public int Unadvise(int dwCookie) {
- return COM.VtblCall(6, address, dwCookie);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
deleted file mode 100644
index 8eb4d505b1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IConnectionPointContainer extends IUnknown
-{
-public IConnectionPointContainer(int address) {
- super(address);
-}
-public int FindConnectionPoint(GUID riid, int[] ppCP) {
- return COM.VtblCall(4, address, riid, ppCP);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
deleted file mode 100644
index f362cc0100..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IDataObject extends IUnknown {
-public IDataObject(int address) {
- super(address);
-}
-public int EnumFormatEtc(int dwDirection, int[] ppenumFormatetc) {
- return COM.VtblCall(8, address, dwDirection, ppenumFormatetc);
-}
-public int GetData(FORMATETC pFormatetc, STGMEDIUM pmedium) {
- //Called by a data consumer to obtain data from a source data object.
- //The GetData method renders the data described in the specified FORMATETC
- //structure and transfers it through the specified STGMEDIUM structure.
- //The caller then assumes responsibility for releasing the STGMEDIUM structure.
- return COM.VtblCall(3, address, pFormatetc, pmedium);
-}
-public int GetDataHere(FORMATETC pFormatetc, STGMEDIUM pmedium) {
- //Called by a data consumer to obtain data from a source data object.
- //This method differs from the GetData method in that the caller must
- //allocate and free the specified storage medium.
- return COM.VtblCall(4, address, pFormatetc, pmedium);
-}
-public int QueryGetData(FORMATETC pFormatetc) {
- return COM.VtblCall(5, address, pFormatetc);
-}
-public int SetData(
- FORMATETC pFormatetc, // Pointer to the FORMATETC structure
- STGMEDIUM pmedium, // Pointer to STGMEDIUM structure
- boolean fRelease // Indicates which object owns the storage medium after the call is completed
- ){
- return COM.VtblCall(7, address, pFormatetc, pmedium, fRelease);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
deleted file mode 100644
index e9dc3fa832..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class IDispatch extends IUnknown
-{
-public IDispatch(int address) {
- super(address);
-}
-public int GetIDsOfNames(GUID riid, String[] rgszNames, int cNames, int lcid, int[] rgDispId) {
-
- char[] buffer;
- int size = rgszNames.length;
-
- // create an array to hold the addresses
- int hHeap = OS.GetProcessHeap();
- int ppNames = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, size*4);
- int[] memTracker = new int[size];
-
- try {
- // add the address of each string to the array
-
- for (int i=0; i<size; i++){
- // create a null terminated array of char for each String
- int nameSize = rgszNames[i].length();
- buffer = new char[nameSize +1];
- rgszNames[i].getChars(0, nameSize, buffer, 0);
- // get the address of the start of the array of char
- int pName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, buffer.length * 2);
- OS.MoveMemory(pName, buffer, buffer.length * 2);
- // copy the address to the array of addresses
- COM.MoveMemory(ppNames + 4*i, new int[]{pName}, 4);
- // keep track of the Global Memory so we can free it
- memTracker[i] = pName;
- }
-
- return COM.VtblCall(5, address, new GUID(), ppNames, cNames, lcid, rgDispId);
-
- } finally {
- // free the memory
- for (int i=0; i<memTracker.length; i++){
- OS.HeapFree(hHeap, 0, memTracker[i]);
- }
- OS.HeapFree(hHeap, 0, ppNames);
- }
-}
-public int GetTypeInfo(int iTInfo, int lcid, int[] ppTInfo ){
- return COM.VtblCall(4, address, iTInfo, lcid, ppTInfo);
-}
-public int GetTypeInfoCount(int[] pctinfo ){
- return COM.VtblCall(3, address, pctinfo);
-}
-public int Invoke(int dispIdMember, GUID riid, int lcid, int dwFlags, DISPPARAMS pDispParams, int pVarResult, EXCEPINFO pExcepInfo, int pArgErr[]) {
- return COM.VtblCall(6, address, dispIdMember, riid, lcid, dwFlags, pDispParams, pVarResult, pExcepInfo, pArgErr);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnum.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
deleted file mode 100644
index 20bfa0d2e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IEnum extends IUnknown
-{
-public IEnum(int address) {
- super(address);
-}
-public int Clone( int[] ppenum ){
- return COM.VtblCall(6, address, ppenum);
-}
-public int Next(int celt, int rgelt, int[] pceltFetched ){
- return COM.VtblCall(3, address, celt, rgelt, pceltFetched);
-}
-public int Reset() {
- return COM.VtblCall(5, address);
-}
-public int Skip(int celt){
- return COM.VtblCall(4, address, celt);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
deleted file mode 100644
index 86ef9e7204..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IEnumFORMATETC extends IEnum {
-public IEnumFORMATETC(int address) {
- super(address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
deleted file mode 100644
index 73f69c2667..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IEnumSTATSTG extends IEnum {
-public IEnumSTATSTG(int address) {
- super(address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IFont.java
deleted file mode 100644
index 1f113189f7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IFont.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IFont extends IUnknown {
-public IFont(int address) {
- super(address);
-}
-public int get_hFont(int[] phfont){
- return COM.VtblCall(3, address, phfont);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
deleted file mode 100644
index 50a7c9460d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IMoniker extends IPersist
-{
-public IMoniker(int address) {
- super(address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
deleted file mode 100644
index 0d86e7f55b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IOleCommandTarget extends IUnknown {
-public IOleCommandTarget(int address) {
- super(address);
-}
-public int Exec(
- GUID pguidCmdGroup, // Pointer to command group
- int nCmdID, // Identifier of command to execute
- int nCmdExecOpt, // Options for executing the command
- int pvaIn, // Pointer to input arguments
- int pvaOut // Pointer to command output
-){
- return COM.VtblCall(4, address, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
-}
-public int QueryStatus(
- GUID pguidCmdGroup, // Pointer to command group
- int cCmds, // Number of commands in prgCmds array
- OLECMD prgCmds, // Array of commands
- OLECMDTEXT pCmdText // Pointer to name or status of command
-){
- // we only support querying for one command at a time
- if (cCmds > 1) return COM.E_INVALIDARG;
- return COM.VtblCall(3, address, pguidCmdGroup, cCmds, prgCmds, pCmdText);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
deleted file mode 100644
index 51f6c3df93..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IOleControl extends IUnknown
-{
-public IOleControl(int address) {
- super(address);
-}
-public int GetControlInfo(CONTROLINFO pCI) {
- return COM.VtblCall(3, address, pCI);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
deleted file mode 100644
index da57f127f1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class IOleInPlaceActiveObject extends IOleWindow
-{
-public IOleInPlaceActiveObject(int address) {
- super(address);
-}
-public int TranslateAccelerator(MSG lpmsg) {
- //lpmsg - Pointer to message that may need translating
- return COM.VtblCall(5, address, lpmsg);
-}
-public int ResizeBorder(RECT prcBorder, int pUIWindow, boolean fFrameWindow) {
- return COM.VtblCall(8, address, prcBorder, pUIWindow, fFrameWindow);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
deleted file mode 100644
index d0c6cc4c61..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class IOleInPlaceObject extends IOleWindow
-{
-public IOleInPlaceObject(int address) {
- super(address);
-}
-public int InPlaceDeactivate() {
- return COM.VtblCall(5, address);
-}
-public int SetObjectRects(RECT lprcPosRect, RECT lprcClipRect) {
- return COM.VtblCall(7, address, lprcPosRect, lprcClipRect);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
deleted file mode 100644
index a676e8090e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IOleLink extends IUnknown
-{
-public IOleLink(int address) {
- super(address);
-}
-public int BindIfRunning() {
- return COM.VtblCall(10, address);
-}
-public int GetSourceMoniker(int[] ppmk) {
- return COM.VtblCall(6, address, ppmk);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
deleted file mode 100644
index 114232a932..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class IOleObject extends IUnknown
-{
-public IOleObject(int address) {
- super(address);
-}
-public int Advise(int pAdvSink, int pdwConnection[]) {
- return COM.VtblCall(19, address, pAdvSink, pdwConnection);
-}
-public int Close(int dwSaveOption) {
- return COM.VtblCall(6, address, dwSaveOption);
-}
-public int DoVerb(int iVerb, MSG lpmsg, int pActiveSite, int lindex, int hwndParent, RECT lprcPosRect) {
- return COM.VtblCall(11, address, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
-}
-public int GetExtent(int dwDrawAspect, SIZE pSizel) {
- return COM.VtblCall(18, address, dwDrawAspect, pSizel);
-}
-public int SetClientSite(int pClientSite) {
- return COM.VtblCall(3, address, pClientSite);
-}
-public int SetExtent(int dwDrawAspect, SIZE pSizel) {
- return COM.VtblCall(17, address, dwDrawAspect, pSizel);
-}
-public int SetHostNames(String szContainerApp, String szContainerObj) {
-
- // create a null terminated array of char
- char[] buffer1 = null;
- if (szContainerApp != null) {
- int count1 = szContainerApp.length();
- buffer1 = new char[count1 + 1];
- szContainerApp.getChars(0, count1, buffer1, 0);
- }
-
- // create a null terminated array of char
- char[] buffer2 = null;
- if (szContainerObj != null) {
- int count2 = szContainerObj.length();
- buffer2 = new char[count2 + 1];
- szContainerObj.getChars(0, count2, buffer2, 0);
- }
- return COM.VtblCall(5, address, buffer1, buffer2);
-}
-public int Update() {
- return COM.VtblCall(13, address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
deleted file mode 100644
index acb1f61664..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IOleWindow extends IUnknown {
-public IOleWindow(int address) {
- super(address);
-}
-public int GetWindow(int phwnd[]) {
- return COM.VtblCall(3, address, phwnd);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersist.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
deleted file mode 100644
index 44f30de396..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IPersist extends IUnknown
-{
-public IPersist(int address) {
- super(address);
-}
-public int GetClassID(GUID pClassID) {
- return COM.VtblCall(3, address, pClassID);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
deleted file mode 100644
index e11d8f971c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IPersistStorage extends IPersist
-{
-public IPersistStorage(int address) {
- super(address);
-}
-public int IsDirty() {
- return COM.VtblCall(4, address);
-}
-public int InitNew(int pStg) {
- return COM.VtblCall(5, address, pStg);
-}
-public int Load(int pStg) {
- return COM.VtblCall(6, address, pStg);
-}
-public int Save(int pStgSave, boolean fSameAsLoad) {
- return COM.VtblCall(7, address, pStgSave, fSameAsLoad);
-}
-public int SaveCompleted(int pStgNew) {
- return COM.VtblCall(8, address, pStgNew);
-}
-public int HandsOffStorage(){
- return COM.VtblCall(9, address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
deleted file mode 100644
index e6ae63f38b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IProvideClassInfo extends IUnknown
-{
-public IProvideClassInfo(int address) {
- super(address);
-}
-public int GetClassInfo(int[] ppTI) {
- return COM.VtblCall(3, address, ppTI);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
deleted file mode 100644
index bcba483008..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IProvideClassInfo2 extends IProvideClassInfo
-{
-public IProvideClassInfo2(int address) {
- super(address);
-}
-public int GetGUID(int dwGuidKind, GUID pGUID) {
- return COM.VtblCall(4, address, dwGuidKind, pGUID);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
deleted file mode 100644
index 4c73a077c2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class ISpecifyPropertyPages extends IUnknown {
-
-public ISpecifyPropertyPages(int address) {
- super(address);
-}
-public int GetPages(CAUUID pPages){
- return COM.VtblCall(3, address, pPages);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStorage.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
deleted file mode 100644
index ad840e36e3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IStorage extends IUnknown
-{
-public IStorage(int address) {
- super(address);
-}
-public int Commit(int grfCommitFlag) {
- return COM.VtblCall(9, address, grfCommitFlag);
-}
-public int CopyTo(
- int ciidExclude, //Number of elements in rgiidExclude
- GUID rgiidExclude, //Array of interface identifiers (IIDs)
- String[] snbExclude, //Points to a block of stream names in the storage object
- int pstgDest //Points to destination storage object
- ){
- // we only support snbExclude = null
- if (snbExclude != null) {
- return COM.E_INVALIDARG;
- }
- return COM.VtblCall(7, address, ciidExclude, rgiidExclude, 0, pstgDest);
-}
-public int CreateStorage(
- String pwcsName, //Pointer to the name of the new storage object
- int grfMode, //Access mode for the new storage object
- int reserved1, //Reserved; must be zero
- int reserved2, //Reserved; must be zero
- int[] ppStg //Pointer to new storage object
-){
-
- // create a null terminated array of char
- char[] buffer = null;
- if (pwcsName != null) {
- buffer = (pwcsName+"\0").toCharArray();
- }
-
- return COM.VtblCall(5, address, buffer, grfMode, reserved1, reserved2, ppStg);
-}
-public int CreateStream(
- String pwcsName, //Pointer to the name of the new stream
- int grfMode, //Access mode for the new stream
- int reserved1, //Reserved; must be zero
- int reserved2, //Reserved; must be zero
- int[] ppStm //Pointer to new stream object
-){
-
- // create a null terminated array of char
- char[] buffer = null;
- if (pwcsName != null) {
- buffer = (pwcsName+"\0").toCharArray();
- }
-
- return COM.VtblCall(3, address, buffer, grfMode, reserved1, reserved2, ppStm);
-}
-public int DestroyElement(String pwcsName) {
-
- // create a null terminated array of char
- char[] buffer = null;
- if (pwcsName != null) {
- buffer = (pwcsName+"\0").toCharArray();
- }
- return COM.VtblCall(12, address, buffer);
-}
-public int EnumElements(
- int reserved1, //Reserved; must be zero
- int reserved2, //Reserved; must be NULL
- int reserved3, //Reserved; must be zero
- int[] ppenum //Pointer to output variable that
- // receives the IEnumSTATSTG interface
-){
- return COM.VtblCall(11, address, reserved1, reserved2, reserved3, ppenum);
-}
-public int OpenStorage(
- String pwcsName, //Pointer to the name of the
- // storage object to open
- int pstgPriority, //Must be NULL.
- int grfMode, //Access mode for the new storage object
- String snbExclude[], //Must be NULL.
- int reserved, //Reserved; must be zero
- int[] ppStg //Pointer to opened storage object
-){
-
- // create a null terminated array of char
- char[] buffer = null;
- if (pwcsName != null) {
- buffer = (pwcsName+"\0").toCharArray();
- }
-
- // we only support the case where snbExclude = null
- if (snbExclude != null) {
- return COM.E_INVALIDARG;
- }
- return COM.VtblCall(6, address, buffer, pstgPriority, grfMode, 0, reserved, ppStg);
-}
-public int OpenStream(
- String pwcsName, //Pointer to name of stream to open
- int reserved1, //Reserved; must be NULL
- int grfMode, //Access mode for the new stream
- int reserved2, //Reserved; must be zero
- int[] ppStm //Pointer to output variable
- // that receives the IStream interface pointer
-) {
-
- // create a null terminated array of char
- char[] buffer = null;
- if (pwcsName != null) {
- buffer = (pwcsName+"\0").toCharArray();
- }
-
- return COM.VtblCall(4, address, buffer, reserved1, grfMode, reserved2, ppStm);
-}
-public int RenameElement(
- String pwcsOldName, //Pointer to the name of the
- // element to be changed
- String pwcsNewName //Pointer to the new name for
- // the specified element
-){
-
- // create a null terminated array of char
- char[] buffer1 = null;
- if (pwcsOldName != null) {
- buffer1 = (pwcsOldName+"\0").toCharArray();
- }
- // create a null terminated array of char
- char[] buffer2 = null;
- if (pwcsNewName != null) {
- buffer2 = (pwcsNewName+"\0").toCharArray();
- }
- return COM.VtblCall(13, address, buffer1, buffer2);
-}
-public int Revert() {
- return COM.VtblCall(10, address);
-}
-public int SetClass(
- GUID clsid //CLSID to be assigned to the storage object
-){
- return COM.VtblCall(15, address, clsid);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStream.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStream.java
deleted file mode 100644
index 658d0d0bdc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IStream.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IStream extends IUnknown {
-public IStream(int address) {
- super(address);
-}
-public int Clone(
- int[] ppstm //Pointer to location for pointer to the new stream object
-){
- return COM.VtblCall(13, address, ppstm);
-}
-public int Commit( int grfCommitFlags //Specifies how changes are committed
-){
- return COM.VtblCall(8, address, grfCommitFlags);
-}
-public int Read(int pv, int cb, int[] pcbWritten) {
- return COM.VtblCall(3, address, pv, cb, pcbWritten);
-}
-public int Revert(){
- return COM.VtblCall(9, address);
-}
-public int Write(int pv, int cb, int[] pcbWritten) {
- return COM.VtblCall(4, address, pv, cb, pcbWritten);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
deleted file mode 100644
index c67a5069ef..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.OS;
-
-public class ITypeInfo extends IUnknown
-{
-
-public ITypeInfo(int address) {
- super(address);
-}
-public int GetDocumentation(int index, String[] name, String[] docString, int[] pdwHelpContext, String[] helpFile ) {
- int[] pBstrName = null;
- if (name != null) pBstrName = new int[1];
- int[] pBstrDocString = null;
- if (docString != null) pBstrDocString = new int[1];
- int[] pBstrHelpFile = null;
- if (helpFile != null) pBstrHelpFile = new int[1];
- int rc = COM.VtblCall(12, address, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
- if (name != null && pBstrName[0] != 0) {
- int size = COM.SysStringByteLen(pBstrName[0]);
- if (size > 0){
- // get the unicode character array from the global memory and create a String
- char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
- COM.MoveMemory(buffer, pBstrName[0], size);
- name[0] = new String(buffer);
- int subindex = name[0].indexOf("\0");
- if (subindex > 0)
- name[0] = name[0].substring(0, subindex);
- }
- COM.SysFreeString(pBstrName[0]);
- }
- if (docString != null && pBstrDocString[0] != 0) {
- int size = COM.SysStringByteLen(pBstrDocString[0]);
- if (size > 0){
- // get the unicode character array from the global memory and create a String
- char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
- COM.MoveMemory(buffer, pBstrDocString[0], size);
- docString[0] = new String(buffer);
- int subindex = docString[0].indexOf("\0");
- if (subindex > 0)
- docString[0] = docString[0].substring(0, subindex);
- }
- COM.SysFreeString(pBstrDocString[0]);
- }
- if (helpFile != null && pBstrHelpFile[0] != 0) {
- int size = COM.SysStringByteLen(pBstrHelpFile[0]);
- if (size > 0){
- // get the unicode character array from the global memory and create a String
- char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
- COM.MoveMemory(buffer, pBstrHelpFile[0], size);
- helpFile[0] = new String(buffer);
- int subindex = helpFile[0].indexOf("\0");
- if (subindex > 0)
- helpFile[0] = helpFile[0].substring(0, subindex);
- }
- COM.SysFreeString(pBstrHelpFile[0]);
- }
- return rc;
-}
-public int GetFuncDesc(int index, int[] ppFuncDesc) {
- return COM.VtblCall(5, address, index, ppFuncDesc);
-}
-public int GetIDsOfNames(String[] rgszNames, int cNames, int[] pMemId) {
-
- char[] buffer;
- int size = rgszNames.length;
-
- // create an array to hold the addresses
- int hHeap = OS.GetProcessHeap();
- int ppNames = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, size*4);
- int[] memTracker = new int[size];
-
- try {
- // add the address of each string to the array
-
- for (int i=0; i<size; i++){
- // create a null terminated array of char for each String
- int nameSize = rgszNames[i].length();
- buffer = new char[nameSize +1];
- rgszNames[i].getChars(0, nameSize, buffer, 0);
- // get the address of the start of the array of char
- int pName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, buffer.length * 2);
- OS.MoveMemory(pName, buffer, buffer.length * 2);
- // copy the address to the array of addresses
- COM.MoveMemory(ppNames + 4*i, new int[]{pName}, 4);
- // keep track of the Global Memory so we can free it
- memTracker[i] = pName;
- }
-
- return COM.VtblCall(10, address, ppNames, cNames, pMemId);
-
- } finally {
- // free the memory
- for (int i=0; i<memTracker.length; i++){
- OS.HeapFree(hHeap, 0, memTracker[i]);
- }
- OS.HeapFree(hHeap, 0, ppNames);
- }
-}
-
-public int GetImplTypeFlags(int index, int[] pImplTypeFlags) {
- return COM.VtblCall(9, address, index, pImplTypeFlags);
-}
-public int GetNames(int memid, String[] names, int cMaxNames, int[] pcNames){
-
- int nameSize = names.length;
- int[] rgBstrNames = new int[nameSize];
- int rc = COM.VtblCall(7, address, memid, rgBstrNames, nameSize, pcNames);
-
- if (rc == COM.S_OK) {
- for (int i = 0; i < pcNames[0]; i++) {
- int size = COM.SysStringByteLen(rgBstrNames[i]);
- if (size > 0){
- // get the unicode character array from the global memory and create a String
- char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
- COM.MoveMemory(buffer, rgBstrNames[i], size);
- names[i] = new String(buffer);
- int subindex = names[i].indexOf("\0");
- if (subindex > 0)
- names[i] = names[i].substring(0, subindex);
- }
- COM.SysFreeString(rgBstrNames[i]);
- }
- }
-
- return rc;
-}
-public int GetRefTypeInfo(int hRefType, int[] ppTInfo) {
- return COM.VtblCall(14, address, hRefType, ppTInfo);
-}
-public int GetRefTypeOfImplType(int index, int[] pRefType) {
- return COM.VtblCall(8, address, index, pRefType);
-}
-public int GetTypeAttr(int[] ppTypeAttr) {
- return COM.VtblCall(3, address, ppTypeAttr);
-}
-public int GetVarDesc(int index, int[] ppVarDesc ) {
- return COM.VtblCall(6, address, index, ppVarDesc);
-}
-public int ReleaseFuncDesc(int pFuncDesc ) {
- return COM.VtblCall(20, address, pFuncDesc);
-}
-public int ReleaseTypeAttr(int pTypeAttr) {
- return COM.VtblCall(19, address, pTypeAttr);
-}
-public int ReleaseVarDesc(int pVarDesc ) {
- return COM.VtblCall(21, address, pVarDesc);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
deleted file mode 100644
index 9e168f70ae..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class IUnknown
-{
- int address;
-public IUnknown(int address) {
- this.address = address;
-}
-public int AddRef() {
- return COM.VtblCall(1, address);
-}
-public int getAddress() {
- return address;
-}
-public int QueryInterface(GUID riid, int ppvObject[]) {
- return COM.VtblCall(0, address, riid, ppvObject);
-}
-public int Release() {
- return COM.VtblCall(2, address);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
deleted file mode 100644
index 7124f871e2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.win32.*;
-
-public class IViewObject2 extends IUnknown
-{
-public IViewObject2(int address) {
- super(address);
-}
-public int GetExtent(int dwAspect, int lindex, DVTARGETDEVICE ptd, SIZE lpsizel) {
- return COM.VtblCall(9, address, dwAspect, lindex, ptd, lpsizel);
-}
-public int SetAdvise(int dwAspects, int dwAdvf, int pIAdviseSink) {
- return COM.VtblCall(7, address, dwAspects, dwAdvf, pIAdviseSink);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
deleted file mode 100644
index f4b54163b3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class LICINFO
-{
- public int cbLicInfo;
- public int fRuntimeKeyAvail;
- public int fLicVerified;
-
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
deleted file mode 100644
index 9ded930322..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class OLECMD {
- public int cmdID;
- public int cmdf;
-
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
deleted file mode 100644
index ee5594b3e4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class OLECMDTEXT {
- public int cmdtextf;
- public int cwActual;
- public int cwBuf;
- public short rgwz;
-
- // Note: this is a variable sized struct. The last field rgwz can vary in size.
- // Currently we do not use this field and do not support accessing anything more
- // than the first char in the field.
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
deleted file mode 100644
index 7459b53de1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class OLEINPLACEFRAMEINFO
-{
-
- public int cb;
- public int fMDIApp;
- public int hwndFrame;
- public int haccel;
- public int cAccelEntries;
-
- public static final int sizeof = 20;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
deleted file mode 100644
index abb2e3ea23..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class STATSTG {
- public int pwcsName;
- public int type;
- public long cbSize;
- //FILETIME mtime;
- public int mtime_dwLowDateTime;
- public int mtime_dwHighDateTime;
- //FILETIME ctime;
- public int ctime_dwLowDateTime;
- public int ctime_dwHighDateTime;
- //FILETIME atime;
- public int atime_dwLowDateTime;
- public int atime_dwHighDateTime;
- public int grfMode;
- public int grfLocksSupported;
- //GUID clsid;
- public int clsid_data1;
- public short clsid_data2;
- public short clsid_data3;
- public byte clsid_b0;
- public byte clsid_b1;
- public byte clsid_b2;
- public byte clsid_b3;
- public byte clsid_b4;
- public byte clsid_b5;
- public byte clsid_b6;
- public byte clsid_b7;
- public int grfStateBits;
- public int reserved;
-
- public static final int sizeof = 72;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
deleted file mode 100644
index edf791bf8a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class STGMEDIUM
-{
- public int tymed;
- public int unionField;
- public int pUnkForRelease;
-
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
deleted file mode 100644
index f127ba3939..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public final class TYPEATTR
-{
- //public GUID guid
- public int guid_data1;
- public short guid_data2;
- public short guid_data3;
- public byte guid_b0;
- public byte guid_b1;
- public byte guid_b2;
- public byte guid_b3;
- public byte guid_b4;
- public byte guid_b5;
- public byte guid_b6;
- public byte guid_b7;
-
- public int lcid;
- public int dwReserved;
- public int memidConstructor;
- public int memidDestructor;
- public int lpstrSchema;
- public int cbSizeInstance;
- public int typekind;
- public short cFuncs;
- public short cVars;
- public short cImplTypes;
- public short cbSizeVft;
- public short cbAlignment;
- public short wTypeFlags;
- public short wMajorVerNum;
- public short wMinorVerNum;
-
- // public TYPEDESC tdescAlias
- public int tdescAlias_unionField;
- public short tdescAlias_vt;
- // this filler field is required for proper byte alignment
- public short filler;
-
- // public IDLDESC idldesctype
- public int idldescType_dwReserved;
- public short idldescType_wIDLFlags;
-
- public static final int sizeof = 74;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
deleted file mode 100644
index 1f5d9cf023..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class VARDESC1 {
- public int memid;
- public int lpstrSchema;
- public int unionField;
- //ELEMDESC elemdescVar
- //TYPEDESC elemdescVar.tdesc
- public int elemdescVar_tdesc_union;
- public short elemdescVar_tdesc_vt;
- public short elemdescVar_tdesc_filler;
- //PARAMDESC elemdescFunc.paramdesc
- public int elemdescVar_paramdesc_pparamdescex;
- public short elemdescVar_paramdesc_wParamFlags;
- public short elemdescVar_paramdesc_filler;
- public short wVarFlags;
- public short filler;
- public int varkind;
-
- public static final int sizeof = 36;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
deleted file mode 100644
index a422c5f454..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.internal.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class VARDESC2 {
- public int memid;
- public int lpstrSchema;
- public int unionField;
- //ELEMDESC elemdescVar
- //TYPEDESC elemdescVar.tdesc
- public int elemdescVar_tdesc_union;
- public short elemdescVar_tdesc_vt;
- public short elemdescVar_tdesc_filler;
- //IDLDESC elemdescFunc.idldesc
- public int elemdescFunc_idldesc_dwReserved;
- public short elemdescFunc_idldesc_wIDLFlags;
- public short elemdescFunc_idldesc_filler;
- public short wVarFlags;
- public short filler;
- public int varkind;
-
- public static final int sizeof = 36;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/package.html
deleted file mode 100644
index 1c2f7fe7d9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/package.html
+++ /dev/null
@@ -1,20 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT internal Win32 OLE implementation classes.
-<h2>
-Package Specification</h2>
-This package contains the internal classes which implement the Microsoft
-Win32 platform interface to the Object Linking and Embedding mechanism
-that the win32 variant of SWT is capable of using.
-<p>
-Referencing any of the classes in this package directly guarantees
-that the code is platform specific. Applications should not need to
-reference the classes in this package directly.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ACCEL.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ACCEL.java
deleted file mode 100644
index e120333ed2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ACCEL.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class ACCEL {
- public byte fVirt;
- public short key;
- public short cmd;
- public static final int sizeof = OS.IsWinCE ? 8 : 6;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BITMAP.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BITMAP.java
deleted file mode 100644
index bd7fddbae7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BITMAP.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class BITMAP {
- public int bmType;
- public int bmWidth;
- public int bmHeight;
- public int bmWidthBytes;
- public short bmPlanes;
- public short bmBitsPixel;
- public int bmBits;
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java
deleted file mode 100644
index 62bff55770..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class BROWSEINFO {
- public int hwndOwner;
- public int pidlRoot;
- public int pszDisplayName;
- public int lpszTitle;
- public int ulFlags;
- public int lpfn;
- public int lParam;
- public int iImage;
- public static final int sizeof = 32;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java
deleted file mode 100644
index 3e55e87f0a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class CHOOSECOLOR {
- public int lStructSize;
- public int hwndOwner;
- public int hInstance;
- public int rgbResult;
- public int lpCustColors;
- public int Flags;
- public int lCustData;
- public int lpfnHook;
- public int lpTemplateName;
- public static final int sizeof = 36;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java
deleted file mode 100644
index ef117a13ce..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class CHOOSEFONT {
- public int lStructSize;
- public int hwndOwner;
- public int hDC;
- public int lpLogFont;
- public int iPointSize;
- public int Flags;
- public int rgbColors;
- public int lCustData;
- public int lpfnHook;
- public int lpTemplateName;
- public int hInstance;
- public int lpszStyle;
- public short nFontType;
- public int nSizeMin;
- public int nSizeMax;
- public static final int sizeof = 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java
deleted file mode 100644
index 47c61ba3d7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class COMPOSITIONFORM {
- public int dwStyle;
-// POINT ptCurrentPos;
- public int x, y;
-// RECT rcArea;
- public int left, top, right, bottom;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java
deleted file mode 100644
index 20ce99ee28..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class CREATESTRUCT {
- public int lpCreateParams;
- public int hInstance;
- public int hMenu;
- public int hwndParent;
- public int cy;
- public int cx;
- public int y;
- public int x;
- public int style;
- public int lpszName;
- public int lpszClass;
- public int dwExStyle;
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DIBSECTION.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DIBSECTION.java
deleted file mode 100644
index a4f81b07e4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DIBSECTION.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class DIBSECTION extends BITMAP {
- public int biSize;
- public int biWidth;
- public int biHeight;
- public short biPlanes;
- public short biBitCount;
- public int biCompression;
- public int biSizeImage;
- public int biXPelsPerMeter;
- public int biYPelsPerMeter;
- public int biClrUsed;
- public int biClrImportant;
- public int dsBitfields0;
- public int dsBitfields1;
- public int dsBitfields2;
- public int dshSection;
- public int dsOffset;
- public static final int sizeof = 84;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java
deleted file mode 100644
index cf7feb6443..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class DLLVERSIONINFO {
- public int cbSize;
- public int dwMajorVersion;
- public int dwMinorVersion;
- public int dwBuildNumber;
- public int dwPlatformID;
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DOCINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DOCINFO.java
deleted file mode 100644
index 2bf47fc62c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DOCINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class DOCINFO {
- public int cbSize;
- public int lpszDocName; // LPCTSTR
- public int lpszOutput; // LPCTSTR
- public int lpszDatatype;// LPCTSTR
- public int fwType; // DWORD
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java
deleted file mode 100644
index f521b51c65..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class DRAWITEMSTRUCT {
- public int CtlType;
- public int CtlID;
- public int itemID;
- public int itemAction;
- public int itemState;
- public int hwndItem;
- public int hDC;
-// public RECT rcItem;
- public int left, top, bottom, right;
- public int itemData;
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DROPFILES.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DROPFILES.java
deleted file mode 100644
index fa2e29651c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DROPFILES.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class DROPFILES {
- public int pFiles; // Offset of the file list from the beginning of this structure, in bytes.
- //public POINT pt; // Drop point. The coordinates depend on fNC.
- public int pt_x;
- public int pt_y;
- public int fNC; // Nonclient area flag. If this member is TRUE, pt specifies the screen
- // coordinates of a point in a window's nonclient area. If it is FALSE,
- // pt specifies the client coordinates of a point in the client area.
- public int fWide; // Value that indicates whether the file contains ANSI or Unicode
- // characters. If it is zero, it contains ANSI characters. Otherwise, it
- // contains Unicode characters.
-
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/FILETIME.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/FILETIME.java
deleted file mode 100644
index 638964e661..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/FILETIME.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class FILETIME {
- public int dwLowDateTime;
- public int dwHighDateTime;
- static final public int sizeof = 8;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GCP_RESULTS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GCP_RESULTS.java
deleted file mode 100644
index 84fc901602..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GCP_RESULTS.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class GCP_RESULTS {
- public int lStructSize;
- public int lpOutString;
- public int lpOrder;
- public int lpDx;
- public int lpCaretPos;
- public int lpClass;
- public int lpGlyphs;
- public int nGlyphs;
- public int nMaxFit;
- public static final int sizeof = 36;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GRADIENT_RECT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GRADIENT_RECT.java
deleted file mode 100644
index 7fe9d7307b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/GRADIENT_RECT.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class GRADIENT_RECT {
- public int UpperLeft;
- public int LowerRight;
- public static final int sizeof = 8;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HDITEM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HDITEM.java
deleted file mode 100644
index 9f77689c42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HDITEM.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class HDITEM {
- public int mask;
- public int cxy;
- public int pszText;
- public int hbm;
- public int cchTextMax;
- public int fmt;
- public int lParam;
- public int iImage;
- public int iOrder;
- public static int sizeof = 36;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HELPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HELPINFO.java
deleted file mode 100644
index b26f03b462..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/HELPINFO.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class HELPINFO {
- public int cbSize;
- public int iContextType;
- public int iCtrlId;
- public int hItemHandle;
- public int dwContextId;
-// POINT MousePos
- public int x;
- public int y;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ICONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ICONINFO.java
deleted file mode 100644
index 705afc412e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/ICONINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class ICONINFO {
- public boolean fIcon;
- public int xHotspot;
- public int yHotspot;
- public int hbmMask;
- public int hbmColor;
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java
deleted file mode 100644
index 353bf4845b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class INITCOMMONCONTROLSEX {
- public int dwSize;
- public int dwICC;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java
deleted file mode 100644
index 2ed2297c01..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LOGBRUSH {
- public int lbStyle;
- public int lbColor;
- public int lbHatch;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGFONT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGFONT.java
deleted file mode 100644
index 99716291d6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGFONT.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LOGFONT {
- public int lfHeight;
- public int lfWidth;
- public int lfEscapement;
- public int lfOrientation;
- public int lfWeight;
- public byte lfItalic;
- public byte lfUnderline;
- public byte lfStrikeOut;
- public byte lfCharSet;
- public byte lfOutPrecision;
- public byte lfClipPrecision;
- public byte lfQuality;
- public byte lfPitchAndFamily;
-// TCHAR lfFaceName[LF_FACESIZE];
- public char
- lfFaceName0, lfFaceName1, lfFaceName2, lfFaceName3,
- lfFaceName4, lfFaceName5, lfFaceName6, lfFaceName7,
- lfFaceName8, lfFaceName9, lfFaceName10, lfFaceName11,
- lfFaceName12, lfFaceName13, lfFaceName14, lfFaceName15,
- lfFaceName16, lfFaceName17, lfFaceName18, lfFaceName19,
- lfFaceName20, lfFaceName21, lfFaceName22, lfFaceName23,
- lfFaceName24, lfFaceName25, lfFaceName26, lfFaceName27,
- lfFaceName28, lfFaceName29, lfFaceName30, lfFaceName31;
- public static final int sizeof = OS.IsUnicode ? 92 : 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGPEN.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGPEN.java
deleted file mode 100644
index 022df9c14d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LOGPEN.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LOGPEN {
- public int lopnStyle;
-// POINT lopnWidth;
- public int x;
- public int y;
- public int lopnColor;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LRESULT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LRESULT.java
deleted file mode 100644
index f475dee40c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LRESULT.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LRESULT {
- public int value;
- public static final LRESULT ONE = new LRESULT (1);
- public static final LRESULT ZERO = new LRESULT (0);
-public LRESULT (int value) {
- this.value = value;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java
deleted file mode 100644
index fc3d5bc9e3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LVCOLUMN {
- public int mask;
- public int fmt;
- public int cx;
- public int pszText;
- public int cchTextMax;
- public int iSubItem;
- public int iImage;
- public int iOrder;
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java
deleted file mode 100644
index c01a08011e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LVHITTESTINFO {
-// POINT pt;
- public int x;
- public int y;
- public int flags;
- public int iItem;
- public int iSubItem;
- public static int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVITEM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVITEM.java
deleted file mode 100644
index f7b4277364..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LVITEM.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class LVITEM {
- public int mask;
- public int iItem;
- public int iSubItem;
- public int state;
- public int stateMask;
- public int pszText;
- public int cchTextMax;
- public int iImage;
- public int lParam;
- public int iIndent;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java
deleted file mode 100644
index b4a7ea9572..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class MEASUREITEMSTRUCT {
- public int CtlType;
- public int CtlID;
- public int itemID;
- public int itemWidth;
- public int itemHeight;
- public int itemData;
- public static final int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUINFO.java
deleted file mode 100644
index c28ee6f543..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUINFO.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class MENUINFO {
- public int cbSize;
- public int fMask;
- public int dwStyle;
- public int cyMax;
- public int hbrBack;
- public int dwContextHelpID;
- public int dwMenuData;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java
deleted file mode 100644
index 176e567585..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class MENUITEMINFO {
- public int cbSize;
- public int fMask;
- public int fType;
- public int fState;
- public int wID;
- public int hSubMenu;
- public int hbmpChecked;
- public int hbmpUnchecked;
- public int dwItemData;
- public int dwTypeData;
- public int cch;
- public int hbmpItem;
- public static final int sizeof;
-
- /*
- * Feature in Windows. The hbmpItem field requires Windows 4.10
- * or greater. On Windows NT 4.0, passing in a larger struct size
- * in the cbSize field does nothing. On Windows 95, the MENUITEMINFO
- * calls fail when the struct size is too large. The fix is to ensure
- * that the correct struct size is used for the Windows platform.
- */
- static {
- sizeof = (OS.WIN32_MAJOR << 16 | OS.WIN32_MINOR) < (4 << 16 | 10) ? 44 : 48;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MSG.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MSG.java
deleted file mode 100644
index e4e1f3db43..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/MSG.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class MSG {
- public int hwnd;
- public int message;
- public int wParam;
- public int lParam;
- public int time;
-// public POINT pt;
- public int x, y;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHDR.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHDR.java
deleted file mode 100644
index 2302fdea6d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHDR.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class NMHDR {
- public int hwndFrom;
- public int idFrom;
- public int code;
- public static final int sizeof = 12;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHEADER.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHEADER.java
deleted file mode 100644
index 944a76ecd7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMHEADER.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class NMHEADER extends NMHDR {
- public int iItem;
- public int iButton;
- public int pitem;
- public static int sizeof = 24;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java
deleted file mode 100644
index 52d2cda846..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class NMLISTVIEW extends NMHDR {
- public int iItem;
- public int iSubItem;
- public int uNewState;
- public int uOldState;
- public int uChanged;
-// public POINT ptAction;
- public int x, y;
- public int lParam;
- public static int sizeof = 44;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java
deleted file mode 100644
index 8723a2fd3d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class NMTOOLBAR extends NMHDR {
- public int iItem;
-// TBBUTTON tbButton;
- public int iBitmap;
- public int idCommand;
- public byte fsState;
- public byte fsStyle;
- public int dwData;
- public int iString;
- public int cchText;
- public int pszText;
-// RECT rcButton;
- public int left, top, right, bottom;
- public static final int sizeof = 60;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java
deleted file mode 100644
index 155eb49bf9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class NMTTDISPINFO extends NMHDR {
- public int lpszText;
-// char szText[80];
-// public char [] szText = new char [80];
- public int hinst;
- public int uFlags;
- public int lParam;
- public static final int sizeof = OS.IsUnicode ? 188 : 108;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NONCLIENTMETRICS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NONCLIENTMETRICS.java
deleted file mode 100644
index 5742454caa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/NONCLIENTMETRICS.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class NONCLIENTMETRICS {
- public int cbSize;
- public int iBorderWidth;
- public int iScrollWidth;
- public int iScrollHeight;
- public int iCaptionWidth;
- public int iCaptionHeight;
-// LOGFONT lfCaptionFont;
- public LOGFONT lfCaptionFont = new LOGFONT ();
- public int iSmCaptionWidth;
- public int iSmCaptionHeight;
-// LOGFONT lfSmCaptionFont;
- public LOGFONT lfSmCaptionFont = new LOGFONT ();
- public int iMenuWidth;
- public int iMenuHeight;
-// LOGFONT lfMenuFont;
- public LOGFONT lfMenuFont = new LOGFONT ();
-// LOGFONT lfStatusFont;
- public LOGFONT lfStatusFont = new LOGFONT ();
-// LOGFONT lfMessageFont;
- public LOGFONT lfMessageFont = new LOGFONT ();
- public static final int sizeof = OS.IsUnicode ? 500 : 340;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java
deleted file mode 100644
index 74fbcad8b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class OPENFILENAME {
- public int lStructSize;
- public int hwndOwner;
- public int hInstance;
- public int lpstrFilter;
- public int lpstrCustomFilter;
- public int nMaxCustFilter;
- public int nFilterIndex;
- public int lpstrFile;
- public int nMaxFile;
- public int lpstrFileTitle;
- public int nMaxFileTitle;
- public int lpstrInitialDir;
- public int lpstrTitle;
- public int Flags;
- public short nFileOffset;
- public short nFileExtension;
- public int lpstrDefExt;
- public int lCustData;
- public int lpfnHook;
- public int lpTemplateName;
- public static final int sizeof = 76;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
deleted file mode 100644
index 8b5aa1246f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ /dev/null
@@ -1,2281 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-
-public class OS {
-
- /*
- * SWT Windows flags.
- */
- public static final boolean IsWin32s;
- public static final boolean IsWin95;
- public static final boolean IsWinNT;
- public static final boolean IsWinCE;
- public static final boolean IsDBLocale;
- public static final boolean IsUnicode;
- public static final int WIN32_MAJOR, WIN32_MINOR;
-
- /*
- * Flags for Window API GetVersionEx
- */
- public static final int VER_PLATFORM_WIN32s = 0;
- public static final int VER_PLATFORM_WIN32_WINDOWS = 1;
- public static final int VER_PLATFORM_WIN32_NT = 2;
- public static final int VER_PLATFORM_WIN32_CE = 3;
-
- /*
- * Initialize the Windows flags
- */
- static {
-
- /* Load the SWT library */
- Library.loadLibrary ("swt");
-
- /*
- * Try the UNICODE version of GetVersionEx first
- * and then the ANSI version. The UNICODE version
- * is present on all versions of Windows but is not
- * implemented on Win95/98/ME.
- *
- * NOTE: The value of OSVERSIONINFO.sizeof cannot
- * be static final because it relies on the Windows
- * platform version to be initialized and IsUnicode
- * has not been calculated. It must be initialized
- * here, after the platform is determined in order
- * for the value to be correct.
- */
- OSVERSIONINFO info = new OSVERSIONINFO ();
-
- // TEMPORARY CODE
- String MBCS = System.getProperty ("MBCS");
- if (MBCS != null) {
- info.dwOSVersionInfoSize = 148;
- OS.GetVersionExA (info);
- } else {
- info.dwOSVersionInfoSize = 276;
- if (!OS.GetVersionExW (info)) {
- info.dwOSVersionInfoSize = 148;
- OS.GetVersionExA (info);
- }
- }
- OSVERSIONINFO.sizeof = info.dwOSVersionInfoSize;
-
- IsWin32s = info.dwPlatformId == VER_PLATFORM_WIN32s;
- IsWin95 = info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
- IsWinNT = info.dwPlatformId == VER_PLATFORM_WIN32_NT;
- IsWinCE = info.dwPlatformId == VER_PLATFORM_WIN32_CE;
- WIN32_MAJOR = info.dwMajorVersion;
- WIN32_MINOR = info.dwMinorVersion;
-
- // TEMPORARY CODE
- if (MBCS != null) {
- IsUnicode = false;
- System.out.println ("*** SWT - Warning: Unicode disabled");
- } else {
- IsUnicode = !IsWin32s && !IsWin95;
- }
-
- /* Get the DBCS flag */
- int index = 0;
- while (index <= 0xFF) {
- if (OS.IsDBCSLeadByte ((byte) index)) break;
- index++;
- }
- IsDBLocale = index <= 0xFF;
- }
-
- /* Flag used on WinCE */
- static final int SYS_COLOR_INDEX_FLAG = OS.IsWinCE ? 0x40000000 : 0x0;
-
- /*
- * NOTE: There is a bug in JVM 1.2 where loading
- * a class with a large number of constants causes
- * a segment fault to occur sometime later after
- * the class is loaded. The fix is to break the
- * class up into a hierarchy of classes that each
- * contain a smaller number of constants. This
- * fix is not necessary at this time but is required
- * when all constants are uncommented. We have not
- * done the research to determine the limit.
- */
-
- /* Constants */
- public static final int BFFM_INITIALIZED = 0x1;
- public static final int BFFM_SETSELECTION = IsUnicode ? 0x467 : 0x466;
- public static final int BFFM_VALIDATEFAILED = IsUnicode ? 0x4 : 0x3;
- public static final int BFFM_VALIDATEFAILEDW = 0x4;
- public static final int BFFM_VALIDATEFAILEDA = 0x3;
- public static final int BF_BOTTOM = 0x8;
- public static final int BF_RIGHT = 0x4;
- public static final int BIF_EDITBOX = 0x10;
- public static final int BIF_RETURNONLYFSDIRS = 0x1;
- public static final int BIF_VALIDATE = 0x20;
- public static final int BITSPIXEL = 0xc;
- public static final int BLACKNESS = 0x42;
- public static final int BM_CLICK = 0xf5;
- public static final int BM_GETCHECK = 0xf0;
- public static final int BM_SETCHECK = 0xf1;
- public static final int BM_SETIMAGE = 0xf7;
- public static final int BM_SETSTYLE = 0xf4;
- public static final int BN_CLICKED = 0x0;
- public static final int BN_DOUBLECLICKED = 0x5;
- public static final int BST_CHECKED = 0x1;
- public static final int BST_UNCHECKED = 0x0;
- public static final int BS_BITMAP = 0x80;
- public static final int BS_CENTER = 0x300;
- public static final int BS_CHECKBOX = 0x2;
- public static final int BS_DEFPUSHBUTTON = 0x1;
- public static final int BS_FLAT = 0x8000;
- public static final int BS_GROUPBOX = 0x7;
- public static final int BS_ICON = 0x40;
- public static final int BS_LEFT = 0x100;
- public static final int BS_NOTIFY = 0x4000;
- public static final int BS_OWNERDRAW = 0xb;
- public static final int BS_PUSHBUTTON = 0x0;
- public static final int BS_PUSHLIKE = 0x1000;
- public static final int BS_RADIOBUTTON = 0x4;
- public static final int BS_RIGHT = 0x200;
- public static final int BS_SOLID = 0x0;
- public static final int BTNS_AUTOSIZE = 0x10;
- public static final int BTNS_BUTTON = 0x0;
- public static final int BTNS_CHECK = 0x2;
- public static final int BTNS_CHECKGROUP = 0x6;
- public static final int BTNS_DROPDOWN = 0x8;
- public static final int BTNS_GROUP = 0x4;
- public static final int BTNS_SEP = 0x1;
- public static final int CBN_EDITCHANGE = 0x5;
- public static final int CBN_KILLFOCUS = 0x4;
- public static final int CBN_SELCHANGE = 0x1;
- public static final int CBN_SETFOCUS = 0x3;
- public static final int CBS_AUTOHSCROLL = 0x40;
- public static final int CBS_DROPDOWN = 0x2;
- public static final int CBS_DROPDOWNLIST = 0x3;
- public static final int CBS_NOINTEGRALHEIGHT = 0x400;
- public static final int CBS_SIMPLE = 0x1;
- public static final int CB_ADDSTRING = 0x143;
- public static final int CB_DELETESTRING = 0x144;
- public static final int CB_ERR = 0xffffffff;
- public static final int CB_ERRSPACE = 0xfffffffe;
- public static final int CB_FINDSTRINGEXACT = 0x158;
- public static final int CB_GETCOUNT = 0x146;
- public static final int CB_GETCURSEL = 0x147;
- public static final int CB_GETDROPPEDSTATE = 0x157;
- public static final int CB_GETEDITSEL = 0x140;
- public static final int CB_GETITEMHEIGHT = 0x154;
- public static final int CB_GETLBTEXT = 0x148;
- public static final int CB_GETLBTEXTLEN = 0x149;
- public static final int CB_INSERTSTRING = 0x14a;
- public static final int CB_LIMITTEXT = 0x141;
- public static final int CB_RESETCONTENT = 0x14b;
- public static final int CB_SELECTSTRING = 0x14d;
- public static final int CB_SETCURSEL = 0x14e;
- public static final int CB_SETEDITSEL = 0x142;
- public static final int CCM_FIRST = 0x2000;
- public static final int CCM_SETBKCOLOR = 0x2001;
- public static final int CCS_NODIVIDER = 0x40;
- public static final int CCS_NORESIZE = 0x4;
- public static final int CC_ANYCOLOR = 0x100;
- public static final int CC_ENABLEHOOK = 0x10;
- public static final int CC_RGBINIT = 0x1;
- public static final int CFE_AUTOCOLOR = 0x40000000;
- public static final int CFE_ITALIC = 0x2;
- public static final int CFE_STRIKEOUT = 0x8;
- public static final int CFE_UNDERLINE = 0x4;
- public static final int CFM_BOLD = 0x1;
- public static final int CFM_CHARSET = 0x8000000;
- public static final int CFM_COLOR = 0x40000000;
- public static final int CFM_FACE = 0x20000000;
- public static final int CFM_ITALIC = 0x2;
- public static final int CFM_SIZE = 0x80000000;
- public static final int CFM_STRIKEOUT = 0x8;
- public static final int CFM_UNDERLINE = 0x4;
- public static final int CFM_WEIGHT = 0x400000;
- public static final int CFS_POINT = 0x2;
- public static final int CF_EFFECTS = 0x100;
- public static final int CF_INITTOLOGFONTSTRUCT = 0x40;
- public static final int CF_SCREENFONTS = 0x1;
- public static final int CF_TEXT = 0x1;
- public static final int CF_UNICODETEXT = 13;
- public static final int CF_USESTYLE = 0x80;
- public static final int CLR_INVALID = 0xffffffff;
- public static final int COLORONCOLOR = 0x3;
- public static final int COLOR_3DDKSHADOW = 0x15 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_3DFACE = 0xf | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_3DHIGHLIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_3DHILIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_3DLIGHT = 0x16 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_3DSHADOW = 0x10 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_ACTIVECAPTION = 0x2 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_BTNFACE = 0xf | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_BTNHIGHLIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_BTNSHADOW = 0x10 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_BTNTEXT = 0x12 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_CAPTIONTEXT = 0x9 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_GRADIENTACTIVECAPTION = 0x1b | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_GRADIENTINACTIVECAPTION = 0x1c | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_HIGHLIGHT = 0xd | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_HIGHLIGHTTEXT = 0xe | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_INACTIVECAPTION = 0x3 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_INACTIVECAPTIONTEXT = 0x13 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_INFOBK = 0x18 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_INFOTEXT = 0x17 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_MENU = 0x4 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_MENUTEXT = 0x7 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_SCROLLBAR = 0x0 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_WINDOW = 0x5 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_WINDOWFRAME = 0x6 | SYS_COLOR_INDEX_FLAG;
- public static final int COLOR_WINDOWTEXT = 0x8 | SYS_COLOR_INDEX_FLAG;
- public static final int COMPLEXREGION = 0x3;
- public static final int CP_ACP = 0x0;
- public static final int CS_BYTEALIGNWINDOW = 0x2000;
- public static final int CS_DBLCLKS = 0x8;
- public static final int CS_HREDRAW = 0x2;
- public static final int CS_VREDRAW = 0x1;
- public static final int CW_USEDEFAULT = 0x80000000;
- public static final int DCX_CACHE = 0x2;
- public static final int DCX_CLIPCHILDREN = 0x8;
- public static final int DCX_CLIPSIBLINGS = 0x10;
- public static final int DEFAULT_CHARSET = 0x1;
- public static final int DEFAULT_GUI_FONT = 0x11;
- public static final int DFCS_BUTTONCHECK = 0x0;
- public static final int DFCS_CHECKED = 0x400;
- public static final int DFCS_FLAT = 0x4000;
- public static final int DFCS_INACTIVE = 0x100;
- public static final int DFCS_PUSHED = 0x200;
- public static final int DFCS_SCROLLDOWN = 0x1;
- public static final int DFCS_SCROLLLEFT = 0x2;
- public static final int DFCS_SCROLLRIGHT = 0x3;
- public static final int DFCS_SCROLLUP = 0x0;
- public static final int DFC_BUTTON = 0x4;
- public static final int DFC_SCROLL = 0x3;
- public static final int DIB_RGB_COLORS = 0x0;
- public static final int DISP_E_EXCEPTION = 0x80020009;
- public static final int DI_NORMAL = 0x3;
- public static final int DLGC_BUTTON = 0x2000;
- public static final int DLGC_STATIC = 0x100;
- public static final int DLGC_WANTALLKEYS = 0x4;
- public static final int DLGC_WANTARROWS = 0x1;
- public static final int DLGC_WANTTAB = 0x2;
- public static final int DSS_DISABLED = 0x20;
- public static final int DSTINVERT = 0x550009;
- public static final int DST_BITMAP = 0x4;
- public static final int DST_ICON = 0x3;
- public static final int DT_CALCRECT = 0x400;
- public static final int DT_EDITCONTROL = 0x2000;
- public static final int DT_EXPANDTABS = 0x40;
- public static final int DT_LEFT = 0x0;
- public static final int DT_NOPREFIX = 0x800;
- public static final int DT_SINGLELINE = 0x20;
- public static final int DT_WORDBREAK = 0x10;
- public static final int ECOOP_AND = 0x3;
- public static final int ECOOP_OR = 0x2;
- public static final int ECO_AUTOHSCROLL = 0x80;
- public static final int EDGE_ETCHED = 0x6;
- public static final int EDGE_SUNKEN = 0xa;
- public static final int EM_CANUNDO = 0xc6;
- public static final int EM_CHARFROMPOS = 0xd7;
- public static final int EM_DISPLAYBAND = 0x433;
- public static final int EM_GETFIRSTVISIBLELINE = 0xce;
- public static final int EM_GETLIMITTEXT = 0xd5;
- public static final int EM_GETLINE = 0xc4;
- public static final int EM_GETLINECOUNT = 0xba;
- public static final int EM_GETMARGINS = 0xd4;
- public static final int EM_GETPASSWORDCHAR = 0xd2;
- public static final int EM_GETRECT = 0xb2;
- public static final int EM_GETSCROLLPOS = 0x4dd;
- public static final int EM_GETSEL = 0xb0;
- public static final int EM_LIMITTEXT = 0xc5;
- public static final int EM_LINEFROMCHAR = 0xc9;
- public static final int EM_LINEINDEX = 0xbb;
- public static final int EM_LINELENGTH = 0xc1;
- public static final int EM_LINESCROLL = 0xb6;
- public static final int EM_POSFROMCHAR = 0xd6;
- public static final int EM_REPLACESEL = 0xc2;
- public static final int EM_SCROLLCARET = 0xb7;
- public static final int EM_SETBKGNDCOLOR = 0x443;
- public static final int EM_SETLIMITTEXT = 0xc5;
- public static final int EM_SETOPTIONS = 0x44d;
- public static final int EM_SETPARAFORMAT = 0x447;
- public static final int EM_SETPASSWORDCHAR = 0xcc;
- public static final int EM_SETREADONLY = 0xcf;
- public static final int EM_SETSEL = 0xb1;
- public static final int EM_SETTABSTOPS = 0xcb;
- public static final int EN_CHANGE = 0x300;
- public static final int ERROR_NO_MORE_ITEMS = 0x103;
- public static final int ESB_DISABLE_BOTH = 0x3;
- public static final int ESB_ENABLE_BOTH = 0x0;
- public static final int ES_AUTOHSCROLL = 0x80;
- public static final int ES_MULTILINE = 0x4;
- public static final int ES_NOHIDESEL = 0x100;
- public static final int ES_READONLY = 0x800;
- public static final int FALT = 0x10;
- public static final int FCONTROL = 0x8;
- public static final int FNERR_INVALIDFILENAME = 0x3002;
- public static final int FSHIFT = 0x4;
- public static final int FVIRTKEY = 0x1;
- public static final int GCS_COMPSTR = 0x8;
- public static final int GCS_RESULTSTR = 0x800;
- public static final int GMDI_USEDISABLED = 0x1;
- public static final int GMEM_FIXED = 0x0;
- public static final int GMEM_ZEROINIT = 0x40;
- public static final int GPTR = 0x40;
- public static final int GRADIENT_FILL_RECT_H = 0x0;
- public static final int GRADIENT_FILL_RECT_V = 0x1;
- public static final int GTL_NUMBYTES = 0x10;
- public static final int GTL_NUMCHARS = 0x8;
- public static final int GTL_PRECISE = 0x2;
- public static final int GT_DEFAULT = 0x0;
- public static final int GWL_EXSTYLE = 0xffffffec;
- public static final int GWL_STYLE = 0xfffffff0;
- public static final int GWL_USERDATA = 0xffffffeb;
- public static final int GWL_WNDPROC = 0xfffffffc;
- public static final int GW_CHILD = 0x5;
- public static final int GW_HWNDFIRST = 0x0;
- public static final int GW_HWNDLAST = 0x1;
- public static final int GW_HWNDNEXT = 0x2;
- public static final int GW_HWNDPREV = 0x3;
- public static final int HBMMENU_CALLBACK = 0xffffffff;
- public static final int HDI_WIDTH = 0x1;
- public static final int HDM_FIRST = 0x1200;
- public static final int HDM_GETBITMAPMARGIN = HDM_FIRST + 21;
- public static final int HDM_GETITEMCOUNT = 0x1200;
- public static final int HDN_BEGINTRACK = IsUnicode ? 0xfffffeba : 0xfffffece;
- public static final int HDN_BEGINTRACKW = 0xfffffeba;
- public static final int HDN_BEGINTRACKA = 0xfffffece;
- public static final int HDN_FIRST = 0xfffffed4;
- public static final int HDN_ITEMCHANGED = IsUnicode ? 0xfffffebf : 0xfffffed3;
- public static final int HDN_ITEMCHANGEDW = 0xfffffebf;
- public static final int HDN_ITEMCHANGEDA = 0xfffffed3;
- public static final int HEAP_ZERO_MEMORY = 0x8;
- public static final int HELPINFO_MENUITEM = 0x2;
- public static final int HINST_COMMCTRL = 0xffffffff;
- public static final int HKEY_CLASSES_ROOT = 0x80000000;
- public static final int HKEY_CURRENT_USER = 0x80000001;
- public static final int HORZRES = 0x8;
- public static final int HTBORDER = 0x12;
- public static final int HTCLIENT = 0x1;
- public static final int HTHSCROLL = 0x6;
- public static final int HTMENU = 0x5;
- public static final int HTNOWHERE = 0x0;
- public static final int HTTRANSPARENT = 0xffffffff;
- public static final int HTVSCROLL = 0x7;
- public static final int HWND_BOTTOM = 0x1;
- public static final int HWND_TOP = 0x0;
- public static final int HWND_TOPMOST = 0xffffffff;
- public static final int ICC_COOL_CLASSES = 0x400;
- public static final int ICM_NOTOPEN = 0x0;
- public static final int ICON_BIG = 0x1;
- public static final int ICON_SMALL = 0x0;
- public static final int I_IMAGENONE = -2;
- public static final int IDABORT = 0x3;
- public static final int IDB_STD_SMALL_COLOR = 0x0;
- public static final int IDC_APPSTARTING = 0x7f8a;
- public static final int IDC_ARROW = 0x7f00;
- public static final int IDC_CROSS = 0x7f03;
- public static final int IDC_HAND = 0x7f89;
- public static final int IDC_HELP = 0x7f8b;
- public static final int IDC_IBEAM = 0x7f01;
- public static final int IDC_NO = 0x7f88;
- public static final int IDC_SIZE = 0x7f80;
- public static final int IDC_SIZEALL = 0x7f86;
- public static final int IDC_SIZENESW = 0x7f83;
- public static final int IDC_SIZENS = 0x7f85;
- public static final int IDC_SIZENWSE = 0x7f82;
- public static final int IDC_SIZEWE = 0x7f84;
- public static final int IDC_UPARROW = 0x7f04;
- public static final int IDC_WAIT = 0x7f02;
- public static final int IDI_WINLOGO = 0x7f05;
- public static final int IDNO = 0x7;
- public static final int IDOK = 0x1;
- public static final int IDRETRY = 0x4;
- public static final int IDYES = 0x6;
- public static final int ILC_COLOR = 0x0;
- public static final int ILC_COLOR16 = 0x10;
- public static final int ILC_COLOR24 = 0x18;
- public static final int ILC_COLOR32 = 0x20;
- public static final int ILC_COLOR4 = 0x4;
- public static final int ILC_COLOR8 = 0x8;
- public static final int ILC_MASK = 0x1;
- public static final int ILD_NORMAL = 0x0;
- public static final int IMAGE_BITMAP = 0x0;
- public static final int IMAGE_CURSOR = 0x2;
- public static final int IMAGE_ICON = 0x1;
- public static final int IME_CMODE_FULLSHAPE = 0x8;
- public static final int IME_CMODE_KATAKANA = 0x2;
- public static final int IME_CMODE_NATIVE = 0x1;
- public static final int IME_CMODE_ROMAN = 0x10;
- public static final int KEY_ENUMERATE_SUB_KEYS = 0x8;
- public static final int KEY_NOTIFY = 0x10;
- public static final int KEY_QUERY_VALUE = 0x1;
- public static final int KEY_READ = 0x20019;
- public static final int LBN_DBLCLK = 0x2;
- public static final int LBN_SELCHANGE = 0x1;
- public static final int LBS_EXTENDEDSEL = 0x800;
- public static final int LBS_MULTIPLESEL = 0x8;
- public static final int LBS_NOINTEGRALHEIGHT = 0x100;
- public static final int LBS_NOTIFY = 0x1;
- public static final int LB_ADDSTRING = 0x180;
- public static final int LB_DELETESTRING = 0x182;
- public static final int LB_ERR = 0xffffffff;
- public static final int LB_ERRSPACE = 0xfffffffe;
- public static final int LB_FINDSTRINGEXACT = 0x1a2;
- public static final int LB_GETCARETINDEX = 0x19f;
- public static final int LB_GETCOUNT = 0x18b;
- public static final int LB_GETCURSEL = 0x188;
- public static final int LB_GETHORIZONTALEXTENT = 0x193;
- public static final int LB_GETITEMHEIGHT = 0x1a1;
- public static final int LB_GETITEMRECT = 0x198;
- public static final int LB_GETSEL = 0x187;
- public static final int LB_GETSELCOUNT = 0x190;
- public static final int LB_GETSELITEMS = 0x191;
- public static final int LB_GETTEXT = 0x189;
- public static final int LB_GETTEXTLEN = 0x18a;
- public static final int LB_GETTOPINDEX = 0x18e;
- public static final int LB_INITSTORAGE = 0x1a8;
- public static final int LB_INSERTSTRING = 0x181;
- public static final int LB_RESETCONTENT = 0x184;
- public static final int LB_SELITEMRANGE = 0x19b;
- public static final int LB_SELITEMRANGEEX = 0x183;
- public static final int LB_SETCARETINDEX = 0x19e;
- public static final int LB_SETCURSEL = 0x186;
- public static final int LB_SETHORIZONTALEXTENT = 0x194;
- public static final int LB_SETSEL = 0x185;
- public static final int LB_SETTOPINDEX = 0x197;
- public static final int LCID_SUPPORTED = 0x2;
- public static final int LOCALE_IDEFAULTANSICODEPAGE = 0x1004;
- public static final int LOCALE_SISO3166CTRYNAME = 0x5a;
- public static final int LOCALE_SISO639LANGNAME = 0x59;
- public static final int LOGPIXELSX = 0x58;
- public static final int LOGPIXELSY = 0x5a;
- public static final int LPSTR_TEXTCALLBACK = 0xffffffff;
- public static final int LR_DEFAULTCOLOR = 0x0;
- public static final int LVCFMT_CENTER = 0x2;
- public static final int LVCFMT_IMAGE = 0x800;
- public static final int LVCFMT_LEFT = 0x0;
- public static final int LVCFMT_RIGHT = 0x1;
- public static final int LVCF_FMT = 0x1;
- public static final int LVCF_IMAGE = 0x10;
- public static final int LVCF_TEXT = 0x4;
- public static final int LVCF_WIDTH = 0x2;
- public static final int LVHT_ONITEM = 0xe;
- public static final int LVHT_ONITEMICON = 0x2;
- public static final int LVHT_ONITEMLABEL = 0x4;
- public static final int LVHT_ONITEMSTATEICON = 0x8;
- public static final int LVIF_IMAGE = 0x2;
- public static final int LVIF_INDENT = 0x10;
- public static final int LVIF_STATE = 0x8;
- public static final int LVIF_TEXT = 0x1;
- public static final int LVIR_BOUNDS = 0x0;
- public static final int LVIR_ICON = 0x1;
- public static final int LVIR_LABEL = 0x2;
- public static final int LVIS_DROPHILITED = 0x8;
- public static final int LVIS_FOCUSED = 0x1;
- public static final int LVIS_SELECTED = 0x2;
- public static final int LVIS_STATEIMAGEMASK = 0xf000;
- public static final int LVM_APPROXIMATEVIEWRECT = 0x1040;
- public static final int LVM_DELETEALLITEMS = 0x1009;
- public static final int LVM_DELETECOLUMN = 0x101c;
- public static final int LVM_DELETEITEM = 0x1008;
- public static final int LVM_ENSUREVISIBLE = 0x1013;
- public static final int LVM_FIRST = 0x1000;
- public static final int LVM_GETBKCOLOR = 0x1000;
- public static final int LVM_GETCOLUMN = IsUnicode ? 0x105f : 0x1019;
- public static final int LVM_GETCOLUMNWIDTH = 0x101d;
- public static final int LVM_GETCOUNTPERPAGE = 0x1028;
- public static final int LVM_GETEXTENDEDLISTVIEWSTYLE = 0x1037;
- public static final int LVM_GETHEADER = 0x101f;
- public static final int LVM_GETIMAGELIST = 0x1002;
- public static final int LVM_GETITEM = IsUnicode ? 0x104b : 0x1005;
- public static final int LVM_GETITEMW = 0x104b;
- public static final int LVM_GETITEMA = 0x1005;
- public static final int LVM_GETITEMCOUNT = 0x1004;
- public static final int LVM_GETITEMRECT = 0x100e;
- public static final int LVM_GETITEMSTATE = 0x102c;
- public static final int LVM_GETNEXTITEM = 0x100c;
- public static final int LVM_GETSELECTEDCOUNT = 0x1032;
- public static final int LVM_GETSTRINGWIDTH = IsUnicode ? 0x1057 : 0x1011;
- public static final int LVM_GETSUBITEMRECT = 0x1038;
- public static final int LVM_GETTEXTCOLOR = 0x1023;
- public static final int LVM_GETTOPINDEX = 0x1027;
- public static final int LVM_HITTEST = 0x1012;
- public static final int LVM_INSERTCOLUMN = IsUnicode ? 0x1061 : 0x101b;
- public static final int LVM_INSERTITEM = IsUnicode ? 0x104d : 0x1007;
- public static final int LVM_SCROLL = 0x1014;
- public static final int LVM_SETBKCOLOR = 0x1001;
- public static final int LVM_SETCOLUMN = IsUnicode ? 0x1060 : 0x101a;
- public static final int LVM_SETCOLUMNWIDTH = 0x101e;
- public static final int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036;
- public static final int LVM_SETIMAGELIST = 0x1003;
- public static final int LVM_SETITEM = IsUnicode ? 0x104c : 0x1006;
- public static final int LVM_SETITEMSTATE = 0x102b;
- public static final int LVM_SETTEXTBKCOLOR = 0x1026;
- public static final int LVM_SETTEXTCOLOR = 0x1024;
- public static final int LVNI_FOCUSED = 0x1;
- public static final int LVNI_SELECTED = 0x2;
- public static final int LVN_BEGINDRAG = 0xffffff93;
- public static final int LVN_BEGINRDRAG = 0xffffff91;
- public static final int LVN_COLUMNCLICK = 0xffffff94;
- public static final int LVN_FIRST = 0xffffff9c;
- public static final int LVN_ITEMACTIVATE = 0xffffff8e;
- public static final int LVN_ITEMCHANGED = 0xffffff9b;
- public static final int LVN_MARQUEEBEGIN = 0xffffff64;
- public static final int LVSCW_AUTOSIZE = 0xffffffff;
- public static final int LVSCW_AUTOSIZE_USEHEADER = 0xfffffffe;
- public static final int LVSIL_SMALL = 0x1;
- public static final int LVSIL_STATE = 0x2;
- public static final int LVS_EX_FULLROWSELECT = 0x20;
- public static final int LVS_EX_GRIDLINES = 0x1;
- public static final int LVS_EX_LABELTIP = 0x4000;
- public static final int LVS_EX_ONECLICKACTIVATE = 0x40;
- public static final int LVS_EX_SUBITEMIMAGES = 0x2;
- public static final int LVS_EX_TRACKSELECT = 0x8;
- public static final int LVS_EX_TWOCLICKACTIVATE = 0x80;
- public static final int LVS_NOCOLUMNHEADER = 0x4000;
- public static final int LVS_NOSCROLL = 0x2000;
- public static final int LVS_REPORT = 0x1;
- public static final int LVS_SHAREIMAGELISTS = 0x40;
- public static final int LVS_SHOWSELALWAYS = 0x8;
- public static final int LVS_SINGLESEL = 0x4;
- public static final int MA_NOACTIVATE = 0x3;
- public static final int MB_ABORTRETRYIGNORE = 0x2;
- public static final int MB_APPLMODAL = 0x0;
- public static final int MB_ICONERROR = 0x10;
- public static final int MB_ICONINFORMATION = 0x40;
- public static final int MB_ICONQUESTION = 0x20;
- public static final int MB_ICONWARNING = 0x30;
- public static final int MB_OK = 0x0;
- public static final int MB_OKCANCEL = 0x1;
- public static final int MB_PRECOMPOSED = 0x1;
- public static final int MB_RETRYCANCEL = 0x5;
- public static final int MB_SYSTEMMODAL = 0x1000;
- public static final int MB_TASKMODAL = 0x2000;
- public static final int MB_YESNO = 0x4;
- public static final int MB_YESNOCANCEL = 0x3;
- public static final int MFS_CHECKED = 0x8;
- public static final int MFS_DISABLED = 0x3;
- public static final int MFS_GRAYED = 0x3;
- public static final int MFT_RADIOCHECK = 0x200;
- public static final int MFT_SEPARATOR = 0x800;
- public static final int MFT_STRING = 0x0;
- public static final int MF_BYCOMMAND = 0x0;
- public static final int MF_BYPOSITION = 0x400;
- public static final int MF_CHECKED = 0x8;
- public static final int MF_DISABLED = 0x2;
- public static final int MF_ENABLED = 0x0;
- public static final int MF_GRAYED = 0x1;
- public static final int MF_HILITE = 0x80;
- public static final int MF_POPUP = 0x10;
- public static final int MF_SEPARATOR = 0x800;
- public static final int MF_SYSMENU = 0x2000;
- public static final int MF_UNCHECKED = 0x0;
- public static final int MIIM_BITMAP = 0x80;
- public static final int MIIM_DATA = 0x20;
- public static final int MIIM_ID = 0x2;
- public static final int MIIM_STATE = 0x1;
- public static final int MIIM_SUBMENU = 0x4;
- public static final int MIIM_TYPE = 0x10;
- public static final int MIM_STYLE = 0x10;
- public static final int MK_CONTROL = 0x8;
- public static final int MK_LBUTTON = 0x1;
- public static final int MK_MBUTTON = 0x10;
- public static final int MK_RBUTTON = 0x2;
- public static final int MK_SHIFT = 0x4;
- public static final int MM_TEXT = 0x1;
- public static final int MNC_CLOSE = 0x1;
- public static final int MNS_CHECKORBMP = 0x4000000;
- public static final int NM_CLICK = 0xfffffffe;
- public static final int NM_DBLCLK = 0xfffffffd;
- public static final int NM_FIRST = 0x0;
- public static final int NM_RETURN = 0xfffffffc;
- public static final int NOTSRCCOPY = 0x330008;
- public static final int NULLREGION = 0x1;
- public static final int NULL_BRUSH = 0x5;
- public static final int NULL_PEN = 0x8;
- public static final int OBJ_FONT = 0x6;
- public static final int OBJ_PEN = 0x1;
- public static final int OBM_CHECKBOXES = 0x7ff7;
- public static final int ODS_SELECTED = 0x1;
- public static final int ODT_MENU = 0x1;
- public static final int OFN_ALLOWMULTISELECT = 0x200;
- public static final int OFN_EXPLORER = 0x80000;
- public static final int OFN_HIDEREADONLY = 0x4;
- public static final int OFN_NOCHANGEDIR = 0x8;
- public static final int OPAQUE = 0x2;
- public static final int PATCOPY = 0xf00021;
- public static final int PATINVERT = 0x5a0049;
- public static final int PBM_GETPOS = 0x408;
- public static final int PBM_GETRANGE = 0x407;
- public static final int PBM_SETBARCOLOR = 0x409;
- public static final int PBM_SETBKCOLOR = 0x2001;
- public static final int PBM_SETPOS = 0x402;
- public static final int PBM_SETRANGE32 = 0x406;
- public static final int PBS_SMOOTH = 0x1;
- public static final int PBS_VERTICAL = 0x4;
- public static final int PD_ALLPAGES = 0x0;
- public static final int PD_COLLATE = 0x10;
- public static final int PD_PAGENUMS = 0x2;
- public static final int PD_PRINTTOFILE = 0x20;
- public static final int PD_RETURNDC = 0x100;
- public static final int PD_SELECTION = 0x1;
- public static final int PD_USEDEVMODECOPIESANDCOLLATE = 0x40000;
- public static final int PFM_TABSTOPS = 0x10;
- public static final int PHYSICALHEIGHT = 0x6f;
- public static final int PHYSICALOFFSETX = 0x70;
- public static final int PHYSICALOFFSETY = 0x71;
- public static final int PHYSICALWIDTH = 0x6e;
- public static final int PLANES = 0xe;
- public static final int PM_REMOVE = 0x1;
- public static final String PROGRESS_CLASS = "msctls_progress32";
- public static final int PS_DASH = 0x1;
- public static final int PS_DASHDOT = 0x3;
- public static final int PS_DASHDOTDOT = 0x4;
- public static final int PS_DOT = 0x2;
- public static final int PS_ENDCAP_FLAT = 0x200;
- public static final int PS_GEOMETRIC = 0x10000;
- public static final int PS_JOIN_MITER = 0x2000;
- public static final int PS_SOLID = 0x0;
- public static final int PS_STYLE_MASK = 0xf;
- public static final int R2_COPYPEN = 0xd;
- public static final int R2_XORPEN = 0x7;
- public static final int RASTERCAPS = 0x26;
- public static final int RASTER_FONTTYPE = 0x1;
- public static final int RBBIM_CHILD = 0x10;
- public static final int RBBIM_CHILDSIZE = 0x20;
- public static final int RBBIM_COLORS = 0x2;
- public static final int RBBIM_HEADERSIZE = 0x800;
- public static final int RBBIM_ID = 0x100;
- public static final int RBBIM_IDEALSIZE = 0x200;
- public static final int RBBIM_SIZE = 0x40;
- public static final int RBBIM_STYLE = 0x1;
- public static final int RBBIM_TEXT = 0x4;
- public static final int RBBS_BREAK = 0x1;
- public static final int RBBS_GRIPPERALWAYS = 0x80;
- public static final int RBBS_VARIABLEHEIGHT = 0x40;
- public static final int RBN_FIRST = 0xfffffcc1;
- public static final int RBN_HEIGHTCHANGE = 0xfffffcc1;
- public static final int RBS_BANDBORDERS = 0x400;
- public static final int RBS_VARHEIGHT = 0x200;
- public static final int RB_DELETEBAND = 0x402;
- public static final int RB_GETBANDBORDERS = 0x422;
- public static final int RB_GETBANDCOUNT = 0x40c;
- public static final int RB_GETBANDINFO = IsUnicode ? 0x41c : 0x41d;
- public static final int RB_GETBARHEIGHT = 0x41b;
- public static final int RB_GETBKCOLOR = 0x414;
- public static final int RB_GETRECT = 0x409;
- public static final int RB_GETTEXTCOLOR = 0x416;
- public static final int RB_IDTOINDEX = 0x410;
- public static final int RB_INSERTBAND = IsUnicode ? 0x40a : 0x401;
- public static final int RB_MOVEBAND = 0x427;
- public static final int RB_SETBANDINFO = IsUnicode ? 0x40b : 0x406;
- public static final int RB_SETBKCOLOR = 0x413;
- public static final int RB_SETTEXTCOLOR = 0x415;
- public static final int RC_BITBLT = 0x1;
- public static final int RC_PALETTE = 0x100;
- public static final int RDW_ALLCHILDREN = 0x80;
- public static final int RDW_ERASE = 0x4;
- public static final int RDW_FRAME = 0x400;
- public static final int RDW_INVALIDATE = 0x1;
- public static final int RDW_UPDATENOW = 0x100;
- public static final int READ_CONTROL = 0x20000;
- public static final String REBARCLASSNAME = "ReBarWindow32";
- public static final int RGN_OR = 0x2;
- public static final int SBS_HORZ = 0x0;
- public static final int SBS_VERT = 0x1;
- public static final int SB_BOTTOM = 0x7;
- public static final int SB_CTL = 0x2;
- public static final int SB_ENDSCROLL = 0x8;
- public static final int SB_HORZ = 0x0;
- public static final int SB_LINEDOWN = 0x1;
- public static final int SB_LINEUP = 0x0;
- public static final int SB_PAGEDOWN = 0x3;
- public static final int SB_PAGEUP = 0x2;
- public static final int SB_THUMBPOSITION = 0x4;
- public static final int SB_THUMBTRACK = 0x5;
- public static final int SB_TOP = 0x6;
- public static final int SB_VERT = 0x1;
- public static final int SCF_ALL = 0x4;
- public static final int SCF_DEFAULT = 0x0;
- public static final int SCF_SELECTION = 0x1;
- public static final int SC_CLOSE = 0xf060;
- public static final int SC_HSCROLL = 0xf080;
- public static final int SC_KEYMENU = 0xf100;
- public static final int SC_MAXIMIZE = 0xf030;
- public static final int SC_MINIMIZE = 0xf020;
- public static final int SC_RESTORE = 0xf120;
- public static final int SC_SIZE = 0xf000;
- public static final int SC_TASKLIST = 0xf130;
- public static final int SC_VSCROLL = 0xf070;
- public static final int SF_RTF = 0x2;
- public static final int SHCMBM_SETSUBMENU = 0x590;
- public static final int SHCMBM_GETSUBMENU = 0x591;
- public static final int SIF_ALL = 0x17;
- public static final int SIF_DISABLENOSCROLL = 0x8;
- public static final int SIF_PAGE = 0x2;
- public static final int SIF_POS = 0x4;
- public static final int SIF_RANGE = 0x1;
- public static final int SIF_TRACKPOS = 0x10;
- public static final int SIZE_MINIMIZED = 0x1;
- public static final int SM_CXBORDER = 0x5;
- public static final int SM_CXCURSOR = 0xd;
- public static final int SM_CXEDGE = 0x2d;
- public static final int SM_CXHSCROLL = 0x15;
- public static final int SM_CXICON = 0x0b;
- public static final int SM_CYICON = 0x0c;
- public static final int SM_CXSMICON = 49;
- public static final int SM_CYSMICON = 50;
- public static final int SM_CXSCREEN = 0x0;
- public static final int SM_CXVSCROLL = 0x2;
- public static final int SM_CYBORDER = 0x6;
- public static final int SM_CYCURSOR = 0xe;
- public static final int SM_CYHSCROLL = 0x3;
- public static final int SM_CYMENU = 0xf;
- public static final int SM_CYSCREEN = 0x1;
- public static final int SM_CYVSCROLL = 0x14;
- public static final int SPI_GETWORKAREA = 0x30;
- public static final int SPI_GETNONCLIENTMETRICS = 41;
- public static final int SPI_GETWHEELSCROLLLINES = 104;
- public static final int SRCAND = 0x8800c6;
- public static final int SRCCOPY = 0xcc0020;
- public static final int SRCINVERT = 0x660046;
- public static final int SRCPAINT = 0xee0086;
- public static final int SS_BITMAP = 0xe;
- public static final int SS_CENTER = 0x1;
- public static final int SS_CENTERIMAGE = 0x200;
- public static final int SS_ICON = 0x3;
- public static final int SS_LEFT = 0x0;
- public static final int SS_LEFTNOWORDWRAP = 0xc;
- public static final int SS_NOTIFY = 0x100;
- public static final int SS_OWNERDRAW = 0xd;
- public static final int SS_REALSIZEIMAGE = 0x800;
- public static final int SS_RIGHT = 0x2;
- public static final int STANDARD_RIGHTS_READ = 0x20000;
- public static final int STD_COPY = 0x1;
- public static final int STD_CUT = 0x0;
- public static final int STD_FILENEW = 0x6;
- public static final int STD_FILEOPEN = 0x7;
- public static final int STD_FILESAVE = 0x8;
- public static final int STD_PASTE = 0x2;
- public static final int STM_SETIMAGE = 0x172;
- public static final int SWP_DRAWFRAME = 0x20;
- public static final int SWP_NOACTIVATE = 0x10;
- public static final int SWP_NOCOPYBITS = 0x100;
- public static final int SWP_NOMOVE = 0x2;
- public static final int SWP_NOREDRAW = 0x8;
- public static final int SWP_NOSIZE = 0x1;
- public static final int SWP_NOZORDER = 0x4;
- public static final int SW_ERASE = 0x4;
- public static final int SW_HIDE = 0x0;
- public static final int SW_INVALIDATE = 0x2;
- public static final int SW_PARENTOPENING = 0x3;
- public static final int SW_RESTORE = OS.IsWinCE ? 0xd : 0x9;
- public static final int SW_SCROLLCHILDREN = 0x1;
- public static final int SW_SHOW = 0x5;
- public static final int SW_SHOWMAXIMIZED = OS.IsWinCE ? 0xb : 0x3;
- public static final int SW_SHOWMINNOACTIVE = 0x7;
- public static final int SW_SHOWNA = 0x8;
- public static final int SW_SHOWNOACTIVATE = 0x4;
- public static final int SYNCHRONIZE = 0x100000;
- public static final int SYSTEM_FONT = 0xd;
- public static final int S_OK = 0x0;
- public static final int TBIF_IMAGE = 0x1;
- public static final int TBIF_LPARAM = 0x10;
- public static final int TBIF_SIZE = 0x40;
- public static final int TBIF_STYLE = 0x8;
- public static final int TBIF_TEXT = 0x2;
- public static final int TBM_GETLINESIZE = 0x418;
- public static final int TBM_GETPAGESIZE = 0x416;
- public static final int TBM_GETPOS = 0x400;
- public static final int TBM_GETRANGEMAX = 0x402;
- public static final int TBM_GETRANGEMIN = 0x401;
- public static final int TBM_GETTHUMBRECT = 0x419;
- public static final int TBM_SETLINESIZE = 0x417;
- public static final int TBM_SETPAGESIZE = 0x415;
- public static final int TBM_SETPOS = 0x405;
- public static final int TBM_SETRANGEMAX = 0x408;
- public static final int TBM_SETRANGEMIN = 0x407;
- public static final int TBM_SETTICFREQ = 0x414;
- public static final int TBN_DROPDOWN = 0xfffffd3a;
- public static final int TBN_FIRST = 0xfffffd44;
- public static final int TBSTATE_CHECKED = 0x1;
- public static final int TBSTYLE_DROPDOWN = 0x8;
- public static final int TBSTATE_ENABLED = 0x4;
- public static final int TBSTYLE_AUTOSIZE = 0x10;
- public static final int TBSTYLE_EX_DRAWDDARROWS = 0x1;
- public static final int TBSTYLE_FLAT = 0x800;
- public static final int TBSTYLE_LIST = 0x1000;
- public static final int TBSTYLE_TOOLTIPS = 0x100;
- public static final int TBSTYLE_WRAPABLE = 0x200;
- public static final int TBS_AUTOTICKS = 0x1;
- public static final int TBS_BOTH = 0x8;
- public static final int TBS_HORZ = 0x0;
- public static final int TBS_VERT = 0x2;
- public static final int TB_ADDSTRING = IsUnicode ? 0x44d : 0x41c;
- public static final int TB_BUTTONCOUNT = 0x418;
- public static final int TB_BUTTONSTRUCTSIZE = 0x41e;
- public static final int TB_COMMANDTOINDEX = 0x419;
- public static final int TB_DELETEBUTTON = 0x416;
- public static final int TB_ENDTRACK = 0x8;
- public static final int TB_GETBUTTON = 0x417;
- public static final int TB_GETBUTTONINFO = IsUnicode ? 0x43f : 0x441;
- public static final int TB_GETBUTTONSIZE = 0x43a;
- public static final int TB_GETBUTTONTEXT = IsUnicode ? 0x44b : 0x42d;
- public static final int TB_GETDISABLEDIMAGELIST = 0x437;
- public static final int TB_GETHOTIMAGELIST = 0x435;
- public static final int TB_GETHOTITEM = 0x0400 + 71;
- public static final int TB_GETIMAGELIST = 0x431;
- public static final int TB_GETITEMRECT = 0x41d;
- public static final int TB_GETROWS = 0x428;
- public static final int TB_GETSTATE = 0x412;
- public static final int TB_GETTOOLTIPS = 0x423;
- public static final int TB_INSERTBUTTON = IsUnicode ? 0x443 : 0x415;
- public static final int TB_LOADIMAGES = 0x432;
- public static final int TB_MAPACCELERATOR = 0x0400 + (IsUnicode ? 90 : 78);
- public static final int TB_SETBITMAPSIZE = 0x420;
- public static final int TB_SETBUTTONINFO = IsUnicode ? 0x440 : 0x442;
- public static final int TB_SETBUTTONSIZE = 0x41f;
- public static final int TB_SETDISABLEDIMAGELIST = 0x436;
- public static final int TB_SETEXTENDEDSTYLE = 0x454;
- public static final int TB_SETHOTIMAGELIST = 0x434;
- public static final int TB_SETHOTITEM = 0x0400 + 72;
- public static final int TB_SETIMAGELIST = 0x430;
- public static final int TB_SETROWS = 0x427;
- public static final int TB_SETSTATE = 0x411;
- public static final int TCIF_IMAGE = 0x2;
- public static final int TCIF_TEXT = 0x1;
- public static final int TCI_SRCCHARSET = 0x1;
- public static final int TCI_SRCCODEPAGE = 0x2;
- public static final int TCM_ADJUSTRECT = 0x1328;
- public static final int TCM_DELETEITEM = 0x1308;
- public static final int TCM_GETCURSEL = 0x130b;
- public static final int TCM_GETITEMCOUNT = 0x1304;
- public static final int TCM_GETITEMRECT = 0x130a;
- public static final int TCM_GETTOOLTIPS = 0x132d;
- public static final int TCM_INSERTITEM = IsUnicode ? 0x133e : 0x1307;
- public static final int TCM_SETCURSEL = 0x130c;
- public static final int TCM_SETIMAGELIST = 0x1303;
- public static final int TCM_SETITEM = IsUnicode ? 0x133d : 0x1306;
- public static final int TCN_SELCHANGE = 0xfffffdd9;
- public static final int TCN_SELCHANGING = 0xfffffdd8;
- public static final int TCS_FOCUSNEVER = 0x8000;
- public static final int TCS_MULTILINE = 0x200;
- public static final int TCS_TABS = 0x0;
- public static final int TCS_TOOLTIPS = 0x4000;
- public static final int TME_HOVER = 0x1;
- public static final int TME_LEAVE = 0x2;
- public static final int TME_QUERY = 0x40000000;
- public static final int TMPF_VECTOR = 0x2;
- public static final String TOOLBARCLASSNAME = "ToolbarWindow32";
- public static final String TOOLTIPS_CLASS = "tooltips_class32";
- public static final int TPM_LEFTALIGN = 0x0;
- public static final int TPM_LEFTBUTTON = 0x0;
- public static final int TPM_RIGHTBUTTON = 0x2;
- public static final String TRACKBAR_CLASS = "msctls_trackbar32";
- public static final int TRANSPARENT = 0x1;
- public static final int TTF_IDISHWND = 0x1;
- public static final int TTF_SUBCLASS = 0x10;
- public static final int TTM_ADDTOOL = IsUnicode ? 0x432 : 0x404;
- public static final int TTM_DELTOOL = IsUnicode ? 0x433 : 0x405;
- public static final int TTM_SETMAXTIPWIDTH = 0x418;
- public static final int TTM_UPDATE = 0x41D;
- public static final int TTN_FIRST = 0xfffffdf8;
- public static final int TTN_GETDISPINFO = IsUnicode ? 0xfffffdee : 0xfffffdf8;
- public static final int TTN_GETDISPINFOW = 0xfffffdee;
- public static final int TTN_GETDISPINFOA = 0xfffffdf8;
- public static final int TTS_ALWAYSTIP = 0x1;
- public static final int TVE_COLLAPSE = 0x1;
- public static final int TVE_EXPAND = 0x2;
- public static final int TVGN_CARET = 0x9;
- public static final int TVGN_CHILD = 0x4;
- public static final int TVGN_FIRSTVISIBLE = 0x5;
- public static final int TVGN_LASTVISIBLE = 0xa;
- public static final int TVGN_NEXT = 0x1;
- public static final int TVGN_NEXTVISIBLE = 0x6;
- public static final int TVGN_PARENT = 0x3;
- public static final int TVGN_PREVIOUSVISIBLE = 0x7;
- public static final int TVGN_ROOT = 0x0;
- public static final int TVHT_ONITEM = 0x46;
- public static final int TVHT_ONITEMICON = 0x2;
- public static final int TVHT_ONITEMLABEL = 0x4;
- public static final int TVHT_ONITEMSTATEICON = 0x40;
- public static final int TVIF_HANDLE = 0x10;
- public static final int TVIF_IMAGE = 0x2;
- public static final int TVIF_PARAM = 0x4;
- public static final int TVIF_SELECTEDIMAGE = 0x20;
- public static final int TVIF_STATE = 0x8;
- public static final int TVIF_TEXT = 0x1;
- public static final int TVIS_DROPHILITED = 0x8;
- public static final int TVIS_EXPANDED = 0x20;
- public static final int TVIS_SELECTED = 0x2;
- public static final int TVIS_STATEIMAGEMASK = 0xf000;
- public static final int TVI_FIRST = 0xffff0001;
- public static final int TVI_LAST = 0xffff0002;
- public static final int TVI_ROOT = 0xffff0000;
- public static final int TVM_DELETEITEM = 0x1101;
- public static final int TVM_ENSUREVISIBLE = 0x1114;
- public static final int TVM_EXPAND = 0x1102;
- public static final int TVM_GETBKCOLOR = 0x111f;
- public static final int TVM_GETCOUNT = 0x1105;
- public static final int TVM_GETIMAGELIST = 0x1108;
- public static final int TVM_GETITEM = IsUnicode ? 0x113e : 0x110c;
- public static final int TVM_GETITEMHEIGHT = 0x111c;
- public static final int TVM_GETITEMRECT = 0x1104;
- public static final int TVM_GETNEXTITEM = 0x110a;
- public static final int TVM_GETTEXTCOLOR = 0x1120;
- public static final int TVM_HITTEST = 0x1111;
- public static final int TVM_INSERTITEM = IsUnicode ? 0x1132 : 0x1100;
- public static final int TVM_SELECTITEM = 0x110b;
- public static final int TVM_SETBKCOLOR = 0x111d;
- public static final int TVM_SETIMAGELIST = 0x1109;
- public static final int TVM_SETINSERTMARK = 0x111a;
- public static final int TVM_SETITEM = IsUnicode ? 0x113f : 0x110d;
- public static final int TVM_SETTEXTCOLOR = 0x111e;
- public static final int TVN_BEGINDRAG = IsUnicode ? 0xfffffe38 : 0xfffffe69;
- public static final int TVN_BEGINDRAGW = 0xfffffe38;
- public static final int TVN_BEGINDRAGA = 0xfffffe69;
- public static final int TVN_BEGINRDRAG = IsUnicode ? 0xfffffe37 : 0xfffffe68;
- public static final int TVN_BEGINRDRAGW = 0xfffffe37;
- public static final int TVN_BEGINRDRAGA = 0xfffffe68;
- public static final int TVN_FIRST = 0xfffffe70;
- public static final int TVN_ITEMEXPANDING = IsUnicode ? 0xfffffe3a : 0xfffffe6b;
- public static final int TVN_ITEMEXPANDINGW = 0xfffffe3a;
- public static final int TVN_ITEMEXPANDINGA = 0xfffffe6b;
- public static final int TVN_SELCHANGED = IsUnicode ? 0xfffffe3d : 0xfffffe6e;
- public static final int TVN_SELCHANGEDW = 0xfffffe3d;
- public static final int TVN_SELCHANGEDA = 0xfffffe6e;
- public static final int TVN_SELCHANGING = IsUnicode ? 0xfffffe3e : 0xfffffe6f;
- public static final int TVN_SELCHANGINGW = 0xfffffe3e;
- public static final int TVN_SELCHANGINGA = 0xfffffe6f;
- public static final int TVSIL_NORMAL = 0x0;
- public static final int TVSIL_STATE = 0x2;
- public static final int TVS_DISABLEDRAGDROP = 0x10;
- public static final int TVS_FULLROWSELECT = 0x1000;
- public static final int TVS_HASBUTTONS = 0x1;
- public static final int TVS_HASLINES = 0x2;
- public static final int TVS_LINESATROOT = 0x4;
- public static final int TVS_NOTOOLTIPS = 0x80;
- public static final int TVS_SHOWSELALWAYS = 0x20;
- public static final int TV_FIRST = 0x1100;
- public static final int VERTRES = 0xa;
- public static final int VK_BACK = 0x8;
- public static final int VK_CAPITAL = 0x14;
- public static final int VK_CONTROL = 0x11;
- public static final int VK_DELETE = 0x2e;
- public static final int VK_DIVIDE = 0x6f;
- public static final int VK_DOWN = 0x28;
- public static final int VK_END = 0x23;
- public static final int VK_ESCAPE = 0x1b;
- public static final int VK_F1 = 0x70;
- public static final int VK_F10 = 0x79;
- public static final int VK_F11 = 0x7a;
- public static final int VK_F12 = 0x7b;
- public static final int VK_F2 = 0x71;
- public static final int VK_F3 = 0x72;
- public static final int VK_F4 = 0x73;
- public static final int VK_F5 = 0x74;
- public static final int VK_F6 = 0x75;
- public static final int VK_F7 = 0x76;
- public static final int VK_F8 = 0x77;
- public static final int VK_F9 = 0x78;
- public static final int VK_HOME = 0x24;
- public static final int VK_INSERT = 0x2d;
- public static final int VK_LBUTTON = 0x1;
- public static final int VK_LEFT = 0x25;
- public static final int VK_MBUTTON = 0x4;
- public static final int VK_MENU = 0x12;
- public static final int VK_NEXT = 0x22;
- public static final int VK_NUMLOCK = 0x90;
- public static final int VK_NUMPAD0 = 0x60;
- public static final int VK_PRIOR = 0x21;
- public static final int VK_RBUTTON = 0x2;
- public static final int VK_RETURN = 0xd;
- public static final int VK_RIGHT = 0x27;
- public static final int VK_SCROLL = 0x91;
- public static final int VK_SHIFT = 0x10;
- public static final int VK_SPACE = 0x20;
- public static final int VK_TAB = 0x9;
- public static final int VK_UP = 0x26;
- public static final int VK_APP1 = 0xc1;
- public static final int VK_APP2 = 0xc2;
- public static final int VK_APP3 = 0xc3;
- public static final int VK_APP4 = 0xc4;
- public static final int VK_APP5 = 0xc5;
- public static final int VK_APP6 = 0xc6;
- public static final String WC_LISTVIEW = "SysListView32";
- public static final String WC_TABCONTROL = "SysTabControl32";
- public static final String WC_TREEVIEW = "SysTreeView32";
- public static final int WH_GETMESSAGE = 0x3;
- public static final int WHEEL_DELTA = 120;
- public static final int WM_ACTIVATE = 0x6;
- public static final int WM_APP = 0x8000;
- public static final int WM_CANCELMODE = 0x1f;
- public static final int WM_CHAR = 0x102;
- public static final int WM_CLEAR = 0x303;
- public static final int WM_CLOSE = 0x10;
- public static final int WM_COMMAND = 0x111;
- public static final int WM_CONTEXTMENU = 0x7b;
- public static final int WM_COPY = 0x301;
- public static final int WM_CTLCOLORBTN = 0x135;
- public static final int WM_CTLCOLORDLG = 0x136;
- public static final int WM_CTLCOLOREDIT = 0x133;
- public static final int WM_CTLCOLORLISTBOX = 0x134;
- public static final int WM_CTLCOLORMSGBOX = 0x132;
- public static final int WM_CTLCOLORSCROLLBAR = 0x137;
- public static final int WM_CTLCOLORSTATIC = 0x138;
- public static final int WM_CUT = 0x300;
- public static final int WM_DESTROY = 0x2;
- public static final int WM_DRAWITEM = 0x2b;
- public static final int WM_ERASEBKGND = 0x14;
- public static final int WM_GETDLGCODE = 0x87;
- public static final int WM_GETFONT = 0x31;
-// public static final int WM_GETICON = 0x7f;
- public static final int WM_HELP = 0x53;
- public static final int WM_HSCROLL = 0x114;
- public static final int WM_IME_CHAR = 0x286;
- public static final int WM_IME_COMPOSITION = 0x10f;
- public static final int WM_INITDIALOG = 0x110;
- public static final int WM_INITMENUPOPUP = 0x117;
- public static final int WM_KEYDOWN = 0x100;
- public static final int WM_KEYFIRST = 0x100;
- public static final int WM_KEYLAST = 0x108;
- public static final int WM_KEYUP = 0x101;
- public static final int WM_KILLFOCUS = 0x8;
- public static final int WM_LBUTTONDBLCLK = 0x203;
- public static final int WM_LBUTTONDOWN = 0x201;
- public static final int WM_LBUTTONUP = 0x202;
- public static final int WM_MBUTTONDBLCLK = 0x209;
- public static final int WM_MBUTTONDOWN = 0x207;
- public static final int WM_MBUTTONUP = 0x208;
- public static final int WM_MEASUREITEM = 0x2c;
- public static final int WM_MENUCHAR = 0x120;
- public static final int WM_MENUSELECT = 0x11f;
- public static final int WM_MOUSEACTIVATE = 0x21;
- public static final int WM_MOUSEFIRST = 0x200;
- public static final int WM_MOUSEHOVER = 0x2a1;
- public static final int WM_MOUSELEAVE = 0x2a3;
- public static final int WM_MOUSEMOVE = 0x200;
- public static final int WM_MOUSEWHEEL = 0x20a;
- public static final int WM_MOUSELAST = 0x20d;
- public static final int WM_MOVE = 0x3;
- public static final int WM_NCACTIVATE = 0x86;
- public static final int WM_NCCALCSIZE = 0x83;
- public static final int WM_NCHITTEST = 0x84;
- public static final int WM_NOTIFY = 0x4e;
- public static final int WM_NULL = 0x0;
- public static final int WM_PAINT = 0xf;
- public static final int WM_PALETTECHANGED = 0x311;
- public static final int WM_PASTE = 0x302;
- public static final int WM_QUERYNEWPALETTE = 0x30f;
- public static final int WM_QUERYOPEN = 0x13;
- public static final int WM_RBUTTONDBLCLK = 0x206;
- public static final int WM_RBUTTONDOWN = 0x204;
- public static final int WM_RBUTTONUP = 0x205;
- public static final int WM_SETCURSOR = 0x20;
- public static final int WM_SETFOCUS = 0x7;
- public static final int WM_SETFONT = 0x30;
- public static final int WM_SETICON = 0x80;
- public static final int WM_SETREDRAW = 0xb;
- public static final int WM_SETTINGCHANGE = 0x1A;
- public static final int WM_SHOWWINDOW = 0x18;
- public static final int WM_SIZE = 0x5;
- public static final int WM_SYSCHAR = 0x106;
- public static final int WM_SYSCOLORCHANGE = 0x15;
- public static final int WM_SYSCOMMAND = 0x112;
- public static final int WM_SYSKEYDOWN = 0x104;
- public static final int WM_SYSKEYUP = 0x105;
- public static final int WM_TIMER = 0x113;
- public static final int WM_UNDO = 0x304;
- public static final int WM_USER = 0x400;
- public static final int WM_VSCROLL = 0x115;
- public static final int WM_WINDOWPOSCHANGING = 0x46;
- public static final int WS_BORDER = 0x800000;
- public static final int WS_CAPTION = 0xc00000;
- public static final int WS_CHILD = 0x40000000;
- public static final int WS_CLIPCHILDREN = 0x2000000;
- public static final int WS_CLIPSIBLINGS = 0x4000000;
- public static final int WS_EX_CAPTIONOKBTN = 0x80000000;
- public static final int WS_EX_CLIENTEDGE = 0x200;
- public static final int WS_EX_DLGMODALFRAME = 0x1;
- public static final int WS_EX_STATICEDGE = 0x20000;
- public static final int WS_EX_TOOLWINDOW = 0x80;
- public static final int WS_EX_TOPMOST = 0x8;
- public static final int WS_EX_TRANSPARENT = 0x20;
- public static final int WS_HSCROLL = 0x100000;
- public static final int WS_MAXIMIZEBOX = OS.IsWinCE ? 0x20000 : 0x10000;
- public static final int WS_MINIMIZEBOX = OS.IsWinCE ? 0x10000 : 0x20000;
- public static final int WS_OVERLAPPED = OS.IsWinCE ? WS_BORDER | WS_CAPTION : 0x0;
- public static final int WS_OVERLAPPEDWINDOW = 0xcf0000;
- public static final int WS_POPUP = 0x80000000;
- public static final int WS_SYSMENU = 0x80000;
- public static final int WS_TABSTOP = 0x10000;
- public static final int WS_THICKFRAME = 0x40000;
- public static final int WS_VISIBLE = 0x10000000;
- public static final int WS_VSCROLL = 0x200000;
-
-/** Ansi/Unicode wrappers */
-
-public static final int CallWindowProc (int lpPrevWndFunc, int hWnd, int Msg, int wParam, int lParam) {
- if (IsUnicode) return CallWindowProcW (lpPrevWndFunc, hWnd, Msg, wParam, lParam);
- return CallWindowProcA (lpPrevWndFunc, hWnd, Msg, wParam, lParam);
-}
-
-public static final short CharUpper (short ch) {
- if (IsUnicode) return CharUpperW (ch);
- return CharUpperA (ch);
-}
-
-public static final short CharLower (short ch) {
- if (IsUnicode) return CharLowerW (ch);
- return CharLowerA (ch);
-}
-
-public static final boolean ChooseColor (CHOOSECOLOR lpcc) {
- if (IsUnicode) return ChooseColorW (lpcc);
- return ChooseColorA (lpcc);
-}
-
-public static final boolean ChooseFont (CHOOSEFONT chooseFont) {
- if (IsUnicode) return ChooseFontW (chooseFont);
- return ChooseFontA (chooseFont);
-}
-
-public static final int CreateAcceleratorTable (byte [] lpaccl, int cEntries) {
- if (IsUnicode) return CreateAcceleratorTableW (lpaccl, cEntries);
- return CreateAcceleratorTableA (lpaccl, cEntries);
-}
-
-public static final int CreateDC (TCHAR lpszDriver, TCHAR lpszDevice, int lpszOutput, int lpInitData) {
- if (IsUnicode) {
- char [] lpszDriver1 = lpszDriver == null ? null : lpszDriver.chars;
- char [] lpszDevice1 = lpszDevice == null ? null : lpszDevice.chars;
- return CreateDCW (lpszDriver1, lpszDevice1, lpszOutput, lpInitData);
- }
- byte [] lpszDriver1 = lpszDriver == null ? null : lpszDriver.bytes;
- byte [] lpszDevice1 = lpszDevice == null ? null : lpszDevice.bytes;
- return CreateDCA (lpszDriver1, lpszDevice1, lpszOutput, lpInitData);
-}
-
-public static final int CreateFontIndirect (int lplf) {
- if (IsUnicode) return CreateFontIndirectW (lplf);
- return CreateFontIndirectA (lplf);
-}
-
-public static final int CreateFontIndirect (LOGFONT lplf) {
- if (IsUnicode) return CreateFontIndirectW (lplf);
- return CreateFontIndirectA (lplf);
-}
-
-public static final int CreateWindowEx (int dwExStyle, TCHAR lpClassName, TCHAR lpWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, CREATESTRUCT lpParam) {
- if (IsUnicode) {
- char [] lpClassName1 = lpClassName == null ? null : lpClassName.chars;
- char [] lpWindowName1 = lpWindowName == null ? null : lpWindowName.chars;
- return CreateWindowExW (dwExStyle, lpClassName1, lpWindowName1, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
- }
- byte [] lpClassName1 = lpClassName == null ? null : lpClassName.bytes;
- byte [] lpWindowName1 = lpWindowName == null ? null : lpWindowName.bytes;
- return CreateWindowExA (dwExStyle, lpClassName1, lpWindowName1, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
-}
-
-public static final int DefWindowProc (int hWnd, int Msg, int wParam, int lParam) {
- if (IsUnicode) return DefWindowProcW (hWnd, Msg, wParam, lParam);
- return DefWindowProcA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int DispatchMessage (MSG lpmsg) {
- if (IsUnicode) return DispatchMessageW (lpmsg);
- return DispatchMessageA (lpmsg);
-}
-
-public static final int DragQueryFile (int hDrop, int iFile, TCHAR lpszFile, int cch) {
- if (IsUnicode) {
- char [] lpszFile1 = lpszFile == null ? null : lpszFile.chars;
- return DragQueryFileW (hDrop, iFile, lpszFile1, cch);
- }
- byte [] lpszFile1 = lpszFile == null ? null : lpszFile.bytes;
- return DragQueryFileA (hDrop, iFile, lpszFile1, cch);
-}
-
-public static final boolean DrawState (int hdc, int hbr, int lpOutputFunc, int lData, int wData, int x, int y, int cx, int cy, int fuFlags) {
- if (IsUnicode) return DrawStateW (hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags);
- return DrawStateA (hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags);
-}
-
-public static final int DrawText (int hDC, TCHAR lpString, int nCount, RECT lpRect, int uFormat) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return DrawTextW (hDC, lpString1, nCount, lpRect, uFormat);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return DrawTextA (hDC, lpString1, nCount, lpRect, uFormat);
-}
-
-public static final int EnumFontFamilies (int hdc, TCHAR lpszFamily, int lpEnumFontFamProc, int lParam) {
- if (IsUnicode) {
- char [] lpszFamily1 = lpszFamily == null ? null : lpszFamily.chars;
- return EnumFontFamiliesW (hdc, lpszFamily1, lpEnumFontFamProc, lParam);
- }
- byte [] lpszFamily1 = lpszFamily == null ? null : lpszFamily.bytes;
- return EnumFontFamiliesA (hdc, lpszFamily1, lpEnumFontFamProc, lParam);
-}
-
-public static final boolean EnumSystemLocales (int lpLocaleEnumProc, int dwFlags) {
- if (IsUnicode) return EnumSystemLocalesW (lpLocaleEnumProc, dwFlags);
- return EnumSystemLocalesA (lpLocaleEnumProc, dwFlags);
-}
-
-public static final int ExtractIconEx (TCHAR lpszFile, int nIconIndex, int [] phiconLarge, int [] phiconSmall, int nIcons) {
- if (IsUnicode) {
- char [] lpszFile1 = lpszFile == null ? null : lpszFile.chars;
- return ExtractIconExW (lpszFile1, nIconIndex, phiconLarge, phiconSmall, nIcons);
- }
- byte [] lpszFile1 = lpszFile == null ? null : lpszFile.bytes;
- return ExtractIconExA (lpszFile1, nIconIndex, phiconLarge, phiconSmall, nIcons);
-}
-
-public static final boolean ExtTextOut(int hdc, int X, int Y, int fuOptions, RECT lprc, TCHAR lpString, int cbCount, int[] lpDx) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return ExtTextOutW (hdc, X, Y, fuOptions, lprc, lpString1, cbCount, lpDx);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return ExtTextOutA (hdc, X, Y, fuOptions, lprc, lpString1, cbCount, lpDx);
-}
-
-public static final int FindWindow (TCHAR lpClassName, TCHAR lpWindowName) {
- if (IsUnicode) {
- char [] lpClassName1 = lpClassName == null ? null : lpClassName.chars;
- char [] lpWindowName1 = lpWindowName == null ? null : lpWindowName.chars;
- return FindWindowW (lpClassName1, lpWindowName1);
- }
- byte [] lpClassName1 = lpClassName == null ? null : lpClassName.bytes;
- byte [] lpWindowName1 = lpWindowName == null ? null : lpWindowName.bytes;
- return FindWindowA (lpClassName1, lpWindowName1);
-}
-
-public static final boolean GetCharABCWidths (int hdc, int iFirstChar, int iLastChar, int [] lpabc) {
- if (IsUnicode) return GetCharABCWidthsW (hdc,iFirstChar, iLastChar, lpabc);
- return GetCharABCWidthsA (hdc,iFirstChar, iLastChar, lpabc);
-}
-
-public static final int GetCharacterPlacement (int hdc, TCHAR lpString, int nCount, int nMaxExtent, GCP_RESULTS lpResults, int dwFlags) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return GetCharacterPlacementW (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return GetCharacterPlacementA (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags);
-}
-
-public static final boolean GetCharWidth (int hdc, int iFirstChar, int iLastChar, int [] lpabc) {
- if (IsUnicode) return GetCharWidthW (hdc,iFirstChar, iLastChar, lpabc);
- return GetCharWidthA (hdc,iFirstChar, iLastChar, lpabc);
-}
-
-public static final boolean GetClassInfo (int hInstance, TCHAR lpClassName, WNDCLASS lpWndClass) {
- if (IsUnicode) {
- char [] lpClassName1 = lpClassName == null ? null : lpClassName.chars;
- return GetClassInfoW (hInstance, lpClassName1, lpWndClass);
- }
- byte [] lpClassName1 = lpClassName == null ? null : lpClassName.bytes;
- return GetClassInfoA (hInstance, lpClassName1, lpWndClass);
-}
-
-public static final int GetClipboardFormatName (int format, TCHAR lpszFormatName, int cchMaxCount) {
- if (IsUnicode) {
- char [] lpszFormatName1 = lpszFormatName == null ? null : lpszFormatName.chars;
- return GetClipboardFormatNameW (format, lpszFormatName1, cchMaxCount);
- }
- byte [] lpszFormatName1 = lpszFormatName == null ? null : lpszFormatName.bytes;
- return GetClipboardFormatNameA (format, lpszFormatName1, cchMaxCount);
-
-}
-
-public static final short GetFileTitle (TCHAR lpszFile, TCHAR lpszTitle, short cbBuf) {
- if (IsUnicode) {
- char [] lpszFile1 = lpszFile == null ? null : lpszFile.chars;
- char [] lpszTitle1 = lpszTitle == null ? null : lpszTitle.chars;
- return GetFileTitleW (lpszFile1, lpszTitle1, cbBuf);
- }
- byte [] lpszFile1 = lpszFile == null ? null : lpszFile.bytes;
- byte [] lpszTitle1 = lpszTitle == null ? null : lpszTitle.bytes;
- return GetFileTitleA (lpszFile1, lpszTitle1, cbBuf);
-}
-
-public static final int GetLocaleInfo (int Locale, int LCType, TCHAR lpLCData, int cchData) {
- if (IsUnicode) {
- char [] lpLCData1 = lpLCData == null ? null : lpLCData.chars;
- return GetLocaleInfoW (Locale, LCType, lpLCData1, cchData);
- }
- byte [] lpLCData1 = lpLCData == null ? null : lpLCData.bytes;
- return GetLocaleInfoA (Locale, LCType, lpLCData1, cchData);
-}
-
-public static final boolean GetMenuItemInfo (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii) {
- if (IsUnicode) return GetMenuItemInfoW (hMenu, uItem, fByPosition, lpmii);
- return GetMenuItemInfoA (hMenu, uItem, fByPosition, lpmii);
-}
-
-public static final boolean GetMessage (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax) {
- if (IsUnicode) return GetMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
- return GetMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
-}
-
-public static final int GetModuleHandle (TCHAR lpModuleName) {
- if (IsUnicode) {
- char [] lpModuleName1 = lpModuleName == null ? null : lpModuleName.chars;
- return GetModuleHandleW (lpModuleName1);
- }
- byte [] lpModuleName1 = lpModuleName == null ? null : lpModuleName.bytes;
- return GetModuleHandleA (lpModuleName1);
-}
-
-public static final int GetObject (int hgdiobj, int cbBuffer, BITMAP lpvObject) {
- if (IsUnicode) return GetObjectW (hgdiobj, cbBuffer, lpvObject);
- return GetObjectA (hgdiobj, cbBuffer, lpvObject);
-}
-
-public static final int GetObject (int hgdiobj, int cbBuffer, DIBSECTION lpvObject) {
- if (IsUnicode) return GetObjectW (hgdiobj, cbBuffer, lpvObject);
- return GetObjectA (hgdiobj, cbBuffer, lpvObject);
-}
-
-public static final int GetObject (int hgdiobj, int cbBuffer, LOGBRUSH lpvObject) {
- if (IsUnicode) return GetObjectW (hgdiobj, cbBuffer, lpvObject);
- return GetObjectA (hgdiobj, cbBuffer, lpvObject);
-}
-
-public static final int GetObject (int hgdiobj, int cbBuffer, LOGFONT lpvObject) {
- if (IsUnicode) return GetObjectW (hgdiobj, cbBuffer, lpvObject);
- return GetObjectA (hgdiobj, cbBuffer, lpvObject);
-}
-
-public static final int GetObject (int hgdiobj, int cbBuffer, LOGPEN lpvObject) {
- if (IsUnicode) return GetObjectW (hgdiobj, cbBuffer, lpvObject);
- return GetObjectA (hgdiobj, cbBuffer, lpvObject);
-}
-
-public static final boolean GetOpenFileName (OPENFILENAME lpofn) {
- if (IsUnicode) return GetOpenFileNameW (lpofn);
- return GetOpenFileNameA (lpofn);
-}
-
-public static final int GetProfileString (TCHAR lpAppName, TCHAR lpKeyName, TCHAR lpDefault, TCHAR lpReturnedString, int nSize) {
- if (IsUnicode) {
- char [] lpAppName1 = lpAppName == null ? null : lpAppName.chars;
- char [] lpKeyName1 = lpKeyName == null ? null : lpKeyName.chars;
- char [] lpDefault1 = lpDefault == null ? null : lpDefault.chars;
- char [] lpReturnedString1 = lpReturnedString == null ? null : lpReturnedString.chars;
- return GetProfileStringW (lpAppName1, lpKeyName1, lpDefault1, lpReturnedString1, nSize);
- }
- byte [] lpAppName1 = lpAppName == null ? null : lpAppName.bytes;
- byte [] lpKeyName1 = lpKeyName == null ? null : lpKeyName.bytes;
- byte [] lpDefault1 = lpDefault == null ? null : lpDefault.bytes;
- byte [] lpReturnedString1 = lpReturnedString == null ? null : lpReturnedString.bytes;
- return GetProfileStringA (lpAppName1, lpKeyName1, lpDefault1, lpReturnedString1, nSize);
-}
-
-public static final boolean GetSaveFileName (OPENFILENAME lpofn) {
- if (IsUnicode) return GetSaveFileNameW (lpofn);
- return GetSaveFileNameA (lpofn);
-}
-
-public static final boolean GetTextExtentPoint32 (int hdc, TCHAR lpString, int cbString, SIZE lpSize) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return GetTextExtentPoint32W (hdc, lpString1, cbString, lpSize);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return GetTextExtentPoint32A (hdc, lpString1, cbString, lpSize);
-}
-
-public static final boolean GetTextMetrics (int hdc, TEXTMETRIC lptm) {
- if (IsUnicode) return GetTextMetricsW (hdc, lptm);
- return GetTextMetricsA (hdc, lptm);
-}
-
-public static final boolean GetVersionEx (OSVERSIONINFO lpVersionInfo) {
- if (IsUnicode) return GetVersionExW (lpVersionInfo);
- return GetVersionExA (lpVersionInfo);
-}
-
-public static final int GetWindowLong (int hWnd, int nIndex) {
- if (IsUnicode) return GetWindowLongW (hWnd, nIndex);
- return GetWindowLongA (hWnd, nIndex);
-}
-
-public static final int GetWindowText (int hWnd, TCHAR lpString, int nMaxCount) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return GetWindowTextW (hWnd, lpString1, nMaxCount);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return GetWindowTextA (hWnd, lpString1, nMaxCount);
-}
-
-public static final int GetWindowTextLength (int hWnd) {
- if (IsUnicode) return GetWindowTextLengthW (hWnd);
- return GetWindowTextLengthA (hWnd);
-}
-
-public static final boolean ImmGetCompositionFont (int hIMC, LOGFONT lplf) {
- if (IsUnicode) return ImmGetCompositionFontW (hIMC, lplf);
- return ImmGetCompositionFontA (hIMC, lplf);
-}
-
-public static final boolean ImmSetCompositionFont (int hIMC, LOGFONT lplf) {
- if (IsUnicode) return ImmSetCompositionFontW (hIMC, lplf);
- return ImmSetCompositionFontA (hIMC, lplf);
-}
-
-public static final int ImmGetCompositionString (int hIMC, int dwIndex, TCHAR lpBuf, int dwBufLen) {
- if (IsUnicode) {
- char [] lpBuf1 = lpBuf == null ? null : lpBuf.chars;
- return ImmGetCompositionStringW (hIMC, dwIndex, lpBuf1, dwBufLen);
- }
- byte [] lpBuf1 = lpBuf == null ? null : lpBuf.bytes;
- return ImmGetCompositionStringA (hIMC, dwIndex, lpBuf1, dwBufLen);
-}
-
-public static final boolean InsertMenu (int hMenu, int uPosition, int uFlags, int uIDNewItem, TCHAR lpNewItem) {
- if (IsUnicode) {
- char [] lpNewItem1 = lpNewItem == null ? null : lpNewItem.chars;
- return InsertMenuW (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1);
- }
- byte [] lpNewItem1 = lpNewItem == null ? null : lpNewItem.bytes;
- return InsertMenuA (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1);
-}
-
-public static final boolean InsertMenuItem (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii) {
- if (IsUnicode) return InsertMenuItemW (hMenu, uItem, fByPosition, lpmii);
- return InsertMenuItemA (hMenu, uItem, fByPosition, lpmii);
-}
-
-public static final int LoadBitmap (int hInstance, int lpBitmapName) {
- if (IsUnicode) return LoadBitmapW (hInstance, lpBitmapName);
- return LoadBitmapA (hInstance, lpBitmapName);
-}
-
-public static final int LoadCursor (int hInstance, int lpCursorName) {
- if (IsUnicode) return LoadCursorW (hInstance, lpCursorName);
- return LoadCursorA (hInstance, lpCursorName);
-}
-
-public static final int LoadIcon (int hInstance, int lpIconName) {
- if (IsUnicode) return LoadIconW (hInstance, lpIconName);
- return LoadIconA (hInstance, lpIconName);
-}
-
-public static final int LoadImage (int hinst, TCHAR lpszName, int uType, int cxDesired, int cyDesired, int fuLoad) {
- if (IsUnicode) {
- char [] lpszName1 = lpszName == null ? null : lpszName.chars;
- return LoadImageW (hinst, lpszName1, uType, cxDesired, cyDesired, fuLoad);
- }
- byte [] lpszName1 = lpszName == null ? null : lpszName.bytes;
- return LoadImageA (hinst, lpszName1, uType, cxDesired, cyDesired, fuLoad);
-}
-
-public static final int LoadLibrary (TCHAR lpLibFileName) {
- if (IsUnicode) {
- char [] lpLibFileName1 = lpLibFileName == null ? null : lpLibFileName.chars;
- return LoadLibraryW (lpLibFileName1);
- }
- byte [] lpLibFileName1 = lpLibFileName == null ? null : lpLibFileName.bytes;
- return LoadLibraryA (lpLibFileName1);
-}
-
-public static final int MapVirtualKey (int uCode, int uMapType) {
- if (IsUnicode) return MapVirtualKeyW (uCode, uMapType);
- return MapVirtualKeyA (uCode, uMapType);
-}
-
-public static final int MessageBox (int hWnd, TCHAR lpText, TCHAR lpCaption, int uType) {
- if (IsUnicode) {
- char [] lpText1 = lpText == null ? null : lpText.chars;
- char [] lpCaption1 = lpCaption == null ? null : lpCaption.chars;
- return MessageBoxW (hWnd, lpText1, lpCaption1, uType);
- }
- byte [] lpText1 = lpText == null ? null : lpText.bytes;
- byte [] lpCaption1 = lpCaption == null ? null : lpCaption.bytes;
- return MessageBoxA (hWnd, lpText1, lpCaption1, uType);
-}
-
-public static final void MoveMemory (int Destination, TCHAR Source, int Length) {
- if (IsUnicode) {
- char [] Source1 = Source == null ? null : Source.chars;
- MoveMemory (Destination, Source1, Length);
- } else {
- byte [] Source1 = Source == null ? null : Source.bytes;
- MoveMemory (Destination, Source1, Length);
- }
-}
-
-public static final void MoveMemory (TCHAR Destination, int Source, int Length) {
- if (IsUnicode) {
- char [] Destination1 = Destination == null ? null : Destination.chars;
- MoveMemory (Destination1, Source, Length);
- } else {
- byte [] Destination1 = Destination == null ? null : Destination.bytes;
- MoveMemory (Destination1, Source, Length);
- }
-}
-
-public static final void MoveMemory (int Destination, LOGFONT Source, int Length) {
- if (IsUnicode) {
- MoveMemoryW (Destination, Source, Length);
- } else {
- MoveMemoryA (Destination, Source, Length);
- }
-}
-
-public static final void MoveMemory (LOGFONT Destination, int Source, int Length) {
- if (IsUnicode) {
- MoveMemoryW (Destination, Source, Length);
- } else {
- MoveMemoryA (Destination, Source, Length);
- }
-}
-
-public static final void MoveMemory (int Destination, NMTTDISPINFO Source, int Length) {
- if (IsUnicode) {
- MoveMemoryW (Destination, Source, Length);
- } else {
- MoveMemoryA (Destination, Source, Length);
- }
-}
-
-public static final void MoveMemory (NMTTDISPINFO Destination, int Source, int Length) {
- if (IsUnicode) {
- MoveMemoryW (Destination, Source, Length);
- } else {
- MoveMemoryA (Destination, Source, Length);
- }
-}
-
-public static final boolean PeekMessage (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg) {
- if (IsUnicode) return PeekMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
- return PeekMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
-}
-
-public static final boolean PostMessage (int hWnd, int Msg, int wParam, int lParam) {
- if (IsUnicode) return PostMessageW (hWnd, Msg, wParam, lParam);
- return PostMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final boolean PostThreadMessage (int idThread, int Msg, int wParam, int lParam) {
- if (IsUnicode) return PostThreadMessageW (idThread, Msg, wParam, lParam);
- return PostThreadMessageA (idThread, Msg, wParam, lParam);
-}
-
-public static final boolean PrintDlg (PRINTDLG lppd) {
- if (IsUnicode) return PrintDlgW (lppd);
- return PrintDlgA (lppd);
-}
-
-public static final int RegEnumKeyEx (int hKey, int dwIndex, TCHAR lpName, int [] lpcName, int [] lpReserved, TCHAR lpClass, int [] lpcClass, FILETIME lpftLastWriteTime) {
- if (IsUnicode) {
- char [] lpName1 = lpName == null ? null : lpName.chars;
- char [] lpClass1 = lpClass == null ? null : lpClass.chars;
- return RegEnumKeyExW (hKey, dwIndex, lpName1, lpcName, lpReserved, lpClass1, lpcClass, lpftLastWriteTime);
- }
- byte [] lpName1 = lpName == null ? null : lpName.bytes;
- byte [] lpClass1 = lpClass == null ? null : lpClass.bytes;
- return RegEnumKeyExA (hKey, dwIndex, lpName1, lpcName, lpReserved, lpClass1, lpcClass, lpftLastWriteTime);
-}
-
-public static final int RegisterClass (WNDCLASS lpWndClass) {
- if (IsUnicode) return RegisterClassW (lpWndClass);
- return RegisterClassA (lpWndClass);
-}
-
-public static final int RegisterClipboardFormat (TCHAR lpszFormat) {
- if (IsUnicode) {
- char [] lpszFormat1 = lpszFormat == null ? null : lpszFormat.chars;
- return RegisterClipboardFormatW (lpszFormat1);
- }
- byte [] lpszFormat1 = lpszFormat == null ? null : lpszFormat.bytes;
- return RegisterClipboardFormatA (lpszFormat1);
-}
-
-public static final int RegOpenKeyEx (int hKey, TCHAR lpSubKey, int ulOptions, int samDesired, int[] phkResult) {
- if (IsUnicode) {
- char [] lpSubKey1 = lpSubKey == null ? null : lpSubKey.chars;
- return RegOpenKeyExW (hKey, lpSubKey1, ulOptions, samDesired, phkResult);
- }
- byte [] lpSubKey1 = lpSubKey == null ? null : lpSubKey.bytes;
- return RegOpenKeyExA (hKey, lpSubKey1, ulOptions, samDesired, phkResult);
-}
-
-public static final int RegQueryInfoKey (int hKey, int lpClass, int[] lpcbClass, int lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int lpftLastWriteTime){
- if (IsUnicode) return RegQueryInfoKeyW (hKey, lpClass, lpcbClass, lpReserved, lpSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime);
- return RegQueryInfoKeyA (hKey, lpClass, lpcbClass, lpReserved, lpSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime);
-}
-
-public static final int RegQueryValueEx (int hKey, TCHAR lpValueName, int lpReserved, int[] lpType, TCHAR lpData, int[] lpcbData) {
- if (IsUnicode) {
- char [] lpValueName1 = lpValueName == null ? null : lpValueName.chars;
- char [] lpData1 = lpData == null ? null : lpData.chars;
- return RegQueryValueExW (hKey, lpValueName1, lpReserved, lpType, lpData1, lpcbData);
- }
- byte [] lpValueName1 = lpValueName == null ? null : lpValueName.bytes;
- byte [] lpData1 = lpData == null ? null : lpData.bytes;
- return RegQueryValueExA (hKey, lpValueName1, lpReserved, lpType, lpData1, lpcbData);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TCHAR lParam) {
- if (IsUnicode) {
- char [] lParam1 = lParam == null ? null : lParam.chars;
- return SendMessageW (hWnd, Msg, wParam, lParam1);
- }
- byte [] lParam1 = lParam == null ? null : lParam.bytes;
- return SendMessageA (hWnd, Msg, wParam, lParam1);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int [] wParam, int [] lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int [] wParam, int lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, int [] lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, short [] lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, int lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, LVCOLUMN lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, LVHITTESTINFO lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, LVITEM lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, REBARBANDINFO lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, RECT lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TBBUTTON lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TBBUTTONINFO lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TCITEM lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TOOLINFO lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TVHITTESTINFO lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TVINSERTSTRUCT lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final int SendMessage (int hWnd, int Msg, int wParam, TVITEM lParam) {
- if (IsUnicode) return SendMessageW (hWnd, Msg, wParam, lParam);
- return SendMessageA (hWnd, Msg, wParam, lParam);
-}
-
-public static final boolean SetMenuItemInfo (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii) {
- if (IsUnicode) return SetMenuItemInfoW (hMenu, uItem, fByPosition, lpmii);
- return SetMenuItemInfoA (hMenu, uItem, fByPosition, lpmii);
-}
-
-public static final int SetWindowLong (int hWnd, int nIndex, int dwNewLong) {
- if (IsUnicode) return SetWindowLongW (hWnd, nIndex, dwNewLong);
- return SetWindowLongA (hWnd, nIndex, dwNewLong);
-}
-
-public static final int SetWindowsHookEx (int idHook, int lpfn, int hMod, int dwThreadId) {
- if (IsUnicode) return SetWindowsHookExW (idHook, lpfn, hMod, dwThreadId);
- return SetWindowsHookExA (idHook, lpfn, hMod, dwThreadId);
-}
-
-public static final boolean SetWindowText (int hWnd, TCHAR lpString) {
- if (IsUnicode) {
- char [] lpString1 = lpString == null ? null : lpString.chars;
- return SetWindowTextW (hWnd, lpString1);
- }
- byte [] lpString1 = lpString == null ? null : lpString.bytes;
- return SetWindowTextA (hWnd, lpString1);
-}
-
-public static final int SHBrowseForFolder (BROWSEINFO lpbi) {
- if (IsUnicode) return SHBrowseForFolderW (lpbi);
- return SHBrowseForFolderA (lpbi);
-}
-
-public static final boolean ShellExecuteEx (SHELLEXECUTEINFO lpExecInfo) {
- if (IsUnicode) return ShellExecuteExW (lpExecInfo);
- return ShellExecuteExA (lpExecInfo);
-}
-
-public static final boolean SHGetPathFromIDList (int pidl, TCHAR pszPath) {
- if (IsUnicode) {
- char [] pszPath1 = pszPath == null ? null : pszPath.chars;
- return SHGetPathFromIDListW (pidl, pszPath1);
- }
- byte [] pszPath1 = pszPath == null ? null : pszPath.bytes;
- return SHGetPathFromIDListA (pidl, pszPath1);
-}
-
-public static final int StartDoc (int hdc, DOCINFO lpdi) {
- if (IsUnicode) return StartDocW (hdc, lpdi);
- return StartDocA (hdc, lpdi);
-}
-
-public static final boolean SystemParametersInfo (int uiAction, int uiParam, RECT pvParam, int fWinIni) {
- if (IsUnicode) return SystemParametersInfoW (uiAction, uiParam, pvParam, fWinIni);
- return SystemParametersInfoA (uiAction, uiParam, pvParam, fWinIni);
-}
-
-public static final boolean SystemParametersInfo (int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni) {
- if (IsUnicode) return SystemParametersInfoW (uiAction, uiParam, pvParam, fWinIni);
- return SystemParametersInfoA (uiAction, uiParam, pvParam, fWinIni);
-}
-
-public static final boolean SystemParametersInfo (int uiAction, int uiParam, int[] pvParam, int fWinIni) {
- if (IsUnicode) return SystemParametersInfoW (uiAction, uiParam, pvParam, fWinIni);
- return SystemParametersInfoA (uiAction, uiParam, pvParam, fWinIni);
-}
-
-public static final int TranslateAccelerator (int hWnd, int hAccTable, MSG lpMsg) {
- if (IsUnicode) return TranslateAcceleratorW (hWnd, hAccTable, lpMsg);
- return TranslateAcceleratorA (hWnd, hAccTable, lpMsg);
-}
-
-public static final boolean UnregisterClass (TCHAR lpClassName, int hInstance) {
- if (IsUnicode) {
- char [] lpClassName1 = lpClassName == null ? null : lpClassName.chars;
- return UnregisterClassW (lpClassName1, hInstance);
- }
- byte [] lpClassName1 = lpClassName == null ? null : lpClassName.bytes;
- return UnregisterClassA (lpClassName1, hInstance);
-}
-
-public static final short VkKeyScan (short ch) {
- if (IsUnicode) return VkKeyScanW (ch);
- return VkKeyScanA (ch);
-}
-
-/** Natives */
-public static final native int AbortDoc (int hdc);
-public static final native int ActivateKeyboardLayout(int hkl, int Flags);
-public static final native boolean AdjustWindowRectEx (RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle);
-public static final native boolean Arc (int hdc,int nLeftRect,int nTopRect,int nRightRect,int nBottomRect,int nXStartArc,int nYStartArc,int nXEndArc,int nYEndArc);
-public static final native int BeginDeferWindowPos (int nNumWindows);
-public static final native int BeginPaint (int hWnd, PAINTSTRUCT lpPaint);
-public static final native boolean BitBlt (int hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,int hdcSrc,int nXSrc,int nYSrc,int dwRop);
-public static final native boolean BringWindowToTop (int hWnd);
-public static final native int Call (int address, DLLVERSIONINFO arg0);
-public static final native int CallNextHookEx(int hhk, int nCode, int wParam, int lParam);
-public static final native int CallWindowProcW (int lpPrevWndFunc, int hWnd, int Msg, int wParam, int lParam);
-public static final native int CallWindowProcA (int lpPrevWndFunc, int hWnd, int Msg, int wParam, int lParam);
-public static final native short CharLowerW (short ch);
-public static final native short CharLowerA (short ch);
-public static final native short CharUpperW (short ch);
-public static final native short CharUpperA (short ch);
-public static final native boolean CheckMenuItem (int hmenu, int uIDCheckItem, int uCheck);
-public static final native boolean ChooseColorW (CHOOSECOLOR lpcc);
-public static final native boolean ChooseColorA (CHOOSECOLOR lpcc);
-public static final native boolean ChooseFontW (CHOOSEFONT chooseFont);
-public static final native boolean ChooseFontA (CHOOSEFONT chooseFont);
-public static final native boolean ClientToScreen (int hWnd, POINT lpPoint);
-public static final native boolean CloseClipboard ();
-public static final native int CombineRgn (int hrgnDest, int hrgnSrc1, int hrgnSrc2, int fnCombineMode);
-public static final native void CommandBar_Destroy (int hwndCB);
-public static final native int CommDlgExtendedError ();
-public static final native int CopyImage (int hImage, int uType, int cxDesired, int cyDesired, int fuFlags);
-public static final native int CreateAcceleratorTableW (byte [] lpaccl, int cEntries);
-public static final native int CreateAcceleratorTableA (byte [] lpaccl, int cEntries);
-public static final native int CreateBitmap (int nWidth, int nHeight, int cPlanes, int cBitsPerPel, byte [] lpvBits);
-public static final native boolean CreateCaret (int hWnd, int hBitmap, int nWidth, int nHeight);
-public static final native int CreateCompatibleBitmap (int hdc, int nWidth, int nHeight);
-public static final native int CreateCompatibleDC (int hdc);
-public static final native int CreateCursor (int hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte [] pvANDPlane, byte [] pvXORPlane);
-public static final native int CreateDCW (char [] lpszDriver, char [] lpszDevice, int lpszOutput, int lpInitData);
-public static final native int CreateDCA (byte [] lpszDriver, byte [] lpszDevice, int lpszOutput, int lpInitData);
-public static final native int CreateDIBSection(int hdc, byte[] pbmi, int iUsage, int[] ppvBits, int hSection, int dwOffset);
-public static final native int CreateFontIndirectW (int lplf);
-public static final native int CreateFontIndirectA (int lplf);
-public static final native int CreateFontIndirectW (LOGFONT lplf);
-public static final native int CreateFontIndirectA (LOGFONT lplf);
-public static final native int CreateIconIndirect (ICONINFO lplf);
-public static final native int CreateMenu ();
-public static final native int CreatePalette (byte[] logPalette);
-public static final native int CreatePatternBrush (int colorRef);
-public static final native int CreatePen (int fnPenStyle, int nWidth, int crColor);
-public static final native int CreatePopupMenu ();
-public static final native int CreateRectRgn (int left, int top, int right, int bottom);
-public static final native int CreateSolidBrush (int colorRef);
-public static final native int CreateWindowExW (int dwExStyle, char [] lpClassName, char [] lpWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, CREATESTRUCT lpParam);
-public static final native int CreateWindowExA (int dwExStyle, byte [] lpClassName, byte [] lpWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, CREATESTRUCT lpParam);
-public static final native int DeferWindowPos (int hWinPosInfo, int hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
-public static final native int DefWindowProcW (int hWnd, int Msg, int wParam, int lParam);
-public static final native int DefWindowProcA (int hWnd, int Msg, int wParam, int lParam);
-public static final native boolean DeleteDC (int hdc);
-public static final native boolean DeleteMenu (int hMenu, int uPosition, int uFlags);
-public static final native boolean DeleteObject (int hGdiObj);
-public static final native boolean DestroyAcceleratorTable (int hAccel);
-public static final native boolean DestroyCaret ();
-public static final native boolean DestroyCursor (int hCursor);
-public static final native boolean DestroyIcon (int hIcon);
-public static final native boolean DestroyMenu (int hMenu);
-public static final native boolean DestroyWindow (int hWnd);
-public static final native int DispatchMessageW (MSG lpmsg);
-public static final native int DispatchMessageA (MSG lpmsg);
-public static final native boolean DragDetect (int hwnd, POINT pt);
-public static final native void DragFinish (int hDrop);
-public static final native int DragQueryFileA (int hDrop, int iFile, byte[] lpszFile, int cch);
-public static final native int DragQueryFileW (int hDrop, int iFile, char[] lpszFile, int cch);
-public static final native boolean DrawEdge (int hdc, RECT qrc, int edge, int grfFlags);
-public static final native boolean DrawFocusRect (int hDC, RECT lpRect);
-public static final native boolean DrawFrameControl (int hdc, RECT lprc, int uType, int uState);
-public static final native boolean DrawIconEx (int hdc, int xLeft, int yTop, int hIcon, int cxWidth, int cyWidth, int istepIfAniCur, int hbrFlickerFreeDraw, int diFlags);
-public static final native boolean DrawMenuBar (int hWnd);
-public static final native boolean DrawStateW (int hdc, int hbr, int lpOutputFunc, int lData, int wData, int x, int y, int cx, int cy, int fuFlags);
-public static final native boolean DrawStateA (int hdc, int hbr, int lpOutputFunc, int lData, int wData, int x, int y, int cx, int cy, int fuFlags);
-public static final native int DrawTextW (int hDC, char [] lpString, int nCount, RECT lpRect, int uFormat);
-public static final native int DrawTextA (int hDC, byte [] lpString, int nCount, RECT lpRect, int uFormat);
-public static final native boolean Ellipse (int hdc,int nLeftRect,int nTopRect,int nRightRect,int nBottomRect);
-public static final native boolean EnableMenuItem (int hMenu, int uIDEnableItem, int uEnable);
-public static final native boolean EnableScrollBar (int hWnd, int wSBflags, int wArrows);
-public static final native boolean EnableWindow (int hWnd, boolean bEnable);
-public static final native boolean EnumSystemLocalesW (int lpLocaleEnumProc, int dwFlags);
-public static final native boolean EnumSystemLocalesA (int lpLocaleEnumProc, int dwFlags);
-public static final native boolean EndDeferWindowPos (int hWinPosInfo);
-public static final native int EndDoc (int hdc);
-public static final native int EndPage (int hdc);
-public static final native int EndPaint (int hWnd, PAINTSTRUCT lpPaint);
-public static final native int EnumFontFamiliesW (int hdc, char [] lpszFamily, int lpEnumFontFamProc, int lParam);
-public static final native int EnumFontFamiliesA (int hdc, byte [] lpszFamily, int lpEnumFontFamProc, int lParam);
-public static final native boolean EqualRgn (int hSrcRgn1, int hSrcRgn2);
-public static final native boolean ExtTextOutW(int hdc, int X, int Y, int fuOptions, RECT lprc, char[] lpString, int cbCount, int[] lpDx);
-public static final native boolean ExtTextOutA(int hdc, int X, int Y, int fuOptions, RECT lprc, byte[] lpString, int cbCount, int[] lpDx);
-public static final native int ExtractIconExW (char [] lpszFile, int nIconIndex, int [] phiconLarge, int [] phiconSmall, int nIcons);
-public static final native int ExtractIconExA (byte [] lpszFile, int nIconIndex, int [] phiconLarge, int [] phiconSmall, int nIcons);
-public static final native int FillRect(int hDC, RECT lprc, int hbr);
-public static final native int FindWindowA (byte [] lpClassName, byte [] lpWindowName);
-public static final native int FindWindowW (char [] lpClassName, char [] lpWindowName);
-public static final native boolean FreeLibrary (int hLibModule);
-public static final native int GetACP ();
-public static final native int GetActiveWindow ();
-public static final native int GetBkColor (int hDC);
-public static final native int GetCapture ();
-public static final native boolean GetCaretPos (POINT lpPoint);
-public static final native boolean GetCharABCWidthsA (int hdc, int iFirstChar, int iLastChar, int [] lpabc);
-public static final native boolean GetCharABCWidthsW (int hdc, int iFirstChar, int iLastChar, int [] lpabc);
-public static final native int GetCharacterPlacementW(int hdc, char[] lpString, int nCount, int nMaxExtent, GCP_RESULTS lpResults, int dwFlags);
-public static final native int GetCharacterPlacementA(int hdc, byte[] lpString, int nCount, int nMaxExtent, GCP_RESULTS lpResults, int dwFlags);
-public static final native boolean GetCharWidthA (int hdc, int iFirstChar, int iLastChar, int [] lpBuffer);
-public static final native boolean GetCharWidthW (int hdc, int iFirstChar, int iLastChar, int [] lpBuffer);
-public static final native boolean GetClassInfoW (int hInstance, char [] lpClassName, WNDCLASS lpWndClass);
-public static final native boolean GetClassInfoA (int hInstance, byte [] lpClassName, WNDCLASS lpWndClass);
-public static final native boolean GetClientRect (int hWnd, RECT lpRect);
-public static final native int GetClipboardData (int uFormat);
-public static final native int GetClipboardFormatNameA (int format, byte[] lpszFormatName, int cchMaxCount);
-public static final native int GetClipboardFormatNameW (int format, char[] lpszFormatName, int cchMaxCount);
-public static final native int GetClipBox (int hdc, RECT lprc);
-public static final native int GetClipRgn (int hdc, int hrgn);
-public static final native int GetCurrentObject (int hdc, int uObjectType);
-public static final native int GetCurrentProcessId ();
-public static final native int GetCurrentThreadId ();
-public static final native int GetCursor ();
-public static final native boolean GetCursorPos (POINT lpPoint);
-public static final native int GetDC (int hwnd);
-public static final native int GetDCEx (int hWnd, int hrgnClip, int flags);
-public static final native int GetDesktopWindow ();
-public static final native int GetDeviceCaps (int hdc, int nIndex);
-public static final native int GetDialogBaseUnits ();
-public static final native int GetDIBColorTable (int hdc, int uStartIndex, int cEntries, byte[] pColors);
-public static final native int GetDIBits (int hdc, int hbmp, int uStartScan, int cScanLines, int lpvBits, byte[] lpbi, int uUsage);
-public static final native int GetDlgItem (int hDlg, int nIDDlgItem);
-public static final native int GetDoubleClickTime ();
-public static final native short GetFileTitleW (char [] lpszFile, char [] lpszTitle, short cbBuf);
-public static final native short GetFileTitleA (byte [] lpszFile, byte [] lpszTitle, short cbBuf);
-public static final native int GetFocus ();
-public static final native int GetFontLanguageInfo(int hdc);
-public static final native boolean GetIconInfo (int hIcon, ICONINFO piconinfo);
-public static final native int GetKeyboardLayoutList(int nBuff, int[] lpList);
-public static final native int GetKeyboardLayout(int idThread);public static final native short GetKeyState (int nVirtKey);
-public static final native boolean GetKeyboardState (byte [] lpKeyState);
-public static final native int GetLastActivePopup (int hWnd);
-public static final native int GetLastError ();
-/* returns the instance handle to the swt library */
-public static final native int GetLibraryHandle ();
-public static final native int GetLocaleInfoW (int Locale, int LCType, char [] lpLCData, int cchData);
-public static final native int GetLocaleInfoA (int Locale, int LCType, byte [] lpLCData, int cchData);
-public static final native int GetMenu (int hWnd);
-public static final native int GetMenuDefaultItem (int hMenu, int fByPos, int gmdiFlags);
-public static final native boolean GetMenuInfo (int hmenu, MENUINFO lpcmi);
-public static final native int GetMenuItemCount (int hMenu);
-public static final native boolean GetMenuItemInfoW (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native boolean GetMenuItemInfoA (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native boolean GetMessageW (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax);
-public static final native boolean GetMessageA (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax);
-public static final native int GetMessagePos ();
-public static final native int GetMessageTime ();
-public static final native int GetTextCharset(int hdc);
-public static final native int GetTickCount ();
-public static final native int GetModuleHandleW (char [] lpModuleName);
-public static final native int GetModuleHandleA (byte [] lpModuleName);
-public static final native int GetNearestPaletteIndex(int hPal, int crColor);
-public static final native int GetObjectA (int hgdiobj, int cbBuffer, BITMAP lpvObject);
-public static final native int GetObjectW (int hgdiobj, int cbBuffer, BITMAP lpvObject);
-public static final native int GetObjectA (int hgdiobj, int cbBuffer, DIBSECTION lpvObject);
-public static final native int GetObjectW (int hgdiobj, int cbBuffer, DIBSECTION lpvObject);
-public static final native int GetObjectA (int hgdiobj, int cbBuffer, LOGBRUSH lpvObject);
-public static final native int GetObjectW (int hgdiobj, int cbBuffer, LOGBRUSH lpvObject);
-public static final native int GetObjectA (int hgdiobj, int cbBuffer, LOGFONT lpvObject);
-public static final native int GetObjectW (int hgdiobj, int cbBuffer, LOGFONT lpvObject);
-public static final native int GetObjectA (int hgdiobj, int cbBuffer, LOGPEN lpvObject);
-public static final native int GetObjectW (int hgdiobj, int cbBuffer, LOGPEN lpvObject);
-public static final native boolean GetOpenFileNameW (OPENFILENAME lpofn);
-public static final native boolean GetOpenFileNameA (OPENFILENAME lpofn);
-public static final native int GetPaletteEntries (int hPalette, int iStartIndex, int nEntries, byte[] logPalette);
-public static final native int GetParent (int hWnd);
-public static final native int GetPixel (int hdc, int x, int y);
-public static final native int GetProcAddress (int hModule, byte [] lpProcName);
-public static final native int GetProcessHeap ();
-public static final native int GetProfileStringW (char [] lpAppName, char [] lpKeyName, char [] lpDefault, char [] lpReturnedString, int nSize);
-public static final native int GetProfileStringA (byte [] lpAppName, byte [] lpKeyName, byte [] lpDefault, byte [] lpReturnedString, int nSize);
-public static final native int GetRegionData (int hRgn, int dwCount, int [] lpRgnData);
-public static final native int GetRgnBox (int hrgn, RECT lprc);
-public static final native int GetROP2 (int hdc);
-public static final native boolean GetSaveFileNameW (OPENFILENAME lpofn);
-public static final native boolean GetSaveFileNameA (OPENFILENAME lpofn);
-public static final native boolean GetScrollInfo (int hwnd, int flags, SCROLLINFO info);
-public static final native int GetStockObject (int fnObject);
-public static final native int GetSysColor (int nIndex);
-public static final native int GetSysColorBrush (int nIndex);
-public static final native int GetSystemMenu (int hWnd, boolean bRevert);
-public static final native int GetSystemMetrics (int nIndex);
-public static final native int GetTextColor (int hDC);
-public static final native boolean GetTextExtentPoint32W (int hdc, char [] lpString, int cbString, SIZE lpSize);
-public static final native boolean GetTextExtentPoint32A (int hdc, byte [] lpString, int cbString, SIZE lpSize);
-public static final native boolean GetTextMetricsW (int hdc, TEXTMETRIC lptm);
-public static final native boolean GetTextMetricsA (int hdc, TEXTMETRIC lptm);
-public static final native int GetUpdateRgn (int hWnd, int hRgn, boolean bErase);
-public static final native boolean GetVersionExW (OSVERSIONINFO lpVersionInfo);
-public static final native boolean GetVersionExA (OSVERSIONINFO lpVersionInfo);
-public static final native int GetWindow (int hWnd, int uCmd);
-public static final native int GetWindowLongW (int hWnd, int nIndex);
-public static final native int GetWindowLongA (int hWnd, int nIndex);
-public static final native boolean GetWindowPlacement (int hWnd, WINDOWPLACEMENT lpwndpl);
-public static final native boolean GetWindowRect (int hWnd, RECT lpRect);
-public static final native int GetWindowTextW (int hWnd, char [] lpString, int nMaxCount);
-public static final native int GetWindowTextA (int hWnd, byte [] lpString, int nMaxCount);
-public static final native int GetWindowTextLengthW (int hWnd);
-public static final native int GetWindowTextLengthA (int hWnd);
-public static final native int GetWindowThreadProcessId (int hWnd, int [] lpdwProcessId);
-public static final native int GlobalAlloc (int uFlags, int dwBytes);
-public static final native int GlobalFree (int hMem);
-public static final native int GlobalLock (int hMem);
-public static final native int GlobalSize (int hMem);
-public static final native boolean GlobalUnlock (int hMem);
-public static final native boolean GradientFill(int hdc, int pVertex, int dwNumVertex, int pMesh, int dwNumMesh, int dwMode);
-public static final native int HeapAlloc (int hHeap, int dwFlags, int dwBytes);
-public static final native boolean HeapFree (int hHeap, int dwFlags, int lpMem);
-public static final native boolean HideCaret (int hWnd);
-public static final native int ImageList_Add (int himl, int hbmImage, int hbmMask);
-public static final native int ImageList_AddMasked (int himl, int hbmImage, int crMask);
-public static final native int ImageList_Create (int cx, int cy, int flags, int cInitial, int cGrow);
-public static final native boolean ImageList_Destroy (int himl);
-public static final native int ImageList_GetIcon (int himl, int i, int flags);
-public static final native boolean ImageList_GetIconSize (int himl, int [] cx, int [] cy);
-public static final native int ImageList_GetImageCount (int himl);
-public static final native boolean ImageList_Remove (int himl, int i);
-public static final native boolean ImageList_Replace (int himl, int i, int hbmImage, int hbmMask);
-public static final native int ImageList_ReplaceIcon (int himl, int i, int hicon);
-public static final native boolean ImageList_SetIconSize (int himl, int cx, int cy);
-public static final native int ImmAssociateContext (int hWnd, int hIMC);
-public static final native int ImmCreateContext ();
-public static final native boolean ImmDestroyContext (int hIMC);
-public static final native boolean ImmGetCompositionFontW (int hIMC, LOGFONT lplf);
-public static final native boolean ImmGetCompositionFontA (int hIMC, LOGFONT lplf);
-public static final native int ImmGetCompositionStringW (int hIMC, int dwIndex, char [] lpBuf, int dwBufLen);
-public static final native int ImmGetCompositionStringA (int hIMC, int dwIndex, byte [] lpBuf, int dwBufLen);
-public static final native int ImmGetContext (int hWnd);
-public static final native boolean ImmGetConversionStatus (int hIMC, int [] lpfdwConversion, int [] lpfdwSentence);
-public static final native int ImmGetDefaultIMEWnd (int hWnd);
-public static final native boolean ImmGetOpenStatus (int hIMC);
-public static final native boolean ImmReleaseContext (int hWnd, int hIMC);
-public static final native boolean ImmSetCompositionFontW (int hIMC, LOGFONT lplf);
-public static final native boolean ImmSetCompositionFontA (int hIMC, LOGFONT lplf);
-public static final native boolean ImmSetCompositionWindow (int hIMC, COMPOSITIONFORM lpCompForm);
-public static final native boolean ImmSetConversionStatus (int hIMC, int fdwConversion, int dwSentence);
-public static final native boolean ImmSetOpenStatus (int hIMC, boolean fOpen);
-public static final native void InitCommonControls ();
-public static final native boolean InitCommonControlsEx (INITCOMMONCONTROLSEX lpInitCtrls);
-public static final native boolean InsertMenuW (int hMenu, int uPosition, int uFlags, int uIDNewItem, char [] lpNewItem);
-public static final native boolean InsertMenuA (int hMenu, int uPosition, int uFlags, int uIDNewItem, byte [] lpNewItem);
-public static final native boolean InsertMenuItemW (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native boolean InsertMenuItemA (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native boolean InvalidateRect(int hWnd, RECT lpRect, boolean bErase);
-public static final native boolean InvalidateRgn (int hWnd, int hRgn, boolean bErase);
-public static final native boolean IsDBCSLeadByte (byte TestChar);
-public static final native boolean IsIconic (int hWnd);
-public static final native boolean IsWindowEnabled (int hWnd);
-public static final native boolean IsWindowVisible (int hWnd);
-public static final native boolean IsZoomed (int hWnd);
-public static final native boolean KillTimer (int hWnd, int uIDEvent);
-public static final native boolean LineTo (int hdc,int x1, int x2);
-public static final native int LoadBitmapW (int hInstance, int lpBitmapName);
-public static final native int LoadBitmapA (int hInstance, int lpBitmapName);
-public static final native int LoadCursorW (int hInstance, int lpCursorName);
-public static final native int LoadCursorA (int hInstance, int lpCursorName);
-public static final native int LoadIconW (int hInstance, int lpIconName);
-public static final native int LoadIconA (int hInstance, int lpIconName);
-public static final native int LoadImageW (int hinst, char [] lpszName, int uType, int cxDesired, int cyDesired, int fuLoad);
-public static final native int LoadImageA (int hinst, byte [] lpszName, int uType, int cxDesired, int cyDesired, int fuLoad);
-public static final native int LoadLibraryW (char [] lpLibFileName);
-public static final native int LoadLibraryA (byte [] lpLibFileName);
-public static final native int MapVirtualKeyW (int uCode, int uMapType);
-public static final native int MapVirtualKeyA (int uCode, int uMapType);
-public static final native int MapWindowPoints (int hWndFrom, int hWndTo, POINT lpPoints, int cPoints);
-public static final native int MapWindowPoints (int hWndFrom, int hWndTo, RECT lpPoints, int cPoints);
-public static final native boolean MessageBeep (int uType);
-public static final native int MessageBoxW (int hWnd, char [] lpText, char [] lpCaption, int uType);
-public static final native int MessageBoxA (int hWnd, byte [] lpText, byte [] lpCaption, int uType);
-public static final native void MoveMemory (char[] Destination, int SourcePtr, int Length);
-public static final native void MoveMemory (byte [] Destination, int Source, int Length);
-public static final native void MoveMemory (byte [] Destination, ACCEL Source, int Length);
-public static final native void MoveMemory (int [] Destination, int Source, int Length);
-public static final native void MoveMemory (int Destination, byte [] Source, int Length);
-public static final native void MoveMemory (int Destination, char [] Source, int Length);
-public static final native void MoveMemory (int Destination, int [] Source, int Length);
-public static final native void MoveMemory (int Destination, GRADIENT_RECT Source, int Length);
-public static final native void MoveMemoryW (int Destination, LOGFONT Source, int Length);
-public static final native void MoveMemoryA (int Destination, LOGFONT Source, int Length);
-public static final native void MoveMemory (int Destination, MEASUREITEMSTRUCT Source, int Length);
-public static final native void MoveMemoryW (int Destination, NMTTDISPINFO Source, int Length);
-public static final native void MoveMemoryA (int Destination, NMTTDISPINFO Source, int Length);
-public static final native void MoveMemory (int Destination, RECT Source, int Length);
-public static final native void MoveMemory (int Destination, TRIVERTEX Source, int Length);
-public static final native void MoveMemory (int Destination, WINDOWPOS Source, int Length);
-public static final native void MoveMemory (DRAWITEMSTRUCT Destination, int Source, int Length);
-public static final native void MoveMemory (HDITEM Destination, int Source, int Length);
-public static final native void MoveMemory (HELPINFO Destination, int Source, int Length);
-public static final native void MoveMemoryW (LOGFONT Destination, int Source, int Length);
-public static final native void MoveMemoryA (LOGFONT Destination, int Source, int Length);
-public static final native void MoveMemory (MEASUREITEMSTRUCT Destination, int Source, int Length);
-public static final native void MoveMemory (NMHDR Destination, int Source, int Length);
-public static final native void MoveMemory (NMHEADER Destination, int Source, int Length);
-public static final native void MoveMemory (NMLISTVIEW Destination, int Source, int Length);
-public static final native void MoveMemory (NMTOOLBAR Destination, int Source, int Length);
-public static final native void MoveMemoryW (NMTTDISPINFO Destination, int Source, int Length);
-public static final native void MoveMemoryA (NMTTDISPINFO Destination, int Source, int Length);
-public static final native void MoveMemory (TVITEM Destination, int Source, int Length);
-public static final native void MoveMemory (WINDOWPOS Destination, int Source, int Length);
-public static final native void MoveMemory (MSG Destination, int Source, int Length);
-public static final native void MoveMemory(int Destination, DROPFILES Source, int Length);
-public static final native void MoveMemory(double[] Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(float[] Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(short[] Destination, int SourcePtr, int Length);
-public static final native void MoveMemory(int DestinationPtr, double[] Source, int Length);
-public static final native void MoveMemory(int DestinationPtr, float[] Source, int Length);
-public static final native void MoveMemory(int DestinationPtr, short[] Source, int Length);
-public static final native boolean MoveToEx (int hdc,int x1, int x2, int lPoint);
-public static final native int MultiByteToWideChar (int CodePage, int dwFlags, byte [] lpMultiByteStr, int cchMultiByte, char [] lpWideCharStr, int cchWideChar);
-public static final native int OleInitialize (int pvReserved);
-public static final native void OleUninitialize ();
-public static final native boolean OpenClipboard (int hWndNewOwner);
-public static final native boolean PatBlt (int hdc,int x1, int x2,int w, int h, int rop);
-public static final native boolean PeekMessageW (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);
-public static final native boolean PeekMessageA (MSG lpMsg, int hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);
-public static final native boolean Pie (int hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc);
-public static final native boolean Polygon (int hdc, int [] points, int nPoints);
-public static final native boolean Polyline (int hdc,int[] points, int nPoints);
-public static final native boolean PostMessageW (int hWnd, int Msg, int wParam, int lParam);
-public static final native boolean PostMessageA (int hWnd, int Msg, int wParam, int lParam);
-public static final native boolean PostThreadMessageW (int idThread, int Msg, int wParam, int lParam);
-public static final native boolean PostThreadMessageA (int idThread, int Msg, int wParam, int lParam);
-public static final native boolean PrintDlgW (PRINTDLG lppd);
-public static final native boolean PrintDlgA (PRINTDLG lppd);
-public static final native boolean PtInRect (RECT rect, POINT pt);
-public static final native boolean PtInRegion (int hrgn, int X, int Y);
-public static final native int RealizePalette(int hDC);
-public static final native boolean Rectangle (int hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
-public static final native boolean RectInRegion (int hrgn, RECT lprc);
-public static final native boolean RedrawWindow (int hWnd, RECT lprcUpdate, int hrgnUpdate, int flags);
-public static final native int RegCloseKey (int hKey);
-public static final native int RegisterClassW (WNDCLASS lpWndClass);
-public static final native int RegisterClassA (WNDCLASS lpWndClass);
-public static final native int RegEnumKeyExW (int hKey, int dwIndex, char [] lpName, int [] lpcName, int [] lpReserved, char [] lpClass, int [] lpcClass, FILETIME lpftLastWriteTime);
-public static final native int RegisterClipboardFormatA (byte[] lpszFormat);
-public static final native int RegisterClipboardFormatW (char[] lpszFormat);
-public static final native int RegOpenKeyExW (int hKey, char[] lpSubKey, int ulOptions, int samDesired, int[] phkResult);
-public static final native int RegQueryInfoKeyW (int hKey, int lpClass, int[] lpcbClass, int lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int lpftLastWriteTime);
-public static final native int RegQueryValueExW (int hKey, char[] lpValueName, int lpReserved, int[] lpType, char [] lpData, int[] lpcbData);
-public static final native int RegEnumKeyExA (int hKey, int dwIndex, byte [] lpName, int [] lpcName, int [] lpReserved, byte [] lpClass, int [] lpcClass, FILETIME lpftLastWriteTime);
-public static final native int RegOpenKeyExA (int hKey, byte[] lpSubKey, int ulOptions, int samDesired, int[] phkResult);
-public static final native int RegQueryInfoKeyA (int hKey, int lpClass, int[] lpcbClass, int lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int lpftLastWriteTime);
-public static final native int RegQueryValueExA (int hKey, byte[] lpValueName, int lpReserved, int[] lpType, byte [] lpData, int[] lpcbData);
-public static final native boolean ReleaseCapture ();
-public static final native int ReleaseDC (int hWnd, int hDC);
-public static final native boolean RemoveMenu (int hMenu, int uPosition, int uFlags);
-public static final native boolean RoundRect (int hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidth, int nHeight);
-public static final native boolean ScreenToClient (int hWnd, POINT lpPoint);
-public static final native int ScrollWindowEx (int hWnd, int dx, int dy, RECT prcScroll, RECT prcClip, int hrgnUpdate, RECT prcUpdate, int flags);
-public static final native int SelectClipRgn (int hdc, int hrgn);
-public static final native int SelectObject(int hDC, int HGDIObj);
-public static final native int SelectPalette(int hDC, int hpal, boolean bForceBackground);
-public static final native int SendMessageW (int hWnd, int Msg, int [] wParam, int [] lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int [] wParam, int lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, char [] lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, int [] lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, short [] lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, int lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, LVCOLUMN lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, LVHITTESTINFO lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, LVITEM lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, REBARBANDINFO lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, RECT lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TBBUTTON lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TBBUTTONINFO lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TCITEM lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TOOLINFO lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TVHITTESTINFO lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TVINSERTSTRUCT lParam);
-public static final native int SendMessageW (int hWnd, int Msg, int wParam, TVITEM lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int [] wParam, int [] lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int [] wParam, int lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, byte [] lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, int [] lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, short [] lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, int lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, LVCOLUMN lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, LVHITTESTINFO lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, LVITEM lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, REBARBANDINFO lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, RECT lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TBBUTTON lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TBBUTTONINFO lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TCITEM lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TOOLINFO lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TVHITTESTINFO lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TVINSERTSTRUCT lParam);
-public static final native int SendMessageA (int hWnd, int Msg, int wParam, TVITEM lParam);
-public static final native int SetActiveWindow (int hWnd);
-public static final native int SetBkColor (int hdc, int colorRef);
-public static final native int SetBkMode (int hdc, int mode);
-public static final native int SetCapture (int hWnd);
-public static final native boolean SetCaretPos (int X, int Y);
-public static final native int SetClipboardData (int uFormat, int hMem);
-public static final native int SetCursor (int hCursor);
-public static final native boolean SetCursorPos (int X, int Y);
-public static final native int SetDIBColorTable (int hdc, int uStartIndex, int cEntries, byte[] pColors);
-public static final native int SetFocus (int hWnd);
-public static final native boolean SetForegroundWindow (int hWnd);
-public static final native boolean SetMenu (int hWnd, int hMenu);
-public static final native boolean SetMenuDefaultItem (int hMenu, int uItem, int fByPos);
-public static final native boolean SetMenuInfo (int hmenu, MENUINFO lpcmi);
-public static final native boolean SetMenuItemInfoW (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native boolean SetMenuItemInfoA (int hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii);
-public static final native int SetPaletteEntries (int hPal, int iStart, int cEntries, byte[] lppe);
-public static final native int SetParent (int hWndChild, int hWndNewParent);
-public static final native int SetPixel (int hdc, int X, int Y, int crColor);
-public static final native boolean SetRect(RECT lprc, int xLeft, int yTop, int xRight, int yBottom);
-public static final native boolean SetRectRgn (int hrgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
-public static final native int SetROP2 (int hdc, int fnDrawMode);
-public static final native boolean SetScrollInfo (int hwnd, int flags, SCROLLINFO info, boolean fRedraw);
-public static final native int SetStretchBltMode(int hdc, int iStretchMode);
-public static final native int SetTextAlign(int hdc, int fMode);
-public static final native int SetTextColor (int hdc, int colorRef);
-public static final native int SetTimer (int hWnd, int nIDEvent, int Elapse, int lpTimerFunc);
-public static final native int SetWindowLongW (int hWnd, int nIndex, int dwNewLong);
-public static final native int SetWindowLongA (int hWnd, int nIndex, int dwNewLong);
-public static final native boolean SetWindowPlacement (int hWnd, WINDOWPLACEMENT lpwndpl);
-public static final native boolean SetWindowPos(int hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
-public static final native boolean SetWindowTextW (int hWnd, char [] lpString);
-public static final native boolean SetWindowTextA (int hWnd, byte [] lpString);
-public static final native int SetWindowsHookExW (int idHook, int lpfn, int hMod, int dwThreadId);
-public static final native int SetWindowsHookExA (int idHook, int lpfn, int hMod, int dwThreadId);
-public static final native int SHBrowseForFolderW (BROWSEINFO lpbi);
-public static final native int SHBrowseForFolderA (BROWSEINFO lpbi);
-public static final native boolean SHCreateMenuBar(SHMENUBARINFO pmb);
-public static final native boolean ShellExecuteExW (SHELLEXECUTEINFO lpExecInfo);
-public static final native boolean ShellExecuteExA (SHELLEXECUTEINFO lpExecInfo);
-public static final native int SHGetMalloc (int [] ppMalloc);
-public static final native boolean SHGetPathFromIDListW (int pidl, char [] pszPath);
-public static final native boolean SHGetPathFromIDListA (int pidl, byte [] pszPath);
-public static final native boolean SHSetAppKeyWndAssoc(byte bVk, int hwnd);
-public static final native boolean ShowCaret (int hWnd);
-public static final native boolean ShowOwnedPopups (int hWnd, boolean fShow);
-public static final native boolean ShowScrollBar (int hWnd, int wBar, boolean bShow);
-public static final native boolean ShowWindow (int hWnd, int nCmdShow);
-public static final native int StartDocW (int hdc, DOCINFO lpdi);
-public static final native int StartDocA (int hdc, DOCINFO lpdi);
-public static final native int StartPage (int hdc);
-public static final native boolean StretchBlt (int hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, int hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, int dwRop);
-public static final native boolean SystemParametersInfoW (int uiAction, int uiParam, RECT pvParam, int fWinIni);
-public static final native boolean SystemParametersInfoA (int uiAction, int uiParam, RECT pvParam, int fWinIni);
-public static final native boolean SystemParametersInfoW (int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni);
-public static final native boolean SystemParametersInfoA (int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni);
-public static final native boolean SystemParametersInfoW (int uiAction, int uiParam, int[] pvParam, int fWinIni);
-public static final native boolean SystemParametersInfoA (int uiAction, int uiParam, int[] pvParam, int fWinIni);
-public static final native int ToAscii (int uVirtKey, int uScanCode, byte [] lpKeyState, short [] lpChar, int uFlags);
-public static final native int ToUnicode(int wVirtKey, int wScanCode, byte [] lpKeyState, char [] pwszBuff, int cchBuff, int wFlags);
-public static final native boolean TrackMouseEvent(TRACKMOUSEEVENT lpEventTrack);
-public static final native boolean TrackPopupMenu (int hMenu, int uFlags, int x, int y, int nReserved, int hWnd, RECT prcRect);
-public static final native int TranslateAcceleratorW (int hWnd, int hAccTable, MSG lpMsg);
-public static final native int TranslateAcceleratorA (int hWnd, int hAccTable, MSG lpMsg);
-public static final native boolean TranslateCharsetInfo(int lpSrc, int [] lpCs, int dwFlags);
-public static final native boolean TranslateMessage (MSG lpmsg);
-public static final native boolean UnhookWindowsHookEx(int hhk);
-public static final native boolean UnregisterClassW (char [] lpClassName, int hInstance);
-public static final native boolean UnregisterClassA (byte [] lpClassName, int hInstance);
-public static final native boolean UpdateWindow (int hWnd);
-public static final native boolean ValidateRect (int hWnd, RECT lpRect);
-public static final native short VkKeyScanW (short ch);
-public static final native short VkKeyScanA (short ch);
-public static final native int VtblCall (int ppVtbl, int fnNumber, int arg0);
-public static final native boolean WaitMessage ();
-public static final native int WideCharToMultiByte (int CodePage, int dwFlags, char [] lpWideCharStr, int cchWideChar, byte [] lpMultiByteStr, int cchMultiByte, byte [] lpDefaultChar, boolean [] lpUsedDefaultChar);
-public static final native int WindowFromDC (int lpPoint);
-public static final native int WindowFromPoint (POINT lpPoint);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFO.java
deleted file mode 100644
index 80a6821834..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFO.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class OSVERSIONINFO {
- public int dwOSVersionInfoSize;
- public int dwMajorVersion;
- public int dwMinorVersion;
- public int dwBuildNumber;
- public int dwPlatformId;
-// TCHAR szCSDVersion [128];
-// public char [] szCSDVersion = new char [128];
- public static /*final*/ int sizeof = OS.IsUnicode ? 276 : 148;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java
deleted file mode 100644
index 1113357dc3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class PAINTSTRUCT {
- public int hdc;
- public boolean fErase;
-// public RECT rcPaint;
- public int left, top, right, bottom;
- public boolean fRestore;
- public boolean fIncUpdate;
-// public byte rgbReserved[32];
- public int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7;
- public static final int sizeof = 64;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/POINT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/POINT.java
deleted file mode 100644
index 10e63cb6f0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/POINT.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class POINT {
- public int x;
- public int y;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PRINTDLG.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PRINTDLG.java
deleted file mode 100644
index 2810a59709..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/PRINTDLG.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class PRINTDLG {
- public int lStructSize; // DWORD
- public int hwndOwner; // HWND
- public int hDevMode; // HGLOBAL
- public int hDevNames; // HGLOBAL
- public int hDC; // HDC
- public int Flags; // DWORD
- public short nFromPage; // WORD
- public short nToPage; // WORD
- public short nMinPage; // WORD
- public short nMaxPage; // WORD
- public short nCopies; // WORD
- public int hInstance; // HINSTANCE
- public int lCustData; // LPARAM
- public int lpfnPrintHook; // LPPRINTHOOKPROC
- public int lpfnSetupHook; // LPSETUPHOOKPROC
- public int lpPrintTemplateName; // LPCTSTR
- public int lpSetupTemplateName; // LPCTSTR
- public int hPrintTemplate; // HGLOBAL
- public int hSetupTemplate; // HGLOBAL
- public static final int sizeof = 66;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java
deleted file mode 100644
index 77309f2515..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class REBARBANDINFO {
- public int cbSize;
- public int fMask;
- public int fStyle;
- public int clrFore;
- public int clrBack;
- public int lpText;
- public int cch;
- public int iImage;
- public int hwndChild;
- public int cxMinChild;
- public int cyMinChild;
- public int cx;
- public int hbmBack;
- public int wID;
- public int cyChild;
- public int cyMaxChild;
- public int cyIntegral;
- public int cxIdeal;
- public int lParam;
- public int cxHeader;
- public static final int sizeof = 80;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/RECT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/RECT.java
deleted file mode 100644
index 66ad34282c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/RECT.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class RECT {
- public int left;
- public int top;
- public int right;
- public int bottom;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java
deleted file mode 100644
index bc4872a85a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class SCROLLINFO {
- public int cbSize;
- public int fMask;
- public int nMin;
- public int nMax;
- public int nPage;
- public int nPos;
- public int nTrackPos;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFO.java
deleted file mode 100644
index bfd63aa6e2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class SHELLEXECUTEINFO {
-
- public int cbSize;
- public int fMask;
- public int hwnd;
- public int lpVerb;
- public int lpFile;
- public int lpParameters;
- public int lpDirectory;
- public int nShow;
- public int hInstApp;
-
- // Optional members
- public int lpIDList;
- public int lpClass;
- public int hkeyClass;
- public int dwHotKey;
-// union {
-// HANDLE hIcon;
-// HANDLE hMonitor;
-// };
- public int hIcon;
- public int hProcess;
-
- public static final int sizeof = 60;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHMENUBARINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHMENUBARINFO.java
deleted file mode 100644
index 39c5169885..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHMENUBARINFO.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class SHMENUBARINFO {
- public int cbSize;
- public int hwndParent;
- public int dwFlags;
- public int nToolBarId;
- public int hInstRes;
- public int nBmpId;
- public int cBmpImages;
- public int hwndMB;
- public static final int sizeof = 32;
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SIZE.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SIZE.java
deleted file mode 100644
index f76a162e49..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SIZE.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class SIZE {
- public int cx;
- public int cy;
- public static final int sizeof = 8;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTON.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTON.java
deleted file mode 100644
index 8f2b88db63..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTON.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TBBUTTON {
- public int iBitmap;
- public int idCommand;
- public byte fsState;
- public byte fsStyle;
- public int dwData;
- public int iString;
- public static final int sizeof = 20;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java
deleted file mode 100644
index 4cb8d1b329..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TBBUTTONINFO {
- public int cbSize;
- public int dwMask;
- public int idCommand;
- public int iImage;
- public byte fsState;
- public byte fsStyle;
- public short cx;
- public int lParam;
- public int pszText;
- public int cchText;
- public static final int sizeof = 32;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCHAR.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCHAR.java
deleted file mode 100644
index 6d1193929b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCHAR.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- */
-
-public class TCHAR {
-
-int codePage;
-char [] chars;
-byte [] bytes;
-int byteCount;
-
-public final static int sizeof = OS.IsUnicode ? 2 : 1;
-
-public TCHAR (int codePage, int length) {
- this.codePage = codePage;
- if (OS.IsUnicode) {
- chars = new char [length];
- } else {
- bytes = new byte [byteCount = length];
- }
-}
-
-public TCHAR (int codePage, char ch, boolean terminate) {
- this (codePage, String.valueOf (ch), terminate);
-}
-
-public TCHAR (int codePage, String string, boolean terminate) {
- this.codePage = codePage;
- int charCount = string.length ();
- char [] chars = new char [charCount + (terminate ? 1 : 0)];
- string.getChars (0, charCount, chars, 0);
- if (OS.IsUnicode) {
- this.chars = chars;
- } else {
- int cp = codePage != 0 ? codePage : OS.CP_ACP;
- bytes = new byte [byteCount = charCount * 2 + (terminate ? 1 : 0)];
- byteCount = OS.WideCharToMultiByte (cp, 0, chars, charCount, bytes, byteCount, null, null);
- if (terminate) byteCount++;
- }
-}
-
-public int length () {
- if (OS.IsUnicode) {
- return chars.length;
- } else {
- return byteCount;
- }
-}
-
-public int strlen () {
- if (OS.IsUnicode) {
- for (int i=0; i<chars.length; i++) {
- if (chars [i] == '\0') return i;
- }
- return chars.length;
- } else {
- for (int i=0; i<byteCount; i++) {
- if (bytes [i] == '\0') return i;
- }
- return byteCount;
- }
-}
-
-public int tcharAt (int index) {
- if (OS.IsUnicode) {
- return chars [index];
- } else {
- int ch = bytes [index] & 0xFF;
- if (OS.IsDBCSLeadByte ((byte) ch)) {
- ch = ch << 8 | (bytes [index + 1] & 0xFF);
- }
- return ch;
- }
-}
-
-public String toString () {
- return toString (0, length ());
-}
-
-public String toString (int start, int length) {
- if (OS.IsUnicode) {
- return new String (chars, start, length);
- } else {
- byte [] bytes = this.bytes;
- if (start != 0) {
- bytes = new byte [length];
- System.arraycopy (this.bytes, start, bytes, 0, length);
- }
- char [] chars = new char [length];
- int cp = codePage != 0 ? codePage : OS.CP_ACP;
- int charCount = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, bytes, length, chars, length);
- return new String (chars, 0, charCount);
- }
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCITEM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCITEM.java
deleted file mode 100644
index e8eba369bb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TCITEM.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TCITEM {
- public int mask;
- public int dwState;
- public int dwStateMask;
- public int pszText;
- public int cchTextMax;
- public int iImage;
- public int lParam;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java
deleted file mode 100644
index 8b348232b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TEXTMETRIC {
- public int tmHeight;
- public int tmAscent;
- public int tmDescent;
- public int tmInternalLeading;
- public int tmExternalLeading;
- public int tmAveCharWidth;
- public int tmMaxCharWidth;
- public int tmWeight;
- public int tmOverhang;
- public int tmDigitizedAspectX;
- public int tmDigitizedAspectY;
-// TCHAR tmFirstChar;
-// TCHAR tmLastChar;
-// TCHAR tmDefaultChar;
-// TCHAR tmBreakChar;
-// public char tmFirstChar;
-// public char tmLastChar;
-// public char tmDefaultChar;
-// public char tmBreakChar;
- public byte tmItalic;
- public byte tmUnderlined;
- public byte tmStruckOut;
- public byte tmPitchAndFamily;
- public byte tmCharSet;
- public static final int sizeof = OS.IsUnicode ? 60 : 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TOOLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TOOLINFO.java
deleted file mode 100644
index 19b7e2c7c5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TOOLINFO.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TOOLINFO {
- public int cbSize;
- public int uFlags;
- public int hwnd;
- public int uId;
-// public RECT rect;
- public int left, top, right, bottom;
- public int hinst;
- public int lpszText;
- public int lParam;
- public static int sizeof = 44;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java
deleted file mode 100644
index 47c09dba4f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class TRACKMOUSEEVENT {
- public int cbSize;
- public int dwFlags;
- public int hwndTrack;
- public int dwHoverTime;
- public static final int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRIVERTEX.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRIVERTEX.java
deleted file mode 100644
index 40301af947..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TRIVERTEX.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TRIVERTEX {
- public int x;
- public int y;
- public short Red;
- public short Green;
- public short Blue;
- public short Alpha;
- public static final int sizeof = 16;
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java
deleted file mode 100644
index c987ce7fd3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TVHITTESTINFO {
-// POINT pt;
- public int x;
- public int y;
- public int flags;
- public int hItem;
- public static int sizeof = 16;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java
deleted file mode 100644
index 8e104640de..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TVINSERTSTRUCT {
- public int hParent;
- public int hInsertAfter;
-// public TVITEM item;
- public int mask;
- public int hItem;
- public int state;
- public int stateMask;
- public int pszText;
- public int cchTextMax;
- public int iImage;
- public int iSelectedImage;
- public int cChildren;
- public int lParam;
- public static final int sizeof = 48;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVITEM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVITEM.java
deleted file mode 100644
index 32090afd86..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/TVITEM.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class TVITEM {
- public int mask;
- public int hItem;
- public int state;
- public int stateMask;
- public int pszText;
- public int cchTextMax;
- public int iImage;
- public int iSelectedImage;
- public int cChildren;
- public int lParam;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java
deleted file mode 100644
index 964fefc305..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class WINDOWPLACEMENT {
- public int length;
- public int flags;
- public int showCmd;
-// POINT ptMinPosition;
- public int ptMinPosition_x;
- public int ptMinPosition_y;
-// POINT ptMaxPosition;
- public int ptMaxPosition_x;
- public int ptMaxPosition_y;
-// RECT rcNormalPosition;
- public int left;
- public int top;
- public int right;
- public int bottom;
- public static final int sizeof = 44;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java
deleted file mode 100644
index 35c8b78d69..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class WINDOWPOS {
- public int hwnd;
- public int hwndInsertAfter;
- public int x;
- public int y;
- public int cx;
- public int cy;
- public int flags;
- public static final int sizeof = 28;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WNDCLASS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WNDCLASS.java
deleted file mode 100644
index d78bcc2a32..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/WNDCLASS.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.swt.internal.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-public class WNDCLASS {
- public int style;
- public int lpfnWndProc;
- public int cbClsExtra;
- public int cbWndExtra;
- public int hInstance;
- public int hIcon;
- public int hCursor;
- public int hbrBackground;
- public int lpszMenuName;
- public int lpszClassName;
- public static final int sizeof = 40;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/package.html
deleted file mode 100644
index 049087bd3e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT internal Win32 implementation classes.
-<h2>
-Package Specification</h2>
-This package contains the classes which represent the Microsoft
-Win32 platform interface that the win32 variant of SWT is built
-from.
-<p>
-Referencing any of the classes in this package directly guarantees
-that the code is platform specific. Applications should not need to
-reference the classes in this package directly.
-</p>
-
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java
deleted file mode 100755
index 87b953254e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are descriptions of a print job
- * in terms of the printer, and the scope and type of printing
- * that is desired. For example, the number of pages and copies
- * can be specified, as well as whether or not the print job
- * should go to a file.
- * <p>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- * </p>
- *
- * @see Printer
- * @see Printer#getPrinterList
- * @see PrintDialog#open
- */
-
-public final class PrinterData extends DeviceData {
-
- /**
- * the printer driver
- * On Windows systems, this is the name of the driver (often "winspool").
- * On X/Window systems, this is the name of a display connection to the
- * Xprt server (the default is ":1").
- */
- public String driver;
-
- /**
- * the name of the printer
- * On Windows systems, this is the name of the 'device'.
- * On X/Window systems, this is the printer's 'name'.
- */
- public String name;
-
- /**
- * the scope of the print job, expressed as one of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- */
- public int scope = ALL_PAGES;
-
- /**
- * the start page of a page range, used when scope is PAGE_RANGE
- */
- public int startPage = 0;
-
- /**
- * the end page of a page range, used when scope is PAGE_RANGE
- */
- public int endPage = 0;
-
- /**
- * whether or not the print job should go to a file
- */
- public boolean printToFile = false;
-
- /**
- * the name of the file to print to if printToFile is true.
- * Note that this field is ignored if printToFile is false.
- */
- public String fileName;
-
- /**
- * the number of copies to print.
- * Note that this field may be controlled by the printer driver
- * In other words, the printer itself may be capable of printing
- * multiple copies, and if so, the value of this field will always be 1.
- */
- public int copyCount = 1;
-
- /**
- * whether or not the printer should collate the printed paper
- * Note that this field may be controlled by the printer driver.
- * In other words, the printer itself may be capable of doing the
- * collation, and if so, the value of this field will always be false.
- */
- public boolean collate = false;
-
- /**
- * <code>scope</code> field value indicating that
- * all pages should be printed
- */
- public static final int ALL_PAGES = 0;
-
- /**
- * <code>scope</code> field value indicating that
- * the range of pages specified by startPage and endPage
- * should be printed
- */
- public static final int PAGE_RANGE = 1;
-
- /**
- * <code>scope</code> field value indicating that
- * the current selection should be printed
- */
- public static final int SELECTION = 2;
-
- /**
- * private, platform-specific data
- * On Windows, this contains a copy of the DEVMODE struct
- * returned from the <code>PrintDialog</code>.
- * This field is not currently used on the X/Window System.
- */
- byte [] otherData;
-
- /**
- * Constructs an instance of this class that can be
- * used to print to the default printer.
- *
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the default printer data</li>
- * </ul>
- */
- public PrinterData() {
- PrinterData data = Printer.getDefaultPrinterData();
- this.driver = data.driver;
- this.name = data.name;
- }
-
- /**
- * Constructs an instance of this class with the given
- * printer driver and printer name.
- *
- * @param driver the printer driver for the printer
- * @param name the name of the printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #driver
- * @see #name
- */
- public PrinterData(String driver, String name) {
- this.driver = driver;
- this.name = name;
- }
-
- /**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
- public String toString() {
- return "PrinterData {" + "driver = " + driver + ", name = " + name + "}";
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/package.html b/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/package.html
deleted file mode 100755
index 8504b5e5a5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Printing support classes.
-<h2>
-Package Specification</h2>
-This package contains the classes which provide printing support for SWT.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java
deleted file mode 100644
index fb049da49a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class allow the user to select
- * a printer and various print-related parameters
- * prior to starting a print job.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class PrintDialog extends Dialog {
- int scope = PrinterData.ALL_PAGES;
- int startPage = -1, endPage = -1;
- boolean printToFile = false;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return a printer data object describing the desired print job parameters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public PrinterData open() {
- /* Return the first printer in the list */
- PrinterData[] printers = Printer.getPrinterList();
- if (printers.length > 0) return printers[0];
- return null;
-}
-/**
- * Returns the print job scope that the user selected
- * before pressing OK in the dialog. This will be one
- * of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @return the scope setting that the user selected
- */
-public int getScope() {
- return scope;
-}
-/**
- * Sets the scope of the print job. The user will see this
- * setting when the dialog is opened. This can have one of
- * the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @param int the scope setting when the dialog is opened
- */
-public void setScope(int scope) {
- this.scope = scope;
-}
-/**
- * Returns the start page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the start page setting that the user selected
- */
-public int getStartPage() {
- return startPage;
-}
-/**
- * Sets the start page that the user will see when the dialog
- * is opened.
- *
- * @param int the startPage setting when the dialog is opened
- */
-public void setStartPage(int startPage) {
- this.startPage = startPage;
-}
-/**
- * Returns the end page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the end page setting that the user selected
- */
-public int getEndPage() {
- return endPage;
-}
-/**
- * Sets the end page that the user will see when the dialog
- * is opened.
- *
- * @param int the end page setting when the dialog is opened
- */
-public void setEndPage(int endPage) {
- this.endPage = endPage;
-}
-/**
- * Returns the 'Print to file' setting that the user selected
- * before pressing OK in the dialog.
- *
- * @return the 'Print to file' setting that the user selected
- */
-public boolean getPrintToFile() {
- return printToFile;
-}
-/**
- * Sets the 'Print to file' setting that the user will see
- * when the dialog is opened.
- *
- * @param boolean the 'Print to file' setting when the dialog is opened
- */
-public void setPrintToFile(boolean printToFile) {
- this.printToFile = printToFile;
-}
-protected void checkSubclass() {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java
deleted file mode 100644
index e203c1a679..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class are used to print to a printer.
- * Applications create a GC on a printer using <code>new GC(printer)</code>
- * and then draw on the printer GC using the usual graphics calls.
- * <p>
- * A <code>Printer</code> object may be constructed by providing
- * a <code>PrinterData</code> object which identifies the printer.
- * A <code>PrintDialog</code> presents a print dialog to the user
- * and returns an initialized instance of <code>PrinterData</code>.
- * Alternatively, calling <code>new Printer()</code> will construct a
- * printer object for the user's default printer.
- * </p><p>
- * Application code must explicitly invoke the <code>Printer.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see PrinterData
- * @see PrintDialog
- */
-public final class Printer extends Device {
- PrinterData data;
- int printContext, xScreen, xDrawable;
- int defaultFontList;
-
-/**
- * Returns an array of <code>PrinterData</code> objects
- * representing all available printers.
- *
- * @return the list of available printers
- */
-public static PrinterData[] getPrinterList() {
- PrinterData printerList[] = new PrinterData[0];
- return printerList;
-}
-
-static PrinterData getDefaultPrinterData() {
- /* Use the first printer in the list as the default */
- PrinterData[] list = getPrinterList();
- if (list.length == 0) {
- /* no printers */
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- return list[0];
-}
-
-/**
- * Constructs a new printer representing the default printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer() {
- this(getDefaultPrinterData());
-}
-
-/**
- * Constructs a new printer given a <code>PrinterData</code>
- * object representing the desired printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @param data the printer data for the specified printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer(PrinterData data) {
- super(data);
-}
-
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC(GCData data) {
- return 0;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC(int xGC, GCData data) {
-}
-
-/**
- * Starts a print job and returns true if the job started successfully
- * and false otherwise.
- * <p>
- * This must be the first method called to initiate a print job,
- * followed by any number of startPage/endPage calls, followed by
- * endJob. Calling startPage, endPage, or endJob before startJob
- * will result in undefined behavior.
- * </p>
- *
- * @return true if the job started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #endPage
- * @see #endJob
- */
-public boolean startJob(String jobName) {
- return true;
-}
-
-/**
- * Ends the current print job.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startJob
- * @see #startPage
- * @see #endPage
- */
-public void endJob() {
-}
-
-/**
- * Cancels a print job in progress.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void cancelJob() {
-}
-
-/**
- * Starts a page and returns true if the page started successfully
- * and false otherwise.
- * <p>
- * After calling startJob, this method may be called any number of times
- * along with a matching endPage.
- * </p>
- *
- * @return true if the page started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #endPage
- * @see #startJob
- * @see #endJob
- */
-public boolean startPage() {
- return true;
-}
-
-/**
- * Ends the current page.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #startJob
- * @see #endJob
- */
-public void endPage() {
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the printer, and whose y coordinate
- * is the vertical dots per inch of the printer.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI() {
- return new Point(0, 0);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- * For a printer, this is the size of a page, in pixels.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getClientArea
- * @see #computeTrim
- */
-public Rectangle getBounds() {
- return null;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- * For a printer, this is the size of the printable area
- * of a page, in pixels.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #computeTrim
- */
-public Rectangle getClientArea() {
- return null;
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- * Note that there is no setBounds for a printer. This method
- * is usually used by passing in the client area (the 'printable
- * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #getClientArea
- */
-public Rectangle computeTrim(int x, int y, int width, int height) {
- return new Rectangle(0,0,0,0);
-}
-
-/**
- * Returns a <code>PrinterData</code> object representing the
- * target printer for this print job.
- *
- * @return a PrinterData object describing the receiver
- */
-public PrinterData getPrinterData() {
- return data;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java
deleted file mode 100644
index fb049da49a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class allow the user to select
- * a printer and various print-related parameters
- * prior to starting a print job.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class PrintDialog extends Dialog {
- int scope = PrinterData.ALL_PAGES;
- int startPage = -1, endPage = -1;
- boolean printToFile = false;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return a printer data object describing the desired print job parameters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public PrinterData open() {
- /* Return the first printer in the list */
- PrinterData[] printers = Printer.getPrinterList();
- if (printers.length > 0) return printers[0];
- return null;
-}
-/**
- * Returns the print job scope that the user selected
- * before pressing OK in the dialog. This will be one
- * of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @return the scope setting that the user selected
- */
-public int getScope() {
- return scope;
-}
-/**
- * Sets the scope of the print job. The user will see this
- * setting when the dialog is opened. This can have one of
- * the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @param int the scope setting when the dialog is opened
- */
-public void setScope(int scope) {
- this.scope = scope;
-}
-/**
- * Returns the start page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the start page setting that the user selected
- */
-public int getStartPage() {
- return startPage;
-}
-/**
- * Sets the start page that the user will see when the dialog
- * is opened.
- *
- * @param int the startPage setting when the dialog is opened
- */
-public void setStartPage(int startPage) {
- this.startPage = startPage;
-}
-/**
- * Returns the end page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the end page setting that the user selected
- */
-public int getEndPage() {
- return endPage;
-}
-/**
- * Sets the end page that the user will see when the dialog
- * is opened.
- *
- * @param int the end page setting when the dialog is opened
- */
-public void setEndPage(int endPage) {
- this.endPage = endPage;
-}
-/**
- * Returns the 'Print to file' setting that the user selected
- * before pressing OK in the dialog.
- *
- * @return the 'Print to file' setting that the user selected
- */
-public boolean getPrintToFile() {
- return printToFile;
-}
-/**
- * Sets the 'Print to file' setting that the user will see
- * when the dialog is opened.
- *
- * @param boolean the 'Print to file' setting when the dialog is opened
- */
-public void setPrintToFile(boolean printToFile) {
- this.printToFile = printToFile;
-}
-protected void checkSubclass() {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java
deleted file mode 100644
index e203c1a679..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class are used to print to a printer.
- * Applications create a GC on a printer using <code>new GC(printer)</code>
- * and then draw on the printer GC using the usual graphics calls.
- * <p>
- * A <code>Printer</code> object may be constructed by providing
- * a <code>PrinterData</code> object which identifies the printer.
- * A <code>PrintDialog</code> presents a print dialog to the user
- * and returns an initialized instance of <code>PrinterData</code>.
- * Alternatively, calling <code>new Printer()</code> will construct a
- * printer object for the user's default printer.
- * </p><p>
- * Application code must explicitly invoke the <code>Printer.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see PrinterData
- * @see PrintDialog
- */
-public final class Printer extends Device {
- PrinterData data;
- int printContext, xScreen, xDrawable;
- int defaultFontList;
-
-/**
- * Returns an array of <code>PrinterData</code> objects
- * representing all available printers.
- *
- * @return the list of available printers
- */
-public static PrinterData[] getPrinterList() {
- PrinterData printerList[] = new PrinterData[0];
- return printerList;
-}
-
-static PrinterData getDefaultPrinterData() {
- /* Use the first printer in the list as the default */
- PrinterData[] list = getPrinterList();
- if (list.length == 0) {
- /* no printers */
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- return list[0];
-}
-
-/**
- * Constructs a new printer representing the default printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer() {
- this(getDefaultPrinterData());
-}
-
-/**
- * Constructs a new printer given a <code>PrinterData</code>
- * object representing the desired printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @param data the printer data for the specified printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer(PrinterData data) {
- super(data);
-}
-
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC(GCData data) {
- return 0;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC(int xGC, GCData data) {
-}
-
-/**
- * Starts a print job and returns true if the job started successfully
- * and false otherwise.
- * <p>
- * This must be the first method called to initiate a print job,
- * followed by any number of startPage/endPage calls, followed by
- * endJob. Calling startPage, endPage, or endJob before startJob
- * will result in undefined behavior.
- * </p>
- *
- * @return true if the job started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #endPage
- * @see #endJob
- */
-public boolean startJob(String jobName) {
- return true;
-}
-
-/**
- * Ends the current print job.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startJob
- * @see #startPage
- * @see #endPage
- */
-public void endJob() {
-}
-
-/**
- * Cancels a print job in progress.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void cancelJob() {
-}
-
-/**
- * Starts a page and returns true if the page started successfully
- * and false otherwise.
- * <p>
- * After calling startJob, this method may be called any number of times
- * along with a matching endPage.
- * </p>
- *
- * @return true if the page started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #endPage
- * @see #startJob
- * @see #endJob
- */
-public boolean startPage() {
- return true;
-}
-
-/**
- * Ends the current page.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #startJob
- * @see #endJob
- */
-public void endPage() {
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the printer, and whose y coordinate
- * is the vertical dots per inch of the printer.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI() {
- return new Point(0, 0);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- * For a printer, this is the size of a page, in pixels.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getClientArea
- * @see #computeTrim
- */
-public Rectangle getBounds() {
- return null;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- * For a printer, this is the size of the printable area
- * of a page, in pixels.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #computeTrim
- */
-public Rectangle getClientArea() {
- return null;
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- * Note that there is no setBounds for a printer. This method
- * is usually used by passing in the client area (the 'printable
- * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #getClientArea
- */
-public Rectangle computeTrim(int x, int y, int width, int height) {
- return new Rectangle(0,0,0,0);
-}
-
-/**
- * Returns a <code>PrinterData</code> object representing the
- * target printer for this print job.
- *
- * @return a PrinterData object describing the receiver
- */
-public PrinterData getPrinterData() {
- return data;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/PrintDialog.java
deleted file mode 100755
index 3c1d7d7d02..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/PrintDialog.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- * Instances of this class allow the user to select
- * a printer and various print-related parameters
- * prior to starting a print job.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class PrintDialog extends Dialog {
- int scope = PrinterData.ALL_PAGES;
- int startPage = -1, endPage = -1;
- boolean printToFile = false;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return a printer data object describing the desired print job parameters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public PrinterData open() {
- /* Return the first printer in the list */
- PrinterData[] printers = Printer.getPrinterList();
- if (printers.length > 0) return printers[0];
- return null;
-}
-/**
- * Returns the print job scope that the user selected
- * before pressing OK in the dialog. This will be one
- * of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @return the scope setting that the user selected
- */
-public int getScope() {
- return scope;
-}
-/**
- * Sets the scope of the print job. The user will see this
- * setting when the dialog is opened. This can have one of
- * the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @param int the scope setting when the dialog is opened
- */
-public void setScope(int scope) {
- this.scope = scope;
-}
-/**
- * Returns the start page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the start page setting that the user selected
- */
-public int getStartPage() {
- return startPage;
-}
-/**
- * Sets the start page that the user will see when the dialog
- * is opened.
- *
- * @param int the startPage setting when the dialog is opened
- */
-public void setStartPage(int startPage) {
- this.startPage = startPage;
-}
-/**
- * Returns the end page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the end page setting that the user selected
- */
-public int getEndPage() {
- return endPage;
-}
-/**
- * Sets the end page that the user will see when the dialog
- * is opened.
- *
- * @param int the end page setting when the dialog is opened
- */
-public void setEndPage(int endPage) {
- this.endPage = endPage;
-}
-/**
- * Returns the 'Print to file' setting that the user selected
- * before pressing OK in the dialog.
- *
- * @return the 'Print to file' setting that the user selected
- */
-public boolean getPrintToFile() {
- return printToFile;
-}
-/**
- * Sets the 'Print to file' setting that the user will see
- * when the dialog is opened.
- *
- * @param boolean the 'Print to file' setting when the dialog is opened
- */
-public void setPrintToFile(boolean printToFile) {
- this.printToFile = printToFile;
-}
-protected void checkSubclass() {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java
deleted file mode 100755
index c1f4e3f1b8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java
+++ /dev/null
@@ -1,550 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- * Instances of this class are used to print to a printer.
- * Applications create a GC on a printer using <code>new GC(printer)</code>
- * and then draw on the printer GC using the usual graphics calls.
- * <p>
- * A <code>Printer</code> object may be constructed by providing
- * a <code>PrinterData</code> object which identifies the printer.
- * A <code>PrintDialog</code> presents a print dialog to the user
- * and returns an initialized instance of <code>PrinterData</code>.
- * Alternatively, calling <code>new Printer()</code> will construct a
- * printer object for the user's default printer.
- * </p><p>
- * Application code must explicitly invoke the <code>Printer.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see PrinterData
- * @see PrintDialog
- */
-public final class Printer extends Device {
- PrinterData data;
- int printContext, xScreen, xDrawable, xtContext;
- int defaultFontList;
-
- static String APP_NAME = "SWT_Printer";
-
- public static String XDefaultPrintServer = ":1";
-// static {
-// /* Read the default print server name from
-// * the XPRINTER environment variable.
-// */
-// XDefaultPrintServer = ":1";
-// }
-/**
- * Returns an array of <code>PrinterData</code> objects
- * representing all available printers.
- *
- * @return the list of available printers
- */
-public static PrinterData[] getPrinterList() {
- /* Connect to the default X print server */
- byte [] buffer = Converter.wcsToMbcs(null, XDefaultPrintServer, true);
- int xtContext = OS.XtCreateApplicationContext ();
- int pdpy = OS.XtOpenDisplay (xtContext, buffer, null, null, 0, 0, new int [] {0}, 0);
- if (pdpy == 0) {
- /* no print server */
- return new PrinterData[0];
- }
-
- /* Get the list of printers */
- int [] listCount = new int[1];
- int plist = OS.XpGetPrinterList(pdpy, null, listCount);
- int printerCount = listCount[0];
- if (plist == 0 || printerCount == 0) {
- /* no printers */
- //OS.XCloseDisplay(pdpy);
- return new PrinterData[0];
- }
-
- /* Copy the printer names into PrinterData objects */
- int [] stringPointers = new int [printerCount * 2];
- OS.memmove(stringPointers, plist, printerCount * 2 * 4);
- PrinterData printerList[] = new PrinterData[printerCount];
- for (int i = 0; i < printerCount; i++) {
- String name = "";
- int address = stringPointers[i * 2];
- if (address != 0) {
- int length = OS.strlen(address);
- buffer = new byte [length];
- OS.memmove(buffer, address, length);
- /* Use the character encoding for the default locale */
- name = new String(Converter.mbcsToWcs(null, buffer));
- }
- printerList[i] = new PrinterData(XDefaultPrintServer, name);
- }
- OS.XpFreePrinterList(plist);
- OS.XtDestroyApplicationContext (xtContext);
- return printerList;
-}
-
-/*
- * Returns a <code>PrinterData</code> object representing
- * the default printer.
- *
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the default printer data</li>
- * </ul>
- *
- * @return the default printer data
- */
-static PrinterData getDefaultPrinterData() {
- /* Use the first printer in the list as the default */
- PrinterData[] list = getPrinterList();
- if (list.length == 0) {
- /* no printers */
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- return list[0];
-}
-
-/**
- * Constructs a new printer representing the default printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer() {
- this(getDefaultPrinterData());
-}
-
-/**
- * Constructs a new printer given a <code>PrinterData</code>
- * object representing the desired printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @param data the printer data for the specified printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer(PrinterData data) {
- super(data);
-}
-
-protected void create(DeviceData deviceData) {
- data = (PrinterData)deviceData;
-
- /* Open the display for the X print server */
- String display_name = null;
- String application_name = APP_NAME;
- String application_class = APP_NAME;
- if (data != null) {
-// if (data.display_name != null) display_name = data.display_name;
- if (data.driver != null) display_name = data.driver;
- if (data.application_name != null) application_name = data.application_name;
- if (data.application_class != null) application_class = data.application_class;
- }
- /* Use the character encoding for the default locale */
- byte [] displayName = null, appName = null, appClass = null;
- if (display_name != null) displayName = Converter.wcsToMbcs (null, display_name, true);
- if (application_name != null) appName = Converter.wcsToMbcs (null, application_name, true);
- if (application_class != null) appClass = Converter.wcsToMbcs (null, application_class, true);
-
- xtContext = OS.XtCreateApplicationContext ();
- xDisplay = OS.XtOpenDisplay (xtContext, displayName, appName, appClass, 0, 0, new int [] {0}, 0);
- if (xDisplay == 0) {
- /* no print server */
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
-}
-
-protected void init() {
- super.init();
-
- /* Create the printContext for the printer */
- /* Use the character encoding for the default locale */
- byte[] name = Converter.wcsToMbcs(null, data.name, true);
- printContext = OS.XpCreateContext(xDisplay, name);
- if (printContext == OS.None) {
- /* can't create print context */
- //OS.XCloseDisplay(xDisplay);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
-
- /* Set the printContext into the display */
- OS.XpSetContext(xDisplay, printContext);
-
- /* Get the printer's screen */
- xScreen = OS.XpGetScreenOfContext(xDisplay, printContext);
-
- /* Initialize Motif */
- int widgetClass = OS.TopLevelShellWidgetClass();
- int shellHandle = OS.XtAppCreateShell(null, null, widgetClass, xDisplay, null, 0);
- OS.XtDestroyWidget(shellHandle);
-
- /* Initialize the default font */
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs(null, "-*-courier-medium-r-*-*-*-120-*-*-*-*-*-*", true);
- int fontListEntry = OS.XmFontListEntryLoad(xDisplay, buffer, OS.XmFONT_IS_FONTSET, OS.XmFONTLIST_DEFAULT_TAG);
- if (fontListEntry == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- defaultFontList = OS.XmFontListAppendEntry(0, fontListEntry);
- OS.XmFontListEntryFree(new int[]{fontListEntry});
-}
-
-protected void destroy() {
- if (xtContext != 0) OS.XtDestroyApplicationContext (xtContext);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC(GCData data) {
- if (xDrawable == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int xGC = OS.XCreateGC(xDisplay, xDrawable, 0, null);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (data != null) {
- data.device = this;
- data.display = xDisplay;
- data.drawable = xDrawable; // not valid until after startJob
- data.fontList = defaultFontList;
- data.colormap = OS.XDefaultColormapOfScreen(xScreen);
- }
- return xGC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC(int xGC, GCData data) {
- OS.XFreeGC(xDisplay, xGC);
-}
-
-/**
- * Starts a print job and returns true if the job started successfully
- * and false otherwise.
- * <p>
- * This must be the first method called to initiate a print job,
- * followed by any number of startPage/endPage calls, followed by
- * endJob. Calling startPage, endPage, or endJob before startJob
- * will result in undefined behavior.
- * </p>
- *
- * @return true if the job started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #endPage
- * @see #endJob
- */
-public boolean startJob(String jobName) {
- checkDevice();
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs(null, "*job-name: " + jobName, true);
- OS.XpSetAttributes(xDisplay, printContext, OS.XPJobAttr, buffer, OS.XPAttrMerge);
- OS.XpStartJob(xDisplay, OS.XPSpool);
-
- /* Create the xDrawable */
- XRectangle rect = new XRectangle();
- short [] width = new short [1];
- short [] height = new short [1];
- OS.XpGetPageDimensions(xDisplay, printContext, width, height, rect);
- xDrawable = OS.XCreateWindow(xDisplay, OS.XRootWindowOfScreen(xScreen),
- 0, 0, rect.width, rect.height, 0,
- OS.CopyFromParent, OS.CopyFromParent, OS.CopyFromParent, 0, 0);
- return true;
-}
-
-/**
- * Ends the current print job.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startJob
- * @see #startPage
- * @see #endPage
- */
-public void endJob() {
- checkDevice();
- OS.XpEndJob(xDisplay);
- OS.XFlush(xDisplay);
-}
-
-/**
- * Cancels a print job in progress.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void cancelJob() {
- checkDevice();
- OS.XpCancelJob(xDisplay, true);
-}
-
-/**
- * Starts a page and returns true if the page started successfully
- * and false otherwise.
- * <p>
- * After calling startJob, this method may be called any number of times
- * along with a matching endPage.
- * </p>
- *
- * @return true if the page started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #endPage
- * @see #startJob
- * @see #endJob
- */
-public boolean startPage() {
- checkDevice();
- OS.XpStartPage(xDisplay, xDrawable);
- return true;
-}
-
-/**
- * Ends the current page.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #startJob
- * @see #endJob
- */
-public void endPage() {
- checkDevice();
- OS.XpEndPage(xDisplay);
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the printer, and whose y coordinate
- * is the vertical dots per inch of the printer.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI() {
- checkDevice();
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs(null, "default-printer-resolution", true);
- int pool = OS.XpGetOneAttribute(xDisplay, printContext, OS.XPDocAttr, buffer);
- int length = OS.strlen(pool);
- buffer = new byte[length];
- OS.memmove(buffer, pool, length);
- OS.XtFree(pool);
- String resolution = new String(buffer, 0, buffer.length);
- int res = 300; // default
- if (resolution.length() == 0) {
- /* If we can't get the info from the DocAttrs, ask the printer. */
- /* Use the character encoding for the default locale */
- buffer = Converter.wcsToMbcs(null, "printer-resolutions-supported", true);
- pool = OS.XpGetOneAttribute(xDisplay, printContext, OS.XPPrinterAttr, buffer);
- length = OS.strlen(pool);
- buffer = new byte[length];
- OS.memmove(buffer, pool, length);
- OS.XtFree(pool);
- int n = 0;
- while (!Compatibility.isWhitespace((char)buffer[n]) && n < buffer.length) n++;
- resolution = new String(buffer, 0, n);
- }
- if (resolution.length() != 0) {
- try {
- res = Integer.parseInt(resolution);
- } catch (NumberFormatException ex) {}
- }
- return new Point(res, res);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- * For a printer, this is the size of a page, in pixels.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getClientArea
- * @see #computeTrim
- */
-public Rectangle getBounds() {
- checkDevice();
- XRectangle rect = new XRectangle();
- short [] width = new short [1];
- short [] height = new short [1];
- OS.XpGetPageDimensions(xDisplay, printContext, width, height, rect);
- return new Rectangle(0, 0, width[0], height[0]);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- * For a printer, this is the size of the printable area
- * of a page, in pixels.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #computeTrim
- */
-public Rectangle getClientArea() {
- checkDevice();
- XRectangle rect = new XRectangle();
- OS.XpGetPageDimensions(xDisplay, printContext, new short [1], new short [1], rect);
- return new Rectangle(0, 0, rect.width, rect.height);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- * Note that there is no setBounds for a printer. This method
- * is usually used by passing in the client area (the 'printable
- * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #getClientArea
- */
-public Rectangle computeTrim(int x, int y, int width, int height) {
- checkDevice();
- XRectangle rect = new XRectangle();
- short [] paperWidth = new short [1];
- short [] paperHeight = new short [1];
- OS.XpGetPageDimensions(xDisplay, printContext, paperWidth, paperHeight, rect);
- int hTrim = paperWidth[0] - rect.width;
- int vTrim = paperHeight[0] - rect.height;
- return new Rectangle(x - rect.x, y - rect.y, width + hTrim, height + vTrim);
-}
-
-/**
- * Returns a <code>PrinterData</code> object representing the
- * target printer for this print job.
- *
- * @return a PrinterData object describing the receiver
- */
-public PrinterData getPrinterData() {
- return data;
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return Font.motif_new (this, defaultFontList);
-}
-
-protected void checkDevice() {
- if (xDisplay == 0) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-protected void release() {
- super.release();
- if (defaultFontList != 0) {
- OS.XmFontListFree(defaultFontList);
- defaultFontList = 0;
- }
- if (printContext != 0) {
- OS.XpDestroyContext(xDisplay, printContext);
- printContext = 0;
- }
- if (xDrawable != 0) {
- OS.XDestroyWindow(xDisplay, xDrawable);
- xDrawable = 0;
- }
- xScreen = 0;
- data = null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java
deleted file mode 100755
index d33d75d064..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- * Instances of this class allow the user to select
- * a printer and various print-related parameters
- * prior to starting a print job.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class PrintDialog extends Dialog {
- int scope = PrinterData.ALL_PAGES;
- int startPage = -1, endPage = -1;
- boolean printToFile = false;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return a printer data object describing the desired print job parameters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public PrinterData open() {
- /* Return the first printer in the list */
- PrinterData[] printers = Printer.getPrinterList();
- if (printers.length > 0) return printers[0];
- return null;
-}
-/**
- * Returns the print job scope that the user selected
- * before pressing OK in the dialog. This will be one
- * of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @return the scope setting that the user selected
- */
-public int getScope() {
- return scope;
-}
-/**
- * Sets the scope of the print job. The user will see this
- * setting when the dialog is opened. This can have one of
- * the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @param int the scope setting when the dialog is opened
- */
-public void setScope(int scope) {
- this.scope = scope;
-}
-/**
- * Returns the start page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the start page setting that the user selected
- */
-public int getStartPage() {
- return startPage;
-}
-/**
- * Sets the start page that the user will see when the dialog
- * is opened.
- *
- * @param int the startPage setting when the dialog is opened
- */
-public void setStartPage(int startPage) {
- this.startPage = startPage;
-}
-/**
- * Returns the end page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the end page setting that the user selected
- */
-public int getEndPage() {
- return endPage;
-}
-/**
- * Sets the end page that the user will see when the dialog
- * is opened.
- *
- * @param int the end page setting when the dialog is opened
- */
-public void setEndPage(int endPage) {
- this.endPage = endPage;
-}
-/**
- * Returns the 'Print to file' setting that the user selected
- * before pressing OK in the dialog.
- *
- * @return the 'Print to file' setting that the user selected
- */
-public boolean getPrintToFile() {
- return printToFile;
-}
-/**
- * Sets the 'Print to file' setting that the user will see
- * when the dialog is opened.
- *
- * @param boolean the 'Print to file' setting when the dialog is opened
- */
-public void setPrintToFile(boolean printToFile) {
- this.printToFile = printToFile;
-}
-protected void checkSubclass() {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java
deleted file mode 100755
index 575c07297a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- * Instances of this class are used to print to a printer.
- * Applications create a GC on a printer using <code>new GC(printer)</code>
- * and then draw on the printer GC using the usual graphics calls.
- * <p>
- * A <code>Printer</code> object may be constructed by providing
- * a <code>PrinterData</code> object which identifies the printer.
- * A <code>PrintDialog</code> presents a print dialog to the user
- * and returns an initialized instance of <code>PrinterData</code>.
- * Alternatively, calling <code>new Printer()</code> will construct a
- * printer object for the user's default printer.
- * </p><p>
- * Application code must explicitly invoke the <code>Printer.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see PrinterData
- * @see PrintDialog
- */
-public final class Printer extends Device {
- PrinterData data;
- int printContext, xScreen, xDrawable;
- int defaultFontList;
-
-/**
- * Returns an array of <code>PrinterData</code> objects
- * representing all available printers.
- *
- * @return the list of available printers
- */
-public static PrinterData[] getPrinterList() {
- PrinterData printerList[] = new PrinterData[0];
- return printerList;
-}
-
-static PrinterData getDefaultPrinterData() {
- /* Use the first printer in the list as the default */
- PrinterData[] list = getPrinterList();
- if (list.length == 0) {
- /* no printers */
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- return list[0];
-}
-
-/**
- * Constructs a new printer representing the default printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer() {
- this(getDefaultPrinterData());
-}
-
-/**
- * Constructs a new printer given a <code>PrinterData</code>
- * object representing the desired printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @param data the printer data for the specified printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer(PrinterData data) {
- super(data);
-}
-
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC(GCData data) {
- return 0;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC(int xGC, GCData data) {
-}
-
-/**
- * Starts a print job and returns true if the job started successfully
- * and false otherwise.
- * <p>
- * This must be the first method called to initiate a print job,
- * followed by any number of startPage/endPage calls, followed by
- * endJob. Calling startPage, endPage, or endJob before startJob
- * will result in undefined behavior.
- * </p>
- *
- * @return true if the job started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #endPage
- * @see #endJob
- */
-public boolean startJob(String jobName) {
- return true;
-}
-
-/**
- * Ends the current print job.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startJob
- * @see #startPage
- * @see #endPage
- */
-public void endJob() {
-}
-
-/**
- * Cancels a print job in progress.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void cancelJob() {
-}
-
-/**
- * Starts a page and returns true if the page started successfully
- * and false otherwise.
- * <p>
- * After calling startJob, this method may be called any number of times
- * along with a matching endPage.
- * </p>
- *
- * @return true if the page started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #endPage
- * @see #startJob
- * @see #endJob
- */
-public boolean startPage() {
- return true;
-}
-
-/**
- * Ends the current page.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #startJob
- * @see #endJob
- */
-public void endPage() {
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the printer, and whose y coordinate
- * is the vertical dots per inch of the printer.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI() {
- return new Point(0, 0);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- * For a printer, this is the size of a page, in pixels.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getClientArea
- * @see #computeTrim
- */
-public Rectangle getBounds() {
- return null;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- * For a printer, this is the size of the printable area
- * of a page, in pixels.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #computeTrim
- */
-public Rectangle getClientArea() {
- return null;
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- * Note that there is no setBounds for a printer. This method
- * is usually used by passing in the client area (the 'printable
- * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #getClientArea
- */
-public Rectangle computeTrim(int x, int y, int width, int height) {
- return new Rectangle(0,0,0,0);
-}
-
-/**
- * Returns a <code>PrinterData</code> object representing the
- * target printer for this print job.
- *
- * @return a PrinterData object describing the receiver
- */
-public PrinterData getPrinterData() {
- return data;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java
deleted file mode 100755
index 36344c472e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * Instances of this class allow the user to select
- * a printer and various print-related parameters
- * prior to starting a print job.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class PrintDialog extends Dialog {
- int scope = PrinterData.ALL_PAGES;
- int startPage = -1, endPage = -1;
- boolean printToFile = false;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public PrintDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the print job scope that the user selected
- * before pressing OK in the dialog. This will be one
- * of the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @return the scope setting that the user selected
- */
-public int getScope() {
- return scope;
-}
-
-/**
- * Sets the scope of the print job. The user will see this
- * setting when the dialog is opened. This can have one of
- * the following values:
- * <dl>
- * <dt><code>ALL_PAGES</code></dt>
- * <dd>Print all pages in the current document</dd>
- * <dt><code>PAGE_RANGE</code></dt>
- * <dd>Print the range of pages specified by startPage and endPage</dd>
- * <dt><code>SELECTION</code></dt>
- * <dd>Print the current selection</dd>
- * </dl>
- *
- * @param int the scope setting when the dialog is opened
- */
-public void setScope(int scope) {
- this.scope = scope;
-}
-
-/**
- * Returns the start page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the start page setting that the user selected
- */
-public int getStartPage() {
- return startPage;
-}
-
-/**
- * Sets the start page that the user will see when the dialog
- * is opened.
- *
- * @param int the startPage setting when the dialog is opened
- */
-public void setStartPage(int startPage) {
- this.startPage = startPage;
-}
-
-/**
- * Returns the end page setting that the user selected
- * before pressing OK in the dialog.
- * <p>
- * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
- * </p>
- *
- * @return the end page setting that the user selected
- */
-public int getEndPage() {
- return endPage;
-}
-
-/**
- * Sets the end page that the user will see when the dialog
- * is opened.
- *
- * @param int the end page setting when the dialog is opened
- */
-public void setEndPage(int endPage) {
- this.endPage = endPage;
-}
-
-/**
- * Returns the 'Print to file' setting that the user selected
- * before pressing OK in the dialog.
- *
- * @return the 'Print to file' setting that the user selected
- */
-public boolean getPrintToFile() {
- return printToFile;
-}
-
-/**
- * Sets the 'Print to file' setting that the user will see
- * when the dialog is opened.
- *
- * @param boolean the 'Print to file' setting when the dialog is opened
- */
-public void setPrintToFile(boolean printToFile) {
- this.printToFile = printToFile;
-}
-
-protected void checkSubclass() {
-}
-
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return a printer data object describing the desired print job parameters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public PrinterData open() {
- PRINTDLG pd = new PRINTDLG();
- pd.lStructSize = PRINTDLG.sizeof;
- pd.Flags = OS.PD_USEDEVMODECOPIESANDCOLLATE;
- if (printToFile) pd.Flags |= OS.PD_PRINTTOFILE;
- switch (scope) {
- case PrinterData.PAGE_RANGE: pd.Flags |= OS.PD_PAGENUMS; break;
- case PrinterData.SELECTION: pd.Flags |= OS.PD_SELECTION; break;
- default: pd.Flags |= OS.PD_ALLPAGES;
- }
- pd.nMinPage = 1;
- pd.nMaxPage = -1;
- pd.nFromPage = (short) startPage;
- pd.nToPage = (short) endPage;
- if (OS.PrintDlg(pd)) {
- /* Get driver and device from the DEVNAMES struct */
- int size = OS.GlobalSize(pd.hDevNames);
- int ptr = OS.GlobalLock(pd.hDevNames);
- short[] offsets = new short[4];
- OS.MoveMemory(offsets, ptr, 2 * offsets.length);
- TCHAR buffer = new TCHAR(0, size);
- OS.MoveMemory(buffer, ptr, size);
- OS.GlobalUnlock(ptr);
-
- int driverOffset = offsets[0];
- int i = 0;
- while (driverOffset + i < size) {
- if (buffer.tcharAt(driverOffset + i) == 0) break;
- else i++;
- }
- String driver = buffer.toString(driverOffset, i);
- int deviceOffset = offsets[1];
- i = 0;
- while (deviceOffset + i < size) {
- if (buffer.tcharAt(deviceOffset + i) == 0) break;
- else i++;
- }
- String device = buffer.toString(deviceOffset, i);
-
- /* Create PrinterData object and set fields from PRINTDLG */
- PrinterData data = new PrinterData(driver, device);
- if ((pd.Flags & OS.PD_PAGENUMS) != 0) {
- data.scope = PrinterData.PAGE_RANGE;
- data.startPage = pd.nFromPage;
- data.endPage = pd.nToPage;
- } else if ((pd.Flags & OS.PD_SELECTION) != 0) {
- data.scope = PrinterData.SELECTION;
- }
- data.printToFile = (pd.Flags & OS.PD_PRINTTOFILE) != 0;
- data.copyCount = pd.nCopies;
- data.collate = (pd.Flags & OS.PD_COLLATE) != 0;
-
- /* Bulk-save the printer-specific settings in the DEVMODE struct */
- ptr = OS.GlobalLock(pd.hDevMode);
- size = OS.GlobalSize(ptr);
- data.otherData = new byte[size];
- OS.MoveMemory(data.otherData, ptr, size);
- OS.GlobalUnlock(ptr);
-
- return data;
- }
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java
deleted file mode 100755
index 29b5a724c9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java
+++ /dev/null
@@ -1,502 +0,0 @@
-package org.eclipse.swt.printing;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * Instances of this class are used to print to a printer.
- * Applications create a GC on a printer using <code>new GC(printer)</code>
- * and then draw on the printer GC using the usual graphics calls.
- * <p>
- * A <code>Printer</code> object may be constructed by providing
- * a <code>PrinterData</code> object which identifies the printer.
- * A <code>PrintDialog</code> presents a print dialog to the user
- * and returns an initialized instance of <code>PrinterData</code>.
- * Alternatively, calling <code>new Printer()</code> will construct a
- * printer object for the user's default printer.
- * </p><p>
- * Application code must explicitly invoke the <code>Printer.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see PrinterData
- * @see PrintDialog
- */
-public final class Printer extends Device {
- /**
- * the handle to the printer DC
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the printer data describing this printer
- */
- PrinterData data;
-
- /**
- * whether or not a GC was created for this printer
- */
- boolean isGCCreated = false;
-
- /**
- * strings used to access the Windows registry
- * (Warning: These fields are platform dependent)
- */
- static TCHAR profile;
- static TCHAR appName;
- static TCHAR keyName;
- static {
- profile = new TCHAR(0, "PrinterPorts", true);
- appName = new TCHAR(0, "windows", true);
- keyName = new TCHAR(0, "device", true);
- }
-
-/**
- * Returns an array of <code>PrinterData</code> objects
- * representing all available printers.
- *
- * @return the list of available printers
- */
-public static PrinterData[] getPrinterList() {
- int length = 1024;
- /* Use the character encoding for the default locale */
- TCHAR buf = new TCHAR(0, length);
- TCHAR nullBuf = new TCHAR(0, 1);
- int n = OS.GetProfileString(profile, null, nullBuf, buf, length);
- if (n == 0) return new PrinterData[0];
- String[] deviceNames = new String[5];
- int nameCount = 0;
- int index = 0;
- for (int i = 0; i < n; i++) {
- if (buf.tcharAt(i) == 0) {
- if (nameCount == deviceNames.length) {
- String[] newNames = new String[deviceNames.length + 5];
- System.arraycopy(deviceNames, 0, newNames, 0, deviceNames.length);
- deviceNames = newNames;
- }
- deviceNames[nameCount] = buf.toString(index, i - index);
- nameCount++;
- index = i + 1;
- }
- }
- PrinterData printerList[] = new PrinterData[nameCount];
- for (int p = 0; p < nameCount; p++) {
- String device = deviceNames[p];
- String driver = "";
- if (OS.GetProfileString(profile, new TCHAR(0, device, true), nullBuf, buf, length) > 0) {
- int commaIndex = 0;
- while (buf.tcharAt(commaIndex) != ',' && commaIndex < length) commaIndex++;
- if (commaIndex < length) {
- driver = buf.toString(0, commaIndex);
- }
- }
- printerList[p] = new PrinterData(driver, device);
- }
- return printerList;
-}
-
-/*
- * Returns a <code>PrinterData</code> object representing
- * the default printer.
- *
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the default printer data</li>
- * </ul>
- *
- * @return the default printer data
- */
-static PrinterData getDefaultPrinterData() {
- String deviceName = null;
- int length = 1024;
- /* Use the character encoding for the default locale */
- TCHAR buf = new TCHAR(0, length);
- TCHAR nullBuf = new TCHAR(0, 1);
- int n = OS.GetProfileString(appName, keyName, nullBuf, buf, length);
- if (n == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int commaIndex = 0;
- while(buf.tcharAt(commaIndex) != ',' && commaIndex < length) commaIndex++;
- if (commaIndex < length) {
- deviceName = buf.toString(0, commaIndex);
- }
- String driver = "";
- if (OS.GetProfileString(profile, new TCHAR(0, deviceName, true), nullBuf, buf, length) > 0) {
- commaIndex = 0;
- while (buf.tcharAt(commaIndex) != ',' && commaIndex < length) commaIndex++;
- if (commaIndex < length) {
- driver = buf.toString(0, commaIndex);
- }
- }
- return new PrinterData(driver, deviceName);
-}
-
-/**
- * Constructs a new printer representing the default printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer() {
- this(getDefaultPrinterData());
-}
-
-/**
- * Constructs a new printer given a <code>PrinterData</code>
- * object representing the desired printer.
- * <p>
- * You must dispose the printer when it is no longer required.
- * </p>
- *
- * @param data the printer data for the specified printer
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @see #dispose
- */
-public Printer(PrinterData data) {
- super(data);
-}
-
-/**
- * Creates the printer handle.
- * This method is called internally by the instance creation
- * mechanism of the <code>Device</code> class.
- */
-protected void create(DeviceData deviceData) {
- data = (PrinterData)deviceData;
- /* Use the character encoding for the default locale */
- TCHAR driver = new TCHAR(0, data.driver, true);
- TCHAR device = new TCHAR(0, data.name, true);
- int lpInitData = 0;
- byte buffer [] = data.otherData;
- int hHeap = OS.GetProcessHeap();
- if (buffer != null && buffer.length != 0) {
- lpInitData = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, buffer.length);
- OS.MoveMemory(lpInitData, buffer, buffer.length);
- }
- handle = OS.CreateDC(driver, device, 0, lpInitData);
- if (lpInitData != 0) OS.HeapFree(hHeap, 0, lpInitData);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC(GCData data) {
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (data != null) {
- if (isGCCreated) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- data.device = this;
- data.hFont = OS.GetCurrentObject(handle, OS.OBJ_FONT);
- isGCCreated = true;
- }
- return handle;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Printer</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC(int hDC, GCData data) {
- if (data != null) isGCCreated = false;
-}
-
-/**
- * Starts a print job and returns true if the job started successfully
- * and false otherwise.
- * <p>
- * This must be the first method called to initiate a print job,
- * followed by any number of startPage/endPage calls, followed by
- * endJob. Calling startPage, endPage, or endJob before startJob
- * will result in undefined behavior.
- * </p>
- *
- * @return true if the job started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #endPage
- * @see #endJob
- */
-public boolean startJob(String jobName) {
- checkDevice();
- DOCINFO di = new DOCINFO();
- di.cbSize = DOCINFO.sizeof;
- int hHeap = OS.GetProcessHeap();
- int lpszDocName = 0;
- if (jobName != null && jobName.length() != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR(0, jobName, true);
- int byteCount = buffer.length() * TCHAR.sizeof;
- lpszDocName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory(lpszDocName, buffer, byteCount);
- di.lpszDocName = lpszDocName;
- }
- int lpszOutput = 0;
- if (data.printToFile && data.fileName != null) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR(0, data.fileName, true);
- int byteCount = buffer.length() * TCHAR.sizeof;
- lpszOutput = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory(lpszOutput, buffer, byteCount);
- di.lpszOutput = lpszOutput;
- }
- int rc = OS.StartDoc(handle, di);
- if (lpszDocName != 0) OS.HeapFree(hHeap, 0, lpszDocName);
- if (lpszOutput != 0) OS.HeapFree(hHeap, 0, lpszOutput);
- return rc > 0;
-}
-
-/**
- * Ends the current print job.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startJob
- * @see #startPage
- * @see #endPage
- */
-public void endJob() {
- checkDevice();
- OS.EndDoc(handle);
-}
-
-/**
- * Cancels a print job in progress.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void cancelJob() {
- checkDevice();
- OS.AbortDoc(handle);
-}
-
-/**
- * Starts a page and returns true if the page started successfully
- * and false otherwise.
- * <p>
- * After calling startJob, this method may be called any number of times
- * along with a matching endPage.
- * </p>
- *
- * @return true if the page started successfully and false otherwise.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #endPage
- * @see #startJob
- * @see #endJob
- */
-public boolean startPage() {
- checkDevice();
- int rc = OS.StartPage(handle);
- if (rc <= 0) OS.AbortDoc(handle);
- return rc > 0;
-}
-
-/**
- * Ends the current page.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #startPage
- * @see #startJob
- * @see #endJob
- */
-public void endPage() {
- checkDevice();
- OS.EndPage(handle);
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the printer, and whose y coordinate
- * is the vertical dots per inch of the printer.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI() {
- checkDevice();
- int dpiX = OS.GetDeviceCaps(handle, OS.LOGPIXELSX);
- int dpiY = OS.GetDeviceCaps(handle, OS.LOGPIXELSY);
- return new Point(dpiX, dpiY);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- * For a printer, this is the size of a page, in pixels.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getClientArea
- * @see #computeTrim
- */
-public Rectangle getBounds() {
- checkDevice();
- int width = OS.GetDeviceCaps(handle, OS.PHYSICALWIDTH);
- int height = OS.GetDeviceCaps(handle, OS.PHYSICALHEIGHT);
- return new Rectangle(0, 0, width, height);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- * For a printer, this is the size of the printable area
- * of a page, in pixels.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #computeTrim
- */
-public Rectangle getClientArea() {
- checkDevice();
- int width = OS.GetDeviceCaps(handle, OS.HORZRES);
- int height = OS.GetDeviceCaps(handle, OS.VERTRES);
- return new Rectangle(0, 0, width, height);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- * Note that there is no setBounds for a printer. This method
- * is usually used by passing in the client area (the 'printable
- * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- * @see #getClientArea
- */
-public Rectangle computeTrim(int x, int y, int width, int height) {
- checkDevice();
- int printX = -OS.GetDeviceCaps(handle, OS.PHYSICALOFFSETX);
- int printY = -OS.GetDeviceCaps(handle, OS.PHYSICALOFFSETY);
- int printWidth = OS.GetDeviceCaps(handle, OS.HORZRES);
- int printHeight = OS.GetDeviceCaps(handle, OS.VERTRES);
- int paperWidth = OS.GetDeviceCaps(handle, OS.PHYSICALWIDTH);
- int paperHeight = OS.GetDeviceCaps(handle, OS.PHYSICALHEIGHT);
- int hTrim = paperWidth - printWidth;
- int vTrim = paperHeight - printHeight;
- return new Rectangle(x + printX, y + printY, width + hTrim, height + vTrim);
-}
-
-/**
- * Returns a <code>PrinterData</code> object representing the
- * target printer for this print job.
- *
- * @return a PrinterData object describing the receiver
- */
-public PrinterData getPrinterData() {
- return data;
-}
-
-/**
- * Checks the validity of this device.
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-protected void checkDevice() {
- if (handle == 0) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-/**
- * Releases any internal state prior to destroying this printer.
- * This method is called internally by the dispose
- * mechanism of the <code>Device</code> class.
- */
-protected void release() {
- super.release();
- data = null;
-}
-
-/**
- * Destroys the printer handle.
- * This method is called internally by the dispose
- * mechanism of the <code>Device</code> class.
- */
-protected void destroy() {
- if (handle != 0) OS.DeleteDC(handle);
- handle = 0;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/common/org/eclipse/swt/program/package.html b/bundles/org.eclipse.swt/Eclipse SWT Program/common/org/eclipse/swt/program/package.html
deleted file mode 100755
index 25df82ce32..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/common/org/eclipse/swt/program/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Program support class.
-<h2>
-Package Specification</h2>
-This package contains class <code>Program</code> which provides access to facilities for
-discovering operating system specific aspects of external program launching.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
deleted file mode 100644
index 04cf611eaa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.eclipse.swt.program;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.graphics.*;
-
-import java.io.IOException;
-
-/**
- * Instances of this class represent programs and
- * their assoicated file extensions in the operating
- * system.
- */
-public final class Program {
- String name = "", extension = "", command = "";
-
-/**
- * Finds the program that is associated with an extension.
- * The extension may or may not begin with a '.'.
- *
- * @param extension the program extension
- * @return the program or nil
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static Program findProgram (String extension) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return null;
- return null;
-}
-
-/**
- * Answer all program extensions in the operating system.
- *
- * @return an array of extensions
- */
-public static String [] getExtensions () {
- return new String [0];
-}
-
-/**
- * Answers all available programs in the operating system.
- *
- * @return an array of programs
- */
-public static Program [] getPrograms () {
- return new Program [0];
-}
-
-/**
- * Launches the executable associated with the file in
- * the operating system. If the file is an executable,
- * then the executable is launched.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public static boolean launch (String fileName) {
- if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
-
- return false;
-}
-
-/**
- * Executes the program with the file as the single argument
- * in the operating system. It is the responsibility of the
- * programmer to ensure that the file contains valid data for
- * this program.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public boolean execute (String fileName) {
- if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- return false;
-}
-
-/**
- * Returns the receiver's image data. This is the icon
- * that is associated with the reciever in the operating
- * system.
- *
- * @return the image data for the program, may be null
- */
-public ImageData getImageData () {
- return null;
-}
-
-/**
- * Returns the receiver's name. This is as short and
- * descriptive a name as possible for the program. If
- * the program has no descriptive name, this string may
- * be the executable name, path or empty.
- *
- * @return an the name of the program
- */
-public String getName () {
- return name;
-}
-
-/**
- * Returns true if the receiver and the argument represent
- * the same program.
- *
- * @return true if the programs are the same
- */
-public boolean equals(Object other) {
- if (this == other) return true;
- if (other instanceof Program) {
- final Program program = (Program) other;
- return extension.equals(program.extension) && name.equals(program.name)
- && command.equals(program.command);
- }
- return false;
-}
-
-/**
- * Returns a hash code suitable for this object.
- *
- * @return a hash code
- */
-public int hashCode() {
- return extension.hashCode() ^ name.hashCode() ^ command.hashCode();
-}
-
-public String toString () {
- return "Program {" + name + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java
deleted file mode 100644
index 04cf611eaa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.eclipse.swt.program;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.graphics.*;
-
-import java.io.IOException;
-
-/**
- * Instances of this class represent programs and
- * their assoicated file extensions in the operating
- * system.
- */
-public final class Program {
- String name = "", extension = "", command = "";
-
-/**
- * Finds the program that is associated with an extension.
- * The extension may or may not begin with a '.'.
- *
- * @param extension the program extension
- * @return the program or nil
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static Program findProgram (String extension) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return null;
- return null;
-}
-
-/**
- * Answer all program extensions in the operating system.
- *
- * @return an array of extensions
- */
-public static String [] getExtensions () {
- return new String [0];
-}
-
-/**
- * Answers all available programs in the operating system.
- *
- * @return an array of programs
- */
-public static Program [] getPrograms () {
- return new Program [0];
-}
-
-/**
- * Launches the executable associated with the file in
- * the operating system. If the file is an executable,
- * then the executable is launched.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public static boolean launch (String fileName) {
- if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
-
- return false;
-}
-
-/**
- * Executes the program with the file as the single argument
- * in the operating system. It is the responsibility of the
- * programmer to ensure that the file contains valid data for
- * this program.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public boolean execute (String fileName) {
- if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- return false;
-}
-
-/**
- * Returns the receiver's image data. This is the icon
- * that is associated with the reciever in the operating
- * system.
- *
- * @return the image data for the program, may be null
- */
-public ImageData getImageData () {
- return null;
-}
-
-/**
- * Returns the receiver's name. This is as short and
- * descriptive a name as possible for the program. If
- * the program has no descriptive name, this string may
- * be the executable name, path or empty.
- *
- * @return an the name of the program
- */
-public String getName () {
- return name;
-}
-
-/**
- * Returns true if the receiver and the argument represent
- * the same program.
- *
- * @return true if the programs are the same
- */
-public boolean equals(Object other) {
- if (this == other) return true;
- if (other instanceof Program) {
- final Program program = (Program) other;
- return extension.equals(program.extension) && name.equals(program.name)
- && command.equals(program.command);
- }
- return false;
-}
-
-/**
- * Returns a hash code suitable for this object.
- *
- * @return a hash code
- */
-public int hashCode() {
- return extension.hashCode() ^ name.hashCode() ^ command.hashCode();
-}
-
-public String toString () {
- return "Program {" + name + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
deleted file mode 100755
index 8640d87eeb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
+++ /dev/null
@@ -1,1065 +0,0 @@
-package org.eclipse.swt.program;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.swt.widgets.Display;
-
-import java.io.*;
-import java.util.Iterator;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * Instances of this class represent programs and
- * their assoicated file extensions in the operating
- * system.
- */
-public final class Program {
- String name;
- String extension;
- String command;
- Display display;
-
- static private final String cdeShell = "Program_CDE_SHELL"; // hidden shell used for DtAppInitialize and DtActionInvoke
- static private final String[] cdeIconExt = { ".m.pm", ".l.pm", ".s.pm", ".t.pm" };
- static private final String[] cdeMaskExt = { ".m_m.bm", ".l_m.bm", ".s_m.bm", ".t_m.bm" };
- static private final String desktopData = "Program_DESKTOP";
-
- static final int DESKTOP_UNKNOWN = 0;
- static final int DESKTOP_KDE = 1; // Linux
- static final int DESKTOP_GNOME = 2; // Linux
- static final int DESKTOP_CDE = 3; // Solaris
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Program () {
-}
-
-/* Determine the desktop for the given display. */
-static int getDesktop( Display display ) {
- if (display == null) return DESKTOP_UNKNOWN;
-
- // If the desktop type for this display is already known, return it.
- Integer desktopValue = (Integer) display.getData( desktopData );
- if (desktopValue != null) {
- return desktopValue.intValue();
- }
-
- // Obtain the atoms for the various window manager signature properties.
- int desktop = DESKTOP_UNKNOWN;
- int xDisplay = display.xDisplay;
- /* Use the character encoding for the default locale */
- byte[] gnomeName = Converter.wcsToMbcs (null, "GNOME_NAME_SERVER", true);
- byte[] cdeName = Converter.wcsToMbcs (null, "DTWM_IS_RUNNING", true);
- byte[] kdeName = Converter.wcsToMbcs (null, "KWIN_RUNNING", true);
- int gnome = OS.XInternAtom( xDisplay, gnomeName, true );
- int cde = OS.XInternAtom( xDisplay, cdeName, true );
- int kde = OS.XInternAtom( xDisplay, kdeName, true );
-
- // Get the list of properties on the root window.
- int rootWindow = OS.XDefaultRootWindow( xDisplay );
- int[] numProp = new int[1];
- int propList = OS.XListProperties( xDisplay, rootWindow, numProp );
- if (propList == 0) return DESKTOP_UNKNOWN;
- int[] property = new int[ numProp[0] ];
- OS.memmove( property, propList, (property.length * 4) );
- OS.XFree( propList );
-
- // A given WM (desktop) is active if the property exists on the root window.
- for (int index = 0; desktop == DESKTOP_UNKNOWN && index < property.length; index++) {
- if (property[ index ] == OS.None) continue; // do not match atoms that do not exist
- if (property[ index ] == gnome) {
- if (gnome_init()) desktop = DESKTOP_GNOME;
- }
- if (property[ index ] == cde) {
- if (cde_init( display )) desktop = DESKTOP_CDE;
- }
- if (property[ index ] == kde) {
- if (kde_init()) desktop = DESKTOP_KDE;
- }
- }
-
- // Save the desktop type on the display itself.
- display.setData( desktopData, new Integer(desktop) );
- return desktop;
-}
-
-/**
- * Finds the program that is associated with an extension.
- * The extension may or may not begin with a '.'.
- *
- * @param extension the program extension
- * @return the program or nil
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static Program findProgram (String extension) {
- return findProgram( Display.getCurrent(), extension );
-}
-
-/*
- * API: When support for multiple displays is added, this method will
- * become public and the original method above can be deprecated.
- */
-private static Program findProgram( Display display, String extension ) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return null;
- if (extension.charAt (0) != '.') extension = "." + extension;
- String command = null;
- String name = null;
- int desktop = getDesktop( display );
- Hashtable mimeInfo = null;
- if (desktop == DESKTOP_KDE) mimeInfo = kde_getMimeInfo();
- if (desktop == DESKTOP_GNOME) mimeInfo = gnome_getMimeInfo();
- if (desktop == DESKTOP_CDE) mimeInfo = cde_getDataTypeInfo();
- if (mimeInfo == null) return null;
-
- // Find the data type matching the extension.
- Iterator keys = mimeInfo.keySet().iterator();
- while (name == null && keys.hasNext()) {
- String mimeType = (String) keys.next();
- Vector mimeExts = (Vector) mimeInfo.get( mimeType );
- for (int index = 0; index < mimeExts.size(); index++){
- if (extension.equals( mimeExts.elementAt( index ) )) {
- name = mimeType;
- }
- }
- }
- if (name == null) return null;
-
- // Get the corresponding command for the mime type.
- if (desktop == DESKTOP_KDE) command = kde_getMimeTypeCommand( name );
- if (desktop == DESKTOP_GNOME) command = gnome_getMimeValue( name, "open" );
- if (desktop == DESKTOP_CDE) command = cde_getAction( name );
- if (command == null) return null;
-
- // Return the corresponding program.
- Program program = new Program ();
- program.name = name;
- program.command = command;
- program.extension = extension;
- program.display = display;
- return program;
-}
-
-/**
- * Answer all program extensions in the operating system.
- *
- * @return an array of extensions
- */
-public static String [] getExtensions () {
- return getExtensions( Display.getCurrent() );
-}
-
-/*
- * API: When support for multiple displays is added, this method will
- * become public and the original method above can be deprecated.
- */
-private static String[] getExtensions( Display display ) {
- int desktop = getDesktop( display );
- Hashtable mimeInfo = null;
- if (desktop == DESKTOP_KDE) mimeInfo = kde_getMimeInfo();
- if (desktop == DESKTOP_GNOME) mimeInfo = gnome_getMimeInfo();
- if (desktop == DESKTOP_CDE) mimeInfo = cde_getDataTypeInfo();
- if (mimeInfo == null) return new String[0];
-
-
- // Create a unique set of the file extensions.
- Vector extensions = new Vector();
- Iterator keys = mimeInfo.keySet().iterator();
- while (keys.hasNext()) {
- String mimeType = (String) keys.next();
- Vector mimeExts = (Vector) mimeInfo.get( mimeType );
- for (int index = 0; index < mimeExts.size(); index++){
- if (!extensions.contains( mimeExts.elementAt( index ) )) {
- extensions.addElement( mimeExts.elementAt( index ) );
- }
- }
- }
-
- // Return the list of extensions.
- String[] extStrings = new String[ extensions.size() ];
- for (int index = 0; index < extensions.size(); index++) {
- extStrings[ index ] = (String) extensions.elementAt( index );
- }
- return extStrings;
-}
-
-/**
- * Answers all available programs in the operating system.
- *
- * @return an array of programs
- */
-public static Program [] getPrograms () {
- return getPrograms( Display.getCurrent() );
-}
-
-/*
- * API: When support for multiple displays is added, this method will
- * become public and the original method above can be deprecated.
- */
-private static Program[] getPrograms( Display display ) {
- int desktop = getDesktop( display );
- Hashtable mimeInfo = null;
- if (desktop == DESKTOP_KDE) mimeInfo = kde_getMimeInfo();
- if (desktop == DESKTOP_GNOME) mimeInfo = gnome_getMimeInfo();
- if (desktop == DESKTOP_CDE) mimeInfo = cde_getDataTypeInfo();
- if (mimeInfo == null) return new Program[0];
-
- // Create a list of programs with commands.
- Vector programs = new Vector();
- Iterator keys = mimeInfo.keySet().iterator();
- while (keys.hasNext()) {
- String mimeType = (String) keys.next();
- Vector mimeExts = (Vector) mimeInfo.get( mimeType );
- String extension = "";
- if (mimeExts.size() > 0){
- extension = (String) mimeExts.elementAt( 0 );
- }
- String command = null;
- if (desktop == DESKTOP_KDE) command = kde_getMimeTypeCommand( mimeType );
- if (desktop == DESKTOP_GNOME) command = gnome_getMimeValue( mimeType, "open" );
- if (desktop == DESKTOP_CDE) command = cde_getAction( mimeType );
- if (command != null) {
- Program program = new Program ();
- program.name = mimeType;
- program.command = command;
- program.extension = extension;
- program.display = display;
- programs.addElement( program );
- }
- }
-
- // Return the list of programs to the user.
- Program[] programList = new Program[ programs.size() ];
- for (int index = 0; index < programList.length; index++) {
- programList[ index ] = (Program) programs.elementAt( index );
- }
- return programList;
-}
-
-/*
- * Obtain the registered mime type information and
- * return it in a map. The key of each entry
- * in the map is the mime type name. The value is
- * a vector of the associated file extensions.
- */
-
-private static Hashtable gnome_getMimeInfo() {
- Hashtable mimeInfo = new Hashtable();
-
- // Extract the mime info from the system directory.
- String mimeDirectory = gnome_getDataDirectory ("mime-info");
- gnome_getMimeInfoFromDirectory( mimeInfo, new File( mimeDirectory ) );
-
- // Append the mime info from the user's directory (if it exists).
- String userDirectory = gnome_getHomeDirectory();
- if (userDirectory != null) {
- userDirectory = userDirectory + File.separator + ".gnome" + File.separator + "mime-info";
- gnome_getMimeInfoFromDirectory( mimeInfo, new File( userDirectory ) );
- }
-
- return mimeInfo;
-}
-
-// Given a map and a directory, find all of the
-// mime information files (*.mime) and parse them for
-// relavent mime type information. Each entry in the
-// map corresponds to one mime type, and its
-// associated file extensions.
-
-private static void gnome_getMimeInfoFromDirectory( Hashtable info, File directory ) {
- // For each entry in the given directory (if it exists)
- if (directory.exists()) {
- File[] files = directory.listFiles();
- for (int i = 0; i < files.length; i++) {
-
- // If the entry is a subdirectory, process it and
- // merge the mime type into the given map.
- if (files[i].isDirectory()) {
- gnome_getMimeInfoFromDirectory( info, files[i] );
- }
-
- // else if the entry is a mime info file (*.mime)
- else if (files[i].getName().endsWith(".mime")) {
- try {
- // Parse the mime file and merge the info
- // into the given map.
- FileReader in = new FileReader( files[i] );
- BufferedReader reader = new BufferedReader( in );
- gnome_parseMimeFile( info, reader );
- reader.close();
- in.close();
- }
- catch (IOException e) {
- // Ignore file exceptions silently. If we
- // can't read it, the info is not available.
- }
- }
- }
- }
-}
-
-private static void gnome_parseMimeFile( Hashtable info, BufferedReader reader ) {
- Vector mimeExts = null;
- String mimeType = null;
- boolean saveType = false;
- String line = "#";
- while (line != null) {
-
- // Determine if the line contains a mime type name.
- boolean newType = (line.length() > 0 && Compatibility.isLetter( line.charAt(0) ));
-
- // If there is valid data on this line to be processed
- String data = line.trim();
- if (data.length() > 0 && data.charAt(0) != '#') {
-
- // If this line defines a new mime type
- if (newType) {
-
- // If a previous mime type has not be saved yet
- if (mimeType != null) {
- // Save the type and process this line again.
- saveType = true;
- }
- // else initialize the mime type info
- else {
- int colon = data.indexOf( ':' );
- if (colon != -1) {
- mimeType = data.substring( 0, colon );
- }
- else {
- mimeType = data;
- }
- mimeExts = new Vector();
- }
- }
-
- // else if the line defines a list of extensions
- else if (data.indexOf( "ext" ) == 0 && mimeType != null) {
-
- // Get the extensions defined on the line
- String exts = "";
- int colon = data.indexOf( ':' );
- if ((colon != -1) && ((colon+1) < data.length())) {
- exts = data.substring( (colon+1) ).trim();
- }
-
- // While there are extensions to be processed (use space as separator)
- exts = exts.replace( '\t', ' ' );
- exts = exts.replace( ',', ' ' );
- while (exts.length() != 0) {
- // Extract the next entension from the list
- String newExt;
- int space = exts.indexOf( ' ' );
- if (space != -1) {
- newExt = exts.substring( 0, space );
- exts = exts.substring( space ).trim();
- }
- else {
- newExt = exts;
- exts = "";
- }
-
- // Prefix an extension with a period.
- if (newExt.charAt(0) != '.') {
- newExt = "." + newExt;
- }
- mimeExts.addElement( newExt );
- }
- }
-
- // else if the line defines a list of regular expressions
- else if (data.indexOf( "regex" ) == 0 && mimeType != null) {
- // Do nothing with these right now.
- }
- }
-
-
- // If the current mime type is still being processed
- if (!saveType) {
- // Get the next line
- try {
- line = reader.readLine();
- }
- catch (IOException e) {
- line = null;
- }
- }
-
- // If the current type should be saved or if the end
- // of the file was reached
- if (saveType || (line == null)) {
- // If there is a mime type to be saved
- if (mimeType != null) {
-
- // If the mime type does not exist in the map, add it.
- Vector prevExts = (Vector) info.get( mimeType );
- if (prevExts == null) {
- info.put( mimeType, mimeExts );
- }
-
- // else append the new list of extensions.
- else {
- for (int i = 0; i < mimeExts.size(); i++) {
- prevExts.add( mimeExts.elementAt( i ) );
- }
- }
- }
- mimeType = null;
- mimeExts = null;
- saveType = false;
- }
- }
-}
-
-// Private method for parsing a command line into its arguments.
-private static String[] parseCommand( String cmd ) {
- Vector args = new Vector();
- int sIndex = 0;
- int eIndex;
- while (sIndex < cmd.length()) {
- // Trim initial white space of argument.
- while (sIndex < cmd.length() && Compatibility.isWhitespace( cmd.charAt(sIndex) )) {
- sIndex++;
- }
- if (sIndex < cmd.length()) {
- // If the command is a quoted string
- if (cmd.charAt(sIndex) == '"' || cmd.charAt(sIndex) == '\''){
- // Find the terminating quote (or end of line).
- // This code currently does not handle escaped characters (e.g., " a\"b").
- eIndex = sIndex + 1;
- while (eIndex < cmd.length() && cmd.charAt(eIndex) != cmd.charAt(sIndex)) {
- eIndex++;
- }
- if (eIndex >= cmd.length()) { // the terminating quote was not found
- // Add the argument as is with only one initial quote.
- args.addElement( cmd.substring( sIndex, eIndex ) );
- }
- // else add the argument, trimming off the quotes.
- else {
- args.addElement( cmd.substring( sIndex+1, eIndex ) );
- }
- sIndex = eIndex + 1;
- }
-
- // else use white space for the delimiters.
- else {
- eIndex = sIndex;
- while (eIndex < cmd.length() && !Compatibility.isWhitespace( cmd.charAt(eIndex) )) {
- eIndex++;
- }
- args.addElement( cmd.substring( sIndex, eIndex ) );
- sIndex = eIndex + 1;
- }
- }
- }
-
- String[] strings = new String[ args.size() ];
- for (int index =0; index < args.size(); index++) {
- strings[ index ] = (String) args.elementAt( index );
- }
- return strings;
-}
-
-
-static String gnome_getDataDirectory(String dirName) {
- /* Use the character encoding for the default locale */
- byte [] nameBuffer = Converter.wcsToMbcs (null, dirName, true);
- int ptr = GNOME.gnome_datadir_file(nameBuffer);
- if (ptr == 0) return null;
- int length = OS.strlen(ptr);
- byte[] dirBuffer = new byte[length];
- OS.memmove(dirBuffer, ptr, length);
- /* Use the character encoding for the default locale */
- return new String(Converter.mbcsToWcs(null, dirBuffer));
-}
-
-static String gnome_getHomeDirectory() {
- int ptr = GNOME.g_get_home_dir();
- if (ptr == 0) return null;
- int length = OS.strlen(ptr);
- byte[] homeDirBuffer = new byte[length];
- OS.memmove(homeDirBuffer, ptr, length);
- /* Use the character encoding for the default locale */
- return new String(Converter.mbcsToWcs(null, homeDirBuffer));
-}
-
-static String gnome_getMimeType(String name) {
- /* Use the character encoding for the default locale */
- byte [] nameBuffer = Converter.wcsToMbcs (null, name, true);
- int ptr = GNOME.gnome_mime_type(nameBuffer);
- if (ptr == 0) return null;
- int length = OS.strlen(ptr);
- byte[] mimeBuffer = new byte[length];
- OS.memmove(mimeBuffer, ptr, length);
- /* Use the character encoding for the default locale */
- return new String(Converter.mbcsToWcs(null, mimeBuffer));
-}
-
-static String gnome_getMimeValue(String mimeType, String key) {
- /* Use the character encoding for the default locale */
- byte [] typeBuffer = Converter.wcsToMbcs (null, mimeType, true);
- byte [] keyBuffer = Converter.wcsToMbcs (null, key, true);
- int ptr = GNOME.gnome_mime_get_value(typeBuffer, keyBuffer);
- if (ptr == 0) return null;
-
- StringBuffer stringBuffer = new StringBuffer();
- int length = OS.strlen(ptr);
- byte[] valueBuffer = new byte[length];
- OS.memmove(valueBuffer, ptr, length);
- /* Use the character encoding for the default locale */
- return new String(Converter.mbcsToWcs(null, valueBuffer));
-}
-
-static boolean kde_init () {
- try {
- Library.loadLibrary("swt-kde");
- } catch (Throwable e) {
- return false;
- }
-
- /* Use the character encoding for the default locale */
- byte [] nameBuffer = Converter.wcsToMbcs( null, "SWT", true );
- int qcString = KDE.QCString_new( nameBuffer );
- KDE.KApplication_new( qcString );
- KDE.QCString_delete( qcString );
- return true;
-}
-
-private static String kde_getMimeTypeCommand( String mimeType ) {
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, mimeType, true);
- int qMimeType = KDE.QString_new( buffer );
- int serviceList = KDE.KMimeType_offers( qMimeType );
- KDE.QString_delete( qMimeType );
- if (serviceList == 0) return null;
- KDE.KServiceList_delete( serviceList );
- return "KRun::runURL(url,mimeType)";
-}
-/*
- * Obtain the registered mime type information and
- * return it in a map. The key of each entry
- * in the map is the mime type name. The value is
- * a vector of the associated file extensions.
- */
-
-private static Hashtable kde_getMimeInfo() {
- Hashtable mimeInfo = new Hashtable();
- Vector mimeExts = null;
- String mimeType;
-
- // Get the list of all mime types available.
- int mimeTypeList = KDE.KMimeType_allMimeTypes();
- int iterator = KDE.KMimeTypeList_begin( mimeTypeList );
- int listEnd = KDE.KMimeTypeList_end( mimeTypeList );
- while (KDE.KMimeTypeListIterator_equals( iterator, listEnd ) == 0) {
- // Get the next KMimeType from the list.
- int kMimeType = KDE.KMimeTypeListIterator_dereference( iterator );
-
- // Get the mime type name.
- int mimeName = KDE.KMimeType_name( kMimeType );
- mimeType = kde_convertQStringAndFree( mimeName );
-
- // Get the list of extension patterns.
- mimeExts = new Vector();
- String extension;
-
- // Add the mime type to the hash table with its extensions.
- int patternList = KDE.KMimeType_patterns( kMimeType );
- int patIterator = KDE.QStringList_begin( patternList );
- int patListEnd = KDE.QStringList_end( patternList );
- while (KDE.QStringListIterator_equals( patIterator, patListEnd ) == 0) {
- // Get the next extension pattern from the list.
- int patString = KDE.QStringListIterator_dereference( patIterator );
- extension = kde_convertQStringAndFree( patString );
- int period = extension.indexOf( '.' );
- if (period != -1) {
- mimeExts.addElement( extension.substring( period ) );
- }
-
- // Advance to the next pattern.
- KDE.QStringListIterator_increment( patIterator );
- }
- KDE.QStringListIterator_delete( patIterator );
- KDE.QStringListIterator_delete( patListEnd );
- KDE.QStringList_delete( patternList );
-
- // If there is at least one extension, save the mime type.
- if (mimeExts.size() > 0) {
- mimeInfo.put( mimeType, mimeExts );
- }
-
- // Advance to the next mime type.
- KDE.KMimeTypeListIterator_increment( iterator );
- }
- KDE.KMimeTypeListIterator_delete( iterator );
- KDE.KMimeTypeListIterator_delete( listEnd );
- KDE.KMimeTypeList_delete( mimeTypeList );
-
- return mimeInfo;
-}
-
-static String kde_convertQStringAndFree (int qString) {
- int qCString = KDE.QString_utf8 (qString);
- int charString = KDE.QCString_data (qCString);
-
- StringBuffer stringBuffer = new StringBuffer ();
- int length = KDE.strlen (charString);
- byte[] buffer = new byte [length];
- KDE.memmove (buffer, charString, length);
- /* Use the character encoding for the default locale */
- String answer = new String (Converter.mbcsToWcs (null, buffer));
-
- KDE.QCString_delete (qCString);
- KDE.QString_delete (qString);
- return answer;
-}
-
-/**
- * Launches the executable associated with the file in
- * the operating system. If the file is an executable,
- * then the executable is launched.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public static boolean launch (String fileName) {
- return launch( Display.getCurrent(), fileName );
-}
-
-/*
- * API: When support for multiple displays is added, this method will
- * become public and the original method above can be deprecated.
- */
-private static boolean launch( Display display, String fileName ) {
- if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
-
- // If the argument appears to be a data file (it has an extension)
- int index = fileName.lastIndexOf('.');
- if (index > 0) {
-
- // Find the associated program, if one is defined.
- String extension = fileName.substring( index );
- Program program = Program.findProgram( display, extension );
-
- // If the associated program is defined and can be executed, return.
- if (program != null && program.execute( fileName )) return true;
- }
-
- // Otherwise, the argument was the program itself.
- try {
- Compatibility.exec(fileName);
- return true;
- } catch (IOException e) {
- return false;
- }
-}
-
-/**
- * Executes the program with the file as the single argument
- * in the operating system. It is the responsibility of the
- * programmer to ensure that the file contains valid data for
- * this program.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public boolean execute (String fileName) {
- if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- switch (getDesktop( display )) {
- case DESKTOP_KDE: {
- String urlString = "file://" + fileName;
- /* Use the character encoding for the default locale */
- byte[] buffer = Converter.wcsToMbcs( null, urlString, true );
- int qString = KDE.QString_new( buffer );
- int url = KDE.KURL_new( qString );
- KDE.QString_delete( qString );
- /* Use the character encoding for the default locale */
- buffer = Converter.wcsToMbcs (null, name, true);
- int mimeTypeName = KDE.QString_new( buffer );
- int pid = KDE.KRun_runURL( url, mimeTypeName );
- KDE.KURL_delete( url );
- KDE.QString_delete( mimeTypeName );
- return (pid != 0);
- }
-
- case DESKTOP_GNOME: {
- // Parse the command into its individual arguments.
- String[] args = parseCommand( command );
- int fileArg = -1;
- int index;
- for (index=0; index < args.length; index++) {
- int j = args[ index ].indexOf( "%f" );
- if (j != -1) {
- String value = args[ index ];
- fileArg = index;
- args[ index ] = value.substring(0,j) + fileName + value.substring(j+2);
- }
- }
-
- // If a file name was given but the command did not have "%f"
- if ((fileName.length() > 0) && (fileArg < 0)) {
- String[] newArgs = new String[ args.length + 1 ];
- for (index=0; index < args.length; index++)
- newArgs[ index ] = args[ index ];
- newArgs[ args.length ] = fileName;
- args = newArgs;
- }
-
- // Execute the command.
- try {
- Compatibility.exec(args);
- } catch (IOException e) {
- return false;
- }
- return true;
- }
-
- case DESKTOP_CDE: {
- /* Use the character encoding for the default locale */
- byte[] action = Converter.wcsToMbcs( null, command, true );
- byte[] fileArg = Converter.wcsToMbcs( null, fileName, true );
- Integer shell = (Integer) display.getData( cdeShell );
- int actionID = 0;
- if (shell != null) {
- actionID = CDE.DtActionInvoke( shell.intValue(), action, fileArg, 1, null, null, null, 1, 0, 0 );
- }
- return (actionID != 0);
- }
- }
-
- return false;
-}
-
-/**
- * Returns the receiver's image data. This is the icon
- * that is associated with the reciever in the operating
- * system.
- *
- * @return the image data for the program, may be null
- */
-public ImageData getImageData () {
- String iconPath = null;
- switch (getDesktop( display )) {
- case DESKTOP_KDE: {
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, name, true);
- int mimeTypeName = KDE.QString_new( buffer );
- int mimeType = KDE.KMimeType_mimeType( mimeTypeName );
- KDE.QString_delete( mimeTypeName );
- if (mimeType == 0) return null;
- int mimeIcon = KDE.KMimeType_icon(mimeType, 0, 0);
- int loader = KDE.KGlobal_iconLoader();
- int path = KDE.KIconLoader_iconPath(loader, mimeIcon, KDE.KICON_SMALL, 1);
- if (path == 0) return null;
- iconPath = kde_convertQStringAndFree(path);
- break;
- }
-
- case DESKTOP_GNOME: {
- String fakeFileName = "file" + extension;
- String mime = gnome_getMimeType(fakeFileName);
- if (mime == null) return null;
- iconPath = gnome_getMimeValue(mime, "icon-filename");
- if (iconPath == null) return null;
- break;
- }
-
- case DESKTOP_CDE: {
- return cde_getImageData();
- }
-
- case DESKTOP_UNKNOWN: {
- return null;
- }
- }
- if (iconPath.endsWith ("xpm")) {
- int xDisplay = display.xDisplay;
- int screen = OS.XDefaultScreenOfDisplay( xDisplay );
- int fgPixel = OS.XWhitePixel( display.xDisplay, OS.XDefaultScreen( xDisplay ) );
- int bgPixel = OS.XBlackPixel( display.xDisplay, OS.XDefaultScreen( xDisplay ) );
- /* Use the character encoding for the default locale */
- byte [] iconName = Converter.wcsToMbcs (null, iconPath, true);
- int pixmap = OS.XmGetPixmap( screen, iconName, fgPixel, bgPixel );
- if (pixmap == OS.XmUNSPECIFIED_PIXMAP) return null;
- Image image = Image.motif_new (display, SWT.BITMAP, pixmap, 0);
- ImageData imageData = image.getImageData ();
-
- // The pixmap returned from XmGetPixmap is cached by Motif
- // and must be deleted by XmDestroyPixmap. Because it cannot
- // be deleted directly by XFreePixmap, image.dispose() must not
- // be called. The following code should do an equivalent image.dispose().
- OS.XmDestroyPixmap( screen, pixmap );
- return imageData;
- }
- try {
- return new ImageData (iconPath);
- } catch (Exception e) {
- return null;
- }
-}
-
-/**
- * Returns the receiver's name. This is as short and
- * descriptive a name as possible for the program. If
- * the program has no descriptive name, this string may
- * be the executable name, path or empty.
- *
- * @return an the name of the program
- */
-public String getName () {
- return name;
-}
-
-/**
- * Returns true if the receiver and the argument represent
- * the same program.
- *
- * @return true if the programs are the same
- */
-public boolean equals(Object other) {
- if (this == other) return true;
- if (other instanceof Program) {
- final Program program = (Program) other;
- return display == program.display && extension.equals(program.extension) &&
- name.equals(program.name) && command.equals(program.command);
- }
- return false;
-}
-
-/**
- * Returns a hash code suitable for this object.
- *
- * @return a hash code
- */
-public int hashCode() {
- return extension.hashCode() ^ name.hashCode() ^ command.hashCode() ^ display.hashCode();
-}
-
-public String toString () {
- return "Program {" + name + "}";
-}
-static boolean gnome_init () {
- try {
- Library.loadLibrary("swt-gnome");
- } catch (Throwable e) {
- return false;
- }
- return true;
-}
-
-/* CDE - Get Attribute Value
- *
- * This method takes a data type name and an attribute name, and returns
- * the corresponding attribute value.
- */
-
-static String cde_getAttribute(String dataType, String attrName) {
- /* Use the character encoding for the default locale */
- byte [] dataTypeBuf = Converter.wcsToMbcs (null, dataType, true);
- byte [] attrNameBuf = Converter.wcsToMbcs (null, attrName, true);
- byte [] optNameBuf = null;
- int attrValue = CDE.DtDtsDataTypeToAttributeValue( dataTypeBuf, attrNameBuf, optNameBuf );
- if (attrValue == 0) return null;
- int length = OS.strlen(attrValue);
- byte[] attrValueBuf = new byte[length];
- OS.memmove(attrValueBuf, attrValue, length);
- CDE.DtDtsFreeAttributeValue( attrValue );
- /* Use the character encoding for the default locale */
- return new String(Converter.mbcsToWcs(null, attrValueBuf));
-}
-
-/* CDE - Get Default Action of Data Type
- *
- * This method takes a data type and returns the corresponding default action.
- * By default, the "Open" action is used if it is available. If it is not
- * available, the first action in the list is used. Typically, if Open is not
- * available, there is usually only one action anyways.
- */
-
-static String cde_getAction(String dataType) {
- String action = null;
- String actions = cde_getAttribute( dataType, CDE.DtDTS_DA_ACTION_LIST );
- if (actions != null) {
- int index = actions.indexOf( "Open" );
- if (index != -1) {
- action = actions.substring( index, index+4 );
- }
- else {
- index = actions.indexOf( "," );
- if (index != -1) {
- action = actions.substring( 0, index );
- }
- else {
- action = actions;
- }
- }
- }
- return action;
-}
-
-/* CDE - Get Extension of Data Type
- *
- * This method takes a data type and returns the corresponding extension.
- * The extension is obtained from the NAME TEMPLATE attribute.
- */
-
-static String cde_getExtension(String dataType) {
- String fileExt = cde_getAttribute( dataType, CDE.DtDTS_DA_NAME_TEMPLATE );
- if (fileExt == null || fileExt.indexOf( "%s." ) == -1) return null;
- int dot = fileExt.indexOf( "." );
- return fileExt.substring( dot );
-}
-
-/* CDE - Get Data Types
- *
- * This method returns the list of data type names available.
- * Each data type returned is valid, meaning it has an action and
- * an extension.
- */
-
-static Hashtable cde_getDataTypeInfo() {
- Hashtable dataTypeInfo = new Hashtable();
- int index;
- int dataTypeList = CDE.DtDtsDataTypeNames();
- if (dataTypeList != 0) {
- // For each data type name in the list
- index = 0;
- int dataType = CDE.listElementAt( dataTypeList, index++ );
- while (dataType != 0) {
- int length = OS.strlen(dataType);
- byte[] dataTypeBuf = new byte[length];
- OS.memmove(dataTypeBuf, dataType, length);
- /* Use the character encoding for the default locale */
- String dataTypeName = new String(Converter.mbcsToWcs(null, dataTypeBuf));
-
- // The data type is valid if it is not an action, and it has an extension and an action.
- String extension = cde_getExtension( dataTypeName );
- if (!CDE.DtDtsDataTypeIsAction( dataTypeBuf ) &&
- extension != null && cde_getAction( dataTypeName ) != null) {
- Vector exts = new Vector();
- exts.addElement( extension );
- dataTypeInfo.put( dataTypeName, exts );
- }
- dataType = CDE.listElementAt( dataTypeList, index++ );
- }
- CDE.DtDtsFreeDataTypeNames( dataTypeList );
- }
-
- return dataTypeInfo;
-}
-
-/* CDE - Get Image Data
- *
- * This method returns the image data of the icon associated with
- * the data type. Since CDE supports multiple sizes of icons, several
- * attempts are made to locate an icon of the desired size and format.
- * CDE supports the sizes: tiny, small, medium and large. The best
- * search order is medium, large, small and then tiny. Althoug CDE supports
- * colour and monochrome bitmaps, only colour icons are tried. (The order is
- * defined by the cdeIconExt and cdeMaskExt arrays above.)
- */
-
-ImageData cde_getImageData() {
- int xDisplay = display.xDisplay;
- int screen = OS.XDefaultScreenOfDisplay( xDisplay );
- int fgPixel = OS.XWhitePixel( display.xDisplay, OS.XDefaultScreen( xDisplay ) );
- int bgPixel = OS.XBlackPixel( display.xDisplay, OS.XDefaultScreen( xDisplay ) );
-
- String icon = cde_getAttribute( name, CDE.DtDTS_DA_ICON );
- byte [] iconName;
- byte [] maskName = null;
- int pixmap = 0;
- for (int index = 0; index < cdeIconExt.length && pixmap == 0; index++) {
- /* Use the character encoding for the default locale */
- iconName = Converter.wcsToMbcs (null, icon + cdeIconExt[ index ], true);
- maskName = Converter.wcsToMbcs (null, icon + cdeMaskExt[ index ], true);
- pixmap = OS.XmGetPixmap( screen, iconName, fgPixel, bgPixel );
- if (pixmap == OS.XmUNSPECIFIED_PIXMAP) pixmap = 0;
- }
-
- if (pixmap != 0) {
- int type = SWT.ICON;
- // When creating the mask pixmap, do not use the screen's white and black
- // pixel for the foreground and background respectively, because on some
- // X servers (e.g., Solaris) pixel 0 is white and pixel 1 is black. Passing
- // (screen, name, whitePixel, blackPixel, 1) to get the mask pixmap will
- // result in an inverted mask. Instead explicitly use 1 (FG) and 0 (BG).
- int mask = OS.XmGetPixmapByDepth( screen, maskName, 1, 0, 1 );
- if (mask == OS.XmUNSPECIFIED_PIXMAP) {
- type = SWT.BITMAP;
- mask = 0;
- }
- Image image = Image.motif_new (display, type, pixmap, mask );
- ImageData imageData = image.getImageData();
-
- // The pixmaps returned from XmGetPixmap... are cached by Motif
- // and must be deleted by XmDestroyPixmap. Because they cannot
- // be deleted directly by XFreePixmap, image.dispose() must not
- // be called. The following code should do an equivalent image.dispose().
- OS.XmDestroyPixmap( screen, pixmap );
- if (mask != 0) OS.XmDestroyPixmap( screen, mask );
- return imageData;
- }
- return null;
-}
-
-/* CDE - Initialize
- *
- * This method loads the swt-cde library and initializes CDE itself.
- * The shell created fo DtAppInitialize is kept for DtActionInvoke calls.
- */
-static boolean cde_init( Display display ) {
- try {
- Library.loadLibrary("swt-cde");
- } catch (Throwable e) {
- return false;
- }
-
- /* Use the character encoding for the default locale */
- byte[] appName = Converter.wcsToMbcs( null, "SWT", true );
- int xtContext = OS.XtDisplayToApplicationContext( display.xDisplay );
- int widgetClass = OS.TopLevelShellWidgetClass();
- int shell = OS.XtAppCreateShell( appName, appName, widgetClass, display.xDisplay, null, 0 );
- boolean initOK = CDE.DtAppInitialize( xtContext, display.xDisplay, shell, appName, appName );
- if (!initOK) {
- OS.XtDestroyWidget( shell );
- }
- else {
- CDE.DtDbLoad();
- display.setData( cdeShell, new Integer(shell) );
- display.disposeExec( new Runnable() {
- public void run() {
- // This logic assumes that when the corresponding display is
- // being disposed, it must be the current one.
- Integer shell = (Integer) Display.getCurrent().getData( cdeShell );
- if (shell != null) {
- OS.XtDestroyWidget( shell.intValue() );
- }
- }
- });
- }
- return initOK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/photon/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/photon/org/eclipse/swt/program/Program.java
deleted file mode 100755
index 4e5cf5dc28..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/photon/org/eclipse/swt/program/Program.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package org.eclipse.swt.program;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.swt.widgets.Display;
-
-import java.util.Vector;
-import java.io.*;
-
-/**
- * Instances of this class represent programs and
- * their assoicated file extensions in the operating
- * system.
- */
-public final class Program {
- String name;
- String extension;
- String command;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Program () {
-}
-
-/**
- * Finds the program that is associated with an extension.
- * The extension may or may not begin with a '.'.
- *
- * @param extension the program extension
- * @return the program or nil
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static Program findProgram (String extension) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return null;
- return null;
-}
-
-/**
- * Answer all program extensions in the operating system.
- *
- * @return an array of extensions
- */
-public static String [] getExtensions () {
- return new String[0];
-}
-
-/**
- * Answers all available programs in the operating system.
- *
- * @return an array of programs
- */
-public static Program [] getPrograms () {
- Program [] programs = new Program [1024];
- byte [] key = new byte [1024];
- int index = 0, count = 0;
-// while (OS.RegEnumKey (OS.HKEY_CLASSES_ROOT, index, key, key.length) != OS.ERROR_NO_MORE_ITEMS) {
-// Program program = getProgram (key);
-// if (program != null) {
-// if (count == programs.length) {
-// Program [] newPrograms = new Program [programs.length + 1024];
-// System.arraycopy (programs, 0, newPrograms, 0, programs.length);
-// programs = newPrograms;
-// }
-// programs [count++] = program;
-// }
-// index++;
-// }
- if (count != programs.length) {
- Program [] newPrograms = new Program [count];
- System.arraycopy (programs, 0, newPrograms, 0, count);
- programs = newPrograms;
- }
- return programs;
-}
-
-/**
- * Launches the executable associated with the file in
- * the operating system. If the file is an executable,
- * then the executable is launched.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public static boolean launch (String fileName) {
- if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = fileName.lastIndexOf ('.');
- if (index == -1) return false;
- String extension = fileName.substring (index, fileName.length ());
- Program program = Program.findProgram (extension);
- if (program != null && program.execute (fileName)) return true;
- try {
- Compatibility.exec(fileName);
- return true;
- } catch (IOException e) {
- return false;
- }
-}
-
-/**
- * Executes the program with the file as the single argument
- * in the operating system. It is the responsibility of the
- * programmer to ensure that the file contains valid data for
- * this program.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public boolean execute (String fileName) {
- if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = command.indexOf ("%f");
- if (index == -1) return false;
- String prefix = command.substring (0, index);
- String suffix = command.substring (index + 2, command.length ());
- try {
- Compatibility.exec(prefix + '"' + fileName + '"' + suffix);
- } catch (IOException e) {
- return false;
- }
- return true;
-}
-
-/**
- * Returns the receiver's image data. This is the icon
- * that is associated with the reciever in the operating
- * system.
- *
- * @return the image data for the program, may be null
- */
-public ImageData getImageData () {
- return null;
-}
-
-/**
- * Returns the receiver's name. This is as short and
- * descriptive a name as possible for the program. If
- * the program has no descriptive name, this string may
- * be the executable name, path or empty.
- *
- * @return an the name of the program
- */
-public String getName () {
- return name;
-}
-
-/**
- * Returns true if the receiver and the argument represent
- * the same program.
- *
- * @return true if the programs are the same
- */
-public boolean equals(Object other) {
- if (this == other) return true;
- if (other instanceof Program) {
- final Program program = (Program) other;
- return extension.equals(program.extension) && name.equals(program.name) &&
- command.equals(program.command);
- }
- return false;
-}
-
-/**
- * Returns a hash code suitable for this object.
- *
- * @return a hash code
- */
-public int hashCode() {
- return extension.hashCode() ^ name.hashCode() ^ command.hashCode();
-}
-
-public String toString () {
- return "Program {" + name + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
deleted file mode 100755
index 47b389e2ac..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package org.eclipse.swt.program;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-import java.io.IOException;
-
-/**
- * Instances of this class represent programs and
- * their assoicated file extensions in the operating
- * system.
- */
-public final class Program {
- String name;
- String command;
- String iconName;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Program () {
-}
-
-/**
- * Finds the program that is associated with an extension.
- * The extension may or may not begin with a '.'.
- *
- * @param extension the program extension
- * @return the program or nil
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when extension is null</li>
- * </ul>
- */
-public static Program findProgram (String extension) {
- if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (extension.length () == 0) return null;
- if (extension.charAt (0) != '.') extension = "." + extension;
- /* Use the character encoding for the default locale */
- TCHAR key = new TCHAR (0, extension, true);
- int [] phkResult = new int [1];
- if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
- return null;
- }
- int [] lpcbData = new int [] {256};
- TCHAR lpData = new TCHAR (0, lpcbData [0]);
- int result = OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData);
- OS.RegCloseKey (phkResult [0]);
- if (result != 0) return null;
- return getProgram (lpData.toString (0, lpData.strlen ()));
-}
-
-/**
- * Answer all program extensions in the operating system.
- *
- * @return an array of extensions
- */
-public static String [] getExtensions () {
- String [] extensions = new String [1024];
- /* Use the character encoding for the default locale */
- TCHAR lpName = new TCHAR (0, 1024);
- int [] lpcName = new int [] {lpName.length ()};
- FILETIME ft = new FILETIME ();
- int dwIndex = 0, count = 0;
- while (OS.RegEnumKeyEx (OS.HKEY_CLASSES_ROOT, dwIndex, lpName, lpcName, null, null, null, ft) != OS.ERROR_NO_MORE_ITEMS) {
- String extension = lpName.toString (0, lpcName [0]);
- lpcName [0] = lpName.length ();
- if (extension.length () > 0 && extension.charAt (0) == '.') {
- if (count == extensions.length) {
- String [] newExtensions = new String [extensions.length + 1024];
- System.arraycopy (extensions, 0, newExtensions, 0, extensions.length);
- extensions = newExtensions;
- }
- extensions [count++] = extension;
- }
- dwIndex++;
- }
- if (count != extensions.length) {
- String [] newExtension = new String [count];
- System.arraycopy (extensions, 0, newExtension, 0, count);
- extensions = newExtension;
- }
- return extensions;
-}
-
-static String getKeyValue (String string) {
- /* Use the character encoding for the default locale */
- TCHAR key = new TCHAR (0, string, true);
- int [] phkResult = new int [1];
- if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
- return null;
- }
- String result = null;
- int [] lpcbData = new int [1];
- if (OS.RegQueryValueEx (phkResult [0], (TCHAR) null, 0, null, null, lpcbData) == 0) {
- /* Use the character encoding for the default locale */
- TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof);
- if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
- int length = Math.max(0, lpData.length () - 1);
- result = lpData.toString (0, length);
- }
- }
- if (phkResult [0] != 0) OS.RegCloseKey (phkResult [0]);
- return result;
-}
-
-static Program getProgram (String key) {
-
- /* Name */
- String name = getKeyValue (key);
- if (name == null || name.length () == 0) return null;
-
- /* Command */
- String COMMAND = "\\shell\\open\\command";
- String command = getKeyValue (key + COMMAND);
- if (command == null || command.length () == 0) return null;
-
- /* Icon */
- String DEFAULT_ICON = "\\DefaultIcon";
- String iconName = getKeyValue (key + DEFAULT_ICON);
- if (iconName == null || iconName.length () == 0) return null;
-
- Program program = new Program ();
- program.name = name;
- program.command = command;
- program.iconName = iconName;
- return program;
-}
-
-/**
- * Answers all available programs in the operating system.
- *
- * @return an array of programs
- */
-public static Program [] getPrograms () {
- Program [] programs = new Program [1024];
- /* Use the character encoding for the default locale */
- TCHAR lpName = new TCHAR (0, 1024);
- int [] lpcName = new int [] {lpName.length ()};
- FILETIME ft = new FILETIME ();
- int dwIndex = 0, count = 0;
- while (OS.RegEnumKeyEx (OS.HKEY_CLASSES_ROOT, dwIndex, lpName, lpcName, null, null, null, ft) != OS.ERROR_NO_MORE_ITEMS) {
- String path = lpName.toString (0, lpcName [0]);
- lpcName [0] = lpName.length ();
- Program program = getProgram (path);
- if (program != null) {
- if (count == programs.length) {
- Program [] newPrograms = new Program [programs.length + 1024];
- System.arraycopy (programs, 0, newPrograms, 0, programs.length);
- programs = newPrograms;
- }
- programs [count++] = program;
- }
- dwIndex++;
- }
- if (count != programs.length) {
- Program [] newPrograms = new Program [count];
- System.arraycopy (programs, 0, newPrograms, 0, count);
- programs = newPrograms;
- }
- return programs;
-}
-
-/**
- * Launches the executable associated with the file in
- * the operating system. If the file is an executable,
- * then the executable is launched.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public static boolean launch (String fileName) {
- if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Use the character encoding for the default locale */
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer1 = new TCHAR (0, "open", true);
- int byteCount1 = buffer1.length () * TCHAR.sizeof;
- int lpVerb = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount1);
- OS.MoveMemory (lpVerb, buffer1, byteCount1);
- TCHAR buffer2 = new TCHAR (0, fileName, true);
- int byteCount2 = buffer2.length () * TCHAR.sizeof;
- int lpFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount2);
- OS.MoveMemory (lpFile, buffer2, byteCount2);
-
- SHELLEXECUTEINFO info = new SHELLEXECUTEINFO ();
- info.cbSize = SHELLEXECUTEINFO.sizeof;
- info.lpVerb = lpVerb;
- info.lpFile = lpFile;
- info.nShow = OS.SW_SHOW;
-
- boolean result = OS.ShellExecuteEx (info);
-
- if (lpVerb != 0) OS.HeapFree (hHeap, 0, lpVerb);
- if (lpFile != 0) OS.HeapFree (hHeap, 0, lpFile);
-
- return result;
-}
-
-/**
- * Executes the program with the file as the single argument
- * in the operating system. It is the responsibility of the
- * programmer to ensure that the file contains valid data for
- * this program.
- *
- * @param fileName the file or program name
- * @return <code>true</code> if the file is launched, otherwise <code>false</code>
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
- * </ul>
- */
-public boolean execute (String fileName) {
- if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- boolean quote = true;
- String prefix = command, suffix = "";
- int index = command.indexOf ("%1");
- if (index != -1) {
- int count=0;
- int i=index + 2, length = command.length ();
- while (i < length) {
- if (command.charAt (i) == '"') count++;
- i++;
- }
- quote = count % 2 == 0;
- prefix = command.substring (0, index);
- suffix = command.substring (index + 2, length);
- }
- if (quote) fileName = " \"" + fileName + "\"";
- try {
- Compatibility.exec(prefix + fileName + suffix);
- } catch (IOException e) {
- return false;
- }
- return true;
-}
-
-/**
- * Returns the receiver's image data. This is the icon
- * that is associated with the reciever in the operating
- * system.
- *
- * @return the image data for the program, may be null
- */
-public ImageData getImageData () {
- int nIconIndex = 0;
- String fileName = iconName;
- int index = iconName.indexOf (',');
- if (index != -1) {
- fileName = iconName.substring (0, index);
- String iconIndex = iconName.substring (index + 1, iconName.length ()).trim ();
- try {
- nIconIndex = Integer.parseInt (iconIndex);
- } catch (NumberFormatException e) {};
- }
- /* Use the character encoding for the default locale */
- TCHAR lpszFile = new TCHAR (0, fileName, true);
- int [] phiconSmall = new int[1], phiconLarge = null;
- OS.ExtractIconEx (lpszFile, nIconIndex, phiconLarge, phiconSmall, 1);
- if (phiconSmall [0] == 0) return null;
- Image image = Image.win32_new (null, SWT.ICON, phiconSmall[0]);
- ImageData imageData = image.getImageData ();
- image.dispose ();
- return imageData;
-}
-
-/**
- * Returns the receiver's name. This is as short and
- * descriptive a name as possible for the program. If
- * the program has no descriptive name, this string may
- * be the executable name, path or empty.
- *
- * @return an the name of the program
- */
-public String getName () {
- return name;
-}
-
-/**
- * Returns true if the receiver and the argument represent
- * the same program.
- *
- * @return true if the programs are the same
- */
-public boolean equals(Object other) {
- if (this == other) return true;
- if (other instanceof Program) {
- final Program program = (Program) other;
- return name.equals(program.name) && command.equals(program.command)
- && iconName.equals(program.iconName);
- }
- return false;
-}
-
-/**
- * Returns a hash code suitable for this object.
- *
- * @return a hash code
- */
-public int hashCode() {
- return name.hashCode() ^ command.hashCode() ^ iconName.hashCode();
-}
-
-public String toString () {
- return "Program {" + name + "}";
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c
deleted file mode 100755
index 255e75adbb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * Callback implementation.
- */
-#include "swt.h"
-#include "callback.h"
-
-/* --------------- callback globals ----------------- */
-
-SWT_CALLBACKINFO dllCallbackInfo[MAX_CALLBACKS];
-jfieldID objectID;
-jfieldID addressID;
-jfieldID methodID;
-jfieldID signatureID;
-jfieldID isStaticID;
-jfieldID argCountID;
-jfieldID isArrayBasedID;
-int callbackCached;
-int initialized;
-int counter;
-int CallbacksEnabled = 1;
-
-/* --------------- callback functions --------------- */
-
-/* Function name from index and number of arguments */
-#define FN(index, args) fn##index##_##args
-
-/**
- * Functions templates
- *
- * NOTE: If the maximum number of arguments changes (MAX_ARGS), the number
- * of function templates has to change accordinglly.
- */
-
-/* Function template with no arguments */
-#define FN_0(index) RETURN_TYPE FN(index, 0)() { return RETURN_CAST callback(index); }
-
-/* Function template with 1 argument */
-#define FN_1(index) RETURN_TYPE FN(index, 1)(int p1) { return RETURN_CAST callback(index, p1); }
-
-/* Function template with 2 arguments */
-#define FN_2(index) RETURN_TYPE FN(index, 2)(int p1, int p2) { return RETURN_CAST callback(index, p1, p2); }
-
-/* Function template with 3 arguments */
-#define FN_3(index) RETURN_TYPE FN(index, 3)(int p1, int p2, int p3) { return RETURN_CAST callback(index, p1, p2, p3); }
-
-/* Function template with 4 arguments */
-#define FN_4(index) RETURN_TYPE FN(index, 4)(int p1, int p2, int p3, int p4) { return RETURN_CAST callback(index, p1, p2, p3, p4); }
-
-/* Function template with 5 arguments */
-#define FN_5(index) RETURN_TYPE FN(index, 5)(int p1, int p2, int p3, int p4, int p5) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5); }
-
-/* Function template with 6 arguments */
-#define FN_6(index) RETURN_TYPE FN(index, 6)(int p1, int p2, int p3, int p4, int p5, int p6) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6); }
-
-/* Function template with 7 arguments */
-#define FN_7(index) RETURN_TYPE FN(index, 7)(int p1, int p2, int p3, int p4, int p5, int p6, int p7) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7); }
-
-/* Function template with 8 arguments */
-#define FN_8(index) RETURN_TYPE FN(index, 8)(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7, p8); }
-
-/* Function template with 9 arguments */
-#define FN_9(index) RETURN_TYPE FN(index, 9)(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
-
-/* Function template with 10 arguments */
-#define FN_10(index) RETURN_TYPE FN(index, 10) (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
-
-/* Function template with 11 arguments */
-#define FN_11(index) RETURN_TYPE FN(index, 11) (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
-
-/* Function template with 12 arguments */
-#define FN_12(index) RETURN_TYPE FN(index, 12) (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12) { return RETURN_CAST callback(index, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
-
-/**
- * Define all functions with the specified number of arguments.
- *
- * NOTE: If the maximum number of callbacks changes (MAX_CALLBACKS),
- * this macro has to be updated.
- */
-#define FN_BLOCK(args) FN_##args##(0) FN_##args##(1) FN_##args##(2) FN_##args##(3) FN_##args##(4) FN_##args##(5) FN_##args##(6) FN_##args##(7) FN_##args##(8) FN_##args##(9) FN_##args##(10) FN_##args##(11) FN_##args##(12) FN_##args##(13) FN_##args##(14) FN_##args##(15) FN_##args##(16) FN_##args##(17) FN_##args##(18) FN_##args##(19) FN_##args##(20) FN_##args##(21) FN_##args##(22) FN_##args##(23) FN_##args##(24) FN_##args##(25) FN_##args##(26) FN_##args##(27) FN_##args##(28) FN_##args##(29) FN_##args##(30) FN_##args##(31) FN_##args##(32) FN_##args##(33) FN_##args##(34) FN_##args##(35) FN_##args##(36) FN_##args##(37) FN_##args##(38) FN_##args##(39) FN_##args##(40) FN_##args##(41) FN_##args##(42) FN_##args##(43) FN_##args##(44) FN_##args##(45) FN_##args##(46) FN_##args##(47) FN_##args##(48) FN_##args##(49) FN_##args##(50) FN_##args##(51) FN_##args##(52) FN_##args##(53) FN_##args##(54) FN_##args##(55) FN_##args##(56) FN_##args##(57) FN_##args##(58) FN_##args##(59) FN_##args##(60) FN_##args##(61) FN_##args##(62) FN_##args##(63) FN_##args##(64) FN_##args##(65) FN_##args##(66) FN_##args##(67) FN_##args##(68) FN_##args##(69) FN_##args##(70) FN_##args##(71) FN_##args##(72) FN_##args##(73) FN_##args##(74) FN_##args##(75) FN_##args##(76) FN_##args##(77) FN_##args##(78) FN_##args##(79) FN_##args##(80) FN_##args##(81) FN_##args##(82) FN_##args##(83) FN_##args##(84) FN_##args##(85) FN_##args##(86) FN_##args##(87) FN_##args##(88) FN_##args##(89) FN_##args##(90) FN_##args##(91) FN_##args##(92) FN_##args##(93) FN_##args##(94) FN_##args##(95) FN_##args##(96) FN_##args##(97) FN_##args##(98) FN_##args##(99) FN_##args##(100) FN_##args##(101) FN_##args##(102) FN_##args##(103) FN_##args##(104) FN_##args##(105) FN_##args##(106) FN_##args##(107) FN_##args##(108) FN_##args##(109) FN_##args##(110) FN_##args##(111) FN_##args##(112) FN_##args##(113) FN_##args##(114) FN_##args##(115) FN_##args##(116) FN_##args##(117) FN_##args##(118) FN_##args##(119) FN_##args##(120) FN_##args##(121) FN_##args##(122) FN_##args##(123) FN_##args##(124) FN_##args##(125) FN_##args##(126) FN_##args##(127)
-
-/**
- * Define all callback functions.
- *
- * NOTE: If the maximum number of arguments changes (MAX_ARGS), the following
- * has to change accordinglly.
- */
-FN_BLOCK(0)
-FN_BLOCK(1)
-FN_BLOCK(2)
-FN_BLOCK(3)
-FN_BLOCK(4)
-FN_BLOCK(5)
-FN_BLOCK(6)
-FN_BLOCK(7)
-FN_BLOCK(8)
-FN_BLOCK(9)
-FN_BLOCK(10)
-FN_BLOCK(11)
-FN_BLOCK(12)
-
-/**
- * Initialize the function pointers for the callback routines.
- *
- * NOTE: If MAX_ARGS or MAX_CALLBACKS changes, the following has to be updated.
- */
-#define FN_A_BLOCK(args) {(int *)FN(0, args),(int *)FN(1, args),(int *)FN(2, args),(int *)FN(3, args),(int *)FN(4, args),(int *)FN(5, args),(int *)FN(6, args),(int *)FN(7, args),(int *)FN(8, args),(int *)FN(9, args),(int *)FN(10, args),(int *)FN(11, args),(int *)FN(12, args),(int *)FN(13, args),(int *)FN(14, args),(int *)FN(15, args),(int *)FN(16, args),(int *)FN(17, args),(int *)FN(18, args),(int *)FN(19, args),(int *)FN(20, args),(int *)FN(21, args),(int *)FN(22, args),(int *)FN(23, args),(int *)FN(24, args),(int *)FN(25, args),(int *)FN(26, args),(int *)FN(27, args),(int *)FN(28, args),(int *)FN(29, args),(int *)FN(30, args),(int *)FN(31, args),(int *)FN(32, args),(int *)FN(33, args),(int *)FN(34, args),(int *)FN(35, args),(int *)FN(36, args),(int *)FN(37, args),(int *)FN(38, args),(int *)FN(39, args),(int *)FN(40, args),(int *)FN(41, args),(int *)FN(42, args),(int *)FN(43, args),(int *)FN(44, args),(int *)FN(45, args),(int *)FN(46, args),(int *)FN(47, args),(int *)FN(48, args),(int *)FN(49, args),(int *)FN(50, args),(int *)FN(51, args),(int *)FN(52, args),(int *)FN(53, args),(int *)FN(54, args),(int *)FN(55, args),(int *)FN(56, args),(int *)FN(57, args),(int *)FN(58, args),(int *)FN(59, args),(int *)FN(60, args),(int *)FN(61, args),(int *)FN(62, args),(int *)FN(63, args),(int *)FN(64, args),(int *)FN(65, args),(int *)FN(66, args),(int *)FN(67, args),(int *)FN(68, args),(int *)FN(69, args),(int *)FN(70, args),(int *)FN(71, args),(int *)FN(72, args),(int *)FN(73, args),(int *)FN(74, args),(int *)FN(75, args),(int *)FN(76, args),(int *)FN(77, args),(int *)FN(78, args),(int *)FN(79, args),(int *)FN(80, args),(int *)FN(81, args),(int *)FN(82, args),(int *)FN(83, args),(int *)FN(84, args),(int *)FN(85, args),(int *)FN(86, args),(int *)FN(87, args),(int *)FN(88, args),(int *)FN(89, args),(int *)FN(90, args),(int *)FN(91, args),(int *)FN(92, args),(int *)FN(93, args),(int *)FN(94, args),(int *)FN(95, args),(int *)FN(96, args),(int *)FN(97, args),(int *)FN(98, args),(int *)FN(99, args),(int *)FN(100, args),(int *)FN(101, args),(int *)FN(102, args),(int *)FN(103, args),(int *)FN(104, args),(int *)FN(105, args),(int *)FN(106, args),(int *)FN(107, args),(int *)FN(108, args),(int *)FN(109, args),(int *)FN(110, args),(int *)FN(111, args),(int *)FN(112, args),(int *)FN(113, args),(int *)FN(114, args),(int *)FN(115, args),(int *)FN(116, args),(int *)FN(117, args),(int *)FN(118, args),(int *)FN(119, args),(int *)FN(120, args),(int *)FN(121, args),(int *)FN(122, args),(int *)FN(123, args),(int *)FN(124, args),(int *)FN(125, args),(int *)FN(126, args),(int *)FN(127, args)},
-
-int * fnx_array[MAX_ARGS+1][MAX_CALLBACKS] = {
- FN_A_BLOCK(0)
- FN_A_BLOCK(1)
- FN_A_BLOCK(2)
- FN_A_BLOCK(3)
- FN_A_BLOCK(4)
- FN_A_BLOCK(5)
- FN_A_BLOCK(6)
- FN_A_BLOCK(7)
- FN_A_BLOCK(8)
- FN_A_BLOCK(9)
- FN_A_BLOCK(10)
- FN_A_BLOCK(11)
- FN_A_BLOCK(12)
-};
-
-
-/* --------------- callback class calls --------------- */
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: bind
- * Signature: (Lorg/eclipse/swt/internal/Callback;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_Callback_bind
- (JNIEnv *env, jclass that, jobject lpCallback)
-/*
-** The methodID is computed once during the bind and will be valid
-** unless the Callback class is reloaded.
-*/
-{
- DECL_GLOB(pGlob)
- int i;
- jclass javaClass;
- jobject javaObject, javaMethod, javaSignature;
- jboolean isStatic, isArrayBased;
- jint argCount;
- jmethodID mid;
- const char *methodString, *sigString;
-
- javaClass = that;
- if (!PGLOB(callbackCached)) {
- PGLOB(objectID) = (*env)->GetFieldID(env,javaClass,"object","Ljava/lang/Object;");
- PGLOB(addressID) = (*env)->GetFieldID(env,javaClass,"address","I");
- PGLOB(methodID) = (*env)->GetFieldID(env,javaClass,"method","Ljava/lang/String;");
- PGLOB(signatureID) = (*env)->GetFieldID(env,javaClass,"signature","Ljava/lang/String;");
- PGLOB(isStaticID) = (*env)->GetFieldID(env,javaClass,"isStatic","Z");
- PGLOB(argCountID) = (*env)->GetFieldID(env,javaClass,"argCount","I");
- PGLOB(isArrayBasedID) = (*env)->GetFieldID(env,javaClass,"isArrayBased","Z");
- PGLOB(callbackCached) = 1;
- }
- javaObject = (*env)->GetObjectField(env,lpCallback,PGLOB(objectID));
- javaMethod = (*env)->GetObjectField(env,lpCallback,PGLOB(methodID));
- javaSignature = (*env)->GetObjectField(env,lpCallback,PGLOB(signatureID));
- isStatic = (*env)->GetBooleanField(env,lpCallback,PGLOB(isStaticID));
- argCount = (*env)->GetIntField(env,lpCallback,PGLOB(argCountID));
- isArrayBased = (*env)->GetBooleanField(env,lpCallback,PGLOB(isArrayBasedID));
- methodString = (const char *) (*env)->GetStringUTFChars(env, javaMethod, NULL);
- sigString = (const char *) (*env)->GetStringUTFChars(env, javaSignature, NULL);
- if (isStatic) {
- mid = (*env)->GetStaticMethodID(env, javaObject, methodString, sigString);
- } else {
- javaClass = (*env)->GetObjectClass(env,javaObject);
- /* note that this call is reusing javaClass */
- mid = (*env)->GetMethodID(env, javaClass, methodString, sigString);
- }
- (*env)->ReleaseStringUTFChars(env, javaMethod, methodString);
- (*env)->ReleaseStringUTFChars(env, javaSignature, sigString);
- if (PGLOB(initialized)==0) {
- memset((void *)&PGLOB(dllCallbackInfo), 0, sizeof(PGLOB(dllCallbackInfo)));
- PGLOB(initialized) = 1;
- }
- for (i=0; i<MAX_CALLBACKS; i++) {
- if (!PGLOB(dllCallbackInfo)[i].callin) {
- PGLOB(dllCallbackInfo)[i].callin = (*env)->NewGlobalRef(env,lpCallback);
- PGLOB(dllCallbackInfo)[i].env = env;
- PGLOB(dllCallbackInfo)[i].methodID = mid;
-
- return (jint) fnx_array[argCount][i];
- }
- }
- fprintf(stderr, "bind fail, no free callback slot ******* \n");
- return 0; /* this means there was no free callback slot */
-}
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: unbind
- * Signature: (Lorg/eclipse/swt/internal/Callback;)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_Callback_unbind
- (JNIEnv *env, jclass that, jobject lpCallback)
-{
- DECL_GLOB(pGlob)
- int i, address, argCount;
- if (!PGLOB(callbackCached)) return;
-
- address = (*env)->GetIntField(env,lpCallback,PGLOB(addressID));
- argCount = (*env)->GetIntField(env,lpCallback,PGLOB(argCountID));
-
- for (i=0; i<MAX_CALLBACKS; i++) {
- if ((int)fnx_array[argCount][i] == address) {
- (*env)->DeleteGlobalRef(env, PGLOB(dllCallbackInfo)[i].callin);
- PGLOB(dllCallbackInfo)[i].callin = 0;
- PGLOB(dllCallbackInfo)[i].env = 0;
- PGLOB(dllCallbackInfo)[i].methodID = 0;
- }
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: setEnabled
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_Callback_setEnabled
- (JNIEnv *env, jclass that, jboolean enable)
-{
- CallbacksEnabled = enable;
-}
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: getEnabled
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_Callback_getEnabled
- (JNIEnv *env, jclass that, jboolean enable)
-{
- return (jboolean)CallbacksEnabled;
-}
-
-int callback(int index, ...)
-{
- if (!CallbacksEnabled) {
- return 0;
- } else {
-
- DECL_GLOB(pGlob)
- jobject callback = PGLOB(dllCallbackInfo)[index].callin;
- JNIEnv *env = PGLOB(dllCallbackInfo)[index].env;
- jmethodID mid = PGLOB(dllCallbackInfo)[index].methodID;
- jobject javaObject;
- jboolean isStatic, isArrayBased;
-
- int result = 0;
- va_list vl;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "* callback starting %d\n", PGLOB(counter)++);
-#endif
-
- /* An exception has already occurred. Allow the stack to unwind so that
- the exception will be thrown in Java */
- if ((*env)->ExceptionOccurred(env)) {
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "************ java exception occurred\n");
-#endif
-
- return 0;
- }
-
- javaObject = (*env)->GetObjectField(env,callback,PGLOB(objectID));
- isStatic = ((*env)->GetBooleanField(env,callback,PGLOB(isStaticID))) != 0;
- isArrayBased = ((*env)->GetBooleanField(env,callback,PGLOB(isArrayBasedID))) != 0;
-
- va_start(vl, index);
- if (isArrayBased) {
- int i;
- jint argCount = (*env)->GetIntField(env,callback,PGLOB(argCountID));
- jintArray javaArray = (*env)->NewIntArray(env,argCount);
- jint *elements = (*env)->GetIntArrayElements(env,javaArray,NULL);
- for (i=0; i<argCount; i++) {
- elements[i] = va_arg(vl, jint);
- }
- (*env)->ReleaseIntArrayElements(env, javaArray, elements, 0);
- if (isStatic) {
- result = (*env)->CallStaticIntMethod(env, javaObject, mid, javaArray);
- } else {
- result = (*env)->CallIntMethod(env, javaObject, mid, javaArray);
- }
- (*env)->DeleteLocalRef(env, javaArray);
- } else {
- if (isStatic) {
- result = (*env)->CallStaticIntMethodV(env, javaObject, mid, vl);
- } else {
- result = (*env)->CallIntMethodV(env, javaObject, mid, vl);
- }
- }
- va_end(vl);
- /* This call may be called many times before we return to Java.
- We have to explicitly delete local references to avoid GP's
- in the JDK and IBM Hursley VM.
- */
- (*env)->DeleteLocalRef(env,javaObject);
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "* callback exiting %d\n", --PGLOB(counter));
-#endif
- return result;
- }
-}
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: reset
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_Callback_reset
- (JNIEnv *env, jclass that)
-{
- DECL_GLOB(pGlob)
- memset((void *)&PGLOB(dllCallbackInfo), 0, sizeof(PGLOB(dllCallbackInfo)));
-}
-
-/*
- * Class: org_eclipse_swt_internal_Callback
- * Method: getPlatform
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_eclipse_swt_internal_Callback_getPlatform
- (JNIEnv *env, jclass that)
-{
- return (*env)->NewStringUTF(env, PLATFORM);
-}
-
-/* ------------- callback class calls end --------------- */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h
deleted file mode 100755
index 8332fe880d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * Callback implementation.
- */
-#ifndef INC_callback_H
-#define INC_callback_H
-
-int callback(int index, ...);
-
-#if defined (WIN32) || defined (_WIN32_WCE)
-#include "windows.h"
-#define PLATFORM "win32"
-#define RETURN_TYPE LRESULT CALLBACK
-#define RETURN_CAST (LRESULT)
-#endif
-
-#ifdef MOTIF
-#define PLATFORM "motif"
-#endif
-
-#ifdef GTK
-#define PLATFORM "gtk"
-#endif
-
-#ifdef PHOTON
-#define PLATFORM "photon"
-#endif
-
-#ifndef PLATFORM
-#define PLATFORM "unknown"
-#endif
-
-#ifndef RETURN_TYPE
-#define RETURN_TYPE int
-#endif
-
-#ifndef RETURN_CAST
-#define RETURN_CAST
-#endif
-
-#define MAX_CALLBACKS 128
-#define MAX_ARGS 12
-
-typedef struct SWT_CALLBACKINFO {
- jobject callin;
- JNIEnv *env;
- jmethodID methodID;
-} SWT_CALLBACKINFO;
-
-#endif /* ifndef INC_callback_H */
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
deleted file mode 100644
index 75558d7c4e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
+++ /dev/null
@@ -1,4 +0,0 @@
-maj_ver=2
-min_ver=024
-bld_num=0
-comma_ver=2,0,2,4
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h
deleted file mode 100644
index f2457ceba4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * swt.h
- *
- * This file contains the global macro declarations for the
- * SWT library.
- *
- */
-
-#ifndef INC_swt_H
-#define INC_swt_H
-
-#include "jni.h"
-
-/* For debugging */
-#define DEBUG_PRINTF(x)
-/*#define DEBUG_PRINTF(x) printf x; */
-
-/* define this to print out debug statements */
-/* #define DEBUG_CALL_PRINTS */
-
-#ifdef DEBUG_CALL_PRINTS
-#define DEBUG_CALL(func) fprintf(stderr, func);
-#else
-#define DEBUG_CALL(func)
-#endif
-
-#define DECL_GLOB(pSym)
-#define PGLOB(x) x
-
-#endif /* ifndef INC_swt_H */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
deleted file mode 100755
index 922fb3b20b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
+++ /dev/null
@@ -1,1924 +0,0 @@
-package org.eclipse.swt;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-
-/**
- * This class provides access to a small number of SWT system-wide
- * methods, and in addition defines the public constants provided
- * by SWT.
- * <p>
- * By defining constants like UP and DOWN in a single class, SWT
- * can share common names and concepts at the same time minimizing
- * the number of classes, names and constants for the application
- * programmer.
- * </p><p>
- * Note that, some of the constants provided by this class represent
- * optional, appearance related aspects of widgets which are available
- * either only on some window systems, or for a differing set of
- * widgets on each window system. These constants are marked
- * as <em>HINT</em>s. The set of widgets which support a particular
- * <em>HINT</em> may change from release to release, although we typically
- * will not withdraw support for a <em>HINT</em> once it is made available.
- * </p>
- */
-
-/* NOTE:
- * Good javadoc coding style is to put the values of static final
- * constants in the comments. This re-inforces the fact that
- * consumers are allowed to rely on the value (and they must
- * since the values are compiled inline in their code). We
- * can <em>not</em> change the values of these constants between
- * releases.
- */
-public class SWT {
-
- /* Widget Event Constants */
-
- /**
- * key down event type (value is 1)
- */
- public static final int KeyDown = 1;
-
- /**
- * key up event type (value is 2)
- */
- public static final int KeyUp = 2;
-
- /**
- * mouse down event type (value is 3)
- */
- public static final int MouseDown = 3;
-
- /**
- * mouse up event type (value is 4)
- */
- public static final int MouseUp = 4;
-
- /**
- * mouse move event type (value is 5)
- */
- public static final int MouseMove = 5;
-
- /**
- * mouse enter event type (value is 6)
- */
- public static final int MouseEnter = 6;
-
- /**
- * Mouse exit event type (value is 7)
- */
- public static final int MouseExit = 7;
-
- /**
- * mouse double click event type (value is 8)
- */
- public static final int MouseDoubleClick = 8;
-
- /**
- * paint event type (value is 9)
- */
- public static final int Paint = 9;
-
- /**
- * move event type (value is 10)
- */
- public static final int Move = 10;
-
- /**
- * resize event type (value is 11)
- */
- public static final int Resize = 11;
-
- /**
- * dispose event type (value is 12)
- */
- public static final int Dispose = 12;
-
- /**
- * selection event type (value is 13)
- */
- public static final int Selection = 13;
-
- /**
- * default selection event type (value is 14)
- */
- public static final int DefaultSelection = 14;
-
- /**
- * focus in event type (value is 15)
- */
- public static final int FocusIn = 15;
-
- /**
- * focus out event type (value is 16)
- */
- public static final int FocusOut = 16;
-
- /**
- * expand event type (value is 17)
- */
- public static final int Expand = 17;
-
- /**
- * collapse event type (value is 18)
- */
- public static final int Collapse = 18;
-
- /**
- * iconify event type (value is 19)
- */
- public static final int Iconify = 19;
-
- /**
- * de-iconify event type (value is 20)
- */
- public static final int Deiconify = 20;
-
- /**
- * close event type (value is 21)
- */
- public static final int Close = 21;
-
- /**
- * show event type (value is 22)
- */
- public static final int Show = 22;
-
- /**
- * hide event type (value is 23)
- */
- public static final int Hide = 23;
-
- /**
- * modify event type (value is 24)
- */
- public static final int Modify = 24;
-
- /**
- * verify event type (value is 25)
- */
- public static final int Verify = 25;
-
- /**
- * activate event type (value is 26)
- */
- public static final int Activate = 26;
-
- /**
- * deactivate event type (value is 27)
- */
- public static final int Deactivate = 27;
-
- /**
- * help event type (value is 28)
- */
- public static final int Help = 28;
-
- /**
- * drag detect event type (value is 29)
- */
- public static final int DragDetect = 29;
-
- /**
- * arm event type (value is 30)
- */
- public static final int Arm = 30;
-
- /**
- * traverse event type (value is 31)
- */
- public static final int Traverse = 31;
-
- /**
- * mouse hover event type (value is 32)
- */
- public static final int MouseHover = 32;
-
- /**
- * hardware key down event type (value is 33)
- */
- public static final int HardKeyDown = 33;
-
- /**
- * hardware key up event type (value is 34)
- */
- public static final int HardKeyUp = 34;
-
- /* Event Details */
-
- /**
- * a constant known to be zero (0), used in operations which
- * take bit flags to indicate that "no bits are set"
- */
- public static final int NONE = 0;
-
- /**
- * indicates that a user-interface component is being dragged,
- * for example dragging the thumb of a scroll bar (value is 1)
- */
- public static final int DRAG = 1;
-
- /**
- * a constant known to be zero (0), used in operations which
- * take pointers to indicate a null argument
- */
- public static final int NULL = 0;
-
- /**
- * indicates that a default should be used (value is -1)
- */
- public static final int DEFAULT = -1;
-
- /**
- * <code>Menu</code> style constant for menu bar behavior (value is 1&lt;&lt;1)
- */
- public static final int BAR = 1 << 1;
-
- /**
- * <code>Menu</code> style constant for drop down menu behavior (value is 1&lt;&lt;2)
- */
- public static final int DROP_DOWN = 1 << 2;
-
- /**
- * <code>Menu</code> style constant for pop up menu behavior (value is 1&lt;&lt;3)
- */
- public static final int POP_UP = 1 << 3;
-
- /**
- * <code>MenuItem</code> style constant for line separator behavior (value is 1&lt;&lt;1)
- */
- public static final int SEPARATOR = 1 << 1;
-
- /* Button, MenuItem Constants */
-
- /**
- * <code>Button</code> style constant for toggle button behavior (value is 1&lt;&lt;1)
- */
- public static final int TOGGLE = 1 << 1;
-
- /**
- * <code>Button</code> style constant for arrow button behavior (value is 1&lt;&lt;2)
- */
- public static final int ARROW = 1 << 2;
-
- /**
- * <code>Button</code> and <code>MenuItem</code>
- * style constant for push button behavior (value is 1&lt;&lt;3)
- */
- public static final int PUSH = 1 << 3;
-
- /**
- * <code>Button</code> and <code>MenuItem</code>
- * style constant for radio button behavior (value is 1&lt;&lt;4)
- */
- public static final int RADIO = 1 << 4;
-
- /**
- * <code>Button</code> and <code>MenuItem</code>
- * style constant for check box behavior (value is 1&lt;&lt;5)
- */
- public static final int CHECK = 1 << 5;
-
- /**
- * <code>MenuItem</code> style constant for cascade behavior (value is 1&lt;&lt;6)
- */
- public static final int CASCADE = 1 << 6;
-
- /**
- * <code>Text</code> and <code>List</code>
- * style constant for multi-selection behavior in lists
- * and multiple line support on text fields (value is 1&lt;&lt;1)
- */
- public static final int MULTI = 1 << 1;
-
- /**
- * <code>Text</code> and <code>List</code>
- * style constant for single selection behavior in lists
- * and single line support on text fields (value is 1&lt;&lt;2)
- */
- public static final int SINGLE = 1 << 2;
-
- /**
- * <code>Text</code> style constant for read-only behavior (value is 1&lt;&lt;3)
- */
- public static final int READ_ONLY = 1 << 3;
-
- /**
- * <code>Text</code> style constant for auto-line wrap behavior (value is 1&lt;&lt;6)
- */
- public static final int WRAP = 1 << 6;
-
- /**
- * <code>Combo</code> style constant for simple (not drop down) behavior (value is 1&lt;&lt;6)
- */
- public static final int SIMPLE = 1 << 6;
-
- /**
- * <code>Group</code> and <code>Label</code>
- * style constant for shadow in behavior (value is 1&lt;&lt;2)
- */
- public static final int SHADOW_IN = 1 << 2;
-
- /**
- * <code>Group</code>, <code>Label</code> and <code>CustomLabel</code>
- * style constant for shadow out behavior (value is 1&lt;&lt;3)
- */
- public static final int SHADOW_OUT = 1 << 3;
-
- /**
- * <code>Group</code> style constant for shadow etched in behavior (value is 1&lt;&lt;4)
- * NOTE: This style is ignored on all platforms except Motif
- */
- public static final int SHADOW_ETCHED_IN = 1 << 4;
-
- /**
- * <code>Label</code> style constant for no shadow behavior (value is 1&lt;&lt;5)
- */
- public static final int SHADOW_NONE = 1 << 5;
-
- /**
- * <code>Group</code> style constant for shadow etched out behavior (value is 1&lt;&lt;6)
- * NOTE: This style is ignored on all platforms except Motif
- */
- public static final int SHADOW_ETCHED_OUT = 1 << 6;
-
- /**
- * <code>Shell</code> style constant for tool window behavior (value is 1&lt;&lt;2)
- */
- public static final int TOOL = 1 << 2;
-
- /**
- * <code>Shell</code> style constant to ensure no trimmings are used.
- * This overrides all other trim styles (value is 1&lt;&lt;3)
- */
- public static final int NO_TRIM = 1 << 3;
-
- /**
- * <code>Shell</code> style constant for resize box trim (value is 1&lt;&lt;4)
- */
- public static final int RESIZE = 1 << 4;
-
- /**
- * <code>Shell</code> style constant for title area trim (value is 1&lt;&lt;5)
- */
- public static final int TITLE = 1 << 5;
-
- /**
- * <code>Shell</code> style constant for close box trim (value is 1&lt;&lt;6,
- * since we do not distinguish between CLOSE style and MENU style)
- */
- public static final int CLOSE = 1 << 6;
-
- /**
- * <code>Shell</code> style constant for shell menu trim (value is 1&lt;&lt;6,
- * since we do not distinguish between CLOSE style and MENU style)
- */
- public static final int MENU = CLOSE;
-
- /**
- * <code>Shell</code> style constant for minimize box trim (value is 1&lt;&lt;7)
- */
- public static final int MIN = 1 << 7;
-
- /* ScrollBar, Composite, Shell Constants */
-
- /**
- * <code>ScrollBar</code>, <code>Composite</code> and <code>Shell</code>
- * style constant for horizontal scrollbar behavior (value is 1&lt;&lt;8)
- */
- public static final int H_SCROLL = 1 << 8;
-
- /**
- * <code>ScrollBar</code>, <code>Composite</code> and <code>Shell</code>
- * style constant for vertical scrollbar behavior (value is 1&lt;&lt;9)
- */
- public static final int V_SCROLL = 1 << 9;
-
- /**
- * <code>Shell</code> style constant for maximize box trim (value is 1&lt;&lt;10)
- */
- public static final int MAX = 1 << 10;
-
- /**
- * all <code>Widget</code> style constant for bordered behavior (value is 1&lt;&lt;11)
- */
- public static final int BORDER = 1 << 11;
-
- /**
- * all <code>Widget</code> style constant indicating that the window
- * manager should clip a widget's children with respect to its viewable
- * area. Note that this is a <em>HINT</em>. (value is 1&lt;&lt;12)
- */
- public static final int CLIP_CHILDREN = 1 << 12;
-
- /**
- * all <code>Widget</code> style constant indicating that the window
- * manager should clip a widget's siblings with respect to its viewable
- * area. Note that this is a <em>HINT</em>. (value is 1&lt;&lt;13)
- */
- public static final int CLIP_SIBLINGS = 1 << 13;
-
- /**
- * <code>Shell</code> style constant for always on top behavior (value is 1&lt;&lt;14)
- */
- public static final int ON_TOP = 1 << 14;
-
- /**
- * <code>Shell</code> trim style convenience constant for the
- * most common top level shell appearance
- * (value is CLOSE|TITLE|MIN|MAX|RESIZE)
- */
- public static final int SHELL_TRIM = CLOSE | TITLE | MIN | MAX | RESIZE;
-
- /**
- * <code>Shell</code> trim style convenience constant for the
- * most common dialog shell appearance
- * (value is CLOSE|TITLE|BORDER)
- */
- public static final int DIALOG_TRIM = TITLE | CLOSE | BORDER;
-
- /**
- * <code>Shell</code> style constant for modeless behavior (value is 0)
- */
- public static final int MODELESS = 0;
-
- /**
- * <code>Shell</code> style constant for primary modal behavior (value is 1&lt;&lt;15)
- */
- public static final int PRIMARY_MODAL = 1 << 15;
-
- /**
- * <code>Shell</code> style constant for application modal behavior (value is 1&lt;&lt;16)
- */
- public static final int APPLICATION_MODAL = 1 << 16;
-
- /**
- * <code>Shell</code> style constant for system modal behavior (value is 1&lt;&lt;17)
- */
- public static final int SYSTEM_MODAL = 1 << 17;
-
- /**
- * all <code>Widget</code> style constant for selection hiding
- * behavior. Note that this is a <em>HINT</em>. (value is 1&lt;&lt;15)
- */
- public static final int HIDE_SELECTION = 1 << 15;
-
- /**
- * all <code>Widget</code> style constant for full row selection
- * behavior. Note that this is a <em>HINT</em>. (value is 1&lt;&lt;16 since
- * FULL_SELECTION and SMOOTH share the same value, but are
- * implemented on non-intersecting sets of widgets)
- */
- public static final int FULL_SELECTION = 1 << 16;
-
- /**
- * all <code>Widget</code> style constant for flat appearance.
- * Note that this is a <em>HINT</em>. (value is 1&lt;&lt;23)
- */
- public static final int FLAT = 1 << 23;
-
- /**
- * all <code>Widget</code> style constant for flat appearance.
- * Note that this is a <em>HINT</em>. (value is 1&lt;&lt;16 since
- * FULL_SELECTION and SMOOTH share the same value, but are
- * implemented on non-intersecting sets of widgets)
- */
- public static final int SMOOTH = FULL_SELECTION;
-
- /**
- * <code>Canvas</code> style constant for no background behavior (value is 1&lt;&lt;18)
- */
- public static final int NO_BACKGROUND = 1 << 18;
-
- /**
- * <code>Canvas</code> style constant for does not take focus behavior (value is 1&lt;&lt;19)
- */
- public static final int NO_FOCUS = 1 << 19;
-
- /**
- * <code>Canvas</code> style constant for no redraw on resize behavior (value is 1&lt;&lt;20)
- */
- public static final int NO_REDRAW_RESIZE = 1 << 20;
-
- /**
- * <code>Canvas</code> style constant for no paint event merging
- * behavior (value is 1&lt;&lt;21)
- */
- public static final int NO_MERGE_PAINTS = 1 << 21;
-
- /**
- * <code>Canvas</code> style constant for preventing child radio group
- * behavior (value is 1&lt;&lt;22)
- */
- public static final int NO_RADIO_GROUP = 1 << 22;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align up behavior (value is 1&lt;&lt;7, since
- * align UP and align TOP are considered the same)
- */
- public static final int UP = 1 << 7;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align top behavior (value is 1&lt;&lt;7, since
- * align UP and align TOP are considered the same)
- */
- public static final int TOP = UP;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align down behavior (value is 1&lt;&lt;10, since
- * align DOWN and align BOTTOM are considered the same)
- */
- public static final int DOWN = 1 << 10;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align bottom behavior (value is 1&lt;&lt;10, since
- * align DOWN and align BOTTOM are considered the same)
- */
- public static final int BOTTOM = DOWN;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align left behavior (value is 1&lt;&lt;14)
- */
- public static final int LEFT = 1 << 14;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align right behavior (value is 1&lt;&lt;17)
- */
- public static final int RIGHT = 1 << 17;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align center behavior (value is 1&lt;&lt;24)
- */
- public static final int CENTER = 1 << 24;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align horizontal behavior (value is 1&lt;&lt;8)
- */
- public static final int HORIZONTAL = H_SCROLL;
-
- /**
- * various <code>Widget</code> and <code>Layout</code>
- * style constant for align vertical behavior (value is 1&lt;&lt;9)
- */
- public static final int VERTICAL = V_SCROLL;
-
- /**
- * Input Method Editor style constant for double byte
- * input behavior (value is 1&lt;&lt;1)
- */
- public static final int DBCS = 1 << 1;
-
- /**
- * Input Method Editor style constant for alpha
- * input behavior (value is 1&lt;&lt;2)
- */
- public static final int ALPHA = 1 << 2;
-
- /**
- * Input Method Editor style constant for native
- * input behavior (value is 1&lt;&lt;3)
- */
- public static final int NATIVE = 1 << 3;
-
- /**
- * Input Method Editor style constant for phonetic
- * input behavior (value is 1&lt;&lt;4)
- */
- public static final int PHONETIC = 1 << 4;
-
- /**
- * Input Method Editor style constant for romanicized
- * input behavior (value is 1&lt;&lt;5)
- */
- public static final int ROMAN = 1 << 5;
-
- /**
- * ASCII character convenience constant for the escape character
- * (value is the <code>char</code> with value 27)
- */
- public static final char ESC = 27;
-
- /**
- * ASCII character convenience constant for the delete character
- * (value is the <code>char</code> with value 127)
- */
- public static final char DEL = 0x7F;
-
- /**
- * ASCII character convenience constant for the backspace character
- * (value is the <code>char</code> '\b')
- */
- public static final char BS = '\b';
-
- /**
- * ASCII character convenience constant for the carriage return character
- * (value is the <code>char</code> '\r')
- */
- public static final char CR = '\r';
-
- /**
- * ASCII character convenience constant for the line feed character
- * (value is the <code>char</code> '\n')
- */
- public static final char LF = '\n';
-
- /**
- * keyboard and/or mouse event mask indicating that the ALT key
- * was pushed on the keyboard when the event was generated
- * (value is 1&lt;&lt;16)
- */
- public static final int ALT = 1 << 16;
-
- /**
- * keyboard and/or mouse event mask indicating that the SHIFT key
- * was pushed on the keyboard when the event was generated
- * (value is 1&lt;&lt;17)
- */
- public static final int SHIFT = 1 << 17;
-
- /**
- * keyboard and/or mouse event mask indicating that the CTRL key
- * was pushed on the keyboard when the event was generated
- * (value is 1&lt;&lt;18)
- */
- public static final int CTRL = 1 << 18;
-
- /**
- * keyboard and/or mouse event mask indicating that the CTRL key
- * was pushed on the keyboard when the event was generated. This
- * is a synonym for CTRL (value is 1&lt;&lt;18)
- */
- public static final int CONTROL = CTRL;
-
- /**
- * keyboard and/or mouse event mask indicating that mouse button one
- * was pushed when the event was generated. (value is 1&lt;&lt;19)
- */
- public static final int BUTTON1 = 1 << 19;
-
- /**
- * keyboard and/or mouse event mask indicating that mouse button two
- * was pushed when the event was generated. (value is 1&lt;&lt;20)
- */
- public static final int BUTTON2 = 1 << 20;
-
- /**
- * keyboard and/or mouse event mask indicating that mouse button three
- * was pushed when the event was generated. (value is 1&lt;&lt;21)
- */
- public static final int BUTTON3 = 1 << 21;
-
- /**
- * keyboard event constant representing the UP ARROW key
- * (value is (1&lt;&lt;24)+1)
- */
- public static final int ARROW_UP = (1 << 24) + 1;
-
- /**
- * keyboard event constant representing the DOWN ARROW key
- * (value is (1&lt;&lt;24)+2)
- */
- public static final int ARROW_DOWN = (1 << 24) + 2;
-
- /**
- * keyboard event constant representing the LEFT ARROW key
- * (value is (1&lt;&lt;24)+3)
- */
- public static final int ARROW_LEFT = (1 << 24) + 3;
-
- /**
- * keyboard event constant representing the RIGHT ARROW key
- * (value is (1&lt;&lt;24)+4)
- */
- public static final int ARROW_RIGHT = (1 << 24) + 4;
-
- /**
- * keyboard event constant representing the PAGE UP key
- * (value is (1&lt;&lt;24)+5)
- */
- public static final int PAGE_UP = (1 << 24) + 5;
-
- /**
- * keyboard event constant representing the PAGE DOWN key
- * (value is (1&lt;&lt;24)+6)
- */
- public static final int PAGE_DOWN = (1 << 24) + 6;
-
- /**
- * keyboard event constant representing the HOME key
- * (value is (1&lt;&lt;24)+7)
- */
- public static final int HOME = (1 << 24) + 7;
-
- /**
- * keyboard event constant representing the END key
- * (value is (1&lt;&lt;24)+8)
- */
- public static final int END = (1 << 24) + 8;
-
- /**
- * keyboard event constant representing the INSERT key
- * (value is (1&lt;&lt;24)+9)
- */
- public static final int INSERT = (1 << 24) + 9;
-
- /**
- * keyboard event constant representing the F1 key
- * (value is (1&lt;&lt;24)+10)
- */
- public static final int F1 = (1 << 24) + 10;
-
- /**
- * keyboard event constant representing the F2 key
- * (value is (1&lt;&lt;24)+11)
- */
- public static final int F2 = (1 << 24) + 11;
-
- /**
- * keyboard event constant representing the F3 key
- * (value is (1&lt;&lt;24)+12)
- */
- public static final int F3 = (1 << 24) + 12;
-
- /**
- * keyboard event constant representing the F4 key
- * (value is (1&lt;&lt;24)+13)
- */
- public static final int F4 = (1 << 24) + 13;
-
- /**
- * keyboard event constant representing the F5 key
- * (value is (1&lt;&lt;24)+14)
- */
- public static final int F5 = (1 << 24) + 14;
-
- /**
- * keyboard event constant representing the F6 key
- * (value is (1&lt;&lt;24)+15)
- */
- public static final int F6 = (1 << 24) + 15;
-
- /**
- * keyboard event constant representing the F7 key
- * (value is (1&lt;&lt;24)+16)
- */
- public static final int F7 = (1 << 24) + 16;
-
- /**
- * keyboard event constant representing the F8 key
- * (value is (1&lt;&lt;24)+17)
- */
- public static final int F8 = (1 << 24) + 17;
-
- /**
- * keyboard event constant representing the F9 key
- * (value is (1&lt;&lt;24)+18)
- */
- public static final int F9 = (1 << 24) + 18;
-
- /**
- * keyboard event constant representing the F10 key
- * (value is (1&lt;&lt;24)+19)
- */
- public static final int F10 = (1 << 24) + 19;
-
- /**
- * keyboard event constant representing the F11 key
- * (value is (1&lt;&lt;24)+20)
- */
- public static final int F11 = (1 << 24) + 20;
-
- /**
- * keyboard event constant representing the F12 key
- * (value is (1&lt;&lt;24)+21)
- */
- public static final int F12 = (1 << 24) + 21;
-
- /**
- * <code>MessageBox</code> style constant for error icon
- * behavior (value is 1)
- */
- public static final int ICON_ERROR = 1;
-
- /**
- * <code>MessageBox</code> style constant for information icon
- * behavior (value is 1&lt;&lt;1)
- */
- public static final int ICON_INFORMATION = 1 << 1;
-
- /**
- * <code>MessageBox</code> style constant for question icon
- * behavior (value is 1&lt;&lt;2)
- */
- public static final int ICON_QUESTION = 1 << 2;
-
- /**
- * <code>MessageBox</code> style constant for warning icon
- * behavior (value is 1&lt;&lt;3)
- */
- public static final int ICON_WARNING = 1 << 3;
-
- /**
- * <code>MessageBox</code> style constant for "working" icon
- * behavior (value is 1&lt;&lt;4)
- */
- public static final int ICON_WORKING = 1 << 4;
-
- /**
- * <code>MessageBox</code> style constant for an OK button.
- * Valid combinations are OK, OK|CANCEL
- * (value is 1&lt;&lt;5)
- */
- public static final int OK = 1 << 5;
-
- /**
- * <code>MessageBox</code> style constant for YES button.
- * Valid combinations are YES|NO, YES|NO|CANCEL
- * (value is 1&lt;&lt;6)
- */
- public static final int YES = 1 << 6;
-
- /**
- * <code>MessageBox</code> style constant for NO button.
- * Valid combinations are YES|NO, YES|NO|CANCEL
- * (value is 1&lt;&lt;7)
- */
- public static final int NO = 1 << 7;
-
- /**
- * <code>MessageBox</code> style constant for a CANCEL button.
- * Valid combinations are OK|CANCEL, YES|NO|CANCEL, RETRY|CANCEL
- * (value is 1&lt;&lt;8)
- */
- public static final int CANCEL = 1 << 8;
-
- /**
- * <code>MessageBox</code> style constant for an ABORT button.
- * The only valid combination is ABORT|RETRY|IGNORE
- * (value is 1&lt;&lt;9)
- */
- public static final int ABORT = 1 << 9;
-
- /**
- * <code>MessageBox</code> style constant for a RETRY button.
- * Valid combinations are ABORT|RETRY|IGNORE, RETRY|CANCEL
- * (value is 1&lt;&lt;10)
- */
- public static final int RETRY = 1 << 10;
-
- /**
- * <code>MessageBox</code> style constant for an IGNORE button.
- * The only valid combination is ABORT|RETRY|IGNORE
- * (value is 1&lt;&lt;11)
- */
- public static final int IGNORE = 1 << 11;
-
- /**
- * <code>FileDialog</code> style constant for open file dialog behavior
- * (value is 1&lt;&lt;12)
- */
- public static final int OPEN = 1 << 12;
-
- /**
- * <code>FileDialog</code> style constant for save file dialog behavior
- * (value is 1&lt;&lt;13)
- */
- public static final int SAVE = 1 << 13;
-
- /**
- * default color white (value is 1)
- */
- public static final int COLOR_WHITE = 1;
-
- /**
- * default color black (value is 2)
- */
- public static final int COLOR_BLACK = 2;
-
- /**
- * default color red (value is 3)
- */
- public static final int COLOR_RED = 3;
-
- /**
- * default color dark red (value is 4)
- */
- public static final int COLOR_DARK_RED = 4;
-
- /**
- * default color green (value is 5)
- */
- public static final int COLOR_GREEN = 5;
-
- /**
- * default color dark green (value is 6)
- */
- public static final int COLOR_DARK_GREEN = 6;
-
- /**
- * default color yellow (value is 7)
- */
- public static final int COLOR_YELLOW = 7;
-
- /**
- * default color dark yello (value is 8)
- */
- public static final int COLOR_DARK_YELLOW = 8;
-
- /**
- * default color blue (value is 9)
- */
- public static final int COLOR_BLUE = 9;
-
- /**
- * default color dark blue (value is 10)
- */
- public static final int COLOR_DARK_BLUE = 10;
-
- /**
- * default color magenta (value is 11)
- */
- public static final int COLOR_MAGENTA = 11;
-
- /**
- * default color dark magenta (value is 12)
- */
- public static final int COLOR_DARK_MAGENTA = 12;
-
- /**
- * default color cyan (value is 13)
- */
- public static final int COLOR_CYAN = 13;
-
- /**
- * default color dark cyan (value is 14)
- */
- public static final int COLOR_DARK_CYAN = 14;
-
- /**
- * default color gray (value is 15)
- */
- public static final int COLOR_GRAY = 15;
-
- /**
- * default color dark gray (value is 16)
- */
- public static final int COLOR_DARK_GRAY = 16;
-
- /*
- * System Colors
- *
- * Dealing with system colors is an area where there are
- * many platform differences. On some platforms, system
- * colors can change dynamically while the program is
- * running. On other platforms, system colors can be
- * changed for all instances of a particular widget.
- * Therefore, the only truly portable method to obtain
- * a widget color query is to query the color from an
- * instance of the widget.
- *
- * It is expected that the list of supported colors
- * will grow over time.
- */
-
- /**
- * system color used to paint dark shadow areas (value is 17)
- */
- public static final int COLOR_WIDGET_DARK_SHADOW = 17;
-
- /**
- * system color used to paint normal shadow areas (value is 18)
- */
- public static final int COLOR_WIDGET_NORMAL_SHADOW = 18;
-
- /**
- * system color used to paint light shadow areas (value is 19)
- */
- public static final int COLOR_WIDGET_LIGHT_SHADOW = 19;
-
- /**
- * system color used to paint highlight shadow areas (value is 20)
- */
- public static final int COLOR_WIDGET_HIGHLIGHT_SHADOW = 20;
-
- /**
- * system color used to paint foreground areas (value is 21)
- */
- public static final int COLOR_WIDGET_FOREGROUND = 21;
-
- /**
- * system color used to paint background areas (value is 22)
- */
- public static final int COLOR_WIDGET_BACKGROUND = 22;
-
- /**
- * system color used to paint border areas (value is 23)
- */
- public static final int COLOR_WIDGET_BORDER = 23;
-
- /**
- * system color used to paint list foreground areas (value is 24)
- */
- public static final int COLOR_LIST_FOREGROUND = 24;
-
- /**
- * system color used to paint list background areas (value is 25)
- */
- public static final int COLOR_LIST_BACKGROUND = 25;
-
- /**
- * system color used to paint list selection background areas (value is 26)
- */
- public static final int COLOR_LIST_SELECTION = 26;
-
- /**
- * system color used to paint list selected text (value is 27)
- */
- public static final int COLOR_LIST_SELECTION_TEXT = 27;
-
- /**
- * system color used to paint tooltip text (value is 28)
- */
- public static final int COLOR_INFO_FOREGROUND = 28;
-
- /**
- * system color used to paint tooltip background areas (value is 29)
- */
- public static final int COLOR_INFO_BACKGROUND = 29;
-
- /**
- * system color used to paint title text (value is 30)
- */
- public static final int COLOR_TITLE_FOREGROUND = 30;
-
- /**
- * system color used to paint title background areas (value is 31)
- */
- public static final int COLOR_TITLE_BACKGROUND = 31;
-
- /**
- * system color used to paint title background gradient (value is 32)
- */
- public static final int COLOR_TITLE_BACKGROUND_GRADIENT = 32;
-
- /**
- * system color used to paint inactive title text (value is 33)
- */
- public static final int COLOR_TITLE_INACTIVE_FOREGROUND = 33;
-
- /**
- * system color used to paint inactive title background areas (value is 34)
- */
- public static final int COLOR_TITLE_INACTIVE_BACKGROUND = 34;
-
- /**
- * system color used to paint inactive title background gradient (value is 35)
- */
- public static final int COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = 35;
-
- /**
- * draw constant indicating whether the drawing operation
- * should fill the background (value is 1&lt;&lt;0)
- */
- public static final int DRAW_TRANSPARENT = 1 << 0;
-
- /**
- * draw constant indicating whether the string drawing operation
- * should handle line-delimeters (value is 1&lt;&lt;1)
- */
- public static final int DRAW_DELIMITER = 1 << 1;
-
- /**
- * draw constant indicating whether the string drawing operation
- * should expand TAB characters (value is 1&lt;&lt;2)
- */
- public static final int DRAW_TAB = 1 << 2;
-
- /**
- * draw constant indicating whether the string drawing operation
- * should handle mnemonics (value is 1&lt;&lt;3)
- */
- public static final int DRAW_MNEMONIC = 1 << 3;
-
- /**
- * SWT error constant indicating that no error number was specified
- * (value is 1)
- */
- public static final int ERROR_UNSPECIFIED = 1;
-
- /**
- * SWT error constant indicating that no more handles for an
- * operating system resource are available
- * (value is 2)
- */
- public static final int ERROR_NO_HANDLES = 2;
-
- /**
- * SWT error constant indicating that no more callback resources are available
- * (value is 3)
- */
- public static final int ERROR_NO_MORE_CALLBACKS = 3;
-
- /**
- * SWT error constant indicating that a null argument was passed in
- * (value is 4)
- */
- public static final int ERROR_NULL_ARGUMENT = 4;
-
- /**
- * SWT error constant indicating that an invalid argument was passed in
- * (value is 5)
- */
- public static final int ERROR_INVALID_ARGUMENT = 5;
-
- /**
- * SWT error constant indicating that a value was found to be
- * outside the allowable range
- * (value is 6)
- */
- public static final int ERROR_INVALID_RANGE = 6;
-
- /**
- * SWT error constant indicating that a value which can not be
- * zero was found to be
- * (value is 7)
- */
- public static final int ERROR_CANNOT_BE_ZERO = 7;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide the value of an item
- * (value is 8)
- */
- public static final int ERROR_CANNOT_GET_ITEM = 8;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide the selection
- * (value is 9)
- */
- public static final int ERROR_CANNOT_GET_SELECTION = 9;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide the height of an item
- * (value is 11)
- */
- public static final int ERROR_CANNOT_GET_ITEM_HEIGHT = 11;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide the text of a widget
- * (value is 12)
- */
- public static final int ERROR_CANNOT_GET_TEXT = 12;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to set the text of a widget
- * (value is 13)
- */
- public static final int ERROR_CANNOT_SET_TEXT = 13;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to add an item
- * (value is 14)
- */
- public static final int ERROR_ITEM_NOT_ADDED = 14;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to remove an item
- * (value is 15)
- */
- public static final int ERROR_ITEM_NOT_REMOVED = 15;
-
- /**
- * SWT error constant indicating that a particular feature has
- * not been implemented on this platform
- * (value is 20)
- */
- public static final int ERROR_NOT_IMPLEMENTED = 20;
-
- /**
- * SWT error constant indicating that a menu which needed
- * to have the drop down style had some other style instead
- * (value is 21)
- */
- public static final int ERROR_MENU_NOT_DROP_DOWN = 21;
-
- /**
- * SWT error constant indicating that an attempt was made to
- * invoke an SWT operation which can only be executed by the
- * user-interface thread from some other thread
- * (value is 22)
- */
- public static final int ERROR_THREAD_INVALID_ACCESS = 22;
-
- /**
- * SWT error constant indicating that an attempt was made to
- * invoke an SWT operation using a widget which had already
- * been disposed.
- * (value is 24)
- */
- public static final int ERROR_WIDGET_DISPOSED = 24;
-
- /**
- * SWT error constant indicating that a menu item which needed
- * to have the cascade style had some other style instead
- * (value is 27)
- */
- public static final int ERROR_MENUITEM_NOT_CASCADE = 27;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to set the selection of a widget
- * (value is 28)
- */
- public static final int ERROR_CANNOT_SET_SELECTION = 28;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to set the menu
- * (value is 29)
- */
- public static final int ERROR_CANNOT_SET_MENU = 29;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to set the enabled state
- * (value is 30)
- */
- public static final int ERROR_CANNOT_SET_ENABLED = 30;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide enabled/disabled state information
- * (value is 31)
- */
- public static final int ERROR_CANNOT_GET_ENABLED = 31;
-
- /**
- * SWT error constant indicating that a provided widget can
- * not be used as a parent in the current operation
- * (value is 32)
- */
- public static final int ERROR_INVALID_PARENT = 32;
-
- /**
- * SWT error constant indicating that a menu which needed
- * to have the menu bar style had some other style instead
- * (value is 33)
- */
- public static final int ERROR_MENU_NOT_BAR = 33;
-
- /**
- * SWT error constant indicating that the underlying operating
- * system was unable to provide count information
- * (value is 36)
- */
- public static final int ERROR_CANNOT_GET_COUNT = 36;
-
- /**
- * SWT error constant indicating that a menu which needed
- * to have the pop up menu style had some other style instead
- * (value is 37)
- */
- public static final int ERROR_MENU_NOT_POP_UP = 37;
-
- /**
- * SWT error constant indicating that a graphics operation
- * was attempted with an image of an unsupported depth
- * (value is 38)
- */
- public static final int ERROR_UNSUPPORTED_DEPTH = 38;
-
- /**
- * SWT error constant indicating that an input/output operation
- * failed during the execution of an SWT operation
- * (value is 39)
- */
- public static final int ERROR_IO = 39;
-
- /**
- * SWT error constant indicating that a graphics operation
- * was attempted with an image having an invalid format
- * (value is 40)
- */
- public static final int ERROR_INVALID_IMAGE = 40;
-
- /**
- * SWT error constant indicating that a graphics operation
- * was attempted with an image having a valid but unsupported
- * format
- * (value is 42)
- */
- public static final int ERROR_UNSUPPORTED_FORMAT = 42;
-
- /**
- * SWT error constant indicating that an attempt was made
- * to subclass an SWT widget class without implementing the
- * <code>checkSubclass()</code> method. For additional
- * information see the comment in <code>Widget.checkSubclass()</code>
- * (value is 43)
- *
- * @see org.eclipse.swt.widgets.Widget#checkSubclass
- */
- public static final int ERROR_INVALID_SUBCLASS = 43;
-
- /**
- * SWT error constant indicating that an attempt was made to
- * invoke an SWT operation using a graphics object which had
- * already been disposed.
- * (value is 44)
- */
- public static final int ERROR_GRAPHIC_DISPOSED = 44;
-
- /**
- * SWT error constant indicating that an attempt was made to
- * invoke an SWT operation using a device which had already
- * been disposed.
- * (value is 45)
- */
- public static final int ERROR_DEVICE_DISPOSED = 45;
-
- /**
- * SWT error constant indicating that an exception happened
- * when executing a runnable.
- * (value is 46)
- */
- public static final int ERROR_FAILED_EXEC = 46;
-
- /**
- * SWT error constant indicating that an unsatisfied link
- * error occured while attempting to load a library.
- * (value is 47)
- */
- public static final int ERROR_FAILED_LOAD_LIBRARY = 47;
-
- /**
- * traversal event detail field value indicating that no
- * traversal action should be taken.
- * (value is 0)
- */
- public static final int TRAVERSE_NONE = 0;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that a dialog should be cancelled was
- * pressed; typically, this is the ESC key
- * (value is 1&lt;&lt;1)
- */
- public static final int TRAVERSE_ESCAPE = 1 << 1;
-
- /**
- * traversal event detail field value indicating that the
- * key which activates the default button in a dialog was
- * pressed; typically, this is the ENTER key
- * (value is 1&lt;&lt;2)
- */
- public static final int TRAVERSE_RETURN = 1 << 2;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that focus should be given to the
- * previous tab group was pressed; typically, this is the
- * SHIFT-TAB key sequence
- * (value is 1&lt;&lt;3)
- */
- public static final int TRAVERSE_TAB_PREVIOUS = 1 << 3;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that focus should be given to the
- * next tab group was pressed; typically, this is the
- * TAB key
- * (value is 1&lt;&lt;4)
- */
- public static final int TRAVERSE_TAB_NEXT = 1 << 4;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that focus should be given to the
- * previous tab item was pressed; typically, this is either
- * the LEFT-ARROW or UP-ARROW keys
- * (value is 1&lt;&lt;5)
- */
- public static final int TRAVERSE_ARROW_PREVIOUS = 1 << 5;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that focus should be given to the
- * previous tab item was pressed; typically, this is either
- * the RIGHT-ARROW or DOWN-ARROW keys
- * (value is 1&lt;&lt;6)
- */
- public static final int TRAVERSE_ARROW_NEXT = 1 << 6;
-
- /**
- * traversal event detail field value indicating that a
- * mnemonic key sequence was pressed
- * (value is 1&lt;&lt;7)
- */
- public static final int TRAVERSE_MNEMONIC = 1 << 7;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that the previous page of a multi-page
- * window should be shown was pressed; typically, this
- * is the CTRL-PAGEUP key sequence
- * (value is 1&lt;&lt;8)
- */
- public static final int TRAVERSE_PAGE_PREVIOUS = 1 << 8;
-
- /**
- * traversal event detail field value indicating that the
- * key which designates that the next page of a multi-page
- * window should be shown was pressed; typically, this
- * is the CTRL-PAGEDOWN key sequence
- * (value is 1&lt;&lt;9)
- */
- public static final int TRAVERSE_PAGE_NEXT = 1 << 9;
-
- /**
- * constant indicating that an image or operation is of type bitmap (value is 0)
- */
- public static final int BITMAP = 0;
-
- /**
- * constant indicating that an image or operation is of type icon (value is 1)
- */
- public static final int ICON = 1;
-
- /**
- * <code>Image</code> constructor argument indicating that
- * the new image should be a copy of the image provided as
- * an argument (value is 0)
- */
- public static final int IMAGE_COPY = 0;
-
- /**
- * <code>Image</code> constructor argument indicating that
- * the new image should have the appearance of a "disabled"
- * (using the platform's rules for how this should look)
- * copy of the image provided as an argument (value is 1)
- */
- public static final int IMAGE_DISABLE = 1;
-
- /**
- * <code>Image</code> constructor argument indicating that
- * the new image should have the appearance of a "gray scaled"
- * copy of the image provided as an argument (value is 2)
- */
- public static final int IMAGE_GRAY = 2;
-
- /**
- * font style constant indicating a normal weight, non-italic font
- * (value is 0)
- */
- public static final int NORMAL = 0;
-
- /**
- * font style constant indicating a bold weight font
- * (value is 1&lt;&lt;0)
- */
- public static final int BOLD = 1 << 0;
-
- /**
- * font style constant indicating an italic font
- * (value is 1&lt;&lt;1)
- */
- public static final int ITALIC = 1 << 1;
-
- /**
- * system arrow cursor (value is 0)
- */
- public static final int CURSOR_ARROW = 0;
-
- /**
- * system wait cursor (value is 1)
- */
- public static final int CURSOR_WAIT = 1;
-
- /**
- * system cross hair cursor (value is 2)
- */
- public static final int CURSOR_CROSS = 2;
-
- /**
- * system app startup cursor (value is 3)
- */
- public static final int CURSOR_APPSTARTING = 3;
-
- /**
- * system help cursor (value is 4)
- */
- public static final int CURSOR_HELP = 4;
-
- /**
- * system resize all directions cursor (value is 5)
- */
- public static final int CURSOR_SIZEALL = 5;
-
- /**
- * system resize north-east-south-west cursor (value is 6)
- */
- public static final int CURSOR_SIZENESW = 6;
-
- /**
- * system resize north-south cursor (value is 7)
- */
- public static final int CURSOR_SIZENS = 7;
-
- /**
- * system resize north-west-south-east cursor (value is 8)
- */
- public static final int CURSOR_SIZENWSE = 8;
-
- /**
- * system resize west-east cursor (value is 9)
- */
- public static final int CURSOR_SIZEWE = 9;
-
- /**
- * system resize north cursor (value is 10)
- */
- public static final int CURSOR_SIZEN = 10;
-
- /**
- * system resize south cursor (value is 11)
- */
- public static final int CURSOR_SIZES = 11;
-
- /**
- * system resize east cursor (value is 12)
- */
- public static final int CURSOR_SIZEE = 12;
-
- /**
- * system resize west cursor (value is 13)
- */
- public static final int CURSOR_SIZEW = 13;
-
- /**
- * system resize north-east cursor (value is 14)
- */
- public static final int CURSOR_SIZENE = 14;
-
- /**
- * system resize south-east cursor (value is 15)
- */
- public static final int CURSOR_SIZESE = 15;
-
- /**
- * system resize south-west cursor (value is 16)
- */
- public static final int CURSOR_SIZESW = 16;
-
- /**
- * system resize north-west cursor (value is 17)
- */
- public static final int CURSOR_SIZENW = 17;
-
- /**
- * system up arrow cursor (value is 18)
- */
- public static final int CURSOR_UPARROW = 18;
-
- /**
- * system i-beam cursor (value is 19)
- */
- public static final int CURSOR_IBEAM = 19;
-
- /**
- * system "not allowed" cursor (value is 20)
- */
- public static final int CURSOR_NO = 20;
-
- /**
- * system hand cursor (value is 21)
- */
- public static final int CURSOR_HAND = 21;
-
- /**
- * line drawing style for solid lines (value is 1)
- */
- public static final int LINE_SOLID = 1;
-
- /**
- * line drawing style for dashed lines (value is 2)
- */
- public static final int LINE_DASH = 2;
-
- /**
- * line drawing style for dotted lines (value is 3)
- */
- public static final int LINE_DOT = 3;
-
- /**
- * line drawing style for alternating dash-dot lines (value is 4)
- */
- public static final int LINE_DASHDOT = 4;
-
- /**
- * line drawing style for dash-dot-dot lines (value is 5)
- */
- public static final int LINE_DASHDOTDOT = 5;
-
- /**
- * image format constant indicating an unknown image type (value is -1)
- */
- public static final int IMAGE_UNDEFINED = -1;
-
- /**
- * image format constant indicating a Windows BMP format image (value is 0)
- */
- public static final int IMAGE_BMP = 0;
-
- /**
- * image format constant indicating a run-length encoded
- * Windows BMP format image (value is 1)
- */
- public static final int IMAGE_BMP_RLE = 1;
-
- /**
- * image format constant indicating a GIF format image (value is 2)
- */
- public static final int IMAGE_GIF = 2;
-
- /**
- * image format constant indicating a ICO format image (value is 3)
- */
- public static final int IMAGE_ICO = 3;
-
- /**
- * image format constant indicating a JPEG format image (value is 4)
- */
- public static final int IMAGE_JPEG = 4;
-
- /**
- * image format constant indicating a PNG format image (value is 5)
- */
- public static final int IMAGE_PNG = 5;
-
- /**
- * GIF image disposal method constants indicating that the
- * disposal method is unspecified (value is 0)
- */
- public static final int DM_UNSPECIFIED = 0x0;
-
- /**
- * GIF image disposal method constants indicating that the
- * disposal method is to do nothing. That is, to leave the
- * previous image in place (value is 1)
- */
- public static final int DM_FILL_NONE = 0x1;
-
- /**
- * GIF image disposal method constants indicating that the
- * the previous images should be covered with the background
- * color before displaying the next image (value is 2)
- */
- public static final int DM_FILL_BACKGROUND = 0x2;
-
- /**
- * GIF image disposal method constants indicating that the
- * disposal method is to restore the previous picture
- * (value is 3)
- */
- public static final int DM_FILL_PREVIOUS = 0x3;
-
- /**
- * image transparency constant indicating that the image
- * contains no transparency information (value is 0)
- */
- public static final int TRANSPARENCY_NONE = 0x0;
-
- /**
- * image transparency constant indicating that the image
- * contains no transparency information (value is 1&lt;&lt;0)
- */
- public static final int TRANSPARENCY_ALPHA = 1 << 0;
-
- /**
- * image transparency constant indicating that the image
- * contains no transparency information (value is 1&lt;&lt;1)
- */
- public static final int TRANSPARENCY_MASK = 1 << 1;
-
- /**
- * image transparency constant indicating that the image
- * contains no transparency information (value is 1&lt;&lt;2)
- */
- public static final int TRANSPARENCY_PIXEL = 1 << 2;
-
-/**
- * Answers a concise, human readable description of the error code.
- *
- * @param code the SWT error code.
- * @return a description of the error code.
- *
- * @see SWT
- */
-static String findErrorText (int code) {
- switch (code) {
- case ERROR_UNSPECIFIED: return "Unspecified error";
- case ERROR_NO_HANDLES: return "No more handles";
- case ERROR_NO_MORE_CALLBACKS: return "No more callbacks";
- case ERROR_NULL_ARGUMENT: return "Argument cannot be null";
- case ERROR_INVALID_ARGUMENT: return "Argument not valid";
- case ERROR_INVALID_RANGE: return "Index out of bounds";
- case ERROR_CANNOT_BE_ZERO: return "Argument cannot be zero";
- case ERROR_CANNOT_GET_ITEM: return "Cannot get item";
- case ERROR_CANNOT_GET_SELECTION: return "Cannot get selection";
- case ERROR_CANNOT_GET_ITEM_HEIGHT: return "Cannot get item height";
- case ERROR_CANNOT_GET_TEXT: return "Cannot get text";
- case ERROR_CANNOT_SET_TEXT: return "Cannot set text";
- case ERROR_ITEM_NOT_ADDED: return "Item not added";
- case ERROR_ITEM_NOT_REMOVED: return "Item not removed";
- case ERROR_NOT_IMPLEMENTED: return "Not implemented";
- case ERROR_MENU_NOT_DROP_DOWN: return "Menu must be a drop down";
- case ERROR_THREAD_INVALID_ACCESS: return "Invalid thread access";
- case ERROR_WIDGET_DISPOSED: return "Widget is disposed";
- case ERROR_MENUITEM_NOT_CASCADE: return "Menu item is not a CASCADE";
- case ERROR_CANNOT_SET_SELECTION: return "Cannot set selection";
- case ERROR_CANNOT_SET_MENU: return "Cannot set menu";
- case ERROR_CANNOT_SET_ENABLED: return "Cannot set the enabled state";
- case ERROR_CANNOT_GET_ENABLED: return "Cannot get the enabled state";
- case ERROR_INVALID_PARENT: return "Widget has the wrong parent";
- case ERROR_MENU_NOT_BAR: return "Menu is not a BAR";
- case ERROR_CANNOT_GET_COUNT: return "Cannot get count";
- case ERROR_MENU_NOT_POP_UP: return "Menu is not a POP_UP";
- case ERROR_UNSUPPORTED_DEPTH: return "Unsupported color depth";
- case ERROR_IO: return "i/o error";
- case ERROR_INVALID_IMAGE: return "Invalid image";
- case ERROR_UNSUPPORTED_FORMAT: return "Unsupported or unrecognized format";
- case ERROR_INVALID_SUBCLASS: return "Subclassing not allowed";
- case ERROR_GRAPHIC_DISPOSED: return "Graphic is disposed";
- case ERROR_DEVICE_DISPOSED: return "Device is disposed";
- case ERROR_FAILED_EXEC: return "Failed to execute runnable";
- case ERROR_FAILED_LOAD_LIBRARY: return "Unable to load library";
- }
- return "Unknown error";
-}
-
-/**
- * Returns the NLS'ed message for the given argument.
- *
- * @param key the key to look up
- * @return the message for the given key
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- */
-public static String getMessage(String key) {
- return Compatibility.getMessage(key);
-}
-
-/**
- * Returns the SWT platform name.
- * Examples: "win32", "motif", "gtk", "photon"
- *
- * @return the SWT version number
- */
-public static String getPlatform () {
- return Callback.getPlatform ();
-}
-
-/**
- * Returns the SWT version number as an integer.
- * Example: "SWT051" == 51
- *
- * @return the SWT version number
- */
-public static int getVersion () {
- return Library.getVersion ();
-}
-
-/**
- * Throws an appropriate exception based on the passed in error code.
- *
- * @param code the SWT error code
- */
-public static void error (int code) {
- error (code, null);
-}
-
-/**
- * Throws an appropriate exception based on the passed in error code.
- * The <code>throwable</code> argument should be either null, or the
- * throwable which caused SWT to throw an exception.
- * <p>
- * In SWT, errors are reported by throwing one of three exceptions:
- * <dl>
- * <dd>java.lang.IllegalArgumentException</dd>
- * <dt>thrown whenever one of the API methods is invoked with an illegal argument</dt>
- * <dd>org.eclipse.swt.SWTException (extends java.lang.RuntimeException)</dd>
- * <dt>thrown whenever a recoverable error happens internally in SWT</dt>
- * <dd>org.eclipse.swt.SWTError (extends java.lang.Error)</dd>
- * <dt>thrown whenever a <b>non-recoverable</b> error happens internally in SWT</dt>
- * </dl>
- * This method provides the logic which maps between error codes
- * and one of the above exceptions.
- * </p>
- *
- * @param code the SWT error code.
- * @param throwable the exception which caused the error to occur.
- *
- * @see SWTError
- * @see SWTException
- * @see IllegalArgumentException
- */
-public static void error (int code, Throwable throwable) {
-
- // This code prevents the creation of "chains" of SWTErrors and
- // SWTExceptions which in turn contain other SWTErrors and
- // SWTExceptions as their throwable. This can occur when low level
- // code throws an exception past a point where a higher layer is
- // being "safe" and catching all exceptions. (Note that, this is
- // _a_bad_thing_ which we always try to avoid.)
- //
- // On the theory that the low level code is closest to the
- // original problem, we simply re-throw the original exception here.
- if (throwable instanceof SWTError) throw (SWTError) throwable;
- if (throwable instanceof SWTException) throw (SWTException) throwable;
-
- switch (code) {
-
- // Illegal Arguments (non-fatal)
- case ERROR_NULL_ARGUMENT:
- case ERROR_CANNOT_BE_ZERO:
- case ERROR_INVALID_ARGUMENT:
- case ERROR_MENU_NOT_BAR:
- case ERROR_MENU_NOT_DROP_DOWN:
- case ERROR_MENU_NOT_POP_UP:
- case ERROR_MENUITEM_NOT_CASCADE:
- case ERROR_INVALID_PARENT:
- case ERROR_INVALID_RANGE: {
- throw new IllegalArgumentException (findErrorText (code));
- }
-
- // SWT Errors (non-fatal)
- case ERROR_INVALID_SUBCLASS:
- case ERROR_THREAD_INVALID_ACCESS:
- case ERROR_WIDGET_DISPOSED:
- case ERROR_GRAPHIC_DISPOSED:
- case ERROR_DEVICE_DISPOSED:
- case ERROR_INVALID_IMAGE:
- case ERROR_UNSUPPORTED_DEPTH:
- case ERROR_UNSUPPORTED_FORMAT:
- case ERROR_FAILED_EXEC:
- case ERROR_IO: {
- SWTException exception = new SWTException (code);
- exception.throwable = throwable;
- throw exception;
- }
-
- // OS Failure/Limit (fatal, may occur only on some platforms)
- case ERROR_CANNOT_GET_COUNT:
- case ERROR_CANNOT_GET_ENABLED:
- case ERROR_CANNOT_GET_ITEM:
- case ERROR_CANNOT_GET_ITEM_HEIGHT:
- case ERROR_CANNOT_GET_SELECTION:
- case ERROR_CANNOT_GET_TEXT:
- case ERROR_CANNOT_SET_ENABLED:
- case ERROR_CANNOT_SET_MENU:
- case ERROR_CANNOT_SET_SELECTION:
- case ERROR_CANNOT_SET_TEXT:
- case ERROR_ITEM_NOT_ADDED:
- case ERROR_ITEM_NOT_REMOVED:
- case ERROR_NO_HANDLES: // fall through
-
- // SWT Failure/Limit (fatal, may occur only on some platforms)
- case ERROR_FAILED_LOAD_LIBRARY:
- case ERROR_NO_MORE_CALLBACKS:
- case ERROR_NOT_IMPLEMENTED:
- case ERROR_UNSPECIFIED: {
- SWTError error = new SWTError (code);
- error.throwable = throwable;
- throw error;
- }
- }
-
- // Unknown/Undefined Error
- SWTError error = new SWTError (code);
- error.throwable = throwable;
- throw error;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTError.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTError.java
deleted file mode 100755
index 4f7b1ff8ce..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTError.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.swt;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-
-/**
- * This error is thrown whenever an unrecoverable error
- * occurs internally in SWT. The message text and error code
- * provide a further description of the problem. The exception
- * has a <code>throwable</code> field which holds the underlying
- * throwable that caused the problem (if this information is
- * available (i.e. it may be null)).
- * <p>
- * SWTErrors are thrown when something fails internally which
- * either leaves SWT in an unknown state (eg. the o/s call to
- * remove an item from a list returns an error code) or when SWT
- * is left in a known-to-be-unrecoverable state (eg. it runs out
- * of callback resources). SWTErrors should not occur in typical
- * programs, although "high reliability" applications should
- * still catch them.
- * </p><p>
- * This class also provides support methods used by SWT to match
- * error codes to the appropriate exception class (SWTError,
- * SWTException, or IllegalArgumentException) and to provide
- * human readable strings for SWT error codes.
- * </p>
- *
- * @see SWTException
- * @see SWT#error
- */
-
-public class SWTError extends Error {
- public int code;
- public Throwable throwable;
-
-/**
- * Constructs a new instance of this class with its
- * walkback filled in. The error code is set to an
- * unspecified value.
- */
-public SWTError () {
- this (SWT.ERROR_UNSPECIFIED);
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback and message filled in. The error code is
- * set to an unspecified value.
- *
- * @param message the detail message for the exception
- */
-public SWTError (String message) {
- this (SWT.ERROR_UNSPECIFIED, message);
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback and error code filled in.
- *
- * @param code the SWT error code
- */
-public SWTError (int code) {
- this (code, SWT.findErrorText (code));
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback, error code and message filled in.
- *
- * @param code the SWT error code
- * @param message the detail message for the exception
- */
-public SWTError (int code, String message) {
- super (message);
- this.code = code;
-}
-
-/**
- * Returns the string describing this SWTError object.
- * <p>
- * It is combined with the message string of the Throwable
- * which caused this SWTError (if this information is available).
- * </p>
- * @return the error message string of this SWTError object
- */
-public String getMessage() {
- if (throwable == null)
- return super.getMessage();
- else
- return super.getMessage() + " (" + throwable.toString() + ")";
-}
-
-/**
- * Outputs a printable representation of this error's
- * walkback on the standard error stream.
- * <p>
- * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter)
- * are not provided in order to maintain compatibility with CLDC.
- * </p>
- */
-public synchronized void printStackTrace() {
- super.printStackTrace();
- if (throwable != null) {
- System.err.println("*** Stack trace of contained error ***");
- throwable.printStackTrace();
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTException.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTException.java
deleted file mode 100755
index 20e989b46a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTException.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.swt;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-
-/**
- * This runtime exception is thrown whenever a recoverable error
- * occurs internally in SWT. The message text and error code
- * provide a further description of the problem. The exception
- * has a <code>throwable</code> field which holds the underlying
- * exception that caused the problem (if this information is
- * available (i.e. it may be null)).
- * <p>
- * SWTExceptions are thrown when something fails internally,
- * but SWT is left in a known stable state (eg. a widget call
- * was made from a non-u/i thread, or there is failure while
- * reading an Image because the source file was corrupt).
- * </p>
- *
- * @see SWTError
- */
-
-public class SWTException extends RuntimeException {
- public int code;
- public Throwable throwable;
-
-/**
- * Constructs a new instance of this class with its
- * walkback filled in. The error code is set to an
- * unspecified value.
- */
-public SWTException () {
- this (SWT.ERROR_UNSPECIFIED);
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback and message filled in. The error code is
- * set to an unspecified value.
- *
- * @param message the detail message for the exception
- */
-public SWTException (String message) {
- this (SWT.ERROR_UNSPECIFIED, message);
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback and error code filled in.
- *
- * @param code the SWT error code
- */
-public SWTException (int code) {
- this (code, SWT.findErrorText (code));
-}
-
-/**
- * Constructs a new instance of this class with its
- * walkback, error code and message filled in.
- *
- * @param code the SWT error code
- * @param message the detail message for the exception
- */
-public SWTException (int code, String message) {
- super (message);
- this.code = code;
-}
-
-/**
- * Returns the string describing this SWTException object.
- * <p>
- * It is combined with the message string of the Throwable
- * which caused this SWTException (if this information is available).
- * </p>
- * @return the error message string of this SWTException object
- */
-public String getMessage() {
- if (throwable == null)
- return super.getMessage();
- else
- return super.getMessage() + " (" + throwable.toString() + ")";
-}
-
-/**
- * Outputs a printable representation of this exception's
- * walkback on the standard error stream.
- * <p>
- * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter)
- * are not provided in order to maintain compatibility with CLDC.
- * </p>
- */
-public void printStackTrace() {
- super.printStackTrace();
- if (throwable != null) {
- System.err.println("*** Stack trace of contained exception ***");
- throwable.printStackTrace();
- }
-}
-
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java
deleted file mode 100755
index bcf47de09e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * a widget such as a menu item being armed.
- *
- * @see ArmListener
- */
-
-public final class ArmEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public ArmEvent(Event e) {
- super(e);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmListener.java
deleted file mode 100755
index e870a81743..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the event that is generated when a widget,
- * such as a menu item, is armed.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a widget using the
- * <code>addArmListener</code> method and removed using
- * the <code>removeArmListener</code> method. When the
- * widget is armed, the widgetArmed method will be invoked.
- * </p>
- *
- * @see ArmEvent
- */
-public interface ArmListener extends SWTEventListener {
-
-/**
- * Sent when a widget is armed, or 'about to be selected'.
- *
- * @param e an event containing information about the arm
- */
-public void widgetArmed(ArmEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java
deleted file mode 100755
index 38551bc270..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>ControlListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>ControlEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see ControlListener
- * @see ControlEvent
- */
-public abstract class ControlAdapter implements ControlListener {
-
-/**
- * Sent when the location (x, y) of a control changes relative
- * to its parent (or relative to the display, for <code>Shell</code>s).
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the move
- */
-public void controlMoved(ControlEvent e) {
-}
-
-/**
- * Sent when the size (width, height) of a control changes.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the resize
- */
-public void controlResized(ControlEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlEvent.java
deleted file mode 100755
index 8285307a51..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * controls being moved or resized.
- *
- * @see ControlListener
- */
-
-public final class ControlEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public ControlEvent(Event e) {
- super(e);
-}
-
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java
deleted file mode 100755
index 49a78ba639..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated by moving
- * and resizing controls.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addControlListener</code> method and removed using
- * the <code>removeControlListener</code> method. When a
- * control is moved or resized, the appropriate method will
- * be invoked.
- * </p>
- *
- * @see ControlAdapter
- * @see ControlEvent
- */
-public interface ControlListener extends SWTEventListener {
-
-/**
- * Sent when the location (x, y) of a control changes relative
- * to its parent (or relative to the display, for <code>Shell</code>s).
- *
- * @param e an event containing information about the move
- */
-public void controlMoved(ControlEvent e);
-
-/**
- * Sent when the size (width, height) of a control changes.
- *
- * @param e an event containing information about the resize
- */
-public void controlResized(ControlEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeEvent.java
deleted file mode 100755
index 42c50f72fc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * widgets being disposed.
- *
- * @see DisposeListener
- */
-
-public final class DisposeEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public DisposeEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeListener.java
deleted file mode 100755
index 63ea534e1b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the event that is generated when a widget
- * is disposed.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a widget using the
- * <code>addDisposeListener</code> method and removed using
- * the <code>removeDisposeListener</code> method. When a
- * widget is disposed, the widgetDisposed method will
- * be invoked.
- * </p>
- *
- * @see DisposeEvent
- */
-public interface DisposeListener extends SWTEventListener {
-
-/**
- * Sent when the widget is disposed.
- *
- * @param e an event containing information about the dispose
- */
-public void widgetDisposed(DisposeEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusAdapter.java
deleted file mode 100755
index 2864339bc8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>FocusListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>FocusEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see FocusListener
- * @see FocusEvent
- */
-public abstract class FocusAdapter implements FocusListener {
-
-/**
- * Sent when a control gets focus.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the focus change
- */
-public void focusGained(FocusEvent e) {
-}
-
-/**
- * Sent when a control loses focus.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the focus change
- */
-public void focusLost(FocusEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusEvent.java
deleted file mode 100755
index 2e14985163..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * widgets gaining and losing focus.
- *
- * @see FocusListener
- */
-
-public final class FocusEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public FocusEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusListener.java
deleted file mode 100755
index d3872d2ac3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated as controls
- * gain and lose focus.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addFocusListener</code> method and removed using
- * the <code>removeFocusListener</code> method. When a
- * control gains or loses focus, the appropriate method
- * will be invoked.
- * </p>
- *
- * @see FocusAdapter
- * @see FocusEvent
- */
-public interface FocusListener extends SWTEventListener {
-
-/**
- * Sent when a control gets focus.
- *
- * @param e an event containing information about the focus change
- */
-public void focusGained(FocusEvent e);
-
-/**
- * Sent when a control loses focus.
- *
- * @param e an event containing information about the focus change
- */
-public void focusLost(FocusEvent e);
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpEvent.java
deleted file mode 100755
index 81ad33e31a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * help being requested for a widget.
- *
- * @see HelpListener
- */
-
-public final class HelpEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public HelpEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpListener.java
deleted file mode 100755
index a60550e0fd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the event that is generated when help is
- * requested for a control, typically when the user presses F1.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addHelpListener</code> method and removed using
- * the <code>removeHelpListener</code> method. When help
- * is requested for a control, the helpRequested method
- * will be invoked.
- * </p>
- *
- * @see HelpEvent
- */
-public interface HelpListener extends SWTEventListener {
-
-/**
- * Sent when help is requested for a control, typically
- * when the user presses F1.
- *
- * @param e an event containing information about the help
- */
-public void helpRequested(HelpEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyAdapter.java
deleted file mode 100755
index 7a865a969c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>KeyListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>KeyEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see KeyListener
- * @see KeyEvent
- */
-public abstract class KeyAdapter implements KeyListener {
-
-/**
- * Sent when a key is pressed on the system keyboard.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the key press
- */
-public void keyPressed(KeyEvent e) {
-}
-
-/**
- * Sent when a key is released on the system keyboard.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the key release
- */
-public void keyReleased(KeyEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyEvent.java
deleted file mode 100755
index 1869b340c4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyEvent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * keys being pressed and released on the keyboard
- *
- * @see KeyListener
- */
-
-public class KeyEvent extends TypedEvent {
-
- /**
- * the character represented by the key that was typed
- */
- public char character;
-
- /**
- * the key code of the key that was typed
- */
- public int keyCode;
-
- /**
- * the state of the keyboard modifier keys at the time
- * the event was generated
- */
- public int stateMask;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public KeyEvent(Event e) {
- super(e);
- this.character = e.character;
- this.keyCode = e.keyCode;
- this.stateMask = e.stateMask;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyListener.java
deleted file mode 100755
index c7b1d903e1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated as keys
- * are pressed on the system keyboard.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addKeyListener</code> method and removed using
- * the <code>removeKeyListener</code> method. When a
- * key is pressed or released, the appropriate method will
- * be invoked.
- * </p>
- *
- * @see KeyAdapter
- * @see KeyEvent
- */
-public interface KeyListener extends SWTEventListener {
-
-/**
- * Sent when a key is pressed on the system keyboard.
- *
- * @param e an event containing information about the key press
- */
-public void keyPressed(KeyEvent e);
-
-/**
- * Sent when a key is released on the system keyboard.
- *
- * @param e an event containing information about the key release
- */
-public void keyReleased(KeyEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuAdapter.java
deleted file mode 100755
index 428ebc43c4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>MenuListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>MenuEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see MenuListener
- * @see MenuEvent
- */
-public abstract class MenuAdapter implements MenuListener {
-
-/**
- * Sent when a menu is hidden.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the menu operation
- */
-public void menuHidden(MenuEvent e) {
-}
-
-/**
- * Sent when a menu is shown.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the menu operation
- */
-public void menuShown(MenuEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuEvent.java
deleted file mode 100755
index ae6af6dc1b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * menus being shown and hidden.
- *
- * @see MenuListener
- */
-
-public final class MenuEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public MenuEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuListener.java
deleted file mode 100755
index 24d57167e5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the hiding and showing of menus.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addMenuListener</code> method and removed using
- * the <code>removeMenuListener</code> method. When a
- * menu is hidden or shown, the appropriate method will
- * be invoked.
- * </p>
- *
- * @see MenuAdapter
- * @see MenuEvent
- */
-public interface MenuListener extends SWTEventListener {
-
-/**
- * Sent when a menu is hidden.
- *
- * @param e an event containing information about the menu operation
- */
-public void menuHidden(MenuEvent e);
-
-/**
- * Sent when a menu is shown.
- *
- * @param e an event containing information about the menu operation
- */
-public void menuShown(MenuEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyEvent.java
deleted file mode 100755
index 2ca717d10a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * text being modified.
- *
- * @see ModifyListener
- */
-
-public final class ModifyEvent extends TypedEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public ModifyEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyListener.java
deleted file mode 100755
index 0126a781e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the events that are generated when text
- * is modified.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a text widget using the
- * <code>addModifyListener</code> method and removed using
- * the <code>removeModifyListener</code> method. When the
- * text is modified, the modifyText method will be invoked.
- * </p>
- *
- * @see ModifyEvent
- */
-public interface ModifyListener extends SWTEventListener {
-
-/**
- * Sent when the text is modified.
- *
- * @param e an event containing information about the modify
- */
-public void modifyText(ModifyEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseAdapter.java
deleted file mode 100755
index 6f7b1c377f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseAdapter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>MouseListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>MouseEvent</code>s
- * which occur as mouse buttons are pressed and released can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see MouseListener
- * @see MouseEvent
- */
-public abstract class MouseAdapter implements MouseListener {
-
-/**
- * Sent when a mouse button is pressed twice within the
- * (operating system specified) double click period.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the mouse double click
- *
- * @see org.eclipse.swt.widgets.Display#getDoubleClickTime
- */
-public void mouseDoubleClick(MouseEvent e) {
-}
-
-/**
- * Sent when a mouse button is pressed.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the mouse button press
- */
-public void mouseDown(MouseEvent e) {
-}
-
-/**
- * Sent when a mouse button is released.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the mouse button release
- */
-public void mouseUp(MouseEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseEvent.java
deleted file mode 100755
index d56a77c8c5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseEvent.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent whenever mouse
- * related actions occur. This includes mouse buttons
- * being pressed and released, the mouse pointer being
- * moved and the mouse pointer crossing widget boundaries.
- * <p>
- * Note: The <code>button</code> field is an integer that
- * represents the mouse button number. This is not the same
- * as the <code>SWT</code> mask constants <code>BUTTONx</code>.
- * </p>
- *
- * @see MouseListener
- * @see MouseMoveListener
- * @see MouseTrackListener
- */
-
-public final class MouseEvent extends TypedEvent {
-
- /**
- * the button that was pressed or released; 1 for the
- * first button, 2 for the second button, and 3 for the
- * third button, etc.
- */
- public int button;
-
- /**
- * the state of the keyboard modifier keys at the time
- * the event was generated
- */
- public int stateMask;
-
- /**
- * the widget-relative, x coordinate of the pointer
- * at the time the mouse button was pressed or released
- */
- public int x;
-
- /**
- * the widget-relative, y coordinate of the pointer
- * at the time the mouse button was pressed or released
- */
- public int y;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public MouseEvent(Event e) {
- super(e);
- this.x = e.x;
- this.y = e.y;
- this.button = e.button;
- this.stateMask = e.stateMask;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseListener.java
deleted file mode 100755
index 05262c485e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseListener.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated as mouse buttons
- * are pressed.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addMouseListener</code> method and removed using
- * the <code>removeMouseListener</code> method. When a
- * mouse button is pressed or released, the appropriate method
- * will be invoked.
- * </p>
- *
- * @see MouseAdapter
- * @see MouseEvent
- */
-public interface MouseListener extends SWTEventListener {
-
-/**
- * Sent when a mouse button is pressed twice within the
- * (operating system specified) double click period.
- *
- * @param e an event containing information about the mouse double click
- *
- * @see org.eclipse.swt.widgets.Display#getDoubleClickTime
- */
-public void mouseDoubleClick(MouseEvent e);
-
-/**
- * Sent when a mouse button is pressed.
- *
- * @param e an event containing information about the mouse button press
- */
-public void mouseDown(MouseEvent e);
-
-/**
- * Sent when a mouse button is released.
- *
- * @param e an event containing information about the mouse button release
- */
-public void mouseUp(MouseEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseMoveListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseMoveListener.java
deleted file mode 100755
index 493eaea8d9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseMoveListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the events that are generated as the mouse
- * pointer moves.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addMouseMoveListener</code> method and removed using
- * the <code>removeMouseMoveListener</code> method. As the
- * mouse moves, the mouseMove method will be invoked.
- * </p>
- *
- * @see MouseEvent
- */
-public interface MouseMoveListener extends SWTEventListener {
-
-/**
- * Sent when the mouse moves.
- *
- * @param e an event containing information about the mouse move
- */
-public void mouseMove(MouseEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackAdapter.java
deleted file mode 100755
index dad082237d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>MouseTrackListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>MouseEvent</code>s which
- * occur as the mouse pointer passes (or hovers) over controls can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see MouseTrackListener
- * @see MouseEvent
- */
-public class MouseTrackAdapter implements MouseTrackListener {
-
-/**
- * Sent when the mouse pointer passes into the area of
- * the screen covered by a control.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the mouse enter
- */
-public void mouseEnter(MouseEvent e) {
-}
-
-/**
- * Sent when the mouse pointer passes out of the area of
- * the screen covered by a control.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the mouse exit
- */
-public void mouseExit(MouseEvent e) {
-}
-
-/**
- * Sent when the mouse pointer hovers (that is, stops moving
- * for an (operating system specified) period of time) over
- * a control.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the hover
- */
-public void mouseHover(MouseEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackListener.java
deleted file mode 100755
index 3f1b3c148f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated as the mouse
- * pointer passes (or hovers) over controls.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addMouseTrackListener</code> method and removed using
- * the <code>removeMouseTrackListener</code> method. When the
- * mouse pointer passes into or out of the area of the screen
- * covered by a control or pauses while over a control, the
- * appropriate method will be invoked.
- * </p>
- *
- * @see MouseTrackAdapter
- * @see MouseEvent
- */
-public interface MouseTrackListener extends SWTEventListener {
-
-/**
- * Sent when the mouse pointer passes into the area of
- * the screen covered by a control.
- *
- * @param e an event containing information about the mouse enter
- */
-public void mouseEnter(MouseEvent e);
-
-/**
- * Sent when the mouse pointer passes out of the area of
- * the screen covered by a control.
- *
- * @param e an event containing information about the mouse exit
- */
-public void mouseExit(MouseEvent e);
-
-/**
- * Sent when the mouse pointer hovers (that is, stops moving
- * for an (operating system specified) period of time) over
- * a control.
- *
- * @param e an event containing information about the hover
- */
-public void mouseHover(MouseEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintEvent.java
deleted file mode 100755
index 51cacfe55d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintEvent.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.graphics.GC;
-
-/**
- * Instances of this class are sent as a result of
- * visible areas of controls requiring re-painting.
- *
- * @see PaintListener
- */
-
-public final class PaintEvent extends TypedEvent {
-
- /**
- * the graphics context to use when painting
- * that is configured to use the colors, font and
- * damaged region of the control. It is valid
- * only during the paint and must not be disposed
- */
- public GC gc;
-
- /**
- * the x offset of the bounding rectangle of the
- * region that requires painting
- */
- public int x;
-
- /**
- * the y offset of the bounding rectangle of the
- * region that requires painting
- */
- public int y;
-
- /**
- * the width of the bounding rectangle of the
- * region that requires painting
- */
- public int width;
-
- /**
- * the height of the bounding rectangle of the
- * region that requires painting
- */
- public int height;
-
- /**
- * the number of following paint events which
- * are pending which may always be zero on
- * some platforms
- */
- public int count;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public PaintEvent(Event e) {
- super(e);
- this.gc = e.gc;
- this.x = e.x;
- this.y = e.y;
- this.width = e.width;
- this.height = e.height;
- this.count = e.count;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintListener.java
deleted file mode 100755
index 127fb67f9f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated when the
- * control needs to be painted.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addPaintListener</code> method and removed using
- * the <code>removePaintListener</code> method. When a
- * paint event occurs, the paintControl method will be
- * invoked.
- * </p>
- *
- * @see PaintEvent
- */
-public interface PaintListener extends SWTEventListener {
-
-/**
- * Sent when a paint event occurs for the control.
- *
- * @param e an event containing information about the paint
- */
-public void paintControl(PaintEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionAdapter.java
deleted file mode 100755
index 8724e9c9fa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>SelectionListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>SelectionEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see SelectionListener
- * @see SelectionEvent
- */
-public abstract class SelectionAdapter implements SelectionListener {
-
-/**
- * Sent when selection occurs in the control.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the selection
- */
-public void widgetSelected(SelectionEvent e) {
-}
-
-/**
- * Sent when default selection occurs in the control.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the default selection
- */
-public void widgetDefaultSelected(SelectionEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionEvent.java
deleted file mode 100755
index c33c9d10a7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionEvent.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * Instances of this class are sent as a result of
- * widgets being selected.
- * <p>
- * Note: The fields that are filled in depend on the widget.
- * </p>
- *
- * @see SelectionListener
- */
-
-public class SelectionEvent extends TypedEvent {
-
- /**
- * the item that was selected
- */
- public Widget item;
-
- /**
- * extra detail information about the selection
- */
- public int detail;
-
- /**
- * the x location of the selected area
- */
- public int x;
-
- /**
- * the y location of selected area
- */
- public int y;
-
- /**
- * the width of selected area
- */
- public int width;
-
- /**
- * the height of selected area
- */
- public int height;
-
- /**
- * the state of the keyboard modifier keys at the time
- * the event was generated.
- */
- public int stateMask;
-
- /**
- * a flag indicating whether the operation should be allowed
- */
- public boolean doit;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public SelectionEvent(Event e) {
- super(e);
- this.item = e.item;
- this.x = e.x;
- this.y = e.y;
- this.width = e.width;
- this.height = e.height;
- this.detail = e.detail;
- this.stateMask = e.stateMask;
- this.doit = e.doit;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionListener.java
deleted file mode 100755
index 27b046d003..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated when selection
- * occurs in a control.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addSelectionListener</code> method and removed using
- * the <code>removeSelectionListener</code> method. When
- * selection occurs in a control the appropriate method
- * will be invoked.
- * </p>
- *
- * @see SelectionAdapter
- * @see SelectionEvent
- */
-public interface SelectionListener extends SWTEventListener {
-
-/**
- * Sent when selection occurs in the control.
- * <p>
- * For example, on some platforms selection occurs in
- * a List when the user selects an item or items.
- * </p>
- *
- * @param e an event containing information about the selection
- */
-public void widgetSelected(SelectionEvent e);
-
-/**
- * Sent when default selection occurs in the control.
- * <p>
- * For example, on some platforms default selection occurs
- * in a List when the user double-clicks an item or types
- * return in a Text.
- * </p>
- *
- * @param e an event containing information about the default selection
- */
-public void widgetDefaultSelected(SelectionEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellAdapter.java
deleted file mode 100755
index 93a6fb85ff..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellAdapter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>ShellListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>ShellEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see ShellListener
- * @see ShellEvent
- */
-public abstract class ShellAdapter implements ShellListener {
-
-/**
- * Sent when a shell becomes the active window.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the activation
- */
-public void shellActivated(ShellEvent e) {
-}
-
-/**
- * Sent when a shell is closed.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the close
- */
-public void shellClosed(ShellEvent e) {
-}
-
-/**
- * Sent when a shell stops being the active window.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the deactivation
- */
-public void shellDeactivated(ShellEvent e) {
-}
-
-/**
- * Sent when a shell is un-minimized.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the un-minimization
- */
-public void shellDeiconified(ShellEvent e) {
-}
-
-/**
- * Sent when a shell is minimized.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the minimization
- */
-public void shellIconified(ShellEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellEvent.java
deleted file mode 100755
index 6273f8de22..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * operations being performed on shells.
- *
- * @see ShellListener
- */
-
-public final class ShellEvent extends TypedEvent {
-
- /**
- * a flag indicating whether the operation should be allowed
- */
- public boolean doit;
-
-public ShellEvent(Event e) {
- super(e);
- this.doit = e.doit;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellListener.java
deleted file mode 100755
index 22334a0f2b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellListener.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with changes in state of <code>Shell</code>s.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addShellListener</code> method and removed using
- * the <code>removeShellListener</code> method. When the
- * state of a shell changes, the appropriate method will
- * be invoked.
- * </p>
- *
- * @see ShellAdapter
- * @see ShellEvent
- */
-public interface ShellListener extends SWTEventListener {
-
-/**
- * Sent when a shell becomes the active window.
- *
- * @param e an event containing information about the activation
- */
-public void shellActivated(ShellEvent e);
-
-/**
- * Sent when a shell is closed.
- *
- * @param e an event containing information about the close
- */
-public void shellClosed(ShellEvent e);
-
-/**
- * Sent when a shell stops being the active window.
- *
- * @param e an event containing information about the deactivation
- */
-public void shellDeactivated(ShellEvent e);
-
-/**
- * Sent when a shell is un-minimized.
- *
- * @param e an event containing information about the un-minimization
- */
-public void shellDeiconified(ShellEvent e);
-
-/**
- * Sent when a shell is minimized.
- *
- * @param e an event containing information about the minimization
- */
-public void shellIconified(ShellEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseEvent.java
deleted file mode 100755
index 9cd752f8d8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * widget traversal actions.
- *
- * @see TraverseListener
- */
-
-public class TraverseEvent extends KeyEvent {
-
- /**
- * the type of traversal
- */
- public int detail;
-
- /**
- * a flag indicating whether the operation should be allowed
- */
- public boolean doit;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public TraverseEvent(Event e) {
- super(e);
- this.doit = e.doit;
- this.detail = e.detail;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseListener.java
deleted file mode 100755
index d20394d323..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the events that are generated when a
- * traverse event occurs in a control.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addTraverseListener</code> method and removed using
- * the <code>removeTraverseListener</code> method. When a
- * traverse event occurs in a control, the keyTraversed method
- * will be invoked.
- * </p>
- *
- * @see TraverseEvent
- */
-public interface TraverseListener extends SWTEventListener {
-
-/**
- * Sent when a traverse event occurs in a control.
- * <p>
- * A traverse event occurs when the user presses a traversal
- * key. Traversal keys are typically tab and arrow keys, along
- * with certain other keys on some platforms. Traversal key
- * constants beginning with <code>TRAVERSE_</code> are defined
- * in the <code>SWT</code> class.
- * </p>
- *
- * @param e an event containing information about the traverse
- */
-public void keyTraversed(TraverseEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeAdapter.java
deleted file mode 100755
index 7c1cd12e4d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This adapter class provides default implementations for the
- * methods described by the <code>TreeListener</code> interface.
- * <p>
- * Classes that wish to deal with <code>TreeEvent</code>s can
- * extend this class and override only the methods which they are
- * interested in.
- * </p>
- *
- * @see TreeListener
- * @see TreeEvent
- */
-public abstract class TreeAdapter implements TreeListener {
-
-/**
- * Sent when a tree branch is collapsed.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the tree operation
- */
-public void treeCollapsed(TreeEvent e) {
-}
-
-/**
- * Sent when a tree branch is expanded.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the tree operation
- */
-public void treeExpanded(TreeEvent e) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeEvent.java
deleted file mode 100755
index a930b8773e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * trees being expanded and collapsed.
- *
- * @see TreeListener
- */
-
-public final class TreeEvent extends SelectionEvent {
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public TreeEvent(Event e) {
- super(e);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeListener.java
deleted file mode 100755
index ca1ef793e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the expanding and collapsing of tree
- * branches.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a control using the
- * <code>addTreeListener</code> method and removed using
- * the <code>removeTreeListener</code> method. When a branch
- * of a tree is expanded or collapsed, the appropriate method
- * will be invoked.
- * </p>
- *
- * @see TreeAdapter
- * @see TreeEvent
- */
-public interface TreeListener extends SWTEventListener {
-
-/**
- * Sent when a tree branch is collapsed.
- *
- * @param e an event containing information about the tree operation
- */
-public void treeCollapsed(TreeEvent e);
-
-/**
- * Sent when a tree branch is expanded.
- *
- * @param e an event containing information about the tree operation
- */
-public void treeExpanded(TreeEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java
deleted file mode 100755
index 2157df732e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.SWTEventObject;
-
-/**
- * This is the super class for all typed event classes provided
- * by SWT. Typed events contain particular information which is
- * applicable to the event occurance.
- *
- * @see org.eclipse.swt.widgets.Event
- */
-public class TypedEvent extends SWTEventObject {
-
- /**
- * the widget that issued the event
- */
- public Widget widget;
-
- /**
- * the time that the event occurred
- */
- public int time;
-
- /**
- * a field for application use
- */
- public Object data;
-
-/**
- * Constructs a new instance of this class.
- *
- * @param source the object that fired the event
- */
-public TypedEvent(Object object) {
- super(object);
-}
-
-/**
- * Constructs a new instance of this class based on the
- * information in the argument.
- *
- * @param e the low level event to initialize the receiver with
- */
-public TypedEvent(Event e) {
- super(e.widget);
- this.widget = e.widget;
- this.time = e.time;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyEvent.java
deleted file mode 100755
index e90f60701f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyEvent.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Instances of this class are sent as a result of
- * widgets handling keyboard events
- *
- * @see VerifyListener
- */
-
-public final class VerifyEvent extends KeyEvent {
-
- /**
- * the range of text being modified
- */
- public int start, end;
-
- /**
- * the new text that will be inserted
- */
- public String text;
-
- /**
- * a flag indicating whether the operation should be allowed
- */
- public boolean doit;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public VerifyEvent(Event e) {
- super(e);
- this.character = e.character;
- this.keyCode = e.keyCode;
- this.stateMask = e.stateMask;
- this.start = e.start;
- this.end = e.end;
- this.text = e.text;
- this.doit = e.doit;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyListener.java
deleted file mode 100755
index 8a050cf46d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.events;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the events that are generated when text
- * is about to be modified.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to a text widget using the
- * <code>addVerifyListener</code> method and removed using
- * the <code>removeVerifyListener</code> method. When the
- * text is about to be modified, the verifyText method
- * will be invoked.
- * </p>
- *
- * @see VerifyEvent
- */
-public interface VerifyListener extends SWTEventListener {
-
-/**
- * Sent when the text is about to be modified.
- * <p>
- * A verify event occurs after the user has done something
- * to modify the text (typically typed a key), but before
- * the text is modified. The doit field in the verify event
- * indicates whether or not to modify the text.
- * </p>
- *
- * @param e an event containing information about the verify
- */
-public void verifyText(VerifyEvent e);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/package.html
deleted file mode 100755
index 6cb72031fc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT <em>typed listener</em> support.
-<h2>
-Package Specification</h2>
-This package provides the typed events and listener interfaces and,
-where appropriate, matching adapter classes which make up the
-"high level" <em>typed listener</em> support provided by SWT.
-<p>
-For contrast, see also the <em>untyped listener</em> support provided
-by class <code>org.eclipse.swt.widgets.Event</code> and interface
-<code>org.eclipse.swt.widgets.Listener</code>, and the
-<code>addListener</code> and <code>removeListener</code> methods in
-class <code>org.eclipse.swt.widgets.Widget</code>.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Drawable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Drawable.java
deleted file mode 100755
index 77c36fdefc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Drawable.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public interface Drawable {
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Drawable</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-
-public int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Drawable</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int handle, GCData data);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java
deleted file mode 100755
index ca7e26be42..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java
+++ /dev/null
@@ -1,3540 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.image.*;
-import org.eclipse.swt.internal.CloneableCompatibility;
-
-/**
- * Instances of this class are device-independent descriptions
- * of images. They are typically used as an intermediate format
- * between loading from or writing to streams and creating an
- * <code>Image</code>.
- * <p>
- * Note that the public fields <code>x</code>, <code>y</code>,
- * <code>disposalMethod</code> and <code>delayTime</code> are
- * typically only used when the image is in a set of images used
- * for animation.
- * </p>
- *
- * @see Image
- * @see ImageLoader
- */
-
-public final class ImageData implements CloneableCompatibility {
-
- /**
- * the width of the image, in pixels
- */
- public int width;
-
- /**
- * the height of the image, in pixels
- */
- public int height;
-
- /**
- * the color depth of the image, in bits per pixel
- * <p>
- * Note that a depth of 8 or less does not necessary
- * mean that the image is palette indexed, or
- * conversely that a depth greater than 8 means that
- * the image is direct color. Check the associated
- * PaletteData's isDirect field for such determinations.
- */
- public int depth;
-
- /**
- * the scanline padding
- * <p>
- * If one scanline of the image is not a multiple of
- * this number, it will be padded with zeros until it is.
- * </p>
- */
- public int scanlinePad;
-
- /**
- * the number of bytes per scanline
- * <p>
- * This is a multiple of the scanline padding.
- * </p>
- */
- public int bytesPerLine;
-
- /**
- * the pixel data of the image
- * <p>
- * Note that for 16 bit depth images the pixel data is stored
- * in least significant byte order; however, for 24bit and
- * 32bit depth images the pixel data is stored in most
- * significant byte order.
- * </p>
- */
- public byte[] data;
-
- /**
- * the color table for the image
- */
- public PaletteData palette;
-
- /**
- * the transparent pixel
- * <p>
- * Pixels with this value are transparent.
- * </p><p>
- * The default is -1 which means 'no transparent pixel'.
- * </p>
- */
- public int transparentPixel;
-
- /**
- * icon-specific field containing the data from the icon mask
- * <p>
- * This is a 1 bit bitmap stored with the most significant
- * bit first. The number of bytes per scanline is
- * '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'.
- * </p><p>
- * The default is null which means 'no transparency mask'.
- * </p>
- */
- public byte[] maskData;
-
- /**
- * icon-specific field containing the scanline pad of the mask
- * <p>
- * If one scanline of the transparency mask is not a
- * multiple of this number, it will be padded with zeros until
- * it is.
- * </p>
- */
- public int maskPad;
-
- /**
- * the alpha data of the image
- * <p>
- * Every pixel can have an <em>alpha blending</em> value that
- * varies from 0, meaning fully transparent, to 255 meaning
- * fully opaque. The number of bytes per scanline is
- * 'width'.
- * </p>
- */
- public byte[] alphaData;
-
- /**
- * the global alpha value to be used for every pixel
- * <p>
- * If this value is set, the <code>alphaData</code> field
- * is ignored and when the image is rendered each pixel
- * will be blended with the background an amount
- * proportional to this value.
- * </p><p>
- * The default is -1 which means 'no global alpha value'
- * </p>
- */
- public int alpha;
-
- /**
- * the type of file that the image was read in from,
- * expressed as one of the following values:
- * <dl>
- * <dt><code>IMAGE_BMP</code></dt>
- * <dd>Windows BMP file format, no compression</dd>
- * <dt><code>IMAGE_BMP_RLE</code></dt>
- * <dd>Windows BMP file format, RLE compression if appropriate</dd>
- * <dt><code>IMAGE_GIF</code></dt>
- * <dd>GIF file format</dd>
- * <dt><code>IMAGE_ICO</code></dt>
- * <dd>Windows ICO file format</dd>
- * <dt><code>IMAGE_JPEG</code></dt>
- * <dd>JPEG file format</dd>
- * <dt><code>IMAGE_PNG</code></dt>
- * <dd>PNG file format</dd>
- * </dl>
- */
- public int type;
-
- /**
- * the x coordinate of the top left corner of the image
- * within the logical screen (this field corresponds to
- * the GIF89a Image Left Position value)
- */
- public int x;
-
- /**
- * The y coordinate of the top left corner of the image
- * within the logical screen (this field corresponds to
- * the GIF89a Image Top Position value)
- */
- public int y;
-
- /**
- * a description of how to dispose of the current image
- * before displaying the next, expressed as one of the
- * following values:
- * <dl>
- * <dt><code>DM_UNSPECIFIED</code></dt>
- * <dd>disposal method not specified</dd>
- * <dt><code>DM_FILL_NONE</code></dt>
- * <dd>do nothing - leave the image in place</dd>
- * <dt><code>DM_FILL_BACKGROUND</code></dt>
- * <dd>fill with the background color</dd>
- * <dt><code>DM_FILL_PREVIOUS</code></dt>
- * <dd>restore the previous picture</dd>
- * </dl>
- * (this field corresponds to the GIF89a Disposal Method value)
- */
- public int disposalMethod;
-
- /**
- * the time to delay before displaying the next image
- * in an animation (this field corresponds to the GIF89a
- * Delay Time value)
- */
- public int delayTime;
-
- /**
- * Arbitrary channel width data to 8-bit conversion table
- */
- static final byte[][] ANY_TO_EIGHT = new byte[9][];
- static {
- for (int b = 0; b < 9; ++b) {
- byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b];
- if (b == 0) continue;
- int inc = 0;
- for (int bit = 0x10000; (bit >>= b) != 0;) inc |= bit;
- for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = (byte)(v >> 8);
- }
- }
- static final byte[] ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8];
-
- /**
- * Scaled 8x8 Bayer dither matrix
- */
- static final int[][] DITHER_MATRIX = {
- { 0xfc0000, 0x7c0000, 0xdc0000, 0x5c0000, 0xf40000, 0x740000, 0xd40000, 0x540000 },
- { 0x3c0000, 0xbc0000, 0x1c0000, 0x9c0000, 0x340000, 0xb40000, 0x140000, 0x940000 },
- { 0xcc0000, 0x4c0000, 0xec0000, 0x6c0000, 0xc40000, 0x440000, 0xe40000, 0x640000 },
- { 0x0c0000, 0x8c0000, 0x2c0000, 0xac0000, 0x040000, 0x840000, 0x240000, 0xa40000 },
- { 0xf00000, 0x700000, 0xd00000, 0x500000, 0xf80000, 0x780000, 0xd80000, 0x580000 },
- { 0x300000, 0xb00000, 0x100000, 0x900000, 0x380000, 0xb80000, 0x180000, 0x980000 },
- { 0xc00000, 0x400000, 0xe00000, 0x600000, 0xc80000, 0x480000, 0xe80000, 0x680000 },
- { 0x000000, 0x800000, 0x200000, 0xa00000, 0x080000, 0x880000, 0x280000, 0xa80000 }
- };
-
-/**
- * Constructs a new, empty ImageData with the given width, height,
- * depth and palette. The data will be initialized to an (all zero)
- * array of the appropriate size.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @param depth the depth of the image
- * @param palette the palette of the image (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative</li>
- * <li>ERROR_NULL_ARGUMENT - if the palette is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth argument is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public ImageData(int width, int height, int depth, PaletteData palette) {
- this(width, height, depth, palette,
- 4, null, 0, null,
- null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
-}
-
-/**
- * Constructs a new, empty ImageData with the given width, height,
- * depth, palette, scanlinePad and data.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @param depth the depth of the image
- * @param palette the palette of the image
- * @param scanlinePad the padding of each line, in bytes
- * @param data the data of the image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative</li>
- * <li>ERROR_NULL_ARGUMENT - if the palette or data is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth argument is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data) {
- this(width, height, depth, palette,
- scanlinePad, checkData(data), 0, null,
- null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
-}
-
-/**
- * Constructs an <code>ImageData</code> loaded from the specified
- * input stream. Throws an error if an error occurs while loading
- * the image, or if the image has an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p>
- *
- * @param stream the input stream to load the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the stream is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- *
- * @see ImageLoader#load
- */
-public ImageData(InputStream stream) {
- ImageData[] data = new ImageLoader().load(stream);
- if (data.length < 1) SWT.error(SWT.ERROR_INVALID_IMAGE);
- ImageData i = data[0];
- setAllFields(
- i.width,
- i.height,
- i.depth,
- i.scanlinePad,
- i.bytesPerLine,
- i.data,
- i.palette,
- i.transparentPixel,
- i.maskData,
- i.maskPad,
- i.alphaData,
- i.alpha,
- i.type,
- i.x,
- i.y,
- i.disposalMethod,
- i.delayTime);
-}
-
-/**
- * Constructs an <code>ImageData</code> loaded from a file with the
- * specified name. Throws an error if an error occurs loading the
- * image, or if the image has an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the file contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p>
- *
- * @param filename the name of the file to load the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO if an IO error occurs while reading data</li>
- * </ul>
- */
-public ImageData(String filename) {
- ImageData[] data = new ImageLoader().load(filename);
- if (data.length < 1) SWT.error(SWT.ERROR_INVALID_IMAGE);
- ImageData i = data[0];
- setAllFields(
- i.width,
- i.height,
- i.depth,
- i.scanlinePad,
- i.bytesPerLine,
- i.data,
- i.palette,
- i.transparentPixel,
- i.maskData,
- i.maskPad,
- i.alphaData,
- i.alpha,
- i.type,
- i.x,
- i.y,
- i.disposalMethod,
- i.delayTime);
-}
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-ImageData() {
-}
-
-/**
- * Constructs an image data by giving values for all non-computable fields.
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- */
-ImageData(
- int width, int height, int depth, PaletteData palette,
- int scanlinePad, byte[] data, int maskPad, byte[] maskData,
- byte[] alphaData, int alpha, int transparentPixel, int type,
- int x, int y, int disposalMethod, int delayTime)
-{
-
- if (palette == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8
- || depth == 16 || depth == 24 || depth == 32)) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (width <= 0 || height <= 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1))
- / scanlinePad * scanlinePad;
- setAllFields(
- width,
- height,
- depth,
- scanlinePad,
- bytesPerLine,
- data != null ? data : new byte[bytesPerLine * height],
- palette,
- transparentPixel,
- maskData,
- maskPad,
- alphaData,
- alpha,
- type,
- x,
- y,
- disposalMethod,
- delayTime);
-}
-
-/**
- * Initializes all fields in the receiver. This method must be called
- * by all public constructors to ensure that all fields are initialized
- * for a new ImageData object. If a new field is added to the class,
- * then it must be added to this method.
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- */
-void setAllFields(int width, int height, int depth, int scanlinePad,
- int bytesPerLine, byte[] data, PaletteData palette, int transparentPixel,
- byte[] maskData, int maskPad, byte[] alphaData, int alpha,
- int type, int x, int y, int disposalMethod, int delayTime) {
-
- this.width = width;
- this.height = height;
- this.depth = depth;
- this.scanlinePad = scanlinePad;
- this.bytesPerLine = bytesPerLine;
- this.data = data;
- this.palette = palette;
- this.transparentPixel = transparentPixel;
- this.maskData = maskData;
- this.maskPad = maskPad;
- this.alphaData = alphaData;
- this.alpha = alpha;
- this.type = type;
- this.x = x;
- this.y = y;
- this.disposalMethod = disposalMethod;
- this.delayTime = delayTime;
-}
-
-/**
- * Invokes internal SWT functionality to create a new instance of
- * this class.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>ImageData</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is subject
- * to change without notice, and should never be called from
- * application code.
- * </p>
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- *
- * @private
- */
-public static ImageData internal_new(
- int width, int height, int depth, PaletteData palette,
- int scanlinePad, byte[] data, int maskPad, byte[] maskData,
- byte[] alphaData, int alpha, int transparentPixel, int type,
- int x, int y, int disposalMethod, int delayTime)
-{
- return new ImageData(
- width, height, depth, palette, scanlinePad, data, maskPad, maskData,
- alphaData, alpha, transparentPixel, type, x, y, disposalMethod, delayTime);
-}
-
-ImageData colorMaskImage(int pixel) {
- ImageData mask = new ImageData(width, height, 1, bwPalette(),
- Image.DEFAULT_SCANLINE_PAD, null, 0, null,
- null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
- int[] row = new int[width];
- for (int y = 0; y < height; y++) {
- getPixels(0, y, width, row, 0);
- for (int i = 0; i < width; i++) {
- if (pixel != -1 && row[i] == pixel) {
- row[i] = 0;
- } else {
- row[i] = 1;
- }
- }
- mask.setPixels(0, y, width, row, 0);
- }
- return mask;
-}
-
-static byte[] checkData(byte [] data) {
- if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return data;
-}
-
-/**
- * Returns a new instance of the same class as the receiver,
- * whose slots have been filled in with <em>copies</em> of
- * the values in the slots of the receiver. That is, the
- * returned object is a <em>deep copy</em> of the receiver.
- *
- * @return a copy of the receiver.
- */
-public Object clone() {
- byte[] cloneData = new byte[data.length];
- System.arraycopy(data, 0, cloneData, 0, data.length);
- byte[] cloneMaskData = null;
- if (maskData != null) {
- cloneMaskData = new byte[maskData.length];
- System.arraycopy(maskData, 0, cloneMaskData, 0, maskData.length);
- }
- byte[] cloneAlphaData = null;
- if (alphaData != null) {
- cloneAlphaData = new byte[alphaData.length];
- System.arraycopy(alphaData, 0, cloneAlphaData, 0, alphaData.length);
- }
- return new ImageData(
- width,
- height,
- depth,
- palette,
- scanlinePad,
- cloneData,
- maskPad,
- cloneMaskData,
- cloneAlphaData,
- alpha,
- transparentPixel,
- type,
- x,
- y,
- disposalMethod,
- delayTime);
-}
-
-/**
- * Returns the alpha value at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's alpha data.
- *
- * @param x the x coodinate of the pixel to get the alpha value of
- * @param y the y coordinate of the pixel to get the alpha value of
- * @return the alpha value at the given coordinates
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either argument is out of range</li>
- * </ul>
- */
-public int getAlpha(int x, int y) {
- if (x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- if (alphaData == null) return 255;
- return alphaData[y * width + x] & 0xFF;
-}
-
-/**
- * Returns <code>getWidth</code> alpha values starting at offset
- * <code>x</code> in scanline <code>y</code> in the receiver's alpha
- * data starting at <code>startIndex</code>.
- *
- * @param x the x position of the pixel to begin getting alpha values
- * @param y the y position of the pixel to begin getting alpha values
- * @param getWidth the width of the data to get
- * @param alphas the buffer in which to put the alpha values
- * @param startIndex the offset into the image to begin getting alpha values
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
- * </ul>
- */
-public void getAlphas(int x, int y, int getWidth, byte[] alphas, int startIndex) {
- if (alphas == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (getWidth == 0) return;
-
- if (alphaData == null) {
- int endIndex = startIndex + getWidth;
- for (int i = startIndex; i < endIndex; i++) {
- alphas[i] = (byte)255;
- }
- return;
- }
- // may throw an IndexOutOfBoundsException
- System.arraycopy(alphaData, y * width + x, alphas, startIndex, getWidth);
-}
-
-/**
- * Returns the pixel value at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data.
- *
- * @param x the x position of the pixel to get
- * @param y the y position of the pixel to get
- * @return the pixel at the given coordinates
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either argument is out of bounds</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public int getPixel(int x, int y) {
- if (x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int index;
- int theByte;
- int mask;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index] & 0xFF;
- mask = 1 << (7 - (x & 0x7));
- if ((theByte & mask) == 0) {
- return 0;
- } else {
- return 1;
- }
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index] & 0xFF;
- int offset = 3 - (x % 4);
- mask = 3 << (offset * 2);
- return (theByte & mask) >> (offset * 2);
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- theByte = data[index] & 0xFF;
- if ((x & 0x1) == 0) {
- return theByte >> 4;
- } else {
- return theByte & 0x0F;
- }
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x ;
- return data[index] & 0xFF;
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- return ((data[index+1] & 0xFF) << 8) + (data[index] & 0xFF);
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- return ((data[index] & 0xFF) << 16) + ((data[index+1] & 0xFF) << 8) +
- (data[index+2] & 0xFF);
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- return ((data[index] & 0xFF) << 24) + ((data[index+1] & 0xFF) << 16) +
- ((data[index+2] & 0xFF) << 8) + (data[index+3] & 0xFF);
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- return 0;
-}
-
-/**
- * Returns <code>getWidth</code> pixel values starting at offset
- * <code>x</code> in scanline <code>y</code> in the receiver's
- * data starting at <code>startIndex</code>.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the byte array to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4 or 8
- * (For higher depths, use the int[] version of this method.)</li>
- * </ul>
- */
-public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (getWidth == 0) return;
- int index;
- int theByte;
- int mask = 0;
- int n = getWidth;
- int i = startIndex;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index] & 0xFF;
- while (n > 1) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((theByte & mask) == 0) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- if (n > 0) theByte = data[index] & 0xFF;
- }
- }
- }
- return;
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index] & 0xFF;
- int offset;
- while (n > 0) {
- offset = 3 - (srcX % 4);
- mask = 3 << (offset * 2);
- pixels[i] = (byte)((theByte & mask) >> (offset * 2));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- theByte = data[index] & 0xFF;
- }
- }
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- if ((x & 0x1) == 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte & 0x0F);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- while (n > 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte >> 4);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- pixels[i] = (byte)(theByte & 0x0F);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- }
- if (n > 0) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte >> 4);
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = data[index];
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-
-/**
- * Returns <code>getWidth</code> pixel values starting at offset
- * <code>x</code> in scanline <code>y</code> in the receiver's
- * data starting at <code>startIndex</code>.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the buffer to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (getWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = getWidth;
- int i = startIndex;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index] & 0xFF;
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((theByte & mask) == 0) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- if (n > 0) theByte = data[index] & 0xFF;
- }
- }
- }
- return;
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index] & 0xFF;
- int offset;
- while (n > 0) {
- offset = 3 - (srcX % 4);
- mask = 3 << (offset * 2);
- pixels[i] = (byte)((theByte & mask) >> (offset * 2));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- theByte = data[index] & 0xFF;
- }
- }
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- if ((x & 0x1) == 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte & 0x0F;
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- while (n > 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte >> 4;
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- pixels[i] = theByte & 0x0F;
- i++;
- n--;
- srcX++;;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- }
- if (n > 0) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte >> 4;
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = data[index] & 0xFF;
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- return;
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index+1] & 0xFF) << 8) + (data[index] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 2;
- }
- }
- return;
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index] & 0xFF) << 16) | ((data[index+1] & 0xFF) << 8)
- | (data[index+2] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 3;
- }
- }
- return;
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- i = startIndex;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index] & 0xFF) << 24) | ((data[index+1] & 0xFF) << 16)
- | ((data[index+2] & 0xFF) << 8) | (data[index+3] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 4;
- }
- }
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-
-/**
- * Returns an array of <code>RGB</code>s which comprise the
- * indexed color table of the receiver, or null if the receiver
- * has a direct color model.
- *
- * @return the RGB values for the image or null if direct color
- *
- * @see PaletteData#getRGBs
- */
-public RGB[] getRGBs() {
- return palette.getRGBs();
-}
-
-/**
- * Returns an <code>ImageData</code> which specifies the
- * transparency mask information for the receiver, or null if the
- * receiver has no transparency and is not an icon.
- *
- * @return the transparency mask or null if none exists
- */
-public ImageData getTransparencyMask() {
- if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
- } else {
- return colorMaskImage(transparentPixel);
- }
-}
-
-/**
- * Returns the image transparency type.
- *
- * @return the receiver's transparency type
- */
-public int getTransparencyType() {
- if (maskData != null) return SWT.TRANSPARENCY_MASK;
- if (transparentPixel != -1) return SWT.TRANSPARENCY_PIXEL;
- if (alphaData != null) return SWT.TRANSPARENCY_ALPHA;
- return SWT.TRANSPARENCY_NONE;
-}
-
-/**
- * Returns the byte order of the receiver.
- *
- * @return MSB_FIRST or LSB_FIRST
- */
-int getByteOrder() {
- return (depth != 16) ? MSB_FIRST : LSB_FIRST;
-}
-
-/**
- * Returns a copy of the receiver which has been stretched or
- * shrunk to the specified size. If either the width or height
- * is negative, the resulting image will be inverted in the
- * associated axis.
- *
- * @param width the width of the new ImageData
- * @param height the height of the new ImageData
- * @return a scaled copy of the image
- */
-public ImageData scaledTo(int width, int height) {
- /* Create a destination image with no data */
- final boolean flipX = (width < 0);
- if (flipX) width = - width;
- final boolean flipY = (height < 0);
- if (flipY) height = - height;
-
- ImageData dest = new ImageData(
- width, height, depth, palette,
- scanlinePad, null, 0, null,
- null, -1, transparentPixel, type,
- x, y, disposalMethod, delayTime);
-
- /* Scale the image contents */
- if (palette.isDirect) blit(BLIT_SRC,
- this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, 0, 0, 0,
- ALPHA_OPAQUE, null, 0,
- dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, 0, 0, 0,
- flipX, flipY);
- else blit(BLIT_SRC,
- this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0,
- dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
-
- /* Scale the image mask or alpha */
- if (maskData != null) {
- dest.maskPad = this.maskPad;
- int destBpl = (dest.width + 7) / 8;
- destBpl = (destBpl + (dest.maskPad - 1)) / dest.maskPad * dest.maskPad;
- dest.maskData = new byte[destBpl * dest.height];
- int srcBpl = (this.width + 7) / 8;
- srcBpl = (srcBpl + (this.maskPad - 1)) / this.maskPad * this.maskPad;
- blit(BLIT_SRC,
- this.maskData, 1, srcBpl, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0,
- dest.maskData, 1, destBpl, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
- } else if (alpha != -1) {
- dest.alpha = this.alpha;
- } else if (alphaData != null) {
- dest.alphaData = new byte[dest.width * dest.height];
- blit(BLIT_SRC,
- this.alphaData, 8, this.width, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0,
- dest.alphaData, 8, dest.width, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
- }
- return dest;
-}
-
-/**
- * Sets the alpha value at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's alpha data.
- *
- * @param x the x coordinate of the alpha value to set
- * @param y the y coordinate of the alpha value to set
- * @param alpha the value to set the alpha to
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * </ul>
- */
-public void setAlpha(int x, int y, int alpha) {
- if (x >= width || y >= height || x < 0 || y < 0 || alpha < 0 || alpha > 255)
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- if (alphaData == null) alphaData = new byte[width * height];
- alphaData[y * width + x] = (byte)alpha;
-}
-
-/**
- * Sets the alpha values starting at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's alpha data to the
- * values from the array <code>alphas</code> starting at
- * <code>startIndex</code>.
- *
- * @param x the x coordinate of the pixel to being setting the alpha values
- * @param y the y coordinate of the pixel to being setting the alpha values
- * @param putWidth the width of the alpha values to set
- * @param alphas the alpha values to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
- * </ul>
- */
-public void setAlphas(int x, int y, int putWidth, byte[] alphas, int startIndex) {
- if (alphas == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (putWidth == 0) return;
-
- if (alphaData == null) alphaData = new byte[width * height];
- // may throw an IndexOutOfBoundsException
- System.arraycopy(alphas, startIndex, alphaData, y * width + x, putWidth);
-}
-
-/**
- * Sets the pixel value at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data.
- *
- * @param x the x coordinate of the pixel to set
- * @param y the y coordinate of the pixel to set
- * @param pixelValue the value to set the pixel to
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public void setPixel(int x, int y, int pixelValue) {
- if (x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int index;
- byte theByte;
- int mask;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index];
- mask = 1 << (7 - (x & 0x7));
- if ((pixelValue & 0x1) == 1) {
- data[index] = (byte)(theByte | mask);
- } else {
- data[index] = (byte)(theByte & (mask ^ -1));
- }
- return;
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index];
- int offset = 3 - (x % 4);
- mask = 0xFF ^ (3 << (offset * 2));
- data[index] = (byte)((data[index] & mask) | (pixelValue << (offset * 2)));
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- if ((x & 0x1) == 0) {
- data[index] = (byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4));
- } else {
- data[index] = (byte)((data[index] & 0xF0) | (pixelValue & 0x0F));
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x ;
- data[index] = (byte)(pixelValue & 0xFF);
- return;
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- data[index + 1] = (byte)((pixelValue >> 8) & 0xFF);
- data[index] = (byte)(pixelValue & 0xFF);
- return;
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- data[index] = (byte)((pixelValue >> 16) & 0xFF);
- data[index + 1] = (byte)((pixelValue >> 8) & 0xFF);
- data[index + 2] = (byte)(pixelValue & 0xFF);
- return;
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- data[index] = (byte)((pixelValue >> 24) & 0xFF);
- data[index + 1] = (byte)((pixelValue >> 16) & 0xFF);
- data[index + 2] = (byte)((pixelValue >> 8) & 0xFF);
- data[index + 3] = (byte)(pixelValue & 0xFF);
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-
-/**
- * Sets the pixel values starting at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data to the
- * values from the array <code>pixels</code> starting at
- * <code>startIndex</code>.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8
- * (For higher depths, use the int[] version of this method.)</li>
- * </ul>
- */
-public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (putWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = putWidth;
- int i = startIndex;
- int pixel;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((pixels[i] & 0x1) == 1) {
- data[index] = (byte)((data[index] & 0xFF) | mask);
- } else {
- data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- }
- }
- }
- return;
- }
- if (depth == 2) {
- byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F };
- index = (y * bytesPerLine) + (x >> 2);
- int offset = 3 - (x % 4);
- while (n > 0) {
- theByte = pixels[i] & 0x3;
- data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- offset = 0;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- offset = 3;
- } else {
- offset--;
- }
- }
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- boolean high = (x & 0x1) == 0;
- while (n > 0) {
- theByte = pixels[i] & 0x0F;
- if (high) {
- data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));
- } else {
- data[index] = (byte)((data[index] & 0xF0) | theByte);
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- high = true;
- srcX = 0;
- } else {
- if (!high) index++;
- high = !high;
- }
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < putWidth; j++) {
- data[index] = (byte)(pixels[i] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-
-/**
- * Sets the pixel values starting at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data to the
- * values from the array <code>pixels</code> starting at
- * <code>startIndex</code>.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (putWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = putWidth;
- int i = startIndex;
- int pixel;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((pixels[i] & 0x1) == 1) {
- data[index] = (byte)((data[index] & 0xFF) | mask);
- } else {
- data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- }
- }
- }
- return;
- }
- if (depth == 2) {
- byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F };
- index = (y * bytesPerLine) + (x >> 2);
- int offset = 3 - (x % 4);
- while (n > 0) {
- theByte = pixels[i] & 0x3;
- data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- offset = 3;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- offset = 3;
- } else {
- offset--;
- }
- }
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- boolean high = (x & 0x1) == 0;
- while (n > 0) {
- theByte = pixels[i] & 0x0F;
- if (high) {
- data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));
- } else {
- data[index] = (byte)((data[index] & 0xF0) | theByte);
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- high = true;
- srcX = 0;
- } else {
- if (!high) index++;
- high = !high;
- }
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < putWidth; j++) {
- data[index] = (byte)(pixels[i] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- return;
-
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)(pixel & 0xFF);
- data[index + 1] = (byte)((pixel >> 8) & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 2;
- }
- }
- return;
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)((pixel >> 16) & 0xFF);
- data[index + 1] = (byte)((pixel >> 8) & 0xFF);
- data[index + 2] = (byte)(pixel & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 3;
- }
- }
- return;
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)((pixel >> 24) & 0xFF);
- data[index + 1] = (byte)((pixel >> 16) & 0xFF);
- data[index + 2] = (byte)((pixel >> 8) & 0xFF);
- data[index + 3] = (byte)(pixel & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 4;
- }
- }
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-
-/**
- * Returns a palette with 2 colors: black & white.
- */
-static PaletteData bwPalette() {
- return new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255)});
-}
-
-/**
- * Gets the offset of the most significant bit for
- * the given mask.
- */
-static int getMSBOffset(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return i + 1;
- }
- return 0;
-}
-
-/**
- * Finds the closest match.
- */
-static int closestMatch(int depth, byte red, byte green, byte blue, int redMask, int greenMask, int blueMask, byte[] reds, byte[] greens, byte[] blues) {
- if (depth > 8) {
- int rshift = 32 - getMSBOffset(redMask);
- int gshift = 32 - getMSBOffset(greenMask);
- int bshift = 32 - getMSBOffset(blueMask);
- return (((red << 24) >>> rshift) & redMask) |
- (((green << 24) >>> gshift) & greenMask) |
- (((blue << 24) >>> bshift) & blueMask);
- }
- int r, g, b;
- int minDistance = 0x7fffffff;
- int nearestPixel = 0;
- int n = reds.length;
- for (int j = 0; j < n; j++) {
- r = (reds[j] & 0xFF) - (red & 0xFF);
- g = (greens[j] & 0xFF) - (green & 0xFF);
- b = (blues[j] & 0xFF) - (blue & 0xFF);
- int distance = r*r + g*g + b*b;
- if (distance < minDistance) {
- nearestPixel = j;
- if (distance == 0) break;
- minDistance = distance;
- }
- }
- return nearestPixel;
-}
-
-/**
- * Blit operation bits to be OR'ed together to specify the desired operation.
- */
-static final int
- BLIT_SRC = 1, // copy source directly, else applies logic operations
- BLIT_ALPHA = 2, // enable alpha blending
- BLIT_DITHER = 4; // enable dithering in low color modes
-
-/**
- * Alpha mode, values 0 - 255 specify global alpha level
- */
-static final int
- ALPHA_OPAQUE = 255, // Fully opaque (ignores any alpha data)
- ALPHA_TRANSPARENT = 0, // Fully transparent (ignores any alpha data)
- ALPHA_CHANNEL_SEPARATE = -1, // Use alpha channel from separate alphaData
- ALPHA_CHANNEL_SOURCE = -2, // Use alpha channel embedded in sourceData
- ALPHA_MASK_UNPACKED = -3, // Use transparency mask formed by bytes in alphaData (non-zero is opaque)
- ALPHA_MASK_PACKED = -4, // Use transparency mask formed by packed bits in alphaData
- ALPHA_MASK_INDEX = -5, // Consider source palette indices transparent if in alphaData array
- ALPHA_MASK_RGB = -6; // Consider source RGBs transparent if in RGB888 format alphaData array
-
-/**
- * Byte and bit order constants.
- */
-static final int MSB_FIRST = 1;
-static final int LSB_FIRST = 2;
-
-/**
- * Data types (internal)
- */
-private static final int
- // direct / true color formats with arbitrary masks & shifts
- TYPE_GENERIC_8 = 0,
- TYPE_GENERIC_16_MSB = 1,
- TYPE_GENERIC_16_LSB = 2,
- TYPE_GENERIC_24 = 3,
- TYPE_GENERIC_32_MSB = 4,
- TYPE_GENERIC_32_LSB = 5,
- // palette indexed color formats
- TYPE_INDEX_8 = 6,
- TYPE_INDEX_4 = 7,
- TYPE_INDEX_2 = 8,
- TYPE_INDEX_1_MSB = 9,
- TYPE_INDEX_1_LSB = 10;
-
-/**
- * Blits a direct palette image into a direct palette image.
- * <p>
- * Note: When the source and destination depth, order and masks
- * are pairwise equal and the blitter operation is BLIT_SRC,
- * the masks are ignored. Hence when not changing the image
- * data format, 0 may be specified for the masks.
- * </p>
- *
- * @param op the blitter operation: a combination of BLIT_xxx flags
- * (see BLIT_xxx constants)
- * @param srcData the source byte array containing image data
- * @param srcDepth the source depth: one of 8, 16, 24, 32
- * @param srcStride the source number of bytes per line
- * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if srcDepth is not 16 or 32
- * @param srcX the top-left x-coord of the source blit region
- * @param srcY the top-left y-coord of the source blit region
- * @param srcWidth the width of the source blit region
- * @param srcHeight the height of the source blit region
- * @param srcRedMask the source red channel mask
- * @param srcGreenMask the source green channel mask
- * @param srcBlueMask the source blue channel mask
- * @param alphaMode the alpha blending or mask mode, may be
- * an integer 0-255 for global alpha; ignored if BLIT_ALPHA
- * not specified in the blitter operations
- * (see ALPHA_MODE_xxx constants)
- * @param alphaData the alpha blending or mask data, varies depending
- * on the value of alphaMode and sometimes ignored
- * @param destData the destination byte array containing image data
- * @param destDepth the destination depth: one of 8, 16, 24, 32
- * @param destStride the destination number of bytes per line
- * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if destDepth is not 16 or 32
- * @param destX the top-left x-coord of the destination blit region
- * @param destY the top-left y-coord of the destination blit region
- * @param destWidth the width of the destination blit region
- * @param destHeight the height of the destination blit region
- * @param destRedMask the destination red channel mask
- * @param destGreenMask the destination green channel mask
- * @param destBlueMask the destination blue channel mask
- * @param flipX if true the resulting image is flipped along the vertical axis
- * @param flipY if true the resulting image is flipped along the horizontal axis
- */
-static void blit(int op,
- byte[] srcData, int srcDepth, int srcStride, int srcOrder,
- int srcX, int srcY, int srcWidth, int srcHeight,
- int srcRedMask, int srcGreenMask, int srcBlueMask,
- int alphaMode, byte[] alphaData, int alphaStride,
- byte[] destData, int destDepth, int destStride, int destOrder,
- int destX, int destY, int destWidth, int destHeight,
- int destRedMask, int destGreenMask, int destBlueMask,
- boolean flipX, boolean flipY) {
- if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return;
-
- // these should be supplied as params later
- final int srcAlphaMask = 0, destAlphaMask = 0;
-
- /*** Prepare scaling data ***/
- final int dwm1 = destWidth - 1;
- final int sfxi = (dwm1 != 0) ? ((srcWidth << 16) - 1) / dwm1 : 0;
- final int dhm1 = destHeight - 1;
- final int sfyi = (dhm1 != 0) ? ((srcHeight << 16) - 1) / dhm1 : 0;
-
- /*** Prepare source-related data ***/
- final int sbpp, stype;
- switch (srcDepth) {
- case 8:
- sbpp = 1;
- stype = TYPE_GENERIC_8;
- break;
- case 16:
- sbpp = 2;
- stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB;
- break;
- case 24:
- sbpp = 3;
- stype = TYPE_GENERIC_24;
- break;
- case 32:
- sbpp = 4;
- stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int spr = srcY * srcStride + srcX * sbpp;
-
- /*** Prepare destination-related data ***/
- final int dbpp, dtype;
- switch (destDepth) {
- case 8:
- dbpp = 1;
- dtype = TYPE_GENERIC_8;
- break;
- case 16:
- dbpp = 2;
- dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB;
- break;
- case 24:
- dbpp = 3;
- dtype = TYPE_GENERIC_24;
- break;
- case 32:
- dbpp = 4;
- dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid destination type");
- return;
- }
- int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp;
- final int dprxi = (flipX) ? -dbpp : dbpp;
- final int dpryi = (flipY) ? -destStride : destStride;
-
- /*** Prepare special processing data ***/
- int apr;
- if ((op & BLIT_ALPHA) != 0) {
- switch (alphaMode) {
- case ALPHA_MASK_UNPACKED:
- case ALPHA_CHANNEL_SEPARATE:
- if (alphaData == null) alphaMode = 0x10000;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_PACKED:
- if (alphaData == null) alphaMode = 0x10000;
- alphaStride <<= 3;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_INDEX:
- //throw new IllegalArgumentException("Invalid alpha type");
- return;
- case ALPHA_MASK_RGB:
- if (alphaData == null) alphaMode = 0x10000;
- apr = 0;
- break;
- default:
- alphaMode = (alphaMode << 16) / 255; // prescale
- case ALPHA_CHANNEL_SOURCE:
- apr = 0;
- break;
- }
- } else {
- alphaMode = 0x10000;
- apr = 0;
- }
-
- /*** Blit ***/
- int dp = dpr;
- int sp = spr;
- if ((alphaMode == 0x10000) && (stype == dtype) &&
- (srcRedMask == destRedMask) && (srcGreenMask == destGreenMask) &&
- (srcBlueMask == destBlueMask) && (srcAlphaMask == destAlphaMask)) {
- /*** Fast blit (straight copy) ***/
- switch (sbpp) {
- case 1:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- destData[dp] = srcData[sp];
- sp += (sfx >>> 16);
- }
- }
- break;
- case 2:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- destData[dp] = srcData[sp];
- destData[dp + 1] = srcData[sp + 1];
- sp += (sfx >>> 16) * 2;
- }
- }
- break;
- case 3:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- destData[dp] = srcData[sp];
- destData[dp + 1] = srcData[sp + 1];
- destData[dp + 2] = srcData[sp + 2];
- sp += (sfx >>> 16) * 3;
- }
- }
- break;
- case 4:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- destData[dp] = srcData[sp];
- destData[dp + 1] = srcData[sp + 1];
- destData[dp + 2] = srcData[sp + 2];
- destData[dp + 3] = srcData[sp + 3];
- sp += (sfx >>> 16) * 4;
- }
- }
- break;
- }
- return;
- }
- /*** Comprehensive blit (apply transformations) ***/
- final int srcRedShift = getChannelShift(srcRedMask);
- final byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)];
- final int srcGreenShift = getChannelShift(srcGreenMask);
- final byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)];
- final int srcBlueShift = getChannelShift(srcBlueMask);
- final byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)];
- final int srcAlphaShift = getChannelShift(srcAlphaMask);
- final byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)];
-
- final int destRedShift = getChannelShift(destRedMask);
- final int destRedWidth = getChannelWidth(destRedMask, destRedShift);
- final byte[] destReds = ANY_TO_EIGHT[destRedWidth];
- final int destRedPreShift = 8 - destRedWidth;
- final int destGreenShift = getChannelShift(destGreenMask);
- final int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift);
- final byte[] destGreens = ANY_TO_EIGHT[destGreenWidth];
- final int destGreenPreShift = 8 - destGreenWidth;
- final int destBlueShift = getChannelShift(destBlueMask);
- final int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift);
- final byte[] destBlues = ANY_TO_EIGHT[destBlueWidth];
- final int destBluePreShift = 8 - destBlueWidth;
- final int destAlphaShift = getChannelShift(destAlphaMask);
- final int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift);
- final byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth];
- final int destAlphaPreShift = 8 - destAlphaWidth;
-
- int ap = apr, alpha = alphaMode;
- int r = 0, g = 0, b = 0, a = 0;
- int rq = 0, gq = 0, bq = 0, aq = 0;
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy,
- sp = spr += (sfy >>> 16) * srcStride,
- ap = apr += (sfy >>> 16) * alphaStride,
- sfy = (sfy & 0xffff) + sfyi,
- dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx,
- dp += dprxi,
- sfx = (sfx & 0xffff) + sfxi) {
- /*** READ NEXT PIXEL ***/
- switch (stype) {
- case TYPE_GENERIC_8: {
- final int data = srcData[sp] & 0xff;
- sp += (sfx >>> 16);
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_MSB: {
- final int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff);
- sp += (sfx >>> 16) * 2;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_LSB: {
- final int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff);
- sp += (sfx >>> 16) * 2;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_24: {
- final int data = (( ((srcData[sp] & 0xff) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp + 2] & 0xff);
- sp += (sfx >>> 16) * 3;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_MSB: {
- final int data = (( (( ((srcData[sp] & 0xff) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp + 2] & 0xff)) << 8) |
- (srcData[sp + 3] & 0xff);
- sp += (sfx >>> 16) * 4;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_LSB: {
- final int data = (( (( ((srcData[sp + 3] & 0xff) << 8) |
- (srcData[sp + 2] & 0xff)) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp] & 0xff);
- sp += (sfx >>> 16) * 4;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- }
-
- /*** DO SPECIAL PROCESSING IF REQUIRED ***/
- switch (alphaMode) {
- case ALPHA_CHANNEL_SEPARATE:
- alpha = ((alphaData[ap] & 0xff) << 16) / 255;
- ap += (sfx >> 16);
- break;
- case ALPHA_CHANNEL_SOURCE:
- alpha = (a << 16) / 255;
- break;
- case ALPHA_MASK_UNPACKED:
- alpha = (alphaData[ap] != 0) ? 0x10000 : 0;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_PACKED:
- alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_RGB:
- alpha = 0x10000;
- for (int i = 0; i < alphaData.length; i += 3) {
- if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) {
- alpha = 0x0000;
- break;
- }
- }
- break;
- }
- if (alpha != 0x10000) {
- if (alpha == 0x0000) continue;
- switch (dtype) {
- case TYPE_GENERIC_8: {
- final int data = destData[dp] & 0xff;
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_MSB: {
- final int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_LSB: {
- final int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_24: {
- final int data = (( ((destData[dp] & 0xff) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp + 2] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_MSB: {
- final int data = (( (( ((destData[dp] & 0xff) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp + 2] & 0xff)) << 8) |
- (destData[dp + 3] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_LSB: {
- final int data = (( (( ((destData[dp + 3] & 0xff) << 8) |
- (destData[dp + 2] & 0xff)) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- }
- // Perform alpha blending
- a = aq + ((a - aq) * alpha >> 16);
- r = rq + ((r - rq) * alpha >> 16);
- g = gq + ((g - gq) * alpha >> 16);
- b = bq + ((b - bq) * alpha >> 16);
- }
-
- /*** WRITE NEXT PIXEL ***/
- final int data =
- (r >>> destRedPreShift << destRedShift) |
- (g >>> destGreenPreShift << destGreenShift) |
- (b >>> destBluePreShift << destBlueShift) |
- (a >>> destAlphaPreShift << destAlphaShift);
- switch (dtype) {
- case TYPE_GENERIC_8: {
- destData[dp] = (byte) data;
- } break;
- case TYPE_GENERIC_16_MSB: {
- destData[dp] = (byte) (data >>> 8);
- destData[dp + 1] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_16_LSB: {
- destData[dp] = (byte) (data & 0xff);
- destData[dp + 1] = (byte) (data >>> 8);
- } break;
- case TYPE_GENERIC_24: {
- destData[dp] = (byte) (data >>> 16);
- destData[dp + 1] = (byte) (data >>> 8);
- destData[dp + 2] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_32_MSB: {
- destData[dp] = (byte) (data >>> 24);
- destData[dp + 1] = (byte) (data >>> 16);
- destData[dp + 2] = (byte) (data >>> 8);
- destData[dp + 3] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_32_LSB: {
- destData[dp] = (byte) (data & 0xff);
- destData[dp + 1] = (byte) (data >>> 8);
- destData[dp + 2] = (byte) (data >>> 16);
- destData[dp + 3] = (byte) (data >>> 24);
- } break;
- }
- }
- }
-}
-
-/**
- * Blits an index palette image into an index palette image.
- * <p>
- * Note: The source and destination red, green, and blue
- * arrays may be null if no alpha blending or dither is to be
- * performed.
- * </p>
- *
- * @param op the blitter operation: a combination of BLIT_xxx flags
- * (see BLIT_xxx constants)
- * @param srcData the source byte array containing image data
- * @param srcDepth the source depth: one of 1, 2, 4, 8
- * @param srcStride the source number of bytes per line
- * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if srcDepth is not 1
- * @param srcX the top-left x-coord of the source blit region
- * @param srcY the top-left y-coord of the source blit region
- * @param srcWidth the width of the source blit region
- * @param srcHeight the height of the source blit region
- * @param srcReds the source palette red component intensities
- * @param srcGreens the source palette green component intensities
- * @param srcBlues the source palette blue component intensities
- * @param alphaMode the alpha blending or mask mode, may be
- * an integer 0-255 for global alpha; ignored if BLIT_ALPHA
- * not specified in the blitter operations
- * (see ALPHA_MODE_xxx constants)
- * @param alphaData the alpha blending or mask data, varies depending
- * on the value of alphaMode and sometimes ignored
- * @param destData the destination byte array containing image data
- * @param destDepth the destination depth: one of 1, 2, 4, 8
- * @param destStride the destination number of bytes per line
- * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if destDepth is not 1
- * @param destX the top-left x-coord of the destination blit region
- * @param destY the top-left y-coord of the destination blit region
- * @param destWidth the width of the destination blit region
- * @param destHeight the height of the destination blit region
- * @param destReds the destination palette red component intensities
- * @param destGreens the destination palette green component intensities
- * @param destBlues the destination palette blue component intensities
- * @param flipX if true the resulting image is flipped along the vertical axis
- * @param flipY if true the resulting image is flipped along the horizontal axis
- */
-static void blit(int op,
- byte[] srcData, int srcDepth, int srcStride, int srcOrder,
- int srcX, int srcY, int srcWidth, int srcHeight,
- byte[] srcReds, byte[] srcGreens, byte[] srcBlues,
- int alphaMode, byte[] alphaData, int alphaStride,
- byte[] destData, int destDepth, int destStride, int destOrder,
- int destX, int destY, int destWidth, int destHeight,
- byte[] destReds, byte[] destGreens, byte[] destBlues,
- boolean flipX, boolean flipY) {
- if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return;
-
- /*** Prepare scaling data ***/
- final int dwm1 = destWidth - 1;
- final int sfxi = (dwm1 != 0) ? ((srcWidth << 16) - 1) / dwm1 : 0;
- final int dhm1 = destHeight - 1;
- final int sfyi = (dhm1 != 0) ? ((srcHeight << 16) - 1) / dhm1 : 0;
-
- /*** Prepare source-related data ***/
- final int stype;
- switch (srcDepth) {
- case 8:
- stype = TYPE_INDEX_8;
- break;
- case 4:
- srcStride <<= 1;
- stype = TYPE_INDEX_4;
- break;
- case 2:
- srcStride <<= 2;
- stype = TYPE_INDEX_2;
- break;
- case 1:
- srcStride <<= 3;
- stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int spr = srcY * srcStride + srcX;
-
- /*** Prepare destination-related data ***/
- final int dtype;
- switch (destDepth) {
- case 8:
- dtype = TYPE_INDEX_8;
- break;
- case 4:
- destStride <<= 1;
- dtype = TYPE_INDEX_4;
- break;
- case 2:
- destStride <<= 2;
- dtype = TYPE_INDEX_2;
- break;
- case 1:
- destStride <<= 3;
- dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX);
- final int dprxi = (flipX) ? -1 : 1;
- final int dpryi = (flipY) ? -destStride : destStride;
-
- /*** Prepare special processing data ***/
- int apr;
- if ((op & BLIT_ALPHA) != 0) {
- switch (alphaMode) {
- case ALPHA_MASK_UNPACKED:
- case ALPHA_CHANNEL_SEPARATE:
- if (alphaData == null) alphaMode = 0x10000;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_PACKED:
- if (alphaData == null) alphaMode = 0x10000;
- alphaStride <<= 3;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_INDEX:
- case ALPHA_MASK_RGB:
- if (alphaData == null) alphaMode = 0x10000;
- apr = 0;
- break;
- default:
- alphaMode = (alphaMode << 16) / 255; // prescale
- case ALPHA_CHANNEL_SOURCE:
- apr = 0;
- break;
- }
- } else {
- alphaMode = 0x10000;
- apr = 0;
- }
- final boolean ditherEnabled = (op & BLIT_DITHER) != 0;
-
- /*** Blit ***/
- int dp = dpr;
- int sp = spr;
- int ap = apr;
- int destPaletteSize = 1 << destDepth;
- if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length;
- byte[] paletteMapping = null;
- boolean isExactPaletteMapping = true;
- switch (alphaMode) {
- case 0x10000:
- /*** If the palettes and formats are equivalent use a one-to-one mapping ***/
- if ((stype == dtype) &&
- (srcReds == destReds) && (srcGreens == destGreens) && (srcBlues == destBlues)) {
- paletteMapping = ONE_TO_ONE_MAPPING;
- break;
- /*** If palettes have not been supplied, supply a suitable mapping ***/
- } else if ((srcReds == null) || (destReds == null)) {
- if (srcDepth <= destDepth) {
- paletteMapping = ONE_TO_ONE_MAPPING;
- } else {
- paletteMapping = new byte[1 << srcDepth];
- int mask = (0xff << destDepth) >>> 8;
- for (int i = 0; i < paletteMapping.length; ++i) paletteMapping[i] = (byte)(i & mask);
- }
- break;
- }
- case ALPHA_MASK_UNPACKED:
- case ALPHA_MASK_PACKED:
- case ALPHA_MASK_INDEX:
- case ALPHA_MASK_RGB:
- /*** Generate a palette mapping ***/
- int srcPaletteSize = 1 << srcDepth;
- paletteMapping = new byte[srcPaletteSize];
- if ((srcReds != null) && (srcReds.length < srcPaletteSize)) srcPaletteSize = srcReds.length;
- for (int i = 0, r, g, b, index; i < srcPaletteSize; ++i) {
- r = srcReds[i] & 0xff;
- g = srcGreens[i] & 0xff;
- b = srcBlues[i] & 0xff;
- index = 0;
- int minDistance = 0x7fffffff;
- for (int j = 0, dr, dg, db, distance; j < destPaletteSize; ++j) {
- dr = (destReds[j] & 0xff) - r;
- dg = (destGreens[j] & 0xff) - g;
- db = (destBlues[j] & 0xff) - b;
- distance = dr * dr + dg * dg + db * db;
- if (distance < minDistance) {
- index = j;
- if (distance == 0) break;
- minDistance = distance;
- }
- }
- paletteMapping[i] = (byte)index;
- if (minDistance != 0) isExactPaletteMapping = false;
- }
- break;
- }
- if ((paletteMapping != null) && (isExactPaletteMapping || ! ditherEnabled)) {
- if ((stype == dtype) && (alphaMode == 0x10000)) {
- /*** Fast blit (copy w/ mapping) ***/
- switch (stype) {
- case TYPE_INDEX_8:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- destData[dp] = paletteMapping[srcData[sp] & 0xff];
- sp += (sfx >>> 16);
- }
- }
- break;
- case TYPE_INDEX_4:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- final int v;
- if ((sp & 1) != 0) v = paletteMapping[srcData[sp >> 1] & 0x0f];
- else v = (srcData[sp >> 1] >>> 4) & 0x0f;
- sp += (sfx >>> 16);
- if ((dp & 1) != 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | v);
- else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (v << 4));
- }
- }
- break;
- case TYPE_INDEX_2:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- final int index = paletteMapping[(srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03];
- sp += (sfx >>> 16);
- final int shift = 6 - (dp & 3) * 2;
- destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift));
- }
- }
- break;
- case TYPE_INDEX_1_MSB:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- final int index = paletteMapping[(srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01];
- sp += (sfx >>> 16);
- final int shift = 7 - (dp & 7);
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift));
- }
- }
- break;
- case TYPE_INDEX_1_LSB:
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) {
- final int index = paletteMapping[(srcData[sp >> 3] >>> (sp & 7)) & 0x01];
- sp += (sfx >>> 16);
- final int shift = dp & 7;
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift));
- }
- }
- break;
- }
- } else {
- /*** Convert between indexed modes using mapping and mask ***/
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy,
- sp = spr += (sfy >>> 16) * srcStride,
- sfy = (sfy & 0xffff) + sfyi,
- dp = dpr += dpryi) {
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx,
- dp += dprxi,
- sfx = (sfx & 0xffff) + sfxi) {
- int index;
- /*** READ NEXT PIXEL ***/
- switch (stype) {
- case TYPE_INDEX_8:
- index = srcData[sp] & 0xff;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_4:
- if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f;
- else index = (srcData[sp >> 1] >>> 4) & 0x0f;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_2:
- index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_MSB:
- index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_LSB:
- index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01;
- sp += (sfx >>> 16);
- break;
- default:
- return;
- }
- /*** APPLY MASK ***/
- switch (alphaMode) {
- case ALPHA_MASK_UNPACKED: {
- final byte mask = alphaData[ap];
- ap += (sfx >> 16);
- if (mask == 0) continue;
- } break;
- case ALPHA_MASK_PACKED: {
- final int mask = alphaData[ap >> 3] & (1 << (ap & 7));
- ap += (sfx >> 16);
- if (mask == 0) continue;
- } break;
- case ALPHA_MASK_INDEX: {
- int i = 0;
- while (i < alphaData.length) {
- if (index == (alphaData[i] & 0xff)) break;
- }
- if (i < alphaData.length) continue;
- } break;
- case ALPHA_MASK_RGB: {
- final byte r = srcReds[index], g = srcGreens[index], b = srcBlues[index];
- int i = 0;
- while (i < alphaData.length) {
- if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) break;
- i += 3;
- }
- if (i < alphaData.length) continue;
- } break;
- }
- index = paletteMapping[index] & 0xff;
-
- /*** WRITE NEXT PIXEL ***/
- switch (dtype) {
- case TYPE_INDEX_8:
- destData[dp] = (byte) index;
- break;
- case TYPE_INDEX_4:
- if ((dp & 1) != 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | index);
- else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (index << 4));
- break;
- case TYPE_INDEX_2: {
- final int shift = 6 - (dp & 3) * 2;
- destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift));
- } break;
- case TYPE_INDEX_1_MSB: {
- final int shift = 7 - (dp & 7);
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift));
- } break;
- case TYPE_INDEX_1_LSB: {
- final int shift = dp & 7;
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift));
- } break;
- }
- }
- }
- }
- return;
- }
-
- /*** Comprehensive blit (apply transformations) ***/
- int alpha = alphaMode;
- int index = 0;
- int indexq = 0;
- int lastindex = 0, lastr = -1, lastg = -1, lastb = -1;
- final int[] rerr, gerr, berr;
- if (ditherEnabled) {
- rerr = new int[destWidth + 2];
- gerr = new int[destWidth + 2];
- berr = new int[destWidth + 2];
- } else {
- rerr = null; gerr = null; berr = null;
- }
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy,
- sp = spr += (sfy >>> 16) * srcStride,
- ap = apr += (sfy >>> 16) * alphaStride,
- sfy = (sfy & 0xffff) + sfyi,
- dp = dpr += dpryi) {
- int lrerr = 0, lgerr = 0, lberr = 0;
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx,
- dp += dprxi,
- sfx = (sfx & 0xffff) + sfxi) {
- /*** READ NEXT PIXEL ***/
- switch (stype) {
- case TYPE_INDEX_8:
- index = srcData[sp] & 0xff;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_4:
- if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f;
- else index = (srcData[sp >> 1] >>> 4) & 0x0f;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_2:
- index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_MSB:
- index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_LSB:
- index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01;
- sp += (sfx >>> 16);
- break;
- }
-
- /*** DO SPECIAL PROCESSING IF REQUIRED ***/
- int r = srcReds[index] & 0xff, g = srcGreens[index] & 0xff, b = srcBlues[index] & 0xff;
- switch (alphaMode) {
- case ALPHA_CHANNEL_SEPARATE:
- alpha = ((alphaData[ap] & 0xff) << 16) / 255;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_UNPACKED:
- alpha = (alphaData[ap] != 0) ? 0x10000 : 0;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_PACKED:
- alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices
- int i = 0;
- while (i < alphaData.length) {
- if (index == (alphaData[i] & 0xff)) break;
- }
- if (i < alphaData.length) continue;
- } break;
- case ALPHA_MASK_RGB: {
- int i = 0;
- while (i < alphaData.length) {
- if ((r == (alphaData[i] & 0xff)) &&
- (g == (alphaData[i + 1] & 0xff)) &&
- (b == (alphaData[i + 2] & 0xff))) break;
- i += 3;
- }
- if (i < alphaData.length) continue;
- } break;
- }
- if (alpha != 0x10000) {
- if (alpha == 0x0000) continue;
- switch (dtype) {
- case TYPE_INDEX_8:
- indexq = destData[dp] & 0xff;
- break;
- case TYPE_INDEX_4:
- if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f;
- else indexq = (destData[dp >> 1] >>> 4) & 0x0f;
- break;
- case TYPE_INDEX_2:
- indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03;
- break;
- case TYPE_INDEX_1_MSB:
- indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01;
- break;
- case TYPE_INDEX_1_LSB:
- indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01;
- break;
- }
- // Perform alpha blending
- final int rq = destReds[indexq] & 0xff;
- final int gq = destGreens[indexq] & 0xff;
- final int bq = destBlues[indexq] & 0xff;
- r = rq + ((r - rq) * alpha >> 16);
- g = gq + ((g - gq) * alpha >> 16);
- b = bq + ((b - bq) * alpha >> 16);
- }
-
- /*** MAP COLOR TO THE PALETTE ***/
- if (ditherEnabled) {
- // Floyd-Steinberg error diffusion
- r += rerr[dx] >> 4;
- if (r < 0) r = 0; else if (r > 255) r = 255;
- g += gerr[dx] >> 4;
- if (g < 0) g = 0; else if (g > 255) g = 255;
- b += berr[dx] >> 4;
- if (b < 0) b = 0; else if (b > 255) b = 255;
- rerr[dx] = lrerr;
- gerr[dx] = lgerr;
- berr[dx] = lberr;
- }
- if (r != lastr || g != lastg || b != lastb) {
- // moving the variable declarations out seems to make the JDK JIT happier...
- for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) {
- dr = (destReds[j] & 0xff) - r;
- dg = (destGreens[j] & 0xff) - g;
- db = (destBlues[j] & 0xff) - b;
- distance = dr * dr + dg * dg + db * db;
- if (distance < minDistance) {
- lastindex = j;
- if (distance == 0) break;
- minDistance = distance;
- }
- }
- lastr = r; lastg = g; lastb = b;
- }
- if (ditherEnabled) {
- // Floyd-Steinberg error diffusion, cont'd...
- final int dxm1 = dx - 1, dxp1 = dx + 1;
- int acc;
- rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr;
- rerr[dx] += acc += lrerr + lrerr;
- rerr[dxm1] += acc + lrerr + lrerr;
- gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr;
- gerr[dx] += acc += lgerr + lgerr;
- gerr[dxm1] += acc + lgerr + lgerr;
- berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr;
- berr[dx] += acc += lberr + lberr;
- berr[dxm1] += acc + lberr + lberr;
- }
-
- /*** WRITE NEXT PIXEL ***/
- switch (dtype) {
- case TYPE_INDEX_8:
- destData[dp] = (byte) lastindex;
- break;
- case TYPE_INDEX_4:
- if ((dp & 1) != 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | lastindex);
- else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4));
- break;
- case TYPE_INDEX_2: {
- final int shift = 6 - (dp & 3) * 2;
- destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift));
- } break;
- case TYPE_INDEX_1_MSB: {
- final int shift = 7 - (dp & 7);
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift));
- } break;
- case TYPE_INDEX_1_LSB: {
- final int shift = dp & 7;
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift));
- } break;
- }
- }
- }
-}
-
-/**
- * Blits an index palette image into a direct palette image.
- * <p>
- * Note: The source and destination masks and palettes must
- * always be fully specified.
- * </p>
- *
- * @param op the blitter operation: a combination of BLIT_xxx flags
- * (see BLIT_xxx constants)
- * @param srcData the source byte array containing image data
- * @param srcDepth the source depth: one of 1, 2, 4, 8
- * @param srcStride the source number of bytes per line
- * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if srcDepth is not 1
- * @param srcX the top-left x-coord of the source blit region
- * @param srcY the top-left y-coord of the source blit region
- * @param srcWidth the width of the source blit region
- * @param srcHeight the height of the source blit region
- * @param srcReds the source palette red component intensities
- * @param srcGreens the source palette green component intensities
- * @param srcBlues the source palette blue component intensities
- * @param alphaMode the alpha blending or mask mode, may be
- * an integer 0-255 for global alpha; ignored if BLIT_ALPHA
- * not specified in the blitter operations
- * (see ALPHA_MODE_xxx constants)
- * @param alphaData the alpha blending or mask data, varies depending
- * on the value of alphaMode and sometimes ignored
- * @param destData the destination byte array containing image data
- * @param destDepth the destination depth: one of 8, 16, 24, 32
- * @param destStride the destination number of bytes per line
- * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if destDepth is not 16 or 32
- * @param destX the top-left x-coord of the destination blit region
- * @param destY the top-left y-coord of the destination blit region
- * @param destWidth the width of the destination blit region
- * @param destHeight the height of the destination blit region
- * @param destRedMask the destination red channel mask
- * @param destGreenMask the destination green channel mask
- * @param destBlueMask the destination blue channel mask
- * @param flipX if true the resulting image is flipped along the vertical axis
- * @param flipY if true the resulting image is flipped along the horizontal axis
- */
-static void blit(int op,
- byte[] srcData, int srcDepth, int srcStride, int srcOrder,
- int srcX, int srcY, int srcWidth, int srcHeight,
- byte[] srcReds, byte[] srcGreens, byte[] srcBlues,
- int alphaMode, byte[] alphaData, int alphaStride,
- byte[] destData, int destDepth, int destStride, int destOrder,
- int destX, int destY, int destWidth, int destHeight,
- int destRedMask, int destGreenMask, int destBlueMask,
- boolean flipX, boolean flipY) {
- if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return;
-
- // these should be supplied as params later
- final int destAlphaMask = 0;
-
- /*** Prepare scaling data ***/
- final int dwm1 = destWidth - 1;
- final int sfxi = (dwm1 != 0) ? ((srcWidth << 16) - 1) / dwm1 : 0;
- final int dhm1 = destHeight - 1;
- final int sfyi = (dhm1 != 0) ? ((srcHeight << 16) - 1) / dhm1 : 0;
-
- /*** Prepare source-related data ***/
- final int stype;
- switch (srcDepth) {
- case 8:
- stype = TYPE_INDEX_8;
- break;
- case 4:
- srcStride <<= 1;
- stype = TYPE_INDEX_4;
- break;
- case 2:
- srcStride <<= 2;
- stype = TYPE_INDEX_2;
- break;
- case 1:
- srcStride <<= 3;
- stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int spr = srcY * srcStride + srcX;
-
- /*** Prepare destination-related data ***/
- final int dbpp, dtype;
- switch (destDepth) {
- case 8:
- dbpp = 1;
- dtype = TYPE_GENERIC_8;
- break;
- case 16:
- dbpp = 2;
- dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB;
- break;
- case 24:
- dbpp = 3;
- dtype = TYPE_GENERIC_24;
- break;
- case 32:
- dbpp = 4;
- dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid destination type");
- return;
- }
- int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp;
- final int dprxi = (flipX) ? -dbpp : dbpp;
- final int dpryi = (flipY) ? -destStride : destStride;
-
- /*** Prepare special processing data ***/
- int apr;
- if ((op & BLIT_ALPHA) != 0) {
- switch (alphaMode) {
- case ALPHA_MASK_UNPACKED:
- case ALPHA_CHANNEL_SEPARATE:
- if (alphaData == null) alphaMode = 0x10000;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_PACKED:
- if (alphaData == null) alphaMode = 0x10000;
- alphaStride <<= 3;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_INDEX:
- case ALPHA_MASK_RGB:
- if (alphaData == null) alphaMode = 0x10000;
- apr = 0;
- break;
- default:
- alphaMode = (alphaMode << 16) / 255; // prescale
- case ALPHA_CHANNEL_SOURCE:
- apr = 0;
- break;
- }
- } else {
- alphaMode = 0x10000;
- apr = 0;
- }
-
- /*** Comprehensive blit (apply transformations) ***/
- final int destRedShift = getChannelShift(destRedMask);
- final int destRedWidth = getChannelWidth(destRedMask, destRedShift);
- final byte[] destReds = ANY_TO_EIGHT[destRedWidth];
- final int destRedPreShift = 8 - destRedWidth;
- final int destGreenShift = getChannelShift(destGreenMask);
- final int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift);
- final byte[] destGreens = ANY_TO_EIGHT[destGreenWidth];
- final int destGreenPreShift = 8 - destGreenWidth;
- final int destBlueShift = getChannelShift(destBlueMask);
- final int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift);
- final byte[] destBlues = ANY_TO_EIGHT[destBlueWidth];
- final int destBluePreShift = 8 - destBlueWidth;
- final int destAlphaShift = getChannelShift(destAlphaMask);
- final int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift);
- final byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth];
- final int destAlphaPreShift = 8 - destAlphaWidth;
-
- int dp = dpr;
- int sp = spr;
- int ap = apr, alpha = alphaMode;
- int r = 0, g = 0, b = 0, a = 0, index = 0;
- int rq = 0, gq = 0, bq = 0, aq = 0;
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy,
- sp = spr += (sfy >>> 16) * srcStride,
- ap = apr += (sfy >>> 16) * alphaStride,
- sfy = (sfy & 0xffff) + sfyi,
- dp = dpr += dpryi) {
- int lrerr = 0, lgerr = 0, lberr = 0;
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx,
- dp += dprxi,
- sfx = (sfx & 0xffff) + sfxi) {
- /*** READ NEXT PIXEL ***/
- switch (stype) {
- case TYPE_INDEX_8:
- index = srcData[sp] & 0xff;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_4:
- if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f;
- else index = (srcData[sp >> 1] >>> 4) & 0x0f;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_2:
- index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_MSB:
- index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01;
- sp += (sfx >>> 16);
- break;
- case TYPE_INDEX_1_LSB:
- index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01;
- sp += (sfx >>> 16);
- break;
- }
-
- /*** DO SPECIAL PROCESSING IF REQUIRED ***/
- r = srcReds[index] & 0xff;
- g = srcGreens[index] & 0xff;
- b = srcBlues[index] & 0xff;
- switch (alphaMode) {
- case ALPHA_CHANNEL_SEPARATE:
- alpha = ((alphaData[ap] & 0xff) << 16) / 255;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_UNPACKED:
- alpha = (alphaData[ap] != 0) ? 0x10000 : 0;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_PACKED:
- alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices
- int i = 0;
- while (i < alphaData.length) {
- if (index == (alphaData[i] & 0xff)) break;
- }
- if (i < alphaData.length) continue;
- } break;
- case ALPHA_MASK_RGB: {
- int i = 0;
- while (i < alphaData.length) {
- if ((r == (alphaData[i] & 0xff)) &&
- (g == (alphaData[i + 1] & 0xff)) &&
- (b == (alphaData[i + 2] & 0xff))) break;
- i += 3;
- }
- if (i < alphaData.length) continue;
- } break;
- }
- if (alpha != 0x10000) {
- if (alpha == 0x0000) continue;
- switch (dtype) {
- case TYPE_GENERIC_8: {
- final int data = destData[dp] & 0xff;
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_MSB: {
- final int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_LSB: {
- final int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_24: {
- final int data = (( ((destData[dp] & 0xff) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp + 2] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_MSB: {
- final int data = (( (( ((destData[dp] & 0xff) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp + 2] & 0xff)) << 8) |
- (destData[dp + 3] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_LSB: {
- final int data = (( (( ((destData[dp + 3] & 0xff) << 8) |
- (destData[dp + 2] & 0xff)) << 8) |
- (destData[dp + 1] & 0xff)) << 8) |
- (destData[dp] & 0xff);
- rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff;
- gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff;
- bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff;
- aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff;
- } break;
- }
- // Perform alpha blending
- a = aq + ((a - aq) * alpha >> 16);
- r = rq + ((r - rq) * alpha >> 16);
- g = gq + ((g - gq) * alpha >> 16);
- b = bq + ((b - bq) * alpha >> 16);
- }
-
- /*** WRITE NEXT PIXEL ***/
- final int data =
- (r >>> destRedPreShift << destRedShift) |
- (g >>> destGreenPreShift << destGreenShift) |
- (b >>> destBluePreShift << destBlueShift) |
- (a >>> destAlphaPreShift << destAlphaShift);
- switch (dtype) {
- case TYPE_GENERIC_8: {
- destData[dp] = (byte) data;
- } break;
- case TYPE_GENERIC_16_MSB: {
- destData[dp] = (byte) (data >>> 8);
- destData[dp + 1] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_16_LSB: {
- destData[dp] = (byte) (data & 0xff);
- destData[dp + 1] = (byte) (data >>> 8);
- } break;
- case TYPE_GENERIC_24: {
- destData[dp] = (byte) (data >>> 16);
- destData[dp + 1] = (byte) (data >>> 8);
- destData[dp + 2] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_32_MSB: {
- destData[dp] = (byte) (data >>> 24);
- destData[dp + 1] = (byte) (data >>> 16);
- destData[dp + 2] = (byte) (data >>> 8);
- destData[dp + 3] = (byte) (data & 0xff);
- } break;
- case TYPE_GENERIC_32_LSB: {
- destData[dp] = (byte) (data & 0xff);
- destData[dp + 1] = (byte) (data >>> 8);
- destData[dp + 2] = (byte) (data >>> 16);
- destData[dp + 3] = (byte) (data >>> 24);
- } break;
- }
- }
- }
-}
-
-/**
- * Blits a direct palette image into an index palette image.
- * <p>
- * Note: The source and destination masks and palettes must
- * always be fully specified.
- * </p>
- *
- * @param op the blitter operation: a combination of BLIT_xxx flags
- * (see BLIT_xxx constants)
- * @param srcData the source byte array containing image data
- * @param srcDepth the source depth: one of 8, 16, 24, 32
- * @param srcStride the source number of bytes per line
- * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if srcDepth is not 16 or 32
- * @param srcX the top-left x-coord of the source blit region
- * @param srcY the top-left y-coord of the source blit region
- * @param srcWidth the width of the source blit region
- * @param srcHeight the height of the source blit region
- * @param srcRedMask the source red channel mask
- * @param srcGreenMask the source green channel mask
- * @param srcBlueMask the source blue channel mask
- * @param alphaMode the alpha blending or mask mode, may be
- * an integer 0-255 for global alpha; ignored if BLIT_ALPHA
- * not specified in the blitter operations
- * (see ALPHA_MODE_xxx constants)
- * @param alphaData the alpha blending or mask data, varies depending
- * on the value of alphaMode and sometimes ignored
- * @param destData the destination byte array containing image data
- * @param destDepth the destination depth: one of 1, 2, 4, 8
- * @param destStride the destination number of bytes per line
- * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST;
- * ignored if destDepth is not 1
- * @param destX the top-left x-coord of the destination blit region
- * @param destY the top-left y-coord of the destination blit region
- * @param destWidth the width of the destination blit region
- * @param destHeight the height of the destination blit region
- * @param destReds the destination palette red component intensities
- * @param destGreens the destination palette green component intensities
- * @param destBlues the destination palette blue component intensities
- * @param flipX if true the resulting image is flipped along the vertical axis
- * @param flipY if true the resulting image is flipped along the horizontal axis
- */
-static void blit(int op,
- byte[] srcData, int srcDepth, int srcStride, int srcOrder,
- int srcX, int srcY, int srcWidth, int srcHeight,
- int srcRedMask, int srcGreenMask, int srcBlueMask,
- int alphaMode, byte[] alphaData, int alphaStride,
- byte[] destData, int destDepth, int destStride, int destOrder,
- int destX, int destY, int destWidth, int destHeight,
- byte[] destReds, byte[] destGreens, byte[] destBlues,
- boolean flipX, boolean flipY) {
- if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return;
-
- // these should be supplied as params later
- final int srcAlphaMask = 0;
-
- /*** Prepare scaling data ***/
- final int dwm1 = destWidth - 1;
- final int sfxi = (dwm1 != 0) ? ((srcWidth << 16) - 1) / dwm1 : 0;
- final int dhm1 = destHeight - 1;
- final int sfyi = (dhm1 != 0) ? ((srcHeight << 16) - 1) / dhm1 : 0;
-
- /*** Prepare source-related data ***/
- final int sbpp, stype;
- switch (srcDepth) {
- case 8:
- sbpp = 1;
- stype = TYPE_GENERIC_8;
- break;
- case 16:
- sbpp = 2;
- stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB;
- break;
- case 24:
- sbpp = 3;
- stype = TYPE_GENERIC_24;
- break;
- case 32:
- sbpp = 4;
- stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int spr = srcY * srcStride + srcX * sbpp;
-
- /*** Prepare destination-related data ***/
- final int dtype;
- switch (destDepth) {
- case 8:
- dtype = TYPE_INDEX_8;
- break;
- case 4:
- destStride <<= 1;
- dtype = TYPE_INDEX_4;
- break;
- case 2:
- destStride <<= 2;
- dtype = TYPE_INDEX_2;
- break;
- case 1:
- destStride <<= 3;
- dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB;
- break;
- default:
- //throw new IllegalArgumentException("Invalid source type");
- return;
- }
- int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX);
- final int dprxi = (flipX) ? -1 : 1;
- final int dpryi = (flipY) ? -destStride : destStride;
-
- /*** Prepare special processing data ***/
- int apr;
- if ((op & BLIT_ALPHA) != 0) {
- switch (alphaMode) {
- case ALPHA_MASK_UNPACKED:
- case ALPHA_CHANNEL_SEPARATE:
- if (alphaData == null) alphaMode = 0x10000;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_PACKED:
- if (alphaData == null) alphaMode = 0x10000;
- alphaStride <<= 3;
- apr = srcY * alphaStride + srcX;
- break;
- case ALPHA_MASK_INDEX:
- //throw new IllegalArgumentException("Invalid alpha type");
- return;
- case ALPHA_MASK_RGB:
- if (alphaData == null) alphaMode = 0x10000;
- apr = 0;
- break;
- default:
- alphaMode = (alphaMode << 16) / 255; // prescale
- case ALPHA_CHANNEL_SOURCE:
- apr = 0;
- break;
- }
- } else {
- alphaMode = 0x10000;
- apr = 0;
- }
- final boolean ditherEnabled = (op & BLIT_DITHER) != 0;
-
- /*** Comprehensive blit (apply transformations) ***/
- final int srcRedShift = getChannelShift(srcRedMask);
- final byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)];
- final int srcGreenShift = getChannelShift(srcGreenMask);
- final byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)];
- final int srcBlueShift = getChannelShift(srcBlueMask);
- final byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)];
- final int srcAlphaShift = getChannelShift(srcAlphaMask);
- final byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)];
-
- int dp = dpr;
- int sp = spr;
- int ap = apr, alpha = alphaMode;
- int r = 0, g = 0, b = 0, a = 0;
- int indexq = 0;
- int lastindex = 0, lastr = -1, lastg = -1, lastb = -1;
- final int[] rerr, gerr, berr;
- int destPaletteSize = 1 << destDepth;
- if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length;
- if (ditherEnabled) {
- rerr = new int[destWidth + 2];
- gerr = new int[destWidth + 2];
- berr = new int[destWidth + 2];
- } else {
- rerr = null; gerr = null; berr = null;
- }
- for (int dy = destHeight, sfy = sfyi; dy > 0; --dy,
- sp = spr += (sfy >>> 16) * srcStride,
- ap = apr += (sfy >>> 16) * alphaStride,
- sfy = (sfy & 0xffff) + sfyi,
- dp = dpr += dpryi) {
- int lrerr = 0, lgerr = 0, lberr = 0;
- for (int dx = destWidth, sfx = sfxi; dx > 0; --dx,
- dp += dprxi,
- sfx = (sfx & 0xffff) + sfxi) {
- /*** READ NEXT PIXEL ***/
- switch (stype) {
- case TYPE_GENERIC_8: {
- final int data = srcData[sp] & 0xff;
- sp += (sfx >>> 16);
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_MSB: {
- final int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff);
- sp += (sfx >>> 16) * 2;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_16_LSB: {
- final int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff);
- sp += (sfx >>> 16) * 2;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_24: {
- final int data = (( ((srcData[sp] & 0xff) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp + 2] & 0xff);
- sp += (sfx >>> 16) * 3;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_MSB: {
- final int data = (( (( ((srcData[sp] & 0xff) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp + 2] & 0xff)) << 8) |
- (srcData[sp + 3] & 0xff);
- sp += (sfx >>> 16) * 4;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- case TYPE_GENERIC_32_LSB: {
- final int data = (( (( ((srcData[sp + 3] & 0xff) << 8) |
- (srcData[sp + 2] & 0xff)) << 8) |
- (srcData[sp + 1] & 0xff)) << 8) |
- (srcData[sp] & 0xff);
- sp += (sfx >>> 16) * 4;
- r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff;
- g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff;
- b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff;
- a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff;
- } break;
- }
-
- /*** DO SPECIAL PROCESSING IF REQUIRED ***/
- switch (alphaMode) {
- case ALPHA_CHANNEL_SEPARATE:
- alpha = ((alphaData[ap] & 0xff) << 16) / 255;
- ap += (sfx >> 16);
- break;
- case ALPHA_CHANNEL_SOURCE:
- alpha = (a << 16) / 255;
- break;
- case ALPHA_MASK_UNPACKED:
- alpha = (alphaData[ap] != 0) ? 0x10000 : 0;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_PACKED:
- alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000;
- ap += (sfx >> 16);
- break;
- case ALPHA_MASK_RGB:
- alpha = 0x10000;
- for (int i = 0; i < alphaData.length; i += 3) {
- if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) {
- alpha = 0x0000;
- break;
- }
- }
- break;
- }
- if (alpha != 0x10000) {
- if (alpha == 0x0000) continue;
- switch (dtype) {
- case TYPE_INDEX_8:
- indexq = destData[dp] & 0xff;
- break;
- case TYPE_INDEX_4:
- if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f;
- else indexq = (destData[dp >> 1] >>> 4) & 0x0f;
- break;
- case TYPE_INDEX_2:
- indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03;
- break;
- case TYPE_INDEX_1_MSB:
- indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01;
- break;
- case TYPE_INDEX_1_LSB:
- indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01;
- break;
- }
- // Perform alpha blending
- final int rq = destReds[indexq] & 0xff;
- final int gq = destGreens[indexq] & 0xff;
- final int bq = destBlues[indexq] & 0xff;
- r = rq + ((r - rq) * alpha >> 16);
- g = gq + ((g - gq) * alpha >> 16);
- b = bq + ((b - bq) * alpha >> 16);
- }
-
- /*** MAP COLOR TO THE PALETTE ***/
- if (ditherEnabled) {
- // Floyd-Steinberg error diffusion
- r += rerr[dx] >> 4;
- if (r < 0) r = 0; else if (r > 255) r = 255;
- g += gerr[dx] >> 4;
- if (g < 0) g = 0; else if (g > 255) g = 255;
- b += berr[dx] >> 4;
- if (b < 0) b = 0; else if (b > 255) b = 255;
- rerr[dx] = lrerr;
- gerr[dx] = lgerr;
- berr[dx] = lberr;
- }
- if (r != lastr || g != lastg || b != lastb) {
- // moving the variable declarations out seems to make the JDK JIT happier...
- for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) {
- dr = (destReds[j] & 0xff) - r;
- dg = (destGreens[j] & 0xff) - g;
- db = (destBlues[j] & 0xff) - b;
- distance = dr * dr + dg * dg + db * db;
- if (distance < minDistance) {
- lastindex = j;
- if (distance == 0) break;
- minDistance = distance;
- }
- }
- lastr = r; lastg = g; lastb = b;
- }
- if (ditherEnabled) {
- // Floyd-Steinberg error diffusion, cont'd...
- final int dxm1 = dx - 1, dxp1 = dx + 1;
- int acc;
- rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr;
- rerr[dx] += acc += lrerr + lrerr;
- rerr[dxm1] += acc + lrerr + lrerr;
- gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr;
- gerr[dx] += acc += lgerr + lgerr;
- gerr[dxm1] += acc + lgerr + lgerr;
- berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr;
- berr[dx] += acc += lberr + lberr;
- berr[dxm1] += acc + lberr + lberr;
- }
-
- /*** WRITE NEXT PIXEL ***/
- switch (dtype) {
- case TYPE_INDEX_8:
- destData[dp] = (byte) lastindex;
- break;
- case TYPE_INDEX_4:
- if ((dp & 1) != 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | lastindex);
- else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4));
- break;
- case TYPE_INDEX_2: {
- final int shift = 6 - (dp & 3) * 2;
- destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift));
- } break;
- case TYPE_INDEX_1_MSB: {
- final int shift = 7 - (dp & 7);
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift));
- } break;
- case TYPE_INDEX_1_LSB: {
- final int shift = dp & 7;
- destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift));
- } break;
- }
- }
- }
-}
-
-/**
- * Computes the required channel shift from a mask.
- */
-static int getChannelShift(int mask) {
- if (mask == 0) return 0;
- int i;
- for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) {
- mask >>>= 1;
- }
- return i;
-}
-
-/**
- * Computes the required channel width (depth) from a mask.
- */
-static int getChannelWidth(int mask, int shift) {
- if (mask == 0) return 0;
- int i;
- mask >>>= shift;
- for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) {
- mask >>>= 1;
- }
- return i - shift;
-}
-
-/**
- * Extracts a field from packed RGB data given a mask for that field.
- */
-static byte getChannelField(int data, int mask) {
- final int shift = getChannelShift(mask);
- return ANY_TO_EIGHT[getChannelWidth(mask, shift)][(data & mask) >>> shift];
-}
-
-/**
- * Creates an ImageData containing one band's worth of a gradient filled
- * block. If <code>vertical</code> is true, the band must be tiled
- * horizontally to fill a region, otherwise it must be tiled vertically.
- *
- * @param width the width of the region to be filled
- * @param height the height of the region to be filled
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- * @param fromRGB the color to start with
- * @param toRGB the color to end with
- * @param redBits the number of significant red bits, 0 for palette modes
- * @param greenBits the number of significant green bits, 0 for palette modes
- * @param blueBits the number of significant blue bits, 0 for palette modes
- * @return the new ImageData
- */
-static ImageData createGradientBand(
- int width, int height, boolean vertical,
- RGB fromRGB, RGB toRGB,
- int redBits, int greenBits, int blueBits) {
- /* Gradients are drawn as tiled bands */
- final int bandWidth, bandHeight, bitmapDepth;
- final byte[] bitmapData;
- final PaletteData paletteData;
- /* Select an algorithm depending on the depth of the screen */
- if (redBits != 0 && greenBits != 0 && blueBits != 0) {
- paletteData = new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000);
- bitmapDepth = 32;
- if (redBits >= 8 && greenBits >= 8 && blueBits >= 8) {
- /* Precise color */
- final int steps;
- if (vertical) {
- bandWidth = 1;
- bandHeight = height;
- steps = bandHeight > 1 ? bandHeight - 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = 1;
- steps = bandWidth > 1 ? bandWidth - 1 : 1;
- }
- final int bytesPerLine = bandWidth * 4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- buildPreciseGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine);
- buildPreciseGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine);
- buildPreciseGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine);
- } else {
- /* Dithered color */
- final int steps;
- if (vertical) {
- bandWidth = (width < 8) ? width : 8;
- bandHeight = height;
- steps = bandHeight > 1 ? bandHeight - 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = (height < 8) ? height : 8;
- steps = bandWidth > 1 ? bandWidth - 1 : 1;
- }
- final int bytesPerLine = bandWidth * 4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- buildDitheredGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine, blueBits);
- buildDitheredGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine, greenBits);
- buildDitheredGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine, redBits);
- }
- } else {
- /* Dithered two tone */
- paletteData = new PaletteData(new RGB[] { fromRGB, toRGB });
- bitmapDepth = 8;
- final int blendi;
- if (vertical) {
- bandWidth = (width < 8) ? width : 8;
- bandHeight = height;
- blendi = (bandHeight > 1) ? 0x1040000 / (bandHeight - 1) + 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = (height < 8) ? height : 8;
- blendi = (bandWidth > 1) ? 0x1040000 / (bandWidth - 1) + 1 : 1;
- }
- final int bytesPerLine = (bandWidth + 3) & -4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- if (vertical) {
- for (int dy = 0, blend = 0, dp = 0; dy < bandHeight;
- ++dy, blend += blendi, dp += bytesPerLine) {
- for (int dx = 0; dx < bandWidth; ++dx) {
- bitmapData[dp + dx] = (blend + DITHER_MATRIX[dy & 7][dx]) <
- 0x1000000 ? (byte)0 : (byte)1;
- }
- }
- } else {
- for (int dx = 0, blend = 0; dx < bandWidth; ++dx, blend += blendi) {
- for (int dy = 0, dptr = dx; dy < bandHeight; ++dy, dptr += bytesPerLine) {
- bitmapData[dptr] = (blend + DITHER_MATRIX[dy][dx & 7]) <
- 0x1000000 ? (byte)0 : (byte)1;
- }
- }
- }
- }
- return new ImageData(bandWidth, bandHeight, bitmapDepth, paletteData, 4, bitmapData);
-}
-
-/*
- * Fill in gradated values for a color channel
- */
-static final void buildPreciseGradientChannel(int from, int to, int steps,
- int bandWidth, int bandHeight, boolean vertical,
- byte[] bitmapData, int dp, int bytesPerLine) {
- int val = from << 16;
- final int inc = ((to << 16) - val) / steps + 1;
- if (vertical) {
- for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
- bitmapData[dp] = (byte)(val >>> 16);
- val += inc;
- }
- } else {
- for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
- bitmapData[dp] = (byte)(val >>> 16);
- val += inc;
- }
- }
-}
-
-/*
- * Fill in dithered gradated values for a color channel
- */
-static final void buildDitheredGradientChannel(int from, int to, int steps,
- int bandWidth, int bandHeight, boolean vertical,
- byte[] bitmapData, int dp, int bytesPerLine, int bits) {
- final int mask = 0xff00 >>> bits;
- int val = from << 16;
- final int inc = ((to << 16) - val) / steps + 1;
- if (vertical) {
- for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
- for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
- final int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = (byte)((temp >>> 16) & mask);
- }
- val += inc;
- }
- } else {
- for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
- for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
- final int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = (byte)((temp >>> 16) & mask);
- }
- val += inc;
- }
- }
-}
-
-/**
- * Renders a gradient onto a GC.
- * <p>
- * This is a GC helper.
- * </p>
- *
- * @param gc the GC to render the gradient onto
- * @param device the device the GC belongs to
- * @param x the top-left x coordinate of the region to be filled
- * @param y the top-left y coordinate of the region to be filled
- * @param width the width of the region to be filled
- * @param height the height of the region to be filled
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- * @param fromRGB the color to start with
- * @param toRGB the color to end with
- * @param redBits the number of significant red bits, 0 for palette modes
- * @param greenBits the number of significant green bits, 0 for palette modes
- * @param blueBits the number of significant blue bits, 0 for palette modes
- */
-static void fillGradientRectangle(GC gc, Device device,
- int x, int y, int width, int height, boolean vertical,
- RGB fromRGB, RGB toRGB,
- int redBits, int greenBits, int blueBits) {
- /* Create the bitmap and tile it */
- ImageData band = createGradientBand(width, height, vertical,
- fromRGB, toRGB, redBits, greenBits, blueBits);
- Image image = new Image(device, band);
- if ((band.width == 1) || (band.height == 1)) {
- gc.drawImage(image, 0, 0, band.width, band.height, x, y, width, height);
- } else {
- if (vertical) {
- for (int dx = 0; dx < width; dx += band.width) {
- int blitWidth = width - dx;
- if (blitWidth > band.width) blitWidth = band.width;
- gc.drawImage(image, 0, 0, blitWidth, band.height, dx + x, y, blitWidth, band.height);
- }
- } else {
- for (int dy = 0; dy < height; dy += band.height) {
- int blitHeight = height - dy;
- if (blitHeight > band.height) blitHeight = band.height;
- gc.drawImage(image, 0, 0, band.width, blitHeight, x, dy + y, band.width, blitHeight);
- }
- }
- }
- image.dispose();
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java
deleted file mode 100755
index 3850ea302d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import java.util.Vector;
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.internal.image.*;
-
-/**
- * Instances of this class are used to load images from,
- * and save images to, a file or stream.
- * <p>
- * Currently supported image formats are:
- * </p><ul>
- * <li>BMP (Windows Bitmap)</li>
- * <li>ICO (Windows Icon)</li>
- * <li>JPEG</li>
- * <li>GIF</li>
- * <li>PNG</li>
- * </ul>
- * <code>ImageLoaders</code> can be used to:
- * <ul>
- * <li>load/save single images in all formats</li>
- * <li>load/save multiple images (GIF/ICO)</li>
- * <li>load/save animated GIF images</li>
- * <li>load interlaced GIF/PNG images</li>
- * <li>load progressive JPEG images</li>
- * </ul>
- */
-
-public class ImageLoader {
-
- /**
- * the array of ImageData objects in this ImageLoader.
- * This array is read in when the load method is called,
- * and it is written out when the save method is called
- */
- public ImageData[] data;
-
- /**
- * the width of the logical screen on which the images
- * reside, in pixels (this corresponds to the GIF89a
- * Logical Screen Width value)
- */
- public int logicalScreenWidth;
-
- /**
- * the height of the logical screen on which the images
- * reside, in pixels (this corresponds to the GIF89a
- * Logical Screen Height value)
- */
- public int logicalScreenHeight;
-
- /**
- * the background pixel for the logical screen (this
- * corresponds to the GIF89a Background Color Index value).
- * The default is -1 which means 'unspecified background'
- *
- */
- public int backgroundPixel;
-
- /**
- * the number of times to repeat the display of a sequence
- * of animated images (this corresponds to the commonly-used
- * GIF application extension for "NETSCAPE 2.0 01")
- */
- public int repeatCount;
-
- /*
- * the set of ImageLoader event listeners, created on demand
- */
- Vector imageLoaderListeners;
-
-/**
- * Construct a new empty ImageLoader.
- */
-public ImageLoader() {
- reset();
-}
-
-/**
- * Resets the fields of the ImageLoader, except for the
- * <code>imageLoaderListeners</code> field.
- */
-void reset() {
- data = null;
- logicalScreenWidth = 0;
- logicalScreenHeight = 0;
- backgroundPixel = -1;
- repeatCount = 1;
-}
-
-/**
- * Loads an array of <code>ImageData</code> objects from the
- * specified input stream. Throws an error if either an error
- * occurs while loading the images, or if the images are not
- * of a supported type. Returns the loaded image data array.
- *
- * @param stream the input stream to load the images from
- * @return an array of <code>ImageData</code> objects loaded from the specified input stream
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the stream is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO - if an input/output error occurs while reading data</li>
- * </ul>
- */
-public ImageData[] load(InputStream stream) {
- if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- reset();
- data = FileFormat.load(stream, this);
- return data;
-}
-
-/**
- * Loads an array of <code>ImageData</code> objects from the
- * file with the specified name. Throws an error if either
- * an error occurs while loading the images, or if the images are
- * not of a supported type. Returns the loaded image data array.
- *
- * @param filename the name of the file to load the images from
- * @return an array of <code>ImageData</code> objects loaded from the specified file
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public ImageData[] load(String filename) {
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- InputStream stream = null;
- try {
- stream = Compatibility.newFileInputStream(filename);
- return load(stream);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- } finally {
- try {
- if (stream != null) stream.close();
- } catch (IOException e) {
- // Ignore error
- }
- }
- return null;
-}
-
-/**
- * Saves the image data in this ImageLoader to the specified stream.
- * The format parameter can have one of the following values:
- * <dl>
- * <dt><code>IMAGE_BMP</code></dt>
- * <dd>Windows BMP file format, no compression</dd>
- * <dt><code>IMAGE_BMP_RLE</code></dt>
- * <dd>Windows BMP file format, RLE compression if appropriate</dd>
- * <dt><code>IMAGE_GIF</code></dt>
- * <dd>GIF file format</dd>
- * <dt><code>IMAGE_ICO</code></dt>
- * <dd>Windows ICO file format</dd>
- * <dt><code>IMAGE_JPEG</code></dt>
- * <dd>JPEG file format</dd>
- * <dt><code>IMAGE_PNG</code></dt>
- * <dd>PNG file format</dd>
- * </dl>
- *
- * @param stream the output stream to write the images to
- * @param format the format to write the images in
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the stream is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE if the image data contains invalid data</li>
- * <li>ERROR_IO if an IO error occurs while writing to the stream</li>
- * </ul>
- */
-public void save(OutputStream stream, int format) {
- if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- FileFormat.save(stream, format, this);
-}
-
-/**
- * Saves the image data in this ImageLoader to a file with the specified name.
- * The format parameter can have one of the following values:
- * <dl>
- * <dt><code>IMAGE_BMP</code></dt>
- * <dd>Windows BMP file format, no compression</dd>
- * <dt><code>IMAGE_BMP_RLE</code></dt>
- * <dd>Windows BMP file format, RLE compression if appropriate</dd>
- * <dt><code>IMAGE_GIF</code></dt>
- * <dd>GIF file format</dd>
- * <dt><code>IMAGE_ICO</code></dt>
- * <dd>Windows ICO file format</dd>
- * <dt><code>IMAGE_JPEG</code></dt>
- * <dd>JPEG file format</dd>
- * <dt><code>IMAGE_PNG</code></dt>
- * <dd>PNG file format</dd>
- * </dl>
- *
- * @param filename the name of the file to write the images to
- * @param format the format to write the images in
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE if the image data contains invalid data</li>
- * <li>ERROR_IO if an IO error occurs while writing to the file</li>
- * </ul>
- */
-public void save(String filename, int format) {
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- OutputStream stream = null;
- try {
- stream = Compatibility.newFileOutputStream(filename);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- save(stream, format);
-}
-
-/**
- * Adds a listener to receive image loader events.
- * <p>
- * An ImageLoaderListener should be added before invoking
- * one of the receiver's load methods. The listener's
- * <code>imageDataLoaded</code> method is called when image
- * data has been partially loaded, as is supported by interlaced
- * GIF/PNG or progressive JPEG images.
- *
- * @param listener the ImageLoaderListener to add
- *
- * @see ImageLoaderListener
- * @see ImageLoaderEvent
- */
-public void addImageLoaderListener(ImageLoaderListener listener) {
- if (imageLoaderListeners == null) {
- imageLoaderListeners = new Vector();
- }
- imageLoaderListeners.addElement(listener);
-}
-
-/**
- * Removes a listener that was receiving image loader events.
- *
- * @param listener the ImageLoaderListener to remove
- *
- * @see #addImageLoaderListener
- */
-public void removeImageLoaderListener(ImageLoaderListener listener) {
- if (imageLoaderListeners == null) return;
- imageLoaderListeners.removeElement(listener);
-}
-
-/**
- * Returns <code>true</code> if the receiver has image loader
- * listeners, and <code>false</code> otherwise.
- *
- * @return <code>true</code> if there are <code>ImageLoaderListener</code>s, and <code>false</code> otherwise
- *
- * @see #addImageLoaderListener
- * @see #removeImageLoaderListener
- */
-public boolean hasListeners() {
- return imageLoaderListeners != null && imageLoaderListeners.size() > 0;
-}
-
-/**
- * Notifies all image loader listeners that an image loader event
- * has occurred. Pass the specified event object to each listener.
- *
- * @param event the <code>ImageLoaderEvent</code> to send to each <code>ImageLoaderListener</code>
- */
-public void notifyListeners(ImageLoaderEvent event) {
- if (!hasListeners()) return;
- int size = imageLoaderListeners.size();
- for (int i = 0; i < size; i++) {
- ImageLoaderListener listener = (ImageLoaderListener) imageLoaderListeners.elementAt(i);
- listener.imageDataLoaded(event);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java
deleted file mode 100755
index 1b88b67280..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventObject;
-
-/**
- * Instances of this class are sent as a result of the incremental
- * loading of image data.
- * <p>
- * <b>Notes:</b>
- * </p><ul>
- * <li>The number of events which will be sent when loading images
- * is not constant. It varies by image type, and for JPEG images it
- * varies from image to image.</li>
- * <li>For image sources which contain multiple images, the
- * <code>endOfImage</code> flag in the event will be set to true
- * after each individual image is loaded.</li>
- * </ul>
- *
- * @see ImageLoader
- * @see ImageLoaderListener
- */
-
-public class ImageLoaderEvent extends SWTEventObject {
-
- /**
- * if the <code>endOfImage</code> flag is false, then this is a
- * partially complete copy of the current <code>ImageData</code>,
- * otherwise this is a completely loaded <code>ImageData</code>
- */
- public ImageData imageData;
-
- /**
- * the zero-based count of image data increments -- this is
- * equivalent to the number of events that have been generated
- * while loading a particular image
- */
- public int incrementCount;
-
- /**
- * If this flag is true, then the current image data has been
- * completely loaded, otherwise the image data is only partially
- * loaded, and further ImageLoader events will occur unless an
- * exception is thrown
- */
- public boolean endOfImage;
-
-/**
- * Constructs a new instance of this class given the event source and
- * the values to store in its fields.
- *
- * @param source the ImageLoader that was loading when the event occurred
- * @param imageData the image data for the event
- * @param incrementCount the image data increment for the event
- * @param endOfImage the end of image flag for the event
- */
-public ImageLoaderEvent(ImageLoader source, ImageData imageData, int incrementCount, boolean endOfImage) {
- super(source);
- this.imageData = imageData;
- this.incrementCount = incrementCount;
- this.endOfImage = endOfImage;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the point
- */
-public String toString () {
- return "ImageLoaderEvent {source=" + source + " imageData=" + imageData + " incrementCount=" + incrementCount + " endOfImage=" + endOfImage + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderListener.java
deleted file mode 100755
index 2d7db6fb0d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the incremental loading of image data.
- * <p>
- * After creating an instance of a class that implements
- * this interface it can be added to an image loader using the
- * <code>addImageLoaderListener</code> method and removed using
- * the <code>removeImageLoaderListener</code> method. When
- * image data is either partially or completely loaded, this
- * method will be invoked.
- * </p>
- *
- * @see ImageLoader
- * @see ImageLoaderEvent
- */
-
-public interface ImageLoaderListener extends SWTEventListener {
-
-/**
- * Sent when image data is either partially or completely loaded.
- * <p>
- * The timing of when this method is called varies depending on
- * the format of the image being loaded.
- * </p>
- *
- * @param e an event containing information about the image loading operation
- */
-public void imageDataLoaded(ImageLoaderEvent e);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/PaletteData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/PaletteData.java
deleted file mode 100755
index cd2d3596ec..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/PaletteData.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe the color data used by an image.
- * <p>
- * Depending on the depth of the image, the PaletteData can take one
- * of two forms, indicated by the isDirect field:
- * </p>
- * <dl>
- * <dt>
- * <em>isDirect is false</em>
- * </dt>
- * <dd>
- * If isDirect is <code>false</code>, this palette is an indexed
- * palette which maps pixel values to RGBs. The actual RGB values
- * may be retrieved by using the getRGBs() method.
- * </dd>
- * <dt>
- * <em>isDirect is true</em>
- * </dt>
- * <dd>
- * If isDirect is <code>true</code>, this palette is a direct color
- * palette. Instead of containing RGB values, it contains red,
- * green and blue mask and shift information which indicates how
- * the color components may be extracted from a given pixel.
- * This means that the RGB value is actually encoded in the pixel value.
- * <p>
- * In this case, the shift data is the number of bits required to shift
- * the RGB value to the left in order to align the high bit of the
- * corresponding mask with the high bit of the first byte. This number
- * may be negative, so care must be taken when shifting. For example,
- * with a red mask of 0xFF0000, the red shift would be -16. With a red
- * mask of 0x1F, the red shift would be 3.
- * </p>
- * </dd>
- * </dl>
- *
- * @see Image
- * @see RGB
- */
-
-public final class PaletteData {
-
- /**
- * true if the receiver is a direct palette,
- * and false otherwise
- */
- public boolean isDirect;
-
- /**
- * the RGB values for an indexed palette, where the
- * indices of the array correspond to pixel values
- */
- public RGB[] colors;
-
- /**
- * the red mask for a direct palette
- */
- public int redMask;
-
- /**
- * the green mask for a direct palette
- */
- public int greenMask;
-
- /**
- * the blue mask for a direct palette
- */
- public int blueMask;
-
- /**
- * the red shift for a direct palette
- */
- public int redShift;
-
- /**
- * the green shift for a direct palette
- */
- public int greenShift;
-
- /**
- * the blue shift for a direct palette
- */
- public int blueShift;
-
-/**
- * Constructs a new indexed palette given an array of RGB values.
- *
- * @param colors the array of <code>RGB</code>s for the palette
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public PaletteData(RGB[] colors) {
- if (colors == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.colors = colors;
- this.isDirect = false;
-}
-
-/**
- * Constructs a new direct palette given the red, green and blue masks.
- *
- * @param redMask the red mask
- * @param greenMask the green mask
- * @param blueMask the blue mask
- */
-public PaletteData(int redMask, int greenMask, int blueMask) {
- this.redMask = redMask;
- this.greenMask = greenMask;
- this.blueMask = blueMask;
- this.isDirect = true;
- this.redShift = shiftForMask(redMask);
- this.greenShift = shiftForMask(greenMask);
- this.blueShift = shiftForMask(blueMask);
-}
-
-/**
- * Returns the pixel value corresponding to the given <code>RBG</code>.
- *
- * @return the pixel value for the given RGB
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the RGB is not found in the palette</li>
- * </ul>
- */
-public int getPixel(RGB rgb) {
- if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (isDirect) {
- int pixel = 0;
- pixel |= (redShift < 0 ? rgb.red << -redShift : rgb.red >>> redShift) & redMask;
- pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
- pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
- return pixel;
- } else {
- for (int i = 0; i < colors.length; i++) {
- if (colors[i].equals(rgb)) return i;
- }
- /* The RGB did not exist in the palette */
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return 0;
- }
-}
-
-/**
- * Returns an <code>RGB</code> corresponding to the given pixel value.
- *
- * @return the RGB value for the given pixel
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the pixel does not exist in the palette</li>
- * </ul>
- */
-public RGB getRGB(int pixel) {
- if (isDirect) {
- int r = pixel & redMask;
- r = (redShift < 0) ? r >>> -redShift : r << redShift;
- int g = pixel & greenMask;
- g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;
- int b = pixel & blueMask;
- b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
- return new RGB(r, g, b);
- } else {
- if (pixel < 0 || pixel >= colors.length) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- return colors[pixel];
- }
-}
-
-/**
- * Returns all the RGB values in the receiver if it is an
- * indexed palette, or null if it is a direct palette.
- *
- * @return the <code>RGB</code>s for the receiver or null
- */
-public RGB[] getRGBs() {
- return colors;
-}
-
-/**
- * Computes the shift value for a given mask.
- *
- * @param mask the mask to compute the shift for
- * @return the shift amount
- *
- * @see PaletteData
- */
-int shiftForMask(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return 7 - i;
- }
- return 32;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java
deleted file mode 100755
index 8836a3f176..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SerializableCompatibility;
-
-/**
- * Instances of this class represent places on the (x, y)
- * coordinate plane.
- * <p>
- * The coordinate space for rectangles and points is considered
- * to have increasing values downward and to the right from its
- * origin making this the normal, computer graphics oriented notion
- * of (x, y) coordinates rather than the strict mathematical one.
- * </p>
- * <p>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- * </p>
- *
- * @see Rectangle
- */
-
-public final class Point implements SerializableCompatibility {
-
- /**
- * the x coordinate of the point
- */
- public int x;
-
- /**
- * the y coordinate of the point
- */
- public int y;
-
-/**
- * Constructs a new point with the given x and y coordinates.
- *
- * @param x the x coordinate of the new point
- * @param y the y coordinate of the new point
- */
-public Point (int x, int y) {
- this.x = x;
- this.y = y;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Point)) return false;
- Point p = (Point)object;
- return (p.x == this.x) && (p.y == this.y);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return x ^ y;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the point
- */
-public String toString () {
- return "Point {" + x + ", " + y + "}";
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/RGB.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/RGB.java
deleted file mode 100755
index 686d519af9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/RGB.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SerializableCompatibility;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are descriptions of colors in
- * terms of the primary additive color model (red, green and
- * blue). A color may be described in terms of the relative
- * intensities of these three primary colors. The brightness
- * of each color is specified by a value in the range 0 to 255,
- * where 0 indicates no color (blackness) and 255 indicates
- * maximum intensity.
- * <p>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- * </p>
- *
- * @see Color
- */
-
-public final class RGB implements SerializableCompatibility {
-
- /**
- * the red component of the RGB
- */
- public int red;
-
- /**
- * the green component of the RGB
- */
- public int green;
-
- /**
- * the blue component of the RGB
- */
- public int blue;
-
-/**
- * Constructs an instance of this class with the given
- * red, green and blue values.
- *
- * @param red the red component of the new instance
- * @param green the green component of the new instance
- * @param blue the blue component of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- */
-public RGB(int red, int green, int blue) {
- if ((red > 255) || (red < 0) ||
- (green > 255) || (green < 0) ||
- (blue > 255) || (blue < 0))
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.red = red;
- this.green = green;
- this.blue = blue;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof RGB)) return false;
- RGB rgb = (RGB)object;
- return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return (blue << 16) | (green << 8) | red;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the <code>RGB</code>
- */
-public String toString () {
- return "RGB {" + red + ", " + green + ", " + blue + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java
deleted file mode 100755
index 5a53032233..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java
+++ /dev/null
@@ -1,269 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SerializableCompatibility;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent rectangular areas in an
- * (x, y) coordinate system. The top left corner of the rectangle
- * is specified by its x and y values, and the extent of the
- * rectangle is specified by its width and height.
- * <p>
- * The coordinate space for rectangles and points is considered
- * to have increasing values downward and to the right from its
- * origin making this the normal, computer graphics oriented notion
- * of (x, y) coordinates rather than the strict mathematical one.
- * </p>
- * <p>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- * </p>
- *
- * @see Point
- */
-
-public final class Rectangle implements SerializableCompatibility {
-
- /**
- * the x coordinate of the rectangle
- */
- public int x;
-
- /**
- * the y coordinate of the rectangle
- */
- public int y;
-
- /**
- * the width of the rectangle
- */
- public int width;
-
- /**
- * the height of the rectangle
- */
- public int height;
-
-/**
- * Construct a new instance of this class given the
- * x, y, width and height values.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- */
-public Rectangle (int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
-}
-
-/**
- * Destructively replaces the x, y, width and height values
- * in the receiver with ones which represent the union of the
- * rectangles specified by the receiver and the given rectangle.
- * <p>
- * The union of two rectangles is the smallest single rectangle
- * that completely covers both of the areas covered by the two
- * given rectangles.
- * </p>
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void add (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int left = x < rect.x ? x : rect.x;
- int top = y < rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs > rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs > rhs ? lhs : rhs;
- x = left; y = top; width = right - left; height = bottom - top;
-}
-
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
- */
-public boolean contains (int x, int y) {
- return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height);
-}
-
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public boolean contains (Point pt) {
- if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Rectangle)) return false;
- Rectangle r = (Rectangle)object;
- return (r.x == this.x) && (r.y == this.y) && (r.width == this.width) && (r.height == this.height);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return x ^ y ^ width ^ height;
-}
-
-/**
- * Returns a new rectangle which represents the intersection
- * of the receiver and the given rectangle.
- * <p>
- * The intersection of two rectangles is the rectangle that
- * covers the area which is contained within both rectangles.
- * </p>
- *
- * @param rect the rectangle to intersect with the receiver
- * @return the intersection of the receiver and the argument
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public Rectangle intersection (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (this == rect) return new Rectangle (x, y, width, height);
- int left = x > rect.x ? x : rect.x;
- int top = y > rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs < rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs < rhs ? lhs : rhs;
- return new Rectangle (left, top, right - left, bottom - top);
-}
-
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with the receiver and <code>false</code> otherwise.
- * <p>
- * Two rectangles intersect if the area of the rectangle
- * representing their intersection is not empty.
- * </p>
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- *
- * @see #intersection
- * @see #isEmpty
- */
-public boolean intersects (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return (rect == this) || (rect.x < x + width) && (rect.y < y + height) &&
- (rect.x + rect.width > x) && (rect.y + rect.height > y);
-}
-
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- * <p>
- * A rectangle is considered to <em>cover area</em> in the
- * (x, y) coordinate plane if both its width and height are
- * non-zero.
- * </p>
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- */
-public boolean isEmpty () {
- return (width <= 0) || (height <= 0);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the rectangle
- */
-public String toString () {
- return "Rectangle {" + x + ", " + y + ", " + width + ", " + height + "}";
-}
-
-/**
- * Returns a new rectangle which represents the union of
- * the receiver and the given rectangle.
- * <p>
- * The union of two rectangles is the smallest single rectangle
- * that completely covers both of the areas covered by the two
- * given rectangles.
- * </p>
- *
- * @param rect the rectangle to perform union with
- * @return the union of the receiver and the argument
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- *
- * @see #add
- */
-public Rectangle union (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int left = x < rect.x ? x : rect.x;
- int top = y < rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs > rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs > rhs ? lhs : rhs;
- return new Rectangle (left, top, right - left, bottom - top);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/package.html
deleted file mode 100755
index c6a867e380..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/package.html
+++ /dev/null
@@ -1,17 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT graphics classes.
-<h2>
-Package Specification</h2>
-This package provides the classes which implement points, rectangles,
-regions, colors, cursors, fonts, graphics contexts (that is, <code>GC</code>s)
-where most of the primitive drawing operations are implemented, and
-images including both the code for displaying them and the public API for
-loading/saving them.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java
deleted file mode 100755
index 1728b09ad8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent entry points into Java
- * which can be invoked from operating system level callback
- * routines.
- * <p>
- * IMPORTANT: A callback is only valid when invoked on the
- * thread which created it. The results are undefined (and
- * typically bad) when a callback is passed out to the
- * operating system (or other code) in such a way that the
- * callback is called from a different thread.
- */
-
-public class Callback {
-
- Object object;
- String method, signature;
- int argCount, address;
- boolean isStatic, isArrayBased;
-
- /* Load the SWT library */
- static {
- Library.loadLibrary ("swt");
- }
-
-/**
- * Constructs a new instance of this class given an object
- * to send the message to, a string naming the method to
- * invoke and an argument count. Note that, if the object
- * is an instance of <code>Class</code> it is assumed that
- * the method is a static method on that class.
- *
- * @param object the object to send the message to
- * @param method the name of the method to invoke
- * @param argCount the number of arguments that the method takes
- */
-public Callback (Object object, String method, int argCount) {
- this (object, method, argCount, false);
-}
-
-/**
- * Constructs a new instance of this class given an object
- * to send the message to, a string naming the method to
- * invoke, an argument count and a flag indicating whether
- * or not the arguments will be passed in an array. Note
- * that, if the object is an instance of <code>Class</code>
- * it is assumed that the method is a static method on that
- * class.
- *
- * @param object the object to send the message to
- * @param method the name of the method to invoke
- * @param argCount the number of arguments that the method takes
- * @param isArrayBased <code>true</code> if the arguments should be passed in an array and false otherwise
- */
-public Callback (Object object, String method, int argCount, boolean isArrayBased) {
-
- /* Set the callback fields */
- this.object = object;
- this.method = method;
- this.argCount = argCount;
- isStatic = object instanceof Class;
- this.isArrayBased = isArrayBased;
-
- /* Inline the common cases */
- if (isArrayBased) {
- signature = "([I)I";
- } else {
- switch (argCount) {
- case 0: signature = "()I"; break;
- case 1: signature = "(I)I"; break;
- case 2: signature = "(II)I"; break;
- case 3: signature = "(III)I"; break;
- case 4: signature = "(IIII)I"; break;
- default:
- signature = "(";
- for (int i=0; i<argCount; i++) signature += "I";
- signature += ")I";
- }
- }
-
- /* Bind the address */
- address = bind (this);
-}
-
-/**
- * Allocates the native level resources associated with the
- * callback. This method is only invoked from within the
- * constructor for the argument.
- *
- * @param callback the callback to bind
- */
-static native synchronized int bind (Callback callback);
-
-/**
- * Releases the native level resources associated with the callback,
- * and removes all references between the callback and
- * other objects. This helps to prevent (bad) application code
- * from accidentally holding onto extraneous garbage.
- */
-public void dispose () {
- if (object == null) return;
- unbind (this);
- object = method = signature = null;
- address = 0;
-}
-
-/**
- * Returns the address of a block of machine code which will
- * invoke the callback represented by the receiver.
- *
- * @return the callback address
- */
-public int getAddress () {
- return address;
-}
-
-/**
- * Returns the SWT platform name.
- *
- * @return the platform name of the currently running SWT
- */
-public static native String getPlatform ();
-
-/**
- * Indicates whether or not callbacks which are triggered at the
- * native level should cause the messages described by the matching
- * <code>Callback</code> objects to be invoked. This method is used
- * to safely shut down SWT when it is run within environments
- * which can generate spurious events.
- * <p>
- * Note: This should not be called by application code.
- * </p>
- *
- * @param ignore true if callbacks should not be invoked
- */
-public static final native synchronized void setEnabled (boolean enable);
-
-/**
- * Returns whether or not callbacks which are triggered at the
- * native level should cause the messages described by the matching
- * <code>Callback</code> objects to be invoked. This method is used
- * to safely shut down SWT when it is run within environments
- * which can generate spurious events.
- * <p>
- * Note: This should not be called by application code.
- * </p>
- *
- * @return true if callbacks should not be invoked
- */
-public static final native synchronized boolean getEnabled ();
-
-/**
- * This might be called directly from native code in environments
- * which can generate spurious events. Check before removing it.
- *
- * @deprecated
- *
- * @param ignore true if callbacks should not be invoked
- */
-static final void ignoreCallbacks (boolean ignore) {
- setEnabled (!ignore);
-}
-
-/**
- * Immediately wipes out all native level state associated
- * with <em>all</em> callbacks.
- * <p>
- * <b>WARNING:</b> This operation is <em>extremely</em> dangerous,
- * and should never be performed by application code.
- * </p>
- */
-public static final native synchronized void reset ();
-
-/**
- * Releases the native level resources associated with the callback.
- *
- * @see #dispose
- */
-static final native synchronized void unbind (Callback callback);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/FileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/FileFormat.java
deleted file mode 100755
index 8610057e0f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/FileFormat.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-public abstract class FileFormat {
- LEDataInputStream inputStream;
- LEDataOutputStream outputStream;
- ImageLoader loader;
-byte[] bitInvertData(byte[] data, int startIndex, int endIndex) {
- // Destructively bit invert data in the given byte array.
- for (int i = startIndex; i < endIndex; i++) {
- data[i] = (byte)(255 - data[i - startIndex]);
- }
- return data;
-}
-
-abstract ImageData[] loadFromByteStream();
-
-public ImageData[] loadFromStream(LEDataInputStream stream) {
- try {
- inputStream = stream;
- return loadFromByteStream();
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
-}
-public static ImageData[] load(InputStream is, ImageLoader loader) {
- FileFormat fileFormat = null;
- LEDataInputStream stream = new LEDataInputStream(is);
- if (GIFFileFormat.isGIFFile(stream)) {
- fileFormat = new GIFFileFormat();
- } else if (WinBMPFileFormat.isBMPFile(stream)) {
- fileFormat = new WinBMPFileFormat();
- } else if (WinICOFileFormat.isICOFile(stream)) {
- fileFormat = new WinICOFileFormat();
- } else if (JPEGFileFormat.isJPEGFile(stream)) {
- fileFormat = new JPEGFileFormat();
- } else if (PNGFileFormat.isPNGFile(stream)) {
- fileFormat = new PNGFileFormat();
- } else {
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- }
- fileFormat.loader = loader;
- return fileFormat.loadFromStream(stream);
-}
-public static void save(OutputStream os, int format, ImageLoader loader) {
- /* We do not currently support writing multi-image files,
- * so we use the first image data in the loader's array. */
- ImageData data = loader.data[0];
- LEDataOutputStream stream = new LEDataOutputStream(os);
- switch (format) {
- case SWT.IMAGE_BMP:
- WinBMPFileFormat f = new WinBMPFileFormat();
- f.unloadIntoStream(data, stream);
- break;
- case SWT.IMAGE_BMP_RLE:
- f = new WinBMPFileFormat();
- if (data.depth == 8)
- f.compression = 1;
- if (data.depth == 4)
- f.compression = 2;
- f.unloadIntoStream(data, stream);
- break;
- case SWT.IMAGE_GIF:
- GIFFileFormat g = new GIFFileFormat();
- g.unloadIntoStream(data, stream);
- break;
- case SWT.IMAGE_ICO:
- WinICOFileFormat i = new WinICOFileFormat();
- i.unloadIntoStream(data, stream);
- break;
- case SWT.IMAGE_JPEG:
- JPEGFileFormat j = new JPEGFileFormat();
- j.unloadIntoStream(data, stream);
- break;
- case SWT.IMAGE_PNG:
- PNGFileFormat p = new PNGFileFormat();
- p.unloadIntoStream(data, stream);
- break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-abstract void unloadIntoByteStream(ImageData image);
-
-public void unloadIntoStream(ImageData image, LEDataOutputStream stream) {
- try {
- outputStream = stream;
- unloadIntoByteStream(image);
- outputStream.close();
- } catch (Exception e) {
- try {outputStream.close();} catch (Exception f) {}
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java
deleted file mode 100755
index 055a6d56f3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java
+++ /dev/null
@@ -1,521 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-final class GIFFileFormat extends FileFormat {
- String signature, version;
- boolean sorted;
- int screenWidth, screenHeight, backgroundPixel, aspect, bitsPerPixel;
- boolean userInput = false;
- int disposalMethod = 0;
- int delayTime = 0;
- int transparentPixel = -1;
- int repeatCount = 1;
-
- static final int GIF_APPLICATION_EXTENSION_BLOCK_ID = 0xFF;
- static final int GIF_GRAPHICS_CONTROL_BLOCK_ID = 0xF9;
- static final int GIF_PLAIN_TEXT_BLOCK_ID = 0x01;
- static final int GIF_COMMENT_BLOCK_ID = 0xFE;
- static final int GIF_EXTENSION_BLOCK_ID = 0x21;
- static final int GIF_IMAGE_BLOCK_ID = 0x2C;
- static final int GIF_TRAILER_ID = 0x3B;
-
- /**
- * Return whether or not the specified input stream
- * represents a GIF file.
- */
- public static boolean isGIFFile(LEDataInputStream stream) {
- try {
- byte[] signature = new byte[3];
- stream.read(signature);
- stream.unread(signature);
- return new String(signature).equals("GIF");
- } catch (Exception e) {
- return false;
- }
- }
-
- /**
- * Answer a palette containing numGrays
- * shades of gray, ranging from black to white.
- */
- static PaletteData grayRamp(int numGrays) {
- int n = numGrays - 1;
- RGB[] colors = new RGB[numGrays];
- for (int i = 0; i < numGrays; i++) {
- int intensity = (byte)((i * 3) * 256 / n);
- colors[i] = new RGB(intensity, intensity, intensity);
- }
- return new PaletteData(colors);
- }
-
- /**
- * Load the GIF image(s) stored in the input stream.
- * Return an array of ImageData representing the image(s).
- */
- ImageData[] loadFromByteStream() {
- byte[] signatureBytes = new byte[3];
- byte[] versionBytes = new byte[3];
- byte[] block = new byte[7];
- try {
- inputStream.read(signatureBytes);
- signature = new String(signatureBytes);
- if (!signature.equals("GIF"))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- inputStream.read(versionBytes);
- version = new String(versionBytes);
-
- inputStream.read(block);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- screenWidth = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
- loader.logicalScreenWidth = screenWidth;
- screenHeight = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
- loader.logicalScreenHeight = screenHeight;
- byte bitField = block[4];
- backgroundPixel = block[5] & 0xFF;
- aspect = block[6] & 0xFF;
- bitsPerPixel = ((bitField >> 4) & 0x07) + 1;
- int depth = (bitField & 0x7) + 1;
- PaletteData palette = null;
- if ((bitField & 0x80) != 0) {
- // Global palette.
- sorted = (bitField & 0x8) != 0;
- palette = readPalette(1 << depth);
- } else {
- // No global palette.
- sorted = false;
- backgroundPixel = -1;
- depth = bitsPerPixel;
- }
- loader.backgroundPixel = backgroundPixel;
-
- getExtensions();
- int id = readID();
- ImageData[] images = new ImageData[0];
- while (id == GIF_IMAGE_BLOCK_ID) {
- ImageData image = readImageBlock(depth, palette);
- if (loader.hasListeners()) {
- loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true));
- }
- ImageData[] oldImages = images;
- images = new ImageData[oldImages.length + 1];
- System.arraycopy(oldImages, 0, images, 0, oldImages.length);
- images[images.length - 1] = image;
- try {
- /* Read the 0-byte terminator at the end of the image. */
- id = inputStream.read();
- if (id > 0) {
- /* We read the terminator earlier. */
- inputStream.unread(new byte[] {(byte)id});
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- getExtensions();
- id = readID();
- }
- return images;
- }
-
- /**
- * Read and return the next block or extension identifier from the file.
- */
- int readID() {
- try {
- return inputStream.read();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return -1;
- }
-
- /**
- * Read extensions until an image descriptor appears.
- * In the future, if we care about the extensions, they
- * should be properly grouped with the image data before
- * which they appeared. Right now, the interesting parts
- * of some extensions are kept, but the rest is discarded.
- * Throw an error if an error occurs.
- */
- void getExtensions() {
- int id = readID();
- while (id != GIF_IMAGE_BLOCK_ID && id != GIF_TRAILER_ID && id > 0) {
- if (id == GIF_EXTENSION_BLOCK_ID) {
- readExtension();
- } else {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- id = readID();
- }
- if (id == GIF_IMAGE_BLOCK_ID || id == GIF_TRAILER_ID) {
- try {
- inputStream.unread(new byte[] {(byte)id});
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
- }
-
- /**
- * Read a control extension.
- * Return the extension block data.
- */
- byte[] readExtension() {
- int extensionID = readID();
- if (extensionID == GIF_COMMENT_BLOCK_ID)
- return readCommentExtension();
- if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID)
- return readPlainTextExtension();
- if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID)
- return readGraphicsControlExtension();
- if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID)
- return readApplicationExtension();
- // Otherwise, we don't recognize the block. If the
- // field size is correct, we can just skip over
- // the block contents.
- try {
- int extSize = inputStream.read();
- if (extSize < 0) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- byte[] ext = new byte[extSize];
- inputStream.read(ext, 0, extSize);
- return ext;
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
-
- /**
- * We have just read the Comment extension identifier
- * from the input stream. Read in the rest of the comment
- * and return it. GIF comment blocks are variable size.
- */
- byte[] readCommentExtension() {
- try {
- byte[] comment = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
- byte[] oldComment = comment;
- comment = new byte[oldComment.length + size];
- System.arraycopy(oldComment, 0, comment, 0, oldComment.length);
- System.arraycopy(block, 0, comment, oldComment.length, size);
- size = inputStream.read();
- }
- return comment;
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
-
- /**
- * We have just read the PlainText extension identifier
- * from the input stream. Read in the plain text info and text,
- * and return the text. GIF plain text blocks are variable size.
- */
- byte[] readPlainTextExtension() {
- try {
- // Read size of block = 0x0C.
- inputStream.read();
- // Read the text information (x, y, width, height, colors).
- byte[] info = new byte[12];
- inputStream.read(info);
- // Read the text.
- byte[] text = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
- byte[] oldText = text;
- text = new byte[oldText.length + size];
- System.arraycopy(oldText, 0, text, 0, oldText.length);
- System.arraycopy(block, 0, text, oldText.length, size);
- size = inputStream.read();
- }
- return text;
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
-
- /**
- * We have just read the GraphicsControl extension identifier
- * from the input stream. Read in the control information, store
- * it, and return it.
- */
- byte[] readGraphicsControlExtension() {
- try {
- // Read size of block = 0x04.
- inputStream.read();
- // Read the control block.
- byte[] controlBlock = new byte[4];
- inputStream.read(controlBlock);
- byte bitField = controlBlock[0];
- // Store the user input field.
- userInput = (bitField & 0x02) != 0;
- // Store the disposal method.
- disposalMethod = (bitField >> 2) & 0x07;
- // Store the delay time.
- delayTime = (controlBlock[1] & 0xFF) | ((controlBlock[2] & 0xFF) << 8);
- // Store the transparent color.
- if ((bitField & 0x01) != 0)
- transparentPixel = controlBlock[3] & 0xFF;
- else
- transparentPixel = -1;
- // Read block terminator.
- inputStream.read();
- return controlBlock;
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
-
- /**
- * We have just read the Application extension identifier
- * from the input stream. Read in the rest of the extension,
- * look for and store 'number of repeats', and return the data.
- */
- byte[] readApplicationExtension() {
- try {
- // Read size of block = 0x0B.
- inputStream.read();
- // Read application identifier.
- byte[] applicationBytes = new byte[8];
- inputStream.read(applicationBytes);
- String application = new String(applicationBytes);
- // Read authentication code.
- byte[] authenticationBytes = new byte[3];
- inputStream.read(authenticationBytes);
- String authentication = new String(authenticationBytes);
- // Read application data.
- byte[] data = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
- byte[] oldData = data;
- data = new byte[oldData.length + size];
- System.arraycopy(oldData, 0, data, 0, oldData.length);
- System.arraycopy(block, 0, data, oldData.length, size);
- size = inputStream.read();
- }
- // Look for the NETSCAPE 'repeat count' field for an animated GIF.
- if (application.equals("NETSCAPE") && authentication.equals("2.0") && data[0] == 01) {
- repeatCount = (data[1] & 0xFF) | ((data[2] & 0xFF) << 8);
- loader.repeatCount = repeatCount;
- }
- return data;
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
-
- /**
- * Return a DeviceIndependentImage representing the
- * image block at the current position in the input stream.
- * Throw an error if an error occurs.
- */
- ImageData readImageBlock(int defaultDepth, PaletteData defaultPalette) {
- int depth;
- PaletteData palette;
- byte[] block = new byte[9];
- try {
- inputStream.read(block);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- int left = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
- int top = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
- int width = (block[4] & 0xFF) | ((block[5] & 0xFF) << 8);
- int height = (block[6] & 0xFF) | ((block[7] & 0xFF) << 8);
- byte bitField = block[8];
- boolean interlaced = (bitField & 0x40) != 0;
- boolean sorted = (bitField & 0x20) != 0;
- if ((bitField & 0x80) != 0) {
- // Local palette.
- depth = (bitField & 0x7) + 1;
- palette = readPalette(1 << depth);
- } else {
- // No local palette.
- depth = defaultDepth;
- palette = defaultPalette;
- }
- // Promote depth to next highest supported value.
- if (!(depth == 1 || depth == 4 || depth == 8)) {
- if (depth < 4)
- depth = 4;
- else
- depth = 8;
- }
- if (palette == null) {
- palette = grayRamp(1 << depth);
- }
- int initialCodeSize = -1;
- try {
- initialCodeSize = inputStream.read();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (initialCodeSize < 0) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- ImageData image = ImageData.internal_new(
- width,
- height,
- depth,
- palette,
- 4,
- null,
- 0,
- null,
- null,
- -1,
- transparentPixel,
- SWT.IMAGE_GIF,
- left,
- top,
- disposalMethod,
- delayTime);
- LZWCodec codec = new LZWCodec();
- codec.decode(inputStream, loader, image, interlaced, initialCodeSize);
- return image;
- }
-
- /**
- * Read a palette from the input stream.
- */
- PaletteData readPalette(int numColors) {
- byte[] bytes = new byte[numColors * 3];
- try {
- if (inputStream.read(bytes) != bytes.length)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- RGB[] colors = new RGB[numColors];
- for (int i = 0; i < numColors; i++)
- colors[i] = new RGB(bytes[i*3] & 0xFF,
- bytes[i*3+1] & 0xFF, bytes[i*3+2] & 0xFF);
- return new PaletteData(colors);
- }
-
- /**
- * Write the specified device independent image
- * to the output stream.
- */
- void unloadIntoByteStream(ImageData image) {
- if (!((image.depth == 1) || (image.depth == 4) || (image.depth == 8))) {
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- byte bitField = (byte)((0x80 & 0xF8 & 0xF7 & 0x8F) + (image.depth - 1) + ((image.depth - 1) * 16));
- try {
- outputStream.write(new byte[] { (byte)'G', (byte)'I', (byte)'F' });
- outputStream.write(new byte[] { (byte)'8', (byte)'9', (byte)'a' });
- outputStream.writeShort((short)image.width);
- outputStream.writeShort((short)image.height);
- outputStream.writeByte(bitField);
- outputStream.writeByte((byte)0);
- outputStream.writeByte((byte)0);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- writePalette(image.palette, image.depth);
- if (image.transparentPixel != -1 || image.disposalMethod != 0 || image.delayTime != 0) {
- writeGraphicsControlBlock(image);
- }
- writeImageBlock(image);
- }
-
- /**
- * Write out a GraphicsControlBlock to describe
- * the specified device independent image.
- */
- void writeGraphicsControlBlock(ImageData image) {
- try {
- outputStream.write(GIF_EXTENSION_BLOCK_ID);
- outputStream.write(GIF_GRAPHICS_CONTROL_BLOCK_ID);
- outputStream.write(0x04); // size of block
- byte[] gcBlock = new byte[4];
- gcBlock[0] = (byte)0xFD;
- gcBlock[1] = 0;
- gcBlock[2] = 0;
- gcBlock[3] = 0;
- if (image.transparentPixel == -1) {
- gcBlock[0] = (byte)(gcBlock[0] & 0xFE);
- } else {
- gcBlock[0] = (byte)(gcBlock[0] | 0x01);
- gcBlock[3] = (byte)image.transparentPixel;
- }
- if (image.disposalMethod != 0) {
- gcBlock[0] = (byte)(gcBlock[0] | ((image.disposalMethod & 0x07) << 2));
- }
- if (image.delayTime != 0) {
- gcBlock[1] = (byte)(image.delayTime & 0xFF);
- gcBlock[2] = (byte)((image.delayTime >> 8) & 0xFF);
- }
- outputStream.write(gcBlock);
- outputStream.write(0); // block terminator
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-
- /**
- * Write the specified device independent image
- * to the current position in the output stream.
- */
- void writeImageBlock(ImageData image) {
- try {
- outputStream.write(GIF_IMAGE_BLOCK_ID);
- byte[] block = new byte[9];
- block[0] = (byte)(image.x & 0xFF);
- block[1] = (byte)((image.x >> 8) & 0xFF);
- block[2] = (byte)(image.y & 0xFF);
- block[3] = (byte)((image.y >> 8) & 0xFF);
- block[4] = (byte)(image.width & 0xFF);
- block[5] = (byte)((image.width >> 8) & 0xFF);
- block[6] = (byte)(image.height & 0xFF);
- block[7] = (byte)((image.height >> 8) & 0xFF);
- block[8] = 0; // no interlace, no sort, no local palette
- outputStream.write(block);
- outputStream.write(image.depth);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- new LZWCodec().encode(outputStream, image);
- }
-
- /**
- * Write the specified palette to the output stream.
- */
- void writePalette(PaletteData palette, int depth) {
- byte[] bytes = new byte[(1 << depth) * 3];
- int offset = 0;
- for (int i = 0; i < palette.colors.length; i++) {
- RGB color = palette.colors[i];
- bytes[offset] = (byte)color.red;
- bytes[offset + 1] = (byte)color.green;
- bytes[offset + 2] = (byte)color.blue;
- offset += 3;;
- }
- try {
- outputStream.write(bytes);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGAppn.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGAppn.java
deleted file mode 100755
index 074cd7d3ac..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGAppn.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-final class JPEGAppn extends JPEGVariableSizeSegment {
-
- public JPEGAppn(byte[] reference) {
- super(reference);
- }
-
- public JPEGAppn(LEDataInputStream byteStream) {
- super(byteStream);
- }
-
- public boolean verify() {
- int marker = getSegmentMarker();
- return marker >= JPEGFileFormat.APP0 && marker <= JPEGFileFormat.APP15;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java
deleted file mode 100755
index 0bfd486f7a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGArithmeticConditioningTable extends JPEGVariableSizeSegment {
-
- public JPEGArithmeticConditioningTable(LEDataInputStream byteStream) {
- super(byteStream);
- }
-
- public int signature() {
- return JPEGFileFormat.DAC;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGComment.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGComment.java
deleted file mode 100755
index 9c5f46b9bc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGComment.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGComment extends JPEGVariableSizeSegment {
-
- public JPEGComment(byte[] reference) {
- super(reference);
- }
-
- public JPEGComment(LEDataInputStream byteStream) {
- super(byteStream);
- }
-
- public int signature() {
- return JPEGFileFormat.COM;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGEndOfImage.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGEndOfImage.java
deleted file mode 100755
index 7aa67b6cdf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGEndOfImage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGEndOfImage extends JPEGFixedSizeSegment {
-
- public JPEGEndOfImage() {
- super();
- }
-
- public JPEGEndOfImage(byte[] reference) {
- super(reference);
- }
-
- public int signature() {
- return JPEGFileFormat.EOI;
- }
-
- public int fixedSize() {
- return 2;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFileFormat.java
deleted file mode 100755
index 983952d138..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFileFormat.java
+++ /dev/null
@@ -1,1892 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-final class JPEGFileFormat extends FileFormat {
- int restartInterval;
- JPEGFrameHeader frameHeader;
- int imageWidth, imageHeight;
- int interleavedMcuCols, interleavedMcuRows;
- int maxV, maxH;
- boolean progressive;
- int samplePrecision;
- int nComponents;
- int[][] frameComponents;
- int[] componentIds;
- byte[][] imageComponents;
- int[] dataUnit;
- int[][][] dataUnits;
- int[] precedingDCs;
- JPEGScanHeader scanHeader;
- byte[] dataBuffer;
- int currentBitCount;
- int bufferCurrentPosition;
- int restartsToGo;
- int nextRestartNumber;
- JPEGArithmeticConditioningTable arithmeticTables;
- JPEGHuffmanTable[] acHuffmanTables;
- JPEGHuffmanTable[] dcHuffmanTables;
- int[][] quantizationTables;
- int currentByte;
- int decoderQFactor;
- int encoderQFactor = 75;
- int eobrun = 0;
- /* JPEGConstants */
- public static final int DCTSIZE = 8;
- public static final int DCTSIZESQR = 64;
- /* JPEGFixedPointConstants */
- public static final int FIX_0_899976223 = 7373;
- public static final int FIX_1_961570560 = 16069;
- public static final int FIX_2_053119869 = 16819;
- public static final int FIX_0_298631336 = 2446;
- public static final int FIX_1_847759065 = 15137;
- public static final int FIX_1_175875602 = 9633;
- public static final int FIX_3_072711026 = 25172;
- public static final int FIX_0_765366865 = 6270;
- public static final int FIX_2_562915447 = 20995;
- public static final int FIX_0_541196100 = 4433;
- public static final int FIX_0_390180644 = 3196;
- public static final int FIX_1_501321110 = 12299;
- /* JPEGMarkerCodes */
- public static final int APP0 = 0xFFE0;
- public static final int APP15 = 0xFFEF;
- public static final int COM = 0xFFFE;
- public static final int DAC = 0xFFCC;
- public static final int DHP = 0xFFDE;
- public static final int DHT = 0xFFC4;
- public static final int DNL = 0xFFDC;
- public static final int DRI = 0xFFDD;
- public static final int DQT = 0xFFDB;
- public static final int EOI = 0xFFD9;
- public static final int EXP = 0xFFDF;
- public static final int JPG = 0xFFC8;
- public static final int JPG0 = 0xFFF0;
- public static final int JPG13 = 0xFFFD;
- public static final int RST0 = 0xFFD0;
- public static final int RST1 = 0xFFD1;
- public static final int RST2 = 0xFFD2;
- public static final int RST3 = 0xFFD3;
- public static final int RST4 = 0xFFD4;
- public static final int RST5 = 0xFFD5;
- public static final int RST6 = 0xFFD6;
- public static final int RST7 = 0xFFD7;
- public static final int SOF0 = 0xFFC0;
- public static final int SOF1 = 0xFFC1;
- public static final int SOF2 = 0xFFC2;
- public static final int SOF3 = 0xFFC3;
- public static final int SOF5 = 0xFFC5;
- public static final int SOF6 = 0xFFC6;
- public static final int SOF7 = 0xFFC7;
- public static final int SOF9 = 0xFFC9;
- public static final int SOF10 = 0xFFCA;
- public static final int SOF11 = 0xFFCB;
- public static final int SOF13 = 0xFFCD;
- public static final int SOF14 = 0xFFCE;
- public static final int SOF15 = 0xFFCF;
- public static final int SOI = 0xFFD8;
- public static final int SOS = 0xFFDA;
- public static final int TEM = 0xFF01;
- /* JPEGFrameComponentParameterConstants */
- public static final int TQI = 0;
- public static final int HI = 1;
- public static final int VI = 2;
- public static final int CW = 3;
- public static final int CH = 4;
- /* JPEGScanComponentParameterConstants */
- public static final int DC = 0;
- public static final int AC = 1;
- /* JFIF Component Constants */
- public static final int ID_Y = 1 - 1;
- public static final int ID_CB = 2 - 1;
- public static final int ID_CR = 3 - 1;
-
- public static final int[] ExtendTest = {
- 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
- 4096, 8192, 16384, 32768, 65536, 131072, 262144
- };
- public static final int[] ExtendOffset = new int[] {
- 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047,
- -4095, -8191, -16383, -32767, -65535, -131071, -262143
- };
- public static final int[] ZigZag8x8 = {
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63
- };
- public static int[] CrRTable, CbBTable, CrGTable, CbGTable;
- public static int[] RYTable, GYTable, BYTable,
- RCbTable, GCbTable, BCbTable, RCrTable, GCrTable, BCrTable, NBitsTable;
- static {
- initialize();
- }
-void compress(ImageData image, byte[] dataYComp, byte[] dataCbComp, byte[] dataCrComp) {
- int srcWidth = image.width;
- int srcHeight = image.height;
- int vhFactor = maxV * maxH;
- int[] frameComponent;
- imageComponents = new byte[nComponents][];
- for (int i = 0; i < nComponents; i++) {
- frameComponent = frameComponents[componentIds[i]];
- imageComponents[i] = new byte[frameComponent[CW] * frameComponent[CH]];
- }
- frameComponent = frameComponents[componentIds[ID_Y]];
- for (int yPos = 0; yPos < srcHeight; yPos++) {
- int srcOfs = yPos * srcWidth;
- int dstOfs = yPos * frameComponent[CW];
- System.arraycopy(dataYComp, srcOfs, imageComponents[ID_Y], dstOfs, srcWidth);
- }
- frameComponent = frameComponents[componentIds[ID_CB]];
- for (int yPos = 0; yPos < srcHeight / maxV; yPos++) {
- int destRowIndex = yPos * frameComponent[CW];
- for (int xPos = 0; xPos < srcWidth / maxH; xPos++) {
- int sum = 0;
- for (int iv = 0; iv < maxV; iv++) {
- int srcIndex = (yPos * maxV + iv) * srcWidth + (xPos * maxH);
- for (int ih = 0; ih < maxH; ih++) {
- sum += dataCbComp[srcIndex + ih] & 0xFF;
- }
- }
- imageComponents[ID_CB][destRowIndex + xPos] = (byte)(sum / vhFactor);
- }
- }
- frameComponent = frameComponents[componentIds[ID_CR]];
- for (int yPos = 0; yPos < srcHeight / maxV; yPos++) {
- int destRowIndex = yPos * frameComponent[CW];
- for (int xPos = 0; xPos < srcWidth / maxH; xPos++) {
- int sum = 0;
- for (int iv = 0; iv < maxV; iv++) {
- int srcIndex = (yPos * maxV + iv) * srcWidth + (xPos * maxH);
- for (int ih = 0; ih < maxH; ih++) {
- sum += dataCrComp[srcIndex + ih] & 0xFF;
- }
- }
- imageComponents[ID_CR][destRowIndex + xPos] = (byte)(sum / vhFactor);
- }
- }
- for (int iComp = 0; iComp < nComponents; iComp++) {
- byte[] imageComponent = imageComponents[iComp];
- frameComponent = frameComponents[componentIds[iComp]];
- int hFactor = frameComponent[HI];
- int vFactor = frameComponent[VI];
- int componentWidth = frameComponent[CW];
- int componentHeight = frameComponent[CH];
- int compressedWidth = srcWidth / (maxH / hFactor);
- int compressedHeight = srcHeight / (maxV / vFactor);
- if (compressedWidth < componentWidth) {
- int delta = componentWidth - compressedWidth;
- for (int yPos = 0; yPos < compressedHeight; yPos++) {
- int dstOfs = ((yPos + 1) * componentWidth - delta);
- int dataValue = imageComponent[dstOfs - 1] & 0xFF;
- for (int i = 0; i < delta; i++) {
- imageComponent[dstOfs + i] = (byte)dataValue;
- }
- }
- }
- if (compressedHeight < componentHeight) {
- int srcOfs = (compressedHeight - 1) * componentWidth;
- for (int yPos = compressedHeight; yPos <= componentHeight; yPos++) {
- int dstOfs = (yPos - 1) * componentWidth;
- System.arraycopy(imageComponent, srcOfs, imageComponent, dstOfs, componentWidth);
- }
- }
- }
-}
-void convert4BitRGBToYCbCr(ImageData image) {
- RGB[] rgbs = image.getRGBs();
- int paletteSize = rgbs.length;
- byte[] yComp = new byte[paletteSize];
- byte[] cbComp = new byte[paletteSize];
- byte[] crComp = new byte[paletteSize];
- int srcWidth = image.width;
- int srcHeight = image.height;
- for (int i = 0; i < paletteSize; i++) {
- RGB color = rgbs[i];
- int r = color.red;
- int g = color.green;
- int b = color.blue;
- int n = RYTable[r] + GYTable[g] + BYTable[b];
- yComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) yComp[i]--;
- n = RCbTable[r] + GCbTable[g] + BCbTable[b];
- cbComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) cbComp[i]--;
- n = RCrTable[r] + GCrTable[g] + BCrTable[b];
- crComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) crComp[i]--;
- }
- int bSize = srcWidth * srcHeight;
- byte[] dataYComp = new byte[bSize];
- byte[] dataCbComp = new byte[bSize];
- byte[] dataCrComp = new byte[bSize];
- byte[] origData = image.data;
- for (int yPos = 0; yPos < srcHeight; yPos++) {
- for (int xPos = 0; xPos < srcWidth / 2; xPos++) {
- int srcIndex = yPos * (srcWidth / 2) + xPos;
- int dstIndex = yPos * srcWidth + (xPos * 2);
- int value2 = origData[srcIndex] & 0xFF;
- int value1 = value2 / 16;
- value2 = value2 % 16;
- dataYComp[dstIndex] = yComp[value1];
- dataCbComp[dstIndex] = cbComp[value1];
- dataCrComp[dstIndex] = crComp[value1];
- dataYComp[dstIndex + 1] = yComp[value2];
- dataCbComp[dstIndex + 1] = cbComp[value2];
- dataCrComp[dstIndex + 1] = crComp[value2];
- }
- }
- compress(image, dataYComp, dataCbComp, dataCrComp);
-}
-void convert8BitRGBToYCbCr(ImageData image) {
- RGB[] rgbs = image.getRGBs();
- int paletteSize = rgbs.length;
- byte[] yComp = new byte[paletteSize];
- byte[] cbComp = new byte[paletteSize];
- byte[] crComp = new byte[paletteSize];
- int srcWidth = image.width;
- int srcHeight = image.height;
- for (int i = 0; i < paletteSize; i++) {
- RGB color = rgbs[i];
- int r = color.red;
- int g = color.green;
- int b = color.blue;
- int n = RYTable[r] + GYTable[g] + BYTable[b];
- yComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) yComp[i]--;
- n = RCbTable[r] + GCbTable[g] + BCbTable[b];
- cbComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) cbComp[i]--;
- n = RCrTable[r] + GCrTable[g] + BCrTable[b];
- crComp[i] = (byte)(n / 65536);
- if ((n < 0) && (n % 65536 != 0)) crComp[i]--;
- }
- int dstWidth = image.width;
- int dstHeight = srcHeight;
- int stride = (srcWidth + 3) / 4 * 4;
- int bSize = dstWidth * dstHeight;
- byte[] dataYComp = new byte[bSize];
- byte[] dataCbComp = new byte[bSize];
- byte[] dataCrComp = new byte[bSize];
- byte[] origData = image.data;
- for (int yPos = 0; yPos < srcHeight; yPos++) {
- int srcRowIndex = yPos * stride;
- int dstRowIndex = yPos * dstWidth;
- for (int xPos = 0; xPos < srcWidth; xPos++) {
- int value = origData[srcRowIndex + xPos] & 0xFF;
- int dstIndex = dstRowIndex + xPos;
- dataYComp[dstIndex] = yComp[value];
- dataCbComp[dstIndex] = cbComp[value];
- dataCrComp[dstIndex] = crComp[value];
- }
- }
- compress(image, dataYComp, dataCbComp, dataCrComp);
-}
-byte[] convertCMYKToRGB() {
- /* Unsupported CMYK format. Answer an empty byte array. */
- return new byte[0];
-}
-void convertImageToYCbCr(ImageData image) {
- switch (image.depth) {
- case 4:
- convert4BitRGBToYCbCr(image);
- return;
- case 8:
- convert8BitRGBToYCbCr(image);
- return;
- case 16:
- case 24:
- case 32:
- convertMultiRGBToYCbCr(image);
- return;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- return;
-}
-void convertMultiRGBToYCbCr(ImageData image) {
- int srcWidth = image.width;
- int srcHeight = image.height;
- int bSize = srcWidth * srcHeight;
- byte[] dataYComp = new byte[bSize];
- byte[] dataCbComp = new byte[bSize];
- byte[] dataCrComp = new byte[bSize];
- byte[] origData = image.data;
- PaletteData palette = image.palette;
- int[] buffer = new int[srcWidth];
- if (palette.isDirect) {
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- int redShift = palette.redShift;
- int greenShift = palette.greenShift;
- int blueShift = palette.blueShift;
- for (int yPos = 0; yPos < srcHeight; yPos++) {
- image.getPixels(0, yPos, srcWidth, buffer, 0);
- int dstRowIndex = yPos * srcWidth;
- for (int xPos = 0; xPos < srcWidth; xPos++) {
- int pixel = buffer[xPos];
- int dstDataIndex = dstRowIndex + xPos;
- int r = pixel & redMask;
- r = (redShift < 0) ? r >> -redShift : r << redShift;
- int g = pixel & greenMask;
- g = (greenShift < 0) ? g >> -greenShift : g << greenShift;
- int b = pixel & blueMask;
- b = (blueShift < 0) ? b >> -blueShift : b << blueShift;
- dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) / 65536);
- dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) / 65536);
- dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) / 65536);
- }
- }
- } else {
- for (int yPos = 0; yPos < srcHeight; yPos++) {
- image.getPixels(0, yPos, srcWidth, buffer, 0);
- int dstRowIndex = yPos * srcWidth;
- for (int xPos = 0; xPos < srcWidth; xPos++) {
- int pixel = buffer[xPos];
- int dstDataIndex = dstRowIndex + xPos;
- RGB rgb = palette.getRGB(pixel);
- int r = rgb.red;
- int g = rgb.green;
- int b = rgb.blue;
- dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) / 65536);
- dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) / 65536);
- dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) / 65536);
- }
- }
- }
- compress(image, dataYComp, dataCbComp, dataCrComp);
-}
-byte[] convertYToRGB() {
- int compWidth = frameComponents[componentIds[ID_Y]][CW];
- int bytesPerLine = (((imageWidth * 8 + 7) / 8) + 3) / 4 * 4;
- byte[] data = new byte[bytesPerLine * imageHeight];
- byte[] yComp = imageComponents[ID_Y];
- int destIndex = 0;
- for (int i = 0; i < imageHeight; i++) {
- int srcIndex = i * compWidth;
- for (int j = 0; j < bytesPerLine; j++) {
- int y = yComp[srcIndex] & 0xFF;
- if (y < 0) {
- y = 0;
- } else {
- if (y > 255) y = 255;
- }
- if (j >= imageWidth) {
- y = 0;
- }
- data[destIndex] = (byte)y;
- srcIndex++;
- destIndex++;
- }
- }
- return data;
-}
-byte[] convertYCbCrToRGB() {
- /**
- * Convert existing image components into an RGB format.
- * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
- * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
- * The conversion equations to be implemented are therefore
- * R = Y + 1.40200 * Cr
- * G = Y - 0.34414 * Cb - 0.71414 * Cr
- * B = Y + 1.77200 * Cb
- * where Cb and Cr represent the incoming values less MAXJSAMPLE/2.
- * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
- *
- * To avoid floating-point arithmetic, we represent the fractional constants
- * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
- * the products by 2^16, with appropriate rounding, to get the correct answer.
- * Notice that Y, being an integral input, does not contribute any fraction
- * so it need not participate in the rounding.
- *
- * For even more speed, we avoid doing any multiplications in the inner loop
- * by precalculating the constants times Cb and Cr for all possible values.
- * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
- * for 12-bit samples it is still acceptable. It's not very reasonable for
- * 16-bit samples, but if you want lossless storage you shouldn't be changing
- * colorspace anyway.
- * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
- * values for the G calculation are left scaled up, since we must add them
- * together before rounding.
- */
- int bSize = imageWidth * imageHeight * nComponents;
- byte[] rgbData = new byte[bSize];
- int destIndex = 0;
- expandImageComponents();
- byte[] yComp = imageComponents[ID_Y];
- byte[] cbComp = imageComponents[ID_CB];
- byte[] crComp = imageComponents[ID_CR];
- int compWidth = frameComponents[componentIds[ID_Y]][CW];
- for (int v = 0; v < imageHeight; v++) {
- int srcIndex = v * compWidth;
- for (int i = 0; i < imageWidth; i++) {
- int y = yComp[srcIndex] & 0xFF;
- int cb = cbComp[srcIndex] & 0xFF;
- int cr = crComp[srcIndex] & 0xFF;
- int r = y + CrRTable[cr];
- int g = y + ((CbGTable[cb] + CrGTable[cr]) / 65536);
- int b = y + CbBTable[cb];
- if (r < 0) {
- r = 0;
- } else {
- if (r > 255) r = 255;
- }
- if (g < 0) {
- g = 0;
- } else {
- if (g > 255) g = 255;
- }
- if (b < 0) {
- b = 0;
- } else {
- if (b > 255) b = 255;
- }
- rgbData[destIndex] = (byte)b;
- rgbData[destIndex + 1] = (byte)g;
- rgbData[destIndex + 2] = (byte)r;
- destIndex += 3;
- srcIndex++;
- }
- }
- return rgbData;
-}
-byte[] convertYIQToRGB() {
- /* Unsupported CMYK format. Answer an empty byte array. */
- return new byte[0];
-}
-void decodeACCoefficients(int[] dataUnit, int iComp) {
- int[] sParams = scanHeader.componentParameters[componentIds[iComp]];
- JPEGHuffmanTable acTable = acHuffmanTables[sParams[AC]];
- int k = 1;
- while (k < 64) {
- int rs = decodeUsingTable(acTable);
- int r = rs >> 4;
- int s = rs & 0xF;
- if (s == 0) {
- if (r == 15) {
- k += 16;
- } else {
- break;
- }
- } else {
- k += r;
- int bits = receive(s);
- dataUnit[ZigZag8x8[k]] = extendBy(bits, s);
- k++;
- }
- }
-}
-void decodeACFirstCoefficients(int[] dataUnit, int iComp, int start, int end, int approxBit) {
- if (eobrun > 0) {
- eobrun--;
- return;
- }
- int[] sParams = scanHeader.componentParameters[componentIds[iComp]];
- JPEGHuffmanTable acTable = acHuffmanTables[sParams[AC]];
- int k = start;
- while (k <= end) {
- int rs = decodeUsingTable(acTable);
- int r = rs >> 4;
- int s = rs & 0xF;
- if (s == 0) {
- if (r == 15) {
- k += 16;
- } else {
- eobrun = (1 << r) + receive(r) - 1;
- break;
- }
- } else {
- k += r;
- int bits = receive(s);
- dataUnit[ZigZag8x8[k]] = extendBy(bits, s) << approxBit;
- k++;
- }
- }
-}
-void decodeACRefineCoefficients(int[] dataUnit, int iComp, int start, int end, int approxBit) {
- int[] sParams = scanHeader.componentParameters[componentIds[iComp]];
- JPEGHuffmanTable acTable = acHuffmanTables[sParams[AC]];
- int k = start;
- while (k <= end) {
- if (eobrun > 0) {
- while (k <= end) {
- int zzIndex = ZigZag8x8[k];
- if (dataUnit[zzIndex] != 0) {
- dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit);
- }
- k++;
- }
- eobrun--;
- } else {
- int rs = decodeUsingTable(acTable);
- int r = rs >> 4;
- int s = rs & 0xF;
- if (s == 0) {
- if (r == 15) {
- int zeros = 0;
- while (zeros < 16 && k <= end) {
- int zzIndex = ZigZag8x8[k];
- if (dataUnit[zzIndex] != 0) {
- dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit);
- } else {
- zeros++;
- }
- k++;
- }
- } else {
- eobrun = (1 << r) + receive(r);
- }
- } else {
- int bit = receive(s);
- int zeros = 0;
- int zzIndex = ZigZag8x8[k];
- while ((zeros < r || dataUnit[zzIndex] != 0) && k <= end) {
- if (dataUnit[zzIndex] != 0) {
- dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit);
- } else {
- zeros++;
- }
- k++;
- zzIndex = ZigZag8x8[k];
- }
- if (bit != 0) {
- dataUnit[zzIndex] = 1 << approxBit;
- } else {
- dataUnit[zzIndex] = -1 << approxBit;
- }
- k++;
- }
- }
- }
-}
-int refineAC(int ac, int approxBit) {
- if (ac > 0) {
- int bit = nextBit();
- if (bit != 0) {
- ac = ac + (1 << approxBit);
- }
- } else if (ac < 0) {
- int bit = nextBit();
- if (bit != 0) {
- ac = ac + (-1 << approxBit);
- }
- }
- return ac;
-}
-void decodeDCCoefficient(int[] dataUnit, int iComp, boolean first, int approxBit) {
- int[] sParams = scanHeader.componentParameters[componentIds[iComp]];
- JPEGHuffmanTable dcTable = dcHuffmanTables[sParams[DC]];
- int lastDC = 0;
- if (progressive && !first) {
- int bit = nextBit();
- lastDC = dataUnit[0] + (bit << approxBit);
- } else {
- lastDC = precedingDCs[iComp];
- int nBits = decodeUsingTable(dcTable);
- if (nBits != 0) {
- int bits = receive(nBits);
- int diff = extendBy(bits, nBits);
- lastDC = lastDC + diff;
- precedingDCs[iComp] = lastDC;
- }
- if (progressive) {
- lastDC = lastDC << approxBit;
- }
- }
- dataUnit[0] = lastDC;
-}
-void dequantize(int[] dataUnit, int iComp) {
- int[] qTable = quantizationTables[frameComponents[componentIds[iComp]][TQI]];
- for (int i = 0; i < dataUnit.length; i++) {
- int zzIndex = ZigZag8x8[i];
- dataUnit[zzIndex] = dataUnit[zzIndex] * qTable[i];
- }
-}
-byte[] decodeImageComponents() {
- int[] compIds = new int[nComponents];
- int compIdsIndex = 0;
- for (int i = 0; i < nComponents; i++) {
- compIds[compIdsIndex] = i + 1;
- compIdsIndex++;
- }
- if ((compIds.length == 3) &&
- (compIds[0] == 1) &&
- (compIds[1] == 2) &&
- (compIds[2] == 3)) {
- return convertYCbCrToRGB();
- }
- if ((compIds.length == 3) &&
- (compIds[0] == 1) &&
- (compIds[1] == 4) &&
- (compIds[2] == 5)) {
- return convertYIQToRGB();
- }
- if (compIds.length == 4) {
- return convertCMYKToRGB();
- }
- return convertYToRGB();
-}
-void decodeMCUAtXAndY(int xmcu, int ymcu, int nComponentsInScan, boolean first, int start, int end, int approxBit) {
- for (int iComp = 0; iComp < nComponentsInScan; iComp++) {
- int scanComponent = iComp;
- while (scanHeader.componentParameters[componentIds[scanComponent]] == null) {
- scanComponent++;
- }
- int[] frameComponent = frameComponents[componentIds[scanComponent]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- if (nComponentsInScan == 1) {
- hi = 1;
- vi = 1;
- }
- int compWidth = frameComponent[CW];
- for (int ivi = 0; ivi < vi; ivi++) {
- for (int ihi = 0; ihi < hi; ihi++) {
- if (progressive) {
- // Progressive: First scan - create a new data unit.
- // Subsequent scans - refine the existing data unit.
- int index = (ymcu * vi + ivi) * compWidth + xmcu * hi + ihi;
- dataUnit = dataUnits[scanComponent][index];
- if (dataUnit == null) {
- dataUnit = new int[64];
- dataUnits[scanComponent][index] = dataUnit;
- }
- } else {
- // Sequential: Clear and reuse the data unit buffer.
- for (int i = 0; i < dataUnit.length; i++) {
- dataUnit[i] = 0;
- }
- }
- if (!progressive || scanHeader.isDCProgressiveScan()) {
- decodeDCCoefficient(dataUnit, scanComponent, first, approxBit);
- }
- if (!progressive) {
- decodeACCoefficients(dataUnit, scanComponent);
- } else {
- if (scanHeader.isACProgressiveScan()) {
- if (first) {
- decodeACFirstCoefficients(dataUnit, scanComponent, start, end, approxBit);
- } else {
- decodeACRefineCoefficients(dataUnit, scanComponent, start, end, approxBit);
- }
- }
- if (loader.hasListeners()) {
- // Dequantization, IDCT, up-sampling and color conversion
- // are done on a copy of the coefficient data in order to
- // display the image incrementally.
- int[] temp = dataUnit;
- dataUnit = new int[64];
- System.arraycopy(temp, 0, dataUnit, 0, 64);
- }
- }
- if (!progressive || (progressive && loader.hasListeners())) {
- dequantize(dataUnit, scanComponent);
- inverseDCT(dataUnit);
- storeData(dataUnit, scanComponent, xmcu, ymcu, hi, ihi, vi, ivi);
- }
- }
- }
- }
-}
-void decodeScan() {
- if (progressive && !scanHeader.verifyProgressiveScan()) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- int nComponentsInScan = scanHeader.getNumberOfImageComponents();
- int mcuRowsInScan = interleavedMcuRows;
- int mcusPerRow = interleavedMcuCols;
- if (nComponentsInScan == 1) {
- // Non-interleaved.
- int scanComponent = 0;
- while (scanHeader.componentParameters[componentIds[scanComponent]] == null) {
- scanComponent++;
- }
- int[] frameComponent = frameComponents[componentIds[scanComponent]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- int mcuWidth = DCTSIZE * maxH / hi;
- int mcuHeight = DCTSIZE * maxV / vi;
- mcusPerRow = (imageWidth + mcuWidth - 1) / mcuWidth;
- mcuRowsInScan = (imageHeight + mcuHeight - 1) / mcuHeight;
- }
- boolean first = scanHeader.isFirstScan();
- int start = scanHeader.getStartOfSpectralSelection();
- int end = scanHeader.getEndOfSpectralSelection();
- int approxBit = scanHeader.getApproxBitPositionLow();
- restartsToGo = restartInterval;
- nextRestartNumber = 0;
- for (int ymcu = 0; ymcu < mcuRowsInScan; ymcu++) {
- for (int xmcu = 0; xmcu < mcusPerRow; xmcu++) {
- if (restartInterval != 0) {
- if (restartsToGo == 0) processRestartInterval();
- restartsToGo--;
- }
- decodeMCUAtXAndY(xmcu, ymcu, nComponentsInScan, first, start, end, approxBit);
- }
- }
-}
-int decodeUsingTable(JPEGHuffmanTable huffmanTable) {
- int i = 0;
- int[] maxCodes = huffmanTable.getDhMaxCodes();
- int[] minCodes = huffmanTable.getDhMinCodes();
- int[] valPtrs = huffmanTable.getDhValPtrs();
- int[] huffVals = huffmanTable.getDhValues();
- int code = nextBit();
- while (code > maxCodes[i]) {
- code = code * 2 + nextBit();
- i++;
- }
- int j = valPtrs[i];
- j = j + code - minCodes[i];
- return huffVals[j];
-}
-void emit(int huffCode, int nBits) {
- if (nBits == 0) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- int[] power2m1 = new int[] {
- 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191,
- 16383, 32767, 65535, 131125
- };
- int code = (huffCode & power2m1[nBits - 1]) << (24 - nBits - currentBitCount);
- byte[] codeBuffer = new byte[4];
- codeBuffer[0] = (byte)(code % 256);
- codeBuffer[1] = (byte)((code / 256) % 256);
- codeBuffer[2] = (byte)((code / 65536) % 256);
- codeBuffer[3] = (byte)((code / 16777216) % 256);
- int abs = nBits - (8 - currentBitCount);
- if (abs < 0) abs = -abs;
- if ((abs / 8) > 0) {
- currentByte += codeBuffer[2];
- emitByte((byte)currentByte);
- emitByte((byte)codeBuffer[1]);
- currentByte = codeBuffer[0];
- currentBitCount += nBits - 16;
- } else {
- currentBitCount += nBits;
- if (currentBitCount >= 8) {
- currentByte += codeBuffer[2];
- emitByte((byte)currentByte);
- currentByte = codeBuffer[1];
- currentBitCount -= 8;
- } else {
- currentByte += codeBuffer[2];
- }
- }
-}
-void emitByte(byte byteValue) {
- if (bufferCurrentPosition >= 512) {
- resetOutputBuffer();
- }
- dataBuffer[bufferCurrentPosition] = byteValue;
- bufferCurrentPosition++;
- if (byteValue == -1) {
- emitByte((byte)0);
- }
-}
-void encodeACCoefficients(int[] dataUnit, int iComp) {
- int[] sParams = scanHeader.componentParameters[iComp];
- JPEGHuffmanTable acTable = acHuffmanTables[sParams[AC]];
- int[] ehCodes = acTable.ehCodes;
- byte[] ehSizes = acTable.ehCodeLengths;
- int r = 0;
- int k = 1;
- while (k < 64) {
- k++;
- int acValue = dataUnit[ZigZag8x8[k - 1]];
- if (acValue == 0) {
- if (k == 64) {
- emit(ehCodes[0], ehSizes[0] & 0xFF);
- } else {
- r++;
- }
- } else {
- while (r > 15) {
- emit(ehCodes[0xF0], ehSizes[0xF0] & 0xFF);
- r -= 16;
- }
- if (acValue < 0) {
- int absACValue = acValue;
- if (absACValue < 0) absACValue = -absACValue;
- int nBits = NBitsTable[absACValue];
- int rs = r * 16 + nBits;
- emit(ehCodes[rs], ehSizes[rs] & 0xFF);
- emit(0xFFFFFF - absACValue, nBits);
- } else {
- int nBits = NBitsTable[acValue];
- int rs = r * 16 + nBits;
- emit(ehCodes[rs], ehSizes[rs] & 0xFF);
- emit(acValue, nBits);
- }
- r = 0;
- }
- }
-}
-void encodeDCCoefficients(int[] dataUnit, int iComp) {
- int[] sParams = scanHeader.componentParameters[iComp];
- JPEGHuffmanTable dcTable = dcHuffmanTables[sParams[DC]];
- int lastDC = precedingDCs[iComp];
- int dcValue = dataUnit[0];
- int diff = dcValue - lastDC;
- precedingDCs[iComp] = dcValue;
- if (diff < 0) {
- int absDiff = 0 - diff;
- int nBits = NBitsTable[absDiff];
- emit(dcTable.ehCodes[nBits], dcTable.ehCodeLengths[nBits]);
- emit(0xFFFFFF - absDiff, nBits);
- } else {
- int nBits = NBitsTable[diff];
- emit(dcTable.ehCodes[nBits], dcTable.ehCodeLengths[nBits]);
- if (nBits != 0) {
- emit(diff, nBits);
- }
- }
-}
-void encodeMCUAtXAndY(int xmcu, int ymcu) {
- int nComponentsInScan = scanHeader.getNumberOfImageComponents();
- dataUnit = new int[64];
- for (int iComp = 0; iComp < nComponentsInScan; iComp++) {
- int[] frameComponent = frameComponents[componentIds[iComp]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- for (int ivi = 0; ivi < vi; ivi++) {
- for (int ihi = 0; ihi < hi; ihi++) {
- extractData(dataUnit, iComp, xmcu, ymcu, ihi, ivi);
- forwardDCT(dataUnit);
- quantizeData(dataUnit, iComp);
- encodeDCCoefficients(dataUnit, iComp);
- encodeACCoefficients(dataUnit, iComp);
- }
- }
- }
-}
-void encodeScan() {
- for (int ymcu = 0; ymcu < interleavedMcuRows; ymcu++) {
- for (int xmcu = 0; xmcu < interleavedMcuCols; xmcu++) {
- encodeMCUAtXAndY(xmcu, ymcu);
- }
- }
- if (currentBitCount != 0) {
- emitByte((byte)currentByte);
- }
- resetOutputBuffer();
-}
-void expandImageComponents() {
- for (int iComp = 0; iComp < nComponents; iComp++) {
- int[] frameComponent = frameComponents[componentIds[iComp]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- int upH = maxH / hi;
- int upV = maxV / vi;
- if ((upH * upV) > 1) {
- byte[] component = imageComponents[iComp];
- int compWidth = frameComponent[CW];
- int compHeight = frameComponent[CH];
- int upCompWidth = compWidth * upH;
- int upCompHeight = compHeight * upV;
- RGB[] rgbs = new RGB[] {
- new RGB(0,0,0),
- new RGB(0x80,0,0),
- new RGB(0,0x80,0),
- new RGB(0x80,0x80,0),
- new RGB(0,0,0x80),
- new RGB(0x80,0,0x80),
- new RGB(0,0x80,0x80),
- new RGB(0xC0,0xC0,0xC0),
- new RGB(0x80,0x80,0x80),
- new RGB(0xFF,0,0),
- new RGB(0,0xFF,0),
- new RGB(0xFF,0xFF,0),
- new RGB(0,0,0xFF),
- new RGB(0xFF,0,0xFF),
- new RGB(0,0xFF,0xFF),
- new RGB(0xFF,0xFF,0xFF),
- };
- ImageData src = new ImageData(compWidth, compHeight, 8, new PaletteData(rgbs), 4, component);
- ImageData dest = src.scaledTo(upCompWidth, upCompHeight);
- imageComponents[iComp] = dest.data;
- }
- }
-}
-int extendBy(int diff, int t) {
- if (diff < ExtendTest[t]) {
- return diff + ExtendOffset[t];
- } else {
- return diff;
- }
-}
-void extractData(int[] dataUnit, int iComp, int xmcu, int ymcu, int ihi, int ivi) {
- byte[] compImage = imageComponents[iComp];
- int[] frameComponent = frameComponents[componentIds[iComp]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- int compWidth = frameComponent[CW];
- int srcIndex = ((ymcu * vi + ivi) * compWidth * DCTSIZE) + ((xmcu * hi + ihi) * DCTSIZE);
- int destIndex = 0;
- for (int i = 0; i < DCTSIZE; i++) {
- for (int col = 0; col < DCTSIZE; col++) {
- dataUnit[destIndex] = (compImage[srcIndex + col] & 0xFF) - 128;
- destIndex++;
- }
- srcIndex += compWidth;
- }
-}
-void forwardDCT(int[] dataUnit) {
- for (int row = 0; row < 8; row++) {
- int rIndex = row * DCTSIZE;
- int tmp0 = dataUnit[rIndex] + dataUnit[rIndex + 7];
- int tmp7 = dataUnit[rIndex] - dataUnit[rIndex + 7];
- int tmp1 = dataUnit[rIndex + 1] + dataUnit[rIndex + 6];
- int tmp6 = dataUnit[rIndex + 1] - dataUnit[rIndex + 6];
- int tmp2 = dataUnit[rIndex + 2] + dataUnit[rIndex + 5];
- int tmp5 = dataUnit[rIndex + 2] - dataUnit[rIndex + 5];
- int tmp3 = dataUnit[rIndex + 3] + dataUnit[rIndex + 4];
- int tmp4 = dataUnit[rIndex + 3] - dataUnit[rIndex + 4];
-
- /**
- * Even part per LL&M figure 1 --- note that published figure
- * is faulty; rotator 'sqrt(2)*c1' should be 'sqrt(2)*c6'.
- */
- int tmp10 = tmp0 + tmp3;
- int tmp13 = tmp0 - tmp3;
- int tmp11 = tmp1 + tmp2;
- int tmp12 = tmp1 - tmp2;
-
- dataUnit[rIndex] = (tmp10 + tmp11) * 4;
- dataUnit[rIndex + 4] = (tmp10 - tmp11) * 4;
-
- int z1 = (tmp12 + tmp13) * FIX_0_541196100;
- int scaleFactor1 = ExtendTest[11];
- int scaleFactor2 = ExtendTest[12];
- int n = z1 + (tmp13 * FIX_0_765366865) + scaleFactor1;
- dataUnit[rIndex + 2] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 2]--;
- n = z1 + (tmp12 * (0 - FIX_1_847759065)) + scaleFactor1;
- dataUnit[rIndex + 6] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 6]--;
-
- /**
- * Odd part per figure 8 --- note paper omits factor of sqrt(2).
- * cK represents cos(K*pi/16).
- * i0..i3 in the paper are tmp4..tmp7 here.
- */
- z1 = tmp4 + tmp7;
- int z2 = tmp5 + tmp6;
- int z3 = tmp4 + tmp6;
- int z4 = tmp5 + tmp7;
- int z5 = (z3 + z4) * FIX_1_175875602; // sqrt(2) * c3
-
- tmp4 = tmp4 * FIX_0_298631336; // sqrt(2) * (-c1+c3+c5-c7)
- tmp5 = tmp5 * FIX_2_053119869; // sqrt(2) * ( c1+c3-c5+c7)
- tmp6 = tmp6 * FIX_3_072711026; // sqrt(2) * ( c1+c3+c5-c7)
- tmp7 = tmp7 * FIX_1_501321110; // sqrt(2) * ( c1+c3-c5-c7)
- z1 = z1 * (0 - FIX_0_899976223); // sqrt(2) * (c7-c3)
- z2 = z2 * (0 - FIX_2_562915447); // sqrt(2) * (-c1-c3)
- z3 = z3 * (0 - FIX_1_961570560); // sqrt(2) * (-c3-c5)
- z4 = z4 * (0 - FIX_0_390180644); // sqrt(2) * (c5-c3)
-
- z3 = z3 + z5;
- z4 = z4 + z5;
-
- n = tmp4 + z1 + z3 + scaleFactor1;
- dataUnit[rIndex + 7] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 7]--;
- n = tmp5 + z2 + z4 + scaleFactor1;
- dataUnit[rIndex + 5] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 5]--;
- n = tmp6 + z2 + z3 + scaleFactor1;
- dataUnit[rIndex + 3] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 3]--;
- n = tmp7 + z1 + z4 + scaleFactor1;
- dataUnit[rIndex + 1] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[rIndex + 1]--;
- }
-
- /**
- * Pass 2: process columns.
- * Note that we must descale the results by a factor of 8 == 2**3,
- * and also undo the PASS1_BITS scaling.
- */
- for (int col = 0; col < 8; col++) {
- int c0 = col;
- int c1 = col + 8;
- int c2 = col + 16;
- int c3 = col + 24;
- int c4 = col + 32;
- int c5 = col + 40;
- int c6 = col + 48;
- int c7 = col + 56;
- int tmp0 = dataUnit[c0] + dataUnit[c7];
- int tmp7 = dataUnit[c0] - dataUnit[c7];
- int tmp1 = dataUnit[c1] + dataUnit[c6];
- int tmp6 = dataUnit[c1] - dataUnit[c6];
- int tmp2 = dataUnit[c2] + dataUnit[c5];
- int tmp5 = dataUnit[c2] - dataUnit[c5];
- int tmp3 = dataUnit[c3] + dataUnit[c4];
- int tmp4 = dataUnit[c3] - dataUnit[c4];
-
- /**
- * Even part per LL&M figure 1 --- note that published figure
- * is faulty; rotator 'sqrt(2)*c1' should be 'sqrt(2)*c6'.
- */
- int tmp10 = tmp0 + tmp3;
- int tmp13 = tmp0 - tmp3;
- int tmp11 = tmp1 + tmp2;
- int tmp12 = tmp1 - tmp2;
-
- int scaleFactor1 = ExtendTest[5];
- int scaleFactor2 = ExtendTest[6];
- int n = tmp10 + tmp11 + scaleFactor1;
- dataUnit[c0] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c0]--;
- n = tmp10 - tmp11 + scaleFactor1;
- dataUnit[c4] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c4]--;
-
- int z1 = (tmp12 + tmp13) * FIX_0_541196100;
- scaleFactor1 = ExtendTest[18];
- scaleFactor2 = ExtendTest[19];
- n = z1 + (tmp13 * FIX_0_765366865) + scaleFactor1;
- dataUnit[c2] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c2]--;
- n = z1 + (tmp12 * (0 - FIX_1_847759065)) + scaleFactor1;
- dataUnit[c6] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c6]--;
-
- /**
- * Odd part per figure 8 --- note paper omits factor of sqrt(2).
- * cK represents cos(K*pi/16).
- * i0..i3 in the paper are tmp4..tmp7 here.
- */
- z1 = tmp4 + tmp7;
- int z2 = tmp5 + tmp6;
- int z3 = tmp4 + tmp6;
- int z4 = tmp5 + tmp7;
- int z5 = (z3 + z4) * FIX_1_175875602; // sqrt(2) * c3
-
- tmp4 = tmp4 * FIX_0_298631336; // sqrt(2) * (-c1+c3+c5-c7)
- tmp5 = tmp5 * FIX_2_053119869; // sqrt(2) * ( c1+c3-c5+c7)
- tmp6 = tmp6 * FIX_3_072711026; // sqrt(2) * ( c1+c3+c5-c7)
- tmp7 = tmp7 * FIX_1_501321110; // sqrt(2) * ( c1+c3-c5-c7)
- z1 = z1 * (0 - FIX_0_899976223); // sqrt(2) * (c7-c3)
- z2 = z2 * (0 - FIX_2_562915447); // sqrt(2) * (-c1-c3)
- z3 = z3 * (0 - FIX_1_961570560); // sqrt(2) * (-c3-c5)
- z4 = z4 * (0 - FIX_0_390180644); // sqrt(2) * (c5-c3)
-
- z3 = z3 + z5;
- z4 = z4 + z5;
-
- n = tmp4 + z1 + z3 + scaleFactor1;
- dataUnit[c7] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c7]--;
- n = tmp5 + z2 + z4 + scaleFactor1;
- dataUnit[c5] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c5]--;
- n = tmp6 + z2 + z3 + scaleFactor1;
- dataUnit[c3] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c3]--;
- n = tmp7 + z1 + z4 + scaleFactor1;
- dataUnit[c1] = n / scaleFactor2;
- if ((n < 0) && (n % scaleFactor2 != 0)) dataUnit[c1]--;
- }
-}
-void getAPP0() {
- JPEGAppn appn = new JPEGAppn(inputStream);
- if (!appn.verify()) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-}
-void getCOM() {
- new JPEGComment(inputStream);
-}
-void getDAC() {
- JPEGArithmeticConditioningTable dac = new JPEGArithmeticConditioningTable(inputStream);
- arithmeticTables = dac;
-}
-void getDHT() {
- JPEGHuffmanTable dht = new JPEGHuffmanTable(inputStream);
- if (!dht.verify()) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- if (acHuffmanTables == null) {
- acHuffmanTables = new JPEGHuffmanTable[4];
- }
- if (dcHuffmanTables == null) {
- dcHuffmanTables = new JPEGHuffmanTable[4];
- }
- JPEGHuffmanTable[] dhtTables = dht.getAllTables();
- for (int i = 0; i < dhtTables.length; i++) {
- JPEGHuffmanTable dhtTable = dhtTables[i];
- if (dhtTable.getTableClass() == 0) {
- dcHuffmanTables[dhtTable.getTableIdentifier()] = dhtTable;
- } else {
- acHuffmanTables[dhtTable.getTableIdentifier()] = dhtTable;
- }
- }
-}
-void getDNL() {
- new JPEGRestartInterval(inputStream);
-}
-void getDQT() {
- JPEGQuantizationTable dqt = new JPEGQuantizationTable(inputStream);
- int[][] currentTables = quantizationTables;
- if (currentTables == null) {
- currentTables = new int[4][];
- }
- int[] dqtTablesKeys = dqt.getQuantizationTablesKeys();
- int[][] dqtTablesValues = dqt.getQuantizationTablesValues();
- for (int i = 0; i < dqtTablesKeys.length; i++) {
- int index = dqtTablesKeys[i];
- currentTables[index] = dqtTablesValues[i];
- }
- quantizationTables = currentTables;
-}
-void getDRI() {
- JPEGRestartInterval dri = new JPEGRestartInterval(inputStream);
- if (!dri.verify()) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- restartInterval = dri.getRestartInterval();
-}
-static void initialize() {
- initializeRGBYCbCrTables();
- initializeYCbCrRGBTables();
- initializeBitCountTable();
-}
-static void initializeBitCountTable() {
- int nBits = 1;
- int count = 0;
- int power2 = 2;
- NBitsTable = new int[2048];
- NBitsTable[0] = 0;
- for (int i = 1; i < NBitsTable.length; i++) {
- if (!(i < power2)) {
- nBits++;
- power2 *= 2;
- }
- NBitsTable[i] = nBits;
- }
-}
-static void initializeRGBYCbCrTables() {
- RYTable = new int[256];
- GYTable = new int[256];
- BYTable = new int[256];
- RCbTable = new int[256];
- GCbTable = new int[256];
- BCbTable = new int[256];
- RCrTable = BCbTable;
- GCrTable = new int[256];
- BCrTable = new int[256];
- for (int i = 0; i < 256; i++) {
- RYTable[i] = i * 19595;
- GYTable[i] = i * 38470;
- BYTable[i] = i * 7471 + 32768;
- RCbTable[i] = i * -11059;
- GCbTable[i] = i * -21709;
- BCbTable[i] = i * 32768 + 8388608;
- GCrTable[i] = i * -27439;
- BCrTable[i] = i * -5329;
- }
-}
-static void initializeYCbCrRGBTables() {
- CrRTable = new int[256];
- CbBTable = new int[256];
- CrGTable = new int[256];
- CbGTable = new int[256];
- for (int i = 0; i < 256; i++) {
- int x2 = 2 * i - 255;
- CrRTable[i] = (45941 * x2 + 32768) / 65536;
- CbBTable[i] = (58065 * x2 + 32768) / 65536;
- CrGTable[i] = -23401 * x2;
- CbGTable[i] = -11277 * x2 + 32768;
- }
-}
-void inverseDCT(int[] dataUnit) {
- for (int row = 0; row < 8; row++) {
- int rIndex = row * DCTSIZE;
- /**
- * Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any row in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * row DCT calculations can be simplified this way.
- */
- if (isZeroInRow(dataUnit, rIndex)) {
- int dcVal = dataUnit[rIndex] * 4;
- for (int i = rIndex; i < rIndex + 8; i++) {
- dataUnit[i] = dcVal;
- }
- } else {
- /**
- * Even part: reverse the even part of the forward DCT.
- * The rotator is sqrt(2)*c(-6).
- */
- int z2 = dataUnit[rIndex + 2];
- int z3 = dataUnit[rIndex + 6];
- int z1 = (z2 + z3) * FIX_0_541196100;
- int tmp2 = z1 + (z3 * (0 - FIX_1_847759065));
- int tmp3 = z1 + (z2 * FIX_0_765366865);
- int tmp0 = (dataUnit[rIndex] + dataUnit[rIndex + 4]) * 8192;
- int tmp1 = (dataUnit[rIndex] - dataUnit[rIndex + 4]) * 8192;
- int tmp10 = tmp0 + tmp3;
- int tmp13 = tmp0 - tmp3;
- int tmp11 = tmp1 + tmp2;
- int tmp12 = tmp1 - tmp2;
- /**
- * Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
- tmp0 = dataUnit[rIndex + 7];
- tmp1 = dataUnit[rIndex + 5];
- tmp2 = dataUnit[rIndex + 3];
- tmp3 = dataUnit[rIndex + 1];
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- int z4 = tmp1 + tmp3;
- int z5 = (z3 + z4)* FIX_1_175875602; /* sqrt(2) * c3 */
-
- tmp0 = tmp0 * FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = tmp1 * FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = tmp2 * FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = tmp3 * FIX_1_501321110; /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = z1 * (0 - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = z2 * (0 - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = z3 * (0 - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = z4 * (0 - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 = z3 + z5;
- z4 = z4 + z5;
- tmp0 = tmp0 + z1 + z3;
- tmp1 = tmp1 + z2 + z4;
- tmp2 = tmp2 + z2 + z3;
- tmp3 = tmp3 + z1 + z4;
-
- int descaleFactor1 = ExtendTest[11];
- int descaleFactor2 = ExtendTest[12];
- dataUnit[rIndex] = (tmp10 + tmp3 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 7] = (tmp10 - tmp3 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 1] = (tmp11 + tmp2 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 6] = (tmp11 - tmp2 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 2] = (tmp12 + tmp1 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 5] = (tmp12 - tmp1 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 3] = (tmp13 + tmp0 + descaleFactor1) / descaleFactor2;
- dataUnit[rIndex + 4] = (tmp13 - tmp0 + descaleFactor1) / descaleFactor2;
- }
- }
- /**
- * Pass 2: process columns.
- * Note that we must descale the results by a factor of 8 == 2**3,
- * and also undo the PASS1_BITS scaling.
- */
- for (int col = 0; col < 8; col++) {
- int c0 = col;
- int c1 = col + 8;
- int c2 = col + 16;
- int c3 = col + 24;
- int c4 = col + 32;
- int c5 = col + 40;
- int c6 = col + 48;
- int c7 = col + 56;
- if (isZeroInColumn(dataUnit, col)) {
- int dcVal = (dataUnit[c0] + 16) / 32;
- dataUnit[c0] = dcVal;
- dataUnit[c1] = dcVal;
- dataUnit[c2] = dcVal;
- dataUnit[c3] = dcVal;
- dataUnit[c4] = dcVal;
- dataUnit[c5] = dcVal;
- dataUnit[c6] = dcVal;
- dataUnit[c7] = dcVal;
- } else {
- /**
- * Even part: reverse the even part of the forward DCT.
- * The rotator is sqrt(2)*c(-6).
- */
- int z2 = dataUnit[c2];
- int z3 = dataUnit[c6];
- int z1 = (z2 + z3) * FIX_0_541196100;
- int tmp2 = z1 + (z3 * (0 - FIX_1_847759065));
- int tmp3 = z1 + (z2 * FIX_0_765366865);
- int tmp0 = (dataUnit[c0] + dataUnit[c4]) * 8192;
- int tmp1 = (dataUnit[c0] - dataUnit[c4]) * 8192;
- int tmp10 = tmp0 + tmp3;
- int tmp13 = tmp0 - tmp3;
- int tmp11 = tmp1 + tmp2;
- int tmp12 = tmp1 - tmp2;
- /**
- * Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
- tmp0 = dataUnit[c7];;
- tmp1 = dataUnit[c5];
- tmp2 = dataUnit[c3];
- tmp3 = dataUnit[c1];
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- int z4 = tmp1 + tmp3;
- int z5 = (z3 + z4) * FIX_1_175875602; /* sqrt(2) * c3 */
-
- tmp0 = tmp0 * FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = tmp1 * FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = tmp2 * FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = tmp3 * FIX_1_501321110; /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = z1 * (0 - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = z2 * (0 - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = z3 * (0 - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = z4 * (0 - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 = z3 + z5;
- z4 = z4 + z5;
-
- tmp0 = tmp0 + z1 + z3;
- tmp1 = tmp1 + z2 + z4;
- tmp2 = tmp2 + z2 + z3;
- tmp3 = tmp3 + z1 + z4;
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
- int descaleFactor1 = ExtendTest[18];
- int descaleFactor2 = ExtendTest[19];
- dataUnit[c0] = (tmp10 + tmp3 + descaleFactor1) / descaleFactor2;
- dataUnit[c7] = (tmp10 - tmp3 + descaleFactor1) / descaleFactor2;
- dataUnit[c1] = (tmp11 + tmp2 + descaleFactor1) / descaleFactor2;
- dataUnit[c6] = (tmp11 - tmp2 + descaleFactor1) / descaleFactor2;
- dataUnit[c2] = (tmp12 + tmp1 + descaleFactor1) / descaleFactor2;
- dataUnit[c5] = (tmp12 - tmp1 + descaleFactor1) / descaleFactor2;
- dataUnit[c3] = (tmp13 + tmp0 + descaleFactor1) / descaleFactor2;
- dataUnit[c4] = (tmp13 - tmp0 + descaleFactor1) / descaleFactor2;
- }
- }
-}
-public static boolean isJPEGFile(LEDataInputStream stream) {
- try {
- JPEGStartOfImage soi = new JPEGStartOfImage(stream);
- stream.unread(soi.reference);
- return soi.verify(); // we no longer check for appN
- } catch (Exception e) {
- return false;
- }
-}
-boolean isZeroInColumn(int[] dataUnit, int col) {
- return (dataUnit[col + 8] + dataUnit[col + 16] +
- dataUnit[col + 24] + dataUnit[col + 32] +
- dataUnit[col + 40] + dataUnit[col + 48] +
- dataUnit[col + 56]) == 0;
-}
-boolean isZeroInRow(int[] dataUnit, int rIndex) {
- return (dataUnit[rIndex + 1] + dataUnit[rIndex + 2] +
- dataUnit[rIndex + 3] + dataUnit[rIndex + 4] +
- dataUnit[rIndex + 5] + dataUnit[rIndex + 6] +
- dataUnit[rIndex + 7]) == 0;
-}
-ImageData[] loadFromByteStream() {
- JPEGStartOfImage soi = new JPEGStartOfImage(inputStream);
- if (!soi.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE);
- restartInterval = 0;
-
- /* Process the tables preceding the frame header. */
- processTables();
-
- /* Start of Frame. */
- frameHeader = new JPEGFrameHeader(inputStream);
- if (!frameHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE);
- imageWidth = frameHeader.getSamplesPerLine();
- imageHeight = frameHeader.getNumberOfLines();
- maxH = frameHeader.getMaxHFactor();
- maxV = frameHeader.getMaxVFactor();
- int mcuWidth = maxH * DCTSIZE;
- int mcuHeight = maxV * DCTSIZE;
- interleavedMcuCols = (imageWidth + mcuWidth - 1) / mcuWidth;
- interleavedMcuRows = (imageHeight + mcuHeight - 1) / mcuHeight;
- progressive = frameHeader.isProgressive();
- samplePrecision = frameHeader.getSamplePrecision();
- nComponents = frameHeader.getNumberOfImageComponents();
- frameComponents = frameHeader.componentParameters;
- componentIds = frameHeader.componentIdentifiers;
- imageComponents = new byte[nComponents][];
- if (progressive) {
- // Progressive jpeg: need to keep all of the data units.
- dataUnits = new int[nComponents][][];
- } else {
- // Sequential jpeg: only need one data unit.
- dataUnit = new int[8 * 8];
- }
- for (int i = 0; i < nComponents; i++) {
- int[] frameComponent = frameComponents[componentIds[i]];
- int bufferSize = frameComponent[CW] * frameComponent[CH];
- imageComponents[i] = new byte[bufferSize];
- if (progressive) {
- dataUnits[i] = new int[bufferSize][];
- }
- }
-
- /* Process the tables preceding the scan header. */
- processTables();
-
- /* Start of Scan. */
- scanHeader = new JPEGScanHeader(inputStream);
- if (!scanHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- /* Process scan(s) and further tables until EOI. */
- int progressiveScanCount = 0;
- boolean done = false;
- while(!done) {
- resetInputBuffer();
- precedingDCs = new int[4];
- decodeScan();
- if (progressive && loader.hasListeners()) {
- ImageData imageData = createImageData();
- loader.notifyListeners(new ImageLoaderEvent(loader, imageData, progressiveScanCount, false));
- progressiveScanCount++;
- }
-
- /* Unread any buffered data before looking for tables again. */
- int delta = 512 - bufferCurrentPosition - 1;
- if (delta > 0) {
- byte[] unreadBuffer = new byte[delta];
- System.arraycopy(dataBuffer, bufferCurrentPosition + 1, unreadBuffer, 0, delta);
- try {
- inputStream.unread(unreadBuffer);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-
- /* Process the tables preceding the next scan header. */
- JPEGSegment jpegSegment = processTables();
- if (jpegSegment == null || jpegSegment.getSegmentMarker() == EOI) {
- done = true;
- } else {
- scanHeader = new JPEGScanHeader(inputStream);
- if (!scanHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- }
-
- if (progressive) {
- for (int ymcu = 0; ymcu < interleavedMcuRows; ymcu++) {
- for (int xmcu = 0; xmcu < interleavedMcuCols; xmcu++) {
- for (int iComp = 0; iComp < nComponents; iComp++) {
- int[] frameComponent = frameComponents[componentIds[iComp]];
- int hi = frameComponent[HI];
- int vi = frameComponent[VI];
- int compWidth = frameComponent[CW];
- for (int ivi = 0; ivi < vi; ivi++) {
- for (int ihi = 0; ihi < hi; ihi++) {
- int index = (ymcu * vi + ivi) * compWidth + xmcu * hi + ihi;
- dataUnit = dataUnits[iComp][index];
- dequantize(dataUnit, iComp);
- inverseDCT(dataUnit);
- storeData(dataUnit, iComp, xmcu, ymcu, hi, ihi, vi, ivi);
- }
- }
- }
- }
- }
- }
- ImageData imageData = createImageData();
- if (progressive && loader.hasListeners()) {
- loader.notifyListeners(new ImageLoaderEvent(loader, imageData, progressiveScanCount, true));
- }
- return new ImageData[] {imageData};
-}
-ImageData createImageData() {
- return ImageData.internal_new(
- imageWidth,
- imageHeight,
- nComponents * samplePrecision,
- setUpPalette(),
- nComponents == 1 ? 4 : 1,
- decodeImageComponents(),
- 0,
- null,
- null,
- -1,
- -1,
- SWT.IMAGE_JPEG,
- 0,
- 0,
- 0,
- 0);
-}
-int nextBit() {
- if (currentBitCount != 0) {
- currentBitCount--;
- currentByte *= 2;
- if (currentByte > 255) {
- currentByte -= 256;
- return 1;
- } else {
- return 0;
- }
- }
- bufferCurrentPosition++;
- if (bufferCurrentPosition >= 512) {
- resetInputBuffer();
- bufferCurrentPosition = 0;
- }
- currentByte = dataBuffer[bufferCurrentPosition] & 0xFF;
- currentBitCount = 8;
- byte nextByte;
- if (bufferCurrentPosition == 511) {
- resetInputBuffer();
- currentBitCount = 8;
- nextByte = dataBuffer[0];
- } else {
- nextByte = dataBuffer[bufferCurrentPosition + 1];
- }
- if (currentByte == 0xFF) {
- if (nextByte == 0) {
- bufferCurrentPosition ++;
- currentBitCount--;
- currentByte *= 2;
- if (currentByte > 255) {
- currentByte -= 256;
- return 1;
- } else {
- return 0;
- }
- } else {
- if ((nextByte & 0xFF) + 0xFF00 == DNL) {
- getDNL();
- return 0;
- } else {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return 0;
- }
- }
- } else {
- currentBitCount--;
- currentByte *= 2;
- if (currentByte > 255) {
- currentByte -= 256;
- return 1;
- } else {
- return 0;
- }
- }
-}
-void processRestartInterval() {
- do {
- bufferCurrentPosition++;
- if (bufferCurrentPosition > 511) {
- resetInputBuffer();
- bufferCurrentPosition = 0;
- }
- currentByte = dataBuffer[bufferCurrentPosition] & 0xFF;
- } while (currentByte != 0xFF);
- while (currentByte == 0xFF) {
- bufferCurrentPosition++;
- if (bufferCurrentPosition > 511) {
- resetInputBuffer();
- bufferCurrentPosition = 0;
- }
- currentByte = dataBuffer[bufferCurrentPosition] & 0xFF;
- }
- if (currentByte != ((RST0 + nextRestartNumber) % 256)) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- bufferCurrentPosition++;
- if (bufferCurrentPosition > 511) {
- resetInputBuffer();
- bufferCurrentPosition = 0;
- }
- currentByte = dataBuffer[bufferCurrentPosition] & 0xFF;
- currentBitCount = 8;
- restartsToGo = restartInterval;
- nextRestartNumber = (nextRestartNumber + 1) % 8;
- precedingDCs = new int[4];
- eobrun = 0;
-}
-/* Process all markers until a frame header, scan header, or EOI is found. */
-JPEGSegment processTables() {
- while (true) {
- JPEGSegment jpegSegment = seekUnspecifiedMarker(inputStream);
- if (jpegSegment == null) return null;
- JPEGFrameHeader sof = new JPEGFrameHeader(jpegSegment.reference);
- if (sof.verify()) {
- return jpegSegment;
- }
- int marker = jpegSegment.getSegmentMarker();
- switch (marker) {
- case SOI: // there should only be one SOI per file
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- case EOI:
- case SOS:
- return jpegSegment;
- case DQT:
- getDQT();
- break;
- case DHT:
- getDHT();
- break;
- case DAC:
- getDAC();
- break;
- case DRI:
- getDRI();
- break;
- case APP0:
- getAPP0();
- break;
- case COM:
- getCOM();
- break;
- default:
- skipSegmentFrom(inputStream);
-
- }
- }
-}
-void quantizeData(int[] dataUnit, int iComp) {
- int[] qTable = quantizationTables[frameComponents[componentIds[iComp]][TQI]];
- for (int i = 0; i < dataUnit.length; i++) {
- int zzIndex = ZigZag8x8[i];
- int data = dataUnit[zzIndex];
- int absData = data < 0 ? 0 - data : data;
- int qValue = qTable[i];
- int q2 = qValue / 2;
- absData += q2;
- if (absData < qValue) {
- dataUnit[zzIndex] = 0;
- } else {
- absData /= qValue;
- if (data >= 0) {
- dataUnit[zzIndex] = absData;
- } else {
- dataUnit[zzIndex] = 0 - absData;
- }
- }
- }
-}
-int receive(int nBits) {
- int v = 0;
- for (int i = 0; i < nBits; i++) {
- v = v * 2 + nextBit();
- }
- return v;
-}
-void resetInputBuffer() {
- if (dataBuffer == null) {
- dataBuffer = new byte[512];
- }
- try {
- inputStream.read(dataBuffer);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- currentBitCount = 0;
- bufferCurrentPosition = -1;
-}
-void resetOutputBuffer() {
- if (dataBuffer == null) {
- dataBuffer = new byte[512];
- } else {
- try {
- outputStream.write(dataBuffer, 0, bufferCurrentPosition);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
- bufferCurrentPosition = 0;
-}
-static JPEGSegment seekUnspecifiedMarker(LEDataInputStream byteStream) {
- byte[] byteArray = new byte[2];
- try {
- while (true) {
- if (byteStream.read(byteArray, 0, 1) != 1) return null;
- if (byteArray[0] == (byte) 0xFF) {
- if (byteStream.read(byteArray, 1, 1) != 1) return null;
- if (byteArray[1] != (byte) 0xFF && byteArray[1] != 0) {
- byteStream.unread(byteArray);
- return new JPEGSegment(byteArray);
- }
- }
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return null;
-}
-PaletteData setUpPalette() {
- if (nComponents == 1) {
- RGB[] entries = new RGB[256];
- for (int i = 0; i < 256; i++) {
- entries[i] = new RGB(i, i, i);
- }
- return new PaletteData(entries);
- }
- return new PaletteData(0xFF, 0xFF00, 0xFF0000);
-}
-static void skipSegmentFrom(LEDataInputStream byteStream) {
- try {
- byte[] byteArray = new byte[4];
- JPEGSegment jpegSegment = new JPEGSegment(byteArray);
-
- if (byteStream.read(byteArray) != byteArray.length) {
- throw new SWTError(SWT.ERROR_INVALID_IMAGE);
- }
- if (!(byteArray[0] == -1 && byteArray[1] != 0 && byteArray[1] != -1)) {
- throw new SWTError(SWT.ERROR_INVALID_IMAGE);
- }
- int delta = jpegSegment.getSegmentLength() - 2;
- byteStream.skip(delta);
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-void storeData(int[] dataUnit, int iComp, int xmcu, int ymcu, int hi, int ihi, int vi, int ivi) {
- byte[] compImage = imageComponents[iComp];
- int[] frameComponent = frameComponents[componentIds[iComp]];
- int compWidth = frameComponent[CW];
- int destIndex = ((ymcu * vi + ivi) * compWidth * DCTSIZE) + ((xmcu * hi + ihi) * DCTSIZE);
- int srcIndex = 0;
- for (int i = 0; i < DCTSIZE; i++) {
- for (int col = 0; col < DCTSIZE; col++) {
- int x = dataUnit[srcIndex] + 128;
- if (x < 0) {
- x = 0;
- } else {
- if (x > 255) x = 255;
- }
- compImage[destIndex + col] = (byte)x;
- srcIndex++;
- }
- destIndex += compWidth;
- }
-}
-void unloadIntoByteStream(ImageData image) {
- if (!new JPEGStartOfImage().writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- JPEGAppn appn = new JPEGAppn(new byte[] {(byte)0xFF, (byte)0xE0, 0, 0x10, 0x4A, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0});
- if (!appn.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- quantizationTables = new int[4][];
- JPEGQuantizationTable chromDQT = JPEGQuantizationTable.defaultChrominanceTable();
- chromDQT.scaleBy(encoderQFactor);
- int[] jpegDQTKeys = chromDQT.getQuantizationTablesKeys();
- int[][] jpegDQTValues = chromDQT.getQuantizationTablesValues();
- for (int i = 0; i < jpegDQTKeys.length; i++) {
- quantizationTables[jpegDQTKeys[i]] = jpegDQTValues[i];
- }
- JPEGQuantizationTable lumDQT = JPEGQuantizationTable.defaultLuminanceTable();
- lumDQT.scaleBy(encoderQFactor);
- jpegDQTKeys = lumDQT.getQuantizationTablesKeys();
- jpegDQTValues = lumDQT.getQuantizationTablesValues();
- for (int i = 0; i < jpegDQTKeys.length; i++) {
- quantizationTables[jpegDQTKeys[i]] = jpegDQTValues[i];
- }
- if (!lumDQT.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- if (!chromDQT.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- int frameLength, scanLength, precision;
- int[][] frameParams, scanParams;
- if (image.depth == 1) {
- frameLength = 11;
- frameParams = new int[1][];
- frameParams[0] = new int[] {1, 1, 1, 0, 0};
- scanParams = new int[1][];
- scanParams[0] = new int[] {0, 0};
- scanLength = 8;
- nComponents = 1;
- precision = 1;
- } else {
- frameLength = 17;
- frameParams = new int[3][];
- frameParams[0] = new int[] {0, 2, 2, 0, 0};
- frameParams[1] = new int[] {1, 1, 1, 0, 0};
- frameParams[2] = new int[] {1, 1, 1, 0, 0};
- scanParams = new int[3][];
- scanParams[0] = new int[] {0, 0};
- scanParams[1] = new int[] {1, 1};
- scanParams[2] = new int[] {1, 1};
- scanLength = 12;
- nComponents = 3;
- precision = 8;
- }
- imageWidth = image.width;
- imageHeight = image.height;
- frameHeader = new JPEGFrameHeader(new byte[19]);
- frameHeader.setSegmentMarker(SOF0);
- frameHeader.setSegmentLength(frameLength);
- frameHeader.setSamplePrecision(precision);
- frameHeader.setSamplesPerLine(imageWidth);
- frameHeader.setNumberOfLines(imageHeight);
- frameHeader.setNumberOfImageComponents(nComponents);
- frameHeader.componentParameters = frameParams;
- frameHeader.componentIdentifiers = new int[] {0, 1, 2};
- frameHeader.initializeContents();
- if (!frameHeader.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- frameComponents = frameParams;
- componentIds = frameHeader.componentIdentifiers;
- maxH = frameHeader.getMaxHFactor();
- maxV = frameHeader.getMaxVFactor();
- int mcuWidth = maxH * DCTSIZE;
- int mcuHeight = maxV * DCTSIZE;
- interleavedMcuCols = (imageWidth + mcuWidth - 1) / mcuWidth;
- interleavedMcuRows = (imageHeight + mcuHeight - 1) / mcuHeight;
- acHuffmanTables = new JPEGHuffmanTable[4];
- dcHuffmanTables = new JPEGHuffmanTable[4];
- JPEGHuffmanTable[] dhtTables = new JPEGHuffmanTable[] {
- JPEGHuffmanTable.getDefaultDCLuminanceTable(),
- JPEGHuffmanTable.getDefaultDCChrominanceTable(),
- JPEGHuffmanTable.getDefaultACLuminanceTable(),
- JPEGHuffmanTable.getDefaultACChrominanceTable()
- };
- for (int i = 0; i < dhtTables.length; i++) {
- JPEGHuffmanTable dhtTable = dhtTables[i];
- if (!dhtTable.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- JPEGHuffmanTable[] allTables = dhtTable.getAllTables();
- for (int j = 0; j < allTables.length; j++) {
- JPEGHuffmanTable huffmanTable = allTables[j];
- if (huffmanTable.getTableClass() == 0) {
- dcHuffmanTables[huffmanTable.getTableIdentifier()] = huffmanTable;
- } else {
- acHuffmanTables[huffmanTable.getTableIdentifier()] = huffmanTable;
- }
- }
- }
- precedingDCs = new int[4];
- scanHeader = new JPEGScanHeader(new byte[14]);
- scanHeader.setSegmentMarker(SOS);
- scanHeader.setSegmentLength(scanLength);
- scanHeader.setNumberOfImageComponents(nComponents);
- scanHeader.setStartOfSpectralSelection(0);
- scanHeader.setEndOfSpectralSelection(63);
- scanHeader.componentParameters = scanParams;
- scanHeader.initializeContents();
- if (!scanHeader.writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
- convertImageToYCbCr(image);
- resetOutputBuffer();
- currentByte = 0;
- currentBitCount = 0;
- encodeScan();
- if (!new JPEGEndOfImage().writeToStream(outputStream)) {
- SWT.error(SWT.ERROR_IO);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java
deleted file mode 100755
index 98b8c1c0fc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-abstract class JPEGFixedSizeSegment extends JPEGSegment {
-
- public JPEGFixedSizeSegment() {
- reference = new byte[fixedSize()];
- setSegmentMarker(signature());
- }
-
- public JPEGFixedSizeSegment(byte[] reference) {
- super(reference);
- }
-
- public JPEGFixedSizeSegment(LEDataInputStream byteStream) {
- reference = new byte[fixedSize()];
- try {
- byteStream.read(reference);
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-
- abstract public int fixedSize();
-
- public int getSegmentLength() {
- return fixedSize() - 2;
- }
-
- public void setSegmentLength(int length) {
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFrameHeader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFrameHeader.java
deleted file mode 100755
index 483b32fd40..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFrameHeader.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-final class JPEGFrameHeader extends JPEGVariableSizeSegment {
- int maxVFactor;
- int maxHFactor;
- public int[] componentIdentifiers;
- public int[][] componentParameters;
-
- public JPEGFrameHeader(byte[] reference) {
- super(reference);
- }
-
- public JPEGFrameHeader(LEDataInputStream byteStream) {
- super(byteStream);
- initializeComponentParameters();
- }
-
- public int getSamplePrecision() {
- return reference[4] & 0xFF;
- }
-
- public int getNumberOfLines() {
- return (reference[5] & 0xFF) << 8 | (reference[6] & 0xFF);
- }
-
- public int getSamplesPerLine() {
- return (reference[7] & 0xFF) << 8 | (reference[8] & 0xFF);
- }
-
- public int getNumberOfImageComponents() {
- return reference[9] & 0xFF;
- }
-
- public void setSamplePrecision(int precision) {
- reference[4] = (byte)(precision & 0xFF);
- }
-
- public void setNumberOfLines(int anInteger) {
- reference[5] = (byte)((anInteger & 0xFF00) >> 8);
- reference[6] = (byte)(anInteger & 0xFF);
- }
-
- public void setSamplesPerLine(int samples) {
- reference[7] = (byte)((samples & 0xFF00) >> 8);
- reference[8] = (byte)(samples & 0xFF);
- }
-
- public void setNumberOfImageComponents(int anInteger) {
- reference[9] = (byte)(anInteger & 0xFF);
- }
-
- public int getMaxHFactor() {
- return maxHFactor;
- }
-
- public int getMaxVFactor() {
- return maxVFactor;
- }
-
- public void setMaxHFactor(int anInteger) {
- maxHFactor = anInteger;
- }
-
- public void setMaxVFactor(int anInteger) {
- maxVFactor = anInteger;
- }
-
- /* Used when decoding. */
- void initializeComponentParameters() {
- int nf = getNumberOfImageComponents();
- componentIdentifiers = new int[nf];
- int[][] compSpecParams = new int[0][];
- int hmax = 1;
- int vmax = 1;
- for (int i = 0; i < nf; i++) {
- int ofs = i * 3 + 10;
- int ci = reference[ofs] & 0xFF;
- componentIdentifiers[i] = ci - 1;
- int hi = (reference[ofs + 1] & 0xFF) / 16;
- int vi = (reference[ofs + 1] & 0xFF) % 16;
- int tqi = reference[ofs + 2] & 0xFF;
- if (hi > hmax) {
- hmax = hi;
- }
- if (vi > vmax) {
- vmax = vi;
- }
- int[] compParam = new int[5];
- compParam[0] = tqi;
- compParam[1] = hi;
- compParam[2] = vi;
- if (compSpecParams.length < ci) {
- int[][] newParams = new int[ci][];
- System.arraycopy(compSpecParams, 0, newParams, 0, compSpecParams.length);
- compSpecParams = newParams;
- }
- compSpecParams[ci - 1] = compParam;
- }
- int x = getSamplesPerLine();
- int y = getNumberOfLines();
- int[] multiples = new int[] { 8, 16, 24, 32 };
- for (int i = 0; i < nf; i++) {
- int[] compParam = compSpecParams[componentIdentifiers[i]];
- int hi = compParam[1];
- int vi = compParam[2];
- int compWidth = (x * hi + hmax - 1) / hmax;
- int compHeight = (y * vi + vmax - 1) / vmax;
- int dsWidth = roundUpToMultiple(compWidth, multiples[hi - 1]);
- int dsHeight = roundUpToMultiple(compHeight, multiples[vi - 1]);
- compParam[3] = dsWidth;
- compParam[4] = dsHeight;
- }
- setMaxHFactor(hmax);
- setMaxVFactor(vmax);
- componentParameters = compSpecParams;
- }
-
- /* Used when encoding. */
- public void initializeContents() {
- int nf = getNumberOfImageComponents();
- if (nf == 0 || nf != componentParameters.length) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- int hmax = 0;
- int vmax = 0;
- int[][] compSpecParams = componentParameters;
- for (int i = 0; i < nf; i++) {
- int ofs = i * 3 + 10;
- int[] compParam = compSpecParams[componentIdentifiers[i]];
- int hi = compParam[1];
- int vi = compParam[2];
- if (hi * vi > 4) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- reference[ofs] = (byte)(i + 1);
- reference[ofs + 1] = (byte)(hi * 16 + vi);
- reference[ofs + 2] = (byte)(compParam[0]);
- if (hi > hmax) hmax = hi;
- if (vi > vmax) vmax = vi;
- }
- int x = getSamplesPerLine();
- int y = getNumberOfLines();
- int[] multiples = new int[] {8, 16, 24, 32};
- for (int i = 0; i < nf; i++) {
- int[] compParam = compSpecParams[componentIdentifiers[i]];
- int hi = compParam[1];
- int vi = compParam[2];
- int compWidth = (x * hi + hmax - 1) / hmax;
- int compHeight = (y * vi + vmax - 1) / vmax;
- int dsWidth = roundUpToMultiple(compWidth, multiples[hi - 1]);
- int dsHeight = roundUpToMultiple(compHeight, multiples[vi - 1]);
- compParam[3] = dsWidth;
- compParam[4] = dsHeight;
- }
- setMaxHFactor(hmax);
- setMaxVFactor(vmax);
- }
-
- int roundUpToMultiple(int anInteger, int mInteger) {
- int a = anInteger + mInteger - 1;
- return a - (a % mInteger);
- }
-
- /*
- * Verify the information contained in the receiver is correct.
- * Answer true if the header contains a valid marker. Otherwise,
- * answer false. Valid Start Of Frame markers are:
- * SOF_0 - Baseline DCT, Huffman coding
- * SOF_1 - Extended sequential DCT, Huffman coding
- * SOF_2 - Progressive DCT, Huffman coding
- * SOF_3 - Lossless (sequential), Huffman coding
- * SOF_5 - Differential sequential, Huffman coding
- * SOF_6 - Differential progressive, Huffman coding
- * SOF_7 - Differential lossless, Huffman coding
- * SOF_9 - Extended sequential DCT, arithmetic coding
- * SOF_10 - Progressive DCT, arithmetic coding
- * SOF_11 - Lossless (sequential), arithmetic coding
- * SOF_13 - Differential sequential, arithmetic coding
- * SOF_14 - Differential progressive, arithmetic coding
- * SOF_15 - Differential lossless, arithmetic coding
- */
- public boolean verify() {
- int marker = getSegmentMarker();
- return (marker >= JPEGFileFormat.SOF0 && marker <= JPEGFileFormat.SOF3) ||
- (marker >= JPEGFileFormat.SOF5 && marker <= JPEGFileFormat.SOF7) ||
- (marker >= JPEGFileFormat.SOF9 && marker <= JPEGFileFormat.SOF11) ||
- (marker >= JPEGFileFormat.SOF13 && marker <= JPEGFileFormat.SOF15);
- }
-
- public boolean isProgressive() {
- int marker = getSegmentMarker();
- return marker == JPEGFileFormat.SOF2
- || marker == JPEGFileFormat.SOF6
- || marker == JPEGFileFormat.SOF10
- || marker == JPEGFileFormat.SOF14;
- }
-
- public boolean isArithmeticCoding() {
- return getSegmentMarker() >= JPEGFileFormat.SOF9;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGHuffmanTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGHuffmanTable.java
deleted file mode 100755
index 190b3164e2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGHuffmanTable.java
+++ /dev/null
@@ -1,262 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * JPEGHuffmanTable class actually represents two types of object:
- * 1) A DHT (Define Huffman Tables) segment, which may represent
- * as many as 4 Huffman tables. In this case, the tables are
- * stored in the allTables array.
- * 2) A single Huffman table. In this case, the allTables array
- * will be null.
- * The 'reference' field is stored in both types of object, but
- * 'initialize' is only called if the object represents a DHT.
- */
-final class JPEGHuffmanTable extends JPEGVariableSizeSegment {
- JPEGHuffmanTable[] allTables;
- int tableClass;
- int tableIdentifier;
- int[] dhCodes;
- int[] dhCodeLengths;
- int[] dhMaxCodes;
- int[] dhMinCodes;
- int[] dhValPtrs;
- int[] dhValues;
- int[] ehCodes;
- byte[] ehCodeLengths;
- static byte[] DCLuminanceTable = {
- (byte)255, (byte)196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
- };
- static byte[] DCChrominanceTable = {
- (byte)255, (byte)196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
- };
- static byte[] ACLuminanceTable = {
- (byte)255, (byte)196, 0, (byte)181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125,
- 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20,
- 50, (byte)129, (byte)145, (byte)161, 8, 35, 66, (byte)177, (byte)193, 21, 82, (byte)209, (byte)240, 36, 51, 98,
- 114, (byte)130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53,
- 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87,
- 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118,
- 119, 120, 121, 122, (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, (byte)138, (byte)146, (byte)147, (byte)148,
- (byte)149, (byte)150, (byte)151, (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, (byte)166, (byte)167, (byte)168, (byte)169, (byte)170,
- (byte)178, (byte)179, (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199,
- (byte)200, (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, (byte)215, (byte)216, (byte)217, (byte)218, (byte)225, (byte)226, (byte)227,
- (byte)228, (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)241, (byte)242, (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248,
- (byte)249, (byte)250
- };
- static byte[] ACChrominanceTable = {
- (byte)255, (byte)196, 0, (byte)181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0,
- 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34,
- 50, (byte)129, 8, 20, 66, (byte)145, (byte)161, (byte)177, (byte)193, 9, 35,
- 51, 82, (byte)240, 21, 98, 114, (byte)209, 10, 22, 36, 52, (byte)225, 37,
- (byte)241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67,
- 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102,
- 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, (byte)130,
- (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137,
- (byte)138, (byte)146, (byte)147, (byte)148, (byte)149, (byte)150, (byte)151,
- (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165,
- (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, (byte)178, (byte)179,
- (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186,
- (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, (byte)200,
- (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214,
- (byte)215, (byte)216, (byte)217, (byte)218, (byte)226, (byte)227, (byte)228,
- (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)242,
- (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, (byte)249,
- (byte)250
- };
-
-public JPEGHuffmanTable(byte[] reference) {
- super(reference);
-}
-
-public JPEGHuffmanTable(LEDataInputStream byteStream) {
- super(byteStream);
- initialize();
-}
-
-public JPEGHuffmanTable[] getAllTables() {
- return allTables;
-}
-
-public static JPEGHuffmanTable getDefaultACChrominanceTable() {
- JPEGHuffmanTable result = new JPEGHuffmanTable(ACChrominanceTable);
- result.initialize();
- return result;
-}
-
-public static JPEGHuffmanTable getDefaultACLuminanceTable() {
- JPEGHuffmanTable result = new JPEGHuffmanTable(ACLuminanceTable);
- result.initialize();
- return result;
-}
-
-public static JPEGHuffmanTable getDefaultDCChrominanceTable() {
- JPEGHuffmanTable result = new JPEGHuffmanTable(DCChrominanceTable);
- result.initialize();
- return result;
-}
-
-public static JPEGHuffmanTable getDefaultDCLuminanceTable() {
- JPEGHuffmanTable result = new JPEGHuffmanTable(DCLuminanceTable);
- result.initialize();
- return result;
-}
-
-public int[] getDhMaxCodes() {
- return dhMaxCodes;
-}
-
-public int[] getDhMinCodes() {
- return dhMinCodes;
-}
-
-public int[] getDhValPtrs() {
- return dhValPtrs;
-}
-
-public int[] getDhValues() {
- return dhValues;
-}
-
-public int getTableClass() {
- return tableClass;
-}
-
-public int getTableIdentifier() {
- return tableIdentifier;
-}
-
-void initialize() {
- int totalLength = getSegmentLength() - 2;
- int ofs = 4;
- int[] bits = new int[16];
- JPEGHuffmanTable[] huffTables = new JPEGHuffmanTable[8]; // maximum is 4 AC + 4 DC
- int huffTableCount = 0;
- while (totalLength > 0) {
- int tc = (reference[ofs] & 0xFF) / 16; // table class: AC (1) or DC (0)
- int tid = (reference[ofs] & 0xFF) % 16; // table id: 0-1 baseline, 0-3 prog/ext
- ofs++;
-
- /* Read the 16 count bytes and add them together to get the table size. */
- int count = 0;
- for (int i = 0; i < bits.length; i++) {
- int bCount = reference[ofs + i] & 0xFF;
- bits[i] = bCount;
- count += bCount;
- }
- ofs += 16;
- totalLength -= 17;
-
- /* Read the table. */
- int[] huffVals = new int[count];
- for (int i = 0; i < count; i++) {
- huffVals[i] = reference[ofs + i] & 0xFF;
- }
- ofs += count;
- totalLength -= count;
-
- /* Calculate the lengths. */
- int[] huffCodeLengths = new int[50]; // start with 50 and increment as needed
- int huffCodeLengthsIndex = 0;
- for (int i = 0; i < 16; i++) {
- for (int j = 0; j < bits[i]; j++) {
- if (huffCodeLengthsIndex >= huffCodeLengths.length) {
- int[] newHuffCodeLengths = new int[huffCodeLengths.length + 50];
- System.arraycopy(huffCodeLengths, 0, newHuffCodeLengths, 0, huffCodeLengths.length);
- huffCodeLengths = newHuffCodeLengths;
- }
- huffCodeLengths[huffCodeLengthsIndex] = i + 1;
- huffCodeLengthsIndex++;
- }
- }
-
- /* Truncate huffCodeLengths to the correct size. */
- if (huffCodeLengthsIndex < huffCodeLengths.length) {
- int[] newHuffCodeLengths = new int[huffCodeLengthsIndex];
- System.arraycopy(huffCodeLengths, 0, newHuffCodeLengths, 0, huffCodeLengthsIndex);
- huffCodeLengths = newHuffCodeLengths;
- }
-
- /* Calculate the Huffman codes. */
- int[] huffCodes = new int[50]; // start with 50 and increment as needed
- int huffCodesIndex = 0;
- int k = 1;
- int code = 0;
- int si = huffCodeLengths[0];
- int p = 0;
- while (p < huffCodeLengthsIndex) {
- while ((p < huffCodeLengthsIndex) && (huffCodeLengths[p] == si)) {
- if (huffCodesIndex >= huffCodes.length) {
- int[] newHuffCodes = new int[huffCodes.length + 50];
- System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodes.length);
- huffCodes = newHuffCodes;
- }
- huffCodes[huffCodesIndex] = code;
- huffCodesIndex++;
- code++;
- p++;
- }
- code *= 2;
- si++;
- }
-
- /* Truncate huffCodes to the correct size. */
- if (huffCodesIndex < huffCodes.length) {
- int[] newHuffCodes = new int[huffCodesIndex];
- System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodesIndex);
- huffCodes = newHuffCodes;
- }
-
- /* Calculate the maximum and minimum codes */
- k = 0;
- int[] maxCodes = new int[16];
- int[] minCodes = new int[16];
- int[] valPtrs = new int[16];
- for (int i = 0; i < 16; i++) {
- int bSize = bits[i];
- if (bSize == 0) {
- maxCodes[i] = -1;
- } else {
- valPtrs[i] = k;
- minCodes[i] = huffCodes[k];
- k += bSize;
- maxCodes[i] = huffCodes[k - 1];
- }
- }
-
- /* Calculate the eHuffman codes and lengths. */
- int[] eHuffCodes = new int[256];
- byte[] eHuffSize = new byte[256];
- for (int i = 0; i < huffCodesIndex; i++) {
- eHuffCodes[huffVals[i]] = huffCodes[i];
- eHuffSize[huffVals[i]] = (byte)huffCodeLengths[i];
- }
-
- /* Create the new JPEGHuffmanTable and add it to the allTables array. */
- JPEGHuffmanTable dhtTable = new JPEGHuffmanTable(reference);
- dhtTable.tableClass = tc;
- dhtTable.tableIdentifier = tid;
- dhtTable.dhValues = huffVals;
- dhtTable.dhCodes = huffCodes;
- dhtTable.dhCodeLengths = huffCodeLengths;
- dhtTable.dhMinCodes = minCodes;
- dhtTable.dhMaxCodes = maxCodes;
- dhtTable.dhValPtrs = valPtrs;
- dhtTable.ehCodes = eHuffCodes;
- dhtTable.ehCodeLengths = eHuffSize;
- huffTables[huffTableCount] = dhtTable;
- huffTableCount++;
- }
- allTables = new JPEGHuffmanTable[huffTableCount];
- System.arraycopy(huffTables, 0, allTables, 0, huffTableCount);
-}
-
-public int signature() {
- return JPEGFileFormat.DHT;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java
deleted file mode 100755
index dbe8092880..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGQuantizationTable extends JPEGVariableSizeSegment {
- public static byte[] DefaultLuminanceQTable = {
- (byte)255, (byte)219, 0, 67, 0,
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 56, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
- };
- public static byte[] DefaultChrominanceQTable = {
- (byte)255, (byte)219, 0, 67, 1,
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
- };
-
-public JPEGQuantizationTable(byte[] reference) {
- super(reference);
-}
-
-public JPEGQuantizationTable(LEDataInputStream byteStream) {
- super(byteStream);
-}
-
-public static JPEGQuantizationTable defaultChrominanceTable() {
- byte[] data = new byte[DefaultChrominanceQTable.length];
- System.arraycopy(DefaultChrominanceQTable, 0, data, 0, data.length);
- return new JPEGQuantizationTable(data);
-}
-
-public static JPEGQuantizationTable defaultLuminanceTable() {
- byte[] data = new byte[DefaultLuminanceQTable.length];
- System.arraycopy(DefaultLuminanceQTable, 0, data, 0, data.length);
- return new JPEGQuantizationTable(data);
-}
-
-public int[] getQuantizationTablesKeys() {
- int[] keys = new int[4];
- int keysIndex = 0;
- int totalLength = getSegmentLength() - 2;
- int ofs = 4;
- while (totalLength > 64) {
- int tq = (reference[ofs] & 0xFF) % 16;
- int pq = (reference[ofs] & 0xFF) / 16;
- if (pq == 0) {
- ofs += 65;
- totalLength -= 65;
- } else {
- ofs += 129;
- totalLength -= 129;
- }
- if (keysIndex >= keys.length) {
- int[] newKeys = new int[keys.length + 4];
- System.arraycopy(keys, 0, newKeys, 0, keys.length);
- keys = newKeys;
- }
- keys[keysIndex] = tq;
- keysIndex++;
- }
- int[] newKeys = new int[keysIndex];
- System.arraycopy(keys, 0, newKeys, 0, keysIndex);
- return newKeys;
-}
-
-public int[][] getQuantizationTablesValues() {
- int[][] values = new int[4][];
- int valuesIndex = 0;
- int totalLength = getSegmentLength() - 2;
- int ofs = 4;
- while (totalLength > 64) {
- int[] qk = new int[64];
- int pq = (reference[ofs] & 0xFF) / 16;
- if (pq == 0) {
- for (int i = 0; i < qk.length; i++) {
- qk[i] = reference[ofs + i + 1];
- }
- ofs += 65;
- totalLength -= 65;
- } else {
- for (int i = 0; i < qk.length; i++) {
- int idx = (i - 1) * 2 ;
- qk[i] = (reference[ofs + idx + 1] & 0xFF) * 256 + (reference[ofs + idx + 2] & 0xFF);
- }
- ofs += 129;
- totalLength -= 129;
- }
- if (valuesIndex >= values.length) {
- int[][] newValues = new int[values.length + 4][];
- System.arraycopy(values, 0, newValues, 0, values.length);
- values = newValues;
- }
- values[valuesIndex] = qk;
- valuesIndex++;
- }
- int[][] newValues = new int[valuesIndex][];
- System.arraycopy(values, 0, newValues, 0, valuesIndex);
- return newValues;
-}
-
-public void scaleBy(int qualityFactor) {
- int qFactor = qualityFactor;
- if (qFactor <= 0) {
- qFactor = 1;
- }
- if (qFactor > 100) {
- qFactor = 100;
- }
- if (qFactor < 50) {
- qFactor = 5000 / qFactor;
- } else {
- qFactor = 200 - (qFactor * 2);
- }
- int totalLength = getSegmentLength() - 2;
- int ofs = 4;
- while (totalLength > 64) {
- int tq = (reference[ofs] & 0xFF) % 16;
- int pq = (reference[ofs] & 0xFF) / 16;
- if (pq == 0) {
- for (int i = ofs + 1; i <= ofs + 64; i++) {
- int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100;
- if (temp <= 0) temp = 1;
- if (temp > 255) temp = 255;
- reference[i] = (byte)temp;
- }
- ofs += 65;
- totalLength -= 65;
- } else {
- for (int i = ofs + 1; i <= ofs + 128; i += 2) {
- int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100;
- if (temp <= 0) temp = 1;
- if (temp > 32767) temp = 32767;
- reference[i] = (byte)(temp / 256);
- reference[i + 1] = (byte)(temp % 256);
- }
- ofs += 129;
- totalLength -= 129;
- }
- }
-}
-
-public int signature() {
- return JPEGFileFormat.DQT;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGRestartInterval.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGRestartInterval.java
deleted file mode 100755
index fe439a5d04..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGRestartInterval.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGRestartInterval extends JPEGFixedSizeSegment {
-
- public JPEGRestartInterval(LEDataInputStream byteStream) {
- super(byteStream);
- }
-
- public int signature() {
- return JPEGFileFormat.DRI;
- }
-
- public int getRestartInterval() {
- return ((reference[4] & 0xFF) << 8 | (reference[5] & 0xFF));
- }
-
- public int fixedSize() {
- return 6;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGScanHeader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGScanHeader.java
deleted file mode 100755
index a4778fd8aa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGScanHeader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-final class JPEGScanHeader extends JPEGVariableSizeSegment {
- public int[][] componentParameters;
-
-public JPEGScanHeader(byte[] reference) {
- super(reference);
-}
-
-public JPEGScanHeader(LEDataInputStream byteStream) {
- super(byteStream);
- initializeComponentParameters();
-}
-
-public int getApproxBitPositionHigh() {
- return (reference[(2 * getNumberOfImageComponents()) + 7] & 0xFF) / 16;
-}
-
-public int getApproxBitPositionLow() {
- return (reference[(2 * getNumberOfImageComponents()) + 7] & 0xFF) % 16;
-}
-
-public int getEndOfSpectralSelection() {
- return (reference[(2 * getNumberOfImageComponents()) + 6] & 0xFF);
-}
-
-public int getNumberOfImageComponents() {
- return (reference[4] & 0xFF);
-}
-
-public int getStartOfSpectralSelection() {
- return (reference[(2 * getNumberOfImageComponents()) + 5] & 0xFF);
-}
-
-/* Used when decoding. */
-void initializeComponentParameters() {
- int compCount = getNumberOfImageComponents();
- componentParameters = new int[0][];
- for (int i = 0; i < compCount; i++) {
- int ofs = 5 + i * 2;
- int cid = reference[ofs] & 0xFF;
- int dc = (reference[ofs + 1] & 0xFF) / 16;
- int ac = (reference[ofs + 1] & 0xFF) % 16;
- if (componentParameters.length < cid) {
- int[][] newParams = new int[cid][];
- System.arraycopy(componentParameters, 0, newParams, 0, componentParameters.length);
- componentParameters = newParams;
- }
- componentParameters[cid - 1] = new int[] { dc, ac };
- }
-}
-
-/* Used when encoding. */
-public void initializeContents() {
- int compCount = getNumberOfImageComponents();
- int[][] compSpecParams = componentParameters;
- if (compCount == 0 || compCount != compSpecParams.length) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- for (int i = 0; i < compCount; i++) {
- int ofs = i * 2 + 5;
- int[] compParams = compSpecParams[i];
- reference[ofs] = (byte)(i + 1);
- reference[ofs + 1] = (byte)(compParams[0] * 16 + compParams[1]);
- }
-}
-
-public void setEndOfSpectralSelection(int anInteger) {
- reference[(2 * getNumberOfImageComponents()) + 6] = (byte)anInteger;
-}
-
-public void setNumberOfImageComponents(int anInteger) {
- reference[4] = (byte)(anInteger & 0xFF);
-}
-
-public void setStartOfSpectralSelection(int anInteger) {
- reference[(2 * getNumberOfImageComponents()) + 5] = (byte)anInteger;
-}
-
-public int signature() {
- return JPEGFileFormat.SOS;
-}
-
-public boolean verifyProgressiveScan() {
- int start = getStartOfSpectralSelection();
- int end = getEndOfSpectralSelection();
- int low = getApproxBitPositionLow();
- int high = getApproxBitPositionHigh();
- int count = getNumberOfImageComponents();
- if ((start == 0 && end == 00) || (start <= end && end <= 63)) {
- if (low <= 13 && high <= 13 && (high == 0 || high == low + 1)) {
- return start == 0 || (start > 0 && count == 1);
- }
- }
- return false;
-}
-
-public boolean isACProgressiveScan() {
- return getStartOfSpectralSelection() != 0 && getEndOfSpectralSelection() != 0;
-}
-
-public boolean isDCProgressiveScan() {
- return getStartOfSpectralSelection() == 0 && getEndOfSpectralSelection() == 0;
-}
-
-public boolean isFirstScan() {
- return getApproxBitPositionHigh() == 0;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGSegment.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGSegment.java
deleted file mode 100755
index ab5dda1157..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGSegment.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-class JPEGSegment {
- public byte[] reference;
-
- JPEGSegment() {
- }
-
- public JPEGSegment(byte[] reference) {
- this.reference = reference;
- }
-
- public int signature() {
- return 0;
- }
-
- public boolean verify() {
- return getSegmentMarker() == signature();
- }
-
- public int getSegmentMarker() {
- return ((reference[0] & 0xFF) << 8 | (reference[1] & 0xFF));
- }
-
- public void setSegmentMarker(int marker) {
- reference[0] = (byte)((marker & 0xFF00) >> 8);
- reference[1] = (byte)(marker & 0xFF);
- }
-
- public int getSegmentLength() {
- return ((reference[2] & 0xFF) << 8 | (reference[3] & 0xFF));
- }
-
- public void setSegmentLength(int length) {
- reference[2] = (byte)((length & 0xFF00) >> 8);
- reference[3] = (byte)(length & 0xFF);
- }
-
- public boolean writeToStream(LEDataOutputStream byteStream) {
- try {
- byteStream.write(reference);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGStartOfImage.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGStartOfImage.java
deleted file mode 100755
index b8ef25c1a3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGStartOfImage.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class JPEGStartOfImage extends JPEGFixedSizeSegment {
-
- public JPEGStartOfImage() {
- super();
- }
-
- public JPEGStartOfImage(byte[] reference) {
- super(reference);
- }
-
- public JPEGStartOfImage(LEDataInputStream byteStream) {
- super(byteStream);
- }
-
- public int signature() {
- return JPEGFileFormat.SOI;
- }
-
- public int fixedSize() {
- return 2;
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java
deleted file mode 100755
index cafb98740e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-abstract class JPEGVariableSizeSegment extends JPEGSegment {
-
- public JPEGVariableSizeSegment(byte[] reference) {
- super(reference);
- }
-
- public JPEGVariableSizeSegment(LEDataInputStream byteStream) {
- try {
- byte[] header = new byte[4];
- byteStream.read(header);
- reference = header; // to use getSegmentLength()
- byte[] contents = new byte[getSegmentLength() + 2];
- contents[0] = header[0];
- contents[1] = header[1];
- contents[2] = header[2];
- contents[3] = header[3];
- byteStream.read(contents, 4, contents.length - 4);
- reference = contents;
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java
deleted file mode 100755
index cdbf2cda87..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-
-final class LEDataInputStream extends InputStream {
- int position;
- InputStream in;
-
- /**
- * The byte array containing the bytes to read.
- */
- protected byte[] buf;
-
- /**
- * The current position within the byte array <code>buf</code>. A value
- * equal to buf.length indicates no bytes available. A value of
- * 0 indicates the buffer is full.
- */
- protected int pos;
-
-
- public LEDataInputStream(InputStream input) {
- this(input, 512);
- }
-
- public LEDataInputStream(InputStream input, int bufferSize) {
- this.in = input;
- if (bufferSize > 0) {
- buf = new byte[bufferSize];
- pos = bufferSize;
- }
- else throw new IllegalArgumentException();
- }
-
- public void close() throws IOException {
- buf = null;
- if (in != null) {
- in.close();
- in = null;
- }
- }
-
- /**
- * Answer how many bytes were read.
- */
- public int getPosition() {
- return position;
- }
-
- /**
- * Answers how many bytes are available for reading without blocking
- */
- public int available() throws IOException {
- if (buf == null) throw new IOException();
- return (buf.length - pos) + in.available();
- }
-
- /**
- * Answer the next byte of the input stream.
- */
- public int read() throws IOException {
- if (buf == null) throw new IOException();
- position++;
- if (pos < buf.length) return (buf[pos++] & 0xFF);
- return in.read();
- }
-
- /**
- * Don't imitate the JDK behaviour of reading a random number
- * of bytes when you can actually read them all.
- */
- public int read(byte b[], int off, int len) throws IOException {
- int result;
- int left = len;
- result = readData(b, off, len);
- while (true) {
- if (result == -1) return -1;
- position += result;
- if (result == left) return len;
- left -= result;
- off += result;
- result = readData(b, off, left);
- }
- }
-
- /**
- * Reads at most <code>length</code> bytes from this LEDataInputStream and
- * stores them in byte array <code>buffer</code> starting at <code>offset</code>.
- * <p>
- * Answer the number of bytes actually read or -1 if no bytes were read and
- * end of stream was encountered. This implementation reads bytes from
- * the pushback buffer first, then the target stream if more bytes are required
- * to satisfy <code>count</code>.
- * </p>
- * @param buffer the byte array in which to store the read bytes.
- * @param offset the offset in <code>buffer</code> to store the read bytes.
- * @param length the maximum number of bytes to store in <code>buffer</code>.
- *
- * @return int the number of bytes actually read or -1 if end of stream.
- *
- * @exception java.io.IOException if an IOException occurs.
- */
- private int readData(byte[] buffer, int offset, int length) throws IOException {
- if (buf == null) throw new IOException();
- if (offset < 0 || offset > buffer.length ||
- length < 0 || (length > buffer.length - offset)) {
- throw new ArrayIndexOutOfBoundsException();
- }
-
- int cacheCopied = 0;
- int newOffset = offset;
-
- // Are there pushback bytes available?
- int available = buf.length - pos;
- if (available > 0) {
- cacheCopied = (available >= length) ? length : available;
- System.arraycopy(buf, pos, buffer, newOffset, cacheCopied);
- newOffset += cacheCopied;
- pos += cacheCopied;
- }
-
- // Have we copied enough?
- if (cacheCopied == length) return length;
-
- int inCopied = in.read(buffer, newOffset, length - cacheCopied);
-
- if (inCopied > 0) return inCopied + cacheCopied;
- if (cacheCopied == 0) return inCopied;
- return cacheCopied;
- }
-
- /**
- * Answer an integer comprised of the next
- * four bytes of the input stream.
- */
- public int readInt() throws IOException {
- byte[] buf = new byte[4];
- read(buf);
- return ((((((buf[3] & 0xFF) << 8) |
- (buf[2] & 0xFF)) << 8) |
- (buf[1] & 0xFF)) << 8) |
- (buf[0] & 0xFF);
- }
-
- /**
- * Answer a short comprised of the next
- * two bytes of the input stream.
- */
- public short readShort() throws IOException {
- byte[] buf = new byte[2];
- read(buf);
- return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
- }
-
- /**
- * Push back the entire content of the given buffer <code>b</code>.
- * <p>
- * The bytes are pushed so that they would be read back b[0], b[1], etc.
- * If the push back buffer cannot handle the bytes copied from <code>b</code>,
- * an IOException will be thrown and no byte will be pushed back.
- * </p>
- *
- * @param b the byte array containing bytes to push back into the stream
- *
- * @exception java.io.IOException if the pushback buffer is too small
- */
- public void unread(byte[] b) throws IOException {
- int length = b.length;
- if (length > pos) throw new IOException();
- position -= length;
- pos -= length;
- System.arraycopy(b, 0, buf, pos, length);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java
deleted file mode 100755
index 16a52f1ff6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-
-final class LEDataOutputStream extends OutputStream {
- OutputStream out;
-public LEDataOutputStream(OutputStream output) {
- this.out = output;
-}
-public void close() throws IOException {
- out.close();
-}
-public void write(byte b[], int off, int len) throws IOException {
- out.write(b, off, len);
-}
-/**
- * Answer the next byte of the input stream.
- */
-public void write(int b) throws IOException {
- out.write(b);
-}
-/**
- * Answer the next byte of the input stream.
- */
-public void writeByte(byte b) throws IOException {
- out.write(b & 0xFF);
-}
-/**
- * Answer an integer comprised of the next
- * four bytes of the input stream.
- */
-public void writeInt(int theInt) throws IOException {
- out.write(theInt & 0xFF);
- out.write((theInt >> 8) & 0xFF);
- out.write((theInt >> 16) & 0xFF);
- out.write((theInt >> 24) & 0xFF);
-}
-/**
- * Answer an integer comprised of the next
- * two bytes of the input stream.
- */
-public void writeShort(int theShort) throws IOException {
- out.write(theShort & 0xFF);
- out.write((theShort >> 8) & 0xFF);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWCodec.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWCodec.java
deleted file mode 100755
index 184d43f057..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWCodec.java
+++ /dev/null
@@ -1,476 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-final class LZWCodec {
- int bitsPerPixel, blockSize, blockIndex, currentByte, bitsLeft,
- codeSize, clearCode, endCode, newCodes, topSlot, currentSlot,
- imageWidth, imageHeight, imageX, imageY, pass, line, codeMask, buffer;
- byte[] block, lineArray;
- int[] maskTable, stack, suffix, prefix;
- LZWNode[] nodeStack;
- LEDataInputStream inputStream;
- LEDataOutputStream outputStream;
- ImageData image;
- ImageLoader loader;
- boolean interlaced;
-/**
- * Decode the input.
- */
-void decode() {
- int code;
- int oc = 0;
- int fc = 0;
- byte[] buf = new byte[imageWidth];
- int stackIndex = 0;
- int bufIndex = 0;
- int c;
- while ((c = nextCode()) != endCode) {
- if (c == clearCode) {
- codeSize = bitsPerPixel + 1;
- codeMask = maskTable[bitsPerPixel];
- currentSlot = newCodes;
- topSlot = 1 << codeSize;
- while ((c = nextCode()) == clearCode) {};
- if (c != endCode) {
- oc = fc = c;
- buf[bufIndex] = (byte)c;
- bufIndex++;
- if (bufIndex == imageWidth) {
- nextPutPixels(buf);
- bufIndex = 0;
- }
- }
- } else {
- code = c;
- if (code >= currentSlot) {
- if (code > currentSlot)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- code = oc;
- stack[stackIndex] = fc;
- stackIndex++;
- }
- while (code >= newCodes) {
- stack[stackIndex] = suffix[code];
- stackIndex++;
- code = prefix[code];
- }
- stack[stackIndex] = code;
- stackIndex++;
- if (currentSlot < topSlot) {
- fc = code;
- suffix[currentSlot] = fc;
- prefix[currentSlot] = oc;
- currentSlot++;
- oc = c;
- }
- if (currentSlot >= topSlot) {
- if (codeSize < 12) {
- codeMask = maskTable[codeSize];
- codeSize++;
- topSlot = topSlot + topSlot;
- }
- }
- while (stackIndex > 0) {
- stackIndex--;
- buf[bufIndex] = (byte)stack[stackIndex];
- bufIndex++;
- if (bufIndex == imageWidth) {
- nextPutPixels(buf);
- bufIndex = 0;
- }
- }
- }
- }
- if (bufIndex != 0 && line < imageHeight) {
- nextPutPixels(buf);
- }
-}
-/**
- * Decode the LZW-encoded bytes in the given byte stream
- * into the given DeviceIndependentImage.
- */
-public void decode(LEDataInputStream inputStream, ImageLoader loader, ImageData image, boolean interlaced, int depth) {
- this.inputStream = inputStream;
- this.loader = loader;
- this.image = image;
- this.interlaced = interlaced;
- this.bitsPerPixel = depth;
- initializeForDecoding();
- decode();
-}
-/**
- * Encode the image.
- */
-void encode() {
- nextPutCode(clearCode);
- int lastPrefix = encodeLoop();
- nextPutCode(lastPrefix);
- nextPutCode(endCode);
-
- // Write out last partial block
- if (bitsLeft == 8) {
- block[0] = (byte)(blockIndex - 1); // Nothing in last byte
- } else {
- block[0] = (byte)(blockIndex); // Last byte has data
- }
- writeBlock();
-
- // Write out empty block to indicate the end (if needed)
- if (block[0] != 0) {
- block[0] = 0;
- writeBlock();
- }
-}
-/**
- * Encode the bytes into the given byte stream
- * from the given DeviceIndependentImage.
- */
-public void encode(LEDataOutputStream byteStream, ImageData image) {
- this.outputStream = byteStream;
- this.image = image;
- initializeForEncoding();
- encode();
-}
-/**
- * Encoding loop broken out to allow early return.
- */
-int encodeLoop() {
- int pixel = nextPixel();
- boolean found;
- LZWNode node;
- while (true) {
- int currentPrefix = pixel;
- node = nodeStack[currentPrefix];
- found = true;
- pixel = nextPixel();
- if (pixel < 0)
- return currentPrefix;
- while (found && (node.children != null)) {
- node = node.children;
- while (found && (node.suffix != pixel)) {
- if (pixel < node.suffix) {
- if (node.left == null) {
- node.left = new LZWNode();
- found = false;
- }
- node = node.left;
- } else {
- if (node.right == null) {
- node.right = new LZWNode();
- found = false;
- }
- node = node.right;
- }
- }
- if (found) {
- currentPrefix = node.code;
- pixel = nextPixel();
- if (pixel < 0)
- return currentPrefix;
- }
- }
- if (found) {
- node.children = new LZWNode();
- node = node.children;
- }
- node.children = null;
- node.left = null;
- node.right = null;
- node.code = currentSlot;
- node.prefix = currentPrefix;
- node.suffix = pixel;
- nextPutCode(currentPrefix);
- currentSlot++;
- // Off by one?
- if (currentSlot < 4096) {
- if (currentSlot > topSlot) {
- codeSize++;
- codeMask = maskTable[codeSize - 1];
- topSlot *= 2;
- }
- } else {
- nextPutCode(clearCode);
- for (int i = 0; i < nodeStack.length; i++)
- nodeStack[i].children = null;
- codeSize = bitsPerPixel + 1;
- codeMask = maskTable[codeSize - 1];
- currentSlot = newCodes;
- topSlot = 1 << codeSize;
- }
- }
-}
-/**
- * Initialize the receiver for decoding the given
- * byte array.
- */
-void initializeForDecoding() {
- pass = 1;
- line = 0;
- codeSize = bitsPerPixel + 1;
- topSlot = 1 << codeSize;
- clearCode = 1 << bitsPerPixel;
- endCode = clearCode + 1;
- newCodes = currentSlot = endCode + 1;
- currentByte = -1;
- blockSize = bitsLeft = 0;
- blockIndex = 0;
- maskTable = new int[] {
- 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F,
- 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF
- };
- codeMask = maskTable[codeSize - 1];
- stack = new int[4096];
- suffix = new int[4096];
- prefix = new int[4096];
- block = new byte[256];
- imageWidth = image.width;
- imageHeight = image.height;
-}
-/**
- * Initialize the receiver for encoding the given
- * byte array.
- */
-void initializeForEncoding() {
- interlaced = false;
- bitsPerPixel = image.depth;
- codeSize = bitsPerPixel + 1;
- topSlot = 1 << codeSize;
- clearCode = 1 << bitsPerPixel;
- endCode = clearCode + 1;
- newCodes = currentSlot = endCode + 1;
- bitsLeft = 8;
- currentByte = 0;
- blockIndex = 1;
- blockSize = 255;
- block = new byte[blockSize];
- block[0] = (byte)(blockSize - 1);
- maskTable = new int[] {
- 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F,
- 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF
- };
- nodeStack = new LZWNode[1 << bitsPerPixel];
- for (int i = 0; i < nodeStack.length; i++) {
- LZWNode node = new LZWNode();
- node.code = i + 1;
- node.prefix = -1;
- node.suffix = i + 1;
- nodeStack[i] = node;
- }
- imageWidth = image.width;
- imageHeight = image.height;
- imageY = -1;
- lineArray = new byte[imageWidth];
- imageX = imageWidth + 1; // Force a read
-}
-/**
- * Answer the next code from the input byte array.
- */
-int nextCode() {
- int code;
- if (bitsLeft == 0) {
- if (blockIndex >= blockSize) {
- blockSize = readBlock();
- blockIndex = 0;
- if (blockSize == 0) return endCode;
- }
- blockIndex++;
- currentByte = block[blockIndex] & 0xFF;
- bitsLeft = 8;
- code = currentByte;
- } else {
- int shift = bitsLeft - 8;
- if (shift < 0)
- code = currentByte >> (0 - shift);
- else
- code = currentByte << shift;
- }
- while (codeSize > bitsLeft) {
- if (blockIndex >= blockSize) {
- blockSize = readBlock();
- blockIndex = 0;
- if (blockSize == 0) return endCode;
- }
- blockIndex++;
- currentByte = block[blockIndex] & 0xFF;
- code += currentByte << bitsLeft;
- bitsLeft += 8;
- }
- bitsLeft -= codeSize;
- return code & codeMask;
-}
-/**
- * Answer the next pixel to encode in the image
- */
-int nextPixel() {
- imageX++;
- if (imageX > imageWidth) {
- imageY++;
- if (imageY >= imageHeight) {
- return -1;
- } else {
- nextPixels(lineArray, imageWidth);
- }
- imageX = 1;
- }
- return this.lineArray[imageX - 1] & 0xFF;
-}
-/**
- * Copy a row of pixel values from the image.
- */
-void nextPixels(byte[] buf, int lineWidth) {
- if (image.depth == 8) {
- System.arraycopy(image.data, imageY * image.bytesPerLine, buf, 0, lineWidth);
- } else {
- image.getPixels(0, imageY, lineWidth, buf, 0);
- }
-}
-/**
- * Output aCode to the output stream.
- */
-void nextPutCode(int aCode) {
- int codeToDo = aCode;
- int codeBitsToDo = codeSize;
- // Fill in the remainder of the current byte with the
- // *high-order* bits of the code.
- int c = codeToDo & maskTable[bitsLeft - 1];
- currentByte = currentByte | (c << (8 - bitsLeft));
- block[blockIndex] = (byte)currentByte;
- codeBitsToDo -= bitsLeft;
- if (codeBitsToDo < 1) {
- // The whole code fit in the first byte, so we are done.
- bitsLeft -= codeSize;
- if (bitsLeft == 0) {
- // We used the whole last byte, so get ready
- // for the next one.
- bitsLeft = 8;
- blockIndex++;
- if (blockIndex >= blockSize) {
- writeBlock();
- blockIndex = 1;
- }
- currentByte = 0;
- }
- return;
- }
- codeToDo = codeToDo >> bitsLeft;
-
- // Fill in any remaining whole bytes (i.e. not the last one!)
- blockIndex++;
- if (blockIndex >= blockSize) {
- writeBlock();
- blockIndex = 1;
- }
- while (codeBitsToDo >= 8) {
- currentByte = codeToDo & 0xFF;
- block[blockIndex] = (byte)currentByte;
- codeToDo = codeToDo >> 8;
- codeBitsToDo -= 8;
- blockIndex++;
- if (blockIndex >= blockSize) {
- writeBlock();
- blockIndex = 1;
- }
- }
- // Fill the *low-order* bits of the last byte with the remainder
- bitsLeft = 8 - codeBitsToDo;
- currentByte = codeToDo;
- block[blockIndex] = (byte)currentByte;
-}
-/**
- * Copy a row of pixel values to the image.
- */
-void nextPutPixels(byte[] buf) {
- if (image.depth == 8) {
- // Slight optimization for depth = 8.
- int start = line * image.bytesPerLine;
- for (int i = 0; i < imageWidth; i++)
- image.data[start + i] = buf[i];
- } else {
- image.setPixels(0, line, imageWidth, buf, 0);
- }
- if (interlaced) {
- if (pass == 1) {
- copyRow(buf, 7);
- line += 8;
- } else if (pass == 2) {
- copyRow(buf, 3);
- line += 8;
- } else if (pass == 3) {
- copyRow(buf, 1);
- line += 4;
- } else if (pass == 4) {
- line += 2;
- } else if (pass == 5) {
- line += 0;
- }
- if (line >= imageHeight) {
- pass++;
- if (pass == 2) line = 4;
- else if (pass == 3) line = 2;
- else if (pass == 4) line = 1;
- else if (pass == 5) line = 0;
- if (pass < 5) {
- if (loader.hasListeners()) {
- ImageData imageCopy = (ImageData) image.clone();
- loader.notifyListeners(
- new ImageLoaderEvent(loader, imageCopy, pass - 2, false));
- }
- }
- }
- if (line >= imageHeight) line = 0;
- } else {
- line++;
- }
-}
-/**
- * Copy duplicate rows of pixel values to the image.
- * This is to fill in rows if the image is interlaced.
- */
-void copyRow(byte[] buf, int copies) {
- for (int i = 1; i <= copies; i++) {
- if (line + i < imageHeight) {
- image.setPixels(0, line + i, imageWidth, buf, 0);
- }
- }
-}
-/**
- * Read a block from the byte stream.
- * Return the number of bytes read.
- * Throw an exception if the block could not be read.
- */
-int readBlock() {
- int size = -1;
- try {
- size = inputStream.read();
- if (size == -1) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- block[0] = (byte)size;
- size = inputStream.read(block, 1, size);
- if (size == -1) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return size;
-}
-/**
- * Write a block to the byte stream.
- * Throw an exception if the block could not be written.
- */
-void writeBlock() {
- try {
- outputStream.write(block, 0, (block[0] & 0xFF) + 1);
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWNode.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWNode.java
deleted file mode 100755
index 4e41f73259..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWNode.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-final class LZWNode {
- public LZWNode left, right, children;
- public int code, prefix, suffix;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PNGFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PNGFileFormat.java
deleted file mode 100755
index 12faa73b2b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PNGFileFormat.java
+++ /dev/null
@@ -1,536 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-public class PNGFileFormat extends FileFormat {
- static final int SIGNATURE_LENGTH = 8;
- PngDecodingDataStream decodingStream;
- PngIhdrChunk headerChunk;
- PngPlteChunk paletteChunk;
- PngTrnsChunk trnsChunk;
- ImageData imageData;
- byte[] data;
- byte[] alphaPalette;
-
-/**
- * Skip over signature data. This has already been
- * verified in isPNGFile().
- */
-void readSignature() throws IOException {
- byte[] signature = new byte[SIGNATURE_LENGTH];
- inputStream.read(signature);
-}
-/**
- * Load the PNG image from the byte stream.
- */
-ImageData[] loadFromByteStream() {
- try {
- readSignature();
- PngChunkReader chunkReader = new PngChunkReader(inputStream);
- headerChunk = chunkReader.getIhdrChunk();
- int imageSize = getAlignedBytesPerRow() * headerChunk.getHeight();
- data = new byte[imageSize];
- imageData = ImageData.internal_new(
- headerChunk.getWidth(),
- headerChunk.getHeight(),
- headerChunk.getSwtBitsPerPixel(),
- new PaletteData(0, 0, 0),
- 4,
- data,
- 0,
- null,
- null,
- -1,
- -1,
- SWT.IMAGE_PNG,
- 0,
- 0,
- 0,
- 0);
-
- if (headerChunk.usesDirectColor()) {
- imageData.palette = headerChunk.getPaletteData();
- };
-
- // Read and process chunks until the IEND chunk is encountered.
- while (chunkReader.hasMoreChunks()) {
- readNextChunk(chunkReader);
- }
-
- return new ImageData[] {imageData};
- } catch (IOException e) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return null;
- }
-}
-/**
- * Read and handle the next chunk of data from the
- * PNG file.
- */
-void readNextChunk(PngChunkReader chunkReader) {
- PngChunk chunk = chunkReader.readNextChunk();
- switch (chunk.getChunkType()) {
- case PngChunk.CHUNK_IEND:
- break;
- case PngChunk.CHUNK_PLTE:
- if (!headerChunk.usesDirectColor()) {
- paletteChunk = (PngPlteChunk) chunk;
- imageData.palette = paletteChunk.getPaletteData();
- };
- break;
- case PngChunk.CHUNK_tRNS:
- PngTrnsChunk trnsChunk = (PngTrnsChunk) chunk;
- if (trnsChunk.getTransparencyType(headerChunk) ==
- PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL)
- {
- imageData.transparentPixel =
- trnsChunk.getSwtTransparentPixel(headerChunk);
- } else {
- alphaPalette = trnsChunk.getAlphaValues(headerChunk, paletteChunk);
- }
- break;
- case PngChunk.CHUNK_IDAT:
- if (chunkReader.readPixelData()) {
- // All IDAT chunks in an image file must be
- // sequential. If the pixel data has already
- // been read and another IDAT block is encountered,
- // then this is an invalid image.
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- // Read in the pixel data for the image. This should
- // go through all the image's IDAT chunks.
- PngIdatChunk dataChunk = (PngIdatChunk) chunk;
- readPixelData(dataChunk, chunkReader);
- }
- break;
- default:
- if (chunk.isCritical()) {
- // All critical chunks must be supported.
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
-}
-void unloadIntoByteStream(ImageData p1) {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
-}
-/**
- * Answer whether the specified input stream
- * contains a PNG image.
- */
-public static boolean isPNGFile(LEDataInputStream stream) {
- try {
- byte[] signature = new byte[SIGNATURE_LENGTH];
- stream.read(signature);
- stream.unread(signature);
- if ((signature[0] & 0xFF) != 137) return false; //137
- if ((signature[1] & 0xFF) != 80) return false; //P
- if ((signature[2] & 0xFF) != 78) return false; //N
- if ((signature[3] & 0xFF) != 71) return false; //G
- if ((signature[4] & 0xFF) != 13) return false; //<RETURN>
- if ((signature[5] & 0xFF) != 10) return false; //<LINEFEED>
- if ((signature[6] & 0xFF) != 26) return false; //<CTRL/Z>
- if ((signature[7] & 0xFF) != 10) return false; //<LINEFEED>
- return true;
- } catch (Exception e) {
- return false;
- }
-}
-/**
- * SWT does not support 16-bit depths. If this image uses
- * 16-bit depths, convert the data to an 8-bit depth.
- */
-byte[] validateBitDepth(byte[] data) {
- if (headerChunk.getBitDepth() > 8) {
- byte[] result = new byte[data.length / 2];
- compress16BitDepthTo8BitDepth(data, 0, result, 0, result.length);
- return result;
- } else {
- return data;
- }
-}
-/**
- * SWT does not support greyscale as a color type. For
- * plain grayscale, we create a palette. For Grayscale
- * with Alpha, however, we need to convert the pixels
- * to use RGB values.
- * Note: This method assumes that the bit depth of the
- * data has already been restricted to 8 or less.
- */
-void setPixelData(byte[] data, ImageData imageData) {
- switch (headerChunk.getColorType()) {
- case PngIhdrChunk.COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- {
- int width = imageData.width;
- int height = imageData.height;
- int destBytesPerLine = imageData.bytesPerLine;
- /*
- * If the image uses 16-bit depth, it is converted
- * to an 8-bit depth image.
- */
- int srcBytesPerLine = getAlignedBytesPerRow();
- if (headerChunk.getBitDepth() > 8) srcBytesPerLine /= 2;
-
- byte[] rgbData = new byte[destBytesPerLine * height];
- byte[] alphaData = new byte[width * height];
- for (int y = 0; y < height; y++) {
- int srcIndex = srcBytesPerLine * y;
- int destIndex = destBytesPerLine * y;
- int destAlphaIndex = width * y;
- for (int x = 0; x < width; x++) {
- byte grey = data[srcIndex];
- byte alpha = data[srcIndex + 1];
- rgbData[destIndex + 0] = grey;
- rgbData[destIndex + 1] = grey;
- rgbData[destIndex + 2] = grey;
- alphaData[destAlphaIndex] = alpha;
- srcIndex += 2;
- destIndex += 3;
- destAlphaIndex++;
- }
- }
- imageData.data = rgbData;
- imageData.alphaData = alphaData;
- break;
- }
- case PngIhdrChunk.COLOR_TYPE_RGB_WITH_ALPHA:
- {
- int width = imageData.width;
- int height = imageData.height;
- int destBytesPerLine = imageData.bytesPerLine;
- int srcBytesPerLine = getAlignedBytesPerRow();
- /*
- * If the image uses 16-bit depth, it is converted
- * to an 8-bit depth image.
- */
- if (headerChunk.getBitDepth() > 8) srcBytesPerLine /= 2;
-
- byte[] rgbData = new byte[destBytesPerLine * height];
- byte[] alphaData = new byte[width * height];
- for (int y = 0; y < height; y++) {
- int srcIndex = srcBytesPerLine * y;
- int destIndex = destBytesPerLine * y;
- int destAlphaIndex = width * y;
- for (int x = 0; x < width; x++) {
- rgbData[destIndex + 0] = data[srcIndex + 0];
- rgbData[destIndex + 1] = data[srcIndex + 1];
- rgbData[destIndex + 2] = data[srcIndex + 2];
- alphaData[destAlphaIndex] = data[srcIndex + 3];
- srcIndex += 4;
- destIndex += 3;
- destAlphaIndex++;
- }
- }
- imageData.data = rgbData;
- imageData.alphaData = alphaData;
- break;
- }
- case PngIhdrChunk.COLOR_TYPE_RGB:
- imageData.data = data;
- break;
- case PngIhdrChunk.COLOR_TYPE_PALETTE:
- imageData.data = data;
- if (alphaPalette != null) {
- int size = imageData.width * imageData.height;
- byte[] alphaData = new byte[size];
- byte[] pixelData = new byte[size];
- imageData.getPixels(0, 0, size, pixelData, 0);
- for (int i = 0; i < pixelData.length; i++) {
- alphaData[i] = alphaPalette[pixelData[i] & 0xFF];
- }
- imageData.alphaData = alphaData;
- }
- break;
- default:
- imageData.data = data;
- break;
- }
-}
-/**
- * PNG supports some color types and bit depths that are
- * unsupported by SWT. If the image uses an unsupported
- * color type (either of the gray scale types) or bit
- * depth (16), convert the data to an SWT-supported
- * format. Then assign the data into the ImageData given.
- */
-void setImageDataValues(byte[] data, ImageData imageData) {
- byte[] result = validateBitDepth(data);
- setPixelData(result, imageData);
-}
-/**
- * Read the image data from the data stream. This must handle
- * decoding the data, filtering, and interlacing.
- */
-void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) {
- decodingStream = new PngDecodingDataStream(chunk, chunkReader);
- int interlaceMethod = headerChunk.getInterlaceMethod();
- if (interlaceMethod == PngIhdrChunk.INTERLACE_METHOD_NONE) {
- readNonInterlacedImage();
- } else {
- readInterlacedImage();
- }
- decodingStream.assertImageDataAtEnd();
- decodingStream.checkAdler();
-}
-/**
- * Answer the number of bytes in a word-aligned row of pixel data.
- */
-int getAlignedBytesPerRow() {
- return ((getBytesPerRow(headerChunk.getWidth()) + 3) / 4) * 4;
-}
-/**
- * Answer the number of bytes in each row of the image
- * data. Each PNG row is byte-aligned, so images with bit
- * depths less than a byte may have unused bits at the
- * end of each row. The value of these bits is undefined.
- */
-int getBytesPerRow() {
- return getBytesPerRow(headerChunk.getWidth());
-}
-/**
- * Answer the number of bytes needed to represent a pixel.
- * This value depends on the image's color type and bit
- * depth.
- * Note that this method rounds up if an image's pixel size
- * isn't byte-aligned.
- */
-int getBytesPerPixel() {
- int bitsPerPixel = headerChunk.getBitsPerPixel();
- return (bitsPerPixel + 7) / 8;
-}
-/**
- * Answer the number of bytes in a row of the given pixel
- * width. Each row is byte-aligned, so images with bit
- * depths less than a byte may have unused bits at the
- * end of each row. The value of these bits is undefined.
- */
-int getBytesPerRow(int rowWidthInPixels) {
- int bitsPerPixel = headerChunk.getBitsPerPixel();
- int bitsPerRow = bitsPerPixel * rowWidthInPixels;
- int bitsPerByte = 8;
- return (bitsPerRow + (bitsPerByte - 1)) / bitsPerByte;
-}
-/**
- * 1. Read one of the seven frames of interlaced data.
- * 2. Update the imageData.
- * 3. Notify the image loader's listeners of the frame load.
- */
-void readInterlaceFrame(
- int rowInterval,
- int columnInterval,
- int startRow,
- int startColumn,
- int frameCount)
-{
- int width = headerChunk.getWidth();
- int alignedBytesPerRow = getAlignedBytesPerRow();
- int height = headerChunk.getHeight();
- if (startRow >= height || startColumn >= width) return;
-
- int pixelsPerRow = (width - startColumn + columnInterval - 1) / columnInterval;
- int bytesPerRow = getBytesPerRow(pixelsPerRow);
- byte[] row1 = new byte[bytesPerRow];
- byte[] row2 = new byte[bytesPerRow];
- byte[] currentRow = row1;
- byte[] lastRow = row2;
- for (int row = startRow; row < height; row += rowInterval) {
- byte filterType = decodingStream.getNextDecodedByte();
- for (int col = 0; col < bytesPerRow; col++) {
- currentRow[col] = decodingStream.getNextDecodedByte();
- }
- filterRow(currentRow, lastRow, filterType);
- if (headerChunk.getBitDepth() >= 8) {
- int bytesPerPixel = getBytesPerPixel();
- int dataOffset = (row * alignedBytesPerRow) + (startColumn * bytesPerPixel);
- for (int rowOffset = 0; rowOffset < currentRow.length; rowOffset += bytesPerPixel) {
- for (int byteOffset = 0; byteOffset < bytesPerPixel; byteOffset++) {
- data[dataOffset + byteOffset] = currentRow[rowOffset + byteOffset];
- }
- dataOffset += (columnInterval * bytesPerPixel);
- }
- } else {
- int bitsPerPixel = headerChunk.getBitDepth();
- int pixelsPerByte = 8 / bitsPerPixel;
- int column = startColumn;
- int rowBase = row * alignedBytesPerRow;
- int valueMask = 0;
- for (int i = 0; i < bitsPerPixel; i++) {
- valueMask <<= 1;
- valueMask |= 1;
- }
- int maxShift = 8 - bitsPerPixel;
- for (int byteOffset = 0; byteOffset < currentRow.length; byteOffset++) {
- for (int bitOffset = maxShift; bitOffset >= 0; bitOffset -= bitsPerPixel) {
- if (column < width) {
- int dataOffset = rowBase + (column * bitsPerPixel / 8);
- int value = (currentRow[byteOffset] >> bitOffset) & valueMask;
- int dataShift = maxShift - (bitsPerPixel * (column % pixelsPerByte));
- data[dataOffset] |= value << dataShift;
- }
- column += columnInterval;
- }
- }
- }
- currentRow = (currentRow == row1) ? row2 : row1;
- lastRow = (lastRow == row1) ? row2 : row1;
- }
- setImageDataValues(data, imageData);
- fireInterlacedFrameEvent(frameCount);
-}
-/**
- * Read the pixel data for an interlaced image from the
- * data stream.
- */
-void readInterlacedImage() {
- readInterlaceFrame(8, 8, 0, 0, 0);
- readInterlaceFrame(8, 8, 0, 4, 1);
- readInterlaceFrame(8, 4, 4, 0, 2);
- readInterlaceFrame(4, 4, 0, 2, 3);
- readInterlaceFrame(4, 2, 2, 0, 4);
- readInterlaceFrame(2, 2, 0, 1, 5);
- readInterlaceFrame(2, 1, 1, 0, 6);
-}
-/**
- * Fire an event to let listeners know that an interlaced
- * frame has been loaded.
- * finalFrame should be true if the image has finished
- * loading, false if there are more frames to come.
- */
-void fireInterlacedFrameEvent(int frameCount) {
- if (loader.hasListeners()) {
- ImageData image = (ImageData) imageData.clone();
- boolean finalFrame = frameCount == 6;
- loader.notifyListeners(new ImageLoaderEvent(loader, image, frameCount, finalFrame));
- }
-}
-/**
- * Read the pixel data for a non-interlaced image from the
- * data stream.
- * Update the imageData to reflect the new data.
- */
-void readNonInterlacedImage() {
- int dataOffset = 0;
- int alignedBytesPerRow = getAlignedBytesPerRow();
- int bytesPerRow = getBytesPerRow();
- byte[] row1 = new byte[bytesPerRow];
- byte[] row2 = new byte[bytesPerRow];
- byte[] currentRow = row1;
- byte[] lastRow = row2;
- for (int row = 0; row < headerChunk.getHeight(); row++) {
- byte filterType = decodingStream.getNextDecodedByte();
- for (int col = 0; col < bytesPerRow; col++) {
- currentRow[col] = decodingStream.getNextDecodedByte();
- }
- filterRow(currentRow, lastRow, filterType);
- System.arraycopy(currentRow, 0, data, dataOffset, bytesPerRow);
- dataOffset += alignedBytesPerRow;
- currentRow = (currentRow == row1) ? row2 : row1;
- lastRow = (lastRow == row1) ? row2 : row1;
- }
- setImageDataValues(data, imageData);
-}
-/**
- * SWT does not support 16-bit depth color formats.
- * Convert the 16-bit data to 8-bit data.
- * The correct way to do this is to multiply each
- * 16 bit value by the value:
- * (2^8 - 1) / (2^16 - 1).
- * The fast way to do this is just to drop the low
- * byte of the 16-bit value.
- */
-static void compress16BitDepthTo8BitDepth(
- byte[] source,
- int sourceOffset,
- byte[] destination,
- int destinationOffset,
- int numberOfValues)
-{
- //double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1);
- for (int i = 0; i < numberOfValues; i++) {
- int sourceIndex = sourceOffset + (2 * i);
- int destinationIndex = destinationOffset + i;
- //int value = (source[sourceIndex] << 8) | source[sourceIndex + 1];
- //byte compressedValue = (byte)(value * multiplier);
- byte compressedValue = source[sourceIndex];
- destination[destinationIndex] = compressedValue;
- }
-}
-/**
- * SWT does not support 16-bit depth color formats.
- * Convert the 16-bit data to 8-bit data.
- * The correct way to do this is to multiply each
- * 16 bit value by the value:
- * (2^8 - 1) / (2^16 - 1).
- * The fast way to do this is just to drop the low
- * byte of the 16-bit value.
- */
-static int compress16BitDepthTo8BitDepth(int value) {
- //double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1);
- //byte compressedValue = (byte)(value * multiplier);
- return value >> 8;
-}
-/**
- * PNG supports four filtering types. These types are applied
- * per row of image data. This method unfilters the given row
- * based on the filterType.
- */
-void filterRow(byte[] row, byte[] previousRow, int filterType) {
- int byteOffset = headerChunk.getFilterByteOffset();
- switch (filterType) {
- case PngIhdrChunk.FILTER_NONE:
- break;
- case PngIhdrChunk.FILTER_SUB:
- for (int i = byteOffset; i < row.length; i++) {
- int current = row[i] & 0xFF;
- int left = row[i - byteOffset] & 0xFF;
- row[i] = (byte)((current + left) & 0xFF);
- }
- break;
- case PngIhdrChunk.FILTER_UP:
- for (int i = 0; i < row.length; i++) {
- int current = row[i] & 0xFF;
- int above = previousRow[i] & 0xFF;
- row[i] = (byte)((current + above) & 0xFF);
- }
- break;
- case PngIhdrChunk.FILTER_AVERAGE:
- for (int i = 0; i < row.length; i++) {
- int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF;
- int above = previousRow[i] & 0xFF;
- int current = row[i] & 0xFF;
- row[i] = (byte)((current + ((left + above) / 2)) & 0xFF);
- }
- break;
- case PngIhdrChunk.FILTER_PAETH:
- for (int i = 0; i < row.length; i++) {
- int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF;
- int aboveLeft = (i < byteOffset) ? 0 : previousRow[i - byteOffset] & 0xFF;
- int above = previousRow[i] & 0xFF;
-
- int a = Math.abs(above - aboveLeft);
- int b = Math.abs(left - aboveLeft);
- int c = Math.abs(left - aboveLeft + above - aboveLeft);
-
- int preductor = 0;
- if (a <= b && a <= c) {
- preductor = left;
- } else if (b <= c) {
- preductor = above;
- } else {
- preductor = aboveLeft;
- }
-
- int currentValue = row[i] & 0xFF;
- row[i] = (byte) ((currentValue + preductor) & 0xFF);
- }
- break;
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
deleted file mode 100755
index b71f331e09..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
+++ /dev/null
@@ -1,334 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Compatibility;
-import java.io.*;
-
-class PngChunk extends Object {
- byte[] reference;
-
- static final int LENGTH_OFFSET = 0;
- static final int TYPE_OFFSET = 4;
- static final int DATA_OFFSET = 8;
-
- static final int TYPE_FIELD_LENGTH = 4;
- static final int LENGTH_FIELD_LENGTH = 4;
- static final int MIN_LENGTH = 12;
-
- static final int CHUNK_UNKNOWN = -1;
- // Critical chunks.
- static final int CHUNK_IHDR = 0;
- static final int CHUNK_PLTE = 1;
- static final int CHUNK_IDAT = 2;
- static final int CHUNK_IEND = 3;
- // Non-critical chunks.
- static final int CHUNK_tRNS = 5;
-
- static final byte[] TYPE_IHDR = {(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'};
- static final byte[] TYPE_PLTE = {(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'};
- static final byte[] TYPE_IDAT = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'};
- static final byte[] TYPE_IEND = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'};
- static final byte[] TYPE_tRNS = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'};
-
- static final int[] CRC_TABLE;
- static {
- CRC_TABLE = new int[256];
- for (int i = 0; i < 256; i++) {
- CRC_TABLE[i] = i;
- for (int j = 0; j < 8; j++) {
- if ((CRC_TABLE[i] & 0x1) == 0) {
- CRC_TABLE[i] = (CRC_TABLE[i] >> 1) & 0x7FFFFFFF;
- } else {
- CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF);
- }
- }
- }
- }
-
-/**
- * Construct a PngChunk using the reference bytes
- * given.
- */
-PngChunk(byte[] reference) {
- super();
- setReference(reference);
-}
-
-/**
- * Get the PngChunk's reference byteArray;
- */
-byte[] getReference() {
- return reference;
-}
-
-/**
- * Set the PngChunk's reference byteArray;
- */
-void setReference(byte[] reference) {
- this.reference = reference;
-}
-
-/**
- * Get the 32-bit integer from the reference byte
- * array at the given offset.
- */
-int getInt32(int offset) {
- int answer = 0;
- answer |= (reference[offset] & 0xFF) << 24;
- answer |= (reference[offset + 1] & 0xFF) << 16;
- answer |= (reference[offset + 2] & 0xFF) << 8;
- answer |= (reference[offset + 3] & 0xFF);
- return answer;
-}
-
-/**
- * Set the 32-bit integer in the reference byte
- * array at the given offset.
- */
-void setInt32(int offset, int value) {
- reference[offset] = (byte) ((value >> 24) & 0xFF);
- reference[offset + 1] = (byte) ((value >> 16) & 0xFF);
- reference[offset + 2] = (byte) ((value >> 8) & 0xFF);
- reference[offset + 3] = (byte) (value & 0xFF);
-}
-
-/**
- * Get the length of the data component of this chunk.
- * This is not the length of the entire chunk.
- */
-int getLength() {
- return getInt32(LENGTH_OFFSET);
-}
-
-/**
- * Set the length of the data component of this chunk.
- * This is not the length of the entire chunk.
- */
-void setLength(int value) {
- setInt32(LENGTH_OFFSET, value);
-}
-
-/**
- * Get the chunk type. This is a four byte value.
- * Each byte should be an ASCII character.
- * The first byte is upper case if the chunk is critical.
- * The second byte is upper case if the chunk is publicly defined.
- * The third byte must be upper case.
- * The fourth byte is upper case if the chunk is unsafe to copy.
- * Public chunk types are defined by the PNG Development Group.
- */
-byte[] getTypeBytes() {
- byte[] type = new byte[4];
- System.arraycopy(reference, TYPE_OFFSET, type, 0, TYPE_FIELD_LENGTH);
- return type;
-}
-
-/**
- * Set the chunk type. This is a four byte value.
- * Each byte should be an ASCII character.
- * The first byte is upper case if the chunk is critical.
- * The second byte is upper case if the chunk is publicly defined.
- * The third byte must be upper case.
- * The fourth byte is upper case if the chunk is unsafe to copy.
- * Public chunk types are defined by the PNG Development Group.
- */
-void setType(byte[] value) {
- if (value.length != TYPE_FIELD_LENGTH) {
- throw new SWTException(SWT.ERROR_INVALID_ARGUMENT);
- }
- System.arraycopy(value, 0, reference, TYPE_OFFSET, TYPE_FIELD_LENGTH);
-}
-
-/**
- * Get the chunk's data.
- */
-byte[] getData() {
- int dataLength = getLength();
- if (reference.length < MIN_LENGTH + dataLength) {
- throw new SWTException(SWT.ERROR_INVALID_RANGE);
- }
- byte[] data = new byte[dataLength];
- System.arraycopy(reference, DATA_OFFSET, data, 0, dataLength);
- return data;
-}
-
-/**
- * Set the chunk's data.
- * This method has two side-effects.
- * 1. It will set the length field to be the length
- * of the data array given.
- * 2. It will set the CRC field to the computed CRC
- * value of the data array given.
- */
-void setData(byte[] data) {
- setLength(data.length);
- System.arraycopy(data, 0, reference, DATA_OFFSET, data.length);
- setCRC(computeCRC());
-}
-
-/**
- * Get the CRC value for the chunk's data.
- * Ensure that the length field has a good
- * value before making this call.
- */
-int getCRC() {
- int crcOffset = DATA_OFFSET + getLength();
- return getInt32(crcOffset);
-}
-
-/**
- * Set the CRC value for the chunk's data.
- * Ensure that the length field has a good
- * value before making this call.
- */
-void setCRC(int value) {
- int crcOffset = DATA_OFFSET + getLength();
- setInt32(crcOffset, value);
-}
-
-/**
- * Get the chunk's total size including the length, type, and crc fields.
- */
-int getSize() {
- return MIN_LENGTH + getLength();
-}
-
-/**
- * Compute the CRC value for the chunk's data. Answer
- * whether this value matches the value stored in the
- * chunk.
- */
-boolean checkCRC() {
- int crc = computeCRC();
- int storedCRC = getCRC();
- return crc == storedCRC;
-}
-
-/**
- * Answer the CRC value of chunk's data.
- */
-int computeCRC() {
- int crc = 0xFFFFFFFF;
- int start = TYPE_OFFSET;
- int stop = DATA_OFFSET + getLength();
- for (int i = start; i < stop; i++) {
- int index = (crc ^ reference[i]) & 0xFF;
- crc = CRC_TABLE[index] ^ ((crc >> 8) & 0x00FFFFFF);
- }
- return ~crc;
-}
-
-boolean typeMatchesArray(byte[] array) {
- for (int i = 0; i < TYPE_FIELD_LENGTH; i++) {
- if (reference[TYPE_OFFSET + i] != array[i]){
- return false;
- }
- }
- return true;
-}
-
-boolean isCritical() {
- return Character.isUpperCase((char) getTypeBytes()[0]);
-}
-
-int getChunkType() {
- if (typeMatchesArray(TYPE_IHDR)) return CHUNK_IHDR;
- if (typeMatchesArray(TYPE_PLTE)) return CHUNK_PLTE;
- if (typeMatchesArray(TYPE_IDAT)) return CHUNK_IDAT;
- if (typeMatchesArray(TYPE_IEND)) return CHUNK_IEND;
- if (typeMatchesArray(TYPE_tRNS)) return CHUNK_tRNS;
- return CHUNK_UNKNOWN;
-}
-
-
-
-
-/**
- * Read the next PNG chunk from the input stream given.
- * If unable to read a chunk, return null.
- */
-static PngChunk readNextFromStream(LEDataInputStream stream) {
- try {
- int headerLength = LENGTH_FIELD_LENGTH + TYPE_FIELD_LENGTH;
- byte[] headerBytes = new byte[headerLength];
- int result = stream.read(headerBytes, 0, headerLength);
- stream.unread(headerBytes);
- if (result != headerLength) return null;
-
- PngChunk tempChunk = new PngChunk(headerBytes);
-
- int chunkLength = tempChunk.getSize();
- byte[] chunk = new byte[chunkLength];
- result = stream.read(chunk, 0, chunkLength);
- if (result != chunkLength) return null;
-
- switch (tempChunk.getChunkType()) {
- case CHUNK_IHDR:
- return new PngIhdrChunk(chunk);
- case CHUNK_PLTE:
- return new PngPlteChunk(chunk);
- case CHUNK_IDAT:
- return new PngIdatChunk(chunk);
- case CHUNK_IEND:
- return new PngIendChunk(chunk);
- case CHUNK_tRNS:
- return new PngTrnsChunk(chunk);
- default:
- return new PngChunk(chunk);
- }
- } catch (IOException e) {
- return null;
- }
-}
-
-/**
- * Answer whether the chunk is a valid PNG chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
- if (reference.length < MIN_LENGTH) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- byte[] type = getTypeBytes();
-
- // The third character MUST be upper case.
- if (!Character.isUpperCase((char) type[2])) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- // All characters must be letters.
- for (int i = 0; i < TYPE_FIELD_LENGTH; i++) {
- if (!Compatibility.isLetter((char) type[i])) SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-
- // The stored CRC must match the data's computed CRC.
- if (!checkCRC()) SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-
-/**
- * Provided so that subclasses can override and add
- * data to the toString() call.
- */
-void contributeToString(StringBuffer buffer) {}
-
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("{");
- buffer.append("\n\tLength: ");
- buffer.append(getLength());
- buffer.append("\n\tType: ");
- byte[] type = getTypeBytes();
- for(int i = 0; i < type.length; i++) {
- buffer.append((char) type[i]);
- }
-
- contributeToString(buffer);
-
- buffer.append("\n\tCRC: ");
- buffer.append(Integer.toHexString(getCRC()));
- buffer.append("\n}");
- return buffer.toString();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunkReader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunkReader.java
deleted file mode 100755
index 48a9adb86b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunkReader.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-public class PngChunkReader {
- LEDataInputStream inputStream;
- PngFileReadState readState;
- PngIhdrChunk headerChunk;
- PngPlteChunk paletteChunk;
-
-PngChunkReader(LEDataInputStream inputStream) {
- this.inputStream = inputStream;
- readState = new PngFileReadState();
- headerChunk = null;
-}
-
-PngIhdrChunk getIhdrChunk() {
- if (headerChunk == null) {
- try {
- PngChunk chunk = PngChunk.readNextFromStream(inputStream);
- headerChunk = (PngIhdrChunk) chunk;
- headerChunk.validate(readState, null);
- } catch (ClassCastException e) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- }
- return headerChunk;
-}
-
-PngChunk readNextChunk() {
- if (headerChunk == null) return getIhdrChunk();
-
- PngChunk chunk = PngChunk.readNextFromStream(inputStream);
- switch (chunk.getChunkType()) {
- case PngChunk.CHUNK_tRNS:
- ((PngTrnsChunk) chunk).validate(readState, headerChunk, paletteChunk);
- break;
- case PngChunk.CHUNK_PLTE:
- chunk.validate(readState, headerChunk);
- paletteChunk = (PngPlteChunk) chunk;
- break;
- default:
- chunk.validate(readState, headerChunk);
- }
- if (readState.readIDAT && !(chunk.getChunkType() == PngChunk.CHUNK_IDAT)) {
- readState.readPixelData = true;
- }
- return chunk;
-}
-
-boolean readPixelData() {
- return readState.readPixelData;
-}
-
-boolean hasMoreChunks() {
- return !readState.readIEND;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngDecodingDataStream.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngDecodingDataStream.java
deleted file mode 100755
index e1e6b5d08c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngDecodingDataStream.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-
-public class PngDecodingDataStream {
- PngIdatChunk currentChunk;
- PngChunkReader chunkReader;
- byte currentByte;
- int nextByteIndex;
- int nextBitIndex;
-
- PngLzBlockReader lzBlockReader;
- int adlerValue;
-
- static final int PRIME = 65521;
- static final int MAX_BIT = 7;
-
-PngDecodingDataStream(PngIdatChunk idatChunk, PngChunkReader chunkReader) {
- super();
- this.currentChunk = idatChunk;
- this.chunkReader = chunkReader;
- nextByteIndex = 0;
- nextBitIndex = MAX_BIT + 1;
- adlerValue = 1;
- lzBlockReader = new PngLzBlockReader(this);
- readCompressedDataHeader();
- lzBlockReader.readNextBlockHeader();
-}
-
-/**
- * This method should be called when the image decoder thinks
- * that all of the compressed image data has been read. This
- * method will ensure that the next data value is an end of
- * block marker. If there are more blocks after this one,
- * the method will read them and ensure that they are empty.
- */
-void assertImageDataAtEnd() {
- lzBlockReader.assertCompressedDataAtEnd();
-}
-
-int getNextIdatBits(int length) {
- int value = 0;
- for (int i = 0; i < length; i++) {
- value |= (getNextIdatBit() << i);
- }
- return value;
-}
-
-byte getNextIdatBit() {
- if (nextBitIndex > MAX_BIT) {
- currentByte = getNextIdatByte();
- nextBitIndex = 0;
- }
- int mask = 1 << nextBitIndex;
- nextBitIndex++;
- return ((currentByte & mask) > 0) ? (byte) 1 : (byte) 0;
-}
-
-private PngIdatChunk getNextChunk() {
- PngChunk chunk = chunkReader.readNextChunk();
- if (chunk == null) error();
- if (chunk.getChunkType() != PngChunk.CHUNK_IDAT) error();
- return (PngIdatChunk) chunk;
-}
-
-byte getNextIdatByte() {
- if (nextByteIndex > currentChunk.getLength() - 1) {
- currentChunk = getNextChunk();
- nextByteIndex = 0;
- }
- byte nextByte = currentChunk.getDataByteAtOffset(nextByteIndex);
- nextByteIndex++;
- nextBitIndex = MAX_BIT + 1;
- return nextByte;
-}
-
-private void updateAdler(byte value) {
- int low = adlerValue & 0xFFFF;
- int high = (adlerValue >> 16) & 0xFFFF;
- int valueInt = value & 0xFF;
- low = (low + valueInt) % PRIME;
- high = (low + high) % PRIME;
- adlerValue = (high << 16) | low;
-}
-
-byte getNextDecodedByte() {
- byte nextDecodedByte = lzBlockReader.getNextByte();
- updateAdler(nextDecodedByte);
- return nextDecodedByte;
-}
-
-void error() {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-
-private void readCompressedDataHeader() {
- byte headerByte1 = getNextIdatByte();
- byte headerByte2 = getNextIdatByte();
-
- int number = ((headerByte1 & 0xFF) << 8) | (headerByte2 & 0xFF);
- if (number % 31 != 0) error();
-
- int compressionMethod = headerByte1 & 0x0F;
- if (compressionMethod != 8) error();
-
- int windowSizeHint = (headerByte1 & 0xF0) >> 4;
- if (windowSizeHint > 7) error();
- int windowSize = (1 << (windowSizeHint + 8));
- lzBlockReader.setWindowSize(windowSize);
-
- int dictionary = (headerByte2 & (1 << 5));
- if (dictionary != 0) error();
-
- int compressionLevel = (headerByte2 & 0xC0) >> 6;
-}
-
-void checkAdler() {
- int storedAdler = ((getNextIdatByte() & 0xFF) << 24)
- | ((getNextIdatByte() & 0xFF) << 16)
- | ((getNextIdatByte() & 0xFF) << 8)
- | (getNextIdatByte() & 0xFF);
- if (storedAdler != adlerValue) error();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngFileReadState.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngFileReadState.java
deleted file mode 100755
index 88778d4617..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngFileReadState.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-class PngFileReadState extends Object {
- boolean readIHDR;
- boolean readPLTE;
- boolean readIDAT;
- boolean readIEND;
-
- // Non - critical chunks
- boolean readBKGD;
- boolean readTRNS;
-
- // Set to true after IDATs have been read.
- boolean readPixelData;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java
deleted file mode 100755
index f751ff7c1a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PngHuffmanTable {
- CodeLengthInfo[] codeLengthInfo;
- int[] codeValues;
-
- static final int MAX_CODE_LENGTH = 15;
- static final int BAD_CODE = 0xFFFFFFF;
-
-PngHuffmanTable (int[] lengths) {
- super();
- initialize(lengths);
- generateTable(lengths);
-}
-
-private void initialize(int[] lengths) {
- codeValues = new int[lengths.length];
- for (int i = 0; i < codeValues.length; i++) {
- codeValues[i] = i;
- }
-
- // minCodesByLength[n] : The smallest Huffman code of length n + 1.
- // maxCodesByLength[n] : The largest Huffman code of length n + 1.
- // indexesByLength[n] : Index into the values array. First value with a code of length n + 1.
- codeLengthInfo = new CodeLengthInfo[MAX_CODE_LENGTH];
- for (int i = 0; i < MAX_CODE_LENGTH; i++) {
- codeLengthInfo[i] = new CodeLengthInfo();
- codeLengthInfo[i].length = i;
- codeLengthInfo[i].baseIndex = 0;
- codeLengthInfo[i].min = BAD_CODE;
- codeLengthInfo[i].max = -1;
- }
-}
-
-private void generateTable(int[] lengths) {
- // Sort the values. Primary key is code size. Secondary key is value.
- for (int i = 0; i < lengths.length - 1; i++) {
- for (int j = i + 1; j < lengths.length; j++) {
- if (lengths[j] < lengths[i]
- || (lengths[j] == lengths[i]
- && codeValues[j] < codeValues[i]))
- {
- int tmp;
- tmp = lengths[j];
- lengths[j] = lengths[i];
- lengths[i] = tmp;
- tmp = codeValues[j];
- codeValues[j] = codeValues[i];
- codeValues[i] = tmp;
- }
- }
- }
-
- // These values in these arrays correspond to the elements of the
- // "values" array. The Huffman code for codeValues[N] is codes[N]
- // and the length of the code is lengths[N].
- int[] codes = new int[lengths.length];
- int lastLength = 0;
- int code = 0;
- for (int i = 0; i < lengths.length; i++) {
- while (lastLength != lengths[i]) {
- lastLength++;
- code <<= 1;
- }
- if (lastLength != 0) {
- codes[i] = code;
- code++;
- }
- }
-
- int last = 0;
- for (int i = 0; i < lengths.length; i++) {
- if (last != lengths[i]) {
- last = lengths[i];
- codeLengthInfo[last - 1].baseIndex = i;
- codeLengthInfo[last - 1].min = codes[i];
- }
- if (last != 0) codeLengthInfo[last - 1].max = codes[i];
- }
-}
-
-int getNextValue(PngDecodingDataStream stream) {
- int code = stream.getNextIdatBit();
- int codelength = 0;
-
- // Here we are taking advantage of the fact that 1 bits are used as
- // a prefix to the longer codeValues.
- while (code > codeLengthInfo[codelength].max && codelength < MAX_CODE_LENGTH) {
- code = ((code << 1) | stream.getNextIdatBit());
- codelength++;
- }
- if (codelength >= MAX_CODE_LENGTH) stream.error();
-
- // Now we have a Huffman code of length (codelength + 1) that
- // is somewhere in the range
- // minCodesByLength[codelength]..maxCodesByLength[codelength].
- // This code is the (offset + 1)'th code of (codelength + 1);
- int offset = code - codeLengthInfo[codelength].min;
-
- // indexesByLength[codelength] is the first code of length (codelength + 1)
- // so now we can look up the value for the Huffman code in the table.
- int index = codeLengthInfo[codelength].baseIndex + offset;
- return codeValues[index];
-}
-
-class CodeValuePair {
- int value;
- int code;
-}
-class CodeLengthInfo {
- int length;
- int max;
- int min;
- int baseIndex;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTables.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTables.java
deleted file mode 100755
index cb1ed09fa8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTables.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PngHuffmanTables {
- PngHuffmanTable literalTable;
- PngHuffmanTable distanceTable;
-
- static PngHuffmanTable FixedLiteralTable;
- static PngHuffmanTable FixedDistanceTable;
-
- static final int LiteralTableSize = 288;
- static final int[] FixedLiteralLengths = {
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
- };
-
- static final int DistanceTableSize = 32;
- static final int[] FixedDistanceLengths = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- };
-
- static final int LengthCodeTableSize = 19;
- static final int[] LengthCodeOrder = {
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
- 11, 4, 12, 3, 13, 2, 14, 1, 15
- };
-
-static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream){
- return new PngHuffmanTables(stream);
-}
-static PngHuffmanTables getFixedTables() {
- return new PngHuffmanTables();
-}
-
-private PngHuffmanTable getFixedLiteralTable() {
- if (FixedLiteralTable == null) {
- FixedLiteralTable = new PngHuffmanTable(FixedLiteralLengths);
- }
- return FixedLiteralTable;
-}
-
-private PngHuffmanTable getFixedDistanceTable() {
- if (FixedDistanceTable == null) {
- FixedDistanceTable = new PngHuffmanTable(FixedDistanceLengths);
- }
- return FixedDistanceTable;
-}
-
-private PngHuffmanTables () {
- super();
- literalTable = getFixedLiteralTable();
- distanceTable = getFixedDistanceTable();
-}
-
-private PngHuffmanTables (PngDecodingDataStream stream) {
- super();
-
- int literals = PngLzBlockReader.FIRST_LENGTH_CODE
- + stream.getNextIdatBits(5);
- int distances = PngLzBlockReader.FIRST_DISTANCE_CODE
- + stream.getNextIdatBits(5);
- int codeLengthCodes = PngLzBlockReader.FIRST_CODE_LENGTH_CODE
- + stream.getNextIdatBits(4);
-
- if (codeLengthCodes > PngLzBlockReader.LAST_CODE_LENGTH_CODE) {
- stream.error();
- }
-
- /* Tricky, tricky, tricky. The length codes are stored in
- * a very odd order. (For the order, see the definition of
- * the static field lengthCodeOrder.) Also, the data may
- * not contain values for all the codes. It may just contain
- * values for the first X number of codes. The table should
- * be of size <LengthCodeTableSize> regardless of the number
- * of values actually given in the table.
- */
- int[] lengthCodes = new int[LengthCodeTableSize];
- for (int i = 0; i < codeLengthCodes; i++) {
- lengthCodes[LengthCodeOrder[i]] = stream.getNextIdatBits(3);
- }
- PngHuffmanTable codeLengthsTable = new PngHuffmanTable(lengthCodes);
-
- int[] literalLengths = readLengths(
- stream, literals, codeLengthsTable, LiteralTableSize);
- int[] distanceLengths = readLengths(
- stream, distances, codeLengthsTable, DistanceTableSize);
-
- literalTable = new PngHuffmanTable(literalLengths);
- distanceTable = new PngHuffmanTable(distanceLengths);
-}
-
-private int [] readLengths (PngDecodingDataStream stream,
- int numLengths,
- PngHuffmanTable lengthsTable,
- int tableSize)
-{
- int[] lengths = new int[tableSize];
-
- for (int index = 0; index < numLengths;) {
- int value = lengthsTable.getNextValue(stream);
- if (value < 16) {
- // Literal value
- lengths[index] = value;
- index++;
- } else if (value == 16) {
- // Repeat the previous code 3-6 times.
- int count = stream.getNextIdatBits(2) + 3;
- for (int i = 0; i < count; i++) {
- lengths[index] = lengths [index - 1];
- index++;
- }
- } else if (value == 17) {
- // Repeat 0 3-10 times.
- int count = stream.getNextIdatBits(3) + 3;
- for (int i = 0; i < count; i++) {
- lengths[index] = 0;
- index++;
- }
- } else if (value == 18) {
- // Repeat 0 11-138 times.
- int count = stream.getNextIdatBits(7) + 11;
- for (int i = 0; i < count; i++) {
- lengths[index] = 0;
- index++;
- }
- } else {
- stream.error();
- }
- }
- return lengths;
-}
-
-int getNextLiteralValue(PngDecodingDataStream stream) {
- return literalTable.getNextValue(stream);
-}
-
-int getNextDistanceValue(PngDecodingDataStream stream) {
- return distanceTable.getNextValue(stream);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIdatChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIdatChunk.java
deleted file mode 100755
index 8d0febe31e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIdatChunk.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-class PngIdatChunk extends PngChunk {
-
-PngIdatChunk(byte[] reference){
- super(reference);
-}
-
-/**
- * Answer whether the chunk is a valid IDAT chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
- if (!readState.readIHDR
- || (headerChunk.getMustHavePalette() && !readState.readPLTE)
- || readState.readIEND)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- readState.readIDAT = true;
- }
-
- super.validate(readState, headerChunk);
-}
-
-byte getDataByteAtOffset(int offset) {
- return reference[DATA_OFFSET + offset];
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIendChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIendChunk.java
deleted file mode 100755
index 899820a8d0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIendChunk.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-class PngIendChunk extends PngChunk {
-
-PngIendChunk(byte[] reference){
- super(reference);
-}
-
-/**
- * Answer whether the chunk is a valid IEND chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
- // An IEND chunk is invalid if no IHDR has been read.
- // Or if a palette is required and has not been read.
- // Or if no IDAT chunk has been read.
- if (!readState.readIHDR
- || (headerChunk.getMustHavePalette() && !readState.readPLTE)
- || !readState.readIDAT
- || readState.readIEND)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- readState.readIEND = true;
- }
-
- super.validate(readState, headerChunk);
-
- // IEND chunks are not allowed to have any data.
- if (getLength() > 0) SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
deleted file mode 100755
index 0941d91caa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Compatibility;
-
-class PngIhdrChunk extends PngChunk {
- static final int EXPECTED_DATA_LENGTH = 13;
-
- static final int WIDTH_DATA_OFFSET = DATA_OFFSET + 0;
- static final int HEIGHT_DATA_OFFSET = DATA_OFFSET + 4;
- static final int BIT_DEPTH_OFFSET = DATA_OFFSET + 8;
- static final int COLOR_TYPE_OFFSET = DATA_OFFSET + 9;
- static final int COMPRESSION_METHOD_OFFSET = DATA_OFFSET + 10;
- static final int FILTER_METHOD_OFFSET = DATA_OFFSET + 11;
- static final int INTERLACE_METHOD_OFFSET = DATA_OFFSET + 12;
-
- static final int COLOR_TYPE_GRAYSCALE = 0;
- static final int COLOR_TYPE_RGB = 2;
- static final int COLOR_TYPE_PALETTE = 3;
- static final int COLOR_TYPE_GRAYSCALE_WITH_ALPHA = 4;
- static final int COLOR_TYPE_RGB_WITH_ALPHA = 6;
-
- static final int INTERLACE_METHOD_NONE = 0;
- static final int INTERLACE_METHOD_ADAM7 = 1;
-
- static final int FILTER_NONE = 0;
- static final int FILTER_SUB = 1;
- static final int FILTER_UP = 2;
- static final int FILTER_AVERAGE = 3;
- static final int FILTER_PAETH = 4;
-
- static final byte[] ValidBitDepths = {1, 2, 4, 8, 16};
- static final byte[] ValidColorTypes = {0, 2, 3, 4, 6};
-
-/**
- * Construct a PNGChunk using the reference bytes
- * given.
- */
-PngIhdrChunk(byte[] reference) {
- super(reference);
-}
-
-/**
- * Get the image's width in pixels.
- */
-int getWidth() {
- return getInt32(WIDTH_DATA_OFFSET);
-}
-
-/**
- * Set the image's width in pixels.
- */
-void setWidth(int value) {
- setInt32(WIDTH_DATA_OFFSET, value);
-}
-
-/**
- * Get the image's height in pixels.
- */
-int getHeight() {
- return getInt32(HEIGHT_DATA_OFFSET);
-}
-
-/**
- * Set the image's height in pixels.
- */
-void setHeight(int value) {
- setInt32(HEIGHT_DATA_OFFSET, value);
-}
-
-/**
- * Get the image's bit depth.
- * This is limited to the values 1, 2, 4, 8, or 16.
- */
-byte getBitDepth() {
- return reference[BIT_DEPTH_OFFSET];
-}
-
-/**
- * Set the image's bit depth.
- * This is limited to the values 1, 2, 4, 8, or 16.
- */
-void setBitDepth(byte value) {
- reference[BIT_DEPTH_OFFSET] = value;
-}
-
-/**
- * Get the image's color type.
- * This is limited to the values:
- * 0 - Grayscale image.
- * 2 - RGB triple.
- * 3 - Palette.
- * 4 - Grayscale with Alpha channel.
- * 6 - RGB with Alpha channel.
- */
-byte getColorType() {
- return reference[COLOR_TYPE_OFFSET];
-}
-
-/**
- * Set the image's color type.
- * This is limited to the values:
- * 0 - Grayscale image.
- * 2 - RGB triple.
- * 3 - Palette.
- * 4 - Grayscale with Alpha channel.
- * 6 - RGB with Alpha channel.
- */
-void setColorType(byte value) {
- reference[COLOR_TYPE_OFFSET] = value;
-}
-
-/**
- * Get the image's compression method.
- * This value must be 0.
- */
-byte getCompressionMethod() {
- return reference[COMPRESSION_METHOD_OFFSET];
-}
-
-/**
- * Set the image's compression method.
- * This value must be 0.
- */
-void setCompressionMethod(byte value) {
- reference[COMPRESSION_METHOD_OFFSET] = value;
-}
-
-/**
- * Get the image's filter method.
- * This value must be 0.
- */
-byte getFilterMethod() {
- return reference[FILTER_METHOD_OFFSET];
-}
-
-/**
- * Set the image's filter method.
- * This value must be 0.
- */
-void setFilterMethod(byte value) {
- reference[FILTER_METHOD_OFFSET] = value;
-}
-
-/**
- * Get the image's interlace method.
- * This value is limited to:
- * 0 - No interlacing used.
- * 1 - Adam7 interlacing used.
- */
-byte getInterlaceMethod() {
- return reference[INTERLACE_METHOD_OFFSET];
-}
-
-/**
- * Set the image's interlace method.
- * This value is limited to:
- * 0 - No interlacing used.
- * 1 - Adam7 interlacing used.
- */
-void setInterlaceMethod(byte value) {
- reference[INTERLACE_METHOD_OFFSET] = value;
-}
-
-/**
- * Answer whether the chunk is a valid IHDR chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
- // An IHDR chunk is invalid if any other chunk has
- // been read.
- if (readState.readIHDR
- || readState.readPLTE
- || readState.readIDAT
- || readState.readIEND)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- readState.readIHDR = true;
- }
-
- super.validate(readState, headerChunk);
-
- if (getLength() != EXPECTED_DATA_LENGTH) SWT.error(SWT.ERROR_INVALID_IMAGE);
- if (getCompressionMethod() != 0) SWT.error(SWT.ERROR_INVALID_IMAGE);
- if (getInterlaceMethod() != INTERLACE_METHOD_NONE &&
- getInterlaceMethod() != INTERLACE_METHOD_ADAM7) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-
- boolean colorTypeIsValid = false;
- byte colorType = getColorType();
- for (int i = 0; i < ValidColorTypes.length; i++) {
- if (ValidColorTypes[i] == colorType) {
- colorTypeIsValid = true;
- break;
- }
- }
- if (!colorTypeIsValid) SWT.error(SWT.ERROR_INVALID_IMAGE);;
-
- boolean bitDepthIsValid = false;
- byte bitDepth = getBitDepth();
- for (int i = 0; i < ValidBitDepths.length; i++) {
- if (ValidBitDepths[i] == bitDepth) {
- bitDepthIsValid = true;
- break;
- }
- }
- if (!bitDepthIsValid) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- if ((colorType == COLOR_TYPE_RGB
- || colorType == COLOR_TYPE_RGB_WITH_ALPHA
- || colorType == COLOR_TYPE_GRAYSCALE_WITH_ALPHA)
- && bitDepth < 8)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-
- if (colorType == COLOR_TYPE_PALETTE && bitDepth > 8) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-}
-
-String getColorTypeString() {
- switch (getColorType()) {
- case COLOR_TYPE_GRAYSCALE: return "Grayscale";
- case COLOR_TYPE_RGB: return "RGB";
- case COLOR_TYPE_PALETTE: return "Palette";
- case COLOR_TYPE_GRAYSCALE_WITH_ALPHA: return "Grayscale with Alpha";
- case COLOR_TYPE_RGB_WITH_ALPHA: return "RGB with Alpha";
- default: return "Unknown - " + getColorType();
- }
-}
-
-String getFilterMethodString() {
- switch (getFilterMethod()) {
- case FILTER_NONE: return "None";
- case FILTER_SUB: return "Sub";
- case FILTER_UP: return "Up";
- case FILTER_AVERAGE: return "Average";
- case FILTER_PAETH: return "Paeth";
- default: return "Unknown";
- }
-}
-
-String getInterlaceMethodString() {
- switch (getInterlaceMethod()) {
- case INTERLACE_METHOD_NONE: return "Not Interlaced";
- case INTERLACE_METHOD_ADAM7: return "Interlaced - ADAM7";
- default: return "Unknown";
- }
-}
-
-void contributeToString(StringBuffer buffer) {
- buffer.append("\n\tWidth: ");
- buffer.append(getWidth());
- buffer.append("\n\tHeight: ");
- buffer.append(getHeight());
- buffer.append("\n\tBit Depth: ");
- buffer.append(getBitDepth());
- buffer.append("\n\tColor Type: ");
- buffer.append(getColorTypeString());
- buffer.append("\n\tCompression Method: ");
- buffer.append(getCompressionMethod());
- buffer.append("\n\tFilter Method: ");
- buffer.append(getFilterMethodString());
- buffer.append("\n\tInterlace Method: ");
- buffer.append(getInterlaceMethodString());
-}
-
-boolean getMustHavePalette() {
- return getColorType() == COLOR_TYPE_PALETTE;
-}
-
-boolean getCanHavePalette() {
- int colorType = getColorType();
- return colorType != COLOR_TYPE_GRAYSCALE &&
- colorType != COLOR_TYPE_GRAYSCALE_WITH_ALPHA;
-}
-
-/**
- * Answer the pixel size in bits based on the color type
- * and bit depth.
- */
-int getBitsPerPixel() {
- int bitDepth = getBitDepth();
- switch (getColorType()) {
- case COLOR_TYPE_RGB_WITH_ALPHA:
- return 4 * bitDepth;
- case COLOR_TYPE_RGB:
- return 3 * bitDepth;
- case COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- return 2 * bitDepth;
- case COLOR_TYPE_GRAYSCALE:
- case COLOR_TYPE_PALETTE:
- return bitDepth;
- default:
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return 0;
- }
-}
-
-/**
- * Answer the pixel size in bits based on the color type
- * and bit depth.
- */
-int getSwtBitsPerPixel() {
- int bitDepth = getBitDepth();
- switch (getColorType()) {
- case COLOR_TYPE_RGB_WITH_ALPHA:
- case COLOR_TYPE_RGB:
- case COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- return 24;
- case COLOR_TYPE_GRAYSCALE:
- case COLOR_TYPE_PALETTE:
- return Math.min(bitDepth, 8);
- default:
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return 0;
- }
-}
-
-int getFilterByteOffset() {
- if (getBitDepth() < 8) return 1;
- return getBitsPerPixel() / 8;
-}
-
-boolean usesDirectColor() {
- switch (getColorType()) {
- case COLOR_TYPE_GRAYSCALE:
- case COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- case COLOR_TYPE_RGB:
- case COLOR_TYPE_RGB_WITH_ALPHA:
- return true;
- default:
- return false;
- }
-}
-
-PaletteData createGrayscalePalette() {
- int bitDepth = Math.min(getBitDepth(), 8);
- int max = Compatibility.pow2(bitDepth) - 1;
- int delta = 255 / max;
- int gray = 0;
- RGB[] rgbs = new RGB[max + 1];
- for (int i = 0; i <= max; i++) {
- rgbs[i] = new RGB(gray, gray, gray);
- gray += delta;
- }
- return new PaletteData(rgbs);
-}
-
-PaletteData getPaletteData() {
- switch (getColorType()) {
- case COLOR_TYPE_GRAYSCALE:
- return createGrayscalePalette();
- case COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- case COLOR_TYPE_RGB:
- case COLOR_TYPE_RGB_WITH_ALPHA:
- return new PaletteData(0xFF0000, 0xFF00, 0xFF);
- default:
- return null;
- }
-}
-
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngLzBlockReader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngLzBlockReader.java
deleted file mode 100755
index a828aa965d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngLzBlockReader.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PngLzBlockReader {
- boolean readHeader;
- boolean isLastBlock;
- byte compressionType;
- int uncompressedBytesRemaining;
- PngDecodingDataStream stream;
- PngHuffmanTables huffmanTables;
-
- byte[] window;
- int windowIndex;
- int copyIndex;
- int copyBytesRemaining;
-
- static final int UNCOMPRESSED = 0;
- static final int COMPRESSED_FIXED = 1;
- static final int COMPRESSED_DYNAMIC = 2;
-
- static final int END_OF_COMPRESSED_BLOCK = 256;
- static final int FIRST_LENGTH_CODE = 257;
- static final int LAST_LENGTH_CODE = 285;
- static final int FIRST_DISTANCE_CODE = 1;
- static final int LAST_DISTANCE_CODE = 29;
- static final int FIRST_CODE_LENGTH_CODE = 4;
- static final int LAST_CODE_LENGTH_CODE = 19;
-
- static final int[] lengthBases = {
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27,
- 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258
- } ;
- static final int[] extraLengthBits = {
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0,
- };
- static final int[] distanceBases = {
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129,
- 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097,
- 6145, 8193, 12289, 16385, 24577,
- };
- static final int[] extraDistanceBits = {
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
- 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
- };
-
-
-PngLzBlockReader(PngDecodingDataStream stream) {
- this.stream = stream;
- readHeader = false;
- isLastBlock = false;
-}
-
-void setWindowSize(int windowSize) {
- window = new byte[windowSize];
-}
-
-void readNextBlockHeader() {
- isLastBlock = stream.getNextIdatBit() != 0;
- compressionType = (byte)(stream.getNextIdatBits(2) & 0xFF);
- if (compressionType > 2) stream.error();
-
- if (compressionType == UNCOMPRESSED) {
- byte b1 = stream.getNextIdatByte();
- byte b2 = stream.getNextIdatByte();
- byte b3 = stream.getNextIdatByte();
- byte b4 = stream.getNextIdatByte();
- if (b1 != ~b3 || b2 != ~b4) stream.error();
- uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8);
- } else if (compressionType == COMPRESSED_DYNAMIC) {
- huffmanTables = PngHuffmanTables.getDynamicTables(stream);
- } else {
- huffmanTables = PngHuffmanTables.getFixedTables();
- }
-}
-
-byte getNextByte() {
- if (compressionType == UNCOMPRESSED) {
- if (uncompressedBytesRemaining == 0) {
- readNextBlockHeader();
- return getNextByte();
- }
- uncompressedBytesRemaining--;
- return stream.getNextIdatByte();
- } else {
- byte value = getNextCompressedByte();
- if (value == END_OF_COMPRESSED_BLOCK) {
- if (isLastBlock) stream.error();
- readNextBlockHeader();
- return getNextByte();
- } else {
- return value;
- }
- }
-}
-
-private void assertBlockAtEnd() {
- if (compressionType == UNCOMPRESSED) {
- if (uncompressedBytesRemaining > 0) stream.error();
- } else if (copyBytesRemaining > 0 ||
- (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK))
- {
- stream.error();
- }
-}
-void assertCompressedDataAtEnd() {
- assertBlockAtEnd();
- while (!isLastBlock) {
- readNextBlockHeader();
- assertBlockAtEnd();
- }
-}
-
-private byte getNextCompressedByte() {
- if (copyBytesRemaining > 0) {
- byte value = window[copyIndex];
- byte temp = (byte) (value & 0xFF);
- window[windowIndex] = value;
- copyBytesRemaining--;
-
- copyIndex++;
- windowIndex++;
- if (copyIndex == window.length) copyIndex = 0;
- if (windowIndex == window.length) windowIndex = 0;
-
- return value;
- }
-
- int value = huffmanTables.getNextLiteralValue(stream);
- if (value < END_OF_COMPRESSED_BLOCK) {
- byte temp = (byte) (value & 0xFF);
- window[windowIndex] = (byte) (value & 0xFF);
- windowIndex++;
- if (windowIndex >= window.length) windowIndex = 0;
- return (byte) (value & 0xFF);
- } else if (value == END_OF_COMPRESSED_BLOCK) {
- readNextBlockHeader();
- return getNextCompressedByte();
- } else if (value <= LAST_LENGTH_CODE) {
- int extraBits = extraLengthBits[value - FIRST_LENGTH_CODE];
- int length = lengthBases[value - FIRST_LENGTH_CODE];
- if (extraBits > 0) {
- length += stream.getNextIdatBits(extraBits);
- }
-
- value = huffmanTables.getNextDistanceValue(stream);
- if (value > LAST_DISTANCE_CODE) stream.error();
- extraBits = extraDistanceBits[value];
- int distance = distanceBases[value];
- if (extraBits > 0) {
- distance += stream.getNextIdatBits(extraBits);
- }
-
- copyIndex = windowIndex - distance;
- if (copyIndex < 0) copyIndex += window.length;
-
- copyBytesRemaining = length;
- return getNextCompressedByte();
- } else {
- stream.error();
- return 0;
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
deleted file mode 100755
index e40a886129..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Compatibility;
-
-class PngPlteChunk extends PngChunk {
-
-PngPlteChunk(byte[] reference){
- super(reference);
-}
-
-/**
- * Get the number of colors in this palette.
- */
-int getPaletteSize() {
- return getLength() / 3;
-}
-
-/**
- * Get a PaletteData object representing the colors
- * stored in this PLTE chunk.
- * The result should be cached as the PLTE chunk
- * does not store the palette data created.
- */
-PaletteData getPaletteData() {
- RGB[] rgbs = new RGB[getPaletteSize()];
- int start = DATA_OFFSET;
- int end = DATA_OFFSET + getLength();
- for (int i = 0; i < rgbs.length; i++) {
- int offset = DATA_OFFSET + (i * 3);
- int red = reference[offset] & 0xFF;
- int green = reference[offset + 1] & 0xFF;
- int blue = reference[offset + 2] & 0xFF;
- rgbs[i] = new RGB(red, green, blue);
- }
- return new PaletteData(rgbs);
-}
-
-/**
- * Answer whether the chunk is a valid PLTE chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
- // A PLTE chunk is invalid if no IHDR has been read or if any PLTE,
- // IDAT, or IEND chunk has been read.
- if (!readState.readIHDR
- || readState.readPLTE
- || readState.readTRNS
- || readState.readBKGD
- || readState.readIDAT
- || readState.readIEND)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- readState.readPLTE = true;
- }
-
- super.validate(readState, headerChunk);
-
- // Palettes cannot be included in grayscale images.
- if (!headerChunk.getCanHavePalette()) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- // Palette chunks' data fields must be event multiples
- // of 3. Each 3-byte group represents an RGB value.
- if (getLength() % 3 != 0) SWT.error(SWT.ERROR_INVALID_IMAGE);
-
- // Palettes cannot have more entries than 2^bitDepth
- // where bitDepth is the bit depth of the image given
- // in the IHDR chunk.
- if (Compatibility.pow2(headerChunk.getBitDepth()) < getPaletteSize()) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-
- // Palettes cannot have more than 256 entries.
- if (256 < getPaletteSize()) SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-
-void contributeToString(StringBuffer buffer) {
- buffer.append("\n\tPalette size:");
- buffer.append(getPaletteSize());
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngTrnsChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngTrnsChunk.java
deleted file mode 100755
index e65f28e4d9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngTrnsChunk.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-public class PngTrnsChunk extends PngChunk {
- static final int TRANSPARENCY_TYPE_PIXEL = 0;
- static final int TRANSPARENCY_TYPE_ALPHAS = 1;
-
-PngTrnsChunk(byte[] reference){
- super(reference);
-}
-
-void validateLength(PngIhdrChunk header, PngPlteChunk paletteChunk) {
- boolean valid;
- switch (header.getColorType()) {
- case PngIhdrChunk.COLOR_TYPE_RGB:
- // Three 2-byte values (RGB)
- valid = getLength() == 6;
- break;
- case PngIhdrChunk.COLOR_TYPE_PALETTE:
- // Three 2-byte values (RGB)
- valid = getLength() <= paletteChunk.getLength();
- break;
- case PngIhdrChunk.COLOR_TYPE_GRAYSCALE:
- // One 2-byte value
- valid = getLength() == 2;
- break;
- // Cannot use both Alpha and tRNS
- case PngIhdrChunk.COLOR_TYPE_RGB_WITH_ALPHA:
- case PngIhdrChunk.COLOR_TYPE_GRAYSCALE_WITH_ALPHA:
- default:
- valid = false;
- }
- if (!valid) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
-}
-
-/**
- * Answer whether the chunk is a valid tRNS chunk.
- */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk, PngPlteChunk paletteChunk) {
- if (!readState.readIHDR
- || (headerChunk.getMustHavePalette() && !readState.readPLTE)
- || readState.readIDAT
- || readState.readIEND)
- {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } else {
- readState.readTRNS = true;
- }
-
- validateLength(headerChunk, paletteChunk);
-
- super.validate(readState, headerChunk);
-}
-
-
-int getTransparencyType(PngIhdrChunk header) {
- if (header.getColorType() == PngIhdrChunk.COLOR_TYPE_PALETTE) {
- return TRANSPARENCY_TYPE_ALPHAS;
- }
- return TRANSPARENCY_TYPE_PIXEL;
-}
-
-/**
- * Answer the transparent pixel RGB value.
- * This is not valid for palette color types.
- * This is not valid for alpha color types.
- * This will convert a grayscale value into
- * a palette index.
- * It will compress a 6 byte RGB into a 3 byte
- * RGB.
- */
-int getSwtTransparentPixel(PngIhdrChunk header) {
- switch (header.getColorType()) {
- case PngIhdrChunk.COLOR_TYPE_GRAYSCALE:
- int gray = ((reference[DATA_OFFSET] & 0xFF) << 8)
- + (reference[DATA_OFFSET + 1] & 0xFF);
- if (header.getBitDepth() > 8) {
- return PNGFileFormat.compress16BitDepthTo8BitDepth(gray);
- }
- return gray & 0xFF;
- case PngIhdrChunk.COLOR_TYPE_RGB:
- int red = ((reference[DATA_OFFSET] & 0xFF) << 8)
- | (reference[DATA_OFFSET + 1] & 0xFF);
- int green = ((reference[DATA_OFFSET + 2] & 0xFF) << 8)
- | (reference[DATA_OFFSET + 3] & 0xFF);
- int blue = ((reference[DATA_OFFSET + 4] & 0xFF) << 8)
- | (reference[DATA_OFFSET + 5] & 0xFF);
- if (header.getBitDepth() > 8) {
- red = PNGFileFormat.compress16BitDepthTo8BitDepth(red);
- green = PNGFileFormat.compress16BitDepthTo8BitDepth(green);
- blue = PNGFileFormat.compress16BitDepthTo8BitDepth(blue);
- }
- return (red << 16) | (green << 8) | blue;
- default:
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return -1;
- }
-}
-
-/**
- * Answer an array of Alpha values that correspond to the
- * colors in the palette.
- * This is only valid for the COLOR_TYPE_PALETTE color type.
- */
-byte[] getAlphaValues(PngIhdrChunk header, PngPlteChunk paletteChunk) {
- if (header.getColorType() != PngIhdrChunk.COLOR_TYPE_PALETTE) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- byte[] alphas = new byte[paletteChunk.getPaletteSize()];
- int dataLength = getLength();
- int i = 0;
- for (i = 0; i < dataLength; i++) {
- alphas[i] = reference[DATA_OFFSET + i];
- }
- /**
- * Any palette entries which do not have a corresponding
- * alpha value in the tRNS chunk are spec'd to have an
- * alpha of 255.
- */
- for (int j = i; j < alphas.length; j++) {
- alphas[j] = (byte) 255;
- }
- return alphas;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinBMPFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinBMPFileFormat.java
deleted file mode 100755
index 14c713d342..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinBMPFileFormat.java
+++ /dev/null
@@ -1,664 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-final class WinBMPFileFormat extends FileFormat {
- int compression;
- int importantColors;
- Point pelsPerMeter = new Point(0, 0);
- public static final int BMPHeaderFixedSize = 40;
-
-/**
- * Compress numBytes bytes of image data from src, storing in dest
- * (starting at 0), using the technique specified by comp.
- * If last is true, this indicates the last line of the image.
- * Answer the size of the compressed data.
- */
-int compress(int comp, byte[] src, int srcOffset, int numBytes, byte[] dest, boolean last) {
- if (comp == 1) { // BMP_RLE8_COMPRESSION
- return compressRLE8Data(src, srcOffset, numBytes, dest, last);
- }
- if (comp == 2) { // BMP_RLE4_COMPRESSION
- return compressRLE4Data(src, srcOffset, numBytes, dest, last);
- }
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return 0;
-}
-int compressRLE4Data(byte[] src, int srcOffset, int numBytes, byte[] dest, boolean last) {
- int sp = srcOffset, end = srcOffset + numBytes, dp = 0;
- int size = 0, left, i, n;
- byte theByte;
- while (sp < end) {
- /* find two consecutive bytes that are the same in the next 128 */
- left = end - sp - 1;
- if (left > 127)
- left = 127;
- for (n = 0; n < left; n++) {
- if (src[sp + n] == src[sp + n + 1])
- break;
- }
- /* if there is only one more byte in the scan line, include it */
- if (n < 127 && n == left)
- n++;
- /* store the intervening data */
- switch (n) {
- case 0:
- break;
- case 1: /* handled separately because 0,2 is a command */
- dest[dp] = 2; dp++; /* 1 byte == 2 pixels */
- dest[dp] = src[sp];
- dp++; sp++;
- size += 2;
- break;
- default:
- dest[dp] = 0; dp++;
- dest[dp] = (byte)(n + n); dp++; /* n bytes = n*2 pixels */
- for (i = n; i > 0; i--) {
- dest[dp] = src[sp];
- dp++; sp++;
- }
- size += 2 + n;
- if ((n & 1) != 0) { /* pad to word */
- dest[dp] = 0;
- dp++;
- size++;
- }
- break;
- }
- /* find the length of the next run (up to 127) and store it */
- left = end - sp;
- if (left > 0) {
- if (left > 127)
- left = 127;
- theByte = src[sp];
- for (n = 1; n < left; n++) {
- if (src[sp + n] != theByte)
- break;
- }
- dest[dp] = (byte)(n + n); dp++; /* n bytes = n*2 pixels */
- dest[dp] = theByte; dp++;
- sp += n;
- size += 2;
- }
- }
-
- /* store the end of line or end of bitmap codes */
- dest[dp] = 0; dp++;
- if (last) {
- dest[dp] = 1; dp++;
- } else {
- dest[dp] = 0; dp++;
- }
- size += 2;
-
- return size;
-}
-int compressRLE8Data(byte[] src, int srcOffset, int numBytes, byte[] dest, boolean last) {
- int sp = srcOffset, end = srcOffset + numBytes, dp = 0;
- int size = 0, left, i, n;
- byte theByte;
- while (sp < end) {
- /* find two consecutive bytes that are the same in the next 256 */
- left = end - sp - 1;
- if (left > 254)
- left = 254;
- for (n = 0; n < left; n++) {
- if (src[sp + n] == src[sp + n + 1])
- break;
- }
- /* if there is only one more byte in the scan line, include it */
- if (n == left)
- n++;
- /* store the intervening data */
- switch (n) {
- case 0:
- break;
- case 2: /* handled separately because 0,2 is a command */
- dest[dp] = 1; dp++;
- dest[dp] = src[sp];
- dp++; sp++;
- size += 2;
- /* don't break, fall through */
- case 1: /* handled separately because 0,1 is a command */
- dest[dp] = 1; dp++;
- dest[dp] = src[sp];
- dp++; sp++;
- size += 2;
- break;
- default:
- dest[dp] = 0; dp++;
- dest[dp] = (byte)n; dp++;
- for (i = n; i > 0; i--) {
- dest[dp] = src[sp];
- dp++; sp++;
- }
- size += 2 + n;
- if ((n & 1) != 0) { /* pad to word */
- dest[dp] = 0;
- dp++;
- size++;
- }
- break;
- }
- /* find the length of the next run (up to 255) and store it */
- left = end - sp;
- if (left > 0) {
- if (left > 255)
- left = 255;
- theByte = src[sp];
- for (n = 1; n < left; n++) {
- if (src[sp + n] != theByte)
- break;
- }
- dest[dp] = (byte)n; dp++;
- dest[dp] = theByte; dp++;
- sp += n;
- size += 2;
- }
- }
-
- /* store the end of line or end of bitmap codes */
- dest[dp] = 0; dp++;
- if (last) {
- dest[dp] = 1; dp++;
- } else {
- dest[dp] = 0; dp++;
- }
- size += 2;
-
- return size;
-}
-void decompressData(byte[] src, byte[] dest, int stride, int cmp) {
- if (cmp == 1) { // BMP_RLE8_COMPRESSION
- if (decompressRLE8Data(src, src.length, stride, dest, dest.length) <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return;
- }
- if (cmp == 2) { // BMP_RLE4_COMPRESSION
- if (decompressRLE4Data(src, src.length, stride, dest, dest.length) <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return;
- }
- SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-int decompressRLE4Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
- int sp = 0;
- int se = numBytes;
- int dp = 0;
- int de = destSize;
- int x = 0, y = 0;
- while (sp < se) {
- int len = src[sp] & 0xFF;
- sp++;
- if (len == 0) {
- len = src[sp] & 0xFF;
- sp++;
- switch (len) {
- case 0: /* end of line */
- y++;
- x = 0;
- dp = y * stride;
- if (dp >= de)
- return -1;
- break;
- case 1: /* end of bitmap */
- return 1;
- case 2: /* delta */
- x += src[sp] & 0xFF;
- sp++;
- y += src[sp] & 0xFF;
- sp++;
- dp = y * stride + x / 2;
- if (dp >= de)
- return -1;
- break;
- default: /* absolute mode run */
- if ((len & 1) != 0) /* odd run lengths not currently supported */
- return -1;
- x += len;
- len = len / 2;
- if (len > (se - sp))
- return -1;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = src[sp];
- dp++;
- sp++;
- }
- if ((sp & 1) != 0)
- sp++; /* word align sp? */
- break;
- }
- } else {
- if ((len & 1) != 0)
- return -1;
- x += len;
- len = len / 2;
- byte theByte = src[sp];
- sp++;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = theByte;
- dp++;
- }
- }
- }
- return 1;
-}
-int decompressRLE8Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
- int sp = 0;
- int se = numBytes;
- int dp = 0;
- int de = destSize;
- int x = 0, y = 0;
- while (sp < se) {
- int len = src[sp] & 0xFF;
- sp++;
- if (len == 0) {
- len = src[sp] & 0xFF;
- sp++;
- switch (len) {
- case 0: /* end of line */
- y++;
- x = 0;
- dp = y * stride;
- if (dp >= de)
- return -1;
- break;
- case 1: /* end of bitmap */
- return 1;
- case 2: /* delta */
- x += src[sp] & 0xFF;
- sp++;
- y += src[sp] & 0xFF;
- sp++;
- dp = y * stride + x;
- if (dp >= de)
- return -1;
- break;
- default: /* absolute mode run */
- if (len > (se - sp))
- return -1;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = src[sp];
- dp++;
- sp++;
- }
- if ((sp & 1) != 0)
- sp++; /* word align sp? */
- x += len;
- break;
- }
- } else {
- byte theByte = src[sp];
- sp++;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = theByte;
- dp++;
- }
- x += len;
- }
- }
- return 1;
-}
-public static boolean isBMPFile(LEDataInputStream stream) {
- try {
- byte[] header = new byte[2];
- stream.read(header);
- stream.unread(header);
- return header[0] == 0x42 && header[1] == 0x4D;
- } catch (Exception e) {
- return false;
- }
-}
-byte[] loadData(byte[] infoHeader) {
- int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- int stride = (width * bitCount + 7) / 8;
- stride = (stride + 3) / 4 * 4; // Round up to 4 byte multiple
- byte[] data = loadData(infoHeader, stride);
- flipScanLines(data, stride, height);
- return data;
-}
-byte[] loadData(byte[] infoHeader, int stride) {
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int dataSize = height * stride;
- byte[] data = new byte[dataSize];
- int cmp = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
- if (cmp == 0) { // BMP_NO_COMPRESSION
- try {
- if (inputStream.read(data) != dataSize)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- } else {
- int compressedSize = (infoHeader[20] & 0xFF) | ((infoHeader[21] & 0xFF) << 8) | ((infoHeader[22] & 0xFF) << 16) | ((infoHeader[23] & 0xFF) << 24);
- byte[] compressed = new byte[compressedSize];
- try {
- if (inputStream.read(compressed) != compressedSize)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- decompressData(compressed, data, stride, cmp);
- }
- return data;
-}
-int[] loadFileHeader() {
- int[] header = new int[5];
- try {
- header[0] = inputStream.readShort();
- header[1] = inputStream.readInt();
- header[2] = inputStream.readShort();
- header[3] = inputStream.readShort();
- header[4] = inputStream.readInt();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (header[0] != 0x4D42)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return header;
-}
-ImageData[] loadFromByteStream() {
- int[] fileHeader = loadFileHeader();
- byte[] infoHeader = new byte[BMPHeaderFixedSize];
- try {
- inputStream.read(infoHeader);
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- PaletteData palette = loadPalette(infoHeader);
- if (inputStream.getPosition() < fileHeader[4]) {
- // Seek to the specified offset
- try {
- inputStream.skip(fileHeader[4] - inputStream.getPosition());
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
- byte[] data = loadData(infoHeader);
- this.compression = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
- this.importantColors = (infoHeader[36] & 0xFF) | ((infoHeader[37] & 0xFF) << 8) | ((infoHeader[38] & 0xFF) << 16) | ((infoHeader[39] & 0xFF) << 24);
- int xPelsPerMeter = (infoHeader[24] & 0xFF) | ((infoHeader[25] & 0xFF) << 8) | ((infoHeader[26] & 0xFF) << 16) | ((infoHeader[27] & 0xFF) << 24);
- int yPelsPerMeter = (infoHeader[28] & 0xFF) | ((infoHeader[29] & 0xFF) << 8) | ((infoHeader[30] & 0xFF) << 16) | ((infoHeader[31] & 0xFF) << 24);
- this.pelsPerMeter = new Point(xPelsPerMeter, yPelsPerMeter);
- int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- int type = (this.compression == 1 /*BMP_RLE8_COMPRESSION*/) || (this.compression == 2 /*BMP_RLE4_COMPRESSION*/) ? SWT.IMAGE_BMP_RLE : SWT.IMAGE_BMP;
- return new ImageData[] {
- ImageData.internal_new(
- width,
- height,
- bitCount,
- palette,
- 4,
- data,
- 0,
- null,
- null,
- -1,
- -1,
- type,
- 0,
- 0,
- 0,
- 0)
- };
-}
-PaletteData loadPalette(byte[] infoHeader) {
- int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- if (depth <= 8) {
- int numColors = (infoHeader[32] & 0xFF) | ((infoHeader[33] & 0xFF) << 8) | ((infoHeader[34] & 0xFF) << 16) | ((infoHeader[35] & 0xFF) << 24);
- if (numColors == 0) {
- numColors = 1 << ((infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8));
- } else {
- if (numColors > 256)
- numColors = 256;
- }
- byte[] buf = new byte[numColors * 4];
- try {
- if (inputStream.read(buf) != buf.length)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return paletteFromBytes(buf, numColors);
- }
- if (depth == 16)
- return new PaletteData(0x7C00, 0x3E0, 0x1F);
- return new PaletteData(0xFF, 0xFF00, 0xFF0000);
-}
-PaletteData paletteFromBytes(byte[] bytes, int numColors) {
- int bytesOffset = 0;
- RGB[] colors = new RGB[numColors];
- for (int i = 0; i < numColors; i++) {
- colors[i] = new RGB(bytes[bytesOffset + 2] & 0xFF,
- bytes[bytesOffset + 1] & 0xFF,
- bytes[bytesOffset] & 0xFF);
- bytesOffset += 4;
- }
- return new PaletteData(colors);
-}
-/**
- * Answer a byte array containing the BMP representation of
- * the given device independent palette.
- */
-byte[] paletteToBytes(PaletteData pal) {
- int n = (pal.colors.length < 256) ? pal.colors.length : 256;
- byte[] bytes = new byte[n * 4];
- int offset = 0;
- for (int i = 0; i < n; i++) {
- RGB col = pal.colors[i];
- bytes[offset] = (byte)col.blue;
- bytes[offset + 1] = (byte)col.green;
- bytes[offset + 2] = (byte)col.red;
- offset += 4;
- }
- return bytes;
-}
-/**
- * Unload the given image's data into the given byte stream
- * using the given compression strategy.
- * Answer the number of bytes written.
- */
-int unloadData(ImageData image, OutputStream out, int comp) {
- int totalSize = 0;
- try {
- if (comp == 0)
- return unloadDataNoCompression(image, out);
- int bpl = (image.width * image.depth + 7) / 8;
- int bmpBpl = (bpl + 3) / 4 * 4; // BMP pads scanlines to multiples of 4 bytes
- int imageBpl = image.bytesPerLine;
- // Compression can actually take twice as much space, in worst case
- byte[] buf = new byte[bmpBpl * 2];
- int srcOffset = imageBpl * (image.height - 1); // Start at last line
- byte[] data = image.data;
- totalSize = 0;
- byte[] buf2 = new byte[32768];
- int buf2Offset = 0;
- for (int y = image.height - 1; y >= 0; y--) {
- int lineSize = compress(comp, data, srcOffset, bpl, buf, y == 0);
- if (buf2Offset + lineSize > buf2.length) {
- out.write(buf2, 0, buf2Offset);
- buf2Offset = 0;
- }
- System.arraycopy(buf, 0, buf2, buf2Offset, lineSize);
- buf2Offset += lineSize;
- totalSize += lineSize;
- srcOffset -= imageBpl;
- }
- if (buf2Offset > 0)
- out.write(buf2, 0, buf2Offset);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return totalSize;
-}
-/**
- * Prepare the given image's data for unloading into a byte stream
- * using no compression strategy.
- * Answer the number of bytes written.
- */
-int unloadDataNoCompression(ImageData image, OutputStream out) {
- int bmpBpl = 0;
- try {
- int bpl = (image.width * image.depth + 7) / 8;
- bmpBpl = (bpl + 3) / 4 * 4; // BMP pads scanlines to multiples of 4 bytes
- int linesPerBuf = 32678 / bmpBpl;
- byte[] buf = new byte[linesPerBuf * bmpBpl];
- byte[] data = image.data;
- int imageBpl = image.bytesPerLine;
- int dataIndex = imageBpl * (image.height - 1); // Start at last line
- if (image.depth == 16) {
- for (int y = 0; y < image.height; y += linesPerBuf) {
- int count = image.height - y;
- if (linesPerBuf < count) count = linesPerBuf;
- int bufOffset = 0;
- for (int i = 0; i < count; i++) {
- for (int wIndex = 0; wIndex < bpl; wIndex += 2) {
- buf[bufOffset + wIndex + 1] = data[dataIndex + wIndex + 1];
- buf[bufOffset + wIndex] = data[dataIndex + wIndex];
- }
- bufOffset += bmpBpl;
- dataIndex -= imageBpl;
- }
- out.write(buf, 0, bufOffset);
- }
- } else {
- for (int y = 0; y < image.height; y += linesPerBuf) {
- int tmp = image.height - y;
- int count = tmp < linesPerBuf ? tmp : linesPerBuf;
- int bufOffset = 0;
- for (int i = 0; i < count; i++) {
- System.arraycopy(data, dataIndex, buf, bufOffset, bpl);
- bufOffset += bmpBpl;
- dataIndex -= imageBpl;
- }
- out.write(buf, 0, bufOffset);
- }
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return bmpBpl * image.height;
-}
-/**
- * Unload a DeviceIndependentImage using Windows .BMP format into the given
- * byte stream.
- */
-void unloadIntoByteStream(ImageData image) {
- byte[] rgbs;
- int numCols;
- if (!((image.depth == 1) || (image.depth == 4) || (image.depth == 8) ||
- (image.depth == 16) || (image.depth == 24)))
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- int comp = this.compression;
- if (!((comp == 0) || ((comp == 1) && (image.depth == 8)) ||
- ((comp == 2) && (image.depth == 4))))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- PaletteData pal = image.palette;
- if ((image.depth == 16) || (image.depth == 24)) {
- if (!pal.isDirect)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- numCols = 0;
- rgbs = null;
- } else {
- if (pal.isDirect)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- numCols = pal.colors.length;
- rgbs = paletteToBytes(pal);
- }
- // Fill in file header, except for bfsize, which is done later.
- int headersSize = 54;
- int[] fileHeader = new int[5];
- fileHeader[0] = 0x4D42; // Signature
- fileHeader[1] = 0; // File size - filled in later
- fileHeader[2] = 0; // Reserved 1
- fileHeader[3] = 0; // Reserved 2
- fileHeader[4] = headersSize; // Offset to data
- if (rgbs != null) {
- fileHeader[4] += rgbs.length;
- }
-
- // Prepare data. This is done first so we don't have to try to rewind
- // the stream and fill in the details later.
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- unloadData(image, out, comp);
- byte[] compressedData = out.toByteArray();
-
- // Calculate file size
- fileHeader[1] = fileHeader[4] + compressedData.length;
-
- // Write the headers
- try {
- outputStream.writeShort(fileHeader[0]);
- outputStream.writeInt(fileHeader[1]);
- outputStream.writeShort(fileHeader[2]);
- outputStream.writeShort(fileHeader[3]);
- outputStream.writeInt(fileHeader[4]);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- try {
- outputStream.writeInt(WinBMPFileFormat.BMPHeaderFixedSize);
- outputStream.writeInt(image.width);
- outputStream.writeInt(image.height);
- outputStream.writeShort(1);
- outputStream.writeShort((short)image.depth);
- outputStream.writeInt(comp);
- outputStream.writeInt(compressedData.length);
- outputStream.writeInt(pelsPerMeter.x);
- outputStream.writeInt(pelsPerMeter.y);
- outputStream.writeInt(numCols);
- outputStream.writeInt(importantColors);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-
- // Unload palette
- if (numCols > 0) {
- try {
- outputStream.write(rgbs);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
-
- // Unload the data
- try {
- outputStream.write(compressedData);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-void flipScanLines(byte[] data, int stride, int height) {
- int i1 = 0;
- int i2 = (height - 1) * stride;
- for (int i = 0; i < height / 2; i++) {
- for (int index = 0; index < stride; index++) {
- byte b = data[index + i1];
- data[index + i1] = data[index + i2];
- data[index + i2] = b;
- }
- i1 += stride;
- i2 -= stride;
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java
deleted file mode 100755
index 3952169710..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package org.eclipse.swt.internal.image;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-final class WinICOFileFormat extends FileFormat {
-/**
- * Answer the size in bytes of the file representation of the given
- * icon
- */
-int iconSize(ImageData i) {
- int shapeDataStride = (i.width * i.depth + 31) / 32 * 4;
- int maskDataStride = (i.width + 31) / 32 * 4;
- int dataSize = (shapeDataStride + maskDataStride) * i.height;
- return WinBMPFileFormat.BMPHeaderFixedSize + (i.palette.colors.length * 4) + dataSize;
-}
-public static boolean isICOFile(LEDataInputStream stream) {
- try {
- byte[] header = new byte[4];
- stream.read(header);
- stream.unread(header);
- return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0;
- } catch (Exception e) {
- return false;
- }
-}
-boolean isValidIcon(ImageData i) {
- if (!((i.depth == 1) || (i.depth == 4) || (i.depth == 8)))
- return false;
- int size = i.palette.colors.length;
- return ((size == 2) || (size == 16) || (size == 32) || (size == 256));
-}
-int loadFileHeader(LEDataInputStream byteStream) {
- int[] fileHeader = new int[3];
- try {
- fileHeader[0] = byteStream.readShort();
- fileHeader[1] = byteStream.readShort();
- fileHeader[2] = byteStream.readShort();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int numIcons = fileHeader[2];
- if (numIcons <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return numIcons;
-}
-int loadFileHeader(LEDataInputStream byteStream, boolean hasHeader) {
- int[] fileHeader = new int[3];
- try {
- if (hasHeader) {
- fileHeader[0] = byteStream.readShort();
- fileHeader[1] = byteStream.readShort();
- } else {
- fileHeader[0] = 0;
- fileHeader[1] = 1;
- }
- fileHeader[2] = byteStream.readShort();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int numIcons = fileHeader[2];
- if (numIcons <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return numIcons;
-}
-ImageData[] loadFromByteStream() {
- int numIcons = loadFileHeader(inputStream);
- int[][] headers = loadIconHeaders(numIcons);
- ImageData[] icons = new ImageData[headers.length];
- for (int i = 0; i < icons.length; i++) {
- icons[i] = loadIcon(headers[i]);
- }
- return icons;
-}
-/**
- * Load one icon from the byte stream.
- */
-ImageData loadIcon(int[] iconHeader) {
- byte[] infoHeader = loadInfoHeader(iconHeader);
- WinBMPFileFormat bmpFormat = new WinBMPFileFormat();
- bmpFormat.inputStream = inputStream;
- PaletteData palette = bmpFormat.loadPalette(infoHeader);
- byte[] shapeData = bmpFormat.loadData(infoHeader);
- int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- infoHeader[14] = 1;
- infoHeader[15] = 0;
- byte[] maskData = bmpFormat.loadData(infoHeader);
- bitInvertData(maskData, 0, maskData.length);
- int infoWidth = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- return ImageData.internal_new(
- infoWidth,
- infoHeight,
- depth,
- palette,
- 4,
- shapeData,
-// 4,
- 2,
- maskData,
- null,
- -1,
- -1,
- SWT.IMAGE_ICO,
- 0,
- 0,
- 0,
- 0);
-}
-int[][] loadIconHeaders(int numIcons) {
- int[][] headers = new int[numIcons][7];
- try {
- for (int i = 0; i < numIcons; i++) {
- headers[i][0] = inputStream.read();
- headers[i][1] = inputStream.read();
- headers[i][2] = inputStream.readShort();
- headers[i][3] = inputStream.readShort();
- headers[i][4] = inputStream.readShort();
- headers[i][5] = inputStream.readInt();
- headers[i][6] = inputStream.readInt();
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return headers;
-}
-byte[] loadInfoHeader(int[] iconHeader) {
- int width = iconHeader[0];
- int height = iconHeader[1];
- int numColors = iconHeader[2]; // the number of colors is in the low byte, but the high byte must be 0
- if (numColors == 0) numColors = 256; // this is specified: '00' represents '256' (0x100) colors
- if ((numColors != 2) && (numColors != 8) && (numColors != 16) &&
- (numColors != 32) && (numColors != 256))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- if (inputStream.getPosition() < iconHeader[6]) {
- // Seek to the specified offset
- try {
- inputStream.skip(iconHeader[6] - inputStream.getPosition());
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
- byte[] infoHeader = new byte[WinBMPFileFormat.BMPHeaderFixedSize];
- try {
- inputStream.read(infoHeader);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (((infoHeader[12] & 0xFF) | ((infoHeader[13] & 0xFF) << 8)) != 1)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int infoWidth = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- if (height == infoHeight && bitCount == 1) height /= 2;
- if (!((width == infoWidth) && (height * 2 == infoHeight) &&
- ((bitCount == 1) || (bitCount == 4) || (bitCount == 8))))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- infoHeader[8] = (byte)(height & 0xFF);
- infoHeader[9] = (byte)((height >> 8) & 0xFF);
- infoHeader[10] = (byte)((height >> 16) & 0xFF);
- infoHeader[11] = (byte)((height >> 24) & 0xFF);
- return infoHeader;
-}
-/**
- * Unload a single icon
- */
-void unloadIcon(ImageData icon) {
- int sizeImage = (((icon.width * icon.depth + 31) / 32 * 4) +
- ((icon.width + 31) / 32 * 4)) * icon.height;
- try {
- outputStream.writeInt(WinBMPFileFormat.BMPHeaderFixedSize);
- outputStream.writeInt(icon.width);
- outputStream.writeInt(icon.height * 2);
- outputStream.writeShort(1);
- outputStream.writeShort((short)icon.depth);
- outputStream.writeInt(0);
- outputStream.writeInt(sizeImage);
- outputStream.writeInt(0);
- outputStream.writeInt(0);
- outputStream.writeInt(icon.palette.colors.length);
- outputStream.writeInt(0);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-
- byte[] rgbs = new WinBMPFileFormat().paletteToBytes(icon.palette);
- try {
- outputStream.write(rgbs);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- unloadShapeData(icon);
- unloadMaskData(icon);
-}
-/**
- * Unload the icon header for the given icon, calculating the offset.
- */
-void unloadIconHeader(ImageData i) {
- int headerSize = 16;
- int offset = headerSize + 6;
- int iconSize = iconSize(i);
- try {
- outputStream.writeByte((byte)i.width);
- outputStream.writeByte((byte)i.height);
- outputStream.writeShort(i.palette.colors.length);
- outputStream.writeShort(0);
- outputStream.writeShort(0);
- outputStream.writeInt(iconSize);
- outputStream.writeInt(offset);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-void unloadIntoByteStream(ImageData image) {
- if (!isValidIcon(image))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- try {
- outputStream.writeShort(0);
- outputStream.writeShort(1);
- outputStream.writeShort(1);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- unloadIconHeader(image);
- unloadIcon(image);
-}
-/**
- * Unload the mask data for an icon. The data is flipped vertically
- * and inverted.
- */
-void unloadMaskData(ImageData icon) {
- int bpl = (icon.width + 7) / 8;
- int pad = 4;
- int srcBpl = (bpl + pad - 1) / pad * pad;
- int destBpl = (bpl + 3) / 4 * 4;
- byte[] buf = new byte[destBpl];
- int offset = (icon.height - 1) * srcBpl;
- byte[] data = icon.getTransparencyMask().data;
- try {
- for (int i = 0; i < icon.height; i++) {
- System.arraycopy(data, offset, buf, 0, bpl);
- bitInvertData(buf, 0, bpl);
- outputStream.write(buf, 0, destBpl);
- offset -= srcBpl;
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-/**
- * Unload the shape data for an icon. The data is flipped vertically.
- */
-void unloadShapeData(ImageData icon) {
- int bpl = (icon.width * icon.depth + 7) / 8;
- int pad = 4;
- int srcBpl = (bpl + pad - 1) / pad * pad;
- int destBpl = (bpl + 3) / 4 * 4;
- byte[] buf = new byte[destBpl];
- int offset = (icon.height - 1) * srcBpl;
- byte[] data = icon.data;
- try {
- for (int i = 0; i < icon.height; i++) {
- System.arraycopy(data, offset, buf, 0, bpl);
- outputStream.write(buf, 0, destBpl);
- offset -= srcBpl;
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/package.html
deleted file mode 100755
index 62fccda519..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/package.html
+++ /dev/null
@@ -1,18 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT internal image loading/saving support classes.
-<h2>
-Package Specification</h2>
-This package contains the classes used by SWT to load and save images
-in the various formats we support, including GIF, JPEG, PNG, BMP, and ICO.
-<p>
-Applications should not need to reference the classes in this package
-directly.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/package.html
deleted file mode 100755
index da0cec585e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/package.html
+++ /dev/null
@@ -1,20 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT internal classes
-<h2>
-Package Specification</h2>
-This package provides the <code>Callback</code> class which is used to
-map the operating system's callback mechanism to Java message sends, and
-the <code>Converter</code> class which provides translation between Unicode
-and platform specific character sets.
-<p>
-Applications should not need to reference the classes in this package
-directly.
-</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java
deleted file mode 100755
index 051568f4d2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.layout;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public final class FillLayout extends Layout {
- /**
- * type specifies how controls will be positioned
- * within the layout.
- *
- * The default value is HORIZONTAL.
- *
- * Possible values are:
- *
- * HORIZONTAL: Position the controls horizontally from left to right
- * VERTICAL: Position the controls vertically from top to bottom
- */
- public int type = SWT.HORIZONTAL;
-public FillLayout () {
-}
-protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
- if (type == SWT.HORIZONTAL) {
- return new Point (count * maxWidth, maxHeight);
- }
- return new Point (maxWidth, count * maxHeight);
-}
-protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect = composite.getClientArea ();
- Control [] children = composite.getChildren ();
- int count = children.length;
- if (count == 0) return;
- if (type == SWT.HORIZONTAL) {
- int x = rect.x + ((rect.width % count) / 2);
- int width = rect.width / count;
- int y = rect.y, height = rect.height;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- child.setBounds (x, y, width, height);
- x += width;
- }
- return;
- }
- int x = rect.x, width = rect.width;
- int y = rect.y + ((rect.height % count) / 2);
- int height = rect.height / count;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- child.setBounds (x, y, width, height);
- y += height;
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
deleted file mode 100755
index 79fe0a1002..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.layout;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public final class GridData {
- /**
- * verticalAlignment specifies how controls will be positioned
- * vertically within a cell.
- *
- * The default value is CENTER.
- *
- * Possible values are:
- *
- * BEGINNING: Position the control at the top of the cell
- * CENTER: Position the control in the vertical center of the cell
- * END: Position the control at the bottom of the cell
- * FILL: Resize the control to fill the cell vertically
- */
- public int verticalAlignment = CENTER;
- /**
- * horizontalAlignment specifies how controls will be positioned
- * horizontally within a cell.
- *
- * The default value is BEGINNING.
- *
- * Possible values are:
- *
- * BEGINNING: Position the control at the left of the cell
- * CENTER: Position the control in the horizontal center of the cell
- * END: Position the control at the right of the cell
- * FILL: Resize the control to fill the cell horizontally
- */
- public int horizontalAlignment = BEGINNING;
- /**
- * widthHint specifies a minimum width for the column. A value of
- * SWT.DEFAULT indicates that no minimum width is specified.
- *
- * The default value is SWT.DEFAULT.
- */
- public int widthHint = SWT.DEFAULT;
- /**
- * heightHint specifies a minimum height for the row. A value of
- * SWT.DEFAULT indicates that no minimum height is specified.
- *
- * The default value is SWT.DEFAULT.
- */
- public int heightHint = SWT.DEFAULT;
- /**
- * horizontalIndent specifies the number of pixels of indentation
- * that will be placed along the left side of the cell.
- *
- * The default value is 0.
- */
- public int horizontalIndent = 0;
- /**
- * horizontalSpan specifies the number of column cells that the control
- * will take up.
- *
- * The default value is 1.
- */
- public int horizontalSpan = 1;
- /**
- * verticalSpan specifies the number of row cells that the control
- * will take up.
- *
- * The default value is 1.
- */
- public int verticalSpan = 1;
- /**
- * grabExcessHorizontalSpace specifies whether the cell will be made
- * wide enough to fit the remaining horizontal space.
- *
- * The default value is false.
- */
- public boolean grabExcessHorizontalSpace = false;
- /**
- * grabExcessVerticalSpace specifies whether the cell will be made
- * tall enough to fit the remaining vertical space.
- *
- * The default value is false.
- */
- public boolean grabExcessVerticalSpace = false;
-
- // Alignment constants.
- public static final int BEGINNING = 1;
- public static final int CENTER = 2;
- public static final int END = 3;
- public static final int FILL = 4;
-
- // Style constants
- public static final int VERTICAL_ALIGN_BEGINNING = 1 << 1;
- public static final int VERTICAL_ALIGN_CENTER = 1 << 2;
- public static final int VERTICAL_ALIGN_END = 1 << 3;
- public static final int VERTICAL_ALIGN_FILL = 1 << 4;
- public static final int HORIZONTAL_ALIGN_BEGINNING = 1 << 5;
- public static final int HORIZONTAL_ALIGN_CENTER = 1 << 6;
- public static final int HORIZONTAL_ALIGN_END = 1 << 7;
- public static final int HORIZONTAL_ALIGN_FILL = 1 << 8;
- public static final int GRAB_HORIZONTAL = 1 << 9;
- public static final int GRAB_VERTICAL = 1 << 10;
-
- // Style convenience constants
- public static final int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
- public static final int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
- public static final int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL;
-
- // Private
- int childIndex;
- boolean isItemData = true;
- int hSpan;
-public GridData() {
- super();
-}
-public GridData(int style) {
- super();
-
- if ((style & VERTICAL_ALIGN_BEGINNING) != 0)
- verticalAlignment = BEGINNING;
- if ((style & VERTICAL_ALIGN_CENTER) != 0)
- verticalAlignment = CENTER;
- if ((style & VERTICAL_ALIGN_FILL) != 0)
- verticalAlignment = FILL;
- if ((style & VERTICAL_ALIGN_END) != 0)
- verticalAlignment = END;
-
- if ((style & HORIZONTAL_ALIGN_BEGINNING) != 0)
- horizontalAlignment = BEGINNING;
- if ((style & HORIZONTAL_ALIGN_CENTER) != 0)
- horizontalAlignment = CENTER;
- if ((style & HORIZONTAL_ALIGN_FILL) != 0)
- horizontalAlignment = FILL;
- if ((style & HORIZONTAL_ALIGN_END) != 0)
- horizontalAlignment = END;
-
- if ((style & GRAB_HORIZONTAL) != 0)
- grabExcessHorizontalSpace = true;
- else
- grabExcessHorizontalSpace = false;
- if ((style & GRAB_VERTICAL) != 0)
- grabExcessVerticalSpace = true;
- else
- grabExcessVerticalSpace = false;
-
-}
-boolean isItemData() {
- return isItemData;
-}
-boolean isSpacerData() {
- return !isItemData;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java
deleted file mode 100755
index ec912016b6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java
+++ /dev/null
@@ -1,645 +0,0 @@
-package org.eclipse.swt.layout;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public final class GridLayout extends Layout {
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the layout.
- *
- * The default value is 5.
- */
- public int marginWidth = 5;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the layout.
- *
- * The default value is 5.
- */
- public int marginHeight = 5;
- /**
- * numColumns specifies the number of cell columns in the layout.
- *
- * The default value is 1.
- */
- public int numColumns = 1;
- /**
- * makeColumnsEqualWidth specifies whether all columns in the layout
- * will be forced to have the same width.
- *
- * The default value is false.
- */
- public boolean makeColumnsEqualWidth = false;
- /**
- * horizontalSpacing specifies the number of pixels between the right
- * edge of one cell and the left edge of its neighbouring cell to
- * the right.
- *
- * The default value is 5.
- */
- public int horizontalSpacing = 5;
- /**
- * verticalSpacing specifies the number of pixels between the bottom
- * edge of one cell and the top edge of its neighbouring cell underneath.
- *
- * The default value is 5.
- */
- public int verticalSpacing = 5;
-
- // Private variables. Cached values used to cut down on grid calculations.
- Vector grid = new Vector();
- int [] pixelColumnWidths;
- int [] pixelRowHeights;
- int [] expandableColumns;
- int [] expandableRows;
-public GridLayout() {
- super();
-}
-void adjustGridDimensions(Composite composite, boolean flushCache) {
- // Ensure that widgets that span more than one row or column have enough space.
- for (int row = 0; row < grid.size(); row++) {
- for (int column = 0; column < numColumns; column++) {
- GridData spec = ((GridData[]) grid.elementAt(row))[column];
- if (spec.isItemData()) {
- // Widgets spanning columns.
- if (spec.hSpan > 1) {
- Control child = composite.getChildren()[spec.childIndex];
- Point extent = child.computeSize(spec.widthHint, spec.heightHint, flushCache);
-
- // Calculate the size of the widget's spanned columns.
- int lastSpanIndex = column + spec.hSpan;
- int spannedSize = 0;
- for (int c = column; c < lastSpanIndex; c++) {
- spannedSize = spannedSize + pixelColumnWidths[c] + horizontalSpacing;
- }
- spannedSize = spannedSize - horizontalSpacing;
-
- // If the spanned columns are not large enough to display the widget, adjust the column
- // sizes to account for the extra space that is needed.
- if (extent.x + spec.horizontalIndent > spannedSize) {
- int extraSpaceNeeded = extent.x + spec.horizontalIndent - spannedSize;
- int lastColumn = column + spec.hSpan - 1;
- int colWidth;
- if (makeColumnsEqualWidth) {
- // Evenly distribute the extra space amongst all of the columns.
- int columnExtra = extraSpaceNeeded / numColumns;
- int columnRemainder = extraSpaceNeeded % numColumns;
- for (int i = 0; i < pixelColumnWidths.length; i++) {
- colWidth = pixelColumnWidths[i] + columnExtra;
- pixelColumnWidths[i] = colWidth;
- }
- colWidth = pixelColumnWidths[lastColumn] + columnRemainder;
- pixelColumnWidths[lastColumn] = colWidth;
- } else {
- Vector localExpandableColumns = new Vector();
- for (int i = column; i <= lastColumn; i++) {
- for (int j = 0; j < expandableColumns.length; j++) {
- if (expandableColumns[j] == i) {
- localExpandableColumns.addElement(new Integer(i));
- }
- }
- }
- if (localExpandableColumns.size() > 0) {
- // If any of the widget's columns grab excess space, allocate the space amongst those columns.
- int columnExtra = extraSpaceNeeded / localExpandableColumns.size();
- int columnRemainder = extraSpaceNeeded % localExpandableColumns.size();
- for (int i = 0; i < localExpandableColumns.size(); i++) {
- int expandableCol = ((Integer) localExpandableColumns.elementAt(i)).intValue();
- colWidth = pixelColumnWidths[expandableCol] + columnExtra;
- pixelColumnWidths[expandableCol] = colWidth;
- }
- colWidth = pixelColumnWidths[lastColumn] + columnRemainder;
- pixelColumnWidths[lastColumn] = colWidth;
- } else {
- // Add the extra space to the widget's last column if none of its columns grab excess space.
- colWidth = pixelColumnWidths[lastColumn] + extraSpaceNeeded;
- pixelColumnWidths[lastColumn] = colWidth;
- }
- }
- }
- }
-
- // Widgets spanning rows.
- if (spec.verticalSpan > 1) {
- Control child = composite.getChildren()[spec.childIndex];
- Point extent = child.computeSize(spec.widthHint, spec.heightHint, flushCache);
-
- // Calculate the size of the widget's spanned rows.
- int lastSpanIndex = row + spec.verticalSpan;
- int spannedSize = 0;
- for (int r = row; r < lastSpanIndex; r++) {
- spannedSize = spannedSize + pixelRowHeights[r] + verticalSpacing;
- }
- spannedSize = spannedSize - verticalSpacing;
- // If the spanned rows are not large enough to display the widget, adjust the row
- // sizes to account for the extra space that is needed.
- if (extent.y > spannedSize) {
- int extraSpaceNeeded = extent.y - spannedSize;
- int lastRow = row + spec.verticalSpan - 1;
- int rowHeight;
- Vector localExpandableRows = new Vector();
- for (int i = row; i <= lastRow; i++) {
- for (int j = 0; j < expandableRows.length; j++) {
- if (expandableRows[j] == i) {
- localExpandableRows.addElement(new Integer(i));
- }
- }
- }
- if (localExpandableRows.size() > 0) {
- // If any of the widget's rows grab excess space, allocate the space amongst those rows.
- int rowExtra = extraSpaceNeeded / localExpandableRows.size();
- int rowRemainder = extraSpaceNeeded % localExpandableRows.size();
- for (int i = 0; i < localExpandableRows.size(); i++) {
- int expandableRow = ((Integer) localExpandableRows.elementAt(i)).intValue();
- rowHeight = pixelRowHeights[expandableRow] + rowExtra;
- pixelRowHeights[expandableRow] = rowHeight;
- }
- rowHeight = pixelRowHeights[lastRow] + rowRemainder;
- pixelRowHeights[lastRow] = rowHeight;
- } else {
- // Add the extra space to the widget's last row if no rows grab excess space.
- rowHeight = pixelRowHeights[lastRow] + extraSpaceNeeded;
- pixelRowHeights[lastRow] = rowHeight;
- }
- }
- }
- }
- }
- }
-}
-void calculateGridDimensions(Composite composite, boolean flushCache) {
- int maxWidth, childWidth, maxHeight, childHeight;
-
- //
- Control[] children = composite.getChildren();
- Point[] childSizes = new Point[children.length];
- pixelColumnWidths = new int[numColumns];
- pixelRowHeights = new int[grid.size()];
-
- // Loop through the grid by column to get the width that each column needs to be.
- // Each column will be as wide as its widest widget.
- for (int column = 0; column < numColumns; column++) {
- maxWidth = 0;
- for (int row = 0; row < grid.size(); row++) {
- GridData spec = ((GridData[]) grid.elementAt(row))[column];
- if (spec.isItemData()) {
- Control child = children[spec.childIndex];
- childSizes[spec.childIndex] = child.computeSize(spec.widthHint, spec.heightHint, flushCache);
- childWidth = childSizes[spec.childIndex].x + spec.horizontalIndent;
- if (spec.hSpan == 1) {
- maxWidth = Math.max(maxWidth, childWidth);
- }
- }
- }
- // Cache the values for later use.
- pixelColumnWidths[column] = maxWidth;
- }
-
- //
- if (makeColumnsEqualWidth) {
- maxWidth = 0;
- // Find the largest column size that is necessary and make each column that size.
- for (int i = 0; i < numColumns; i++) {
- maxWidth = Math.max(maxWidth, pixelColumnWidths[i]);
- }
- for (int i = 0; i < numColumns; i++) {
- pixelColumnWidths[i] = maxWidth;
- }
- }
-
- // Loop through the grid by row to get the height that each row needs to be.
- // Each row will be as high as its tallest widget.
- for (int row = 0; row < grid.size(); row++) {
- maxHeight = 0;
- for (int column = 0; column < numColumns; column++) {
- GridData spec = ((GridData[]) grid.elementAt(row))[column];
- if (spec.isItemData()) {
- childHeight = childSizes[spec.childIndex].y;
- if (spec.verticalSpan == 1) {
- maxHeight = Math.max(maxHeight, childHeight);
- }
- }
- }
- // Cache the values for later use.
- pixelRowHeights[row] = maxHeight;
- }
-}
-void computeExpandableCells() {
- // If a widget grabs excess horizontal space, the last column that the widget spans
- // will be expandable. Similarly, if a widget grabs excess vertical space, the
- // last row that the widget spans will be expandable.
- Hashtable growColumns = new Hashtable();
- Hashtable growRows = new Hashtable();
- for (int col = 0; col < numColumns; col++) {
- for (int row = 0; row < grid.size(); row++) {
- GridData spec = ((GridData[]) grid.elementAt(row))[col];
- if (spec.grabExcessHorizontalSpace) {
- growColumns.put(new Integer(col + spec.hSpan - 1), new Object());
- }
- if (spec.grabExcessVerticalSpace) {
- growRows.put(new Integer(row + spec.verticalSpan - 1), new Object());
- }
- }
- }
-
- // Cache the values. These values are used later during children layout.
- int i = 0;
- Enumeration enum = growColumns.keys();
- expandableColumns = new int[growColumns.size()];
- while (enum.hasMoreElements()) {
- expandableColumns[i] = ((Integer)enum.nextElement()).intValue();
- i = i + 1;
- }
- i = 0;
- enum = growRows.keys();
- expandableRows = new int[growRows.size()];
- while (enum.hasMoreElements()) {
- expandableRows[i] = ((Integer)enum.nextElement()).intValue();
- i = i + 1;
- }
-}
-Point computeLayoutSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- int totalMarginHeight, totalMarginWidth;
- int totalWidth, totalHeight;
- int cols, rows;
-
- // Initialize the grid and other cached information that help with the grid layout.
- if (grid.size() == 0) {
- createGrid(composite);
- calculateGridDimensions(composite, flushCache);
- computeExpandableCells();
- adjustGridDimensions(composite, flushCache);
- }
-
- //
- cols = numColumns;
- rows = grid.size();
- totalMarginHeight = marginHeight;
- totalMarginWidth = marginWidth;
-
- // The total width is the margin plus border width plus space between each column,
- // plus the width of each column.
- totalWidth = (totalMarginWidth * 2) + ((cols - 1) * horizontalSpacing);
-
- //Add up the width of each column.
- for (int i = 0; i < pixelColumnWidths.length; i++) {
- totalWidth = totalWidth + pixelColumnWidths[i];
- }
-
- // The total height is the margin plus border height, plus space between each row,
- // plus the height of the tallest child in each row.
- totalHeight = (totalMarginHeight * 2) + ((rows - 1) * verticalSpacing);
-
- //Add up the height of each row.
- for (int i = 0; i < pixelRowHeights.length; i++) {
- totalHeight = totalHeight + pixelRowHeights[i];
- }
-
- if (wHint != SWT.DEFAULT) {
- totalWidth = wHint;};
- if (hHint != SWT.DEFAULT) {
- totalHeight = hHint;};
- // The preferred extent is the width and height that will accomodate the grid's widgets.
- return new Point(totalWidth, totalHeight);
-}
-protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Control[] children = composite.getChildren();
- int numChildren = children.length;
-
- if (numChildren == 0) return new Point(0,0);
-
- if (flushCache) {
- // Cause the grid and its related information to be calculated
- // again.
- grid.removeAllElements();
- }
- return computeLayoutSize(composite, wHint, hHint, flushCache);
-}
-Point getFirstEmptyCell(int row, int column) {
- GridData[] rowData = (GridData[]) grid.elementAt(row);
- while (column < numColumns && rowData[column] != null) {
- column++;
- }
- if (column == numColumns) {
- row++;
- column = 0;
- if (row == grid.size()) {
- grid.addElement(emptyRow());
- }
- return getFirstEmptyCell(row, column);
- }
- return new Point(row, column);
-}
-Point getLastEmptyCell(int row, int column) {
- GridData[] rowData = (GridData[])grid.elementAt(row);
- while (column < numColumns && rowData[column] == null ) {
- column++;
- }
- return new Point(row, column - 1);
-}
-Point getCell(int row, int column, int width, int height) {
- Point start = getFirstEmptyCell(row, column);
- Point end = getLastEmptyCell(start.x, start.y);
- if (end.y + 1 - start.y >= width) return start;
- GridData[] rowData = (GridData[]) grid.elementAt(start.x);
- for (int j = start.y; j < end.y + 1; j++) {
- GridData spacerSpec = new GridData();
- spacerSpec.isItemData = false;
- rowData[j] = spacerSpec;
- }
- return getCell(end.x, end.y, width, height);
-}
-void createGrid(Composite composite) {
- int row, column, rowFill, columnFill;
- Control[] children;
- GridData spacerSpec;
-
- //
- children = composite.getChildren();
-
- //
- grid.addElement(emptyRow());
- row = 0;
- column = 0;
-
- // Loop through the children and place their associated layout specs in the
- // grid. Placement occurs left to right, top to bottom (i.e., by row).
- for (int i = 0; i < children.length; i++) {
- // Find the first available spot in the grid.
- Control child = children[i];
- GridData spec = (GridData) child.getLayoutData();
- if (spec == null) {
- spec = new GridData();
- child.setLayoutData(spec);
- }
- spec.hSpan = Math.min(spec.horizontalSpan, numColumns);
- Point p = getCell(row, column, spec.hSpan, spec.verticalSpan);
- row = p.x; column = p.y;
-
- // The vertical span for the item will be at least 1. If it is > 1,
- // add other rows to the grid.
- for (int j = 2; j <= spec.verticalSpan; j++) {
- if (row + j > grid.size()) {
- grid.addElement(emptyRow());
- }
- }
-
- // Store the layout spec. Also cache the childIndex. NOTE: That we assume the children of a
- // composite are maintained in the order in which they are created and added to the composite.
- ((GridData[]) grid.elementAt(row))[column] = spec;
- spec.childIndex = i;
-
- // Put spacers in the grid to account for the item's vertical and horizontal
- // span.
- rowFill = spec.verticalSpan - 1;
- columnFill = spec.hSpan - 1;
- for (int r = 1; r <= rowFill; r++) {
- for (int c = 0; c < spec.hSpan; c++) {
- spacerSpec = new GridData();
- spacerSpec.isItemData = false;
- ((GridData[]) grid.elementAt(row + r))[column + c] = spacerSpec;
- }
- }
- for (int c = 1; c <= columnFill; c++) {
- for (int r = 0; r < spec.verticalSpan; r++) {
- spacerSpec = new GridData();
- spacerSpec.isItemData = false;
- ((GridData[]) grid.elementAt(row + r))[column + c] = spacerSpec;
- }
- }
- column = column + spec.hSpan - 1;
- }
-
- // Fill out empty grid cells with spacers.
- for (int r = row; r < grid.size(); r++) {
- GridData[] rowData = (GridData[]) grid.elementAt(r);
- for (int c = 0; c < numColumns; c++) {
- if (rowData[c] == null) {
- spacerSpec = new GridData();
- spacerSpec.isItemData = false;
- rowData[c] = spacerSpec;
- }
- }
- }
-}
-GridData[] emptyRow() {
- GridData[] row = new GridData[numColumns];
- for (int i = 0; i < numColumns; i++) {
- row[i] = null;}
- return row;
-}
-protected void layout(Composite composite, boolean flushCache) {
- int[] columnWidths;
- int[] rowHeights;
- int rowSize, rowY, columnX;
- int compositeWidth, compositeHeight;
- int excessHorizontal, excessVertical;
- Control[] children;
- if (flushCache) {
- // Cause the grid and its related information to be calculated
- // again.
- grid.removeAllElements();
- }
- children = composite.getChildren();
- if (children.length == 0)
- return;
-
- //
- Point extent = computeSize(composite, SWT.DEFAULT, SWT.DEFAULT, flushCache);
- columnWidths = new int[numColumns];
- for (int i = 0; i < pixelColumnWidths.length; i++) {
- columnWidths[i] = pixelColumnWidths[i];
- }
- rowHeights = new int[grid.size()];
- for (int i = 0; i < pixelRowHeights.length; i++) {
- rowHeights[i] = pixelRowHeights[i];
- }
- int columnWidth = 0;
- rowSize = Math.max(1, grid.size());
-
- //
- compositeWidth = extent.x;
- compositeHeight = extent.y;
-
- // Calculate whether or not there is any extra space or not enough space due to a resize
- // operation. Then allocate/deallocate the space to columns and rows that are expandable.
- // If a widget grabs excess space, its last column or row will be expandable.
- excessHorizontal = composite.getClientArea().width - compositeWidth;
- excessVertical = composite.getClientArea().height - compositeHeight;
-
- // Allocate/deallocate horizontal space.
- if (expandableColumns.length != 0) {
- int excess, remainder, last;
- int colWidth;
- excess = excessHorizontal / expandableColumns.length;
- remainder = excessHorizontal % expandableColumns.length;
- last = 0;
- for (int i = 0; i < expandableColumns.length; i++) {
- int expandableCol = expandableColumns[i];
- colWidth = columnWidths[expandableCol];
- colWidth = colWidth + excess;
- columnWidths[expandableCol] = colWidth;
- last = Math.max(last, expandableCol);
- }
- colWidth = columnWidths[last];
- colWidth = colWidth + remainder;
- columnWidths[last] = colWidth;
- }
-
- // Go through all specs in each expandable column and get the maximum specified
- // widthHint. Use this as the minimumWidth for the column.
- for (int i = 0; i < expandableColumns.length; i++) {
- int expandableCol = expandableColumns[i];
- int colWidth = columnWidths[expandableCol];
- int minWidth = 0;
- for (int j = 0; j < grid.size(); j++) {
- GridData[] row = (GridData[]) grid.elementAt(j);
- GridData spec = row[expandableCol];
- if (spec.hSpan == 1) {
- minWidth = Math.max(minWidth, spec.widthHint);
- }
- }
- columnWidths[expandableCol] = Math.max(colWidth, minWidth);
- }
- // Allocate/deallocate vertical space.
- if (expandableRows.length != 0) {
- int excess, remainder, last;
- int rowHeight;
- excess = excessVertical / expandableRows.length;
- remainder = excessVertical % expandableRows.length;
- last = 0;
- for (int i = 0; i < expandableRows.length; i++) {
- int expandableRow = expandableRows[i];
- rowHeight = rowHeights[expandableRow];
- rowHeight = rowHeight + excess;
- rowHeights[expandableRow] = rowHeight;
- last = Math.max(last, expandableRow);
- }
- rowHeight = rowHeights[last];
- rowHeight = rowHeight + remainder;
- rowHeights[last] = rowHeight;
- }
- // Go through all specs in each expandable row and get the maximum specified
- // heightHint. Use this as the minimumHeight for the row.
- for (int i = 0; i < expandableRows.length; i++) {
- int expandableRow = expandableRows[i];
- int rowHeight = rowHeights[expandableRow];
- int minHeight = 0;
- GridData[] row = (GridData[]) grid.elementAt(expandableRow);
- for (int j = 0; j < numColumns; j++) {
- GridData spec = row[j];
- if (spec.verticalSpan == 1) {
- minHeight = Math.max(minHeight, spec.heightHint);
- }
- }
- rowHeights[expandableRow] = Math.max(rowHeight, minHeight);
- }
-
- // Get the starting x and y.
- columnX = marginWidth + composite.getClientArea().x;
- rowY = marginHeight + composite.getClientArea().y;
-
- // Layout the widget left to right, top to bottom.
- for (int r = 0; r < rowSize; r++) {
- int rowHeight = rowHeights[r];
- GridData[] row = (GridData[]) grid.elementAt(r);
-
- //
- for (int c = 0; c < row.length; c++) {
- int spannedWidth = 0, spannedHeight = 0;
- int hAlign = 0, vAlign = 0;
- int widgetX = 0, widgetY = 0;
- int widgetW = 0, widgetH = 0;
-
- //
- GridData spec = (GridData) row[c];
- if (makeColumnsEqualWidth) {
- columnWidth = composite.getClientArea().width - 2 * (marginWidth) - ((numColumns - 1) * horizontalSpacing);
- columnWidth = columnWidth / numColumns;
- for (int i = 0; i < columnWidths.length; i++) {
- columnWidths[i] = columnWidth;
- }
- } else {
- columnWidth = columnWidths[c];
- }
-
- //
- spannedWidth = columnWidth;
- for (int k = 1; k < spec.hSpan; k++) {
- if ((c + k) <= numColumns) {
- if (!makeColumnsEqualWidth) {
- columnWidth = columnWidths[c + k];
- }
- spannedWidth = spannedWidth + columnWidth + horizontalSpacing;
- }
- }
-
- //
- spannedHeight = rowHeight;
- for (int k = 1; k < spec.verticalSpan; k++) {
- if ((r + k) <= grid.size()) {
- spannedHeight = spannedHeight + rowHeights[r + k] + verticalSpacing;
- }
- }
-
- //
- if (spec.isItemData()) {
- Control child = children[spec.childIndex];
- Point childExtent = child.computeSize(spec.widthHint, spec.heightHint, flushCache);
- hAlign = spec.horizontalAlignment;
- widgetX = columnX;
-
- // Calculate the x and width values for the widget.
- if (hAlign == spec.CENTER) {
- widgetX = widgetX + (spannedWidth / 2) - (childExtent.x / 2);
- } else
- if (hAlign == spec.END) {
- widgetX = widgetX + spannedWidth - childExtent.x - spec.horizontalIndent;
- } else {
- widgetX = widgetX + spec.horizontalIndent;
- }
- if (hAlign == spec.FILL) {
- widgetW = spannedWidth - spec.horizontalIndent;
- widgetX = columnX + spec.horizontalIndent;
- } else {
- widgetW = childExtent.x;
- }
-
- // Calculate the y and height values for the widget.
- vAlign = spec.verticalAlignment;
- widgetY = rowY;
- if (vAlign == spec.CENTER) {
- widgetY = widgetY + (spannedHeight / 2) - (childExtent.y / 2);
- } else
- if (vAlign == spec.END) {
- widgetY = widgetY + spannedHeight - childExtent.y;
- } else {
- widgetY = widgetY;
- }
- if (vAlign == spec.FILL) {
- widgetH = spannedHeight;
- widgetY = rowY;
- } else {
- widgetH = childExtent.y;
- }
- // Place the widget.
- child.setBounds(widgetX, widgetY, widgetW, widgetH);
- }
- // Update the starting x value.
- columnX = columnX + columnWidths[c] + horizontalSpacing;
- }
- // Update the starting y value and since we're starting a new row, reset the starting x value.
- rowY = rowY + rowHeights[r] + verticalSpacing;
- columnX = marginWidth + composite.getClientArea().x;
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
deleted file mode 100755
index 61c90135bc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.layout;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-public final class RowData {
- /**
- * width specifies the width of the cell in pixels.
- */
- public int width;
- /**
- * height specifies the height of the cell in pixels.
- */
- public int height;
-public RowData () {
- this (SWT.DEFAULT, SWT.DEFAULT);
-}
-public RowData (int width, int height) {
- this.width = width; this.height = height;
-}
-public RowData (Point point) {
- this (point.x, point.y);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java
deleted file mode 100755
index 2c5fc8e107..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package org.eclipse.swt.layout;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public final class RowLayout extends Layout {
- /**
- * type specifies whether the layout places controls in rows or
- * columns.
- *
- * The default value is horizontal.
- *
- * @since 2.0
- */
- public int type = SWT.HORIZONTAL;
- /**
- * wrap specifies whether a control will be wrapped to the next
- * row if there is insufficient space on the current row.
- *
- * The default value is true.
- */
- public boolean wrap = true;
- /**
- * pack specifies whether all controls in the layout are forced
- * to be the same size.
- *
- * The default value is true.
- */
- public boolean pack = true;
- /**
- * justify specifies whether the controls in a row should be
- * fully justified, with any extra space placed between the controls.
- *
- * The default value is false.
- */
- public boolean justify = false;
- /**
- * spacing specifies the number of pixels between the edge of one cell
- * and the edge of its neighbouring cell.
- *
- * The default value is 3.
- */
- public int spacing = 3;
- /**
- * marginLeft specifies the number of pixels of horizontal margin
- * that will be placed along the left edge of the layout.
- *
- * The default value is 3.
- */
- public int marginLeft = 3;
- /**
- * marginTop specifies the number of pixels of vertical margin
- * that will be placed along the top edge of the layout.
- *
- * The default value is 3.
- */
- public int marginTop = 3;
- /**
- * marginRight specifies the number of pixels of horizontal margin
- * that will be placed along the right edge of the layout.
- *
- * The default value is 3.
- */
- public int marginRight = 3;
- /**
- * marginBottom specifies the number of pixels of vertical margin
- * that will be placed along the bottom edge of the layout.
- *
- * The default value is 3.
- */
- public int marginBottom = 3;
-
-public RowLayout () {
-}
-
-protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- Point extent;
- if (type == SWT.HORIZONTAL) {
- extent = layoutHorizontal (composite, false, (wHint != SWT.DEFAULT) && wrap, wHint, flushCache);
- } else {
- extent = layoutVertical (composite, false, (hHint != SWT.DEFAULT) && wrap, wHint, flushCache);
- }
- if (wHint != SWT.DEFAULT) extent.x = wHint;
- if (hHint != SWT.DEFAULT) extent.y = hHint;
- return extent;
-}
-
-Point getSize (Control control, boolean flushCache) {
- int wHint = SWT.DEFAULT, hHint = SWT.DEFAULT;
- RowData data = (RowData) control.getLayoutData ();
- if (data != null) {
- wHint = data.width;
- hHint = data.height;
- }
- return control.computeSize (wHint, hHint, flushCache);
-}
-
-protected void layout (Composite composite, boolean flushCache) {
- Rectangle clientArea = composite.getClientArea ();
- if (type == SWT.HORIZONTAL) {
- layoutHorizontal (composite, true, wrap, clientArea.width, flushCache);
- } else {
- layoutVertical (composite, true, wrap, clientArea.height, flushCache);
- }
-}
-
-Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int width, boolean flushCache) {
- Control [] children = composite.getChildren ();
- int count = children.length;
- int childWidth = 0, childHeight = 0, maxHeight = 0;
- if (!pack) {
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = getSize (child, flushCache);
- childWidth = Math.max (childWidth, pt.x);
- childHeight = Math.max (childHeight, pt.y);
- }
- maxHeight = childHeight;
- }
- int clientX = 0, clientY = 0;
- if (move) {
- Rectangle rect = composite.getClientArea ();
- clientX = rect.x; clientY = rect.y;
- }
- boolean wrapped = false;
- Rectangle [] bounds = null;
- if (move && justify) bounds = new Rectangle [count];
- int maxX = 0, x = marginLeft, y = marginTop;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- if (pack) {
- Point pt = getSize (child, flushCache);
- childWidth = pt.x; childHeight = pt.y;
- }
- if (wrap && (i != 0) && (x + childWidth > width)) {
- wrapped = true;
- x = marginLeft; y += spacing + maxHeight;
- }
- if (pack) {
- maxHeight = Math.max (maxHeight, childHeight);
- }
- if (move) {
- int childX = x + clientX, childY = y + clientY;
- if (justify) {
- bounds [i] = new Rectangle (childX, childY, childWidth, childHeight);
- } else {
- child.setBounds (childX, childY, childWidth, childHeight);
- }
- }
- x += spacing + childWidth;
- maxX = Math.max (maxX, x);
- }
- if (!wrap) maxX = x + marginRight;
- if (move && justify) {
- int space = 0, margin = 0;
- if (!wrapped) {
- space = Math.max (0, (width - maxX) / (count + 1));
- margin = Math.max (0, ((width - maxX) % (count + 1)) / 2);
- }
- for (int i=0; i<count; i++) {
- Control child = children [i];
- bounds [i].x += (space * (i + 1)) + margin;
- child.setBounds (bounds [i]);
- }
- }
- return new Point (maxX, y + maxHeight + marginBottom);
-}
-
-Point layoutVertical (Composite composite, boolean move, boolean wrap, int height, boolean flushCache) {
- Control [] children = composite.getChildren ();
- int count = children.length;
- int childWidth = 0, childHeight = 0, maxWidth = 0;
- if (!pack) {
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = getSize (child, flushCache);
- childWidth = Math.max (childWidth, pt.x);
- childHeight = Math.max (childHeight, pt.y);
- }
- maxWidth = childWidth;
- }
- int clientX = 0, clientY = 0;
- if (move) {
- Rectangle rect = composite.getClientArea ();
- clientX = rect.x; clientY = rect.y;
- }
- boolean wrapped = false;
- Rectangle [] bounds = null;
- if (move && justify) bounds = new Rectangle [count];
- int maxY = 0, x = marginLeft, y = marginTop;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- if (pack) {
- Point pt = getSize (child, flushCache);
- childWidth = pt.x; childHeight = pt.y;
- }
- if (wrap && (i != 0) && (y + childHeight > height)) {
- wrapped = true;
- x += spacing + maxWidth; y = marginTop;
- }
- if (pack) {
- maxWidth = Math.max (maxWidth, childWidth);
- }
- if (move) {
- int childX = x + clientX, childY = y + clientY;
- if (justify) {
- bounds [i] = new Rectangle (childX, childY, childWidth, childHeight);
- } else {
- child.setBounds (childX, childY, childWidth, childHeight);
- }
- }
- y += spacing + childHeight;
- maxY = Math.max (maxY, y);
- }
- if (!wrap) maxY = y + marginBottom;
- if (move && justify) {
- int space = 0, margin = 0;
- if (!wrapped) {
- space = Math.max (0, (height - maxY) / (count + 1));
- margin = Math.max (0, ((height - maxY) % (count + 1)) / 2);
- }
- for (int i=0; i<count; i++) {
- Control child = children [i];
- bounds [i].y += (space * (i + 1)) + margin;
- child.setBounds (bounds [i]);
- }
- }
- return new Point (x + maxWidth + marginRight, maxY);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/package.html
deleted file mode 100755
index 4408b8f7ff..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT layout classes
-<h2>
-Package Specification</h2>
-This package contains several standard layout classes which provide automated positioning and sizing support for SWT widgets.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/package.html
deleted file mode 100755
index ec94fab277..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT constants and error handling support.
-<h2>
-Package Specification</h2>
-This package provides the class <code>SWT</code> which contains all of the
-constants used by SWT as well as a small selection of error handling routines
-and queries such as <code>getPlatform</code> and <code>getVersion</code>.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java
deleted file mode 100755
index d91f648867..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * This class is the abstract superclass of the classes
- * that represent the built in platform dialogs.
- * A <code>Dialog</code> typically contains other widgets
- * that are not accessible. A <code>Dialog</code> is not
- * a <code>Widget</code>.
- * <p>
- * This class can also be used as the abstract superclass
- * for user-designed dialogs. Such dialogs usually consist
- * of a Shell with child widgets. The basic template for a
- * user-defined dialog typically looks something like this:
- * <code>
- * public class MyDialog extends Dialog {
- * Object result;
- *
- * public MyDialog (Shell parent, int style) {
- * super (parent, style);
- * }
- * public MyDialog (Shell parent) {
- * this (parent, 0); // your default style bits go here (not the Shell's style bits)
- * }
- * public Object open () {
- * Shell parent = getParent();
- * Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- * shell.setText(getText());
- * // Your code goes here (widget creation, set result, etc).
- * shell.open();
- * Display display = parent.getDisplay();
- * while (!shell.isDisposed()) {
- * if (!display.readAndDispatch()) display.sleep();
- * }
- * return result;
- * }
- * }
- * </code>
- * <p>
- * Note: The <em>modality</em> styles supported by this class
- * must be treated as <em>HINT</em>s, because not all are
- * supported by every subclass on every platform. If a modality style
- * is not supported, it is "upgraded" to a more restrictive modality
- * style that is supported. For example, if <code>PRIMARY_MODAL</code>
- * is not supported by a particular dialog, it would be upgraded to
- * <code>APPLICATION_MODAL</code>. In addition, as is the case
- * for shells, the window manager for the desktop on which the
- * instance is visible has ultimate control over the appearance
- * and behavior of the instance, including its modality.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- *
- * @see Shell
- */
-
-public abstract class Dialog {
- int style;
- Shell parent;
- String title;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
-public Dialog (Shell parent) {
- this (parent, 0);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
-public Dialog (Shell parent, int style) {
- checkParent (parent);
- this.parent = parent;
- this.style = style;
- title = "";
-}
-
-/**
- * Checks that this class can be subclassed.
- * <p>
- * IMPORTANT: See the comment in <code>Widget.checkSubclass()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see Widget#checkSubclass
- */
-protected void checkSubclass () {
- if (!Display.isValidClass (getClass ())) {
- error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-
-/**
- * Throws an exception if the specified widget can not be
- * used as a parent for the receiver.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
-void checkParent (Shell parent) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (parent.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-
-/**
- * Does whatever dialog specific cleanup is required, and then
- * uses the code in <code>SWTError.error</code> to handle the error.
- *
- * @param code the descriptive error code
- *
- * @see SWTError#error
- */
-void error (int code) {
- SWT.error(code);
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Shell</code>
- * or null.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getParent () {
- return parent;
-}
-
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that, the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- return style;
-}
-
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- return title;
-}
-
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which must not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- title = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java
deleted file mode 100755
index 5039985cae..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a description of a particular
- * event which occurred within SWT. The SWT <em>untyped listener</em>
- * API uses these instances for all event dispatching.
- * <p>
- * Note: For a given event, only the fields which are appropriate
- * will be filled in. The contents of the fields which are not used
- * by the event are unspecified.
- * </p>
- *
- * @see Listener
- * @see org.eclipse.swt.events.TypedEvent
- */
-
-public class Event {
-
- /**
- * the type of event, as defined by the event type constants
- * in class <code>SWT</code>
- *
- * @see SWT
- */
- public int type;
-
- /**
- * the widget that the event occurred in
- */
- public Widget widget;
- public Widget item;
- public GC gc;
- public int detail;
- public int x, y, width, height;
- public int time;
- public int count;
- public int button;
- public int keyCode;
- public int stateMask;
- public char character;
- public int start, end;
- public String text;
- public boolean doit = true;
- public Object data;
-
-/**
-* Gets the bounds.
-* <p>
-* @return a rectangle that is the bounds.
-*/
-public Rectangle getBounds () {
- return new Rectangle (x, y, width, height);
-}
-/**
-* Sets the bounds.
-* <p>
-* @param x the new x position
-* @param y the new y position
-* @param width the new width
-* @param height the new height
-*/
-public void setBounds (Rectangle rect) {
- this.x = rect.x;
- this.y = rect.y;
- this.width = rect.width;
- this.height = rect.height;
-}
-/**
-* Returns a string representation of the object.
-*
-* @return a string representation of the object
-*/
-public String toString () {
- return "Event {type=" + type + ",widget=" + widget + ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java
deleted file mode 100755
index 13d9333716..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-
-/**
- * Instances of this class implement a simple
- * look up mechanism that maps an event type
- * to a listener. Muliple listeners for the
- * same event type are supported.
- */
-
-class EventTable {
- int [] types;
- Listener [] listeners;
- int level;
-
-public void hook (int eventType, Listener listener) {
- if (types == null) types = new int [4];
- if (listeners == null) listeners = new Listener [4];
- int length = types.length, index = length - 1;
- while (index >= 0) {
- if (types [index] != 0) break;
- --index;
- }
- index++;
- if (index == length) {
- if (level == 0) {
- index = 0;
- for (int i=0; i<types.length; i++) {
- if (types [i] != 0) {
- types [index] = types [i];
- listeners [index] = listeners [i];
- index++;
- }
- }
- for (int i=index; i<types.length; i++) {
- types [i] = 0;
- listeners [i] = null;
- }
- }
- if (index == length) {
- int [] newTypes = new int [length + 4];
- System.arraycopy (types, 0, newTypes, 0, length);
- types = newTypes;
- Listener [] newListeners = new Listener [length + 4];
- System.arraycopy (listeners, 0, newListeners, 0, length);
- listeners = newListeners;
- }
- }
- types [index] = eventType;
- listeners [index] = listener;
-}
-
-public boolean hooks (int eventType) {
- if (types == null) return false;
- for (int i=0; i<types.length; i++) {
- if (types [i] == eventType) return true;
- }
- return false;
-}
-
-public void sendEvent (Event event) {
- if (types == null) return;
- level++;
- for (int i=0; i<types.length; i++) {
- if (types [i] == event.type) {
- Listener listener = listeners [i];
- if (listener != null) listener.handleEvent (event);
- }
- }
- --level;
-}
-
-void remove (int index) {
- if (level == 0) {
- int end = types.length - 1;
- System.arraycopy (types, index + 1, types, index, end - index);
- System.arraycopy (listeners, index + 1, listeners, index, end - index);
- index = end;
- }
- types [index] = 0;
- listeners [index] = null;
-}
-
-public void unhook (int eventType, Listener listener) {
- if (types == null) return;
- for (int i=0; i<types.length; i++) {
- if (types [i] == eventType && listeners [i] == listener) {
- remove (i);
- return;
- }
- }
-}
-
-public void unhook (int eventType, SWTEventListener listener) {
- if (types == null) return;
- for (int i=0; i<types.length; i++) {
- if (types [i] == eventType) {
- if (listeners [i] instanceof TypedListener) {
- TypedListener typedListener = (TypedListener) listeners [i];
- if (typedListener.getEventListener () == listener) {
- remove (i);
- return;
- }
- }
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Item.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Item.java
deleted file mode 100755
index f80c0330b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Item.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all non-windowed
- * user interface objects that occur within specific
- * controls. For example, a tree will contain tree
- * items.
- */
-
-public abstract class Item extends Widget {
- String text;
- Image image;
-
-public Item (Widget parent, int style) {
- super (parent, style);
- text = "";
-}
-
-public Item (Widget parent, int style, int index) {
- this (parent, style);
-}
-
-protected void checkSubclass () {
- /* Do Nothing - Subclassing is allowed */
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- text = null;
- image = null;
-}
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- this.image = image;
-}
-
-/**
- * Sets the receiver's text.
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- text = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Layout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Layout.java
deleted file mode 100755
index e95adb3783..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Layout.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A layout controls the position and size
- * of the children of a composite widget.
- * This class is the abstract base class for
- * layouts.
- */
-public abstract class Layout {
-
-/**
- * Computes and returns the size of the specified
- * composite's client area according to this layout.
- * <p>
- * This method computes the minimum size that the
- * client area of the composite must be in order to
- * position all children at their minimum size inside
- * the composite according to the layout algorithm
- * encoded by this layout.
- * </p>
- * <p>
- * When a width or height hint is supplied, it is
- * used to constrain the result. For example, if a
- * width hint is provided that is less than the minimum
- * width of the client area, the layout may choose
- * to wrap and increase height, clip, overlap, or
- * otherwise constrain the children.
- * </p>
- *
- * @param composite a composite widget using this layout
- * @param wHint width (<code>SWT.DEFAULT</code> for minimum)
- * @param hHint height (<code>SWT.DEFAULT</code> for minimum)
- * @param flushCache <code>true</code> means flush cached layout values
- * @return a point containing the computed size (width, height)
- * @see #layout
- */
-protected abstract Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache);
-
-/**
- * Lays out the children of the specified composite
- * according to this layout.
- * <p>
- * This method positions and sizes the children of a
- * composite using the layout algorithm encoded by this
- * layout. Children of the composite are positioned in
- * the client area of the composite. The position of
- * the composite is not altered by this method.
- * </p>
- * <p>
- * When the flush cache hint is true, the layout is
- * instructed to flush any cached values associated
- * with the children. Typically, a layout will cache
- * the preferred sizes of the children to avoid the
- * expense of computing these values each time the
- * widget is layed out.
- * </p>
- * <p>
- * When layout is triggered explicitly by the programmer
- * the flush cache hint is true. When layout is triggered
- * by a resize, either caused by the programmer or by the
- * user, the hint is false.
- * </p>
- *
- * @param composite a composite widget using this layout
- * @param flushCache <code>true</code> means flush cached layout values
- */
-protected abstract void layout (Composite composite, boolean flushCache);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Listener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Listener.java
deleted file mode 100755
index eeb0de496b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Listener.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * <code>Listener</code>s implement a simple <code>handleEvent(...)</code>
- * method that is used internally by SWT to dispatch events.
- * <p>
- * After creating an instance of a class that implements this interface
- * it can be added to a widget using the
- * <code>addListener(int eventType, Listener handler)</code> method and
- * removed using the
- * <code>removeListener (int eventType, Listener handler)</code> method.
- * When the specified event occurs, <code>handleEvent(...)</code> will
- * will be sent to the instance.
- * </p>
- * <p>
- * Classes which implement this interface are described within SWT as
- * providing the <em>untyped listener</em> API. Typically, widgets will
- * also provide a higher-level <em>typed listener</em> API, that is based
- * on the standard <code>java.util.EventListener</code> pattern.
- * </p>
- * <p>
- * Note that, since all internal SWT event dispatching is based on untyped
- * listeners, it is simple to build subsets of SWT for use on memory
- * constrained, small footprint devices, by removing the classes and
- * methods which implement the typed listener API.
- * </p>
- *
- * @see Widget#addListener
- * @see java.util.EventListener
- * @see org.eclipse.swt.events.*
- */
-public interface Listener {
-
-/**
- * Sent when an event that the receiver has registered for occurs.
- *
- * @param event the event which occurred
- */
-void handleEvent (Event event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/RunnableLock.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/RunnableLock.java
deleted file mode 100755
index 911f2d4044..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/RunnableLock.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Instances of this class are used to ensure that an
- * application cannot interfere with the locking mechanism
- * used to implement asynchonous and synchronous communication
- * between widgets and background threads.
- */
-
-class RunnableLock {
- Runnable runnable;
- Thread thread;
- Throwable throwable;
-
-RunnableLock (Runnable runnable) {
- this.runnable = runnable;
-}
-
-boolean done () {
- return runnable == null || throwable != null;
-}
-
-void run () {
- if (runnable != null) runnable.run ();
- runnable = null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Synchronizer.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Synchronizer.java
deleted file mode 100755
index b6898ad660..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Synchronizer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Compatibility;
-
-/**
- * Instances of this class provide synchronization support
- * for displays. A default instance is created automatically
- * for each display, and this instance is sufficient for almost
- * all applications.
- * <p>
- * <b>IMPORTANT:</b> Typical application code <em>never</em>
- * needs to deal with this class. It is provided only to
- * allow applications which require non-standard
- * synchronization behavior to plug in the support they
- * require. <em>Subclasses which override the methods in
- * this class must ensure that the superclass methods are
- * invoked in their implementations</em>
- * </p>
- *
- * @see Display#setSynchronizer
- */
-public class Synchronizer {
- Display display;
- int messagesSize;
- RunnableLock [] messages;
- Object messageLock = new Object ();
- Thread syncThread;
-
-public Synchronizer (Display display) {
- this.display = display;
-}
-
-void addLast (RunnableLock entry) {
- synchronized (messageLock) {
- if (messages == null) messages = new RunnableLock [4];
- if (messagesSize == messages.length) {
- RunnableLock[] newMessages = new RunnableLock [messagesSize + 4];
- System.arraycopy (messages, 0, newMessages, 0, messagesSize);
- messages = newMessages;
- }
- messages [messagesSize++] = entry;
- }
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-protected void asyncExec (Runnable runnable) {
- if (runnable != null) addLast (new RunnableLock (runnable));
- display.wake ();
-}
-
-void releaseSynchronizer () {
- display = null;
- messages = null;
- messageLock = null;
- syncThread = null;
-}
-
-RunnableLock removeFirst () {
- synchronized (messageLock) {
- if (messagesSize == 0) return null;
- RunnableLock lock = messages [0];
- System.arraycopy (messages, 1, messages, 0, --messagesSize);
- messages [messagesSize] = null;
- if (messagesSize == 0) messages = null;
- return lock;
- }
-}
-
-boolean runAsyncMessages () {
- if (messagesSize == 0) return false;
- do {
- RunnableLock lock = removeFirst ();
- if (lock == null) return true;
- synchronized (lock) {
- syncThread = lock.thread;
- try {
- lock.run ();
- } catch (Throwable t) {
- lock.throwable = t;
- SWT.error (SWT.ERROR_FAILED_EXEC, t);
- } finally {
- syncThread = null;
- lock.notifyAll ();
- }
- }
- } while (true);
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-protected void syncExec (Runnable runnable) {
- if (display.isValidThread ()) {
- if (runnable != null) runnable.run ();
- return;
- }
- if (runnable == null) {
- display.wake ();
- return;
- }
- RunnableLock lock = new RunnableLock (runnable);
- /*
- * Only remember the syncThread for syncExec.
- */
- lock.thread = Thread.currentThread();
- synchronized (lock) {
- addLast (lock);
- display.wake ();
- boolean interrupted = false;
- while (!lock.done ()) {
- try {
- lock.wait ();
- } catch (InterruptedException e) {
- interrupted = true;
- }
- }
- if (interrupted) {
- Compatibility.interrupt();
- }
- if (lock.throwable != null) {
- SWT.error (SWT.ERROR_FAILED_EXEC, lock.throwable);
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java
deleted file mode 100755
index ca11b03e04..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.SWTEventListener;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are <em>internal SWT implementation</em>
- * objects which provide a mapping between the typed and untyped
- * listener mechanisms that SWT supports.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It should never be
- * referenced from application code.
- * </p>
- *
- * @see Listener
- *
- * @private
- */
-public class TypedListener implements Listener {
-
- /**
- * The receiver's event listener
- */
- protected SWTEventListener eventListener;
-
-/**
- * Constructs a new instance of this class for the given event listener.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It should never be
- * referenced from application code.
- * </p>
- *
- * @param listener the event listener to store in the receiver
- */
-public TypedListener (SWTEventListener listener) {
- eventListener = listener;
-}
-
-/**
- * Returns the receiver's event listener.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It should never be
- * referenced from application code.
- * </p>
- *
- * @return the receiver's event listener
- */
-public SWTEventListener getEventListener () {
- return eventListener;
-}
-
-/**
- * Handles the given event.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It should never be
- * referenced from application code.
- * </p>
- */
-public void handleEvent (Event e) {
- switch (e.type) {
- case SWT.Paint: {
- /* Field set by Control */
- PaintEvent event = new PaintEvent (e);
- ((PaintListener) eventListener).paintControl (event);
- e.gc = event.gc;
- break;
- }
- case SWT.Selection: {
- /* Fields set by Sash */
- SelectionEvent event = new SelectionEvent (e);
- ((SelectionListener) eventListener).widgetSelected (event);
- e.x = event.x;
- e.y = event.y;
- e.doit = event.doit;
- break;
- }
- case SWT.DefaultSelection: {
- ((SelectionListener)eventListener).widgetDefaultSelected(new SelectionEvent(e));
- break;
- }
- case SWT.Dispose: {
- ((DisposeListener) eventListener).widgetDisposed(new DisposeEvent(e));
- break;
- }
- case SWT.FocusIn: {
- ((FocusListener) eventListener).focusGained(new FocusEvent(e));
- break;
- }
- case SWT.FocusOut: {
- ((FocusListener) eventListener).focusLost(new FocusEvent(e));
- break;
- }
- case SWT.Hide: {
- ((MenuListener) eventListener).menuHidden(new MenuEvent(e));
- break;
- }
- case SWT.Show: {
- ((MenuListener) eventListener).menuShown(new MenuEvent(e));
- break;
- }
- case SWT.KeyDown: {
- ((KeyListener) eventListener).keyPressed(new KeyEvent(e));
- break;
- }
- case SWT.KeyUp: {
- ((KeyListener) eventListener).keyReleased(new KeyEvent(e));
- break;
- }
- case SWT.MouseDown: {
- ((MouseListener) eventListener).mouseDown(new MouseEvent(e));
- break;
- }
- case SWT.MouseUp: {
- ((MouseListener) eventListener).mouseUp(new MouseEvent(e));
- break;
- }
- case SWT.MouseDoubleClick: {
- ((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
- break;
- }
- case SWT.MouseMove: {
- ((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
- return;
- }
- case SWT.Resize: {
- ((ControlListener) eventListener).controlResized(new ControlEvent(e));
- break;
- }
- case SWT.Move: {
- ((ControlListener) eventListener).controlMoved(new ControlEvent(e));
- break;
- }
- case SWT.Close: {
- /* Fields set by Decorations */
- ShellEvent event = new ShellEvent (e);
- ((ShellListener) eventListener).shellClosed(event);
- e.doit = event.doit;
- break;
- }
- case SWT.Activate: {
- ((ShellListener) eventListener).shellActivated(new ShellEvent(e));
- break;
- }
- case SWT.Deactivate: {
- ((ShellListener) eventListener).shellDeactivated(new ShellEvent(e));
- break;
- }
- case SWT.Iconify: {
- ((ShellListener) eventListener).shellIconified(new ShellEvent(e));
- break;
- }
- case SWT.Deiconify: {
- ((ShellListener) eventListener).shellDeiconified(new ShellEvent(e));
- break;
- }
- case SWT.Expand: {
- ((TreeListener) eventListener).treeExpanded(new TreeEvent(e));
- break;
- }
- case SWT.Collapse: {
- ((TreeListener) eventListener).treeCollapsed(new TreeEvent(e));
- break;
- }
- case SWT.Modify: {
- ((ModifyListener) eventListener).modifyText(new ModifyEvent(e));
- break;
- }
- case SWT.Verify: {
- /* Fields set by Text, RichText */
- VerifyEvent event = new VerifyEvent (e);
- ((VerifyListener) eventListener).verifyText (event);
- e.text = event.text;
- e.doit = event.doit;
- break;
- }
- case SWT.Help: {
- ((HelpListener) eventListener).helpRequested (new HelpEvent (e));
- break;
- }
- case SWT.Arm: {
- ((ArmListener) eventListener).widgetArmed (new ArmEvent (e));
- break;
- }
- case SWT.MouseExit: {
- ((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
- break;
- }
- case SWT.MouseEnter: {
- ((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
- break;
- }
- case SWT.MouseHover: {
- ((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
- break;
- }
- case SWT.Traverse: {
- /* Fields set by Control */
- TraverseEvent event = new TraverseEvent (e);
- ((TraverseListener) eventListener).keyTraversed (event);
- e.detail = event.detail;
- e.doit = event.doit;
- break;
- }
-
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/package.html b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/package.html
deleted file mode 100755
index b23d27be20..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT widget public API classes.
-<h2>
-Package Specification</h2>
-This package contains the classes which make up the public SWT widget
-API as well as the related public support classes (for example, class
-<code>Event</code>).
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
deleted file mode 100755
index 5acbe5145f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-version 2.024 \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatibility.java
deleted file mode 100644
index 7ab0d205bc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatibility.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This interface is the cross-platform version of the
- * java.lang.Cloneable interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement CloneableCompatibility instead of java.lang.Cloneable.
- * </p>
- * <p>
- * Note: java.lang.Cloneable is not part of CLDC.
- * </p>
- * <p>
- * IMPORTANT: CDC mandates Cloneable. Behavior on CLDC will have
- * to be discussed further.
- * </p>
- */
-public interface CloneableCompatibility {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java
deleted file mode 100644
index 4175e5c195..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package org.eclipse.swt.internal;
-
-import org.eclipse.swt.SWT;
-import java.io.*;
-
-/**
- * This class is a placeholder for utility methods commonly
- * used on J2SE platforms but not supported on some J2ME
- * profiles.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms.
- * </p>
- * <p>
- * IMPORTANT: some of the methods have been modified from their
- * J2SE parents. Refer to the description of each method for
- * specific changes.
- * </p>
- * <ul>
- * <li>Exceptions thrown may differ since J2ME's set of
- * exceptions is a subset of J2SE's one.
- * </li>
- * <li>The range of the mathematic functions is subject to
- * change.
- * </li>
- * </ul>
- */
-public final class Compatibility {
-
-/**
- * Sine table
- * <p>
- * Values represent sine for each degree between 0 and 90. Values have
- * been multiplied by 65536 and rounded.
- * </p>
- */
-static int[] sineTable = {
- 0, 1143, 2287, 3429, 4571, 5711, 6850, 7986, 9120, 10252, // 0 to 9 degrees
- 11380, 12504, 13625, 14742, 15854, 16961, 18064, 19160, 20251, 21336, // 10 to 19 degrees
- 22414, 23486, 24550, 25606, 26655, 27696, 28729, 29752, 30767, 31772, // 20 to 29 degrees
- 32767, 33753, 34728, 35693, 36647, 37589, 38521, 39440, 40347, 41243, // 30 to 39 degrees
- 42125, 42995, 43852, 44695, 45525, 46340, 47142, 47929, 48702, 49460, // 40 to 49 degrees
- 50203, 50931, 51643, 52339, 53019, 53683, 54331, 54963, 55577, 56175, // 50 to 59 degrees
- 56755, 57319, 57864, 58393, 58903, 59395, 59870, 60326, 60763, 61183, // 60 to 69 degrees
- 61583, 61965, 62328, 62672, 62997, 63302, 63589, 63856, 64103, 64331, // 70 to 79 degrees
- 64540, 64729, 64898, 65047, 65176, 65286, 65376, 65446, 65496, 65526, // 80 to 89 degrees
- 65536 }; // 90 degrees
-
-/**
- * Answers the length of the side adjacent to the given angle
- * of a right triangle. In other words, it returns the integer
- * conversion of length * cos (angle).
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the argument. length must be between -32767 and 32767 (inclusive).
- * </p>
- *
- * @param angle the angle in degrees
- * @param length the length of the triangle's hypotenuse
- * @return the integer conversion of length * cos (angle)
- */
-public static int cos(int angle, int length) {
- return sin(90 - angle, length);
-}
-
-/**
- * Answers the length of the side opposite to the given angle
- * of a right triangle. In other words, it returns the integer
- * conversion of length * sin (angle).
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the argument. length must be between -32767 and 32767 (inclusive).
- * </p>
- *
- * @param angle the angle in degrees
- * @param length the length of the triangle's hypotenuse
- * @return the integer conversion of length * sin (angle)
- */
-public static int sin(int angle, int length) {
- if (length < -32767 || length > 32767) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- if (angle < 0 || angle >= 360) {
- angle = angle % 360;
- if (angle < 0) angle += 360;
- }
-
- int sineValue;
- if (angle >= 0 && angle < 90) sineValue = sineTable[angle];
- else if (angle >= 90 && angle < 180) sineValue = sineTable[180 - angle];
- else if (angle >= 180 && angle < 270) sineValue = 0 - sineTable[angle - 180];
- else {
- // angle >= 270 && angle < 360
- sineValue = 0 - sineTable[360 - angle];
- }
-
- return (sineValue * length) >> 16;
-}
-
-/**
- * Answers the most negative (i.e. closest to negative infinity)
- * integer value which is greater than the number obtained by dividing
- * the first argument p by the second argument q.
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the ceiling of the rational number p / q.
- */
-public static int ceil(int p, int q) {
- int res = p / q;
- if ((p % q == 0) ||
- (res < 0) ||
- ((res == 0) && ((p < 0 && q > 0) || (p > 0 && q < 0))))
- return res;
- else
- return res + 1;
-}
-
-/**
- * Answers the most positive (i.e. closest to positive infinity)
- * integer value which is less than the number obtained by dividing
- * the first argument p by the second argument q.
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the floor of the rational number p / q.
- */
-public static int floor(int p, int q) {
- int res = p / q;
- if ((p % q == 0) ||
- (res > 0) ||
- ((res == 0) && ((p > 0 && q > 0) || (p < 0 && q < 0))))
- return res;
- else
- return res - 1;
-}
-
-/**
- * Answers the result of rounding to the closest integer the number obtained
- * by dividing the first argument p by the second argument q.
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the arguments. p must be within the range 0 - 32767 (inclusive).
- * q must be within the range 1 - 32767 (inclusive).
- * </p>
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the closest integer to the rational number p / q
- */
-public static int round(int p, int q) {
- if (p < 0 || p > 32767 || q < 1 || q > 32767) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- return (2 * p + q) / (2 * q);
-}
-
-/**
- * Returns 2 raised to the power of the argument.
- *
- * @param n an int value between 0 and 30 (inclusive)
- * @return 2 raised to the power of the argument
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the argument is not between 0 and 30 (inclusive)</li>
- * </ul>
- */
-public static int pow2(int n) {
- if (n >= 1 && n <= 30)
- return 2 << (n - 1);
- else if (n != 0) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- return 1;
-}
-
-/**
- * Open a file if such things are supported.
- *
- * @param filename the name of the file to open
- * @return a stream on the file if it could be opened.
- */
-public static InputStream newFileInputStream (String filename) throws IOException {
- throw new IOException();
-}
-
-/**
- * Open a file if such things are supported.
- *
- * @param filename the name of the file to open
- * @return a stream on the file if it could be opened.
- */
-public static OutputStream newFileOutputStream (String filename) throws IOException {
- throw new IOException();
-}
-
-/**
- * Answers whether the character is a letter.
- *
- * @param c the character
- * @return true when the character is a letter
- */
-public static boolean isLetter(char c) {
- return (Character.isUpperCase(c)) || (Character.isLowerCase(c));
-}
-
-/**
- * Answers whether the character is a letter or a digit.
- *
- * @param c the character
- * @return true when the character is a letter or a digit
- */
-public static boolean isLetterOrDigit(char c) {
- return isLetter(c) || Character.isDigit(c);
-}
-
-/**
- * Answers whether the character is a Unicode space character.
- *
- * @param c the character
- * @return true when the character is a Unicode space character
- */
-public static boolean isSpaceChar(char c) {
- return c == ' ';
-}
-
-/**
- * Answers whether the character is whitespace character.
- *
- * @param c the character
- * @return true when the character is a whitespace character
- */
-public static boolean isWhitespace(char c) {
- // Optimized case for ASCII
- if ((c >= 0x1c && c <= 0x20) || (c >= 0x9 && c <= 0xd))
- return true;
- return false;
-}
-
-/**
- * Execute a program in a separate platform process if the
- * underlying platform support this.
- * <p>
- * The new process inherits the environment of the caller.
- * </p>
- *
- * @param program the name of the program to execute
- *
- * @exception IOException
- * if the program cannot be executed
- * @exception SecurityException
- * if the current SecurityManager disallows program execution
- */
-public static void exec(String prog) throws java.io.IOException {
- throw new IOException();
-}
-
-/**
- * Execute progArray[0] in a separate platform process if the
- * underlying platform support this.
- * <p>
- * The new process inherits the environment of the caller.
- * <p>
- *
- * @param progArray array containing the program to execute and its arguments
- *
- * @exception IOException
- * if the program cannot be executed
- * @exception SecurityException
- * if the current SecurityManager disallows program execution
- */
-public static void exec(String[] progArray) throws java.io.IOException{
- throw new IOException();
-}
-
-/**
- * Returns the NLS'ed message for the given argument. This is only being
- * called from SWT.
- *
- * @param key the key to look up
- * @return the message for the given key
- *
- * @see SWT#getMessage
- */
-public static String getMessage(String key) {
- String answer = key;
-
- if (key == null)
- SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (key.equals( "SWT_Yes"))
- return "Yes";
- if (key.equals("SWT_No"))
- return "No";
- if (key.equals("SWT_OK"))
- return "OK";
- if (key.equals("SWT_Cancel"))
- return "Cancel";
- if (key.equals("SWT_Abort"))
- return "Abort";
- if (key.equals("SWT_Retry"))
- return "Retry";
- if (key.equals("SWT_Ignore"))
- return "Ignore";
- if (key.equals("SWT_Sample"))
- return "Sample";
- if (key.equals("SWT_A_Sample_Text"))
- return "A Sample Text";
- if (key.equals("SWT_Selection"))
- return "Selection";
- if (key.equals("SWT_Current_Selection"))
- return "Current Selection";
- if (key.equals("SWT_Character_set"))
- return "Character set";
- if (key.equals("SWT_Font"))
- return "Font";
- if (key.equals("SWT_Extended_style"))
- return "Extended style";
- if (key.equals("SWT_Size"))
- return "Size";
- if (key.equals("SWT_Style"))
- return "Style";
-
- return key;
-}
-
-/**
- * Interrupt the current thread.
- * <p>
- * Note that this is not available on CLDC.
- * </p>
- */
-public static void interrupt() {
-}
-
-/**
- * Compares two instances of class String ignoring the case of the
- * characters and answers if they are equal.
- *
- * @param s1 string
- * @param s2 string
- * @return true if the two instances of class String are equal
- */
-public static boolean equalsIgnoreCase(String s1, String s2) {
- if (s1 == s2) return true;
- if (s2 == null || s1.length() != s2.length()) return false;
-
- char[] cArray1 = s1.toCharArray();
- char[] cArray2 = s2.toCharArray();
- int length = s1.length();
- char c1, c2;
-
- for (int index = 0; index < length; index++) {
- c1 = cArray1[index];
- c2 = cArray2[index];
- if (c1 != c2 &&
- Character.toUpperCase(c1) != Character.toUpperCase(c2) &&
- Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * Copies a range of characters into a new String.
- *
- * @param buffer the StringBuffer we want to copy from
- * @param start the offset of the first character
- * @param end the offset one past the last character
- * @return a new String containing the characters from start to end - 1
- *
- * @exception IndexOutOfBoundsException
- * when <code>start < 0, start > end</code> or <code>end > length()</code>
- */
-public static String substring(StringBuffer buffer, int start, int end) {
- return buffer.toString().substring(start, end);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventListener.java
deleted file mode 100644
index 6e602486ad..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This interface is the cross-platform version of the
- * java.util.EventListener interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement SWTEventListener instead of java.util.EventListener.
- * </p>
- * <p>
- * Note: java.util.EventListener is not part of CDC and CLDC.
- * </p>
- */
-public interface SWTEventListener {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventObject.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventObject.java
deleted file mode 100644
index 4acab638b5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SWTEventObject.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.swt.internal;
-
-/**
- * This class is the cross-platform version of the
- * java.util.EventObject class.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * extend SWTEventObject instead of java.util.EventObject.
- * </p>
- * <p>
- * Note: java.util.EventObject is not part of CDC and CLDC.
- * </p>
- */
-public class SWTEventObject implements SerializableCompatibility {
-
- /**
- * The event source.
- */
- protected transient Object source;
-
-/**
- * Constructs a new instance of this class.
- *
- * @param source the object which fired the event
- */
-public SWTEventObject(Object source) {
- if (source != null) this.source = source;
- else throw new IllegalArgumentException();
-}
-
-/**
- * Answers the event source.
- *
- * @return the object which fired the event
- */
-public Object getSource() {
- return source;
-}
-
-/**
- * Answers the string representation of this SWTEventObject.
- *
- * @return the string representation of this SWTEventObject
- */
-public String toString() {
- return getClass().getName() + "[source=" + String.valueOf(source) + ']';
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SerializableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SerializableCompatibility.java
deleted file mode 100644
index db2aa3eedb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/SerializableCompatibility.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This interface is the cross-platform version of the
- * java.io.Serializable interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement SerializableCompatibility instead of
- * java.io.Serializable.
- * </p>
- * <p>
- * Note: java.io.Serializable is not part of CLDC.
- * </p>
- * <p>
- * IMPORTANT: CDC mandates Serializable. Behavior on CLDC will have
- * to be discussed further.
- * </p>
- */
-public interface SerializableCompatibility {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java
deleted file mode 100644
index e1fe1f1620..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This interface is the cross-platform version of the
- * java.lang.Cloneable interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement CloneableCompatibility instead of java.lang.Cloneable.
- * </p>
- * <p>
- * Note: java.lang.Cloneable is not part of CLDC.
- * </p>
- */
-public interface CloneableCompatibility extends Cloneable {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
deleted file mode 100644
index 090aa4a8cc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package org.eclipse.swt.internal;
-
-import java.io.*;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import org.eclipse.swt.SWT;
-
-/**
- * This class is a placeholder for utility methods commonly
- * used on J2SE platforms but not supported on some J2ME
- * profiles.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms.
- * </p>
- * <p>
- * IMPORTANT: some of the methods have been modified from their
- * J2SE parents. Refer to the description of each method for
- * specific changes.
- * </p>
- * <ul>
- * <li>Exceptions thrown may differ since J2ME's set of
- * exceptions is a subset of J2SE's one.
- * </li>
- * <li>The range of the mathematic functions is subject to
- * change.
- * </li>
- * </ul>
- */
-public final class Compatibility {
-
-static double pi = 3.1415926535;
-static double toRadians = pi / 180;
-
-/**
- * Answers the length of the side adjacent to the given angle
- * of a right triangle. In other words, it returns the integer
- * conversion of length * cos (angle).
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the argument. length must be between -32767 and 32767 (inclusive).
- * </p>
- *
- * @param angle the angle in degrees
- * @param length the length of the triangle's hypotenuse
- * @return the integer conversion of length * cos (angle)
- */
-public static int cos(int angle, int length) {
- return (int)(Math.cos(angle * toRadians) * length);
-}
-
-/**
- * Answers the length of the side opposite to the given angle
- * of a right triangle. In other words, it returns the integer
- * conversion of length * sin (angle).
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the argument. length must be between -32767 and 32767 (inclusive).
- * </p>
- *
- * @param angle the angle in degrees
- * @param length the length of the triangle's hypotenuse
- * @return the integer conversion of length * sin (angle)
- */
-public static int sin(int angle, int length) {
- return (int)(Math.sin(angle * toRadians) * length);
-}
-
-/**
- * Answers the most negative (i.e. closest to negative infinity)
- * integer value which is greater than the number obtained by dividing
- * the first argument p by the second argument q.
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the ceiling of the rational number p / q.
- */
-public static int ceil(int p, int q) {
- return (int)Math.ceil((float)p / q);
-}
-
-/**
- * Answers the most positive (i.e. closest to positive infinity)
- * integer value which is less than the number obtained by dividing
- * the first argument p by the second argument q.
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the floor of the rational number p / q.
- */
-public static int floor(int p, int q) {
- return (int)Math.floor((double)p / q);
-}
-
-/**
- * Answers the result of rounding to the closest integer the number obtained
- * by dividing the first argument p by the second argument q.
- * <p>
- * IMPORTANT: the j2me version has an additional restriction on
- * the arguments. p must be within the range 0 - 32767 (inclusive).
- * q must be within the range 1 - 32767 (inclusive).
- * </p>
- *
- * @param p numerator
- * @param q denominator (must be different from zero)
- * @return the closest integer to the rational number p / q
- */
-public static int round(int p, int q) {
- return (int)Math.round((float)p / q);
-}
-
-/**
- * Returns 2 raised to the power of the argument.
- *
- * @param n an int value between 0 and 30 (inclusive)
- * @return 2 raised to the power of the argument
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the argument is not between 0 and 30 (inclusive)</li>
- * </ul>
- */
-public static int pow2(int n) {
- if (n >= 1 && n <= 30)
- return 2 << (n - 1);
- else if (n != 0) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- return 1;
-}
-
-/**
- * Open a file if such things are supported.
- *
- * @param filename the name of the file to open
- * @return a stream on the file if it could be opened.
- */
-public static InputStream newFileInputStream(String filename) throws IOException {
- return new FileInputStream(filename);
-}
-
-/**
- * Open a file if such things are supported.
- *
- * @param filename the name of the file to open
- * @return a stream on the file if it could be opened.
- */
-public static OutputStream newFileOutputStream(String filename) throws IOException {
- return new FileOutputStream(filename);
-}
-
-/**
- * Answers whether the character is a letter.
- *
- * @param c the character
- * @return true when the character is a letter
- */
-public static boolean isLetter(char c) {
- return Character.isLetter(c);
-}
-
-/**
- * Answers whether the character is a letter or a digit.
- *
- * @param c the character
- * @return true when the character is a letter or a digit
- */
-public static boolean isLetterOrDigit(char c) {
- return Character.isLetterOrDigit(c);
-}
-
-/**
- * Answers whether the character is a Unicode space character.
- *
- * @param c the character
- * @return true when the character is a Unicode space character
- */
-public static boolean isSpaceChar(char c) {
- return Character.isSpaceChar(c);
-}
-
-/**
- * Answers whether the character is a whitespace character.
- *
- * @param ch the character to test
- * @return true if the character is whitespace
- */
-public static boolean isWhitespace(char c) {
- return Character.isWhitespace(c);
-}
-
-/**
- * Execute a program in a separate platform process if the
- * underlying platform support this.
- * <p>
- * The new process inherits the environment of the caller.
- * </p>
- *
- * @param program the name of the program to execute
- *
- * @exception IOException
- * if the program cannot be executed
- * @exception SecurityException
- * if the current SecurityManager disallows program execution
- */
-public static void exec(String prog) throws java.io.IOException {
- Runtime.getRuntime().exec(prog);
-}
-
-/**
- * Execute progArray[0] in a separate platform process if the
- * underlying platform support this.
- * <p>
- * The new process inherits the environment of the caller.
- * <p>
- *
- * @param progArray array containing the program to execute and its arguments
- *
- * @exception IOException
- * if the program cannot be executed
- * @exception SecurityException
- * if the current SecurityManager disallows program execution
- */
-public static void exec(String[] progArray) throws java.io.IOException{
- Runtime.getRuntime().exec(progArray);
-}
-
-private static ResourceBundle msgs = null;
-
-/**
- * Returns the NLS'ed message for the given argument. This is only being
- * called from SWT.
- *
- * @param key the key to look up
- * @return the message for the given key
- *
- * @see SWT#getMessage
- */
-public static String getMessage(String key) {
- String answer = key;
-
- if (key == null) {
- SWT.error (SWT.ERROR_NULL_ARGUMENT);
- }
- if (msgs == null) {
- try {
- msgs = ResourceBundle.getBundle("org.eclipse.swt.internal.SWTMessages");
- } catch (MissingResourceException ex) {
- answer = key + " (no resource bundle)";
- }
- }
- if (msgs != null) {
- try {
- answer = msgs.getString(key);
- } catch (MissingResourceException ex2) {}
- }
- return answer;
-}
-
-/**
- * Interrupt the current thread.
- * <p>
- * Note that this is not available on CLDC.
- * </p>
- */
-public static void interrupt() {
- Thread.currentThread().interrupt();
-}
-
-/**
- * Compares two instances of class String ignoring the case of the
- * characters and answers if they are equal.
- *
- * @param s1 string
- * @param s2 string
- * @return true if the two instances of class String are equal
- */
-public static boolean equalsIgnoreCase(String s1, String s2) {
- return s1.equalsIgnoreCase(s2);
-}
-
-/**
- * Copies a range of characters into a new String.
- *
- * @param buffer the StringBuffer we want to copy from
- * @param start the offset of the first character
- * @param end the offset one past the last character
- * @return a new String containing the characters from start to end - 1
- *
- * @exception IndexOutOfBoundsException
- * when <code>start < 0, start > end</code> or <code>end > length()</code>
- */
-public static String substring(StringBuffer buffer, int start, int end) {
- return buffer.substring(start, end);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java
deleted file mode 100644
index 9b3b7bbd43..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.EventListener;
-
-/**
- * This interface is the cross-platform version of the
- * java.util.EventListener interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement SWTEventListener instead of java.util.EventListener.
- * </p>
- * <p>
- * Note: java.util.EventListener is not part of CDC and CLDC.
- * </p>
- */
-public interface SWTEventListener extends EventListener {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java
deleted file mode 100644
index 33f9d5ace5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.internal;
-
-import java.util.EventObject;
-
-/**
- * This class is the cross-platform version of the
- * java.util.EventObject class.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * extend SWTEventObject instead of java.util.EventObject.
- * </p>
- * <p>
- * Note: java.util.EventObject is not part of CDC and CLDC.
- * </p>
- */
-public class SWTEventObject extends EventObject {
-
-/**
- * Constructs a new instance of this class.
- *
- * @param source the object which fired the event
- */
-public SWTEventObject(Object source) {
- super(source);
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
deleted file mode 100644
index 7510e2b02c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-SWT_Yes=Yes
-SWT_No=No
-SWT_OK=OK
-SWT_Cancel=Cancel
-SWT_Abort=Abort
-SWT_Retry=Retry
-SWT_Ignore=Ignore
-SWT_Sample=Sample
-SWT_A_Sample_Text=A Sample Text
-SWT_Selection=Selection
-SWT_Current_Selection=Current Selection
-SWT_Character_set=Character set
-SWT_Font=Font
-SWT_Extended_style=Extended style
-SWT_Size=Size
-SWT_Style=Style
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java
deleted file mode 100644
index 978f5d323e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.Serializable;
-
-/**
- * This interface is the cross-platform version of the
- * java.io.Serializable interface.
- * <p>
- * It is part of our effort to provide support for both J2SE
- * and J2ME platforms. Under this scheme, classes need to
- * implement SerializableCompatibility instead of
- * java.io.Serializable.
- * </p>
- * <p>
- * Note: java.io.Serializable is not part of CLDC.
- * </p>
- */
-public interface SerializableCompatibility extends Serializable {
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java
deleted file mode 100644
index b67bbb6b01..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.internal; /* * (c) Copyright IBM Corp. 2001, 2002. * All Rights Reserved */
-import org.eclipse.swt.graphics.GC;
-
-/*
- * This class is supplied so that the StyledText code that supports bidi text (supported
- * for win platforms) is not platform dependent. Bidi text is not implemented on
- * emulated platforms.
- */
-public class BidiUtil {
- // Keyboard language ids
- public static final int KEYBOARD_LATIN = 0;
- public static final int KEYBOARD_HEBREW = 1;
- public static final int KEYBOARD_ARABIC = 2;
-
- // bidi rendering input flag constants, not used
- // on emulated platforms
- public static final int CLASSIN = 1;
- public static final int LINKBEFORE = 2;
- public static final int LINKAFTER = 4;
-
- // bidi rendering/ordering constants, not used on
- // emulated platforms
- public static final int CLASS_HEBREW = 2;
- public static final int CLASS_ARABIC = 2;
- public static final int CLASS_LOCALNUMBER = 4;
- public static final int REORDER = 0;
- public static final int LIGATE = 0;
- public static final int GLYPHSHAPE = 0;
-
-/*
- * Not implemented.
- */
-public static void addLanguageListener(int hwnd, Runnable runnable) {
-}
-/*
- * Not implemented.
- *
- */
-public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) {
-}
-/*
- * Bidi not supported on emulated platforms.
- *
- */
-public static boolean isBidiPlatform() {
- return false;
-}
-/*
- * Not implemented.
- */
-public static int getFontBidiAttributes(GC gc) {
- return 0;
-}
-/*
- * Not implemented.
- *
- */
-public static void getOrderInfo(GC gc, String text, int[] order, byte[] classBuffer, int flags, int [] offsets) {
-}
-/*
- * Not implemented. Returns null.
- *
- */
-public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) {
- return null;
-}
-/*
- * Not implemented. Returns 0.
- */
-public static int getKeyboardLanguage() {
- return 0;
-}
-/*
- * Not implemented.
- */
-public static void removeLanguageListener(int hwnd) {
-}
-/*
- * Not implemented.
- */
-public static void setKeyboardLanguage(int language) {
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java
deleted file mode 100644
index 6e7eefb832..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java
+++ /dev/null
@@ -1,933 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an area for dynamically
- * positioning the items they contain.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>CoolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class CoolBar extends Composite {
- CoolItem[][] items = new CoolItem[0][0];
- CoolItem[] originalItems = new CoolItem[0];
- Cursor hoverCursor, dragCursor;
- CoolItem dragging = null;
- int mouseXOffset, itemXOffset;
- Point click = new Point(0, 0);
- static final int ROW_SPACING = 2;
- static final int CLICK_DISTANCE = 3;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolBar (Composite parent, int style) {
- super (parent, checkStyle(style));
- Display display = getDisplay();
- hoverCursor = new Cursor(display, SWT.CURSOR_SIZEWE);
- dragCursor = new Cursor(display, SWT.CURSOR_SIZEALL);
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose: onDispose(); break;
- case SWT.MouseDown: onMouseDown(event); break;
- case SWT.MouseExit: onMouseExit(); break;
- case SWT.MouseMove: onMouseMove(event); break;
- case SWT.MouseUp: onMouseUp(event); break;
- case SWT.Paint: onPaint(event); break;
- }
- }
- };
- int[] events = new int[] {
- SWT.Dispose,
- SWT.MouseDown,
- SWT.MouseExit,
- SWT.MouseMove,
- SWT.MouseUp,
- SWT.Paint
- };
- for (int i = 0; i < events.length; i++) {
- addListener(events[i], listener);
- }
-}
-private static int checkStyle (int style) {
- return (style | SWT.NO_REDRAW_RESIZE | SWT.NO_FOCUS) & ~(SWT.V_SCROLL | SWT.H_SCROLL);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = 0, height = 0;
- for (int row = 0; row < items.length; row++) {
- int rowWidth = 0, rowHeight = 0;
- for (int i = 0; i < items[row].length; i++) {
- rowWidth += items[row][i].preferredWidth;
- rowHeight = Math.max(rowHeight, items[row][i].getSize().y);
- }
- height += rowHeight;
- if (row > 0) height += ROW_SPACING;
- width = Math.max(width, rowWidth);
- }
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth();
- width += 2 * border;
- height += 2 * border;
- return new Point(width, height);
-}
-CoolItem getGrabbedItem(int x, int y) {
- for (int row = 0; row < items.length; row++) {
- for (int i = 0; i < items[row].length; i++) {
- CoolItem item = items[row][i];
- Rectangle bounds = item.getBounds();
- bounds.width = CoolItem.MINIMUM_WIDTH;
- if (bounds.x > x) break;
- if (bounds.y > y) return null;
- if (bounds.contains(x, y)) {
- return item;
- }
- }
- }
- return null;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public CoolItem getItem (int index) {
- checkWidget();
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- for (int row = 0; row < items.length; row++) {
- if (items[row].length > index) {
- return items[row][index];
- } else {
- index -= items[row].length;
- }
- }
- error (SWT.ERROR_INVALID_RANGE);
- return null;
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- return originalItems.length;
-}
-/**
- * Returns an array of <code>CoolItems</code>s which are the
- * items in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public CoolItem [] getItems () {
- checkWidget();
- CoolItem [] result = new CoolItem [getItemCount()];
- int offset = 0;
- for (int row = 0; row < items.length; row++) {
- System.arraycopy(items[row], 0, result, offset, items[row].length);
- offset += items[row].length;
- }
- return result;
-}
-Point findItem (CoolItem item) {
- for (int row = 0; row < items.length; row++) {
- for (int i = 0; i < items[row].length; i++) {
- if (items[row][i].equals(item)) return new Point(i, row);
- }
- }
- return new Point(-1, -1);
-}
-/**
- * Searches the receiver's items, in the order they were
- * added, starting at the first item (index 0) until an item
- * is found that is equal to the argument, and returns the
- * index of that item. If no item is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item is disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (CoolItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- int answer = 0;
- for (int row = 0; row < items.length; row++) {
- for (int i = 0; i < items[row].length; i++) {
- if (items[row][i].equals(item)) {
- return answer;
- } else {
- answer++;
- }
- }
- }
- return -1;
-}
-/**
- * Insert the item into the row. Adjust the x and width values
- * appropriately.
- */
-void insertItemIntoRow(CoolItem item, int rowIndex, int x_root) {
- int barWidth = getSize().x;
- int rowY = items[rowIndex][0].getBounds().y;
- int x = Math.max(0, x_root - toDisplay(new Point(0, 0)).x);
-
- /* Find the insertion index and add the item. */
- int index;
- for (index = 0; index < items[rowIndex].length; index++) {
- if (x < items[rowIndex][index].getBounds().x) break;
- }
- int oldLength = items[rowIndex].length;
- CoolItem[] newRow = new CoolItem[oldLength + 1];
- System.arraycopy(items[rowIndex], 0, newRow, 0, index);
- newRow[index] = item;
- System.arraycopy(items[rowIndex], index, newRow, index + 1, oldLength - index);
- items[rowIndex] = newRow;
-
- /* Adjust the width of the item to the left. */
- if (index > 0) {
- CoolItem left = items[rowIndex][index - 1];
- Rectangle leftBounds = left.getBounds();
- int newWidth = x - leftBounds.x;
- if (newWidth < CoolItem.MINIMUM_WIDTH) {
- x += CoolItem.MINIMUM_WIDTH - newWidth;
- newWidth = CoolItem.MINIMUM_WIDTH;
- }
- left.setBounds(leftBounds.x, leftBounds.y, newWidth, leftBounds.height);
- left.requestedWidth = newWidth;
- }
-
- /* Set the item's bounds. */
- int width = 0, height = item.getSize().y;
- if (index < items[rowIndex].length - 1) {
- CoolItem right = items[rowIndex][index + 1];
- width = right.getBounds().x - x;
- if (width < CoolItem.MINIMUM_WIDTH) {
- moveRight(right, CoolItem.MINIMUM_WIDTH - width);
- width = right.getBounds().x - x;
- }
- item.setBounds(x, rowY, width, height);
- if (width < CoolItem.MINIMUM_WIDTH) moveLeft(item, CoolItem.MINIMUM_WIDTH - width);
- } else {
- width = Math.max(CoolItem.MINIMUM_WIDTH, barWidth - x);
- item.setBounds(x, rowY, width, height);
- if (x + width > barWidth) moveLeft(item, x + width - barWidth);
- }
- Rectangle bounds = item.getBounds();
- item.requestedWidth = bounds.width;
- redraw(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height, false);
-}
-void createItem (CoolItem item, int index) {
- int itemCount = getItemCount(), row = 0;
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE);
- if (items.length == 0) {
- items = new CoolItem[1][1];
- items[0][0] = item;
- }
- else {
- int i = index;
- /* find the row to insert into */
- if (index < itemCount) {
- while (i > items[row].length) {
- i -= items[row].length;
- row++;
- }
- }
- else {
- row = items.length - 1;
- i = items[row].length;
- }
- int oldLength = items[row].length;
- CoolItem[] newRow = new CoolItem[oldLength + 1];
- System.arraycopy(items[row], 0, newRow, 0, i);
- newRow[index] = item;
- System.arraycopy(items[row], i, newRow, i + 1, oldLength - i);
- items[row] = newRow;
- }
- item.requestedWidth = CoolItem.MINIMUM_WIDTH;
- layoutItems();
-
- int length = originalItems.length;
- CoolItem [] newOriginals = new CoolItem [length + 1];
- System.arraycopy (originalItems, 0, newOriginals, 0, index);
- System.arraycopy (originalItems, index, newOriginals, index + 1, length - index);
- newOriginals [index] = item;
- originalItems = newOriginals;
-}
-void destroyItem(CoolItem item) {
- int row = findItem(item).y;
- if (row == -1) return;
- Rectangle bounds = item.getBounds();
- removeItemFromRow(item, row);
- redraw(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height, false);
- layoutItems();
-
- int index = 0;
- while (index < originalItems.length) {
- if (originalItems [index] == item) break;
- index++;
- }
- int length = originalItems.length - 1;
- CoolItem [] newOriginals = new CoolItem [length];
- System.arraycopy (originalItems, 0, newOriginals, 0, index);
- System.arraycopy (originalItems, index + 1, newOriginals, index, length - index);
- originalItems = newOriginals;
-}
-void moveDown(CoolItem item, int x_root) {
- int oldRowIndex = findItem(item).y;
- boolean resize = false;
- if (items[oldRowIndex].length == 1) {
- resize = true;
- /* If this is the only item in the bottom row, don't move it. */
- if (oldRowIndex == items.length - 1) return;
- }
- int newRowIndex = (items[oldRowIndex].length == 1) ? oldRowIndex : oldRowIndex + 1;
- removeItemFromRow(item, oldRowIndex);
- Rectangle old = item.getBounds();
- redraw(old.x, old.y, CoolItem.MINIMUM_WIDTH, old.height, false);
- if (newRowIndex == items.length) {
- /* Create a new bottom row for the item. */
- CoolItem[][] newRows = new CoolItem[items.length + 1][];
- System.arraycopy(items, 0, newRows, 0, items.length);
- int row = items.length;
- newRows[row] = new CoolItem[1];
- newRows[row][0] = item;
- items = newRows;
- resize = true;
- }
- else {
- insertItemIntoRow(item, newRowIndex, x_root);
- }
- if (resize) relayout();
- else layoutItems();
-}
-void moveLeft(CoolItem item, int pixels) {
- Point point = findItem(item);
- int row = point.y;
- int index = point.x;
- if (index == 0) return;
- Rectangle bounds = item.getBounds();
- int min = index * CoolItem.MINIMUM_WIDTH;
- int x = Math.max(min, bounds.x - pixels);
- CoolItem left = items[row][index - 1];
- Rectangle leftBounds = left.getBounds();
- if (leftBounds.x + CoolItem.MINIMUM_WIDTH > x) {
- int shift = leftBounds.x + CoolItem.MINIMUM_WIDTH - x;
- moveLeft(left, shift);
- leftBounds = left.getBounds();
- }
- int leftWidth = Math.max(CoolItem.MINIMUM_WIDTH, leftBounds.width - pixels);
- left.setBounds(leftBounds.x, leftBounds.y, leftWidth, leftBounds.height);
- left.requestedWidth = leftWidth;
- int width = bounds.width + (bounds.x - x);
- item.setBounds(x, bounds.y, width, bounds.height);
- item.requestedWidth = width;
-
- int damagedWidth = bounds.x - x + CoolItem.MINIMUM_WIDTH;
- if (damagedWidth > CoolItem.MINIMUM_WIDTH) {
- redraw(x, bounds.y, damagedWidth, bounds.height, false);
- }
-}
-void moveRight(CoolItem item, int pixels) {
- Point point = findItem(item);
- int row = point.y;
- int index = point.x;
- if (index == 0) return;
- Rectangle bounds = item.getBounds();
- int minSpaceOnRight = (items[row].length - index) * CoolItem.MINIMUM_WIDTH;
- int max = getBounds().width - minSpaceOnRight;
- int x = Math.min(max, bounds.x + pixels);
- int width = 0;
- if (index + 1 == items[row].length) {
- width = getBounds().width - x;
- } else {
- CoolItem right = items[row][index + 1];
- Rectangle rightBounds = right.getBounds();
- if (x + CoolItem.MINIMUM_WIDTH > rightBounds.x) {
- int shift = x + CoolItem.MINIMUM_WIDTH - rightBounds.x;
- moveRight(right, shift);
- rightBounds = right.getBounds();
- }
- width = rightBounds.x - x;
- }
- item.setBounds(x, bounds.y, width, bounds.height);
- item.requestedWidth = width;
- CoolItem left = items[row][index - 1];
- Rectangle leftBounds = left.getBounds();
- int leftWidth = x - leftBounds.x;
- left.setBounds(leftBounds.x, leftBounds.y, leftWidth, leftBounds.height);
- left.requestedWidth = leftWidth;
-
- int damagedWidth = x - bounds.x + CoolItem.MINIMUM_WIDTH + CoolItem.MARGIN_WIDTH;
- if (x - bounds.x > 0) {
- redraw(bounds.x - CoolItem.MARGIN_WIDTH, bounds.y, damagedWidth, bounds.height, false);
- }
-}
-void moveUp(CoolItem item, int x_root) {
- Point point = findItem(item);
- int oldRowIndex = point.y;
- boolean resize = false;
- if (items[oldRowIndex].length == 1) {
- resize = true;
- /* If this is the only item in the top row, don't move it. */
- if (oldRowIndex == 0) return;
- }
- removeItemFromRow(item, oldRowIndex);
- Rectangle old = item.getBounds();
- redraw(old.x, old.y, CoolItem.MINIMUM_WIDTH, old.height, false);
- int newRowIndex = Math.max(0, oldRowIndex - 1);
- if (oldRowIndex == 0) {
- /* Create a new top row for the item. */
- CoolItem[][] newRows = new CoolItem[items.length + 1][];
- System.arraycopy(items, 0, newRows, 1, items.length);
- newRows[0] = new CoolItem[1];
- newRows[0][0] = item;
- items = newRows;
- resize = true;
- }
- else {
- insertItemIntoRow(item, newRowIndex, x_root);
- }
- if (resize) relayout();
- else layoutItems();
-}
-void onDispose() {
- hoverCursor.dispose();
- dragCursor.dispose();
-}
-void onMouseDown(Event event) {
- dragging = getGrabbedItem(event.x, event.y);
- if (dragging != null) {
- mouseXOffset = event.x;
- itemXOffset = mouseXOffset - dragging.getBounds().x;
- setCursor(dragCursor);
- }
- click.x = event.x;
- click.y = event.y;
-}
-void onMouseExit() {
- if (dragging == null) setCursor(null);
-}
-void onMouseMove(Event event) {
- CoolItem grabbed = getGrabbedItem(event.x, event.y);
- if (dragging != null) {
- int left_root = toDisplay(new Point(event.x, event.y)).x - itemXOffset;
- Rectangle bounds = dragging.getBounds();
- if (event.y < bounds.y) {
- moveUp(dragging, left_root);
- }
- else if (event.y > bounds.y + bounds.height){
- moveDown(dragging, left_root);
- }
- else if (event.x < mouseXOffset) {
- int distance = Math.min(mouseXOffset, bounds.x + itemXOffset) - event.x;
- if (distance > 0) moveLeft(dragging, distance);
- }
- else if (event.x > mouseXOffset) {
- int distance = event.x - Math.max(mouseXOffset, bounds.x + itemXOffset);
- if (distance > 0) moveRight(dragging, distance);
- }
- mouseXOffset = event.x;
- return;
- }
- if (grabbed != null) {
- setCursor(hoverCursor);
- }
- else {
- setCursor(null);
- }
-}
-void onMouseUp(Event event) {
- dragging = null;
- CoolItem target = getGrabbedItem(event.x, event.y);
- if (target == null) {
- setCursor(null);
- return;
- }
- int xDelta = Math.abs(click.x - event.x), yDelta = Math.abs(click.y - event.y);
- if (xDelta <= CLICK_DISTANCE && yDelta <= CLICK_DISTANCE) {
- Point location = findItem(target);
- int row = location.y;
- int index = location.x;
- if (items[row].length > 1) {
- Point size = target.getSize();
- int maxSize = getSize().x - (items[row].length - 1) * CoolItem.MINIMUM_WIDTH;
- if (size.x == maxSize) {
- /* The item is at its maximum width. It should be resized to its minimum width. */
- int distance = size.x - CoolItem.MINIMUM_WIDTH;
- if (index + 1 < items[row].length) {
- /* There is an item to the right. Maximize it. */
- CoolItem right = items[row][index + 1];
- moveLeft(right, distance);
- }
- else {
- /* There is no item to the right. Move the item all the way right. */
- moveRight(target, distance);
- }
- }
- else if (size.x < target.preferredWidth) {
- /* The item is less than its preferredWidth. Resize to preferredWidth. */
- int distance = target.preferredWidth - size.x;
- if (index + 1 < items[row].length) {
- CoolItem right = items[row][index + 1];
- moveRight(right, distance);
- distance = target.preferredWidth - target.getSize().x;
- }
- if (distance > 0) {
- moveLeft(target, distance);
- }
- }
- else {
- /* The item is at its minimum width. Maximize it. */
- for (int i = 0; i < items[row].length; i++) {
- if (i != index) items[row][i].requestedWidth = CoolItem.MINIMUM_WIDTH;
- }
- target.requestedWidth = getDisplay().getBounds().width;
- layoutItems();
- }
- target = getGrabbedItem(event.x, event.y);
- if (target != null) setCursor(hoverCursor);
- else setCursor(null);
- }
- }
-}
-void onPaint(Event event) {
- GC gc = event.gc;
- if (items.length == 0) return;
- Display display = getDisplay();
- Color shadowColor = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color highlightColor = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- Color lightShadowColor = display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
-
- int y = 0;
- int stopX = getBounds().width;
- for (int row = 0; row < items.length; row++) {
- Rectangle bounds = new Rectangle(0, 0, 0, 0);
- for (int i = 0; i < items[row].length; i++) {
- bounds = items[row][i].getBounds();
- if (!gc.getClipping().intersects(bounds)) continue;
- int grabberHeight = bounds.height - (2 * CoolItem.MARGIN_HEIGHT) - 1;
-
- /* Draw separator. */
- gc.setForeground(shadowColor);
- gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
- gc.setForeground(highlightColor);
- gc.drawLine(bounds.x + 1, bounds.y, bounds.x + 1, bounds.y + bounds.height - 1);
-
- /* Draw grabber. */
- gc.setForeground(shadowColor);
- gc.drawRectangle(
- bounds.x + CoolItem.MARGIN_WIDTH,
- bounds.y + CoolItem.MARGIN_HEIGHT,
- 2,
- grabberHeight);
- gc.setForeground(highlightColor);
- gc.drawLine(
- bounds.x + CoolItem.MARGIN_WIDTH,
- bounds.y + CoolItem.MARGIN_HEIGHT + 1,
- bounds.x + CoolItem.MARGIN_WIDTH,
- bounds.y + CoolItem.MARGIN_HEIGHT + grabberHeight - 1);
- gc.drawLine(
- bounds.x + CoolItem.MARGIN_WIDTH,
- bounds.y + CoolItem.MARGIN_HEIGHT,
- bounds.x + CoolItem.MARGIN_WIDTH + 1,
- bounds.y + CoolItem.MARGIN_HEIGHT);
- }
- if (row + 1 < items.length) {
- /* Draw row separator. */
- int separatorY = bounds.y + bounds.height;
- gc.setForeground(shadowColor);
- gc.drawLine(0, separatorY, stopX, separatorY);
- gc.setForeground(highlightColor);
- gc.drawLine(0, separatorY + 1, stopX, separatorY + 1);
- }
- }
- gc.setForeground(getForeground());
- gc.setBackground(getBackground());
-}
-/**
- * Remove the item from the row. Adjust the x and width values
- * appropriately.
- */
-void removeItemFromRow(CoolItem item, int rowIndex) {
- int index = findItem(item).x;
- int newLength = items[rowIndex].length - 1;
- Rectangle itemBounds = item.getBounds();
- if (newLength > 0) {
- CoolItem[] newRow = new CoolItem[newLength];
- System.arraycopy(items[rowIndex], 0, newRow, 0, index);
- System.arraycopy(items[rowIndex], index + 1, newRow, index, newRow.length - index);
- items[rowIndex] = newRow;
- }
- else {
- CoolItem[][] newRows = new CoolItem[items.length - 1][];
- System.arraycopy(items, 0, newRows, 0, rowIndex);
- System.arraycopy(items, rowIndex + 1, newRows, rowIndex, newRows.length - rowIndex);
- items = newRows;
- return;
- }
- if (index == 0) {
- CoolItem first = items[rowIndex][0];
- Rectangle bounds = first.getBounds();
- int width = bounds.x + bounds.width;
- first.setBounds(0, bounds.y, width, bounds.height);
- first.requestedWidth = width;
- redraw(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height, false);
- } else {
- CoolItem previous = items[rowIndex][index - 1];
- Rectangle bounds = previous.getBounds();
- int width = bounds.width + itemBounds.width;
- previous.setBounds(bounds.x, bounds.y, width, bounds.height);
- previous.requestedWidth = width;
- }
-}
-/**
- * Return the height of the bar after it has
- * been properly layed out for the given width.
- */
-int layoutItems () {
- int y = 0, maxWidth = 0, width = getSize().x;
- for (int row = 0; row < items.length; row++) {
- int count = items[row].length;
- int available = width - count * CoolItem.MINIMUM_WIDTH;
- if (available < 0) available = count * CoolItem.MINIMUM_WIDTH;
- int x = 0;
-
- /* determine the height of the row */
- int rowHeight = 0;
- for (int i = 0; i < items[row].length; i++) {
- CoolItem item = items[row][i];
- if (item.control != null) {
- rowHeight = Math.max(rowHeight, item.control.getSize().y);
- }
- }
- rowHeight += 2 * CoolItem.MARGIN_HEIGHT;
- if (row > 0) y += ROW_SPACING;
-
- /* lay the items out */
- for (int i = 0; i < count; i++) {
- CoolItem child = items[row][i];
- int newWidth = available + CoolItem.MINIMUM_WIDTH;
- if (i + 1 < count) {
- newWidth = Math.min(newWidth, child.requestedWidth);
- available -= (newWidth - CoolItem.MINIMUM_WIDTH);
- }
- Rectangle oldBounds = child.getBounds();
- Rectangle newBounds = new Rectangle(x, y, newWidth, rowHeight);
- if (!oldBounds.equals(newBounds)) {
- child.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
- Rectangle damage = new Rectangle(0, 0, 0, 0);
- /* Cases are in descending order from most area to redraw to least. */
- if (oldBounds.y != newBounds.y) {
- damage = newBounds;
- damage.add(oldBounds);
- /* Redraw the row separator as well. */
- damage.y -= ROW_SPACING;
- damage.height += 2 * ROW_SPACING;
- }
- else if (oldBounds.height != newBounds.height) {
- /*
- * Draw from the bottom of the gripper to the bottom of the new area.
- * (Bottom of the gripper is -3 from the bottom of the item).
- */
- damage.y = newBounds.y + Math.min(oldBounds.height, newBounds.height) - 3;
- damage.height = newBounds.y + newBounds.height + ROW_SPACING;
- damage.x = oldBounds.x - CoolItem.MARGIN_WIDTH;
- damage.width = oldBounds.width + CoolItem.MARGIN_WIDTH;
- }
- else if (oldBounds.x != newBounds.x) {
- /* Redraw only the difference between the separators. */
- damage.x = Math.min(oldBounds.x, newBounds.x);
- damage.width = Math.abs(oldBounds.x - newBounds.x) + CoolItem.MINIMUM_WIDTH;
- damage.y = oldBounds.y;
- damage.height = oldBounds.height;
- }
- redraw(damage.x, damage.y, damage.width, damage.height, false);
- }
- x += newWidth;
- }
- maxWidth = Math.max(maxWidth, x);
- y += rowHeight;
- }
- return y;
-}
-void relayout() {
- Point size = getSize();
- int height = layoutItems();
- height += 2 * getBorderWidth();
- if (height != size.y) super.setSize(size.x, height);
-}
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- layoutItems();
-}
-public void setSize (int width, int height) {
- super.setSize (width, height);
- layoutItems();
-}
-/**
- * Returns an array of zero-relative indices which map the order
- * that the items in the receiver were added in to
- * the order which they are currently being displayed.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's item order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int[] getItemOrder () {
- checkWidget ();
- int count = getItemCount ();
- int [] indices = new int [count];
- count = 0;
- for (int i = 0; i < items.length; i++) {
- for (int j = 0; j < items[i].length; j++) {
- CoolItem item = items[i][j];
- int index = 0;
- while (index<originalItems.length) {
- if (originalItems [index] == item) break;
- index++;
- }
- if (index == originalItems.length) error (SWT.ERROR_CANNOT_GET_ITEM);
- indices [count++] = index;
- }
- }
- return indices;
-}
-void setItemOrder (int[] itemOrder) {
- if (itemOrder == null) error(SWT.ERROR_NULL_ARGUMENT);
- int count = originalItems.length;
- if (itemOrder.length != count) error(SWT.ERROR_INVALID_ARGUMENT);
-
- /* Ensure that itemOrder does not contain any duplicates. */
- boolean [] set = new boolean [count];
- for (int i = 0; i < set.length; i++) set [i] = false;
- for (int i = 0; i < itemOrder.length; i++) {
- if (itemOrder [i] < 0 || itemOrder [i] >= count) error (SWT.ERROR_INVALID_ARGUMENT);
- if (set [itemOrder [i]]) error (SWT.ERROR_INVALID_ARGUMENT);
- set [itemOrder [i]] = true;
- }
-
- CoolItem[] row = new CoolItem[count];
- for (int i = 0; i < count; i++) {
- row[i] = originalItems[itemOrder[i]];
- }
- items = new CoolItem[1][count];
- items[0] = row;
-}
-/**
- * Returns an array of points whose x and y coordinates describe
- * the widths and heights (respectively) of the items in the receiver.
- *
- * @return the receiver's item sizes
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point[] getItemSizes () {
- checkWidget();
- CoolItem[] items = getItems();
- Point[] sizes = new Point[items.length];
- for (int i = 0; i < items.length; i++) {
- sizes[i] = items[i].getSize();
- }
- return sizes;
-}
-void setItemSizes (Point[] sizes) {
- if (sizes == null) error(SWT.ERROR_NULL_ARGUMENT);
- CoolItem[] items = getItems();
- if (sizes.length != items.length) error(SWT.ERROR_INVALID_ARGUMENT);
- for (int i = 0; i < items.length; i++) {
- items[i].setSize(sizes[i]);
- }
-}
-/**
- * Returns an array of ints which describe the zero-relative
- * row number of the row which each of the items in the
- * receiver occurs in.
- *
- * @return the receiver's wrap indices
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int[] getWrapIndices () {
- checkWidget();
- if (items.length <= 1) return new int[]{};
- int[] data = new int[items.length - 1];
- int i = 0, nextWrap = items[0].length;
- for (int row = 1; row < items.length; row++) {
- data[i++] = nextWrap;
- nextWrap += items[row].length;
- }
- return data;
-}
-/**
- * Sets the row that each of the receiver's items will be
- * displayed in to the given array of ints which describe
- * the zero-relative row number of the row for each item.
- * If indices is null, the items will be placed on one line.
- *
- * @param indices the new wrap indices
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWrapIndices (int[] data) {
- checkWidget();
- if (data == null) data = new int[0];
- for (int i=0; i<data.length; i++) {
- if (data[i] < 0 || data[i] >= originalItems.length) error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (items.length == 0) return;
-
- CoolItem[] allItems = getItems();
- items = new CoolItem[0][];
- CoolItem[][] newItems;
- CoolItem[] row;
- int itemIndex = 0;
- for (int i = 0; i <= data.length; i++) {
- int nextWrap = (i < data.length) ? data[i] : allItems.length;
- row = new CoolItem[nextWrap - itemIndex];
- System.arraycopy(allItems, itemIndex, row, 0, row.length);
- itemIndex += row.length;
- newItems = new CoolItem[items.length + 1][];
- System.arraycopy(items, 0, newItems, 0, items.length);
- newItems[items.length] = row;
- items = newItems;
- }
- relayout();
-}
-/**
- * Sets the receiver's item order, wrap indices, and item
- * sizes at once. This equivalent to calling the setter
- * methods for each of these values individually.
- *
- * @param itemOrder the new item order
- * @param wrapIndices the new wrap indices
- * @param size the new item sizes
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItemLayout (int[] itemOrder, int[] wrapIndices, Point[] sizes) {
- checkWidget();
- setItemOrder(itemOrder);
- setWrapIndices(wrapIndices);
- setItemSizes(sizes);
- relayout();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolItem.java
deleted file mode 100644
index bd11897891..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolItem.java
+++ /dev/null
@@ -1,290 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent the dynamically positionable
- * areas of a <code>CoolBar</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class CoolItem extends Item {
- Control control;
- CoolBar parent;
- int preferredWidth, requestedWidth;
- Rectangle itemBounds = new Rectangle(0, 0, 0, 0);
-
- static final int MARGIN_WIDTH = 4;
- static final int MARGIN_HEIGHT = 2;
- static final int GRABBER_WIDTH = 2;
- static final int MINIMUM_WIDTH = (2 * MARGIN_WIDTH) + GRABBER_WIDTH;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolItem (CoolBar parent, int style) {
- super(parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolItem (CoolBar parent, int style, int index) {
- super(parent, 0);
- this.parent = parent;
- parent.createItem (this, index);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a <code>CoolItem</code> is the size that
- * it would best be displayed at. The width hint and height hint arguments
- * allow the caller to ask the instance questions such as "Given a particular
- * width, how high does it need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- checkWidget();
- int width = wHint, height = hHint;
- if (wHint == SWT.DEFAULT) width = 32;
- if (hHint == SWT.DEFAULT) height = 32;
- width += MINIMUM_WIDTH + MARGIN_WIDTH;
- height += 2 * MARGIN_HEIGHT;
- return new Point (width, height);
-}
-public void dispose () {
- if (isDisposed()) return;
-
- /*
- * Must call parent.destroyItem() before super.dispose(), since it needs to
- * query the bounds to properly remove the item.
- */
- parent.destroyItem(this);
- super.dispose ();
- parent = null;
- control = null;
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- return new Rectangle(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height);
-}
-/**
- * Gets the control which is associated with the receiver.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>CoolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public CoolBar getParent () {
- checkWidget();
- return parent;
-}
-public Point getSize () {
- checkWidget();
- return new Point (itemBounds.width, itemBounds.height);
-}
-/**
- * Sets the control which is associated with the receiver
- * to the argument.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- Control oldControl = this.control;
- if (oldControl != null) oldControl.setVisible(false);
- this.control = control;
- if (control != null && !control.isDisposed ()) {
- Rectangle bounds = getBounds();
- control.setBounds (
- bounds.x + MINIMUM_WIDTH,
- bounds.y + MARGIN_HEIGHT,
- bounds.width - MINIMUM_WIDTH - MARGIN_WIDTH,
- bounds.height - (2 * MARGIN_HEIGHT));
-
- control.setVisible(true);
- }
-}
-public void setSize (int width, int height) {
- checkWidget();
- int newWidth = Math.max (width, MINIMUM_WIDTH);
- itemBounds.width = preferredWidth = requestedWidth = newWidth;
- itemBounds.height = height;
- if (control != null) {
- int controlWidth = newWidth - MINIMUM_WIDTH - MARGIN_WIDTH;
- int controlHeight = height - (2 * MARGIN_HEIGHT);
- control.setSize(controlWidth, controlHeight);
- }
- parent.relayout();
-}
-public void setSize (Point size) {
- checkWidget();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-void setBounds (int x, int y, int width, int height) {
- itemBounds.x = x;
- itemBounds.y = y;
- itemBounds.width = width;
- itemBounds.height = height;
- if (control != null) {
- int controlHeight = Math.min(height, control.getSize().y);
- control.setBounds(
- x + MINIMUM_WIDTH,
- y + MARGIN_HEIGHT,
- width - MINIMUM_WIDTH - MARGIN_WIDTH,
- controlHeight);
- }
-}
-public Point getPreferredSize () {
- checkWidget();
- int height = getSize().y;
- return new Point(preferredWidth, height + (2 * MARGIN_HEIGHT));
-}
-public void setPreferredSize (int width, int height) {
- checkWidget();
- preferredWidth = Math.max (width, MINIMUM_WIDTH);
- Rectangle bounds = getBounds();
- setBounds(bounds.x, bounds.y, bounds.width, height);
- if (height != bounds.height) parent.relayout();
-}
-public void setPreferredSize (Point size) {
- checkWidget();
- if (size == null) error(SWT.ERROR_NULL_ARGUMENT);
- setPreferredSize(size.x, size.y);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java
deleted file mode 100644
index 8a5cbef93d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java
+++ /dev/null
@@ -1,1105 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>TabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabFolder extends Composite {
- TabItem items[];
- int selectedIndex = -1;
- int xClient, yClient;
- int imageHeight = -1; // all images have the height of the first image ever set
- int topTabIndex = 0; // index of the first visible tab. Used for tab scrolling
- boolean scrollButtonDown = false; // true=one of the scroll buttons is being pushed
- boolean inDispose = false;
-
- // internal constants
- static final int SCROLL_BUTTON_SIZE = 20; // width/height of the scroll button used for scrolling tab items
- static final int CLIENT_MARGIN_WIDTH = 2; // distance between widget border and client rect
- static final int SELECTED_TAB_TOP_EXPANSION = 2; // amount we expand the selected tab on top
- static final int SELECTED_TAB_HORIZONTAL_EXPANSION = 2; // amount we expand so it overlays to left and right
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabFolder(Composite parent, int style) {
- super(parent, checkStyle (style));
- Listener listener = new Listener() {
- public void handleEvent(Event event) {handleEvents(event);}
- };
- addListener (SWT.Dispose, listener);
- addListener (SWT.MouseDown, listener);
- addListener (SWT.MouseUp, listener);
- addListener (SWT.Paint, listener);
- addListener (SWT.Resize, listener);
- addListener (SWT.Traverse, listener);
- addListener (SWT.KeyDown, listener);
- addListener (SWT.FocusIn, listener);
- addListener (SWT.FocusOut, listener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = CLIENT_MARGIN_WIDTH * 2 + TabItem.SHADOW_WIDTH * 2;
- int height = 0;
-
- if (items != null && items.length > 0) {
- TabItem lastItem = items[items.length-1];
- width = Math.max (width, lastItem.x + lastItem.width);
- }
- Point size;
- Layout layout = getLayout();
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- return new Point (trim.width, trim.height);
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- int border = getBorderWidth ();
- int trimX = x - border - CLIENT_MARGIN_WIDTH - TabItem.SHADOW_WIDTH;
- int trimY = y - border - CLIENT_MARGIN_WIDTH - TabItem.SHADOW_WIDTH;
- int tabHeight = 0;
- if (items != null && items.length > 0) {
- TabItem item = items [0];
- tabHeight = item.y + item.height; // only use height of the first item because all items should be the same height
- }
- int trimWidth = width + border * 2 + CLIENT_MARGIN_WIDTH * 2 + TabItem.SHADOW_WIDTH * 2;
- int trimHeight = height + tabHeight + border * 2 + CLIENT_MARGIN_WIDTH * 2 + TabItem.SHADOW_WIDTH * 2;
- return new Rectangle (trimX, trimY - tabHeight, trimWidth, trimHeight);
-}
-/**
- * Create the specified item at 'index'.
- */
-void createChild (TabItem item, int index) {
- boolean isTabScrolling = isTabScrolling();
-
- if (!(0 <= index && index <= getItemCount ())) error (SWT.ERROR_INVALID_RANGE);
- item.parent = this;
- if (items == null) {
- items = new TabItem[1];
- items[0] = item;
- } else {
- // grow by one and rearrange the array.
- TabItem[] newItems = new TabItem [items.length + 1];
- System.arraycopy(items, 0, newItems, 0, index);
- newItems[index] = item;
- System.arraycopy(items, index, newItems, index + 1, items.length - index);
- items = newItems;
- if (selectedIndex >= index) selectedIndex ++;
- }
- layoutItems();
- redrawTabs();
- // redraw scroll buttons if they just became visible
- // fixes 1G5X1QL
- if (isTabScrolling() != isTabScrolling && isTabScrolling == false) {
- redrawScrollButtons();
- }
- if (getItemCount() == 1) {
- // select the first added item and send a selection event.
- // fixes 1GAP79N
- setSelection(0, true);
- }
-}
-/**
- * Destroy the specified item.
- */
-void destroyChild (TabItem item) {
- int index = indexOf(item);
- if (index == -1) return; // should trigger an error?
- if (items.length == 1) {
- items = null;
- selectedIndex = -1;
- topTabIndex = 0;
- if (!inDispose){
- Control control = item.control;
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- redraw();
- }
- } else {
- // shrink by one and rearrange the array.
- TabItem[] newItems = new TabItem [items.length - 1];
- System.arraycopy(items, 0, newItems, 0, index);
- System.arraycopy(items, index + 1, newItems, index, items.length - index - 1);
- items = newItems;
-
- // move the selection if this item is selected
- if (selectedIndex == index) {
- if (!inDispose) {
- Control control = item.control;
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- selectedIndex = -1;
- setSelection(Math.max(0, index - 1), true);
- }
- } else if (selectedIndex > index) {
- selectedIndex--;
- }
- if (topTabIndex == items.length) {
- --topTabIndex;
- }
- }
- // Make sure that the first tab is visible if scroll buttons are no longer drawn.
- // Fixes 1FXW5DV
- if (topTabIndex > 0 && !isTabScrolling()) {
- topTabIndex = 0;
- }
- if (!inDispose) {
- layoutItems();
- redrawTabs();
- }
-}
-/**
- * Dispose the items of the receiver
- */
-void doDispose() {
- inDispose = true;
- // items array is resized during TabItem.dispose
- // it is set to null if the last item is removed
- while (items != null) {
- if (items[items.length-1] != null) {
- items[items.length-1].dispose();
- }
- }
-}
-/**
- * Draw an arrow like that used in Button with SWT.ARROW style.
- * @param gc - GC to draw on
- * @param xPos - x position the underlying button is drawn at
- * @param yPos - y position the underlying button is drawn at
- * @param size - size of the underlying button
- * @param left - true=arrow is facing left. false=arrow is facing right
- */
-void drawArrow(GC gc, int xPos, int yPos, int size, boolean left) {
- int arrowWidth = size / 4;
- int arrow[] = new int[6];
-
- if (!left) arrowWidth *= -1;
- // start polygon lines with vertical line which is always the same
- arrow[0] = xPos + (size + arrowWidth) / 2;
- arrow[1] = yPos + size / 4;
- arrow[2] = arrow[0];
- arrow[3] = arrow[1] + size / 2;
-
- arrow[4] = arrow[0] - arrowWidth;
- arrow[5] = yPos + size / 2;
-
- gc.setBackground(getForeground());
- gc.fillPolygon(arrow);
- gc.setBackground(getBackground());
-}
-/**
- * Draw a border around the receiver.
- */
-void drawBorder(Event event) {
- GC gc = event.gc;
- Rectangle clientArea = getClientArea();
- int wClient = clientArea.width;
- int hClient = clientArea.height;
- int x, y, x1, y1;
- final Color HighlightShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- final Color LightShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
-
- // Draw the left line
- gc.setForeground(HighlightShadow);
- gc.drawLine((x = xClient - CLIENT_MARGIN_WIDTH),
- yClient + hClient + CLIENT_MARGIN_WIDTH,
- x,
- (y = yClient - CLIENT_MARGIN_WIDTH) + 1);
- // Second, darker, line right of the previous line.
- // Necessary to workaround color constant differences on Windows/Motif
- gc.setForeground(LightShadow);
- gc.drawLine(x + 1, yClient + hClient + CLIENT_MARGIN_WIDTH, x + 1, y + 1);
- gc.setForeground(HighlightShadow);
-
- // Draw the upper line in two chunks so we don't overwrite the selected tab
- if (selectedIndex == -1) {
- gc.setForeground(LightShadow);
- gc.drawLine(x + 1, y + 1, xClient + wClient + CLIENT_MARGIN_WIDTH, y + 1);
- } else {
- TabItem item = items[selectedIndex];
- gc.setForeground(LightShadow);
- if (selectedIndex > 0) {
- gc.drawLine(x + 1, y + 1, item.x - 1 + CLIENT_MARGIN_WIDTH, y + 1);
- }
- gc.drawLine(item.x + item.width, y + 1, xClient + wClient + CLIENT_MARGIN_WIDTH, y + 1);
- }
-
- // Draw the right and bottom black lines
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- gc.drawLine((x = xClient - CLIENT_MARGIN_WIDTH),
- (y = yClient + hClient + CLIENT_MARGIN_WIDTH),
- (x1 = xClient + wClient + CLIENT_MARGIN_WIDTH),
- y);
- gc.drawLine(x1, y, x1, (y1 = yClient - CLIENT_MARGIN_WIDTH + 1));
- x1--;
- x++;
- y--;
- y1++;
-
-
- // There is a dark gray line above the bottom back line
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- gc.drawLine(x, y, x1, y);
- // On the right there is a dark gray line, left of the black one
- gc.drawLine(x1, y-1, x1, y1);
-
- // restore the foreground color.
- gc.setForeground(getForeground());
-}
-/**
- * Draw a plain push button
- * @param gc - GC to draw on
- * @param xPos - x position the button is drawn at
- * @param yPos - y position the button is drawn at
- * @param size - size of the button
- */
-void drawPlainButton(GC gc, int xPos, int yPos, int size) {
- Color rightBottomColor = getForeground();
- Color leftTopColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color rightBottomInnerColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
- Color leftTopInnerColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- int upper = yPos;
- int left = xPos;
- int lower = yPos + size - 1;
- int right = xPos + size - 1;
-
- if (scrollButtonDown) { // draw the button in the pressed down state?
- rightBottomColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- leftTopColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
- rightBottomInnerColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- leftTopInnerColor = getForeground();
- }
- gc.fillRectangle(left, upper, right - left, lower - upper);
- // draw right, bottom line in foreground color
- gc.setForeground(rightBottomColor);
- gc.drawLine(right, upper, right, lower);
- gc.drawLine(left, lower, right, lower);
-
- // draw left, top line in normal shadow (default light gray)
- gc.setForeground(leftTopColor);
- gc.drawLine(left, upper, left, lower - 1);
- gc.drawLine(left, upper, right - 1, upper);
-
- upper++;
- left++;
- lower--;
- right--;
- // draw right, bottom line in dark shadow (default dark gray)
- gc.setForeground(rightBottomInnerColor);
- gc.drawLine(right, upper, right, lower);
- gc.drawLine(left, lower, right, lower);
-
- // draw left, top line in high light shadow (default off white)
- gc.setForeground(leftTopInnerColor);
- gc.drawLine(left, upper, left, lower - 1);
- gc.drawLine(left, upper, right - 1, upper);
- gc.setForeground(getForeground());
-}
-/**
- * Draw the buttons used to scroll tab items
- */
-void drawScrollButtons(Event event) {
- Rectangle buttonArea = getScrollButtonArea();
- int buttonSize = buttonArea.width / 2;
-
- drawPlainButton(event.gc, buttonArea.x, buttonArea.y, buttonSize);
- drawPlainButton(event.gc, buttonArea.x + buttonSize, buttonArea.y, buttonSize);
- if (scrollButtonDown) {
- drawArrow(event.gc, buttonArea.x, buttonArea.y, buttonSize, true);
- drawArrow(event.gc, buttonArea.x + buttonSize + 1, buttonArea.y, buttonSize + 1, false);
- }
- else {
- drawArrow(event.gc, buttonArea.x - 1, buttonArea.y - 1, buttonSize, true);
- drawArrow(event.gc, buttonArea.x + buttonSize, buttonArea.y - 1, buttonSize, false);
- }
-}
-
-/**
- * Make sure that the first tab is visible if scroll buttons are no
- * longer drawn.
- */
-void ensureRightFreeSpaceUsed() {
- if (topTabIndex > 0 && !isTabScrolling()) {
- topTabIndex = 0;
- layoutItems();
- redrawTabs();
- }
-}
-
-/**
- * If the tab at 'tabIndex' is not visible or partially covered by the tab
- * scroll buttons and there is enough space to completely show the tab,
- * the tab is scrolled to the left to make it fully visible.
- */
-void ensureVisible(int tabIndex) {
- if (items == null || tabIndex < 0 || tabIndex >= items.length) return;
- if (!isTabScrolling()) return;
- if (tabIndex < topTabIndex) {
- topTabIndex = tabIndex;
- layoutItems();
- redrawTabs();
- return;
- }
- int rightEdge = getScrollButtonArea().x;
- TabItem tabItem = items[tabIndex];
- while (tabItem.x + tabItem.width > rightEdge && tabIndex != topTabIndex) {
- topTabIndex++;
- layoutItems();
- redrawTabs();
- }
-}
-void focus (Event e) {
- if (selectedIndex == -1) return;
- TabItem tab = items[selectedIndex];
- redraw(tab.x, tab.y, tab.width, tab.height);
-}
-
-public Rectangle getClientArea() {
- checkWidget();
- Rectangle clientArea = super.getClientArea();
-
- if (yClient == 0) { // position not calculated yet
- layoutItems(); // calculate tab folder bounds as soon as there is tab data to use.
- }
- clientArea.x = xClient;
- clientArea.y = yClient;
- clientArea.width -= xClient + CLIENT_MARGIN_WIDTH + 1;
- clientArea.height -= yClient + CLIENT_MARGIN_WIDTH + 1;
- return clientArea;
-}
-/**
- * Return the height of item images. All images are scaled to
- * the height of the first image.
- */
-int getImageHeight() {
- return imageHeight;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem getItem (int index) {
- checkWidget();
- if (!(0 <= index && index < getItemCount())) error(SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount(){
- checkWidget();
- if (items == null)
- return 0;
- else return items.length;
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getItems() {
- checkWidget();
- if (items == null) return new TabItem[0];
- TabItem[] tabItems = new TabItem [items.length];
- System.arraycopy(items, 0, tabItems, 0, items.length);
- return tabItems;
-}
-/**
- * Returns the area where the two scroll buttons are drawn.
- */
-Rectangle getScrollButtonArea() {
- return new Rectangle(
- super.getClientArea().width - SCROLL_BUTTON_SIZE * 2, SELECTED_TAB_TOP_EXPANSION,
- SCROLL_BUTTON_SIZE * 2, SCROLL_BUTTON_SIZE);
-}
-/**
- * Returns an array of <code>TabItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getSelection() {
- checkWidget();
- if (selectedIndex == -1) return new TabItem [0];
- return new TabItem [] {items[selectedIndex]};
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex() {
- checkWidget();
- return selectedIndex;
-}
-/**
- * Handle the events that I have hooked on the canvas.
- */
-void handleEvents (Event event){
- switch (event.type) {
- case SWT.Dispose:
- doDispose();
- break;
- case SWT.Paint:
- paint(event);
- break;
- case SWT.Resize:
- resize();
- break;
- case SWT.MouseDown:
- mouseDown(event);
- break;
- case SWT.MouseUp:
- mouseUp(event);
- break;
- case SWT.Traverse:
- traversal(event);
- break;
- case SWT.FocusIn:
- case SWT.FocusOut:
- focus(event);
- break;
- case SWT.KeyDown:
- keyDown(event);
- break;
- default:
- break;
- }
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf(TabItem item) {
- checkWidget();
- if (item == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] == item) return i;
- }
- }
- return -1;
-}
-/**
- * Answer true when the left scroll button was clicked with mouse button 1.
- */
-boolean isLeftButtonHit(Event event) {
- Rectangle buttonArea = getScrollButtonArea();
-
- buttonArea.width /= 2;
- return isTabScrolling() && event.button == 1 && buttonArea.contains(event.x, event.y);
-}
-/**
- * Answer true when the right scroll button was clicked with mouse button 1.
- */
-boolean isRightButtonHit(Event event) {
- Rectangle buttonArea = getScrollButtonArea();
- int buttonSize = buttonArea.width / 2;
-
- buttonArea.x += buttonSize;
- buttonArea.width = buttonSize;
- return isTabScrolling() && event.button == 1 && buttonArea.contains(event.x, event.y);
-}
-/**
- * Answer true if not all tabs can be visible in the receive
- * thus requiring the scroll buttons to be visible.
- */
-boolean isTabScrolling() {
- boolean isVisible = false;
-
- if (items != null && items.length > 0) {
- TabItem tabItem = items[items.length-1];
- int tabStopX = tabItem.x + tabItem.width;
- tabItem = items[0];
- if (tabStopX - tabItem.x > super.getClientArea().width) {
- isVisible = true; // not all tabs fit in the client area
- }
- }
- return isVisible;
-}
-/**
- * 'item' has changed. Store the image size if this is the
- * first item with an image.
- */
-void itemChanged(TabItem item) {
- Image itemImage = item.getImage();
- boolean isTabScrolling = isTabScrolling();
-
- if (imageHeight == -1 && itemImage != null) {
- imageHeight = itemImage.getBounds().height;
- }
- layoutItems();
- redrawTabs();
- // redraw scroll buttons if they just became visible
- // fixes 1G5X1QL
- if (isTabScrolling() != isTabScrolling && isTabScrolling == false) {
- redrawScrollButtons();
- }
-}
-void keyDown(Event e) {
-// if (e.keyCode == SWT.ARROW_LEFT) {
-// if (selectedIndex > 0) {
-// forceFocus();
-// setSelection(selectedIndex - 1, true);
-// }
-// }
-// if (e.keyCode == SWT.ARROW_RIGHT) {
-// if (selectedIndex < items.length - 1) {
-// forceFocus();
-// setSelection(selectedIndex + 1, true);
-// }
-// }
-}
-/**
- * Layout the items and store the client area size.
- */
-void layoutItems() {
- int x = SELECTED_TAB_HORIZONTAL_EXPANSION;
- int y = SELECTED_TAB_TOP_EXPANSION;
- int tabHeight = 0;
-
- if (items != null) {
- GC gc = new GC(this);
- for (int i=topTabIndex - 1; i>=0; i--) { // if the first visible tab is not the first tab
- TabItem tab = items[i];
- tab.width = tab.preferredWidth(gc);
- tab.height = tab.preferredHeight(gc);
- x -= tab.width; // layout tab items from right to left thus making them invisible
- tab.x = x;
- tab.y = y;
- if (tab.height > tabHeight) tabHeight = tab.height;
- }
- x = SELECTED_TAB_HORIZONTAL_EXPANSION;
- for (int i=topTabIndex; i<items.length; i++) { // continue laying out remaining, visible items left to right
- TabItem tab = items[i];
- tab.x = x;
- tab.y = y;
- tab.width = tab.preferredWidth(gc);
- tab.height = tab.preferredHeight(gc);
- x = x + tab.width;
- if (tab.height > tabHeight) tabHeight = tab.height;
- }
- gc.dispose();
- }
- xClient = CLIENT_MARGIN_WIDTH;
- yClient = CLIENT_MARGIN_WIDTH + tabHeight;
- TabItem selection[] = getSelection();
- if (selection.length > 0)
- selection[0].expand(SELECTED_TAB_HORIZONTAL_EXPANSION, SELECTED_TAB_TOP_EXPANSION, SELECTED_TAB_HORIZONTAL_EXPANSION, 0);
-}
-/**
- * A mouse button was pressed down.
- * If one of the tab scroll buttons was hit, scroll in the appropriate
- * direction.
- * If a tab was hit select the tab.
- */
-void mouseDown(Event event) {
- if (items == null) return;
- if (isLeftButtonHit(event)) {
- scrollButtonDown = true;
- redrawHitButton(event);
- scrollLeft();
- }
- else
- if (isRightButtonHit(event)) {
- scrollButtonDown = true;
- redrawHitButton(event);
- scrollRight();
- }
- else {
- for (int i=0; i<items.length; i++) {
- if (items[i].getBounds().contains(new Point(event.x, event.y))) {
- forceFocus();
- setSelection(i, true);
- return;
- }
- }
- }
-}
-/**
- * A mouse button was released.
- */
-void mouseUp(Event event) {
- if (scrollButtonDown && event.button == 1) {
- scrollButtonDown = false;
- redrawHitButton(event);
- }
-}
-/**
- * Paint the receiver.
- */
-void paint(Event event) {
- // Draw the unselected tabs first.
- for (int i=0; i<getItemCount(); i++) {
- if (i != selectedIndex && event.getBounds().intersects(items[i].getBounds())) {
- items[i].paint(event.gc, false);
- }
- }
- drawBorder(event);
- // Selected tab comes last since selected tabs overlay adjacent tabs
- // and the border
- if (selectedIndex != -1) {
- items[selectedIndex].paint(event.gc, true);
- }
- if (isTabScrolling()) drawScrollButtons(event);
-}
-/**
- * Redraw the area of the receiver specified by x, y, width, height.
- * Don't redraw the scroll buttons to avoid flashing.
- */
-void redraw (int x, int y, int width, int height) {
- Rectangle buttonArea = getScrollButtonArea();
- boolean fixScrollButtons = false;
-
- if (isTabScrolling()) {
- if (x > buttonArea.x) {
- x = buttonArea.x;
- fixScrollButtons = true;
- }
- if (x + width > buttonArea.x) {
- width = buttonArea.x - x;
- fixScrollButtons = true;
- }
- }
- redraw(x, y, width, height, false);
- if (fixScrollButtons) {
- redraw(buttonArea.x, 0, buttonArea.width, buttonArea.y, false); // redraw space above scroll buttons
- if (buttonArea.height < getClientArea().y) {
- int redrawY = buttonArea.y + buttonArea.height;
- redraw(
- buttonArea.x, redrawY,
- buttonArea.width, getClientArea().y - redrawY, false); // redraw space below scroll buttons
- }
- }
-}
-/**
- * Redraw the scroll button that was pressed down
- */
-void redrawHitButton(Event event) {
- Rectangle scrollButtonArea = getScrollButtonArea();
- int scrollButtonWidth = scrollButtonArea.width / 2;
-
- if (isLeftButtonHit(event)) {
- redraw(
- scrollButtonArea.x, scrollButtonArea.y,
- scrollButtonWidth, scrollButtonArea.height, false);
- }
- else
- if (isRightButtonHit(event)) {
- redraw(
- scrollButtonArea.x + scrollButtonWidth, scrollButtonArea.y,
- scrollButtonWidth, scrollButtonArea.height, false);
- }
-}
-/**
- * Redraw both scroll buttons
- */
-void redrawScrollButtons() {
- Rectangle scrollButtonArea = getScrollButtonArea();
-
- redraw(
- scrollButtonArea.x, scrollButtonArea.y,
- scrollButtonArea.width, scrollButtonArea.height, false);
-}
-/**
- * Redraw the tabs at the specified indexes.
- */
-void redrawSelectionChange(int oldSelection, int newSelection) {
- if (oldSelection != -1) {
- TabItem tab = items[oldSelection];
- // since the tab used to be selected, we need to clear its old expanded size
- redraw(tab.x - SELECTED_TAB_HORIZONTAL_EXPANSION,
- tab.y - SELECTED_TAB_TOP_EXPANSION,
- tab.width + 2 * SELECTED_TAB_HORIZONTAL_EXPANSION,
- tab.height + SELECTED_TAB_TOP_EXPANSION);
- }
- if (newSelection != -1) {
- TabItem tab = items[newSelection];
- // this tab is already at the expanded size
- redraw(tab.x, tab.y, tab.width, tab.height);
- }
- // make sure the tab is repainted before the new page is made visible.
- // The latter could take a long time and delay the screen update.
- update();
-}
-/**
- * Redraw the whole tab area
- */
-void redrawTabs() {
- redraw(0, 0, super.getClientArea().width, getClientArea().y);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-/**
- * The widget was resized. Adjust the size of the currently selected page.
- */
-void resize() {
- if (selectedIndex != -1) {
- Control control = items[selectedIndex].getControl();
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- }
- }
- ensureRightFreeSpaceUsed();
-}
-
-/**
- * Scroll the tab items to the left.
- */
-void scrollLeft() {
- if (topTabIndex > 0) {
- --topTabIndex;
- layoutItems();
- redrawTabs();
- }
-}
-/**
- * Scroll the tab items to the right.
- */
-void scrollRight() {
- if (items != null && items.length > 0 && topTabIndex < items.length - 1) {
- TabItem lastTabItem = items[items.length-1];
- int tabStopX = lastTabItem.x + lastTabItem.width;
- if (tabStopX > super.getClientArea().width - SCROLL_BUTTON_SIZE * 2) {
- topTabIndex++;
- layoutItems();
- redrawTabs();
- }
- }
-}
-public void setFont(Font font) {
- checkWidget();
- if (font != null && font.equals(getFont())) return;
- super.setFont(font);
- layoutItems();
- redrawTabs();
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection(int index) {
- checkWidget();
- setSelection(index, false);
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection(TabItem selectedItems[]) {
- checkWidget();
- if (selectedItems == null) error(SWT.ERROR_NULL_ARGUMENT);
- int index = -1;
- if (selectedItems.length > 0) {
- index = indexOf(selectedItems[0]);
- }
- setSelection(index, false);
-}
-/**
- * Set the selection to the tab at the specified index.
- */
-void setSelection(int index, boolean notify) {
-
- int oldIndex = selectedIndex;
-
- if (selectedIndex == index || index >= getItemCount()) return;
- if (selectedIndex != -1) {
- Control control = items[selectedIndex].control;
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- }
- if (index < 0) {
- index = -1; // make sure the index is always -1 if it's negative
- }
- selectedIndex = index;
- layoutItems();
- ensureVisible(index);
- redrawSelectionChange(oldIndex, index);
- if (index >= 0) {
- Control control = items[index].control;
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- control.setVisible(true);
- }
- }
-
- if (notify) {
- if (selectedIndex != oldIndex && selectedIndex != -1) {
- Event event = new Event();
- event.item = getSelection()[0];
- notifyListeners(SWT.Selection, event);
- }
- }
-}
-
-void traversal(Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- event.doit = true;
- break;
- case SWT.TRAVERSE_MNEMONIC:
- event.doit = mnemonicTraversal(event);
- if (event.doit) event.detail = SWT.TRAVERSE_NONE;
- break;
- case SWT.TRAVERSE_PAGE_NEXT:
- case SWT.TRAVERSE_PAGE_PREVIOUS:
- event.doit = pageTraversal(event);
- if (event.doit) event.detail = SWT.TRAVERSE_NONE;
- break;
- }
-}
-
-boolean pageTraversal(Event event) {
- int count = getItemCount ();
- if (count == 0) return false;
- int index = getSelectionIndex ();
- if (index == -1) {
- index = 0;
- } else {
- int offset = (event.detail == SWT.TRAVERSE_PAGE_NEXT) ? 1 : -1;
- index = (index + offset + count) % count;
- }
- setSelection (index, true);
- return true;
-}
-
-boolean mnemonicTraversal (Event event) {
- char key = event.character;
- for (int i = 0; i < items.length; i++) {
- if (items[i] != null) {
- char mnemonic = getMnemonic (items[i].getText ());
- if (mnemonic != '\0') {
- if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) {
- setSelection(i, true);
- return true;
- }
- }
- }
- }
- return false;
-}
-char getMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while ((index < length) && (string.charAt (index) != '&')) index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != '&') return string.charAt (index);
- index++;
- } while (index < length);
- return '\0';
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabItem.java
deleted file mode 100644
index db19089aab..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabItem.java
+++ /dev/null
@@ -1,414 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * corresponding to a tab for a page in a tab folder.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TabItem extends Item {
- TabFolder parent;
- int x,y,width,height = 0;
- String toolTipText;
- Control control; // the tab page
-
- // internal constants
- static final int LEFT_HORIZONTAL_MARGIN = 8;
- static final int RIGHT_HORIZONTAL_MARGIN = 2;
- static final int VERTICAL_MARGIN = 1; // space between tab shadow and tab content
- static final int ICON_MARGIN = 6;
- static final int SHADOW_WIDTH = 2; // width of the tab shadow
- static final int DEFAULT_TEXT_WIDTH = 36; // preferred text width if there is no text.
- // Used for preferred item width calculation
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style) {
- this(parent, style, parent.getItemCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style, int index) {
- super (parent, style);
- parent.createChild (this, index);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public void dispose() {
- if (isDisposed()) return;
- super.dispose();
- parent.destroyChild(this);
- parent = null;
- control = null;
- toolTipText = null;
-}
-/**
- * Expand the receiver's bounds by the specified number of pixels on
- * the left,top,right,and bottom.
- */
-void expand(int left, int top, int right, int bottom) {
- if (hasLocation()) {
- x = x - left;
- y = y - top;
- width = width + left + right;
- height = height + top + bottom;
- }
-}
-/**
- * Return the bounds of the TabItem.
- */
-Rectangle getBounds () {
- return new Rectangle(x, y, width, height);
-}
-/**
- * Returns the control that is used to fill the client area of
- * the tab folder when the user selects the tab item. If no
- * control has been set, return <code>null</code>.
- * <p>
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-public Display getDisplay() {
- if (parent == null) error(SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay();
-}
-/**
- * Returns the receiver's parent, which must be a <code>TabFolder</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabFolder getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-/**
- * Answer true if the receiver has been layed out.
- */
-boolean hasLocation() {
- return !(width == 0 && height == 0 && x == 0 && y == 0);
-}
-/**
- * Answer the image height.
- */
-private int imageHeight() {
- Image image = getImage();
-
- if (parent.getImageHeight() != -1) {
- return parent.getImageHeight();
- } else if (image != null) {
- return image.getBounds().height;
- }
- else {
- return 0;
- }
-}
-/**
- * Answer the icon width.
- */
-private int imageWidth() {
- Image image = getImage();
-
- if (image != null) {
- return image.getBounds().width;
- } else {
- return 0;
- }
-}
-/**
- * Paint the receiver.
- */
-void paint(GC gc, boolean isSelected) {
- // high light colored line across left and top
- gc.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- gc.drawLine(x, y + height - 2, x, y + 2);
- gc.drawLine(x, y + 2, x + 2, y);
- gc.drawLine(x + 2, y, x + width - 3, y);
-
- // light color next to the left and below the top line.
- // Since tabs expand horizontally when selected, we actually draw
- // the background color to erase any debris from a selected tab.
- gc.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- gc.drawLine(x + 1, y + height - 2, x + 1, y + 2);
- gc.drawLine(x + 2, y + 1, x + width - 3, y + 1);
-
- // dark colored line at right
- gc.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- gc.drawLine(x + width - 1, y + 2, x + width - 1, y + height - 1);
- // dark pixel on top of shadowed line, inside dark line
- gc.drawLine(x + width - 2, y + 1, x + width - 2, y + 1);
-
- // shadowed line on right inside the dark line
- gc.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- gc.drawLine(x + width - 2, y + 2, x + width - 2, y + height - 1);
-
- if (parent.isFocusControl() && isSelected) {
- // draw a focus rectangle
- gc.drawFocus(x + 3, y + 3, width - 6, height - 3);
- }
-
- // icon and bitmap. Should probably be checking style bits to determine
- // exactly what to paint. Do we just draw the icon when the icon/text combination
- // is too wide to fit all tabs?
- gc.setForeground(parent.getForeground());
- int xDraw = x + LEFT_HORIZONTAL_MARGIN;
- int yCenter;
- int decorationHeight = SHADOW_WIDTH * 2 + VERTICAL_MARGIN * 2;
- Image image = getImage();
- Rectangle sourceBounds = null;
- if (image != null) {
- sourceBounds = image.getBounds();
- yCenter = y + SHADOW_WIDTH + VERTICAL_MARGIN + (height - decorationHeight - imageHeight()) / 2;
- gc.drawImage(
- image,
- sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height,
- xDraw, yCenter, sourceBounds.width, parent.getImageHeight());
- }
- xDraw = xDraw + ICON_MARGIN;
- if (sourceBounds != null) {
- xDraw += sourceBounds.width;
- }
- yCenter = y + SHADOW_WIDTH + VERTICAL_MARGIN + (height - decorationHeight - textHeight(gc)) / 2;
- int flags = SWT.DRAW_MNEMONIC;
- gc.drawText(getText(), xDraw, yCenter, flags);
-}
-/**
- * Answer the preferred height of the receiver for the GC.
- */
-int preferredHeight(GC gc) {
- int height = textHeight(gc);
- if (imageHeight() > height) height = imageHeight();
- height += VERTICAL_MARGIN * 2 + SHADOW_WIDTH * 2;
- return height;
-}
-/**
- * Answer the preferred width of the receiver for the GC.
- */
-int preferredWidth(GC gc) {
- return imageWidth() + textWidth(gc) + LEFT_HORIZONTAL_MARGIN +
- RIGHT_HORIZONTAL_MARGIN + ICON_MARGIN + SHADOW_WIDTH * 2;
-}
-/**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- Control oldControl = this.control, newControl = control;
- this.control = control;
- int index = parent.indexOf (this);
- if (index != parent.getSelectionIndex ()) {
- if (newControl != null) newControl.setVisible(false);
- return;
- }
- if (newControl != null) {
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
- }
- if (oldControl != null) oldControl.setVisible (false);
-}
-/**
-* Sets the image.
-* <p>
-* @param image the new image (or null)
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void setImage (Image image) {
- checkWidget();
- Image oldImage = this.image;
-
- super.setImage(image);
- if (image == null || !image.equals(oldImage)) {
- parent.itemChanged(this);
- }
-}
-/**
- * Sets the receiver's text.
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- String oldText = text;
-
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText(string);
- if (!string.equals(oldText)) {
- parent.itemChanged(this);
- }
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-/**
- * Answer the text height.
- */
-private int textHeight(GC gc) {
- String text = getText();
-
- if (text == null) {
- return 0;
- } else {
- int flags = SWT.DRAW_MNEMONIC;
- return gc.textExtent(text, flags).y;
- }
-}
-/**
- * Answer the text width.
- */
-private int textWidth(GC gc) {
- String text = getText();
- int textWidth = 0;
-
- if (text != null) {
- int flags = SWT.DRAW_MNEMONIC;
- textWidth = gc.textExtent(text, flags).x;
- }
- if (textWidth == 0) {
- textWidth = DEFAULT_TEXT_WIDTH;
- }
- return textWidth;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/AbstractTreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/AbstractTreeItem.java
deleted file mode 100644
index 76f2caeeaf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/AbstractTreeItem.java
+++ /dev/null
@@ -1,312 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * This class stores and manages child items of a tree item.
- * It provides protocol to query the index of an item relative
- * to the root and to retrieve items by index.
- * The TreeItem class implements this protocol for general
- * tree items.
- * TreeRoots provides a special implementation that allows the
- * Tree class to treat trees with one root and with multiple
- * roots equally.
- */
-abstract class AbstractTreeItem extends SelectableItem {
- private Vector children;
- private boolean isExpanded = false;
- // number of children.
- // includes all expanded items down to the leafs.
- private int visibleItemCount = 0;
-
-/**
- * Create a new instance of the receiver.
- * @param parent - widget the receiver belongs to
- * @param swtStyle - widget style. see Widget class for details
- */
-AbstractTreeItem(Tree parent, int swtStyle) {
- super(parent, swtStyle);
-}
-/**
- * Insert 'item' in the list of child items. Notify the
- * parent about the new item.
- * @param 'item' - the item that should be added to the
- * receiver's children.
- * @param index - position that 'item' will be inserted at
- * in the receiver.
- */
-void add(TreeItem item, int index) {
- Vector items = getChildren();
- int visibleIndex = getVisibleIndex();
-
- if (index < 0 || index > items.size()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
- if (item.isRoot()) {
- visibleIndex = index;
- }
- else
- if (isExpanded == false) {
- visibleIndex = -1;
- }
- if (visibleIndex != -1) {
- if (index > 0) {
- TreeItem previousChild = (TreeItem) getChildren().elementAt(index - 1);
- visibleIndex = previousChild.getVisibleIndex() + previousChild.getVisibleItemCount() + 1;
- }
- else {
- visibleIndex = getVisibleIndex() + 1;
- }
- }
- getSelectableParent().addingItem(item, visibleIndex);
- item.setIndex(index);
- resetChildIndices(index, true);
- items.insertElementAt(item, index);
- if (isExpanded == true) {
- visibleItemCount++;
- calculateVisibleItemCountParent();
- }
- getSelectableParent().addedItem(item, visibleIndex);
-}
-/**
- * Set whether the receiver is expanded or not.
- * If the receiver is expanded its child items are visible.
- * @param expanded -
- * true=the receiver is expanded, making its child items visible.
- * false=the receiver is collapsed, making its child items invisible
- */
-void internalSetExpanded(boolean expanded) {
- isExpanded = expanded;
- calculateVisibleItemCount();
-}
-/**
- * Calculate the number of expanded children.
- * Recurse up in the tree to the root item.
- */
-abstract void calculateVisibleItemCount();
-/**
- * Calculate the number of expanded children for the parent item
- * of this item.
- */
-abstract void calculateVisibleItemCountParent();
-/**
- * Deselect the receiver and all children
- */
-void deselectAll() {
- Enumeration children = getChildren().elements();
- AbstractTreeItem treeItem;
-
- setSelected(false);
- while (children.hasMoreElements() == true) {
- treeItem = (AbstractTreeItem) children.nextElement();
- treeItem.deselectAll();
- }
-}
-public void dispose() {
- if (isDisposed()) return;
- Vector children = getChildren();
- AbstractTreeItem child;
- while (children.size() > 0) { // TreeItem objects are removed from vector during dispose
- child = (AbstractTreeItem) children.firstElement();
- child.dispose();
- }
- super.dispose();
-}
-void doDispose() {
- setChildren(null);
- visibleItemCount = 0;
- super.doDispose();
-}
-/**
- * Answer the Vector containing the child items of the receiver.
- */
-Vector getChildren() {
- if (children == null) {
- children = new Vector(4);
- }
- return children;
-}
-/**
- * Answer whether the receiver is expanded or not.
- * If the receiver is expanded its children are visible.
- * @return
- * true - the receiver is expanded, making its children visible
- * false - the receiver is collapsed, making its children invisible
- */
-public boolean getExpanded() {
- checkWidget();
-
- return isExpanded;
-}
-/**
- * Answer the number of children.
- */
-public int getItemCount() {
- checkWidget();
-
- return getChildren().size();
-}
-/**
- * Answer the index of the receiver relative to the first root
- * item.
- * If 'anIndex' is the global index of the expanded item 'anItem'
- * then the following expressions are true:
- * 'anItem == theRoot.getVisibleItem(anIndex)' and
- * 'anIndex == anItem.getVisibleIndex()'
- * @return
- * The index of the receiver relative to the first root item.
- * Answer -1 if the receiver is not visible (because the parent
- * is collapsed).
- */
-abstract int getVisibleIndex();
-/**
- * Answer the index of the child item identified by 'childIndex'
- * relative to the first root item.
- */
-abstract int getVisibleIndex(int childIndex);
-/**
- * Answer the item at 'searchIndex' relativ to the receiver.
- * When this method is called for the root item, 'searchIndex'
- * represents the global index into all items of the tree.
- * searchIndex=0 returns the receiver.
- * searchIndex=1 returns the first visible child.
- * Note: searchIndex must be >= 0
- *
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. Visible here means that all
- * the parents of the item are expanded. An item is only
- * visible on screen if it is within the receiver's parent's
- * client area.
- */
-abstract TreeItem getVisibleItem(int searchIndex);
-/**
- * Answer the number of expanded children, direct and indirect.
- */
-int getVisibleItemCount() {
- return visibleItemCount;
-}
-/**
- * Returns the expanded state. Circumvent widget/thread check
- * for performance. For non-API callers only.
- */
-boolean internalGetExpanded() {
- return isExpanded;
-}
-/**
- * Answer whether the receiver is a leaf item.
- * An item is a leaf when it has no child items.
- * @return
- * true - receiver is a leaf item
- * false - receiver is not a leaf item.
- */
-boolean isLeaf() {
- return (getChildren().size() == 0);
-}
-/**
- * Answer whether the receiver is a root item.
- * The receiver is a root item when it doesn't have a parent item.
- * @return
- * true - the receiver is a root item.
- * false - the receiver is not a root item.
- */
-boolean isRoot() {
- return false;
-}
-/**
- * Remove 'child' from the receiver.
- * Notify the parent widget only if it is not being disposed itself.
- */
-void removeItem(SelectableItem child) {
- Vector children = getChildren();
- SelectableItemWidget parent = getSelectableParent();
- int childIndex = children.indexOf(child);
-
- if (childIndex != -1) {
- if (((Tree) parent).isRemovingAll() == true) {
- children.removeElementAt(childIndex); // just remove the item from the list if the whole tree is being disposed
- if (isExpanded == true) {
- visibleItemCount--;
- calculateVisibleItemCountParent();
- }
- }
- else {
- parent.removingItem(child);
- children.removeElementAt(childIndex);
- if (isExpanded == true) {
- visibleItemCount--;
- calculateVisibleItemCountParent();
- }
- resetChildIndices(childIndex, false); // mark child index dirty
- parent.removedItem(child);
- }
- }
-}
-/**
- * Allow subclasses to reset any cached data.
- * Called for all children of the receiver.
- */
-void reset() {
- Enumeration children = getChildren().elements();
- AbstractTreeItem treeItem;
-
- while (children.hasMoreElements() == true) {
- treeItem = (AbstractTreeItem) children.nextElement();
- treeItem.reset();
- }
-}
-/**
- * Mark all child indices dirty starting with the child at
- * 'startIndex'. This causes getIndex to recalculate the index.
- * @param startIndex - index in the list of children at which
- * and after which the indices are reset.
- */
-void resetChildIndices(int startIndex, boolean addItem) {
- Vector children = getChildren();
- TreeItem child;
- int increment = addItem ? 1 : 0;
-
- for (int i = startIndex; i < children.size(); i++) {
- child = (TreeItem) children.elementAt(i);
- child.setIndex(i + increment); // mark child index dirty
- }
-}
-/**
- * Select the receiver and all children.
- * Return a Vector containing all the items that have been selected
- * (and that have not been selected before).
- */
-Vector selectAll(Vector selectedItems) {
- Enumeration children = getChildren().elements();
- AbstractTreeItem treeItem;
-
- if (isSelected() == false) {
- selectedItems.addElement(this);
- setSelected(true);
- getSelectableParent().redrawSelection(this);
- }
- while (children.hasMoreElements() == true) {
- treeItem = (AbstractTreeItem) children.nextElement();
- selectedItems = treeItem.selectAll(selectedItems);
- }
- return selectedItems;
-}
-/**
- * Set the Array containing the receiver's child items to 'children'.
- */
-void setChildren(Vector children) {
- this.children = children;
-}
-
-void setVisibleItemCount(int count) {
- visibleItemCount = count;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Header.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Header.java
deleted file mode 100644
index 0c84cd18cf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Header.java
+++ /dev/null
@@ -1,333 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A header draws one or more header items. Each item may have a text
- * label. Each item is identified by an index and can be resized.
- */
-class Header extends Canvas {
- private static final int DEFAULT_WIDTH = 64; // used in computeSize if width could not be calculated
- private static final int DEFAULT_HEIGHT = 64; // used in computeSize if height could not be calculated
- private static final int VERTICAL_MARGIN = 4; // space added to the height of the header label
- private static final int TEXT_Y_OFFSET = 2; // space between the header label and the lower header boundary
- private static final int DEFAULT_ITEM_WIDTH = 9; // default width of a header item
- private static final int TEXT_MARGIN = 6; // space in front and behind header text
- private static final int SHADOW_WIDTH = 2; // width of the right side header shadow
-/**
- * Create a Header widget as a child of 'parent'.
- * @param parent - the parent of the new instance
- */
-Header(Table parent) {
- super(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_FOCUS);
-
- addListener(SWT.Paint, new Listener() {
- public void handleEvent(Event event) {paint(event);}
- });
- setHeaderHeight();
-}
-/**
- * Answer the size of the receiver needed to display all items.
- */
-public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = 0;
- int height = 0;
-
- for (int i = 0; i < getItemCount(); i++) {
- width += getBounds(i).width;
- if (height == 0) {
- height = getBounds(i).height;
- }
- }
- if (width == 0) {
- width = DEFAULT_WIDTH;
- }
- if (height == 0) {
- height = DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) {
- width = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- height = hHint;
- }
- return new Point(width, height);
-}
-/**
- * Draw the bright shadow on the upper and left sides of a header item.
- * @param gc - GC to draw on
- * @param itemIndex - specifies the item to draw
- */
-void drawHighlightShadow(GC gc, int itemIndex) {
- Rectangle bounds = getBounds(itemIndex);
- Color oldForeground = getForeground();
-
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- // draw top horizontal line
- gc.drawLine(bounds.x, bounds.y, bounds.x + bounds.width - 1, bounds.y);
- // draw left vertical line
- gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
- gc.setForeground(oldForeground);
-}
-/**
- * Draw the dark shadow on the lower and right side of a header item.
- * @param gc - GC to draw on
- * @param itemIndex - specifies the item to draw
- */
-void drawLowlightShadows(GC gc, int itemIndex) {
- Rectangle bounds = getBounds(itemIndex);
- Point bottomShadowStart = new Point(bounds.x + 1, bounds.height - 2);
- Point bottomShadowStop = new Point(bottomShadowStart.x + bounds.width - 2, bottomShadowStart.y);
- Point rightShadowStart = null;
- Point rightShadowStop = null;
- Display display = getDisplay();
- Color oldForeground = getForeground();
-
- // light inner shadow
- gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- gc.drawLine(
- bottomShadowStart.x, bottomShadowStart.y,
- bottomShadowStop.x, bottomShadowStop.y);
- if(itemIndex != TableColumn.FILL) {
- rightShadowStart = new Point(bounds.x + bounds.width - 2, bounds.y + 1);
- rightShadowStop = new Point(rightShadowStart.x, bounds.height - 2);
- gc.drawLine(
- rightShadowStart.x, rightShadowStart.y,
- rightShadowStop.x, rightShadowStop.y);
- }
- // dark outer shadow
- bottomShadowStart.x--;
- bottomShadowStart.y++;
- bottomShadowStop.y++;
- gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
- gc.drawLine(
- bottomShadowStart.x, bottomShadowStart.y,
- bottomShadowStop.x, bottomShadowStop.y);
- if(itemIndex != TableColumn.FILL) {
- rightShadowStart.x++;
- rightShadowStart.y--;
- rightShadowStop.y++;
- rightShadowStop.x++;
- gc.drawLine(
- rightShadowStart.x, rightShadowStart.y,
- rightShadowStop.x, rightShadowStop.y);
- }
- gc.setForeground(oldForeground);
-}
-/**
- * Draw the item text of the item identified by 'itemIndex'.
- * @param gc - GC to draw on
- * @param itemIndex - specifies the item to draw
- */
-void drawText(GC gc, int itemIndex) {
- String label = getText(gc, itemIndex);
- Point textExtent;
- Rectangle bounds = getBounds(itemIndex);
- int yPosition;
- int xPosition = 0;
- int alignment;
-
- if (label != null) {
- alignment = ((Table) getParent()).internalGetColumn(itemIndex).getAlignment();
- textExtent = gc.stringExtent(label);
- yPosition = bounds.height - textExtent.y - TEXT_Y_OFFSET;
-
- if ((alignment & SWT.CENTER) != 0) {
- xPosition = (bounds.width - textExtent.x) / 2;
- }
- else
- if ((alignment & SWT.RIGHT) != 0) {
- xPosition = bounds.width - textExtent.x - TEXT_MARGIN;
- }
- xPosition = Math.max(TEXT_MARGIN, xPosition);
- xPosition += bounds.x;
- gc.drawString(label, xPosition, yPosition);
- }
-}
-/**
- * Answer the bounding rectangle of the item identified by 'itemIndex'.
- * @param itemIndex - specifies the item whose bounding rectangle
- * should be returned.
- * @return the bouding rectangle of the item identified by 'itemIndex'.
- */
-Rectangle getBounds(int itemIndex) {
- Rectangle bounds = null;
- int itemCount = getItemCount();
- Table parent = (Table) getParent();
-
- if (itemIndex >= 0 && itemIndex < itemCount) {
- bounds = parent.internalGetColumn(itemIndex).getBounds();
- bounds.y = 0;
- bounds.height = getBounds().height;
- }
- else
- if (itemIndex == TableColumn.FILL) {
- if (itemCount > 0) {
- bounds = parent.internalGetColumn(itemCount - 1).getBounds();
- bounds.x += bounds.width;
- }
- else {
- bounds = new Rectangle(0, 0, 0, 0);
- }
- bounds.width = Math.max(0, getBounds().width - bounds.x);
- bounds.y = 0;
- bounds.height = getBounds().height;
- }
- return bounds;
-}
-/**
- * Answer the number of items in the receiver.
- */
-int getItemCount() {
- return ((Table) getParent()).internalGetColumnCount();
-}
-/**
- * Answer the maximum label width that fits into the item identified by
- * 'itemIndex'.
- */
-int getMaxLabelWidth(int itemIndex) {
- return getBounds(itemIndex).width - 2 * TEXT_MARGIN;
-}
-/**
- * Answer the width required to display the complete label of the header
- * item at position 'index'.
- * @param index - position of the header item whose preferred width should
- * be returned.
- */
-int getPreferredWidth(int index) {
- Table parent = (Table) getParent();
- String text = getText(index);
- int headerWidth = 0;
-
- if (text != null) {
- headerWidth = parent.getTextWidth(text) + 2 * TEXT_MARGIN + 1;
- }
- return headerWidth;
-}
-/**
- * Answer the label of the item identified by 'itemIndex'.
- */
-String getText(int itemIndex) {
- String itemLabel = null;
-
- if (itemIndex >= 0 && itemIndex < getItemCount()) {
- itemLabel = ((Table) getParent()).internalGetColumn(itemIndex).getText();
- }
- return itemLabel;
-}
-/**
- * Answer the text that is going to be drawn in the header item
- * identified by 'itemIndex'. This may be truncated to fit the item
- * width.
- * @param gc - GC to use for measuring the label width.
- * @param itemIndex - specifies the item whose label should be returned.
- */
-String getText(GC gc, int itemIndex) {
- String label = getText(itemIndex);
- int maxWidth;
-
- if (label != null) {
- maxWidth = getMaxLabelWidth(itemIndex);
- label = ((Table) getParent()).trimItemText(label, maxWidth, gc);
- }
- return label;
-}
-/**
- * Draw the header item identified by 'itemIndex'.
- * @param gc - GC to draw on
- * @param itemIndex - item that should be drawn
- */
-void paint(GC gc, int itemIndex) {
- Rectangle bounds = getBounds(itemIndex);
-
- // draw header background
- gc.fillRectangle(bounds.x, bounds.y + 1, bounds.width, bounds.height - 3);
- if (itemIndex != TableColumn.FILL) {
- drawText(gc, itemIndex);
- }
- drawHighlightShadow(gc, itemIndex);
- drawLowlightShadows(gc, itemIndex);
-}
-/**
- * Draw all header items.
- * @param event - Paint event triggering the drawing operation.
- */
-void paint(Event event) {
- int labelCount = getItemCount();
-
- for (int i = 0; i < labelCount; i++) {
- paint(event.gc, i);
- }
- paint(event.gc, TableColumn.FILL); // paint empty fill item behind last item
-}
-/**
- * Redraw the item identified by 'itemIndex'.
- * @param itemIndex - specifies the header item that should be redrawn
- */
-void redraw(int itemIndex) {
- Rectangle bounds = getBounds(itemIndex);
-
- if (bounds != null) {
- redraw(bounds.x, 0, bounds.width, bounds.height, false);
- }
-}
-
-/**
- * Set a new font. Recalculate the header height and redraw the header.
- */
-public void setFont(Font font) {
- checkWidget();
-
- if (font == null || font.equals(getFont()) == true) {
- return;
- }
- super.setFont(font);
- setHeaderHeight();
- redraw();
-}
-/**
- * Calculate and store the height of the receiver.
- */
-void setHeaderHeight() {
- GC gc = new GC(this);
- Rectangle bounds = getBounds();
-
- bounds.height = gc.stringExtent("aString").y + VERTICAL_MARGIN;
- setBounds(bounds);
- gc.dispose();
-}
-/**
- * The width of the header item at position 'itemIndex' is about to change.
- * Adjust the width of the header. Scroll and redraw all header items
- * starting behind the item identified by 'itemIndex'.
- * @param itemIndex - specifies the item after which the redraw
- * should begin.
- * @param widthDiff - the width change of the item.
- * > 0 = item width increased. < 0 = item width decreased
- */
-void widthChange(int itemIndex, int widthDiff) {
- Rectangle bounds = getBounds(itemIndex);
- Rectangle headerBounds = getBounds();
-
- if (bounds != null) {
- if (itemIndex != TableColumn.FILL) { // ignore the fill column header item - there's nothing to redraw anyway
- scroll(
- bounds.x + bounds.width + widthDiff, 0, // destination x, y
- bounds.x + bounds.width, 0, // source x, y
- headerBounds.width + widthDiff, headerBounds.height, false);
- redraw(bounds.x, 0, bounds.width, bounds.height, false);
- }
- }
- headerBounds.width += widthDiff;
- setBounds(headerBounds);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItem.java
deleted file mode 100644
index bbb6e30501..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItem.java
+++ /dev/null
@@ -1,316 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class implements common behavior of TreeItem and TableItem.
- */
-abstract class SelectableItem extends Item {
- protected static final int CHECKBOX_PADDING = 1; // Space behind check box, before item image or text
-
- private SelectableItemWidget parent; // parent widget of the receiver
- private boolean isSelected = false; // item selection state
- private boolean isChecked = false; // item checked state. Can be one of checked and unchecked
- private boolean isGrayed = false; // item grayed state. The gray state is combined with the
- // checked state to create gray checked and gray unchecked.
-/**
- * Create a new instance of the receiver.
- * @param parent - widget the receiver is created in
- * @param style - widget style. see Widget class for details
- */
-SelectableItem(SelectableItemWidget parent, int style) {
- super(parent, style);
- setParent(parent);
-}
-public void dispose() {
- if (isDisposed()) return;
- super.dispose();
- doDispose();
-}
-void doDispose() {
- setParent(null);
-}
-/**
- * Draw the check box of the receiver at 'position' using 'gc'.
- * @param gc - GC to draw on.
- * @param destinationPosition - position on the GC to draw at.
- * @return Answer the position where drawing stopped.
- */
-Point drawCheckbox(GC gc, Point position) {
- SelectableItemWidget parent = getSelectableParent();
- Image image;
- Point imageExtent;
- Rectangle imageBounds;
- int imageOffset;
- int xInset;
- int yInset;
-
- if (getGrayed() == true) {
- image = parent.getGrayUncheckedImage();
- }
- else {
- image = parent.getUncheckedImage();
- }
- if (image != null) {
- imageExtent = parent.getCheckBoxExtent();
- imageOffset = (parent.getItemHeight() - imageExtent.y) / 2;
- gc.drawImage(image, position.x, position.y + imageOffset);
- if (getChecked() == true) {
- image = parent.getCheckMarkImage();
- imageBounds = image.getBounds();
- xInset = (imageExtent.x - imageBounds.width) / 2;
- yInset = (imageExtent.y - imageBounds.height) / 2;
- gc.drawImage(image, position.x + xInset, position.y + imageOffset + yInset);
- }
- position.x += imageExtent.x;
- }
- position.x += CHECKBOX_PADDING; // leave extra space behind check box
- return position;
-}
-void drawInsertMark(GC gc, Point position) {
- SelectableItemWidget parent = getSelectableParent();
- Point selectionExtent = getSelectionExtent();
- final int markerWidth = getInsertMarkWidth();
- int insertMarkYOffset = 0;
-
- if (selectionExtent == null) {
- return;
- }
- if (parent.isInsertAfter()) {
- insertMarkYOffset = selectionExtent.y - markerWidth;
- }
- gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
- gc.fillRectangle(position.x, position.y + insertMarkYOffset, selectionExtent.x, markerWidth);
- gc.setBackground(parent.getBackground());
-}
-/**
- * Answer the bounding rectangle of the item check box.
- * All points within this rectangle hit the check box.
- */
-Rectangle getCheckboxBounds() {
- SelectableItemWidget parent = getSelectableParent();
- Point checkBoxExtent;
- int redrawPosition;
- Rectangle checkboxBounds = new Rectangle(0, 0, 0, 0);
-
- if (isCheckable() == true) {
- checkboxBounds.x = getCheckboxXPosition();
- redrawPosition = parent.getRedrawY(this);
- if (redrawPosition != -1) {
- checkboxBounds.y = redrawPosition;
- }
- checkBoxExtent = parent.getCheckBoxExtent();
- checkboxBounds.width = checkBoxExtent.x;
- checkboxBounds.height = checkBoxExtent.y;
- checkboxBounds.y += (parent.getItemHeight() - checkBoxExtent.y) / 2;
- }
- return checkboxBounds;
-}
-/**
- * Answer the x position of the item check box
- */
-abstract int getCheckboxXPosition();
-/**
- * Return whether or not the receiver is checked.
- * Always return false if the parent of the receiver does not
- * have the CHECK style.
- */
-public boolean getChecked() {
- checkWidget();
- boolean checked = false;
-
- if (isCheckable() == true) {
- checked = isChecked;
- }
- return checked;
-}
-/**
- * Answer the display of the receiver's parent widget.
- */
-public Display getDisplay() {
- SelectableItemWidget parent = getSelectableParent();
-
- if (parent == null) {
- error(SWT.ERROR_WIDGET_DISPOSED);
- }
- return parent.getDisplay();
-}
-
-/**
- * Gets the grayed state.
- * <p>
- * @return the item grayed state.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean getGrayed () {
- checkWidget();
- boolean grayed = false;
-
- if (isCheckable() == true) {
- grayed = isGrayed;
- }
- return grayed;
-}
-/**
- * Return the width in pixels of the line drawn to indicate the
- * drop insert position during a drag and drop operation.
- */
-int getInsertMarkWidth() {
- return 2;
-}
-/**
- * Answer the parent widget of the receiver.
- */
-SelectableItemWidget getSelectableParent() {
- return parent;
-}
-/**
- * Answer the background color to use for drawing the
- * selection rectangle.
- */
-Color getSelectionBackgroundColor() {
- Display display = getSelectableParent().getDisplay();
-
- return display.getSystemColor(SWT.COLOR_LIST_SELECTION);
-}
-/**
- * Return the size of the rectangle drawn to indicate the
- * selected state of the receiver.
- */
-abstract Point getSelectionExtent();
-/**
- * Answer the foreground color to use for drawing the
- * selection rectangle.
- */
-Color getSelectionForegroundColor() {
- Display display = getSelectableParent().getDisplay();
-
- return display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
-}
-/**
- * Return the x position of the selection rectangle
- */
-abstract int getSelectionX();
-/**
- * Answer whether 'posiiton' is inside the item check box.
- * @return
- * true - item check box hit
- * false - item check box not hit
- */
-boolean isCheckHit(Point position) {
- boolean isCheckHit = false;
-
- if (isCheckable() == true) {
- isCheckHit = getCheckboxBounds().contains(position);
- }
- return isCheckHit;
-}
-/**
- * Return whether or not the receiver has a check box and can
- * be checked.
- */
-boolean isCheckable() {
- return (getSelectableParent().getStyle() & SWT.CHECK) != 0;
-}
-/**
- * Answer whether the receiver is selected.
- * @return
- * true - the receiver is selected
- * false - the receiver is not selected
- */
-boolean isSelected() {
- return isSelected;
-}
-/**
- * Redraw the insert mark
- * @param yPosition - y position in the receiver's client area
- * where the item should be drawn.
- */
-void redrawInsertMark(int yPosition) {
- SelectableItemWidget parent = getSelectableParent();
- Point selectionExtent = getSelectionExtent();
- int redrawHeight = getInsertMarkWidth();
-
- if (selectionExtent != null) {
- parent.redraw(getSelectionX(), yPosition, selectionExtent.x, redrawHeight, false);
- parent.redraw(getSelectionX(), yPosition + selectionExtent.y - redrawHeight, selectionExtent.x, redrawHeight, false);
- }
-}
-/**
- * Redraw the selection
- * @param yPosition - y position in the receiver's client area
- * where the item should be drawn.
- */
-void redrawSelection(int yPosition) {
- SelectableItemWidget parent = getSelectableParent();
- Point selectionExtent = getSelectionExtent();
-
- if (selectionExtent != null) {
- parent.redraw(getSelectionX(), yPosition, selectionExtent.x, selectionExtent.y, false);
- }
-}
-/**
- * Set the checked state to 'checked' if the parent of the
- * receiver has the CHECK style.
- */
-public void setChecked(boolean checked) {
- checkWidget();
- SelectableItemWidget parent = getSelectableParent();
- Rectangle redrawRectangle = getCheckboxBounds();
-
- if (isCheckable() == true && isChecked != checked) {
- isChecked = checked;
- parent.redraw(
- redrawRectangle.x, redrawRectangle.y,
- redrawRectangle.width, redrawRectangle.height, false);
- }
-}
-
-/**
- * Sets the grayed state.
- * <p>
- * @param grayed the new grayed state.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
- SelectableItemWidget parent = getSelectableParent();
- Rectangle redrawRectangle = getCheckboxBounds();
-
- if (isCheckable() == true && isGrayed != grayed) {
- isGrayed = grayed;
- parent.redraw(
- redrawRectangle.x, redrawRectangle.y,
- redrawRectangle.width, redrawRectangle.height, false);
- }
-}
-
-/**
- * Set the receiver's parent widget to 'parent'.
- */
-void setParent(SelectableItemWidget parent) {
- this.parent = parent;
-}
-/**
- * Set whether the receiver is selected.
- * @param selected - true=the receiver is selected
- * false=the receiver is not selected
- */
-void setSelected(boolean selected) {
- isSelected = selected;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItemWidget.java
deleted file mode 100644
index 6a3238e28d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ /dev/null
@@ -1,2053 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Compatibility;
-import java.io.*;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * This class is intended for widgets that display data of
- * type Item. It provides a framework for scrolling and
- * handles the screen refresh required when adding and
- * removing items.
- */
-abstract class SelectableItemWidget extends Composite {
- private static final int DEFAULT_WIDTH = 64; // used in computeSize if width could not be calculated
- private static final int DEFAULT_HEIGHT = 64; // used in computeSize if height could not be calculated
- private static final int HORIZONTAL_SCROLL_INCREMENT = 5; // number of pixel the tree is moved
- // during horizontal line scrolling
- private static ImageData UncheckedImageData; // deselected check box image data. used to create an image at run time
- private static ImageData GrayUncheckedImageData; // grayed deselected check box image data. used to create an image at run time
- private static ImageData CheckMarkImageData; // check mark image data for check box. used to create an image at run time
- static {
- initializeImageData();
- }
-
- private int topIndex = 0; // index of the first visible item
- private int itemHeight = 0; // height of a table item
- private Point itemImageExtent = null; // size of the item images. Null unless an image is set for any item
- private int textHeight = -1;
- private int contentWidth = 0; // width of the widget data (ie. table rows/tree items)
- private int horizontalOffset = 0;
- private Vector selectedItems; // indices of the selected items
- private SelectableItem lastSelectedItem; // item that was selected last
- private SelectableItem lastFocusItem; // item that had the focus last. Always equals lastSelectedItem
- // for mouse selection but may differ for keyboard selection
- private SelectableItem insertItem; // item that draws the insert marker to indicate the drop location in a drag and drop operation
- private boolean isInsertAfter; // indicates where the insert marker is rendered, at the top or bottom of 'insertItem'
- private boolean isCtrlSelection = false; // the most recently selected item was
- // selected using the Ctrl modifier key
- private boolean isRemovingAll = false; // true=all items are removed. Used to optimize screen updates and to control item selection on dispose.
- private boolean hasFocus; // workaround for 1FMITIE
- private Image uncheckedImage; // deselected check box
- private Image grayUncheckedImage; // grayed check box
- private Image checkMarkImage; // check mark for selected check box
- private Point checkBoxExtent = null; // width, height of the item check box
- private Listener listener; // event listener used for all events. Events are dispatched
- // to handler methods in handleEvents(Event)
- private int drawCount = 0; // used to reimplement setRedraw(boolean)
-/**
- * Create a new instance of ScrollableItemWidget.
- * @param parent - the parent window of the new instance
- * @param style - window style for the new instance
- */
-SelectableItemWidget(Composite parent, int style) {
- super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
- initialize();
-}
-/**
- * The SelectableItem 'item' has been added to the tree.
- * Calculate the vertical scroll bar.
- * Update the screen to display the new item.
- * @param item - item that has been added to the receiver.
- */
-void addedItem(SelectableItem item, int index) {
- calculateVerticalScrollbar();
- if (getLastFocus() == null) { // if no item has the focus
- setLastFocus(item, true); // set focus to new (must be first) item
- }
-}
-/**
- * The SelectableItem 'item' is about to be added to the tree.
- * @param item - item that is about to be added to the receiver.
- */
-void addingItem(SelectableItem item, int index) {
- if (index >= 0 && index <= getBottomIndex()) {
- scrollVerticalAddingItem(index);
- }
-}
-/**
- * Set the scroll range of the horizontal scroll bar.
- * Resize the scroll bar if the scroll range maximum
- * has changed.
- */
-void calculateHorizontalScrollbar() {
- int newMaximum = getContentWidth();
- ScrollBar horizontalBar = getHorizontalBar();
-
- if (horizontalBar.getMaximum() != newMaximum) {
- // The call to setMaximum is ignored if newMaximum is 0.
- // Therefore we can not rely on getMaximum to subsequently return the number of
- // items in the receiver. We always have to use getVisibleItemCount().
- // Never rely on getMaximum to return what you set. It may not accept the
- // value you set. Even if you use a valid value now the implementation may change
- // later. That's what caused 1FRLOSG.
- horizontalBar.setMaximum(newMaximum);
- if (getVerticalBar().getVisible() == false) { // remove these lines
- horizontalBar.setMaximum(newMaximum); // when PR 1FIG5CG
- } // is fixed
- resizeHorizontalScrollbar();
- }
-}
-/**
- * Calculate the height of items in the receiver.
- * Only the image height is calculated if an item height
- * has already been calculated. Do nothing if both the item
- * height and the image height have already been calculated
- */
-void calculateItemHeight(SelectableItem item) {
- GC gc;
- String itemText;
- int itemHeight = -1;
-
- if (itemImageExtent != null && textHeight != -1) {
- return;
- }
- itemText = item.getText();
- if (itemText != null && textHeight == -1) {
- gc = new GC(this);
- itemHeight = gc.stringExtent(itemText).y;
- textHeight = itemHeight;
- gc.dispose();
- }
- if (itemImageExtent == null) {
- itemImageExtent = getImageExtent(item);
- if (itemImageExtent != null) {
- if (itemImageExtent.y > textHeight) {
- itemHeight = itemImageExtent.y;
- }
- else {
- itemHeight = textHeight;
- }
- }
- }
- itemHeight += getItemPadding(); // make sure that there is empty space below the image/text
- if (itemHeight > getItemHeight()) { // only set new item height if it's higher because new,
- setItemHeight(itemHeight); // smaller item height may not include an icon
- }
-}
-/**
- * Calculate the range of items that need to be selected given
- * the clicked item identified by 'hitItemIndex'
- * @param hitItemIndex - item that was clicked and that the new
- * selection range will be based on. This index is relative to
- * the top index.
- */
-int [] calculateShiftSelectionRange(int hitItemIndex) {
- int selectionRange[] = new int[] {-1, -1};
- SelectableItem closestItem = null;
- SelectableItem selectedItem;
- Enumeration selectedItems = getSelectionVector().elements();
-
- while (selectedItems.hasMoreElements() == true) {
- selectedItem = (SelectableItem) selectedItems.nextElement();
- if (closestItem == null) {
- closestItem = selectedItem;
- }
- else
- if (Math.abs(hitItemIndex - getVisibleIndex(selectedItem)) <
- Math.abs(hitItemIndex - getVisibleIndex(closestItem))) {
- closestItem = selectedItem;
- }
- }
- if (closestItem == null) { // no item selected
- closestItem = getLastSelection(); // item selected last may still have the focus
- }
- if (closestItem != null) {
- selectionRange[0] = getVisibleIndex(closestItem);
- selectionRange[1] = hitItemIndex;
- }
- return selectionRange;
-}
-/**
- * Set the scroll range of the vertical scroll bar.
- * Resize the scroll bar if the scroll range maximum
- * has changed.
- */
-void calculateVerticalScrollbar() {
- int newMaximum = getVisibleItemCount();
- ScrollBar verticalBar = getVerticalBar();
-
- // The call to setMaximum is ignored if newMaximum is 0.
- // Therefore we can not rely on getMaximum to subsequently return the number of
- // items in the receiver. We always have to use getVisibleItemCount().
- // Never rely on getMaximum to return what you set. It may not accept the
- // value you set. Even if you use a valid value now the implementation may change
- // later. That's what caused 1FRLOSG.
- verticalBar.setMaximum(newMaximum);
- if (getHorizontalBar().getVisible() == false) { // remove these lines
- verticalBar.setMaximum(newMaximum); // when PR 1FIG5CG
- } // is fixed
- resizeVerticalScrollbar();
-}
-
-/**
- * Answer the size of the receiver needed to display all items.
- * The length of the longest item in the receiver is used for the
- * width.
- */
-public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = getContentWidth();
- int height = getItemCount() * getItemHeight();
- int style = getStyle();
- int scrollBarWidth = computeTrim(0, 0, 0, 0).width;
-
- if (width == 0) {
- width = DEFAULT_WIDTH;
- }
- if (height == 0) {
- height = DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) {
- width = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- height = hHint;
- }
- if ((getStyle() & SWT.V_SCROLL) != 0) {
- width += scrollBarWidth;
- }
- if ((getStyle() & SWT.H_SCROLL) != 0) {
- height += scrollBarWidth;
- }
- return new Point(width, height);
-}
-/**
- * Do a ctrl+shift selection meaning the ctrl and shift keys
- * were pressed when the mouse click on an item occurred.
- * If an already selected item was clicked the focus is moved to
- * that item.
- * If the previous selection was a ctrl or ctrl+shift selection
- * the range between the last selected item and the clicked item
- * is selected.
- * Otherwise a regular shift selection is performed.
- * @param hitItem - specifies the clicked item
- * @param hitItemIndex - specifies the index of the clicked item
- * relative to the first item.
- */
-void ctrlShiftSelect(SelectableItem hitItem, int hitItemIndex) {
- int fromIndex = -1;
- int toIndex = -1;
- int lastSelectionIndex = -1;
- int selectionRange[];
- SelectableItem lastSelection = getLastSelection();
-
- if (lastSelection != null) {
- lastSelectionIndex = getVisibleIndex(lastSelection);
- }
- if ((getSelectionVector().contains(hitItem) == true) && // clicked an already selected item?
- (hitItemIndex != lastSelectionIndex)) { // and click was not on last selected item?
- setLastSelection(hitItem, true); // set last selection which also sets the focus
- }
- else
- if (isCtrlSelection() == true) { // was last selection ctrl/ctrl+shift selection?
- fromIndex = lastSelectionIndex; // select from last selection
- toIndex = hitItemIndex;
- }
- else { // clicked outside existing selection range
- selectionRange = calculateShiftSelectionRange(hitItemIndex);
- fromIndex = selectionRange[0];
- toIndex = selectionRange[1];
- }
- if (fromIndex != -1 && toIndex != -1) {
- selectRange(fromIndex, toIndex);
- }
-}
-/**
- * Deselect 'item'.
- * @param item - item that should be deselected
- */
-void deselect(SelectableItem item) {
- Vector selectedItems = getSelectionVector();
-
- if ((item != null) && (item.isSelected() == true)) {
- item.setSelected(false);
- redrawSelection(item);
- selectedItems.removeElement(item);
- }
-}
-/**
- * Deselect all item except 'keepSelected'.
- * @param keepSelected - item that should remain selected
- */
-void deselectAllExcept(SelectableItem keepSelected) {
- Vector selectedItems = getSelectionVector();
- Vector deselectedItems = new Vector(selectedItems.size());
- Enumeration elements = selectedItems.elements();
- SelectableItem item;
-
- // deselect and repaint previously selected items
- while (elements.hasMoreElements() == true) {
- item = (SelectableItem) elements.nextElement();
- if (item.isSelected() == true && item != keepSelected) {
- item.setSelected(false);
- // always redraw the selection, even if item is redrawn again
- // in setLastSelection. Fixes 1G0GQ8W
- redrawSelection(item);
- deselectedItems.addElement(item);
- }
- }
- elements = deselectedItems.elements();
- while (elements.hasMoreElements() == true) {
- item = (SelectableItem) elements.nextElement();
- selectedItems.removeElement(item);
- }
- setLastSelection(keepSelected, false);
-}
-/**
- * Deselect all items except those in 'keepSelected'.
- * @param keepSelected - items that should remain selected
- */
-void deselectAllExcept(Vector keepSelected) {
- Vector selectedItems = getSelectionVector();
- Vector deselectedItems = new Vector(selectedItems.size());
- Enumeration elements = selectedItems.elements();
- SelectableItem item;
-
- // deselect and repaint previously selected items
- while (elements.hasMoreElements() == true) {
- item = (SelectableItem) elements.nextElement();
- if (item.isSelected() == true && keepSelected.contains(item) == false) {
- item.setSelected(false);
- // always redraw the selection, even if item is redrawn again
- // in setLastSelection. Fixes 1G0GQ8W
- redrawSelection(item);
- deselectedItems.addElement(item);
- }
- }
- elements = deselectedItems.elements();
- while (elements.hasMoreElements() == true) {
- item = (SelectableItem) elements.nextElement();
- selectedItems.removeElement(item);
- }
- if (keepSelected.size() > 0) {
- setLastSelection((SelectableItem) keepSelected.firstElement(), false);
- }
-}
-/**
- * Deselect 'item'. Notify listeners.
- * @param item - item that should be deselected
- */
-void deselectNotify(SelectableItem item) {
- Event event = new Event();
-
- if (item.isSelected() == true) {
- deselect(item);
- setLastSelection(item, true);
- update(); // looks better when event notification takes long to return
- }
- event.item = item;
- notifyListeners(SWT.Selection, event);
-}
-/**
- * Deselect all items starting at and including 'fromIndex'
- * stopping at and including 'toIndex'.
- * @param fromIndex - index relative to the first item where
- * deselection should start. Deselecion includes 'fromIndex'.
- * @param toIndex - index relative to the first item where
- * deselection should stop. Deselecion includes 'toIndex'.
- */
-void deselectRange(int fromIndex, int toIndex) {
- if (fromIndex > toIndex) {
- for (int i = toIndex; i <= fromIndex; i++) {
- deselect(getVisibleItem(i));
- }
- }
- else
- if (fromIndex < toIndex) {
- for (int i = toIndex; i >= fromIndex; i--) {
- deselect(getVisibleItem(i));
- }
- }
- setLastSelection(getVisibleItem(fromIndex), true);
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection down one item
- * Ctrl Keep old selection, move input focus down one item
- * Shift Extend selection by one item.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowDown(int keyMask) {
- SelectableItem lastFocus = getLastFocus();
- SelectableItem newFocus;
- int focusItemIndex = getVisibleIndex(lastFocus);
-
- if (focusItemIndex < (getVisibleItemCount() - 1)) { // - 1 because indices are 0 based
- focusItemIndex++;
- newFocus = getVisibleItem(focusItemIndex);
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, focusItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Modifier Key Action
- * None Scroll receiver to the left
- * Ctrl See None above
- * Shift See None above
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowLeft(int keyMask) {
- ScrollBar horizontalBar = getHorizontalBar();
- int scrollSelection = horizontalBar.getSelection();
- int scrollAmount;
-
- if (horizontalBar.getVisible() == false) {
- return;
- }
- scrollAmount = Math.min(HORIZONTAL_SCROLL_INCREMENT, scrollSelection);
- horizontalBar.setSelection(scrollSelection - scrollAmount);
- setHorizontalOffset(horizontalBar.getSelection() * -1);
-}
-/**
- * Modifier Key Action
- * None Scroll receiver to the right
- * Ctrl See None above
- * Shift See None above
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowRight(int keyMask) {
- ScrollBar horizontalBar = getHorizontalBar();
- int scrollSelection = horizontalBar.getSelection();
- int scrollAmount;
-
- if (horizontalBar.getVisible() == false) {
- return;
- }
- scrollAmount = Math.min( // scroll by the smaller of
- HORIZONTAL_SCROLL_INCREMENT, // the scroll increment
- horizontalBar.getMaximum() // and the remaining scroll range
- - horizontalBar.getPageIncrement()
- - scrollSelection);
- horizontalBar.setSelection(scrollSelection + scrollAmount);
- setHorizontalOffset(horizontalBar.getSelection() * -1);
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection up one item
- * Ctrl Keep old selection, move input focus up one item
- * Shift Extend selection by one item.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowUp(int keyMask) {
- SelectableItem lastFocus = getLastFocus();
- SelectableItem newFocus;
- int focusItemIndex = getVisibleIndex(lastFocus);
-
- if (focusItemIndex > 0) {
- focusItemIndex--;
- newFocus = getVisibleItem(focusItemIndex);
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, focusItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Perform a selection operation on the item check box.
- * @param item - the item that was clicked
- */
-void doCheckItem(SelectableItem item) {
- Event event = new Event();
-
- item.setChecked(!item.getChecked());
- event.item = item;
- event.detail = SWT.CHECK;
- notifyListeners(SWT.Selection, event);
-}
-/**
- * Free resources.
- */
-void doDispose() {
- setRemovingAll(true);
- getSelectionVector().removeAllElements();
- lastFocusItem = null;
- lastSelectedItem = null;
- if (uncheckedImage != null) {
- uncheckedImage.dispose();
- }
- if (grayUncheckedImage != null) {
- grayUncheckedImage.dispose();
- }
- if (checkMarkImage != null) {
- checkMarkImage.dispose();
- }
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection to the
- * last item
- * Ctrl Keep old selection, move input focus to the
- * last item
- * Shift Extend selection to the last item.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doEnd(int keyMask) {
- SelectableItem lastFocus = getLastFocus();
- SelectableItem newFocus;
- int focusItemIndex = getVisibleIndex(lastFocus);
- int lastItemIndex = getVisibleItemCount() - 1; // - 1 because indices are 0 based
-
- if (focusItemIndex < lastItemIndex) {
- newFocus = getVisibleItem(lastItemIndex);
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, lastItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection to the
- * first item
- * Ctrl Keep old selection, move input focus to the
- * first item
- * Shift Extend selection to the first item.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doHome(int keyMask) {
- SelectableItem lastFocus = getLastFocus();
- SelectableItem newFocus;
- int firstItemIndex = 0;
-
- if (getVisibleIndex(lastFocus) > firstItemIndex) {
- newFocus = getVisibleItem(firstItemIndex);
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, firstItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Perform a mouse select action according to the key state
- * mask in 'eventStateMask'.
- * Key state mask is ignored when receiver has the single selection
- * style.
- * @param item - the item that was clicked
- * @param itemIndex - the index of the clicked item relative
- * to the first item of the receiver
- * @param eventStateMask - the key state mask of the mouse event
- * @param button - the mouse button that was pressed
- */
-void doMouseSelect(SelectableItem item, int itemIndex, int eventStateMask, int button) {
- if (((eventStateMask & SWT.CTRL) != 0) &&
- ((eventStateMask & SWT.SHIFT) != 0) &&
- (isMultiSelect() == true)) {
- if (getSelectionVector().size() == 0) { // no old selection?
- selectNotify(item); // do standard CTRL selection
- }
- else {
- ctrlShiftSelect(item, itemIndex);
- }
- setCtrlSelection(true);
- }
- else
- if (((eventStateMask & SWT.SHIFT) != 0) && (isMultiSelect() == true)) {
- shiftSelect(item, itemIndex);
- setCtrlSelection(false);
- }
- else
- if (((eventStateMask & SWT.CTRL) != 0) && (isMultiSelect() == true)) {
- toggleSelectionNotify(item);
- setCtrlSelection(true);
- }
- else
- if (button != 3 || item.isSelected() == false) {
- // only select the item (and deselect all others) if the mouse click is
- // not a button 3 click or if a previously unselected item was clicked.
- // Fixes 1G97L65
- deselectAllExcept(item);
- selectNotify(item);
- setCtrlSelection(false);
- }
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection one page down
- * Ctrl Keep old selection, move input focus one page down
- * Shift Extend selection one page down
- * One page is the number of items that can be displayed in the
- * receiver's canvas without truncating the last item.
- * The selection is set to the last item if there is no full page
- * of items left.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doPageDown(int keyMask) {
- SelectableItem newFocus;
- int focusItemIndex = getVisibleIndex(getLastFocus());
- int lastItemIndex = getVisibleItemCount() - 1; // - 1 because indices are 0 based
- int visibleItemCount;
-
- if (focusItemIndex < lastItemIndex) {
- visibleItemCount = getItemCountWhole();
- focusItemIndex = Math.min(
- lastItemIndex,
- focusItemIndex + (visibleItemCount - 1));
- newFocus = getVisibleItem(focusItemIndex);
- if (newFocus == null) {
- return;
- }
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, focusItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Modifier Key Action
- * None Remove old selection, move selection one page up
- * Ctrl Keep old selection, move input focus one page up
- * Shift Extend selection one page up
- * One page is the number of items that can be displayed in the
- * receiver's canvas without truncating the last item.
- * The selection is set to the first item if there is no full page
- * of items left.
- * Modifier Key is ignored when receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-void doPageUp(int keyMask) {
- SelectableItem newFocus;
- int focusItemIndex = getVisibleIndex(getLastFocus());
- int visibleItemCount;
-
- if (focusItemIndex > 0) {
- visibleItemCount = getItemCountWhole();
- focusItemIndex = Math.max(
- 0,
- focusItemIndex - (visibleItemCount - 1));
- newFocus = getVisibleItem(focusItemIndex);
- if (keyMask == SWT.CTRL && isMultiSelect() == true) {
- setLastFocus(newFocus, true);
- }
- else
- if (keyMask == SWT.SHIFT && isMultiSelect() == true) {
- shiftSelect(newFocus, focusItemIndex);
- }
- else {
- deselectAllExcept(newFocus);
- selectNotify(newFocus);
- }
- }
-}
-/**
- * Modifier Key Action
- * Ctrl Keep old selection, toggle selection of the item
- * that has the input focus
- * Shift Extend selection to the item that has the input
- * focus
- * Ctrl & Shift Set selection to the item that has input focus
- * Do nothing if receiver has single selection style.
- * @param keyMask - the modifier key that was pressed
- */
-
-void doSpace(int keyMask) {
- SelectableItem item = getLastFocus();
- if (item == null) return;
- if (item.isCheckable() == true) doCheckItem(item);
- int itemIndex = getVisibleIndex(item);
-
- if (keyMask == SWT.NULL && item.isSelected() == false) { // do simple space select in SINGLE and MULTI mode
- deselectAllExcept(item);
- selectNotify(item);
- return;
- }
- if (isMultiSelect() == false) {
- return;
- }
- if (keyMask == SWT.CTRL) {
- toggleSelectionNotify(item);
- }
- else
- if (((keyMask & SWT.CTRL) != 0) && ((keyMask & SWT.SHIFT) != 0)) {
- deselectAllExcept(item);
- selectNotify(item);
- }
- else
- if (keyMask == SWT.SHIFT) {
- shiftSelect(item, itemIndex);
- }
-}
-/**
- * Make sure that free space at the bottom of the receiver is
- * occupied.
- * There will be new space available below the last item when the
- * receiver's height is increased. In this case the receiver
- * is scrolled down to occupy the new space.if the top item is
- * not the first item of the receiver.
- */
-void claimBottomFreeSpace() {
- int clientAreaItemCount = getItemCountWhole();
- int topIndex = getTopIndex();
- int newTopIndex;
- int lastItemIndex = getVisibleItemCount() - topIndex;
-
- if ((topIndex > 0) &&
- (lastItemIndex > 0) &&
- (lastItemIndex < clientAreaItemCount)) {
- newTopIndex = Math.max(0, topIndex-(clientAreaItemCount-lastItemIndex));
- setTopIndex(newTopIndex, true);
- }
-}
-/**
- * Make sure that free space at the right side of the receiver is
- * occupied.
- * There will be new space available at the right side of the receiver
- * when the receiver's width is increased. In this case the receiver
- * is scrolled to the right to occupy the new space.if possible.
- */
-void claimRightFreeSpace() {
- int clientAreaWidth = getClientArea().width;
- int newHorizontalOffset = clientAreaWidth - getContentWidth();
-
- if (newHorizontalOffset - getHorizontalOffset() > 0) { // item is no longer drawn past the right border of the client area
- newHorizontalOffset = Math.min(0, newHorizontalOffset); // align the right end of the item with the right border of the
- setHorizontalOffset(newHorizontalOffset); // client area (window is scrolled right)
- }
-}
-/** Not used right now. Replace focusIn/focusOut with this method once
- * Display.getFocusWindow returns the new focus window on FocusOut event
- * (see 1FMITIE)
- * The focus has moved in to or out of the receiver.
- * Redraw the item selection to reflect the focus change.
- * @param event - the focus change event
- */
-void focusChange(Event event) {
- Enumeration items = getSelectionVector().elements();
- SelectableItem lastFocusItem = getLastFocus();
- SelectableItem item;
-
- while (items.hasMoreElements() == true) {
- item = (SelectableItem) items.nextElement();
- redrawSelection(item);
- }
- if (lastFocusItem != null) {
- redrawSelection(lastFocusItem);
- }
-}
-/**
- * The focus has moved in to or out of the receiver.
- * Redraw the item selection to reflect the focus change.
- * @param event - the focus change event
- */
-void focusIn(Event event) {
- Enumeration items = getSelectionVector().elements();
- SelectableItem lastFocusItem = getLastFocus();
- SelectableItem item;
-
- // Workaround for 1FMITIE
- hasFocus = true;
- while (items.hasMoreElements() == true) {
- item = (SelectableItem) items.nextElement();
- redrawSelection(item);
- }
- if (lastFocusItem != null) {
- redrawSelection(lastFocusItem);
- }
- // Fix blank item on slow machines/VMs. Also fixes 1G0IFMZ.
- update();
-}
-/**
- * The focus has moved in to or out of the receiver.
- * Redraw the item selection to reflect the focus change.
- * @param event - the focus change event
- */
-void focusOut(Event event) {
- Enumeration items = getSelectionVector().elements();
- SelectableItem lastFocusItem = getLastFocus();
- SelectableItem item;
-
- // Workaround for 1FMITIE
- hasFocus = false;
- while (items.hasMoreElements() == true) {
- item = (SelectableItem) items.nextElement();
- redrawSelection(item);
- }
- if (lastFocusItem != null) {
- redrawSelection(lastFocusItem);
- }
- // Fix blank item on slow machines/VMs. Also fixes 1G0IFMZ.
- update();
-}
-/**
- * Answer the index of the last item position in the receiver's
- * client area.
- * @return 0-based index of the last item position in the tree's
- * client area.
- */
-int getBottomIndex() {
- return getTopIndex() + getItemCountTruncated(getClientArea());
-}
-/**
- * Answer the size of the check box image.
- * The calculation is cached and assumes that the images for
- * the checked and unchecked state are the same size.
- */
-Point getCheckBoxExtent() {
- Image checkedImage;
- Rectangle imageBounds;
-
- if (checkBoxExtent == null) {
- checkedImage = getUncheckedImage();
- if (checkedImage != null) {
- imageBounds = checkedImage.getBounds();
- checkBoxExtent = new Point(imageBounds.width, imageBounds.height);
- }
- else {
- checkBoxExtent = new Point(0, 0);
- }
- }
- return checkBoxExtent;
-}
-/**
- * Answer the image for the selected check box
- * Answer null if the image couldn't be loaded.
- */
-Image getCheckMarkImage() {
- InputStream resourceStream;
-
- if (checkMarkImage == null) {
- checkMarkImage = new Image(getDisplay(), CheckMarkImageData);
- }
- return checkMarkImage;
-}
-/**
- * Answer the width of the receiver's content.
- * Needs to be set by subclasses.
- */
-int getContentWidth() {
- return contentWidth;
-}
-/**
- * Answer the horizontal drawing offset used for scrolling.
- * This is < 0 if the receiver has been scrolled to the left,
- * > 0 if the receiver has been scrolled to the right and 0
- * if the receiver has not been scrolled.
- */
-int getHorizontalOffset() {
- return horizontalOffset;
-}
-
-/**
- * Answer the size of item images. Calculated during the item
- * height calculation.
- */
-Point getImageExtent() {
- return itemImageExtent;
-}
-/**
- * Answer the image extent of 'item'. Overridden by subclasses.
- */
-Point getImageExtent(SelectableItem item) {
- Image image = item.getImage();
- Rectangle imageBounds;
- Point imageExtent = null;
-
- if (image != null) {
- imageBounds = image.getBounds();
- imageExtent = new Point(imageBounds.width, imageBounds.height);
- }
- return imageExtent;
-}
-/**
- * Answer the index of 'item' in the receiver.
- */
-abstract int getIndex(SelectableItem item);
-/**
- * Answer the first and last index of items that can be displayed in
- * the area defined by 'clipRectangle'. This includes partial items.
- * @return
- * Array -
- * First element is the index of the first item in 'clipRectangle'.
- * Second element is the index of the last item in 'clipRectangle'.
- */
-int[] getIndexRange(Rectangle clipRectangle) {
- int visibleRange[] = new int[] {0, 0};
-
- visibleRange[0] = clipRectangle.y / getItemHeight();
- visibleRange[1] =
- visibleRange[0] +
- getItemCountTruncated(clipRectangle) - 1; // - 1 because item index is 0 based
- return visibleRange;
-}
-/**
- * Return the item that draws the marker indicating the insert location
- * in a drag and drop operation
- */
-SelectableItem getInsertItem() {
- return insertItem;
-}
-/**
- * Answer the number of items in the receiver.
- */
-public abstract int getItemCount();
-/**
- * Answer the number of items that can be displayed in 'rectangle'.
- * The result includes partially visible items.
- */
-int getItemCountTruncated(Rectangle rectangle) {
- int itemHeight = getItemHeight();
- int itemCount = 0;
- int startIndex;
-
- startIndex = rectangle.y / itemHeight;
- itemCount = Compatibility.ceil(rectangle.y + rectangle.height, itemHeight)-startIndex;
- return itemCount;
-}
-/**
- * Answer the number of items that can be displayed in the client
- * area of the receiver.
- * The result only includes items that completely fit into the
- * client area.
- */
-int getItemCountWhole() {
- return getClientArea().height / getItemHeight();
-}
-/**
- * Answer the height of an item in the receiver.
- * The item height is the greater of the item icon height and
- * text height of the first item that has text or an image
- * respectively.
- * Calculate a default item height based on the font height if
- * no item height has been calculated yet.
- */
-public int getItemHeight() {
- checkWidget();
- GC gc;
- if (itemHeight == 0) {
- gc = new GC(this);
- itemHeight = gc.stringExtent("String").y + getItemPadding(); // initial item height=font height + item spacing
- // use real font height here when available in SWT, instead of GC.textExtent
- gc.dispose();
- }
- return itemHeight;
-}
-/**
- * Answer the number of pixels that should be added to the item height.
- */
-int getItemPadding() {
- return 2 + getDisplay().textHighlightThickness;
-}
-/**
- * Answer the item that most recently received the input focus.
- */
-SelectableItem getLastFocus() {
- return lastFocusItem;
-}
-/**
- * Answer the item that was selected most recently.
- */
-SelectableItem getLastSelection() {
- return lastSelectedItem;
-}
-/**
- * Answer the event listener used for all events. Events are
- * dispatched to handler methods in handleEvents(Event).
- * This scheme saves a lot of inner classes.
- */
-Listener getListener() {
- return listener;
-}
-/**
- * Answer the y coordinate at which 'item' is drawn.
- * @param item - SelectableItem for which the paint position
- * should be returned
- * @return the y coordinate at which 'item' is drawn.
- * Return -1 if 'item' is not an item of the receiver
- */
-int getRedrawY(SelectableItem item) {
- int redrawIndex = getVisibleIndex(item);
- int redrawY = -1;
-
- if (redrawIndex != -1) {
- redrawY = (redrawIndex - getTopIndex()) * getItemHeight();
- }
- return redrawY;
-}
-/**
- * Answer the number of selected items in the receiver.
- */
-public int getSelectionCount() {
- checkWidget();
- return getSelectionVector().size();
-}
-/**
- * Answer the selected items of the receiver.
- * @return The selected items of the receiver stored in a Vector.
- * Returned Vector is empty if no items are selected.
- */
-Vector getSelectionVector() {
- return selectedItems;
-}
-/**
- * Answer the width of 'text' in pixel.
- * Answer 0 if 'text' is null.
- */
-int getTextWidth(String text) {
- int textWidth = 0;
- GC gc;
-
- if (text != null) {
- gc = new GC(this);
- textWidth = gc.stringExtent(text).x;
- gc.dispose();
- }
- return textWidth;
-}
-/**
- * Answer the index of the first visible item in the receiver's
- * client area.
- * @return 0-based index of the first visible item in the
- * receiver's client area.
- */
-int getTopIndex() {
- return topIndex;
-}
-/**
- * Answer the image for the deselected check box.
- */
-Image getUncheckedImage() {
- InputStream resourceStream;
-
- if (uncheckedImage == null) {
- uncheckedImage = new Image(getDisplay(), UncheckedImageData);
- }
- return uncheckedImage;
-}
-
-/**
- * Answer the image for the grayed eck box.
- */
-Image getGrayUncheckedImage() {
- InputStream resourceStream;
-
- if (grayUncheckedImage == null) {
- grayUncheckedImage = new Image(getDisplay(), GrayUncheckedImageData);
- }
- return grayUncheckedImage;
-}
-
-/**
- * Answer the index of 'item' in the receiver.
- * Answer -1 if the item is not visible.
- * The returned index must refer to a visible item.
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. It only means that the item
- * would be displayed if it is located inside the receiver's
- * client area.
- * Normally, every item of the receiver is visible.
- */
-abstract int getVisibleIndex(SelectableItem item);
-/**
- * Answer the SelectableItem located at 'itemIndex' in the
- * receiver.
- * @param itemIndex - location of the SelectableItem object
- * to return
- */
-abstract SelectableItem getVisibleItem(int itemIndex);
-/**
- * Answer the number of visible items of the receiver.
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. It only means that the item
- * would be displayed if it is located inside the receiver's
- * client area.
- * Normally every item of the receiver is visible.
- */
-int getVisibleItemCount() {
- return getItemCount();
-}
-/**
- * Answer the y coordinate at which 'item' is drawn.
- * @param item - SelectableItem for which the paint position
- * should be returned
- * @return the y coordinate at which 'item' is drawn.
- * Return -1 if 'item' is null or outside the client area
- */
-abstract int getVisibleRedrawY(SelectableItem item);
-/**
- * Handle the events the receiver is listening to.
- */
-void handleEvents(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- doDispose();
- break;
- case SWT.KeyDown:
- keyDown(event);
- break;
- case SWT.Resize:
- resize(event);
- break;
- case SWT.Selection:
- if (event.widget == getVerticalBar()) {
- scrollVertical(event);
- }
- else
- if (event.widget == getHorizontalBar()) {
- scrollHorizontal(event);
- }
- break;
- case SWT.FocusOut:
- focusOut(event);
- break;
- case SWT.FocusIn:
- focusIn(event);
- break;
- case SWT.Traverse:
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- event.doit = true;
- break;
- }
- break;
- }
-}
-
-
-
-/**
- * Answer whether 'item' has the input focus.
- */
-boolean hasFocus(SelectableItem item) {
- return (isFocusControl() && item == getLastFocus());
-}
-/**
- * Initialize the receiver. Add event listeners and set widget
- * colors.
- */
-void initialize() {
- Display display = getDisplay();
- ScrollBar horizontalBar = getHorizontalBar();
- ScrollBar verticalBar = getVerticalBar();
-
- // listener may be needed by overridden installListeners()
- listener = new Listener() {
- public void handleEvent(Event event) {handleEvents(event);}
- };
- setSelectionVector(new Vector());
- installListeners();
- calculateVerticalScrollbar();
- calculateHorizontalScrollbar();
- horizontalBar.setMinimum(0);
- verticalBar.setMinimum(0);
- horizontalBar.setIncrement(HORIZONTAL_SCROLL_INCREMENT);
- setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
-}
-/**
- * Initialize the ImageData used for the checked/unchecked images.
- */
-static void initializeImageData() {
- PaletteData uncheckedPalette = new PaletteData(
- new RGB[] {new RGB(128, 128, 128), new RGB(255, 255, 255)});
- PaletteData grayUncheckedPalette = new PaletteData(
- new RGB[] {new RGB(128, 128, 128), new RGB(192, 192, 192)});
- PaletteData checkMarkPalette = new PaletteData(
- new RGB[] {new RGB(0, 0, 0), new RGB(252, 3, 251)});
- byte[] checkbox = new byte[] {0, 0, 127, -64, 127, -64, 127, -64, 127, -64, 127, -64, 127, -64, 127, -64, 127, -64, 127, -64, 0, 0};
-
- // Each pixel is represented by one bit in the byte data.
- // The bit references the palette position (0 or 1). Each pixel row of an image is padded to one byte.
- // Arguments: width, height, depth, palette, scanline padding, data
- UncheckedImageData = new ImageData(11, 11, 1, uncheckedPalette, 2, checkbox);
- GrayUncheckedImageData = new ImageData(11, 11, 1, grayUncheckedPalette, 2, checkbox);
- CheckMarkImageData = new ImageData(7, 7, 1, checkMarkPalette, 1, new byte[] {-4, -8, 112, 34, 6, -114, -34});
- CheckMarkImageData.transparentPixel = 1;
-}
-/**
- * Add event listeners to the tree widget and its scroll bars.
- */
-void installListeners() {
- Listener listener = getListener();
-
- addListener(SWT.Dispose, listener);
- addListener(SWT.Resize, listener);
- addListener(SWT.KeyDown, listener);
- addListener(SWT.FocusOut, listener);
- addListener(SWT.FocusIn, listener);
- addListener(SWT.Traverse, listener);
-
- getVerticalBar().addListener(SWT.Selection, listener);
- getHorizontalBar().addListener(SWT.Selection, listener);
-}
-/**
- * Answer whether the currently selected items were selected
- * using the ctrl key.
- */
-boolean isCtrlSelection() {
- return isCtrlSelection;
-}
-/**
- * Answer true if all items in the widget are disposed.
- * Used to optimize item disposal. Prevents unnecessary screen
- * updates.
- */
-boolean isRemovingAll() {
- return isRemovingAll;
-}
-/**
- * Answer whether the receiver has the input focus.
- * Workaround for 1FMITIE
- */
-public boolean isFocusControl() {
- return hasFocus;
-}
-/**
- * Return whether the drop insert position is before or after the
- * item set using motif_setInsertMark.
- * @return
- * true=insert position is after the insert item
- * false=insert position is before the insert item
- */
-boolean isInsertAfter() {
- return isInsertAfter;
-}
-/**
- * Answer whether the receiver has the MULTI selection style set.
- * @return
- * true = receiver is in multiple selection mode.
- * false = receiver is in single selection mode.
- */
-boolean isMultiSelect() {
- return ((getStyle() & SWT.MULTI) != 0);
-}
-/**
- * The item identified by 'changedItem' has changed.
- * Calculate the item height based on the new item data (it might
- * now have an image which could also be the first image in the
- * receiver)
- * Redraw the whole window if the item height has changed. Otherwise
- * redraw only the changed item or part of it depending on the
- * 'repaintStartX' and 'repaintWidth' parameters.
- * @param changedItem - the item that has changed
- * @param repaintStartX - x position of the item redraw.
- * @param repaintWidth - width of the item redraw.
- */
-void itemChanged(SelectableItem changedItem, int repaintStartX, int repaintWidth) {
- int yPosition;
- int itemHeight;
- int oldItemHeight = getItemHeight();
- Point oldImageExtent = getImageExtent();
-
- calculateItemHeight(changedItem); // make sure that the item height is recalculated
- // no redraw necessary if redraw width is 0 or item is not visible
- if (repaintWidth == 0 || (yPosition = getVisibleRedrawY(changedItem)) == -1) {
- return;
- } // if changedItem is the first item with image.
- itemHeight = getItemHeight();
- if ((oldItemHeight == itemHeight) && // only redraw changed item if the item height and
- (oldImageExtent == getImageExtent())) { // image size has not changed. The latter will only change once,
- // from null to a value-so it's safe to test using !=
- // redrawing outside the client area redraws the widget border on Motif.
- // adjust the redraw width if necessary. Workaround for 1G4TQRW
- repaintWidth = Math.min(repaintWidth, getClientArea().width - repaintStartX);
- if (repaintWidth > 0) {
- redraw(repaintStartX, yPosition, repaintWidth, itemHeight, true);
- }
- }
- else {
- redraw(); // redraw all items if the item height has changed
- }
-}
-/**
- * A key was pressed. Call the appropriate handler method.
- * @param event - the key event
- */
-void keyDown(Event event) {
- boolean isCtrlSelection = isCtrlSelection();
-
- if (event.stateMask != SWT.CTRL) {
- isCtrlSelection = false;
- }
- switch (event.keyCode) {
- case SWT.ARROW_UP:
- doArrowUp(event.stateMask);
- break;
- case SWT.ARROW_DOWN:
- doArrowDown(event.stateMask);
- break;
- case SWT.ARROW_LEFT:
- doArrowLeft(event.stateMask);
- break;
- case SWT.ARROW_RIGHT:
- doArrowRight(event.stateMask);
- break;
- case SWT.PAGE_UP:
- doPageUp(event.stateMask);
- break;
- case SWT.PAGE_DOWN:
- doPageDown(event.stateMask);
- break;
- case SWT.HOME:
- doHome(event.stateMask);
- break;
- case SWT.END:
- doEnd(event.stateMask);
- break;
- default: // no selection occurred, keep previous
- isCtrlSelection = isCtrlSelection(); // selection type information
- }
- if (event.character == ' ') {
- doSpace(event.stateMask);
- isCtrlSelection = (event.stateMask == SWT.CTRL);
- }
- setCtrlSelection(isCtrlSelection);
-}
-/**
- * Sets the drop insert item.
- * The drop insert item has a visual hint to show where a dragged item
- * will be inserted when dropped on the tree.
- * <p>
- * @param item the insert item
- * @param after true places the insert mark below 'item'. false places
- * the insert mark above 'item'.
- */
-void motif_setInsertMark(SelectableItem item, boolean after) {
- SelectableItem currentItem = getInsertItem();
- int redrawY;
-
- setInsertItem(item);
- setInsertAfter(after);
- if (currentItem != null) {
- redrawY = getVisibleRedrawY(currentItem);
- if (redrawY != -1) {
- currentItem.redrawInsertMark(redrawY);
- }
- }
- if (item != null) {
- redrawY = getVisibleRedrawY(item);
- if (redrawY != -1) {
- item.redrawInsertMark(redrawY);
- }
- }
-}
-
-
-/**
- * Overridden to implement setRedraw(). Redraw is ignored if setRedraw was
- * set to false.
- */
-public void redraw () {
- checkWidget();
- if (drawCount == 0) {
- super.redraw();
- }
-}
-/**
- * Overridden to implement setRedraw(). Redraw is ignored if setRedraw was
- * set to false.
- */
-public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget();
- if (drawCount == 0) {
- super.redraw(x, y, width, height, all);
- }
-}
-
-/**
- * Redraw the selection of 'item'
- * @param item - SelectableItem that should have the selection redrawn.
- */
-void redrawSelection(SelectableItem item) {
- int redrawPosition = getVisibleRedrawY(item);
- if (redrawPosition != -1) {
- item.redrawSelection(redrawPosition);
- }
-}
-/**
- * 'item' has been removed from the receiver.
- * Update the display and the scroll bars.
- */
-void removedItem(SelectableItem item) {
- claimBottomFreeSpace();
- calculateVerticalScrollbar();
- if (getItemCount() == 0) {
- reset();
- }
-}
-/**
- * 'item' is about to be removed from the tree.
- * Move the selection/input focus if 'item' is selected or has the
- * input focus,
- * @param item - item that is about to be removed from the tree.
- */
-void removingItem(SelectableItem item) {
- SelectableItem nextFocusItem = null;
- int itemIndex = getVisibleIndex(item);
- int itemCount = getVisibleItemCount();
-
- // deselect item and remove from selection
- if (item.isSelected() == true) {
- getSelectionVector().removeElement(item);
- }
- if (item == getLastFocus() && itemCount > 1) {
- // select previous item if removed item is bottom item
- // otherwise select next item. Fixes 1GA6L85
- if (itemIndex == itemCount - 1) {
- nextFocusItem = getVisibleItem(itemIndex - 1);
- }
- else {
- nextFocusItem = getVisibleItem(itemIndex + 1);
- }
- setLastFocus(nextFocusItem, true);
- }
- // ignore items below widget client area
- if (itemIndex != -1 && itemIndex <= getBottomIndex()) {
- scrollVerticalRemovedItem(itemIndex);
- }
-}
-/**
- * Reset state that is dependent on or calculated from the state
- * of the receiver.
- */
-void reset() {
- setSelectionVector(new Vector());
- setTopIndexNoScroll(0, true);
- lastSelectedItem = null;
- lastFocusItem = null;
- resetItemData();
-}
-/**
- * Reset state that is dependent on or calculated from the items
- * of the receiver.
- */
-void resetItemData() {
- setHorizontalOffset(0);
- setItemHeight(0);
- itemImageExtent = null;
- textHeight = -1;
- claimRightFreeSpace();
-}
-/**
- * The receiver has been resized. Update the scroll bars and
- * make sure that new space is being occupied by items.
- */
-void resize(Event event) {
- int horizontalPageSize = getHorizontalBar().getPageIncrement();
-
- resizeHorizontalScrollbar();
- resizeVerticalScrollbar();
- if (getClientArea().width > horizontalPageSize) { // window resized wider? - Do this check here
- claimRightFreeSpace(); // because claimRightFreeSpace is called elsewhere.
- }
- claimBottomFreeSpace();
-}
-/**
- * Display the horizontal scroll bar if items are drawn off
- * screen. Update the page size.
- */
-void resizeHorizontalScrollbar() {
- ScrollBar horizontalBar = getHorizontalBar();
- int clientAreaWidth = getClientArea().width;
-
- if (clientAreaWidth < getContentWidth()) {
- if (horizontalBar.getVisible() == false) {
- horizontalBar.setVisible(true);
- horizontalBar.setSelection(0);
- }
- }
- else
- if (horizontalBar.getVisible() == true) {
- horizontalBar.setVisible(false);
- }
- horizontalBar.setThumb(clientAreaWidth);
- horizontalBar.setPageIncrement(clientAreaWidth);
-}
-/**
- * Display the vertical scroll bar if items are drawn off screen.
- * Update the page size.
- */
-void resizeVerticalScrollbar() {
- int clientAreaItemCount = getItemCountWhole();
- ScrollBar verticalBar = getVerticalBar();
-
- if (clientAreaItemCount == 0) {
- return;
- }
- if (clientAreaItemCount < getVisibleItemCount()) {
- if (verticalBar.getVisible() == false) {
- verticalBar.setVisible(true);
- }
- // Only set the page size to something smaller than the scroll
- // range maximum. Otherwise the scroll selection will be reset.
- verticalBar.setPageIncrement(clientAreaItemCount);
- verticalBar.setThumb(clientAreaItemCount);
- }
- else
- if (verticalBar.getVisible() == true) {
- verticalBar.setVisible(false);
- }
-}
-/**
- * Scroll the rectangle specified by x, y, width, height to the destination
- * position. Do nothing if redraw is set to false using setRedraw().
- *
- * @param destX - destination x position of the scrolled rectangle
- * @param destY - destination y position of the scrolled rectangle
- * @param x - x location of the upper left corner of the scroll rectangle
- * @param y - y location of the upper left corner of the scroll rectangle
- * @param width - width of the scroll rectangle
- * @param height - height of the scroll rectangle
- * @param all - not used. Used to be true=scroll children intersecting the
- * scroll rectangle.
- */
-void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) {
- if (drawCount == 0) {
- update();
- GC gc = new GC(this);
- gc.copyArea(x, y, width, height, destX, destY);
- gc.dispose();
- }
-}
-/**
- * Scroll horizontally by 'numPixel' pixel.
- * @param numPixel - the number of pixel to scroll
- * numPixel > 0 = scroll to left. numPixel < 0 = scroll to right
- */
-abstract void scrollHorizontal(int numPixel);
-/**
- * The position of the horizontal scroll bar has been modified
- * by the user.
- * Adjust the horizontal offset to trigger a horizontal scroll.
- * @param event-the scroll event
- */
-void scrollHorizontal(Event event) {
- setHorizontalOffset(getHorizontalBar().getSelection() * -1);
-}
-/**
- * Scroll 'item' into the receiver's client area if necessary.
- * @param item - the item that should be scrolled.
- */
-void scrollShowItem(SelectableItem item) {
- int itemIndexFromTop = getIndex(item) - getTopIndex();
- int clientAreaWholeItemCount = getItemCountWhole();
- int scrollAmount = 0;
-
- if (itemIndexFromTop >= clientAreaWholeItemCount) { // show item below visible items?
- scrollAmount = itemIndexFromTop;
- if (clientAreaWholeItemCount > 0) { // will be 0 if showItem is called and receiver hasn't been displayed yet
- scrollAmount -= clientAreaWholeItemCount - 1;
- }
- }
- else
- if (itemIndexFromTop < 0) { // show item above visible items?
- scrollAmount = itemIndexFromTop;
- }
- setTopIndex(getTopIndex() + scrollAmount, true);
-}
-/**
- * Scroll vertically by 'scrollIndexCount' items.
- * @param scrollIndexCount - the number of items to scroll.
- * scrollIndexCount > 0 = scroll up. scrollIndexCount < 0 = scroll down
- */
-abstract void scrollVertical(int scrollIndexCount);
-/**
- * The position of the horizontal scroll bar has been modified
- * by the user.
- * Adjust the index of the top item to trigger a vertical scroll.
- * @param event-the scroll event
- */
-void scrollVertical(Event event) {
- setTopIndex(getVerticalBar().getSelection(), false);
-}
-/**
- * Scroll items down to make space for a new item added to
- * the receiver at position 'index'.
- * @param index - position at which space for one new item
- * should be made. This index is relative to the first item
- * of the receiver.
- */
-void scrollVerticalAddingItem(int index) {
- Rectangle clientArea = getClientArea();
- int itemHeight = getItemHeight();
- int sourceY = Math.max(0, (index - getTopIndex()) * itemHeight); // need to scroll in visible area
-
- scroll(
- 0, sourceY + itemHeight, // destination x, y
- 0, sourceY, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Scroll the items below the item at position 'index' up
- * so that they cover the removed item.
- * @param index - index of the removed item
- */
-void scrollVerticalRemovedItem(int index) {
- Rectangle clientArea = getClientArea();
- int itemHeight = getItemHeight();
- int destinationY = Math.max(0, (index - getTopIndex()) * itemHeight);
-
- scroll(
- 0, destinationY, // destination x, y
- 0, destinationY + itemHeight, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Select 'item' if it is not selected.
- * @param item - item that should be selected
- */
-void select(SelectableItem item) {
- Vector selectedItems = getSelectionVector();
-
- if (item != null && item.isSelected() == false && isRemovingAll() == false) {
- item.setSelected(true);
- redrawSelection(item);
- selectedItems.addElement(item);
- }
-}
-/**
- * Select 'item' if it is not selected. Send a Selection event
- * if the selection was changed.
- * @param item - item that should be selected
- * @param asyncNotify
- * true=send the selection event asynchronously
- * false=send the selection event immediately
- */
-void selectNotify(final SelectableItem item, boolean asyncNotify) {
- if (isRemovingAll() == false) {
- if (item.isSelected() == false) {
- select(item);
- setLastSelection(item, true);
- update(); // looks better when event notification takes long to return
- }
- if (asyncNotify == false) {
- Event event = new Event();
- event.item = item;
- notifyListeners(SWT.Selection, event);
- }
- else {
- getDisplay().asyncExec(new Runnable() {
- public void run() {
- // Only send a selection event when the item has not been disposed.
- // Fixes 1GE6XQA
- if (item.isDisposed() == false) {
- Event event = new Event();
- event.item = item;
- notifyListeners(SWT.Selection, event);
- }
- }
- });
- }
- }
-}
-/**
- * Select 'item' if it is not selected. Send a Selection event
- * if the selection was changed.
- * @param item - item that should be selected
- */
-void selectNotify(SelectableItem item) {
- selectNotify(item, false);
-}
-/**
- * Select all items of the receiver starting at 'fromIndex'
- * and including 'toIndex'.
- */
-void selectRange(int fromIndex, int toIndex) {
- if (fromIndex > toIndex) {
- for (int i = fromIndex; i > toIndex; i--) {
- select(getVisibleItem(i));
- }
- }
- else {
- for (int i = fromIndex; i < toIndex; i++) {
- select(getVisibleItem(i));
- }
- }
- selectNotify(getVisibleItem(toIndex)); // select last item, notifying listeners
-}
-/**
- * Set the width of the receiver's contents to 'newWidth'.
- * Content width is used to calculate the horizontal scrollbar.
- */
-void setContentWidth(int newWidth) {
- ScrollBar horizontalBar;
- boolean scrollBarVisible;
-
- if (contentWidth != newWidth) {
- horizontalBar = getHorizontalBar();
- scrollBarVisible = horizontalBar.getVisible();
- contentWidth = newWidth;
- calculateHorizontalScrollbar();
- if (scrollBarVisible != horizontalBar.getVisible()) {
- resizeVerticalScrollbar(); // the vertical scroll bar needs to be resized if the horizontal
- } // scroll bar was hidden or made visible during recalculation
- }
-}
-/**
- * Set whether the currently selected items were selected using the
- * ctrl key.
- * @param isCtrlSelection -
- * true = currently selected items were selected using the ctrl key.
- * false = currently selected items were not selected using the
- * ctrl key.
- */
-void setCtrlSelection(boolean isCtrlSelection) {
- this.isCtrlSelection = isCtrlSelection;
-}
-/**
- * The font is changing. Reset the text height to force a
- * recalculation during itemChanged().
- */
-public void setFont(Font font) {
- checkWidget();
- super.setFont(font);
- textHeight = -1;
-}
-/**
- * Set the horizontal drawing offset to 'offset'.
- * Scroll the receiver's contents according to the offset change.
- * @param offset - value < 0 = widget contents is drawn left of the client area.
- */
-void setHorizontalOffset(int offset) {
- int offsetChange = offset - horizontalOffset;
- if (offsetChange != 0) {
- scrollHorizontal(offsetChange);
- horizontalOffset = offset;
- }
-}
-
-/**
- * Set whether the drop insert position is before or after the
- * item set using motif_setInsertMark.
- * @param after true=insert position is after the insert item
- * false=insert position is before the insert item
- */
-void setInsertAfter(boolean after) {
- isInsertAfter = after;
-}
-
-/**
- * Set the item that draws the marker indicating the insert location
- * in a drag and drop operation.
- * @param item the item that draws the insert marker
- */
-void setInsertItem(SelectableItem item) {
- insertItem = item;
-}
-/**
- * Set the height of the receiver's items to 'height'.
- */
-void setItemHeight(int height) {
- itemHeight = height;
-}
-/**
- * Set the item that most recently received the input focus
- * to 'focusItem'. Redraw both, the item that lost focus
- * and the one that received focus.
- * @param focusItem - the item that most recently received
- * the input focus
- * @param showItem true=new focus item, if any, should be scrolled
- * into view. false=don't scroll
- */
-void setLastFocus(SelectableItem focusItem, boolean showItem) {
- SelectableItem oldFocusItem = lastFocusItem;
-
- if (focusItem != lastFocusItem) {
- lastFocusItem = focusItem;
- if (oldFocusItem != null) {
- redrawSelection(oldFocusItem);
- }
- if (lastFocusItem != null && isFocusControl() == true) {
- redrawSelection(lastFocusItem);
- }
- }
- if (focusItem != null && showItem == true) {
- showSelectableItem(focusItem);
- }
-}
-/**
- * Set the item that was selected most recently to 'selectedItem'.
- * Set the input focus to that item.
- * @param selectedItem - the item that was selected most recently
- * @param showItem true=new focus item, if any, should be scrolled
- * into view. false=don't scroll
- */
-void setLastSelection(SelectableItem selectedItem, boolean showItem) {
- if (selectedItem == null) { // always store the item selected last
- return;
- }
- setLastFocus(selectedItem, showItem);
- lastSelectedItem = selectedItem;
-}
-/**
- * Sets the redraw flag.
- * @param redraw -
- * true = redraw and scroll operations are performed normally
- * false = redraw and scroll operations are ignored
- */
-public void setRedraw (boolean redraw) {
- checkWidget();
- if (redraw) {
- if (--drawCount == 0) redraw();
- } else {
- drawCount++;
- }
-}
-/**
- * Set whether all items in the widget are disposed.
- * Used to optimize item disposal. Prevents unnecessary screen
- * updates.
- * @param removingAll
- * true=all items are removed.
- * false=normal state, no items or not all items are removed.
- */
-void setRemovingAll(boolean removingAll) {
- isRemovingAll = removingAll;
-}
-/**
- * Select the items stored in 'selectionItems'.
- * A SWT.Selection event is not going to be sent.
- * @param selectionItems - Array containing the items that should
- * be selected
- */
-void setSelectableSelection(SelectableItem selectionItems[]) {
- SelectableItem item = null;
- int selectionCount = selectionItems.length;
- Vector keepSelected;
-
- if (isMultiSelect() == false && selectionCount > 1) {
- selectionCount = 1;
- }
- keepSelected = new Vector(selectionItems.length);
- for (int i = 0; i < selectionCount; i++) {
- if (selectionItems[i] != null) {
- if (selectionItems[i].isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- keepSelected.addElement(selectionItems[i]);
- }
- }
- deselectAllExcept(keepSelected);
- // select in the same order as all the other selection and deslection methods.
- // Otherwise setLastSelection repeatedly changes the lastSelectedItem for repeated
- // selections of the items, causing flash.
- for (int i = selectionCount - 1; i >= 0; i--) {
- item = selectionItems[i];
- if (item != null) {
- select(item);
- }
- }
- if (item != null) {
- setLastSelection(item, true);
- }
-}
-/**
- * Set the vector used to store the selected items of the receiver
- * to 'newVector'.
- * @param newVector - the vector used to store the selected items
- * of the receiver
- */
-void setSelectionVector(Vector newVector) {
- selectedItems = newVector;
-}
-/**
- * Scroll the item at 'index' to the top.
- * @param index - 0-based index of the first visible item in the
- * receiver's client area.
- * @param adjustScrollbar - true=set the position of the vertical
- * scroll bar to the new top index.
- * false=don't adjust the vertical scroll bar
- */
-void setTopIndex(int index, boolean adjustScrollbar) {
- int indexDiff = index-topIndex;
-
- if (indexDiff != 0) {
- scrollVertical(indexDiff);
- setTopIndexNoScroll(index, adjustScrollbar);
- }
-}
-/**
- * Set the index of the first visible item in the receiver's client
- * area to 'index'.
- * @param index - 0-based index of the first visible item in the
- * receiver's client area.
- * @param adjustScrollbar - true=set the position of the vertical
- * scroll bar to the new top index.
- * false=don't adjust the vertical scroll bar
- */
-void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
- topIndex = index;
- if (adjustScrollbar == true) {
- getVerticalBar().setSelection(index);
- }
-}
-/**
- * The shift key was pressed when the mouse click on an item
- * occurred. Do a shift selection. If an already selected item was
- * clicked the selection is expanded/reduced to that item
- * @param hitItem - specifies the clicked item
- * @param hitItemIndex - specifies the index of the clicked item
- * relative to the first item.
- */
-void shiftSelect(SelectableItem hitItem, int hitItemIndex) {
- int fromIndex = -1;
- int toIndex = -1;
- int lastSelectionIndex = -1;
- int selectionRange[];
- SelectableItem lastSelection = getLastSelection();
-
- if (lastSelection != null) {
- lastSelectionIndex = getVisibleIndex(lastSelection);
- }
- if (isCtrlSelection() == true) { // was last selection ctrl selection?
- deselectAllExcept(lastSelection);
- fromIndex = lastSelectionIndex; // select from last selection
- toIndex = hitItemIndex;
- }
- else
- if (getSelectionVector().contains(hitItem) == true) { // clicked an item already selected?
- deselectRange(hitItemIndex, lastSelectionIndex); // reduce selection
- }
- else { // clicked outside existing selection range
- selectionRange = calculateShiftSelectionRange(hitItemIndex);
- fromIndex = selectionRange[0];
- toIndex = selectionRange[1];
- }
- if (hitItemIndex == lastSelectionIndex) { // was click on last selected item?
- return;
- }
- if (fromIndex == -1 || toIndex == -1) { // are there previously selected items?
- toggleSelectionNotify(hitItem); // do a single select.
- }
- else {
- if (((lastSelectionIndex < fromIndex) && (hitItemIndex > fromIndex)) || // does selection reverse direction?
- ((lastSelectionIndex > fromIndex) && (hitItemIndex < fromIndex))) {
- deselectAllExcept((SelectableItem) null); // remove old selection
- }
- selectRange(fromIndex, toIndex);
- }
-}
-/**
- * Make 'item' visible by scrolling it into the receiver's client
- * area if necessary.
- * @param item - the item that should be made visible to the user.
- */
-void showSelectableItem(SelectableItem item) {
- if (item.getSelectableParent() != this) {
- return;
- }
- scrollShowItem(item);
- scrollShowItem(item); // second call makes sure that the item is still visible
- // even if the first scroll caused the horizontal scroll
- // to be displayed and the item to be hidden again.
-}
-/**
- * Show the selection. If there is no selection or the
- * selection is already visible, this method does nothing.
- * If the selection is not visible, the top index of the
- * widget is changed such that the selection becomes visible.
- */
-public void showSelection() {
- checkWidget();
- Vector selection = getSelectionVector();
- SelectableItem selectionItem;
-
- if (selection.size() > 0) {
- selectionItem = (SelectableItem) selection.firstElement();
- showSelectableItem(selectionItem);
- }
-}
-/**
- * Sorts the specified range in the array.
- *
- * @param array the SelectableItem array to be sorted
- * @param start the start index to sort
- * @param end the last + 1 index to sort
- */
-void sort(SelectableItem[] array, int start, int end) {
- int middle = (start + end) / 2;
- if (start + 1 < middle) sort(array, start, middle);
- if (middle + 1 < end) sort(array, middle, end);
- if (start + 1 >= end) return; // this case can only happen when this method is called by the user
- if (getVisibleIndex(array[middle-1]) <= getVisibleIndex(array[middle])) return;
- if (start + 2 == end) {
- SelectableItem temp = array[start];
- array[start] = array[middle];
- array[middle] = temp;
- return;
- }
- int i1 = start, i2 = middle, i3 = 0;
- SelectableItem[] merge = new SelectableItem[end - start];
- while (i1 < middle && i2 < end) {
- merge[i3++] = getVisibleIndex(array[i1]) <= getVisibleIndex(array[i2]) ?
- array[i1++] : array[i2++];
- }
- if (i1 < middle) System.arraycopy(array, i1, merge, i3, middle - i1);
- System.arraycopy(merge, 0, array, start, i2 - start);
-}
-/**
- * Toggle the selection of 'item'.
- * @param item - item that should be selected/deselected
- */
-void toggleSelectionNotify(SelectableItem item) {
- if (item.isSelected() == true) {
- deselectNotify(item);
- }
- else {
- selectNotify(item);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Table.java
deleted file mode 100644
index 09c51cdeec..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Table.java
+++ /dev/null
@@ -1,2654 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * Instances of this class implement a selectable user interface
- * object that displays a list of images and strings and issue
- * notificiation when selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TableItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Table extends SelectableItemWidget {
- private static final int COLUMN_RESIZE_OFFSET = 7; // offset from the start and end of each
- // column at which the resize cursor is displayed
- // if the mouse is in the column header
- static final String DOT_STRING = "..."; // used to indicate truncated item labels
-
- private Header tableHeader;
- private Vector items;
- private Vector columns;
- private boolean drawGridLines = false;
- private boolean firstColumnImage = false; // true if any item in the first column has an image
- private int columnResizeX; // last position of the cursor in a column resize operation
- private Cursor columnResizeCursor; // cursor displayed when a column resize is in progress.
- // Need to keep reference to the cursor in order to dispose it.
- private boolean isColumnResizeCursor = false; // set to true if the column resize cursor is active
- private TableColumn resizeColumn; // column that is currently being resized
- private TableColumn fillColumn; // column used to fill up space that is not used
- // by user defined columns
- private TableColumn defaultColumn; // Default column that is created as soon as the table is created.
- // Fix for 1FUSJY5
- private int dotsWidth = -1; // width of the static String dots (see above)
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Table(Composite parent, int style) {
- // use NO_MERGE_PAINTS to avoid flashing during column and widget resize redraw
- super(parent, checkStyle(style| SWT.NO_MERGE_PAINTS));
-}
-
-/**
- * Add 'column' to the receiver.
- * @param column - new table column that should be added to
- * the receiver
- */
-void addColumn(TableColumn column) {
- int index = column.getIndex();
-
- getColumnVector().insertElementAt(column, index);
- // has the column been inserted (vs. appended)?
- if (index < getColumnCount() - 1) {
- reindexColumns(index + 1);
- }
- // is there more than one user created column?
- // There always is the data and visual of the default column
- // so we don't need to create those for the first user column
- if (getColumnCount() > 1) {
- insertColumnData(column);
- }
- else { // first user created column
- setContentWidth(0); // pretend it's ground zero for column resizings
- redraw(); // redraw the table and header. The default column
- getHeader().redraw(); // won't be drawn anymore, because there now is a user created table.
- }
- insertColumnVisual(column);
-}
-/**
- * Add 'item' to the receiver.
- * @param item - new table item that should be added to
- * the receiver
- * @param index - position the new item should be inserted at
- */
-void addItem(TableItem item, int index) {
- Vector items = getItemVector();
-
- if (index < 0 || index > getItemCount()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
- addingItem(item, index);
- item.setIndex(index);
- if (index < items.size()) {
- for (int i = index; i < items.size(); i++) {
- TableItem anItem = (TableItem) items.elementAt(i);
- anItem.setIndex(anItem.getIndex() + 1);
- }
- items.insertElementAt(item, index);
- }
- else {
- items.addElement(item);
- }
- addedItem(item, index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * The item field of the event object is valid for default selection, but the detail field is not used.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
- * The width of 'column' is about to change.
- * Adjust the position of all columns behind it.
- */
-void columnChange(TableColumn column, Rectangle newBounds) {
- Rectangle columnBounds = column.getBounds();
- Rectangle clientArea = getClientArea();
- int oldXPosition = columnBounds.x + columnBounds.width;
- int newXPosition = newBounds.x + newBounds.width;
- int widthChange = newBounds.width - columnBounds.width;
- int headerHeight = getHeaderHeight();
- int columnIndex = column.getIndex();
-
- if (widthChange != 0) {
- if (columnIndex != TableColumn.FILL) {
- if (getLinesVisible() == true) {
- oldXPosition -= getGridLineWidth(); // include vertical grid line when scrolling resized column.
- newXPosition -= getGridLineWidth();
- }
- scroll( // physically move all following columns
- newXPosition, headerHeight, // destination x, y
- oldXPosition, headerHeight, // source x, y
- clientArea.width, clientArea.height, true);
- }
- column.internalSetBounds(newBounds);
- if (columnIndex != TableColumn.FILL) {
- resetTableItems(columnIndex);
- moveColumns(columnIndex + 1, widthChange); // logically move all following columns (set their bounds)
- setContentWidth(getContentWidth() + widthChange); // set the width of the receiver's content
- claimRightFreeSpace();
- resizeRedraw(column, columnBounds.width, newBounds.width);
- }
- }
- getHeader().widthChange(columnIndex, widthChange);
-}
-/**
- * The mouse pointer was double clicked on the receiver.
- * Handle the event according to the position of the mouse click
- * and the modifier key that was pressed, if any.
- * @param event - the mouse event
- */
-void columnMouseDoubleClick(Event event) {
- int itemHeight = getItemHeight();
- int itemIndex;
- TableItem hitItem;
- TableColumn hitColumn = getColumnAtX (event.x);
- Event columnDblClickEvent;
- boolean isFullSelection = (getStyle () & SWT.FULL_SELECTION) != 0;
-
- if (isFocusControl () == false) {
- forceFocus ();
- }
- if (hitColumn != null) {
- itemIndex = (event.y - getHeaderHeight()) / itemHeight + getTopIndex();
- hitItem = (TableItem) getVisibleItem(itemIndex);
- if (hitItem != null &&
- (hitColumn.getIndex() == TableColumn.FIRST || isFullSelection)) {
- if (hitItem.isSelectionHit(event.x) == true) {
- columnDblClickEvent = new Event();
- columnDblClickEvent.item = hitItem;
- notifyListeners(SWT.DefaultSelection, columnDblClickEvent);
- }
- }
- else {
- deselectAll();
- }
- }
-}
-/**
- * The mouse pointer was pressed down on the receiver.
- * Handle the event according to the position of the mouse click
- * and the modifier key that was pressed, if any.
- * @param event - the mouse event
- */
-void columnMouseDown(Event event) {
- int itemHeight = getItemHeight();
- int itemIndex;
- TableItem hitItem;
- TableColumn hitColumn = getColumnAtX (event.x);
-
- // only react to button one clicks. fixes bug 6770
- if (event.button != 1) {
- return;
- }
- if (isFocusControl () == false) {
- forceFocus ();
- }
- if (hitColumn != null) {
- itemIndex = (event.y - getHeaderHeight()) / itemHeight + getTopIndex();
- hitItem = (TableItem) getVisibleItem(itemIndex);
- if (hitItem != null) {
- if (hitItem.isSelectionHit(event.x) == true) {
- doMouseSelect(hitItem, itemIndex, event.stateMask, event.button);
- }
- else
- if (hitItem.isCheckHit(new Point(event.x, event.y)) == true) {
- doCheckItem(hitItem);
- }
- }
- else {
- deselectAll();
- }
- }
-}
-/**
- * The mouse pointer was moved over the receiver.
- * Reset the column resize cursor if it was active.
- * @param event - the mouse event
- */
-void columnMouseMove(Event event) {
- if (isColumnResizeStarted() == false) {
- setColumnResizeCursor(false);
- }
-}
-public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size = super.computeSize(wHint, hHint, changed);
- Point headerSize;
- GC gc;
- final int WidthCalculationCount = Math.min(getItemCount(), 50); // calculate item width for the first couple of items only
- TableItem item;
- Image itemImage;
- String itemText;
- int width;
- int newItemWidth = 0;
-
- if (getHeaderVisible() == true) {
- headerSize = getHeader().computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- size.y += headerSize.y;
- }
- if (getContentWidth() == 0 && WidthCalculationCount > 0) {
- gc = new GC(this);
- for (int i = 0; i < WidthCalculationCount; i++) {
- item = getItem(i);
- if (item == null) {
- break; // no more items
- }
- itemImage = item.getImage();
- itemText = item.getText();
- width = 0;
- if (itemImage != null) {
- width += itemImage.getBounds().width;
- }
- if (itemText != null) {
- width += gc.stringExtent(itemText).x;
- }
- newItemWidth = Math.max(newItemWidth, width);
- }
- if (newItemWidth > 0) {
- size.x = newItemWidth;
- }
- gc.dispose();
- }
- return size;
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect(int indices[]) {
- checkWidget();
- SelectableItem item = null;
-
- if (indices == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- for (int i = 0; i < indices.length; i++) {
- item = getVisibleItem(indices[i]);
- if (item != null) {
- deselect(item);
- }
- }
- if (item != null) {
- setLastSelection(item, false);
- }
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect(int index) {
- checkWidget();
- SelectableItem item = getVisibleItem(index);
-
- if (item != null) {
- deselect(item);
- setLastSelection(item, false);
- }
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect(int start, int end) {
- checkWidget();
- SelectableItem item = null;
-
- for (int i=start; i<=end; i++) {
- item = getVisibleItem(i);
- if (item != null) {
- deselect(item);
- }
- }
- if (item != null) {
- setLastSelection(item, false);
- }
-}
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll() {
- checkWidget();
-
- deselectAllExcept((SelectableItem) null);
-}
-/**
- * Free resources.
- */
-void doDispose() {
- Vector items = getItemVector();
-
- super.doDispose();
- while (items.size() > 0) { // TableItem objects are removed from vector during dispose()
- ((TableItem) items.lastElement()).dispose();
- }
- items = getColumnVector();
- while (items.size() > 0) { // TableColumn objects are removed from vector during dispose()
- ((TableColumn) items.lastElement()).dispose();
- }
- resizeColumn = null;
- fillColumn = null;
- defaultColumn = null;
- if (columnResizeCursor != null) {
- columnResizeCursor.dispose();
- }
-}
-/**
- * Draw a line tracking the current position of a column
- * resize operation.
- * @param xPosition - x coordinate to draw the line at
- */
-void drawColumnResizeLine(int xPosition) {
- GC gc = new GC(this);
- int lineHeight = getClientArea().height;
-
- redraw(getColumnResizeX(), 0, 1, lineHeight, false);
- setColumnResizeX(xPosition);
- gc.drawLine(xPosition, 0, xPosition, lineHeight);
- gc.dispose();
-}
-/**
- * Draw the grid lines for the receiver.
- * @param event - Paint event triggering the drawing operation.
- * @param drawColumns - The table columns for which the grid
- * lines should be drawn.
- */
-void drawGridLines(Event event, Enumeration drawColumns) {
- GC gc = event.gc;
- Color oldForeground = getForeground();
- Rectangle columnBounds;
- TableColumn column;
- int lineWidth = getGridLineWidth();
- int itemHeight = getItemHeight();
- int headerHeight = getHeaderHeight();
- int lineXPosition;
- int lineYPosition = headerHeight + ((event.y-headerHeight) / itemHeight) * itemHeight;
- int lineYStopPosition = event.y + event.height;
-
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- // Draw the horizontal lines
- if (itemHeight > 0) {
- while (lineYPosition < lineYStopPosition) {
- gc.drawLine(
- event.x, lineYPosition + itemHeight - lineWidth,
- event.x + event.width, lineYPosition + itemHeight - lineWidth);
- lineYPosition += itemHeight;
- }
- }
- // Draw the vertical lines at the right border of each column except the fill column
- while (drawColumns.hasMoreElements() == true) {
- column = (TableColumn) drawColumns.nextElement();
- if (column.getIndex() != TableColumn.FILL) {
- columnBounds = column.getBounds();
- lineXPosition = columnBounds.x + columnBounds.width - lineWidth;
- gc.drawLine(
- lineXPosition, event.y,
- lineXPosition, event.y + event.height);
- }
- }
- gc.setForeground(oldForeground);
-}
-/**
- * Draw a filled rectangle indicating the selection state of 'item'
- * If 'item' is selected the rectangle will be filled with the
- * selection background color. Otherwise the rectangle will be filled
- * with the background color to remove selection.
- * The selection color depends on whether the table widget has
- * focus or not. See getSelectionBackgroundColor() for details.
- * The rectangle is drawn in either the first column or in all columns
- * for full row select.
- * @param item - item for which the selection state should be drawn
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- * @param extent - extent of the selection rectangle.
- */
-void drawSelection(TableItem item, GC gc, Point position, Point extent) {
- if (item.isSelected() == true) {
- gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
- }
- gc.fillRectangle(position.x, position.y, extent.x, extent.y);
- if (item.isSelected() == true) {
- gc.setBackground(getBackground());
- }
-}
-/**
- * If the receiver has input focus draw a rectangle enclosing
- * the label of 'item' to indicate the input focus.
- * The rectangle is drawn in either the first column or in all columns
- * for full row select.
- * @param item - item for which the selection state should be drawn
- * @param gc - GC to draw on.
- */
-void drawSelectionFocus(TableItem item, GC gc) {
- Point extent = item.getSelectionExtent();
- Point position = new Point(
- item.getImageStopX(TableColumn.FIRST) + getHorizontalOffset(),
- getRedrawY(item));
-
- gc.drawFocus(position.x, position.y, extent.x, extent.y);
-}
-
-/**
- * Returns the column at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this method will throw <code>ERROR_INVALID_RANGE</code> despite
- * the fact that a single column of data may be visible in the table.
- * This occurs when the programmer uses the table like a list, adding
- * items but never creating a column.
- *
- * @param index the index of the column to return
- * @return the column at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn getColumn(int index) {
- checkWidget();
- Vector columns = getColumnVector();
-
- if (columns == null) error(SWT.ERROR_CANNOT_GET_ITEM);
- if (index < 0 || index >= columns.size()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
-
- return (TableColumn) columns.elementAt(index);
-}
-/**
- * Return the column located at 'xPosition' in the widget.
- * Return null if xPosition is outside the widget.
- * @param xPosition - position of the desired column
- */
-TableColumn getColumnAtX(int xPosition) {
- Enumeration columns = internalGetColumnVector().elements();
- TableColumn column;
- TableColumn hitColumn = null;
- Rectangle bounds;
-
- while (columns.hasMoreElements() == true && hitColumn == null) {
- column = (TableColumn) columns.nextElement();
- bounds = column.getBounds();
- if ((xPosition >= bounds.x) &&
- (xPosition <= bounds.x + bounds.width)) {
- hitColumn = column;
- }
- }
- if (hitColumn == null) {
- column = getFillColumn();
- bounds = column.getBounds();
- if ((xPosition >= bounds.x) &&
- (xPosition <= bounds.x + bounds.width)) {
- hitColumn = column;
- }
- }
- return hitColumn;
-}
-/**
- * Returns the number of columns contained in the receiver.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this value is zero, despite the fact that visually, one column
- * of items is may be visible. This occurs when the programmer uses
- * the table like a list, adding items but never creating a column.
- *
- * @return the number of columns
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getColumnCount() {
- checkWidget();
- Vector columns = getColumnVector();
- int count = 0;
-
- if (columns != null) {
- count = columns.size();
- }
- return count;
-}
-/** Replace CURSOR_SIZEWE with real column resize cursor
- * (no standard cursor-have to load from file)
- * Answer the cursor displayed during a column resize
- * operation.
- * Lazy initialize the cursor since it may never be needed.
- */
-Cursor getColumnResizeCursor() {
- if (columnResizeCursor == null) {
- columnResizeCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEWE);
- }
- return columnResizeCursor;
-}
-/**
- * Answer the current position of the mouse cursor during
- * a column resize operation.
- */
-int getColumnResizeX() {
- return columnResizeX;
-}
-/**
- * Returns an array of <code>TableColumn</code>s which are the
- * columns in the receiver. If no <code>TableColumn</code>s were
- * created by the programmer, the array is empty, despite the fact
- * that visually, one column of items may be visible. This occurs
- * when the programmer uses the table like a list, adding items but
- * never creating a column.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn [] getColumns() {
- checkWidget();
- Vector columns = getColumnVector();
- TableColumn columnArray[] = new TableColumn[columns.size()];
-
- columns.copyInto(columnArray);
- return columnArray;
-}
-/**
- * Answer a Vector containing all columns of receiver except
- * the fill column to the right of all content columns.
- */
-Vector getColumnVector() {
- return columns;
-}
-/**
- * Return the default column that is created as soon as the table
- * is created.
- * Fix for 1FUSJY5
- */
-TableColumn getDefaultColumn() {
- return defaultColumn;
-}
-/**
- * Answer the width of the replacement String used to indicate
- * truncated items.
- * Cached to speed up calculation of truncated items.
- * @param gc - GC used to measure the width of the replacement
- * String
- */
-int getDotsWidth(GC gc) {
- if (dotsWidth == -1) {
- dotsWidth = gc.stringExtent(DOT_STRING).x;
- }
- return dotsWidth;
-}
-/**
- * Answer the column used to occupy any space left to the
- * right of all the user created columns.
- */
-TableColumn getFillColumn() {
- return fillColumn;
-}
-/**
- * Returns the width in pixels of a grid line.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getGridLineWidth () {
- checkWidget();
-
- return 1;
-}
-/**
- * Answer the table header widget.
- */
-Header getHeader() {
- return tableHeader;
-}
-/**
- * Answer the header height or 0 if the header is not visible.
- */
-int getHeaderHeight() {
- Header header = getHeader();
- int height = 0;
-
- if (header.getVisible() == true) {
- height = header.getBounds().height;
- }
- return height;
-}
-/**
- * Returns <code>true</code> if the receiver's header is visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's header's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getHeaderVisible() {
- checkWidget();
-
- return getHeader().getVisible();
-}
-/**
- * Answer the image extent of 'item'. Use the image of any column.
- */
-Point getImageExtent(SelectableItem item) {
- Image image = null;
- Rectangle imageBounds;
- Point imageExtent = null;
- int columnCount = internalGetColumnCount();
-
- for (int i = 0; i < columnCount && image == null; i++) {
- image = ((TableItem) item).getImage(i);
- }
- if (image != null) {
- imageBounds = image.getBounds();
- imageExtent = new Point(imageBounds.width, imageBounds.height);
- }
- return imageExtent;
-}
-/**
- * Answer the index of 'item' in the receiver.
- */
-int getIndex(SelectableItem item) {
- int index = -1;
-
- if (item != null && item.getSelectableParent() == this) {
- index = ((TableItem) item).getIndex();
- }
- return index;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem(int index) {
- checkWidget();
-
- if (!(0 <= index && index < getItemCount())) {
- error(SWT.ERROR_INVALID_RANGE);
- }
- return (TableItem) getVisibleItem(index);
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem(Point point) {
- int headerHeight = getHeaderHeight();
- TableColumn column = getColumnAtX(point.x);
- TableItem item = null;
-
- if (column != null && column.getIndex() != TableColumn.FILL && point.y - headerHeight > 0) {
- int itemIndex = (point.y - headerHeight) / getItemHeight() + getTopIndex();
- item = (TableItem) getVisibleItem(itemIndex);
- if (item != null) {
- Point itemSize = item.getItemExtent(column);
- if (point.x - column.getBounds().x > itemSize.x) {
- item = null;
- }
- }
- }
- return item;
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount() {
- checkWidget();
-
- return getItemVector().size();
-}
-/**
- * Answer the number of items that can be displayed in the
- * client area of the receiver without truncating any items.
- */
-int getItemCountWhole() {
- int clientAreaHeight = Math.max(0, getClientArea().height - getHeaderHeight());
-
- return clientAreaHeight / getItemHeight();
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight() {
- checkWidget();
-
- return super.getItemHeight();
-}
-/**
- * Answer the number of pixels that should be added to the item height.
- */
-int getItemPadding() {
- return getGridLineWidth() + getDisplay().textHighlightThickness + 1;
-}
-/**
- * Returns an array of <code>TableItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getItems() {
- checkWidget();
- Vector items = getItemVector();
- TableItem itemArray[] = new TableItem[items.size()];
-
- items.copyInto(itemArray);
- return itemArray;
-}
-/**
- * Answer all items of the receiver.
- */
-Vector getItemVector() {
- return items;
-}
-/**
- * Returns <code>true</code> if the receiver's lines are visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the visibility state of the lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getLinesVisible() {
- checkWidget();
-
- return drawGridLines;
-}
-/**
- * Answer a Vector containing the columns that need repainting
- * based on the 'paintArea'.
- * @param paintArea - invalidated rectangle that needs repainting
- */
-Vector getPaintColumns(Rectangle paintArea) {
- Enumeration columns = internalGetColumnVector().elements();
- Vector paintColumns = new Vector();
- TableColumn column;
- Rectangle columnBounds;
- int paintAreaRightBorder = paintArea.x + paintArea.width;
-
- while (columns.hasMoreElements() == true) {
- column = (TableColumn) columns.nextElement();
- columnBounds = column.getBounds();
- if ((columnBounds.x + columnBounds.width >= paintArea.x) && // does the paintArea overlap the current column?
- (columnBounds.x <= paintAreaRightBorder)) {
- paintColumns.addElement(column);
- }
- }
- return paintColumns;
-}
-/**
- * Return the width of the widest item in the column identified by 'columnIndex'
- * @param columnIndex - index of the column whose preferred width should be
- * calculated
- */
-int getPreferredColumnWidth(int columnIndex) {
- Enumeration tableItems = getItemVector().elements();
- TableItem tableItem;
- int width = 0;
- int headerWidth;
-
- if (columnIndex != TableColumn.FILL) {
- while (tableItems.hasMoreElements() == true) {
- tableItem = (TableItem) tableItems.nextElement();
- width = Math.max(width, tableItem.getPreferredWidth(columnIndex));
- }
- headerWidth = getHeader().getPreferredWidth(columnIndex);
- if (width < headerWidth) {
- width = headerWidth;
- }
- }
- return width;
-}
-/**
- * Answer the position in the receiver where 'item' is drawn
- * @return the y coordinate at which 'item' is drawn.
- * Return -1 if 'item' is not an item of the receiver
- */
-int getRedrawY(SelectableItem item) {
- int redrawY = super.getRedrawY(item);
-
- if (redrawY != -1) {
- redrawY += getHeaderHeight();
- }
- return redrawY;
-}
-/**
- * Answer the column that is being resized or null if no
- * resize operation is in progress.
- */
-TableColumn getResizeColumn() {
- return resizeColumn;
-}
-/**
- * Return the positions at which the column identified by 'columnIndex'
- * must be redrawn.
- * These positions may be different for each item since each item may
- * have a different label
- * @param columnIndex - the column index
- * @param columnWidth - width of the column
- * @return the positions at which the column must be redrawn.
- * Each item in the widget client area is represented by a slot in
- * the array. The item at position 'topIndex' is the first item in
- * the array.
- */
-int [] getResizeRedrawX(int columnIndex, int columnWidth) {
- int topIndex = getTopIndex();
- int bottomIndex = getBottomIndex();
- int resizeRedrawX[];
- TableItem item;
-
- bottomIndex = Math.min(bottomIndex, getItemCount());
- resizeRedrawX = new int[bottomIndex-topIndex+1];
- for (int i = topIndex; i < bottomIndex; i++) {
- item = (TableItem) getVisibleItem(i);
- resizeRedrawX[i-topIndex] = item.getDotStartX(columnIndex, columnWidth);
- }
- return resizeRedrawX;
-}
-/**
- * Returns an array of <code>TableItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getSelection() {
- checkWidget();
- Vector selectionVector = getSelectionVector();
- TableItem[] selectionArray = new TableItem[selectionVector.size()];
-
- selectionVector.copyInto(selectionArray);
- sort(selectionArray, 0, selectionArray.length);
- return selectionArray;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount() {
- checkWidget();
-
- return super.getSelectionCount();
-}
-/**
- * Answer the size of the full row selection rectangle for 'item'.
- */
-Point getFullSelectionExtent(TableItem item) {
- TableColumn lastColumn = (TableColumn) internalGetColumnVector().lastElement();
- Point selectionExtent = null;
- Rectangle columnBounds;
- int xPosition = item.getImageStopX(TableColumn.FIRST);
- int gridLineWidth = getGridLineWidth();
-
- if (lastColumn != null) {
- columnBounds = lastColumn.getBounds();
- selectionExtent = new Point(
- columnBounds.x - getHorizontalOffset() + columnBounds.width - xPosition - gridLineWidth,
- getItemHeight());
- if (getLinesVisible() == true) {
- selectionExtent.y -= gridLineWidth;
- }
- }
- return selectionExtent;
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex() {
- checkWidget();
- int index = -1;
-
- if (getSelectionCount() > 0) {
- index = getIndex(getSelection()[0]);
- }
- return index;
-}
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int [] getSelectionIndices() {
- checkWidget();
- TableItem[] items = getSelection();
- int indices[] = new int[items.length];
-
- for (int i = 0; i < items.length; i++) {
- indices[i] = getIndex(items[i]);
- }
- return indices;
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex() {
- checkWidget();
-
- return super.getTopIndex();
-}
-/**
- * Answer the index of 'item' in the receiver.
- * Answer -1 if the item is not visible.
- * The returned index must refer to a visible item.
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. It only means that the item
- * would be displayed if it is located inside the receiver's
- * client area.
- * Every item in a table widget should be visible.
- */
-int getVisibleIndex(SelectableItem item) {
- return getIndex(item);
-}
-/**
- * Answer the SelectableItem located at 'itemIndex' in the receiver.
- * @param itemIndex - location of the SelectableItem object to return
- */
-SelectableItem getVisibleItem(int itemIndex) {
- Vector items = getItemVector();
- TableItem item = null;
-
- if ((items != null) && (itemIndex >= 0) && (itemIndex < items.size())) {
- item = (TableItem) items.elementAt(itemIndex);
- }
- return item;
-}
-/**
- * Answer the y coordinate at which 'item' is drawn.
- * @param item - SelectableItem for which the paint position
- * should be returned
- * @return the y coordinate at which 'item' is drawn.
- * Return -1 if 'item' is null or outside the client area
- */
-int getVisibleRedrawY(SelectableItem item) {
- int redrawY = -1;
- int index = getTopIndex();
- int bottomIndex = getBottomIndex();
-
- if (item == null) {
- return redrawY;
- }
- while (index < bottomIndex && item.equals(getVisibleItem(index)) == false) {
- index++;
- }
- if (index < bottomIndex) {
- redrawY = getRedrawY(item);
- }
- return redrawY;
-}
-/**
- * Handle the events the receiver is listening to.
- */
-void handleEvents(Event event) {
- switch (event.type) {
- case SWT.MouseMove:
- if (event.widget == tableHeader) {
- headerMouseMove(event);
- }
- else {
- columnMouseMove(event);
- }
- break;
- case SWT.MouseDown:
- if (event.widget == tableHeader) {
- headerMouseDown(event);
- }
- else {
- columnMouseDown(event);
- }
- break;
- case SWT.MouseDoubleClick:
- columnMouseDoubleClick(event);
- break;
- case SWT.MouseUp:
- mouseUp(event);
- break;
- case SWT.Paint:
- paint(event);
- break;
- default:
- super.handleEvents(event);
- }
-}
-/**
- * Answer true if any item in the first column has an image.
- * Answer false otherwise.
- */
-boolean hasFirstColumnImage() {
- return firstColumnImage;
-}
-/**
- * The mouse pointer was pressed down on the receiver's header
- * widget. Start a column resize operation if apropriate.
- * @param event - the mouse event that occured over the header
- * widget
- */
-void headerMouseDown(Event event) {
- TableColumn column = getColumnAtX(event.x);
-
- // only react to button one clicks. fixes bug 6770
- if (event.button != 1) {
- return;
- }
- if (isColumnResize(event) == true) {
- startColumnResize(event);
- }
- else
- if (column != null) {
- column.notifyListeners(SWT.Selection, new Event());
- }
-}
-/**
- * The mouse pointer was moved over the receiver's header widget.
- * If a column is currently being resized a vertical line indicating
- * the new position of the resized column is drawn.
- * Otherwise, if no column resize operation is in progress, the
- * column resize cursor is displayed when the mouse is near the border
- * of a column.
- */
-void headerMouseMove(Event event) {
- if (isColumnResizeStarted() == false) { // only check whether cursor is in resize
- setColumnResizeCursor(isColumnResize(event)); // area if no resize operation is in progress
- }
- else
- if (event.x >= getResizeColumn().getBounds().x) {
- drawColumnResizeLine(event.x);
- update(); // looks better if resize line is drawn immediately
- }
-}
-/**
- * Searches the receiver's list starting at the first column
- * (index 0) until a column is found that is equal to the
- * argument, and returns the index of that column. If no column
- * is found, returns -1.
- *
- * @param column the search column
- * @return the index of the column
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf(TableColumn column) {
- checkWidget();
-
- if (column == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- return internalGetColumnVector().indexOf(column);
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf(TableItem item) {
- checkWidget();
- if (item == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- return getIndex(item);
-}
-/**
- * Initialize the receiver. Create a header widget and an empty column.
- */
-void initialize() {
- columns = new Vector();
- setItemVector(new Vector());
- tableHeader = new Header(this);
- tableHeader.setVisible(false); // SWT table header is invisible by default, too
- fillColumn = TableColumn.createFillColumn(this);
- setColumnPosition(fillColumn);
- defaultColumn = TableColumn.createDefaultColumn(this); // Create the default column. Fix for 1FUSJY5
- super.initialize();
-}
-/**
- * Insert the new column 'column' into the table data at position
- * 'index'.
- */
-void insertColumnData(TableColumn column) {
- Enumeration tableItems = getItemVector().elements();
- TableItem tableItem;
-
- while (tableItems.hasMoreElements() == true ) {
- tableItem = (TableItem) tableItems.nextElement();
- tableItem.insertColumn(column);
- }
-}
-/**
- * Insert the new column 'column'.
- * Set the position and move the following columns to the right.
- */
-void insertColumnVisual(TableColumn column) {
- Rectangle columnBounds = column.getBounds();
- Rectangle previousColumnBounds;
- int index = column.getIndex();
-
- if (index > 0) {
- previousColumnBounds = getColumn(index - 1).getBounds();
- columnBounds.x = previousColumnBounds.x + previousColumnBounds.width;
- }
- else {
- columnBounds.x = 0;
- }
- column.setBounds(columnBounds);
- setColumnPosition(column);
-}
-/**
- * Set event listeners for the receiver.
- */
-void installListeners() {
- Header tableHeader = getHeader();
- Listener listener = getListener();
-
- super.installListeners();
- tableHeader.addListener(SWT.MouseMove, listener);
- tableHeader.addListener(SWT.MouseDown, listener);
- tableHeader.addListener(SWT.MouseUp, listener);
-
- addListener(SWT.MouseMove, listener);
- addListener(SWT.MouseDown, listener);
- addListener(SWT.MouseDoubleClick, listener);
- addListener(SWT.MouseUp, listener);
- addListener(SWT.Paint, listener);
-}
-/**
- * Answer the TableColumn at 'index'.
- * If the user has not created any columns the default column is
- * returned if index is 0.
- * Fix for 1FUSJY5
- */
-TableColumn internalGetColumn(int index) {
- Vector columns = internalGetColumnVector();
-
- if (columns == null) error(SWT.ERROR_CANNOT_GET_ITEM);
- if (index < 0 || index >= columns.size()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
-
- return (TableColumn) columns.elementAt(index);
-
-}
-/**
- * Answer the number of columns in the receiver.
- * If the user has not created any columns, 1 is returned since there
- * always is a default column.
- * Fix for 1FUSJY5
- */
-int internalGetColumnCount() {
- Vector columns = internalGetColumnVector();
- int count = 0;
-
- if (columns != null) {
- count = columns.size();
- }
- return count;
-}
-/**
- * Return a Vector containing all columns of the receiver except
- * the fill column to the right of all content columns.
- * Return a Vector containing the default column if the user has
- * not created any columns.
- * Fix for 1FUSJY5
- */
-Vector internalGetColumnVector() {
- Vector internalColumnVector;
- TableColumn defaultColumn;
-
- if (columns.isEmpty() == false) {
- internalColumnVector = columns;
- }
- else {
- internalColumnVector = new Vector(1);
- defaultColumn = getDefaultColumn();
- if (defaultColumn != null) {
- internalColumnVector.addElement(defaultColumn);
- }
- }
- return internalColumnVector;
-}
-/**
- * Answer whether the mouse pointer is at a position that can
- * start a column resize operation. A column resize can be
- * started if the mouse pointer is at either the left or right
- * border of a column.
- * @param event - mouse event specifying the location of the
- * mouse pointer.
- */
-boolean isColumnResize(Event event) {
- TableColumn hotColumn = getColumnAtX(event.x);
- if (hotColumn == null) return false;
- Rectangle bounds = hotColumn.getBounds();
- int hotColumnIndex = hotColumn.getIndex();
- int columnX = event.x - bounds.x;
- boolean isColumnResize = false;
-
- if (columnX <= COLUMN_RESIZE_OFFSET && // mouse over left side of column? and
- hotColumnIndex != TableColumn.FIRST) { // it's not the first column)
- if (hotColumnIndex == TableColumn.FILL) {
- hotColumn = (TableColumn) internalGetColumnVector().lastElement();
- }
- else {
- hotColumn = internalGetColumn(hotColumnIndex - 1);
- }
- isColumnResize = hotColumn.getResizable(); // check whether left column can be resized
- }
- else
- if (columnX >= bounds.width - COLUMN_RESIZE_OFFSET && // mouse over right side of column and
- hotColumn != getFillColumn()) { // column is a real one (not the right hand fill column)?
- isColumnResize = hotColumn.getResizable(); // check whether column under cursor can be resized
- }
- return isColumnResize;
-}
-/**
- * Answer whether a column of the receiver is being resized.
- */
-boolean isColumnResizeStarted() {
- return (getResizeColumn() != null);
-}
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected(int index) {
- checkWidget();
- TableItem item = getItem(index);
-
- return (item != null && item.isSelected() == true);
-}
-/**
- * 'changedItem' has changed. Update the default column width.
- * @param changedItem - the item that has changed
- */
-void itemChanged(SelectableItem changedItem, int repaintStartX, int repaintWidth) {
- // call super.itemChanged first to make sure that table image size is
- // calculated if necessary. Fixes 1FYPBBG.
- super.itemChanged(changedItem, repaintStartX, repaintWidth);
- // remember if any item ever had an image in the first column.
- if (firstColumnImage == false && changedItem.getImage() != null) {
- firstColumnImage = true;
- }
- setFirstColumnWidth((TableItem) changedItem);
-}
-/**
- * A mouse button was released.
- * Update the display if a column has been resized.
- * @param event - the mouse event for the button up action
- */
-void mouseUp(Event event) {
- TableColumn resizeColumn = getResizeColumn();
- Rectangle oldColumnBounds;
- int resizeXPosition;
- int widthChange;
- if (isColumnResizeStarted() == true) {
- oldColumnBounds = resizeColumn.getBounds();
- resizeXPosition = getColumnResizeX();
- widthChange = resizeXPosition - (oldColumnBounds.x + oldColumnBounds.width);
- if (widthChange != 0) {
- if (widthChange > 0) {
- redraw(resizeXPosition, 0, 1, getClientArea().height, false); // remove resize line
- update(); // to avoid cheese caused by scrolling the resize line
- }
- resizeColumn.setWidth(oldColumnBounds.width + widthChange);
- }
- setResizeColumn(null);
- }
-}
-/**
- * Adjust the position of all columns starting at 'startIndex'.
- * @param startIndex - index at which the column move should begin
- * If this is the index of the fill column all columns are moved,
- * including the fill column
- * @param moveDistance - distance that the columns should be moved.
- * < 0 = columns are going to be moved left.
- * > 0 = columns are going to be moved right.
- */
-void moveColumns(int startIndex, int moveDistance) {
- Vector columns = internalGetColumnVector();
- TableColumn moveColumn;
- Rectangle columnBounds;
-
- if (startIndex == TableColumn.FILL) {
- moveColumn = getFillColumn();
- columnBounds = moveColumn.getBounds();
- columnBounds.x += moveDistance;
- moveColumn.setBounds(columnBounds);
- startIndex = 0; // continue with first data column
- }
- for (int i = startIndex; i < columns.size(); i++) {
- moveColumn = (TableColumn) columns.elementAt(i);
- columnBounds = moveColumn.getBounds();
- columnBounds.x += moveDistance;
- moveColumn.setBounds(columnBounds);
- }
-}
-/**
- * Adjust the y position of all columns including the fill column.
- */
-void moveColumnsVertical() {
- Enumeration columns = internalGetColumnVector().elements();
- TableColumn column;
-
- setColumnPosition(getFillColumn());
- while (columns.hasMoreElements() == true) {
- column = (TableColumn) columns.nextElement();
- setColumnPosition(column);
- }
-}
-/**
- * A paint event has occurred. Paint the invalidated items.
- * @param event - paint event specifying the invalidated area.
- */
-void paint(Event event) {
- int visibleRange[];
- int headerHeight = getHeaderHeight();
- Vector paintColumns = getPaintColumns(event.getBounds());
- TableItem focusItem = null;
-
- if (paintColumns.size() > 0) {
- event.y -= headerHeight;
- visibleRange = getIndexRange(event.getBounds());
- event.y += headerHeight;
- // When the top index is > 0 and the receiver is resized
- // higher so that the top index becomes 0 the invalidated
- // rectangle doesn't start below the header widget but at
- // y position 0. Subtraction of the header height (it is
- // not above the receiver but on top) causes event.y and
- // subsequently visibleRange[0] to be negative.
- // Hack to prevent visibleRange[0] from becoming negative.
- // Need to find out why the invalidated area starts at 0
- // in the first place.
- if (visibleRange[0] < 0) {
- visibleRange[0] = 0;
- }
- //
- visibleRange[1] = Math.min(visibleRange[1], getItemCount()-1-getTopIndex());
- focusItem = paintItems(event, visibleRange[0], visibleRange[1], paintColumns);
- }
- if (getLinesVisible() == true) {
- drawGridLines(event, paintColumns.elements());
- }
- if (focusItem != null) {
- // draw focus on top of drawing grid lines so that focus rectangle
- // is not obscured by grid. Fixes 1G5X20B
- drawSelectionFocus(focusItem, event.gc);
- }
-}
-
-/**
- * Paint items of the receiver starting at index 'topPaintIndex' and
- * ending at 'bottomPaintIndex'.
- * @param event - holds the GC to draw on and the clipping rectangle
- * @param topPaintIndex - index of the first item to draw
- * @param bottomPaintIndex - index of the last item to draw
- * @param paintColumns - the table columns that should be painted
- * @return the item that has focus if it was among the rendered items.
- * null if the focus item was not rendered or if no item has focus (ie.
- * because the widget does not have focus)
- */
-TableItem paintItems(Event event, int topPaintIndex, int bottomPaintIndex, Vector paintColumns) {
- Enumeration columns;
- TableColumn column;
- TableItem paintItem;
- TableItem focusItem = null;
- Point selectionExtent;
- Point selectionPosition;
- int itemHeight = getItemHeight();
-
- topPaintIndex += getTopIndex();
- bottomPaintIndex += getTopIndex();
- for (int i = topPaintIndex; i <= bottomPaintIndex; i++) {
- paintItem = (TableItem) getVisibleItem(i);
- selectionExtent = paintItem.getSelectionExtent();
- if (selectionExtent != null) {
- selectionPosition = new Point(paintItem.getSelectionX(), getRedrawY(paintItem));
- drawSelection(paintItem, event.gc, selectionPosition, selectionExtent);
- }
- columns = paintColumns.elements();
- while (columns.hasMoreElements() == true) {
- column = (TableColumn) columns.nextElement();
- paintSubItem(event, paintItem, column, i * itemHeight);
- }
- if (hasFocus(paintItem)) {
- focusItem = paintItem;
- }
- }
- return focusItem;
-}
-
-/**
- * Paint the table item 'paintItem' in 'column' at y position
- * 'paintYPosition' of the receiver.
- * @param event - holds the GC to draw on and the clipping
- * rectangle.
- * @param paintItem - the item to draw
- * @param column - column to draw 'paintItem' in
- * @param paintYPosition - y position in the receiver to draw
- * 'paintItem' at.
- */
-void paintSubItem(Event event, TableItem paintItem, TableColumn column, int paintYPosition) {
- Rectangle columnBounds = column.getBounds();
- int gridLineWidth = getGridLineWidth();
- int itemDrawStopX = columnBounds.x + columnBounds.width - gridLineWidth;
- int clipX;
-
- if (event.x + event.width > itemDrawStopX) { // does the invalidated area stretch past the current column's right border?
- clipX = Math.max(columnBounds.x, event.x);
- event.gc.setClipping( // clip the drawing area
- clipX, event.y,
- itemDrawStopX - clipX, event.height);
- }
- column.paint(paintItem, event.gc, paintYPosition);
- if (event.x + event.width > itemDrawStopX) {
- event.gc.setClipping(event.x, event.y, event.width, event.height); // restore original clip rectangle
- }
-}
-/**
- * Reindex all columns starting at 'startIndex'.
- * Reindexing is necessary when a new column has been inserted.
- */
-void reindexColumns(int startIndex) {
- Vector columns = getColumnVector();
- TableColumn column;
-
- for (int i = startIndex; i < getColumnCount(); i++) {
- column = (TableColumn) columns.elementAt(i);
- column.setIndex(i);
- }
-}
-/**
- * Removes the items from the receiver's list at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove(int indices[]) {
- checkWidget();
- SelectableItem item;
- int [] sortedIndices;
- int last = -1;
-
- if (indices == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- sortedIndices = new int[indices.length];
- System.arraycopy (indices, 0, sortedIndices, 0, indices.length);
- sort(sortedIndices); // sort indices in descending order
- for (int i = 0; i < sortedIndices.length; i++) {
- if (sortedIndices[i] != last) {
- item = getVisibleItem(sortedIndices[i]);
- if (item != null) {
- item.dispose();
- }
- else {
- error(SWT.ERROR_ITEM_NOT_REMOVED);
- }
- last = sortedIndices[i];
- }
- }
-}
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove(int index) {
- checkWidget();
- SelectableItem item = getVisibleItem(index);
-
- if (item != null) {
- item.dispose();
- }
- else {
- error(SWT.ERROR_ITEM_NOT_REMOVED);
- }
-}
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove(int start, int end) {
- checkWidget();
- SelectableItem item;
-
- for (int i = end; i >= start; i--) {
- item = getVisibleItem(i);
- if (item != null) {
- item.dispose();
- }
- else {
- error(SWT.ERROR_ITEM_NOT_REMOVED);
- }
- }
-}
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll() {
- checkWidget();
- Vector items = getItemVector();
-
- setRedraw(false);
- setRemovingAll(true);
- for (int i = 0; i < items.size(); i++) {
- ((TableItem) items.elementAt(i)).dispose();
- }
- setItemVector(new Vector());
- reset();
- calculateVerticalScrollbar();
- setRemovingAll(false);
- setRedraw(true);
-}
-/**
- * Remove 'column' from the receiver.
- */
-void removeColumn(TableColumn column) {
- TableColumn lastColumn;
- int index = column.getIndex();
- int columnWidth = column.getWidth();
- int columnCount;
-
- if (isRemovingAll() == true) {
- getColumnVector().removeElementAt(index);
- }
- else {
- getColumnVector().removeElementAt(index);
- columnCount = getColumnCount();
- // Never remove the data of the last user created column.
- // SWT for Windows does the same.
- if (columnCount > 0) {
- removeColumnData(column);
- }
- removeColumnVisual(column);
- if (index < columnCount) { // is there a column after the removed one?
- reindexColumns(index);
- }
- // last user created column is about to be removed.
- if (columnCount == 0) {
- TableColumn defaultColumn = getDefaultColumn();
- defaultColumn.pack(); // make sure the default column has the right size...
- setColumnPosition(defaultColumn); // ...and is at the right position
- }
- // Fixes for 1G1L0UT
- // Reduce the content width by the width of the removed column
- setContentWidth(getContentWidth() - columnWidth);
- // claim free space
- claimRightFreeSpace();
- //
- }
-}
-/**
- * Remove the column 'column' from the table data.
- */
-void removeColumnData(TableColumn column) {
- Enumeration tableItems = getItemVector().elements();
- TableItem tableItem;
-
- while (tableItems.hasMoreElements() == true ) {
- tableItem = (TableItem) tableItems.nextElement();
- tableItem.removeColumn(column);
- }
-}
-/**
- * Remove the column 'column'.
- * Set the position of the following columns.
- */
-void removeColumnVisual(TableColumn column) {
- int columnWidth = column.getWidth();
-
- // move following columns to the left
- moveColumns(column.getIndex() + 1, columnWidth * -1);
- redraw();
- getHeader().redraw();
-}
-/**
- * Remove 'item' from the receiver.
- * @param item - item that should be removed from the receiver
- */
-void removeItem(TableItem item) {
- Vector items = getItemVector();
- int index = items.indexOf(item);
-
- if (index != -1) {
- if (isRemovingAll() == false) {
- removingItem(item);
- }
- items.removeElementAt(index);
- for (int i = index; i < items.size(); i++) {
- TableItem anItem = (TableItem) items.elementAt(i);
- anItem.setIndex(anItem.getIndex() - 1);
- }
- if (isRemovingAll() == false) {
- removedItem(item);
- }
- }
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-/**
- * Reset cached data of column at 'columnIndex' for the items of the receiver.
- * @param columnIndex - index of the column for which the item data should be
- * reset.
- */
-void resetTableItems(int columnIndex) {
- Enumeration tableItems = getItemVector().elements();
- TableItem tableItem;
-
- while (tableItems.hasMoreElements() == true ) {
- tableItem = (TableItem) tableItems.nextElement();
- tableItem.reset(columnIndex);
- }
-}
-/**
- * The receiver has been resized. Resize the fill column
- * and the header widget.
- */
-void resize(Event event) {
- TableColumn fillColumn = getFillColumn();
- Rectangle fillColumnBounds;
-
- super.resize(event);
- // the x position may change in super.resize.
- // get the column bounds after calling super.resize. Fixes 1G7ALGG
- fillColumnBounds = fillColumn.getBounds();
- fillColumnBounds.width = Math.max(0, getClientArea().width - getContentWidth());
- fillColumn.setBounds(fillColumnBounds);
- resizeHeader();
-}
-/**
- * Resize the header widget to occupy the whole width of the
- * receiver.
- */
-void resizeHeader() {
- Header tableHeader = getHeader();
- Point size = tableHeader.getSize();
-
- size.x = Math.max(getContentWidth(), getClientArea().width);
- tableHeader.setSize(size);
-}
-/**
- * Redraw 'column' after its width has been changed.
- * @param column - column whose width has changed.
- * @param oldColumnWidth - column width before resize
- * @param oldColumnWidth - column width after resize
- */
-void resizeRedraw(TableColumn column, int oldColumnWidth, int newColumnWidth) {
- Rectangle columnBounds = column.getBounds();
- int columnIndex = column.getIndex();
- int oldRedrawStartX[] = getResizeRedrawX(columnIndex, oldColumnWidth);
- int newRedrawStartX[] = getResizeRedrawX(columnIndex, newColumnWidth);
- int itemHeight = getItemHeight();
- int widthChange = newColumnWidth - oldColumnWidth;
- int topIndex = getTopIndex();
-
- for (int i = 0; i < newRedrawStartX.length; i++) {
- if (newRedrawStartX[i] != oldRedrawStartX[i]) {
- if (widthChange > 0) {
- newRedrawStartX[i] = oldRedrawStartX[i];
- }
- redraw(
- columnBounds.x + newRedrawStartX[i], columnBounds.y + itemHeight * (i + topIndex),
- columnBounds.width - newRedrawStartX[i], itemHeight, false);
- }
- }
-}
-/**
- * Scroll horizontally by 'numPixel' pixel.
- * @param numPixel - the number of pixel to scroll
- * < 0 = columns are going to be moved left.
- * > 0 = columns are going to be moved right.
- */
-void scrollHorizontal(int numPixel) {
- Rectangle clientArea = getClientArea();
-
- scroll(
- numPixel, 0, // destination x, y
- 0, 0, // source x, y
- clientArea.width, clientArea.height, true);
- getHeader().scroll(
- numPixel, 0, // destination x, y
- 0, 0, // source x, y
- clientArea.width, clientArea.height, true);
- moveColumns(TableColumn.FILL, numPixel);
-}
-/**
- * Scroll vertically by 'scrollIndexCount' items.
- * @param scrollIndexCount - the number of items to scroll.
- * scrollIndexCount > 0 = scroll up. scrollIndexCount < 0 = scroll down
- */
-void scrollVertical(int scrollIndexCount) {
- int scrollAmount = scrollIndexCount * getItemHeight();
- int headerHeight = getHeaderHeight();
- int destY;
- int sourceY;
- boolean scrollUp = scrollIndexCount < 0;
- Rectangle clientArea = getClientArea();
-
- if (scrollIndexCount == 0) {
- return;
- }
- if (scrollUp == true) {
- destY = headerHeight - scrollAmount;
- sourceY = headerHeight;
- }
- else {
- destY = headerHeight;
- sourceY = destY + scrollAmount;
- }
- scroll(
- 0, destY, // destination x, y
- 0, sourceY, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Scroll items down to make space for a new item added to
- * the receiver at position 'index'.
- * @param index - position at which space for one new item
- * should be made. This index is relative to the first item
- * of the receiver.
- */
-void scrollVerticalAddingItem(int index) {
- int itemHeight = getItemHeight();
- int sourceY = getHeaderHeight();
- Rectangle clientArea = getClientArea();
-
- if (index >= getTopIndex()) {
- sourceY += (index-getTopIndex()) * itemHeight;
- }
- scroll(
- 0, sourceY + itemHeight, // destination x, y
- 0, sourceY, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Scroll the items below the item at position 'index' up
- * so that they cover the removed item.
- * @param index - index of the removed item
- */
-void scrollVerticalRemovedItem(int index) {
- int itemHeight = getItemHeight();
- int headerHeight = getHeaderHeight();
- int destY;
- Rectangle clientArea = getClientArea();
-
- destY = Math.max(headerHeight, headerHeight + (index - getTopIndex()) * itemHeight);
- scroll(
- 0, destY, // destination x, y
- 0, destY + itemHeight, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select(int indices[]) {
- checkWidget();
- SelectableItem item = null;
- int selectionCount;
-
- if (indices == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- selectionCount = indices.length;
- if (isMultiSelect() == false && selectionCount > 1) {
- selectionCount = 1;
- deselectAllExcept(getVisibleItem(indices[0]));
- }
- for (int i = selectionCount - 1; i >= 0; --i) {
- item = getVisibleItem(indices[i]);
- if (item != null) {
- select(item);
- }
- }
- if (item != null) {
- setLastSelection(item, false);
- }
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select(int index) {
- checkWidget();
- SelectableItem item = getVisibleItem(index);
-
- if (isMultiSelect() == false) {
- deselectAllExcept(getVisibleItem(index));
- }
- if (item != null) {
- select(item);
- setLastSelection(item, false);
- }
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select(int start, int end) {
- checkWidget();
- SelectableItem item = null;
- int selectionCount = 1;
-
- if (isMultiSelect() == false) {
- if (start < 0 && end >= 0) {
- start = 0;
- }
- end = start;
- deselectAllExcept(getVisibleItem(end));
- }
- // select in the same order as all the other selection and deslection methods.
- // Otherwise setLastSelection repeatedly changes the lastSelectedItem for repeated
- // selections of the items, causing flash.
- for (int i = end; i >= start; i--) {
- item = getVisibleItem(i);
- if (item != null) {
- select(item);
- }
- }
- if (item != null) {
- setLastSelection(item, false);
- }
-}
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll() {
- checkWidget();
- Enumeration items = getItemVector().elements();
- TableItem item = null;
-
- if (isMultiSelect() == false) {
- return;
- }
- while (items.hasMoreElements() == true) {
- item = (TableItem) items.nextElement();
- select(item);
- }
- if (item != null) {
- setLastSelection(item, false);
- }
-}
-/**
- * Set the y position of 'column'.
- * @param column - the TableColumn that should be set to
- * a new y position.
- */
-void setColumnPosition(TableColumn column) {
- Rectangle bounds = column.getBounds();
-
- bounds.y = getHeaderHeight() - getTopIndex() * getItemHeight();
- column.setBounds(bounds);
-}
-/**
- * Change the cursor of the receiver.
- * @param isColumnResizeCursor - indicates whether the column
- * resize cursor or the regular cursor should be set.
- */
-void setColumnResizeCursor(boolean isColumnResizeCursor) {
- if (isColumnResizeCursor != this.isColumnResizeCursor) {
- this.isColumnResizeCursor = isColumnResizeCursor;
- if (isColumnResizeCursor == true) {
- setCursor(getColumnResizeCursor());
- }
- else {
- setCursor(null);
- }
- }
-}
-/**
- * Set the current position of the resized column to 'xPosition'.
- * @param xPosition - the current position of the resized column
- */
-void setColumnResizeX(int xPosition) {
- columnResizeX = xPosition;
-}
-/**
- * Set the width of the receiver's contents to 'newWidth'.
- * Content width is used to calculate the horizontal scrollbar.
- */
-void setContentWidth(int newWidth) {
- TableColumn fillColumn = getFillColumn();
- Rectangle fillColumnBounds;
- int widthDiff = newWidth - getContentWidth();
-
- super.setContentWidth(newWidth);
- if (fillColumn != null) {
- fillColumnBounds = fillColumn.getBounds();
- fillColumnBounds.x += widthDiff;
- fillColumnBounds.width = Math.max(0, getClientArea().width - newWidth);
- fillColumn.setBounds(fillColumnBounds);
- }
-}
-/**
- * Set the width of the first column to fit 'item' if it is longer than
- * the current column width.
- * Do nothing if the user has already set a width.
- */
-void setFirstColumnWidth(TableItem item) {
- int newWidth;
- TableColumn column;
-
- if (internalGetColumnCount() > 0) {
- column = internalGetColumn(TableColumn.FIRST);
- if (column.isDefaultWidth() == true) {
- newWidth = Math.max(column.getWidth(), item.getPreferredWidth(TableColumn.FIRST));
- column.setWidth(newWidth);
- column.setDefaultWidth(true); // reset to true so that we know when the user has set
- // the width instead of us setting a default width.
- }
- }
-}
-public void setFont(Font font) {
- checkWidget();
- SelectableItem item;
- int itemCount = getItemCount();
-
- if (font == null || font.equals(getFont()) == true) {
- return;
- }
- setRedraw(false); // disable redraw because itemChanged() triggers undesired redraw
- resetItemData();
- super.setFont(font);
- for (int i = 0; i < itemCount; i++) {
- itemChanged(getItem(i), 0, getClientArea().width);
- }
- setRedraw(true); // re-enable redraw
- getHeader().setFont(font);
-}
-/**
- * Marks the receiver's header as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHeaderVisible(boolean headerVisible) {
- checkWidget();
- if (headerVisible != getHeaderVisible()) {
- getHeader().setLocation(0, 0);
- getHeader().setVisible(headerVisible);
- // Windows resets scrolling so do we
- setTopIndex(0, true);
- moveColumnsVertical();
- resizeVerticalScrollbar();
- redraw();
- }
-}
-/**
- * Set the vector that stores the items of the receiver
- * to 'newVector'.
- * @param newVector - Vector to use for storing the items of
- * the receiver.
- */
-void setItemVector(Vector newVector) {
- items = newVector;
-}
-/**
- * Marks the receiver's lines as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLinesVisible(boolean drawGridLines) {
- checkWidget();
- if (this.drawGridLines != drawGridLines) {
- this.drawGridLines = drawGridLines;
- redraw();
- }
-}
-public void setRedraw(boolean redraw) {
- checkWidget();
- super.setRedraw(redraw);
- getHeader().setRedraw(redraw);
-}
-/**
- * Set the column that is being resized to 'column'.
- * @param column - the TableColumn that is being resized.
- * A null value indicates that no column resize operation is
- * in progress.
- */
-void setResizeColumn(TableColumn column) {
- resizeColumn = column;
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int[])
- */
-public void setSelection(int [] indices) {
- checkWidget();
- Vector keepSelected;
-
- if (indices == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- keepSelected = new Vector(indices.length);
- for (int i = 0; i < indices.length; i++) {
- SelectableItem item = getVisibleItem(indices[i]);
- if (item != null) {
- keepSelected.addElement(item);
- }
- }
- deselectAllExcept(keepSelected);
- select(indices);
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection(TableItem selectionItems[]) {
- checkWidget();
- if (selectionItems == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- setSelectableSelection(selectionItems);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * The current selected is first cleared, then the new item is selected.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection(int index) {
- checkWidget();
- deselectAllExcept(getVisibleItem(index));
- select(index);
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection(int start, int end) {
- checkWidget();
- Vector keepSelected = new Vector(end - start + 1);
-
- for (int i = start; i <= end; i++) {
- SelectableItem item = getVisibleItem(i);
- if (item != null) {
- keepSelected.addElement(item);
- }
- }
- deselectAllExcept(keepSelected);
- select(start, end);
-}
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex(int index) {
- checkWidget();
- int itemCount = getItemCount();
- int itemCountWhole = getItemCountWhole();
-
- if (index < 0 || itemCount == 0) {
- return;
- }
- if (index >= itemCount) {
- index = itemCount - itemCountWhole;
- }
- super.setTopIndex(index, true);
-}
-/**
- * Set the index of the first visible item in the receiver's client
- * area to 'index'.
- * @param index - 0-based index of the first visible item in the
- * receiver's client area.
- * @param adjustScrollbar - true=set the position of the vertical
- * scroll bar to the new top index.
- * false=don't adjust the vertical scroll bar
- */
-void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
- super.setTopIndexNoScroll(index, adjustScrollbar);
- moveColumnsVertical();
-}
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showSelection()
- */
-public void showItem(TableItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- showSelectableItem(item);
-}
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showItem(TableItem)
- */
-public void showSelection() {
- checkWidget();
- super.showSelection();
-}
-void sort (int [] items) {
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap=length/2; gap>0; gap/=2) {
- for (int i=gap; i<length; i++) {
- for (int j=i-gap; j>=0; j-=gap) {
- if (items [j] <= items [j + gap]) {
- int swap = items [j];
- items [j] = items [j + gap];
- items [j + gap] = swap;
- }
- }
- }
- }
-}
-/**
- * Start a column resize operation.
- * @param event - the mouse event that occured over the header
- * widget
- */
-void startColumnResize(Event event) {
- Vector columns = internalGetColumnVector();
- TableColumn hitColumn = getColumnAtX(event.x);
- Rectangle hitColumnBounds;
- int hitIndex = hitColumn.getIndex();
-
- if (hitColumn == getFillColumn()) { // clicked on the fill column?
- hitColumn = (TableColumn) columns.lastElement(); // resize the last real column
- }
- else
- if ((event.x - hitColumn.getBounds().x <= COLUMN_RESIZE_OFFSET) && // check if left side of a column was clicked
- (hitIndex > 0)) {
- hitColumn = (TableColumn) columns.elementAt(hitIndex - 1); // resize the preceding column
- }
- hitColumnBounds = hitColumn.getBounds();
- setColumnResizeX(hitColumnBounds.x + hitColumnBounds.width);
- setResizeColumn(hitColumn);
-}
-/**
- * Return 'text' after it has been checked to be no longer than 'maxWidth'
- * when drawn on 'gc'.
- * If it is too long it will be truncated up to the last character.
- * @param text - the String that should be checked for length
- * @param maxWidth - maximum width of 'text'
- * @param gc - GC to use for String measurement
- */
-String trimItemText(String text, int maxWidth, GC gc) {
- int textWidth;
- int dotsWidth;
-
- if (text != null && text.length() > 1) {
- textWidth = gc.stringExtent(text).x;
- if (textWidth >= maxWidth) {
- dotsWidth = getDotsWidth(gc);
- while (textWidth + dotsWidth >= maxWidth && text.length() > 1) {
- text = text.substring(0, text.length() - 1); // chop off one character at the end
- textWidth = gc.stringExtent(text).x;
- }
- text = text.concat(Table.DOT_STRING);
- }
- }
- return text;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableColumn.java
deleted file mode 100644
index c259e18dc2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableColumn.java
+++ /dev/null
@@ -1,527 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a column in a table widget.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd> Move, Resize, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TableColumn extends Item {
- static final int FIRST = 0; // index of the first column
- static final int FILL = -1; // index that identifies the column used to
- // fill space not used by other columns.
- private static final int DEFAULT_WIDTH = 10;
-
- private Table parent;
- private int index; // 0-based column index
- private Rectangle bounds = new Rectangle(0, 0, 0, 0);
- private boolean isDefaultWidth = true;
- private boolean resize = true;
-
-/**
- * Create a new TableColumn without adding it to the parent.
- * Currently used to create fill columns and default columns.
- * @see createFillColumn
- * @see createDefaultColumn
- * @param parent - Table widget the new instance will be a child of.
- */
-TableColumn(Table parent) {
- super(parent, SWT.NULL);
- this.parent = parent;
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn(Table parent, int style) {
- this(parent, style, checkNull(parent).getColumnCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn(Table parent, int style, int index) {
- super(parent, checkStyle (style), index);
-
- this.parent = parent;
- if (index < 0 || index > parent.getColumnCount()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
- setIndex(index);
- parent.addColumn(this);
- setWidth(DEFAULT_WIDTH);
- setDefaultWidth(true);
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {disposeColumn();}
- });
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the column header is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-/**
- * Throw an SWT.ERROR_NULL_ARGUMENT exception if 'table' is null.
- * Otherwise return 'table'
- */
-static Table checkNull(Table table) {
- if (table == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return table;
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
- * Create a new instance of TableColumn that acts as a default column
- * if the user does not create a TableColumn.
- * @param parent - Table widget the new instance will be a child of.
- */
-static TableColumn createDefaultColumn(Table parent) {
- TableColumn defaultColumn = new TableColumn(parent);
-
- defaultColumn.setIndex(FIRST);
- defaultColumn.setWidth(DEFAULT_WIDTH);
- defaultColumn.setDefaultWidth(true);
- return defaultColumn;
-}
-/**
- * Create a new instance of TableColumn that acts as the rightmost
- * fill column in a Table. The new object is not added to the parent
- * like a regular column is.
- * @param parent - Table widget the new instance will be a child of.
- */
-static TableColumn createFillColumn(Table parent) {
- TableColumn fillColumn = new TableColumn(parent);
-
- fillColumn.setIndex(FILL);
- return fillColumn;
-}
-/**
- * Remove the receiver from its parent
- */
-void disposeColumn() {
- getParent().removeColumn(this);
-}
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget();
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Answer the bounding rectangle of the receiver.
- */
-Rectangle getBounds() {
- return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); // copy the object to prevent changes
-}
-public Display getDisplay() {
- if (parent == null) { // access parent field directly to prevent endless recursion
- error(SWT.ERROR_WIDGET_DISPOSED);
- }
- return parent.getDisplay();
-}
-/**
- * Answer the index of the receiver. Specifies the position of the
- * receiver relative to other columns in the parent.
- */
-int getIndex() {
- return index;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent() {
- checkWidget();
- return parent;
-}
-/**
- * Gets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @return the resizable attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getResizable() {
- checkWidget();
- return resize;
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- checkWidget();
- return getBounds().width;
-}
-/**
- * Set the colun bounds.
- */
-void internalSetBounds(Rectangle newBounds) {
- bounds = newBounds;
-}
-/**
- * Answer whether the column has a default width or if a width has been
- * set by the user.
- * @return
- * true=column width is a default width set internally
- * false=column width has been set by the user.
- */
-boolean isDefaultWidth() {
- return isDefaultWidth;
-}
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- */
-public void pack() {
- checkWidget();
- Table parent = getParent();
- int index = parent.indexOf(this);
-
- if (getIndex() != TableColumn.FILL && index != -1) {
- setWidth(parent.getPreferredColumnWidth(index));
- }
-}
-/**
- * Draw the 'item' at 'yPosition' in the receiver column.
- * @param item - TableItem that should be drawn.
- * @param gc - GC to draw on
- * @param yPosition - y position to draw at in the column.
- */
-void paint(TableItem item, GC gc, int yPosition) {
- Rectangle bounds = getBounds();
- Point paintPosition = new Point(bounds.x, bounds.y + yPosition);
-
- item.paint(gc, paintPosition, this);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment(int alignment) {
- checkWidget();
- int index = getIndex();
-
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) != 0 && index != 0) { // ignore calls for the first column to match Windows behavior
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- getParent().getHeader().redraw(index);
- }
-}
-/**
- * Set the bounding rectangle of the receiver to 'newBounds'.
- * Notify the table widget if the column width changes.
- * @param newBounds - the new bounding rectangle of the receiver,
- * consisting of x, y, width, height
- */
-void setBounds(Rectangle newBounds) {
- if (newBounds.width != bounds.width) {
- if (isDefaultWidth() == true) {
- setDefaultWidth(false);
- }
- getParent().columnChange(this, newBounds);
- }
- else {
- // columnChange causes update (via scroll) which may flush redraw
- // based on old bounds. Setting bounds after notifying table fixes 1GABZR5
- // Table sets column bounds at appropriate time when called above with
- // width change. Only set bounds when table was not called. Fixes 1GCGDPB
- bounds = newBounds;
- }
-}
-/**
- * Set whether the column has a default width or if a width has been
- * set by the user.
- * @param isDefaultWidth
- * true=column width is a default width set internally
- * false=column width has been set by the user
- */
-void setDefaultWidth(boolean isDefaultWidth) {
- this.isDefaultWidth = isDefaultWidth;
-}
-/**
- * Set the index of the receiver to 'newIndex'. The index specifies the
- * position of the receiver relative to other columns in the parent.
- */
-void setIndex(int newIndex) {
- this.index = newIndex;
-}
-/**
- * Sets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @param resizable the resize attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setResizable(boolean resize) {
- checkWidget();
- this.resize = resize;
-}
-public void setText(String newText) {
- checkWidget();
- int index = getIndex();
-
- if (newText == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (index != FILL && (text == null || text.equals(newText) == false)) {
- super.setText(newText);
- getParent().getHeader().redraw(index);
- }
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth(int width) {
- checkWidget();
- Table parent = getParent();
- Rectangle bounds = getBounds();
- int oldWidth = bounds.width;
- int redrawX;
-
- if (width != oldWidth) {
- redrawX = bounds.x;
- bounds.width = width;
- setBounds(bounds);
- // redraw at old column position if column was resized wider.
- // fixes focus rectangle.
- redrawX += Math.min(width, oldWidth);
- parent.redraw(
- redrawX - 2, 0,
- 2, parent.getClientArea().height, false); // redraw 2 pixels wide to redraw item focus rectangle and grid line
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableItem.java
deleted file mode 100644
index 8c2056a3cd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableItem.java
+++ /dev/null
@@ -1,1093 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.Vector;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents an item in a table.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TableItem extends SelectableItem {
- private static final int FIRST_COLUMN_IMAGE_INDENT = 2; // Space in front of image - first column only
- private static final int FIRST_COLUMN_TEXT_INDENT = 4; // Space in front of text - first column only
- private static final int TEXT_INDENT_NO_IMAGE = 2; // Space in front of item text when no item in the column has an image - first column only
- private static final int TEXT_INDENT = 6; // Space in front of item text - all other columns
- private static final int SELECTION_PADDING = 6; // Space behind text in a selected item
-
- private Vector dataLabels = new Vector(); // Original text set by the user. Items that don't
- // have a label are represented by a null slot
- private String[] trimmedLabels = new String[0]; // Text that is actually displayed, may be trimmed
- // to fit the column
- private Vector images = new Vector(); // Item images. Items that don't have an image
- // are represented by a null slot
- private Point selectionExtent; // Size of the rectangle drawn to indicate a
- // selected item.
- private int imageIndent = 0; // the factor by which the item image and check box, if any,
- // are indented. The multiplier is the image width.
- private int index; // index of the item in the parent widget
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem(Table parent, int style) {
- this(parent, style, checkNull(parent).getItemCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem(Table parent, int style, int index) {
- super(parent, style);
- parent.addItem(this, index);
-}
-
-/**
- * Calculate the size of the rectangle drawn to indicate a selected
- * item. This is also used to draw the selection focus rectangle.
- * The selection extent is calculated for the first column only (the
- * only column the selection is drawn in).
- */
-void calculateSelectionExtent() {
- Table parent = getParent();
- TableColumn column = parent.internalGetColumn(TableColumn.FIRST);
- GC gc = new GC(parent);
- String trimmedText = getText(gc, column);
- int gridLineWidth = parent.getGridLineWidth();
-
- if (trimmedText != null) {
- selectionExtent = new Point(gc.stringExtent(trimmedText).x, parent.getItemHeight());
- selectionExtent.x += getTextIndent(TableColumn.FIRST) + SELECTION_PADDING;
- selectionExtent.x = Math.min(
- selectionExtent.x, column.getWidth() - getImageStopX(column.getIndex()) - gridLineWidth);
- if (parent.getLinesVisible() == true) {
- selectionExtent.y -= gridLineWidth;
- }
- }
- gc.dispose();
-}
-/**
- * Throw an SWT.ERROR_NULL_ARGUMENT exception if 'table' is null.
- * Otherwise return 'table'
- */
-static Table checkNull(Table table) {
- if (table == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return table;
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-public void dispose() {
- if (isDisposed()) return;
- Table parent = getParent();
- parent.removeItem(this);
- super.dispose();
-}
-void doDispose() {
- dataLabels = null;
- trimmedLabels = null;
- images = null;
- selectionExtent = null;
- super.doDispose();
-}
-
-/**
- * Draw the image of the receiver for column 'index' at
- * 'destinationPosition' using 'gc'.
- * Stretch/shrink the image to the fixed image size of the receiver's
- * parent.
- * @param gc - GC to draw on.
- * @param destinationPosition - position on the GC to draw at.
- * @param index - index of the image to draw
- * @return Answer the position where drawing stopped.
- */
-Point drawImage(GC gc, Point destinationPosition, int index) {
- Table parent = getParent();
- Image image = getImage(index);
- Rectangle sourceImageBounds;
- Point destinationImageExtent = parent.getImageExtent();
-
- if (image != null) {
- sourceImageBounds = image.getBounds();
- // full row select would obscure transparent images in all but the first column
- // so always clear the image area in this case. Fixes 1FYNITC
- if ((parent.getStyle() & SWT.FULL_SELECTION) != 0 && index != TableColumn.FIRST) {
- gc.fillRectangle(
- destinationPosition.x, destinationPosition.y,
- destinationImageExtent.x, destinationImageExtent.y);
- }
- gc.drawImage(
- image, 0, 0, // source x, y
- sourceImageBounds.width, sourceImageBounds.height, // source width, height
- destinationPosition.x, destinationPosition.y, // destination x, y
- destinationImageExtent.x, destinationImageExtent.y); // destination width, height
- }
- if (((index == TableColumn.FIRST && // always add the image width for the first column
- parent.hasFirstColumnImage() == true) || // if any item in the first column has an image
- (index != TableColumn.FIRST && // add the image width if it's not the first column
- image != null)) && // only when the item actually has an image
- destinationImageExtent != null) {
- destinationPosition.x += destinationImageExtent.x;
- }
- return destinationPosition;
-}
-/**
- * Draw the label of the receiver for column 'index' at 'position'
- * using 'gc'.
- * The background color is set to the selection background color if
- * the item is selected and the text is drawn for the first column.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- * @param index - specifies which subitem text to draw
- */
-void drawText(String label, GC gc, Point position, int index) {
- Table parent = getParent();
- boolean drawSelection;
- int textOffset;
- int textHeight;
-
- if (label != null) {
- drawSelection = (index == TableColumn.FIRST || (parent.getStyle() & SWT.FULL_SELECTION) != 0);
- if (isSelected() == true && drawSelection == true) {
- gc.setBackground(getSelectionBackgroundColor());
- gc.setForeground(getSelectionForegroundColor());
- }
- textHeight = gc.stringExtent(label).y;
- textOffset = (parent.getItemHeight() - textHeight) / 2; // vertically center the text
- gc.drawString(label, position.x, position.y + textOffset);
- if (isSelected() == true && drawSelection == true) {
- gc.setBackground(parent.getBackground());
- gc.setForeground(parent.getForeground());
- }
- }
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent at a column in the table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding column rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds(int index) {
- checkWidget();
- Rectangle itemBounds;
- Rectangle columnBounds;
- Rectangle checkboxBounds;
- Table parent = getParent();
- TableColumn column;
- int itemIndex = parent.indexOf(this);
- int itemHeight = parent.getItemHeight();
- int gridLineWidth = parent.getGridLineWidth();
- int itemYPos;
-
- if (itemIndex == -1 || index < 0 || index >= parent.internalGetColumnCount()) {
- itemBounds = new Rectangle(0, 0, 0, 0);
- }
- else {
- column = parent.internalGetColumn(index);
- columnBounds = column.getBounds();
- itemYPos = columnBounds.y + itemHeight * itemIndex;
- itemBounds = new Rectangle(
- columnBounds.x, itemYPos,
- columnBounds.width - gridLineWidth, itemHeight - gridLineWidth);
- if (index == TableColumn.FIRST) {
- if (isCheckable() == true) {
- checkboxBounds = getCheckboxBounds();
- itemBounds.x += checkboxBounds.x + checkboxBounds.width + CHECKBOX_PADDING; // add checkbox start, width and space behind checkbox
- itemBounds.width -= itemBounds.x;
- }
- else {
- itemBounds.x += getImageIndentPixel();
- }
- }
- }
- return itemBounds;
-}
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked() {
- checkWidget();
- return super.getChecked();
-}
-/**
- * Answer the x position of the item check box
- */
-int getCheckboxXPosition() {
- return getImageIndentPixel();
-}
-/**
- * Answer the item labels set by the user.
- * These may not be the same as those drawn on the screen. The latter
- * may be trimmed to fit the column. Items that don't have a label are
- * represented by a null slot in the vector.
- * @return Vector - the item labels set by the user.
- */
-Vector getDataLabels() {
- return dataLabels;
-}
-public Display getDisplay() {
- return super.getDisplay();
-}
-/**
- * Return the position at which the string starts that is used
- * to indicate a truncated item text.
- * @param columnIndex - index of the column for which the position of
- * the truncation replacement should be calculated
- * @param columnWidth - width of the column for which the position of
- * the truncation replacement should be calculated
- * @return -1 when the item text is not truncated
- */
-int getDotStartX(int columnIndex, int columnWidth) {
- GC gc;
- Table parent = getParent();
- String label = getText(columnIndex);
- int dotStartX = -1;
- int maxWidth;
-
- if (label != null) {
- gc = new GC(parent);
- maxWidth = getMaxTextWidth(columnIndex, columnWidth);
- label = parent.trimItemText(label, maxWidth, gc);
- if (label.endsWith(Table.DOT_STRING) == true) {
- dotStartX = gc.stringExtent(label).x - parent.getDotsWidth(gc);
- // add indents, margins and image width
- dotStartX += getImageStopX(columnIndex);
- dotStartX += getTextIndent(columnIndex);
- }
- gc.dispose();
- }
- return dotStartX;
-}
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed() {
- checkWidget();
- return super.getGrayed();
-}
-public Image getImage() {
- checkWidget();
- return getImage(0);
-}
-/**
- * Returns the item image of the column identified by 'columnIndex' or
- * null if no image has been set for that column.
- *
- * @param columnIndex - the column whose image should be returned
- * @return the item image
- */
-public Image getImage(int columnIndex) {
- checkWidget();
- Image image = null;
- Vector images = getImages();
- int itemIndex = getParent().indexOf(this);
-
- if (itemIndex != -1 && columnIndex >= 0 && columnIndex < images.size()) {
- image = (Image) images.elementAt(columnIndex);
- }
- return image;
-}
-/**
- * Returns a rectangle describing the size and location
- * relative to its parent of an image at a column in the
- * table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding image rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getImageBounds(int index) {
- checkWidget();
- Table parent = getParent();
- int itemIndex = parent.indexOf (this);
- int imageWidth = 0;
- Point imageExtent = parent.getImageExtent();
- Rectangle checkboxBounds;
- Rectangle imageBounds = getBounds(index);
-
- if (itemIndex == -1) {
- imageBounds = new Rectangle(0, 0, 0, 0);
- }
- else
- if (imageExtent != null) {
- if (index == TableColumn.FIRST || getImage(index) != null) {
- imageWidth = imageExtent.x;
- }
- }
- imageBounds.width = imageWidth;
- return imageBounds;
-}
-/**
- * Gets the image indent.
- *
- * @return the indent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getImageIndent() {
- checkWidget();
- int index = getParent().indexOf(this);
-
- if (index == -1) {
- return 0;
- }
- return imageIndent;
-}
-/**
- * Answer the number of pixels the image in the first column is
- * indented. Calculation starts at the column start and counts
- * all pixels except the check box.
- */
-int getImageIndentPixel() {
- int indentPixel = FIRST_COLUMN_IMAGE_INDENT;
- Point imageExtent = getParent().getImageExtent();
-
- if (imageExtent != null) {
- indentPixel += imageExtent.x * getImageIndent();
- }
- return indentPixel;
-}
-/**
- * Answer the item images set by the user. Items that don't have an
- * image are represented by a null slot in the vector.
- */
-Vector getImages() {
- return images;
-}
-/**
- * Calculate the x coordinate where the item image of column
- * 'columnIndex' stops.
- * @param columnIndex - the column for which the stop position of the
- * image should be calculated.
- */
-int getImageStopX(int columnIndex) {
- int imageStopX = 0;
- Table parent = getParent();
- Rectangle checkboxBounds;
-
- if (columnIndex == TableColumn.FIRST) {
- if (isCheckable() == true) {
- checkboxBounds = getCheckboxBounds();
- imageStopX += checkboxBounds.x + checkboxBounds.width + CHECKBOX_PADDING;
- }
- else {
- imageStopX = getImageIndentPixel();
- }
- }
- if (((columnIndex == TableColumn.FIRST && // always add the image width for the first column
- parent.hasFirstColumnImage() == true) || // if any item in the first column has an image
- (columnIndex != TableColumn.FIRST && // add the image width if it's not the first column
- getImage(columnIndex) != null)) && // only when the item actually has an image
- parent.getImageExtent() != null) {
- imageStopX += parent.getImageExtent().x;
- }
- return imageStopX;
-}
-/**
- * Return the index of the item in its parent widget.
- */
-int getIndex() {
- return index;
-}
-/**
- * Return the item extent in the specified column
- * The extent includes the actual width of the item including checkbox,
- * image and text.
- */
-Point getItemExtent(TableColumn column) {
- Table parent = getParent();
- int columnIndex = column.getIndex();
- Point extent = new Point(getImageStopX(columnIndex), parent.getItemHeight() - parent.getGridLineWidth());
- GC gc = new GC(parent);
- String trimmedText = getText(gc, column);
-
- if (trimmedText != null && trimmedText.length() > 0) {
- extent.x += gc.stringExtent(trimmedText).x + getTextIndent(columnIndex);
- }
- if (columnIndex == TableColumn.FIRST) {
- extent.x += SELECTION_PADDING;
- }
- gc.dispose();
- return extent;
-}
-/**
- * Answer the maximum width in pixel of the text that fits in the
- * column identified by 'columnIndex' without trimming the text.
- * @param columnIndex - the column for which the maximum text width
- * should be calculated.
- * @param columnWidth - width of the column 'columnIndex'
- */
-int getMaxTextWidth(int columnIndex, int columnWidth) {
- int itemWidth = getImageStopX(columnIndex) + getTextIndent(columnIndex) * 2;
- return columnWidth - itemWidth;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent() {
- checkWidget();
- return (Table) super.getSelectableParent();
-}
-/**
- * Answer the width of the item required to display the complete contents.
- */
-int getPreferredWidth(int index) {
- int size = getImageStopX(index);
- String text = getText(index);
- if (text != null) {
- size += getParent().getTextWidth(text) + getTextIndent(index) * 2 + 1;
- }
- return size;
-}
-/**
- * Return the size of the rectangle drawn to indicate a selected item.
- * This is also used to draw the selection focus rectangle and drop
- * insert marker.
- * Implements SelectableItem#getSelectionExtent
- */
-Point getSelectionExtent() {
- Table parent = getParent();
- Point extent;
-
- if ((parent.getStyle() & SWT.FULL_SELECTION) == 0) { // regular, first column, selection?
- if (selectionExtent == null) {
- calculateSelectionExtent();
- }
- extent = selectionExtent;
- }
- else {
- extent = parent.getFullSelectionExtent(this);
- }
- return extent;
-}
-/**
- * Return the x position of the selection rectangle
- * Implements SelectableItem#getSelectionX
- */
-int getSelectionX() {
- return getImageStopX(TableColumn.FIRST) + getParent().getHorizontalOffset();
-}
-public String getText() {
- checkWidget();
- return getText(0);
-}
-/**
- * Returns the item tezt of the column identified by 'columnIndex',
- * or null if no text has been set for that column.
- *
- * @param columnIndex - the column whose text should be returned
- * @return the item text or null if no text has been set for that column.
- */
-public String getText(int columnIndex) {
- checkWidget();
- int itemIndex = getParent().indexOf(this);
- Vector labels = getDataLabels();
- String label = null;
-
- if (itemIndex == -1) {
- error(SWT.ERROR_CANNOT_GET_TEXT);
- }
- if (columnIndex >= 0 && columnIndex < labels.size()) {
- label = (String) labels.elementAt(columnIndex);
- }
- if (label == null) {
- label = ""; // label vector is initialized with null instead of empty Strings
- }
- return label;
-}
-/**
- * Answer the text that is going to be drawn in 'column'. This
- * text may be a trimmed copy of the original text set by the
- * user if it doesn't fit into the column. In that case the last
- * characters are replaced with Table.DOT_STRING.
- * A cached copy of the trimmed text is returned if available.
- * @param gc - GC to use for measuring the text extent
- * @param column - TableColumn for which the text should be returned
- */
-String getText(GC gc, TableColumn column) {
- int columnIndex = column.getIndex();
- String label = getTrimmedText(columnIndex);
- int maxWidth;
-
- if (label == null) {
- maxWidth = getMaxTextWidth(columnIndex, column.getWidth());
- label = getParent().trimItemText(getText(columnIndex), maxWidth, gc);
- }
- return label;
-}
-/**
- * Answer the indent of the text in column 'columnIndex' in pixel.
- * This indent is used in front of and behind the item text.
- * @param columnIndex - specifies the column for which the indent
- * should be calculated.
- */
-int getTextIndent(int columnIndex) {
- int textIndent;
-
- if (columnIndex == TableColumn.FIRST) {
- if (getParent().hasFirstColumnImage() == false) {
- textIndent = TEXT_INDENT_NO_IMAGE;
- }
- else {
- textIndent = FIRST_COLUMN_TEXT_INDENT;
- }
- }
- else {
- textIndent = TEXT_INDENT;
- }
- return textIndent;
-}
-/**
- * Answer the cached trimmed text for column 'columnIndex'.
- * Answer null if it hasn't been calculated yet.
- * @param columnIndex - specifies the column for which the
- * trimmed text should be answered.
- */
-String getTrimmedText(int columnIndex) {
- String label = null;
- String labels[] = getTrimmedTexts();
-
- if (columnIndex < labels.length) {
- label = labels[columnIndex];
- }
- return label;
-}
-/**
- * Answer an array of cached trimmed labels.
- */
-String [] getTrimmedTexts() {
- return trimmedLabels;
-}
-/**
- * Ensure that the image and label vectors have at least
- * 'newSize' number of elements.
- */
-void growVectors(int newSize) {
- Vector images = getImages();
- Vector labels = getDataLabels();
-
- if (newSize > images.size()){
- images.setSize(newSize);
- }
- if (newSize > labels.size()){
- labels.setSize(newSize);
- }
-}
-/**
- * Insert 'column' into the receiver.
- */
-void insertColumn(TableColumn column) {
- Vector data = getDataLabels();
- Vector images = getImages();
- String stringData[];
- Image imageData[];
- int index = column.getIndex();
-
- if (index < data.size()) {
- data.insertElementAt(null, index);
- }
- else {
- data.addElement(null);
- }
- stringData = new String[data.size()];
- data.copyInto(stringData);
- setText(stringData);
-
- if (index < images.size()) {
- images.insertElementAt(null, index);
- }
- else {
- images.addElement(null);
- }
- imageData = new Image[images.size()];
- images.copyInto(imageData);
- setImage(imageData);
-}
-/**
- * Sets the image at an index.
- *
- * @param image the new image (or null)
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
-void internalSetImage(int columnIndex, Image image) {
- Vector images = getImages();
- boolean imageWasNull = false;
- Table parent = getParent();
-
- if (columnIndex >= 0 &&
- columnIndex < parent.internalGetColumnCount()) {
- if (columnIndex >= images.size()) {
- growVectors(columnIndex + 1);
- }
- if (((Image) images.elementAt(columnIndex)) == null && image != null) {
- imageWasNull = true;
- }
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- images.setElementAt(image, columnIndex);
- reset(columnIndex); // new image may cause text to no longer fit in the column
- notifyImageChanged(columnIndex, imageWasNull);
- }
-}
-/**
-* Sets the widget text.
-*
-* The widget text for an item is the label of the
-* item or the label of the text specified by a column
-* number.
-*
-* @param index the column number
-* @param text the new text
-*
-*/
-void internalSetText(int columnIndex, String string) {
- Vector labels = getDataLabels();
- Table parent = getParent();
- String oldText;
-
- if (columnIndex >= 0 &&
- columnIndex < parent.internalGetColumnCount()) {
- if (columnIndex >= labels.size()) {
- growVectors(columnIndex + 1);
- }
- oldText = (String) labels.elementAt(columnIndex);
- if (string.equals(oldText) == false) {
- labels.setElementAt(string, columnIndex);
- reset(columnIndex);
- notifyTextChanged(columnIndex, oldText == null);
- }
- }
-}
-/**
- * Answer whether the click at 'xPosition' on the receiver is a
- * selection click.
- * A selection click occurred when the click was behind the image
- * and before the end of the item text.
- * @return
- * true - 'xPosition' is a selection click.
- * false - otherwise
- */
-boolean isSelectionHit(int xPosition) {
- int itemStopX = getImageStopX(TableColumn.FIRST);
- Point selectionExtent = getSelectionExtent();
-
- if (selectionExtent != null) {
- itemStopX += selectionExtent.x;
- }
- return (xPosition > getCheckboxBounds().x + getCheckboxBounds().width) && (xPosition <= itemStopX);
-}
-/**
- * The image for the column identified by 'columnIndex' has changed.
- * Notify the parent widget and supply redraw coordinates, if possible.
- * @param columnIndex - index of the column that has a new image.
- */
-void notifyImageChanged(int columnIndex, boolean imageWasNull) {
- Table parent = getParent();
- Rectangle changedColumnBounds;
- int redrawStartX = 0;
- int redrawWidth = 0;
- int columnCount = parent.internalGetColumnCount();
-
- if (columnIndex >= 0 && columnIndex < columnCount && parent.getVisibleRedrawY(this) != -1) {
- changedColumnBounds = parent.internalGetColumn(columnIndex).getBounds();
- redrawStartX = Math.max(0, getImageBounds(columnIndex).x);
- if (parent.getImageExtent() != null && imageWasNull == false) {
- redrawWidth = getImageStopX(columnIndex);
- }
- else {
- redrawWidth = changedColumnBounds.width;
- }
- redrawWidth += changedColumnBounds.x - redrawStartX;
- }
- parent.itemChanged(this, redrawStartX, redrawWidth);
-}
-
-/**
- * The label for the column identified by 'columnIndex' has changed.
- * Notify the parent widget and supply redraw coordinates, if possible.
- * @param columnIndex - index of the column that has a new label.
- */
-void notifyTextChanged(int columnIndex, boolean textWasNull) {
- Table parent = getParent();
- String text;
- Rectangle columnBounds;
- int redrawStartX = 0;
- int redrawWidth = 0;
- int columnCount = parent.internalGetColumnCount();
-
- if (columnIndex >= 0 && columnIndex < columnCount && parent.getVisibleRedrawY(this) != -1) {
- text = (String) getDataLabels().elementAt(columnIndex);
- columnBounds = parent.internalGetColumn(columnIndex).getBounds();
- redrawStartX = columnBounds.x;
- if (getImage(columnIndex) != null) {
- redrawStartX += getImageStopX(columnIndex);
- }
- redrawStartX = Math.max(0, redrawStartX);
- // don't redraw if text changed from null to empty string
- if (textWasNull == false || text.length() > 0) {
- redrawWidth = columnBounds.x + columnBounds.width - redrawStartX;
- }
- }
- parent.itemChanged(this, redrawStartX, redrawWidth);
-}
-/**
- * Draw the receiver at 'paintPosition' in the column identified by
- * 'columnIndex' using 'gc'.
- * @param gc - GC to use for drawing
- * @param paintPosition - position where the receiver should be drawing.
- * @param column - the column to draw in
- */
-void paint(GC gc, Point paintPosition, TableColumn column) {
- int columnIndex = column.getIndex();
- String label = getText(gc, column);
- String oldLabel = getTrimmedText(columnIndex);
-
- if (label != null && label.equals(oldLabel) == false) {
- setTrimmedText(label, columnIndex);
- selectionExtent = null; // force a recalculation next time the selection extent is needed
- }
- if (columnIndex == TableColumn.FIRST) {
- paintPosition.x += getImageIndentPixel();
- if (isCheckable() == true) {
- paintPosition = drawCheckbox(gc, paintPosition);
- }
- }
- paintPosition = drawImage(gc, paintPosition, columnIndex);
- paintPosition.x += getTextIndent(columnIndex);
- drawText(label, gc, paintPosition, columnIndex);
-}
-/**
- * Remove 'column' from the receiver.
- */
-void removeColumn(TableColumn column) {
- Vector data = getDataLabels();
- Vector images = getImages();
- String stringData[];
- Image imageData[];
- int index = column.getIndex();
-
- if (index < data.size()) {
- data.removeElementAt(index);
- stringData = new String[data.size()];
- data.copyInto(stringData);
- setText(stringData);
- }
- if (index < images.size()) {
- images.removeElementAt(index);
- imageData = new Image[images.size()];
- images.copyInto(imageData);
- setImage(imageData);
- }
-}
-/**
- * Reset the cached trimmed label for the sub item identified by
- * 'index'.
- * @param index - index of the label that should be reset.
- */
-void reset(int index) {
- String trimmedLabels[] = getTrimmedTexts();
-
- if (index >= 0 && index < trimmedLabels.length) {
- trimmedLabels[index] = null;
- }
- if (index == TableColumn.FIRST) {
- selectionExtent = null;
- }
-}
-/**
- * Sets the image for multiple columns in the Table.
- *
- * @param images the array of new images
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage(Image [] images) {
- checkWidget();
- if (images == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (getParent().indexOf(this) == -1) {
- return;
- }
- for (int i = 0; i < images.length; i++) {
- internalSetImage(i, images[i]);
- }
-}
-/**
- * Sets the receiver's image at a column.
- *
- * @param index the column index
- * @param image the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage(int index, Image image) {
- checkWidget();
- if (getParent().indexOf(this) != -1) {
- internalSetImage(index, image);
- }
-}
-public void setImage(Image image) {
- checkWidget();
- setImage(0, image);
-}
-/**
- * Sets the image indent.
- *
- * @param indent the new indent
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImageIndent(int indent) {
- checkWidget();
- Table parent = getParent();
- TableColumn column;
- int index = parent.indexOf(this);
-
- if (index != -1 && indent >= 0 && indent != imageIndent) {
- imageIndent = indent;
- column = parent.internalGetColumn(TableColumn.FIRST);
- parent.redraw(
- 0, parent.getRedrawY(this),
- column.getWidth(), parent.getItemHeight(), false);
- }
-}
-/**
- * Sets the text for multiple columns in the table.
- *
- * @param strings the array of new strings
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText(String [] strings) {
- checkWidget();
- if (strings == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (getParent().indexOf(this) == -1) {
- return;
- }
- for (int i = 0; i < strings.length; i++) {
- String string = strings[i];
- if (string != null) {
- internalSetText(i, string);
- }
- }
-}
-/**
- * Sets the receiver's text at a column
- *
- * @param index the column index
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (int index, String string) {
- checkWidget();
- if (string == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (getParent().indexOf(this) != -1) {
- internalSetText(index, string);
- }
-}
-public void setText(String text) {
- checkWidget();
- if (text == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- setText(0, text);
-}
-/**
- * Set the trimmed text of column 'columnIndex' to label. The trimmed
- * text is the one that is displayed in a column. It may be shorter than
- * the text originally set by the user via setText(...) to fit the
- * column.
- * @param label - the text label of column 'columnIndex'. May be trimmed
- * to fit the column.
- * @param columnIndex - specifies the column whose text label should be
- * set.
- */
-void setTrimmedText(String label, int columnIndex) {
- String labels[] = getTrimmedTexts();
-
- if (columnIndex < labels.length) {
- labels[columnIndex] = label;
- }
-}
-/**
- * Sets the checked state of the receiver.
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked(boolean checked) {
- checkWidget();
- super.setChecked(checked);
-}
-/**
- * Sets the grayed state of the receiver.
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
- super.setGrayed(grayed);
-}
-/**
- * Set the index of this item in its parent widget to 'newIndex'.
- */
-void setIndex(int newIndex) {
- index = newIndex;
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java
deleted file mode 100644
index 353fca9702..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java
+++ /dev/null
@@ -1,1638 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-import java.util.Enumeration;
-import java.util.Stack;
-import java.util.Vector;
-
-/**
- * Instances of this class provide a selectable user interface object
- * that displays a hierarchy of items and issue notificiation when an
- * item in the hierarchy is selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TreeItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tree extends SelectableItemWidget {
- // These constants are used internally for item hit test on mouse click
- private static final int ActionNone = 0; // The mouse event was not handled
- private static final int ActionExpandCollapse = 1; // Do an expand/collapse
- private static final int ActionSelect = 2; // Select the item
- private static final int ActionCheck = 3; // Toggle checked state of the item
- private static ImageData CollapsedImageData; // collapsed sub tree image data. used to create an image at run time
- private static ImageData ExpandedImageData; // expanded sub tree image data. used to create an image at run time
- static {
- initializeImageData();
- }
-
- private TreeRoots root;
- private TreeItem expandingItem;
-
- private Image collapsedImage;
- private Image expandedImage;
-
- // The following fields are needed for painting tree items
- final Color CONNECTOR_LINE_COLOR; // Color constant used during painting. Can't keep this in TreeItem
- // because we only need one instance per tree widget/display and can't
- // have it static. Initialized in c'tor and freed in dispose();
- Rectangle hierarchyIndicatorRect = null; // bounding rectangle of the hierarchy indication image (plus/minus)
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tree(Composite parent, int style) {
- super(parent, checkStyle (style));
- CONNECTOR_LINE_COLOR = new Color(getDisplay(), 170, 170, 170); // Light gray;
-}
-/**
- * Add 'item' to the list of root items.
- * @param 'item' - the tree item that should be added as a root.
- * @param index - position that 'item' will be inserted at
- * in the receiver.
- */
-void addItem(TreeItem item, int index) {
- if (index < 0 || index > getItemCount()) {
- error(SWT.ERROR_INVALID_RANGE);
- }
- getRoot().add(item, index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- TypedListener typedListener;
-
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when an item in the receiver is expanded or collapsed
- * by sending it one of the messages defined in the <code>TreeListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #removeTreeListener
- */
-public void addTreeListener(TreeListener listener) {
- checkWidget();
- TypedListener typedListener;
-
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- typedListener = new TypedListener(listener);
- addListener(SWT.Expand, typedListener);
- addListener(SWT.Collapse, typedListener);
-}
-/**
- * The SelectableItem 'item' has been added to the tree.
- * Prevent screen updates when 'item' is inserted due to an
- * expand operation.
- * @param item - item that has been added to the receiver.
- */
-void addedItem(SelectableItem item, int index) {
- super.addedItem(item, index);
- redrawAfterModify(item, index); // redraw plus/minus image, hierarchy lines
-}
-/**
- * Answer the y position of both the first child of 'item' and
- * the item following the last child of 'item'.
- * Used to scroll items on expand/collapse.
- * @param item - TreeItem to use for calculating the y boundary
- * of child items.
- * @return Array - first element is the position of the first
- * child of 'item'. Second element is the position of the item
- * following the last child of 'item'.
- * Both elements are -1 if 'item' is not a child of the receiver.
- */
-int[] calculateChildrenYPos(TreeItem item) {
- int itemIndex = item.getVisibleIndex();
- int itemCount = item.getVisibleItemCount();
- int itemHeight = getItemHeight();
- int yPos;
- int[] yPosition = new int[] {-1, -1};
-
- if (itemIndex != -1) {
- itemIndex -= getTopIndex();
- yPos = (itemIndex + itemCount + 1) * itemHeight; // y position of the item following
- // the last child of 'item'
- yPosition = new int[] {yPos - (itemCount * itemHeight), yPos};
- }
- return yPosition;
-}
-/**
- * Calculate the widest of the children of 'item'.
- * Items that are off screen and that may be scrolled into view are
- * included in the calculation.
- * @param item - the tree item that was expanded
- */
-void calculateWidestExpandingItem(TreeItem item) {
- int itemIndex = item.getVisibleIndex();
- int newMaximumItemWidth = getContentWidth();
- int stopIndex = itemIndex + item.getVisibleItemCount();
-
- for (int i = itemIndex + 1; i <= stopIndex; i++) {
- newMaximumItemWidth = Math.max(newMaximumItemWidth, getContentWidth(i));
- }
- setContentWidth(newMaximumItemWidth);
-}
-/**
- * Calculate the width of new items as they are scrolled into view.
- * Precondition:
- * topIndex has already been set to the new index.
- * @param topIndexDifference - difference between old and new top
- * index.
- */
-void calculateWidestScrolledItem(int topIndexDifference) {
- int visibleItemCount = getItemCountTruncated(getClientArea());
- int newMaximumItemWidth = getContentWidth();
- int topIndex = getTopIndex();
- int stopIndex = topIndex;
-
- if (topIndexDifference < 0) { // scrolled up?
- if (Math.abs(topIndexDifference) > visibleItemCount) { // scrolled down more than one page (via quick thumb dragging)?
- topIndexDifference = visibleItemCount * -1;
- }
- for (int i = stopIndex - topIndexDifference; i >= stopIndex; i--) { // check item width from old top index up to new one
- newMaximumItemWidth = Math.max(newMaximumItemWidth, getContentWidth(i));
- }
- }
- else
- if (topIndexDifference > 0) { // scrolled down?
- if (topIndexDifference > visibleItemCount) { // scrolled down more than one page (via quick thumb dragging)?
- topIndexDifference = visibleItemCount;
- }
- stopIndex += visibleItemCount;
- for (int i = stopIndex - topIndexDifference; i < stopIndex; i++) {
- newMaximumItemWidth = Math.max(newMaximumItemWidth, getContentWidth(i));
- }
- }
- setContentWidth(newMaximumItemWidth);
-}
-/**
- * Calculate the maximum item width of all displayed items.
- */
-void calculateWidestShowingItem() {
- TreeItem visibleItem;
- int newMaximumItemWidth = 0;
- int bottomIndex = getBottomIndex();
- int paintStopX;
-
- // add one to the loop end index because otherwise an item covered
- // by the horizontal scroll bar would not be taken into acount and
- // may become visible after this calculation. We're in trouble if
- // that item is wider than the client area.
- if (getHorizontalBar().getVisible() == true) {
- bottomIndex++;
- }
- for (int i = getTopIndex(); i < bottomIndex; i++) {
- visibleItem = getRoot().getVisibleItem(i);
- if (visibleItem != null) {
- paintStopX = visibleItem.getPaintStopX();
- newMaximumItemWidth = Math.max(newMaximumItemWidth, paintStopX);
- }
- }
- setContentWidth(newMaximumItemWidth);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
- * Collapse the tree item identified by 'item' if it is not
- * already collapsed. Move the selection to the parent item
- * if one of the collapsed items is currently selected.
- * @param item - item that should be collapsed.
- * @param notifyListeners -
- * true=a Collapse event is sent
- * false=no event is sent
- */
-void collapse(TreeItem item, boolean notifyListeners) {
- Event event;
- int itemIndex;
-
- if (item.getExpanded() == false) {
- return;
- }
- collapseNoRedraw(item);
- itemIndex = item.getVisibleIndex();
- if (itemIndex != -1) { // if the item's parent is not collapsed (and the item is thus visible) do the screen updates
- item.redrawExpanded(itemIndex - getTopIndex());
- showSelectableItem(item);
- calculateVerticalScrollbar();
- calculateWidestShowingItem();
- claimRightFreeSpace();
- claimBottomFreeSpace();
- }
- if (notifyListeners == true) {
- event = new Event();
- event.item = item;
- notifyListeners(SWT.Collapse, event);
- }
-}
-
-/**
- * Collapse the tree item identified by 'item' if it is not
- * already collapsed. Move the selection to the parent item
- * if one of the collapsed items is currently selected.
- * This method is used to hide the children if an item is deleted.
- * certain redraw and scroll operations are not needed for this
- * case.
- * @param item - item that should be collapsed.
- */
-void collapseNoRedraw(TreeItem item) {
- int itemIndex;
-
- if (item.getExpanded() == false) {
- return;
- }
- if (isSelectedItemCollapsing(item) == true) {
- deselectAllExcept(item);
- selectNotify(item);
- update(); // call update to make sure that new selection is
- // drawn before items are collapsed (looks better)
- }
- scrollForCollapse(item);
- item.internalSetExpanded(false);
-}
-
-public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size = super.computeSize(wHint, hHint, changed);
- GC gc;
- final int WidthCalculationCount = 50; // calculate item width for the first couple of items only
- TreeRoots root = getRoot();
- TreeItem item;
- Image itemImage;
- String itemText;
- int width;
- int newItemWidth = 0;
-
- if (getContentWidth() == 0 && getItemCount() > 0) {
- gc = new GC(this);
- for (int i = 0; i < WidthCalculationCount; i++) {
- item = root.getVisibleItem(i);
- if (item == null) {
- break; // no more items
- }
- itemImage = item.getImage();
- itemText = item.getText();
- width = 0;
- if (itemImage != null) {
- width += itemImage.getBounds().width;
- }
- if (itemText != null) {
- width += gc.stringExtent(itemText).x;
- }
- newItemWidth = Math.max(newItemWidth, width);
- }
- if (newItemWidth > 0) {
- size.x = newItemWidth;
- }
- gc.dispose();
- }
- return size;
-}
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll() {
- checkWidget();
- getRoot().deselectAll();
- getSelectionVector().removeAllElements();
- redraw();
-}
-/**
- * Modifier Key Action
- * None Collapse the selected item if expanded. Select
- * parent item if selected item is already
- * collapsed and if it's not the root item.
- * Ctrl super.doArrowLeft(int);
- * Shift see None above
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowLeft(int keyMask) {
- TreeItem focusItem = (TreeItem) getLastFocus();
- TreeItem parentItem;
-
- if (focusItem == null) {
- return;
- }
- if (keyMask == SWT.CTRL) {
- super.doArrowLeft(keyMask);
- }
- else
- if (focusItem.getExpanded() == true) { // collapse if expanded
- collapse(focusItem, true);
- }
- else
- if (focusItem.isRoot() == false) { // go to the parent if there is one
- parentItem = focusItem.getParentItem();
- deselectAllExcept(parentItem);
- selectNotify(parentItem);
- }
-}
-/**
- * Modifier Key Action
- * None Expand selected item if collapsed. Select
- * first child item if selected item is
- * already expanded and there is a child item.
- * Ctrl super.doArrowRight(keyMask);
- * Shift see None above
- * @param keyMask - the modifier key that was pressed
- */
-void doArrowRight(int keyMask) {
- TreeItem focusItem = (TreeItem) getLastFocus();
- TreeItem childItem;
-
- if (focusItem == null) {
- return;
- }
- if (keyMask == SWT.CTRL) {
- super.doArrowRight(keyMask);
- }
- else
- if (focusItem.isLeaf() == false) {
- if (focusItem.getExpanded() == false) { // expand if collapsed
- expand(focusItem, true);
- }
- else { // go to the first child if there is one
- childItem = focusItem.getItems()[0];
- deselectAllExcept(childItem);
- selectNotify(childItem);
- }
- }
-}
-/**
- * Expand the selected item and all of its children.
- */
-void doAsterix() {
- expandAll((TreeItem) getLastFocus());
-}
-/**
- * Free resources.
- */
-void doDispose() {
- super.doDispose();
- if (collapsedImage != null) {
- collapsedImage.dispose();
- }
- if (expandedImage != null) {
- expandedImage.dispose();
- }
- getRoot().dispose();
- CONNECTOR_LINE_COLOR.dispose();
- resetHierarchyIndicatorRect();
-}
-/**
- * Collapse the selected item if it is expanded.
- */
-void doMinus() {
- TreeItem selectedItem = (TreeItem) getLastFocus();
-
- if (selectedItem != null) {
- collapse(selectedItem, true);
- }
-}
-/**
- * Expand the selected item if it is collapsed and if it
- * has children.
- */
-void doPlus() {
- TreeItem selectedItem = (TreeItem) getLastFocus();
-
- if (selectedItem != null && selectedItem.isLeaf() == false) {
- expand(selectedItem, true);
- }
-}
-/**
- * Expand the tree item identified by 'item' if it is not already
- * expanded. Scroll the expanded items into view.
- * @param item - item that should be expanded
- * @param notifyListeners -
- * true=an Expand event is sent
- * false=no event is sent
- */
-void expand(TreeItem item, boolean notifyListeners) {
- Event event = new Event();
- int indexFromTop;
- boolean nestedExpand = expandingItem != null;
-
- if (item.getExpanded() == true) {
- return;
- }
- if (nestedExpand == false) {
- setExpandingItem(item);
- }
- scrollForExpand(item);
- item.internalSetExpanded(true);
- if (notifyListeners == true) {
- event.item = item;
- notifyListeners(SWT.Expand, event);
- }
- // redraw hierarchy image
- item.redrawExpanded(item.getVisibleIndex() - getTopIndex());
- calculateVerticalScrollbar();
- if (nestedExpand == false && isVisible() == true) {
- // Save the index here because showSelectableItem may change it
- indexFromTop = item.getVisibleIndex() - getTopIndex();
- showSelectableItem(item); // make expanded item visible. Could be invisible if the expand was caused by a key press.
- calculateWidestExpandingItem(item);
- scrollExpandedItemsIntoView(item);
- }
- if (nestedExpand == false) {
- setExpandingItem(null);
- }
-}
-/**
- * Expand 'item' and all its children.
- */
-void expandAll(TreeItem item) {
- TreeItem items[];
-
- if (item != null && item.isLeaf() == false) {
- expand(item, true);
- update();
- items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- expandAll(items[i]);
- }
- }
-}
-/**
- * Answer the image that is used as a hierarchy indicator
- * for a collapsed hierarchy.
- */
-Image getCollapsedImage() {
- if (collapsedImage == null) {
- collapsedImage = new Image(getDisplay(), CollapsedImageData);
- }
- return collapsedImage;
-}
-/**
- * Answer the width of the item identified by 'itemIndex'.
- */
-int getContentWidth(int itemIndex) {
- TreeItem item = getRoot().getVisibleItem(itemIndex);
- int paintStopX = 0;
-
- if (item != null) {
- paintStopX = item.getPaintStopX();
- }
- return paintStopX;
-}
-/**
- * Answer the image that is used as a hierarchy indicator
- * for an expanded hierarchy.
- */
-Image getExpandedImage() {
- if (expandedImage == null) {
- expandedImage = new Image(getDisplay(), ExpandedImageData);
- }
- return expandedImage;
-}
-/**
- * Answer the rectangle enclosing the hierarchy indicator of a tree item.
- *
- * Note:
- * Assumes that the hierarchy indicators for expanded and
- * collapsed state are the same size.
- * @return
- * The rectangle enclosing the hierarchy indicator.
- */
-Rectangle getHierarchyIndicatorRect() {
- int itemHeight = getItemHeight();
- Image hierarchyImage;
- Rectangle imageBounds;
-
- if (hierarchyIndicatorRect == null && itemHeight != -1) {
- hierarchyImage = getCollapsedImage();
- if (hierarchyImage != null) {
- imageBounds = hierarchyImage.getBounds();
- }
- else {
- imageBounds = new Rectangle(0, 0, 0, 0);
- }
- hierarchyIndicatorRect = new Rectangle(
- 0,
- (itemHeight - imageBounds.height) / 2 + (itemHeight - imageBounds.height) % 2,
- imageBounds.width,
- imageBounds.height);
- }
- return hierarchyIndicatorRect;
-}
-/**
- * Answer the index of 'item' in the receiver.
- */
-int getIndex(SelectableItem item) {
- int index = -1;
-
- if (item != null) {
- index = ((TreeItem) item).getGlobalIndex();
- }
- return index;
-}
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. The
- * number that is returned is the number of roots in the
- * tree.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount() {
- checkWidget();
- return getRoot().getItemCount();
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight() {
- checkWidget();
- return super.getItemHeight();
-}
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. These
- * are the roots of the tree.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems() {
- checkWidget();
- TreeItem childrenArray[] = new TreeItem[getItemCount()];
-
- getRoot().getChildren().copyInto(childrenArray);
- return childrenArray;
-}
-/**
- * Answer the number of sub items of 'item' that do not fit in the
- * tree client area.
- */
-int getOffScreenItemCount(TreeItem item) {
- int itemIndexFromTop = item.getVisibleIndex() - getTopIndex();
- int spaceRemaining = getItemCountWhole()-(itemIndexFromTop+1);
- int expandedItemCount = item.getVisibleItemCount();
-
- return expandedItemCount - spaceRemaining;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem() {
- checkWidget();
- return null;
-}
-/**
- * Answer the object that holds the root items of the receiver.
- */
-TreeRoots getRoot() {
- return root;
-}
-/**
- * Returns an array of <code>TreeItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getSelection() {
- checkWidget();
- Vector selectionVector = getSelectionVector();
- TreeItem[] selectionArray = new TreeItem[selectionVector.size()];
-
- selectionVector.copyInto(selectionArray);
- sort(selectionArray, 0, selectionArray.length);
- return selectionArray;
-}
-/**
- * Answer the index of 'item' in the receiver.
- * Answer -1 if the item is not visible.
- * The returned index must refer to a visible item.
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. It only means that the item
- * would be displayed if it is located inside the receiver's
- * client area.
- * Collapsed items are not visible.
- */
-int getVisibleIndex(SelectableItem item) {
- int index = -1;
-
- if (item != null) {
- index = ((AbstractTreeItem) item).getVisibleIndex();
- }
- return index;
-}
-/**
- * Answer the SelectableItem located at 'itemIndex'
- * in the receiver.
- * @param itemIndex - location of the SelectableItem
- * object to return
- */
-SelectableItem getVisibleItem(int itemIndex) {
- return getRoot().getVisibleItem(itemIndex);
-}
-/**
- * Answer the number of visible items of the receiver.
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. It only means that the item
- * would be displayed if it is located inside the receiver's
- * client area.
- * Collapsed items are not visible.
- */
-int getVisibleItemCount() {
- return getRoot().getVisibleItemCount();
-}
-/**
- * Answer the y coordinate at which 'item' is drawn.
- * @param item - SelectableItem for which the paint position
- * should be returned
- * @return the y coordinate at which 'item' is drawn.
- * Return -1 if 'item' is null or outside the client area
- */
-int getVisibleRedrawY(SelectableItem item) {
- int redrawY = getRedrawY(item);
-
- if (redrawY < 0 || redrawY > getClientArea().height) {
- redrawY = -1;
- }
- return redrawY;
-}
-/**
- * Handle the events the receiver is listening to.
- */
-void handleEvents(Event event) {
- switch (event.type) {
- case SWT.Paint:
- paint(event);
- break;
- case SWT.MouseDown:
- mouseDown(event);
- break;
- case SWT.MouseDoubleClick:
- mouseDoubleClick(event);
- break;
- default:
- super.handleEvents(event);
- }
-}
-/**
- * Initialize the receiver.
- */
-void initialize() {
- resetRoot(); // has to be at very top because super class uses
- // functionality that relies on the TreeRoots object
- super.initialize();
-}
-/**
- * Initialize the ImageData used for the expanded/collapsed images.
- */
-static void initializeImageData() {
- PaletteData fourBit = new PaletteData(
- new RGB[] {new RGB(0, 0, 0), new RGB (128, 0, 0), new RGB (0, 128, 0), new RGB (128, 128, 0), new RGB (0, 0, 128), new RGB (128, 0, 128), new RGB (0, 128, 128), new RGB (128, 128, 128), new RGB (192, 192, 192), new RGB (255, 0, 0), new RGB (0, 255, 0), new RGB (255, 255, 0), new RGB (0, 0, 255), new RGB (255, 0, 255), new RGB (0, 255, 255), new RGB (255, 255, 255)});
-
- CollapsedImageData = new ImageData(
- 9, 9, 4, // width, height, depth
- fourBit, 4,
- new byte[] {119, 119, 119, 119, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, -1, 15, -1, 112, 0, 0, 0, 127, -1, 15, -1, 112, 0, 0, 0, 127, 0, 0, 15, 112, 0, 0, 0, 127, -1, 15, -1, 112, 0, 0, 0, 127, -1, 15, -1, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 119, 119, 119, 119, 112, 0, 0, 0});
- CollapsedImageData.transparentPixel = 15; // use white for transparency
- ExpandedImageData = new ImageData(
- 9, 9, 4, // width, height, depth
- fourBit, 4,
- new byte[] {119, 119, 119, 119, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, 0, 0, 15, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 127, -1, -1, -1, 112, 0, 0, 0, 119, 119, 119, 119, 112, 0, 0, 0});
- ExpandedImageData.transparentPixel = 15; // use white for transparency
-}
-/**
- * Set event listeners for the receiver.
- */
-void installListeners() {
- Listener listener = getListener();
-
- super.installListeners();
- addListener(SWT.Paint, listener);
- addListener(SWT.MouseDown, listener);
- addListener(SWT.MouseDoubleClick, listener);
-}
-/**
- * Answer whether the receiver is currently expanding a sub tree
- * with 'item' in it.
- * Used for performance optimizations.
- */
-boolean isExpandingItem(SelectableItem item) {
- TreeItem parentItem;
-
- if (expandingItem == null || item == null || (item instanceof TreeItem) == false) {
- return false;
- }
- parentItem = ((TreeItem) item).getParentItem();
- return (parentItem == expandingItem || isExpandingItem(parentItem));
-}
-/**
- * Answer whether the children of 'collapsingItem' contain
- * at least one selected item.
- */
-boolean isSelectedItemCollapsing(TreeItem collapsingItem) {
- Enumeration selection = getSelectionVector().elements();
- TreeItem item;
- int selectedItemIndex;
- int collapsingItemIndex = collapsingItem.getVisibleIndex();
- int lastCollapsedItemIndex = collapsingItemIndex + collapsingItem.getVisibleItemCount();
-
- if (collapsingItemIndex == -1) { // is the collapsing item in a collapsed subtree?
- return false; // then neither it nor its children are selected
- }
- while (selection.hasMoreElements() == true) {
- item = (TreeItem) selection.nextElement();
- selectedItemIndex = item.getVisibleIndex();
- if ((selectedItemIndex > collapsingItemIndex) &&
- (selectedItemIndex <= lastCollapsedItemIndex)) {
- return true;
- }
- }
- return false;
-}
-/**
- * Test whether the mouse click specified by 'event' was a
- * valid selection or expand/collapse click.
- * @return
- * One of ActionExpandCollapse, ActionSelect, ActionNone, ActionCheck
- * specifying the action to be taken on the click.
- */
-int itemAction(TreeItem item, int x, int y) {
- int action = ActionNone;
- int itemHeight = getItemHeight();
- int offsetX;
- int offsetY;
- Point offsetPoint;
-
- if (item != null) {
- offsetX = x - item.getPaintStartX();
- offsetY = y - itemHeight * (y / itemHeight);
- offsetPoint = new Point(offsetX, offsetY);
- if ((item.isLeaf() == false) &&
- (getHierarchyIndicatorRect().contains(offsetPoint) == true)) {
- action |= ActionExpandCollapse;
- }
- else
- if (item.isSelectionHit(offsetPoint) == true) {
- action |= ActionSelect;
- }
- else
- if (item.isCheckHit(new Point(x, y)) == true) {
- action |= ActionCheck;
- }
- }
- return action;
-}
-/**
- * The table item 'changedItem' has changed. Redraw the whole
- * item in that column. Include the text in the redraw because
- * an image set to null requires a redraw of the whole item anyway.
- */
-void itemChanged(SelectableItem changedItem, int repaintStartX, int repaintWidth) {
- int oldItemHeight = getItemHeight();
- Point oldImageExtent = getImageExtent();
-
- if (isExpandingItem(changedItem) == false) {
- super.itemChanged(changedItem, repaintStartX, repaintWidth);
- }
- else {
- calculateItemHeight(changedItem);
- }
- if ((oldItemHeight != getItemHeight()) || // only reset items if the item height or
- (oldImageExtent != getImageExtent())) { // image size has changed. The latter will only change once,
- // from null to a value-so it's safe to test using !=
- getRoot().reset(); // reset cached data of all items in the receiver
- resetHierarchyIndicatorRect();
- redraw(); // redraw all items if the image extent has changed. Fixes 1FRIHPZ
- }
- else {
- ((AbstractTreeItem) changedItem).reset(); // reset the item that has changed when the tree item
- // height has not changed (otherwise the item caches old data)
- // Fixes 1FF6B42
- }
- if (repaintWidth != 0) {
- calculateWidestShowingItem();
- claimRightFreeSpace(); // otherwise scroll bar may be reset, but not horizontal offset
- // Fixes 1G4SBJ3
- }
-}
-/**
- * A key was pressed.
- * Call the appropriate key handler method.
- * @param event - the key event
- */
-void keyDown(Event event) {
- super.keyDown(event);
- switch (event.character) {
- case '+':
- doPlus();
- break;
- case '-':
- doMinus();
- break;
- case '*':
- doAsterix();
- break;
- }
-}
-
-/**
- * A mouse double clicked occurred over the receiver.
- * Expand/collapse the clicked item. Do nothing if no item was clicked.
- */
-void mouseDoubleClick(Event event) {
- int hitItemIndex = event.y / getItemHeight();
- TreeItem hitItem = getRoot().getVisibleItem(hitItemIndex + getTopIndex());
- Event newEvent;
-
- if (hitItem == null || itemAction(hitItem, event.x, event.y) != ActionSelect) {
- return;
- }
- if (hooks(SWT.DefaultSelection) == true) {
- newEvent = new Event();
- newEvent.item = hitItem;
- notifyListeners(SWT.DefaultSelection, newEvent);
- }
- else
- if (hitItem.isLeaf() == false) { // item with children was hit. Default behavior is expand/collapse item
- if (hitItem.getExpanded() == true) {
- collapse(hitItem, true);
- }
- else {
- expand(hitItem, true);
- }
- }
-}
-/**
- * The mouse pointer was pressed down on the receiver.
- * Handle the event according to the position of the mouse click.
- */
-void mouseDown(Event event) {
- int hitItemIndex;
- TreeItem hitItem;
- SelectableItem selectionItem = getLastSelection();
- int itemAction;
-
- if (event.button != 1) { // only react to button one clicks.
- return;
- }
- hitItemIndex = event.y / getItemHeight();
- hitItem = getRoot().getVisibleItem(hitItemIndex + getTopIndex());
- if (hitItem == null) {
- return;
- }
- switch (itemAction = itemAction(hitItem, event.x, event.y)) {
- case ActionExpandCollapse:
- if (hitItem.getExpanded() == true) {
- collapse(hitItem, true);
- }
- else {
- expand(hitItem, true);
- }
- break;
- case ActionSelect:
- doMouseSelect(hitItem, hitItemIndex + getTopIndex(), event.stateMask, event.button);
- break;
- case ActionCheck:
- doCheckItem(hitItem);
- break;
- }
- if (itemAction != ActionSelect && selectionItem == null) {
- selectionItem = getRoot().getVisibleItem(getTopIndex()); // select the top item if no item was selected before
- selectNotify(selectionItem);
- }
-}
-/**
- * A paint event has occurred. Display the invalidated items.
- * @param event - expose event specifying the invalidated area.
- */
-void paint(Event event) {
- int visibleRange[] = getIndexRange(event.getBounds());
-
- paintItems(event.gc, visibleRange[0], visibleRange[1] + 1); // + 1 to paint the vertical line
- // connection the last item we really
- // want to paint with the item after that.
-}
-/**
- * Paint tree items on 'gc' starting at index 'topPaintIndex' and
- * stopping at 'bottomPaintIndex'.
- * @param gc - GC to draw tree items on.
- * @param topPaintIndex - index of the first item to draw
- * @param bottomPaintIndex - index of the last item to draw
- */
-void paintItems(GC gc, int topPaintIndex, int bottomPaintIndex) {
- TreeItem visibleItem;
- int itemHeight = getItemHeight();
-
- for (int i = topPaintIndex; i <= bottomPaintIndex; i++) {
- visibleItem = getRoot().getVisibleItem(i + getTopIndex());
- if (visibleItem != null) {
- visibleItem.paint(gc, i * itemHeight);
- }
- }
-}
-/**
- * 'item' has been added to or removed from the receiver.
- * Repaint part of the tree to update the vertical hierarchy
- * connectors and hierarchy image.
- * @param modifiedItem - the added/removed item
- * @param modifiedIndex - index of the added/removed item
- */
-void redrawAfterModify(SelectableItem modifiedItem, int modifiedIndex) {
- int redrawStartY;
- int redrawStopY;
- int itemChildIndex = ((TreeItem) modifiedItem).getIndex();
- int topIndex = getTopIndex();
- int itemHeight = getItemHeight();
- int redrawItemIndex;
- int itemCount;
- AbstractTreeItem parentItem = ((TreeItem) modifiedItem).getParentItem();
- AbstractTreeItem redrawItem = null;
-
- if (redrawParentItem(modifiedItem) == false) {
- return;
- }
- if (parentItem == null) { // a root item is added/removed
- parentItem = getRoot();
- }
- itemCount = parentItem.getItemCount();
- // redraw hierarchy decorations of preceeding item if the last item at a tree
- // level was added/removed
- // otherwise, if the first item was removed, redraw the parent to update hierarchy icon
- if (itemChildIndex > 0) { // more than one item left at this tree level
- // added/removed last item at this tree level? have to test >=.
- // when removing last item, item index is outside itemCount
- if (itemChildIndex >= itemCount - 1) {
- redrawItem = (AbstractTreeItem) parentItem.getChildren().elementAt(itemChildIndex - 1);
- }
- }
- else
- if (getVisibleItemCount() > 0 && itemCount < 2) { // last item at this level removed/first item added?
- redrawItem = parentItem; // redraw parent item to update hierarchy icon
- }
- if (redrawItem != null) {
- redrawItemIndex = redrawItem.getVisibleIndex();
- if (modifiedIndex == -1) {
- modifiedIndex = redrawItemIndex + 1;
- }
- redrawStartY = (redrawItemIndex - topIndex) * itemHeight;
- redrawStopY = (modifiedIndex - topIndex) * itemHeight;
- redraw(
- 0,
- redrawStartY,
- redrawItem.getCheckboxXPosition(), // only redraw up to and including hierarchy icon to avoid flashing
- redrawStopY - redrawStartY, false);
- }
- if (modifiedIndex == 0) { // added/removed first item ?
- redraw(0, 0, getClientArea().width, getItemHeight() * 2, false);// redraw new first two items to
- // fix vertical hierarchy line
- }
-}
-
-/**
- * Determine if part of the tree hierarchy needs to be redrawn.
- * The hierarchy icon of the parent item of 'item' needs to be redrawn if
- * 'item' is added as the first child or removed as the last child.
- * Hierarchy lines need to be redrawn if 'item' is the last in a series of
- * children.
- * @param item - tree item that is added or removed.
- * @return true=tree hierarchy needs to be redrawn. false=no redraw necessary
- */
-boolean redrawParentItem(SelectableItem item) {
- TreeItem parentItem = ((TreeItem) item).getParentItem();
- TreeItem parentItem2;
- boolean redraw = false;
-
- // determine if only the hierarchy icon needs to be redrawn
- if (parentItem != null) {
- parentItem2 = parentItem.getParentItem();
- if ((parentItem2 == null || parentItem2.getExpanded() == true) && parentItem.getChildren().size() < 2) {
- redraw = true;
- }
- }
- // redraw is only neccessary when the receiver is not currently
- // expanding 'item' or a parent item or if the parent item is expanded
- // or if the hierarchy icon of the parent item needs to be redrawn
- if (isExpandingItem(item) == false && parentItem == null || parentItem.getExpanded() == true || redraw == true) {
- redraw = true;
- }
- else {
- redraw = false;
- }
- return redraw;
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll() {
- checkWidget();
- setRedraw(false);
- getRoot().dispose();
- resetRoot();
- reset();
- calculateWidestShowingItem();
- calculateVerticalScrollbar();
- setRedraw(true);
-}
-/**
- * Remove 'item' from the receiver.
- * @param item - tree item that should be removed from the
- * receiver-must be a root item.
- */
-void removeItem(TreeItem item) {
- getRoot().removeItem(item);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener (SWT.Selection, listener);
- removeListener (SWT.DefaultSelection, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when items in the receiver are expanded or collapsed..
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #addTreeListener
- */
-public void removeTreeListener(TreeListener listener) {
- checkWidget();
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener (SWT.Expand, listener);
- removeListener (SWT.Collapse, listener);
-}
-/**
- * 'item' has been removed from the receiver.
- * Recalculate the content width.
- */
-void removedItem(SelectableItem item) {
- if (isExpandingItem(item) == false) {
- super.removedItem(item);
- }
- calculateWidestShowingItem();
- claimRightFreeSpace();
-}
-/**
- * Notification that 'item' is about to be removed from the tree.
- * Update the item selection if neccessary.
- * @param item - item that is about to be removed from the tree.
- */
-void removingItem(SelectableItem item) {
- Vector selection = getSelectionVector();
- TreeItem parentItem = ((TreeItem) item).getParentItem();
- TreeItem newSelectionItem = null;
- boolean isLastSelected = (selection.size() == 1) && (selection.elementAt(0) == item);
- int itemIndex = getVisibleIndex(item);
-
- if (isLastSelected == true) {
- // try selecting the following item
- newSelectionItem = (TreeItem) getVisibleItem(itemIndex + 1);
- if (newSelectionItem == null || newSelectionItem.getParentItem() != parentItem) {
- // select parent item if there is no item following the removed
- // one on the same tree level
- newSelectionItem = parentItem;
- }
- if (newSelectionItem != null) {
- selectNotify(newSelectionItem, true);
- }
- }
- super.removingItem(item);
- if (isExpandingItem(item) == false) {
- // redraw plus/minus image, hierarchy lines,
- // redrawing here assumes that no update happens between now and
- // after the item has actually been removed. Otherwise this call
- // would need to be in removedItem and we would need to store the
- // "itemIndex" here to redraw correctly.
- redrawAfterModify(item, itemIndex);
- }
-}
-/**
- * Reset the rectangle enclosing the hierarchy indicator to null.
- * Forces a recalculation next time getHierarchyIndicatorRect is called.
- */
-void resetHierarchyIndicatorRect() {
- hierarchyIndicatorRect = null;
-}
-/**
- * Reset state that is dependent on or calculated from the items
- * of the receiver.
- */
-void resetItemData() {
- setContentWidth(0);
- resetHierarchyIndicatorRect();
- super.resetItemData();
-}
-/**
- * Reset the object holding the root items of the receiver.
- */
-void resetRoot() {
- root = new TreeRoots(this);
-}
-/**
- * The receiver has been resized. Recalculate the content width.
- */
-void resize(Event event) {
- int oldItemCount = getVerticalBar().getPageIncrement();
-
- super.resize(event);
- if (getItemCountWhole() > oldItemCount) { // window resized higher?
- calculateWidestShowingItem(); // recalculate widest item since a longer item may be visible now
- }
-}
-/**
- * Display as many expanded tree items as possible.
- * Scroll the last expanded child to the bottom if all expanded
- * children can be displayed.
- * Otherwise scroll the expanded item to the top.
- * @param item - the tree item that was expanded
- */
-void scrollExpandedItemsIntoView(TreeItem item) {
- int itemCountOffScreen = getOffScreenItemCount(item);
- int newTopIndex = getTopIndex() + itemCountOffScreen;
-
- if (itemCountOffScreen > 0) {
- newTopIndex = Math.min(item.getVisibleIndex(), newTopIndex); // make sure the expanded item is never scrolled out of view
- setTopIndex(newTopIndex, true);
- }
-}
-/**
- * Scroll the items following the children of 'collapsedItem'
- * below 'collapsedItem' to cover the collapsed children.
- * @param collapsedItem - item that has been collapsed
- */
-void scrollForCollapse(TreeItem collapsedItem) {
- Rectangle clientArea = getClientArea();
- int topIndex = getTopIndex();
- int itemCount = collapsedItem.getVisibleItemCount();
- int scrollYPositions[] = calculateChildrenYPos(collapsedItem);
-
- if (scrollYPositions[0] == -1 && scrollYPositions[1] == -1) {
- return;
- }
- if (topIndex + getItemCountWhole() == getVisibleItemCount() && itemCount < topIndex) {
- // scroll from top if last item is at bottom and will stay at
- // bottom after collapse. Avoids flash caused by too much bit
- // blitting (which force update and thus premature redraw)
- int height = scrollYPositions[1] - scrollYPositions[0];
- scroll(
- 0, 0, // destination x, y
- 0, -height, // source x, y
- clientArea.width, scrollYPositions[0]+height, true);
- setTopIndexNoScroll(topIndex - itemCount, true);
- }
- else {
- scroll(
- 0, scrollYPositions[0], // destination x, y
- 0, scrollYPositions[1], // source x, y
- clientArea.width, clientArea.height - scrollYPositions[0], true);
- }
-}
-/**
- * Scroll the items following 'expandedItem' down to make
- * space for the children of 'expandedItem'.
- * @param expandedItem - item that has been expanded.
- */
-void scrollForExpand(TreeItem expandedItem) {
- int scrollYPositions[];
- Rectangle clientArea = getClientArea();
-
- expandedItem.internalSetExpanded(true);
- scrollYPositions = calculateChildrenYPos(expandedItem);
- expandedItem.internalSetExpanded(false);
- if (scrollYPositions[0] == -1 && scrollYPositions[1] == -1) {
- return;
- }
- scroll(
- 0, scrollYPositions[1], // destination x, y
- 0, scrollYPositions[0], // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Scroll horizontally by 'numPixel' pixel.
- * @param numPixel - the number of pixel to scroll
- * < 0 = columns are going to be moved left.
- * > 0 = columns are going to be moved right.
- */
-void scrollHorizontal(int numPixel) {
- Rectangle clientArea = getClientArea();
-
- scroll(
- numPixel, 0, // destination x, y
- 0, 0, // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Scroll vertically by 'scrollIndexCount' items.
- * @param scrollIndexCount - the number of items to scroll.
- * scrollIndexCount > 0 = scroll up. scrollIndexCount < 0 = scroll down
- */
-void scrollVertical(int scrollIndexCount) {
- Rectangle clientArea = getClientArea();
-
- scroll(
- 0, 0, // destination x, y
- 0, scrollIndexCount * getItemHeight(), // source x, y
- clientArea.width, clientArea.height, true);
-}
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll() {
- checkWidget();
- Vector selection = getSelectionVector();
-
- if (isMultiSelect() == true) {
- selection = getRoot().selectAll(selection);
- setSelectionVector(selection);
- }
-}
-/**
- * Set the item that is currently being expanded to 'item'.
- * Used for performance optimizations.
- */
-void setExpandingItem(TreeItem item) {
- expandingItem = item;
-}
-public void setFont(Font font) {
- checkWidget();
- Stack children = new Stack(); // traverse the tree depth first
- Enumeration elements;
- AbstractTreeItem item;
-
- if (font != null && font.equals(getFont()) == true) {
- return;
- }
- setRedraw(false); // disable redraw because itemChanged() triggers undesired redraw
- resetItemData();
- super.setFont(font);
-
- // Call itemChanged for all tree items
- elements = getRoot().getChildren().elements();
- while (elements.hasMoreElements() == true) {
- children.push(elements.nextElement());
- }
- while (children.empty() == false) {
- item = (AbstractTreeItem) children.pop();
- itemChanged(item, 0, getClientArea().width);
- elements = item.getChildren().elements();
- while (elements.hasMoreElements() == true) {
- children.push(elements.nextElement());
- }
- }
- setRedraw(true); // re-enable redraw
-}
-/**
- * Display a mark indicating the point at which an item will be inserted.
- * The drop insert item has a visual hint to show where a dragged item
- * will be inserted when dropped on the tree.
- *
- * @param item the insert item. Null will clear the insertion mark.
- * @param after true places the insert mark above 'item'. false places
- * the insert mark below 'item'.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setInsertMark(TreeItem item, boolean before){
- checkWidget();
- if (item != null && item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- motif_setInsertMark(item, !before);
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#deselectAll()
- */
-public void setSelection(TreeItem selectionItems[]) {
- checkWidget();
- if (selectionItems == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- setSelectableSelection(selectionItems);
-}
-/**
- * Set the index of the first visible item in the tree client area
- * to 'index'.
- * Scroll the new top item to the top of the tree.
- * @param index - 0-based index of the first visible item in the
- * tree's client area.
- * @param adjustScrollbar -
- * true = the vertical scroll bar is set to reflect the new top index.
- * false = the vertical scroll bar position is not modified.
- */
-void setTopIndex(int index, boolean adjustScrollbar) {
- int indexDiff = index-getTopIndex();
-
- super.setTopIndex(index, adjustScrollbar);
- calculateWidestScrolledItem(indexDiff);
-}
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled
- * and expanded until the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showSelection()
- */
-public void showItem(TreeItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- showSelectableItem(item);
-}
-/**
- * Make 'item' visible by expanding its parent items and scrolling
- * it into the receiver's client area if necessary.
- * An SWT.Expand event is going to be sent for every parent item
- * that is expanded to make 'item' visible.
- * @param item - the item that should be made visible to the
- * user.
- */
-void showSelectableItem(SelectableItem item) {
- if (item.getSelectableParent() != this) {
- return;
- }
- if (((TreeItem) item).isVisible() == false) {
- ((TreeItem) item).makeVisible();
- }
- super.showSelectableItem(item);
-}
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getItem(Point point) {
- int itemHeight;
- int hitItemIndex;
- TreeItem hitItem;
-
- if (getClientArea().contains(point) == false) {
- return null;
- }
- itemHeight = getItemHeight();
- hitItemIndex = point.y / itemHeight;
- hitItem = getRoot().getVisibleItem(hitItemIndex + getTopIndex());
- if (hitItem != null) {
- Point pt = new Point(point.x, point.y);
- pt.x -= hitItem.getPaintStartX();
- pt.y -= itemHeight * hitItemIndex;
- if (hitItem.isSelectionHit(pt) == false) {
- hitItem = null;
- }
- }
- return hitItem;
-}
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount() {
- checkWidget();
- return super.getSelectionCount();
-}
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showItem(TreeItem)
- */
-public void showSelection() {
- checkWidget();
- super.showSelection();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeItem.java
deleted file mode 100644
index d1f00acc98..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeItem.java
+++ /dev/null
@@ -1,1280 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a hierarchy of tree items in a tree widget.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TreeItem extends AbstractTreeItem {
-/*
- * This class caches geometric data for drawing.
- * A description of the cached data follows:
- *
- * | 1 || 5 |
- * | 2 | | 6 |
- * |3 7|
- * _____ | 4 |f| |8
- * | | ____
- * | - | ===== {image} root 9
- * |_____| |
- * |b|c| |d|
- * | e |
- *
- * Widths are measured between vertical lines.
- *
- * Cached item rendering data:
- * 1 = getDecorationsWidth
- * 2 = getHierarchyIndicatorRect
- * 3 = getPaintStartX
- * 4 = getItemConnectorWidth
- * 5 = getItemWidth
- * 6 = getSelectionWidth
- * 7 = getPaintStopX
- * 8 - getTextXPos
- * 9 = getTextYPosition
- *
- * Rendering constants:
- * 4 = DEFAULT_ITEM_CONNECTOR_WIDTH, used when no image is set in the tree.
- * Otherwise it is the image width.
- * b = IMAGE_PADDING
- * c = TEXT_INDENT
- * d = SELECTION_PADDING
- * e = ITEM_NOIMAGE_OFFSET
- * f = ITEM_CONNECTOR_PADDING;
- */
- private static final int DEFAULT_ITEM_CONNECTOR_WIDTH = 8; // Default width of the horizontal line connecting
- // items with the vertical lines. Only used when
- // no image is set in the tree. Normally connector
- // line width is half the image width.
- private static final int ITEM_CONNECTOR_PADDING = 2; // Added to the calculated item connector width
- private static final int IMAGE_PADDING = 3; // Space behind bitmap
- private static final int ITEM_NOIMAGE_OFFSET = 8; // Offset added to the calculated paint position where
- // an item starts drawing. To be used when no item
- // image has been set. Otherwise children would start
- // drawing at the end of the horizontal item connector
- // of their parent.
- private static final int ROOT_INDENT = 5; // Indent of root items
- private static final int SELECTION_PADDING = 2; // Space behind text
- private static final int TEXT_INDENT = 2; // Identation of the item label
-
- // basic item info
- private TreeItem parentItem;
- private int index; // index in the parent item
-
- // geometrical item info
- private int paintStartX = -1; // X coordinate of the upper-left corner of the
- // receivers bounding rectangle
- private Point itemExtent; // Size of the item (image + label)
- private Point imageExtent; // original size of the item image
- private int textYPosition = -1; // Centered y position of the item text
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem(Tree parent, int style) {
- this(parent, style, checkNull(parent).getItemCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem(Tree parent, int style, int index) {
- super(parent, style);
- parent.addItem(this, index);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem(TreeItem parentItem, int style) {
- this(parentItem, style, checkNull(parentItem).getItemCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem(TreeItem parentItem, int style, int index) {
- super(checkNull(parentItem).getParent(), style);
- setParentItem(parentItem);
- parentItem.add(this, index);
-}
-
-/**
- * Calculate the number of expanded children.
- * Recurse up in the tree to the root item.
- */
-void calculateVisibleItemCount() {
- Vector children;
- TreeItem child;
- int visibleItemCount = 0;
-
- // check isExpanded field directly for performance
- if (internalGetExpanded() == true) {
- children = getChildren();
- visibleItemCount = children.size();
- for (int i = 0; i < children.size(); i++) {
- child = (TreeItem) children.elementAt(i);
- visibleItemCount += child.getVisibleItemCount();
- }
- }
- setVisibleItemCount(visibleItemCount);
- calculateVisibleItemCountParent();
-}
-/**
- * Calculate the number of expanded children for the parent item
- * of this item.
- */
-void calculateVisibleItemCountParent() {
- TreeItem parentItem = getParentItem();
-
- if (parentItem != null) {
- parentItem.calculateVisibleItemCount();
- }
- else {
- getParent().getRoot().calculateVisibleItemCount();
- }
-}
-/**
- * Throw an SWT.ERROR_NULL_ARGUMENT exception if 'tree' is null.
- * Otherwise return 'tree'
- */
-static Tree checkNull(Tree tree) {
- if (tree == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return tree;
-}
-/**
- * Throw an SWT.ERROR_NULL_ARGUMENT exception if 'item' is null.
- * Otherwise return 'item'
- */
-static TreeItem checkNull(TreeItem item) {
- if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Draw the hierarchy indicator at 'position'.
- *
- * Note:
- * Assumes that the hierarchy indicators for the expanded and
- * collapsed state are the same size.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- * @return position to continue drawing
- */
-Point drawHierarchyIndicator(GC gc, Point position) {
- Tree parent = getParent();
- Image hierarchyImage;
- Rectangle indicatorRectangle = parent.getHierarchyIndicatorRect();
- int x = position.x;
- int y = position.y;
- int yCenter = y + parent.getItemHeight() / 2;
- Point connectorLinePosition;
-
- if (isLeaf() == false) {
- if (getExpanded() == true) {
- hierarchyImage = parent.getExpandedImage();
- }
- else {
- hierarchyImage = parent.getCollapsedImage();
- }
- if (hierarchyImage != null) {
- gc.drawImage(hierarchyImage, x + indicatorRectangle.x, y + indicatorRectangle.y);
- }
- connectorLinePosition = new Point(x + indicatorRectangle.width, yCenter);
- }
- else {
- connectorLinePosition = new Point(
- x + indicatorRectangle.width / 2
- + indicatorRectangle.width % 2, yCenter); // % 2 in order to not start the next hierarchy
- // component at the middle of the icon but after.
- }
- return connectorLinePosition;
-}
-/**
- * Draw a horizontal line connecting the item image (or label
- * if there is no image) to the vertical line connecting to
- * the parent.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- * @return position to continue drawing
- */
-Point drawHorizontalItemConnector(GC gc, Point position) {
- int itemConnectorEndPos = position.x + getItemConnectorWidth() - 1; // -1 because the position of the last pixel needs to be calculated
-
- gc.drawLine(position.x, position.y, itemConnectorEndPos, position.y);
- return new Point(itemConnectorEndPos + 1, position.y); // + 1 in order to resume drawing after line not on end of line
-}
-/**
- * Display the item image at 'position' using 'gc'.
- * @param gc - GC to draw on
- * @param position - position on the GC to draw at
- * @return position to continue drawing
- */
-Point drawImage(GC gc, Point destinationPosition) {
- Tree parent = getParent();
- Image image = getImage();
- Point sourceImageExtent;
- Point destinationImageExtent = parent.getImageExtent();
- int yCenter;
-
- if (image != null) {
- sourceImageExtent = getImageExtent();
- yCenter = (parent.getItemHeight() - destinationImageExtent.y) / 2;
- gc.drawImage(
- image,
- 0, 0, // source x, y
- sourceImageExtent.x, sourceImageExtent.y, // source width, height
- destinationPosition.x, destinationPosition.y + yCenter, // destination x, y
- destinationImageExtent.x, destinationImageExtent.y); // destination width, height
- }
- if (destinationImageExtent != null) {
- destinationPosition.x += destinationImageExtent.x + IMAGE_PADDING;
- }
- return destinationPosition;
-}
-/**
- * Draw a filled rectangle indicating the item selection state
- * The rectangle will be filled with the selection color if the
- * receiver is selected. Otherwise the rectangle will be filled
- * in the background color to remove the selection.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- */
-void drawSelection(GC gc, Point position) {
- Tree parent = getParent();
- Point selectionExtent = getSelectionExtent();
-
- if (selectionExtent == null) {
- return;
- }
- if (isSelected() == true) {
- gc.setBackground(getSelectionBackgroundColor());
- }
- gc.fillRectangle(position.x, position.y, selectionExtent.x, selectionExtent.y);
- if (isSelected() == true) {
- gc.setBackground(parent.getBackground());
- }
-}
-/**
- * Draw a rectangle enclosing the item label. The rectangle
- * indicates that the receiver was selected last and that it has
- * the input focus.
- * The rectangle will only be drawn if the receiver is selected.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- */
-void drawSelectionFocus(GC gc, Point position) {
- Point selectionExtent = getSelectionExtent();
-
- if (selectionExtent == null) {
- return;
- }
- if (getParent().hasFocus(this) == true) {
- gc.drawFocus(
- position.x, position.y,
- selectionExtent.x, selectionExtent.y);
- }
-}
-/**
- * Draw the item label at 'position' using 'gc'.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- */
-void drawText(GC gc, Point position) {
- Tree parent = getParent();
- String text = getText();
-
- if (text != null) {
- if (isSelected() == true) {
- gc.setBackground(getSelectionBackgroundColor());
- gc.setForeground(getSelectionForegroundColor());
- }
- gc.drawString(text, position.x, position.y);
- if (isSelected() == true) {
- gc.setBackground(parent.getBackground());
- gc.setForeground(parent.getForeground());
- }
- }
-}
-/**
- * Draw a vertical line connecting the horizontal connector line
- * with that of the previous item.
- * Called recursively to draw the lines on all tree levels.
- * @param gc - GC to draw on.
- * @param yPosition - y position of the upper side of the
- * receiver's bounding box.
- * @param isFirstChild - method is called to draw a vertical
- * line for the first child. Leave room for the hierarchy icon.
- */
-void drawVerticalItemConnector(GC gc, int yPosition, boolean isFirstChild) {
- Tree parent = getParent();
- TreeItem nextDrawItem = getParentItem();
- AbstractTreeItem parentItem = nextDrawItem;
- Rectangle indicatorRectangle = parent.getHierarchyIndicatorRect();
- int itemHeight = parent.getItemHeight();
- int itemHeightDiv2 = itemHeight / 2 + itemHeight % 2;
- int indicatorHeightDiv2 = indicatorRectangle.height / 2 + indicatorRectangle.height % 2;
- int lineX = getPaintStartX() + indicatorRectangle.width / 2;
- int lineStartY = yPosition - itemHeightDiv2;
- int lineEndY = yPosition + itemHeightDiv2;
-
- if (parentItem == null) {
- parentItem = parent.getRoot();
- }
- if (getIndex() != parentItem.getItemCount()-1) { // if item is not the last child
- if (isFirstChild == true) {
- lineStartY += indicatorHeightDiv2; // leave space for the hierarchy image
- }
- gc.drawLine(lineX, lineStartY, lineX, lineEndY);
- }
-
- if (nextDrawItem != null) {
- nextDrawItem.drawVerticalItemConnector(gc, yPosition, false);
- }
-}
-/**
- * Draw a vertical line connecting the horizontal connector line
- * with that of the previous item.
- * Do this on all tree levels up to the root level.
- * @param gc - GC to draw on.
- * @param position - position on the GC to draw at.
- * @return position to continue drawing
- */
-Point drawVerticalItemConnector(GC gc, Point position) {
- Tree parent = getParent();
- TreeItem parentItem = getParentItem();
- Rectangle indicatorRectangle = parent.getHierarchyIndicatorRect();
- int itemHeight = parent.getItemHeight();
- int itemHeightDiv2 = itemHeight / 2 + itemHeight % 2;
- int indicatorHeightDiv2 = indicatorRectangle.height / 2 + indicatorRectangle.height % 2;
- int lineX = position.x + indicatorRectangle.width / 2;
- int lineStartY = position.y - itemHeightDiv2;
- int lineEndY = position.y + itemHeightDiv2 - itemHeight % 2;
- TreeItem predecessor;
- boolean isFirstChild = false;
-
- if (isRoot() == true) {
- if (getIndex() == 0) {
- return position; // first root, don't draw vertical line
- }
- }
- else
- if (getIndex() == 0) { // if item is first child
- lineStartY += itemHeightDiv2;
- isFirstChild = true;
- }
- predecessor = getPredecessor();
- if (predecessor != null && predecessor.isLeaf() == false) {
- lineStartY += indicatorHeightDiv2; // leave space for the hierarchy image
- }
- if (isLeaf() == false) {
- lineEndY -= indicatorHeightDiv2;
- }
- gc.drawLine(lineX, lineStartY, lineX, lineEndY);
- if (parentItem != null) {
- parentItem.drawVerticalItemConnector(gc, position.y, isFirstChild);
- }
- return position;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds() {
- checkWidget();
- Tree parent = getParent();
- Point extent = getItemExtent();
- int x = getTextXPos() - TEXT_INDENT;
-
- return new Rectangle(x, parent.getRedrawY(this), extent.x - (x - getItemStartX()), extent.y);
-}
-
-/**
- * Answer the x position of the item check box
- */
-int getCheckboxXPosition() {
- return getPaintStartX() + getDecorationsWidth();
-}
-/**
- * Answer the combined width of the hierarchy indicator and
- * the horizontal item connector line.
- */
-int getDecorationsWidth() {
- int indicatorWidth = getParent().getHierarchyIndicatorRect().width;
- int width = indicatorWidth + getItemConnectorWidth();
-
- if (isLeaf() == true) {
- width -= indicatorWidth / 2;
- }
- return width;
-}
-/**
- * Answer the index of the receiver relative to the first root
- * item.
- * @return
- * The index of the receiver relative to the first root item.
- */
-int getGlobalIndex() {
- int globalItemIndex = getIndex();
- AbstractTreeItem item = null;
-
- if (isRoot() == false) {
- item = getParentItem();
- globalItemIndex++; // adjust for 0-based non-root items
- }
- else {
- item = getParent().getRoot();
- }
-
- globalItemIndex += item.getVisibleIndex(getIndex());
- return globalItemIndex;
-}
-/**
- * Answer the original size of the image of the receiver.
- */
-Point getImageExtent() {
- Image image = getImage();
- Rectangle imageBounds;
-
- if (imageExtent == null && image != null) {
- imageBounds = image.getBounds();
- imageExtent = new Point(imageBounds.width, imageBounds.height);
- }
- return imageExtent;
-}
-/**
- * Answer the receiver's index into its parent's list of children
- */
-int getIndex() {
- return index;
-}
-/**
- * Answer the width of the horizontal item connector line.
- */
-int getItemConnectorWidth() {
- Tree parent = getParent();
- Point imageExtent = parent.getImageExtent();
- int itemConnectorWidth;
- int indicatorWidth = parent.getHierarchyIndicatorRect().width;
-
- if (imageExtent != null) {
- itemConnectorWidth = imageExtent.x / 2 + ITEM_CONNECTOR_PADDING;
- }
- else {
- itemConnectorWidth = DEFAULT_ITEM_CONNECTOR_WIDTH;
- }
- if (isLeaf() == false) { // has children = has hierarchy indicator = shorter connector
- itemConnectorWidth -= indicatorWidth / 2;
- }
- return itemConnectorWidth;
-}
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount() {
- checkWidget();
- return super.getItemCount();
-}
-/**
- * Answer the size of the receiver as displayed on the screen.
- */
-Point getItemExtent() {
- Tree parent;
- Point imageExtent;
- String text;
- int itemWidth;
-
- if (itemExtent == null) {
- parent = getParent();
- imageExtent = parent.getImageExtent();
- text = getText();
- itemWidth = SELECTION_PADDING;
- if (text != null) {
- itemWidth += parent.getTextWidth(text) + TEXT_INDENT;
- }
- if (imageExtent != null) {
- itemWidth += imageExtent.x + IMAGE_PADDING;
- }
- itemExtent = new Point(itemWidth, parent.getItemHeight());
- }
- return itemExtent;
-}
-/**
- * Answer the x position at which painting of the receiver's
- * contents (ie. image, text) can begin.
- */
-int getItemStartX() {
- int itemStartX = getPaintStartX() + getDecorationsWidth();
-
- if (isCheckable() == true) {
- itemStartX += getCheckboxBounds().width + CHECKBOX_PADDING;
- }
- return itemStartX;
-}
-/**
- * Returns an array of <code>TreeItem</code>s which are the
- * direct item children of the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems() {
- checkWidget();
- TreeItem childrenArray[] = new TreeItem[getItemCount()];
-
- getChildren().copyInto(childrenArray);
- return childrenArray;
-}
-/**
- * Answer the x position where the receiver is drawn.
- */
-int getPaintStartX() {
- Tree parent = getParent();
- Point imageExtent;
- TreeItem parentItem;
-
- if (paintStartX == -1) {
- if (isRoot() == true) {
- paintStartX = ROOT_INDENT;
- }
- else {
- parentItem = getParentItem();
- // subtract parent.getHorizontalOffset() to calculate the cached start
- // position independent of the horizontal scroll offset. Fixes 1G1L7EU.
- paintStartX = parentItem.getPaintStartX()
- - parent.getHorizontalOffset()
- + parentItem.getDecorationsWidth()
- - parent.getHierarchyIndicatorRect().width / 2;
- imageExtent = parent.getImageExtent();
- if (imageExtent != null) {
- paintStartX += imageExtent.x / 2;
- }
- else {
- paintStartX += ITEM_NOIMAGE_OFFSET;
- }
- }
- }
- return paintStartX + parent.getHorizontalOffset();
-}
-/**
- * Answer the pixel at which the receiver stops drawing.
- */
-int getPaintStopX() {
- return (getItemStartX() + getItemExtent().x - getParent().getHorizontalOffset());
-}
-/**
- * Returns the receiver's parent, which must be a <code>Tree</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Tree getParent() {
- checkWidget();
- return (Tree) super.getSelectableParent();
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem() {
- checkWidget();
- return parentItem;
-}
-/**
- * Answer the item that directly precedes the receiver.
- * Answer null if this is the first item in a hierarchy level
- * or if there are expanded children in the previous item.
- */
-TreeItem getPredecessor() {
- AbstractTreeItem parentItem = getParentItem();
- Vector children;
- int previousIndex = getIndex() - 1;
- TreeItem previousItem = null;
-
- if (parentItem == null) {
- parentItem = getParent().getRoot();
- }
- if (previousIndex >= 0) {
- children = parentItem.getChildren();
- previousItem = (TreeItem) children.elementAt(previousIndex);
- if (previousItem.isLeaf() == false && previousItem.getExpanded() == true) {
- previousItem = null; // no immediate predecessor because there are expanded children
- }
- }
- return previousItem;
-}
-/**
- * Answer the size of the rectangle drawn to indicate the
- * selected state of the receiver.
- * This is also used to draw the selection focus rectangle.
- */
-Point getSelectionExtent() {
- Point selectionExtent = getItemExtent();
- Point imageExtent = getParent().getImageExtent();
- int x = selectionExtent.x;
-
- if (imageExtent != null) {
- x -= imageExtent.x + IMAGE_PADDING;
- }
- return new Point(x, selectionExtent.y);
-}
-/**
- * Return the x position of the selection rectangle
- */
-int getSelectionX() {
- return getTextXPos() - TEXT_INDENT;
-}
-/**
- * Answer the x position where the receiver draws the item text.
- * This position is relative to the item start position.
- */
-int getTextXPos() {
- Point imageExtent = getParent().getImageExtent();
- int textXPos = getItemStartX() + TEXT_INDENT;
-
- if (imageExtent != null) {
- textXPos += imageExtent.x + IMAGE_PADDING;
- }
- return textXPos;
-}
-/**
- * Answer the y position of the receiver's text.
- * @param
- * gc - GC to use for calculating the text y position
- */
-int getTextYPosition(GC gc) {
- String text;
-
- if (textYPosition == -1) {
- text = getText();
- if (text != null) {
- textYPosition = (getParent().getItemHeight() - gc.stringExtent(text).y) / 2;
- }
- else {
- textYPosition = 0;
- }
- }
- return textYPosition;
-}
-/**
- * Answer the index of the receiver relative to the first root
- * item.
- * If 'anIndex' is the index of the expanded item 'anItem'
- * then the following expressions are true:
- * 'anItem == theRoot.getVisibleItem(anIndex)' and
- * 'anIndex == anItem.getVisibleIndex()'
- * @return
- * The index of the receiver relative to the first root item.
- * Answer -1 if the receiver is not visible (because the parent
- * is collapsed).
- */
-int getVisibleIndex() {
- int visibleItemIndex = getIndex();
- AbstractTreeItem item = null;
-
- if (isRoot() == false) {
- if (isVisible() == false) {
- return -1;
- }
- item = getParentItem();
- visibleItemIndex++; // adjust for 0-based non-root items
- }
- else {
- item = getParent().getRoot();
- }
-
- visibleItemIndex += item.getVisibleIndex(getIndex());
- return visibleItemIndex;
-}
-/**
- * Answer the index of the child item identified by 'childIndex'
- * relative to the first root item.
- */
-int getVisibleIndex(int childIndex) {
- Enumeration children = getChildren().elements();
- TreeItem child;
- int visibleItemIndex = getIndex();
-
- if (isRoot() == false) {
- visibleItemIndex++; // adjust for 0-based non-root items
- }
-
- while (children.hasMoreElements() == true) {
- child = (TreeItem) children.nextElement();
- if (child.getIndex() == childIndex) {
- if (isRoot() == false) {
- visibleItemIndex += getParentItem().getVisibleIndex(getIndex());
- }
- else {
- visibleItemIndex += getParent().getRoot().getVisibleIndex(getIndex());
- }
- break;
- }
- visibleItemIndex += child.getVisibleItemCount();
- }
- return visibleItemIndex;
-}
-/**
- * Answer the item at 'searchIndex' relativ to the receiver.
- * When this method is called for the root item, 'searchIndex'
- * represents the global index into all items of the tree.
- * searchIndex=0 returns the receiver.
- * searchIndex=1 returns the first visible child.
- * Note: searchIndex must be >= 0
- *
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. Visible here means that all
- * the parents of the item are expanded. An item is only
- * visible on screen if it is within the widget client area.
- */
-TreeItem getVisibleItem(int searchIndex) {
- TreeItem child;
- TreeItem foundItem = null;
- Enumeration children = getChildren().elements();
-
- if (searchIndex == 0) {
- return this;
- }
- else
- if (getExpanded() == false) { // trying to find a child when this item isn't expanded ?
- return null;
- }
-
- // Search for expanded items first. Count all subitems in the process.
- while (children.hasMoreElements() == true && foundItem == null) {
- child = (TreeItem) children.nextElement();
- searchIndex--;
- if (child.getExpanded() == true) {
- searchIndex -= child.getVisibleItemCount(); // count children of all expanded items
- }
- if (searchIndex <= 0) { // is searched item past child ?
- // add back children of current item (that's what we want to search)
- foundItem = child.getVisibleItem(searchIndex + child.getVisibleItemCount());
- }
- }
-
- return foundItem;
-}
-/**
- * Answer whether 'item' is a child, direct or indirect, of the receiver.
- * It is an indirect child if it is a child of one of the receiver's children.
- */
-boolean isChild(TreeItem item) {
- Vector children = getChildren();
- TreeItem child;
-
- if (children.contains(item) == true) {
- return true;
- }
- for (int i = 0; i < children.size(); i++) {
- child = (TreeItem) children.elementAt(i);
- if (child.isChild(item) == true) {
- return true;
- }
- }
- return false;
-}
-/**
- * Answer whether the receiver is a root item.
- * The receiver is a root item when it does not have a parent item.
- * @return
- * true - the receiver is a root item.
- * false - the receiver is not a root item.
- */
-boolean isRoot() {
- return (getParentItem() == null);
-}
-/**
- * Answer whether the click at 'position' on the receiver is a selection
- * click.
- * @param position - location of the mouse click relative to the
- * upper left corner of the receiver.
- * @return true - receiver was clicked.
- * false - receiver was not clicked.
- */
-boolean isSelectionHit(Point position) {
- Point itemExtent = getItemExtent();
-
- if (itemExtent == null) { // neither image nor text have been set
- return false;
- }
- return (new Rectangle(
- getItemStartX() - getPaintStartX(), 0,
- itemExtent.x, itemExtent.y)).contains(position);
-}
-/**
- * Answer whether the receiver is visible
- * An item is visible when its parent item is visible and
- * expanded. Root items are always visible.
- *
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. Visible here means that all
- * the parents of the item are expanded. An item is only
- * visible on screen if it is within the receiver's parent's
- * client area.
- * @return
- * true - the receiver is visible
- * false - the receiver is not visible
- */
-boolean isVisible() {
- boolean isVisible = true;
- TreeItem parentItem = getParentItem();
-
- if (isRoot() == false) {
- isVisible = parentItem.getExpanded();
- if (isVisible == true) {
- isVisible = parentItem.isVisible();
- }
- }
- return isVisible;
-}
-/**
- * Make this item visible by expanding its parent item.
- */
-void makeVisible() {
- TreeItem parentItem = getParentItem();
-
- if (isVisible() == false && parentItem != null) {
- getParent().expand(parentItem, true); // have to call Tree.expand directly in order to trigger Expand event
- parentItem.makeVisible();
- }
-}
-/**
- * Draw the receiver at 'yPosition' in the client area of the parent.
- * @param gc - GC to draw on.
- * @param yPosition - y coordinate where the receiver should draw at.
- */
-void paint(GC gc, int yPosition) {
- Tree parent = getParent();
- Point paintPosition = new Point(getPaintStartX(), yPosition);
-
- if (isVisible() == false) {
- return;
- }
- gc.setForeground(parent.CONNECTOR_LINE_COLOR);
- paintPosition = drawVerticalItemConnector(gc, paintPosition);
- paintPosition = drawHierarchyIndicator(gc, paintPosition);
- paintPosition = drawHorizontalItemConnector(gc, paintPosition);
- gc.setForeground(parent.getForeground());
- // paint the rest
- if (isCheckable() == true) {
- paintPosition = drawCheckbox(gc, new Point(paintPosition.x, yPosition));
- }
- paintPosition = drawImage(gc, new Point(paintPosition.x, yPosition));
- drawSelection(gc, paintPosition);
- if (this == parent.getInsertItem()) {
- drawInsertMark(gc, paintPosition);
- }
- drawText(gc, new Point(getTextXPos(), paintPosition.y + getTextYPosition(gc)));
- drawSelectionFocus(gc, paintPosition);
-}
-/**
- * Update the display to reflect the expanded state of the
- * receiver.
- * @param itemIndex - index position in the receiver's client
- * area where should be drawn.
- */
-void redrawExpanded(int itemIndex) {
- Tree parent = getParent();
- int indicatorWidth = parent.getHierarchyIndicatorRect().width;
- int itemHeight = parent.getItemHeight();
-
- parent.redraw(
- getPaintStartX(), itemIndex * itemHeight,
- indicatorWidth, itemHeight, false);
-}
-/**
- * Reset cached size and position data.
- */
-void reset() {
- super.reset();
- setImageExtent(null);
- setItemExtent(null);
- setPaintStartX(-1);
- setTextYPosition(-1);
-}
-/**
- * Sets the expanded state of the receiver.
- * <p>
- *
- * @param expanded the new expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setExpanded(boolean expand) {
- checkWidget();
- if (isLeaf() == false && expand == true) {
- getParent().expand(this, false);
- }
- else {
- getParent().collapse(this, false);
- }
-}
-public void setImage(Image newImage) {
- checkWidget();
- Tree parent = getParent();
- Image oldImage = getImage();
- boolean isSameImage;
- int imageWidth = 0;
- int redrawX = 0;
-
- super.setImage(newImage);
- if (newImage != null && oldImage != null) {
- isSameImage = newImage.equals(oldImage);
- }
- else {
- isSameImage = newImage == oldImage;
- }
- if (isSameImage == false) {
- if (parent.getVisibleRedrawY(this) != -1) {
- if (parent.getImageExtent() != null) {
- imageWidth = parent.getImageExtent().x;
- }
- else
- if (newImage != null) {
- imageWidth = newImage.getBounds().x;
- }
- redrawX = getItemStartX();
- }
- parent.itemChanged(this, redrawX, imageWidth);
- }
-}
-/**
- * Set the size of the original image of the receiver to 'imageExtent'.
- */
-void setImageExtent(Point imageExtent) {
- this.imageExtent = imageExtent;
-}
-/**
- * Set the index of the receiver to 'index'.
- * This index is used to reference children in their parent.
- */
-void setIndex(int index) {
- this.index = index;
-}
-/**
- * Set the size of the receiver to 'extent'.
- */
-void setItemExtent(Point extent) {
- itemExtent = extent;
-}
-/**
- * Set the x position where the receiver is drawn to 'startX'.
- * @param startX - the x position where the receiver is drawn
- */
-void setPaintStartX(int startX) {
- paintStartX = startX;
-}
-/**
- * Set the parent item of the receiver to 'parentItem'.
- * @param parentItem - the receiver's parent item.
- * Receiver is a root if this is null.
- */
-void setParentItem(TreeItem parentItem) {
- this.parentItem = parentItem;
-}
-/**
- * This label will be displayed to the right of the bitmap,
- * or, if the receiver doesn't have a bitmap to the right of
- * the horizontal hierarchy connector line.
- */
-public void setText(String newText) {
- checkWidget();
- Tree parent = getParent();
- String oldText = getText();
- int redrawX = 0;
- int redrawWidth = 0;
-
- if (newText == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- super.setText(newText);
- if (newText.equals(oldText) == false) {
- if (parent.getVisibleRedrawY(this) != -1) {
- redrawX = getTextXPos();
- redrawWidth = parent.getClientArea().width - redrawX;
- }
- parent.itemChanged(this, redrawX, redrawWidth);
- }
-}
-/**
- * Set the y position of the receiver's text to 'yPosition'.
- */
-void setTextYPosition(int yPosition) {
- textYPosition = yPosition;
-}
-
-public void dispose() {
- if (isDisposed()) return;
- // if the tree is being disposed don't bother collapsing the item since all
- // items in the tree will be deleted and redraws will not be processed anyway
- Tree parent = getParent();
- if (parent.isRemovingAll() == false) {
- parent.collapseNoRedraw(this);
- }
-
- if (parentItem != null) {
- parentItem.removeItem(this);
- }
- else {
- parent.removeItem(this);
- }
-
- super.dispose();
-}
-
-void doDispose() {
- // Notify the parent that the receiver is being removed.
- // Reset cached data.
- setParentItem(null);
- setImageExtent(null);
- setItemExtent(null);
- setIndex(-1);
- setPaintStartX(-1);
- setTextYPosition(-1);
-
- super.doDispose();
-}
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked() {
- checkWidget();
- return super.getChecked();
-}
-public Display getDisplay() {
- return super.getDisplay();
-}
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed() {
- checkWidget();
- return super.getGrayed();
-}
-/**
- * Sets the checked state of the receiver.
- * <p>
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked(boolean checked) {
- checkWidget();
- super.setChecked(checked);
-}
-/**
- * Sets the grayed state of the receiver.
- * <p>
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
- super.setGrayed(grayed);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeRoots.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeRoots.java
deleted file mode 100644
index 9674177baf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeRoots.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * This class is used to store tree root items.
- * Instances of this class are never displayed.
- */
-class TreeRoots extends AbstractTreeItem {
-/**
- * Create a tree item that holds one or more root items
- * @param parent - Tree widget the receiver belongs to
- */
-TreeRoots(Tree parent) {
- super(parent, 0);
- initialize();
-}
-/**
- * Calculate the number of expanded children.
- * Recurse up in the tree to the root item.
- */
-void calculateVisibleItemCount() {
- Vector children = getChildren();
- TreeItem child;
- int visibleItemCount = children.size();
-
- for (int i = 0; i < children.size(); i++) {
- child = (TreeItem) children.elementAt(i);
- visibleItemCount += child.getVisibleItemCount();
- }
- setVisibleItemCount(visibleItemCount);
-}
-/**
- * Calculate the number of expanded children for the parent item
- * of this item.
- */
-void calculateVisibleItemCountParent() {}
-
-public void dispose() {
- if (isDisposed()) return;
- Tree parent = (Tree) getSelectableParent();
-
- // all tree items are removed so we don't need to do
- // time consuming screen updates for each removed item
- parent.setRemovingAll(true);
- super.dispose();
- parent.setRemovingAll(false);
-}
-/**
- * Answer the x position of the item check box
- */
-int getCheckboxXPosition() {
- return 0;
-}
-/**
- * Implements SelectableItem#getSelectionExtent
- * Should never be called since objects of this type are never
- * rendered
- */
-Point getSelectionExtent() {
- return new Point(0, 0);
-}
-/**
- * Implements SelectableItem#getSelectionX
- * Should never be called since objects of this type are never
- * rendered
- */
-int getSelectionX() {
- return 0;
-}
-/**
- * Always answer -1 to indicate that the receiver is not visible.
- */
-int getVisibleIndex() {
- return -1;
-}
-/**
- * Answer the index of the child item identified by 'childIndex'
- * relative to the first root item.
- */
-int getVisibleIndex(int childIndex) {
- Enumeration children = getChildren().elements();
- TreeItem child;
- int globalItemIndex = 0;
-
- while (children.hasMoreElements() == true) {
- child = (TreeItem) children.nextElement();
- if (child.getIndex() == childIndex) {
- break;
- }
- globalItemIndex += child.getVisibleItemCount();
- }
- return globalItemIndex;
-}
-/**
- * Answer the item at 'searchIndex' relativ to the receiver.
- * When this method is called for the root item, 'searchIndex'
- * represents the global index into all items of the tree.
- * searchIndex=0 returns the receiver.
- * searchIndex=1 returns the first visible child.
- * Note: searchIndex must be >= 0
- *
- * Note:
- * Visible in this context does not neccessarily mean that the
- * item is displayed on the screen. Visible here means that all
- * the parents of the item are expanded. An item is only
- * visible on screen if it is within the widget client area.
- */
-TreeItem getVisibleItem(int searchIndex) {
- TreeItem child;
- TreeItem foundItem = null;
- Enumeration children = getChildren().elements();
-
- searchIndex++; // skip this fake root item
-
- // Search for expanded items first. Count all subitems in the process.
- while (children.hasMoreElements() == true && foundItem == null) {
- child = (TreeItem) children.nextElement();
- searchIndex--;
- if (child.internalGetExpanded() == true) {
- searchIndex -= child.getVisibleItemCount(); // count children of all expanded items
- }
- if (searchIndex <= 0) { // is searched item past child ?
- // add back children of current item (that's what we want to search)
- foundItem = child.getVisibleItem(searchIndex + child.getVisibleItemCount());
- }
- }
- return foundItem;
-}
-/**
- * Initialize the receiver
- */
-void initialize() {
- internalSetExpanded(true);
-}
-
-/**
- * Select the receiver and all children
- */
-Vector selectAll(Vector selectedItems) {
- Enumeration children = getChildren().elements();
- AbstractTreeItem treeItem;
-
- while (children.hasMoreElements() == true) {
- treeItem = (AbstractTreeItem) children.nextElement();
- selectedItems = treeItem.selectAll(selectedItems);
- }
- return selectedItems;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
deleted file mode 100644
index e796d2151c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class manage the operating system resources that
- * implement SWT's RGB color model. To create a color you can either
- * specify the individual color components as integers in the range
- * 0 to 255 or provide an instance of an <code>RGB</code>.
- * <p>
- * Application code must explicitly invoke the <code>Color.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see RGB
- */
-public final class Color {
- /**
- * the handle to the OS color resource
- * (Warning: This field is platform dependent)
- */
- public GdkColor handle;
- Device display;
-Color() {
-}
-/**
- * Constructs a new instance of this class given a device and the
- * desired red, green and blue values expressed as ints in the range
- * 0 to 255 (where 0 is black and 255 is full brightness). On limited
- * color devices, the color instance created by this call may not have
- * the same RGB values as the ones specified by the arguments. The
- * RGB values on the returned instance will be the color values of
- * the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color(Device display, int red, int green, int blue) {
- init(display, red, green, blue);
-}
-/**
- * Constructs a new instance of this class given a device and an
- * <code>RGB</code> describing the desired red, green and blue values.
- * On limited color devices, the color instance created by this call
- * may not have the same RGB values as the ones specified by the
- * argument. The RGB values on the returned instance will be the color
- * values of the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param RGB the RGB values of the desired color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
- * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color(Device display, RGB rgb) {
- if (rgb == null) error(SWT.ERROR_NULL_ARGUMENT);
- init(display, rgb.red, rgb.green, rgb.blue);
-}
-/**
- * Disposes of the operating system resources associated with
- * the color. Applications must dispose of all colors which
- * they allocate.
- */
-public void dispose() {
- /**
- * If this is a palette-based display,
- * Decrease the reference count for this color.
- * If the reference count reaches 0, the slot may
- * be reused when another color is allocated.
- */
- if (display.colorRefCount != null) {
- if (--display.colorRefCount[handle.pixel] == 0) {
- display.gdkColors[handle.pixel] = null;
- }
- }
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_colors_free(colormap, new int[] { handle.pixel }, 1, 0);
- this.display = null;
- this.handle = null;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Color)) return false;
- Color color = (Color)object;
- GdkColor xColor = color.handle;
- return (handle.pixel == xColor.pixel)&&(handle.red == xColor.red) && (handle.green == xColor.green) && (handle.blue == xColor.blue) && (this.display == color.display);
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns the amount of blue in the color, from 0 to 255.
- *
- * @return the blue component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getBlue() {
- return (handle.blue >> 8) & 0xFF;
-}
-/**
- * Returns the amount of green in the color, from 0 to 255.
- *
- * @return the green component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getGreen() {
- return (handle.green >> 8) & 0xFF;
-}
-/**
- * Returns the amount of red in the color, from 0 to 255.
- *
- * @return the red component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getRed() {
- return (handle.red >> 8) & 0xFF;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle.red ^ handle.green ^ handle.blue;
-}
-/**
- * Returns an <code>RGB</code> representing the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public RGB getRGB () {
- return new RGB(getRed(), getGreen(), getBlue());
-}
-
-void init(Device display, int red, int green, int blue) {
- if (display == null) display = Display.getDefault();
- this.display = display;
- handle = new GdkColor();
- handle.red = (short)((red & 0xFF) | ((red & 0xFF) << 8));
- handle.green = (short)((green & 0xFF) | ((green & 0xFF) << 8));
- handle.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8));
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_color_alloc(colormap, handle);
- if (display.colorRefCount != null) {
- // Make a copy of the color to put in the colors array
- GdkColor colorCopy = new GdkColor();
- colorCopy.red = handle.red;
- colorCopy.green = handle.green;
- colorCopy.blue = handle.blue;
- colorCopy.pixel = handle.pixel;
- display.gdkColors[colorCopy.pixel] = colorCopy;
- display.colorRefCount[colorCopy.pixel]++;
- }
-}
-/**
- * Returns <code>true</code> if the color has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the color.
- * When a color has been disposed, it is an error to
- * invoke any other method using the color.
- *
- * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == null;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
-}
-
-public static Color gtk_new(GdkColor gdkColor) {
- Color color = new Color(null, gtk_getRGBIntensities(gdkColor));
- return color;
-}
-
-static RGB gtk_getRGBIntensities(GdkColor gdkColor) {
- boolean intensitiesAreZero = (gdkColor.red==0) && (gdkColor.green==0) && (gdkColor.blue==0);
- if (!intensitiesAreZero) return new RGB ((gdkColor.red&0xFF00)>>8,
- (gdkColor.green&0xFF00)>>8,
- (gdkColor.blue&0xFF00)>>8 );
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
-
- int r = (gdkColor.pixel&visual.red_mask) >> visual.red_shift;
- if (visual.red_prec<8) r = r << (8 - visual.red_prec);
- else r = r >> (visual.red_prec - 8);
- int g = (gdkColor.pixel&visual.green_mask) >> visual.green_shift;
- if (visual.green_prec<8) g = g << (8 - visual.green_prec);
- else g = g >> (visual.green_prec - 8);
- int b = (gdkColor.pixel&visual.blue_mask) >> visual.blue_shift;
- if (visual.blue_prec<8) b = b << (8 - visual.blue_prec);
- else b = b >> (visual.blue_prec - 8);
-
- return new RGB(r, g, b);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
deleted file mode 100644
index 52658518c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.image.*;
-
-/**
- * Instances of this class manage operating system resources that
- * specify the appearance of the on-screen pointer. To create a
- * cursor you specify the device and either a simple cursor style
- * describing one of the standard operating system provided cursors
- * or the image and mask data for the desired appearance.
- * <p>
- * Application code must explicitly invoke the <code>Cursor.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>
- * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
- * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
- * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
- * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
- * </dd>
- * </dl>
- */
-public final class Cursor {
- /**
- * the handle to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-Cursor () {
-}
-/**
- * Constructs a new cursor given a device and a style
- * constant describing the desired cursor appearance.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param style the style of cursor to allocate
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
- * </ul>
- *
- * @see Cursor for the supported style values
- */
-public Cursor(Device display, int style) {
- int osFlag = 0;
- switch (style) {
- case SWT.CURSOR_ARROW:
- osFlag = OS.GDK_LEFT_PTR;
- break;
- case SWT.CURSOR_WAIT:
- osFlag = OS.GDK_WATCH;
- break;
- case SWT.CURSOR_CROSS:
- osFlag = OS.GDK_CROSS;
- break;
- case SWT.CURSOR_APPSTARTING:
- osFlag = OS.GDK_WATCH;
- break;
- case SWT.CURSOR_HAND:
- osFlag = OS.GDK_HAND1;
- break;
- case SWT.CURSOR_HELP:
- osFlag = OS.GDK_QUESTION_ARROW;
- break;
- case SWT.CURSOR_SIZEALL:
- osFlag = OS.GDK_DIAMOND_CROSS;
- break;
- case SWT.CURSOR_SIZENESW:
- osFlag = OS.GDK_SIZING;
- break;
- case SWT.CURSOR_SIZENS:
- osFlag = OS.GDK_DOUBLE_ARROW;
- break;
- case SWT.CURSOR_SIZENWSE:
- osFlag = OS.GDK_SIZING;
- break;
- case SWT.CURSOR_SIZEWE:
- osFlag = OS.GDK_SB_H_DOUBLE_ARROW;
- break;
- case SWT.CURSOR_SIZEN:
- osFlag = OS.GDK_TOP_SIDE;
- break;
- case SWT.CURSOR_SIZES:
- osFlag = OS.GDK_BOTTOM_SIDE;
- break;
- case SWT.CURSOR_SIZEE:
- osFlag = OS.GDK_RIGHT_SIDE;
- break;
- case SWT.CURSOR_SIZEW:
- osFlag = OS.GDK_LEFT_SIDE;
- break;
- case SWT.CURSOR_SIZENE:
- osFlag = OS.GDK_TOP_RIGHT_CORNER;
- break;
- case SWT.CURSOR_SIZESE:
- osFlag = OS.GDK_BOTTOM_RIGHT_CORNER;
- break;
- case SWT.CURSOR_SIZESW:
- osFlag = OS.GDK_BOTTOM_LEFT_CORNER;
- break;
- case SWT.CURSOR_SIZENW:
- osFlag = OS.GDK_TOP_LEFT_CORNER;
- break;
- case SWT.CURSOR_UPARROW:
- osFlag = OS.GDK_SB_UP_ARROW;
- break;
- case SWT.CURSOR_IBEAM:
- osFlag = OS.GDK_XTERM;
- break;
- case SWT.CURSOR_NO:
- osFlag = OS.GDK_X_CURSOR;
- break;
- default:
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.handle = OS.gdk_cursor_new(osFlag);
-}
-/**
- * Constructs a new cursor given a device, image and mask
- * data describing the desired cursor appearance, and the x
- * and y co-ordinates of the <em>hotspot</em> (that is, the point
- * within the area covered by the cursor which is considered
- * to be where the on-screen pointer is "pointing").
- * <p>
- * The mask data is allowed to be null, but in this case the source
- * must be an ImageData representing an icon that specifies both
- * color data and mask data.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param source the color data for the cursor
- * @param mask the mask data for the cursor (or null)
- * @param hotspotX the x coordinate of the cursor's hotspot
- * @param hotspotY the y coordinate of the cursor's hotspot
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
- * size, or either is not of depth one, or if the hotspot is outside
- * the bounds of the image</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
- * </ul>
- */
-public Cursor(Device display, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
- if (source == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) {
- if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) error(SWT.ERROR_NULL_ARGUMENT);
- mask = source.getTransparencyMask();
- }
- /* Check the bounds. Mask must be the same size as source */
- if (mask.width != source.width || mask.height != source.height) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Check depths */
- if (mask.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
- if (source.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
- /* Check the hotspots */
- if (hotspotX >= source.width || hotspotX < 0 ||
- hotspotY >= source.height || hotspotY < 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /* Swap the bits if necessary */
- byte[] sourceData = new byte[source.data.length];
- byte[] maskData = new byte[mask.data.length];
- /* Swap the bits in each byte */
- byte[] data = source.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- sourceData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- sourceData[i] = (byte) ~sourceData[i];
- }
- data = mask.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- maskData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- maskData[i] = (byte) ~maskData[i];
- }
-
- int sourcePixmap = OS.gdk_bitmap_create_from_data(0, sourceData, source.width, source.height);
- if (sourcePixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
- int maskPixmap = OS.gdk_bitmap_create_from_data(0, maskData, source.width, source.height);
- if (maskPixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* Get the colors */
- GdkColor foreground = new GdkColor();
- foreground.red = 0;
- foreground.green = 0;
- foreground.blue = 0;
- GdkColor background = new GdkColor();
- background.red = (short)65535;
- background.green = (short)65535;
- background.blue = (short)65535;
-
- /* Create the cursor */
- /* For some reason, mask and source take reverse roles, both here and on Motif */
- handle = OS.gdk_cursor_new_from_pixmap (maskPixmap, sourcePixmap, foreground, background, hotspotX, hotspotY);
- /* Dispose the pixmaps */
- OS.gdk_pixmap_unref (sourcePixmap);
- OS.gdk_pixmap_unref (maskPixmap);
- if (handle == 0) error(SWT.ERROR_NO_HANDLES);
-}
-/**
- * Disposes of the operating system resources associated with
- * the cursor. Applications must dispose of all cursors which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_cursor_destroy(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- return (object == this) || ((object instanceof Cursor) && (handle == ((Cursor)object).handle));
-}
-void error(int code) {
- throw new SWTError(code);
-}
-public static Cursor gtk_new(int handle) {
- Cursor cursor = new Cursor();
- cursor.handle = handle;
- return cursor;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the cursor has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the cursor.
- * When a cursor has been disposed, it is an error to
- * invoke any other method using the cursor.
- *
- * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return "Cursor {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java
deleted file mode 100644
index 952fa9d404..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-
-class DefaultGtkStyle {
-
- private static DefaultGtkStyle instance = null;
- private GtkStyle style = null;
- private int defaultFont;
-
- public Color foregroundColorNORMAL() {
- return new Color(null,
- ((short)0xFF00 & style.fg0_red)>>8,
- ((short)0xFF00 & style.fg0_green)>>8,
- ((short)0xFF00 & style.fg0_blue)>>8);
- }
-
- public Color backgroundColorNORMAL() {
- return new Color(null,
- ((short)0xFF00 & style.bg0_red)>>8,
- ((short)0xFF00 & style.bg0_green)>>8,
- ((short)0xFF00 & style.bg0_blue)>>8);
- }
-
- public Color foregroundColorACTIVE() {
- return new Color(null,
- ((short)0xFF00 & style.fg1_red)>>8,
- ((short)0xFF00 & style.fg1_green)>>8,
- ((short)0xFF00 & style.fg1_blue)>>8);
- }
-
- public Color backgroundColorACTIVE() {
- return new Color(null,
- ((short)0xFF00 & style.bg1_red)>>8,
- ((short)0xFF00 & style.bg1_green)>>8,
- ((short)0xFF00 & style.bg1_blue)>>8);
- }
-
- public Color foregroundColorPRELIGHT() {
- return new Color(null,
- ((short)0xFF00 & style.fg2_red)>>8,
- ((short)0xFF00 & style.fg2_green)>>8,
- ((short)0xFF00 & style.fg2_blue)>>8);
- }
-
- public Color backgroundColorPRELIGHT() {
- return new Color(null,
- ((short)0xFF00 & style.bg2_red)>>8,
- ((short)0xFF00 & style.bg2_green)>>8,
- ((short)0xFF00 & style.bg2_blue)>>8);
- }
-
- public Color foregroundColorSELECTED() {
- return new Color(null,
- ((short)0xFF00 & style.fg3_red)>>8,
- ((short)0xFF00 & style.fg3_green)>>8,
- ((short)0xFF00 & style.fg3_blue)>>8);
- }
-
- public Color backgroundColorSELECTED() {
- return new Color(null,
- ((short)0xFF00 & style.bg3_red)>>8,
- ((short)0xFF00 & style.bg3_green)>>8,
- ((short)0xFF00 & style.bg3_blue)>>8);
- }
-
- public Color foregroundColorINSENSITIVE() {
- return new Color(null,
- ((short)0xFF00 & style.fg4_red)>>8,
- ((short)0xFF00 & style.fg4_green)>>8,
- ((short)0xFF00 & style.fg4_blue)>>8);
- }
-
- public Color backgroundColorINSENSITIVE() {
- return new Color(null,
- ((short)0xFF00 & style.bg4_red)>>8,
- ((short)0xFF00 & style.bg4_green)>>8,
- ((short)0xFF00 & style.bg4_blue)>>8);
- }
-
- public int loadDefaultFont() {
- if (defaultFont == 0) {
- int fnames = Font.getFontNameList(style.font);
- int slength = OS.g_slist_length(fnames);
- if (slength < 1) SWT.error(SWT.ERROR_UNSPECIFIED);
- int name1 = OS.g_slist_nth_data(fnames, 0);
- int length = OS.strlen(name1);
- byte [] buffer1 = new byte[length];
- OS.memmove(buffer1, name1, length);
- defaultFont = OS.gdk_font_load(buffer1);
- if (defaultFont==0) SWT.error(SWT.ERROR_UNSPECIFIED);
- GdkFont gdkFont = new GdkFont();
- OS.memmove(gdkFont, defaultFont, GdkFont.sizeof);
- if (gdkFont.type != OS.GDK_FONT_FONT) SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- return defaultFont;
- }
-
- public static DefaultGtkStyle instance() {
- if (instance==null) instance = new DefaultGtkStyle();
- return instance;
- }
-
- private DefaultGtkStyle() {
- style = new GtkStyle();
- OS.memmove(style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- }
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
deleted file mode 100644
index 5140074d6d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ /dev/null
@@ -1,556 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-public abstract class Device implements Drawable {
-
- /* Debugging */
- public static boolean DEBUG;
- boolean debug = DEBUG;
- boolean tracking = DEBUG;
- Error [] errors;
- Object [] objects;
-
- /* Colormap and reference count */
- GdkColor [] gdkColors;
- int [] colorRefCount;
-
- /* Disposed flag */
- boolean disposed;
-
- /* Warning and Error Handlers */
- int logProc;
- Callback logCallback;
- String [] log_domains = {"Gtk", /*"Gdk", "GLib", "GdkPixbuf"*/};
- int [] handler_ids = new int [log_domains.length];
- boolean warnings = true;
-
- /*
- * The following colors are listed in the Windows
- * Programmer's Reference as the colors in the default
- * palette.
- */
- Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE;
- Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED;
- Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE;
-
- /*
- * TEMPORARY CODE. When a graphics object is
- * created and the device parameter is null,
- * the current Display is used. This presents
- * a problem because SWT graphics does not
- * reference classes in SWT widgets. The correct
- * fix is to remove this feature. Unfortunately,
- * too many application programs rely on this
- * feature.
- *
- * This code will be removed in the future.
- */
- protected static Device CurrentDevice;
- protected static Runnable DeviceFinder;
- static {
- try {
- Class.forName ("org.eclipse.swt.widgets.Display");
- } catch (Throwable e) {}
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static Device getDevice () {
- if (DeviceFinder != null) DeviceFinder.run();
- Device device = CurrentDevice;
- CurrentDevice = null;
- return device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * You must dispose the device when it is no longer required.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #create
- * @see #init
- * @see DeviceData
- */
-public Device(DeviceData data) {
- if (data != null) {
- debug = data.debug;
- tracking = data.tracking;
- }
- create (data);
- init ();
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
- }
-}
-
-protected void checkDevice () {
- if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-protected void create (DeviceData data) {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver. After this method has been invoked, the receiver
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- *
- * @see #release
- * @see #destroy
- * @see #checkDevice
- */
-public void dispose () {
- if (isDisposed()) return;
- checkDevice ();
- release ();
- destroy ();
- disposed = true;
- if (tracking) {
- objects = null;
- errors = null;
- }
-}
-
-void dispose_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == object) {
- objects [i] = null;
- errors [i] = null;
- return;
- }
- }
-}
-
-protected void destroy () {
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return new Rectangle(0, 0, 0, 0);
-}
-
-/**
- * Returns a <code>DeviceData</code> based on the receiver.
- * Modifications made to this <code>DeviceData</code> will not
- * affect the receiver.
- *
- * @return a <code>DeviceData</code> containing the device's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see DeviceData
- */
-public DeviceData getDeviceData () {
- checkDevice();
- DeviceData data = new DeviceData ();
- data.debug = debug;
- data.tracking = tracking;
- int count = 0, length = 0;
- if (tracking) length = objects.length;
- for (int i=0; i<length; i++) {
- if (objects [i] != null) count++;
- }
- int index = 0;
- data.objects = new Object [count];
- data.errors = new Error [count];
- for (int i=0; i<length; i++) {
- if (objects [i] != null) {
- data.objects [index] = objects [i];
- data.errors [index] = errors [i];
- index++;
- }
- }
- return data;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- */
-public Rectangle getClientArea () {
- checkDevice ();
- return getBounds ();
-}
-
-/**
- * Returns the bit depth of the screen, which is the number of
- * bits it takes to represent the number of unique colors that
- * the screen is currently capable of displaying. This number
- * will typically be one of 1, 8, 15, 16, 24 or 32.
- *
- * @return the depth of the screen
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getDepth () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return 0;
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return new Point (72, 72);
-}
-
-/**
- * Returns <code>FontData</code> objects which describe
- * the fonts which match the given arguments. If the
- * <code>faceName</code> is null, all fonts will be returned.
- *
- * @param faceName the name of the font to look for, or null
- * @param scalable true if scalable fonts should be returned.
- * @return the matching font data
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData [] getFontList (String faceName, boolean scalable) {
- checkDevice ();
- String xlfd;
- if (faceName == null) {
- xlfd = "-*";
- } else {
- int dashIndex = faceName.indexOf('-');
- if (dashIndex < 0) {
- xlfd = "-*-" + faceName + "-*";
- } else {
- xlfd = "-" + faceName + "-*";
- }
- }
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, xlfd, true);
- int [] ret = new int [1];
- int listPtr = OS.XListFonts (buffer1, 65535, ret);
- int ptr = listPtr;
- int [] intBuf = new int [1];
- FontData [] fd = new FontData [ret [0]];
- int fdIndex = 0;
- for (int i = 0; i < ret [0]; i++) {
- OS.memmove (intBuf, ptr, 4);
- int charPtr = intBuf [0];
- int length = OS.strlen (charPtr);
- byte [] buffer2 = new byte [length];
- OS.memmove (buffer2, charPtr, length);
- /* Use the character encoding for the default locale */
- char [] chars = Converter.mbcsToWcs (null, buffer2);
- FontData data = FontData.gtk_new (new String (chars));
- boolean isScalable = data.averageWidth == 0 && data.pixels == 0 && data.points == 0;
- if (isScalable == scalable) {
- fd [fdIndex++] = data;
- }
- ptr += 4;
- }
- // FIXME, leaking font list
-// OS.XFreeFontNames (listPtr);
- if (fdIndex == ret [0]) return fd;
- FontData [] result = new FontData [fdIndex];
- System.arraycopy (fd, 0, result, 0, fdIndex);
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- switch (id) {
- case SWT.COLOR_BLACK: return COLOR_BLACK;
- case SWT.COLOR_DARK_RED: return COLOR_DARK_RED;
- case SWT.COLOR_DARK_GREEN: return COLOR_DARK_GREEN;
- case SWT.COLOR_DARK_YELLOW: return COLOR_DARK_YELLOW;
- case SWT.COLOR_DARK_BLUE: return COLOR_DARK_BLUE;
- case SWT.COLOR_DARK_MAGENTA: return COLOR_DARK_MAGENTA;
- case SWT.COLOR_DARK_CYAN: return COLOR_DARK_CYAN;
- case SWT.COLOR_GRAY: return COLOR_GRAY;
- case SWT.COLOR_DARK_GRAY: return COLOR_DARK_GRAY;
- case SWT.COLOR_RED: return COLOR_RED;
- case SWT.COLOR_GREEN: return COLOR_GREEN;
- case SWT.COLOR_YELLOW: return COLOR_YELLOW;
- case SWT.COLOR_BLUE: return COLOR_BLUE;
- case SWT.COLOR_MAGENTA: return COLOR_MAGENTA;
- case SWT.COLOR_CYAN: return COLOR_CYAN;
- case SWT.COLOR_WHITE: return COLOR_WHITE;
- }
- return COLOR_BLACK;
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return null;
-}
-
-/**
- * Returns <code>true</code> if the underlying window system prints out
- * warning messages on the console, and <code>setWarnings</code>
- * had previously been called with <code>true</code>.
- *
- * @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getWarnings () {
- checkDevice ();
- return this.warnings;
-}
-
-protected void init () {
-
- /* Create GTK warnings and error callbacks */
- logCallback = new Callback (this, "logProc", 4);
- logProc = logCallback.getAddress ();
- if (logProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- /* Set GTK warning and error handlers */
- if (debug) {
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<log_domains.length; i++) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- handler_ids [i] = OS.g_log_set_handler (log_domain, flags, logProc, 0);
- }
- }
-
- /* Create the standard colors */
- COLOR_BLACK = new Color (this, 0,0,0);
- COLOR_DARK_RED = new Color (this, 0x80,0,0);
- COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
- COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
- COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
- COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
- COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
- COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
- COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
- COLOR_RED = new Color (this, 0xFF,0,0);
- COLOR_GREEN = new Color (this, 0,0xFF,0);
- COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
- COLOR_BLUE = new Color (this, 0,0,0xFF);
- COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
- COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
- COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public abstract int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public abstract void internal_dispose_GC (int handle, GCData data);
-
-/**
- * Returns <code>true</code> if the device has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the device.
- * When a device has been disposed, it is an error to
- * invoke any other method using the device.
- *
- * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return disposed;
-}
-
-int logProc (int log_domain, int log_level, int message, int user_data) {
- if (DEBUG || (debug && warnings)) {
- new Error ().printStackTrace ();
- OS.g_log_default_handler (log_domain, log_level, message, 0);
- }
- return 0;
-}
-
-void new_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == null) {
- objects [i] = object;
- errors [i] = new Error ();
- return;
- }
- }
- Object [] newObjects = new Object [objects.length + 128];
- System.arraycopy (objects, 0, newObjects, 0, objects.length);
- newObjects [objects.length] = object;
- objects = newObjects;
- Error [] newErrors = new Error [errors.length + 128];
- System.arraycopy (errors, 0, newErrors, 0, errors.length);
- newErrors [errors.length] = new Error ();
- errors = newErrors;
-}
-
-protected void release () {
- if (gdkColors != null) {
- int colormap = OS.gdk_colormap_get_system();
- int [] pixel = new int [1];
- for (int i = 0; i < gdkColors.length; i++) {
- GdkColor color = gdkColors [i];
- if (color != null) {
- while (colorRefCount [i] > 0) {
- OS.gdk_color_free(color);
- --colorRefCount [i];
- }
- }
- }
- }
- gdkColors = null;
- colorRefCount = null;
- COLOR_BLACK = COLOR_DARK_RED = COLOR_DARK_GREEN = COLOR_DARK_YELLOW = COLOR_DARK_BLUE =
- COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED =
- COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
-
- /* Free the GTK error and warning handler */
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<handler_ids.length; i++) {
- if (handler_ids [i] != 0) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- OS.g_log_remove_handler (log_domain, handler_ids [i]);
- }
- }
- logCallback.dispose (); logCallback = null;
- handler_ids = null; log_domains = null;
- logProc = 0;
-}
-
-/**
- * If the underlying window system supports printing warning messages
- * to the console, setting warnings to <code>true</code> prevents these
- * messages from being printed. If the argument is <code>false</code>
- * message printing is not blocked.
- *
- * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setWarnings (boolean warnings) {
- checkDevice ();
- this.warnings = warnings;
- if (debug) return;
- for (int i=0; i<handler_ids.length; i++) {
- if (handler_ids [i] != 0) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- OS.g_log_remove_handler (log_domain, handler_ids [i]);
- }
- }
- if (warnings) {
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<log_domains.length; i++) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- handler_ids [i] = OS.g_log_set_handler (log_domain, flags, logProc, 0);
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java
deleted file mode 100644
index 4ed07ebc16..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DeviceData {
- /*
- * Motif only fields.
- */
- public String display_name;
- public String application_name;
- public String application_class;
-
- /*
- * Debug fields - may not be honoured
- * on some SWT platforms.
- */
- public boolean debug;
- public boolean tracking;
- public Error [] errors;
- public Object [] objects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
deleted file mode 100644
index b5a0c1e158..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class manage operating system resources that
- * define how text looks when it is displayed. Fonts may be constructed
- * by providing a device and either name, size and style information
- * or a <code>FontData</code> object which encapsulates this data.
- * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see FontData
- */
-public final class Font {
- /**
- * the handle to the OS font resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-Font() {
-}
-/**
- * Constructs a new font given a device and font data
- * which describes the desired font's appearance.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param fd the FontData that describes the desired font (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
- * </ul>
- */
-public Font(Device display, FontData fd) {
- if (fd == null) error(SWT.ERROR_NULL_ARGUMENT);
-
- String xlfd = fd.getXlfd();
- byte[] buffer = Converter.wcsToMbcs(null, xlfd, true);
- handle = OS.gdk_font_load(buffer);
- if (handle == 0) {
- int hStyle = OS.gtk_widget_get_default_style();
- GtkStyle gtkStyle = new GtkStyle();
- OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
- handle = OS.gdk_font_ref(gtkStyle.font);
- }
-}
-/**
- * Constructs a new font given a device, a font name,
- * the height of the desired font in points, and a font
- * style.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
- * </ul>
- */
-public Font(Device display, String fontFamily, int height, int style) {
- if (fontFamily == null) error(SWT.ERROR_NULL_ARGUMENT);
- FontData fd = new FontData(fontFamily, height, style);
- byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
- handle = OS.gdk_font_load(buffer);
- if (handle == 0) {
- int hStyle = OS.gtk_widget_get_default_style();
- GtkStyle gtkStyle = new GtkStyle();
- OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
- handle = OS.gdk_font_ref(gtkStyle.font);
- }
-}
-/**
- * Disposes of the operating system resources associated with
- * the font. Applications must dispose of all fonts which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_font_unref(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Font)) return false;
- return OS.gdk_font_equal(handle, ((Font)object).handle);
-}
-void error(int code) {
- throw new SWTError (code);
-}
-
-/**
- * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however,
- * a <code>Font</code> object <em>may</em> be composed of multiple X
- * fonts. To support this case, we return an array of font data objects.
- *
- * @return an array of font data objects describing the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData[] getFontData() {
- int index=0;
- int fnames = getFontNameList(handle);
- int nfonts = OS.g_slist_length(fnames);
- FontData[] answer = new FontData[nfonts];
- for (int i=0; i<nfonts; i++) {
- FontData data = new FontData();
-
- int name = OS.g_slist_nth_data(fnames, index);
- int length = OS.strlen(name);
- byte [] buffer1 = new byte[length];
- OS.memmove(buffer1, name, length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String fontname = new String (buffer2, 0, buffer2.length);
- data.setXlfd(fontname);
-
- // Wild guess, 'a' looks average enough
- data.averageWidth = OS.gdk_char_width(handle, (byte)'a');
-
- // Wild guess, a progressive font should probably have A wider than l
- int widthA = OS.gdk_char_width(handle, (byte)'A');
- int widthl = OS.gdk_char_width(handle, (byte)'l');
- if (widthA == widthl) data.spacing = "m";
- else data.spacing = "p";
-
- answer[i] = data;
- }
- return answer;
-}
-static int getFontNameList(int handle) {
- int[] mem = new int[7];
- OS.memmove(mem, handle, 7*4);
- int type = mem[0];
- int ascent = mem[1];
- int descent = mem[2];
- int xfont =mem [3];
- int xdisplay = mem[4];
- int ref_count = mem[5];
- int names = mem[6];
- return names;
-}
-public static Font gtk_new(int handle) {
- Font font = new Font();
- font.handle = handle;
- return font;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the font has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the font.
- * When a font has been disposed, it is an error to
- * invoke any other method using the font.
- *
- * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return "Font {" + handle + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
deleted file mode 100644
index 5915c07c64..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
+++ /dev/null
@@ -1,547 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe operating system fonts.
- * Only the public API of this type is platform independent.
- * <p>
- * For platform-independent behaviour, use the get and set methods
- * corresponding to the following properties:
- * <dl>
- * <dt>height</dt><dd>the height of the font in points</dd>
- * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
- * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
- * </dl>
- * If extra, platform-dependent functionality is required:
- * <ul>
- * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
- * corresponds to a Windows <code>LOGFONT</code> structure whose fields
- * may be retrieved and modified.</li>
- * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * </ul>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- *
- * @see Font
- */
-public final class FontData {
- /**
- * The company that produced the font
- * Warning: This field is platform dependent.
- */
- public String foundry;
- /**
- * The common name of the font
- * Warning: This field is platform dependent.
- */
- public String fontFamily;
- /**
- * The weight ("normal", "bold")
- * Warning: This field is platform dependent.
- */
- public String weight;
- /**
- * The slant ("o" for oblique, "i" for italic)
- * Warning: This field is platform dependent.
- */
- public String slant;
- /**
- * The set width of the font
- * Warning: This field is platform dependent.
- */
- public String setWidth;
- /**
- * Additional font styles
- * Warning: This field is platform dependent.
- */
- public String addStyle;
- /**
- * The height of the font in pixels
- * Warning: This field is platform dependent.
- */
- public int pixels;
- /**
- * The height of the font in tenths of a point
- * Warning: This field is platform dependent.
- */
- public int points;
- /**
- * The horizontal screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int horizontalResolution;
- /**
- * The vertical screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int verticalResolution;
- /**
- * The font spacing ("m" for monospace, "p" for proportional)
- * Warning: This field is platform dependent.
- */
- public String spacing;
- /**
- * The average character width for the font
- * Warning: This field is platform dependent.
- */
- public int averageWidth;
- /**
- * The ISO character set registry
- * Warning: This field is platform dependent.
- */
- public String characterSetRegistry;
- /**
- * The ISO character set name
- * Warning: This field is platform dependent.
- */
- public String characterSetName;
- /**
- * The locales of the font
- * (Warning: These fields are platform dependent)
- */
- String lang, country, variant;
-
-/**
- * Constructs a new un-initialized font data.
- */
-public FontData () {
-}
-/**
- * Constructs a new FontData given a string representation
- * in the form generated by the <code>FontData.toString</code>
- * method.
- * <p>
- * Note that the representation varies between platforms,
- * and a FontData can only be created from a string that was
- * generated on the same platform.
- * </p>
- *
- * @param string the string representation of a <code>FontData</code> (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
- * </ul>
- *
- * @see #toString
- */
-public FontData(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- int start = 0;
- int end = string.indexOf('|');
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- String version1 = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- String name = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- int height = 0;
- try {
- height = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- int style = 0;
- try {
- style = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String platform = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String version2 = string.substring(start, end);
-
- if (platform.equals("MOTIF") && version2.equals("1")) {
- start = end + 1;
- end = string.length();
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String xlfd = string.substring(start, end);
- setXlfd(xlfd);
- return;
- }
- setName(name);
- setHeight(height);
- setStyle(style);
-}
-/**
- * Constructs a new font data given a font name,
- * the height of the desired font in points,
- * and a font style.
- *
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- */
-public FontData(String name, int height, int style) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
- points = height * 10;
- if ((style & SWT.BOLD) != 0) {
- weight = "bold";
- } else {
- weight = "medium";
- }
- if ((style & SWT.ITALIC) != 0) {
- slant = "i";
- } else {
- slant = "r";
- }
-}
-
-
-
-/*
- * Public getters
- */
-
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight
- */
-public int getHeight() {
- return points / 10;
-}
-
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this <code>FontData</code>
- *
- * @see #setName
- */
-public String getName() {
- StringBuffer buffer = new StringBuffer();
- if (foundry != null) {
- buffer.append(foundry);
- buffer.append("-");
- }
- if (fontFamily != null) buffer.append(fontFamily);
- return buffer.toString();
-}
-
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the <code>SWT</code> constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this <code>FontData</code>
- *
- * @see #setStyle
- */
-public int getStyle() {
- int style = 0;
- if (weight.equals("bold"))
- style |= SWT.BOLD;
- if (slant.equals("i"))
- style |= SWT.ITALIC;
- return style;
-}
-
-/**
- * We need this in FontDialog, so we can't just get rid of it or make it private.
- */
-public String gtk_getXlfd() { return getXlfd(); }
-
-String getXlfd() {
- String s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
- s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = s12 = s13 = s14 = "*";
-
- if (foundry != null) s1 = foundry;
- if (fontFamily != null) s2 = fontFamily;
- if (weight != null) s3 = weight;
- if (slant != null) s4 = slant;
- if (setWidth != null) s5 = setWidth;
- if (addStyle != null) s6 = addStyle;
- if (pixels != 0) s7 = Integer.toString(pixels);
- if (points != 0) s8 = Integer.toString(points);
- if (horizontalResolution != 0) s9 = Integer.toString(horizontalResolution);
- if (verticalResolution != 0) s10 = Integer.toString(verticalResolution);
- if (spacing != null) s11 = spacing;
-// The following line has been intentionally commented.
-// we don not know the exact average width as in the font definition,
-// so if someone tries to get a similar font, they'd get something weird
-// if (averageWidth != 0) s12 = Integer.toString(averageWidth);
- if (characterSetRegistry != null) s13 = characterSetRegistry;
- if (characterSetName != null) s14 = characterSetName;
-
- String xlfd = "-" + s1+ "-" + s2 + "-" + s3 + "-" + s4 + "-" + s5 + "-" + s6 + "-" + s7 + "-" + s8 + "-"
- + s9 + "-" + s10 + "-" + s11 + "-" + s12 + "-" + s13 + "-" + s14;
- return xlfd;
-}
-public static FontData gtk_new(String xlfd) {
- FontData fontData = new FontData();
- fontData.setXlfd(xlfd);
- return fontData;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return getXlfd().hashCode();
-}
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the <code>FontData</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- *
- * @see #getHeight
- */
-public void setHeight(int height) {
- if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
- points = height * 10;
-}
-
-/**
- * Sets the locale of the receiver.
- * <p>
- * The locale determines which platform character set this
- * font is going to use. Widgets and graphics operations that
- * use this font will convert UNICODE strings to the platform
- * character set of the specified locale.
- * </p>
- * <p>
- * On platforms which there are multiple character sets for a
- * given language/country locale, the variant portion of the
- * locale will determine the character set.
- * </p>
- *
- * @param locale the <code>String</code> representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(String locale) {
- lang = country = variant = null;
- if (locale != null) {
- char sep = '_';
- int length = locale.length();
- int firstSep, secondSep;
-
- firstSep = locale.indexOf(sep);
- if (firstSep == -1) {
- firstSep = secondSep = length;
- } else {
- secondSep = locale.indexOf(sep, firstSep + 1);
- if (secondSep == -1) secondSep = length;
- }
- if (firstSep > 0) lang = locale.substring(0, firstSep);
- if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
- if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
- }
-}
-/**
- * Sets the name of the receiver.
- * <p>
- * Some platforms support font foundries. On these platforms, the name
- * of the font specified in setName() may have one of the following forms:
- * <ol>
- * <li>a face name (for example, "courier")</li>
- * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
- * </ol>
- * In either case, the name returned from getName() will include the
- * foundry.
- * </p>
- * <p>
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in <code>setName()</code> and
- * <code>getName()</code>.
- * </p>
- *
- * @param name the name of the font data (must not be null)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * </ul>
- *
- * @see #getName
- */
-public void setName(String name) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
-}
-/**
- * Sets the style of the receiver to the argument which must
- * be a bitwise OR of one or more of the <code>SWT</code>
- * constants NORMAL, BOLD and ITALIC.
- *
- * @param style the new style for this <code>FontData</code>
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- if ((style & SWT.BOLD) == SWT.BOLD)
- weight = "bold";
- else
- weight = "medium";
- if ((style & SWT.ITALIC) == SWT.ITALIC)
- slant = "i";
- else
- slant = "r";
-}
-void setXlfd(String xlfd) {
- int start, stop;
- start = 1;
- stop = xlfd.indexOf ("-", start);
- foundry = xlfd.substring(start, stop);
- if (foundry.equals("*")) foundry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- fontFamily = xlfd.substring(start, stop);
- if (fontFamily.equals("*")) fontFamily = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- weight = xlfd.substring(start, stop);
- if (weight.equals("*")) weight = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- slant = xlfd.substring(start, stop);
- if (slant.equals("*")) slant = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- setWidth = xlfd.substring(start, stop);
- if (setWidth.equals("*")) setWidth = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- addStyle = xlfd.substring(start, stop);
- if (addStyle.equals("*")) addStyle = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- String s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- pixels = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- points = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- horizontalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- verticalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- spacing = xlfd.substring(start, stop);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- averageWidth = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetRegistry = xlfd.substring(start, stop);
- if (characterSetRegistry.equals("*")) characterSetRegistry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetName = xlfd.substring(start);
- if (characterSetName.equals("*")) characterSetName = null;
-}
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * <code>FontData(String)</code> constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public String toString() {
- return "1|" + fontFamily + "|" + getHeight() + "|" + getStyle() + "|" +
- "GTK|1|" + getXlfd();
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof FontData) &&
- getXlfd().equals(((FontData)object).getXlfd()));
-}
-void error(int code) {
- throw new SWTError(code);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java
deleted file mode 100644
index b1bd432690..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * <code>FontMetrics</code> are obtained from <code>GC</code>s
- * using the <code>getFontMetrics()</code> method.
- *
- * @see GC#getFontMetrics
- */
-
-public final class FontMetrics {
- int ascent, descent, averageCharWidth, leading, height;
-FontMetrics() {
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontMetrics)) return false;
- FontMetrics metrics = (FontMetrics)object;
- return ascent == metrics.ascent && descent == metrics.descent &&
- averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
- height == metrics.height;
-}
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's <em>ascent</em> is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return ascent;
-}
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- return averageCharWidth;
-}
-/**
- * Returns the descent of the font described by the receiver. A
- * font's <em>descent</em> is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return descent;
-}
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's <em>height</em> is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return height;
-}
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's <em>leading area</em> is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return leading;
-}
-public static FontMetrics gtk_new(int fontHandle) {
- GdkFont f = new GdkFont();
- OS.memmove (f, fontHandle, GdkFont.sizeof);
-
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.ascent = f.ascent;
- fontMetrics.descent = f.descent;
- fontMetrics.averageCharWidth = OS.gdk_char_width(fontHandle, (byte)'a');
- fontMetrics.leading = 3;
- fontMetrics.height = fontMetrics.ascent+fontMetrics.descent+3;
- return fontMetrics;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
deleted file mode 100644
index 24374928a3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ /dev/null
@@ -1,1759 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.*;
-
-
-/**
- * Class <code>GC</code> is where all of the drawing capabilities that are
- * supported by SWT are located. Instances are used to draw on either an
- * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
- * <p>
- * Application code must explicitly invoke the <code>GC.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required. This is <em>particularly</em>
- * important on Windows95 and Windows98 where the operating system has a limited
- * number of device contexts available.
- * </p>
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-public final class GC {
- /**
- * the handle to the OS device context
- * (Warning: This field is platform dependent)
- */
- public int handle;
- Drawable drawable;
- GCData data;
-
-
-/*
- * === Constructors ===
- */
-
-GC() {
-}
-
-/**
- * Constructs a new instance of this class which has been
- * configured to draw on the specified drawable. Sets the
- * foreground and background color in the GC to match those
- * in the drawable.
- * <p>
- * You must dispose the graphics context when it is no longer required.
- * </p>
- * @param drawable the drawable to draw on
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
- * <li>ERROR_INVALID_ARGUMENT
- * - if the drawable is an image that is not a bitmap or an icon
- * - if the drawable is an image or printer that is already selected
- * into another graphics context</li>
- * </ul>
- */
-public GC(Drawable drawable) {
- if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- data = new GCData();
- handle = drawable.internal_new_GC(data);
- this.drawable = drawable;
-
- // The colors we get from the widget are not always right.
- // Get the default GTK_STATE_NORMAL colors
- setBackground( DefaultGtkStyle.instance().backgroundColorNORMAL() );
- setForeground( DefaultGtkStyle.instance().foregroundColorNORMAL() );
-
-
- // Feature in GDK.
- // Sometimes, gdk_gc_new() doesn't get the font from the control,
- // and also, some controls don't contain a font; so when the GC
- // was created in internal_new_gc(), the font might or might not
- // be set; if the font isn't there, just fall back to default.
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- if (values.font == 0) {
- OS.gdk_gc_set_font(handle, DefaultGtkStyle.instance().loadDefaultFont() );
- }
-
- if (data.image != null) {
- data.image.memGC = this;
- /*
- * The transparent pixel mask might change when drawing on
- * the image. Destroy it so that it is regenerated when
- * necessary.
- */
- //if (image.transparentPixel != -1) image.destroyMask();
- }
-
-}
-
-
-
-/**
- * Returns the background color.
- *
- * @return the receiver's background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Access - Get/Set ===
- */
-
-public Color getBackground() {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- GdkColor gdkColor = _getBackgroundGdkColor();
- return Color.gtk_new(gdkColor);
-}
-/**
- * Sets the background color. The background color is used
- * for fill operations and as the background color when text
- * is drawn.
- *
- * @param color the new background color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- OS.gdk_gc_set_background(handle, color.handle);
-}
-
-/**
- * Returns the receiver's foreground color.
- *
- * @return the color used for drawing foreground things
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getForeground() {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- GdkColor gdkColor = _getForegroundGdkColor();
- return Color.gtk_new(gdkColor);
-}
-
-/**
- * Sets the foreground color. The foreground color is used
- * for drawing operations including when text is drawn.
- *
- * @param color the new foreground color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setForeground(Color color) {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
- OS.gdk_gc_set_foreground(handle, color.handle);
-}
-
-
-
-
-
-
-
-/**
- * Returns the <em>advance width</em> of the specified character in
- * the font which is currently selected into the receiver.
- * <p>
- * The advance width is defined as the horizontal distance the cursor
- * should move after printing the character in the selected font.
- * </p>
- *
- * @param ch the character to measure
- * @return the distance in the x direction to move past the character before painting the next
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Access - Get - Calculated ===
- */
-
-public int getAdvanceWidth(char ch) {
- byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
- return OS.gdk_char_width(_getGCFont(), charBuffer[0]);
-}
-/**
- * Returns the width of the specified character in the font
- * selected into the receiver.
- * <p>
- * The width is defined as the space taken up by the actual
- * character, not including the leading and tailing whitespace
- * or overhang.
- * </p>
- *
- * @param ch the character to measure
- * @return the width of the character
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getCharWidth(char ch) {
- byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
- int[] lbearing = new int[1];
- int[] rbearing = new int[1];
- int[] unused = new int[1];
- OS.gdk_string_extents(_getGCFont(), charBuffer, lbearing, rbearing, unused, unused, unused);
- return rbearing[0] - lbearing[0];
-}
-/**
- * Returns the bounding rectangle of the receiver's clipping
- * region. If no clipping region is set, the return value
- * will be a rectangle which covers the entire bounds of the
- * object the receiver is drawing on.
- *
- * @return the bounding rectangle of the clipping region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getClipping() {
- if (data.clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
- return new Rectangle(0, 0, width[0], height[0]);
- }
- GdkRectangle rect = new GdkRectangle();
- OS.gdk_region_get_clipbox(data.clipRgn, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the region managed by the argument to the current
- * clipping region of the receiver.
- *
- * @param region the region to fill with the clipping region
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void getClipping(Region region) {
- if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
- int hRegion = region.handle;
- if (data.clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
- hRegion = OS.gdk_region_new();
- GdkRectangle rect = new GdkRectangle();
- rect.x = 0; rect.y = 0;
- rect.width = (short)width[0]; rect.height = (short)height[0];
- region.handle = OS.gdk_region_union_with_rect(hRegion, rect);
- return;
- }
- hRegion = OS.gdk_region_new();
- region.handle = OS.gdk_regions_union(data.clipRgn, hRegion);
-}
-/**
- * Returns the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getFont() {
- return Font.gtk_new(_getGCFont());
-}
-/**
- * Returns a FontMetrics which contains information
- * about the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return font metrics for the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-// Not done
-public FontMetrics getFontMetrics() {
- int fontHandle = _getGCFont();
- if (fontHandle==0) {
- error(SWT.ERROR_UNSPECIFIED);
- }
- GdkFont gdkFont = new GdkFont();
- OS.memmove(gdkFont, fontHandle, GdkFont.sizeof);
- byte [] w = Converter.wcsToMbcs (null, "w", true);
- return FontMetrics.gtk_new(fontHandle);
-}
-
-/**
- * Returns the receiver's line style, which will be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @return the style used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineStyle() {
- return data.lineStyle;
-}
-/**
- * Returns the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @return the receiver's line width
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineWidth() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values.line_width;
-}
-/**
- * Returns <code>true</code> if this GC is drawing in the mode
- * where the resulting color in the destination is the
- * <em>exclusive or</em> of the color values in the source
- * and the destination, and <code>false</code> if it is
- * drawing in the mode where the destination color is being
- * replaced with the source color value.
- *
- * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getXORMode() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values.function == OS.GDK_XOR;
-}
-/**
- * Returns <code>true</code> if the receiver has a clipping
- * region set into it, and <code>false</code> otherwise.
- * If this method returns false, the receiver will draw on all
- * available space in the destination. If it returns true,
- * it will draw only in the area that is covered by the region
- * that can be accessed with <code>getClipping(region)</code>.
- *
- * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isClipped() {
- return data.clipRgn != 0;
-}
-
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the arguments.
- *
- * @param x the x coordinate of the clipping rectangle
- * @param y the y coordinate of the clipping rectangle
- * @param width the width of the clipping rectangle
- * @param height the height of the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(int x, int y, int width, int height) {
- if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
- GdkRectangle rect = new GdkRectangle();
- rect.x = (short)x; rect.y = (short)y;
- rect.width = (short)width; rect.height = (short)height;
- OS.gdk_gc_set_clip_rectangle(handle, rect);
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- data.clipRgn = OS.gdk_region_union_with_rect(data.clipRgn, rect);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the argument.
- *
- * @param rect the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- setClipping (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the region specified
- * by the argument.
- *
- * @param rect the clipping region.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(Region region) {
- if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
- if (region == null) {
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- OS.gdk_gc_set_clip_mask(handle, OS.GDK_NONE);
- } else {
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- data.clipRgn = OS.gdk_regions_union(region.handle, data.clipRgn);
- OS.gdk_gc_set_clip_region(handle, region.handle);
- }
-}
-/**
- * Sets the font which will be used by the receiver
- * to draw and measure text to the argument. If the
- * argument is null, then a default font appropriate
- * for the platform will be used instead.
- *
- * @param font the new font for the receiver, or null to indicate a default font
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setFont(Font font) {
- int fontHandle = 0;
- if (font == null) {
- GtkStyle gtkStyle = new GtkStyle();
- int style = OS.gtk_widget_get_default_style();
- OS.memmove(gtkStyle, style, GtkStyle.sizeof);
- fontHandle = gtkStyle.font;
- } else {
- fontHandle = font.handle;
- }
- OS.gdk_gc_set_font(handle, fontHandle);
-}
-
-/**
- * Sets the receiver's line style to the argument, which must be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @param lineStyle the style to be used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineStyle(int lineStyle) {
- switch (lineStyle) {
- case SWT.LINE_SOLID:
- this.data.lineStyle = lineStyle;
- OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- return;
- case SWT.LINE_DASH:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2}, 2);
- break;
- case SWT.LINE_DOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {3, 1}, 2);
- break;
- case SWT.LINE_DASHDOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1}, 4);
- break;
- case SWT.LINE_DASHDOTDOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1, 3, 1}, 6);
- break;
- default:
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.data.lineStyle = lineStyle;
- OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
-}
-/**
- * Sets the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @param lineWidth the width of a line
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineWidth(int width) {
- if (data.lineStyle == SWT.LINE_SOLID) {
- OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- } else {
- OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- }
-}
-/**
- * If the argument is <code>true</code>, puts the receiver
- * in a drawing mode where the resulting color in the destination
- * is the <em>exclusive or</em> of the color values in the source
- * and the destination, and if the argument is <code>false</code>,
- * puts the receiver in a drawing mode where the destination color
- * is replaced with the source color value.
- *
- * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setXORMode(boolean val) {
- if (val) {
- OS.gdk_gc_set_function(handle, OS.GDK_XOR);
- } else {
- OS.gdk_gc_set_function(handle, OS.GDK_COPY);
- }
-}
-/**
- * Returns the extent of the given string. No tab
- * expansion or carriage return processing will be performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point stringExtent(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- int width = OS.gdk_string_width(_getGCFont(), buffer);
- int height = OS.gdk_string_height(_getGCFont(), buffer);
- return new Point(width, height);
-}
-/**
- * Returns the extent of the given string. Tab expansion and
- * carriage return processing are performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- int width = OS.gdk_string_width(_getGCFont(), buffer);
- int height = OS.gdk_string_height(_getGCFont(), buffer);
- return new Point(width, height);
-}
-
-
-
-/*
- * === Access - Internal utils ===
- */
-
-private GdkGCValues _getGCValues() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values;
-}
-private GdkColor _getForegroundGdkColor() {
- GdkGCValues values = _getGCValues();
- GdkColor color = new GdkColor();
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- return color;
-}
-private GdkColor _getBackgroundGdkColor() {
- GdkGCValues values = _getGCValues();
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- return color;
-}
-private int _getGCFont() {
- GdkGCValues values = _getGCValues();
- if (values.font==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- return values.font;
-}
-
-
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Drawing operations proper ===
- */
-
-/**
- * Copies a rectangular area of the receiver at the specified
- * position into the image, which must be of type <code>SWT.BITMAP</code>.
- *
- * @param x the x coordinate in the receiver of the area to be copied
- * @param y the y coordinate in the receiver of the area to be copied
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap or has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- Rectangle rect = image.getBounds();
- int xGC = OS.gdk_gc_new(image.pixmap);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- // is it possible/necessary to set the subwindow mode??
- OS.gdk_window_copy_area (image.pixmap, // dest window
- xGC,
- 0, 0, // dest coords
- image.pixmap, // src window
- x, y, // src coords
- rect.width, rect.height);
- OS.gdk_gc_destroy(xGC);
-}
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
- OS.gdk_window_copy_area (data.drawable, handle,
- destX, destY,
- data.drawable,
- srcX, srcY, width, height);
-}
-
-/**
- * Draws the outline of a circular or elliptical arc
- * within the specified rectangular area.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be drawn
- * @param y the y coordinate of the upper-left corner of the arc to be drawn
- * @param width the width of the arc to be drawn
- * @param height the height of the arc to be drawn
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, startAngle * 64, endAngle * 64);
-}
-/**
- * Draws a rectangle, based on the specified arguments, which has
- * the appearance of the platform's <em>focus rectangle</em> if the
- * platform supports such a notion, and otherwise draws a simple
- * rectangle in the receiver's forground color.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void drawFocus(int x, int y, int width, int height) {
- GtkStyle style = new GtkStyle();
- int hStyle = OS.gtk_widget_get_default_style();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Draws the given image in the receiver at the specified
- * coordinates.
- *
- * @param image the image to draw
- * @param x the x coordinate of where to draw
- * @param y the y coordinate of where to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int x, int y) {
- if (image == null) error(SWT.ERROR_NULL_ARGUMENT);
- int pixmap = image.pixmap;
- int [] unused = new int [1]; int [] width = new int [1]; int [] height = new int [1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
- drawImage(image, 0, 0, width[0], height[0], x, y, width[0], height[0]);
-}
-
-/**
- * Copies a rectangular area from the source image into a (potentially
- * different sized) rectangular area in the receiver. If the source
- * and destination areas are of differing sizes, then the source
- * area will be stretched or shrunk to fit the destination area
- * as it is copied. The copy fails if any of the given coordinates
- * are negative or lie outside the bounds of their respective images.
- *
- * @param image the source image
- * @param srcX the x coordinate in the source image to copy from
- * @param srcY the y coordinate in the source image to copy from
- * @param srcWidth the width in pixels to copy from the source
- * @param srcHeight the height in pixels to copy from the source
- * @param destX the x coordinate in the destination to copy to
- * @param destY the y coordinate in the destination to copy to
- * @param destWidth the width in pixels of the destination rectangle
- * @param destHeight the height in pixels of the destination rectangle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- /* basic sanity checks */
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
- if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- /* source image properties */
- int[] width = new int[1];
- int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(srcImage.pixmap, unused, unused, width, height, unused);
- if ((srcY + srcWidth > width[0]) ||
- (srcY + srcHeight > height[0])) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /* Special case: If we don't need to scale, and there is no alpha/mask,
- * then we can just blit the image inside the X server - no net traffic
- */
- boolean needScaling = (srcWidth != destWidth) || (srcHeight != destHeight);
- boolean simple = !needScaling & (srcImage.mask == 0);
-
- if (simple) {
- OS.gdk_draw_pixmap(data.drawable, handle, srcImage.pixmap,
- srcX, srcY,
- destX, destY,
- width[0], height[0]);
- return;
- }
-
-
- /* Fetch a local GdkPixbuf from server */
- Pixbuffer pixbuf = new Pixbuffer(srcImage);
-
- /* Scale if necessary */
- if ((srcWidth != destWidth) || (srcHeight != destHeight)) {
- double scale_x = (double)destWidth / (double)srcWidth;
- double scale_y = (double)destHeight / (double)srcHeight;
- double offset_x = - srcX * scale_x;
- double offset_y = - srcY * scale_y;
-
- int destSizePixbuf = GDKPIXBUF.gdk_pixbuf_new (
- GDKPIXBUF.GDK_COLORSPACE_RGB,
- true, 8, destWidth, destHeight);
- GDKPIXBUF.gdk_pixbuf_scale(
- pixbuf.handle, // src,
- destSizePixbuf,
- 0,
- 0,
- destWidth, destHeight,
- offset_x, offset_y,
- scale_x, scale_y,
- GDKPIXBUF.GDK_INTERP_BILINEAR);
- pixbuf.handle = destSizePixbuf;
- }
-
- /* Paint it */
- GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(
- pixbuf.handle,
- data.drawable,
- 0, 0,
- destX, destY,
- destWidth, destHeight,
- GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
- GDKPIXBUF.GDK_RGB_DITHER_NORMAL,
- 0, 0
- );
-}
-
-/**
- * Draws a line, using the foreground color, between the points
- * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
- *
- * @param x1 the first point's x coordinate
- * @param y1 the first point's y coordinate
- * @param x2 the second point's x coordinate
- * @param y2 the second point's y coordinate
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawLine(int x1, int y1, int x2, int y2) {
- OS.gdk_draw_line (data.drawable, handle, x1, y1, x2, y2);
-}
-/**
- * Draws the outline of an oval, using the foreground color,
- * within the specified rectangular area.
- * <p>
- * The result is a circle or ellipse that fits within the
- * rectangle specified by the <code>x</code>, <code>y</code>,
- * <code>width</code>, and <code>height</code> arguments.
- * </p><p>
- * The oval covers an area that is <code>width + 1</code>
- * pixels wide and <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper left corner of the oval to be drawn
- * @param y the y coordinate of the upper left corner of the oval to be drawn
- * @param width the width of the oval to be drawn
- * @param height the height of the oval to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawOval(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, 0, 23040);
-}
-/**
- * Draws the closed polygon which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the vertices of the polygon. Lines are drawn between
- * each consecutive pair, and between the first pair and last pair in the
- * array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolygon(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- OS.gdk_draw_polygon(data.drawable, handle, 0, points, points.length / 2);
-}
-/**
- * Draws the polyline which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the corners of the polyline. Lines are drawn between
- * each consecutive pair, but not between the first pair and last pair in
- * the array.
- *
- * @param pointArray an array of alternating x and y values which are the corners of the polyline
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolyline(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- OS.gdk_draw_lines(data.drawable, handle, points, points.length / 2);
-}
-/**
- * Draws the outline of the rectangle specified by the arguments,
- * using the receiver's foreground color. The left and right edges
- * of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
-}
-/**
- * Draws the outline of the specified rectangle, using the receiver's
- * foreground color. The left and right edges of the rectangle are at
- * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
- * and bottom edges are at <code>rect.y</code> and
- * <code>rect.y + rect.height</code>.
- *
- * @param rect the rectangle to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Draws the outline of the round-cornered rectangle specified by
- * the arguments, using the receiver's foreground color. The left and
- * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- * The <em>roundness</em> of the corners is specified by the
- * <code>arcWidth</code> and <code>arcHeight</code> arguments.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny -nh;
- }
- if (naw < 0) naw = 0 - naw;
- if (nah < 0) nah = 0 - nah;
-
- int naw2 = Compatibility.floor(naw, 2);
- int nah2 = Compatibility.floor(nah, 2);
-
- OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny, naw, nah, 5760, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny + nh - nah, naw, nah, 11520, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
- OS.gdk_draw_line(data.drawable, handle, nx,ny + nah2, nx, ny + nh - nah2);
- OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
- OS.gdk_draw_line(data.drawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. The background of the rectangular area where
- * the string is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y) {
- drawString(string, x, y, false);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the string is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString(String string, int x, int y, boolean isTransparent) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
- int[] unused = new int[1];
- int[] width = new int[1];
- int[] ascent = new int[1];
- int[] average_ascent = new int [1];
- int fontHandle = _getGCFont();
- OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
- OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
- if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
- if (!isTransparent) {
- int height = OS.gdk_string_height(fontHandle, buffer);
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
- }
- OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. The background of the rectangular area where
- * the text is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText(String string, int x, int y) {
- drawText(string, x, y, false);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText(String string, int x, int y, boolean isTransparent) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
- int fontHandle = _getGCFont();
- int[] unused = new int[1];
- int[] width = new int[1];
- int[] ascent = new int[1];
- int[] average_ascent = new int [1];
- OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
- OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
- if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
- if (!isTransparent) {
- int height = OS.gdk_string_height(fontHandle, buffer);
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
- }
- OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion, line delimiter and mnemonic
- * processing are performed according to the specified flags. If
- * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- * <p>
- * The parameter <code>flags</code> may be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * </p>
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param flags the flags specifing how to process the text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, int flags) {
- // NOT IMPLEMENTED
- drawText(string, x, y, (flags & SWT.DRAW_TRANSPARENT) != 0);
-}
-
-/**
- * Fills the interior of a circular or elliptical arc within
- * the specified rectangular area, with the receiver's background
- * color.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be filled
- * @param y the y coordinate of the upper-left corner of the arc to be filled
- * @param width the width of the arc to be filled
- * @param height the height of the arc to be filled
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawArc
- */
-public void fillArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, startAngle * 64, endAngle * 64);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-
-/**
- * Fills the interior of the specified rectangle with a gradient
- * sweeping from left to right or top to bottom progressing
- * from the receiver's foreground color to its background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled, may be negative
- * (inverts direction of gradient if horizontal)
- * @param height the height of the rectangle to be filled, may be negative
- * (inverts direction of gradient if vertical)
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if ((width == 0) || (height == 0)) return;
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor foregroundGdkColor = new GdkColor();
-
- RGB backgroundRGB, foregroundRGB;
- backgroundRGB = Color.gtk_getRGBIntensities(_getBackgroundGdkColor());
- foregroundRGB = Color.gtk_getRGBIntensities(_getForegroundGdkColor());
-
- RGB fromRGB, toRGB;
- fromRGB = foregroundRGB;
- toRGB = backgroundRGB;
- boolean swapColors = false;
- if (width < 0) {
- x += width; width = -width;
- if (! vertical) swapColors = true;
- }
- if (height < 0) {
- y += height; height = -height;
- if (vertical) swapColors = true;
- }
- if (swapColors) {
- fromRGB = backgroundRGB;
- toRGB = foregroundRGB;
- }
- if (fromRGB == toRGB) {
- fillRectangle(x, y, width, height);
- return;
- }
- ImageData.fillGradientRectangle(this, Display.getCurrent(),
- x, y, width, height, vertical, fromRGB, toRGB,
- 8, 8, 8);
-}
-
-/**
- * Fills the interior of an oval, within the specified
- * rectangular area, with the receiver's background
- * color.
- *
- * @param x the x coordinate of the upper left corner of the oval to be filled
- * @param y the y coordinate of the upper left corner of the oval to be filled
- * @param width the width of the oval to be filled
- * @param height the height of the oval to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawOval
- */
-public void fillOval(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, 0, 23040);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the closed polygon which is defined by the
- * specified array of integer coordinates, using the receiver's
- * background color. The array contains alternating x and y values
- * which are considered to represent points which are the vertices of
- * the polygon. Lines are drawn between each consecutive pair, and
- * between the first pair and last pair in the array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawPolygon
- */
-public void fillPolygon(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_polygon(data.drawable, handle, 1, points, points.length / 2);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the rectangle specified by the arguments,
- * using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width, height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the specified rectangle, using the receiver's
- * background color.
- *
- * @param rectangle the rectangle to be filled
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- fillRectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Fills the interior of the round-cornered rectangle specified by
- * the arguments, using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRoundRectangle
- */
-public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny -nh;
- }
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- naw = Math.min(naw,nw);
- nah = Math.min(nah, nh);
-
- int naw2 = Compatibility.round(naw, 2);
- int nah2 = Compatibility.round(nah, 2);
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny, naw, nah, 5760, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny + nh - nah, naw, nah, 11520, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + naw2, ny, nw - naw, nh);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx, ny + nah2, naw2, nh - nah);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + nw - (naw / 2), ny + nah2, naw2, nh -nah);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-/*
- * === As yet unclassified ===
- */
-
-public boolean equals(Object object) {
- return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns <code>true</code> if the GC has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the GC.
- * When a GC has been disposed, it is an error to
- * invoke any other method using the GC.
- *
- * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-/**
- * Disposes of the operating system resources associated with
- * the graphics context. Applications must dispose of all GCs
- * which they allocate.
- */
-public void dispose() {
- if (handle == 0) return;
-
- /* Free resources */
- int clipRgn = data.clipRgn;
- if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
- Image image = data.image;
- if (image != null) image.memGC = null;
-
- /* Dispose the GC */
- if(drawable == null)
- OS.gdk_gc_unref(handle);
- else
- drawable.internal_dispose_GC(handle, data);
-
- data.drawable = // data.colormap = data.fontList =
- data.clipRgn = data.renderTable = 0;
- drawable = null;
- data.image = null;
- data = null;
- handle = 0;
-
-}
-
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "GC {*DISPOSED*}";
- return "GC {" + handle + "}";
-}
-
-/**
- * Returns the extent of the given string. Tab expansion, line
- * delimiter and mnemonic processing are performed according to
- * the specified flags, which can be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @param flags the flags specifing how to process the text
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string, int flags) {
- //NOT IMPLEMENTED
- return textExtent(string);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
deleted file mode 100644
index ad7b9c7fc2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are descriptions of GCs in terms
- * of unallocated platform-specific data fields.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
- * API for SWT. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms, and should never be called from application code.
- * </p>
- *
- * @private
- */
-public final class GCData {
- public Image image;
- public int drawable;
- public int clipRgn;
- public int lineStyle = SWT.LINE_SOLID;
- public int renderTable;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
deleted file mode 100644
index f733122bf4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
+++ /dev/null
@@ -1,650 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.*;
-import java.io.*;
-
-/**
- * Instances of this class are graphics which have been prepared
- * for display on a specific device. That is, they are ready
- * to paint using methods such as <code>GC.drawImage()</code>
- * and display on widgets with, for example, <code>Button.setImage()</code>.
- * <p>
- * If loaded from a file format that supports it, an
- * <code>Image</code> may have transparency, meaning that certain
- * pixels are specified as being transparent when drawn. Examples
- * of file formats that support transparency are GIF and PNG.
- * </p><p>
- * There are two primary ways to use <code>Images</code>.
- * The first is to load a graphic file from disk and create an
- * <code>Image</code> from it. This is done using an <code>Image</code>
- * constructor, for example:
- * <pre>
- * Image i = new Image(device, "C:\\graphic.bmp");
- * </pre>
- * A graphic file may contain a color table specifying which
- * colors the image was intended to possess. In the above example,
- * these colors will be mapped to the closest available color in
- * SWT. It is possible to get more control over the mapping of
- * colors as the image is being created, using code of the form:
- * <pre>
- * ImageData data = new ImageData("C:\\graphic.bmp");
- * RGB[] rgbs = data.getRGBs();
- * // At this point, rgbs contains specifications of all
- * // the colors contained within this image. You may
- * // allocate as many of these colors as you wish by
- * // using the Color constructor Color(RGB), then
- * // create the image:
- * Image i = new Image(device, data);
- * </pre>
- * <p>
- * Applications which require even greater control over the image
- * loading process should use the support provided in class
- * <code>ImageLoader</code>.
- * </p><p>
- * Application code must explicitely invoke the <code>Image.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see Color
- * @see ImageData
- * @see ImageLoader
- */
-public final class Image implements Drawable{
-
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
- */
- public int type;
-
- /**
- * The handle to the OS pixmap resource.
- * Warning: This field is platform dependent.
- */
- public int pixmap;
-
- /**
- * The handle to the OS mask resource.
- * Warning: This field is platform dependent.
- */
- public int mask;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
- /**
- * specifies the transparent pixel
- * (Warning: This field is platform dependent)
- */
- int transparentPixel = -1;
-
- /**
- * The GC the image is currently selected in.
- * Warning: This field is platform dependent.
- */
- GC memGC;
-
- /**
- * The alpha data of the image.
- * Warning: This field is platform dependent.
- */
- byte[] alphaData;
-
- /**
- * The global alpha value to be used for every pixel.
- * Warning: This field is platform dependent.
- */
- int alpha = -1;
-
- /**
- * Specifies the default scanline padding.
- * Warning: This field is platform dependent.
- */
- static final int DEFAULT_SCANLINE_PAD = 4;
-
-
-
-/*
- * CONSTRUCTORS
- */
-
-Image() {
-}
-
-/**
- * Constructs an empty instance of this class with the
- * specified width and height. The result may be drawn upon
- * by creating a GC and using any of its drawing operations,
- * as shown in the following example:
- * <pre>
- * Image i = new Image(device, width, height);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param width the width of the new image
- * @param height the height of the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
- * </ul>
- */
-public Image(Device display, int width, int height) {
- init(display, width, height);
-}
-
-/**
- * Constructs a new instance of this class based on the
- * provided image, with an appearance that varies depending
- * on the value of the flag. The possible flag values are:
- * <dl>
- * <dt><b>IMAGE_COPY</b></dt>
- * <dd>the result is an identical copy of srcImage</dd>
- * <dt><b>IMAGE_DISABLE</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
- * <dt><b>IMAGE_GRAY</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
- * </dl>
- *
- * @param device the device on which to create the image
- * @param srcImage the image to use as the source
- * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
- * is otherwise in an invalid state</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
-public Image(Device device, Image srcImage, int flag) {
- /* basic sanity */
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.type = srcImage.type;
- this.mask = 0;
-
- /* this is somewhat ugly, because this dilutes the encapsulation
- * of knowledge about what the cloning operations do (e.g., the
- * following lines assume graying and disabling don't change alpha)
- */
- this.alphaData = srcImage.alphaData;
- this.alpha = srcImage.alpha;
- this.transparentPixel = srcImage.transparentPixel;
- // bogus - are we sure about memGC?
-
- /* Special case:
- * If all we want is just a clone of the existing pixmap, it can
- * be done entirely in the X server, without copying across the net.
- */
- if (flag == SWT.IMAGE_COPY) {
- int[] unused = new int[1];
- int[] width = new int[1]; int[] height = new int[1];
- int[] depth = new int[1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, depth);
- pixmap = OS.gdk_pixmap_new (0, width[0], height[0], depth[0]);
- int gc = OS.gdk_gc_new (pixmap);
- OS.gdk_draw_pixmap(pixmap, gc, srcImage.pixmap,
- 0,0,0,0, width[0], height[0]);
- OS.gdk_gc_destroy(gc);
- transparentPixel = srcImage.transparentPixel;
- alpha = srcImage.alpha;
- if (srcImage.alphaData != null) {
- alphaData = new byte[srcImage.alphaData.length];
- System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
- }
-
- /* we are not quite done yet. Need to copy the maskData */
- if (srcImage.mask != 0) {
- /* Generate the mask if necessary. */
-// if (srcImage.transparentPixel != -1) srcImage.createMask();
- mask = OS.gdk_pixmap_new(0, width[0], height[0], 1);
- gc = OS.gdk_gc_new(mask);
- OS.gdk_draw_pixmap(mask, gc, srcImage.mask,
- 0,0,0,0, width[0], height[0]);
- OS.gdk_gc_destroy(gc);
- /* Destroy the image mask if the there is a GC created on the image */
- if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
- }
-
-
- return;
- }
-
-
-
-
- Pixbuffer pb = new Pixbuffer(srcImage);
- Pixbuffer pb2 = new Pixbuffer(pb, flag);
- pb2.toImage(this);
-
-
-}
-
-/**
- * Constructs an empty instance of this class with the
- * width and height of the specified rectangle. The result
- * may be drawn upon by creating a GC and using any of its
- * drawing operations, as shown in the following example:
- * <pre>
- * Image i = new Image(device, boundsRectangle);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param bounds a rectangle specifying the image's width and height (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
- * </ul>
- */
-public Image(Device display, Rectangle bounds) {
- if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(display, bounds.width, bounds.height);
-}
-
-/**
- * Constructs an instance of this class from the given
- * <code>ImageData</code>.
- *
- * @param device the device on which to create the image
- * @param data the image data to create the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
- * </ul>
- */
-public Image(Device display, ImageData image) {
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, image);
-}
-
-/**
- * Constructs an instance of this class, whose type is
- * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
- * objects. The two images must be the same size, and the mask image
- * must have a color depth of 1. Pixel transparency in either image
- * will be ignored. If either image is an icon to begin with, an
- * exception is thrown.
- * <p>
- * The mask image should contain white wherever the icon is to be visible,
- * and black wherever the icon is to be transparent. In addition,
- * the source image should contain black wherever the icon is to be
- * transparent.
- * </p>
- *
- * @param device the device on which to create the icon
- * @param source the color data for the icon
- * @param mask the mask data for the icon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
- * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
- * if the mask is not monochrome, or if either the source or mask
- * is already an icon</li>
- * </ul>
- */
-public Image(Device display, ImageData source, ImageData mask) {
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- if (source.width != mask.width || source.height != mask.height) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- ImageData image;
- if (source.depth != 1)
- image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
- else {
- image = source.getTransparencyMask(); //create an imagedata with scanlinepad == 1 and invalid data
- int[] row = new int[source.width];
- for (int y = 0; y < source.height; y++) {
- source.getPixels(0, y, source.width, row, 0);
- image.setPixels(0, y, source.width, row, 0);
- }//change source data format from scanlinePad == 4 to scanlinePad == 1;
-
- }
- image.type = SWT.ICON;
- image.maskPad = mask.scanlinePad;
- image.maskData = mask.data;
- init(display, image);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the specified input stream. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p><p>
- * This constructor may be used to load a resource as follows:
- * </p>
- * <pre>
- * new Image(device, clazz.getResourceAsStream("file.gif"));
- * </pre>
- *
- * @param device the device on which to create the image
- * @param stream the input stream to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device display, InputStream stream) {
- if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, new ImageData(stream));
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the file with the specified name. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading
- * a single image only. If the specified file contains
- * multiple images, only the first one will be used.
- *
- * @param device the device on which to create the image
- * @param filename the name of the file to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device display, String filename) {
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, new ImageData(filename));
-}
-
-/**
- * Destroy the receiver's mask if it exists.
- */
-void destroyMask() {
- if (mask == 0) return;
- OS.gdk_bitmap_unref(mask);
- mask = 0;
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the image. Applications must dispose of all images which
- * they allocate.
- */
-public void dispose () {
- if (pixmap != 0) OS.gdk_pixmap_unref(pixmap);
- if (mask != 0) OS.gdk_pixmap_unref(mask);
- pixmap = mask = 0;
- memGC = null;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof Image) &&
- (pixmap == ((Image)object).pixmap) &&
- (mask == ((Image)object).mask));
-}
-
-/**
- * Returns the color to which to map the transparent pixel, or null if
- * the receiver has no transparent pixel.
- * <p>
- * There are certain uses of Images that do not support transparency
- * (for example, setting an image into a button or label). In these cases,
- * it may be desired to simulate transparency by using the background
- * color of the widget to paint the transparent pixels of the image.
- * Use this method to check which color will be used in these cases
- * in place of transparency. This value may be set with setBackground().
- * <p>
- *
- * @return the background color of the image, or null if there is no transparency in the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- return null;
-}
-
-/**
- * Sets the color to which to map the transparent pixel.
- * <p>
- * There are certain uses of <code>Images</code> that do not support
- * transparency (for example, setting an image into a button or label).
- * In these cases, it may be desired to simulate transparency by using
- * the background color of the widget to paint the transparent pixels
- * of the image. This method specifies the color that will be used in
- * these cases. For example:
- * <pre>
- * Button b = new Button();
- * image.setBackground(b.getBackground());>
- * b.setImage(image);
- * </pre>
- * </p><p>
- * The image may be modified by this operation (in effect, the
- * transparent regions may be filled with the supplied color). Hence
- * this operation is not reversible and it is not legal to call
- * this function twice or with a null argument.
- * </p><p>
- * This method has no effect if the receiver does not have a transparent
- * pixel value.
- * </p>
- *
- * @param color the color to use when a transparent pixel is specified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-}
-
-/**
- * Returns the bounds of the receiver. The rectangle will always
- * have x and y values of 0, and the width and height of the
- * image.
- *
- * @return a rectangle specifying the image's bounds
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- */
-public Rectangle getBounds() {
- int[] unused = new int[1]; int[] width = new int[1]; int[] height = new int[1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
- return new Rectangle(0, 0, width[0], height[0]);
-
-}
-/**
- * Returns an <code>ImageData</code> based on the receiver
- * Modifications made to this <code>ImageData</code> will not
- * affect the Image.
- *
- * @return an <code>ImageData</code> containing the image's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- *
- * @see ImageData
- */
-public ImageData getImageData() {
- return new Pixbuffer(this).getImageData();
-}
-
-public static Image gtk_new(int type, int pixmap, int mask) {
- Image image = new Image();
- image.type = type;
- image.pixmap = pixmap;
- image.mask = mask;
- return image;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return pixmap;
-}
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (type != SWT.BITMAP || memGC != null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- data.image = this;
- int gc = OS.gdk_gc_new(pixmap);
- data.drawable = pixmap;
- return gc;
-}
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int gc, GCData data) {
- OS.gdk_gc_unref(gc);
-}
-
-void init(Device display, int width, int height) {
- device = display;
- GdkVisual visual = new GdkVisual ();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- this.pixmap = OS.gdk_pixmap_new(0, width, height, visual.depth);
- if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Fill the bitmap with white */
- GdkColor white = new GdkColor();
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_color_white(colormap, white);
- int gc = OS.gdk_gc_new(pixmap);
- OS.gdk_gc_set_foreground(gc, white);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0, 0, width, height);
- OS.gdk_gc_destroy(gc);
- OS.gdk_colors_free(colormap, new int[] { white.pixel }, 1, 0);
- this.type = SWT.BITMAP;
-}
-
-void init(Device display, ImageData image) {
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getCurrent();
- device = display;
-
- /*
- * We don't really care about the real depth of the ImageData we are
- * given. We stretch everything to 24bpp which is the native GdkPixbuffer
- * depth. HOWEVER, there is one situation where this is not acceptable,
- * namely bitmaps (1bpp), because they may be used in contexts that are
- * sensitive to pixmap depth.
- */
- Pixbuffer buff = new Pixbuffer(image);
- buff.toImage(this);
- return;
-}
-
-/**
- * Returns <code>true</code> if the image has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the image.
- * When an image has been disposed, it is an error to
- * invoke any other method using the image.
- *
- * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return pixmap == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return "Image {" + pixmap + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java
deleted file mode 100644
index 460a3bbb6c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java
+++ /dev/null
@@ -1,492 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * This class is <strong>not</strong> part of the SWT API,
- * and its existence is not relevant for application programmers.
- *
- * Pixbuffer represents local GdkPixbuf images on the client.
- */
-final class Pixbuffer {
-
- /* the handle to the OS resource.
- All state is kept in the OS */
- int handle;
-
- /* pointer to the actual pixel array */
- int data;
-
- /* whether the alpha data in the pixbuf is due to
- a transparency mask or an alpha channel */
- boolean hasMask = false;
- boolean hasAlpha = false;
- int constantAlpha = -1;
- int transparentPixel = -1;
-
-
- /*
- * Constructors.
- * There are three ways to create a Pixbuffer:
- * pull one from a Drawable, create from ImageData,
- * or clone an existing Pixbuffer.
- */
-
- private Pixbuffer() {}
-
- /**
- * Pull a Pixbuffer from an Image living on the X Server
- * (making this operation expensive).
- */
- Pixbuffer (Image src) {
- if (src == null || src.pixmap == 0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(src.pixmap, unused, unused, w, h, unused);
- int width = w[0];
- int height = h[0];
-
- // create the actual OS resource
- createHandle(width, height);
-
- // pull the color data
- int cmap = OS.gdk_colormap_get_system();
- GDKPIXBUF.gdk_pixbuf_get_from_drawable(
- handle,
- src.pixmap,
- cmap,
- 0,0,0,0,
- width, height);
-
- // the tricky part is alpha
- if (src.alphaData != null) fillAlphaFromAlphaBytes(src.alphaData);
- else if (src.alpha != -1) fillConstantAlpha(src.alpha);
- else if (src.mask != 0) fillAlphaFromPixmapMask(src.mask);
- else if (src.transparentPixel != -1) fillAlphaFromTransparentPixel(src.pixmap, src.transparentPixel);
- else fillOpaque();
- }
-
- /**
- * Create a Pixbuffer from image data.
- */
- Pixbuffer (ImageData src) {
- if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- createHandle(src.width, src.height);
-
- // populate the pixbuf with data
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- int dataSize = src.height*stride;
- byte[] bytes = new byte[dataSize];
- switch (src.getTransparencyType()) {
- case SWT.TRANSPARENCY_ALPHA: _blit2platformAlpha(bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_MASK: _blit2platformMask (bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_PIXEL: _blit2platformPixel(bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_NONE: _blit2platformNone (bytes, src, src.width, src.height, stride); break;
- }
- OS.memmove(data, bytes, dataSize);
- }
-
- /**
- * Clone an existing Pixbuffer (possibly making it look
- * grayed out or disabled)
- */
- Pixbuffer (Pixbuffer src, int flag) {
- if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (src.handle==0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.hasAlpha = src.hasAlpha;
- this.constantAlpha = src.constantAlpha;
- this.hasMask = src.hasMask;
-
- /* First, get a copy all our own */
- handle = GDKPIXBUF.gdk_pixbuf_copy(src.handle);
- data = GDKPIXBUF.gdk_pixbuf_get_pixels(this.handle);
-
- // simplest case - just clone what we have
- if (flag==SWT.IMAGE_COPY) return;
-
- // gather some information we will need for disabling or graying
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
- int dataSize = height * stride;
- byte[] bytes = new byte[dataSize];
- OS.memmove(bytes,data,dataSize);
- int lineAddress = 0;
- int pixelAddress;
-
- if (flag==SWT.IMAGE_DISABLE) {
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
-
- int intensity =
- bytes[pixelAddress+0] * bytes[pixelAddress+0] +
- bytes[pixelAddress+1] * bytes[pixelAddress+1] +
- bytes[pixelAddress+2] * bytes[pixelAddress+2];
- byte value = (intensity < 9000)?
- (byte)0 : (byte) 255;
- bytes[pixelAddress+0] = bytes[pixelAddress+1] = bytes[pixelAddress+2] = value;
- // no change to alpha
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- return;
- }
-
- if (flag==SWT.IMAGE_GRAY) {
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
- int intensity =
- (bytes[pixelAddress+0] +
- bytes[pixelAddress+1] +
- bytes[pixelAddress+2] ) / 3;
- bytes[pixelAddress+0] = (byte)intensity;
- bytes[pixelAddress+1] = (byte)intensity;
- bytes[pixelAddress+2] = (byte)intensity;
- // no change to alpha
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- return;
- }
-
- // flag is neither COPY nor DISABLE nor GRAY
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
-
- /**
- * Push the pixbuf to the X Server
- */
- void toImage (Image dest) {
- if (dest==null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int w = getWidth();
- int h = getHeight();
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- dest.pixmap = OS.gdk_pixmap_new (0, w, h, visual.depth);
- dest.mask = 0; // for now; we fill it later in this method
- GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(handle, // src
- dest.pixmap, // dest drawable
- 0,0, 0,0,
- w, h,
- GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
- GDKPIXBUF.GDK_RGB_DITHER_NORMAL, 0,0);
-
- // now the mask, if any
- if (hasMask) {
- // bring the pixel data into Java memory
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- byte[] srcBytes = new byte[h*stride];
- OS.memmove(srcBytes, data, h*stride);
-
- // the mask lines are padded to 4 bytes, that is 32 pixels
- int maskwpl = w/32; if (w%32!=0) maskwpl+=1;
- int maskBpl = maskwpl*4; // Bytes per line for the mask
- byte[] bytes = new byte[h * maskBpl];
- for (int y=0; y<h; y++) {
- int lineAddress = y * maskBpl;
- for (int x=0; x<w; x++)
- if (srcBytes[y*stride + x*4 + 3] != 0) {
- int byteAddress = lineAddress + x/8;
- int bit = 1<<(x%8);
- bytes[byteAddress] |= (byte)bit;
- } // if
- } // for y
- dest.mask = OS.gdk_bitmap_create_from_data(0, bytes, maskBpl*8, h);
- } // hasMask
-
- else if (hasAlpha) {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
-
- else if (constantAlpha!=-1) {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
-
- /**
- * Return the ImageData for the receiver.
- */
- ImageData getImageData() {
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- byte[] bytes = _getDataBytes();
- ImageData answer = new ImageData(width, height, 24, new PaletteData(0xFF0000, 0x00FF00, 0x0000FF));
-
- if (hasMask) {
- answer.maskData = new byte[((width+7)/8)*height];
- answer.maskPad = 1;
- }
-
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int address = y*stride + x*4;
- byte r = bytes[address+0];
- byte g = bytes[address+1];
- byte b = bytes[address+2];
- answer.setPixel(x,y, r<<16+g<<8+b);
- byte alpha = bytes[address+3];
- if (hasAlpha) {
- answer.setAlpha(x,y, alpha);
- }
- if (hasMask && (alpha!=0)) {
- // Find out where to stab the bit
- int mask_bytes_per_line = (width+7) / 8;
- int x_inside_line = x / 8;
- int shift_inside_byte = x - (x_inside_line*8);
- answer.maskData[x_inside_line + (y*mask_bytes_per_line)] |= (128 >> shift_inside_byte);
- }
- }
- if (constantAlpha!=-1) answer.alpha = constantAlpha;
- return answer;
- }
-
- int getWidth() {
- return GDKPIXBUF.gdk_pixbuf_get_width (handle);
- }
-
- int getHeight() {
- return GDKPIXBUF.gdk_pixbuf_get_height (handle);
- }
-
-
- /**
- * Actually create the OS resource.
- * No matter what, the GdkPixbuf we create always has
- * an alpha channel.
- */
- private void createHandle(int width, int height) {
- handle = GDKPIXBUF.gdk_pixbuf_new(GDKPIXBUF.GDK_COLORSPACE_RGB,
- true,
- 8,
- width, height);
- if (this.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- data = GDKPIXBUF.gdk_pixbuf_get_pixels(handle);
- }
-
- private void fillAlphaFromPixmapMask(int mask) {
- hasMask = true;
-
- /* pull the mask data from the X Server */
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(mask, unused, unused, w, h, unused);
- int width = Math.min(w[0], getWidth());
- int height = Math.min(h[0], getHeight());
- /* Get the data */
- int xMaskPtr = OS.gdk_image_get(mask, 0, 0, width, height);
- if (xMaskPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* stuff the alpha values */
- byte[] bytes = _getDataBytes();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int pixel_value = OS.gdk_image_get_pixel(xMaskPtr, x, y);
- if (pixel_value==0) bytes[y*stride + x*4 +3] = 0;
- else if (pixel_value==1) bytes[y*stride + x*4 +3] = (byte)255;
- else { System.out.println("GDK insanity: bitmap contains bits other than 0 or 1"); SWT.error(SWT.ERROR_UNSPECIFIED); }
- }
- /* move it back */
- OS.memmove(data, bytes, bytes.length);
- }
-
- private void fillAlphaFromTransparentPixel(int pm, int pixel) {
- transparentPixel = pixel;
-
- /* pull the data from the X Server */
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(pm, unused, unused, w, h, unused);
- int width = Math.min(w[0], getWidth());
- int height = Math.min(h[0], getHeight());
- /* Get the data */
- int xImage = OS.gdk_image_get(pm, 0, 0, width, height);
- if (xImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* stuff the alpha values */
- byte[] bytes = _getDataBytes();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int pixel_value = OS.gdk_image_get_pixel(xImage, x, y);
- if (pixel_value==pixel) bytes[y*stride + x*4 +3] = 0;
- else bytes[y*stride + x*4 +3] = (byte)255;
- }
- /* move it back */
- OS.memmove(data, bytes, bytes.length);
- }
-
- private void fillAlphaFromAlphaBytes(byte[] alpha) {
- hasAlpha = true;
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- }
-
- private void fillConstantAlpha(int alpha) {
- if ((alpha<0)||(alpha>255)) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- constantAlpha = alpha;
- _fillConstantAlpha((byte)alpha);
- }
-
- private void fillOpaque() {
- _fillConstantAlpha((byte)255);
- }
-
- /**
- * Assume the handle represents a valid GdkPixbuf,
- * and data is pointing to the correct location in memory.
- * Fill all alpha bytes with the specified value.
- */
- private void _fillConstantAlpha (byte value) {
- // first, get some technical info
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
- int dataSize = height * stride;
- byte[] bytes = new byte[dataSize];
- OS.memmove(bytes,data,dataSize);
- int lineAddress = 0;
- int pixelAddress;
-
- // set all alpha bytes to 255
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
- bytes[pixelAddress+3] = value;
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- }
-
- private void _blit2platformNone (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride)
- {
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)255;
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformAlpha (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride)
- {
- hasAlpha = true;
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)source.getAlpha(x,y);
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformPixel (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride
- )
- {
- hasMask = true;
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- int pixel = source.getPixel(x,y);
- if (pixel==source.transparentPixel) {
- bytes[lineAddress + x*4 + 0] = (byte)0;
- bytes[lineAddress + x*4 + 1] = (byte)0;
- bytes[lineAddress + x*4 + 2] = (byte)0;
- bytes[lineAddress + x*4 + 3] = (byte)0;
- } else {
- RGB rgb = source.palette.getRGB(pixel);
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)255;
- }
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformMask (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride
- )
- {
- hasMask = true;
- ImageData maskData = source.getTransparencyMask();
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- int alpha = 0;
- if (maskData.getPixel(x,y) !=0) alpha=255;
- bytes[lineAddress + x*4 + 3] = (byte)alpha;
- }
- lineAddress += stride;
- }
- }
-
- /**
- * Transfer the pixel data from OS memory to Java memory
- * and return the Java byte array
- */
- private byte[] _getDataBytes() {
- int height = GDKPIXBUF.gdk_pixbuf_get_height (handle);
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- int size = height*stride;
- byte[] bytes = new byte[size];
- OS.memmove(bytes, data, size);
- return bytes;
- }
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
deleted file mode 100644
index 150b55f0d0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent areas of an x-y coordinate
- * system that are aggregates of the areas covered by a number
- * of rectangles.
- * <p>
- * Application code must explicitly invoke the <code>Region.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- */
-public final class Region {
- /**
- * the OS resource for the region
- * (Warning: This field is platform dependent)
- */
- public int handle;
-/**
- * Constructs a new empty region.
- */
-public Region() {
- handle = OS.gdk_region_new();
-}
-Region(int handle) {
- this.handle = handle;
-}
-/**
- * Adds the given rectangle to the collection of rectangles
- * the receiver maintains to describe its area.
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- GdkRectangle gdkRect = new GdkRectangle();
- gdkRect.x = (short)rect.x;
- gdkRect.y = (short)rect.y;
- gdkRect.width = (short)rect.width;
- gdkRect.height = (short)rect.height;
- int hOld = handle;
- /**
- * Feature in GDK. Due to the way the GDK region calls work,
- * we have to reassign the handle and destroy the old one.
- */
- handle = OS.gdk_region_union_with_rect(handle, gdkRect);
- OS.gdk_region_destroy(hOld);
-}
-/**
- * Adds all of the rectangles which make up the area covered
- * by the argument to the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @param region the region to merge
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add(Region region) {
- if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
- /**
- * Feature in GDK. Due to the way the GDK region calls work,
- * we have to reassign the handle and destroy the old one.
- */
- int hOld = handle;
- handle = OS.gdk_regions_union(handle, region.handle);
- OS.gdk_region_destroy(hOld);
-}
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains(int x, int y) {
- return OS.gdk_region_point_in(handle, x, y);
-}
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains(Point pt) {
- if (pt == null) error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-/**
- * Disposes of the operating system resources associated with
- * the region. Applications must dispose of all regions which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_region_destroy(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (this == object) return true;
- if (!(object instanceof Region)) return false;
- int xRegion = ((Region)object).handle;
- if (handle == xRegion) return true;
- if (xRegion == 0) return false;
- return OS.gdk_region_equal(handle, xRegion);
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns a rectangle which represents the rectangular
- * union of the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @return a bounding rectangle for the region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#union
- */
-public Rectangle getBounds() {
- GdkRectangle rect = new GdkRectangle();
- OS.gdk_region_get_clipbox(handle, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-public static Region gtk_new(int handle) {
- return new Region(handle);
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the rectangle described by the
- * arguments intersects with any of the rectangles the receiver
- * mainains to describe its area, and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (int x, int y, int width, int height) {
- GdkRectangle osRect = new GdkRectangle();
- osRect.x = (short)x;
- osRect.y = (short)y;
- osRect.width = (short)width;
- osRect.height = (short)height;
- return OS.gdk_region_rect_in(handle, osRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
-}
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with any of the rectangles the receiver mainains to describe
- * its area and <code>false</code> otherwise.
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Returns <code>true</code> if the region has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the region.
- * When a region has been disposed, it is an error to
- * invoke any other method using the region.
- *
- * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isEmpty() {
- return OS.gdk_region_empty(handle);
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return "Region {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
deleted file mode 100644
index 66d9149da7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- */
-public final class Converter {
- public static final byte [] NullByteArray = new byte [1];
- public static final char [] NullCharArray = new char [1];
- public static final byte [] EmptyByteArray = new byte [0];
- public static final char [] EmptyCharArray = new char [0];
-/**
- * Returns the default code page for the platform where the
- * application is currently running.
- *
- * @return the default code page
- */
-public static String defaultCodePage () {
- /*
- | ptr cp |
- DefaultCodePage == nil ifFalse: [^DefaultCodePage].
- cp := ''. "$NON-NLS$"
- (ptr := OSStringZ address: (NlLanginfo callWith: 49)) isNull
- ifFalse: [cp := String copyFromOSMemory: ptr].
- cp isEmpty ifFalse: [
- IsSunOS ifTrue: [
- (cp size > 3 and: [(cp copyFrom: 1 to: 3) = 'ISO'])
- ifTrue: [cp := cp copyFrom: 4 to: cp size]].
- ^DefaultCodePage := cp].
- IsAIX ifTrue: [^DefaultCodePage := 'ISO8859-1'].
- IsSunOS ifTrue: [^DefaultCodePage := '8859-1'].
- ^DefaultCodePage := 'iso8859_1'
- */
- return null;
-}
-static boolean is7BitAscii (byte [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if ((buffer [i] & 0xFF) > 0x7F) return false;
- }
- return true;
-}
-static boolean is7BitAscii (char [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if (buffer [i] > 0x7F) return false;
- }
- return true;
-}
-public static char [] mbcsToWcs (String codePage, byte [] buffer) {
- //SLOW AND BOGUS
- return new String (buffer).toCharArray ();
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, String string) {
- return wcsToMbcs (codePage, string, false);
-}
-public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
- //SLOW AND BOGUS
- int count = string.length ();
- if (terminate) count++;
- char [] buffer = new char [count];
- string.getChars (0, string.length (), buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, char [] buffer) {
- return wcsToMbcs (codePage, buffer, false);
-}
-public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
- //SLOW AND BOGUS
- if (!terminate) return new String (buffer).getBytes ();
- byte [] buffer1 = new String (buffer).getBytes ();
- byte [] buffer2 = new byte [buffer1.length + 1];
- System.arraycopy (buffer1, 0, buffer2, 0, buffer1.length);
- return buffer2;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
deleted file mode 100644
index c08b892a20..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ /dev/null
@@ -1,493 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object that
- * issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Button extends Control {
- int boxHandle;
- Image image;
- String text;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Button (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
- if ((style & SWT.PUSH) != 0) {
- return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
- }
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
- return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
- }
- if ((style & SWT.ARROW) != 0) {
- return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
- }
- return style;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the control is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH;
-
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- switch (style & bits) {
- case SWT.ARROW:
- handle = OS.gtk_button_new ();
- int arrow = OS.gtk_arrow_new (OS.GTK_ARROW_UP, OS.GTK_SHADOW_OUT);
- OS.gtk_container_add (handle, arrow);
- OS.gtk_widget_show (arrow);
- break;
- case SWT.TOGGLE:
- handle = OS.gtk_toggle_button_new ();
- break;
- case SWT.CHECK:
- handle = OS.gtk_check_button_new ();
- break;
- case SWT.RADIO:
- handle = OS.gtk_radio_button_new (parent.radioGroup());
- break;
- case SWT.PUSH:
- default:
- handle = OS.gtk_button_new ();
- break;
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (boxHandle, handle);
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents();
- /*
- * Feature in GTK. For some reason, when the widget
- * is a check or radio button, mouse move and key
- * release events are not signaled. The fix is to
- * look for them on the parent.
- */
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_KEY_RELEASE_MASK;
- OS.gtk_widget_add_events (boxHandle, mask);
- signal_connect_after (boxHandle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (boxHandle, "key_release_event", SWT.KeyUp, 3);
- }
- signal_connect (handle, "clicked", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (boxHandle, this);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-int topHandle () { return boxHandle; }
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the alignment will indicate the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & SWT.UP) != 0) return SWT.UP;
- if ((style & SWT.DOWN) != 0) return SWT.DOWN;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.UP;
- }
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed. If the receiver is of any other type,
- * this method returns false.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- return OS.gtk_toggle_button_get_active (handle);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Controls how text, images and arrows will be displayed
- * in the receiver. The argument should be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the argument indicates the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
- style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- int arrow_type = OS.GTK_ARROW_UP;
- switch (alignment) {
- case SWT.UP:
- arrow_type = OS.GTK_ARROW_UP;
- break;
- case SWT.DOWN:
- arrow_type = OS.GTK_ARROW_DOWN;
- break;
- case SWT.LEFT:
- arrow_type = OS.GTK_ARROW_LEFT;
- break;
- case SWT.RIGHT:
- arrow_type = OS.GTK_ARROW_RIGHT;
- break;
- }
- int list = OS.gtk_container_children (handle);
- int arrow = OS.g_list_nth_data (list, 0);
- OS.gtk_arrow_set (arrow, arrow_type, OS.GTK_SHADOW_OUT);
- return;
- }
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int list = OS.gtk_container_children (handle);
- int label = OS.g_list_nth_data (list, 0);
- if (label == 0) return;
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (label, 0.0f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (label, 0.5f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (label, 1.0f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- this.image = image;
- if ((style & SWT.ARROW) != 0) return;
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- if (image != null) {
- int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
- OS.gtk_container_add (handle, pixmap);
- OS.gtk_widget_show (pixmap);
- }
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-
-/**
- * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
- * <code>RADIO</code>, or <code>TOGGLE</code>.
- *
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_toggle_button_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the button label. The label may include
- * the mnemonic character but must not contain line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- int label = OS.gtk_label_new (buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
- OS.gtk_container_add (handle, label);
- OS.gtk_widget_show (label);
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent(SWT.Selection);
- return 0;
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (boxHandle);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
- text = null;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = 0;
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
deleted file mode 100644
index 3374e5cc65..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a surface for drawing
- * arbitrary graphics.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are <em>not</em> constructed
- * from aggregates of other controls. That is, they are either
- * painted using SWT graphics calls or are handled by native
- * methods.
- * </p>
- *
- * @see Composite
- */
-public class Canvas extends Composite {
-
- Caret caret;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-
-Canvas () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-
-/**
- * Returns the caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- *
- * @return the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Caret getCaret () {
- checkWidget();
- return caret;
-}
-
-/**
- * Scrolls a rectangular area of the receiver by first copying
- * the source area to the destination and then causing the area
- * of the source which is not covered by the destination to
- * be repainted. Children that intersect the rectangle are
- * optionally moved during the operation. In addition, outstanding
- * paint events are flushed before the source area is copied to
- * ensure that the contents of the canvas are drawn correctly.
- *
- * @param destX the x coordinate of the destination
- * @param destY the y coordinate of the destination
- * @param x the x coordinate of the source
- * @param y the y coordinate of the source
- * @param width the width of the area
- * @param height the height of the area
- * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- if (!isVisible ()) return;
-
- /* Hide the caret */
- boolean isVisible = (caret != null) && (caret.isVisible ());
- if (isVisible) caret.hideCaret ();
-
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
- int window = widget.window;
- if (window == 0) return;
-
- /* Emit a NoExpose Event */
- int gc = OS.gdk_gc_new (window);
- OS.gdk_gc_set_exposures(gc, true);
- OS.gdk_window_copy_area (window, gc, x, y, window, x, y, width, height);
- OS.gdk_gc_destroy (gc);
-
- /* Flush outstanding Exposes */
- int eventHandle=0;
- while ((eventHandle = OS.gdk_event_get_graphics_expose(window)) != 0) {
- OS.gtk_widget_event(handle, eventHandle);
- OS.gdk_event_free(eventHandle);
- }
-
- /* Scroll the window */
- int gc1 = OS.gdk_gc_new (window);
- OS.gdk_gc_set_exposures(gc1, true);
- OS.gdk_window_copy_area (window, gc1, destX, destY, window, x, y, width, height);
- OS.gdk_gc_destroy (gc1);
- boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
- if (disjoint) {
- OS.gdk_window_clear_area(window, x, y, width, height);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.gdk_window_clear_area_e(window, newX, y, Math.abs (deltaX), height);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.gdk_window_clear_area_e (window, x, newY, width, Math.abs (deltaY));
- }
- }
-
- /* Show the caret */
- if (isVisible) caret.showCaret ();
-}
-/**
- * Sets the receiver's caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- * @param caret the new caret for the receiver, may be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCaret (Caret caret) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (isFocusControl()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) newCaret.setFocus ();
- }
-}
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.NO_FOCUS) != 0) return false;
- return super.setFocus ();
-}
-int processFocusIn (int int0, int int1, int int2) {
- int result = super.processFocusIn (int0, int1, int2);
- if (caret != null) caret.setFocus ();
- return result;
-}
-int processFocusOut(int int0, int int1, int int2) {
- int result = super.processFocusOut (int0, int1, int2);
- if (caret != null) caret.killFocus ();
- return result;
-}
-/*
-int processMouseDown (int callData, int arg1, int int2) {
- if ((UtilFuncs.GTK_WIDGET_GET_FLAGS(handle) & OS.GTK_HAS_FOCUS) == 0)
- OS.gtk_widget_grab_focus(handle);
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int eventType = SWT.MouseDown;
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- if (gdkEvent.button == 3 && menu != null) {
- menu.setVisible (true);
- }
- return 1;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- return 1;
-}
-*/
-int processPaint (int callData, int arg1, int int2) {
- //if (!hooks (SWT.Paint)) return 0;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 0;
-}
-void releaseWidget () {
- if (caret != null) caret.releaseWidget ();
- caret = null;
- super.releaseWidget ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
deleted file mode 100644
index 85c62c27b7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
+++ /dev/null
@@ -1,508 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an i-beam that is typically used
- * as the insertion point for text.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Caret extends Widget {
- Canvas parent;
- int x, y, width, height;
- boolean moved, resized;
- boolean isVisible,isShowing;
- int blinkRate = 500;
- Image image;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Caret (Canvas parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-void createWidget (int index) {
- super.createWidget (index);
- isVisible = true;
- if (parent.getCaret () == null) {
- parent.setCaret (this);
- }
-}
-
-boolean blinkCaret () {
- if (!isVisible) return true;
- if (!isShowing) return showCaret();
- if (blinkRate==0) return true;
- return hideCaret();
-}
-
-boolean drawCaret () {
- if (parent == null) return false;
- if (parent.isDisposed ()) return false;
-
- /* The parent is a Canvas; its handle is a GtkDrawingArea.
- * Get the DA's GDK window to draw on.
- */
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, parent.handle, GtkWidget.sizeof);
- int window = widget.window;
-
- /* Create the GC, and set the working color and rop. */
- int gc = OS.gdk_gc_new(window);
- GdkGCValues gcvalues = new GdkGCValues();
- OS.gdk_gc_get_values(gc, gcvalues);
- /* Actually, we should look at the background and foreground colors.
- * This would require distinguishing between the cases when the GC
- * gives the color as RGB or Pixel, and in the case of Pixel, we
- * would need to distinguish between direct and indexed color.
- * In general, it's not easy to find out the RGB value of a GdkColor
- * (somebody please correct me if I am wrong).
- */
- GdkColor c = new GdkColor();
- c.red = c.green = c.blue = (short)0xFFFF;
- OS.gdk_color_alloc(OS.gdk_colormap_get_system(), c);
- OS.gdk_gc_set_foreground(gc, c);
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- /* Draw the caret */
- int nWidth = width;
- if (nWidth <= 0) nWidth = 2;
- OS.gdk_draw_rectangle(window, gc, 1, x, y, nWidth, height);
- OS.gdk_gc_destroy(gc);
- return true;
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Rectangle (x, y, width, height);
-}
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getFont ();
-}
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Point (x, y);
-}
-/**
- * Returns the receiver's parent, which must be a <code>Canvas</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Canvas getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns a point describing the receiver's size.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Point (width, height);
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return isVisible;
-}
-boolean hideCaret () {
-// Display display = getDisplay ();
-// if (display.currentCaret != this) return false;
- if (!isShowing) return true;
- isShowing = false;
- return drawCaret ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return isVisible && parent.isVisible (); // && parent.hasFocus ();
-}
-void killFocus () {
-// OS.DestroyCaret ();
-// self restoreFont.
-}
-void move () {
- showCaret();
- moved = false;
-}
-void releaseChild () {
- super.releaseChild ();
- if (this == parent.getCaret ()) parent.setCaret (null);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-void resize () {
- int hwnd = parent.handle;
- if (hwnd == 0) return;
-// OS.DestroyCaret ();
-// OS.CreateCaret (hwnd, 0, width, height);
-// OS.SetCaretPos (x, y);
-// OS.ShowCaret (hwnd);
-// self move.
-// showCaret();
- resized = false;
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- boolean samePosition, sameExtent, showing;
- samePosition = (this.x == x) && (this.y == y);
- sameExtent = (this.width == width) && (this.height == height);
- if (samePosition && sameExtent) return;
- if (isShowing) hideCaret ();
- this.x = x; this.y = y;
- this.width = width; this.height = height;
- if (sameExtent) {
- moved = true;
- if (isVisible ()) move ();
- } else {
- resized = true;
- if (isVisible ()) resize ();
- }
- if(isVisible())
- showCaret ();
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-void setFocus () {
- Display display = getDisplay();
- if (display.currentCaret==this) return;
- display.setCurrentCaret(this);
- if (isVisible) showCaret ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (font != null && font.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-/**
- * Returns the image that the receiver will use to paint the caret.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Sets the image that the receiver will use to paint the caret
- * to the image specified by the argument, or to the default
- * which is a filled rectangle if the argument is null
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (isShowing) hideCaret ();
- this.image = image;
- if (isShowing) showCaret ();
-}
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- setBounds (x, y, width, height);
-}
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-/**
- * Sets the receiver's size to the point specified by the arguments.
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (this.width == width && this.height == height) return;
- this.width = width; this.height = height;
- resized = true;
- if (isVisible ()) resize ();
-}
-/**
- * Sets the receiver's size to the point specified by the argument.
- *
- * @param size the new extent for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (visible == isVisible) return;
- if (isVisible = visible) {
- showCaret ();
- } else {
- hideCaret ();
- }
-
-}
-boolean showCaret () {
-// if (getDisplay ().currentCaret != this) return false;
- if (isShowing) return true;
- isShowing = true;
- return drawCaret ();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
deleted file mode 100644
index ebe8093461..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a color
- * from a predefined set of available colors.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ColorDialog extends Dialog {
- RGB rgb;
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent) {
- this (parent, SWT.NULL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-int cancelFunc (int widget, int callData) {
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int colorInfo) {
- OS.gtk_main_quit ();
- return 0;
-}
-/**
- * Returns the currently selected color in the receiver.
- *
- * @return the RGB value for the selected color, may be null
- *
- * @see PaletteData#getRGBs
- */
-public RGB getRGB () {
- return rgb;
-}
-int okFunc (int widget, int callData) {
- GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
- OS.memmove (dialog, callData, GtkColorSelectionDialog.sizeof);
- double [] color = new double [4];
- OS.gtk_color_selection_get_color (dialog.colorsel, color);
- rgb = new RGB ((int)(color [0] * 256), (int)(color [1] * 256), (int)(color [2] * 256));
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return the selected color, or null if the dialog was
- * cancelled, no color was selected, or an error
- * occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public RGB open () {
- int handle;
- byte [] titleBytes;
- titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_color_selection_dialog_new (titleBytes);
- GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
- OS.memmove (dialog, handle, GtkColorSelectionDialog.sizeof);
- OS.gtk_widget_hide (dialog.help_button);
- if (rgb != null) {
- double [] color = new double [4];
- color [0] = (double)rgb.red / 256;
- color [1] = (double)rgb.green / 256;
- color [2] = (double)rgb.blue / 256;
- OS.gtk_color_selection_set_color (dialog.colorsel, color);
- }
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
- OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
- rgb = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return rgb;
-}
-/**
- * Returns the receiver's selected color to be the argument.
- *
- * @param rgb the new RGB value for the selected color, may be
- * null to let the platform to select a default when
- * open() is called
- *
- * @see PaletteData#getRGBs
- */
-public void setRGB (RGB rgb) {
- this.rgb = rgb;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
deleted file mode 100644
index b192c92336..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ /dev/null
@@ -1,1077 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are controls that allow the user
- * to choose an item from a list of items, or optionally
- * enter a new value by typing it into an editable text
- * field. Often, <code>Combo</code>s are used in the same place
- * where a single selection <code>List</code> widget could
- * be used but space is limited. A <code>Combo</code> takes
- * less space than a <code>List</code> widget and shows
- * similar information.
- * <p>
- * Note: Since <code>Combo</code>s can contain both a list
- * and an editable text field, it is possible to confuse methods
- * which access one versus the other (compare for example,
- * <code>clearSelection()</code> and <code>deselectAll()</code>).
- * The API documentation is careful to indicate either "the
- * receiver's list" or the "the receiver's text field" to
- * distinguish between the two cases.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see List
- */
-
-public class Combo extends Composite {
- int padHandle, glist;
- int textLimit = LIMIT;
- public final static int LIMIT;
-
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0xFFFF;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Combo (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- String [] newItems = new String [items.length + 1];
- System.arraycopy (items, 0, newItems, 0, items.length);
- newItems [items.length] = string;
- setItems (newItems);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!(0 <= index && index <= getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- String [] items = getItems ();
- String [] newItems = new String [items.length + 1];
- System.arraycopy (items, 0, newItems, 0, items.length);
- newItems [index] = string;
- setItems (newItems);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a combo box that has a border using Windows style
- * bits. All combo boxes draw their own border and
- * do not use the standard Windows border styles.
- * Therefore, no matter what style bits are specified,
- * clear the BORDER bits so that the SWT style will
- * match the Windows widget.
- *
- * The Windows behavior is currently implemented on
- * all platforms.
- */
- style &= ~SWT.BORDER;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
- if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
- return style;
-}
-
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- int position = OS.gtk_editable_get_position (combo.entry);
- OS.gtk_editable_set_position (combo.entry, position);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- padHandle = OS.gtk_fixed_new ();
- if (padHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_combo_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new();
- if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- boolean isEditable = (style & SWT.READ_ONLY) == 0;
- OS.gtk_entry_set_editable (combo.entry, isEditable);
-}
-
-void configure () {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, padHandle);
- OS.gtk_fixed_put (padHandle, fixedHandle, (short)0, (short)0);
- OS.gtk_fixed_put (padHandle, handle, (short)0, (short)0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- return _computeSize(wHint, hHint, changed);
-}
-
-void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(padHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (handle);
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (padHandle);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- WidgetTable.remove (combo.entry);
- WidgetTable.remove (combo.list);
- WidgetTable.remove (combo.button);
-}
-
-void hookEvents () {
- // TO DO - expose, enter/exit, focus in/out
- super.hookEvents ();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- // TO DO - fix multiple selection events for one user action
- signal_connect (combo.list, "select_child", SWT.Selection, 3);
- signal_connect_after (combo.entry, "changed", SWT.Modify, 2);
- int mask =
- OS.GDK_POINTER_MOTION_MASK |
- OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
- OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK;
- int [] handles = new int [] {combo.entry, combo.list, combo.button};
- for (int i=0; i<handles.length; i++) {
- int handle = handles [i];
- if (!OS.GTK_WIDGET_NO_WINDOW (handle)) {
- OS.gtk_widget_add_events (handle, mask);
- }
- signal_connect_after (handle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (handle, "button_press_event", SWT.MouseDown, 3);
- signal_connect_after (handle, "button_release_event", SWT.MouseUp, 3);
- signal_connect_after (handle, "key_press_event", SWT.KeyDown, 3);
- signal_connect_after (handle, "key_release_event", SWT.KeyUp, 3);
- }
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==padHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- if (h== combo.entry) return true;
- if (h== combo.list) return true;
- if (h== combo.button) return true;
- return false;
-}
-
-void _connectChild (int h) {
- OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(fixedHandle);
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
- UtilFuncs.setSize (fixedHandle, width,height);
- UtilFuncs.setSize (handle, width,height);
- return differentExtent;
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- setItems (getItems ());
-}
-
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget();
- setItems (getItems ());
-}
-
-/*
- * FIXME
-protected boolean hasFocus () {
- return super.hasFocus();
-}
-*/
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- String [] items = getItems ();
- if (!(0 <= index && index < items.length)) {
- error (SWT.ERROR_CANNOT_GET_ITEM);
- }
- return items [index];
-}
-
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- if (glist == 0) return 0;
- return OS.g_list_length (glist);
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- /* FIXME */
- return 0;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- if (glist == 0) return new String [0];
- int count = OS.g_list_length (glist);
- String [] items = new String [count];
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- int length = OS.strlen (data);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, data, length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- items [i] = new String (buffer2, 0, length);
- }
- return items;
-}
-
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- GtkEditable editable = new GtkEditable();
- OS.memmove (editable, combo.entry, GtkEditable.sizeof);
- return new Point (editable.selection_start_pos, editable.selection_end_pos);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- //NOT RIGHT FOR EDITABLE
- return indexOf (getText ());
-}
-
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- int address = OS.gtk_entry_get_text (combo.entry);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- /*
- * This code is intentionally commented.
- * The GTK documentation explicitly states
- * that this address should not be freed.
- */
-// OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-String getText (int start, int stop) {
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- return getText ().substring (start, stop - 1);
-}
-
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget();
- /* A native approach, just measuring the entry:
- * return UtilFuncs.getSize(_entryHandle).y;
- * does not work - the entry is the same size as
- * the whole combo.
- */
- error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
- return 0;
-}
-
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- return textLimit;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- for (int i=start; i<items.length; i++) {
- if (string.equals(items [i])) return i;
- }
- return -1;
-}
-
-int processModify (int arg0, int arg1, int int2) {
- sendEvent (SWT.Modify);
- return 0;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-void register () {
- super.register ();
- WidgetTable.put (padHandle, this);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- WidgetTable.put (combo.entry, this);
- WidgetTable.put (combo.list, this);
- WidgetTable.put (combo.button, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- int padHandle = 0;
-}
-
-void releaseWidget () {
- if (glist != 0) {
- int count = OS.g_list_length (glist);
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- if (data != 0) OS.g_free (data);
- }
- OS.g_list_free (glist);
- }
- glist = 0;
- super.releaseWidget ();
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (!(0 <= index && index < getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- String [] oldItems = getItems ();
- String [] newItems = new String [oldItems.length - 1];
- System.arraycopy (oldItems, 0, newItems, 0, index);
- System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1);
- setItems (newItems);
-}
-
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- if (!(0 <= start && start <= end && end < getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- String [] oldItems = getItems ();
- String [] newItems = new String [oldItems.length - (end - start + 1)];
- System.arraycopy (oldItems, 0, newItems, 0, start);
- System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1);
- setItems (newItems);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index != -1) remove (index);
-}
-
-/**
- * Removes all of the items from the receiver's list.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- setItems (new String [0]);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- String [] items = getItems ();
- if (index >= items.length) return;
- String selectedText = items [index];
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_block_by_data (combo.list, SWT.Selection);
- OS.gtk_list_select_item (combo.list, index);
- OS.gtk_entry_set_text (combo.entry, Converter.wcsToMbcs (null, selectedText, true));
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_unblock_by_data (combo.list, SWT.Selection);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!(0 <= index && index <= getItemCount ())) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- String [] items = getItems ();
- items [index] = string;
- setItems (items);
-}
-
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- if (items.length == 0) {
- OS.gtk_list_clear_items (combo.list, 0, -1);
- //LEAK
- glist = 0;
- } else {
- int new_glist = 0;
- for (int i=0; i<items.length; i++) {
- String string = items [i];
- // FIXME leaked strings and glist
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int data = OS.g_malloc (buffer.length);
- OS.memmove (data, buffer, buffer.length);
- new_glist = OS.g_list_append (new_glist, data);
- }
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_block_by_data (combo.list, SWT.Selection);
- OS.gtk_combo_set_popdown_strings (handle, new_glist);
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_unblock_by_data (combo.list, SWT.Selection);
- if (glist != 0) {
- int count = OS.g_list_length (glist);
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- if (data != 0) OS.g_free (data);
- }
- OS.g_list_free (glist);
- }
- glist = new_glist;
- }
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_editable_delete_text (combo.entry, 0, -1);
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
-}
-
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo gtkCombo = new GtkCombo ();
- OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
- int entry = gtkCombo.entry;
- OS.gtk_editable_set_position (entry, selection.x);
- OS.gtk_editable_select_region (entry, selection.x, selection.y);
-}
-
-protected boolean setTabGroupFocus () {
- return setFocus ();
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo gtkCombo = new GtkCombo ();
- OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
- int entry = gtkCombo.entry;
- OS.gtk_editable_delete_text (entry, 0, -1);
- int [] position = new int [1];
- byte [] buffer = Converter.wcsToMbcs (null, string);
- OS.gtk_editable_insert_text (entry, buffer, buffer.length, position);
- OS.gtk_editable_set_position (entry, 0);
-}
-
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- this.textLimit = (short) limit;
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- OS.gtk_entry_set_max_length (combo.entry, (short) limit);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
deleted file mode 100644
index 7c1b9d83d7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ /dev/null
@@ -1,504 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are controls which are capable
- * of containing other controls.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are constructed from aggregates
- * of other controls.
- * </p>
- *
- * @see Canvas
- */
-public class Composite extends Scrollable {
- int topHandle, eventBoxHandle, fixedHandle, radioHandle;
- Layout layout;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-Composite () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Composite (Composite parent, int style) {
- super (parent, style);
-}
-
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
-
- topHandle = OS.gtk_event_box_new();
- if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new(0,0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_drawing_area_new();
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(topHandle, scrolledHandle);
- _fillBin(scrolledHandle, eventBoxHandle);
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
-}
-
-void setHandleStyle() {
- setScrollingPolicy();
-}
-
-void showHandle() {
- OS.gtk_widget_realize (topHandle);
- OS.gtk_widget_show_now(topHandle);
-
- OS.gtk_widget_show (scrolledHandle);
-
- OS.gtk_widget_realize (eventBoxHandle);
- OS.gtk_widget_show_now(eventBoxHandle);
-
- OS.gtk_widget_realize (fixedHandle);
- OS.gtk_widget_show_now(fixedHandle);
-
- OS.gtk_widget_realize (handle);
- OS.gtk_widget_show_now (handle);
-}
-
-void register () {
- super.register ();
- if (topHandle != 0) WidgetTable.put (topHandle, this);
- if (eventBoxHandle != 0) WidgetTable.put (eventBoxHandle, this);
- if (fixedHandle != 0) WidgetTable.put (fixedHandle, this);
-}
-
-void deregister () {
- super.deregister ();
- if (topHandle != 0) WidgetTable.remove (topHandle);
- if (eventBoxHandle != 0) WidgetTable.remove (eventBoxHandle);
- if (fixedHandle != 0) WidgetTable.remove (fixedHandle);
-}
-
-int topHandle() {
- return topHandle;
-}
-
-int parentingHandle() {
- return fixedHandle;
-}
-
-/**
- * Answer whether the argument points to an OS widget that is
- * implementing the receiver, i.e., one of my own handles
- */
-boolean isMyHandle(int h) {
- if (h==topHandle) return true;
- if (h==eventBoxHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- if (h==radioHandle) return true;
- return false;
-}
-
-
-
-
-/*
- * === GEOMETRY - PHYSICAL ===
- */
-
-
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- layout();
-}
-
-public void setSize (int width, int height) {
- super.setSize(width, height);
- layout();
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
- Point clientSize = UtilFuncs.getSize(fixedHandle);
- OS.gtk_drawing_area_size(handle, width, height);
- UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
- return differentExtent;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- Point size;
- if (layout != null) {
- if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = new Point (wHint, hHint);
- }
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = computeTrim (0, 0, size.x, size.y);
- return new Point (trim.width, trim.height);
-}
-
-void initializeTrim() {
- /* Temporary implementation - I just measured the scrollbars
- * with one particular theme. The fair thing to do is get
- * the real dimensions from gtk.
- */
- trim = new Trim();
- if ((style&SWT.H_SCROLL)!=0) trim.bottom=18;
- if ((style&SWT.V_SCROLL)!=0) trim.right=18;
-}
-
-
-/*
- * === GEOMETRY - LAYOUT ===
- */
-
-/**
- * Returns layout which is associated with the receiver, or
- * null if one has not been set.
- *
- * @return the receiver's layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Layout getLayout () {
- checkWidget();
- return layout;
-}
-
-/**
- * Gets the last specified tabbing order for the control.
- *
- * @return tabList the ordered list of controls representing the tab order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setTabList
- */
-public Control [] getTabList () {
- return new Control [0];
-}
-
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- this.layout = layout;
-}
-
-int _gdkWindow() {
- int windowHandle = _gdkWindow(handle);
- if (windowHandle==0) error(SWT.ERROR_UNSPECIFIED);
- return windowHandle;
-}
-
-/**
- * Returns an array containing the receiver's children.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of children, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return an array of children
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control [] getChildren () {
- checkWidget();
- return _getChildren();
-}
-
-Control [] _getChildren () {
- return _getChildren(parentingHandle());
-}
-
-/**
- * Answer the array of the children of the specified handle,
- * filtering out widgets we don't consider our children.
- * That is, the OS may return some children that don't qualify
- * as such under SWT terminology - e.g., Items are not children.
- */
-Control [] _getChildren (int h) {
- if (h==0) {
- error(SWT.ERROR_UNSPECIFIED);
- }
- int list = OS.gtk_container_children (h);
- int count = OS.g_list_length (list);
- java.util.Vector children = new java.util.Vector();
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (list, i);
- if (!isMyHandle(data)) {
- Control child = _childFromHandle(data);
- if (child != null) children.addElement(child);
- }
- }
- Control[] answer = new Control[children.size()];
- children.copyInto(answer);
- return answer;
-}
-/**
- * Consider the argument a handle of one of the receiver's children.
- * If the argument is not a handle to a widget, or the widget is
- * not our child in SWT (not OS) terminology, return null.
- */
-Control _childFromHandle(int h) {
- Widget child = WidgetTable.get(h);
- return (Control)child;
-}
-
-public Rectangle getClientArea () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- return _getClientArea ();
-}
-
-public Rectangle _getClientArea () {
- Point size = _getClientAreaSize ();
- return new Rectangle (0, 0, size.x, size.y);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the receiver does not have a layout, do nothing.
- * <p>
- * This is equivalent to calling <code>layout(true)</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout () {
- layout (true);
-}
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the the argument is <code>true</code> the layout must not rely
- * on any cached information it is keeping about the children. If it
- * is <code>false</code> the layout may (potentially) simplify the
- * work it is doing by assuming that the state of the none of the
- * receiver's children has changed since the last layout.
- * If the receiver does not have a layout, do nothing.
- *
- * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout (boolean changed) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (layout == null) return;
- layout.layout (this, changed);
-}
-
-Point minimumSize () {
- Control [] children = _getChildren ();
- int width = 0, height = 0;
- for (int i=0; i<children.length; i++) {
- Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
- }
- return new Point (width, height);
-}
-int processResize (int int0, int int1, int int2) {
- sendEvent (SWT.Resize);
- layout();
- return 0;
-}
-int radioGroup() {
- if (radioHandle==0) _initializeRadioGroup();
- return OS.gtk_radio_button_group(radioHandle);
-}
-
-public void redraw () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-// Point size = _getSize();
-// GtkWidget widget = new GtkWidget(handle);
-// _redraw(0, 0, size.x, size.y, true);
-OS.gtk_widget_queue_draw(handle);
-}
-
-void _initializeRadioGroup() {
- radioHandle = OS.gtk_radio_button_new(0);
-}
-
-/**
- * Adopt the widget h as our child.
- */
-void _connectChild (int h) {
- OS.gtk_fixed_put (parentingHandle(), h, (short)0, (short)0);
-}
-
-void releaseChildren () {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child != null && !child.isDisposed ()) {
- child.releaseWidget ();
- child.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseChildren ();
- super.releaseWidget ();
- layout = null;
-}
-void releaseHandle () {
- super.releaseHandle ();
- topHandle = eventBoxHandle = fixedHandle = radioHandle = 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- //NOT DONE - only grab when not already grabbing
- if ((state & CANVAS) != 0) OS.gtk_grab_add (handle);
- return super.processMouseDown (callData, arg1, int2);
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- //NOT DONE - only release when last button goes up
- if ((state & CANVAS) != 0) OS.gtk_grab_remove (handle);
- return super.processMouseUp (callData, arg1, int2);
-}
-
-int processFocusIn(int int0, int int1, int int2) {
- OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_HAS_FOCUS);
- return super.processFocusIn(int0, int1, int2);
-}
-int processFocusOut(int int0, int int1, int int2) {
- OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_HAS_FOCUS);
- return super.processFocusOut(int0, int1, int2);
-}
-
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.getVisible () && child.setFocus ()) return true;
- }
- return super.setFocus ();
-}
-
-/**
- * Sets the tabbing order for the specified controls to
- * match the order that they occur in the argument list.
- *
- * @param tabList the ordered list of controls representing the tab order; must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTabList (Control [] tabList) {
-}
-
-protected void checkSubclass () {
- /* Do nothing - Subclassing is allowed */
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
deleted file mode 100644
index eedad44c27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ /dev/null
@@ -1,2229 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Control is the abstract superclass of all windowed user interface classes.
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b>
- * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
- * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Control extends Widget implements Drawable {
-
- Composite parent;
- Menu menu;
- String toolTipText;
- Object layoutData;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-Control () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Control (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-
-abstract void createHandle(int index);
-
-int eventHandle () {
- return handle;
-}
-
-/**
- * Connect the appropriate signal handlers.
- *
- * At a minimum, we must connect
- * <ul>
- * <li>expose_event
- * <li>button_press_event / button_release_event
- * <li>motion_notify_event
- * <li>enter_notify_event / leave_notify_event
- * <li>key_press_event / key_release_event
- * <li>focus_in_event / focus_out_event
- * </ul>
- *
- * The possible mask bits are:
- * <ul>
- * GDK_EXPOSURE_MASK |
- * GDK_POINTER_MOTION_MASK |
- * GDK_POINTER_MOTION_HINT_MASK |
- * GDK_ENTER_NOTIFY_MASK |
- * GDK_LEAVE_NOTIFY_MASK |
- * GDK_BUTTON_PRESS_MASK
- * GDK_BUTTON_RELEASE_MASK
- * GDK_KEY_PRESS_MASK
- * GDK_KEY_RELEASE_MASK
- * GDK_FOCUS_CHANGE_MASK
- * </ul>
- */
-void hookEvents () {
- signal_connect (handle, "expose_event", SWT.Paint, 3);
- int mask =
- OS.GDK_POINTER_MOTION_MASK |
- OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
- OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
- OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
- OS.GDK_FOCUS_CHANGE_MASK;
- int eventHandle = eventHandle ();
- if (!OS.GTK_WIDGET_NO_WINDOW (eventHandle)) {
- OS.gtk_widget_add_events (eventHandle, mask);
- }
- signal_connect_after (eventHandle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (eventHandle, "button_press_event", SWT.MouseDown, 3);
- signal_connect_after (eventHandle, "button_release_event", SWT.MouseUp, 3);
- signal_connect_after (eventHandle, "enter_notify_event", SWT.MouseEnter, 3);
- signal_connect_after (eventHandle, "leave_notify_event", SWT.MouseExit, 3);
- signal_connect_after (eventHandle, "key_press_event", SWT.KeyDown, 3);
- signal_connect_after (eventHandle, "key_release_event", SWT.KeyUp, 3);
- signal_connect_after (eventHandle, "focus_in_event", SWT.FocusIn, 3);
- signal_connect_after (eventHandle, "focus_out_event", SWT.FocusOut, 3);
-}
-
-abstract void setHandleStyle ();
-void setInitialSize() { UtilFuncs.setZeroSize(topHandle()); }
-void configure () {
- // Do NOT directly use gtk_fixed_put in configure(),
- // because not all composites have GtkFixed as their
- // parenting (bottom) handle.
- _connectParent();
-}
-void _connectParent() {
- parent._connectChild(topHandle());
-}
-/**
- * Every Control must implement this to map the gtk widgets,
- * and also realize those that have to be realized - this means
- * create the actual X window so that there are no surprizes
- * if the user calls a method expecting the X window to be there.
- * Widgets normally do it by invoking gtk_widget_show() on all
- * handles, and then doing gtk_widget_realize() on bottommost
- * handle, which will realize everything above as well.
- * An exception to this is the Shell, which we do NOT realize
- * at this point.
- */
-abstract void showHandle();
-
-int topHandle() {
- return handle;
-}
-
-int paintHandle() {
- return handle;
-}
-
-/*
- * === GEOMETRY ===
- */
-
-int computeHandle () {
- return handle;
-}
-
-Point _computeSize (int wHint, int hHint, boolean changed) {
- int handle = computeHandle ();
- byte [] gtk_aux_info = Converter.wcsToMbcs (null, "gtk-aux-info", true);
- int id = OS.g_quark_from_string (gtk_aux_info);
- int aux_info = OS.gtk_object_get_data_by_id (handle, id);
- OS.gtk_object_set_data_by_id (handle, id, 0);
- GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (handle, requisition);
- OS.gtk_object_set_data_by_id (handle, id, aux_info);
- int width = wHint == SWT.DEFAULT ? requisition.width : wHint;
- int height = hHint == SWT.DEFAULT ? requisition.height : hHint;
- return new Point (width, height);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size of the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- return computeSize (wHint, hHint, true);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p><p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
- * @return the preferred size of the control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- return _computeSize (wHint, hHint, changed);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- return _getBounds();
-}
-
-/**
- * The actual implementation for getBounds().
- * Concrete controls implement their means to answer the location
- * and size by overriding _getLocation() and _getSize().
- */
-final Rectangle _getBounds() {
- Point location = _getLocation();
- Point size = _getSize();
- return new Rectangle(location.x, location.y, size.x, size.y);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean differentOrigin = _setLocation(x,y);
- boolean differentExtent = _setSize (width,height);
- if (differentOrigin) sendEvent (SWT.Move);
- if (differentExtent) sendEvent (SWT.Resize);
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- return _getLocation();
-}
-
-Point _getLocation () {
- return UtilFuncs.getLocation(topHandle());
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation(int x, int y) {
- checkWidget();
- if (_setLocation(x,y)) sendEvent(SWT.Move);
-}
-
-boolean _setLocation(int x, int y) {
- return UtilFuncs.setLocation(parent.parentingHandle(), topHandle(), x,y);
-}
-
-/**
- * Returns a point describing the receiver's size. The
- * x coordinate of the result is the width of the receiver.
- * The y coordinate of the result is the height of the
- * receiver.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- return _getSize();
-}
-Point _getSize() {
- return UtilFuncs.getSize(topHandle());
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause them to be
- * set to zero instead.
- * </p>
- *
- * @param size the new size for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-/**
- * Sets the receiver's size to the point specified by the arguments.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- // Even though GTK+ will not let any widget be smaller
- // than 3@3, we don't care about it here, as this kind
- // of platform weirdness is handled in UtilFuncs.
- width = Math.max(width, 0);
- height = Math.max(height, 0);
- if (_setSize(width, height)) sendEvent(SWT.Resize);
-}
-boolean _setSize(int width, int height) { return UtilFuncs.setSize(topHandle(), width, height); }
-
-/**
- * Moves the receiver above the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the top of the drawing order. The control at
- * the top of the drawing order will not be covered by other
- * controls even if they occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveAbove (Control control) {
- checkWidget();
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle(), GtkWidget.sizeof);
- int topGdkWindow = widget.window;
- if (topGdkWindow!=0) OS.gdk_window_raise (topGdkWindow);
-}
-
-/**
- * Moves the receiver below the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the bottom of the drawing order. The control at
- * the bottom of the drawing order will be covered by all other
- * controls which occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveBelow (Control control) {
- checkWidget();
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle(), GtkWidget.sizeof);
- int topGdkWindow = widget.window;
- if (topGdkWindow!=0) OS.gdk_window_lower (topGdkWindow);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack () {
- pack (true);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- * <p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack (boolean changed) {
- checkWidget();
- setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
-}
-
-/**
- * Sets the layout data associated with the receiver to the argument.
- *
- * @param layoutData the new layout data for the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayoutData (Object layoutData) {
- checkWidget();
- this.layoutData = layoutData;
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in display relative coordinates,
- * to coordinates relative to the receiver.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toControl (Point point) {
- checkWidget();
- int[] x = new int[1], y = new int[1];
- OS.gdk_window_get_origin(_gdkWindow(), x,y);
- int ctlX = point.x - x[0];
- int ctlY = point.y - y[0];
- return new Point (ctlX, ctlY);
-}
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in coordinates relative to
- * the receiver, to display relative coordinates.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toDisplay (Point point) {
- checkWidget();
- int[] x = new int[1], y = new int[1];
- OS.gdk_window_get_origin(_gdkWindow(), x,y);
- return new Point (x[0]+point.x, y[0]+point.y);
-}
-// === End of GEOMETRY Category ===
-
-
-/*
- * == ADD/REMOVE LISTENERS ==
- */
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control gains or loses focus, by sending
- * it one of the messages defined in the <code>FocusListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #removeFocusListener
- */
-public void addFocusListener(FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.FocusIn,typedListener);
- addListener(SWT.FocusOut,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard, by sending
- * it one of the messages defined in the <code>KeyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #removeKeyListener
- */
-public void addKeyListener(KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.KeyUp,typedListener);
- addListener(SWT.KeyDown,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when mouse buttons are pressed and released, by sending
- * it one of the messages defined in the <code>MouseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #removeMouseListener
- */
-public void addMouseListener(MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseDown,typedListener);
- addListener(SWT.MouseUp,typedListener);
- addListener(SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse moves, by sending it one of the
- * messages defined in the <code>MouseMoveListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #removeMouseMoveListener
- */
-public void addMouseMoveListener(MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseMove,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse passes or hovers over controls, by sending
- * it one of the messages defined in the <code>MouseTrackListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #removeMouseTrackListener
- */
-public void addMouseTrackListener (MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseEnter,typedListener);
- addListener (SWT.MouseExit,typedListener);
- addListener (SWT.MouseHover,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver needs to be painted, by sending it
- * one of the messages defined in the <code>PaintListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #removePaintListener
- */
-public void addPaintListener(PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Paint,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when traversal events occur, by sending it
- * one of the messages defined in the <code>TraverseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #removeTraverseListener
- */
-public void addTraverseListener (TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Traverse,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control gains or loses focus.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #addFocusListener
- */
-public void removeFocusListener(FocusListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.FocusIn, listener);
- eventTable.unhook (SWT.FocusOut, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #addKeyListener
- */
-public void removeKeyListener(KeyListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.KeyUp, listener);
- eventTable.unhook (SWT.KeyDown, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when mouse buttons are pressed and released.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #addMouseListener
- */
-public void removeMouseListener (MouseListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseDown, listener);
- eventTable.unhook (SWT.MouseUp, listener);
- eventTable.unhook (SWT.MouseDoubleClick, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse moves.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #addMouseMoveListener
- */
-public void removeMouseMoveListener(MouseMoveListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseMove, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse passes or hovers over controls.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #addMouseTrackListener
- */
-public void removeMouseTrackListener(MouseTrackListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseEnter, listener);
- eventTable.unhook (SWT.MouseExit, listener);
- eventTable.unhook (SWT.MouseHover, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver needs to be painted.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #addPaintListener
- */
-public void removePaintListener(PaintListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Paint, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when traversal events occur.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #addTraverseListener
- */
-public void removeTraverseListener(TraverseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Traverse, listener);
-}
-
-
-/*
- * Return (GTKWIDGET)h->window.
- */
-final int _gdkWindow(int h) {
- /* Temporary code.
- * This check is not necessary as the (internal) callers
- * always make sure h!=0.
- */
- if (h==0) error(SWT.ERROR_CANNOT_BE_ZERO);
-
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, h, GtkWidget.sizeof);
- return widget.window;
-}
-
-int _gdkWindow() {
- int windowHandle = _gdkWindow(handle);
- if (windowHandle==0) error(SWT.ERROR_NO_HANDLES);
- return windowHandle;
-}
-
-/**
- * Forces the receiver to have the <em>keyboard focus</em>, causing
- * all keyboard events to be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setFocus
- */
-public boolean forceFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_grab_focus (handle);
- return true;
-}
-
-/**
- * Returns the receiver's background color.
- *
- * @return the background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getBackground () {
- checkWidget();
- return Color.gtk_new (_getBackgroundGdkColor());
-}
-
-/*
- * Subclasses should override this to pass a meaningful handle
- */
-GdkColor _getBackgroundGdkColor() {
- /* Override this */
- int h = paintHandle();
-
- int hStyle = OS.gtk_widget_get_style (handle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor ();
- color.pixel = style.bg0_pixel;
- color.red = style.bg0_red;
- color.green = style.bg0_green;
- color.blue = style.bg0_blue;
- return color;
-}
-
-/**
- * Returns the receiver's border width.
- *
- * @return the border width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getBorderWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return (style & SWT.BORDER) == 0 ? 0 : 1;
-}
-
-/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- if (parent == null) {
- error (SWT.ERROR_WIDGET_DISPOSED);
- }
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- int topHandle = topHandle ();
- return OS.GTK_WIDGET_SENSITIVE (topHandle);
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- return Font.gtk_new(_getFontHandle());
-}
-/*
- * Subclasses should override this, passing a meaningful handle
- */
-int _getFontHandle () {
- return UtilFuncs.getFont(handle);
-}
-
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getForeground () {
- checkWidget();
- return Color.gtk_new (_getForegroundGdkColor());
-}
-
-/*
- * Subclasses should override this to pass a meaningful handle
- */
-GdkColor _getForegroundGdkColor() {
- /* Override this */
- int h = paintHandle();
-
- int hStyle = OS.gtk_widget_get_style (handle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor ();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
- return color;
-}
-
-/**
- * Returns layout data which is associated with the receiver.
- *
- * @return the receiver's layout data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Object getLayoutData () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return layoutData;
-}
-
-/**
- * Returns the receiver's pop up menu if it has one, or null
- * if it does not. All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return menu;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Composite</code>
- * or null when the receiver is a shell that was created with null or
- * a display for a parent.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Composite getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell() {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return _getShell();
-}
-Shell _getShell() {
- return parent._getShell();
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return toolTipText;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return _getVisible();
-}
-boolean _getVisible() {
- return _getVisible(topHandle());
-}
-boolean _getVisible(int h) {
- return (OS.GTK_WIDGET_FLAGS(h) & OS.GTK_VISIBLE) != 0;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (data == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (paintHandle() == 0) error(SWT.ERROR_UNSPECIFIED);
-
- // Create the GC with default values for this control
- GtkWidget w = new GtkWidget();
- OS.memmove (w, paintHandle(), GtkWidget.sizeof);
-
- if (w.window == 0) error(SWT.ERROR_UNSPECIFIED);
- int gc = OS.gdk_gc_new(w.window);
-
- OS.gdk_gc_set_font(gc, _getFontHandle());
- OS.gdk_gc_set_background(gc, _getBackgroundGdkColor());
- OS.gdk_gc_set_foreground(gc, _getForegroundGdkColor());
-
- data.drawable = w.window;
- return gc;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int xGC, GCData data) {
- if(xGC == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gdk_gc_unref(xGC);
-}
-
-/**
- * Returns <code>true</code> if the underlying operating
- * system supports this reparenting, otherwise <code>false</code>
- *
- * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isReparentable () {
- checkWidget();
- return false;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- int topHandle = topHandle ();
- return OS.GTK_WIDGET_IS_SENSITIVE (topHandle);
-}
-
-/**
- * Returns <code>true</code> if the receiver has the user-interface
- * focus, and <code>false</code> otherwise.
- *
- * @return the receiver's focus state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isFocusControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_HAS_FOCUS)!=0;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- boolean result = getVisible ();
- if (parent != null)
- result = result && parent.isVisible();
- return result;
-}
-Decorations menuShell () {
- return parent.menuShell ();
-}
-
-int processKeyDown (int callData, int arg1, int int2) {
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
- boolean accelResult = OS.gtk_accel_groups_activate(_getShell().topHandle, gdkEvent.keyval, gdkEvent.state);
- if (!accelResult) sendKeyEvent (SWT.KeyDown, gdkEvent);
- return 1;
-}
-
-int processKeyUp (int callData, int arg1, int int2) {
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
- sendKeyEvent (SWT.KeyUp, gdkEvent);
- return 1;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_widget_grab_focus(handle);
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int eventType = SWT.MouseDown;
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- if (gdkEvent.button == 3 && menu != null) {
- menu.setVisible (true);
- }
- return 1;
-}
-
-int processMouseEnter (int arg0, int arg1, int int2) {
- //NOT IMPLEMENTED - event state
- sendEvent (SWT.MouseEnter);
- return 1;
-}
-int processMouseExit (int arg0, int arg1, int int2) {
- //NOT IMPLEMENTED - event state
- sendEvent (SWT.MouseExit);
- return 1;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- return 1;
-}
-
-int processMouseMove (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- Point where = _gdkWindowGetPointer();
- sendMouseEvent (SWT.MouseMove, 0, gdkEvent.state, gdkEvent.time, where.x, where.y);
- return 1;
-}
-Point _gdkWindowGetPointer() {
- int[] px = new int[1], py = new int[1];
- OS.gdk_window_get_pointer(_gdkWindow(), px, py, 0);
- return new Point(px[0], py[0]);
-}
-int processFocusIn(int int0, int int1, int int2) {
- postEvent(SWT.FocusIn);
- return 0;
-}
-int processFocusOut(int int0, int int1, int int2) {
- postEvent(SWT.FocusOut);
- return 0;
-}
-
-int processPaint (int callData, int int2, int int3) {
- if (!hooks (SWT.Paint)) return 1;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- GdkRectangle rect = new GdkRectangle ();
- rect.x = gdkEvent.x; rect.y = gdkEvent.y;
- rect.width = gdkEvent.width; rect.height = gdkEvent.height;
- OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
- gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-}
-
-/**
- * Causes the entire bounds of the receiver to be marked
- * as needing to be redrawn. The next time a paint request
- * is processed, the control will be completely painted.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Point size = _getSize();
- _redraw(0, 0, size.x, size.y, true);
-//OS.gtk_widget_queue_draw(handle);
-}
-/**
- * Causes the rectangular area of the receiver specified by
- * the arguments to be marked as needing to be redrawn.
- * The next time a paint request is processed, that area of
- * the receiver will be painted. If the <code>all</code> flag
- * is <code>true</code>, any children of the receiver which
- * intersect with the specified area will also paint their
- * intersecting areas. If the <code>all</code> flag is
- * <code>false</code>, the children will not be painted.
- *
- * @param x the x coordinate of the area to draw
- * @param y the y coordinate of the area to draw
- * @param width the width of the area to draw
- * @param height the height of the area to draw
- * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw (int x, int y, int width, int height, boolean all) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- _redraw(x, y, width, height, all);
-}
-protected void _redraw(int x, int y, int width, int height, boolean all) {
- OS.gdk_window_clear_area_e (_gdkWindow(), x, y, width, height);
-
-GdkRectangle rect = new GdkRectangle();
-rect.x = (short)x;
-rect.y = (short)y;
-rect.width = (short)width;
-rect.height =(short) height;
-//OS.gtk_widget_draw(handle, rect);
-OS.gtk_widget_queue_draw(handle);
-
-// OS.gtk_widget_queue_draw_area (handle, x, y, width, height);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- toolTipText = null;
- parent = null;
- menu = null;
- layoutData = null;
-}
-void sendKeyEvent (int type, GdkEventKey gdkEvent) {
- /* Look up the keysym and character(s) */
- int size = gdkEvent.length;
- if (gdkEvent.keyval == 0 && size == 0) return;
-
- /* If there is no composed string input by keypress, only send the keyvalue */
- if (size == 0 ) {
- Event event = new Event ();
- event.time = gdkEvent.time;
-// event.character = (char) 0; //no character sent
- event.keyCode = Display.translateKey (gdkEvent.keyval);
- event.character = (char) event.keyCode; //no character sent
- if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
- }
- else {
- byte [] buffer = new byte [size];
- OS.memmove (buffer, gdkEvent.string, size);
- /* Convert from MBCS to UNICODE and send the event */
- char [] result = Converter.mbcsToWcs (null, buffer);
- for (int i=0; i<result.length; i++) {
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.character = result [i];
- event.keyCode = result [i]; //0; //no keyCode sent
- if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
- }
- }
-}
-void sendMouseEvent (int type, int button, int mask, int time, int x, int y) {
- Event event = new Event ();
- event.time = time;
- event.button = button;
- event.x = x; event.y = y;
- if ((mask & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((mask & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((mask & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((mask & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((mask & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((mask & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
-}
-
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int hDefaultStyle = OS.gtk_widget_get_default_style ();
- int hStyle = OS.gtk_widget_get_style (handle);
- boolean makeCopy = hStyle == hDefaultStyle;
- hStyle = OS.gtk_style_copy (makeCopy ? hDefaultStyle : hStyle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- if (color == null) {
- GtkStyle defaultStyle = new GtkStyle ();
- OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
- style.bg0_pixel = defaultStyle.bg0_pixel;
- style.bg0_red = defaultStyle.bg0_red;
- style.bg0_green = defaultStyle.bg0_green;
- style.bg0_blue = defaultStyle.bg0_blue;
- style.bg1_pixel = defaultStyle.bg1_pixel;
- style.bg1_red = defaultStyle.bg1_red;
- style.bg1_green = defaultStyle.bg1_green;
- style.bg1_blue = defaultStyle.bg1_blue;
- style.bg2_pixel = defaultStyle.bg2_pixel;
- style.bg2_red = defaultStyle.bg2_red;
- style.bg2_green = defaultStyle.bg2_green;
- style.bg2_blue = defaultStyle.bg2_blue;
- style.bg3_pixel = defaultStyle.bg3_pixel;
- style.bg3_red = defaultStyle.bg3_red;
- style.bg3_green = defaultStyle.bg3_green;
- style.bg3_blue = defaultStyle.bg3_blue;
- style.bg4_pixel = defaultStyle.bg4_pixel;
- style.bg4_red = defaultStyle.bg4_red;
- style.bg4_green = defaultStyle.bg4_green;
- style.bg4_blue = defaultStyle.bg4_blue;
- } else {
- style.bg0_pixel = color.handle.pixel;
- style.bg0_red = color.handle.red;
- style.bg0_green = color.handle.green;
- style.bg0_blue = color.handle.blue;
- style.bg1_pixel = color.handle.pixel;
- style.bg1_red = color.handle.red;
- style.bg1_green = color.handle.green;
- style.bg1_blue = color.handle.blue;
- style.bg2_pixel = color.handle.pixel;
- style.bg2_red = color.handle.red;
- style.bg2_green = color.handle.green;
- style.bg2_blue = color.handle.blue;
- style.bg3_pixel = color.handle.pixel;
- style.bg3_red = color.handle.red;
- style.bg3_green = color.handle.green;
- style.bg3_blue = color.handle.blue;
- style.bg4_pixel = color.handle.pixel;
- style.bg4_red = color.handle.red;
- style.bg4_green = color.handle.green;
- style.bg4_blue = color.handle.blue;
- }
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
- if (makeCopy) {
- OS.gtk_style_unref (hStyle);
- }
-}
-
-/**
- * If the argument is <code>true</code>, causes the receiver to have
- * all mouse events delivered to it until the method is called with
- * <code>false</code> as the argument.
- *
- * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCapture (boolean capture) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- /*
- if (capture) {
- OS.gtk_widget_grab_focus (handle);
- } else {
- OS.gtk_widget_grab_default (handle);
- }
- */
-}
-/**
- * Sets the receiver's cursor to the cursor specified by the
- * argument, or to the default cursor for that kind of control
- * if the argument is null.
- * <p>
- * When the mouse pointer passes over a control its appearance
- * is changed to match the control's cursor.
- * </p>
- *
- * @param cursor the new cursor (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCursor (Cursor cursor) {
- checkWidget();
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
- int window = widget.window;
- if (window == 0) return;
- int hCursor = 0;
- if (cursor != null) hCursor = cursor.handle;
- OS.gdk_window_set_cursor (window, hCursor);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int topHandle = topHandle ();
- OS.gtk_widget_set_sensitive (topHandle, enabled);
- /*
- * This code is intentionally commented
- */
-// OS.gtk_widget_set_state (topHandle, enabled ? OS.GTK_STATE_NORMAL : OS.GTK_STATE_INSENSITIVE);
-// if (enabled) {
-// OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
-// } else {
-// OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
-// }
-}
-/**
- * Causes the receiver to have the <em>keyboard focus</em>,
- * such that all keyboard events will be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #forceFocus
- */
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return forceFocus ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
-
- /* The non-null font case */
- if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int fontHandle = OS.gdk_font_ref(font.handle);
- _setFontHandle(fontHandle);
- return;
- }
-
- /* The font argument is null, revert to default font */
- GtkStyle style = new GtkStyle();
- OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- int fontHandle = OS.gdk_font_ref(style.font);
- if (fontHandle==0) error(SWT.ERROR_NO_HANDLES);
- _setFontHandle(fontHandle);
-}
-
-/**
- * Actually set the receiver's font in the OS.
- * Concrete subclasses may override this method to operate
- * on a different handle.
- */
-void _setFontHandle (int f) {
- UtilFuncs.setFont(handle, f);
-}
-
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int hStyle = OS.gtk_widget_get_style (handle);
- hStyle = OS.gtk_style_copy (hStyle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- if (color == null) {
- int hDefaultStyle = OS.gtk_widget_get_default_style ();
- GtkStyle defaultStyle = new GtkStyle ();
- OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
- style.fg0_pixel = defaultStyle.fg0_pixel;
- style.fg0_red = defaultStyle.fg0_red;
- style.fg0_green = defaultStyle.fg0_green;
- style.fg0_blue = defaultStyle.fg0_blue;
- style.fg1_pixel = defaultStyle.fg1_pixel;
- style.fg1_red = defaultStyle.fg1_red;
- style.fg1_green = defaultStyle.fg1_green;
- style.fg1_blue = defaultStyle.fg1_blue;
- style.fg2_pixel = defaultStyle.fg2_pixel;
- style.fg2_red = defaultStyle.fg2_red;
- style.fg2_green = defaultStyle.fg2_green;
- style.fg2_blue = defaultStyle.fg2_blue;
- style.fg3_pixel = defaultStyle.fg3_pixel;
- style.fg3_red = defaultStyle.fg3_red;
- style.fg3_green = defaultStyle.fg3_green;
- style.fg3_blue = defaultStyle.fg3_blue;
- style.fg4_pixel = defaultStyle.fg4_pixel;
- style.fg4_red = defaultStyle.fg4_red;
- style.fg4_green = defaultStyle.fg4_green;
- style.fg4_blue = defaultStyle.fg4_blue;
- } else {
- style.fg0_pixel = color.handle.pixel;
- style.fg0_red = color.handle.red;
- style.fg0_green = color.handle.green;
- style.fg0_blue = color.handle.blue;
- style.fg1_pixel = color.handle.pixel;
- style.fg1_red = color.handle.red;
- style.fg1_green = color.handle.green;
- style.fg1_blue = color.handle.blue;
- style.fg2_pixel = color.handle.pixel;
- style.fg2_red = color.handle.red;
- style.fg2_green = color.handle.green;
- style.fg2_blue = color.handle.blue;
- style.fg3_pixel = color.handle.pixel;
- style.fg3_red = color.handle.red;
- style.fg3_green = color.handle.green;
- style.fg3_blue = color.handle.blue;
- style.fg4_pixel = color.handle.pixel;
- style.fg4_red = color.handle.red;
- style.fg4_green = color.handle.green;
- style.fg4_blue = color.handle.blue;
- }
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
-}
-
-/**
- * Sets the receiver's pop up menu to the argument.
- * All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (menu != null) {
- if ((menu.style & SWT.POP_UP) == 0) {
- error (SWT.ERROR_MENU_NOT_POP_UP);
- }
- if (menu.parent != menuShell ()) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
- this.menu = menu;
-}
-
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers <code>true</code> if the parent is successfully changed.
- *
- * @param parent the new parent for the control.
- * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean setParent (Composite parent) {
- checkWidget();
- if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return false;
-}
-
-/**
- * If the argument is <code>false</code>, causes subsequent drawing
- * operations in the receiver to be ignored. No drawing of any kind
- * can occur in the receiver until the flag is set to true.
- * Graphics operations that occurred while the flag was
- * <code>false</code> are lost. When the flag is set to <code>true</code>,
- * the entire widget is marked as needing to be redrawn.
- * <p>
- * Note: This operation is a hint and may not be supported on some
- * platforms or for some widgets.
- * </p>
- *
- * @param redraw the new redraw state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- * @see #update
- */
-public void setRedraw (boolean redraw) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- toolTipText = string;
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- int topHandle = topHandle();
- if (visible) {
- sendEvent (SWT.Show);
- OS.gtk_widget_show (topHandle);
- } else {
- OS.gtk_widget_hide (topHandle);
- sendEvent (SWT.Hide);
- }
-}
-void sort (int [] items) {
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap=length/2; gap>0; gap/=2) {
- for (int i=gap; i<length; i++) {
- for (int j=i-gap; j>=0; j-=gap) {
- if (items [j] <= items [j + gap]) {
- int swap = items [j];
- items [j] = items [j + gap];
- items [j + gap] = swap;
- }
- }
- }
- }
-}
-
-/**
- * Based on the argument, perform one of the expected platform
- * traversal action. The argument should be one of the constants:
- * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
- * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
- * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
- *
- * @param traversal the type of traversal
- * @return true if the traversal succeeded
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean traverse (int traversal) {
- checkWidget ();
- if (!isFocusControl () && !setFocus ()) return false;
- Event event = new Event ();
- event.doit = true;
- event.detail = traversal;
- return traverse (event);
-}
-
-boolean traverse (Event event) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the traverse
- * event. If this happens, return true to stop further
- * event processing.
- */
- sendEvent (SWT.Traverse, event);
- if (isDisposed ()) return false;
- if (!event.doit) return false;
- switch (event.detail) {
- case SWT.TRAVERSE_NONE: return true;
- /*
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character);
- case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true);
- case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false);
- */
- }
- error(SWT.ERROR_NOT_IMPLEMENTED);
- return false;
-}
-
-
-/**
- * Forces all outstanding paint requests for the widget tree
- * to be processed before this method returns.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- */
-public void update () {
- checkWidget ();
- //NOT DONE - should only dispatch paint events
- OS.gdk_flush ();
- while ((OS.gtk_events_pending()) != 0) {
- OS.gtk_main_iteration ();
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
deleted file mode 100644
index 1df146eab7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
+++ /dev/null
@@ -1,447 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide the appearance and
- * behavior of <code>Shells</code>, but are not top
- * level shells or dialogs. Class <code>Shell</code>
- * shares a significant amount of code with this class,
- * and is a subclass.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations.
- * For example, some window managers only support resizable
- * windows and will always assume the RESIZE style, even if
- * it is not set.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- *
- * @see #getMinimized
- * @see #getMaximized
- * @see Shell
- * @see SWT
- */
-
-public class Decorations extends Canvas {
- String text;
- Image image;
- Menu menuBar;
- Menu [] menus;
- Button defaultButton, saveDefault;
-Decorations () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Decorations (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
- style |= SWT.TITLE;
- }
- return style;
-}
-
-void add (Menu menu) {
- if (menus == null) menus = new Menu [4];
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == null) {
- menus [i] = menu;
- return;
- }
- }
- Menu [] newMenus = new Menu [menus.length + 4];
- newMenus [menus.length] = menu;
- System.arraycopy (menus, 0, newMenus, 0, menus.length);
- menus = newMenus;
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-/**
- * Returns the receiver's default button if one had
- * previously been set, otherwise returns null.
- *
- * @return the default button or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setDefaultButton
- */
-public Button getDefaultButton () {
- checkWidget();
- return defaultButton;
-}
-/**
- * Returns the receiver's image if it had previously been
- * set using <code>setImage()</code>. The image is typically
- * displayed by the window manager when the instance is
- * marked as iconified, and may also be displayed somewhere
- * in the trim when the instance is in normal or maximized
- * states.
- * <p>
- * Note: This method will return null if called before
- * <code>setImage()</code> is called. It does not provide
- * access to a window manager provided, "default" image
- * even if one exists.
- * </p>
- *
- * @return the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * maximized, and false otherwise.
- * <p>
- *
- * @return the maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public boolean getMaximized () {
- checkWidget();
- return false;
-}
-/**
- * Returns the receiver's menu bar if one had previously
- * been set, otherwise returns null.
- *
- * @return the menu bar or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenuBar () {
- checkWidget();
- return menuBar;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * minimized, and false otherwise.
- * <p>
- *
- * @return the minimized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public boolean getMinimized () {
- checkWidget();
- return false;
-}
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-Decorations menuShell () {
- return this;
-}
-
-void remove (Menu menu) {
- if (menus == null) return;
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == menu) {
- menus [i] = null;
- return;
- }
- }
-}
-
-void releaseWidget () {
- if (menuBar != null) {
- menuBar.releaseWidget ();
- menuBar.releaseHandle ();
- }
- menuBar = null;
- if (menus != null) {
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- }
- }
- menus = null;
- super.releaseWidget ();
- image = null;
- defaultButton = saveDefault = null;
-}
-/**
- * If the argument is not null, sets the receiver's default
- * button to the argument, and if the argument is null, sets
- * the receiver's default button to the first button which
- * was set as the receiver's default button (called the
- * <em>saved default button</em>). If no default button had
- * previously been set, or the saved default button was
- * disposed, the receiver's default button will be set to
- * null.
- *
- * @param the new default button
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultButton (Button button) {
- checkWidget();
-}
-/**
- * Sets the receiver's image to the argument, which may
- * be null. The image is typically displayed by the window
- * manager when the instance is marked as iconified, and
- * may also be displayed somewhere in the trim when the
- * instance is in normal or maximized states.
- *
- * @param image the new image (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- this.image = image;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- GtkWidget widget = new GtkWidget ();
- OS.memmove(widget, topHandle(), GtkWidget.sizeof);
- OS.gdk_window_set_icon (widget.window, 0, pixmap, mask);
-}
-/**
- * Sets the maximized state of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the maximized state, and if the argument is
- * <code>false</code> and the receiver was previously maximized,
- * causes the receiver to switch back to either the minimized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public void setMaximized (boolean maximized) {
- checkWidget();
-}
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenuBar (Menu menu) {
- checkWidget();
- if (menuBar == menu) return;
- if (menu != null) {
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- menuBar = menu;
-}
-/**
- * Sets the minimized stated of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the minimized state, and if the argument is
- * <code>false</code> and the receiver was previously minimized,
- * causes the receiver to switch back to either the maximized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public void setMinimized (boolean minimized) {
- checkWidget();
-}
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
deleted file mode 100644
index 261a6706e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select a directory.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class DirectoryDialog extends GtkFileDialog {
- String message = "", filterPath = "";
- String directoryPath;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Returns the path which the dialog will use to filter
- * the directories it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the selected directory,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- return super.open();
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the directories it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-boolean getAnswer() {
- String fileNameFromOS = getFileNameFromOS();
- int separatorIndex = calculateLastSeparatorIndex(fileNameFromOS);
- if (separatorIndex+1 != fileNameFromOS.length()) return false; // the user selected a file
- directoryPath = answer = fileNameFromOS;
- return true;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
deleted file mode 100644
index 6512842431..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ /dev/null
@@ -1,1516 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are responsible for managing the
- * connection between SWT and the underlying operating
- * system. Their most important function is to implement
- * the SWT event loop in terms of the platform event model.
- * They also provide various methods for accessing information
- * about the operating system, and have overall control over
- * the operating system resources which SWT allocates.
- * <p>
- * Applications which are built with SWT will <em>almost always</em>
- * require only a single display. In particular, some platforms
- * which SWT supports will not allow more than one <em>active</em>
- * display. In other words, some platforms do not support
- * creating a new display if one already exists that has not been
- * sent the <code>dispose()</code> message.
- * <p>
- * In SWT, the thread which creates a <code>Display</code>
- * instance is distinguished as the <em>user-interface thread</em>
- * for that display.
- * </p>
- * The user-interface thread for a particular display has the
- * following special attributes:
- * <ul>
- * <li>
- * The event loop for that display must be run from the thread.
- * </li>
- * <li>
- * Some SWT API methods (notably, most of the public methods in
- * <code>Widget</code> and its subclasses), may only be called
- * from the thread. (To support multi-threaded user-interface
- * applications, class <code>Display</code> provides inter-thread
- * communication methods which allow threads other than the
- * user-interface thread to request that it perform operations
- * on their behalf.)
- * </li>
- * <li>
- * The thread is not allowed to construct other
- * <code>Display</code>s until that display has been disposed.
- * (Note that, this is in addition to the restriction mentioned
- * above concerning platform support for multiple displays. Thus,
- * the only way to have multiple simultaneously active displays,
- * even on platforms which support it, is to have multiple threads.)
- * </li>
- * </ul>
- * Enforcing these attributes allows SWT to be implemented directly
- * on the underlying operating system's event model. This has
- * numerous benefits including smaller footprint, better use of
- * resources, safer memory management, clearer program logic,
- * better performance, and fewer overall operating system threads
- * required. The down side however, is that care must be taken
- * (only) when constructing multi-threaded applications to use the
- * inter-thread communication mechanisms which this class provides
- * when required.
- * </p><p>
- * All SWT API methods which may only be called from the user-interface
- * thread are distinguished in their documentation by indicating that
- * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
- * SWT exception.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see #syncExec
- * @see #asyncExec
- * @see #wake
- * @see #readAndDispatch
- * @see #sleep
- * @see #dispose
- */
-
-public class Display extends Device {
-
- /* Events Dispatching and Callback */
- Event [] eventQueue;
- int windowProc2, windowProc3, windowProc4, windowProc5;
- Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5;
-
- /* Sync/Async Widget Communication */
- Synchronizer synchronizer = new Synchronizer (this);
- int messagesSize;
- RunnableLock [] messages;
- Object messageLock = new Object ();
- Thread thread = Thread.currentThread ();
-
- /* Display Shutdown */
- Runnable [] disposeList;
-
- /* Timers */
- int [] timerIDs;
- Runnable [] timerList;
- Callback timerCallback;
- int timerProc;
-
- /* Caret */
- Caret currentCaret;
- Callback caretCallback;
- int caretID, caretProc;
-
- /* Colors */
- Color NORMAL_fg, NORMAL_bg, NORMAL_dark, NORMAL_mid, NORMAL_light, NORMAL_text, NORMAL_base;
- Color ACTIVE_fg, ACTIVE_bg, ACTIVE_dark, ACTIVE_mid, ACTIVE_light, ACTIVE_text, ACTIVE_base;
- Color PRELIGHT_fg, PRELIGHT_bg, PRELIGHT_dark, PRELIGHT_mid, PRELIGHT_light, PRELIGHT_text, PRELIGHT_base;
- Color SELECTED_fg, SELECTED_bg, SELECTED_dark, SELECTED_mid, SELECTED_light, SELECTED_text, SELECTED_base;
- Color INSENSITIVE_fg, INSENSITIVE_bg, INSENSITIVE_dark, INSENSITIVE_mid, INSENSITIVE_light, INSENSITIVE_text, INSENSITIVE_base;
-
- /* Key Mappings */
- static final int [] [] KeyTable = {
-
- /* Keyboard and Mouse Masks */
- {OS.GDK_Alt_L, SWT.ALT},
- {OS.GDK_Alt_R, SWT.ALT},
- {OS.GDK_Shift_L, SWT.SHIFT},
- {OS.GDK_Shift_R, SWT.SHIFT},
- {OS.GDK_Control_L, SWT.CONTROL},
- {OS.GDK_Control_R, SWT.CONTROL},
-
- /* Non-Numeric Keypad Constants */
- {OS.GDK_Up, SWT.ARROW_UP},
- {OS.GDK_Down, SWT.ARROW_DOWN},
- {OS.GDK_Left, SWT.ARROW_LEFT},
- {OS.GDK_Right, SWT.ARROW_RIGHT},
- {OS.GDK_Page_Up, SWT.PAGE_UP},
- {OS.GDK_Page_Down, SWT.PAGE_DOWN},
- {OS.GDK_Home, SWT.HOME},
- {OS.GDK_End, SWT.END},
- {OS.GDK_Insert, SWT.INSERT},
-
- /* NOT CURRENTLY USED */
-// {OS.GDK_Delete, SWT.DELETE},
- {OS.GDK_Return, SWT.CR},
-
- /* Functions Keys */
- {OS.GDK_F1, SWT.F1},
- {OS.GDK_F2, SWT.F2},
- {OS.GDK_F3, SWT.F3},
- {OS.GDK_F4, SWT.F4},
- {OS.GDK_F5, SWT.F5},
- {OS.GDK_F6, SWT.F6},
- {OS.GDK_F7, SWT.F7},
- {OS.GDK_F8, SWT.F8},
- {OS.GDK_F9, SWT.F9},
- {OS.GDK_F10, SWT.F10},
- {OS.GDK_F11, SWT.F11},
- {OS.GDK_F12, SWT.F12},
-
- /* Numeric Keypad Constants */
- /* NOT CURRENTLY USED */
-// {OS.GDK_KP_Add, SWT.KP_PLUS},
-// {OS.GDK_KP_Subtract, SWT.KP_MINUS},
-// {OS.GDK_KP_Multiply, SWT.KP_TIMES},
-// {OS.GDK_KP_Divide, SWT.KP_DIVIDE},
-// {OS.GDK_KP_Decimal, SWT.KP_PERIOD},
-// {OS.GDK_KP_Enter, SWT.CR},
-// {OS.GDK_KP_0, SWT.KP_0},
-// {OS.GDK_KP_1, SWT.KP_1},
-// {OS.GDK_KP_2, SWT.KP_2},
-// {OS.GDK_KP_3, SWT.KP_3},
-// {OS.GDK_KP_4, SWT.KP_4},
-// {OS.GDK_KP_5, SWT.KP_5},
-// {OS.GDK_KP_6, SWT.KP_6},
-// {OS.GDK_KP_7, SWT.KP_7},
-// {OS.GDK_KP_8, SWT.KP_8},
-// {OS.GDK_KP_9, SWT.KP_9},
-
- };
-
- /* Multiple Displays. */
- static Display Default;
- static Display [] Displays = new Display [4];
-
- /* Package name */
- static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets.";
- /* This code is intentionally commented.
- * ".class" can not be used on CLDC.
- */
- /*static {
- String name = Display.class.getName ();
- int index = name.lastIndexOf ('.');
- PACKAGE_NAME = name.substring (0, index + 1);
- }*/
-
- /* #define in gdkevents.h */
- static final int DOUBLE_CLICK_TIME = 250;
-
- /* Display Data */
- Object data;
- String [] keys;
- Object [] values;
-
- /*
- * TEMPORARY CODE. Install the runnable that
- * gets the current display. This code will
- * be removed in the future.
- */
- static {
- DeviceFinder = new Runnable () {
- public void run () {
- Device device = getCurrent ();
- if (device == null) {
- device = getDefault ();
- }
- setDevice (device);
- }
- };
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static void setDevice (Device device) {
- CurrentDevice = device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * Note: The resulting display is marked as the <em>current</em>
- * display. If this is the first display which has been
- * constructed since the application started, it is also
- * marked as the <em>default</em> display.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see #getCurrent
- * @see #getDefault
- * @see Widget#checkSubclass
- * @see Shell
- */
-public Display () {
- this (null);
-}
-
-public Display (DeviceData data) {
- super (data);
-}
-
-void addLast (RunnableLock entry) {
- synchronized (messageLock) {
- if (messages == null) messages = new RunnableLock [4];
- if (messagesSize == messages.length) {
- RunnableLock[] newMessages = new RunnableLock [messagesSize + 4];
- System.arraycopy (messages, 0, newMessages, 0, messagesSize);
- messages = newMessages;
- }
- messages [messagesSize++] = entry;
- }
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-public void asyncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.asyncExec (runnable);
-}
-
-/**
- * Causes the system hardware to emit a short sound
- * (if it supports this capability).
- */
-public void beep () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- OS.gdk_beep();
- OS.gdk_flush();
-}
-
-protected void checkDevice () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-static synchronized void checkDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] != null && Displays [i].thread == thread) {
- SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- }
-}
-
-protected void checkSubclass () {
- if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-protected void create (DeviceData data) {
- checkSubclass ();
- checkDisplay(thread = Thread.currentThread ());
- createDisplay (data);
- register ();
- if (Default == null) Default = this;
-}
-
-synchronized void createDisplay (DeviceData data) {
- if (!OS.gtk_init_check (new int [] {0}, null)) {
- /*
- * This code is intentionally commented.
- */
-// disposed = true;
-// SWT.error (SWT.ERROR_DEVICE_DISPOSED);
- return;
- }
- OS.gdk_rgb_init ();
- int ptr = OS.gtk_check_version (1, 2, 8);
- if (ptr != 0) {
- System.out.println ("***WARNING: SWT requires GTK version 1.2.8 or greater");
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer)));
- }
-}
-
-synchronized void deregister () {
- for (int i=0; i<Displays.length; i++) {
- if (this == Displays [i]) Displays [i] = null;
- }
-}
-
-protected void destroy () {
- if (this == Default) Default = null;
- deregister ();
- destroyDisplay ();
-}
-
-void destroyDisplay () {
-}
-
-/**
- * Returns the display which the given thread is the
- * user-interface thread for, or null if the given thread
- * is not a user-interface thread for any display.
- *
- * @param thread the user-interface thread
- * @return the display for the given thread
- */
-public static synchronized Display findDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == thread) {
- return display;
- }
- }
- return null;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread just before the
- * receiver is disposed.
- *
- * @param runnable code to run at dispose time.
- */
-public void disposeExec (Runnable runnable) {
- checkDevice ();
- if (disposeList == null) disposeList = new Runnable [4];
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] == null) {
- disposeList [i] = runnable;
- return;
- }
- }
- Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
- System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
- newDisposeList [disposeList.length] = runnable;
- disposeList = newDisposeList;
-}
-
-/**
- * Does whatever display specific cleanup is required, and then
- * uses the code in <code>SWTError.error</code> to handle the error.
- *
- * @param code the descriptive error code
- *
- * @see SWTError#error
- */
-void error (int code) {
- throw new SWTError (code);
-}
-
-/**
- * Given the operating system handle for a widget, returns
- * the instance of the <code>Widget</code> subclass which
- * represents it in the currently running application, if
- * such exists, or null if no matching widget can be found.
- *
- * @param handle the handle for the widget
- * @return the SWT widget that the handle represents
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Widget findWidget (int handle) {
- checkDevice ();
- // In 0.058 and before, this used to go up the parent
- // chain if the handle was not found in the widget
- // table, up to the root. Now, we require that all
- // widgets register ALL their handles.
- // If somebody creates their own handles outside
- // SWT, it's their problem.
- return WidgetTable.get (handle);
-}
-
-/*
- * In SWT, we force all widgets to have real Gdk windows,
- * thus getting rid of the concept of "lightweight" widgets.
- * Given a GdkWindow, answer a handle to the GtkWidget realized
- * through that window.
- * If the argument is not the pointe rto a GdkWindow, the
- * universe will be left in an inconsistent state.
- */
-int findGtkWidgetByGdkWindow (int gdkWindow) {
- int[] pwidget = new int[1];
- OS.gdk_window_get_user_data(gdkWindow, pwidget);
- return pwidget[0];
-}
-
-/**
- * Returns the currently active <code>Shell</code>, or null
- * if no shell belonging to the currently running application
- * is active.
- *
- * @return the active shell or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getActiveShell () {
- checkDevice ();
- Shell [] shells = getShells();
- for (int i=0; i<shells.length; i++) {
- if (shells [i].hasFocus) return shells [i];
- }
- return null;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- return new Rectangle(0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ());
-}
-
-/**
- * Returns the display which the currently running thread is
- * the user-interface thread for, or null if the currently
- * running thread is not a user-interface thread for any display.
- *
- * @return the current display
- */
-public static synchronized Display getCurrent () {
- Thread current = Thread.currentThread ();
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == current) return display;
- }
- return null;
-}
-
-/**
- * Returns the control which the on-screen pointer is currently
- * over top of, or null if it is not currently over one of the
- * controls built by the currently running application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getCursorControl () {
- checkDevice();
- int[] x = new int[1], y = new int[1];
- int cursorWindowHandle = OS.gdk_window_at_pointer(x,y);
- if (cursorWindowHandle==0) return null;
- int handle = findGtkWidgetByGdkWindow(cursorWindowHandle);
- if (handle==0) return null;
- return findControl(handle);
-}
-
-Control findControl(int h) {
- Widget w = findWidget(h);
- if (w==null) return null;
- if (w instanceof Control) return (Control)w;
- // w is something like an Item. Go for the parent
-
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, h, GtkWidget.sizeof);
- return findControl(widget.parent);
-}
-
-/**
- * Returns the location of the on-screen pointer relative
- * to the top left corner of the screen.
- *
- * @return the cursor location
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCursorLocation () {
- checkDevice ();
- int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, 0);
- return new Point (x [0], y [0]);
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData (String key) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the application defined, display specific data
- * associated with the receiver, or null if it has not been
- * set. The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @return the display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData () {
- checkDevice ();
- return data;
-}
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- int widthMM = OS.gdk_screen_width_mm ();
- int width = OS.gdk_screen_width ();
- // compute round(25.4 * width / widthMM)
- int dpi = Compatibility.round(254 * width, widthMM * 10);
- return new Point (dpi, dpi);
-}
-
-/**
- * Returns the default display. One is created (making the
- * thread that invokes this method its user-interface thread)
- * if it did not already exist.
- *
- * @return the default display
- */
-public static synchronized Display getDefault () {
- if (Default == null) Default = new Display ();
- return Default;
-}
-
-static boolean isValidClass (Class clazz) {
- String name = clazz.getName ();
- int index = name.lastIndexOf ('.');
- return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
-}
-
-/**
- * Returns the longest duration, in milliseconds, between
- * two mouse button clicks that will be considered a
- * <em>double click</em> by the underlying operating system.
- *
- * @return the double click time
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getDoubleClickTime () {
- checkDevice ();
- return DOUBLE_CLICK_TIME;
-}
-
-/**
- * Returns the control which currently has keyboard focus,
- * or null if keyboard events are not currently going to
- * any of the controls built by the currently running
- * application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getFocusControl () {
- checkDevice ();
- Shell active = getActiveShell();
- if (active==null) return null;
- return active.getFocusControl();
-}
-
-public int getDepth () {
- checkDevice ();
- GdkVisual visual = new GdkVisual ();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- return visual.depth;
-}
-
-/**
- * Returns the maximum allowed depth of icons on this display.
- * On some platforms, this may be different than the actual
- * depth of the display.
- *
- * @return the maximum icon depth
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIconDepth () {
- checkDevice ();
- return getDepth ();
-}
-
-/**
- * Returns an array containing all shells which have not been
- * disposed and have the receiver as their display.
- *
- * @return the receiver's shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkDevice ();
- int count = 0;
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && (this == shell.getDisplay ())) {
- count++;
- }
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && (this == shell.getDisplay ())) {
- result [index++] = shell;
- }
- }
- return result;
-}
-
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or null if no such runnable is currently being invoked by
- * the user-interface thread.
- * <p>
- * Note: If a runnable invoked by asyncExec is currently
- * running, this method will return null.
- * </p>
- *
- * @return the receiver's sync-interface thread
- */
-public Thread getSyncThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return synchronizer.syncThread;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- switch (id) {
- case SWT.COLOR_INFO_FOREGROUND: return NORMAL_fg;
- case SWT.COLOR_INFO_BACKGROUND: return NORMAL_bg;
-
- case SWT.COLOR_TITLE_FOREGROUND: return SELECTED_text;
- case SWT.COLOR_TITLE_BACKGROUND: return SELECTED_bg;
- case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: return SELECTED_light;
- case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: return INSENSITIVE_fg;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: return INSENSITIVE_bg;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: return INSENSITIVE_light;
-
- case SWT.COLOR_WIDGET_DARK_SHADOW: return NORMAL_dark;
- case SWT.COLOR_WIDGET_NORMAL_SHADOW: return NORMAL_mid;
- case SWT.COLOR_WIDGET_LIGHT_SHADOW: return NORMAL_light;
- case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: return NORMAL_light;
- case SWT.COLOR_WIDGET_BACKGROUND: return NORMAL_bg;
- case SWT.COLOR_WIDGET_FOREGROUND: return NORMAL_fg;
- case SWT.COLOR_WIDGET_BORDER: return super.getSystemColor (SWT.COLOR_BLACK);
-
- case SWT.COLOR_LIST_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
- case SWT.COLOR_LIST_BACKGROUND: return super.getSystemColor (SWT.COLOR_WHITE);
- case SWT.COLOR_LIST_SELECTION: return SELECTED_bg;
- case SWT.COLOR_LIST_SELECTION_TEXT: return SELECTED_text;
- }
- return super.getSystemColor (id);
-}
-
-void initializeSystemColors() {
-
- /* Get the theme colors */
- GtkStyle defaultStyle = new GtkStyle();
- OS.memmove (defaultStyle, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
-
- GdkColor gdk_NORMAL_dark = new GdkColor();
- gdk_NORMAL_dark.pixel = defaultStyle.dark0_pixel;
- gdk_NORMAL_dark.red = defaultStyle.dark0_red;
- gdk_NORMAL_dark.green = defaultStyle.dark0_green;
- gdk_NORMAL_dark.blue = defaultStyle.dark0_blue;
- NORMAL_dark = Color.gtk_new(gdk_NORMAL_dark);
-
- GdkColor gdk_NORMAL_mid = new GdkColor();
- gdk_NORMAL_mid.pixel = defaultStyle.mid0_pixel;
- gdk_NORMAL_mid.red = defaultStyle.mid0_red;
- gdk_NORMAL_mid.green = defaultStyle.mid0_green;
- gdk_NORMAL_mid.blue = defaultStyle.mid0_blue;
- NORMAL_mid = Color.gtk_new(gdk_NORMAL_mid);
-
- GdkColor gdk_NORMAL_light = new GdkColor();
- gdk_NORMAL_light.pixel = defaultStyle.light0_pixel;
- gdk_NORMAL_light.red = defaultStyle.light0_red;
- gdk_NORMAL_light.green = defaultStyle.light0_green;
- gdk_NORMAL_light.blue = defaultStyle.light0_blue;
- NORMAL_light = Color.gtk_new(gdk_NORMAL_light);
-
- GdkColor gdk_NORMAL_fg = new GdkColor();
- gdk_NORMAL_fg.pixel = defaultStyle.fg0_pixel;
- gdk_NORMAL_fg.red = defaultStyle.fg0_red;
- gdk_NORMAL_fg.green = defaultStyle.fg0_green;
- gdk_NORMAL_fg.blue = defaultStyle.fg0_blue;
- NORMAL_fg = Color.gtk_new(gdk_NORMAL_fg);
-
- GdkColor gdk_NORMAL_bg = new GdkColor();
- gdk_NORMAL_bg.pixel = defaultStyle.bg0_pixel;
- gdk_NORMAL_bg.red = defaultStyle.bg0_red;
- gdk_NORMAL_bg.green = defaultStyle.bg0_green;
- gdk_NORMAL_bg.blue = defaultStyle.bg0_blue;
- NORMAL_bg = Color.gtk_new(gdk_NORMAL_bg);
-
- GdkColor gdk_NORMAL_text = new GdkColor();
- gdk_NORMAL_text.pixel = defaultStyle.text0_pixel;
- gdk_NORMAL_text.red = defaultStyle.text0_red;
- gdk_NORMAL_text.green = defaultStyle.text0_green;
- gdk_NORMAL_text.blue = defaultStyle.text0_blue;
- NORMAL_text = Color.gtk_new(gdk_NORMAL_text);
-
- GdkColor gdk_NORMAL_base = new GdkColor();
- gdk_NORMAL_base.pixel = defaultStyle.base0_pixel;
- gdk_NORMAL_base.red = defaultStyle.base0_red;
- gdk_NORMAL_base.green = defaultStyle.base0_green;
- gdk_NORMAL_base.blue = defaultStyle.base0_blue;
- NORMAL_base = Color.gtk_new(gdk_NORMAL_base);
-
- GdkColor gdk_SELECTED_text = new GdkColor();
- gdk_SELECTED_text.pixel = defaultStyle.text3_pixel;
- gdk_SELECTED_text.red = defaultStyle.text3_red;
- gdk_SELECTED_text.green = defaultStyle.text3_green;
- gdk_SELECTED_text.blue = defaultStyle.text3_blue;
- SELECTED_text = Color.gtk_new(gdk_SELECTED_text);
-
- GdkColor gdk_SELECTED_bg = new GdkColor();
- gdk_SELECTED_bg.pixel = defaultStyle.bg3_pixel;
- gdk_SELECTED_bg.red = defaultStyle.bg3_red;
- gdk_SELECTED_bg.green = defaultStyle.bg3_green;
- gdk_SELECTED_bg.blue = defaultStyle.bg3_blue;
- SELECTED_bg = Color.gtk_new(gdk_SELECTED_bg);
-
- GdkColor gdk_SELECTED_base = new GdkColor();
- gdk_SELECTED_base.pixel = defaultStyle.base3_pixel;
- gdk_SELECTED_base.red = defaultStyle.base3_red;
- gdk_SELECTED_base.green = defaultStyle.base3_green;
- gdk_SELECTED_base.blue = defaultStyle.base3_blue;
- SELECTED_base = Color.gtk_new(gdk_SELECTED_base);
-
- GdkColor gdk_SELECTED_light = new GdkColor();
- gdk_SELECTED_light.pixel = defaultStyle.light3_pixel;
- gdk_SELECTED_light.red = defaultStyle.light3_red;
- gdk_SELECTED_light.green = defaultStyle.light3_green;
- gdk_SELECTED_light.blue = defaultStyle.light3_blue;
- SELECTED_light = Color.gtk_new(gdk_SELECTED_light);
-
-
- GdkColor gdk_PRELIGHT_light = new GdkColor();
- gdk_PRELIGHT_light.pixel = defaultStyle.light2_pixel;
- gdk_PRELIGHT_light.red = defaultStyle.light2_red;
- gdk_PRELIGHT_light.green = defaultStyle.light2_green;
- gdk_PRELIGHT_light.blue = defaultStyle.light2_blue;
- PRELIGHT_light = Color.gtk_new(gdk_PRELIGHT_light);
-
- GdkColor gdk_INSENSITIVE_light = new GdkColor();
- gdk_INSENSITIVE_light.pixel = defaultStyle.light4_pixel;
- gdk_INSENSITIVE_light.red = defaultStyle.light4_red;
- gdk_INSENSITIVE_light.green = defaultStyle.light4_green;
- gdk_INSENSITIVE_light.blue = defaultStyle.light4_blue;
- INSENSITIVE_light = Color.gtk_new(gdk_INSENSITIVE_light);
-
- GdkColor gdk_INSENSITIVE_fg = new GdkColor();
- gdk_INSENSITIVE_fg.pixel = defaultStyle.fg4_pixel;
- gdk_INSENSITIVE_fg.red = defaultStyle.fg4_red;
- gdk_INSENSITIVE_fg.green = defaultStyle.fg4_green;
- gdk_INSENSITIVE_fg.blue = defaultStyle.fg4_blue;
- INSENSITIVE_fg = Color.gtk_new(gdk_INSENSITIVE_fg);
-
- GdkColor gdk_INSENSITIVE_bg = new GdkColor();
- gdk_INSENSITIVE_bg.pixel = defaultStyle.bg4_pixel;
- gdk_INSENSITIVE_bg.red = defaultStyle.bg4_red;
- gdk_INSENSITIVE_bg.green = defaultStyle.bg4_green;
- gdk_INSENSITIVE_bg.blue = defaultStyle.bg4_blue;
- INSENSITIVE_bg = Color.gtk_new(gdk_INSENSITIVE_bg);
-
-
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- GtkStyle style = new GtkStyle();
- OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- int gdkFont = style.font; // gives a GdkFont*
- return Font.gtk_new (gdkFont);
-}
-
-/**
- * Returns the user-interface thread for the receiver.
- *
- * @return the receiver's user-interface thread
- */
-public Thread getThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return thread;
-}
-
-protected void init () {
- super.init ();
- initializeCallbacks ();
- initializeSystemColors ();
-}
-
-void initializeCallbacks () {
- windowCallback2 = new Callback (this, "windowProc", 2);
- windowProc2 = windowCallback2.getAddress ();
- if (windowProc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback3 = new Callback (this, "windowProc", 3);
- windowProc3 = windowCallback3.getAddress ();
- if (windowProc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback4 = new Callback (this, "windowProc", 4);
- windowProc4 = windowCallback4.getAddress ();
- if (windowProc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback5 = new Callback (this, "windowProc", 5);
- windowProc5 = windowCallback5.getAddress ();
- if (windowProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- timerCallback = new Callback (this, "timerProc", 2);
- timerProc = timerCallback.getAddress ();
- if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- caretCallback = new Callback(this, "caretProc", 2);
- caretProc = caretCallback.getAddress();
- if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int handle, GCData data) {
- OS.gdk_gc_destroy(handle);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
- int root = OS.GDK_ROOT_PARENT();
- int gc = OS.gdk_gc_new(root);
- data.drawable = root;
- return gc;
-}
-
-boolean isValidThread () {
- return thread == Thread.currentThread ();
-}
-
-void postEvent (Event event) {
- /*
- * Place the event at the end of the event queue.
- * This code is always called in the Display's
- * thread so it must be re-enterant but does not
- * need to be synchronized.
- */
- if (eventQueue == null) eventQueue = new Event [4];
- int index = 0;
- int length = eventQueue.length;
- while (index < length) {
- if (eventQueue [index] == null) break;
- index++;
- }
- if (index == length) {
- Event [] newQueue = new Event [length + 4];
- System.arraycopy (eventQueue, 0, newQueue, 0, length);
- eventQueue = newQueue;
- }
- eventQueue [index] = event;
-}
-
-/**
- * Reads an event from the operating system's event queue,
- * dispatches it appropriately, and returns <code>true</code>
- * if there is potentially more work to do, or <code>false</code>
- * if the caller can sleep until another event is placed on
- * the event queue.
- * <p>
- * In addition to checking the system event queue, this method also
- * checks if any inter-thread messages (created by <code>syncExec()</code>
- * or <code>asyncExec()</code>) are waiting to be processed, and if
- * so handles them before returning.
- * </p>
- *
- * @return <code>false</code> if the caller can sleep upon return from this method
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #sleep
- * @see #wake
- */
-public boolean readAndDispatch () {
- checkDevice ();
- int status = OS.gtk_events_pending ();
- if (status != 0) {
-// if ((status & OS.XtIMTimer) != 0) OS.XtAppProcessEvent (context, OS.XtIMTimer);
-// if ((status & OS.XtIMAlternateInput) != 0) OS.XtAppProcessEvent (context, OS.XtIMAlternateInput);
-// if ((status & OS.XtIMXEvent) != 0) {
-// OS.XtAppNextEvent (context, event);
-// OS.XtDispatchEvent (event);
-// }
-/* int eventPtr = OS.gdk_event_get();
- if (eventPtr != 0) {
- OS.gtk_main_do_event(eventPtr);
- }*/
- OS.gtk_main_iteration ();
- runDeferredEvents ();
- return true;
- }
- return runAsyncMessages ();
-}
-
-synchronized void register () {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] == null) {
- Displays [i] = this;
- return;
- }
- }
- Display [] newDisplays = new Display [Displays.length + 4];
- System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
- newDisplays [Displays.length] = this;
- Displays = newDisplays;
-}
-
-protected void release () {
-
- /* Release shells */
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
- }
- }
- while (readAndDispatch ()) {};
-
- /* Run dispose list */
- if (disposeList != null) {
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] != null) disposeList [i].run ();
- }
- }
- disposeList = null;
-
- /* Release synchronizer */
- synchronizer.releaseSynchronizer ();
- synchronizer = null;
- releaseDisplay ();
-
- super.release ();
-}
-
-void releaseDisplay () {
- windowCallback2.dispose (); windowCallback2 = null;
- windowCallback3.dispose (); windowCallback3 = null;
- windowCallback4.dispose (); windowCallback4 = null;
- windowCallback5.dispose (); windowCallback5 = null;
-
- /* Dispose the caret callback */
- if (caretID != 0) OS.gtk_timeout_remove (caretID);
- caretID = caretProc = 0;
- caretCallback.dispose ();
- caretCallback = null;
-
- /* Dispose the timer callback */
- if (timerIDs != null) {
- for (int i=0; i<timerIDs.length; i++) {
- if (timerIDs [i] != 0) OS.gtk_timeout_remove (timerIDs [i]);
- }
- }
- timerIDs = null;
- timerList = null;
- timerProc = 0;
- timerCallback.dispose ();
- timerCallback = null;
-
- messages = null; messageLock = null; thread = null;
- messagesSize = windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0;
-
- NORMAL_fg = NORMAL_bg = NORMAL_dark = NORMAL_mid = NORMAL_light = NORMAL_text = NORMAL_base =
- ACTIVE_fg = ACTIVE_bg = ACTIVE_dark = ACTIVE_mid = ACTIVE_light = ACTIVE_text = ACTIVE_base =
- PRELIGHT_fg = PRELIGHT_bg = PRELIGHT_dark = PRELIGHT_mid = PRELIGHT_light = PRELIGHT_text = PRELIGHT_base =
- SELECTED_fg = SELECTED_bg = SELECTED_dark = SELECTED_mid = SELECTED_light = SELECTED_text = SELECTED_base =
- INSENSITIVE_fg = INSENSITIVE_bg = INSENSITIVE_dark = INSENSITIVE_mid = INSENSITIVE_light = INSENSITIVE_text =
- INSENSITIVE_base = null;
-}
-
-RunnableLock removeFirst () {
- synchronized (messageLock) {
- if (messagesSize == 0) return null;
- RunnableLock lock = messages [0];
- System.arraycopy (messages, 1, messages, 0, --messagesSize);
- messages [messagesSize] = null;
- if (messagesSize == 0) messages = null;
- return lock;
- }
-}
-
-boolean runAsyncMessages () {
- return synchronizer.runAsyncMessages ();
-}
-
-boolean runDeferredEvents () {
- /*
- * Run deferred events. This code is always
- * called in the Display's thread so it must
- * be re-enterant need not be synchronized.
- */
- while (eventQueue != null) {
-
- /* Take an event off the queue */
- Event event = eventQueue [0];
- if (event == null) break;
- int length = eventQueue.length;
- System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
- eventQueue [length] = null;
-
- /* Run the event */
- Widget widget = event.widget;
- if (widget != null && !widget.isDisposed ()) {
- Widget item = event.item;
- if (item == null || !item.isDisposed ()) {
- widget.notifyListeners (event.type, event);
- }
- }
-
- /*
- * At this point, the event queue could
- * be null due to a recursive invokation
- * when running the event.
- */
- }
-
- /* Clear the queue */
- eventQueue = null;
- return true;
-}
-
-/**
- * On platforms which support it, sets the application name
- * to be the argument. On Motif, for example, this can be used
- * to set the name used for resource lookup.
- *
- * @param name the new app name
- */
-public static void setAppName (String name) {
- /* Do nothing - Gtk doesn't have the concept of application name. */
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given argument.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public void setData (String key, Object value) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Sets the application defined, display specific data
- * associated with the receiver, to the argument.
- * The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param data the new display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #getData
- * @see #disposeExec
- */
-public void setData (Object data) {
- checkDevice ();
- this.data = data;
-}
-
-/**
- * Sets the synchronizer used by the display to be
- * the argument, which can not be null.
- *
- * @param synchronizer the new synchronizer for the display (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSynchronizer (Synchronizer synchronizer) {
- checkDevice ();
- if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (this.synchronizer != null) {
- this.synchronizer.runAsyncMessages();
- }
- this.synchronizer = synchronizer;
-}
-
-/**
- * Causes the user-interface thread to <em>sleep</em> (that is,
- * to be put in a state where it does not consume CPU cycles)
- * until an event is received or it is otherwise awakened.
- *
- * @return <code>true</code> if an event requiring dispatching was placed on the queue.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #wake
- */
-
-public boolean sleep () {
- checkDevice ();
- /* Temporary code - need to sleep waiting for the next message */
- try { Thread.sleep(50); } catch (Exception e) {};
- return true;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread after the specified
- * number of milliseconds have elapsed.
- *
- * @param milliseconds the delay before running the runnable
- * @param runnable code to run on the user-interface thread
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void timerExec (int milliseconds, Runnable runnable) {
- checkDevice ();
- if (timerList == null) timerList = new Runnable [4];
- if (timerIDs == null) timerIDs = new int [4];
- int index = 0;
- while (index < timerList.length) {
- if (timerList [index] == null) break;
- index++;
- }
- if (index == timerList.length) {
- Runnable [] newTimerList = new Runnable [timerList.length + 4];
- System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
- timerList = newTimerList;
- int [] newTimerIDs = new int [timerIDs.length + 4];
- System.arraycopy (timerIDs, 0, newTimerIDs, 0, timerIDs.length);
- timerIDs = newTimerIDs;
- }
- int timerID = OS.gtk_timeout_add (milliseconds, timerProc, index);
- if (timerID != 0) {
- timerIDs [index] = timerID;
- timerList [index] = runnable;
- }
-}
-
-int timerProc (int index, int id) {
- if (timerList == null) return 0;
- if (0 <= index && index < timerList.length) {
- Runnable runnable = timerList [index];
- timerList [index] = null;
- timerIDs [index] = 0;
- if (runnable != null) runnable.run ();
- }
- return 0;
-}
-
-int caretProc (int clientData, int id) {
- caretID = 0;
- if (currentCaret == null) {
- return 0;
- }
- if (currentCaret.blinkCaret()) {
- int blinkRate = currentCaret.blinkRate;
- caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
- } else {
- currentCaret = null;
- }
- return 0;
-}
-
-void setCurrentCaret (Caret caret) {
- if (caretID != 0) OS.gtk_timeout_remove(caretID);
- caretID = 0;
- currentCaret = caret;
- if (caret == null) return;
- int blinkRate = currentCaret.blinkRate;
- caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void syncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.syncExec (runnable);
-}
-
-static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- }
- return 0;
-}
-
-static int untranslateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [1] == key) return KeyTable [i] [0];
- }
- return 0;
-}
-
-public void update () {
- checkDevice ();
- /* NOT IMPLEMENTED - Need to flush only pending draws */
- OS.gdk_flush ();
- while ((OS.gtk_events_pending ()) != 0) {
- OS.gtk_main_iteration ();
- }
-}
-
-/**
- * If the receiver's user-interface thread was <code>sleep</code>'ing,
- * causes it to be awakened and start running again. Note that this
- * method may be called from any thread.
- *
- * @see #sleep
- */
-public void wake () {
- /* NOT IMPLEMENTED - Need to wake up the event loop */
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-int windowProc (int handle, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, 0, 0, 0);
-}
-
-int windowProc (int handle, int int0, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, 0, 0);
-}
-
-int windowProc (int handle, int int0, int int1, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, int1, 0);
-}
-
-int windowProc (int handle, int int0, int int1, int int2, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, int1, int2);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
deleted file mode 100644
index 940b7427f4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select or enter a file name.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SAVE, OPEN, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FileDialog extends GtkFileDialog {
-
- String fullPath, fileName, filterPath;
- String[] filterNames, filterExtensions;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the path of the first file that was
- * selected in the dialog relative to the filter path,
- * or null if none is available.
- *
- * @return the relative path of the file
- */
-public String getFileName () {
- return fileName;
-}
-/**
- * Returns the paths of all files that were selected
- * in the dialog relative to the filter path, or null
- * if none are available.
- *
- * @return the relative paths of the files
- */
-public String [] getFileNames () {
- return new String[] {fileName};
-}
-/**
- * Returns the file extensions which the dialog will
- * use to filter the files it shows.
- *
- * @return the file extensions filter
- */
-public String [] getFilterExtensions () {
- return filterExtensions;
-}
-/**
- * Returns the file names which the dialog will
- * use to filter the files it shows.
- *
- * @return the file name filter
- */
-public String [] getFilterNames () {
- return filterNames;
-}
-/**
- * Returns the path which the dialog will use to filter
- * the files it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Set the initial filename which the dialog will
- * select by default when opened to the argument,
- * which may be null. The name will be prefixed with
- * the filter path when one is supplied.
- *
- * @param string the file name
- */
-public void setFileName (String string) {
- fileName = string;
-}
-/**
- * Set the file extensions which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param extensions the file extension filter
- */
-public void setFilterExtensions (String [] extensions) {
- filterExtensions = extensions;
-}
-/**
- * Sets the file names which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param names the file name filter
- */
-public void setFilterNames (String [] names) {
- filterNames = names;
-}
-/**
- * Sets the path which the dialog will use to filter
- * the files it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-boolean getAnswer() {
- String fileNameFromOS = getFileNameFromOS();
- int separatorIndex = calculateLastSeparatorIndex(fileNameFromOS);
- if (separatorIndex+1 == fileNameFromOS.length()) return false; // the user selected a directory
- fullPath = answer = fileNameFromOS;
- fileName = fullPath.substring (separatorIndex + 1, fullPath.length ());
- filterPath = fullPath.substring (0, separatorIndex);
- return true;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
deleted file mode 100644
index 8f3a57f991..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a font
- * from all available fonts in the system.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class FontDialog extends Dialog {
- FontData fontData;
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-int cancelFunc (int widget, int callData) {
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int colorInfo) {
- OS.gtk_main_quit ();
- return 0;
-}
-/**
- * Returns a FontData object describing the font that was
- * selected in the dialog, or null if none is available.
- *
- * @return the FontData for the selected font, or null
- */
-public FontData getFontData() {
- return fontData;
-}
-int okFunc (int widget, int callData) {
- int hFontName = OS.gtk_font_selection_dialog_get_font_name (callData);
- int fontSize = OS.strlen (hFontName);
- byte [] buffer = new byte [fontSize];
- OS.memmove (buffer, hFontName, fontSize);
- char [] fontName = Converter.mbcsToWcs (null, buffer);
- fontData = FontData.gtk_new(new String (fontName));
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a FontData object describing the font that was selected,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public FontData open () {
- int handle;
- byte [] titleBytes;
- titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_font_selection_dialog_new (titleBytes);
- GtkFontSelectionDialog dialog = new GtkFontSelectionDialog ();
- OS.memmove (dialog, handle, GtkFontSelectionDialog.sizeof);
- if (parent!=null) {
- OS.gtk_window_set_modal(handle, true);
- OS.gtk_window_set_transient_for(handle, parent.topHandle);
- }
- if (fontData != null) {
- byte[] buffer = Converter.wcsToMbcs(null, fontData.gtk_getXlfd(), true);
- OS.gtk_font_selection_set_font_name(dialog.fontsel, buffer);
- }
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
- OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
- fontData = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return fontData;
-}
-/**
- * Sets a FontData object describing the font to be
- * selected by default in the dialog, or null to let
- * the platform choose one.
- *
- * @param fontData the FontData to use initially, or null
- */
-public void setFontData (FontData fontData) {
- this.fontData = fontData;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
deleted file mode 100644
index b0d72d4e90..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an etched border
- * with an optional title.
- * <p>
- * Shadow styles are hints and may not be honoured
- * by the platform. To create a group with the
- * default shadow style for the platform, do not
- * specify a shadow style.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Group extends Composite {
- int frameHandle;
- String text="";
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Group (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-void createHandle(int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- frameHandle = OS.gtk_frame_new(null);
- if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_fixed_new();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void _setHandleStyle() {
- int shadow = OS.GTK_SHADOW_IN;
- if ((style & SWT.SHADOW_IN) != 0) shadow = OS.GTK_SHADOW_IN;
- if ((style & SWT.SHADOW_OUT) != 0) shadow = OS.GTK_SHADOW_OUT;
- if ((style & SWT.SHADOW_ETCHED_IN) != 0) shadow = OS.GTK_SHADOW_ETCHED_IN;
- if ((style & SWT.SHADOW_ETCHED_OUT) != 0) shadow = OS.GTK_SHADOW_ETCHED_OUT;
- OS.gtk_frame_set_shadow_type(frameHandle, shadow);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, frameHandle);
- OS.gtk_container_add(frameHandle, handle);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = _computeSize(wHint, hHint, changed).x;
- int height = 0;
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (frameHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (frameHandle, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- frameHandle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- text = null;
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (frameHandle);
-}
-
-int topHandle () { return eventBoxHandle; }
-int parentingHandle() { return handle; }
-
-/*
- * === GEOMETRY ===
- */
-
-public Rectangle _getClientArea () {
- /*
- * The Group coordinates originate at the client area
- */
- int width, height;
- Point size = _getSize();
- width = size.x - _getTrim().left - _getTrim().right;
- height = size.y - _getTrim().top - _getTrim().bottom;
- return new Rectangle(0,0, width, height);
-}
-
-Trim _getTrim() {
- trim = new Trim();
-
- // set up the test widgets
- int testWindowHandle = OS.gtk_window_new(0);
- int testHandle = OS.gtk_frame_new(string2bytesConvertMnemonic("Test String"));
- OS.gtk_container_add(testWindowHandle, testHandle);
- OS.gtk_widget_realize(testHandle);
-
- // get info
- GtkFrame frame = new GtkFrame();
- OS.memmove (frame, testHandle, GtkFrame.sizeof);
- GtkStyle groupStyle = new GtkStyle();
- OS.memmove (groupStyle, frame.style, GtkStyle.sizeof);
- GtkStyleClass styleClass = new GtkStyleClass();
- OS.memmove (styleClass, groupStyle.klass, GtkStyleClass.sizeof);
-
- // see gtk_frame_size_allocate()
- trim.left = trim.right = frame.border_width + styleClass.xthickness;
- trim.top = frame.border_width + Math.max(frame.label_height, styleClass.ythickness);
- trim.bottom = frame.border_width + styleClass.ythickness;
-
- // clean up
- OS.gtk_widget_destroy(testHandle);
- OS.gtk_widget_destroy(testWindowHandle);
- return trim;
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
- Point clientSize = UtilFuncs.getSize(frameHandle);
- // WRONG but it's quite safe - the frame clips it
- UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
- return differentExtent;
-}
-/* ========= Model Logic ========= */
-
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which is the string that the
- * is used as the <em>title</em>. If the text has not previously
- * been set, returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return text;
-}
-
-
-/**
- * Sets the receiver's text, which is the string that will
- * be displayed as the receiver's <em>title</em>, to the argument,
- * which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_frame_set_label (frameHandle, string2bytesConvertMnemonic(string));
- text=string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/GtkFileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/GtkFileDialog.java
deleted file mode 100644
index 1cfabc222b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/GtkFileDialog.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.swt.widgets;
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-abstract class GtkFileDialog extends Dialog {
-
- String answer;
- int handle, okButtonHandle, cancelButtonHandle;
- char separator = System.getProperty ("file.separator").charAt (0);
-
-GtkFileDialog (Shell parent, int style) {
- super (parent, style);
-}
-
-/**
- * Actually create the GtkFileSelection dialog widget.
- * Set the correct title.
- * Get the pointers to the buttons.
- */
-void createGtkDialog() {
- /* create */
- byte [] titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_file_selection_new (titleBytes);
-
- /* buttons */
- GtkFileSelection dialog = new GtkFileSelection ();
- OS.memmove (dialog, handle, GtkFileSelection.sizeof);
- okButtonHandle = dialog.ok_button;
- cancelButtonHandle = dialog.cancel_button;
-}
-
-/**
- * Deals with the filter.
- */
-void setUpFilter() {
- /*
- // Calculate the fully-specified file name and convert to bytes
- StringBuffer stringBuffer = new StringBuffer ();
- if (filterPath == null) {
- filterPath = "";
- } else {
- if (filterPath.length () > 0) {
- stringBuffer.append (filterPath);
- if (filterPath.charAt (filterPath.length () - 1) != separator) {
- stringBuffer.append (separator);
- }
- }
- }
- if (fileName == null) {
- fileName = "";
- } else {
- stringBuffer.append (fileName);
- }
- fullPath = stringBuffer.toString ();
- byte [] fullPathBytes = Converter.wcsToMbcs (null, fullPath, true);
- OS.gtk_file_selection_set_filename (handle, fullPathBytes);
-
- // Set the extension
- if (filterNames == null) filterNames = new String [0];
- if (filterExtensions == null) filterExtensions = new String [0];
- if (filterExtensions.length == 1) {
- String ext = filterExtensions [0];
- byte [] extBytes = Converter.wcsToMbcs (null, ext, true);
- OS.gtk_file_selection_complete (handle, extBytes);
- }
- */
-}
-
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the first selected file,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- createGtkDialog();
- setUpFilter();
-
- /* Hook callbacks */
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (okButtonHandle, clicked, okFunc, handle);
- OS.gtk_signal_connect (cancelButtonHandle, clicked, cancelFunc, handle);
-
- /* Show the dialog */
- answer = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
-
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return answer;
-}
-
-abstract boolean getAnswer();
-
-String getFileNameFromOS() {
- int lpFilename = OS.gtk_file_selection_get_filename (handle);
- int filenameLength = OS.strlen (lpFilename);
- byte [] filenameBytes = new byte [filenameLength];
- OS.memmove (filenameBytes, lpFilename, filenameLength);
- return new String (Converter.mbcsToWcs (null, filenameBytes));
-}
-
-int calculateLastSeparatorIndex(String x) {
- int separatorIndex = x.indexOf (separator);
- int index = separatorIndex;
- while (index != -1) {
- separatorIndex = index;
- index = x.indexOf (separator, index + 1);
- }
- return separatorIndex;
-}
-
-
-/*
- * The callback functions.
- */
-int okFunc (int widget, int callData) {
- if (getAnswer()) OS.gtk_widget_destroy (callData);
- return 0;
-}
-int cancelFunc (int widget, int callData) {
- answer = null;
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int callData) {
- OS.gtk_main_quit ();
- return 0;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
deleted file mode 100644
index 84f872b4a8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ /dev/null
@@ -1,365 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a non-selectable
- * user interface object that displays a string or image.
- * When SEPARATOR is specified, displays a single
- * vertical or horizontal line.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
- * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Label extends Control {
- int boxHandle, frameHandle;
- Image image;
- String text;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Label (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SEPARATOR) != 0) return style;
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- frameHandle = OS.gtk_frame_new(null);
- if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = ((style&SWT.SEPARATOR) != 0)? (((style&SWT.HORIZONTAL)!= 0)?
- OS.gtk_hseparator_new() : OS.gtk_vseparator_new()):
- OS.gtk_label_new (new byte [1]);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-void setHandleStyle () {
- int type = (style & SWT.BORDER) != 0 ? OS.GTK_SHADOW_ETCHED_IN : OS.GTK_SHADOW_NONE;
- OS.gtk_frame_set_shadow_type (frameHandle, type);
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((style & SWT.WRAP) != 0) OS.gtk_label_set_line_wrap (handle, true);
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(boxHandle, frameHandle);
- OS.gtk_container_add(frameHandle, handle);
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (frameHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (boxHandle, this);
- WidgetTable.put (frameHandle, this);
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (boxHandle);
- WidgetTable.remove (frameHandle);
-}
-
-int eventHandle () {
- return boxHandle;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
- text = null;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = frameHandle = 0;
-}
-
-int topHandle () {
- return boxHandle;
-}
-
-int computeHandle () {
- return frameHandle;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if ((style&SWT.SEPARATOR) != 0) {
- int w, h;
- if ((style&SWT.HORIZONTAL)!= 0) {
- w = 45;
- h = 6;
- } else { // vertical
- w = 6;
- h = 45;
- }
- if (wHint != SWT.DEFAULT) w = wHint;
- if (hHint != SWT.DEFAULT) h = hHint;
- return new Point(w,h);
- }
- return super.computeSize(wHint, hHint, changed);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return 0;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return "";
- return text;
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- this.image = image;
- if ((style & SWT.SEPARATOR) != 0) return;
- //NOT IMPLEMENTED - events and state of handle lost
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- if (image == null) {
- handle = OS.gtk_label_new (new byte [1]);
- } else {
- handle = OS.gtk_pixmap_new (image.pixmap, image.mask);
- }
- OS.gtk_container_add (frameHandle, handle);
- WidgetTable.put (handle, this);
- int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- switch (alignment) {
- case SWT.LEFT: OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f); break;
- case SWT.CENTER: OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f); break;
- case SWT.RIGHT: OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f); break;
- }
- OS.gtk_widget_show (handle);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if (!isText) {
- //NOT IMPLEMENTED - events and state of handle lost
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- handle = OS.gtk_label_new (new byte [1]);
- OS.gtk_container_add (frameHandle, handle);
- WidgetTable.put (handle, this);
- int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- switch (alignment) {
- case SWT.LEFT:
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- break;
- case SWT.CENTER:
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- break;
- case SWT.RIGHT:
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- break;
- }
- }
- OS.gtk_label_parse_uline (handle, string2bytesConvertMnemonic(string));
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
deleted file mode 100644
index 053ba6cc28..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ /dev/null
@@ -1,1138 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-
-/**
- * Instances of this class represent a selectable user interface
- * object that displays a list of strings and issues notificiation
- * when a string selected. A list may be single or multi select.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class List extends Scrollable {
- boolean selected;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public List (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.g_malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_append (handle, new int [] {ptr});
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- OS.g_free (ptr);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_ADDED);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.g_malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_insert (handle, index, new int [] {ptr});
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- OS.g_free (ptr);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the selection changes.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_clist_new (1);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- int selectionMode = ((style & SWT.MULTI) != 0)?
- OS.GTK_SELECTION_EXTENDED :
- OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, selectionMode);
-
- int border = OS.GTK_SHADOW_NONE;
- if ((style&SWT.BORDER)!=0) {
- border = OS.GTK_SHADOW_ETCHED_IN;
- if ((style&SWT.SHADOW_IN)!=0) border = OS.GTK_SHADOW_IN;
- if ((style&SWT.SHADOW_OUT)!=0) border = OS.GTK_SHADOW_OUT;
- if ((style&SWT.SHADOW_ETCHED_IN)!=0) border = OS.GTK_SHADOW_ETCHED_IN;
- if ((style&SWT.SHADOW_ETCHED_OUT)!=0) border = OS.GTK_SHADOW_ETCHED_OUT;
- }
- OS.gtk_clist_set_shadow_type(handle, border);
- setScrollingPolicy();
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents();
- signal_connect (handle, "select_row", SWT.Selection, 5);
- signal_connect (handle, "unselect_row", SWT.Selection, 5);
-}
-
-void showHandle() {
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return super.computeSize (wHint, hHint, changed);
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_unselect_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_unselect_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * has the focus in the receiver, or -1 if no item is has focus.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getFocusIndex () {
- checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return clist.focus_row;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] buffer = new int [1];
- int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
- int length = OS.strlen (buffer [0]);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, buffer [0], length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- return widget.rows;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int count = getItemCount ();
- String [] result = new String [count];
- for (int i=0; i<count; i++) result [i] = getItem (i);
- return result;
-}
-
-/**
- * Returns an array of <code>String</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public String [] getSelection () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- if (list==0) return new String[0];
- int length = OS.g_list_length (list);
- String [] items = new String [length];
- int [] buffer = new int [1];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (list, i);
- int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
- int strlen = OS.strlen (buffer [0]);
- byte [] buffer1 = new byte [strlen];
- OS.memmove (buffer1, buffer [0], strlen);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- items [i] = new String (buffer2, 0, buffer2.length);
- }
- return items;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- return OS.g_list_length (widget.selection);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return -1;
- return OS.g_list_nth_data (list, 0);
-}
-
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- int [] indices = new int [length];
- for (int i=0; i<length; i++) {
- indices [i] = OS.g_list_nth_data (list, i);
- }
- return indices;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return -clist.voffset / (clist.row_height + 1);
-}
-
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- for (int i=start; i<items.length; i++) {
- if (items [i].equals (string)) return i;
- }
- return -1;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (list == 0) return false;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (index == OS.g_list_nth_data (list, i)) return true;
- }
- return false;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- if ((style & SWT.MULTI) != 0) selected = true;
- return super.processMouseDown (callData, arg1, int2);
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- int result = super.processMouseUp (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) {
- /*
- * Feature in GTK. When an item is reselected, GTK
- * does not issue notification. The fix is to detect
- * that the mouse was released over a selected item when
- * no selection signal was set and issue a fake selection
- * event.
- */
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (selected && clist.selection != 0) {
- int list = clist.selection;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (row [0] == OS.g_list_nth_data (list, i)) {
- postEvent (SWT.Selection);
- }
- }
- }
- }
- selected = false;
- }
- return result;
-}
-
-int processSelection (int int0, int int1, int int2) {
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (int0 != clist.focus_row) return 0;
- if ((style & SWT.MULTI) != 0) selected = false;
- boolean single = true;
- if (int2 != 0) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, int2, GdkEventButton.sizeof);
- single = gdkEvent.type != OS.GDK_2BUTTON_PRESS;
- }
- if (single) {
- postEvent (SWT.Selection);
- } else {
- postEvent (SWT.DefaultSelection);
- }
- return 0;
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_remove (handle, index);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int index = start;
- while (index <= end) {
- OS.gtk_clist_remove (handle, start);
- index++;
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
- remove (index);
-}
-
-/**
- * Removes the items from the receiver at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int last = -1;
- for (int i=0; i<newIndices.length; i++) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- OS.gtk_clist_remove (handle, index);
- last = index;
- }
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_clear (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_select_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_select_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_set_text (handle, index, 0, buffer);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- removeAll ();
- for (int i=0; i<items.length; i++) {
- add (items [i]);
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (int index) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (index);
- showSelection ();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (start, end);
- showSelection ();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selection is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int[])
- */
-public void setSelection(int[] indices) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (indices);
- showSelection ();
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.MULTI) != 0) deselectAll ();
- for (int i=items.length-1; i>=0; --i) {
- int index = 0;
- String string = items [i];
- if (string != null) {
- while ((index = indexOf (string, index)) != -1) {
- select (index);
- if (((style & SWT.SINGLE) != 0) && isSelected (index)) {
- showSelection ();
- return;
- }
- index++;
- }
- }
- }
- if ((style & SWT.SINGLE) != 0) deselectAll ();
- showSelection ();
-}
-
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- //BUG IN GTK - doesn't scroll correctly before shell open
- OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return;
- int index = OS.g_list_nth_data (list, 0);
- int visibility = OS.gtk_clist_row_is_visible (handle, index);
- if (visibility == OS.GTK_VISIBILITY_FULL) return;
- //BUG IN GTK - doesn't scroll correctly before shell open
- OS.gtk_clist_moveto (handle, index, 0, 0.5f, 0.0f);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
deleted file mode 100644
index 7a77f50dc2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ /dev/null
@@ -1,563 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are user interface objects that contain
- * menu items.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BAR, DROP_DOWN, POP_UP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Help, Hide, Show </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Menu extends Widget {
- MenuItem cascade;
- Decorations parent;
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Control parent) {
- this (parent.getShell (), SWT.POP_UP);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Decorations parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Menu parentMenu) {
- this (parentMenu.parent, SWT.DROP_DOWN);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (MenuItem parentItem) {
- this (parentItem.parent);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>MenuListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #removeMenuListener
- */
-public void addMenuListener (MenuListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Hide,typedListener);
- addListener (SWT.Show,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
-}
-void createHandle (int index) {
- state |= HANDLE;
- if ((style & SWT.BAR) != 0) {
- handle = OS.gtk_menu_bar_new ();
- OS.gtk_widget_show (handle);
- } else {
- handle = OS.gtk_menu_new ();
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- parent.add (this);
-}
-
-/**
- * Returns the default menu item or null if none has
- * been previously set.
- *
- * @return the default menu item.
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getDefaultItem () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- int data = OS.g_list_nth_data (list, index);
- if (data == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- return (MenuItem) WidgetTable.get (data);
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- return OS.g_list_length (list);
-}
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- int count = OS.g_list_length (list);
- MenuItem [] items = new MenuItem [count];
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (list, i);
- items [i] = (MenuItem) WidgetTable.get (data);
- }
- return items;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Decorations getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getParentItem () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return cascade;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParentMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (cascade == null) return null;
- return cascade.getParent ();
-}
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getShell ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_MAPPED) != 0;
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (MenuItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getEnabled () && getParent ().getEnabled ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getVisible ();
-}
-void releaseChild () {
- super.releaseChild ();
- if (cascade != null) cascade.setMenu (null);
- if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
- parent.setMenuBar (null);
- }
-}
-void releaseWidget () {
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- if (parent != null) parent.remove (this);
- super.releaseWidget ();
- parent = null;
- cascade = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the menu events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #addMenuListener
- */
-public void removeMenuListener (MenuListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Hide, listener);
- eventTable.unhook (SWT.Show, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultItem (MenuItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the display.
- * <p>
- * Note: This is different from most widgets where the
- * location of the widget is relative to the parent.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
-// OS.gtk_widget_set_uposition(handle, x, y);
-// OS.gtk_widget_set_uposition(handle, 0, 0);
- sendEvent(SWT.Move);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.BAR) != 0) return;
- if (visible) {
- sendEvent(SWT.Show);
- OS.gtk_menu_popup (handle, 0, 0, 0, 0, 3, 0);
- } else {
- OS.gtk_menu_popdown (handle);
- sendEvent(SWT.Hide);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
deleted file mode 100644
index 1de7188b22..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ /dev/null
@@ -1,631 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Arm, Help, Selection</dd>
- * </dl>
- *<p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class MenuItem extends Item {
- Menu parent, menu;
- int accelerator;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (parent.getItemCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- int count = parent.getItemCount ();
- if (!(0 <= index && index <= count)) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- createWidget (index);
-}
-void addAccelerator (int accel_group) {
- if (accel_group == 0) return;
- if (accelerator == 0) return;
- byte [] activate = Converter.wcsToMbcs (null, "activate", true);
- int mask = 0;
- if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
- if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
- if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
- int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
- int newKey = Display.untranslateKey (keysym);
- if (newKey != 0) {
- keysym = newKey;
- } else {
- keysym = wcsToMbcs ((char) keysym);
- }
- OS.gtk_widget_add_accelerator (handle, activate, accel_group, keysym, mask, OS.GTK_ACCEL_VISIBLE);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the arm events are generated for the control, by sending
- * it one of the messages defined in the <code>ArmListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #removeArmListener
- */
-public void addArmListener (ArmListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Arm, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
-}
-void createHandle (int index) {
- state |= HANDLE;
- byte [] buffer = new byte [1];
- int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR;
- switch (style & bits) {
- case SWT.SEPARATOR:
- handle = OS.gtk_menu_item_new ();
- break;
- case SWT.RADIO:
-// handle = OS.gtk_radio_menu_item_new_with_label (0, buffer);
-// break;
- case SWT.CHECK:
- handle = OS.gtk_check_menu_item_new_with_label (buffer);
- break;
- case SWT.PUSH:
- default:
- handle = OS.gtk_menu_item_new_with_label (buffer);
- break;
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- OS.gtk_check_menu_item_set_show_toggle (handle, true);
- }
- if ((parent.style & SWT.BAR) != 0) {
- OS.gtk_menu_bar_insert (parent.handle, handle, index);
- } else {
- OS.gtk_menu_insert (parent.handle, handle, index);
- }
- OS.gtk_widget_show (handle);
-}
-/**
- * Return the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @return the accelerator
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAccelerator () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return accelerator;
-}
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the receiver's cascade menu if it has one or null
- * if it does not. Only <code>CASCADE</code> menu items can have
- * a pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return menu;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- GtkCheckMenuItem menuItem = new GtkCheckMenuItem ();
- OS.memmove (menuItem, handle, GtkCheckMenuItem.sizeof);
- return menuItem.active != 0;
-}
-void hookEvents () {
- super.hookEvents ();
- Display display = getDisplay ();
- int windowProc2 = display.windowProc2;
- byte [] activate_event = Converter.wcsToMbcs (null, "activate", true);
- OS.gtk_signal_connect (handle, activate_event, windowProc2, SWT.Selection);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- return getEnabled ();
-}
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-void releaseChild () {
- super.releaseChild ();
- if (menu != null) menu.dispose ();
- menu = null;
-}
-void releaseWidget () {
- if (menu != null) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- menu = null;
- super.releaseWidget ();
- int accel_group = parent.getShell ().accelGroup;
- removeAccelerator (accel_group);
- accelerator = 0;
- parent = null;
-}
-void removeAccelerator (int accel_group) {
- if (accel_group == 0) return;
- if (accelerator == 0) return;
- int mask = 0;
- if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
- if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
- if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
- int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
- int newKey = Display.untranslateKey (keysym);
- if (newKey != 0) {
- keysym = newKey;
- } else {
- keysym = wcsToMbcs ((char) keysym);
- }
- OS.gtk_widget_remove_accelerator (handle, accel_group, keysym, mask);
- accelerator = 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the arm events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #addArmListener
- */
-public void removeArmListener (ArmListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Arm, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @param accelerator an integer that is the bit-wise OR of masks and a key
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAccelerator (int accelerator) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int accel_group = parent.getShell ().accelGroup;
- if (accelerator != 0) removeAccelerator (accel_group);
- this.accelerator = accelerator;
- if (accelerator != 0) addAccelerator (accel_group);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
-
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget ();
-
- /* Check to make sure the new menu is valid */
- if ((style & SWT.CASCADE) == 0) {
- error (SWT.ERROR_MENUITEM_NOT_CASCADE);
- }
- if (menu != null) {
- if ((menu.style & SWT.DROP_DOWN) == 0) {
- error (SWT.ERROR_MENU_NOT_DROP_DOWN);
- }
- if (menu.parent != parent.parent) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
-
- /* Assign the new menu */
- Menu oldMenu = this.menu;
- if (oldMenu == menu) return;
- if (oldMenu != null) {
- oldMenu.cascade = null;
- /*
- * Add a reference to the menu we are about
- * to replace or GTK will destroy it.
- */
- OS.gtk_object_ref (oldMenu.handle);
- OS.gtk_menu_item_remove_submenu (handle);
- }
- if ((this.menu = menu) != null) {
- menu.cascade = this;
- OS.gtk_menu_item_set_submenu (handle, menu.handle);
- }
-
-
-}
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_check_menu_item_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- int index = string.indexOf('\t');
- if (index != -1) length = index;
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- int label = OS.g_list_nth_data (list, 0);
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- OS.gtk_label_set_text (label, buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java
deleted file mode 100644
index ed3a745f1c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class are used used to inform or warn the user.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
- * <dd>OK, OK | CANCEL</dd>
- * <dd>YES | NO, YES | NO | CANCEL</dd>
- * <dd>RETRY | CANCEL</dd>
- * <dd>ABORT | RETRY | IGNORE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class MessageBox extends Dialog {
-
- String message;
-
- // Handles
- int handle;
- int label;
- int buttonOK, buttonCANCEL, buttonYES, buttonNO, buttonABORT, buttonRETRY, buttonIGNORE;
-
- int state;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent, int style) {
- super(parent, checkStyle(style));
- checkSubclass ();
-}
-
-
-
-/*
- * === GET/SET MESSAGE; OPEN ===
- */
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public int open () {
- createHandle();
- createMessage(); // includes configuring
- createActionButtons();
- state=0;
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "delete_event", true);
- OS.gtk_signal_connect_after (handle, destroy, destroyFunc, handle);
- showHandle();
- while(state==0) OS.gtk_main_iteration();
- OS.gtk_widget_destroy(handle);
- return state;
-}
-
-/*
- * === Actual handle operations ===
- */
-
-private void createHandle() {
- handle = OS.gtk_dialog_new();
- if (handle==0) SWT.error(SWT.ERROR_NO_HANDLES);
- if ((style & (SWT.PRIMARY_MODAL|SWT.APPLICATION_MODAL|SWT.SYSTEM_MODAL)) != 0) {
- OS.gtk_window_set_modal(handle, true);
- }
-}
-private void createMessage() {
- byte[] bytes = Converter.wcsToMbcs (null, getMessage(), true);
- label = OS.gtk_label_new (bytes);
- GtkDialog dialog = new GtkDialog();
- OS.memmove (dialog, handle, GtkDialog.sizeof);
- OS.gtk_box_pack_start (dialog.vbox, label, true, true, 5); // FIXME should we use container_add??
-}
-private void createActionButtons() {
- if ((style & SWT.OK) != 0) buttonOK = createButton("OK");
- if ((style & SWT.CANCEL) != 0) buttonCANCEL = createButton("CANCEL");
-
- if ((style & SWT.YES) != 0) buttonYES = createButton("YES");
- if ((style & SWT.NO) != 0) buttonNO = createButton("NO");
-
- if ((style & SWT.ABORT) != 0) buttonABORT = createButton("ABORT");
- if ((style & SWT.RETRY) != 0) buttonRETRY = createButton("RETRY");
- if ((style & SWT.IGNORE) != 0) buttonIGNORE = createButton("IGNORE");
-}
-private void showHandle() {
- OS.gtk_widget_show_all (handle);
-
- boolean hasTitle=false;
- String title = getText();
- if (title!=null) if (title.length()!=0) hasTitle=true;
-
- int decor = 0;
- if (hasTitle) decor |= OS.GDK_DECOR_TITLE;
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, handle, GtkWidget.sizeof);
- int gdkWindow = widget.window;
- OS.gdk_window_set_decorations(gdkWindow, decor);
- if (hasTitle) {
- byte[] bytes = Converter.wcsToMbcs (null, title, true);
- OS.gtk_window_set_title(handle, bytes);
- }
-}
-int createButton(String buttonName) {
- System.out.println("Creating button "+buttonName);
- byte[] bytes = Converter.wcsToMbcs (null, buttonName, true);
- int buttonHandle = OS.gtk_button_new_with_label(bytes);
- GtkDialog dialog = new GtkDialog();
- OS.memmove (dialog, handle, GtkDialog.sizeof);
- OS.gtk_box_pack_start (dialog.action_area, buttonHandle, true, true, 0);
- hookSelection(buttonHandle);
- return buttonHandle;
-}
-private void hookSelection(int h) {
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
-
- Callback okCallback = new Callback (this, "activateFunc", 2);
- int okFunc = okCallback.getAddress ();
- OS.gtk_signal_connect (h, clicked, okFunc, h);
-
-}
-private static int checkStyle (int style) {
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
-int activateFunc(int widget, int callData) {
- if (widget==buttonOK) { state=SWT.OK; return 0; }
- if (widget==buttonCANCEL) { state=SWT.CANCEL; return 0; }
- if (widget==buttonYES) { state=SWT.YES; return 0; }
- if (widget==buttonNO) { state=SWT.NO; return 0; }
- if (widget==buttonABORT) { state=SWT.ABORT; return 0; }
- if (widget==buttonRETRY) { state=SWT.RETRY; return 0; }
- if (widget==buttonIGNORE) { state=SWT.IGNORE; return 0; }
- return 0;
-}
-/*
- * We need this because some WMs will give us a cross even when
- * we specifically ask it not to.
- */
-int destroyFunc(int widget, int callData) {
- return 1;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
deleted file mode 100644
index b5b36ce79a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent is an unselectable
- * user interface object that is used to display progress,
- * typically in the form of a bar.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class ProgressBar extends Control {
- int min = 0, max = 100, value = 0;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ProgressBar (Composite parent, int style) {
- super (parent, checkStyle(style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- handle = OS.gtk_progress_bar_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- OS.gtk_progress_configure (handle, value, min, max);
-}
-
-void setHandleStyle() {
- int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_TOP_TO_BOTTOM : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
- OS.gtk_progress_bar_set_orientation (handle, orientation);
- int style = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
- OS.gtk_progress_bar_set_bar_style (handle, style);
-}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- return max;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- return min;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- return value;
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int maximum) {
- checkWidget ();
- if (maximum < 0) return;
- max = maximum;
- if (value > maximum) value = maximum;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int minimum) {
- checkWidget ();
- if (minimum < 0) return;
- if (value < minimum) value = minimum;
- min = minimum;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int x) {
- checkWidget ();
- if (x < 0) return;
- value = x;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
deleted file mode 100644
index cad77f4868..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ /dev/null
@@ -1,333 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user interface object
- * that allows the user to drag a rubber banded outline of the sash within
- * the parent control.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Sash extends Control {
- boolean dragging, drawing;
- int startX, startY, lastX, lastY, drawX, drawY;
- int start_root_x, start_root_y;
- int last_root_x, last_root_y;
- int cursor;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Sash (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- handle=OS.gtk_drawing_area_new();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void showHandle() {
- createCursor();
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize(handle);
-}
-
-private void createCursor() {
- int cursorType = ((style&SWT.VERTICAL)!=0)?
- OS.GDK_SB_H_DOUBLE_ARROW:OS.GDK_SB_V_DOUBLE_ARROW;
- cursor = OS.gdk_cursor_new(cursorType);
- GtkWidget widget = new GtkWidget ();
- OS.memmove(widget, handle, GtkWidget.sizeof);
- OS.gdk_window_set_cursor(widget.window, cursor);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
- * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.MouseDoubleClick,listener);
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_grab_add(handle);
- dragging = true;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- if (gdkEvent.button != 1) return 0;
- startX = (int)gdkEvent.x; startY = (int)gdkEvent.y;
- start_root_x=(int)gdkEvent.x_root; start_root_y=(int)gdkEvent.y_root;
- drawX=startX; drawY=startY;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
- Event event = new Event ();
- event.detail = SWT.DRAG;
- event.time = gdkEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- sendEvent (SWT.MouseDown, event);
- return 0;
-}
-
-int processMouseMove (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- if (!dragging) return 0;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
- Rectangle rect = parent.getClientArea();
- int parentWidth = rect.width - 2;
- int parentHeight = rect.height - 2;
- last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- if (last_root_x<=start_root_x)
- newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
- else
- newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
- } else {
- if (last_root_y<=start_root_y)
- newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
- else
- newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
- }
- if ((newX == lastX) && (newY == lastY)) return 0;
- drawBand(newX, newY, width, height);
- return 0;
-}
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- if (gdkEvent.button != 1) return 0;
- if (!dragging) return 0;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
- Rectangle rect = parent.getClientArea();
- int parentWidth = rect.width - 2;
- int parentHeight = rect.height - 2;
- last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- if (last_root_x<=start_root_x)
- newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
- else
- newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
- } else {
- if (last_root_y<=start_root_y)
- newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
- else
- newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
- }
- if ((newX == lastX) && (newY == lastY)) return 0;
-
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.x = newX; event.y = newY;
- event.width = width; event.height = height;
- dragging = false;
- drawBand(newX, newY, width, height);
- drawing = false;
- OS.gtk_grab_remove(handle);
- sendEvent (SWT.Selection, event);
- return 0;
-}
-/*
-int processMouseEnter (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.detail = SWT.DRAG;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- Cursor arrowCursor;
- if ((style & SWT.HORIZONTAL) != 0) {
- arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZENS);
- } else {
- arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZEWE);
- }
- setCursor(arrowCursor);
- sendEvent (SWT.Selection, event);
- return 0;
-}
-*/
-int processMouseExit (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- sendEvent (SWT.MouseExit, event);
- return 0;
-
-}
-
-void drawBand (int x, int y, int width, int height) {
- if (x == drawX && y == drawY) return;
- Display display= parent.getDisplay ();
- if (display == null) return;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, parent.topHandle(), GtkWidget.sizeof);
- int window = gtkwidget.window;
- if (window == 0) return;
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- int stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
- int gc = OS.gdk_gc_new(window);
- Color color = new Color(display, 0xFF, 0, 0);
- OS.gdk_gc_set_background(gc, color.handle);
- Color color1 = new Color(display, 0, 0xFF, 0);
- OS.gdk_gc_set_foreground(gc, color1.handle);
- OS.gdk_gc_set_stipple(gc, stipplePixmap);
- OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
- OS.gdk_gc_set_fill(gc, OS.GDK_STIPPLED);
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- if (drawing)
- OS.gdk_draw_rectangle(window, gc, 1, drawX, drawY, width, height);
- else
- drawing = true;
- drawX=x;drawY=y;
- OS.gdk_draw_rectangle(window, gc, 1, x, y, width, height);
- OS.gdk_bitmap_unref(stipplePixmap);
- OS.gdk_gc_destroy(gc);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- OS.gdk_cursor_destroy (cursor);
- cursor = 0;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
deleted file mode 100644
index 7baf8ad787..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
+++ /dev/null
@@ -1,389 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user
- * interface object that present a range of continuous
- * numeric values.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Scale extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scale (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0);
- if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.HORIZONTAL) != 0) {
- handle = OS.gtk_hscale_new (hAdjustment);
- } else {
- handle = OS.gtk_vscale_new (hAdjustment);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- OS.gtk_scale_set_digits (handle, 0);
- OS.gtk_scale_set_draw_value (handle, false);
-}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.put (hAdjustment, this);
-}
-
-void deregister () {
- super.deregister ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.remove (hAdjustment);
- /*
- * This code is intentionally commented.
- */
-// OS.gtk_object_unref (hAdjustment);
-// OS.gtk_object_destroy (hAdjustment);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_set_value (hAdjustment, value);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
deleted file mode 100644
index daba64bd09..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
+++ /dev/null
@@ -1,639 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given scroll bar will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the scroll bar represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, scroll bars will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, scroll bars are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the scroll bar's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the scroll bar will not change.
- * </p><p>
- * Scroll bars are created by specifying either <code>H_SCROLL</code>,
- * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
- * They are accessed from the <code>Scrollable</code> using
- * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
- * </p><p>
- * Note: Scroll bars are not Controls. On some platforms, scroll bars
- * that appear as part of some standard controls such as a text or list
- * have no operating system resources and are not children of the control.
- * For this reason, scroll bars are treated specially. To create a control
- * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see Slider
- * @see Scrollable
- * @see Scrollable#getHorizontalBar
- * @see Scrollable#getVerticalBar
- */
-
-public class ScrollBar extends Widget {
- Scrollable parent;
-
-ScrollBar () {
-}
-
-/**
-* Creates a new instance of the widget.
-*/
-ScrollBar (Scrollable parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- return true;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the receiver's parent, which must be scrollable.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Scrollable getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-/**
- * For horizontal scroll bars, returns the height of the
- * instance, and for vertical scroll bars, returns the width
- * of the instance.
- *
- * @return the scroll bar size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget ();
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_width, widget.alloc_height);
-}
-
-/**
- * Answers the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public int getThumb () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.page_size;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget ();
- return true;
-}
-
-void hookEvents () {
- signal_connect (handle, "value_changed", SWT.Selection, 2);
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * <p>
- * Note: Because of the strong connection between a scroll bar
- * and the widget which contains it (its parent), a scroll bar
- * will not indicate that it is enabled if its parent is not.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- return getEnabled () && getParent ().getEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget ();
- return getVisible () && getParent ().isVisible ();
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (parent.horizontalBar == this) parent.horizontalBar = null;
- if (parent.verticalBar == this) parent.verticalBar = null;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget ();
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_set_value (handle, value);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.page_size = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget ();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.lower = minimum;
- adjustment.upper = maximum;
- adjustment.step_increment = increment;
- adjustment.page_increment = pageIncrement;
- adjustment.page_size = thumb;
- adjustment.value = selection;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_adjustment_value_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
deleted file mode 100644
index a2405fca32..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all classes which
- * represent controls that have standard scroll bars.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>H_SCROLL, V_SCROLL</dd>
- * <dt><b>Events:</b>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public abstract class Scrollable extends Control {
-
- int scrolledHandle;
- ScrollBar horizontalBar, verticalBar;
- static Trim trim;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Scrollable () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scrollable (Composite parent, int style) {
- super (parent, style);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getClientArea
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- Trim t = _getTrim();
- return new Rectangle (x-t.left, y-t.top, width+t.left+t.right, height+t.top+t.bottom);
-}
-
-Trim _getTrim() {
- if (trim==null) initializeTrim();
- return trim;
-}
-
-void initializeTrim() { trim = new Trim(); }
-
-void _fillBin(int binHandle, int childHandle) {
- GtkBin bin = new GtkBin();
- OS.memmove(bin, binHandle, GtkBin.sizeof);
- bin.child = childHandle;
- OS.memmove(binHandle, bin, GtkBin.sizeof);
- OS.gtk_widget_set_parent(childHandle, binHandle);
-}
-
-/*
- * Subclasses must only use super.configure()
- * to connect their topHandle to the parent.
- * It is the responsibility of the conrete subclass
- * to configure the scrolled handles.
- */
-abstract void configure ();
-
-ScrollBar createScrollBar (int style) {
- if (scrolledHandle == 0) return null;
- ScrollBar bar = new ScrollBar ();
- bar.parent = this;
- bar.style = style;
- bar.state |= HANDLE;
- if ((style & SWT.H_SCROLL) != 0) {
- bar.handle = OS.gtk_scrolled_window_get_hadjustment (scrolledHandle);
- } else {
- bar.handle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
- }
- bar.hookEvents ();
- bar.register ();
- return bar;
-}
-void createWidget (int index) {
- super.createWidget (index);
- if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
- if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
-}
-void deregister () {
- super.deregister ();
- if (scrolledHandle != 0) {
- WidgetTable.remove (scrolledHandle);
- }
-}
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data (that is,
- * not covered by the "trimmings").
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeTrim
- */
-public Rectangle getClientArea () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Rectangle (0, 0, widget.alloc_width, widget.alloc_height);
-}
-/**
- * Returns the receiver's horizontal scroll bar if it has
- * one, and null if it does not.
- *
- * @return the horizontal scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getHorizontalBar () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return horizontalBar;
-}
-/**
- * Returns the receiver's vertical scroll bar if it has
- * one, and null if it does not.
- *
- * @return the vertical scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getVerticalBar () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return verticalBar;
-}
-
-void setScrollingPolicy() {
- if (scrolledHandle==0) return;
- int hsp = ((style&SWT.H_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
- int vsp = ((style&SWT.V_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
- OS.gtk_scrolled_window_set_policy(scrolledHandle, hsp,vsp);
-}
-
-void register () {
- super.register ();
- if (scrolledHandle != 0) {
- WidgetTable.put (scrolledHandle, this);
- }
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- scrolledHandle = 0;
-}
-
-void releaseWidget () {
- if (horizontalBar != null) {
- horizontalBar.releaseWidget ();
- horizontalBar.releaseHandle ();
- }
- if (verticalBar != null) {
- verticalBar.releaseWidget ();
- verticalBar.releaseHandle ();
- }
- horizontalBar = verticalBar = null;
- super.releaseWidget ();
-}
-int topHandle () {
- if (scrolledHandle != 0) return scrolledHandle;
- return handle;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
deleted file mode 100644
index d93c35d2f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ /dev/null
@@ -1,851 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent the "windows"
- * which the desktop or "window manager" is managing.
- * Instances that do not have a parent (that is, they
- * are built using the constructor, which takes a
- * <code>Display</code> as the argument) are described
- * as <em>top level</em> shells. Instances that do have
- * a parent are described as <em>secondary</em> or
- * <em>dialog</em> shells.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations
- * and modality. For example, some window managers only
- * support resizable windows and will always assume the
- * RESIZE style, even if it is not set. In addition, if a
- * modality style is not supported, it is "upgraded" to a
- * more restrictive modality style that is supported. For
- * example, if <code>PRIMARY_MODAL</code> is not supported,
- * it would be upgraded to <code>APPLICATION_MODAL</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * </p>
- * <p>
- * IMPORTANT: This class is not intended to be subclassed.
- * </p>
- *
- * @see Decorations
- * @see SWT
- */
-public class Shell extends Decorations {
- Display display;
- int vboxHandle;
- int modal;
- int accelGroup;
- Rectangle lastClientArea;
- boolean hasFocus;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-/**
- * Constructs a new instance of this class. This is equivalent
- * to calling <code>Shell((Display) null)</code>.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell () {
- this ((Display) null);
-}
-/**
- * Constructs a new instance of this class given only the style
- * value describing its behavior and appearance. This is equivalent
- * to calling <code>Shell((Display) null, style)</code>.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (int style) {
- this ((Display) null, style);
-}
-
-/**
- * Constructs a new instance of this class given only the display
- * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display) {
- this (display, SWT.SHELL_TRIM);
-}
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display, int style) {
- this (display, null, style);
-}
-Shell (Display display, Shell parent, int style) {
- super ();
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.parent = parent;
- this.display = display;
- this.handle = handle;
- createWidget (0);
-}
-/**
- * Constructs a new instance of this class given only its
- * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent) {
- this (parent, SWT.TITLE | SWT.CLOSE | SWT.BORDER);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent, int style) {
- this (null, parent, style);
-}
-
-
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when operations are performed on the receiver,
- * by sending the listener one of the messages defined in the
- * <code>ShellListener</code> interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #removeShellListener
- */
-public void addShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Close,typedListener);
- addListener (SWT.Iconify,typedListener);
- addListener (SWT.Deiconify,typedListener);
- addListener (SWT.Activate, typedListener);
- addListener (SWT.Deactivate, typedListener);
-}
-void bringToTop () {
-// OS.gtk_window_activate_focus (shellHandle);
-}
-/**
- * Requests that the window manager close the receiver in
- * the same way it would be closed when the user clicks on
- * the "close box" or performs some other platform specific
- * key or mouse combination that indicates the window
- * should be removed.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget ();
- closeWidget ();
-}
-void closeWidget () {
- Event event = new Event ();
- event.time = OS.gdk_time_get ();
- sendEvent (SWT.Close, event);
- if (event.doit && !isDisposed ()) dispose ();
-}
-
-
-/*
- * === Handle code I: The createWidget() cycle.
- */
-
-void createHandle (int index) {
- state |= HANDLE;
- topHandle = OS.gtk_window_new((parent==null)? OS.GTK_WINDOW_TOPLEVEL:OS.GTK_WINDOW_DIALOG);
- if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- if (parent!=null) OS.gtk_window_set_transient_for(topHandle, parent.topHandle());
-
- vboxHandle = OS.gtk_vbox_new(false,0);
- if (vboxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_drawing_area_new();
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- accelGroup = OS.gtk_accel_group_new ();
- OS.gtk_window_add_accel_group (topHandle, accelGroup);
- OS.gtk_window_set_title (topHandle, new byte [1]);
-}
-
-void configure () {
- OS.gtk_container_add (topHandle, vboxHandle);
- OS.gtk_box_pack_end(vboxHandle, eventBoxHandle, true,true,0);
- OS.gtk_container_add (eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
-}
-
-void showHandle() {
- OS.gtk_widget_realize (topHandle); // careful: NOT show
- _setStyle();
-
- OS.gtk_widget_realize (vboxHandle);
- OS.gtk_widget_show_now (vboxHandle);
-
- OS.gtk_widget_realize (eventBoxHandle);
- OS.gtk_widget_show_now (eventBoxHandle);
-
- OS.gtk_widget_realize (fixedHandle);
- OS.gtk_widget_show_now (fixedHandle);
-
- OS.gtk_widget_realize (handle);
- OS.gtk_widget_show_now (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- signal_connect(topHandle, "map_event", SWT.Deiconify, 3);
- signal_connect(topHandle, "unmap_event", SWT.Iconify, 3);
- signal_connect(topHandle, "size_allocate", SWT.Resize, 3);
- signal_connect(topHandle, "delete_event", SWT.Dispose, 3);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (vboxHandle, this);
-}
-
-private void _setStyle() {
- boolean modal = (
- ((style&SWT.PRIMARY_MODAL) != 0) ||
- ((style&SWT.APPLICATION_MODAL) != 0) ||
- ((style&SWT.SYSTEM_MODAL) != 0));
- OS.gtk_window_set_modal(topHandle, modal);
-
- int decorations = 0;
- if ((style & SWT.NO_TRIM) == 0) {
- if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE;
- if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
- if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH;
- if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER;
- if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU;
- if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE;
- /*
- * Under some Window Managers (Sawmill), in order
- * to get any border at all from the window manager it is necessary
- * to set GDK_DECOR_BORDER. The fix is to force these bits when any
- * kind of border is requested.
- */
- if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER;
- }
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, topHandle, GtkWidget.sizeof);
- int w = widget.window;
- // PANIC - this must absolutely never happen, so it's not NO_HANDLES actually
- if (w == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gdk_window_set_decorations(w, decorations);
-}
-
-void _connectChild (int h) {
- OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
-}
-
-int topHandle () {
- return topHandle;
-}
-
-int parentingHandle() {
- return fixedHandle;
-}
-
-boolean isMyHandle(int h) {
- if (h == topHandle) return true;
- if (h == vboxHandle) return true;
- if (h == eventBoxHandle) return true;
- if (h == fixedHandle) return true;
- if (h == handle) return true;
- return false;
-}
-
-
-/*
- * === GEOMETRY ===
- */
-
-public Point _getLocation() {
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle, GtkWidget.sizeof);
- int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_origin(widget.window, x,y);
- return new Point(x[0], y[0]);
-}
-
-public Point _getSize() {
- return UtilFuncs.getSize(vboxHandle);
-}
-
-public Rectangle _getClientArea () {
- Point clientSize = UtilFuncs.getSize(eventBoxHandle);
- return new Rectangle (0, 0, clientSize.x, clientSize.y);
-}
-
-boolean _setSize(int width, int height) {
- /*
- * API deficiency in GTK 1.2 - lacking gtk_window_resize.
- * We work around this by directly resizing the X window.
- *
- * First, we find out the GDK handle.
- */
- GtkWidget gtkWidget = new GtkWidget();
- OS.memmove(gtkWidget, topHandle, GtkWidget.sizeof);
-
- OS.gtk_signal_handler_block_by_data (topHandle, SWT.Resize);
- OS.gdk_window_resize(gtkWidget.window, width, height);
- UtilFuncs.setSize(vboxHandle, width, height);
- Point sz = UtilFuncs.getSize(eventBoxHandle);
- UtilFuncs.setSize(fixedHandle, sz.x, sz.y);
- UtilFuncs.setSize(handle, sz.x, sz.y);
- OS.gtk_signal_handler_unblock_by_data (topHandle, SWT.Resize);
-
- return true;
-}
-
-boolean _setLocation (int x, int y) {
- GtkWidget gtkWidget = new GtkWidget();
- OS.memmove(gtkWidget, topHandle, GtkWidget.sizeof);
- OS.gdk_window_move(gtkWidget.window, x, y);
- return true;
-}
-
-void setInitialSize() {
- int width = OS.gdk_screen_width () * 5 / 8;
- int height = OS.gdk_screen_height () * 5 / 8;
- _setSize(width, height);
- OS.gtk_window_set_policy (topHandle, 1,1,0);
-}
-
-/*
- * We can't setInitialSize() before showHandle() in the case of Shell,
- * because we operate on the actual X window, so the shell must be
- * realized by that time.
- * This is a workaround until gtk_window_resize().
- */
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- configure ();
- setHandleStyle ();
- register ();
- showHandle ();
- setInitialSize ();
-}
-
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-
-/*
- * Return the control inside this shell that has the focus,
- * if there is one. Return <code>null</code> if there is no
- * such control - e.g., this shell is not active, or it is active
- * but the user clicked in a no-entry widget (like Label).
- */
-Control getFocusControl() {
- GtkWindow shell = new GtkWindow();
- OS.memmove(shell, topHandle, GtkWindow.sizeof);
- int focusHandle = shell.focus_widget;
- if (focusHandle==0) return null;
- return (Control)this.getDisplay().findWidget(focusHandle);
-}
-
-/**
- * Returns the receiver's input method editor mode. This
- * will be the result of bitwise OR'ing together one or
- * more of the following constants defined in class
- * <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @return the IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public int getImeInputMode () {
- checkWidget();
- return SWT.NONE;
-}
-
-/**
-* Get the modal state.
-* <p>
-* @return the modal state
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-*/
-public int getModal () {
- checkWidget();
- return modal;
-}
-
-Shell _getShell () {
- return this;
-}
-/**
- * Returns an array containing all shells which are
- * descendents of the receiver.
- * <p>
- * @return the dialog shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkWidget();
- int count = 0;
- Shell [] shells = display.getShells ();
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.getParent ();
- } while (shell != null && shell != this);
- if (shell == this) count++;
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.getParent ();
- } while (shell != null && shell != this);
- if (shell == this) {
- result [index++] = shells [i];
- }
- }
- return result;
-}
-
-public void layout (boolean changed) {
- checkWidget();
-// if (!resizedSinceLastLayout()) return;
- lastClientArea=getClientArea();
- if (layout == null) return;
- layout.layout (this, changed);
-}
-
-/*
- * Returns whether the shell has been resized since the last layout()
- */
-boolean resizedSinceLastLayout() {
- return !getClientArea().equals(lastClientArea);
-}
-
-/**
- * Moves the receiver to the top of the drawing order for
- * the display on which it was created (so that all other
- * shells on that display, which are not the receiver's
- * children will be drawn behind it), marks it visible,
- * and sets focus to its default button (if it has one).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Control#setVisible
- * @see Decorations#setDefaultButton
-*/
-public void open () {
- checkWidget();
- setVisible (true);
-}
-
-int processDispose (int int0, int int1, int int2) {
- closeWidget ();
- return 1;
-}
-
-int processFocusIn(int int0, int int1, int int2) {
- hasFocus=true;
- postEvent(SWT.Activate);
- return 0;
-}
-
-int processFocusOut(int int0, int int1, int int2) {
- hasFocus=false;
- postEvent(SWT.Deactivate);
- return 0;
-}
-
-int processPaint (int callData, int int2, int int3) {
- //if (!hooks (SWT.Paint)) return 1;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- GdkRectangle rect = new GdkRectangle ();
- rect.x = gdkEvent.x; rect.y = gdkEvent.y;
- rect.width = gdkEvent.width; rect.height = gdkEvent.height;
- OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
- gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-/*}else{
- GdkRectangle gdkEvent = new GdkRectangle ();
- OS.memmove (gdkEvent, callData, GdkRectangle.sizeof);
- Event event = new Event ();
-// event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- OS.gdk_gc_set_clip_rectangle (gc.handle, gdkEvent);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-} */
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when operations are performed on the receiver.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #addShellListener
- */
-public void removeShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Close, listener);
- eventTable.unhook (SWT.Iconify,listener);
- eventTable.unhook (SWT.Deiconify,listener);
- eventTable.unhook (SWT.Activate, listener);
- eventTable.unhook (SWT.Deactivate, listener);
-}
-
-/**
- * Sets the input method editor mode to the argument which
- * should be the result of bitwise OR'ing together one or more
- * of the following constants defined in class <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @param mode the new IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public void setImeInputMode (int mode) {
- checkWidget();
-}
-
-public void setMaximized (boolean maximized) {
- checkWidget();
-
- /*
- * Out of luck on curent GDK.
- */
-}
-
-public void setMenuBar (Menu menu) {
- checkWidget();
-
- if (menuBar == menu) return;
- if (menu != null) {
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- if (menu == null) {
- if (menuBar != null) {
- OS.gtk_object_ref (menuBar.handle);
- OS.gtk_container_remove (vboxHandle, menuBar.handle);
- }
- }
- menuBar = menu;
- if (menuBar != null) {
- int menuHandle = menu.handle;
- OS.gtk_box_pack_start (vboxHandle, menuHandle, false, false, 0);
- }
-}
-
-public void setMinimized (boolean minimized) {
- checkWidget();
-
- /*
- * In GDK, there is no way to iconify a shell.
- * If we wanted it really badly, on pure X this is done
- * by sending a client message - see ICCCM L.4.1.4.
- */
- if (minimized) return;
-
- /*
- * At least we can force a deiconify
- */
- GtkWidget w = new GtkWidget();
- OS.memmove(w, topHandle, w.sizeof);
- OS.gdk_window_show(w.window);
-}
-
-/**
-* Set the modal state.
-* <p>
-* @param modal the new modal state
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-*/
-public void setModal (int modal) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- this.modal = modal;
-}
-
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_window_set_title (topHandle, buffer);
-}
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible) {
- OS.gtk_widget_show_now (topHandle);
- display.update();
- sendEvent (SWT.Show);
- } else {
- OS.gtk_widget_hide (topHandle);
- sendEvent (SWT.Hide);
- }
-}
-
-
-/*
- * === DESTRUCTION ===
- */
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (vboxHandle);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- vboxHandle = 0;
-}
-
-void releaseShells () {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- shell.releaseWidget ();
- shell.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseShells ();
- super.releaseWidget ();
- if (accelGroup != 0) OS.gtk_accel_group_unref (accelGroup);
- accelGroup = 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
deleted file mode 100644
index 2bad93913c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
+++ /dev/null
@@ -1,539 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given slider will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the slider represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, sliders will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, sliders are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the slider's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the slider will not change.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see ScrollBar
- */
-
-public class Slider extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Slider (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10);
- if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.HORIZONTAL) != 0) {
- handle = OS.gtk_hscrollbar_new (hAdjustment);
- } else {
- handle = OS.gtk_vscrollbar_new (hAdjustment);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.put (hAdjustment, this);
-}
-
-void deregister () {
- super.deregister ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.remove (hAdjustment);
- /*
- * This code is intentionally commented.
- */
-// OS.gtk_object_unref (hAdjustment);
-// OS.gtk_object_destroy (hAdjustment);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- // We are interested in the preferred size.
- // The native widget gives us what it thinks the minimum reasonable
- // size; we'll say we prefer to be twice that long, and exactly
- // that wide.
- int x,y;
- Point size = super.computeSize (wHint, hHint, changed);
- if (hHint==SWT.DEFAULT) {
- x = size.x;
- if ((style & SWT.HORIZONTAL) != 0) x = 2*x;
- } else x = hHint;
- if (wHint==SWT.DEFAULT) {
- y = size.y;
- if ((style & SWT.VERTICAL) != 0) y = 2*y;
- } else y = wHint;
-
- return new Point(x,y);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-/**
- * Returns the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getThumb () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_size;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_set_value (hAdjustment, value);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_size = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget ();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.value = (float) selection;
- adjustment.lower = (float) minimum;
- adjustment.upper = (float) maximum;
- adjustment.page_size = (float) thumb;
- adjustment.step_increment = (float) increment;
- adjustment.page_increment = (float) pageIncrement;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_adjustment_value_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
deleted file mode 100644
index 4338e7e92e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ /dev/null
@@ -1,554 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>TabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabFolder extends Composite {
- int notebookHandle;
- TabItem [] items;
-
-
-/*
- * == CONSTRUCTORS ==
- */
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabFolder (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/*
- * == HANDLE DANCES, FIRST SPECIES ==
- */
-
-void createHandle (int index) {
- state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new();
- fixedHandle = OS.gtk_fixed_new ();
- notebookHandle = OS.gtk_notebook_new ();
- handle = OS.gtk_fixed_new();
-}
-
-void configure () {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, notebookHandle, (short)0, (short)0);
- OS.gtk_fixed_put (fixedHandle, handle, (short)2, (short)33);
-}
-
-void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(notebookHandle);
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (notebookHandle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (notebookHandle, this);
-}
-
-void hookEvents () {
- super.hookEvents ();
- signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
- signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
-}
-
-void createWidget (int index) {
- super.createWidget(index);
- items = new TabItem [4];
-}
-
-int topHandle () { return eventBoxHandle; }
-int paintHandle () { return notebookHandle; }
-int parentingHandle () { return handle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==notebookHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- //notebookHandle
- int width = _computeSize(wHint, hHint, changed).x;
- int height = 0;
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-/**
-* Computes the widget trim.
-*/
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- return new Rectangle(x-2, y-33, width+4, height+35);
-}
-
-/*
- **** Layout code ****
- */
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
- UtilFuncs.setSize (fixedHandle, width,height);
- UtilFuncs.setSize (notebookHandle, width,height);
- UtilFuncs.setSize (handle, width-4, height-35);
- layoutCurrent();
- return differentExtent;
-}
-
-public Rectangle _getClientArea () {
- org.eclipse.swt.graphics.Point size = _getSize();
- int x = Math.max(size.x-4, 3);
- int y = Math.max(size.y-35, 3);
- return new Rectangle(0,0, x, y);
-}
-
-void layoutCurrent() {
- int index=getSelectionIndex();
- if (index==-1) return;
- Control control = items[index].control;
- if (control==null) return;
- if (control.isDisposed()) return;
- control.setBounds(getClientArea());
-}
-
-void createItem (TabItem item, int index) {
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (itemCount == items.length) {
- TabItem [] newItems = new TabItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-
- // create a new label
- byte [] buffer = new byte [] {0};
- int labelHandle = OS.gtk_label_new (buffer);
-
- // create a new fake page
- int stubPage = OS.gtk_fixed_new();
-
- // put the label and the fake page inside the notebook
- OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
- OS.gtk_notebook_append_page(notebookHandle, stubPage, labelHandle);
- OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
-
- OS.gtk_widget_show(labelHandle);
- OS.gtk_widget_show(stubPage);
-
- item.state |= HANDLE;
- item.handle = labelHandle;
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
- OS.gtk_notebook_set_show_tabs (notebookHandle, true);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-
-void destroyItem (TabItem item) {
- int index = 0;
- int itemCount = getItemCount();
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_notebook_remove_page (notebookHandle, index);
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- item.handle = 0;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-
-public TabItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return items [index];
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //return itemCount;
- int list = OS.gtk_container_children (notebookHandle);
- return OS.g_list_length (list);
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- TabItem [] result = new TabItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-/**
- * Returns an array of <code>TabItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
- if (index == -1) return new TabItem [0];
- return new TabItem [] {items [index]};
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return OS.gtk_notebook_get_current_page (notebookHandle);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TabItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- for (int i=0; i<itemCount; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-int processSelection (int int0, int int1, int int2) {
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
- if (index != -1) {
- Control control = items [index].getControl ();
- if (control != null && !control.isDisposed ()) {
- control.setVisible (false);
- }
- }
- Control control = items [int1].getControl ();
- if (control != null && !control.isDisposed ()) {
- control.setBounds(getClientArea());
- control.setVisible (true);
- }
- Event event = new Event();
- event.item = items[int1];
- postEvent(SWT.Selection, event);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int index) {
- checkWidget();
- if (index == -1) return;
- OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
- OS.gtk_notebook_set_page (notebookHandle, index);
- OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (TabItem [] items) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (items.length == 0) {
- setSelection (-1);
- return;
- }
- for (int i=items.length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) setSelection (index);
- }
-}
-
-/*
- * == DESTRUCTION ===
- */
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (notebookHandle);
-}
-
-void releaseChildren() {
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- for (int i=0; i<itemCount; i++) {
- TabItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
-
- // Now, the non-item children
- list = OS.gtk_container_children(parentingHandle());
- int childCount = OS.g_list_length (list);
- for (int i=0; i<childCount; i++) {
- int childHandle = OS.g_list_nth_data(list, i);
- if (!isMyHandle(childHandle)) {
- Widget w = WidgetTable.get(childHandle);
- if (!(w==null) && !(w.isDisposed())) {
- w.releaseWidget();
- w.releaseHandle();
- }
- }
- }
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- notebookHandle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget();
- items = null;
-}
-
-/*
- * == AS YET UNCLASSIFIED ===
- */
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
deleted file mode 100644
index 8454cc3d3b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * corresponding to a tab for a page in a tab folder.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TabItem extends Item {
- Control control;
- TabFolder parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-/**
- * Returns the control that is used to fill the client area of
- * the tab folder when the user selects the tab item. If no
- * control has been set, return <code>null</code>.
- * <p>
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return control;
-}
-public Display getDisplay () {
- TabFolder parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>TabFolder</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabFolder getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-/**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Control oldControl = this.control, newControl = control;
- this.control = control;
- int index = parent.indexOf (this);
- if (index != parent.getSelectionIndex ()) return;
- if (newControl != null) {
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
- }
- if (oldControl != null) oldControl.setVisible (false);
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- super.setImage (image);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- byte [] buffer = string2bytesConvertMnemonic(string);
- OS.gtk_label_parse_uline(handle, buffer);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
deleted file mode 100644
index d45196a62b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ /dev/null
@@ -1,1411 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement a selectable user interface
- * object that displays a list of images and strings and issue
- * notificiation when selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TableItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Table extends Composite {
- int itemCount, columnCount;
- TableItem [] items;
- TableColumn [] columns;
- TableItem itemBeingSelected;
- TableItem[] selection = new TableItem[0];
- int check, uncheck;
- int check_width, check_height;
- public static int MAX_COLUMNS = 32;
-
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Table (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-
-
-
-/*
- * === HANDLE CODE 1 ===
- */
-
-void createHandle (int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new();
- if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_clist_new (MAX_COLUMNS);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void setHandleStyle () {
- /* Single or Multiple Selection */
- int selectionMode;
- if ((style & SWT.MULTI) != 0) selectionMode = OS.GTK_SELECTION_EXTENDED;
- else selectionMode = OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, selectionMode);
-
- /* We fake the number of columns, because we have to know beforehand.
- * Initially all those fake columns are invisible
- */
- byte [] buffer = new byte [1];
- OS.gtk_clist_set_column_title (handle, 0, buffer);
- for (int i=1; i<MAX_COLUMNS; i++) {
- OS.gtk_clist_set_column_visibility (handle, i, false);
- }
-
- /* Scrolling policy */
- int hscrollbar_policy = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
- int vscrollbar_policy = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
- OS.gtk_scrolled_window_set_policy (scrolledHandle, hscrollbar_policy, vscrollbar_policy);
-}
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-static int checkStyle (int style) {
- /*
- * To be compatible with Windows, force the H_SCROLL
- * and V_SCROLL style bits. On Windows, it is not
- * possible to create a table without scroll bars.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (fixedHandle);
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
-int createCheckPixmap(boolean checked) {
- /*
- * The box will occupy the whole item width.
- */
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- check_height = clist.row_height-1;
- check_width = check_height;
-
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- int pixmap = OS.gdk_pixmap_new(0, check_width, check_height, visual.depth);
-
- int gc = OS.gdk_gc_new(pixmap);
-
- GdkColor fgcolor = new GdkColor();
- fgcolor.pixel = 0xFFFFFFFF;
- fgcolor.red = (short) 0xFFFF;
- fgcolor.green = (short) 0xFFFF;
- fgcolor.blue = (short) 0xFFFF;
- OS.gdk_gc_set_foreground(gc, fgcolor);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0,0, check_width,check_height);
-
- fgcolor = new GdkColor();
- fgcolor.pixel = 0;
- fgcolor.red = (short) 0;
- fgcolor.green = (short) 0;
- fgcolor.blue = (short) 0;
- OS.gdk_gc_set_foreground(gc, fgcolor);
-
- OS.gdk_draw_line(pixmap, gc, 0,0, 0,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, check_width-1,check_height-1, check_width-1,0);
- OS.gdk_draw_line(pixmap, gc, check_width-1,0, 0,0);
-
- /* now the cross check */
- if (checked) {
- OS.gdk_draw_line(pixmap, gc, 0,0, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,0);
- }
-
- OS.gdk_gc_destroy(gc);
- return pixmap;
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents ();
- signal_connect (handle, "select_row", SWT.Selection, 5);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new TableItem [4];
- columns = new TableColumn [4];
- itemCount = columnCount = 0;
-}
-
-/*
- * HANDLE CODE 2
- */
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- return false;
-
-}
-
-
-
-/*
- * === GEOMETRY ===
- */
-
-boolean _setSize(int width, int height) {
- boolean different = UtilFuncs.setSize(eventBoxHandle, width, height);
- if (different) UtilFuncs.setSize(fixedHandle, width, height);
- if (different) UtilFuncs.setSize(scrolledHandle, width, height);
- return different;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * The item field of the event object is valid for default selection, but the detail field is not used.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-
-/* The real work to create a new column */
-void createItem (TableColumn column, int index) {
- if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (columnCount == columns.length) {
- TableColumn [] newColumns = new TableColumn [columns.length + 4];
- System.arraycopy (columns, 0, newColumns, 0, columns.length);
- columns = newColumns;
- }
- OS.gtk_clist_set_column_visibility (handle, index, true);
- OS.gtk_clist_column_titles_passive(handle); // paranoia
- System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);
- columns [index] = column;
-}
-void createItem (TableItem item, int index) {
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (itemCount == items.length) {
- TableItem [] newItems = new TableItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-// int ptr = OS.g_malloc (1);
- int [] strings = new int [MAX_COLUMNS];
-// for (int i=0; i<strings.length; i++) strings [i] = ptr;
- for (int i=0; i<strings.length; i++) strings [i] = 0;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_insert (handle, index, strings);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-// OS.g_free (ptr);
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_unselect_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_unselect_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = new TableItem[0];
-}
-
-void destroyItem (TableColumn column) {
- int index = 0;
- while (index < columnCount) {
- if (columns [index] == column) break;
- index++;
- }
- if (index == columnCount) return;
- OS.gtk_clist_set_column_visibility (handle, index, false);
- OS.gtk_clist_set_column_title (handle, index, new byte [1]);
- System.arraycopy (columns, index + 1, columns, index, --columnCount - index);
- columns [columnCount] = null;
-}
-void destroyItem (TableItem item) {
- int index = 0;
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) return;
- OS.gtk_clist_remove (handle, index);
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
-}
-/**
- * Returns the column at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this method will throw <code>ERROR_INVALID_RANGE</code> despite
- * the fact that a single column of data may be visible in the table.
- * This occurs when the programmer uses the table like a list, adding
- * items but never creating a column.
- *
- * @param index the index of the column to return
- * @return the column at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn getColumn (int index) {
- checkWidget();
- if (!(0 <= index && index < columnCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return columns [index];
-}
-/**
- * Returns the number of columns contained in the receiver.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this value is zero, despite the fact that visually, one column
- * of items is may be visible. This occurs when the programmer uses
- * the table like a list, adding items but never creating a column.
- *
- * @return the number of columns
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getColumnCount () {
- checkWidget();
- return columnCount;
-}
-/**
- * Returns an array of <code>TableColumn</code>s which are the
- * columns in the receiver. If no <code>TableColumn</code>s were
- * created by the programmer, the array is empty, despite the fact
- * that visually, one column of items may be visible. This occurs
- * when the programmer uses the table like a list, adding items but
- * never creating a column.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn [] getColumns () {
- checkWidget();
- TableColumn [] result = new TableColumn [columnCount];
- System.arraycopy (columns, 0, result, 0, columnCount);
- return result;
-}
-/**
- * Returns the width in pixels of a grid line.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getGridLineWidth () {
- checkWidget();
- /* FIXME */
- return 0;
-}
-
-
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (int index) {
- checkWidget();
- if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return items [index];
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (Point pt) {
- checkWidget();
-
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int clientX = pt.x;
- int clientY = pt.y - clist.column_title_area_height;
- if (clientY <= 0) return null;
-
- int[] row = new int[1], column = new int[1];
- row[0] = -1;
- OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
- if (row[0] == -1) return null;
- return items[row[0]];
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return itemCount;
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height;
-}
-/**
- * Returns an array of <code>TableItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getItems () {
- checkWidget();
- TableItem [] result = new TableItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-
-
-
-/*
- * === SELECTION STORY ===
- */
-
-/**
- * Returns an array of <code>TableItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem[] getSelection () {
- checkWidget();
- return selection;
-}
-
-/**
- * Get the selection from the OS.
- */
-private TableItem[] _getNativeSelection () {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- switch (clist.selection_mode) {
- case OS.GTK_SELECTION_SINGLE: return getSelection_single();
- case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
- case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
- case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
- default: error(SWT.ERROR_UNSPECIFIED);
- }
- /* can never get here */
- return null;
-}
-private TableItem[] getSelection_single () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- if (length == 0) return new TableItem[0];
- int index = OS.g_list_nth_data (clist.selection, 0);
- return new TableItem [] {items[index]};
-}
-private TableItem[] getSelection_browse () {
- /* same as single */
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- if (length == 0) return new TableItem[0];
- int index = OS.g_list_nth_data (clist.selection, 0);
- return new TableItem [] {items[index]};
-}
-private TableItem[] getSelection_multiple () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- TableItem [] result = new TableItem [length];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (clist.selection, i);
- result [i] = items [index];
- }
- return result;
-}
-private TableItem[] getSelection_extended () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- TableItem [] result = new TableItem [length];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (clist.selection, i);
- result [i] = items [index];
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- return selection.length;
-}
-private int _getNativeSelectionCount () {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int selectionList = clist.selection;
- if (selectionList==0) return 0;
- return OS.g_list_length (clist.selection);
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return -1;
- return OS.g_list_nth_data (list, 0);
-}
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- int [] indices = new int [length];
- for (int i=0; i<length; i++) {
- indices [i] = OS.g_list_nth_data (list, i);
- }
- return indices;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (index == OS.g_list_nth_data (list, i)) return true;
- }
- return false;
-}
-
-
-
-
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return -clist.voffset / (clist.row_height + 1);
-}
-
-/**
- * Searches the receiver's list starting at the first column
- * (index 0) until a column is found that is equal to the
- * argument, and returns the index of that column. If no column
- * is found, returns -1.
- *
- * @param column the search column
- * @return the index of the column
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableColumn column) {
- checkWidget();
- if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<columnCount; i++) {
- if (columns [i] == column) return i;
- }
- return -1;
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<itemCount; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-void releaseWidget () {
- int columnCount = 0;
- for (int i=0; i<columnCount; i++) {
- TableColumn column = columns [i];
-// if (!column.isDisposed ()) column.releaseWidget ();
- if (column != null && !column.isDisposed ()) column.releaseWidget ();
- }
- columns = null;
- int itemCount = 0;
- for (int i=0; i<itemCount; i++) {
- TableItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
- }
- items = null;
- itemBeingSelected = null;
- if (check != 0) OS.gdk_pixmap_unref (check);
- if (uncheck != 0) OS.gdk_pixmap_unref (uncheck);
- check = uncheck = 0;
- super.releaseWidget ();
-}
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_clist_remove (handle, index);
- TableItem item = items [index];
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- item.releaseWidget ();
-}
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- int index = end;
- while (index >= start) {
- OS.gtk_clist_remove (handle, index);
- items [index].releaseWidget ();
- --index;
- }
- int first = index + 1, last = end + 1;
- System.arraycopy (items, last, items, first, itemCount - last);
- for (int i=itemCount-(last-first); i<itemCount; i++) items [i] = null;
- itemCount = itemCount - (last - first);
- if (first > start) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-/**
- * Removes the items from the receiver's list at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- int last = -1;
- for (int i=0; i<newIndices.length; i++) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- OS.gtk_clist_remove (handle, index);
- // BUG - disposed callback could remove an item
- items [index].releaseWidget ();
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- last = index;
- }
- }
-}
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.gtk_clist_clear (handle);
- items = new TableItem [4];
- itemCount = 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_select_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_select_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-
-/**
- * Returns <code>true</code> if the receiver's header is visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's header's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getHeaderVisible () {
- checkWidget();
- return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_CLIST_SHOW_TITLES) != 0;
-}
-
-/**
- * Marks the receiver's header as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHeaderVisible (boolean show) {
- /* FIXME
- * We should investigate why this optimization is not working.
- */
-// boolean isVisibleNow = getHeaderVisible();
-// if (show==isVisibleNow) return;
- if (show) {
- OS.gtk_clist_column_titles_show (handle);
- OS.gtk_clist_column_titles_passive(handle);
- } else {
- OS.gtk_clist_column_titles_hide (handle);
- }
-}
-/**
- * Returns <code>true</code> if the receiver's lines are visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the visibility state of the lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getLinesVisible() {
- checkWidget();
- return false;
-}
-/**
- * Marks the receiver's lines as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLinesVisible (boolean show) {
- checkWidget();
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * The current selected is first cleared, then the new item is selected.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (int index) {
- deselectAll ();
- select (index);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- deselectAll ();
- select (start, end);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int[])
- */
-public void setSelection (int [] indices) {
- deselectAll ();
- select (indices);
- selection = _getNativeSelection();
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (TableItem [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- deselectAll ();
- int length = items.length;
- if (length == 0) return;
- if ((style & SWT.SINGLE) != 0) length = 1;
- for (int i=length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) select (index);
- }
- selection = items; /* FIXME */
-}
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showSelection()
- */
-public void showItem (TableItem item) {
-// error(SWT.ERROR_NOT_IMPLEMENTED);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showItem(TableItem)
- */
-public void showSelection () {
- checkWidget();
- setTopIndex (getSelectionIndex ());
-}
-
-int processSelection (int int0, int int1, int int2) {
- selection = _getNativeSelection();
- itemBeingSelected = items [int0];
- Event event = new Event ();
- event.item = itemBeingSelected;
- sendEvent (SWT.Selection, event);
- return 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_widget_grab_focus(handle);
-
- // First, see if we have a single or double click
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- boolean isDoubleClick = (gdkEvent.type == OS.GDK_2BUTTON_PRESS);
-
- // We can't just use the x and y coordinates from the Gdk event,
- // because the actual items are drawn on a special X window
- Point where = _gdkWindowGetPointer();
- int eventType;
- if (isDoubleClick) {
- eventType = SWT.MouseDoubleClick;
- Event event = new Event ();
- event.item=itemBeingSelected;
- event.x = where.x; event.y = where.y;
- sendEvent (SWT.DefaultSelection, event);
- return 1;
- }
-
- eventType = SWT.MouseDown;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, where.x, where.y);
- if (gdkEvent.button == 3 && menu != null) menu.setVisible (true);
-
-
- if ((style&SWT.CHECK) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int clientX = where.x;
- int clientY = where.y - clist.column_title_area_height;
- if (clientY <= 0) return 1;
- int[] row = new int[1], column = new int[1];
- row[0] = -1;
- OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
- if (row[0] == -1) return -1;
- int leftmost = 2;
- if (clientX < leftmost) return 1;
- if (clientX > leftmost+check_width) return 1;
-
- TableItem item = items [row[0]];
- item._setChecked(!item._getChecked());
- Event event = new Event ();
- event.detail = SWT.CHECK;
- event.item = item;
- postEvent (SWT.Selection, event);
- }
- return 1;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
deleted file mode 100644
index eab13dbec9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
+++ /dev/null
@@ -1,403 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a column in a table widget.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd> Move, Resize, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TableColumn extends Item {
- Table parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (parent.getColumnCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the column header is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-void createWidget (int index) {
- parent.createItem (this, index);
- text = "";
-}
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Gets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @return the resizable attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getResizable () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return false;
- GtkCList gtkclist = new GtkCList();
- OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
- int chandle=gtkclist.column;
- GtkCListColumn gtkcolumn = new GtkCListColumn();
- OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
- return (gtkcolumn.resizeable == 1) ? true : false;
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return 0;
- GtkCList gtkclist = new GtkCList();
- OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
- int chandle=gtkclist.column;
- GtkCListColumn gtkcolumn = new GtkCListColumn();
- OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
- return gtkcolumn.width;
-}
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- */
-public void pack () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- text = null;
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- int index = parent.indexOf (this);
- if (index == -1 || index == 0) return;
- int table = parent.handle;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int justification = 0;
- if ((style & SWT.LEFT) == SWT.LEFT) justification |= OS.GTK_JUSTIFY_LEFT;
- if ((style & SWT.CENTER) == SWT.CENTER) justification |= OS.GTK_JUSTIFY_CENTER;
- if ((style & SWT.RIGHT) == SWT.RIGHT) justification |= OS.GTK_JUSTIFY_RIGHT;
- OS.gtk_clist_set_column_justification (table, index, justification);
-}
-/**
- * Sets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @param resizable the resize attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setResizable (boolean resizable) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- OS.gtk_clist_set_column_resizeable (table, index, resizable);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_clist_set_column_title (table, index, buffer);
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- OS.gtk_clist_set_column_width (table, index, width);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
deleted file mode 100644
index 680b4e1961..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
+++ /dev/null
@@ -1,503 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents an item in a table.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TableItem extends Item {
- Table parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
- _setChecked(false);
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
- _setChecked(false);
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent at a column in the table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding column rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int CELL_SPACING=1;
- GtkCList table = new GtkCList();
- OS.memmove(table, parent.handle, GtkCList.sizeof);
- int columnHandle = table.column;
- columnHandle= columnHandle+index*GtkCListColumn.sizeof;
- GtkCListColumn column=new GtkCListColumn();
- OS.memmove(column, columnHandle, GtkCListColumn.sizeof);
- GtkAdjustment adjustment=new GtkAdjustment();
- OS.memmove(adjustment, table.vadjustment, GtkAdjustment.sizeof);
- float vaj = adjustment.value;
- OS.memmove(adjustment, table.hadjustment, GtkAdjustment.sizeof);
- float haj = adjustment.value;
- int x=(short)column.area_x+table.hoffset;
- int width=(short)column.area_width;
- int height=parent.getItemHeight();
- int row=parent.indexOf(this);
- int y=table.column_title_area_height+height*row+(row+2)*CELL_SPACING-(int)vaj;
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Return whether or not the receiver has a check box and can
- * be checked.
- */
-boolean isCheckable() {
- return (parent.style & SWT.CHECK) != 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- return _getChecked();
-}
-
-boolean _getChecked () {
- int row = parent.indexOf (this);
- if (row == -1) return false;
- int clist = parent.handle;
-
- int[] text = new int[1];
- int[] spacing = new int[1];
- int[] pixmap = new int[1];
- int[] mask = new int[1];
- OS.gtk_clist_get_pixtext(clist, row, 0, text, spacing, pixmap, mask);
-
- return pixmap[0]==parent.check;
-}
-
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((parent.style & SWT.CHECK) == 0) return false;
- return false;
-}
-
-/**
-* Gets the image at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the image
-* @return the image
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public Image getImage (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-/**
- * Returns a rectangle describing the size and location
- * relative to its parent of an image at a column in the
- * table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding image rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getImageBounds (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Rectangle (0, 0, 0, 0);
-}
-/**
- * Gets the image indent.
- *
- * @return the indent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getImageIndent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return 0;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
-* Gets the item text at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the item
-* @return the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_TEXT)
-* when the operation fails
-*/
-public String getText (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-/**
- * Sets the checked state of the receiver.
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget();
- _setChecked (checked);
-}
-void _setChecked (boolean checked) {
- if ((parent.style & SWT.CHECK) == 0) return; /* needed here because we don't verify in the constructor */
-
- int row = parent.indexOf (this);
- if (row == -1) return;
- int ctable = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- if (checked) OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, parent.check, 0);
- else OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, parent.uncheck, 0);
-}
-
-/**
- * Sets the grayed state of the receiver.
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
-}
-/**
- * Sets the receiver's image at a column.
- *
- * @param index the column index
- * @param image the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (int index, Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-// if (index == 0) {
-// setImage (image);
-// return;
-// }
- int row = parent.indexOf (this);
- if (row == -1) return;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- int ctable = parent.handle;
- if (text != null) {
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_clist_set_pixtext (ctable, row, index, buffer, (byte) 2, pixmap, mask);
- } else {
- OS.gtk_clist_set_pixmap (ctable, row, index, pixmap, mask);
- }
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int row = parent.indexOf (this);
- if (row == -1) return;
- super.setImage (image);
- int ctable = parent.handle;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- if (text != null) {
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, pixmap, mask);
- } else {
- OS.gtk_clist_set_pixmap (ctable, row, 0, pixmap, mask);
- }
-}
-/**
- * Sets the image for multiple columns in the Table.
- *
- * @param images the array of new images
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image [] images) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<images.length; i++) {
- setImage (i, images [i]);
- }
-}
-/**
- * Sets the image indent.
- *
- * @param indent the new indent
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImageIndent (int indent) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Sets the receiver's text at a column
- *
- * @param index the column index
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (int index, String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == 0) {
- setText (string);
- return;
- }
- int row = parent.indexOf (this);
- if (row == -1) return;
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- if (image != null) {
- OS.gtk_clist_set_pixtext(ctree, row, index, buffer, (byte) 2, image.pixmap, image.mask);
- } else {
- OS.gtk_clist_set_text (ctree, row, index, buffer);
- }
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int row = parent.indexOf (this);
- if (row == -1) return;
- super.setText (string);
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- if (image != null) {
- OS.gtk_clist_set_pixtext(ctree, row, 0, buffer, (byte) 2, image.pixmap, image.mask);
- } else {
- OS.gtk_clist_set_text (ctree, row, 0, buffer);
- }
-}
-/**
- * Sets the text for multiple columns in the table.
- *
- * @param strings the array of new strings
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String [] strings) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (strings == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<strings.length; i++) {
- String string = strings [i];
- if (string != null) setText (i, string);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
deleted file mode 100644
index b6f5f5c74e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ /dev/null
@@ -1,1226 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that allow the user to enter and modify text.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Verify</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-
-public class Text extends Scrollable {
- int textLimit = 0xFFFF;
- boolean visibility = true;
- public final static int LIMIT;
- public final static String DELIMITER;
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0x7FFFFFFF;
- DELIMITER = "\n";
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Text (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- if ((style & SWT.SINGLE) != 0) {
- handle = OS.gtk_entry_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- } else {
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_text_new (0, 0);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- }
-}
-
-void setHandleStyle() {
- OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
- if ((style & SWT.SINGLE) == 0)
- OS.gtk_text_set_word_wrap (handle, (style & SWT.WRAP) != 0 ? 1 : 0);
- if (scrolledHandle!=0) setScrollingPolicy();
- // When 2.0 arrives, we'll be able to set the flat appearance
-
-}
-
-void configure() {
- _connectParent();
- if (scrolledHandle != 0) {
- OS.gtk_container_add (scrolledHandle, handle);
- }
-}
-
-void showHandle() {
- if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents();
- signal_connect_after (handle, "changed", SWT.Modify, 2);
- signal_connect (handle, "insert_text", SWT.Verify, 5);
- signal_connect (handle, "delete_text", SWT.Verify, 4);
- signal_connect (handle, "activate", SWT.Selection, 2);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is not called for texts.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is verified, by sending
- * it one of the messages defined in the <code>VerifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #removeVerifyListener
- */
-public void addVerifyListener (VerifyListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Verify, typedListener);
-}
-
-/**
- * Appends a string.
- * <p>
- * The new text is appended to the text at
- * the end of the widget.
- * </p>
- *
- * @param string the string to be appended
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void append (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string);
- if ((style & SWT.SINGLE) != 0) {
- OS.gtk_entry_append_text(handle, buffer);
- } else {
- int length = getCharCount();
- int [] position = new int [] {length};
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
- OS.gtk_editable_set_position (handle, position [0]);
- }
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- return style | SWT.MULTI;
- }
- return style | SWT.SINGLE;
-}
-/**
- * Clears the selection.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void clearSelection () {
- checkWidget ();
- int position = OS.gtk_editable_get_position (handle);
- OS.gtk_editable_delete_selection(handle);
- OS.gtk_editable_set_position (handle, position);
-}
-
-/**
- * Copies the selected text.
- * <p>
- * The current selection is copied to the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void copy () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
- GtkEditable widget = new GtkEditable ();
- OS.memmove(widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
- OS.memmove (handle, widget, GtkEditable.sizeof);
-}
-/**
- * Cuts the selected text.
- * <p>
- * The current selection is first copied to the
- * clipboard and then deleted from the widget.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void cut () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
- OS.memmove (handle, widget, GtkEditable.sizeof);
- OS.gtk_editable_delete_text(handle, start, end);
-}
-
-/**
- * Gets the line number of the caret.
- * <p>
- * The line number of the caret is returned.
- * </p>
- *
- * @return the line number
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretLineNumber () {
- checkWidget ();
- int addr_index=getCaretPosition();
- String tmpString= new String(getText(0,addr_index));
- return getLineNumberInString(tmpString,'\n');
-}
-
-/**
- * Gets the location the caret.
- * <p>
- * The location of the caret is returned.
- * </p>
- *
- * @return a point, the location of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCaretLocation () {
- checkWidget ();
- GtkText gtktext = new GtkText ();
- OS.memmove (gtktext, handle, GtkText.sizeof);
- return new Point (gtktext.cursor_pos_x, gtktext.cursor_pos_y);
-}
-
-/**
- * Gets the position of the caret.
- * <p>
- * The character position of the caret is returned.
- * </p>
- *
- * @return the position of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretPosition () {
- checkWidget ();
- //return OS.gtk_text_get_point (handle);
- return OS.gtk_editable_get_position (handle);
-}
-
-
-/**
- * Gets the number of characters.
- *
- * @return number of characters in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCharCount () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int address = OS.gtk_editable_get_chars (handle, 0, -1);
- int length = OS.strlen (address);
- OS.g_free (address);
- return length;
- }
- return OS.gtk_text_get_length (handle);
-}
-
-/**
- * Gets the line delimiter.
- *
- * @return a string that is the line delimiter
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getLineDelimiter () {
- checkWidget ();
- return "\n";
-}
-/**
- * Gets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getDoubleClickEnabled () {
- checkWidget ();
- return true;
-}
-/**
- * Gets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public char getEchoChar () {
- checkWidget ();
- return visibility ? '\0' : '*';
-}
-
-/**
- * Gets the editable state.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEditable () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- return widget.editable!=0;
-}
-
-/**
- * Gets the number of lines.
- *
- * @return the number of lines in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineCount () {
- checkWidget ();
- return getLineNumberInString(new String(getText()),'\n') + 1;
-}
-/**
- * Gets the height of a line.
- *
- * @return the height of a row of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineHeight () {
- checkWidget ();
- Font font = getFont();
- GdkFont gdkfont = new GdkFont();
- int fontHandle = font.handle;
- OS.memmove(gdkfont, fontHandle, GdkFont.sizeof);
- return gdkfont.ascent + gdkfont.descent;
-
-}
-/**
- * Gets the position of the selected text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p>
- *
- * @return the start and end of the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- return new Point (widget.selection_start_pos, widget.selection_end_pos);
-}
-/**
- * Gets the number of selected characters.
- *
- * @return the number of selected characters.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- return end - start;
-}
-/**
- * Gets the selected text.
- *
- * @return the selected text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getSelectionText () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos,widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos,widget.selection_end_pos);
- int address = OS.gtk_editable_get_chars (handle, start, end);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Gets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @return the number of tab characters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTabs () {
- checkWidget ();
- GtkText widget= new GtkText();
- OS.memmove(widget, handle, GtkText.sizeof);
- return widget.default_tab_width;
-}
-
-/**
- * Gets the widget text.
- * <p>
- * The text for a text widget is the characters in the widget.
- * </p>
- *
- * @return the widget text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int address = OS.gtk_editable_get_chars (handle, 0, -1);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Gets a range of text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N-1 where N is
- * the number of characters in the widget.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- * @return the range of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText (int start, int end) {
- checkWidget ();
- int address = OS.gtk_editable_get_chars (handle, start, end);
- if (address == 0) return null;
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Returns the maximum number of characters that the receiver is capable of holding.
- * <p>
- * If this has not been changed by <code>setTextLimit()</code>,
- * it will be the constant <code>Text.LIMIT</code>.
- * </p>
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return textLimit;
- return LIMIT;
-}
-
-/**
- * Returns the zero-relative index of the line which is currently
- * at the top of the receiver.
- * <p>
- * This index can change when lines are scrolled or new lines are added or removed.
- * </p>
- *
- * @return the index of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return 0;
- GtkText widget = new GtkText ();
- OS.memmove (widget, handle, GtkText.sizeof);
- int topCharIndex=widget.first_line_start_index;
- return (getLineNumberInString(getText(0,topCharIndex), '\n'));
- //Since getText uses substring (start, end + 1),so topCharIndex-1
-}
-
-/**
- * Gets the top pixel.
- * <p>
- * The top pixel is the pixel position of the line
- * that is currently at the top of the widget. On
- * some platforms, a text widget can be scrolled by
- * pixels instead of lines so that a partial line
- * is displayed at the top of the widget.
- * </p><p>
- * The top pixel changes when the widget is scrolled.
- * The top pixel does not include the widget trimming.
- * </p>
- *
- * @return the pixel position of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopPixel () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return 0;
- GtkText widget= new GtkText();
- OS.memmove(widget, handle, GtkText.sizeof);
- return widget.first_onscreen_ver_pixel;
-}
-
-boolean getWrap () {
- checkWidget ();
- return false;
-}
-
-/**
- * Inserts a string.
- * <p>
- * The old selection is replaced with the new text.
- * </p>
- *
- * @param string the string
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void insert (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- OS.gtk_editable_delete_text (handle, start, end);
- int [] position = new int [] {start};
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
-}
-
-/**
- * Pastes text from clipboard.
- * <p>
- * The selected text is deleted from the widget
- * and new text inserted from the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void paste () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- byte [] compound = Converter.wcsToMbcs (null, "COMPOUND_TEXT", true);
- int clipboard_atom = OS.gdk_atom_intern (clipboard, 0);
- int compound_atom = OS.gdk_atom_intern (compound, 0);
- OS.gtk_selection_convert(handle, clipboard_atom, compound_atom, 0);
-}
-
-int processModify (int arg0, int arg1, int int2) {
- sendEvent (SWT.Modify);
- return 0;
-}
-
-int processVerify (int int0, int int1, int int2) {
- if (!hooks (SWT.Verify)) return 0;
- if (int2 != 0) {
- // Insert
- if (int0 == 0 || int1==0){
- return 0;
- }
-// int length = OS.strlen (int0);
- byte [] buffer1 = new byte [int1];
- OS.memmove (buffer1, int0, buffer1.length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String oldText = new String (buffer2, 0, buffer2.length);
- int [] position = new int [1];
- OS.memmove (position, int2, 4);
- if (position [0] == -1) position [0] = OS.gtk_text_get_length (handle);
- String newText = verifyText (oldText, position [0], position [0]); //WRONG POSITION
- if (newText == null) {
- byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, insert_text);
- return 0;
- }
- if (newText != oldText) {
- int windowProc5 = getDisplay ().windowProc5;
- byte [] buffer3 = Converter.wcsToMbcs (null, newText);
- OS.gtk_signal_handler_block_by_func (handle, windowProc5, SWT.Verify);
- OS.gtk_editable_insert_text (handle, buffer3, buffer3.length, position);
- OS.gtk_signal_handler_unblock_by_func (handle, windowProc5, SWT.Verify);
- byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, insert_text);
- return 0;
- }
- } else {
- // Delete
- int address = OS.gtk_editable_get_chars (handle, int0, int1);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String oldText = new String (buffer2, 0, buffer2.length);
- String newText = verifyText (oldText, int0, int1);
- if (newText == null) {
- byte [] delete_text = Converter.wcsToMbcs (null, "delete-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, delete_text);
- return 0;
- }
- }
- return 0;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.DefaultSelection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is verified.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #addVerifyListener
- */
-public void removeVerifyListener (VerifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Verify, listener);
-}
-
-/**
- * Selects all the text in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- OS.gtk_editable_select_region (handle, 0, -1);
-}
-
-/**
- * Sets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @param doubleClick the new double click flag
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDoubleClickEnabled (boolean doubleClick) {
- checkWidget ();
-}
-
-/**
- * Sets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @param echo the new echo character
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEchoChar (char echo) {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- OS.gtk_entry_set_visibility (handle, visibility = echo == '\0');
- }
-}
-
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- OS.gtk_editable_set_editable (handle, editable);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * regular array indexing rules.
- * </p>
- *
- * @param start new caret position
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start) {
- checkWidget ();
- OS.gtk_editable_set_position (handle, start);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start, int end) {
- checkWidget ();
- OS.gtk_editable_set_position (handle, start);
- OS.gtk_editable_select_region (handle, start, end);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param selection the point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget ();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_editable_set_position (handle, selection.x);
- OS.gtk_editable_select_region (handle, selection.x, selection.y);
-}
-
- /**
- * Sets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @param tabs the number of tabs
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
-*/
-public void setTabs (int tabs) {
- checkWidget ();
- GtkText widget= new GtkText();
- widget.default_tab_width=tabs;
- OS.memmove(handle, widget, GtkText.sizeof);
-}
-
-/**
- * Sets the contents of the receiver to the given string.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_editable_delete_text (handle, 0, -1);
- int [] position = new int [1];
- byte [] buffer = Converter.wcsToMbcs (null, string);
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
- OS.gtk_editable_set_position (handle, 0);
-}
-
-/**
- * Sets the maximum number of characters that the receiver
- * is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget ();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- if ((style & SWT.SINGLE) != 0) {
- textLimit = (short) limit;
- OS.gtk_entry_set_max_length (handle, (short) limit);
- }
-}
-
-/**
- * Sets the zero-relative index of the line which is currently
- * at the top of the receiver. This index can change when lines
- * are scrolled or new lines are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- if (index > getLineCount()) return;
- GtkAdjustment adjustment = new GtkAdjustment();
- int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
- OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
- int adjust = (int)(index*adjustment.upper/getLineCount());
- if (adjust <= 0) {
- adjust = 0;
- verticalBar.setSelection(0);
- } else {
- verticalBar.setSelection(adjust);
- }
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- int topindex=getTopIndex();
- int lineheight = getLineHeight();
- while( topindex != index) {
- adjust=adjust+lineheight;
- verticalBar.setSelection(adjust+lineheight);
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- topindex=getTopIndex();
- }
-}
-
-void setWrap (boolean wrap) {
- checkWidget ();
- OS.gtk_text_set_word_wrap(handle, wrap ? 1 : 0);
-}
-
-/**
- * Shows the selection.
- * <p>
- * If the selection is already showing
- * in the receiver, this method simply returns. Otherwise,
- * lines are scrolled until the selection is visible.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- int start_pos, end_pos, pos;
- pos = OS.gtk_editable_get_position (handle);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- start_pos = Math.min(widget.selection_start_pos, widget.selection_end_pos) ;
- end_pos = Math.max(widget.selection_start_pos, widget.selection_end_pos) ;
- GtkText gtktext = new GtkText ();
- OS.memmove (gtktext, handle, GtkText.sizeof);
- int topCharIndex=gtktext.first_line_start_index;
- if ( (topCharIndex > start_pos && topCharIndex < end_pos) || topCharIndex==start_pos ||
- topCharIndex == end_pos) return;
- if (pos < start_pos || pos > end_pos) {
- GtkAdjustment adjustment = new GtkAdjustment();
- int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
- OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
- String tmpString= new String(getText(0,start_pos));
- int currentln=getLineNumberInString(tmpString, '\n');
- int adjust = (int)(currentln*adjustment.upper/getLineCount()-adjustment.page_increment);
- if (adjust <= 0)
- OS.gtk_adjustment_set_value (verticalBar.handle, 0);
- else
- OS.gtk_adjustment_set_value (verticalBar.handle, adjust);
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- OS.gtk_editable_set_position (handle, widget.selection_end_pos);
- OS.gtk_editable_select_region (handle, widget.selection_start_pos, widget.selection_end_pos);
- }
-
-}
-
-String verifyText (String string, int start, int end) {
- Event event = new Event ();
- event.text = string;
- event.start = start;
- event.end = end;
- sendEvent (SWT.Verify, event);
- if (!event.doit) return null;
- return event.text;
-}
-
-int getLineNumberInString( String string,char delimiter) {
- int count=0;
- for (int i=0; i<string.length (); i++) {
- if (string.charAt (i) == delimiter) count++;
- }
- return count;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
deleted file mode 100644
index e1e5bedcf0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ /dev/null
@@ -1,351 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class ToolBar extends Composite {
- int boxHandle, tempHandle;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- /* FIXME
- * We do not need an event box here, as event boxes
- * have real X windows.
- */
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- int orientation = ((style&SWT.VERTICAL)!=0)?
- OS.GTK_ORIENTATION_VERTICAL : OS.GTK_ORIENTATION_HORIZONTAL;
- handle = OS.gtk_toolbar_new (orientation, OS.GTK_TOOLBAR_BOTH);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-
- tempHandle = OS.gtk_fixed_new();
- if (tempHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- int relief = ((style&SWT.FLAT)!=0)? OS.GTK_RELIEF_NONE : OS.GTK_RELIEF_NORMAL;
- OS.gtk_toolbar_set_button_relief(handle, relief);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (boxHandle, handle);
- // invisible handle to temporarily hold control (non-item) items
- OS.gtk_toolbar_insert_widget (handle,tempHandle,new byte[1], new byte[1],0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (layout != null) super.computeSize(wHint, hHint, changed);
- return _computeSize (wHint, hHint, changed);
-}
-
-int eventHandle () {
- return boxHandle;
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
- // don't show the temp fixed
-}
-
-void register() {
- super.register ();
- WidgetTable.put (boxHandle, this);
-}
-
-void deregister() {
- super.deregister ();
- WidgetTable.remove (boxHandle);
-}
-
-int topHandle() { return boxHandle; }
-int parentingHandle() { return tempHandle; }
-
-/**
- * Returns whether the argument points to an OS widget that is
- * implementing the receiver, i.e., one of my own handles
- */
-boolean isMyHandle(int h) {
- if (h==handle) return true;
- if (h==tempHandle) return true;
- if (h==boxHandle) return true;
- return false;
-}
-void _connectChild (int h) {
- // When we put a widget as a tool item, we don't know which item it is, yet.
- OS.gtk_fixed_put(tempHandle, h, (short)0, (short)0);
-}
-
-
-/*
- * === GEOMETRY ===
- */
-
-boolean _setSize (int width, int height) { UtilFuncs.setSize(boxHandle, width, height); return true; }
-
-
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getItems()[index];
-}
-
-
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (Point point) {
- return null;
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- /* FIXME
- * This code will return the wrong count for items,
- * as list includes Window children
- */
-// int list = OS.gtk_container_children (handle);
-// return OS.g_list_length (list);
- // TEMPORARY CODE
- return getItems ().length;
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int count = 0;
- int list = OS.gtk_container_children (handle);
- int length = OS.g_list_length (list);
- ToolItem [] result = new ToolItem [length];
- for (int i=0; i<length; i++) {
- int data = OS.g_list_nth_data (list, i);
- Widget widget = WidgetTable.get (data);
- if (widget instanceof ToolItem) {
- result [count++] = (ToolItem) widget;
- }
- }
- if (length == count) return result;
- ToolItem [] newResult = new ToolItem [count];
- System.arraycopy (result, 0, newResult, 0, count);
- return newResult;
-}
-/**
- * Returns the number of rows in the receiver. When
- * the receiver has the <code>WRAP</code> style, the
- * number of rows can be greater than one. Otherwise,
- * the number of rows is always one.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-
-public int getRowCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return 1;
-}
-
-Control _childFromHandle(int h) {
- Widget child = WidgetTable.get(h);
- if (child==null) return null;
- if (child instanceof ToolItem) return null; // ToolItems are not our children
- return (Control)child;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (ToolItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- // TEMPORARY CODE
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- if (item == items[i]) return i;
- }
- return -1;
-}
-int processResize (int int0, int int1, int int2) {
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- Control control = items [i].control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (items [i].getBounds ());
- }
- }
- return 0;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = tempHandle = 0;
-}
-
-void releaseWidget () {
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- ToolItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- super.releaseWidget ();
-}
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style; // & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
deleted file mode 100644
index e20c76f1c0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ /dev/null
@@ -1,744 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a button in a tool bar.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-
-public class ToolItem extends Item {
- int boxHandle;
- ToolBar parent;
- Control control;
- Image hotImage, disabledImage;
- int currentpixmap;
- boolean drawHotImage;
- int position;
- boolean configured=false;
- boolean shown=false;
- private int tooltipsHandle;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- position = parent.getItemCount ();
- createWidget (position);
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- int count = parent.getItemCount ();
- if (!(0 <= index && index <= count)) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- position = index;
- createWidget (index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
- * the event object detail field contains the value <code>SWT.ARROW</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int bits = SWT.SEPARATOR | SWT.RADIO | SWT.CHECK | SWT.PUSH;
- switch (style & bits) {
- case SWT.RADIO:
- case SWT.CHECK:
- _createToggleHandle(index); return;
- case SWT.SEPARATOR:
- _createSeparatorHandle(index); return;
- case SWT.PUSH:
- default:
- _createPushHandle(index); return;
- }
-}
-
-private void _createSeparatorHandle(int index) {
- boxHandle = OS.gtk_event_box_new();
- if (boxHandle==0) error(SWT.ERROR_NO_HANDLES);
- boolean isVertical = (parent.getStyle()&SWT.VERTICAL) != 0;
- handle = isVertical? OS.gtk_hseparator_new() : OS.gtk_vseparator_new();
- if (handle==0) error(SWT.ERROR_NO_HANDLES);
-}
-private void _createPushHandle(int index) {
- handle = OS.gtk_toolbar_insert_element (parent.handle,
- OS.GTK_TOOLBAR_CHILD_BUTTON,
- 0, new byte[1], null, null,
- 0, 0, 0,
- index);
- configured=true;
- shown=true;
-}
-private void _createToggleHandle(int index) {
- handle = OS.gtk_toolbar_insert_element (parent.handle,
- OS.GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
- 0, new byte[1], null, null,
- 0, 0, 0,
- index);
- configured=true;
- shown=true;
-}
-
-
-void configure() {
- // configure is done for non-separators
- if (configured) return;
- OS.gtk_toolbar_insert_widget (
- parent.handle,
- topHandle(),
- new byte[1], new byte[1],
- position);
- OS.gtk_container_add(boxHandle, handle);
-}
-
-void showHandle() {
- if (shown) return;
- if ((parent.getStyle()&SWT.VERTICAL)!=0) OS.gtk_widget_set_usize(handle, 15, 3);
- else OS.gtk_widget_set_usize(handle, 3, 15);
- OS.gtk_widget_show(boxHandle);
- OS.gtk_widget_show(handle);
-}
-
-void register() {
- super.register ();
- if (boxHandle != 0) WidgetTable.put (boxHandle, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = 0;
-}
-
-void deregister() {
- super.deregister ();
- if (boxHandle != 0) WidgetTable.remove (boxHandle);
-}
-
-int topHandle() {
- return (boxHandle==0)? handle : boxHandle;
-}
-
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Rectangle (widget.alloc_x, widget.alloc_y, widget.alloc_width, widget.alloc_height);
-}
-/**
- * Returns the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return control;
-}
-
-/**
- * Returns the receiver's disabled image if it has one, or null
- * if it does not.
- * <p>
- * The disabled image is displayed when the receiver is disabled.
- * </p>
- *
- * @return the receiver's disabled image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getDisabledImage () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- error(SWT.ERROR_NOT_IMPLEMENTED);
- return null;
-}
-
-public Display getDisplay () {
- ToolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the receiver's hot image if it has one, or null
- * if it does not.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @return the receiver's hot image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getHotImage () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-/**
- * Returns the receiver's parent, which must be a <code>ToolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolBar getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- return OS.gtk_toggle_button_get_active (handle);
-}
-/**
- * Returns the receiver's tool tip text, or null if it has not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return widget.alloc_width;
-}
-void hookEvents () {
- if ((style & SWT.SEPARATOR) != 0) return;
- signal_connect(handle, "clicked", SWT.Selection, 2);
- signal_connect(handle, "enter-notify-event", SWT.MouseEnter, 3);
- signal_connect(handle, "leave-notify-event", SWT.MouseExit, 3);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getEnabled () && parent.isEnabled ();
-}
-
-int processMouseEnter (int int0, int int1, int int2) {
- drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
- if ( drawHotImage && (currentpixmap != 0) ) {
- OS.gtk_pixmap_set (currentpixmap, hotImage.pixmap, hotImage.mask);
- }
- return 0;
-}
-
-int processMouseExit (int int0, int int1, int int2) {
- if (drawHotImage) {
- drawHotImage = false;
- if (currentpixmap != 0 && image != null){
- OS.gtk_pixmap_set (currentpixmap, image.pixmap, image.mask);
- }
- }
- return 0;
-}
-/*
-int processPaint (int int0, int int1, int int2) {
- if (ignorePaint) return 0;
- Image currentImage = drawHotImage ? hotImage : image;
- if (!getEnabled()) {
- Display display = getDisplay ();
- currentImage = disabledImage;
- if (currentImage == null) {
- currentImage = new Image (display, image, SWT.IMAGE_DISABLE);
- }
- }
- if (currentpixmap != 0 && currentImage != null)
- OS.gtk_pixmap_set (currentpixmap, currentImage.pixmap, currentImage.mask);
- return 0;
-}
-*/
-int processSelection (int int0, int int1, int int2) {
- if ((style & SWT.RADIO) != 0) {
- this.setSelection (true);
- ToolItem [] items = parent.getItems ();
- int index = 0;
- while (index < items.length && items [index] != this) index++;
- ToolItem item;
- int i = index;
- while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- i = index;
- while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- }
- Event event = new Event ();
- postEvent (SWT.Selection, event);
- return 0;
-}
-void releaseWidget () {
- super.releaseWidget ();
- tooltipsHandle = 0;
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Sets the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget ();
- if (control != null) {
- if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- if ((style & SWT.SEPARATOR) == 0) return;
- Control newControl = control;
- Control oldControl = this.control;
- if (oldControl == newControl) return;
- if (oldControl != null) {
- int topHandle = control.topHandle ();
- int tempHandle = parent.tempHandle;
- OS.gtk_widget_reparent (topHandle, tempHandle);
- }
- this.control = newControl;
- if (newControl != null) {
- if (handle != boxHandle) {
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- handle = boxHandle;
- }
- int topHandle = control.topHandle ();
- OS.gtk_widget_reparent (topHandle, boxHandle);
- //OS.gtk_widget_show (topHandle);
- } else {
- boolean isVertical = (parent.getStyle () & SWT.VERTICAL) != 0;
- handle = isVertical ? OS.gtk_hseparator_new () : OS.gtk_vseparator_new ();
- if (handle == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gtk_container_add (boxHandle, handle);
- }
-}
-/**
- * Sets the receiver's disabled image to the argument, which may be
- * null indicating that no disabled image should be displayed.
- * <p>
- * The disbled image is displayed when the receiver is disabled.
- * </p>
- *
- * @param image the disabled image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDisabledImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) != 0) return;
- disabledImage = image;
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise.
- * <p>
- * A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * </p>
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-/**
- * Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @param image the hot image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHotImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) != 0) return;
- hotImage = image;
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- super.setImage (image);
- if ((style & SWT.SEPARATOR) != 0) return;
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- if (image != null) {
- int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
- OS.gtk_container_add (handle, pixmap);
- OS.gtk_widget_show (pixmap);
- currentpixmap = pixmap;
- }
-}
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_toggle_button_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- int label = OS.gtk_label_new (buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
- OS.gtk_container_add (handle, label);
- OS.gtk_widget_show (label);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new();
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_tooltips_set_tip(tooltipsHandle, handle, buffer, null);
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) == 0) return;
-
- Point size = control.computeSize(width, SWT.DEFAULT);
- control.setSize(size);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
deleted file mode 100644
index dfc7b30b0e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ /dev/null
@@ -1,388 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement rubber banding rectangles.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Move</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tracker extends Widget {
- Composite parent;
- Display display;
- boolean tracking, stippled;
- Rectangle [] rectangles = new Rectangle [0];
-
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tracker (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- display = parent.getDisplay ();
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the tracker on the currently active
- * display if there is one. If there is no current display, the
- * tracker is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the tracker on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Tracker (Display display, int style) {
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = style;
- this.display = display;
-}
-
-
-
-/*
- * === ADD / REMOVE LISTENERS ===
- */
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
-}
-
-
-
-
-/*
- * === PUBLIC ACCESSORS ===
- */
-
-public Display getDisplay () {
- return display;
-}
-
-/**
- * Returns the bounds of the Rectangles being drawn.
- *
- * @return the bounds of the Rectangles being drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle [] getRectangles () {
- checkWidget();
- return rectangles;
-}
-
-/**
- * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
- *
- * @return the stippled effect of the rectangles
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getStippled () {
- checkWidget();
- return stippled;
-}
-
-/**
- * Specify the rectangles that should be drawn.
- *
- * @param rectangles the bounds of the rectangles to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setRectangles (Rectangle [] rectangles) {
- checkWidget();
- this.rectangles = rectangles;
-}
-
-/**
- * Change the appearance of the line used to draw the rectangles.
- *
- * @param stippled <code>true</code> if rectangle should appear stippled
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setStippled (boolean stippled) {
- checkWidget();
- this.stippled = stippled;
-}
-
-
-
-/*
- * === PUBLIC FUNCTIONALITY ===
- */
-
-/**
- * Stop displaying the tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget();
- tracking = false;
-}
-
-/**
- * Start displaying the Tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean open () {
- checkWidget();
- int xWindow = calculateWindow();
- boolean cancelled=false;
- tracking = true;
- drawRectangles ();
-
- int[] newX = new int[1];
- int[] newY = new int[1];
- int[] oldX = new int[1];
- int[] oldY = new int[1];
- OS.gdk_window_get_pointer(xWindow, oldX,oldY, 0);
-
- while (tracking) {
- if (parent != null && parent.isDisposed ()) break;
- int eventType = waitEvent();
- switch (eventType) {
- case OS.GDK_BUTTON_RELEASE:
- case OS.GDK_MOTION_NOTIFY:
- OS.gdk_window_get_pointer(xWindow, newX,newY, 0);
- if (oldX [0] != newX [0] || oldY [0] != newY [0]) {
- drawRectangles ();
- for (int i=0; i<rectangles.length; i++) {
- rectangles [i].x += newX [0] - oldX [0];
- rectangles [i].y += newY [0] - oldY [0];
- }
- Event event = new Event();
- event.x = newX[0];
- event.y = newY[0];
- sendEvent (SWT.Move,event);
- drawRectangles ();
- oldX [0] = newX [0]; oldY [0] = newY [0];
- }
- tracking = (eventType != OS.GDK_BUTTON_RELEASE);
- break;
- case OS.GDK_KEY_PRESS:
-// error(SWT.ERROR_NOT_IMPLEMENTED);
- /*
- XKeyEvent keyEvent = new XKeyEvent ();
- OS.memmove (keyEvent, xEvent, XKeyEvent.sizeof);
- if (keyEvent.keycode != 0) {
- int [] keysym = new int [1];
- OS.XLookupString (keyEvent, null, 0, keysym, null);
- keysym [0] &= 0xFFFF;
- tracking = keysym [0] != OS.XK_Escape && keysym [0] != OS.XK_Cancel;
- cancelled = !tracking;
- }*/
- break;
- } // switch
- } // while
- drawRectangles(); // clean up our mess
- tracking = false;
- return !cancelled;
-}
-
-
-
-private void drawRectangles () {
- int xWindow = calculateWindow();
- if (parent != null) {
- if (parent.isDisposed ()) return;
- parent.getShell ().update ();
- } else {
- display.update ();
- }
-
- int gc = OS.gdk_gc_new(xWindow);
- if (gc==0) error(SWT.ERROR_UNSPECIFIED);
-
- /* White foreground */
- int colormap = OS.gdk_colormap_get_system();
- GdkColor color = new GdkColor();
- OS.gdk_color_white(colormap, color);
- OS.gdk_gc_set_foreground(gc, color);
-
- /* Draw on top of inferior widgets */
- OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
-
- /* XOR */
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- for (int i=0; i<rectangles.length; i++) {
- Rectangle rect = rectangles [i];
- OS.gdk_draw_rectangle(xWindow, gc, 0, rect.x, rect.y, rect.width, rect.height);
- }
- OS.gdk_gc_destroy(gc);
-}
-/*
- * Wait for an event to show up.
- * Return the event's type as a GdkEventType.
- */
-private int waitEvent() {
- int[] eventType = new int[1];
- int eventPtr;
-
- while (true) {
- eventPtr = OS.gdk_event_get();
- if (eventPtr != 0) {
- // hack, must implement memmove properly
- // GdkEvent event = new GdkEvent(eventPtr);
- OS.memmove(eventType, eventPtr, 4);
- OS.gdk_event_free(eventPtr);
- return eventType[0];
- }
- else {
- try { Thread.sleep(50); } catch (Exception ex) {}
- }
- }
-}
-
-/*
- * Figure which GdkWindow we'll draw on.
- * That's normally the root X window, or the parent's GdkWindow if we have a parent.
- */
-private int calculateWindow() {
- int answer;
- if (parent == null) {
- answer = OS.GDK_ROOT_PARENT();
- } else {
- answer = parent._gdkWindow();
- }
- if (answer==0) error(SWT.ERROR_UNSPECIFIED);
- return answer;
-}
-
-public void setCursor (Cursor value) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
deleted file mode 100644
index 95833415cb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ /dev/null
@@ -1,968 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class provide a selectable user interface object
- * that displays a hierarchy of items and issue notificiation when an
- * item in the hierarchy is selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TreeItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tree extends Composite {
- TreeItem [] items;
- boolean selected, doubleSelected;
- int check, uncheck;
- static int CELL_SPACING = 1;
-
- /*
- * NOT DONE - These need to be moved to display,
- * they are not thread safe. Consider moving the
- * methods that access them to Display.
- */
- static TreeItem [] Items;
- static int Index, Count, Sibling;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tree (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- /*
- * To be compatible with Windows, force the H_SCROLL
- * and V_SCROLL style bits. On Windows, it is not
- * possible to create a tree without scroll bars.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-boolean _setSize(int width, int height) {
- if (!UtilFuncs.setSize (eventBoxHandle, width, height)) return false;
- UtilFuncs.setSize (scrolledHandle, width, height);
- return true;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection, typedListener);
- addListener (SWT.DefaultSelection, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when an item in the receiver is expanded or collapsed
- * by sending it one of the messages defined in the <code>TreeListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #removeTreeListener
- */
-public void addTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Expand, typedListener);
- addListener (SWT.Collapse, typedListener);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new(0,0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_ctree_new (1, 0);
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-}
-
-int createCheckPixmap(boolean checked) {
- /*
- * The box will occupy the whole item width.
- */
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int check_height = clist.row_height-1;
- int check_width = check_height;
-
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- int pixmap = OS.gdk_pixmap_new(0, check_width, check_height, visual.depth);
-
- int gc = OS.gdk_gc_new(pixmap);
-
- GdkColor fgcolor = new GdkColor();
- fgcolor.pixel = 0xFFFFFFFF;
- fgcolor.red = (short) 0xFFFF;
- fgcolor.green = (short) 0xFFFF;
- fgcolor.blue = (short) 0xFFFF;
- OS.gdk_gc_set_foreground(gc, fgcolor);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0,0, check_width,check_height);
-
- fgcolor = new GdkColor();
- fgcolor.pixel = 0;
- fgcolor.red = (short) 0;
- fgcolor.green = (short) 0;
- fgcolor.blue = (short) 0;
- OS.gdk_gc_set_foreground(gc, fgcolor);
-
- OS.gdk_draw_line(pixmap, gc, 0,0, 0,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, check_width-1,check_height-1, check_width-1,0);
- OS.gdk_draw_line(pixmap, gc, check_width-1,0, 0,0);
-
- /* now the cross check */
- if (checked) {
- OS.gdk_draw_line(pixmap, gc, 0,0, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,0);
- }
-
- OS.gdk_gc_destroy(gc);
- return pixmap;
-}
-
-void createItem (TreeItem item, int node, int index) {
- int id = 0;
- while (id < items.length && items [id] != null) id++;
- if (id == items.length) {
- TreeItem [] newItems = new TreeItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-
- /* Feature in GTK.
- * When the selection policy is BROWSE (which is what we use for SINGLE),
- * the first item added gets automatically selected. This leads to some
- * nontrivial complications which one better avoid. The hack is to
- * temporarily put a value other than GTK_SELECTION_BROWSE into the
- * selectionMode field just for the insertion. Do not use the policy
- * changing API because this will cause a selection callback.
- */
-// GtkCTree ctree = new GtkCTree ();
-// OS.memmove (ctree, handle, GtkCTree.sizeof);
-// int selection_mode = ctree.selection_mode;
-// ctree.selection_mode = OS.GTK_SELECTION_MULTIPLE;
-// OS.memmove (handle, ctree, GtkCTree.sizeof);
- int [] sm = new int [1];
- OS.memmove (sm, handle+148, 1);
- int selectionMode = sm[0];
- sm [0] = OS.GTK_SELECTION_MULTIPLE;
- OS.memmove (handle+148, sm, 1);
-// FIXME
- int sibling = index == -1 ? 0 : findSibling (node, index);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- item.handle = OS.gtk_ctree_insert_node (handle, node, sibling, null, (byte) 2, uncheck, 0, uncheck, 0, false, false);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- if (item.handle == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.gtk_ctree_node_set_row_data (handle, item.handle, id + 1);
-
-// OS.memmove (ctree, handle, GtkCTree.sizeof);
-// ctree.selection_mode = selection_mode;
-// OS.memmove (handle, ctree, GtkCTree.sizeof);
- sm [0] = selectionMode;
- OS.memmove (handle+148, sm, 1);
- items [id] = item;
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new TreeItem [4];
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll() {
- checkWidget();
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_unselect_recursive (handle, root);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-void destroyItem (TreeItem item) {
- int node = item.handle;
- Callback GtkCTreeFunc = new Callback (this, "GtkCTreeDispose", 3);
- int address = GtkCTreeFunc.getAddress ();
- OS.gtk_ctree_post_recursive (handle, node, address, 0);
- GtkCTreeFunc.dispose ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Collapse);
- OS.gtk_ctree_remove_node (handle, node);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Collapse);
-}
-
-int findSibling (int node, int index) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Index = 0;
- Sibling = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeFindSibling", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, index);
- GtkCTreeCountItems.dispose ();
- if (Sibling == node) Sibling = 0;
- return Sibling;
-}
-
-public boolean forceFocus () {
- checkWidget ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- boolean result = super.forceFocus ();
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- return result;
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getItem (Point point) {
- checkWidget ();
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, point.x, point.y, row, column);
- if (code == 0) return null;
- int node = OS.gtk_ctree_node_nth (handle, row [0]);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- return items [index];
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. The
- * number that is returned is the number of roots in the
- * tree.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return getItemCount (0);
-}
-
-int getItemCount (int node) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Count = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeCountItems", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, node);
- GtkCTreeCountItems.dispose ();
- return Count;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height + CELL_SPACING;
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. These
- * are the roots of the tree.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget();
- return getItems (0);
-}
-
-TreeItem [] getItems (int node) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Count = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeCountItems", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, node);
- GtkCTreeCountItems.dispose ();
- Items = new TreeItem [Count];
- Count = 0;
- Callback GtkCTreeGetItems = new Callback (this, "GtkCTreeGetItems", 3);
- int address1 = GtkCTreeGetItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address1, node);
- GtkCTreeGetItems.dispose ();
- TreeItem [] result = Items;
- Items = null;
- return result;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget ();
- return null;
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem[] getSelection () {
- checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return new TreeItem [0];
- int length = OS.g_list_length (clist.selection);
- TreeItem [] result = new TreeItem [length];
- for (int i=0; i<length; i++) {
- int node = OS.g_list_nth_data (clist.selection, i);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- result [i] = items [index];
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return 0;
- return OS.g_list_length (clist.selection);
-}
-
-int GtkCTreeCountItems (int ctree, int node, int data) {
- if (data != node) Count++;
- return 0;
-}
-
-int GtkCTreeFindSibling (int ctree, int node, int data) {
- if (Index == -1) return 0;
- Index = data == Index ? -1 : Index + 1;
- Sibling = node;
- return 0;
-}
-
-int GtkCTreeGetItems (int ctree, int node, int data) {
- if (data != node) {
- int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
- Items [Count++] = items [index];
- }
- return 0;
-}
-
-int GtkCTreeDispose (int ctree, int node, int data) {
- int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
- OS.gtk_ctree_node_set_row_data (ctree, node, 0);
- TreeItem item = items [index];
- item.releaseWidget ();
- item.releaseHandle ();
- items [index] = null;
- return 0;
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents ();
- signal_connect (handle, "tree_select_row", SWT.Selection, 4);
- signal_connect (handle, "tree_unselect_row", SWT.Selection, 4);
- signal_connect (handle, "tree_expand", SWT.Expand, 3);
- signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-
-boolean isMyHandle(int h) {
- if (h==fixedHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
-int processCollapse (int int0, int int1, int int2) {
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- /*
- * This code is intentionally commented.
- * Not yet sure if freezing improves the
- * look when a tree is collapsed.
- */
-// OS.gtk_clist_freeze (handle);
- sendEvent (SWT.Collapse, event);
-// OS.gtk_clist_thaw (handle);
- return 0;
-}
-
-int processExpand (int int0, int int1, int int2) {
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- OS.gtk_clist_freeze (handle);
- sendEvent (SWT.Expand, event);
- OS.gtk_clist_thaw (handle);
- boolean [] expanded = new boolean [1];
- OS.gtk_ctree_get_node_info (handle, int0, null, null, null, null, null, null, null, expanded);
- if (!expanded [0]) {
- OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
- OS.gtk_ctree_expand (handle, int0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Expand);
- }
- return 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- doubleSelected = false;
- int result = super.processMouseDown (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) selected = true;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- if ((style & SWT.CHECK) != 0) {
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- int node = OS.gtk_ctree_node_nth (handle, row [0]);
- int crow = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row_data = new GtkCTreeRow ();
- OS.memmove (row_data, crow, GtkCTreeRow.sizeof);
- GtkCTree ctree = new GtkCTree();
- OS.memmove (ctree, handle, GtkCTree.sizeof);
- int nX = ctree.hoffset + ctree.tree_indent * row_data.level - 2;
- int nY = ctree.voffset + (ctree.row_height + 1) * row [0] + 2;
- int [] unused = new int [1], check_width = new int [1], check_height = new int [1];
- OS.gdk_window_get_geometry (check, unused, unused, check_width, check_height, unused);
- if (nX <= x && x <= nX + check_width [0]) {
- if (nY <= y && y <= nY + check_height [0]) {
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap = new int [1], mask = new int [1];
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- byte [] text = Converter.wcsToMbcs (null, items [index].getText (), true);
- OS.gtk_ctree_get_node_info (handle, node, null, spacing, pixmap, mask, pixmap, mask, is_leaf, expanded);
- pixmap [0] = pixmap [0] == check ? uncheck : check;
- OS.gtk_ctree_set_node_info (handle, node, text, spacing [0], pixmap [0], mask [0], pixmap [0], mask [0], is_leaf [0], expanded [0]);
- Event event = new Event ();
- event.detail = SWT.CHECK;
- event.item = items [index];
- postEvent (SWT.Selection, event);
- }
- }
- }
- }
- }
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) doubleSelected = true;
- }
- }
- return result;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- int result = super.processMouseUp (callData, arg1, int2);
- /*
- * Feature in GTK. When an item is reselected in a
- * mulit-select tree, GTK does not issue notification.
- * The fix is to detect that the mouse was released over
- * a selected item when no selection signal was set and
- * issue a fake selection event.
- *
- * Feature in GTK. Double selection can only be implemented
- * in a mouse up handler for a tree unlike the list,the event
- * that caused the select signal is not included when the select
- * signal is issued.
- */
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- if ((style & SWT.SINGLE) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (list != 0 && OS.g_list_length (list) != 0) {
- int node = OS.g_list_nth_data (list, 0);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- Event event = new Event ();
- event.item = items [index];
- if (doubleSelected) {
- postEvent (SWT.DefaultSelection, event);
- } else {
- postEvent (SWT.Selection, event);
- }
- }
- selected = false;
- }
- if ((style & SWT.MULTI) != 0) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- int focus = OS.gtk_ctree_node_nth (handle, row [0]);
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (selected && clist.selection != 0) {
- int length = OS.g_list_length (clist.selection);
- for (int i=0; i<length; i++) {
- int node = OS.g_list_nth_data (clist.selection, i);
- if (node == focus) {
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- Event event = new Event ();
- event.item = items [index];
- if (doubleSelected) {
- postEvent (SWT.DefaultSelection, event);
- } else {
- postEvent (SWT.Selection, event);
- }
- }
- }
- }
- }
- selected = false;
- }
- }
- doubleSelected = false;
- return result;
-}
-
-int processSelection (int int0, int int1, int int2) {
- if ((style & SWT.SINGLE) != 0) {
- selected = true;
- return 0;
- }
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int focus = OS.gtk_ctree_node_nth (handle, clist.focus_row);
- if (focus != int0) return 0;
- if ((style & SWT.MULTI) != 0) selected = false;
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- postEvent (SWT.Selection, event);
- return 0;
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- if (check != 0) OS.gdk_pixmap_unref (check);
- if (uncheck != 0) OS.gdk_pixmap_unref (uncheck);
- check = uncheck = 0;
- super.releaseWidget ();
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- OS.gtk_ctree_remove_node (handle, 0);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = new TreeItem [4];
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when items in the receiver are expanded or collapsed..
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #addTreeListener
- */
-public void removeTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Expand, listener);
- eventTable.unhook (SWT.Collapse, listener);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_select_recursive (handle, root);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-void setHandleStyle () {
- int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_EXTENDED : OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, mode);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#deselectAll()
- */
-public void setSelection (TreeItem [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_unselect_recursive (handle, root);
- int index = 0, length = items.length;
- while (index < length) {
- TreeItem item = items [index];
- if (item != null) {
- if (item.isDisposed ()) break;
- OS.gtk_ctree_select (handle, item.handle);
- }
- index++;
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- if (index != length) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (fixedHandle);
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showItem(TreeItem)
- */
-public void showSelection () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return;
- if (OS.g_list_length (clist.selection) == 0) return;
- int node = OS.g_list_nth_data (clist.selection, 0);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- showItem (items [index]);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled
- * and expanded until the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showSelection()
- */
-public void showItem (TreeItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- int node = item.handle;
- int visibility = OS.gtk_ctree_node_is_visible (handle, node);
- if (visibility != OS.GTK_VISIBILITY_NONE) return;
- if (!OS.gtk_ctree_is_viewable (handle, node)) {
- int parent = node;
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
- do {
- int data = OS.g_list_nth_data (parent, 0);
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- if ((parent = row.parent) == 0) break;
- OS.gtk_ctree_expand (handle, parent);
- } while (true);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Expand);
- }
- OS.gtk_ctree_node_moveto (handle, node, 0, 0.0f, 0.0f);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
deleted file mode 100644
index cafd7782d3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ /dev/null
@@ -1,496 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a hierarchy of tree items in a tree widget.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TreeItem extends Item {
- Tree parent;
- int index;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, 0, -1);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style, int index) {
- super (parent, style);
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- this.parent = parent;
- parent.createItem (this, 0, index);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style) {
- super (checkNull (parentItem).getParent(), style);
- this.parent = parentItem.getParent ();
- parent.createItem (this, parentItem.handle, -1);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style, int index) {
- super (checkNull (parentItem).getParent (), style);
- if (index < 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- this.parent = parentItem.getParent ();
- parent.createItem (this, parentItem.handle, index);
-}
-
-static TreeItem checkNull (TreeItem item) {
- if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- int ctree = parent.handle;
- GtkCTree tree = new GtkCTree();
- OS.memmove(tree, ctree, GtkCTree.sizeof);
-
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, tree.vadjustment, GtkAdjustment.sizeof);
- float vaj = adjustment.value;
- OS.memmove (adjustment, tree.hadjustment, GtkAdjustment.sizeof);
- float haj = adjustment.value;
- int columnHandle = tree.column;
-
- int height=parent.getItemHeight();
-
- int row_list = tree.row_list; int level=0;
- int count = OS.g_list_length (row_list);
- int index=0;
- while (index<count) {
- int data = OS.g_list_nth (row_list, index);
- if (handle == data){
- int rowHandle = OS.g_list_nth_data (row_list, index);
- GtkCTreeRow row = new GtkCTreeRow();
- OS.memmove(row, rowHandle, GtkCTreeRow.sizeof);
- level = row.level;
- break;
- }
- index++;
- }
- int y = height*index + Tree.CELL_SPACING + tree.voffset + 2;
-
- int [] buffer = new int [1]; byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, buffer, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
- int length = OS.strlen (buffer[0]);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, buffer[0], length);
- int styleHandle = OS.gtk_ctree_node_get_row_style(ctree, handle);
- if (styleHandle == 0)
- styleHandle = OS.gtk_widget_get_style(ctree);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, styleHandle, GtkStyle.sizeof);
- int width = OS.gdk_string_width(style.font, buffer1);
-
-// x = (short)column.area_x+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
- int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
-
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int ctree = parent.handle;
- int [] pixmap = new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, null, pixmap, null, null, null, null, null);
- return pixmap [0] == parent.check;
-}
-
-public Display getDisplay () {
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is expanded,
- * and false otherwise.
- * <p>
- *
- * @return the expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getExpanded () {
- checkWidget();
- int ctree = parent.handle;
- boolean [] buffer = new boolean [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, null, null, null, null, null, null, buffer);
- return buffer [0];
-}
-
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed() {
- checkWidget();
- return false;
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- return parent.getItemCount (handle);
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s which are the
- * direct item children of the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget();
- return parent.getItems (handle);
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Tree</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Tree getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget();
- int data = OS.g_list_nth_data (handle, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- if (row.parent == 0) return null;
- int ctree = parent.handle;
- int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;
- return parent.items [index];
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Sets the checked state of the receiver.
- * <p>
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return;
- int ctree = parent.handle;
- byte [] spacing = new byte [1];
- int [] pixmap = new int [1], mask = new int [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap, mask, pixmap, mask, is_leaf, expanded);
- if (checked && pixmap [0] == parent.check) return;
- if (!checked && pixmap [0] == parent.uncheck) return;
- pixmap [0] = checked ? parent.check : parent.uncheck;
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap [0], mask [0], pixmap [0], mask [0], is_leaf [0], expanded [0]);
-}
-
-/**
- * Sets the grayed state of the receiver.
- * <p>
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
-}
-
-/**
- * Sets the expanded state of the receiver.
- * <p>
- *
- * @param expanded the new expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setExpanded (boolean expanded) {
- checkWidget();
- int ctree = parent.handle;
- if (expanded) {
- OS.gtk_signal_handler_block_by_data (ctree, SWT.Expand);
- OS.gtk_ctree_expand (ctree, handle);
- OS.gtk_signal_handler_unblock_by_data (ctree, SWT.Expand);
- } else {
- OS.gtk_signal_handler_block_by_data (ctree, SWT.Collapse);
- OS.gtk_ctree_collapse (ctree, handle);
- OS.gtk_signal_handler_unblock_by_data (ctree, SWT.Collapse);
- }
-}
-
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((parent.style & SWT.CHECK) != 0) return;
- this.image = image;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- int ctree = parent.handle;
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, null, null, null, null, is_leaf, expanded);
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap, mask, pixmap, mask, is_leaf [0], expanded [0]);
-}
-
-/**
- * This label will be displayed to the right of the bitmap,
- * or, if the receiver doesn't have a bitmap to the right of
- * the horizontal hierarchy connector line.
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap_closed [0], mask_closed [0], pixmap_opened [0], mask_opened [0], is_leaf [0], expanded [0]);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java
deleted file mode 100644
index 8f37202228..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-class Trim {
- int top=0, bottom=0, left=0, right=0;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java
deleted file mode 100644
index a956c281ed..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * This class contains static helpers wrapping some common
- * widget-inspecific operations like get the size of a gtk widget.
- */
-class UtilFuncs {
-
-/*
- * === GEOMETRY ===
- */
-
-static Point getLocation (int handle) {
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_x, widget.alloc_y);
-}
-
-static boolean setLocation(int parentHandle, int handle, int x, int y) {
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- boolean sameOrigin = (widget.alloc_x == x && widget.alloc_y == y);
-
- // GtkFixed does not leave us alone.
- // Instead, it maintains its own list of geometries for the children.
- // Moreover, it will post a RESIZE on the queue that will cause
- // disturbance to all our brother; to avoid that, we temporarily
- // clear the VISIBLE flag, and do the synchronous update ourselves
- GtkObject gtkChild = new GtkObject();
- OS.memmove (gtkChild, handle, GtkObject.sizeof);
- OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_VISIBLE);
- OS.gtk_fixed_move(parentHandle, handle, (short)x, (short)y );
- OS.memmove(handle, gtkChild, GtkObject.sizeof);
-
-
-// OS.gtk_widget_set_uposition(handle, (short)x, (short)y);
- /*
- byte[] aux_info_id = org.eclipse.swt.internal.Converter.wcsToMbcs (null, "gtk-aux-info", true);
- int aux_info_key_id = OS.g_quark_from_static_string(aux_info_id);
- if (aux_info_key_id == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
- int aux_info = OS.gtk_object_get_data_by_id(handle, aux_info_key_id);
- int[] xy = new int[1];
- // ???
- OS.memmove(aux_info, xy, 4);
- */
-
- // force allocation update NOW
- GtkAllocation alloc = new GtkAllocation();
- alloc.x = (short) x;
- alloc.y = (short) y;
- alloc.width = (short) widget.alloc_width;
- alloc.height = (short) widget.alloc_height;
- OS.memmove(handle, widget, GtkWidget.sizeof);
- OS.gtk_widget_size_allocate(handle, alloc);
-
- return (!sameOrigin);
-}
-
-static Point getSize (int handle) {
- if (handle==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_width, widget.alloc_height);
-}
-
-
-static boolean setSize(int handle, int width, int height) {
- if (handle==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
-
- /* Feature in Gtk.
- * Gtk will refuse to set the size of any widget to anything smaller than 3x3.
- */
- if (height <= 3) height = 3;
- if (width <= 3) width = 3;
-
- // first, see if we actually need to change anything
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- int alloc_width = widget.alloc_width & 0xFFFF;
- int alloc_height = widget.alloc_height & 0xFFFF;
- if (alloc_width == width && alloc_height == height) {
- return false;
- }
-
- OS.gtk_widget_set_usize (handle, width, height);
- // force child allocation update
- GtkAllocation alloc = new GtkAllocation();
- alloc.x = (short) widget.alloc_x;
- alloc.y = (short) widget.alloc_y;
- alloc.width = (short) width;
- alloc.height = (short) height;
- OS.gtk_widget_size_allocate(handle, alloc);
- return true;
-}
-
-static void setZeroSize(int handle) {
- // CHEATING. For some reason,
- // the it will refuse to change its size to anything smaller
- setSize(handle, 3,3);
-}
-
-static int getFont(int widget) {
- int hStyle = OS.gtk_widget_get_style(widget);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
- return style.font;
-}
-
-static void setFont(int handle, int font) {
- OS.gtk_widget_ensure_style(handle);
- // We can't just get the widget's style and set
- // its font, because the style slot may point to the
- // default font; therefore we have to obtain a clone
- // of the style
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- int hStyle = OS.gtk_style_copy(widget.style);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
-
- OS.gdk_font_unref(style.font);
- style.font = font;
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
deleted file mode 100644
index 7ee66f7080..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ /dev/null
@@ -1,921 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.events.*;
-
-/**
- * This class is the abstract superclass of all user interface objects.
- * Widgets are created, disposed and issue notification to listeners
- * when events occur which affect them.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Dispose</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation. However, it has not been marked
- * final to allow those outside of the SWT development team to implement
- * patched versions of the class in order to get around specific
- * limitations in advance of when those limitations can be addressed
- * by the team. Any class built using subclassing to access the internals
- * of this class will likely fail to compile or run between releases and
- * may be strongly platform specific. Subclassing should not be attempted
- * without an intimate and detailed understanding of the workings of the
- * hierarchy. No support is provided for user-written classes which are
- * implemented as subclasses of this class.
- * </p>
- *
- * @see #checkSubclass
- */
-
-public abstract class Widget {
-
- public int handle;
- int style, state;
- EventTable eventTable;
- Object data;
- String [] keys;
- Object [] values;
-
- /* Global state flags */
-// static final int AUTOMATIC = 1<<0;
-// static final int ACTIVE = 1<<1;
-// static final int AUTOGRAB = 1<<2;
-// static final int MULTIEXPOSE = 1<<3;
-// static final int RESIZEREDRAW = 1<<4;
-// static final int WRAP = 1<<5;
-// static final int DISABLED = 1<<6;
-// static final int HIDDEN = 1<<7;
-// static final int FOREGROUND = 1<<8;
-// static final int BACKGROUND = 1<<9;
- static final int DISPOSED = 1<<10;
- static final int HANDLE = 1<<11;
- static final int CANVAS = 1<<12;
-
- /* Default widths for widgets */
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
- static final char Mnemonic = '&';
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Widget () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see #checkSubclass
- * @see #getStyle
- */
-public Widget (Widget parent, int style) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- this.style = style;
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when an event of the given type occurs. When the
- * event does occur in the widget, the listener is notified by
- * sending it the <code>handleEvent()</code> message.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #removeListener
- */
-public void addListener (int eventType, Listener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new EventTable ();
- eventTable.hook (eventType, handler);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when the widget is disposed. When the widget is
- * disposed, the listener is notified by sending it the
- * <code>widgetDisposed()</code> message.
- *
- * @param listener the listener which should be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void addDisposeListener (DisposeListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Dispose, typedListener);
-}
-static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
- int mask = int0 | int1 | int2 | int3 | int4 | int5;
- if ((style & mask) == 0) style |= int0;
- if ((style & int0) != 0) style = (style & ~mask) | int0;
- if ((style & int1) != 0) style = (style & ~mask) | int1;
- if ((style & int2) != 0) style = (style & ~mask) | int2;
- if ((style & int3) != 0) style = (style & ~mask) | int3;
- if ((style & int4) != 0) style = (style & ~mask) | int4;
- if ((style & int5) != 0) style = (style & ~mask) | int5;
- return style;
-}
-
-/**
- * Checks that this class can be subclassed.
- * <p>
- * The SWT class library is intended to be subclassed
- * only at specific, controlled points (most notably,
- * <code>Composite</code> and <code>Canvas</code> when
- * implementing new widgets). This method enforces this
- * rule unless it is overridden.
- * </p><p>
- * <em>IMPORTANT:</em> By providing an implementation of this
- * method that allows a subclass of a class which does not
- * normally allow subclassing to be created, the implementer
- * agrees to be fully responsible for the fact that any such
- * subclass will likely fail between SWT releases and will be
- * strongly platform specific. No support is provided for
- * user-written classes which are implemented in this fashion.
- * </p><p>
- * The ability to subclass outside of the allowed SWT classes,
- * is intended purely to enable those not on the SWT development
- * team to implement patches in order to get around specific
- * limitations in advance of when those limitations can be
- * addressed by the team. Subclassing should not be attempted
- * without an intimate and detailed understanding of the hierarchy.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Throws an <code>SWTException</code> if the receiver can not
- * be accessed by the caller. This may include both checks on
- * the state of the receiver and more generally on the entire
- * execution context. This method <em>should</em> be called by
- * widget implementors to enforce the standard SWT invariants.
- * <p>
- * Currently, it is an error to invoke any method (other than
- * <code>isDisposed()</code>) on a widget that has had its
- * <code>dispose()</code> method called. It is also an error
- * to call widget methods from any thread that is different
- * from the thread that created the widget.
- * </p><p>
- * In future releases of SWT, there may be more or fewer error
- * checks and exceptions may be thrown for different reasons.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-
-/*
- * HANDLE CODE
- *
- * HANDLE CODE 1: HANDLE CREATION CODE - The createWidget() cycle.
- */
-
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- configure ();
- setHandleStyle ();
- register ();
- setInitialSize ();
- showHandle ();
-}
-
-void register () {
- if (handle == 0) return;
- if ((state & HANDLE) != 0) WidgetTable.put (handle, this);
-}
-
-void createHandle (int index) {}
-void configure () {}
-void setHandleStyle () {}
-void setInitialSize () {}
-void hookEvents () {}
-void showHandle () {}
-int paintHandle () { return 0; }
-
-/* HANDLE CODE 3:
- * Handle Destruction
- */
-
-void deregister () {
- if (handle == 0) return;
- if ((state & HANDLE) != 0) WidgetTable.remove (handle);
-}
-void destroyWidget () {
- int topHandle = topHandle ();
- releaseHandle ();
- if (topHandle != 0 && (state & HANDLE) != 0) {
- OS.gtk_widget_destroy (topHandle);
- }
-}
-/**
- * Disposes of the operating system resources associated with
- * the receiver and all its descendents. After this method has
- * been invoked, the receiver and all descendents will answer
- * <code>true</code> when sent the message <code>isDisposed()</code>.
- * Any internal connections between the widgets in the tree will
- * have been removed to facilitate garbage collection.
- * <p>
- * NOTE: This method is not called recursively on the descendents
- * of the receiver. This means that, widget implementers can not
- * detect when a widget is being disposed of by re-implementing
- * this method, but should instead listen for the <code>Dispose</code>
- * event.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #addDisposeListener
- * @see #removeDisposeListener
- * @see #checkWidget
- */
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed()) return;
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- releaseChild ();
- releaseWidget ();
- destroyWidget ();
-}
-
-void error (int code) {
- throw new SWTError (code);
-}
-
-
-
-/**
- * Returns the application defined widget data associated
- * with the receiver, or null if it has not been set. The
- * <em>widget data</em> is a single, unnamed field that is
- * stored with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @return the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return data;
-}
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData (String key) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-/**
- * Returns the <code>Display</code> that is associated with
- * the receiver.
- * <p>
- * A widget's display is either provided when it is created
- * (for example, top level <code>Shell</code>s) or is the
- * same as its parent's display.
- * </p>
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public abstract Display getDisplay ();
-String getName () {
-// String string = getClass ().getName ();
-// int index = string.lastIndexOf ('.');
-// if (index == -1) return string;
- String string = getClass ().getName ();
- int index = string.length ();
- while ((--index > 0) && (string.charAt (index) != '.'));
- return string.substring (index + 1, string.length ());
-}
-String getNameText () {
- return "";
-}
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created. This can occur when the underlying
- * operating system does not support a particular combination of
- * requested styles. For example, if the platform widget used to
- * implement a particular SWT widget always has scroll bars, the
- * result of calling this method would always have the
- * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return style;
-}
-
-/**
- * Returns <code>true</code> if the widget has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the widget.
- * When a widget has been disposed, it is an error to
- * invoke any other method using the widget.
- * </p>
- *
- * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- if (handle != 0) return false;
- if ((state & HANDLE) != 0) return true;
- return (state & DISPOSED) != 0;
-}
-
-/**
- * Returns <code>true</code> if there are any listeners
- * for the specified event type associated with the receiver,
- * and <code>false</code> otherwise.
- *
- * @param eventType the type of event
- * @return true if the event is hooked
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected boolean isListening (int eventType) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return hooks (eventType);
-}
-
-
-/*
- * Returns <code>true</code> if the specified eventType is
- * hooked, and <code>false</code> otherwise. Implementations
- * of SWT can avoid creating objects and sending events
- * when an event happens in the operating system but
- * there are no listeners hooked for the event.
- *
- * @param eventType the event to be checked
- *
- * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
- *
- * @see #isListening
- */
-boolean hooks (int eventType) {
- if (eventTable == null) return false;
- return eventTable.hooks (eventType);
-}
-
-boolean isValidThread () {
- return getDisplay ().isValidThread ();
-}
-public boolean isValidWidget () {
- if (handle != 0) return true;
- if ((state & HANDLE) != 0) return false;
- return (state & DISPOSED) == 0;
-}
-
-boolean isValidSubclass() {
- return Display.isValidClass(getClass());
-}
-
-char mbcsToWcs (char ch) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return ch;
- byte [] buffer;
- if (key <= 0xFF) {
- buffer = new byte [1];
- buffer [0] = (byte) key;
- } else {
- buffer = new byte [2];
- buffer [0] = (byte) ((key >> 8) & 0xFF);
- buffer [1] = (byte) (key & 0xFF);
- }
- char [] result = Converter.mbcsToWcs (null, buffer);
- if (result.length == 0) return 0;
- return result [0];
-}
-/**
- * Notifies all of the receiver's listeners for events
- * of the given type that one such event has occurred by
- * invoking their <code>handleEvent()</code> method.
- *
- * @param eventType the type of event which has occurred
- * @param event the event data
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- eventTable.sendEvent (event);
-}
-void postEvent (int eventType) {
- if (eventTable == null) return;
- postEvent (eventType, new Event ());
-}
-void postEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- getDisplay ().postEvent (event);
-}
-
-int processEvent (int eventNumber, int int0, int int1, int int2) {
- switch (eventNumber) {
- case SWT.Arm: return processArm (int0, int1, int2);
- case SWT.Collapse: return processCollapse (int0, int1, int2);
- case SWT.Expand: return processExpand (int0, int1, int2);
- case SWT.Dispose: return processDispose (int0, int1, int2);
- case SWT.DefaultSelection: return processDoubleSelection (int0, int1, int2);
- case SWT.FocusIn: return processFocusIn (int0, int1, int2);
- case SWT.FocusOut: return processFocusOut (int0, int1, int2);
- case SWT.Help: return processHelp (int0, int1, int2);
- case SWT.Hide: return processHide (int0, int1, int2);
- case SWT.KeyDown: return processKeyDown (int0, int1, int2);
- case SWT.KeyUp: return processKeyUp (int0, int1, int2);
- case SWT.Iconify: return processIconify (int0, int1, int2);
- case SWT.Deiconify: return processDeiconify (int0, int1, int2);
- case SWT.Modify: return processModify (int0, int1, int2);
- case SWT.MouseDown: return processMouseDown (int0, int1, int2);
- case SWT.MouseEnter: return processMouseEnter (int0, int1, int2);
- case SWT.MouseExit: return processMouseExit (int0, int1, int2);
- case SWT.MouseHover: return processMouseHover (int0, int1, int2);
- case SWT.MouseMove: return processMouseMove (int0, int1, int2);
- case SWT.MouseUp: return processMouseUp (int0, int1, int2);
- case SWT.Paint: return processPaint (int0, int1, int2);
- case SWT.Resize: return processResize (int0, int1, int2);
- case SWT.Show: return processShow (int0, int1, int2);
- case SWT.Selection: return processSelection (int0, int1, int2);
- case SWT.Verify: return processVerify (int0, int1, int2);
- }
- return 0;
-}
-
-int processArm (int int0, int int1, int int2) {
- return 0;
-}
-
-/*
- * Item expand/collapse in a tree.
- */
-int processCollapse (int int0, int int1, int int2) {
- return 1; // stop emission
-}
-int processExpand (int int0, int int1, int int2) {
- return 1; // stop emission
-}
-
-/*
- * Close a Shell, triggered by delete_event
- */
-int processDispose (int arg0, int arg1, int int2) {
- return 1;
-}
-
-/*
- * The WM has Iconified/Deiconified a Shell.
- * The Gtk event is map_event/unmap_event
- */
-int processIconify (int int0, int int1, int int2) {
- return 0;
-}
-int processDeiconify (int int0, int int1, int int2) {
- return 0;
-}
-
-int processHelp (int int0, int int1, int int2) {
- return 0;
-}
-int processHide (int int0, int int1, int int2) {
- return 0;
-}
-int processFocusIn(int int0, int int1, int int2) {
- return 0;
-}
-int processFocusOut(int int0, int int1, int int2) {
- return 0;
-}
-int processKeyDown (int arg0, int arg1, int int2) {
- return 0;
-}
-int processKeyUp (int arg0, int arg1, int int2) {
- return 0;
-}
-int processModify (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseDown (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseEnter (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseExit (int arg0, int arg1, int int2) {
- /* Do nothing */
- return 0;
-}
-int processMouseHover (int arg0, int arg1, int int2) {
- /* Do nothing */
- return 0;
-}
-int processMouseMove (int arg0, int arg1, int int2) {
- /* Do nothing */
- /* Even though we do nothing, we still need to at least
- * motify the X Server we are ready to process more events.
- * However, only OS controls can receive this event.
- */
- return 0;
-}
-
-int processMouseUp (int arg0, int arg1, int int2) {
- return 0;
-}
-int processPaint (int int0, int int1, int int2) {
- return 0;
-}
-int processResize (int int0, int int1, int int2) {
- return 0;
-}
-int processSelection (int int0, int int1, int int2) {
- return 0;
-}
-int processShow (int int0, int int1, int int2) {
- return 0;
-}
-int processDoubleSelection (int int0, int int1, int int2) {
- return 0;
-}
-int processVerify (int int0, int int1, int int2) {
- sendEvent (SWT.Verify);
- return 0;
-}
-
-void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
- byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
- int proc=0;
- switch (numArgs) {
- case 2: proc=getDisplay().windowProc2; break;
- case 3: proc=getDisplay().windowProc3; break;
- case 4: proc=getDisplay().windowProc4; break;
- case 5: proc=getDisplay().windowProc5; break;
- default: error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
-}
-void signal_connect_after (int handle, String eventName, int swtEvent, int numArgs) {
- byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
- int proc=0;
- switch (numArgs) {
- case 2: proc=getDisplay().windowProc2; break;
- case 3: proc=getDisplay().windowProc3; break;
- case 4: proc=getDisplay().windowProc4; break;
- case 5: proc=getDisplay().windowProc5; break;
- default: error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gtk_signal_connect_after (handle, buffer, proc, swtEvent);
-}
-
-void releaseChild () {
- /* Do nothing */
-}
-void releaseHandle () {
- handle = 0;
- state |= DISPOSED;
-}
-void releaseWidget () {
- sendEvent (SWT.Dispose);
- deregister ();
- eventTable = null;
- data = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-public void removeListener (int eventType, Listener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
-* Warning: API under construction.
-*/
-protected void removeListener (int eventType, SWTEventListener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when the widget is disposed.
- *
- * @param listener the listener which should no longer be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void removeDisposeListener (DisposeListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Dispose, listener);
-}
-void sendEvent (int eventType) {
- if (eventTable == null) return;
- sendEvent (eventType, new Event ());
-}
-void sendEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.widget = this;
- event.type = eventType;
- eventTable.sendEvent (event);
-}
-/**
- * Sets the application defined widget data associated
- * with the receiver to be the argument. The <em>widget
- * data</em> is a single, unnamed field that is stored
- * with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @param data the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- */
-public void setData (Object data) {
- checkWidget();
- this.data = data;
-}
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given value.
- * <p>
- * Applications may associate arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getData
- */
-public void setData (String key, Object value) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- String string = "*Disposed*";
- if (!isDisposed ()) {
- string = "*Wrong Thread*";
- if (isValidThread ()) string = getNameText ();
- }
- return getName () + " {" + string + "}";
-}
-int topHandle () {
- return handle;
-}
-char wcsToMbcs (char ch) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return ch;
- byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false);
- if (buffer.length == 1) return (char) buffer [0];
- if (buffer.length == 2) {
- return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
- }
- return 0;
-}
-
-byte[] string2bytesConvertMnemonic(String string) {
- //FIXME need to double _'s
- char [] t = new char [string.length ()];
- string.getChars (0, t.length, t, 0);
- for (int i=0; i<t.length; i++) {if (t [i] == '&') t [i] = '_';}
- return Converter.wcsToMbcs (null, t, true);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java
deleted file mode 100644
index df5065116a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-class WidgetTable {
- static int FreeSlot = 0;
- static int GrowSize = 1024;
- static int [] IndexTable = new int [GrowSize];
- static Widget [] WidgetTable = new Widget [GrowSize];
- static {
- for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
- IndexTable [GrowSize - 1] = -1;
- }
-
-public static synchronized Widget get (int handle) {
- if (handle == 0) return null;
- int index = OS.gtk_object_get_user_data (handle) - 1;
- if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
- return null;
-}
-
-public synchronized static void put(int handle, Widget widget) {
- if (handle == 0) return;
- if (FreeSlot == -1) {
- int length = (FreeSlot = IndexTable.length) + GrowSize;
- int[] newIndexTable = new int[length];
- Widget[] newWidgetTable = new Widget [length];
- System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
- System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
- for (int i = FreeSlot; i < length - 1; i++) {
- newIndexTable[i] = i + 1;
- }
- newIndexTable[length - 1] = -1;
- IndexTable = newIndexTable;
- WidgetTable = newWidgetTable;
- }
- int index = FreeSlot + 1;
- OS.gtk_object_set_user_data (handle, index);
- int oldSlot = FreeSlot;
- FreeSlot = IndexTable[oldSlot];
- IndexTable [oldSlot] = -2;
- WidgetTable [oldSlot] = widget;
-}
-
-public static synchronized Widget remove (int handle) {
- if (handle == 0) return null;
- Widget widget = null;
- int index = OS.gtk_object_get_user_data (handle) - 1;
- if (0 <= index && index < WidgetTable.length) {
- widget = WidgetTable [index];
- WidgetTable [index] = null;
- IndexTable [index] = FreeSlot;
- FreeSlot = index;
- OS.gtk_object_set_user_data (handle, 0);
- }
- return widget;
-}
-
-public static synchronized Shell [] shells () {
- int length = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) length++;
- }
- int index = 0;
- Shell [] result = new Shell [length];
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) {
- result [index++] = (Shell) widget;
- }
- }
- return result;
-}
-
-public static synchronized int size () {
- int size = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- if (WidgetTable [i] != null) size++;
- }
- return size;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java
deleted file mode 100644
index e796d2151c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class manage the operating system resources that
- * implement SWT's RGB color model. To create a color you can either
- * specify the individual color components as integers in the range
- * 0 to 255 or provide an instance of an <code>RGB</code>.
- * <p>
- * Application code must explicitly invoke the <code>Color.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see RGB
- */
-public final class Color {
- /**
- * the handle to the OS color resource
- * (Warning: This field is platform dependent)
- */
- public GdkColor handle;
- Device display;
-Color() {
-}
-/**
- * Constructs a new instance of this class given a device and the
- * desired red, green and blue values expressed as ints in the range
- * 0 to 255 (where 0 is black and 255 is full brightness). On limited
- * color devices, the color instance created by this call may not have
- * the same RGB values as the ones specified by the arguments. The
- * RGB values on the returned instance will be the color values of
- * the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color(Device display, int red, int green, int blue) {
- init(display, red, green, blue);
-}
-/**
- * Constructs a new instance of this class given a device and an
- * <code>RGB</code> describing the desired red, green and blue values.
- * On limited color devices, the color instance created by this call
- * may not have the same RGB values as the ones specified by the
- * argument. The RGB values on the returned instance will be the color
- * values of the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param RGB the RGB values of the desired color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
- * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color(Device display, RGB rgb) {
- if (rgb == null) error(SWT.ERROR_NULL_ARGUMENT);
- init(display, rgb.red, rgb.green, rgb.blue);
-}
-/**
- * Disposes of the operating system resources associated with
- * the color. Applications must dispose of all colors which
- * they allocate.
- */
-public void dispose() {
- /**
- * If this is a palette-based display,
- * Decrease the reference count for this color.
- * If the reference count reaches 0, the slot may
- * be reused when another color is allocated.
- */
- if (display.colorRefCount != null) {
- if (--display.colorRefCount[handle.pixel] == 0) {
- display.gdkColors[handle.pixel] = null;
- }
- }
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_colors_free(colormap, new int[] { handle.pixel }, 1, 0);
- this.display = null;
- this.handle = null;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Color)) return false;
- Color color = (Color)object;
- GdkColor xColor = color.handle;
- return (handle.pixel == xColor.pixel)&&(handle.red == xColor.red) && (handle.green == xColor.green) && (handle.blue == xColor.blue) && (this.display == color.display);
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns the amount of blue in the color, from 0 to 255.
- *
- * @return the blue component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getBlue() {
- return (handle.blue >> 8) & 0xFF;
-}
-/**
- * Returns the amount of green in the color, from 0 to 255.
- *
- * @return the green component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getGreen() {
- return (handle.green >> 8) & 0xFF;
-}
-/**
- * Returns the amount of red in the color, from 0 to 255.
- *
- * @return the red component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getRed() {
- return (handle.red >> 8) & 0xFF;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle.red ^ handle.green ^ handle.blue;
-}
-/**
- * Returns an <code>RGB</code> representing the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public RGB getRGB () {
- return new RGB(getRed(), getGreen(), getBlue());
-}
-
-void init(Device display, int red, int green, int blue) {
- if (display == null) display = Display.getDefault();
- this.display = display;
- handle = new GdkColor();
- handle.red = (short)((red & 0xFF) | ((red & 0xFF) << 8));
- handle.green = (short)((green & 0xFF) | ((green & 0xFF) << 8));
- handle.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8));
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_color_alloc(colormap, handle);
- if (display.colorRefCount != null) {
- // Make a copy of the color to put in the colors array
- GdkColor colorCopy = new GdkColor();
- colorCopy.red = handle.red;
- colorCopy.green = handle.green;
- colorCopy.blue = handle.blue;
- colorCopy.pixel = handle.pixel;
- display.gdkColors[colorCopy.pixel] = colorCopy;
- display.colorRefCount[colorCopy.pixel]++;
- }
-}
-/**
- * Returns <code>true</code> if the color has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the color.
- * When a color has been disposed, it is an error to
- * invoke any other method using the color.
- *
- * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == null;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
-}
-
-public static Color gtk_new(GdkColor gdkColor) {
- Color color = new Color(null, gtk_getRGBIntensities(gdkColor));
- return color;
-}
-
-static RGB gtk_getRGBIntensities(GdkColor gdkColor) {
- boolean intensitiesAreZero = (gdkColor.red==0) && (gdkColor.green==0) && (gdkColor.blue==0);
- if (!intensitiesAreZero) return new RGB ((gdkColor.red&0xFF00)>>8,
- (gdkColor.green&0xFF00)>>8,
- (gdkColor.blue&0xFF00)>>8 );
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
-
- int r = (gdkColor.pixel&visual.red_mask) >> visual.red_shift;
- if (visual.red_prec<8) r = r << (8 - visual.red_prec);
- else r = r >> (visual.red_prec - 8);
- int g = (gdkColor.pixel&visual.green_mask) >> visual.green_shift;
- if (visual.green_prec<8) g = g << (8 - visual.green_prec);
- else g = g >> (visual.green_prec - 8);
- int b = (gdkColor.pixel&visual.blue_mask) >> visual.blue_shift;
- if (visual.blue_prec<8) b = b << (8 - visual.blue_prec);
- else b = b >> (visual.blue_prec - 8);
-
- return new RGB(r, g, b);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java
deleted file mode 100644
index 52658518c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.image.*;
-
-/**
- * Instances of this class manage operating system resources that
- * specify the appearance of the on-screen pointer. To create a
- * cursor you specify the device and either a simple cursor style
- * describing one of the standard operating system provided cursors
- * or the image and mask data for the desired appearance.
- * <p>
- * Application code must explicitly invoke the <code>Cursor.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>
- * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
- * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
- * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
- * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
- * </dd>
- * </dl>
- */
-public final class Cursor {
- /**
- * the handle to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-Cursor () {
-}
-/**
- * Constructs a new cursor given a device and a style
- * constant describing the desired cursor appearance.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param style the style of cursor to allocate
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
- * </ul>
- *
- * @see Cursor for the supported style values
- */
-public Cursor(Device display, int style) {
- int osFlag = 0;
- switch (style) {
- case SWT.CURSOR_ARROW:
- osFlag = OS.GDK_LEFT_PTR;
- break;
- case SWT.CURSOR_WAIT:
- osFlag = OS.GDK_WATCH;
- break;
- case SWT.CURSOR_CROSS:
- osFlag = OS.GDK_CROSS;
- break;
- case SWT.CURSOR_APPSTARTING:
- osFlag = OS.GDK_WATCH;
- break;
- case SWT.CURSOR_HAND:
- osFlag = OS.GDK_HAND1;
- break;
- case SWT.CURSOR_HELP:
- osFlag = OS.GDK_QUESTION_ARROW;
- break;
- case SWT.CURSOR_SIZEALL:
- osFlag = OS.GDK_DIAMOND_CROSS;
- break;
- case SWT.CURSOR_SIZENESW:
- osFlag = OS.GDK_SIZING;
- break;
- case SWT.CURSOR_SIZENS:
- osFlag = OS.GDK_DOUBLE_ARROW;
- break;
- case SWT.CURSOR_SIZENWSE:
- osFlag = OS.GDK_SIZING;
- break;
- case SWT.CURSOR_SIZEWE:
- osFlag = OS.GDK_SB_H_DOUBLE_ARROW;
- break;
- case SWT.CURSOR_SIZEN:
- osFlag = OS.GDK_TOP_SIDE;
- break;
- case SWT.CURSOR_SIZES:
- osFlag = OS.GDK_BOTTOM_SIDE;
- break;
- case SWT.CURSOR_SIZEE:
- osFlag = OS.GDK_RIGHT_SIDE;
- break;
- case SWT.CURSOR_SIZEW:
- osFlag = OS.GDK_LEFT_SIDE;
- break;
- case SWT.CURSOR_SIZENE:
- osFlag = OS.GDK_TOP_RIGHT_CORNER;
- break;
- case SWT.CURSOR_SIZESE:
- osFlag = OS.GDK_BOTTOM_RIGHT_CORNER;
- break;
- case SWT.CURSOR_SIZESW:
- osFlag = OS.GDK_BOTTOM_LEFT_CORNER;
- break;
- case SWT.CURSOR_SIZENW:
- osFlag = OS.GDK_TOP_LEFT_CORNER;
- break;
- case SWT.CURSOR_UPARROW:
- osFlag = OS.GDK_SB_UP_ARROW;
- break;
- case SWT.CURSOR_IBEAM:
- osFlag = OS.GDK_XTERM;
- break;
- case SWT.CURSOR_NO:
- osFlag = OS.GDK_X_CURSOR;
- break;
- default:
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.handle = OS.gdk_cursor_new(osFlag);
-}
-/**
- * Constructs a new cursor given a device, image and mask
- * data describing the desired cursor appearance, and the x
- * and y co-ordinates of the <em>hotspot</em> (that is, the point
- * within the area covered by the cursor which is considered
- * to be where the on-screen pointer is "pointing").
- * <p>
- * The mask data is allowed to be null, but in this case the source
- * must be an ImageData representing an icon that specifies both
- * color data and mask data.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param source the color data for the cursor
- * @param mask the mask data for the cursor (or null)
- * @param hotspotX the x coordinate of the cursor's hotspot
- * @param hotspotY the y coordinate of the cursor's hotspot
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
- * size, or either is not of depth one, or if the hotspot is outside
- * the bounds of the image</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
- * </ul>
- */
-public Cursor(Device display, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
- if (source == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) {
- if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) error(SWT.ERROR_NULL_ARGUMENT);
- mask = source.getTransparencyMask();
- }
- /* Check the bounds. Mask must be the same size as source */
- if (mask.width != source.width || mask.height != source.height) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Check depths */
- if (mask.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
- if (source.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
- /* Check the hotspots */
- if (hotspotX >= source.width || hotspotX < 0 ||
- hotspotY >= source.height || hotspotY < 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /* Swap the bits if necessary */
- byte[] sourceData = new byte[source.data.length];
- byte[] maskData = new byte[mask.data.length];
- /* Swap the bits in each byte */
- byte[] data = source.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- sourceData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- sourceData[i] = (byte) ~sourceData[i];
- }
- data = mask.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- maskData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- maskData[i] = (byte) ~maskData[i];
- }
-
- int sourcePixmap = OS.gdk_bitmap_create_from_data(0, sourceData, source.width, source.height);
- if (sourcePixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
- int maskPixmap = OS.gdk_bitmap_create_from_data(0, maskData, source.width, source.height);
- if (maskPixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* Get the colors */
- GdkColor foreground = new GdkColor();
- foreground.red = 0;
- foreground.green = 0;
- foreground.blue = 0;
- GdkColor background = new GdkColor();
- background.red = (short)65535;
- background.green = (short)65535;
- background.blue = (short)65535;
-
- /* Create the cursor */
- /* For some reason, mask and source take reverse roles, both here and on Motif */
- handle = OS.gdk_cursor_new_from_pixmap (maskPixmap, sourcePixmap, foreground, background, hotspotX, hotspotY);
- /* Dispose the pixmaps */
- OS.gdk_pixmap_unref (sourcePixmap);
- OS.gdk_pixmap_unref (maskPixmap);
- if (handle == 0) error(SWT.ERROR_NO_HANDLES);
-}
-/**
- * Disposes of the operating system resources associated with
- * the cursor. Applications must dispose of all cursors which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_cursor_destroy(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- return (object == this) || ((object instanceof Cursor) && (handle == ((Cursor)object).handle));
-}
-void error(int code) {
- throw new SWTError(code);
-}
-public static Cursor gtk_new(int handle) {
- Cursor cursor = new Cursor();
- cursor.handle = handle;
- return cursor;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the cursor has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the cursor.
- * When a cursor has been disposed, it is an error to
- * invoke any other method using the cursor.
- *
- * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return "Cursor {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java
deleted file mode 100644
index 952fa9d404..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-
-class DefaultGtkStyle {
-
- private static DefaultGtkStyle instance = null;
- private GtkStyle style = null;
- private int defaultFont;
-
- public Color foregroundColorNORMAL() {
- return new Color(null,
- ((short)0xFF00 & style.fg0_red)>>8,
- ((short)0xFF00 & style.fg0_green)>>8,
- ((short)0xFF00 & style.fg0_blue)>>8);
- }
-
- public Color backgroundColorNORMAL() {
- return new Color(null,
- ((short)0xFF00 & style.bg0_red)>>8,
- ((short)0xFF00 & style.bg0_green)>>8,
- ((short)0xFF00 & style.bg0_blue)>>8);
- }
-
- public Color foregroundColorACTIVE() {
- return new Color(null,
- ((short)0xFF00 & style.fg1_red)>>8,
- ((short)0xFF00 & style.fg1_green)>>8,
- ((short)0xFF00 & style.fg1_blue)>>8);
- }
-
- public Color backgroundColorACTIVE() {
- return new Color(null,
- ((short)0xFF00 & style.bg1_red)>>8,
- ((short)0xFF00 & style.bg1_green)>>8,
- ((short)0xFF00 & style.bg1_blue)>>8);
- }
-
- public Color foregroundColorPRELIGHT() {
- return new Color(null,
- ((short)0xFF00 & style.fg2_red)>>8,
- ((short)0xFF00 & style.fg2_green)>>8,
- ((short)0xFF00 & style.fg2_blue)>>8);
- }
-
- public Color backgroundColorPRELIGHT() {
- return new Color(null,
- ((short)0xFF00 & style.bg2_red)>>8,
- ((short)0xFF00 & style.bg2_green)>>8,
- ((short)0xFF00 & style.bg2_blue)>>8);
- }
-
- public Color foregroundColorSELECTED() {
- return new Color(null,
- ((short)0xFF00 & style.fg3_red)>>8,
- ((short)0xFF00 & style.fg3_green)>>8,
- ((short)0xFF00 & style.fg3_blue)>>8);
- }
-
- public Color backgroundColorSELECTED() {
- return new Color(null,
- ((short)0xFF00 & style.bg3_red)>>8,
- ((short)0xFF00 & style.bg3_green)>>8,
- ((short)0xFF00 & style.bg3_blue)>>8);
- }
-
- public Color foregroundColorINSENSITIVE() {
- return new Color(null,
- ((short)0xFF00 & style.fg4_red)>>8,
- ((short)0xFF00 & style.fg4_green)>>8,
- ((short)0xFF00 & style.fg4_blue)>>8);
- }
-
- public Color backgroundColorINSENSITIVE() {
- return new Color(null,
- ((short)0xFF00 & style.bg4_red)>>8,
- ((short)0xFF00 & style.bg4_green)>>8,
- ((short)0xFF00 & style.bg4_blue)>>8);
- }
-
- public int loadDefaultFont() {
- if (defaultFont == 0) {
- int fnames = Font.getFontNameList(style.font);
- int slength = OS.g_slist_length(fnames);
- if (slength < 1) SWT.error(SWT.ERROR_UNSPECIFIED);
- int name1 = OS.g_slist_nth_data(fnames, 0);
- int length = OS.strlen(name1);
- byte [] buffer1 = new byte[length];
- OS.memmove(buffer1, name1, length);
- defaultFont = OS.gdk_font_load(buffer1);
- if (defaultFont==0) SWT.error(SWT.ERROR_UNSPECIFIED);
- GdkFont gdkFont = new GdkFont();
- OS.memmove(gdkFont, defaultFont, GdkFont.sizeof);
- if (gdkFont.type != OS.GDK_FONT_FONT) SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- return defaultFont;
- }
-
- public static DefaultGtkStyle instance() {
- if (instance==null) instance = new DefaultGtkStyle();
- return instance;
- }
-
- private DefaultGtkStyle() {
- style = new GtkStyle();
- OS.memmove(style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- }
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
deleted file mode 100644
index 5140074d6d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
+++ /dev/null
@@ -1,556 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-public abstract class Device implements Drawable {
-
- /* Debugging */
- public static boolean DEBUG;
- boolean debug = DEBUG;
- boolean tracking = DEBUG;
- Error [] errors;
- Object [] objects;
-
- /* Colormap and reference count */
- GdkColor [] gdkColors;
- int [] colorRefCount;
-
- /* Disposed flag */
- boolean disposed;
-
- /* Warning and Error Handlers */
- int logProc;
- Callback logCallback;
- String [] log_domains = {"Gtk", /*"Gdk", "GLib", "GdkPixbuf"*/};
- int [] handler_ids = new int [log_domains.length];
- boolean warnings = true;
-
- /*
- * The following colors are listed in the Windows
- * Programmer's Reference as the colors in the default
- * palette.
- */
- Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE;
- Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED;
- Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE;
-
- /*
- * TEMPORARY CODE. When a graphics object is
- * created and the device parameter is null,
- * the current Display is used. This presents
- * a problem because SWT graphics does not
- * reference classes in SWT widgets. The correct
- * fix is to remove this feature. Unfortunately,
- * too many application programs rely on this
- * feature.
- *
- * This code will be removed in the future.
- */
- protected static Device CurrentDevice;
- protected static Runnable DeviceFinder;
- static {
- try {
- Class.forName ("org.eclipse.swt.widgets.Display");
- } catch (Throwable e) {}
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static Device getDevice () {
- if (DeviceFinder != null) DeviceFinder.run();
- Device device = CurrentDevice;
- CurrentDevice = null;
- return device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * You must dispose the device when it is no longer required.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #create
- * @see #init
- * @see DeviceData
- */
-public Device(DeviceData data) {
- if (data != null) {
- debug = data.debug;
- tracking = data.tracking;
- }
- create (data);
- init ();
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
- }
-}
-
-protected void checkDevice () {
- if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-protected void create (DeviceData data) {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver. After this method has been invoked, the receiver
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- *
- * @see #release
- * @see #destroy
- * @see #checkDevice
- */
-public void dispose () {
- if (isDisposed()) return;
- checkDevice ();
- release ();
- destroy ();
- disposed = true;
- if (tracking) {
- objects = null;
- errors = null;
- }
-}
-
-void dispose_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == object) {
- objects [i] = null;
- errors [i] = null;
- return;
- }
- }
-}
-
-protected void destroy () {
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return new Rectangle(0, 0, 0, 0);
-}
-
-/**
- * Returns a <code>DeviceData</code> based on the receiver.
- * Modifications made to this <code>DeviceData</code> will not
- * affect the receiver.
- *
- * @return a <code>DeviceData</code> containing the device's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see DeviceData
- */
-public DeviceData getDeviceData () {
- checkDevice();
- DeviceData data = new DeviceData ();
- data.debug = debug;
- data.tracking = tracking;
- int count = 0, length = 0;
- if (tracking) length = objects.length;
- for (int i=0; i<length; i++) {
- if (objects [i] != null) count++;
- }
- int index = 0;
- data.objects = new Object [count];
- data.errors = new Error [count];
- for (int i=0; i<length; i++) {
- if (objects [i] != null) {
- data.objects [index] = objects [i];
- data.errors [index] = errors [i];
- index++;
- }
- }
- return data;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- */
-public Rectangle getClientArea () {
- checkDevice ();
- return getBounds ();
-}
-
-/**
- * Returns the bit depth of the screen, which is the number of
- * bits it takes to represent the number of unique colors that
- * the screen is currently capable of displaying. This number
- * will typically be one of 1, 8, 15, 16, 24 or 32.
- *
- * @return the depth of the screen
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getDepth () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return 0;
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- return new Point (72, 72);
-}
-
-/**
- * Returns <code>FontData</code> objects which describe
- * the fonts which match the given arguments. If the
- * <code>faceName</code> is null, all fonts will be returned.
- *
- * @param faceName the name of the font to look for, or null
- * @param scalable true if scalable fonts should be returned.
- * @return the matching font data
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData [] getFontList (String faceName, boolean scalable) {
- checkDevice ();
- String xlfd;
- if (faceName == null) {
- xlfd = "-*";
- } else {
- int dashIndex = faceName.indexOf('-');
- if (dashIndex < 0) {
- xlfd = "-*-" + faceName + "-*";
- } else {
- xlfd = "-" + faceName + "-*";
- }
- }
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, xlfd, true);
- int [] ret = new int [1];
- int listPtr = OS.XListFonts (buffer1, 65535, ret);
- int ptr = listPtr;
- int [] intBuf = new int [1];
- FontData [] fd = new FontData [ret [0]];
- int fdIndex = 0;
- for (int i = 0; i < ret [0]; i++) {
- OS.memmove (intBuf, ptr, 4);
- int charPtr = intBuf [0];
- int length = OS.strlen (charPtr);
- byte [] buffer2 = new byte [length];
- OS.memmove (buffer2, charPtr, length);
- /* Use the character encoding for the default locale */
- char [] chars = Converter.mbcsToWcs (null, buffer2);
- FontData data = FontData.gtk_new (new String (chars));
- boolean isScalable = data.averageWidth == 0 && data.pixels == 0 && data.points == 0;
- if (isScalable == scalable) {
- fd [fdIndex++] = data;
- }
- ptr += 4;
- }
- // FIXME, leaking font list
-// OS.XFreeFontNames (listPtr);
- if (fdIndex == ret [0]) return fd;
- FontData [] result = new FontData [fdIndex];
- System.arraycopy (fd, 0, result, 0, fdIndex);
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- switch (id) {
- case SWT.COLOR_BLACK: return COLOR_BLACK;
- case SWT.COLOR_DARK_RED: return COLOR_DARK_RED;
- case SWT.COLOR_DARK_GREEN: return COLOR_DARK_GREEN;
- case SWT.COLOR_DARK_YELLOW: return COLOR_DARK_YELLOW;
- case SWT.COLOR_DARK_BLUE: return COLOR_DARK_BLUE;
- case SWT.COLOR_DARK_MAGENTA: return COLOR_DARK_MAGENTA;
- case SWT.COLOR_DARK_CYAN: return COLOR_DARK_CYAN;
- case SWT.COLOR_GRAY: return COLOR_GRAY;
- case SWT.COLOR_DARK_GRAY: return COLOR_DARK_GRAY;
- case SWT.COLOR_RED: return COLOR_RED;
- case SWT.COLOR_GREEN: return COLOR_GREEN;
- case SWT.COLOR_YELLOW: return COLOR_YELLOW;
- case SWT.COLOR_BLUE: return COLOR_BLUE;
- case SWT.COLOR_MAGENTA: return COLOR_MAGENTA;
- case SWT.COLOR_CYAN: return COLOR_CYAN;
- case SWT.COLOR_WHITE: return COLOR_WHITE;
- }
- return COLOR_BLACK;
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return null;
-}
-
-/**
- * Returns <code>true</code> if the underlying window system prints out
- * warning messages on the console, and <code>setWarnings</code>
- * had previously been called with <code>true</code>.
- *
- * @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getWarnings () {
- checkDevice ();
- return this.warnings;
-}
-
-protected void init () {
-
- /* Create GTK warnings and error callbacks */
- logCallback = new Callback (this, "logProc", 4);
- logProc = logCallback.getAddress ();
- if (logProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- /* Set GTK warning and error handlers */
- if (debug) {
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<log_domains.length; i++) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- handler_ids [i] = OS.g_log_set_handler (log_domain, flags, logProc, 0);
- }
- }
-
- /* Create the standard colors */
- COLOR_BLACK = new Color (this, 0,0,0);
- COLOR_DARK_RED = new Color (this, 0x80,0,0);
- COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
- COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
- COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
- COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
- COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
- COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
- COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
- COLOR_RED = new Color (this, 0xFF,0,0);
- COLOR_GREEN = new Color (this, 0,0xFF,0);
- COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
- COLOR_BLUE = new Color (this, 0,0,0xFF);
- COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
- COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
- COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public abstract int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public abstract void internal_dispose_GC (int handle, GCData data);
-
-/**
- * Returns <code>true</code> if the device has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the device.
- * When a device has been disposed, it is an error to
- * invoke any other method using the device.
- *
- * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return disposed;
-}
-
-int logProc (int log_domain, int log_level, int message, int user_data) {
- if (DEBUG || (debug && warnings)) {
- new Error ().printStackTrace ();
- OS.g_log_default_handler (log_domain, log_level, message, 0);
- }
- return 0;
-}
-
-void new_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == null) {
- objects [i] = object;
- errors [i] = new Error ();
- return;
- }
- }
- Object [] newObjects = new Object [objects.length + 128];
- System.arraycopy (objects, 0, newObjects, 0, objects.length);
- newObjects [objects.length] = object;
- objects = newObjects;
- Error [] newErrors = new Error [errors.length + 128];
- System.arraycopy (errors, 0, newErrors, 0, errors.length);
- newErrors [errors.length] = new Error ();
- errors = newErrors;
-}
-
-protected void release () {
- if (gdkColors != null) {
- int colormap = OS.gdk_colormap_get_system();
- int [] pixel = new int [1];
- for (int i = 0; i < gdkColors.length; i++) {
- GdkColor color = gdkColors [i];
- if (color != null) {
- while (colorRefCount [i] > 0) {
- OS.gdk_color_free(color);
- --colorRefCount [i];
- }
- }
- }
- }
- gdkColors = null;
- colorRefCount = null;
- COLOR_BLACK = COLOR_DARK_RED = COLOR_DARK_GREEN = COLOR_DARK_YELLOW = COLOR_DARK_BLUE =
- COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED =
- COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
-
- /* Free the GTK error and warning handler */
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<handler_ids.length; i++) {
- if (handler_ids [i] != 0) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- OS.g_log_remove_handler (log_domain, handler_ids [i]);
- }
- }
- logCallback.dispose (); logCallback = null;
- handler_ids = null; log_domains = null;
- logProc = 0;
-}
-
-/**
- * If the underlying window system supports printing warning messages
- * to the console, setting warnings to <code>true</code> prevents these
- * messages from being printed. If the argument is <code>false</code>
- * message printing is not blocked.
- *
- * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setWarnings (boolean warnings) {
- checkDevice ();
- this.warnings = warnings;
- if (debug) return;
- for (int i=0; i<handler_ids.length; i++) {
- if (handler_ids [i] != 0) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- OS.g_log_remove_handler (log_domain, handler_ids [i]);
- }
- }
- if (warnings) {
- int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION;
- for (int i=0; i<log_domains.length; i++) {
- byte [] log_domain = Converter.wcsToMbcs (null, log_domains [i], true);
- handler_ids [i] = OS.g_log_set_handler (log_domain, flags, logProc, 0);
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java
deleted file mode 100644
index 4ed07ebc16..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DeviceData {
- /*
- * Motif only fields.
- */
- public String display_name;
- public String application_name;
- public String application_class;
-
- /*
- * Debug fields - may not be honoured
- * on some SWT platforms.
- */
- public boolean debug;
- public boolean tracking;
- public Error [] errors;
- public Object [] objects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java
deleted file mode 100644
index b5a0c1e158..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class manage operating system resources that
- * define how text looks when it is displayed. Fonts may be constructed
- * by providing a device and either name, size and style information
- * or a <code>FontData</code> object which encapsulates this data.
- * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see FontData
- */
-public final class Font {
- /**
- * the handle to the OS font resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-Font() {
-}
-/**
- * Constructs a new font given a device and font data
- * which describes the desired font's appearance.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param fd the FontData that describes the desired font (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
- * </ul>
- */
-public Font(Device display, FontData fd) {
- if (fd == null) error(SWT.ERROR_NULL_ARGUMENT);
-
- String xlfd = fd.getXlfd();
- byte[] buffer = Converter.wcsToMbcs(null, xlfd, true);
- handle = OS.gdk_font_load(buffer);
- if (handle == 0) {
- int hStyle = OS.gtk_widget_get_default_style();
- GtkStyle gtkStyle = new GtkStyle();
- OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
- handle = OS.gdk_font_ref(gtkStyle.font);
- }
-}
-/**
- * Constructs a new font given a device, a font name,
- * the height of the desired font in points, and a font
- * style.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
- * </ul>
- */
-public Font(Device display, String fontFamily, int height, int style) {
- if (fontFamily == null) error(SWT.ERROR_NULL_ARGUMENT);
- FontData fd = new FontData(fontFamily, height, style);
- byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
- handle = OS.gdk_font_load(buffer);
- if (handle == 0) {
- int hStyle = OS.gtk_widget_get_default_style();
- GtkStyle gtkStyle = new GtkStyle();
- OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
- handle = OS.gdk_font_ref(gtkStyle.font);
- }
-}
-/**
- * Disposes of the operating system resources associated with
- * the font. Applications must dispose of all fonts which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_font_unref(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Font)) return false;
- return OS.gdk_font_equal(handle, ((Font)object).handle);
-}
-void error(int code) {
- throw new SWTError (code);
-}
-
-/**
- * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however,
- * a <code>Font</code> object <em>may</em> be composed of multiple X
- * fonts. To support this case, we return an array of font data objects.
- *
- * @return an array of font data objects describing the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData[] getFontData() {
- int index=0;
- int fnames = getFontNameList(handle);
- int nfonts = OS.g_slist_length(fnames);
- FontData[] answer = new FontData[nfonts];
- for (int i=0; i<nfonts; i++) {
- FontData data = new FontData();
-
- int name = OS.g_slist_nth_data(fnames, index);
- int length = OS.strlen(name);
- byte [] buffer1 = new byte[length];
- OS.memmove(buffer1, name, length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String fontname = new String (buffer2, 0, buffer2.length);
- data.setXlfd(fontname);
-
- // Wild guess, 'a' looks average enough
- data.averageWidth = OS.gdk_char_width(handle, (byte)'a');
-
- // Wild guess, a progressive font should probably have A wider than l
- int widthA = OS.gdk_char_width(handle, (byte)'A');
- int widthl = OS.gdk_char_width(handle, (byte)'l');
- if (widthA == widthl) data.spacing = "m";
- else data.spacing = "p";
-
- answer[i] = data;
- }
- return answer;
-}
-static int getFontNameList(int handle) {
- int[] mem = new int[7];
- OS.memmove(mem, handle, 7*4);
- int type = mem[0];
- int ascent = mem[1];
- int descent = mem[2];
- int xfont =mem [3];
- int xdisplay = mem[4];
- int ref_count = mem[5];
- int names = mem[6];
- return names;
-}
-public static Font gtk_new(int handle) {
- Font font = new Font();
- font.handle = handle;
- return font;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the font has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the font.
- * When a font has been disposed, it is an error to
- * invoke any other method using the font.
- *
- * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return "Font {" + handle + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java
deleted file mode 100644
index 5915c07c64..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java
+++ /dev/null
@@ -1,547 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe operating system fonts.
- * Only the public API of this type is platform independent.
- * <p>
- * For platform-independent behaviour, use the get and set methods
- * corresponding to the following properties:
- * <dl>
- * <dt>height</dt><dd>the height of the font in points</dd>
- * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
- * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
- * </dl>
- * If extra, platform-dependent functionality is required:
- * <ul>
- * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
- * corresponds to a Windows <code>LOGFONT</code> structure whose fields
- * may be retrieved and modified.</li>
- * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * </ul>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- *
- * @see Font
- */
-public final class FontData {
- /**
- * The company that produced the font
- * Warning: This field is platform dependent.
- */
- public String foundry;
- /**
- * The common name of the font
- * Warning: This field is platform dependent.
- */
- public String fontFamily;
- /**
- * The weight ("normal", "bold")
- * Warning: This field is platform dependent.
- */
- public String weight;
- /**
- * The slant ("o" for oblique, "i" for italic)
- * Warning: This field is platform dependent.
- */
- public String slant;
- /**
- * The set width of the font
- * Warning: This field is platform dependent.
- */
- public String setWidth;
- /**
- * Additional font styles
- * Warning: This field is platform dependent.
- */
- public String addStyle;
- /**
- * The height of the font in pixels
- * Warning: This field is platform dependent.
- */
- public int pixels;
- /**
- * The height of the font in tenths of a point
- * Warning: This field is platform dependent.
- */
- public int points;
- /**
- * The horizontal screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int horizontalResolution;
- /**
- * The vertical screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int verticalResolution;
- /**
- * The font spacing ("m" for monospace, "p" for proportional)
- * Warning: This field is platform dependent.
- */
- public String spacing;
- /**
- * The average character width for the font
- * Warning: This field is platform dependent.
- */
- public int averageWidth;
- /**
- * The ISO character set registry
- * Warning: This field is platform dependent.
- */
- public String characterSetRegistry;
- /**
- * The ISO character set name
- * Warning: This field is platform dependent.
- */
- public String characterSetName;
- /**
- * The locales of the font
- * (Warning: These fields are platform dependent)
- */
- String lang, country, variant;
-
-/**
- * Constructs a new un-initialized font data.
- */
-public FontData () {
-}
-/**
- * Constructs a new FontData given a string representation
- * in the form generated by the <code>FontData.toString</code>
- * method.
- * <p>
- * Note that the representation varies between platforms,
- * and a FontData can only be created from a string that was
- * generated on the same platform.
- * </p>
- *
- * @param string the string representation of a <code>FontData</code> (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
- * </ul>
- *
- * @see #toString
- */
-public FontData(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- int start = 0;
- int end = string.indexOf('|');
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- String version1 = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- String name = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- int height = 0;
- try {
- height = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
- int style = 0;
- try {
- style = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String platform = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String version2 = string.substring(start, end);
-
- if (platform.equals("MOTIF") && version2.equals("1")) {
- start = end + 1;
- end = string.length();
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String xlfd = string.substring(start, end);
- setXlfd(xlfd);
- return;
- }
- setName(name);
- setHeight(height);
- setStyle(style);
-}
-/**
- * Constructs a new font data given a font name,
- * the height of the desired font in points,
- * and a font style.
- *
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- */
-public FontData(String name, int height, int style) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
- points = height * 10;
- if ((style & SWT.BOLD) != 0) {
- weight = "bold";
- } else {
- weight = "medium";
- }
- if ((style & SWT.ITALIC) != 0) {
- slant = "i";
- } else {
- slant = "r";
- }
-}
-
-
-
-/*
- * Public getters
- */
-
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight
- */
-public int getHeight() {
- return points / 10;
-}
-
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this <code>FontData</code>
- *
- * @see #setName
- */
-public String getName() {
- StringBuffer buffer = new StringBuffer();
- if (foundry != null) {
- buffer.append(foundry);
- buffer.append("-");
- }
- if (fontFamily != null) buffer.append(fontFamily);
- return buffer.toString();
-}
-
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the <code>SWT</code> constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this <code>FontData</code>
- *
- * @see #setStyle
- */
-public int getStyle() {
- int style = 0;
- if (weight.equals("bold"))
- style |= SWT.BOLD;
- if (slant.equals("i"))
- style |= SWT.ITALIC;
- return style;
-}
-
-/**
- * We need this in FontDialog, so we can't just get rid of it or make it private.
- */
-public String gtk_getXlfd() { return getXlfd(); }
-
-String getXlfd() {
- String s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
- s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = s12 = s13 = s14 = "*";
-
- if (foundry != null) s1 = foundry;
- if (fontFamily != null) s2 = fontFamily;
- if (weight != null) s3 = weight;
- if (slant != null) s4 = slant;
- if (setWidth != null) s5 = setWidth;
- if (addStyle != null) s6 = addStyle;
- if (pixels != 0) s7 = Integer.toString(pixels);
- if (points != 0) s8 = Integer.toString(points);
- if (horizontalResolution != 0) s9 = Integer.toString(horizontalResolution);
- if (verticalResolution != 0) s10 = Integer.toString(verticalResolution);
- if (spacing != null) s11 = spacing;
-// The following line has been intentionally commented.
-// we don not know the exact average width as in the font definition,
-// so if someone tries to get a similar font, they'd get something weird
-// if (averageWidth != 0) s12 = Integer.toString(averageWidth);
- if (characterSetRegistry != null) s13 = characterSetRegistry;
- if (characterSetName != null) s14 = characterSetName;
-
- String xlfd = "-" + s1+ "-" + s2 + "-" + s3 + "-" + s4 + "-" + s5 + "-" + s6 + "-" + s7 + "-" + s8 + "-"
- + s9 + "-" + s10 + "-" + s11 + "-" + s12 + "-" + s13 + "-" + s14;
- return xlfd;
-}
-public static FontData gtk_new(String xlfd) {
- FontData fontData = new FontData();
- fontData.setXlfd(xlfd);
- return fontData;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return getXlfd().hashCode();
-}
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the <code>FontData</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- *
- * @see #getHeight
- */
-public void setHeight(int height) {
- if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
- points = height * 10;
-}
-
-/**
- * Sets the locale of the receiver.
- * <p>
- * The locale determines which platform character set this
- * font is going to use. Widgets and graphics operations that
- * use this font will convert UNICODE strings to the platform
- * character set of the specified locale.
- * </p>
- * <p>
- * On platforms which there are multiple character sets for a
- * given language/country locale, the variant portion of the
- * locale will determine the character set.
- * </p>
- *
- * @param locale the <code>String</code> representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(String locale) {
- lang = country = variant = null;
- if (locale != null) {
- char sep = '_';
- int length = locale.length();
- int firstSep, secondSep;
-
- firstSep = locale.indexOf(sep);
- if (firstSep == -1) {
- firstSep = secondSep = length;
- } else {
- secondSep = locale.indexOf(sep, firstSep + 1);
- if (secondSep == -1) secondSep = length;
- }
- if (firstSep > 0) lang = locale.substring(0, firstSep);
- if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
- if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
- }
-}
-/**
- * Sets the name of the receiver.
- * <p>
- * Some platforms support font foundries. On these platforms, the name
- * of the font specified in setName() may have one of the following forms:
- * <ol>
- * <li>a face name (for example, "courier")</li>
- * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
- * </ol>
- * In either case, the name returned from getName() will include the
- * foundry.
- * </p>
- * <p>
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in <code>setName()</code> and
- * <code>getName()</code>.
- * </p>
- *
- * @param name the name of the font data (must not be null)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * </ul>
- *
- * @see #getName
- */
-public void setName(String name) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
-}
-/**
- * Sets the style of the receiver to the argument which must
- * be a bitwise OR of one or more of the <code>SWT</code>
- * constants NORMAL, BOLD and ITALIC.
- *
- * @param style the new style for this <code>FontData</code>
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- if ((style & SWT.BOLD) == SWT.BOLD)
- weight = "bold";
- else
- weight = "medium";
- if ((style & SWT.ITALIC) == SWT.ITALIC)
- slant = "i";
- else
- slant = "r";
-}
-void setXlfd(String xlfd) {
- int start, stop;
- start = 1;
- stop = xlfd.indexOf ("-", start);
- foundry = xlfd.substring(start, stop);
- if (foundry.equals("*")) foundry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- fontFamily = xlfd.substring(start, stop);
- if (fontFamily.equals("*")) fontFamily = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- weight = xlfd.substring(start, stop);
- if (weight.equals("*")) weight = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- slant = xlfd.substring(start, stop);
- if (slant.equals("*")) slant = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- setWidth = xlfd.substring(start, stop);
- if (setWidth.equals("*")) setWidth = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- addStyle = xlfd.substring(start, stop);
- if (addStyle.equals("*")) addStyle = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- String s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- pixels = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- points = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- horizontalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- verticalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- spacing = xlfd.substring(start, stop);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- averageWidth = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetRegistry = xlfd.substring(start, stop);
- if (characterSetRegistry.equals("*")) characterSetRegistry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetName = xlfd.substring(start);
- if (characterSetName.equals("*")) characterSetName = null;
-}
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * <code>FontData(String)</code> constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public String toString() {
- return "1|" + fontFamily + "|" + getHeight() + "|" + getStyle() + "|" +
- "GTK|1|" + getXlfd();
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof FontData) &&
- getXlfd().equals(((FontData)object).getXlfd()));
-}
-void error(int code) {
- throw new SWTError(code);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java
deleted file mode 100644
index b1bd432690..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * <code>FontMetrics</code> are obtained from <code>GC</code>s
- * using the <code>getFontMetrics()</code> method.
- *
- * @see GC#getFontMetrics
- */
-
-public final class FontMetrics {
- int ascent, descent, averageCharWidth, leading, height;
-FontMetrics() {
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontMetrics)) return false;
- FontMetrics metrics = (FontMetrics)object;
- return ascent == metrics.ascent && descent == metrics.descent &&
- averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
- height == metrics.height;
-}
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's <em>ascent</em> is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return ascent;
-}
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- return averageCharWidth;
-}
-/**
- * Returns the descent of the font described by the receiver. A
- * font's <em>descent</em> is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return descent;
-}
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's <em>height</em> is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return height;
-}
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's <em>leading area</em> is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return leading;
-}
-public static FontMetrics gtk_new(int fontHandle) {
- GdkFont f = new GdkFont();
- OS.memmove (f, fontHandle, GdkFont.sizeof);
-
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.ascent = f.ascent;
- fontMetrics.descent = f.descent;
- fontMetrics.averageCharWidth = OS.gdk_char_width(fontHandle, (byte)'a');
- fontMetrics.leading = 3;
- fontMetrics.height = fontMetrics.ascent+fontMetrics.descent+3;
- return fontMetrics;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java
deleted file mode 100644
index 24374928a3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java
+++ /dev/null
@@ -1,1759 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.*;
-
-
-/**
- * Class <code>GC</code> is where all of the drawing capabilities that are
- * supported by SWT are located. Instances are used to draw on either an
- * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
- * <p>
- * Application code must explicitly invoke the <code>GC.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required. This is <em>particularly</em>
- * important on Windows95 and Windows98 where the operating system has a limited
- * number of device contexts available.
- * </p>
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-public final class GC {
- /**
- * the handle to the OS device context
- * (Warning: This field is platform dependent)
- */
- public int handle;
- Drawable drawable;
- GCData data;
-
-
-/*
- * === Constructors ===
- */
-
-GC() {
-}
-
-/**
- * Constructs a new instance of this class which has been
- * configured to draw on the specified drawable. Sets the
- * foreground and background color in the GC to match those
- * in the drawable.
- * <p>
- * You must dispose the graphics context when it is no longer required.
- * </p>
- * @param drawable the drawable to draw on
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
- * <li>ERROR_INVALID_ARGUMENT
- * - if the drawable is an image that is not a bitmap or an icon
- * - if the drawable is an image or printer that is already selected
- * into another graphics context</li>
- * </ul>
- */
-public GC(Drawable drawable) {
- if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- data = new GCData();
- handle = drawable.internal_new_GC(data);
- this.drawable = drawable;
-
- // The colors we get from the widget are not always right.
- // Get the default GTK_STATE_NORMAL colors
- setBackground( DefaultGtkStyle.instance().backgroundColorNORMAL() );
- setForeground( DefaultGtkStyle.instance().foregroundColorNORMAL() );
-
-
- // Feature in GDK.
- // Sometimes, gdk_gc_new() doesn't get the font from the control,
- // and also, some controls don't contain a font; so when the GC
- // was created in internal_new_gc(), the font might or might not
- // be set; if the font isn't there, just fall back to default.
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- if (values.font == 0) {
- OS.gdk_gc_set_font(handle, DefaultGtkStyle.instance().loadDefaultFont() );
- }
-
- if (data.image != null) {
- data.image.memGC = this;
- /*
- * The transparent pixel mask might change when drawing on
- * the image. Destroy it so that it is regenerated when
- * necessary.
- */
- //if (image.transparentPixel != -1) image.destroyMask();
- }
-
-}
-
-
-
-/**
- * Returns the background color.
- *
- * @return the receiver's background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Access - Get/Set ===
- */
-
-public Color getBackground() {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- GdkColor gdkColor = _getBackgroundGdkColor();
- return Color.gtk_new(gdkColor);
-}
-/**
- * Sets the background color. The background color is used
- * for fill operations and as the background color when text
- * is drawn.
- *
- * @param color the new background color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- OS.gdk_gc_set_background(handle, color.handle);
-}
-
-/**
- * Returns the receiver's foreground color.
- *
- * @return the color used for drawing foreground things
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getForeground() {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- GdkColor gdkColor = _getForegroundGdkColor();
- return Color.gtk_new(gdkColor);
-}
-
-/**
- * Sets the foreground color. The foreground color is used
- * for drawing operations including when text is drawn.
- *
- * @param color the new foreground color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setForeground(Color color) {
- if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
- if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
- OS.gdk_gc_set_foreground(handle, color.handle);
-}
-
-
-
-
-
-
-
-/**
- * Returns the <em>advance width</em> of the specified character in
- * the font which is currently selected into the receiver.
- * <p>
- * The advance width is defined as the horizontal distance the cursor
- * should move after printing the character in the selected font.
- * </p>
- *
- * @param ch the character to measure
- * @return the distance in the x direction to move past the character before painting the next
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Access - Get - Calculated ===
- */
-
-public int getAdvanceWidth(char ch) {
- byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
- return OS.gdk_char_width(_getGCFont(), charBuffer[0]);
-}
-/**
- * Returns the width of the specified character in the font
- * selected into the receiver.
- * <p>
- * The width is defined as the space taken up by the actual
- * character, not including the leading and tailing whitespace
- * or overhang.
- * </p>
- *
- * @param ch the character to measure
- * @return the width of the character
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getCharWidth(char ch) {
- byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
- int[] lbearing = new int[1];
- int[] rbearing = new int[1];
- int[] unused = new int[1];
- OS.gdk_string_extents(_getGCFont(), charBuffer, lbearing, rbearing, unused, unused, unused);
- return rbearing[0] - lbearing[0];
-}
-/**
- * Returns the bounding rectangle of the receiver's clipping
- * region. If no clipping region is set, the return value
- * will be a rectangle which covers the entire bounds of the
- * object the receiver is drawing on.
- *
- * @return the bounding rectangle of the clipping region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getClipping() {
- if (data.clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
- return new Rectangle(0, 0, width[0], height[0]);
- }
- GdkRectangle rect = new GdkRectangle();
- OS.gdk_region_get_clipbox(data.clipRgn, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the region managed by the argument to the current
- * clipping region of the receiver.
- *
- * @param region the region to fill with the clipping region
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void getClipping(Region region) {
- if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
- int hRegion = region.handle;
- if (data.clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
- hRegion = OS.gdk_region_new();
- GdkRectangle rect = new GdkRectangle();
- rect.x = 0; rect.y = 0;
- rect.width = (short)width[0]; rect.height = (short)height[0];
- region.handle = OS.gdk_region_union_with_rect(hRegion, rect);
- return;
- }
- hRegion = OS.gdk_region_new();
- region.handle = OS.gdk_regions_union(data.clipRgn, hRegion);
-}
-/**
- * Returns the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getFont() {
- return Font.gtk_new(_getGCFont());
-}
-/**
- * Returns a FontMetrics which contains information
- * about the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return font metrics for the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-// Not done
-public FontMetrics getFontMetrics() {
- int fontHandle = _getGCFont();
- if (fontHandle==0) {
- error(SWT.ERROR_UNSPECIFIED);
- }
- GdkFont gdkFont = new GdkFont();
- OS.memmove(gdkFont, fontHandle, GdkFont.sizeof);
- byte [] w = Converter.wcsToMbcs (null, "w", true);
- return FontMetrics.gtk_new(fontHandle);
-}
-
-/**
- * Returns the receiver's line style, which will be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @return the style used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineStyle() {
- return data.lineStyle;
-}
-/**
- * Returns the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @return the receiver's line width
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineWidth() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values.line_width;
-}
-/**
- * Returns <code>true</code> if this GC is drawing in the mode
- * where the resulting color in the destination is the
- * <em>exclusive or</em> of the color values in the source
- * and the destination, and <code>false</code> if it is
- * drawing in the mode where the destination color is being
- * replaced with the source color value.
- *
- * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getXORMode() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values.function == OS.GDK_XOR;
-}
-/**
- * Returns <code>true</code> if the receiver has a clipping
- * region set into it, and <code>false</code> otherwise.
- * If this method returns false, the receiver will draw on all
- * available space in the destination. If it returns true,
- * it will draw only in the area that is covered by the region
- * that can be accessed with <code>getClipping(region)</code>.
- *
- * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isClipped() {
- return data.clipRgn != 0;
-}
-
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the arguments.
- *
- * @param x the x coordinate of the clipping rectangle
- * @param y the y coordinate of the clipping rectangle
- * @param width the width of the clipping rectangle
- * @param height the height of the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(int x, int y, int width, int height) {
- if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
- GdkRectangle rect = new GdkRectangle();
- rect.x = (short)x; rect.y = (short)y;
- rect.width = (short)width; rect.height = (short)height;
- OS.gdk_gc_set_clip_rectangle(handle, rect);
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- data.clipRgn = OS.gdk_region_union_with_rect(data.clipRgn, rect);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the argument.
- *
- * @param rect the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- setClipping (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the region specified
- * by the argument.
- *
- * @param rect the clipping region.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping(Region region) {
- if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
- if (region == null) {
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- OS.gdk_gc_set_clip_mask(handle, OS.GDK_NONE);
- } else {
- data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
- data.clipRgn = OS.gdk_regions_union(region.handle, data.clipRgn);
- OS.gdk_gc_set_clip_region(handle, region.handle);
- }
-}
-/**
- * Sets the font which will be used by the receiver
- * to draw and measure text to the argument. If the
- * argument is null, then a default font appropriate
- * for the platform will be used instead.
- *
- * @param font the new font for the receiver, or null to indicate a default font
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setFont(Font font) {
- int fontHandle = 0;
- if (font == null) {
- GtkStyle gtkStyle = new GtkStyle();
- int style = OS.gtk_widget_get_default_style();
- OS.memmove(gtkStyle, style, GtkStyle.sizeof);
- fontHandle = gtkStyle.font;
- } else {
- fontHandle = font.handle;
- }
- OS.gdk_gc_set_font(handle, fontHandle);
-}
-
-/**
- * Sets the receiver's line style to the argument, which must be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @param lineStyle the style to be used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineStyle(int lineStyle) {
- switch (lineStyle) {
- case SWT.LINE_SOLID:
- this.data.lineStyle = lineStyle;
- OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- return;
- case SWT.LINE_DASH:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2}, 2);
- break;
- case SWT.LINE_DOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {3, 1}, 2);
- break;
- case SWT.LINE_DASHDOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1}, 4);
- break;
- case SWT.LINE_DASHDOTDOT:
- OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1, 3, 1}, 6);
- break;
- default:
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.data.lineStyle = lineStyle;
- OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
-}
-/**
- * Sets the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @param lineWidth the width of a line
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineWidth(int width) {
- if (data.lineStyle == SWT.LINE_SOLID) {
- OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- } else {
- OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- }
-}
-/**
- * If the argument is <code>true</code>, puts the receiver
- * in a drawing mode where the resulting color in the destination
- * is the <em>exclusive or</em> of the color values in the source
- * and the destination, and if the argument is <code>false</code>,
- * puts the receiver in a drawing mode where the destination color
- * is replaced with the source color value.
- *
- * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setXORMode(boolean val) {
- if (val) {
- OS.gdk_gc_set_function(handle, OS.GDK_XOR);
- } else {
- OS.gdk_gc_set_function(handle, OS.GDK_COPY);
- }
-}
-/**
- * Returns the extent of the given string. No tab
- * expansion or carriage return processing will be performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point stringExtent(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- int width = OS.gdk_string_width(_getGCFont(), buffer);
- int height = OS.gdk_string_height(_getGCFont(), buffer);
- return new Point(width, height);
-}
-/**
- * Returns the extent of the given string. Tab expansion and
- * carriage return processing are performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- int width = OS.gdk_string_width(_getGCFont(), buffer);
- int height = OS.gdk_string_height(_getGCFont(), buffer);
- return new Point(width, height);
-}
-
-
-
-/*
- * === Access - Internal utils ===
- */
-
-private GdkGCValues _getGCValues() {
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- return values;
-}
-private GdkColor _getForegroundGdkColor() {
- GdkGCValues values = _getGCValues();
- GdkColor color = new GdkColor();
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- return color;
-}
-private GdkColor _getBackgroundGdkColor() {
- GdkGCValues values = _getGCValues();
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- return color;
-}
-private int _getGCFont() {
- GdkGCValues values = _getGCValues();
- if (values.font==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- return values.font;
-}
-
-
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-/*
- * === Drawing operations proper ===
- */
-
-/**
- * Copies a rectangular area of the receiver at the specified
- * position into the image, which must be of type <code>SWT.BITMAP</code>.
- *
- * @param x the x coordinate in the receiver of the area to be copied
- * @param y the y coordinate in the receiver of the area to be copied
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap or has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- Rectangle rect = image.getBounds();
- int xGC = OS.gdk_gc_new(image.pixmap);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- // is it possible/necessary to set the subwindow mode??
- OS.gdk_window_copy_area (image.pixmap, // dest window
- xGC,
- 0, 0, // dest coords
- image.pixmap, // src window
- x, y, // src coords
- rect.width, rect.height);
- OS.gdk_gc_destroy(xGC);
-}
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
- OS.gdk_window_copy_area (data.drawable, handle,
- destX, destY,
- data.drawable,
- srcX, srcY, width, height);
-}
-
-/**
- * Draws the outline of a circular or elliptical arc
- * within the specified rectangular area.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be drawn
- * @param y the y coordinate of the upper-left corner of the arc to be drawn
- * @param width the width of the arc to be drawn
- * @param height the height of the arc to be drawn
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, startAngle * 64, endAngle * 64);
-}
-/**
- * Draws a rectangle, based on the specified arguments, which has
- * the appearance of the platform's <em>focus rectangle</em> if the
- * platform supports such a notion, and otherwise draws a simple
- * rectangle in the receiver's forground color.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void drawFocus(int x, int y, int width, int height) {
- GtkStyle style = new GtkStyle();
- int hStyle = OS.gtk_widget_get_default_style();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Draws the given image in the receiver at the specified
- * coordinates.
- *
- * @param image the image to draw
- * @param x the x coordinate of where to draw
- * @param y the y coordinate of where to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int x, int y) {
- if (image == null) error(SWT.ERROR_NULL_ARGUMENT);
- int pixmap = image.pixmap;
- int [] unused = new int [1]; int [] width = new int [1]; int [] height = new int [1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
- drawImage(image, 0, 0, width[0], height[0], x, y, width[0], height[0]);
-}
-
-/**
- * Copies a rectangular area from the source image into a (potentially
- * different sized) rectangular area in the receiver. If the source
- * and destination areas are of differing sizes, then the source
- * area will be stretched or shrunk to fit the destination area
- * as it is copied. The copy fails if any of the given coordinates
- * are negative or lie outside the bounds of their respective images.
- *
- * @param image the source image
- * @param srcX the x coordinate in the source image to copy from
- * @param srcY the y coordinate in the source image to copy from
- * @param srcWidth the width in pixels to copy from the source
- * @param srcHeight the height in pixels to copy from the source
- * @param destX the x coordinate in the destination to copy to
- * @param destY the y coordinate in the destination to copy to
- * @param destWidth the width in pixels of the destination rectangle
- * @param destHeight the height in pixels of the destination rectangle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- /* basic sanity checks */
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
- if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- /* source image properties */
- int[] width = new int[1];
- int[] height = new int[1];
- int[] unused = new int[1];
- OS.gdk_window_get_geometry(srcImage.pixmap, unused, unused, width, height, unused);
- if ((srcY + srcWidth > width[0]) ||
- (srcY + srcHeight > height[0])) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /* Special case: If we don't need to scale, and there is no alpha/mask,
- * then we can just blit the image inside the X server - no net traffic
- */
- boolean needScaling = (srcWidth != destWidth) || (srcHeight != destHeight);
- boolean simple = !needScaling & (srcImage.mask == 0);
-
- if (simple) {
- OS.gdk_draw_pixmap(data.drawable, handle, srcImage.pixmap,
- srcX, srcY,
- destX, destY,
- width[0], height[0]);
- return;
- }
-
-
- /* Fetch a local GdkPixbuf from server */
- Pixbuffer pixbuf = new Pixbuffer(srcImage);
-
- /* Scale if necessary */
- if ((srcWidth != destWidth) || (srcHeight != destHeight)) {
- double scale_x = (double)destWidth / (double)srcWidth;
- double scale_y = (double)destHeight / (double)srcHeight;
- double offset_x = - srcX * scale_x;
- double offset_y = - srcY * scale_y;
-
- int destSizePixbuf = GDKPIXBUF.gdk_pixbuf_new (
- GDKPIXBUF.GDK_COLORSPACE_RGB,
- true, 8, destWidth, destHeight);
- GDKPIXBUF.gdk_pixbuf_scale(
- pixbuf.handle, // src,
- destSizePixbuf,
- 0,
- 0,
- destWidth, destHeight,
- offset_x, offset_y,
- scale_x, scale_y,
- GDKPIXBUF.GDK_INTERP_BILINEAR);
- pixbuf.handle = destSizePixbuf;
- }
-
- /* Paint it */
- GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(
- pixbuf.handle,
- data.drawable,
- 0, 0,
- destX, destY,
- destWidth, destHeight,
- GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
- GDKPIXBUF.GDK_RGB_DITHER_NORMAL,
- 0, 0
- );
-}
-
-/**
- * Draws a line, using the foreground color, between the points
- * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
- *
- * @param x1 the first point's x coordinate
- * @param y1 the first point's y coordinate
- * @param x2 the second point's x coordinate
- * @param y2 the second point's y coordinate
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawLine(int x1, int y1, int x2, int y2) {
- OS.gdk_draw_line (data.drawable, handle, x1, y1, x2, y2);
-}
-/**
- * Draws the outline of an oval, using the foreground color,
- * within the specified rectangular area.
- * <p>
- * The result is a circle or ellipse that fits within the
- * rectangle specified by the <code>x</code>, <code>y</code>,
- * <code>width</code>, and <code>height</code> arguments.
- * </p><p>
- * The oval covers an area that is <code>width + 1</code>
- * pixels wide and <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper left corner of the oval to be drawn
- * @param y the y coordinate of the upper left corner of the oval to be drawn
- * @param width the width of the oval to be drawn
- * @param height the height of the oval to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawOval(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, 0, 23040);
-}
-/**
- * Draws the closed polygon which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the vertices of the polygon. Lines are drawn between
- * each consecutive pair, and between the first pair and last pair in the
- * array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolygon(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- OS.gdk_draw_polygon(data.drawable, handle, 0, points, points.length / 2);
-}
-/**
- * Draws the polyline which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the corners of the polyline. Lines are drawn between
- * each consecutive pair, but not between the first pair and last pair in
- * the array.
- *
- * @param pointArray an array of alternating x and y values which are the corners of the polyline
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolyline(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- OS.gdk_draw_lines(data.drawable, handle, points, points.length / 2);
-}
-/**
- * Draws the outline of the rectangle specified by the arguments,
- * using the receiver's foreground color. The left and right edges
- * of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
-}
-/**
- * Draws the outline of the specified rectangle, using the receiver's
- * foreground color. The left and right edges of the rectangle are at
- * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
- * and bottom edges are at <code>rect.y</code> and
- * <code>rect.y + rect.height</code>.
- *
- * @param rect the rectangle to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Draws the outline of the round-cornered rectangle specified by
- * the arguments, using the receiver's foreground color. The left and
- * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- * The <em>roundness</em> of the corners is specified by the
- * <code>arcWidth</code> and <code>arcHeight</code> arguments.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny -nh;
- }
- if (naw < 0) naw = 0 - naw;
- if (nah < 0) nah = 0 - nah;
-
- int naw2 = Compatibility.floor(naw, 2);
- int nah2 = Compatibility.floor(nah, 2);
-
- OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny, naw, nah, 5760, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny + nh - nah, naw, nah, 11520, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
- OS.gdk_draw_line(data.drawable, handle, nx,ny + nah2, nx, ny + nh - nah2);
- OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
- OS.gdk_draw_line(data.drawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. The background of the rectangular area where
- * the string is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y) {
- drawString(string, x, y, false);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the string is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString(String string, int x, int y, boolean isTransparent) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
- int[] unused = new int[1];
- int[] width = new int[1];
- int[] ascent = new int[1];
- int[] average_ascent = new int [1];
- int fontHandle = _getGCFont();
- OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
- OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
- if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
- if (!isTransparent) {
- int height = OS.gdk_string_height(fontHandle, buffer);
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
- }
- OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. The background of the rectangular area where
- * the text is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText(String string, int x, int y) {
- drawText(string, x, y, false);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText(String string, int x, int y, boolean isTransparent) {
- if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
- int fontHandle = _getGCFont();
- int[] unused = new int[1];
- int[] width = new int[1];
- int[] ascent = new int[1];
- int[] average_ascent = new int [1];
- OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
- OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
- if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
- if (!isTransparent) {
- int height = OS.gdk_string_height(fontHandle, buffer);
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
- }
- OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion, line delimiter and mnemonic
- * processing are performed according to the specified flags. If
- * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- * <p>
- * The parameter <code>flags</code> may be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * </p>
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param flags the flags specifing how to process the text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, int flags) {
- // NOT IMPLEMENTED
- drawText(string, x, y, (flags & SWT.DRAW_TRANSPARENT) != 0);
-}
-
-/**
- * Fills the interior of a circular or elliptical arc within
- * the specified rectangular area, with the receiver's background
- * color.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be filled
- * @param y the y coordinate of the upper-left corner of the arc to be filled
- * @param width the width of the arc to be filled
- * @param height the height of the arc to be filled
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawArc
- */
-public void fillArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, startAngle * 64, endAngle * 64);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-
-/**
- * Fills the interior of the specified rectangle with a gradient
- * sweeping from left to right or top to bottom progressing
- * from the receiver's foreground color to its background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled, may be negative
- * (inverts direction of gradient if horizontal)
- * @param height the height of the rectangle to be filled, may be negative
- * (inverts direction of gradient if vertical)
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if ((width == 0) || (height == 0)) return;
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor foregroundGdkColor = new GdkColor();
-
- RGB backgroundRGB, foregroundRGB;
- backgroundRGB = Color.gtk_getRGBIntensities(_getBackgroundGdkColor());
- foregroundRGB = Color.gtk_getRGBIntensities(_getForegroundGdkColor());
-
- RGB fromRGB, toRGB;
- fromRGB = foregroundRGB;
- toRGB = backgroundRGB;
- boolean swapColors = false;
- if (width < 0) {
- x += width; width = -width;
- if (! vertical) swapColors = true;
- }
- if (height < 0) {
- y += height; height = -height;
- if (vertical) swapColors = true;
- }
- if (swapColors) {
- fromRGB = backgroundRGB;
- toRGB = foregroundRGB;
- }
- if (fromRGB == toRGB) {
- fillRectangle(x, y, width, height);
- return;
- }
- ImageData.fillGradientRectangle(this, Display.getCurrent(),
- x, y, width, height, vertical, fromRGB, toRGB,
- 8, 8, 8);
-}
-
-/**
- * Fills the interior of an oval, within the specified
- * rectangular area, with the receiver's background
- * color.
- *
- * @param x the x coordinate of the upper left corner of the oval to be filled
- * @param y the y coordinate of the upper left corner of the oval to be filled
- * @param width the width of the oval to be filled
- * @param height the height of the oval to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawOval
- */
-public void fillOval(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, 0, 23040);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the closed polygon which is defined by the
- * specified array of integer coordinates, using the receiver's
- * background color. The array contains alternating x and y values
- * which are considered to represent points which are the vertices of
- * the polygon. Lines are drawn between each consecutive pair, and
- * between the first pair and last pair in the array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawPolygon
- */
-public void fillPolygon(int[] pointArray) {
- if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
- short[] points = new short[pointArray.length];
- for (int i = 0; i < pointArray.length; i++) {
- points[i] = (short)pointArray[i];
- }
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_polygon(data.drawable, handle, 1, points, points.length / 2);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the rectangle specified by the arguments,
- * using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle(int x, int y, int width, int height) {
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width, height);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-/**
- * Fills the interior of the specified rectangle, using the receiver's
- * background color.
- *
- * @param rectangle the rectangle to be filled
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- fillRectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Fills the interior of the round-cornered rectangle specified by
- * the arguments, using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRoundRectangle
- */
-public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny -nh;
- }
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- naw = Math.min(naw,nw);
- nah = Math.min(nah, nh);
-
- int naw2 = Compatibility.round(naw, 2);
- int nah2 = Compatibility.round(nah, 2);
-
- GdkGCValues values = new GdkGCValues();
- OS.gdk_gc_get_values(handle, values);
- GdkColor color = new GdkColor();
- color.pixel = values.background_pixel;
- color.red = values.background_red;
- color.green = values.background_green;
- color.blue = values.background_blue;
- OS.gdk_gc_set_foreground(handle, color);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny, naw, nah, 5760, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny + nh - nah, naw, nah, 11520, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + naw2, ny, nw - naw, nh);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx, ny + nah2, naw2, nh - nah);
- OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + nw - (naw / 2), ny + nah2, naw2, nh -nah);
- color.pixel = values.foreground_pixel;
- color.red = values.foreground_red;
- color.green = values.foreground_green;
- color.blue = values.foreground_blue;
- OS.gdk_gc_set_foreground(handle, color);
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-/*
- * === As yet unclassified ===
- */
-
-public boolean equals(Object object) {
- return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns <code>true</code> if the GC has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the GC.
- * When a GC has been disposed, it is an error to
- * invoke any other method using the GC.
- *
- * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-/**
- * Disposes of the operating system resources associated with
- * the graphics context. Applications must dispose of all GCs
- * which they allocate.
- */
-public void dispose() {
- if (handle == 0) return;
-
- /* Free resources */
- int clipRgn = data.clipRgn;
- if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
- Image image = data.image;
- if (image != null) image.memGC = null;
-
- /* Dispose the GC */
- if(drawable == null)
- OS.gdk_gc_unref(handle);
- else
- drawable.internal_dispose_GC(handle, data);
-
- data.drawable = // data.colormap = data.fontList =
- data.clipRgn = data.renderTable = 0;
- drawable = null;
- data.image = null;
- data = null;
- handle = 0;
-
-}
-
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "GC {*DISPOSED*}";
- return "GC {" + handle + "}";
-}
-
-/**
- * Returns the extent of the given string. Tab expansion, line
- * delimiter and mnemonic processing are performed according to
- * the specified flags, which can be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @param flags the flags specifing how to process the text
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string, int flags) {
- //NOT IMPLEMENTED
- return textExtent(string);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java
deleted file mode 100644
index ad7b9c7fc2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are descriptions of GCs in terms
- * of unallocated platform-specific data fields.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
- * API for SWT. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms, and should never be called from application code.
- * </p>
- *
- * @private
- */
-public final class GCData {
- public Image image;
- public int drawable;
- public int clipRgn;
- public int lineStyle = SWT.LINE_SOLID;
- public int renderTable;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java
deleted file mode 100644
index f733122bf4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java
+++ /dev/null
@@ -1,650 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.*;
-import java.io.*;
-
-/**
- * Instances of this class are graphics which have been prepared
- * for display on a specific device. That is, they are ready
- * to paint using methods such as <code>GC.drawImage()</code>
- * and display on widgets with, for example, <code>Button.setImage()</code>.
- * <p>
- * If loaded from a file format that supports it, an
- * <code>Image</code> may have transparency, meaning that certain
- * pixels are specified as being transparent when drawn. Examples
- * of file formats that support transparency are GIF and PNG.
- * </p><p>
- * There are two primary ways to use <code>Images</code>.
- * The first is to load a graphic file from disk and create an
- * <code>Image</code> from it. This is done using an <code>Image</code>
- * constructor, for example:
- * <pre>
- * Image i = new Image(device, "C:\\graphic.bmp");
- * </pre>
- * A graphic file may contain a color table specifying which
- * colors the image was intended to possess. In the above example,
- * these colors will be mapped to the closest available color in
- * SWT. It is possible to get more control over the mapping of
- * colors as the image is being created, using code of the form:
- * <pre>
- * ImageData data = new ImageData("C:\\graphic.bmp");
- * RGB[] rgbs = data.getRGBs();
- * // At this point, rgbs contains specifications of all
- * // the colors contained within this image. You may
- * // allocate as many of these colors as you wish by
- * // using the Color constructor Color(RGB), then
- * // create the image:
- * Image i = new Image(device, data);
- * </pre>
- * <p>
- * Applications which require even greater control over the image
- * loading process should use the support provided in class
- * <code>ImageLoader</code>.
- * </p><p>
- * Application code must explicitely invoke the <code>Image.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see Color
- * @see ImageData
- * @see ImageLoader
- */
-public final class Image implements Drawable{
-
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
- */
- public int type;
-
- /**
- * The handle to the OS pixmap resource.
- * Warning: This field is platform dependent.
- */
- public int pixmap;
-
- /**
- * The handle to the OS mask resource.
- * Warning: This field is platform dependent.
- */
- public int mask;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
- /**
- * specifies the transparent pixel
- * (Warning: This field is platform dependent)
- */
- int transparentPixel = -1;
-
- /**
- * The GC the image is currently selected in.
- * Warning: This field is platform dependent.
- */
- GC memGC;
-
- /**
- * The alpha data of the image.
- * Warning: This field is platform dependent.
- */
- byte[] alphaData;
-
- /**
- * The global alpha value to be used for every pixel.
- * Warning: This field is platform dependent.
- */
- int alpha = -1;
-
- /**
- * Specifies the default scanline padding.
- * Warning: This field is platform dependent.
- */
- static final int DEFAULT_SCANLINE_PAD = 4;
-
-
-
-/*
- * CONSTRUCTORS
- */
-
-Image() {
-}
-
-/**
- * Constructs an empty instance of this class with the
- * specified width and height. The result may be drawn upon
- * by creating a GC and using any of its drawing operations,
- * as shown in the following example:
- * <pre>
- * Image i = new Image(device, width, height);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param width the width of the new image
- * @param height the height of the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
- * </ul>
- */
-public Image(Device display, int width, int height) {
- init(display, width, height);
-}
-
-/**
- * Constructs a new instance of this class based on the
- * provided image, with an appearance that varies depending
- * on the value of the flag. The possible flag values are:
- * <dl>
- * <dt><b>IMAGE_COPY</b></dt>
- * <dd>the result is an identical copy of srcImage</dd>
- * <dt><b>IMAGE_DISABLE</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
- * <dt><b>IMAGE_GRAY</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
- * </dl>
- *
- * @param device the device on which to create the image
- * @param srcImage the image to use as the source
- * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
- * is otherwise in an invalid state</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
-public Image(Device device, Image srcImage, int flag) {
- /* basic sanity */
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.type = srcImage.type;
- this.mask = 0;
-
- /* this is somewhat ugly, because this dilutes the encapsulation
- * of knowledge about what the cloning operations do (e.g., the
- * following lines assume graying and disabling don't change alpha)
- */
- this.alphaData = srcImage.alphaData;
- this.alpha = srcImage.alpha;
- this.transparentPixel = srcImage.transparentPixel;
- // bogus - are we sure about memGC?
-
- /* Special case:
- * If all we want is just a clone of the existing pixmap, it can
- * be done entirely in the X server, without copying across the net.
- */
- if (flag == SWT.IMAGE_COPY) {
- int[] unused = new int[1];
- int[] width = new int[1]; int[] height = new int[1];
- int[] depth = new int[1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, depth);
- pixmap = OS.gdk_pixmap_new (0, width[0], height[0], depth[0]);
- int gc = OS.gdk_gc_new (pixmap);
- OS.gdk_draw_pixmap(pixmap, gc, srcImage.pixmap,
- 0,0,0,0, width[0], height[0]);
- OS.gdk_gc_destroy(gc);
- transparentPixel = srcImage.transparentPixel;
- alpha = srcImage.alpha;
- if (srcImage.alphaData != null) {
- alphaData = new byte[srcImage.alphaData.length];
- System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
- }
-
- /* we are not quite done yet. Need to copy the maskData */
- if (srcImage.mask != 0) {
- /* Generate the mask if necessary. */
-// if (srcImage.transparentPixel != -1) srcImage.createMask();
- mask = OS.gdk_pixmap_new(0, width[0], height[0], 1);
- gc = OS.gdk_gc_new(mask);
- OS.gdk_draw_pixmap(mask, gc, srcImage.mask,
- 0,0,0,0, width[0], height[0]);
- OS.gdk_gc_destroy(gc);
- /* Destroy the image mask if the there is a GC created on the image */
- if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
- }
-
-
- return;
- }
-
-
-
-
- Pixbuffer pb = new Pixbuffer(srcImage);
- Pixbuffer pb2 = new Pixbuffer(pb, flag);
- pb2.toImage(this);
-
-
-}
-
-/**
- * Constructs an empty instance of this class with the
- * width and height of the specified rectangle. The result
- * may be drawn upon by creating a GC and using any of its
- * drawing operations, as shown in the following example:
- * <pre>
- * Image i = new Image(device, boundsRectangle);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param bounds a rectangle specifying the image's width and height (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
- * </ul>
- */
-public Image(Device display, Rectangle bounds) {
- if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(display, bounds.width, bounds.height);
-}
-
-/**
- * Constructs an instance of this class from the given
- * <code>ImageData</code>.
- *
- * @param device the device on which to create the image
- * @param data the image data to create the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
- * </ul>
- */
-public Image(Device display, ImageData image) {
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, image);
-}
-
-/**
- * Constructs an instance of this class, whose type is
- * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
- * objects. The two images must be the same size, and the mask image
- * must have a color depth of 1. Pixel transparency in either image
- * will be ignored. If either image is an icon to begin with, an
- * exception is thrown.
- * <p>
- * The mask image should contain white wherever the icon is to be visible,
- * and black wherever the icon is to be transparent. In addition,
- * the source image should contain black wherever the icon is to be
- * transparent.
- * </p>
- *
- * @param device the device on which to create the icon
- * @param source the color data for the icon
- * @param mask the mask data for the icon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
- * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
- * if the mask is not monochrome, or if either the source or mask
- * is already an icon</li>
- * </ul>
- */
-public Image(Device display, ImageData source, ImageData mask) {
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- if (source.width != mask.width || source.height != mask.height) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- ImageData image;
- if (source.depth != 1)
- image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
- else {
- image = source.getTransparencyMask(); //create an imagedata with scanlinepad == 1 and invalid data
- int[] row = new int[source.width];
- for (int y = 0; y < source.height; y++) {
- source.getPixels(0, y, source.width, row, 0);
- image.setPixels(0, y, source.width, row, 0);
- }//change source data format from scanlinePad == 4 to scanlinePad == 1;
-
- }
- image.type = SWT.ICON;
- image.maskPad = mask.scanlinePad;
- image.maskData = mask.data;
- init(display, image);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the specified input stream. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p><p>
- * This constructor may be used to load a resource as follows:
- * </p>
- * <pre>
- * new Image(device, clazz.getResourceAsStream("file.gif"));
- * </pre>
- *
- * @param device the device on which to create the image
- * @param stream the input stream to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device display, InputStream stream) {
- if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, new ImageData(stream));
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the file with the specified name. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading
- * a single image only. If the specified file contains
- * multiple images, only the first one will be used.
- *
- * @param device the device on which to create the image
- * @param filename the name of the file to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device display, String filename) {
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getDefault();
- init(display, new ImageData(filename));
-}
-
-/**
- * Destroy the receiver's mask if it exists.
- */
-void destroyMask() {
- if (mask == 0) return;
- OS.gdk_bitmap_unref(mask);
- mask = 0;
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the image. Applications must dispose of all images which
- * they allocate.
- */
-public void dispose () {
- if (pixmap != 0) OS.gdk_pixmap_unref(pixmap);
- if (mask != 0) OS.gdk_pixmap_unref(mask);
- pixmap = mask = 0;
- memGC = null;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof Image) &&
- (pixmap == ((Image)object).pixmap) &&
- (mask == ((Image)object).mask));
-}
-
-/**
- * Returns the color to which to map the transparent pixel, or null if
- * the receiver has no transparent pixel.
- * <p>
- * There are certain uses of Images that do not support transparency
- * (for example, setting an image into a button or label). In these cases,
- * it may be desired to simulate transparency by using the background
- * color of the widget to paint the transparent pixels of the image.
- * Use this method to check which color will be used in these cases
- * in place of transparency. This value may be set with setBackground().
- * <p>
- *
- * @return the background color of the image, or null if there is no transparency in the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- return null;
-}
-
-/**
- * Sets the color to which to map the transparent pixel.
- * <p>
- * There are certain uses of <code>Images</code> that do not support
- * transparency (for example, setting an image into a button or label).
- * In these cases, it may be desired to simulate transparency by using
- * the background color of the widget to paint the transparent pixels
- * of the image. This method specifies the color that will be used in
- * these cases. For example:
- * <pre>
- * Button b = new Button();
- * image.setBackground(b.getBackground());>
- * b.setImage(image);
- * </pre>
- * </p><p>
- * The image may be modified by this operation (in effect, the
- * transparent regions may be filled with the supplied color). Hence
- * this operation is not reversible and it is not legal to call
- * this function twice or with a null argument.
- * </p><p>
- * This method has no effect if the receiver does not have a transparent
- * pixel value.
- * </p>
- *
- * @param color the color to use when a transparent pixel is specified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-}
-
-/**
- * Returns the bounds of the receiver. The rectangle will always
- * have x and y values of 0, and the width and height of the
- * image.
- *
- * @return a rectangle specifying the image's bounds
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- */
-public Rectangle getBounds() {
- int[] unused = new int[1]; int[] width = new int[1]; int[] height = new int[1];
- OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
- return new Rectangle(0, 0, width[0], height[0]);
-
-}
-/**
- * Returns an <code>ImageData</code> based on the receiver
- * Modifications made to this <code>ImageData</code> will not
- * affect the Image.
- *
- * @return an <code>ImageData</code> containing the image's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- *
- * @see ImageData
- */
-public ImageData getImageData() {
- return new Pixbuffer(this).getImageData();
-}
-
-public static Image gtk_new(int type, int pixmap, int mask) {
- Image image = new Image();
- image.type = type;
- image.pixmap = pixmap;
- image.mask = mask;
- return image;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return pixmap;
-}
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (type != SWT.BITMAP || memGC != null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- data.image = this;
- int gc = OS.gdk_gc_new(pixmap);
- data.drawable = pixmap;
- return gc;
-}
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int gc, GCData data) {
- OS.gdk_gc_unref(gc);
-}
-
-void init(Device display, int width, int height) {
- device = display;
- GdkVisual visual = new GdkVisual ();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- this.pixmap = OS.gdk_pixmap_new(0, width, height, visual.depth);
- if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Fill the bitmap with white */
- GdkColor white = new GdkColor();
- int colormap = OS.gdk_colormap_get_system();
- OS.gdk_color_white(colormap, white);
- int gc = OS.gdk_gc_new(pixmap);
- OS.gdk_gc_set_foreground(gc, white);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0, 0, width, height);
- OS.gdk_gc_destroy(gc);
- OS.gdk_colors_free(colormap, new int[] { white.pixel }, 1, 0);
- this.type = SWT.BITMAP;
-}
-
-void init(Device display, ImageData image) {
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (display == null) display = Display.getCurrent();
- device = display;
-
- /*
- * We don't really care about the real depth of the ImageData we are
- * given. We stretch everything to 24bpp which is the native GdkPixbuffer
- * depth. HOWEVER, there is one situation where this is not acceptable,
- * namely bitmaps (1bpp), because they may be used in contexts that are
- * sensitive to pixmap depth.
- */
- Pixbuffer buff = new Pixbuffer(image);
- buff.toImage(this);
- return;
-}
-
-/**
- * Returns <code>true</code> if the image has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the image.
- * When an image has been disposed, it is an error to
- * invoke any other method using the image.
- *
- * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return pixmap == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return "Image {" + pixmap + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java
deleted file mode 100644
index 460a3bbb6c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java
+++ /dev/null
@@ -1,492 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * This class is <strong>not</strong> part of the SWT API,
- * and its existence is not relevant for application programmers.
- *
- * Pixbuffer represents local GdkPixbuf images on the client.
- */
-final class Pixbuffer {
-
- /* the handle to the OS resource.
- All state is kept in the OS */
- int handle;
-
- /* pointer to the actual pixel array */
- int data;
-
- /* whether the alpha data in the pixbuf is due to
- a transparency mask or an alpha channel */
- boolean hasMask = false;
- boolean hasAlpha = false;
- int constantAlpha = -1;
- int transparentPixel = -1;
-
-
- /*
- * Constructors.
- * There are three ways to create a Pixbuffer:
- * pull one from a Drawable, create from ImageData,
- * or clone an existing Pixbuffer.
- */
-
- private Pixbuffer() {}
-
- /**
- * Pull a Pixbuffer from an Image living on the X Server
- * (making this operation expensive).
- */
- Pixbuffer (Image src) {
- if (src == null || src.pixmap == 0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(src.pixmap, unused, unused, w, h, unused);
- int width = w[0];
- int height = h[0];
-
- // create the actual OS resource
- createHandle(width, height);
-
- // pull the color data
- int cmap = OS.gdk_colormap_get_system();
- GDKPIXBUF.gdk_pixbuf_get_from_drawable(
- handle,
- src.pixmap,
- cmap,
- 0,0,0,0,
- width, height);
-
- // the tricky part is alpha
- if (src.alphaData != null) fillAlphaFromAlphaBytes(src.alphaData);
- else if (src.alpha != -1) fillConstantAlpha(src.alpha);
- else if (src.mask != 0) fillAlphaFromPixmapMask(src.mask);
- else if (src.transparentPixel != -1) fillAlphaFromTransparentPixel(src.pixmap, src.transparentPixel);
- else fillOpaque();
- }
-
- /**
- * Create a Pixbuffer from image data.
- */
- Pixbuffer (ImageData src) {
- if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- createHandle(src.width, src.height);
-
- // populate the pixbuf with data
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- int dataSize = src.height*stride;
- byte[] bytes = new byte[dataSize];
- switch (src.getTransparencyType()) {
- case SWT.TRANSPARENCY_ALPHA: _blit2platformAlpha(bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_MASK: _blit2platformMask (bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_PIXEL: _blit2platformPixel(bytes, src, src.width, src.height, stride); break;
- case SWT.TRANSPARENCY_NONE: _blit2platformNone (bytes, src, src.width, src.height, stride); break;
- }
- OS.memmove(data, bytes, dataSize);
- }
-
- /**
- * Clone an existing Pixbuffer (possibly making it look
- * grayed out or disabled)
- */
- Pixbuffer (Pixbuffer src, int flag) {
- if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (src.handle==0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.hasAlpha = src.hasAlpha;
- this.constantAlpha = src.constantAlpha;
- this.hasMask = src.hasMask;
-
- /* First, get a copy all our own */
- handle = GDKPIXBUF.gdk_pixbuf_copy(src.handle);
- data = GDKPIXBUF.gdk_pixbuf_get_pixels(this.handle);
-
- // simplest case - just clone what we have
- if (flag==SWT.IMAGE_COPY) return;
-
- // gather some information we will need for disabling or graying
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
- int dataSize = height * stride;
- byte[] bytes = new byte[dataSize];
- OS.memmove(bytes,data,dataSize);
- int lineAddress = 0;
- int pixelAddress;
-
- if (flag==SWT.IMAGE_DISABLE) {
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
-
- int intensity =
- bytes[pixelAddress+0] * bytes[pixelAddress+0] +
- bytes[pixelAddress+1] * bytes[pixelAddress+1] +
- bytes[pixelAddress+2] * bytes[pixelAddress+2];
- byte value = (intensity < 9000)?
- (byte)0 : (byte) 255;
- bytes[pixelAddress+0] = bytes[pixelAddress+1] = bytes[pixelAddress+2] = value;
- // no change to alpha
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- return;
- }
-
- if (flag==SWT.IMAGE_GRAY) {
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
- int intensity =
- (bytes[pixelAddress+0] +
- bytes[pixelAddress+1] +
- bytes[pixelAddress+2] ) / 3;
- bytes[pixelAddress+0] = (byte)intensity;
- bytes[pixelAddress+1] = (byte)intensity;
- bytes[pixelAddress+2] = (byte)intensity;
- // no change to alpha
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- return;
- }
-
- // flag is neither COPY nor DISABLE nor GRAY
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
-
- /**
- * Push the pixbuf to the X Server
- */
- void toImage (Image dest) {
- if (dest==null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int w = getWidth();
- int h = getHeight();
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- dest.pixmap = OS.gdk_pixmap_new (0, w, h, visual.depth);
- dest.mask = 0; // for now; we fill it later in this method
- GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(handle, // src
- dest.pixmap, // dest drawable
- 0,0, 0,0,
- w, h,
- GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
- GDKPIXBUF.GDK_RGB_DITHER_NORMAL, 0,0);
-
- // now the mask, if any
- if (hasMask) {
- // bring the pixel data into Java memory
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- byte[] srcBytes = new byte[h*stride];
- OS.memmove(srcBytes, data, h*stride);
-
- // the mask lines are padded to 4 bytes, that is 32 pixels
- int maskwpl = w/32; if (w%32!=0) maskwpl+=1;
- int maskBpl = maskwpl*4; // Bytes per line for the mask
- byte[] bytes = new byte[h * maskBpl];
- for (int y=0; y<h; y++) {
- int lineAddress = y * maskBpl;
- for (int x=0; x<w; x++)
- if (srcBytes[y*stride + x*4 + 3] != 0) {
- int byteAddress = lineAddress + x/8;
- int bit = 1<<(x%8);
- bytes[byteAddress] |= (byte)bit;
- } // if
- } // for y
- dest.mask = OS.gdk_bitmap_create_from_data(0, bytes, maskBpl*8, h);
- } // hasMask
-
- else if (hasAlpha) {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
-
- else if (constantAlpha!=-1) {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
-
- /**
- * Return the ImageData for the receiver.
- */
- ImageData getImageData() {
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- byte[] bytes = _getDataBytes();
- ImageData answer = new ImageData(width, height, 24, new PaletteData(0xFF0000, 0x00FF00, 0x0000FF));
-
- if (hasMask) {
- answer.maskData = new byte[((width+7)/8)*height];
- answer.maskPad = 1;
- }
-
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int address = y*stride + x*4;
- byte r = bytes[address+0];
- byte g = bytes[address+1];
- byte b = bytes[address+2];
- answer.setPixel(x,y, r<<16+g<<8+b);
- byte alpha = bytes[address+3];
- if (hasAlpha) {
- answer.setAlpha(x,y, alpha);
- }
- if (hasMask && (alpha!=0)) {
- // Find out where to stab the bit
- int mask_bytes_per_line = (width+7) / 8;
- int x_inside_line = x / 8;
- int shift_inside_byte = x - (x_inside_line*8);
- answer.maskData[x_inside_line + (y*mask_bytes_per_line)] |= (128 >> shift_inside_byte);
- }
- }
- if (constantAlpha!=-1) answer.alpha = constantAlpha;
- return answer;
- }
-
- int getWidth() {
- return GDKPIXBUF.gdk_pixbuf_get_width (handle);
- }
-
- int getHeight() {
- return GDKPIXBUF.gdk_pixbuf_get_height (handle);
- }
-
-
- /**
- * Actually create the OS resource.
- * No matter what, the GdkPixbuf we create always has
- * an alpha channel.
- */
- private void createHandle(int width, int height) {
- handle = GDKPIXBUF.gdk_pixbuf_new(GDKPIXBUF.GDK_COLORSPACE_RGB,
- true,
- 8,
- width, height);
- if (this.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- data = GDKPIXBUF.gdk_pixbuf_get_pixels(handle);
- }
-
- private void fillAlphaFromPixmapMask(int mask) {
- hasMask = true;
-
- /* pull the mask data from the X Server */
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(mask, unused, unused, w, h, unused);
- int width = Math.min(w[0], getWidth());
- int height = Math.min(h[0], getHeight());
- /* Get the data */
- int xMaskPtr = OS.gdk_image_get(mask, 0, 0, width, height);
- if (xMaskPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* stuff the alpha values */
- byte[] bytes = _getDataBytes();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int pixel_value = OS.gdk_image_get_pixel(xMaskPtr, x, y);
- if (pixel_value==0) bytes[y*stride + x*4 +3] = 0;
- else if (pixel_value==1) bytes[y*stride + x*4 +3] = (byte)255;
- else { System.out.println("GDK insanity: bitmap contains bits other than 0 or 1"); SWT.error(SWT.ERROR_UNSPECIFIED); }
- }
- /* move it back */
- OS.memmove(data, bytes, bytes.length);
- }
-
- private void fillAlphaFromTransparentPixel(int pm, int pixel) {
- transparentPixel = pixel;
-
- /* pull the data from the X Server */
- // get the geometry
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- int[] d = new int[1];
- OS.gdk_window_get_geometry(pm, unused, unused, w, h, unused);
- int width = Math.min(w[0], getWidth());
- int height = Math.min(h[0], getHeight());
- /* Get the data */
- int xImage = OS.gdk_image_get(pm, 0, 0, width, height);
- if (xImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* stuff the alpha values */
- byte[] bytes = _getDataBytes();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- for (int y=0; y<height; y++)
- for (int x=0; x<width; x++) {
- int pixel_value = OS.gdk_image_get_pixel(xImage, x, y);
- if (pixel_value==pixel) bytes[y*stride + x*4 +3] = 0;
- else bytes[y*stride + x*4 +3] = (byte)255;
- }
- /* move it back */
- OS.memmove(data, bytes, bytes.length);
- }
-
- private void fillAlphaFromAlphaBytes(byte[] alpha) {
- hasAlpha = true;
- SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- }
-
- private void fillConstantAlpha(int alpha) {
- if ((alpha<0)||(alpha>255)) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- constantAlpha = alpha;
- _fillConstantAlpha((byte)alpha);
- }
-
- private void fillOpaque() {
- _fillConstantAlpha((byte)255);
- }
-
- /**
- * Assume the handle represents a valid GdkPixbuf,
- * and data is pointing to the correct location in memory.
- * Fill all alpha bytes with the specified value.
- */
- private void _fillConstantAlpha (byte value) {
- // first, get some technical info
- int width = getWidth();
- int height = getHeight();
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
- int dataSize = height * stride;
- byte[] bytes = new byte[dataSize];
- OS.memmove(bytes,data,dataSize);
- int lineAddress = 0;
- int pixelAddress;
-
- // set all alpha bytes to 255
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- pixelAddress = lineAddress+x*4;
- bytes[pixelAddress+3] = value;
- }
- lineAddress += stride;
- }
- /* move it back */
- OS.memmove(data, bytes, dataSize);
- }
-
- private void _blit2platformNone (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride)
- {
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)255;
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformAlpha (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride)
- {
- hasAlpha = true;
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)source.getAlpha(x,y);
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformPixel (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride
- )
- {
- hasMask = true;
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- int pixel = source.getPixel(x,y);
- if (pixel==source.transparentPixel) {
- bytes[lineAddress + x*4 + 0] = (byte)0;
- bytes[lineAddress + x*4 + 1] = (byte)0;
- bytes[lineAddress + x*4 + 2] = (byte)0;
- bytes[lineAddress + x*4 + 3] = (byte)0;
- } else {
- RGB rgb = source.palette.getRGB(pixel);
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- bytes[lineAddress + x*4 + 3] = (byte)255;
- }
- }
- lineAddress += stride;
- }
- }
-
- private void _blit2platformMask (byte[] bytes,
- ImageData source,
- int width,
- int height,
- int stride
- )
- {
- hasMask = true;
- ImageData maskData = source.getTransparencyMask();
- int lineAddress = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- RGB rgb = source.palette.getRGB(source.getPixel(x,y));
- bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
- bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
- bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
- int alpha = 0;
- if (maskData.getPixel(x,y) !=0) alpha=255;
- bytes[lineAddress + x*4 + 3] = (byte)alpha;
- }
- lineAddress += stride;
- }
- }
-
- /**
- * Transfer the pixel data from OS memory to Java memory
- * and return the Java byte array
- */
- private byte[] _getDataBytes() {
- int height = GDKPIXBUF.gdk_pixbuf_get_height (handle);
- int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
- int size = height*stride;
- byte[] bytes = new byte[size];
- OS.memmove(bytes, data, size);
- return bytes;
- }
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java
deleted file mode 100644
index 150b55f0d0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent areas of an x-y coordinate
- * system that are aggregates of the areas covered by a number
- * of rectangles.
- * <p>
- * Application code must explicitly invoke the <code>Region.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- */
-public final class Region {
- /**
- * the OS resource for the region
- * (Warning: This field is platform dependent)
- */
- public int handle;
-/**
- * Constructs a new empty region.
- */
-public Region() {
- handle = OS.gdk_region_new();
-}
-Region(int handle) {
- this.handle = handle;
-}
-/**
- * Adds the given rectangle to the collection of rectangles
- * the receiver maintains to describe its area.
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- GdkRectangle gdkRect = new GdkRectangle();
- gdkRect.x = (short)rect.x;
- gdkRect.y = (short)rect.y;
- gdkRect.width = (short)rect.width;
- gdkRect.height = (short)rect.height;
- int hOld = handle;
- /**
- * Feature in GDK. Due to the way the GDK region calls work,
- * we have to reassign the handle and destroy the old one.
- */
- handle = OS.gdk_region_union_with_rect(handle, gdkRect);
- OS.gdk_region_destroy(hOld);
-}
-/**
- * Adds all of the rectangles which make up the area covered
- * by the argument to the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @param region the region to merge
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add(Region region) {
- if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
- /**
- * Feature in GDK. Due to the way the GDK region calls work,
- * we have to reassign the handle and destroy the old one.
- */
- int hOld = handle;
- handle = OS.gdk_regions_union(handle, region.handle);
- OS.gdk_region_destroy(hOld);
-}
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains(int x, int y) {
- return OS.gdk_region_point_in(handle, x, y);
-}
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains(Point pt) {
- if (pt == null) error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-/**
- * Disposes of the operating system resources associated with
- * the region. Applications must dispose of all regions which
- * they allocate.
- */
-public void dispose() {
- if (handle != 0) OS.gdk_region_destroy(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (this == object) return true;
- if (!(object instanceof Region)) return false;
- int xRegion = ((Region)object).handle;
- if (handle == xRegion) return true;
- if (xRegion == 0) return false;
- return OS.gdk_region_equal(handle, xRegion);
-}
-void error(int code) {
- throw new SWTError(code);
-}
-/**
- * Returns a rectangle which represents the rectangular
- * union of the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @return a bounding rectangle for the region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#union
- */
-public Rectangle getBounds() {
- GdkRectangle rect = new GdkRectangle();
- OS.gdk_region_get_clipbox(handle, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-public static Region gtk_new(int handle) {
- return new Region(handle);
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle;
-}
-/**
- * Returns <code>true</code> if the rectangle described by the
- * arguments intersects with any of the rectangles the receiver
- * mainains to describe its area, and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (int x, int y, int width, int height) {
- GdkRectangle osRect = new GdkRectangle();
- osRect.x = (short)x;
- osRect.y = (short)y;
- osRect.width = (short)width;
- osRect.height = (short)height;
- return OS.gdk_region_rect_in(handle, osRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
-}
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with any of the rectangles the receiver mainains to describe
- * its area and <code>false</code> otherwise.
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects(Rectangle rect) {
- if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Returns <code>true</code> if the region has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the region.
- * When a region has been disposed, it is an error to
- * invoke any other method using the region.
- *
- * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isEmpty() {
- return OS.gdk_region_empty(handle);
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return "Region {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java
deleted file mode 100644
index 66d9149da7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- */
-public final class Converter {
- public static final byte [] NullByteArray = new byte [1];
- public static final char [] NullCharArray = new char [1];
- public static final byte [] EmptyByteArray = new byte [0];
- public static final char [] EmptyCharArray = new char [0];
-/**
- * Returns the default code page for the platform where the
- * application is currently running.
- *
- * @return the default code page
- */
-public static String defaultCodePage () {
- /*
- | ptr cp |
- DefaultCodePage == nil ifFalse: [^DefaultCodePage].
- cp := ''. "$NON-NLS$"
- (ptr := OSStringZ address: (NlLanginfo callWith: 49)) isNull
- ifFalse: [cp := String copyFromOSMemory: ptr].
- cp isEmpty ifFalse: [
- IsSunOS ifTrue: [
- (cp size > 3 and: [(cp copyFrom: 1 to: 3) = 'ISO'])
- ifTrue: [cp := cp copyFrom: 4 to: cp size]].
- ^DefaultCodePage := cp].
- IsAIX ifTrue: [^DefaultCodePage := 'ISO8859-1'].
- IsSunOS ifTrue: [^DefaultCodePage := '8859-1'].
- ^DefaultCodePage := 'iso8859_1'
- */
- return null;
-}
-static boolean is7BitAscii (byte [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if ((buffer [i] & 0xFF) > 0x7F) return false;
- }
- return true;
-}
-static boolean is7BitAscii (char [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if (buffer [i] > 0x7F) return false;
- }
- return true;
-}
-public static char [] mbcsToWcs (String codePage, byte [] buffer) {
- //SLOW AND BOGUS
- return new String (buffer).toCharArray ();
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, String string) {
- return wcsToMbcs (codePage, string, false);
-}
-public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
- //SLOW AND BOGUS
- int count = string.length ();
- if (terminate) count++;
- char [] buffer = new char [count];
- string.getChars (0, string.length (), buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, char [] buffer) {
- return wcsToMbcs (codePage, buffer, false);
-}
-public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
- //SLOW AND BOGUS
- if (!terminate) return new String (buffer).getBytes ();
- byte [] buffer1 = new String (buffer).getBytes ();
- byte [] buffer2 = new byte [buffer1.length + 1];
- System.arraycopy (buffer1, 0, buffer2, 0, buffer1.length);
- return buffer2;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java
deleted file mode 100644
index c08b892a20..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java
+++ /dev/null
@@ -1,493 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object that
- * issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Button extends Control {
- int boxHandle;
- Image image;
- String text;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Button (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
- if ((style & SWT.PUSH) != 0) {
- return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
- }
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
- return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
- }
- if ((style & SWT.ARROW) != 0) {
- return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
- }
- return style;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the control is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH;
-
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- switch (style & bits) {
- case SWT.ARROW:
- handle = OS.gtk_button_new ();
- int arrow = OS.gtk_arrow_new (OS.GTK_ARROW_UP, OS.GTK_SHADOW_OUT);
- OS.gtk_container_add (handle, arrow);
- OS.gtk_widget_show (arrow);
- break;
- case SWT.TOGGLE:
- handle = OS.gtk_toggle_button_new ();
- break;
- case SWT.CHECK:
- handle = OS.gtk_check_button_new ();
- break;
- case SWT.RADIO:
- handle = OS.gtk_radio_button_new (parent.radioGroup());
- break;
- case SWT.PUSH:
- default:
- handle = OS.gtk_button_new ();
- break;
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (boxHandle, handle);
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents();
- /*
- * Feature in GTK. For some reason, when the widget
- * is a check or radio button, mouse move and key
- * release events are not signaled. The fix is to
- * look for them on the parent.
- */
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_KEY_RELEASE_MASK;
- OS.gtk_widget_add_events (boxHandle, mask);
- signal_connect_after (boxHandle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (boxHandle, "key_release_event", SWT.KeyUp, 3);
- }
- signal_connect (handle, "clicked", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (boxHandle, this);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-int topHandle () { return boxHandle; }
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the alignment will indicate the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & SWT.UP) != 0) return SWT.UP;
- if ((style & SWT.DOWN) != 0) return SWT.DOWN;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.UP;
- }
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed. If the receiver is of any other type,
- * this method returns false.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- return OS.gtk_toggle_button_get_active (handle);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Controls how text, images and arrows will be displayed
- * in the receiver. The argument should be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the argument indicates the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
- style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- int arrow_type = OS.GTK_ARROW_UP;
- switch (alignment) {
- case SWT.UP:
- arrow_type = OS.GTK_ARROW_UP;
- break;
- case SWT.DOWN:
- arrow_type = OS.GTK_ARROW_DOWN;
- break;
- case SWT.LEFT:
- arrow_type = OS.GTK_ARROW_LEFT;
- break;
- case SWT.RIGHT:
- arrow_type = OS.GTK_ARROW_RIGHT;
- break;
- }
- int list = OS.gtk_container_children (handle);
- int arrow = OS.g_list_nth_data (list, 0);
- OS.gtk_arrow_set (arrow, arrow_type, OS.GTK_SHADOW_OUT);
- return;
- }
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int list = OS.gtk_container_children (handle);
- int label = OS.g_list_nth_data (list, 0);
- if (label == 0) return;
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (label, 0.0f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (label, 0.5f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (label, 1.0f, 0.5f);
- if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- this.image = image;
- if ((style & SWT.ARROW) != 0) return;
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- if (image != null) {
- int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
- OS.gtk_container_add (handle, pixmap);
- OS.gtk_widget_show (pixmap);
- }
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-
-/**
- * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
- * <code>RADIO</code>, or <code>TOGGLE</code>.
- *
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_toggle_button_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the button label. The label may include
- * the mnemonic character but must not contain line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- int label = OS.gtk_label_new (buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
- OS.gtk_container_add (handle, label);
- OS.gtk_widget_show (label);
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent(SWT.Selection);
- return 0;
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (boxHandle);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
- text = null;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = 0;
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java
deleted file mode 100644
index 3374e5cc65..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a surface for drawing
- * arbitrary graphics.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are <em>not</em> constructed
- * from aggregates of other controls. That is, they are either
- * painted using SWT graphics calls or are handled by native
- * methods.
- * </p>
- *
- * @see Composite
- */
-public class Canvas extends Composite {
-
- Caret caret;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-
-Canvas () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-
-/**
- * Returns the caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- *
- * @return the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Caret getCaret () {
- checkWidget();
- return caret;
-}
-
-/**
- * Scrolls a rectangular area of the receiver by first copying
- * the source area to the destination and then causing the area
- * of the source which is not covered by the destination to
- * be repainted. Children that intersect the rectangle are
- * optionally moved during the operation. In addition, outstanding
- * paint events are flushed before the source area is copied to
- * ensure that the contents of the canvas are drawn correctly.
- *
- * @param destX the x coordinate of the destination
- * @param destY the y coordinate of the destination
- * @param x the x coordinate of the source
- * @param y the y coordinate of the source
- * @param width the width of the area
- * @param height the height of the area
- * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- if (!isVisible ()) return;
-
- /* Hide the caret */
- boolean isVisible = (caret != null) && (caret.isVisible ());
- if (isVisible) caret.hideCaret ();
-
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
- int window = widget.window;
- if (window == 0) return;
-
- /* Emit a NoExpose Event */
- int gc = OS.gdk_gc_new (window);
- OS.gdk_gc_set_exposures(gc, true);
- OS.gdk_window_copy_area (window, gc, x, y, window, x, y, width, height);
- OS.gdk_gc_destroy (gc);
-
- /* Flush outstanding Exposes */
- int eventHandle=0;
- while ((eventHandle = OS.gdk_event_get_graphics_expose(window)) != 0) {
- OS.gtk_widget_event(handle, eventHandle);
- OS.gdk_event_free(eventHandle);
- }
-
- /* Scroll the window */
- int gc1 = OS.gdk_gc_new (window);
- OS.gdk_gc_set_exposures(gc1, true);
- OS.gdk_window_copy_area (window, gc1, destX, destY, window, x, y, width, height);
- OS.gdk_gc_destroy (gc1);
- boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
- if (disjoint) {
- OS.gdk_window_clear_area(window, x, y, width, height);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.gdk_window_clear_area_e(window, newX, y, Math.abs (deltaX), height);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.gdk_window_clear_area_e (window, x, newY, width, Math.abs (deltaY));
- }
- }
-
- /* Show the caret */
- if (isVisible) caret.showCaret ();
-}
-/**
- * Sets the receiver's caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- * @param caret the new caret for the receiver, may be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCaret (Caret caret) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (isFocusControl()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) newCaret.setFocus ();
- }
-}
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.NO_FOCUS) != 0) return false;
- return super.setFocus ();
-}
-int processFocusIn (int int0, int int1, int int2) {
- int result = super.processFocusIn (int0, int1, int2);
- if (caret != null) caret.setFocus ();
- return result;
-}
-int processFocusOut(int int0, int int1, int int2) {
- int result = super.processFocusOut (int0, int1, int2);
- if (caret != null) caret.killFocus ();
- return result;
-}
-/*
-int processMouseDown (int callData, int arg1, int int2) {
- if ((UtilFuncs.GTK_WIDGET_GET_FLAGS(handle) & OS.GTK_HAS_FOCUS) == 0)
- OS.gtk_widget_grab_focus(handle);
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int eventType = SWT.MouseDown;
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- if (gdkEvent.button == 3 && menu != null) {
- menu.setVisible (true);
- }
- return 1;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- return 1;
-}
-*/
-int processPaint (int callData, int arg1, int int2) {
- //if (!hooks (SWT.Paint)) return 0;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 0;
-}
-void releaseWidget () {
- if (caret != null) caret.releaseWidget ();
- caret = null;
- super.releaseWidget ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java
deleted file mode 100644
index 85c62c27b7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java
+++ /dev/null
@@ -1,508 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an i-beam that is typically used
- * as the insertion point for text.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Caret extends Widget {
- Canvas parent;
- int x, y, width, height;
- boolean moved, resized;
- boolean isVisible,isShowing;
- int blinkRate = 500;
- Image image;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Caret (Canvas parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-void createWidget (int index) {
- super.createWidget (index);
- isVisible = true;
- if (parent.getCaret () == null) {
- parent.setCaret (this);
- }
-}
-
-boolean blinkCaret () {
- if (!isVisible) return true;
- if (!isShowing) return showCaret();
- if (blinkRate==0) return true;
- return hideCaret();
-}
-
-boolean drawCaret () {
- if (parent == null) return false;
- if (parent.isDisposed ()) return false;
-
- /* The parent is a Canvas; its handle is a GtkDrawingArea.
- * Get the DA's GDK window to draw on.
- */
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, parent.handle, GtkWidget.sizeof);
- int window = widget.window;
-
- /* Create the GC, and set the working color and rop. */
- int gc = OS.gdk_gc_new(window);
- GdkGCValues gcvalues = new GdkGCValues();
- OS.gdk_gc_get_values(gc, gcvalues);
- /* Actually, we should look at the background and foreground colors.
- * This would require distinguishing between the cases when the GC
- * gives the color as RGB or Pixel, and in the case of Pixel, we
- * would need to distinguish between direct and indexed color.
- * In general, it's not easy to find out the RGB value of a GdkColor
- * (somebody please correct me if I am wrong).
- */
- GdkColor c = new GdkColor();
- c.red = c.green = c.blue = (short)0xFFFF;
- OS.gdk_color_alloc(OS.gdk_colormap_get_system(), c);
- OS.gdk_gc_set_foreground(gc, c);
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- /* Draw the caret */
- int nWidth = width;
- if (nWidth <= 0) nWidth = 2;
- OS.gdk_draw_rectangle(window, gc, 1, x, y, nWidth, height);
- OS.gdk_gc_destroy(gc);
- return true;
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Rectangle (x, y, width, height);
-}
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getFont ();
-}
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Point (x, y);
-}
-/**
- * Returns the receiver's parent, which must be a <code>Canvas</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Canvas getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns a point describing the receiver's size.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Point (width, height);
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return isVisible;
-}
-boolean hideCaret () {
-// Display display = getDisplay ();
-// if (display.currentCaret != this) return false;
- if (!isShowing) return true;
- isShowing = false;
- return drawCaret ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return isVisible && parent.isVisible (); // && parent.hasFocus ();
-}
-void killFocus () {
-// OS.DestroyCaret ();
-// self restoreFont.
-}
-void move () {
- showCaret();
- moved = false;
-}
-void releaseChild () {
- super.releaseChild ();
- if (this == parent.getCaret ()) parent.setCaret (null);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-void resize () {
- int hwnd = parent.handle;
- if (hwnd == 0) return;
-// OS.DestroyCaret ();
-// OS.CreateCaret (hwnd, 0, width, height);
-// OS.SetCaretPos (x, y);
-// OS.ShowCaret (hwnd);
-// self move.
-// showCaret();
- resized = false;
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- boolean samePosition, sameExtent, showing;
- samePosition = (this.x == x) && (this.y == y);
- sameExtent = (this.width == width) && (this.height == height);
- if (samePosition && sameExtent) return;
- if (isShowing) hideCaret ();
- this.x = x; this.y = y;
- this.width = width; this.height = height;
- if (sameExtent) {
- moved = true;
- if (isVisible ()) move ();
- } else {
- resized = true;
- if (isVisible ()) resize ();
- }
- if(isVisible())
- showCaret ();
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-void setFocus () {
- Display display = getDisplay();
- if (display.currentCaret==this) return;
- display.setCurrentCaret(this);
- if (isVisible) showCaret ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (font != null && font.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-/**
- * Returns the image that the receiver will use to paint the caret.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Sets the image that the receiver will use to paint the caret
- * to the image specified by the argument, or to the default
- * which is a filled rectangle if the argument is null
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (isShowing) hideCaret ();
- this.image = image;
- if (isShowing) showCaret ();
-}
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- setBounds (x, y, width, height);
-}
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-/**
- * Sets the receiver's size to the point specified by the arguments.
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (this.width == width && this.height == height) return;
- this.width = width; this.height = height;
- resized = true;
- if (isVisible ()) resize ();
-}
-/**
- * Sets the receiver's size to the point specified by the argument.
- *
- * @param size the new extent for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (visible == isVisible) return;
- if (isVisible = visible) {
- showCaret ();
- } else {
- hideCaret ();
- }
-
-}
-boolean showCaret () {
-// if (getDisplay ().currentCaret != this) return false;
- if (isShowing) return true;
- isShowing = true;
- return drawCaret ();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java
deleted file mode 100644
index ebe8093461..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a color
- * from a predefined set of available colors.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ColorDialog extends Dialog {
- RGB rgb;
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent) {
- this (parent, SWT.NULL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-int cancelFunc (int widget, int callData) {
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int colorInfo) {
- OS.gtk_main_quit ();
- return 0;
-}
-/**
- * Returns the currently selected color in the receiver.
- *
- * @return the RGB value for the selected color, may be null
- *
- * @see PaletteData#getRGBs
- */
-public RGB getRGB () {
- return rgb;
-}
-int okFunc (int widget, int callData) {
- GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
- OS.memmove (dialog, callData, GtkColorSelectionDialog.sizeof);
- double [] color = new double [4];
- OS.gtk_color_selection_get_color (dialog.colorsel, color);
- rgb = new RGB ((int)(color [0] * 256), (int)(color [1] * 256), (int)(color [2] * 256));
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return the selected color, or null if the dialog was
- * cancelled, no color was selected, or an error
- * occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public RGB open () {
- int handle;
- byte [] titleBytes;
- titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_color_selection_dialog_new (titleBytes);
- GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
- OS.memmove (dialog, handle, GtkColorSelectionDialog.sizeof);
- OS.gtk_widget_hide (dialog.help_button);
- if (rgb != null) {
- double [] color = new double [4];
- color [0] = (double)rgb.red / 256;
- color [1] = (double)rgb.green / 256;
- color [2] = (double)rgb.blue / 256;
- OS.gtk_color_selection_set_color (dialog.colorsel, color);
- }
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
- OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
- rgb = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return rgb;
-}
-/**
- * Returns the receiver's selected color to be the argument.
- *
- * @param rgb the new RGB value for the selected color, may be
- * null to let the platform to select a default when
- * open() is called
- *
- * @see PaletteData#getRGBs
- */
-public void setRGB (RGB rgb) {
- this.rgb = rgb;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java
deleted file mode 100644
index b192c92336..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java
+++ /dev/null
@@ -1,1077 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are controls that allow the user
- * to choose an item from a list of items, or optionally
- * enter a new value by typing it into an editable text
- * field. Often, <code>Combo</code>s are used in the same place
- * where a single selection <code>List</code> widget could
- * be used but space is limited. A <code>Combo</code> takes
- * less space than a <code>List</code> widget and shows
- * similar information.
- * <p>
- * Note: Since <code>Combo</code>s can contain both a list
- * and an editable text field, it is possible to confuse methods
- * which access one versus the other (compare for example,
- * <code>clearSelection()</code> and <code>deselectAll()</code>).
- * The API documentation is careful to indicate either "the
- * receiver's list" or the "the receiver's text field" to
- * distinguish between the two cases.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see List
- */
-
-public class Combo extends Composite {
- int padHandle, glist;
- int textLimit = LIMIT;
- public final static int LIMIT;
-
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0xFFFF;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Combo (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- String [] newItems = new String [items.length + 1];
- System.arraycopy (items, 0, newItems, 0, items.length);
- newItems [items.length] = string;
- setItems (newItems);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!(0 <= index && index <= getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- String [] items = getItems ();
- String [] newItems = new String [items.length + 1];
- System.arraycopy (items, 0, newItems, 0, items.length);
- newItems [index] = string;
- setItems (newItems);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a combo box that has a border using Windows style
- * bits. All combo boxes draw their own border and
- * do not use the standard Windows border styles.
- * Therefore, no matter what style bits are specified,
- * clear the BORDER bits so that the SWT style will
- * match the Windows widget.
- *
- * The Windows behavior is currently implemented on
- * all platforms.
- */
- style &= ~SWT.BORDER;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
- if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
- return style;
-}
-
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- int position = OS.gtk_editable_get_position (combo.entry);
- OS.gtk_editable_set_position (combo.entry, position);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- padHandle = OS.gtk_fixed_new ();
- if (padHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_combo_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new();
- if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- boolean isEditable = (style & SWT.READ_ONLY) == 0;
- OS.gtk_entry_set_editable (combo.entry, isEditable);
-}
-
-void configure () {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, padHandle);
- OS.gtk_fixed_put (padHandle, fixedHandle, (short)0, (short)0);
- OS.gtk_fixed_put (padHandle, handle, (short)0, (short)0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- return _computeSize(wHint, hHint, changed);
-}
-
-void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(padHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (handle);
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (padHandle);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- WidgetTable.remove (combo.entry);
- WidgetTable.remove (combo.list);
- WidgetTable.remove (combo.button);
-}
-
-void hookEvents () {
- // TO DO - expose, enter/exit, focus in/out
- super.hookEvents ();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- // TO DO - fix multiple selection events for one user action
- signal_connect (combo.list, "select_child", SWT.Selection, 3);
- signal_connect_after (combo.entry, "changed", SWT.Modify, 2);
- int mask =
- OS.GDK_POINTER_MOTION_MASK |
- OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
- OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK;
- int [] handles = new int [] {combo.entry, combo.list, combo.button};
- for (int i=0; i<handles.length; i++) {
- int handle = handles [i];
- if (!OS.GTK_WIDGET_NO_WINDOW (handle)) {
- OS.gtk_widget_add_events (handle, mask);
- }
- signal_connect_after (handle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (handle, "button_press_event", SWT.MouseDown, 3);
- signal_connect_after (handle, "button_release_event", SWT.MouseUp, 3);
- signal_connect_after (handle, "key_press_event", SWT.KeyDown, 3);
- signal_connect_after (handle, "key_release_event", SWT.KeyUp, 3);
- }
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==padHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- if (h== combo.entry) return true;
- if (h== combo.list) return true;
- if (h== combo.button) return true;
- return false;
-}
-
-void _connectChild (int h) {
- OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(fixedHandle);
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
- UtilFuncs.setSize (fixedHandle, width,height);
- UtilFuncs.setSize (handle, width,height);
- return differentExtent;
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- setItems (getItems ());
-}
-
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget();
- setItems (getItems ());
-}
-
-/*
- * FIXME
-protected boolean hasFocus () {
- return super.hasFocus();
-}
-*/
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- String [] items = getItems ();
- if (!(0 <= index && index < items.length)) {
- error (SWT.ERROR_CANNOT_GET_ITEM);
- }
- return items [index];
-}
-
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- if (glist == 0) return 0;
- return OS.g_list_length (glist);
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- /* FIXME */
- return 0;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- if (glist == 0) return new String [0];
- int count = OS.g_list_length (glist);
- String [] items = new String [count];
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- int length = OS.strlen (data);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, data, length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- items [i] = new String (buffer2, 0, length);
- }
- return items;
-}
-
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- GtkEditable editable = new GtkEditable();
- OS.memmove (editable, combo.entry, GtkEditable.sizeof);
- return new Point (editable.selection_start_pos, editable.selection_end_pos);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- //NOT RIGHT FOR EDITABLE
- return indexOf (getText ());
-}
-
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- int address = OS.gtk_entry_get_text (combo.entry);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- /*
- * This code is intentionally commented.
- * The GTK documentation explicitly states
- * that this address should not be freed.
- */
-// OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-String getText (int start, int stop) {
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- return getText ().substring (start, stop - 1);
-}
-
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget();
- /* A native approach, just measuring the entry:
- * return UtilFuncs.getSize(_entryHandle).y;
- * does not work - the entry is the same size as
- * the whole combo.
- */
- error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
- return 0;
-}
-
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- return textLimit;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- for (int i=start; i<items.length; i++) {
- if (string.equals(items [i])) return i;
- }
- return -1;
-}
-
-int processModify (int arg0, int arg1, int int2) {
- sendEvent (SWT.Modify);
- return 0;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-void register () {
- super.register ();
- WidgetTable.put (padHandle, this);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- WidgetTable.put (combo.entry, this);
- WidgetTable.put (combo.list, this);
- WidgetTable.put (combo.button, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- int padHandle = 0;
-}
-
-void releaseWidget () {
- if (glist != 0) {
- int count = OS.g_list_length (glist);
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- if (data != 0) OS.g_free (data);
- }
- OS.g_list_free (glist);
- }
- glist = 0;
- super.releaseWidget ();
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (!(0 <= index && index < getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- String [] oldItems = getItems ();
- String [] newItems = new String [oldItems.length - 1];
- System.arraycopy (oldItems, 0, newItems, 0, index);
- System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1);
- setItems (newItems);
-}
-
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- if (!(0 <= start && start <= end && end < getItemCount ())) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- String [] oldItems = getItems ();
- String [] newItems = new String [oldItems.length - (end - start + 1)];
- System.arraycopy (oldItems, 0, newItems, 0, start);
- System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1);
- setItems (newItems);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index != -1) remove (index);
-}
-
-/**
- * Removes all of the items from the receiver's list.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- setItems (new String [0]);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- String [] items = getItems ();
- if (index >= items.length) return;
- String selectedText = items [index];
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_block_by_data (combo.list, SWT.Selection);
- OS.gtk_list_select_item (combo.list, index);
- OS.gtk_entry_set_text (combo.entry, Converter.wcsToMbcs (null, selectedText, true));
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_unblock_by_data (combo.list, SWT.Selection);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!(0 <= index && index <= getItemCount ())) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- String [] items = getItems ();
- items [index] = string;
- setItems (items);
-}
-
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- if (items.length == 0) {
- OS.gtk_list_clear_items (combo.list, 0, -1);
- //LEAK
- glist = 0;
- } else {
- int new_glist = 0;
- for (int i=0; i<items.length; i++) {
- String string = items [i];
- // FIXME leaked strings and glist
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int data = OS.g_malloc (buffer.length);
- OS.memmove (data, buffer, buffer.length);
- new_glist = OS.g_list_append (new_glist, data);
- }
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_block_by_data (combo.list, SWT.Selection);
- OS.gtk_combo_set_popdown_strings (handle, new_glist);
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
- OS.gtk_signal_handler_unblock_by_data (combo.list, SWT.Selection);
- if (glist != 0) {
- int count = OS.g_list_length (glist);
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (glist, i);
- if (data != 0) OS.g_free (data);
- }
- OS.g_list_free (glist);
- }
- glist = new_glist;
- }
- OS.gtk_signal_handler_block_by_data (combo.entry, SWT.Modify);
- OS.gtk_editable_delete_text (combo.entry, 0, -1);
- OS.gtk_signal_handler_unblock_by_data (combo.entry, SWT.Modify);
-}
-
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo gtkCombo = new GtkCombo ();
- OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
- int entry = gtkCombo.entry;
- OS.gtk_editable_set_position (entry, selection.x);
- OS.gtk_editable_select_region (entry, selection.x, selection.y);
-}
-
-protected boolean setTabGroupFocus () {
- return setFocus ();
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- GtkCombo gtkCombo = new GtkCombo ();
- OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
- int entry = gtkCombo.entry;
- OS.gtk_editable_delete_text (entry, 0, -1);
- int [] position = new int [1];
- byte [] buffer = Converter.wcsToMbcs (null, string);
- OS.gtk_editable_insert_text (entry, buffer, buffer.length, position);
- OS.gtk_editable_set_position (entry, 0);
-}
-
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- this.textLimit = (short) limit;
- GtkCombo combo = new GtkCombo ();
- OS.memmove (combo, handle, GtkCombo.sizeof);
- OS.gtk_entry_set_max_length (combo.entry, (short) limit);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java
deleted file mode 100644
index 7c1b9d83d7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java
+++ /dev/null
@@ -1,504 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are controls which are capable
- * of containing other controls.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are constructed from aggregates
- * of other controls.
- * </p>
- *
- * @see Canvas
- */
-public class Composite extends Scrollable {
- int topHandle, eventBoxHandle, fixedHandle, radioHandle;
- Layout layout;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-Composite () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Composite (Composite parent, int style) {
- super (parent, style);
-}
-
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
-
- topHandle = OS.gtk_event_box_new();
- if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new(0,0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_drawing_area_new();
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(topHandle, scrolledHandle);
- _fillBin(scrolledHandle, eventBoxHandle);
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
-}
-
-void setHandleStyle() {
- setScrollingPolicy();
-}
-
-void showHandle() {
- OS.gtk_widget_realize (topHandle);
- OS.gtk_widget_show_now(topHandle);
-
- OS.gtk_widget_show (scrolledHandle);
-
- OS.gtk_widget_realize (eventBoxHandle);
- OS.gtk_widget_show_now(eventBoxHandle);
-
- OS.gtk_widget_realize (fixedHandle);
- OS.gtk_widget_show_now(fixedHandle);
-
- OS.gtk_widget_realize (handle);
- OS.gtk_widget_show_now (handle);
-}
-
-void register () {
- super.register ();
- if (topHandle != 0) WidgetTable.put (topHandle, this);
- if (eventBoxHandle != 0) WidgetTable.put (eventBoxHandle, this);
- if (fixedHandle != 0) WidgetTable.put (fixedHandle, this);
-}
-
-void deregister () {
- super.deregister ();
- if (topHandle != 0) WidgetTable.remove (topHandle);
- if (eventBoxHandle != 0) WidgetTable.remove (eventBoxHandle);
- if (fixedHandle != 0) WidgetTable.remove (fixedHandle);
-}
-
-int topHandle() {
- return topHandle;
-}
-
-int parentingHandle() {
- return fixedHandle;
-}
-
-/**
- * Answer whether the argument points to an OS widget that is
- * implementing the receiver, i.e., one of my own handles
- */
-boolean isMyHandle(int h) {
- if (h==topHandle) return true;
- if (h==eventBoxHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- if (h==radioHandle) return true;
- return false;
-}
-
-
-
-
-/*
- * === GEOMETRY - PHYSICAL ===
- */
-
-
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- layout();
-}
-
-public void setSize (int width, int height) {
- super.setSize(width, height);
- layout();
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
- Point clientSize = UtilFuncs.getSize(fixedHandle);
- OS.gtk_drawing_area_size(handle, width, height);
- UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
- return differentExtent;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- Point size;
- if (layout != null) {
- if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = new Point (wHint, hHint);
- }
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = computeTrim (0, 0, size.x, size.y);
- return new Point (trim.width, trim.height);
-}
-
-void initializeTrim() {
- /* Temporary implementation - I just measured the scrollbars
- * with one particular theme. The fair thing to do is get
- * the real dimensions from gtk.
- */
- trim = new Trim();
- if ((style&SWT.H_SCROLL)!=0) trim.bottom=18;
- if ((style&SWT.V_SCROLL)!=0) trim.right=18;
-}
-
-
-/*
- * === GEOMETRY - LAYOUT ===
- */
-
-/**
- * Returns layout which is associated with the receiver, or
- * null if one has not been set.
- *
- * @return the receiver's layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Layout getLayout () {
- checkWidget();
- return layout;
-}
-
-/**
- * Gets the last specified tabbing order for the control.
- *
- * @return tabList the ordered list of controls representing the tab order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setTabList
- */
-public Control [] getTabList () {
- return new Control [0];
-}
-
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- this.layout = layout;
-}
-
-int _gdkWindow() {
- int windowHandle = _gdkWindow(handle);
- if (windowHandle==0) error(SWT.ERROR_UNSPECIFIED);
- return windowHandle;
-}
-
-/**
- * Returns an array containing the receiver's children.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of children, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return an array of children
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control [] getChildren () {
- checkWidget();
- return _getChildren();
-}
-
-Control [] _getChildren () {
- return _getChildren(parentingHandle());
-}
-
-/**
- * Answer the array of the children of the specified handle,
- * filtering out widgets we don't consider our children.
- * That is, the OS may return some children that don't qualify
- * as such under SWT terminology - e.g., Items are not children.
- */
-Control [] _getChildren (int h) {
- if (h==0) {
- error(SWT.ERROR_UNSPECIFIED);
- }
- int list = OS.gtk_container_children (h);
- int count = OS.g_list_length (list);
- java.util.Vector children = new java.util.Vector();
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (list, i);
- if (!isMyHandle(data)) {
- Control child = _childFromHandle(data);
- if (child != null) children.addElement(child);
- }
- }
- Control[] answer = new Control[children.size()];
- children.copyInto(answer);
- return answer;
-}
-/**
- * Consider the argument a handle of one of the receiver's children.
- * If the argument is not a handle to a widget, or the widget is
- * not our child in SWT (not OS) terminology, return null.
- */
-Control _childFromHandle(int h) {
- Widget child = WidgetTable.get(h);
- return (Control)child;
-}
-
-public Rectangle getClientArea () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- return _getClientArea ();
-}
-
-public Rectangle _getClientArea () {
- Point size = _getClientAreaSize ();
- return new Rectangle (0, 0, size.x, size.y);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the receiver does not have a layout, do nothing.
- * <p>
- * This is equivalent to calling <code>layout(true)</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout () {
- layout (true);
-}
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the the argument is <code>true</code> the layout must not rely
- * on any cached information it is keeping about the children. If it
- * is <code>false</code> the layout may (potentially) simplify the
- * work it is doing by assuming that the state of the none of the
- * receiver's children has changed since the last layout.
- * If the receiver does not have a layout, do nothing.
- *
- * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout (boolean changed) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (layout == null) return;
- layout.layout (this, changed);
-}
-
-Point minimumSize () {
- Control [] children = _getChildren ();
- int width = 0, height = 0;
- for (int i=0; i<children.length; i++) {
- Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
- }
- return new Point (width, height);
-}
-int processResize (int int0, int int1, int int2) {
- sendEvent (SWT.Resize);
- layout();
- return 0;
-}
-int radioGroup() {
- if (radioHandle==0) _initializeRadioGroup();
- return OS.gtk_radio_button_group(radioHandle);
-}
-
-public void redraw () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-// Point size = _getSize();
-// GtkWidget widget = new GtkWidget(handle);
-// _redraw(0, 0, size.x, size.y, true);
-OS.gtk_widget_queue_draw(handle);
-}
-
-void _initializeRadioGroup() {
- radioHandle = OS.gtk_radio_button_new(0);
-}
-
-/**
- * Adopt the widget h as our child.
- */
-void _connectChild (int h) {
- OS.gtk_fixed_put (parentingHandle(), h, (short)0, (short)0);
-}
-
-void releaseChildren () {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child != null && !child.isDisposed ()) {
- child.releaseWidget ();
- child.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseChildren ();
- super.releaseWidget ();
- layout = null;
-}
-void releaseHandle () {
- super.releaseHandle ();
- topHandle = eventBoxHandle = fixedHandle = radioHandle = 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- //NOT DONE - only grab when not already grabbing
- if ((state & CANVAS) != 0) OS.gtk_grab_add (handle);
- return super.processMouseDown (callData, arg1, int2);
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- //NOT DONE - only release when last button goes up
- if ((state & CANVAS) != 0) OS.gtk_grab_remove (handle);
- return super.processMouseUp (callData, arg1, int2);
-}
-
-int processFocusIn(int int0, int int1, int int2) {
- OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_HAS_FOCUS);
- return super.processFocusIn(int0, int1, int2);
-}
-int processFocusOut(int int0, int int1, int int2) {
- OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_HAS_FOCUS);
- return super.processFocusOut(int0, int1, int2);
-}
-
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.getVisible () && child.setFocus ()) return true;
- }
- return super.setFocus ();
-}
-
-/**
- * Sets the tabbing order for the specified controls to
- * match the order that they occur in the argument list.
- *
- * @param tabList the ordered list of controls representing the tab order; must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTabList (Control [] tabList) {
-}
-
-protected void checkSubclass () {
- /* Do nothing - Subclassing is allowed */
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java
deleted file mode 100644
index eedad44c27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java
+++ /dev/null
@@ -1,2229 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Control is the abstract superclass of all windowed user interface classes.
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b>
- * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
- * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Control extends Widget implements Drawable {
-
- Composite parent;
- Menu menu;
- String toolTipText;
- Object layoutData;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-Control () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Control (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-
-abstract void createHandle(int index);
-
-int eventHandle () {
- return handle;
-}
-
-/**
- * Connect the appropriate signal handlers.
- *
- * At a minimum, we must connect
- * <ul>
- * <li>expose_event
- * <li>button_press_event / button_release_event
- * <li>motion_notify_event
- * <li>enter_notify_event / leave_notify_event
- * <li>key_press_event / key_release_event
- * <li>focus_in_event / focus_out_event
- * </ul>
- *
- * The possible mask bits are:
- * <ul>
- * GDK_EXPOSURE_MASK |
- * GDK_POINTER_MOTION_MASK |
- * GDK_POINTER_MOTION_HINT_MASK |
- * GDK_ENTER_NOTIFY_MASK |
- * GDK_LEAVE_NOTIFY_MASK |
- * GDK_BUTTON_PRESS_MASK
- * GDK_BUTTON_RELEASE_MASK
- * GDK_KEY_PRESS_MASK
- * GDK_KEY_RELEASE_MASK
- * GDK_FOCUS_CHANGE_MASK
- * </ul>
- */
-void hookEvents () {
- signal_connect (handle, "expose_event", SWT.Paint, 3);
- int mask =
- OS.GDK_POINTER_MOTION_MASK |
- OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
- OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
- OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
- OS.GDK_FOCUS_CHANGE_MASK;
- int eventHandle = eventHandle ();
- if (!OS.GTK_WIDGET_NO_WINDOW (eventHandle)) {
- OS.gtk_widget_add_events (eventHandle, mask);
- }
- signal_connect_after (eventHandle, "motion_notify_event", SWT.MouseMove, 3);
- signal_connect_after (eventHandle, "button_press_event", SWT.MouseDown, 3);
- signal_connect_after (eventHandle, "button_release_event", SWT.MouseUp, 3);
- signal_connect_after (eventHandle, "enter_notify_event", SWT.MouseEnter, 3);
- signal_connect_after (eventHandle, "leave_notify_event", SWT.MouseExit, 3);
- signal_connect_after (eventHandle, "key_press_event", SWT.KeyDown, 3);
- signal_connect_after (eventHandle, "key_release_event", SWT.KeyUp, 3);
- signal_connect_after (eventHandle, "focus_in_event", SWT.FocusIn, 3);
- signal_connect_after (eventHandle, "focus_out_event", SWT.FocusOut, 3);
-}
-
-abstract void setHandleStyle ();
-void setInitialSize() { UtilFuncs.setZeroSize(topHandle()); }
-void configure () {
- // Do NOT directly use gtk_fixed_put in configure(),
- // because not all composites have GtkFixed as their
- // parenting (bottom) handle.
- _connectParent();
-}
-void _connectParent() {
- parent._connectChild(topHandle());
-}
-/**
- * Every Control must implement this to map the gtk widgets,
- * and also realize those that have to be realized - this means
- * create the actual X window so that there are no surprizes
- * if the user calls a method expecting the X window to be there.
- * Widgets normally do it by invoking gtk_widget_show() on all
- * handles, and then doing gtk_widget_realize() on bottommost
- * handle, which will realize everything above as well.
- * An exception to this is the Shell, which we do NOT realize
- * at this point.
- */
-abstract void showHandle();
-
-int topHandle() {
- return handle;
-}
-
-int paintHandle() {
- return handle;
-}
-
-/*
- * === GEOMETRY ===
- */
-
-int computeHandle () {
- return handle;
-}
-
-Point _computeSize (int wHint, int hHint, boolean changed) {
- int handle = computeHandle ();
- byte [] gtk_aux_info = Converter.wcsToMbcs (null, "gtk-aux-info", true);
- int id = OS.g_quark_from_string (gtk_aux_info);
- int aux_info = OS.gtk_object_get_data_by_id (handle, id);
- OS.gtk_object_set_data_by_id (handle, id, 0);
- GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (handle, requisition);
- OS.gtk_object_set_data_by_id (handle, id, aux_info);
- int width = wHint == SWT.DEFAULT ? requisition.width : wHint;
- int height = hHint == SWT.DEFAULT ? requisition.height : hHint;
- return new Point (width, height);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size of the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- return computeSize (wHint, hHint, true);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p><p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
- * @return the preferred size of the control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- return _computeSize (wHint, hHint, changed);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- return _getBounds();
-}
-
-/**
- * The actual implementation for getBounds().
- * Concrete controls implement their means to answer the location
- * and size by overriding _getLocation() and _getSize().
- */
-final Rectangle _getBounds() {
- Point location = _getLocation();
- Point size = _getSize();
- return new Rectangle(location.x, location.y, size.x, size.y);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean differentOrigin = _setLocation(x,y);
- boolean differentExtent = _setSize (width,height);
- if (differentOrigin) sendEvent (SWT.Move);
- if (differentExtent) sendEvent (SWT.Resize);
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- return _getLocation();
-}
-
-Point _getLocation () {
- return UtilFuncs.getLocation(topHandle());
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation(int x, int y) {
- checkWidget();
- if (_setLocation(x,y)) sendEvent(SWT.Move);
-}
-
-boolean _setLocation(int x, int y) {
- return UtilFuncs.setLocation(parent.parentingHandle(), topHandle(), x,y);
-}
-
-/**
- * Returns a point describing the receiver's size. The
- * x coordinate of the result is the width of the receiver.
- * The y coordinate of the result is the height of the
- * receiver.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- return _getSize();
-}
-Point _getSize() {
- return UtilFuncs.getSize(topHandle());
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause them to be
- * set to zero instead.
- * </p>
- *
- * @param size the new size for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-/**
- * Sets the receiver's size to the point specified by the arguments.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- // Even though GTK+ will not let any widget be smaller
- // than 3@3, we don't care about it here, as this kind
- // of platform weirdness is handled in UtilFuncs.
- width = Math.max(width, 0);
- height = Math.max(height, 0);
- if (_setSize(width, height)) sendEvent(SWT.Resize);
-}
-boolean _setSize(int width, int height) { return UtilFuncs.setSize(topHandle(), width, height); }
-
-/**
- * Moves the receiver above the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the top of the drawing order. The control at
- * the top of the drawing order will not be covered by other
- * controls even if they occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveAbove (Control control) {
- checkWidget();
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle(), GtkWidget.sizeof);
- int topGdkWindow = widget.window;
- if (topGdkWindow!=0) OS.gdk_window_raise (topGdkWindow);
-}
-
-/**
- * Moves the receiver below the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the bottom of the drawing order. The control at
- * the bottom of the drawing order will be covered by all other
- * controls which occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveBelow (Control control) {
- checkWidget();
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle(), GtkWidget.sizeof);
- int topGdkWindow = widget.window;
- if (topGdkWindow!=0) OS.gdk_window_lower (topGdkWindow);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack () {
- pack (true);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- * <p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack (boolean changed) {
- checkWidget();
- setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
-}
-
-/**
- * Sets the layout data associated with the receiver to the argument.
- *
- * @param layoutData the new layout data for the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayoutData (Object layoutData) {
- checkWidget();
- this.layoutData = layoutData;
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in display relative coordinates,
- * to coordinates relative to the receiver.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toControl (Point point) {
- checkWidget();
- int[] x = new int[1], y = new int[1];
- OS.gdk_window_get_origin(_gdkWindow(), x,y);
- int ctlX = point.x - x[0];
- int ctlY = point.y - y[0];
- return new Point (ctlX, ctlY);
-}
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in coordinates relative to
- * the receiver, to display relative coordinates.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toDisplay (Point point) {
- checkWidget();
- int[] x = new int[1], y = new int[1];
- OS.gdk_window_get_origin(_gdkWindow(), x,y);
- return new Point (x[0]+point.x, y[0]+point.y);
-}
-// === End of GEOMETRY Category ===
-
-
-/*
- * == ADD/REMOVE LISTENERS ==
- */
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control gains or loses focus, by sending
- * it one of the messages defined in the <code>FocusListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #removeFocusListener
- */
-public void addFocusListener(FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.FocusIn,typedListener);
- addListener(SWT.FocusOut,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard, by sending
- * it one of the messages defined in the <code>KeyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #removeKeyListener
- */
-public void addKeyListener(KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.KeyUp,typedListener);
- addListener(SWT.KeyDown,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when mouse buttons are pressed and released, by sending
- * it one of the messages defined in the <code>MouseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #removeMouseListener
- */
-public void addMouseListener(MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseDown,typedListener);
- addListener(SWT.MouseUp,typedListener);
- addListener(SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse moves, by sending it one of the
- * messages defined in the <code>MouseMoveListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #removeMouseMoveListener
- */
-public void addMouseMoveListener(MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseMove,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse passes or hovers over controls, by sending
- * it one of the messages defined in the <code>MouseTrackListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #removeMouseTrackListener
- */
-public void addMouseTrackListener (MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseEnter,typedListener);
- addListener (SWT.MouseExit,typedListener);
- addListener (SWT.MouseHover,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver needs to be painted, by sending it
- * one of the messages defined in the <code>PaintListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #removePaintListener
- */
-public void addPaintListener(PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Paint,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when traversal events occur, by sending it
- * one of the messages defined in the <code>TraverseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #removeTraverseListener
- */
-public void addTraverseListener (TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Traverse,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control gains or loses focus.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #addFocusListener
- */
-public void removeFocusListener(FocusListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.FocusIn, listener);
- eventTable.unhook (SWT.FocusOut, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #addKeyListener
- */
-public void removeKeyListener(KeyListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.KeyUp, listener);
- eventTable.unhook (SWT.KeyDown, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when mouse buttons are pressed and released.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #addMouseListener
- */
-public void removeMouseListener (MouseListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseDown, listener);
- eventTable.unhook (SWT.MouseUp, listener);
- eventTable.unhook (SWT.MouseDoubleClick, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse moves.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #addMouseMoveListener
- */
-public void removeMouseMoveListener(MouseMoveListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseMove, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse passes or hovers over controls.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #addMouseTrackListener
- */
-public void removeMouseTrackListener(MouseTrackListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseEnter, listener);
- eventTable.unhook (SWT.MouseExit, listener);
- eventTable.unhook (SWT.MouseHover, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver needs to be painted.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #addPaintListener
- */
-public void removePaintListener(PaintListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Paint, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when traversal events occur.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #addTraverseListener
- */
-public void removeTraverseListener(TraverseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Traverse, listener);
-}
-
-
-/*
- * Return (GTKWIDGET)h->window.
- */
-final int _gdkWindow(int h) {
- /* Temporary code.
- * This check is not necessary as the (internal) callers
- * always make sure h!=0.
- */
- if (h==0) error(SWT.ERROR_CANNOT_BE_ZERO);
-
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, h, GtkWidget.sizeof);
- return widget.window;
-}
-
-int _gdkWindow() {
- int windowHandle = _gdkWindow(handle);
- if (windowHandle==0) error(SWT.ERROR_NO_HANDLES);
- return windowHandle;
-}
-
-/**
- * Forces the receiver to have the <em>keyboard focus</em>, causing
- * all keyboard events to be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setFocus
- */
-public boolean forceFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_grab_focus (handle);
- return true;
-}
-
-/**
- * Returns the receiver's background color.
- *
- * @return the background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getBackground () {
- checkWidget();
- return Color.gtk_new (_getBackgroundGdkColor());
-}
-
-/*
- * Subclasses should override this to pass a meaningful handle
- */
-GdkColor _getBackgroundGdkColor() {
- /* Override this */
- int h = paintHandle();
-
- int hStyle = OS.gtk_widget_get_style (handle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor ();
- color.pixel = style.bg0_pixel;
- color.red = style.bg0_red;
- color.green = style.bg0_green;
- color.blue = style.bg0_blue;
- return color;
-}
-
-/**
- * Returns the receiver's border width.
- *
- * @return the border width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getBorderWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return (style & SWT.BORDER) == 0 ? 0 : 1;
-}
-
-/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- if (parent == null) {
- error (SWT.ERROR_WIDGET_DISPOSED);
- }
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- int topHandle = topHandle ();
- return OS.GTK_WIDGET_SENSITIVE (topHandle);
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- return Font.gtk_new(_getFontHandle());
-}
-/*
- * Subclasses should override this, passing a meaningful handle
- */
-int _getFontHandle () {
- return UtilFuncs.getFont(handle);
-}
-
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getForeground () {
- checkWidget();
- return Color.gtk_new (_getForegroundGdkColor());
-}
-
-/*
- * Subclasses should override this to pass a meaningful handle
- */
-GdkColor _getForegroundGdkColor() {
- /* Override this */
- int h = paintHandle();
-
- int hStyle = OS.gtk_widget_get_style (handle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- GdkColor color = new GdkColor ();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
- return color;
-}
-
-/**
- * Returns layout data which is associated with the receiver.
- *
- * @return the receiver's layout data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Object getLayoutData () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return layoutData;
-}
-
-/**
- * Returns the receiver's pop up menu if it has one, or null
- * if it does not. All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return menu;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Composite</code>
- * or null when the receiver is a shell that was created with null or
- * a display for a parent.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Composite getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell() {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return _getShell();
-}
-Shell _getShell() {
- return parent._getShell();
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return toolTipText;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return _getVisible();
-}
-boolean _getVisible() {
- return _getVisible(topHandle());
-}
-boolean _getVisible(int h) {
- return (OS.GTK_WIDGET_FLAGS(h) & OS.GTK_VISIBLE) != 0;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (data == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (paintHandle() == 0) error(SWT.ERROR_UNSPECIFIED);
-
- // Create the GC with default values for this control
- GtkWidget w = new GtkWidget();
- OS.memmove (w, paintHandle(), GtkWidget.sizeof);
-
- if (w.window == 0) error(SWT.ERROR_UNSPECIFIED);
- int gc = OS.gdk_gc_new(w.window);
-
- OS.gdk_gc_set_font(gc, _getFontHandle());
- OS.gdk_gc_set_background(gc, _getBackgroundGdkColor());
- OS.gdk_gc_set_foreground(gc, _getForegroundGdkColor());
-
- data.drawable = w.window;
- return gc;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int xGC, GCData data) {
- if(xGC == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gdk_gc_unref(xGC);
-}
-
-/**
- * Returns <code>true</code> if the underlying operating
- * system supports this reparenting, otherwise <code>false</code>
- *
- * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isReparentable () {
- checkWidget();
- return false;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- int topHandle = topHandle ();
- return OS.GTK_WIDGET_IS_SENSITIVE (topHandle);
-}
-
-/**
- * Returns <code>true</code> if the receiver has the user-interface
- * focus, and <code>false</code> otherwise.
- *
- * @return the receiver's focus state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isFocusControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_HAS_FOCUS)!=0;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- boolean result = getVisible ();
- if (parent != null)
- result = result && parent.isVisible();
- return result;
-}
-Decorations menuShell () {
- return parent.menuShell ();
-}
-
-int processKeyDown (int callData, int arg1, int int2) {
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
- boolean accelResult = OS.gtk_accel_groups_activate(_getShell().topHandle, gdkEvent.keyval, gdkEvent.state);
- if (!accelResult) sendKeyEvent (SWT.KeyDown, gdkEvent);
- return 1;
-}
-
-int processKeyUp (int callData, int arg1, int int2) {
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
- sendKeyEvent (SWT.KeyUp, gdkEvent);
- return 1;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_widget_grab_focus(handle);
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int eventType = SWT.MouseDown;
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- if (gdkEvent.button == 3 && menu != null) {
- menu.setVisible (true);
- }
- return 1;
-}
-
-int processMouseEnter (int arg0, int arg1, int int2) {
- //NOT IMPLEMENTED - event state
- sendEvent (SWT.MouseEnter);
- return 1;
-}
-int processMouseExit (int arg0, int arg1, int int2) {
- //NOT IMPLEMENTED - event state
- sendEvent (SWT.MouseExit);
- return 1;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
- return 1;
-}
-
-int processMouseMove (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- Point where = _gdkWindowGetPointer();
- sendMouseEvent (SWT.MouseMove, 0, gdkEvent.state, gdkEvent.time, where.x, where.y);
- return 1;
-}
-Point _gdkWindowGetPointer() {
- int[] px = new int[1], py = new int[1];
- OS.gdk_window_get_pointer(_gdkWindow(), px, py, 0);
- return new Point(px[0], py[0]);
-}
-int processFocusIn(int int0, int int1, int int2) {
- postEvent(SWT.FocusIn);
- return 0;
-}
-int processFocusOut(int int0, int int1, int int2) {
- postEvent(SWT.FocusOut);
- return 0;
-}
-
-int processPaint (int callData, int int2, int int3) {
- if (!hooks (SWT.Paint)) return 1;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- GdkRectangle rect = new GdkRectangle ();
- rect.x = gdkEvent.x; rect.y = gdkEvent.y;
- rect.width = gdkEvent.width; rect.height = gdkEvent.height;
- OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
- gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-}
-
-/**
- * Causes the entire bounds of the receiver to be marked
- * as needing to be redrawn. The next time a paint request
- * is processed, the control will be completely painted.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Point size = _getSize();
- _redraw(0, 0, size.x, size.y, true);
-//OS.gtk_widget_queue_draw(handle);
-}
-/**
- * Causes the rectangular area of the receiver specified by
- * the arguments to be marked as needing to be redrawn.
- * The next time a paint request is processed, that area of
- * the receiver will be painted. If the <code>all</code> flag
- * is <code>true</code>, any children of the receiver which
- * intersect with the specified area will also paint their
- * intersecting areas. If the <code>all</code> flag is
- * <code>false</code>, the children will not be painted.
- *
- * @param x the x coordinate of the area to draw
- * @param y the y coordinate of the area to draw
- * @param width the width of the area to draw
- * @param height the height of the area to draw
- * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw (int x, int y, int width, int height, boolean all) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- _redraw(x, y, width, height, all);
-}
-protected void _redraw(int x, int y, int width, int height, boolean all) {
- OS.gdk_window_clear_area_e (_gdkWindow(), x, y, width, height);
-
-GdkRectangle rect = new GdkRectangle();
-rect.x = (short)x;
-rect.y = (short)y;
-rect.width = (short)width;
-rect.height =(short) height;
-//OS.gtk_widget_draw(handle, rect);
-OS.gtk_widget_queue_draw(handle);
-
-// OS.gtk_widget_queue_draw_area (handle, x, y, width, height);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- toolTipText = null;
- parent = null;
- menu = null;
- layoutData = null;
-}
-void sendKeyEvent (int type, GdkEventKey gdkEvent) {
- /* Look up the keysym and character(s) */
- int size = gdkEvent.length;
- if (gdkEvent.keyval == 0 && size == 0) return;
-
- /* If there is no composed string input by keypress, only send the keyvalue */
- if (size == 0 ) {
- Event event = new Event ();
- event.time = gdkEvent.time;
-// event.character = (char) 0; //no character sent
- event.keyCode = Display.translateKey (gdkEvent.keyval);
- event.character = (char) event.keyCode; //no character sent
- if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
- }
- else {
- byte [] buffer = new byte [size];
- OS.memmove (buffer, gdkEvent.string, size);
- /* Convert from MBCS to UNICODE and send the event */
- char [] result = Converter.mbcsToWcs (null, buffer);
- for (int i=0; i<result.length; i++) {
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.character = result [i];
- event.keyCode = result [i]; //0; //no keyCode sent
- if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
- }
- }
-}
-void sendMouseEvent (int type, int button, int mask, int time, int x, int y) {
- Event event = new Event ();
- event.time = time;
- event.button = button;
- event.x = x; event.y = y;
- if ((mask & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
- if ((mask & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
- if ((mask & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
- if ((mask & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
- if ((mask & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
- if ((mask & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
- postEvent (type, event);
-}
-
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int hDefaultStyle = OS.gtk_widget_get_default_style ();
- int hStyle = OS.gtk_widget_get_style (handle);
- boolean makeCopy = hStyle == hDefaultStyle;
- hStyle = OS.gtk_style_copy (makeCopy ? hDefaultStyle : hStyle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- if (color == null) {
- GtkStyle defaultStyle = new GtkStyle ();
- OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
- style.bg0_pixel = defaultStyle.bg0_pixel;
- style.bg0_red = defaultStyle.bg0_red;
- style.bg0_green = defaultStyle.bg0_green;
- style.bg0_blue = defaultStyle.bg0_blue;
- style.bg1_pixel = defaultStyle.bg1_pixel;
- style.bg1_red = defaultStyle.bg1_red;
- style.bg1_green = defaultStyle.bg1_green;
- style.bg1_blue = defaultStyle.bg1_blue;
- style.bg2_pixel = defaultStyle.bg2_pixel;
- style.bg2_red = defaultStyle.bg2_red;
- style.bg2_green = defaultStyle.bg2_green;
- style.bg2_blue = defaultStyle.bg2_blue;
- style.bg3_pixel = defaultStyle.bg3_pixel;
- style.bg3_red = defaultStyle.bg3_red;
- style.bg3_green = defaultStyle.bg3_green;
- style.bg3_blue = defaultStyle.bg3_blue;
- style.bg4_pixel = defaultStyle.bg4_pixel;
- style.bg4_red = defaultStyle.bg4_red;
- style.bg4_green = defaultStyle.bg4_green;
- style.bg4_blue = defaultStyle.bg4_blue;
- } else {
- style.bg0_pixel = color.handle.pixel;
- style.bg0_red = color.handle.red;
- style.bg0_green = color.handle.green;
- style.bg0_blue = color.handle.blue;
- style.bg1_pixel = color.handle.pixel;
- style.bg1_red = color.handle.red;
- style.bg1_green = color.handle.green;
- style.bg1_blue = color.handle.blue;
- style.bg2_pixel = color.handle.pixel;
- style.bg2_red = color.handle.red;
- style.bg2_green = color.handle.green;
- style.bg2_blue = color.handle.blue;
- style.bg3_pixel = color.handle.pixel;
- style.bg3_red = color.handle.red;
- style.bg3_green = color.handle.green;
- style.bg3_blue = color.handle.blue;
- style.bg4_pixel = color.handle.pixel;
- style.bg4_red = color.handle.red;
- style.bg4_green = color.handle.green;
- style.bg4_blue = color.handle.blue;
- }
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
- if (makeCopy) {
- OS.gtk_style_unref (hStyle);
- }
-}
-
-/**
- * If the argument is <code>true</code>, causes the receiver to have
- * all mouse events delivered to it until the method is called with
- * <code>false</code> as the argument.
- *
- * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCapture (boolean capture) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- /*
- if (capture) {
- OS.gtk_widget_grab_focus (handle);
- } else {
- OS.gtk_widget_grab_default (handle);
- }
- */
-}
-/**
- * Sets the receiver's cursor to the cursor specified by the
- * argument, or to the default cursor for that kind of control
- * if the argument is null.
- * <p>
- * When the mouse pointer passes over a control its appearance
- * is changed to match the control's cursor.
- * </p>
- *
- * @param cursor the new cursor (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCursor (Cursor cursor) {
- checkWidget();
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
- int window = widget.window;
- if (window == 0) return;
- int hCursor = 0;
- if (cursor != null) hCursor = cursor.handle;
- OS.gdk_window_set_cursor (window, hCursor);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int topHandle = topHandle ();
- OS.gtk_widget_set_sensitive (topHandle, enabled);
- /*
- * This code is intentionally commented
- */
-// OS.gtk_widget_set_state (topHandle, enabled ? OS.GTK_STATE_NORMAL : OS.GTK_STATE_INSENSITIVE);
-// if (enabled) {
-// OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
-// } else {
-// OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
-// }
-}
-/**
- * Causes the receiver to have the <em>keyboard focus</em>,
- * such that all keyboard events will be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #forceFocus
- */
-public boolean setFocus () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return forceFocus ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
-
- /* The non-null font case */
- if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int fontHandle = OS.gdk_font_ref(font.handle);
- _setFontHandle(fontHandle);
- return;
- }
-
- /* The font argument is null, revert to default font */
- GtkStyle style = new GtkStyle();
- OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- int fontHandle = OS.gdk_font_ref(style.font);
- if (fontHandle==0) error(SWT.ERROR_NO_HANDLES);
- _setFontHandle(fontHandle);
-}
-
-/**
- * Actually set the receiver's font in the OS.
- * Concrete subclasses may override this method to operate
- * on a different handle.
- */
-void _setFontHandle (int f) {
- UtilFuncs.setFont(handle, f);
-}
-
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int hStyle = OS.gtk_widget_get_style (handle);
- hStyle = OS.gtk_style_copy (hStyle);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, hStyle, GtkStyle.sizeof);
- if (color == null) {
- int hDefaultStyle = OS.gtk_widget_get_default_style ();
- GtkStyle defaultStyle = new GtkStyle ();
- OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
- style.fg0_pixel = defaultStyle.fg0_pixel;
- style.fg0_red = defaultStyle.fg0_red;
- style.fg0_green = defaultStyle.fg0_green;
- style.fg0_blue = defaultStyle.fg0_blue;
- style.fg1_pixel = defaultStyle.fg1_pixel;
- style.fg1_red = defaultStyle.fg1_red;
- style.fg1_green = defaultStyle.fg1_green;
- style.fg1_blue = defaultStyle.fg1_blue;
- style.fg2_pixel = defaultStyle.fg2_pixel;
- style.fg2_red = defaultStyle.fg2_red;
- style.fg2_green = defaultStyle.fg2_green;
- style.fg2_blue = defaultStyle.fg2_blue;
- style.fg3_pixel = defaultStyle.fg3_pixel;
- style.fg3_red = defaultStyle.fg3_red;
- style.fg3_green = defaultStyle.fg3_green;
- style.fg3_blue = defaultStyle.fg3_blue;
- style.fg4_pixel = defaultStyle.fg4_pixel;
- style.fg4_red = defaultStyle.fg4_red;
- style.fg4_green = defaultStyle.fg4_green;
- style.fg4_blue = defaultStyle.fg4_blue;
- } else {
- style.fg0_pixel = color.handle.pixel;
- style.fg0_red = color.handle.red;
- style.fg0_green = color.handle.green;
- style.fg0_blue = color.handle.blue;
- style.fg1_pixel = color.handle.pixel;
- style.fg1_red = color.handle.red;
- style.fg1_green = color.handle.green;
- style.fg1_blue = color.handle.blue;
- style.fg2_pixel = color.handle.pixel;
- style.fg2_red = color.handle.red;
- style.fg2_green = color.handle.green;
- style.fg2_blue = color.handle.blue;
- style.fg3_pixel = color.handle.pixel;
- style.fg3_red = color.handle.red;
- style.fg3_green = color.handle.green;
- style.fg3_blue = color.handle.blue;
- style.fg4_pixel = color.handle.pixel;
- style.fg4_red = color.handle.red;
- style.fg4_green = color.handle.green;
- style.fg4_blue = color.handle.blue;
- }
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
-}
-
-/**
- * Sets the receiver's pop up menu to the argument.
- * All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (menu != null) {
- if ((menu.style & SWT.POP_UP) == 0) {
- error (SWT.ERROR_MENU_NOT_POP_UP);
- }
- if (menu.parent != menuShell ()) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
- this.menu = menu;
-}
-
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers <code>true</code> if the parent is successfully changed.
- *
- * @param parent the new parent for the control.
- * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean setParent (Composite parent) {
- checkWidget();
- if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return false;
-}
-
-/**
- * If the argument is <code>false</code>, causes subsequent drawing
- * operations in the receiver to be ignored. No drawing of any kind
- * can occur in the receiver until the flag is set to true.
- * Graphics operations that occurred while the flag was
- * <code>false</code> are lost. When the flag is set to <code>true</code>,
- * the entire widget is marked as needing to be redrawn.
- * <p>
- * Note: This operation is a hint and may not be supported on some
- * platforms or for some widgets.
- * </p>
- *
- * @param redraw the new redraw state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- * @see #update
- */
-public void setRedraw (boolean redraw) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- toolTipText = string;
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- int topHandle = topHandle();
- if (visible) {
- sendEvent (SWT.Show);
- OS.gtk_widget_show (topHandle);
- } else {
- OS.gtk_widget_hide (topHandle);
- sendEvent (SWT.Hide);
- }
-}
-void sort (int [] items) {
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap=length/2; gap>0; gap/=2) {
- for (int i=gap; i<length; i++) {
- for (int j=i-gap; j>=0; j-=gap) {
- if (items [j] <= items [j + gap]) {
- int swap = items [j];
- items [j] = items [j + gap];
- items [j + gap] = swap;
- }
- }
- }
- }
-}
-
-/**
- * Based on the argument, perform one of the expected platform
- * traversal action. The argument should be one of the constants:
- * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
- * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
- * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
- *
- * @param traversal the type of traversal
- * @return true if the traversal succeeded
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean traverse (int traversal) {
- checkWidget ();
- if (!isFocusControl () && !setFocus ()) return false;
- Event event = new Event ();
- event.doit = true;
- event.detail = traversal;
- return traverse (event);
-}
-
-boolean traverse (Event event) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the traverse
- * event. If this happens, return true to stop further
- * event processing.
- */
- sendEvent (SWT.Traverse, event);
- if (isDisposed ()) return false;
- if (!event.doit) return false;
- switch (event.detail) {
- case SWT.TRAVERSE_NONE: return true;
- /*
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character);
- case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true);
- case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false);
- */
- }
- error(SWT.ERROR_NOT_IMPLEMENTED);
- return false;
-}
-
-
-/**
- * Forces all outstanding paint requests for the widget tree
- * to be processed before this method returns.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- */
-public void update () {
- checkWidget ();
- //NOT DONE - should only dispatch paint events
- OS.gdk_flush ();
- while ((OS.gtk_events_pending()) != 0) {
- OS.gtk_main_iteration ();
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java
deleted file mode 100644
index 1df146eab7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java
+++ /dev/null
@@ -1,447 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide the appearance and
- * behavior of <code>Shells</code>, but are not top
- * level shells or dialogs. Class <code>Shell</code>
- * shares a significant amount of code with this class,
- * and is a subclass.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations.
- * For example, some window managers only support resizable
- * windows and will always assume the RESIZE style, even if
- * it is not set.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- *
- * @see #getMinimized
- * @see #getMaximized
- * @see Shell
- * @see SWT
- */
-
-public class Decorations extends Canvas {
- String text;
- Image image;
- Menu menuBar;
- Menu [] menus;
- Button defaultButton, saveDefault;
-Decorations () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Decorations (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
- style |= SWT.TITLE;
- }
- return style;
-}
-
-void add (Menu menu) {
- if (menus == null) menus = new Menu [4];
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == null) {
- menus [i] = menu;
- return;
- }
- }
- Menu [] newMenus = new Menu [menus.length + 4];
- newMenus [menus.length] = menu;
- System.arraycopy (menus, 0, newMenus, 0, menus.length);
- menus = newMenus;
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-/**
- * Returns the receiver's default button if one had
- * previously been set, otherwise returns null.
- *
- * @return the default button or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setDefaultButton
- */
-public Button getDefaultButton () {
- checkWidget();
- return defaultButton;
-}
-/**
- * Returns the receiver's image if it had previously been
- * set using <code>setImage()</code>. The image is typically
- * displayed by the window manager when the instance is
- * marked as iconified, and may also be displayed somewhere
- * in the trim when the instance is in normal or maximized
- * states.
- * <p>
- * Note: This method will return null if called before
- * <code>setImage()</code> is called. It does not provide
- * access to a window manager provided, "default" image
- * even if one exists.
- * </p>
- *
- * @return the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * maximized, and false otherwise.
- * <p>
- *
- * @return the maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public boolean getMaximized () {
- checkWidget();
- return false;
-}
-/**
- * Returns the receiver's menu bar if one had previously
- * been set, otherwise returns null.
- *
- * @return the menu bar or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenuBar () {
- checkWidget();
- return menuBar;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * minimized, and false otherwise.
- * <p>
- *
- * @return the minimized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public boolean getMinimized () {
- checkWidget();
- return false;
-}
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-Decorations menuShell () {
- return this;
-}
-
-void remove (Menu menu) {
- if (menus == null) return;
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == menu) {
- menus [i] = null;
- return;
- }
- }
-}
-
-void releaseWidget () {
- if (menuBar != null) {
- menuBar.releaseWidget ();
- menuBar.releaseHandle ();
- }
- menuBar = null;
- if (menus != null) {
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- }
- }
- menus = null;
- super.releaseWidget ();
- image = null;
- defaultButton = saveDefault = null;
-}
-/**
- * If the argument is not null, sets the receiver's default
- * button to the argument, and if the argument is null, sets
- * the receiver's default button to the first button which
- * was set as the receiver's default button (called the
- * <em>saved default button</em>). If no default button had
- * previously been set, or the saved default button was
- * disposed, the receiver's default button will be set to
- * null.
- *
- * @param the new default button
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultButton (Button button) {
- checkWidget();
-}
-/**
- * Sets the receiver's image to the argument, which may
- * be null. The image is typically displayed by the window
- * manager when the instance is marked as iconified, and
- * may also be displayed somewhere in the trim when the
- * instance is in normal or maximized states.
- *
- * @param image the new image (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- this.image = image;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- GtkWidget widget = new GtkWidget ();
- OS.memmove(widget, topHandle(), GtkWidget.sizeof);
- OS.gdk_window_set_icon (widget.window, 0, pixmap, mask);
-}
-/**
- * Sets the maximized state of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the maximized state, and if the argument is
- * <code>false</code> and the receiver was previously maximized,
- * causes the receiver to switch back to either the minimized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public void setMaximized (boolean maximized) {
- checkWidget();
-}
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenuBar (Menu menu) {
- checkWidget();
- if (menuBar == menu) return;
- if (menu != null) {
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- menuBar = menu;
-}
-/**
- * Sets the minimized stated of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the minimized state, and if the argument is
- * <code>false</code> and the receiver was previously minimized,
- * causes the receiver to switch back to either the maximized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public void setMinimized (boolean minimized) {
- checkWidget();
-}
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java
deleted file mode 100644
index 261a6706e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select a directory.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class DirectoryDialog extends GtkFileDialog {
- String message = "", filterPath = "";
- String directoryPath;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Returns the path which the dialog will use to filter
- * the directories it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the selected directory,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- return super.open();
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the directories it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-boolean getAnswer() {
- String fileNameFromOS = getFileNameFromOS();
- int separatorIndex = calculateLastSeparatorIndex(fileNameFromOS);
- if (separatorIndex+1 != fileNameFromOS.length()) return false; // the user selected a file
- directoryPath = answer = fileNameFromOS;
- return true;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java
deleted file mode 100644
index 6512842431..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java
+++ /dev/null
@@ -1,1516 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are responsible for managing the
- * connection between SWT and the underlying operating
- * system. Their most important function is to implement
- * the SWT event loop in terms of the platform event model.
- * They also provide various methods for accessing information
- * about the operating system, and have overall control over
- * the operating system resources which SWT allocates.
- * <p>
- * Applications which are built with SWT will <em>almost always</em>
- * require only a single display. In particular, some platforms
- * which SWT supports will not allow more than one <em>active</em>
- * display. In other words, some platforms do not support
- * creating a new display if one already exists that has not been
- * sent the <code>dispose()</code> message.
- * <p>
- * In SWT, the thread which creates a <code>Display</code>
- * instance is distinguished as the <em>user-interface thread</em>
- * for that display.
- * </p>
- * The user-interface thread for a particular display has the
- * following special attributes:
- * <ul>
- * <li>
- * The event loop for that display must be run from the thread.
- * </li>
- * <li>
- * Some SWT API methods (notably, most of the public methods in
- * <code>Widget</code> and its subclasses), may only be called
- * from the thread. (To support multi-threaded user-interface
- * applications, class <code>Display</code> provides inter-thread
- * communication methods which allow threads other than the
- * user-interface thread to request that it perform operations
- * on their behalf.)
- * </li>
- * <li>
- * The thread is not allowed to construct other
- * <code>Display</code>s until that display has been disposed.
- * (Note that, this is in addition to the restriction mentioned
- * above concerning platform support for multiple displays. Thus,
- * the only way to have multiple simultaneously active displays,
- * even on platforms which support it, is to have multiple threads.)
- * </li>
- * </ul>
- * Enforcing these attributes allows SWT to be implemented directly
- * on the underlying operating system's event model. This has
- * numerous benefits including smaller footprint, better use of
- * resources, safer memory management, clearer program logic,
- * better performance, and fewer overall operating system threads
- * required. The down side however, is that care must be taken
- * (only) when constructing multi-threaded applications to use the
- * inter-thread communication mechanisms which this class provides
- * when required.
- * </p><p>
- * All SWT API methods which may only be called from the user-interface
- * thread are distinguished in their documentation by indicating that
- * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
- * SWT exception.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see #syncExec
- * @see #asyncExec
- * @see #wake
- * @see #readAndDispatch
- * @see #sleep
- * @see #dispose
- */
-
-public class Display extends Device {
-
- /* Events Dispatching and Callback */
- Event [] eventQueue;
- int windowProc2, windowProc3, windowProc4, windowProc5;
- Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5;
-
- /* Sync/Async Widget Communication */
- Synchronizer synchronizer = new Synchronizer (this);
- int messagesSize;
- RunnableLock [] messages;
- Object messageLock = new Object ();
- Thread thread = Thread.currentThread ();
-
- /* Display Shutdown */
- Runnable [] disposeList;
-
- /* Timers */
- int [] timerIDs;
- Runnable [] timerList;
- Callback timerCallback;
- int timerProc;
-
- /* Caret */
- Caret currentCaret;
- Callback caretCallback;
- int caretID, caretProc;
-
- /* Colors */
- Color NORMAL_fg, NORMAL_bg, NORMAL_dark, NORMAL_mid, NORMAL_light, NORMAL_text, NORMAL_base;
- Color ACTIVE_fg, ACTIVE_bg, ACTIVE_dark, ACTIVE_mid, ACTIVE_light, ACTIVE_text, ACTIVE_base;
- Color PRELIGHT_fg, PRELIGHT_bg, PRELIGHT_dark, PRELIGHT_mid, PRELIGHT_light, PRELIGHT_text, PRELIGHT_base;
- Color SELECTED_fg, SELECTED_bg, SELECTED_dark, SELECTED_mid, SELECTED_light, SELECTED_text, SELECTED_base;
- Color INSENSITIVE_fg, INSENSITIVE_bg, INSENSITIVE_dark, INSENSITIVE_mid, INSENSITIVE_light, INSENSITIVE_text, INSENSITIVE_base;
-
- /* Key Mappings */
- static final int [] [] KeyTable = {
-
- /* Keyboard and Mouse Masks */
- {OS.GDK_Alt_L, SWT.ALT},
- {OS.GDK_Alt_R, SWT.ALT},
- {OS.GDK_Shift_L, SWT.SHIFT},
- {OS.GDK_Shift_R, SWT.SHIFT},
- {OS.GDK_Control_L, SWT.CONTROL},
- {OS.GDK_Control_R, SWT.CONTROL},
-
- /* Non-Numeric Keypad Constants */
- {OS.GDK_Up, SWT.ARROW_UP},
- {OS.GDK_Down, SWT.ARROW_DOWN},
- {OS.GDK_Left, SWT.ARROW_LEFT},
- {OS.GDK_Right, SWT.ARROW_RIGHT},
- {OS.GDK_Page_Up, SWT.PAGE_UP},
- {OS.GDK_Page_Down, SWT.PAGE_DOWN},
- {OS.GDK_Home, SWT.HOME},
- {OS.GDK_End, SWT.END},
- {OS.GDK_Insert, SWT.INSERT},
-
- /* NOT CURRENTLY USED */
-// {OS.GDK_Delete, SWT.DELETE},
- {OS.GDK_Return, SWT.CR},
-
- /* Functions Keys */
- {OS.GDK_F1, SWT.F1},
- {OS.GDK_F2, SWT.F2},
- {OS.GDK_F3, SWT.F3},
- {OS.GDK_F4, SWT.F4},
- {OS.GDK_F5, SWT.F5},
- {OS.GDK_F6, SWT.F6},
- {OS.GDK_F7, SWT.F7},
- {OS.GDK_F8, SWT.F8},
- {OS.GDK_F9, SWT.F9},
- {OS.GDK_F10, SWT.F10},
- {OS.GDK_F11, SWT.F11},
- {OS.GDK_F12, SWT.F12},
-
- /* Numeric Keypad Constants */
- /* NOT CURRENTLY USED */
-// {OS.GDK_KP_Add, SWT.KP_PLUS},
-// {OS.GDK_KP_Subtract, SWT.KP_MINUS},
-// {OS.GDK_KP_Multiply, SWT.KP_TIMES},
-// {OS.GDK_KP_Divide, SWT.KP_DIVIDE},
-// {OS.GDK_KP_Decimal, SWT.KP_PERIOD},
-// {OS.GDK_KP_Enter, SWT.CR},
-// {OS.GDK_KP_0, SWT.KP_0},
-// {OS.GDK_KP_1, SWT.KP_1},
-// {OS.GDK_KP_2, SWT.KP_2},
-// {OS.GDK_KP_3, SWT.KP_3},
-// {OS.GDK_KP_4, SWT.KP_4},
-// {OS.GDK_KP_5, SWT.KP_5},
-// {OS.GDK_KP_6, SWT.KP_6},
-// {OS.GDK_KP_7, SWT.KP_7},
-// {OS.GDK_KP_8, SWT.KP_8},
-// {OS.GDK_KP_9, SWT.KP_9},
-
- };
-
- /* Multiple Displays. */
- static Display Default;
- static Display [] Displays = new Display [4];
-
- /* Package name */
- static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets.";
- /* This code is intentionally commented.
- * ".class" can not be used on CLDC.
- */
- /*static {
- String name = Display.class.getName ();
- int index = name.lastIndexOf ('.');
- PACKAGE_NAME = name.substring (0, index + 1);
- }*/
-
- /* #define in gdkevents.h */
- static final int DOUBLE_CLICK_TIME = 250;
-
- /* Display Data */
- Object data;
- String [] keys;
- Object [] values;
-
- /*
- * TEMPORARY CODE. Install the runnable that
- * gets the current display. This code will
- * be removed in the future.
- */
- static {
- DeviceFinder = new Runnable () {
- public void run () {
- Device device = getCurrent ();
- if (device == null) {
- device = getDefault ();
- }
- setDevice (device);
- }
- };
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static void setDevice (Device device) {
- CurrentDevice = device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * Note: The resulting display is marked as the <em>current</em>
- * display. If this is the first display which has been
- * constructed since the application started, it is also
- * marked as the <em>default</em> display.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see #getCurrent
- * @see #getDefault
- * @see Widget#checkSubclass
- * @see Shell
- */
-public Display () {
- this (null);
-}
-
-public Display (DeviceData data) {
- super (data);
-}
-
-void addLast (RunnableLock entry) {
- synchronized (messageLock) {
- if (messages == null) messages = new RunnableLock [4];
- if (messagesSize == messages.length) {
- RunnableLock[] newMessages = new RunnableLock [messagesSize + 4];
- System.arraycopy (messages, 0, newMessages, 0, messagesSize);
- messages = newMessages;
- }
- messages [messagesSize++] = entry;
- }
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-public void asyncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.asyncExec (runnable);
-}
-
-/**
- * Causes the system hardware to emit a short sound
- * (if it supports this capability).
- */
-public void beep () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- OS.gdk_beep();
- OS.gdk_flush();
-}
-
-protected void checkDevice () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-static synchronized void checkDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] != null && Displays [i].thread == thread) {
- SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- }
-}
-
-protected void checkSubclass () {
- if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-protected void create (DeviceData data) {
- checkSubclass ();
- checkDisplay(thread = Thread.currentThread ());
- createDisplay (data);
- register ();
- if (Default == null) Default = this;
-}
-
-synchronized void createDisplay (DeviceData data) {
- if (!OS.gtk_init_check (new int [] {0}, null)) {
- /*
- * This code is intentionally commented.
- */
-// disposed = true;
-// SWT.error (SWT.ERROR_DEVICE_DISPOSED);
- return;
- }
- OS.gdk_rgb_init ();
- int ptr = OS.gtk_check_version (1, 2, 8);
- if (ptr != 0) {
- System.out.println ("***WARNING: SWT requires GTK version 1.2.8 or greater");
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer)));
- }
-}
-
-synchronized void deregister () {
- for (int i=0; i<Displays.length; i++) {
- if (this == Displays [i]) Displays [i] = null;
- }
-}
-
-protected void destroy () {
- if (this == Default) Default = null;
- deregister ();
- destroyDisplay ();
-}
-
-void destroyDisplay () {
-}
-
-/**
- * Returns the display which the given thread is the
- * user-interface thread for, or null if the given thread
- * is not a user-interface thread for any display.
- *
- * @param thread the user-interface thread
- * @return the display for the given thread
- */
-public static synchronized Display findDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == thread) {
- return display;
- }
- }
- return null;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread just before the
- * receiver is disposed.
- *
- * @param runnable code to run at dispose time.
- */
-public void disposeExec (Runnable runnable) {
- checkDevice ();
- if (disposeList == null) disposeList = new Runnable [4];
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] == null) {
- disposeList [i] = runnable;
- return;
- }
- }
- Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
- System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
- newDisposeList [disposeList.length] = runnable;
- disposeList = newDisposeList;
-}
-
-/**
- * Does whatever display specific cleanup is required, and then
- * uses the code in <code>SWTError.error</code> to handle the error.
- *
- * @param code the descriptive error code
- *
- * @see SWTError#error
- */
-void error (int code) {
- throw new SWTError (code);
-}
-
-/**
- * Given the operating system handle for a widget, returns
- * the instance of the <code>Widget</code> subclass which
- * represents it in the currently running application, if
- * such exists, or null if no matching widget can be found.
- *
- * @param handle the handle for the widget
- * @return the SWT widget that the handle represents
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Widget findWidget (int handle) {
- checkDevice ();
- // In 0.058 and before, this used to go up the parent
- // chain if the handle was not found in the widget
- // table, up to the root. Now, we require that all
- // widgets register ALL their handles.
- // If somebody creates their own handles outside
- // SWT, it's their problem.
- return WidgetTable.get (handle);
-}
-
-/*
- * In SWT, we force all widgets to have real Gdk windows,
- * thus getting rid of the concept of "lightweight" widgets.
- * Given a GdkWindow, answer a handle to the GtkWidget realized
- * through that window.
- * If the argument is not the pointe rto a GdkWindow, the
- * universe will be left in an inconsistent state.
- */
-int findGtkWidgetByGdkWindow (int gdkWindow) {
- int[] pwidget = new int[1];
- OS.gdk_window_get_user_data(gdkWindow, pwidget);
- return pwidget[0];
-}
-
-/**
- * Returns the currently active <code>Shell</code>, or null
- * if no shell belonging to the currently running application
- * is active.
- *
- * @return the active shell or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getActiveShell () {
- checkDevice ();
- Shell [] shells = getShells();
- for (int i=0; i<shells.length; i++) {
- if (shells [i].hasFocus) return shells [i];
- }
- return null;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- return new Rectangle(0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ());
-}
-
-/**
- * Returns the display which the currently running thread is
- * the user-interface thread for, or null if the currently
- * running thread is not a user-interface thread for any display.
- *
- * @return the current display
- */
-public static synchronized Display getCurrent () {
- Thread current = Thread.currentThread ();
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == current) return display;
- }
- return null;
-}
-
-/**
- * Returns the control which the on-screen pointer is currently
- * over top of, or null if it is not currently over one of the
- * controls built by the currently running application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getCursorControl () {
- checkDevice();
- int[] x = new int[1], y = new int[1];
- int cursorWindowHandle = OS.gdk_window_at_pointer(x,y);
- if (cursorWindowHandle==0) return null;
- int handle = findGtkWidgetByGdkWindow(cursorWindowHandle);
- if (handle==0) return null;
- return findControl(handle);
-}
-
-Control findControl(int h) {
- Widget w = findWidget(h);
- if (w==null) return null;
- if (w instanceof Control) return (Control)w;
- // w is something like an Item. Go for the parent
-
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, h, GtkWidget.sizeof);
- return findControl(widget.parent);
-}
-
-/**
- * Returns the location of the on-screen pointer relative
- * to the top left corner of the screen.
- *
- * @return the cursor location
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCursorLocation () {
- checkDevice ();
- int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, 0);
- return new Point (x [0], y [0]);
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData (String key) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the application defined, display specific data
- * associated with the receiver, or null if it has not been
- * set. The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @return the display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData () {
- checkDevice ();
- return data;
-}
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- int widthMM = OS.gdk_screen_width_mm ();
- int width = OS.gdk_screen_width ();
- // compute round(25.4 * width / widthMM)
- int dpi = Compatibility.round(254 * width, widthMM * 10);
- return new Point (dpi, dpi);
-}
-
-/**
- * Returns the default display. One is created (making the
- * thread that invokes this method its user-interface thread)
- * if it did not already exist.
- *
- * @return the default display
- */
-public static synchronized Display getDefault () {
- if (Default == null) Default = new Display ();
- return Default;
-}
-
-static boolean isValidClass (Class clazz) {
- String name = clazz.getName ();
- int index = name.lastIndexOf ('.');
- return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
-}
-
-/**
- * Returns the longest duration, in milliseconds, between
- * two mouse button clicks that will be considered a
- * <em>double click</em> by the underlying operating system.
- *
- * @return the double click time
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getDoubleClickTime () {
- checkDevice ();
- return DOUBLE_CLICK_TIME;
-}
-
-/**
- * Returns the control which currently has keyboard focus,
- * or null if keyboard events are not currently going to
- * any of the controls built by the currently running
- * application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getFocusControl () {
- checkDevice ();
- Shell active = getActiveShell();
- if (active==null) return null;
- return active.getFocusControl();
-}
-
-public int getDepth () {
- checkDevice ();
- GdkVisual visual = new GdkVisual ();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- return visual.depth;
-}
-
-/**
- * Returns the maximum allowed depth of icons on this display.
- * On some platforms, this may be different than the actual
- * depth of the display.
- *
- * @return the maximum icon depth
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIconDepth () {
- checkDevice ();
- return getDepth ();
-}
-
-/**
- * Returns an array containing all shells which have not been
- * disposed and have the receiver as their display.
- *
- * @return the receiver's shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkDevice ();
- int count = 0;
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && (this == shell.getDisplay ())) {
- count++;
- }
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && (this == shell.getDisplay ())) {
- result [index++] = shell;
- }
- }
- return result;
-}
-
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or null if no such runnable is currently being invoked by
- * the user-interface thread.
- * <p>
- * Note: If a runnable invoked by asyncExec is currently
- * running, this method will return null.
- * </p>
- *
- * @return the receiver's sync-interface thread
- */
-public Thread getSyncThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return synchronizer.syncThread;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- switch (id) {
- case SWT.COLOR_INFO_FOREGROUND: return NORMAL_fg;
- case SWT.COLOR_INFO_BACKGROUND: return NORMAL_bg;
-
- case SWT.COLOR_TITLE_FOREGROUND: return SELECTED_text;
- case SWT.COLOR_TITLE_BACKGROUND: return SELECTED_bg;
- case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: return SELECTED_light;
- case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: return INSENSITIVE_fg;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: return INSENSITIVE_bg;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: return INSENSITIVE_light;
-
- case SWT.COLOR_WIDGET_DARK_SHADOW: return NORMAL_dark;
- case SWT.COLOR_WIDGET_NORMAL_SHADOW: return NORMAL_mid;
- case SWT.COLOR_WIDGET_LIGHT_SHADOW: return NORMAL_light;
- case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: return NORMAL_light;
- case SWT.COLOR_WIDGET_BACKGROUND: return NORMAL_bg;
- case SWT.COLOR_WIDGET_FOREGROUND: return NORMAL_fg;
- case SWT.COLOR_WIDGET_BORDER: return super.getSystemColor (SWT.COLOR_BLACK);
-
- case SWT.COLOR_LIST_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
- case SWT.COLOR_LIST_BACKGROUND: return super.getSystemColor (SWT.COLOR_WHITE);
- case SWT.COLOR_LIST_SELECTION: return SELECTED_bg;
- case SWT.COLOR_LIST_SELECTION_TEXT: return SELECTED_text;
- }
- return super.getSystemColor (id);
-}
-
-void initializeSystemColors() {
-
- /* Get the theme colors */
- GtkStyle defaultStyle = new GtkStyle();
- OS.memmove (defaultStyle, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
-
- GdkColor gdk_NORMAL_dark = new GdkColor();
- gdk_NORMAL_dark.pixel = defaultStyle.dark0_pixel;
- gdk_NORMAL_dark.red = defaultStyle.dark0_red;
- gdk_NORMAL_dark.green = defaultStyle.dark0_green;
- gdk_NORMAL_dark.blue = defaultStyle.dark0_blue;
- NORMAL_dark = Color.gtk_new(gdk_NORMAL_dark);
-
- GdkColor gdk_NORMAL_mid = new GdkColor();
- gdk_NORMAL_mid.pixel = defaultStyle.mid0_pixel;
- gdk_NORMAL_mid.red = defaultStyle.mid0_red;
- gdk_NORMAL_mid.green = defaultStyle.mid0_green;
- gdk_NORMAL_mid.blue = defaultStyle.mid0_blue;
- NORMAL_mid = Color.gtk_new(gdk_NORMAL_mid);
-
- GdkColor gdk_NORMAL_light = new GdkColor();
- gdk_NORMAL_light.pixel = defaultStyle.light0_pixel;
- gdk_NORMAL_light.red = defaultStyle.light0_red;
- gdk_NORMAL_light.green = defaultStyle.light0_green;
- gdk_NORMAL_light.blue = defaultStyle.light0_blue;
- NORMAL_light = Color.gtk_new(gdk_NORMAL_light);
-
- GdkColor gdk_NORMAL_fg = new GdkColor();
- gdk_NORMAL_fg.pixel = defaultStyle.fg0_pixel;
- gdk_NORMAL_fg.red = defaultStyle.fg0_red;
- gdk_NORMAL_fg.green = defaultStyle.fg0_green;
- gdk_NORMAL_fg.blue = defaultStyle.fg0_blue;
- NORMAL_fg = Color.gtk_new(gdk_NORMAL_fg);
-
- GdkColor gdk_NORMAL_bg = new GdkColor();
- gdk_NORMAL_bg.pixel = defaultStyle.bg0_pixel;
- gdk_NORMAL_bg.red = defaultStyle.bg0_red;
- gdk_NORMAL_bg.green = defaultStyle.bg0_green;
- gdk_NORMAL_bg.blue = defaultStyle.bg0_blue;
- NORMAL_bg = Color.gtk_new(gdk_NORMAL_bg);
-
- GdkColor gdk_NORMAL_text = new GdkColor();
- gdk_NORMAL_text.pixel = defaultStyle.text0_pixel;
- gdk_NORMAL_text.red = defaultStyle.text0_red;
- gdk_NORMAL_text.green = defaultStyle.text0_green;
- gdk_NORMAL_text.blue = defaultStyle.text0_blue;
- NORMAL_text = Color.gtk_new(gdk_NORMAL_text);
-
- GdkColor gdk_NORMAL_base = new GdkColor();
- gdk_NORMAL_base.pixel = defaultStyle.base0_pixel;
- gdk_NORMAL_base.red = defaultStyle.base0_red;
- gdk_NORMAL_base.green = defaultStyle.base0_green;
- gdk_NORMAL_base.blue = defaultStyle.base0_blue;
- NORMAL_base = Color.gtk_new(gdk_NORMAL_base);
-
- GdkColor gdk_SELECTED_text = new GdkColor();
- gdk_SELECTED_text.pixel = defaultStyle.text3_pixel;
- gdk_SELECTED_text.red = defaultStyle.text3_red;
- gdk_SELECTED_text.green = defaultStyle.text3_green;
- gdk_SELECTED_text.blue = defaultStyle.text3_blue;
- SELECTED_text = Color.gtk_new(gdk_SELECTED_text);
-
- GdkColor gdk_SELECTED_bg = new GdkColor();
- gdk_SELECTED_bg.pixel = defaultStyle.bg3_pixel;
- gdk_SELECTED_bg.red = defaultStyle.bg3_red;
- gdk_SELECTED_bg.green = defaultStyle.bg3_green;
- gdk_SELECTED_bg.blue = defaultStyle.bg3_blue;
- SELECTED_bg = Color.gtk_new(gdk_SELECTED_bg);
-
- GdkColor gdk_SELECTED_base = new GdkColor();
- gdk_SELECTED_base.pixel = defaultStyle.base3_pixel;
- gdk_SELECTED_base.red = defaultStyle.base3_red;
- gdk_SELECTED_base.green = defaultStyle.base3_green;
- gdk_SELECTED_base.blue = defaultStyle.base3_blue;
- SELECTED_base = Color.gtk_new(gdk_SELECTED_base);
-
- GdkColor gdk_SELECTED_light = new GdkColor();
- gdk_SELECTED_light.pixel = defaultStyle.light3_pixel;
- gdk_SELECTED_light.red = defaultStyle.light3_red;
- gdk_SELECTED_light.green = defaultStyle.light3_green;
- gdk_SELECTED_light.blue = defaultStyle.light3_blue;
- SELECTED_light = Color.gtk_new(gdk_SELECTED_light);
-
-
- GdkColor gdk_PRELIGHT_light = new GdkColor();
- gdk_PRELIGHT_light.pixel = defaultStyle.light2_pixel;
- gdk_PRELIGHT_light.red = defaultStyle.light2_red;
- gdk_PRELIGHT_light.green = defaultStyle.light2_green;
- gdk_PRELIGHT_light.blue = defaultStyle.light2_blue;
- PRELIGHT_light = Color.gtk_new(gdk_PRELIGHT_light);
-
- GdkColor gdk_INSENSITIVE_light = new GdkColor();
- gdk_INSENSITIVE_light.pixel = defaultStyle.light4_pixel;
- gdk_INSENSITIVE_light.red = defaultStyle.light4_red;
- gdk_INSENSITIVE_light.green = defaultStyle.light4_green;
- gdk_INSENSITIVE_light.blue = defaultStyle.light4_blue;
- INSENSITIVE_light = Color.gtk_new(gdk_INSENSITIVE_light);
-
- GdkColor gdk_INSENSITIVE_fg = new GdkColor();
- gdk_INSENSITIVE_fg.pixel = defaultStyle.fg4_pixel;
- gdk_INSENSITIVE_fg.red = defaultStyle.fg4_red;
- gdk_INSENSITIVE_fg.green = defaultStyle.fg4_green;
- gdk_INSENSITIVE_fg.blue = defaultStyle.fg4_blue;
- INSENSITIVE_fg = Color.gtk_new(gdk_INSENSITIVE_fg);
-
- GdkColor gdk_INSENSITIVE_bg = new GdkColor();
- gdk_INSENSITIVE_bg.pixel = defaultStyle.bg4_pixel;
- gdk_INSENSITIVE_bg.red = defaultStyle.bg4_red;
- gdk_INSENSITIVE_bg.green = defaultStyle.bg4_green;
- gdk_INSENSITIVE_bg.blue = defaultStyle.bg4_blue;
- INSENSITIVE_bg = Color.gtk_new(gdk_INSENSITIVE_bg);
-
-
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- GtkStyle style = new GtkStyle();
- OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
- int gdkFont = style.font; // gives a GdkFont*
- return Font.gtk_new (gdkFont);
-}
-
-/**
- * Returns the user-interface thread for the receiver.
- *
- * @return the receiver's user-interface thread
- */
-public Thread getThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return thread;
-}
-
-protected void init () {
- super.init ();
- initializeCallbacks ();
- initializeSystemColors ();
-}
-
-void initializeCallbacks () {
- windowCallback2 = new Callback (this, "windowProc", 2);
- windowProc2 = windowCallback2.getAddress ();
- if (windowProc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback3 = new Callback (this, "windowProc", 3);
- windowProc3 = windowCallback3.getAddress ();
- if (windowProc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback4 = new Callback (this, "windowProc", 4);
- windowProc4 = windowCallback4.getAddress ();
- if (windowProc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- windowCallback5 = new Callback (this, "windowProc", 5);
- windowProc5 = windowCallback5.getAddress ();
- if (windowProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- timerCallback = new Callback (this, "timerProc", 2);
- timerProc = timerCallback.getAddress ();
- if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- caretCallback = new Callback(this, "caretProc", 2);
- caretProc = caretCallback.getAddress();
- if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int handle, GCData data) {
- OS.gdk_gc_destroy(handle);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
- int root = OS.GDK_ROOT_PARENT();
- int gc = OS.gdk_gc_new(root);
- data.drawable = root;
- return gc;
-}
-
-boolean isValidThread () {
- return thread == Thread.currentThread ();
-}
-
-void postEvent (Event event) {
- /*
- * Place the event at the end of the event queue.
- * This code is always called in the Display's
- * thread so it must be re-enterant but does not
- * need to be synchronized.
- */
- if (eventQueue == null) eventQueue = new Event [4];
- int index = 0;
- int length = eventQueue.length;
- while (index < length) {
- if (eventQueue [index] == null) break;
- index++;
- }
- if (index == length) {
- Event [] newQueue = new Event [length + 4];
- System.arraycopy (eventQueue, 0, newQueue, 0, length);
- eventQueue = newQueue;
- }
- eventQueue [index] = event;
-}
-
-/**
- * Reads an event from the operating system's event queue,
- * dispatches it appropriately, and returns <code>true</code>
- * if there is potentially more work to do, or <code>false</code>
- * if the caller can sleep until another event is placed on
- * the event queue.
- * <p>
- * In addition to checking the system event queue, this method also
- * checks if any inter-thread messages (created by <code>syncExec()</code>
- * or <code>asyncExec()</code>) are waiting to be processed, and if
- * so handles them before returning.
- * </p>
- *
- * @return <code>false</code> if the caller can sleep upon return from this method
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #sleep
- * @see #wake
- */
-public boolean readAndDispatch () {
- checkDevice ();
- int status = OS.gtk_events_pending ();
- if (status != 0) {
-// if ((status & OS.XtIMTimer) != 0) OS.XtAppProcessEvent (context, OS.XtIMTimer);
-// if ((status & OS.XtIMAlternateInput) != 0) OS.XtAppProcessEvent (context, OS.XtIMAlternateInput);
-// if ((status & OS.XtIMXEvent) != 0) {
-// OS.XtAppNextEvent (context, event);
-// OS.XtDispatchEvent (event);
-// }
-/* int eventPtr = OS.gdk_event_get();
- if (eventPtr != 0) {
- OS.gtk_main_do_event(eventPtr);
- }*/
- OS.gtk_main_iteration ();
- runDeferredEvents ();
- return true;
- }
- return runAsyncMessages ();
-}
-
-synchronized void register () {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] == null) {
- Displays [i] = this;
- return;
- }
- }
- Display [] newDisplays = new Display [Displays.length + 4];
- System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
- newDisplays [Displays.length] = this;
- Displays = newDisplays;
-}
-
-protected void release () {
-
- /* Release shells */
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
- }
- }
- while (readAndDispatch ()) {};
-
- /* Run dispose list */
- if (disposeList != null) {
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] != null) disposeList [i].run ();
- }
- }
- disposeList = null;
-
- /* Release synchronizer */
- synchronizer.releaseSynchronizer ();
- synchronizer = null;
- releaseDisplay ();
-
- super.release ();
-}
-
-void releaseDisplay () {
- windowCallback2.dispose (); windowCallback2 = null;
- windowCallback3.dispose (); windowCallback3 = null;
- windowCallback4.dispose (); windowCallback4 = null;
- windowCallback5.dispose (); windowCallback5 = null;
-
- /* Dispose the caret callback */
- if (caretID != 0) OS.gtk_timeout_remove (caretID);
- caretID = caretProc = 0;
- caretCallback.dispose ();
- caretCallback = null;
-
- /* Dispose the timer callback */
- if (timerIDs != null) {
- for (int i=0; i<timerIDs.length; i++) {
- if (timerIDs [i] != 0) OS.gtk_timeout_remove (timerIDs [i]);
- }
- }
- timerIDs = null;
- timerList = null;
- timerProc = 0;
- timerCallback.dispose ();
- timerCallback = null;
-
- messages = null; messageLock = null; thread = null;
- messagesSize = windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0;
-
- NORMAL_fg = NORMAL_bg = NORMAL_dark = NORMAL_mid = NORMAL_light = NORMAL_text = NORMAL_base =
- ACTIVE_fg = ACTIVE_bg = ACTIVE_dark = ACTIVE_mid = ACTIVE_light = ACTIVE_text = ACTIVE_base =
- PRELIGHT_fg = PRELIGHT_bg = PRELIGHT_dark = PRELIGHT_mid = PRELIGHT_light = PRELIGHT_text = PRELIGHT_base =
- SELECTED_fg = SELECTED_bg = SELECTED_dark = SELECTED_mid = SELECTED_light = SELECTED_text = SELECTED_base =
- INSENSITIVE_fg = INSENSITIVE_bg = INSENSITIVE_dark = INSENSITIVE_mid = INSENSITIVE_light = INSENSITIVE_text =
- INSENSITIVE_base = null;
-}
-
-RunnableLock removeFirst () {
- synchronized (messageLock) {
- if (messagesSize == 0) return null;
- RunnableLock lock = messages [0];
- System.arraycopy (messages, 1, messages, 0, --messagesSize);
- messages [messagesSize] = null;
- if (messagesSize == 0) messages = null;
- return lock;
- }
-}
-
-boolean runAsyncMessages () {
- return synchronizer.runAsyncMessages ();
-}
-
-boolean runDeferredEvents () {
- /*
- * Run deferred events. This code is always
- * called in the Display's thread so it must
- * be re-enterant need not be synchronized.
- */
- while (eventQueue != null) {
-
- /* Take an event off the queue */
- Event event = eventQueue [0];
- if (event == null) break;
- int length = eventQueue.length;
- System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
- eventQueue [length] = null;
-
- /* Run the event */
- Widget widget = event.widget;
- if (widget != null && !widget.isDisposed ()) {
- Widget item = event.item;
- if (item == null || !item.isDisposed ()) {
- widget.notifyListeners (event.type, event);
- }
- }
-
- /*
- * At this point, the event queue could
- * be null due to a recursive invokation
- * when running the event.
- */
- }
-
- /* Clear the queue */
- eventQueue = null;
- return true;
-}
-
-/**
- * On platforms which support it, sets the application name
- * to be the argument. On Motif, for example, this can be used
- * to set the name used for resource lookup.
- *
- * @param name the new app name
- */
-public static void setAppName (String name) {
- /* Do nothing - Gtk doesn't have the concept of application name. */
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given argument.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public void setData (String key, Object value) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Sets the application defined, display specific data
- * associated with the receiver, to the argument.
- * The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param data the new display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #getData
- * @see #disposeExec
- */
-public void setData (Object data) {
- checkDevice ();
- this.data = data;
-}
-
-/**
- * Sets the synchronizer used by the display to be
- * the argument, which can not be null.
- *
- * @param synchronizer the new synchronizer for the display (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSynchronizer (Synchronizer synchronizer) {
- checkDevice ();
- if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (this.synchronizer != null) {
- this.synchronizer.runAsyncMessages();
- }
- this.synchronizer = synchronizer;
-}
-
-/**
- * Causes the user-interface thread to <em>sleep</em> (that is,
- * to be put in a state where it does not consume CPU cycles)
- * until an event is received or it is otherwise awakened.
- *
- * @return <code>true</code> if an event requiring dispatching was placed on the queue.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #wake
- */
-
-public boolean sleep () {
- checkDevice ();
- /* Temporary code - need to sleep waiting for the next message */
- try { Thread.sleep(50); } catch (Exception e) {};
- return true;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread after the specified
- * number of milliseconds have elapsed.
- *
- * @param milliseconds the delay before running the runnable
- * @param runnable code to run on the user-interface thread
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void timerExec (int milliseconds, Runnable runnable) {
- checkDevice ();
- if (timerList == null) timerList = new Runnable [4];
- if (timerIDs == null) timerIDs = new int [4];
- int index = 0;
- while (index < timerList.length) {
- if (timerList [index] == null) break;
- index++;
- }
- if (index == timerList.length) {
- Runnable [] newTimerList = new Runnable [timerList.length + 4];
- System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
- timerList = newTimerList;
- int [] newTimerIDs = new int [timerIDs.length + 4];
- System.arraycopy (timerIDs, 0, newTimerIDs, 0, timerIDs.length);
- timerIDs = newTimerIDs;
- }
- int timerID = OS.gtk_timeout_add (milliseconds, timerProc, index);
- if (timerID != 0) {
- timerIDs [index] = timerID;
- timerList [index] = runnable;
- }
-}
-
-int timerProc (int index, int id) {
- if (timerList == null) return 0;
- if (0 <= index && index < timerList.length) {
- Runnable runnable = timerList [index];
- timerList [index] = null;
- timerIDs [index] = 0;
- if (runnable != null) runnable.run ();
- }
- return 0;
-}
-
-int caretProc (int clientData, int id) {
- caretID = 0;
- if (currentCaret == null) {
- return 0;
- }
- if (currentCaret.blinkCaret()) {
- int blinkRate = currentCaret.blinkRate;
- caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
- } else {
- currentCaret = null;
- }
- return 0;
-}
-
-void setCurrentCaret (Caret caret) {
- if (caretID != 0) OS.gtk_timeout_remove(caretID);
- caretID = 0;
- currentCaret = caret;
- if (caret == null) return;
- int blinkRate = currentCaret.blinkRate;
- caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void syncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.syncExec (runnable);
-}
-
-static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- }
- return 0;
-}
-
-static int untranslateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [1] == key) return KeyTable [i] [0];
- }
- return 0;
-}
-
-public void update () {
- checkDevice ();
- /* NOT IMPLEMENTED - Need to flush only pending draws */
- OS.gdk_flush ();
- while ((OS.gtk_events_pending ()) != 0) {
- OS.gtk_main_iteration ();
- }
-}
-
-/**
- * If the receiver's user-interface thread was <code>sleep</code>'ing,
- * causes it to be awakened and start running again. Note that this
- * method may be called from any thread.
- *
- * @see #sleep
- */
-public void wake () {
- /* NOT IMPLEMENTED - Need to wake up the event loop */
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-int windowProc (int handle, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, 0, 0, 0);
-}
-
-int windowProc (int handle, int int0, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, 0, 0);
-}
-
-int windowProc (int handle, int int0, int int1, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, int1, 0);
-}
-
-int windowProc (int handle, int int0, int int1, int int2, int user_data) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (user_data, int0, int1, int2);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java
deleted file mode 100644
index 940b7427f4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select or enter a file name.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SAVE, OPEN, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FileDialog extends GtkFileDialog {
-
- String fullPath, fileName, filterPath;
- String[] filterNames, filterExtensions;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the path of the first file that was
- * selected in the dialog relative to the filter path,
- * or null if none is available.
- *
- * @return the relative path of the file
- */
-public String getFileName () {
- return fileName;
-}
-/**
- * Returns the paths of all files that were selected
- * in the dialog relative to the filter path, or null
- * if none are available.
- *
- * @return the relative paths of the files
- */
-public String [] getFileNames () {
- return new String[] {fileName};
-}
-/**
- * Returns the file extensions which the dialog will
- * use to filter the files it shows.
- *
- * @return the file extensions filter
- */
-public String [] getFilterExtensions () {
- return filterExtensions;
-}
-/**
- * Returns the file names which the dialog will
- * use to filter the files it shows.
- *
- * @return the file name filter
- */
-public String [] getFilterNames () {
- return filterNames;
-}
-/**
- * Returns the path which the dialog will use to filter
- * the files it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Set the initial filename which the dialog will
- * select by default when opened to the argument,
- * which may be null. The name will be prefixed with
- * the filter path when one is supplied.
- *
- * @param string the file name
- */
-public void setFileName (String string) {
- fileName = string;
-}
-/**
- * Set the file extensions which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param extensions the file extension filter
- */
-public void setFilterExtensions (String [] extensions) {
- filterExtensions = extensions;
-}
-/**
- * Sets the file names which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param names the file name filter
- */
-public void setFilterNames (String [] names) {
- filterNames = names;
-}
-/**
- * Sets the path which the dialog will use to filter
- * the files it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-boolean getAnswer() {
- String fileNameFromOS = getFileNameFromOS();
- int separatorIndex = calculateLastSeparatorIndex(fileNameFromOS);
- if (separatorIndex+1 == fileNameFromOS.length()) return false; // the user selected a directory
- fullPath = answer = fileNameFromOS;
- fileName = fullPath.substring (separatorIndex + 1, fullPath.length ());
- filterPath = fullPath.substring (0, separatorIndex);
- return true;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java
deleted file mode 100644
index 8f3a57f991..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a font
- * from all available fonts in the system.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class FontDialog extends Dialog {
- FontData fontData;
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-int cancelFunc (int widget, int callData) {
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int colorInfo) {
- OS.gtk_main_quit ();
- return 0;
-}
-/**
- * Returns a FontData object describing the font that was
- * selected in the dialog, or null if none is available.
- *
- * @return the FontData for the selected font, or null
- */
-public FontData getFontData() {
- return fontData;
-}
-int okFunc (int widget, int callData) {
- int hFontName = OS.gtk_font_selection_dialog_get_font_name (callData);
- int fontSize = OS.strlen (hFontName);
- byte [] buffer = new byte [fontSize];
- OS.memmove (buffer, hFontName, fontSize);
- char [] fontName = Converter.mbcsToWcs (null, buffer);
- fontData = FontData.gtk_new(new String (fontName));
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a FontData object describing the font that was selected,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public FontData open () {
- int handle;
- byte [] titleBytes;
- titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_font_selection_dialog_new (titleBytes);
- GtkFontSelectionDialog dialog = new GtkFontSelectionDialog ();
- OS.memmove (dialog, handle, GtkFontSelectionDialog.sizeof);
- if (parent!=null) {
- OS.gtk_window_set_modal(handle, true);
- OS.gtk_window_set_transient_for(handle, parent.topHandle);
- }
- if (fontData != null) {
- byte[] buffer = Converter.wcsToMbcs(null, fontData.gtk_getXlfd(), true);
- OS.gtk_font_selection_set_font_name(dialog.fontsel, buffer);
- }
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
- OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
- fontData = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return fontData;
-}
-/**
- * Sets a FontData object describing the font to be
- * selected by default in the dialog, or null to let
- * the platform choose one.
- *
- * @param fontData the FontData to use initially, or null
- */
-public void setFontData (FontData fontData) {
- this.fontData = fontData;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java
deleted file mode 100644
index b0d72d4e90..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an etched border
- * with an optional title.
- * <p>
- * Shadow styles are hints and may not be honoured
- * by the platform. To create a group with the
- * default shadow style for the platform, do not
- * specify a shadow style.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Group extends Composite {
- int frameHandle;
- String text="";
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Group (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-void createHandle(int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- frameHandle = OS.gtk_frame_new(null);
- if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_fixed_new();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void _setHandleStyle() {
- int shadow = OS.GTK_SHADOW_IN;
- if ((style & SWT.SHADOW_IN) != 0) shadow = OS.GTK_SHADOW_IN;
- if ((style & SWT.SHADOW_OUT) != 0) shadow = OS.GTK_SHADOW_OUT;
- if ((style & SWT.SHADOW_ETCHED_IN) != 0) shadow = OS.GTK_SHADOW_ETCHED_IN;
- if ((style & SWT.SHADOW_ETCHED_OUT) != 0) shadow = OS.GTK_SHADOW_ETCHED_OUT;
- OS.gtk_frame_set_shadow_type(frameHandle, shadow);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, frameHandle);
- OS.gtk_container_add(frameHandle, handle);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = _computeSize(wHint, hHint, changed).x;
- int height = 0;
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (frameHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (frameHandle, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- frameHandle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- text = null;
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (frameHandle);
-}
-
-int topHandle () { return eventBoxHandle; }
-int parentingHandle() { return handle; }
-
-/*
- * === GEOMETRY ===
- */
-
-public Rectangle _getClientArea () {
- /*
- * The Group coordinates originate at the client area
- */
- int width, height;
- Point size = _getSize();
- width = size.x - _getTrim().left - _getTrim().right;
- height = size.y - _getTrim().top - _getTrim().bottom;
- return new Rectangle(0,0, width, height);
-}
-
-Trim _getTrim() {
- trim = new Trim();
-
- // set up the test widgets
- int testWindowHandle = OS.gtk_window_new(0);
- int testHandle = OS.gtk_frame_new(string2bytesConvertMnemonic("Test String"));
- OS.gtk_container_add(testWindowHandle, testHandle);
- OS.gtk_widget_realize(testHandle);
-
- // get info
- GtkFrame frame = new GtkFrame();
- OS.memmove (frame, testHandle, GtkFrame.sizeof);
- GtkStyle groupStyle = new GtkStyle();
- OS.memmove (groupStyle, frame.style, GtkStyle.sizeof);
- GtkStyleClass styleClass = new GtkStyleClass();
- OS.memmove (styleClass, groupStyle.klass, GtkStyleClass.sizeof);
-
- // see gtk_frame_size_allocate()
- trim.left = trim.right = frame.border_width + styleClass.xthickness;
- trim.top = frame.border_width + Math.max(frame.label_height, styleClass.ythickness);
- trim.bottom = frame.border_width + styleClass.ythickness;
-
- // clean up
- OS.gtk_widget_destroy(testHandle);
- OS.gtk_widget_destroy(testWindowHandle);
- return trim;
-}
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
- Point clientSize = UtilFuncs.getSize(frameHandle);
- // WRONG but it's quite safe - the frame clips it
- UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
- return differentExtent;
-}
-/* ========= Model Logic ========= */
-
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which is the string that the
- * is used as the <em>title</em>. If the text has not previously
- * been set, returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return text;
-}
-
-
-/**
- * Sets the receiver's text, which is the string that will
- * be displayed as the receiver's <em>title</em>, to the argument,
- * which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_frame_set_label (frameHandle, string2bytesConvertMnemonic(string));
- text=string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/GtkFileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/GtkFileDialog.java
deleted file mode 100644
index 1cfabc222b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/GtkFileDialog.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.swt.widgets;
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-abstract class GtkFileDialog extends Dialog {
-
- String answer;
- int handle, okButtonHandle, cancelButtonHandle;
- char separator = System.getProperty ("file.separator").charAt (0);
-
-GtkFileDialog (Shell parent, int style) {
- super (parent, style);
-}
-
-/**
- * Actually create the GtkFileSelection dialog widget.
- * Set the correct title.
- * Get the pointers to the buttons.
- */
-void createGtkDialog() {
- /* create */
- byte [] titleBytes = Converter.wcsToMbcs (null, title, true);
- handle = OS.gtk_file_selection_new (titleBytes);
-
- /* buttons */
- GtkFileSelection dialog = new GtkFileSelection ();
- OS.memmove (dialog, handle, GtkFileSelection.sizeof);
- okButtonHandle = dialog.ok_button;
- cancelButtonHandle = dialog.cancel_button;
-}
-
-/**
- * Deals with the filter.
- */
-void setUpFilter() {
- /*
- // Calculate the fully-specified file name and convert to bytes
- StringBuffer stringBuffer = new StringBuffer ();
- if (filterPath == null) {
- filterPath = "";
- } else {
- if (filterPath.length () > 0) {
- stringBuffer.append (filterPath);
- if (filterPath.charAt (filterPath.length () - 1) != separator) {
- stringBuffer.append (separator);
- }
- }
- }
- if (fileName == null) {
- fileName = "";
- } else {
- stringBuffer.append (fileName);
- }
- fullPath = stringBuffer.toString ();
- byte [] fullPathBytes = Converter.wcsToMbcs (null, fullPath, true);
- OS.gtk_file_selection_set_filename (handle, fullPathBytes);
-
- // Set the extension
- if (filterNames == null) filterNames = new String [0];
- if (filterExtensions == null) filterExtensions = new String [0];
- if (filterExtensions.length == 1) {
- String ext = filterExtensions [0];
- byte [] extBytes = Converter.wcsToMbcs (null, ext, true);
- OS.gtk_file_selection_complete (handle, extBytes);
- }
- */
-}
-
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the first selected file,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- createGtkDialog();
- setUpFilter();
-
- /* Hook callbacks */
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
- OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
- Callback okCallback = new Callback (this, "okFunc", 2);
- int okFunc = okCallback.getAddress ();
- Callback cancelCallback = new Callback (this, "cancelFunc", 2);
- int cancelFunc = cancelCallback.getAddress ();
- OS.gtk_signal_connect (okButtonHandle, clicked, okFunc, handle);
- OS.gtk_signal_connect (cancelButtonHandle, clicked, cancelFunc, handle);
-
- /* Show the dialog */
- answer = null;
- OS.gtk_widget_show_now (handle);
- OS.gtk_main ();
-
- destroyCallback.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
- return answer;
-}
-
-abstract boolean getAnswer();
-
-String getFileNameFromOS() {
- int lpFilename = OS.gtk_file_selection_get_filename (handle);
- int filenameLength = OS.strlen (lpFilename);
- byte [] filenameBytes = new byte [filenameLength];
- OS.memmove (filenameBytes, lpFilename, filenameLength);
- return new String (Converter.mbcsToWcs (null, filenameBytes));
-}
-
-int calculateLastSeparatorIndex(String x) {
- int separatorIndex = x.indexOf (separator);
- int index = separatorIndex;
- while (index != -1) {
- separatorIndex = index;
- index = x.indexOf (separator, index + 1);
- }
- return separatorIndex;
-}
-
-
-/*
- * The callback functions.
- */
-int okFunc (int widget, int callData) {
- if (getAnswer()) OS.gtk_widget_destroy (callData);
- return 0;
-}
-int cancelFunc (int widget, int callData) {
- answer = null;
- OS.gtk_widget_destroy (callData);
- return 0;
-}
-int destroyFunc (int widget, int callData) {
- OS.gtk_main_quit ();
- return 0;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java
deleted file mode 100644
index 84f872b4a8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java
+++ /dev/null
@@ -1,365 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a non-selectable
- * user interface object that displays a string or image.
- * When SEPARATOR is specified, displays a single
- * vertical or horizontal line.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
- * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Label extends Control {
- int boxHandle, frameHandle;
- Image image;
- String text;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Label (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SEPARATOR) != 0) return style;
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- frameHandle = OS.gtk_frame_new(null);
- if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = ((style&SWT.SEPARATOR) != 0)? (((style&SWT.HORIZONTAL)!= 0)?
- OS.gtk_hseparator_new() : OS.gtk_vseparator_new()):
- OS.gtk_label_new (new byte [1]);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- text = "";
-}
-
-void setHandleStyle () {
- int type = (style & SWT.BORDER) != 0 ? OS.GTK_SHADOW_ETCHED_IN : OS.GTK_SHADOW_NONE;
- OS.gtk_frame_set_shadow_type (frameHandle, type);
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((style & SWT.WRAP) != 0) OS.gtk_label_set_line_wrap (handle, true);
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(boxHandle, frameHandle);
- OS.gtk_container_add(frameHandle, handle);
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (frameHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (boxHandle, this);
- WidgetTable.put (frameHandle, this);
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (boxHandle);
- WidgetTable.remove (frameHandle);
-}
-
-int eventHandle () {
- return boxHandle;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
- text = null;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = frameHandle = 0;
-}
-
-int topHandle () {
- return boxHandle;
-}
-
-int computeHandle () {
- return frameHandle;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if ((style&SWT.SEPARATOR) != 0) {
- int w, h;
- if ((style&SWT.HORIZONTAL)!= 0) {
- w = 45;
- h = 6;
- } else { // vertical
- w = 6;
- h = 45;
- }
- if (wHint != SWT.DEFAULT) w = wHint;
- if (hHint != SWT.DEFAULT) h = hHint;
- return new Point(w,h);
- }
- return super.computeSize(wHint, hHint, changed);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return 0;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return "";
- return text;
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if ((style & SWT.LEFT) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- return;
- }
- if ((style & SWT.CENTER) != 0) {
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- return;
- }
- if ((style & SWT.RIGHT) != 0) {
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- return;
- }
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- this.image = image;
- if ((style & SWT.SEPARATOR) != 0) return;
- //NOT IMPLEMENTED - events and state of handle lost
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- if (image == null) {
- handle = OS.gtk_label_new (new byte [1]);
- } else {
- handle = OS.gtk_pixmap_new (image.pixmap, image.mask);
- }
- OS.gtk_container_add (frameHandle, handle);
- WidgetTable.put (handle, this);
- int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- switch (alignment) {
- case SWT.LEFT: OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f); break;
- case SWT.CENTER: OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f); break;
- case SWT.RIGHT: OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f); break;
- }
- OS.gtk_widget_show (handle);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
- if (!isText) {
- //NOT IMPLEMENTED - events and state of handle lost
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- handle = OS.gtk_label_new (new byte [1]);
- OS.gtk_container_add (frameHandle, handle);
- WidgetTable.put (handle, this);
- int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- switch (alignment) {
- case SWT.LEFT:
- OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
- break;
- case SWT.CENTER:
- OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
- break;
- case SWT.RIGHT:
- OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
- OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
- break;
- }
- }
- OS.gtk_label_parse_uline (handle, string2bytesConvertMnemonic(string));
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java
deleted file mode 100644
index 053ba6cc28..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java
+++ /dev/null
@@ -1,1138 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-
-/**
- * Instances of this class represent a selectable user interface
- * object that displays a list of strings and issues notificiation
- * when a string selected. A list may be single or multi select.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class List extends Scrollable {
- boolean selected;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public List (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.g_malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_append (handle, new int [] {ptr});
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- OS.g_free (ptr);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_ADDED);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.g_malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_insert (handle, index, new int [] {ptr});
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- OS.g_free (ptr);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the selection changes.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_clist_new (1);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- int selectionMode = ((style & SWT.MULTI) != 0)?
- OS.GTK_SELECTION_EXTENDED :
- OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, selectionMode);
-
- int border = OS.GTK_SHADOW_NONE;
- if ((style&SWT.BORDER)!=0) {
- border = OS.GTK_SHADOW_ETCHED_IN;
- if ((style&SWT.SHADOW_IN)!=0) border = OS.GTK_SHADOW_IN;
- if ((style&SWT.SHADOW_OUT)!=0) border = OS.GTK_SHADOW_OUT;
- if ((style&SWT.SHADOW_ETCHED_IN)!=0) border = OS.GTK_SHADOW_ETCHED_IN;
- if ((style&SWT.SHADOW_ETCHED_OUT)!=0) border = OS.GTK_SHADOW_ETCHED_OUT;
- }
- OS.gtk_clist_set_shadow_type(handle, border);
- setScrollingPolicy();
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents();
- signal_connect (handle, "select_row", SWT.Selection, 5);
- signal_connect (handle, "unselect_row", SWT.Selection, 5);
-}
-
-void showHandle() {
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return super.computeSize (wHint, hHint, changed);
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_unselect_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_unselect_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * has the focus in the receiver, or -1 if no item is has focus.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getFocusIndex () {
- checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return clist.focus_row;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] buffer = new int [1];
- int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
- int length = OS.strlen (buffer [0]);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, buffer [0], length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- return widget.rows;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int count = getItemCount ();
- String [] result = new String [count];
- for (int i=0; i<count; i++) result [i] = getItem (i);
- return result;
-}
-
-/**
- * Returns an array of <code>String</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public String [] getSelection () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- if (list==0) return new String[0];
- int length = OS.g_list_length (list);
- String [] items = new String [length];
- int [] buffer = new int [1];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (list, i);
- int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
- int strlen = OS.strlen (buffer [0]);
- byte [] buffer1 = new byte [strlen];
- OS.memmove (buffer1, buffer [0], strlen);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- items [i] = new String (buffer2, 0, buffer2.length);
- }
- return items;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- return OS.g_list_length (widget.selection);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return -1;
- return OS.g_list_nth_data (list, 0);
-}
-
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- int [] indices = new int [length];
- for (int i=0; i<length; i++) {
- indices [i] = OS.g_list_nth_data (list, i);
- }
- return indices;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return -clist.voffset / (clist.row_height + 1);
-}
-
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- String [] items = getItems ();
- for (int i=start; i<items.length; i++) {
- if (items [i].equals (string)) return i;
- }
- return -1;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (list == 0) return false;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (index == OS.g_list_nth_data (list, i)) return true;
- }
- return false;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- if ((style & SWT.MULTI) != 0) selected = true;
- return super.processMouseDown (callData, arg1, int2);
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- int result = super.processMouseUp (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) {
- /*
- * Feature in GTK. When an item is reselected, GTK
- * does not issue notification. The fix is to detect
- * that the mouse was released over a selected item when
- * no selection signal was set and issue a fake selection
- * event.
- */
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (selected && clist.selection != 0) {
- int list = clist.selection;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (row [0] == OS.g_list_nth_data (list, i)) {
- postEvent (SWT.Selection);
- }
- }
- }
- }
- selected = false;
- }
- return result;
-}
-
-int processSelection (int int0, int int1, int int2) {
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (int0 != clist.focus_row) return 0;
- if ((style & SWT.MULTI) != 0) selected = false;
- boolean single = true;
- if (int2 != 0) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, int2, GdkEventButton.sizeof);
- single = gdkEvent.type != OS.GDK_2BUTTON_PRESS;
- }
- if (single) {
- postEvent (SWT.Selection);
- } else {
- postEvent (SWT.DefaultSelection);
- }
- return 0;
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_remove (handle, index);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int index = start;
- while (index <= end) {
- OS.gtk_clist_remove (handle, start);
- index++;
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
- remove (index);
-}
-
-/**
- * Removes the items from the receiver at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int last = -1;
- for (int i=0; i<newIndices.length; i++) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- OS.gtk_clist_remove (handle, index);
- last = index;
- }
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_clear (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_select_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_select_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_set_text (handle, index, 0, buffer);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- removeAll ();
- for (int i=0; i<items.length; i++) {
- add (items [i]);
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (int index) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (index);
- showSelection ();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (start, end);
- showSelection ();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selection is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int[])
- */
-public void setSelection(int[] indices) {
- checkWidget();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (indices);
- showSelection ();
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.MULTI) != 0) deselectAll ();
- for (int i=items.length-1; i>=0; --i) {
- int index = 0;
- String string = items [i];
- if (string != null) {
- while ((index = indexOf (string, index)) != -1) {
- select (index);
- if (((style & SWT.SINGLE) != 0) && isSelected (index)) {
- showSelection ();
- return;
- }
- index++;
- }
- }
- }
- if ((style & SWT.SINGLE) != 0) deselectAll ();
- showSelection ();
-}
-
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- //BUG IN GTK - doesn't scroll correctly before shell open
- OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return;
- int index = OS.g_list_nth_data (list, 0);
- int visibility = OS.gtk_clist_row_is_visible (handle, index);
- if (visibility == OS.GTK_VISIBILITY_FULL) return;
- //BUG IN GTK - doesn't scroll correctly before shell open
- OS.gtk_clist_moveto (handle, index, 0, 0.5f, 0.0f);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java
deleted file mode 100644
index 7a77f50dc2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java
+++ /dev/null
@@ -1,563 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are user interface objects that contain
- * menu items.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BAR, DROP_DOWN, POP_UP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Help, Hide, Show </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Menu extends Widget {
- MenuItem cascade;
- Decorations parent;
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Control parent) {
- this (parent.getShell (), SWT.POP_UP);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Decorations parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Menu parentMenu) {
- this (parentMenu.parent, SWT.DROP_DOWN);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (MenuItem parentItem) {
- this (parentItem.parent);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>MenuListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #removeMenuListener
- */
-public void addMenuListener (MenuListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Hide,typedListener);
- addListener (SWT.Show,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
-}
-void createHandle (int index) {
- state |= HANDLE;
- if ((style & SWT.BAR) != 0) {
- handle = OS.gtk_menu_bar_new ();
- OS.gtk_widget_show (handle);
- } else {
- handle = OS.gtk_menu_new ();
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- parent.add (this);
-}
-
-/**
- * Returns the default menu item or null if none has
- * been previously set.
- *
- * @return the default menu item.
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getDefaultItem () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- int data = OS.g_list_nth_data (list, index);
- if (data == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- return (MenuItem) WidgetTable.get (data);
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- return OS.g_list_length (list);
-}
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (handle);
- int count = OS.g_list_length (list);
- MenuItem [] items = new MenuItem [count];
- for (int i=0; i<count; i++) {
- int data = OS.g_list_nth_data (list, i);
- items [i] = (MenuItem) WidgetTable.get (data);
- }
- return items;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Decorations getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getParentItem () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return cascade;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParentMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (cascade == null) return null;
- return cascade.getParent ();
-}
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getShell ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_MAPPED) != 0;
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (MenuItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getEnabled () && getParent ().getEnabled ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getVisible ();
-}
-void releaseChild () {
- super.releaseChild ();
- if (cascade != null) cascade.setMenu (null);
- if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
- parent.setMenuBar (null);
- }
-}
-void releaseWidget () {
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- if (parent != null) parent.remove (this);
- super.releaseWidget ();
- parent = null;
- cascade = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the menu events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #addMenuListener
- */
-public void removeMenuListener (MenuListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Hide, listener);
- eventTable.unhook (SWT.Show, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultItem (MenuItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the display.
- * <p>
- * Note: This is different from most widgets where the
- * location of the widget is relative to the parent.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
-// OS.gtk_widget_set_uposition(handle, x, y);
-// OS.gtk_widget_set_uposition(handle, 0, 0);
- sendEvent(SWT.Move);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.BAR) != 0) return;
- if (visible) {
- sendEvent(SWT.Show);
- OS.gtk_menu_popup (handle, 0, 0, 0, 0, 3, 0);
- } else {
- OS.gtk_menu_popdown (handle);
- sendEvent(SWT.Hide);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java
deleted file mode 100644
index 1de7188b22..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java
+++ /dev/null
@@ -1,631 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Arm, Help, Selection</dd>
- * </dl>
- *<p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class MenuItem extends Item {
- Menu parent, menu;
- int accelerator;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (parent.getItemCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- int count = parent.getItemCount ();
- if (!(0 <= index && index <= count)) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- createWidget (index);
-}
-void addAccelerator (int accel_group) {
- if (accel_group == 0) return;
- if (accelerator == 0) return;
- byte [] activate = Converter.wcsToMbcs (null, "activate", true);
- int mask = 0;
- if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
- if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
- if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
- int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
- int newKey = Display.untranslateKey (keysym);
- if (newKey != 0) {
- keysym = newKey;
- } else {
- keysym = wcsToMbcs ((char) keysym);
- }
- OS.gtk_widget_add_accelerator (handle, activate, accel_group, keysym, mask, OS.GTK_ACCEL_VISIBLE);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the arm events are generated for the control, by sending
- * it one of the messages defined in the <code>ArmListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #removeArmListener
- */
-public void addArmListener (ArmListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Arm, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
-}
-void createHandle (int index) {
- state |= HANDLE;
- byte [] buffer = new byte [1];
- int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR;
- switch (style & bits) {
- case SWT.SEPARATOR:
- handle = OS.gtk_menu_item_new ();
- break;
- case SWT.RADIO:
-// handle = OS.gtk_radio_menu_item_new_with_label (0, buffer);
-// break;
- case SWT.CHECK:
- handle = OS.gtk_check_menu_item_new_with_label (buffer);
- break;
- case SWT.PUSH:
- default:
- handle = OS.gtk_menu_item_new_with_label (buffer);
- break;
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- OS.gtk_check_menu_item_set_show_toggle (handle, true);
- }
- if ((parent.style & SWT.BAR) != 0) {
- OS.gtk_menu_bar_insert (parent.handle, handle, index);
- } else {
- OS.gtk_menu_insert (parent.handle, handle, index);
- }
- OS.gtk_widget_show (handle);
-}
-/**
- * Return the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @return the accelerator
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAccelerator () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return accelerator;
-}
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the receiver's cascade menu if it has one or null
- * if it does not. Only <code>CASCADE</code> menu items can have
- * a pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return menu;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- GtkCheckMenuItem menuItem = new GtkCheckMenuItem ();
- OS.memmove (menuItem, handle, GtkCheckMenuItem.sizeof);
- return menuItem.active != 0;
-}
-void hookEvents () {
- super.hookEvents ();
- Display display = getDisplay ();
- int windowProc2 = display.windowProc2;
- byte [] activate_event = Converter.wcsToMbcs (null, "activate", true);
- OS.gtk_signal_connect (handle, activate_event, windowProc2, SWT.Selection);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- return getEnabled ();
-}
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-void releaseChild () {
- super.releaseChild ();
- if (menu != null) menu.dispose ();
- menu = null;
-}
-void releaseWidget () {
- if (menu != null) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- menu = null;
- super.releaseWidget ();
- int accel_group = parent.getShell ().accelGroup;
- removeAccelerator (accel_group);
- accelerator = 0;
- parent = null;
-}
-void removeAccelerator (int accel_group) {
- if (accel_group == 0) return;
- if (accelerator == 0) return;
- int mask = 0;
- if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
- if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
- if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
- int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
- int newKey = Display.untranslateKey (keysym);
- if (newKey != 0) {
- keysym = newKey;
- } else {
- keysym = wcsToMbcs ((char) keysym);
- }
- OS.gtk_widget_remove_accelerator (handle, accel_group, keysym, mask);
- accelerator = 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the arm events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #addArmListener
- */
-public void removeArmListener (ArmListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Arm, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @param accelerator an integer that is the bit-wise OR of masks and a key
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAccelerator (int accelerator) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int accel_group = parent.getShell ().accelGroup;
- if (accelerator != 0) removeAccelerator (accel_group);
- this.accelerator = accelerator;
- if (accelerator != 0) addAccelerator (accel_group);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
-
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget ();
-
- /* Check to make sure the new menu is valid */
- if ((style & SWT.CASCADE) == 0) {
- error (SWT.ERROR_MENUITEM_NOT_CASCADE);
- }
- if (menu != null) {
- if ((menu.style & SWT.DROP_DOWN) == 0) {
- error (SWT.ERROR_MENU_NOT_DROP_DOWN);
- }
- if (menu.parent != parent.parent) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
-
- /* Assign the new menu */
- Menu oldMenu = this.menu;
- if (oldMenu == menu) return;
- if (oldMenu != null) {
- oldMenu.cascade = null;
- /*
- * Add a reference to the menu we are about
- * to replace or GTK will destroy it.
- */
- OS.gtk_object_ref (oldMenu.handle);
- OS.gtk_menu_item_remove_submenu (handle);
- }
- if ((this.menu = menu) != null) {
- menu.cascade = this;
- OS.gtk_menu_item_set_submenu (handle, menu.handle);
- }
-
-
-}
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_check_menu_item_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- int index = string.indexOf('\t');
- if (index != -1) length = index;
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- int label = OS.g_list_nth_data (list, 0);
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- OS.gtk_label_set_text (label, buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java
deleted file mode 100644
index ed3a745f1c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class are used used to inform or warn the user.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
- * <dd>OK, OK | CANCEL</dd>
- * <dd>YES | NO, YES | NO | CANCEL</dd>
- * <dd>RETRY | CANCEL</dd>
- * <dd>ABORT | RETRY | IGNORE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class MessageBox extends Dialog {
-
- String message;
-
- // Handles
- int handle;
- int label;
- int buttonOK, buttonCANCEL, buttonYES, buttonNO, buttonABORT, buttonRETRY, buttonIGNORE;
-
- int state;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent, int style) {
- super(parent, checkStyle(style));
- checkSubclass ();
-}
-
-
-
-/*
- * === GET/SET MESSAGE; OPEN ===
- */
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public int open () {
- createHandle();
- createMessage(); // includes configuring
- createActionButtons();
- state=0;
- Callback destroyCallback = new Callback (this, "destroyFunc", 2);
- int destroyFunc = destroyCallback.getAddress ();
- byte [] destroy = Converter.wcsToMbcs (null, "delete_event", true);
- OS.gtk_signal_connect_after (handle, destroy, destroyFunc, handle);
- showHandle();
- while(state==0) OS.gtk_main_iteration();
- OS.gtk_widget_destroy(handle);
- return state;
-}
-
-/*
- * === Actual handle operations ===
- */
-
-private void createHandle() {
- handle = OS.gtk_dialog_new();
- if (handle==0) SWT.error(SWT.ERROR_NO_HANDLES);
- if ((style & (SWT.PRIMARY_MODAL|SWT.APPLICATION_MODAL|SWT.SYSTEM_MODAL)) != 0) {
- OS.gtk_window_set_modal(handle, true);
- }
-}
-private void createMessage() {
- byte[] bytes = Converter.wcsToMbcs (null, getMessage(), true);
- label = OS.gtk_label_new (bytes);
- GtkDialog dialog = new GtkDialog();
- OS.memmove (dialog, handle, GtkDialog.sizeof);
- OS.gtk_box_pack_start (dialog.vbox, label, true, true, 5); // FIXME should we use container_add??
-}
-private void createActionButtons() {
- if ((style & SWT.OK) != 0) buttonOK = createButton("OK");
- if ((style & SWT.CANCEL) != 0) buttonCANCEL = createButton("CANCEL");
-
- if ((style & SWT.YES) != 0) buttonYES = createButton("YES");
- if ((style & SWT.NO) != 0) buttonNO = createButton("NO");
-
- if ((style & SWT.ABORT) != 0) buttonABORT = createButton("ABORT");
- if ((style & SWT.RETRY) != 0) buttonRETRY = createButton("RETRY");
- if ((style & SWT.IGNORE) != 0) buttonIGNORE = createButton("IGNORE");
-}
-private void showHandle() {
- OS.gtk_widget_show_all (handle);
-
- boolean hasTitle=false;
- String title = getText();
- if (title!=null) if (title.length()!=0) hasTitle=true;
-
- int decor = 0;
- if (hasTitle) decor |= OS.GDK_DECOR_TITLE;
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, handle, GtkWidget.sizeof);
- int gdkWindow = widget.window;
- OS.gdk_window_set_decorations(gdkWindow, decor);
- if (hasTitle) {
- byte[] bytes = Converter.wcsToMbcs (null, title, true);
- OS.gtk_window_set_title(handle, bytes);
- }
-}
-int createButton(String buttonName) {
- System.out.println("Creating button "+buttonName);
- byte[] bytes = Converter.wcsToMbcs (null, buttonName, true);
- int buttonHandle = OS.gtk_button_new_with_label(bytes);
- GtkDialog dialog = new GtkDialog();
- OS.memmove (dialog, handle, GtkDialog.sizeof);
- OS.gtk_box_pack_start (dialog.action_area, buttonHandle, true, true, 0);
- hookSelection(buttonHandle);
- return buttonHandle;
-}
-private void hookSelection(int h) {
- byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
-
- Callback okCallback = new Callback (this, "activateFunc", 2);
- int okFunc = okCallback.getAddress ();
- OS.gtk_signal_connect (h, clicked, okFunc, h);
-
-}
-private static int checkStyle (int style) {
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
-int activateFunc(int widget, int callData) {
- if (widget==buttonOK) { state=SWT.OK; return 0; }
- if (widget==buttonCANCEL) { state=SWT.CANCEL; return 0; }
- if (widget==buttonYES) { state=SWT.YES; return 0; }
- if (widget==buttonNO) { state=SWT.NO; return 0; }
- if (widget==buttonABORT) { state=SWT.ABORT; return 0; }
- if (widget==buttonRETRY) { state=SWT.RETRY; return 0; }
- if (widget==buttonIGNORE) { state=SWT.IGNORE; return 0; }
- return 0;
-}
-/*
- * We need this because some WMs will give us a cross even when
- * we specifically ask it not to.
- */
-int destroyFunc(int widget, int callData) {
- return 1;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java
deleted file mode 100644
index b5b36ce79a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent is an unselectable
- * user interface object that is used to display progress,
- * typically in the form of a bar.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class ProgressBar extends Control {
- int min = 0, max = 100, value = 0;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ProgressBar (Composite parent, int style) {
- super (parent, checkStyle(style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- handle = OS.gtk_progress_bar_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- OS.gtk_progress_configure (handle, value, min, max);
-}
-
-void setHandleStyle() {
- int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_TOP_TO_BOTTOM : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
- OS.gtk_progress_bar_set_orientation (handle, orientation);
- int style = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
- OS.gtk_progress_bar_set_bar_style (handle, style);
-}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- return max;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- return min;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- return value;
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int maximum) {
- checkWidget ();
- if (maximum < 0) return;
- max = maximum;
- if (value > maximum) value = maximum;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int minimum) {
- checkWidget ();
- if (minimum < 0) return;
- if (value < minimum) value = minimum;
- min = minimum;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int x) {
- checkWidget ();
- if (x < 0) return;
- value = x;
- OS.gtk_progress_configure (handle, value, min, max);
- /*
- * Feature in GTK. The progress bar does
- * not redraw right away when a value is
- * changed. This is not strictly incorrect
- * but unexpected. The fix is to force all
- * outstanding redraws to be delivered.
- */
- update ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java
deleted file mode 100644
index cad77f4868..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java
+++ /dev/null
@@ -1,333 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user interface object
- * that allows the user to drag a rubber banded outline of the sash within
- * the parent control.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Sash extends Control {
- boolean dragging, drawing;
- int startX, startY, lastX, lastY, drawX, drawY;
- int start_root_x, start_root_y;
- int last_root_x, last_root_y;
- int cursor;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Sash (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- handle=OS.gtk_drawing_area_new();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void showHandle() {
- createCursor();
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize(handle);
-}
-
-private void createCursor() {
- int cursorType = ((style&SWT.VERTICAL)!=0)?
- OS.GDK_SB_H_DOUBLE_ARROW:OS.GDK_SB_V_DOUBLE_ARROW;
- cursor = OS.gdk_cursor_new(cursorType);
- GtkWidget widget = new GtkWidget ();
- OS.memmove(widget, handle, GtkWidget.sizeof);
- OS.gdk_window_set_cursor(widget.window, cursor);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
- * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.MouseDoubleClick,listener);
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_grab_add(handle);
- dragging = true;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- if (gdkEvent.button != 1) return 0;
- startX = (int)gdkEvent.x; startY = (int)gdkEvent.y;
- start_root_x=(int)gdkEvent.x_root; start_root_y=(int)gdkEvent.y_root;
- drawX=startX; drawY=startY;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
- Event event = new Event ();
- event.detail = SWT.DRAG;
- event.time = gdkEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- sendEvent (SWT.MouseDown, event);
- return 0;
-}
-
-int processMouseMove (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- if (!dragging) return 0;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
- Rectangle rect = parent.getClientArea();
- int parentWidth = rect.width - 2;
- int parentHeight = rect.height - 2;
- last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- if (last_root_x<=start_root_x)
- newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
- else
- newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
- } else {
- if (last_root_y<=start_root_y)
- newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
- else
- newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
- }
- if ((newX == lastX) && (newY == lastY)) return 0;
- drawBand(newX, newY, width, height);
- return 0;
-}
-int processMouseUp (int callData, int arg1, int int2) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- if (gdkEvent.button != 1) return 0;
- if (!dragging) return 0;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
- Rectangle rect = parent.getClientArea();
- int parentWidth = rect.width - 2;
- int parentHeight = rect.height - 2;
- last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- if (last_root_x<=start_root_x)
- newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
- else
- newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
- } else {
- if (last_root_y<=start_root_y)
- newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
- else
- newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
- }
- if ((newX == lastX) && (newY == lastY)) return 0;
-
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.x = newX; event.y = newY;
- event.width = width; event.height = height;
- dragging = false;
- drawBand(newX, newY, width, height);
- drawing = false;
- OS.gtk_grab_remove(handle);
- sendEvent (SWT.Selection, event);
- return 0;
-}
-/*
-int processMouseEnter (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.detail = SWT.DRAG;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- Cursor arrowCursor;
- if ((style & SWT.HORIZONTAL) != 0) {
- arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZENS);
- } else {
- arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZEWE);
- }
- setCursor(arrowCursor);
- sendEvent (SWT.Selection, event);
- return 0;
-}
-*/
-int processMouseExit (int callData, int arg1, int int2) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
- int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
- Event event = new Event ();
- event.time = gdkEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- sendEvent (SWT.MouseExit, event);
- return 0;
-
-}
-
-void drawBand (int x, int y, int width, int height) {
- if (x == drawX && y == drawY) return;
- Display display= parent.getDisplay ();
- if (display == null) return;
- GtkWidget gtkwidget = new GtkWidget();
- OS.memmove(gtkwidget, parent.topHandle(), GtkWidget.sizeof);
- int window = gtkwidget.window;
- if (window == 0) return;
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- int stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
- int gc = OS.gdk_gc_new(window);
- Color color = new Color(display, 0xFF, 0, 0);
- OS.gdk_gc_set_background(gc, color.handle);
- Color color1 = new Color(display, 0, 0xFF, 0);
- OS.gdk_gc_set_foreground(gc, color1.handle);
- OS.gdk_gc_set_stipple(gc, stipplePixmap);
- OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
- OS.gdk_gc_set_fill(gc, OS.GDK_STIPPLED);
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- if (drawing)
- OS.gdk_draw_rectangle(window, gc, 1, drawX, drawY, width, height);
- else
- drawing = true;
- drawX=x;drawY=y;
- OS.gdk_draw_rectangle(window, gc, 1, x, y, width, height);
- OS.gdk_bitmap_unref(stipplePixmap);
- OS.gdk_gc_destroy(gc);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- OS.gdk_cursor_destroy (cursor);
- cursor = 0;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java
deleted file mode 100644
index 7baf8ad787..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java
+++ /dev/null
@@ -1,389 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user
- * interface object that present a range of continuous
- * numeric values.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Scale extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scale (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0);
- if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.HORIZONTAL) != 0) {
- handle = OS.gtk_hscale_new (hAdjustment);
- } else {
- handle = OS.gtk_vscale_new (hAdjustment);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- OS.gtk_scale_set_digits (handle, 0);
- OS.gtk_scale_set_draw_value (handle, false);
-}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.put (hAdjustment, this);
-}
-
-void deregister () {
- super.deregister ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.remove (hAdjustment);
- /*
- * This code is intentionally commented.
- */
-// OS.gtk_object_unref (hAdjustment);
-// OS.gtk_object_destroy (hAdjustment);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_set_value (hAdjustment, value);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java
deleted file mode 100644
index daba64bd09..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java
+++ /dev/null
@@ -1,639 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given scroll bar will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the scroll bar represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, scroll bars will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, scroll bars are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the scroll bar's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the scroll bar will not change.
- * </p><p>
- * Scroll bars are created by specifying either <code>H_SCROLL</code>,
- * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
- * They are accessed from the <code>Scrollable</code> using
- * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
- * </p><p>
- * Note: Scroll bars are not Controls. On some platforms, scroll bars
- * that appear as part of some standard controls such as a text or list
- * have no operating system resources and are not children of the control.
- * For this reason, scroll bars are treated specially. To create a control
- * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see Slider
- * @see Scrollable
- * @see Scrollable#getHorizontalBar
- * @see Scrollable#getVerticalBar
- */
-
-public class ScrollBar extends Widget {
- Scrollable parent;
-
-ScrollBar () {
-}
-
-/**
-* Creates a new instance of the widget.
-*/
-ScrollBar (Scrollable parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- return true;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the receiver's parent, which must be scrollable.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Scrollable getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-/**
- * For horizontal scroll bars, returns the height of the
- * instance, and for vertical scroll bars, returns the width
- * of the instance.
- *
- * @return the scroll bar size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget ();
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_width, widget.alloc_height);
-}
-
-/**
- * Answers the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public int getThumb () {
- checkWidget ();
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- return (int) adjustment.page_size;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget ();
- return true;
-}
-
-void hookEvents () {
- signal_connect (handle, "value_changed", SWT.Selection, 2);
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * <p>
- * Note: Because of the strong connection between a scroll bar
- * and the widget which contains it (its parent), a scroll bar
- * will not indicate that it is enabled if its parent is not.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- return getEnabled () && getParent ().getEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget ();
- return getVisible () && getParent ().isVisible ();
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (parent.horizontalBar == this) parent.horizontalBar = null;
- if (parent.verticalBar == this) parent.verticalBar = null;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget ();
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_set_value (handle, value);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget ();
- if (value < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.page_size = (float) value;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget ();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
- adjustment.lower = minimum;
- adjustment.upper = maximum;
- adjustment.step_increment = increment;
- adjustment.page_increment = pageIncrement;
- adjustment.page_size = thumb;
- adjustment.value = selection;
- OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_adjustment_changed (handle);
- OS.gtk_adjustment_value_changed (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java
deleted file mode 100644
index a2405fca32..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all classes which
- * represent controls that have standard scroll bars.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>H_SCROLL, V_SCROLL</dd>
- * <dt><b>Events:</b>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public abstract class Scrollable extends Control {
-
- int scrolledHandle;
- ScrollBar horizontalBar, verticalBar;
- static Trim trim;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Scrollable () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scrollable (Composite parent, int style) {
- super (parent, style);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getClientArea
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-
- Trim t = _getTrim();
- return new Rectangle (x-t.left, y-t.top, width+t.left+t.right, height+t.top+t.bottom);
-}
-
-Trim _getTrim() {
- if (trim==null) initializeTrim();
- return trim;
-}
-
-void initializeTrim() { trim = new Trim(); }
-
-void _fillBin(int binHandle, int childHandle) {
- GtkBin bin = new GtkBin();
- OS.memmove(bin, binHandle, GtkBin.sizeof);
- bin.child = childHandle;
- OS.memmove(binHandle, bin, GtkBin.sizeof);
- OS.gtk_widget_set_parent(childHandle, binHandle);
-}
-
-/*
- * Subclasses must only use super.configure()
- * to connect their topHandle to the parent.
- * It is the responsibility of the conrete subclass
- * to configure the scrolled handles.
- */
-abstract void configure ();
-
-ScrollBar createScrollBar (int style) {
- if (scrolledHandle == 0) return null;
- ScrollBar bar = new ScrollBar ();
- bar.parent = this;
- bar.style = style;
- bar.state |= HANDLE;
- if ((style & SWT.H_SCROLL) != 0) {
- bar.handle = OS.gtk_scrolled_window_get_hadjustment (scrolledHandle);
- } else {
- bar.handle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
- }
- bar.hookEvents ();
- bar.register ();
- return bar;
-}
-void createWidget (int index) {
- super.createWidget (index);
- if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
- if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
-}
-void deregister () {
- super.deregister ();
- if (scrolledHandle != 0) {
- WidgetTable.remove (scrolledHandle);
- }
-}
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data (that is,
- * not covered by the "trimmings").
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeTrim
- */
-public Rectangle getClientArea () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Rectangle (0, 0, widget.alloc_width, widget.alloc_height);
-}
-/**
- * Returns the receiver's horizontal scroll bar if it has
- * one, and null if it does not.
- *
- * @return the horizontal scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getHorizontalBar () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return horizontalBar;
-}
-/**
- * Returns the receiver's vertical scroll bar if it has
- * one, and null if it does not.
- *
- * @return the vertical scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getVerticalBar () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return verticalBar;
-}
-
-void setScrollingPolicy() {
- if (scrolledHandle==0) return;
- int hsp = ((style&SWT.H_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
- int vsp = ((style&SWT.V_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
- OS.gtk_scrolled_window_set_policy(scrolledHandle, hsp,vsp);
-}
-
-void register () {
- super.register ();
- if (scrolledHandle != 0) {
- WidgetTable.put (scrolledHandle, this);
- }
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- scrolledHandle = 0;
-}
-
-void releaseWidget () {
- if (horizontalBar != null) {
- horizontalBar.releaseWidget ();
- horizontalBar.releaseHandle ();
- }
- if (verticalBar != null) {
- verticalBar.releaseWidget ();
- verticalBar.releaseHandle ();
- }
- horizontalBar = verticalBar = null;
- super.releaseWidget ();
-}
-int topHandle () {
- if (scrolledHandle != 0) return scrolledHandle;
- return handle;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java
deleted file mode 100644
index d93c35d2f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java
+++ /dev/null
@@ -1,851 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent the "windows"
- * which the desktop or "window manager" is managing.
- * Instances that do not have a parent (that is, they
- * are built using the constructor, which takes a
- * <code>Display</code> as the argument) are described
- * as <em>top level</em> shells. Instances that do have
- * a parent are described as <em>secondary</em> or
- * <em>dialog</em> shells.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations
- * and modality. For example, some window managers only
- * support resizable windows and will always assume the
- * RESIZE style, even if it is not set. In addition, if a
- * modality style is not supported, it is "upgraded" to a
- * more restrictive modality style that is supported. For
- * example, if <code>PRIMARY_MODAL</code> is not supported,
- * it would be upgraded to <code>APPLICATION_MODAL</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * </p>
- * <p>
- * IMPORTANT: This class is not intended to be subclassed.
- * </p>
- *
- * @see Decorations
- * @see SWT
- */
-public class Shell extends Decorations {
- Display display;
- int vboxHandle;
- int modal;
- int accelGroup;
- Rectangle lastClientArea;
- boolean hasFocus;
-
-/*
- * === CONSTRUCTORS ===
- */
-
-/**
- * Constructs a new instance of this class. This is equivalent
- * to calling <code>Shell((Display) null)</code>.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell () {
- this ((Display) null);
-}
-/**
- * Constructs a new instance of this class given only the style
- * value describing its behavior and appearance. This is equivalent
- * to calling <code>Shell((Display) null, style)</code>.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (int style) {
- this ((Display) null, style);
-}
-
-/**
- * Constructs a new instance of this class given only the display
- * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display) {
- this (display, SWT.SHELL_TRIM);
-}
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display, int style) {
- this (display, null, style);
-}
-Shell (Display display, Shell parent, int style) {
- super ();
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.parent = parent;
- this.display = display;
- this.handle = handle;
- createWidget (0);
-}
-/**
- * Constructs a new instance of this class given only its
- * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent) {
- this (parent, SWT.TITLE | SWT.CLOSE | SWT.BORDER);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent, int style) {
- this (null, parent, style);
-}
-
-
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when operations are performed on the receiver,
- * by sending the listener one of the messages defined in the
- * <code>ShellListener</code> interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #removeShellListener
- */
-public void addShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Close,typedListener);
- addListener (SWT.Iconify,typedListener);
- addListener (SWT.Deiconify,typedListener);
- addListener (SWT.Activate, typedListener);
- addListener (SWT.Deactivate, typedListener);
-}
-void bringToTop () {
-// OS.gtk_window_activate_focus (shellHandle);
-}
-/**
- * Requests that the window manager close the receiver in
- * the same way it would be closed when the user clicks on
- * the "close box" or performs some other platform specific
- * key or mouse combination that indicates the window
- * should be removed.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget ();
- closeWidget ();
-}
-void closeWidget () {
- Event event = new Event ();
- event.time = OS.gdk_time_get ();
- sendEvent (SWT.Close, event);
- if (event.doit && !isDisposed ()) dispose ();
-}
-
-
-/*
- * === Handle code I: The createWidget() cycle.
- */
-
-void createHandle (int index) {
- state |= HANDLE;
- topHandle = OS.gtk_window_new((parent==null)? OS.GTK_WINDOW_TOPLEVEL:OS.GTK_WINDOW_DIALOG);
- if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- if (parent!=null) OS.gtk_window_set_transient_for(topHandle, parent.topHandle());
-
- vboxHandle = OS.gtk_vbox_new(false,0);
- if (vboxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- eventBoxHandle = OS.gtk_event_box_new ();
- if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_drawing_area_new();
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- accelGroup = OS.gtk_accel_group_new ();
- OS.gtk_window_add_accel_group (topHandle, accelGroup);
- OS.gtk_window_set_title (topHandle, new byte [1]);
-}
-
-void configure () {
- OS.gtk_container_add (topHandle, vboxHandle);
- OS.gtk_box_pack_end(vboxHandle, eventBoxHandle, true,true,0);
- OS.gtk_container_add (eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
-}
-
-void showHandle() {
- OS.gtk_widget_realize (topHandle); // careful: NOT show
- _setStyle();
-
- OS.gtk_widget_realize (vboxHandle);
- OS.gtk_widget_show_now (vboxHandle);
-
- OS.gtk_widget_realize (eventBoxHandle);
- OS.gtk_widget_show_now (eventBoxHandle);
-
- OS.gtk_widget_realize (fixedHandle);
- OS.gtk_widget_show_now (fixedHandle);
-
- OS.gtk_widget_realize (handle);
- OS.gtk_widget_show_now (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- signal_connect(topHandle, "map_event", SWT.Deiconify, 3);
- signal_connect(topHandle, "unmap_event", SWT.Iconify, 3);
- signal_connect(topHandle, "size_allocate", SWT.Resize, 3);
- signal_connect(topHandle, "delete_event", SWT.Dispose, 3);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (vboxHandle, this);
-}
-
-private void _setStyle() {
- boolean modal = (
- ((style&SWT.PRIMARY_MODAL) != 0) ||
- ((style&SWT.APPLICATION_MODAL) != 0) ||
- ((style&SWT.SYSTEM_MODAL) != 0));
- OS.gtk_window_set_modal(topHandle, modal);
-
- int decorations = 0;
- if ((style & SWT.NO_TRIM) == 0) {
- if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE;
- if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
- if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH;
- if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER;
- if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU;
- if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE;
- /*
- * Under some Window Managers (Sawmill), in order
- * to get any border at all from the window manager it is necessary
- * to set GDK_DECOR_BORDER. The fix is to force these bits when any
- * kind of border is requested.
- */
- if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER;
- }
- GtkWidget widget = new GtkWidget();
- OS.memmove(widget, topHandle, GtkWidget.sizeof);
- int w = widget.window;
- // PANIC - this must absolutely never happen, so it's not NO_HANDLES actually
- if (w == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gdk_window_set_decorations(w, decorations);
-}
-
-void _connectChild (int h) {
- OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
-}
-
-int topHandle () {
- return topHandle;
-}
-
-int parentingHandle() {
- return fixedHandle;
-}
-
-boolean isMyHandle(int h) {
- if (h == topHandle) return true;
- if (h == vboxHandle) return true;
- if (h == eventBoxHandle) return true;
- if (h == fixedHandle) return true;
- if (h == handle) return true;
- return false;
-}
-
-
-/*
- * === GEOMETRY ===
- */
-
-public Point _getLocation() {
- GtkWidget widget = new GtkWidget();
- OS.memmove (widget, topHandle, GtkWidget.sizeof);
- int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_origin(widget.window, x,y);
- return new Point(x[0], y[0]);
-}
-
-public Point _getSize() {
- return UtilFuncs.getSize(vboxHandle);
-}
-
-public Rectangle _getClientArea () {
- Point clientSize = UtilFuncs.getSize(eventBoxHandle);
- return new Rectangle (0, 0, clientSize.x, clientSize.y);
-}
-
-boolean _setSize(int width, int height) {
- /*
- * API deficiency in GTK 1.2 - lacking gtk_window_resize.
- * We work around this by directly resizing the X window.
- *
- * First, we find out the GDK handle.
- */
- GtkWidget gtkWidget = new GtkWidget();
- OS.memmove(gtkWidget, topHandle, GtkWidget.sizeof);
-
- OS.gtk_signal_handler_block_by_data (topHandle, SWT.Resize);
- OS.gdk_window_resize(gtkWidget.window, width, height);
- UtilFuncs.setSize(vboxHandle, width, height);
- Point sz = UtilFuncs.getSize(eventBoxHandle);
- UtilFuncs.setSize(fixedHandle, sz.x, sz.y);
- UtilFuncs.setSize(handle, sz.x, sz.y);
- OS.gtk_signal_handler_unblock_by_data (topHandle, SWT.Resize);
-
- return true;
-}
-
-boolean _setLocation (int x, int y) {
- GtkWidget gtkWidget = new GtkWidget();
- OS.memmove(gtkWidget, topHandle, GtkWidget.sizeof);
- OS.gdk_window_move(gtkWidget.window, x, y);
- return true;
-}
-
-void setInitialSize() {
- int width = OS.gdk_screen_width () * 5 / 8;
- int height = OS.gdk_screen_height () * 5 / 8;
- _setSize(width, height);
- OS.gtk_window_set_policy (topHandle, 1,1,0);
-}
-
-/*
- * We can't setInitialSize() before showHandle() in the case of Shell,
- * because we operate on the actual X window, so the shell must be
- * realized by that time.
- * This is a workaround until gtk_window_resize().
- */
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- configure ();
- setHandleStyle ();
- register ();
- showHandle ();
- setInitialSize ();
-}
-
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-
-/*
- * Return the control inside this shell that has the focus,
- * if there is one. Return <code>null</code> if there is no
- * such control - e.g., this shell is not active, or it is active
- * but the user clicked in a no-entry widget (like Label).
- */
-Control getFocusControl() {
- GtkWindow shell = new GtkWindow();
- OS.memmove(shell, topHandle, GtkWindow.sizeof);
- int focusHandle = shell.focus_widget;
- if (focusHandle==0) return null;
- return (Control)this.getDisplay().findWidget(focusHandle);
-}
-
-/**
- * Returns the receiver's input method editor mode. This
- * will be the result of bitwise OR'ing together one or
- * more of the following constants defined in class
- * <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @return the IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public int getImeInputMode () {
- checkWidget();
- return SWT.NONE;
-}
-
-/**
-* Get the modal state.
-* <p>
-* @return the modal state
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-*/
-public int getModal () {
- checkWidget();
- return modal;
-}
-
-Shell _getShell () {
- return this;
-}
-/**
- * Returns an array containing all shells which are
- * descendents of the receiver.
- * <p>
- * @return the dialog shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkWidget();
- int count = 0;
- Shell [] shells = display.getShells ();
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.getParent ();
- } while (shell != null && shell != this);
- if (shell == this) count++;
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.getParent ();
- } while (shell != null && shell != this);
- if (shell == this) {
- result [index++] = shells [i];
- }
- }
- return result;
-}
-
-public void layout (boolean changed) {
- checkWidget();
-// if (!resizedSinceLastLayout()) return;
- lastClientArea=getClientArea();
- if (layout == null) return;
- layout.layout (this, changed);
-}
-
-/*
- * Returns whether the shell has been resized since the last layout()
- */
-boolean resizedSinceLastLayout() {
- return !getClientArea().equals(lastClientArea);
-}
-
-/**
- * Moves the receiver to the top of the drawing order for
- * the display on which it was created (so that all other
- * shells on that display, which are not the receiver's
- * children will be drawn behind it), marks it visible,
- * and sets focus to its default button (if it has one).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Control#setVisible
- * @see Decorations#setDefaultButton
-*/
-public void open () {
- checkWidget();
- setVisible (true);
-}
-
-int processDispose (int int0, int int1, int int2) {
- closeWidget ();
- return 1;
-}
-
-int processFocusIn(int int0, int int1, int int2) {
- hasFocus=true;
- postEvent(SWT.Activate);
- return 0;
-}
-
-int processFocusOut(int int0, int int1, int int2) {
- hasFocus=false;
- postEvent(SWT.Deactivate);
- return 0;
-}
-
-int processPaint (int callData, int int2, int int3) {
- //if (!hooks (SWT.Paint)) return 1;
-
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- GdkRectangle rect = new GdkRectangle ();
- rect.x = gdkEvent.x; rect.y = gdkEvent.y;
- rect.width = gdkEvent.width; rect.height = gdkEvent.height;
- OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
- gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-/*}else{
- GdkRectangle gdkEvent = new GdkRectangle ();
- OS.memmove (gdkEvent, callData, GdkRectangle.sizeof);
- Event event = new Event ();
-// event.count = gdkEvent.count;
- event.x = gdkEvent.x; event.y = gdkEvent.y;
- event.width = gdkEvent.width; event.height = gdkEvent.height;
- GC gc = event.gc = new GC (this);
- OS.gdk_gc_set_clip_rectangle (gc.handle, gdkEvent);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 1;
-} */
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when operations are performed on the receiver.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #addShellListener
- */
-public void removeShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Close, listener);
- eventTable.unhook (SWT.Iconify,listener);
- eventTable.unhook (SWT.Deiconify,listener);
- eventTable.unhook (SWT.Activate, listener);
- eventTable.unhook (SWT.Deactivate, listener);
-}
-
-/**
- * Sets the input method editor mode to the argument which
- * should be the result of bitwise OR'ing together one or more
- * of the following constants defined in class <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @param mode the new IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public void setImeInputMode (int mode) {
- checkWidget();
-}
-
-public void setMaximized (boolean maximized) {
- checkWidget();
-
- /*
- * Out of luck on curent GDK.
- */
-}
-
-public void setMenuBar (Menu menu) {
- checkWidget();
-
- if (menuBar == menu) return;
- if (menu != null) {
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- if (menu == null) {
- if (menuBar != null) {
- OS.gtk_object_ref (menuBar.handle);
- OS.gtk_container_remove (vboxHandle, menuBar.handle);
- }
- }
- menuBar = menu;
- if (menuBar != null) {
- int menuHandle = menu.handle;
- OS.gtk_box_pack_start (vboxHandle, menuHandle, false, false, 0);
- }
-}
-
-public void setMinimized (boolean minimized) {
- checkWidget();
-
- /*
- * In GDK, there is no way to iconify a shell.
- * If we wanted it really badly, on pure X this is done
- * by sending a client message - see ICCCM L.4.1.4.
- */
- if (minimized) return;
-
- /*
- * At least we can force a deiconify
- */
- GtkWidget w = new GtkWidget();
- OS.memmove(w, topHandle, w.sizeof);
- OS.gdk_window_show(w.window);
-}
-
-/**
-* Set the modal state.
-* <p>
-* @param modal the new modal state
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-*/
-public void setModal (int modal) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- this.modal = modal;
-}
-
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_window_set_title (topHandle, buffer);
-}
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible) {
- OS.gtk_widget_show_now (topHandle);
- display.update();
- sendEvent (SWT.Show);
- } else {
- OS.gtk_widget_hide (topHandle);
- sendEvent (SWT.Hide);
- }
-}
-
-
-/*
- * === DESTRUCTION ===
- */
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (vboxHandle);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- vboxHandle = 0;
-}
-
-void releaseShells () {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- shell.releaseWidget ();
- shell.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseShells ();
- super.releaseWidget ();
- if (accelGroup != 0) OS.gtk_accel_group_unref (accelGroup);
- accelGroup = 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java
deleted file mode 100644
index 2bad93913c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java
+++ /dev/null
@@ -1,539 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given slider will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the slider represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, sliders will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, sliders are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the slider's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the slider will not change.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see ScrollBar
- */
-
-public class Slider extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Slider (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10);
- if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.HORIZONTAL) != 0) {
- handle = OS.gtk_hscrollbar_new (hAdjustment);
- } else {
- handle = OS.gtk_vscrollbar_new (hAdjustment);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {}
-
-void showHandle() {
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
-}
-
-void register () {
- super.register ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.put (hAdjustment, this);
-}
-
-void deregister () {
- super.deregister ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- WidgetTable.remove (hAdjustment);
- /*
- * This code is intentionally commented.
- */
-// OS.gtk_object_unref (hAdjustment);
-// OS.gtk_object_destroy (hAdjustment);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- // We are interested in the preferred size.
- // The native widget gives us what it thinks the minimum reasonable
- // size; we'll say we prefer to be twice that long, and exactly
- // that wide.
- int x,y;
- Point size = super.computeSize (wHint, hHint, changed);
- if (hHint==SWT.DEFAULT) {
- x = size.x;
- if ((style & SWT.HORIZONTAL) != 0) x = 2*x;
- } else x = hHint;
- if (wHint==SWT.DEFAULT) {
- y = size.y;
- if ((style & SWT.VERTICAL) != 0) y = 2*y;
- } else y = wHint;
-
- return new Point(x,y);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.step_increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.upper;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.lower;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_increment;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.value;
-}
-
-/**
- * Returns the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getThumb () {
- checkWidget ();
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- return (int) adjustment.page_size;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.Selection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.step_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.upper = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.lower = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_increment = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_set_value (hAdjustment, value);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget ();
- if (value < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.page_size = (float) value;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget ();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int hAdjustment = OS.gtk_range_get_adjustment (handle);
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
- adjustment.value = (float) selection;
- adjustment.lower = (float) minimum;
- adjustment.upper = (float) maximum;
- adjustment.page_size = (float) thumb;
- adjustment.step_increment = (float) increment;
- adjustment.page_increment = (float) pageIncrement;
- OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
- OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
- OS.gtk_adjustment_changed (hAdjustment);
- OS.gtk_adjustment_value_changed (hAdjustment);
- OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java
deleted file mode 100644
index 4338e7e92e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java
+++ /dev/null
@@ -1,554 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>TabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabFolder extends Composite {
- int notebookHandle;
- TabItem [] items;
-
-
-/*
- * == CONSTRUCTORS ==
- */
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabFolder (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/*
- * == HANDLE DANCES, FIRST SPECIES ==
- */
-
-void createHandle (int index) {
- state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new();
- fixedHandle = OS.gtk_fixed_new ();
- notebookHandle = OS.gtk_notebook_new ();
- handle = OS.gtk_fixed_new();
-}
-
-void configure () {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, notebookHandle, (short)0, (short)0);
- OS.gtk_fixed_put (fixedHandle, handle, (short)2, (short)33);
-}
-
-void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(notebookHandle);
- OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (notebookHandle);
- OS.gtk_widget_realize (handle);
-}
-
-void register () {
- super.register ();
- WidgetTable.put (notebookHandle, this);
-}
-
-void hookEvents () {
- super.hookEvents ();
- signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
- signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
-}
-
-void createWidget (int index) {
- super.createWidget(index);
- items = new TabItem [4];
-}
-
-int topHandle () { return eventBoxHandle; }
-int paintHandle () { return notebookHandle; }
-int parentingHandle () { return handle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==notebookHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- //notebookHandle
- int width = _computeSize(wHint, hHint, changed).x;
- int height = 0;
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-/**
-* Computes the widget trim.
-*/
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- return new Rectangle(x-2, y-33, width+4, height+35);
-}
-
-/*
- **** Layout code ****
- */
-
-boolean _setSize(int width, int height) {
- boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
- UtilFuncs.setSize (fixedHandle, width,height);
- UtilFuncs.setSize (notebookHandle, width,height);
- UtilFuncs.setSize (handle, width-4, height-35);
- layoutCurrent();
- return differentExtent;
-}
-
-public Rectangle _getClientArea () {
- org.eclipse.swt.graphics.Point size = _getSize();
- int x = Math.max(size.x-4, 3);
- int y = Math.max(size.y-35, 3);
- return new Rectangle(0,0, x, y);
-}
-
-void layoutCurrent() {
- int index=getSelectionIndex();
- if (index==-1) return;
- Control control = items[index].control;
- if (control==null) return;
- if (control.isDisposed()) return;
- control.setBounds(getClientArea());
-}
-
-void createItem (TabItem item, int index) {
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (itemCount == items.length) {
- TabItem [] newItems = new TabItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-
- // create a new label
- byte [] buffer = new byte [] {0};
- int labelHandle = OS.gtk_label_new (buffer);
-
- // create a new fake page
- int stubPage = OS.gtk_fixed_new();
-
- // put the label and the fake page inside the notebook
- OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
- OS.gtk_notebook_append_page(notebookHandle, stubPage, labelHandle);
- OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
-
- OS.gtk_widget_show(labelHandle);
- OS.gtk_widget_show(stubPage);
-
- item.state |= HANDLE;
- item.handle = labelHandle;
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
- OS.gtk_notebook_set_show_tabs (notebookHandle, true);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-
-void destroyItem (TabItem item) {
- int index = 0;
- int itemCount = getItemCount();
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_notebook_remove_page (notebookHandle, index);
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- item.handle = 0;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-
-public TabItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return items [index];
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //return itemCount;
- int list = OS.gtk_container_children (notebookHandle);
- return OS.g_list_length (list);
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- TabItem [] result = new TabItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-/**
- * Returns an array of <code>TabItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
- if (index == -1) return new TabItem [0];
- return new TabItem [] {items [index]};
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return OS.gtk_notebook_get_current_page (notebookHandle);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TabItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- for (int i=0; i<itemCount; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-int processSelection (int int0, int int1, int int2) {
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
- if (index != -1) {
- Control control = items [index].getControl ();
- if (control != null && !control.isDisposed ()) {
- control.setVisible (false);
- }
- }
- Control control = items [int1].getControl ();
- if (control != null && !control.isDisposed ()) {
- control.setBounds(getClientArea());
- control.setVisible (true);
- }
- Event event = new Event();
- event.item = items[int1];
- postEvent(SWT.Selection, event);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int index) {
- checkWidget();
- if (index == -1) return;
- OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
- OS.gtk_notebook_set_page (notebookHandle, index);
- OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (TabItem [] items) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (items.length == 0) {
- setSelection (-1);
- return;
- }
- for (int i=items.length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) setSelection (index);
- }
-}
-
-/*
- * == DESTRUCTION ===
- */
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (notebookHandle);
-}
-
-void releaseChildren() {
- int list = OS.gtk_container_children (notebookHandle);
- int itemCount = OS.g_list_length (list);
- for (int i=0; i<itemCount; i++) {
- TabItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
-
- // Now, the non-item children
- list = OS.gtk_container_children(parentingHandle());
- int childCount = OS.g_list_length (list);
- for (int i=0; i<childCount; i++) {
- int childHandle = OS.g_list_nth_data(list, i);
- if (!isMyHandle(childHandle)) {
- Widget w = WidgetTable.get(childHandle);
- if (!(w==null) && !(w.isDisposed())) {
- w.releaseWidget();
- w.releaseHandle();
- }
- }
- }
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- notebookHandle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget();
- items = null;
-}
-
-/*
- * == AS YET UNCLASSIFIED ===
- */
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java
deleted file mode 100644
index 8454cc3d3b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * corresponding to a tab for a page in a tab folder.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TabItem extends Item {
- Control control;
- TabFolder parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-/**
- * Returns the control that is used to fill the client area of
- * the tab folder when the user selects the tab item. If no
- * control has been set, return <code>null</code>.
- * <p>
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return control;
-}
-public Display getDisplay () {
- TabFolder parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>TabFolder</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabFolder getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-/**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- Control oldControl = this.control, newControl = control;
- this.control = control;
- int index = parent.indexOf (this);
- if (index != parent.getSelectionIndex ()) return;
- if (newControl != null) {
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
- }
- if (oldControl != null) oldControl.setVisible (false);
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- super.setImage (image);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- byte [] buffer = string2bytesConvertMnemonic(string);
- OS.gtk_label_parse_uline(handle, buffer);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java
deleted file mode 100644
index d45196a62b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java
+++ /dev/null
@@ -1,1411 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement a selectable user interface
- * object that displays a list of images and strings and issue
- * notificiation when selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TableItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Table extends Composite {
- int itemCount, columnCount;
- TableItem [] items;
- TableColumn [] columns;
- TableItem itemBeingSelected;
- TableItem[] selection = new TableItem[0];
- int check, uncheck;
- int check_width, check_height;
- public static int MAX_COLUMNS = 32;
-
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Table (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-
-
-
-/*
- * === HANDLE CODE 1 ===
- */
-
-void createHandle (int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new();
- if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_clist_new (MAX_COLUMNS);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void setHandleStyle () {
- /* Single or Multiple Selection */
- int selectionMode;
- if ((style & SWT.MULTI) != 0) selectionMode = OS.GTK_SELECTION_EXTENDED;
- else selectionMode = OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, selectionMode);
-
- /* We fake the number of columns, because we have to know beforehand.
- * Initially all those fake columns are invisible
- */
- byte [] buffer = new byte [1];
- OS.gtk_clist_set_column_title (handle, 0, buffer);
- for (int i=1; i<MAX_COLUMNS; i++) {
- OS.gtk_clist_set_column_visibility (handle, i, false);
- }
-
- /* Scrolling policy */
- int hscrollbar_policy = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
- int vscrollbar_policy = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
- OS.gtk_scrolled_window_set_policy (scrolledHandle, hscrollbar_policy, vscrollbar_policy);
-}
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-static int checkStyle (int style) {
- /*
- * To be compatible with Windows, force the H_SCROLL
- * and V_SCROLL style bits. On Windows, it is not
- * possible to create a table without scroll bars.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (fixedHandle);
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
-int createCheckPixmap(boolean checked) {
- /*
- * The box will occupy the whole item width.
- */
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- check_height = clist.row_height-1;
- check_width = check_height;
-
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- int pixmap = OS.gdk_pixmap_new(0, check_width, check_height, visual.depth);
-
- int gc = OS.gdk_gc_new(pixmap);
-
- GdkColor fgcolor = new GdkColor();
- fgcolor.pixel = 0xFFFFFFFF;
- fgcolor.red = (short) 0xFFFF;
- fgcolor.green = (short) 0xFFFF;
- fgcolor.blue = (short) 0xFFFF;
- OS.gdk_gc_set_foreground(gc, fgcolor);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0,0, check_width,check_height);
-
- fgcolor = new GdkColor();
- fgcolor.pixel = 0;
- fgcolor.red = (short) 0;
- fgcolor.green = (short) 0;
- fgcolor.blue = (short) 0;
- OS.gdk_gc_set_foreground(gc, fgcolor);
-
- OS.gdk_draw_line(pixmap, gc, 0,0, 0,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, check_width-1,check_height-1, check_width-1,0);
- OS.gdk_draw_line(pixmap, gc, check_width-1,0, 0,0);
-
- /* now the cross check */
- if (checked) {
- OS.gdk_draw_line(pixmap, gc, 0,0, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,0);
- }
-
- OS.gdk_gc_destroy(gc);
- return pixmap;
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents ();
- signal_connect (handle, "select_row", SWT.Selection, 5);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new TableItem [4];
- columns = new TableColumn [4];
- itemCount = columnCount = 0;
-}
-
-/*
- * HANDLE CODE 2
- */
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-boolean isMyHandle(int h) {
- if (h==eventBoxHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==fixedHandle) return true;
- if (h==handle) return true;
- return false;
-
-}
-
-
-
-/*
- * === GEOMETRY ===
- */
-
-boolean _setSize(int width, int height) {
- boolean different = UtilFuncs.setSize(eventBoxHandle, width, height);
- if (different) UtilFuncs.setSize(fixedHandle, width, height);
- if (different) UtilFuncs.setSize(scrolledHandle, width, height);
- return different;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * The item field of the event object is valid for default selection, but the detail field is not used.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-
-/* The real work to create a new column */
-void createItem (TableColumn column, int index) {
- if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (columnCount == columns.length) {
- TableColumn [] newColumns = new TableColumn [columns.length + 4];
- System.arraycopy (columns, 0, newColumns, 0, columns.length);
- columns = newColumns;
- }
- OS.gtk_clist_set_column_visibility (handle, index, true);
- OS.gtk_clist_column_titles_passive(handle); // paranoia
- System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);
- columns [index] = column;
-}
-void createItem (TableItem item, int index) {
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (itemCount == items.length) {
- TableItem [] newItems = new TableItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-// int ptr = OS.g_malloc (1);
- int [] strings = new int [MAX_COLUMNS];
-// for (int i=0; i<strings.length; i++) strings [i] = ptr;
- for (int i=0; i<strings.length; i++) strings [i] = 0;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- int result = OS.gtk_clist_insert (handle, index, strings);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-// OS.g_free (ptr);
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_unselect_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_unselect_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_unselect_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = new TableItem[0];
-}
-
-void destroyItem (TableColumn column) {
- int index = 0;
- while (index < columnCount) {
- if (columns [index] == column) break;
- index++;
- }
- if (index == columnCount) return;
- OS.gtk_clist_set_column_visibility (handle, index, false);
- OS.gtk_clist_set_column_title (handle, index, new byte [1]);
- System.arraycopy (columns, index + 1, columns, index, --columnCount - index);
- columns [columnCount] = null;
-}
-void destroyItem (TableItem item) {
- int index = 0;
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) return;
- OS.gtk_clist_remove (handle, index);
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
-}
-/**
- * Returns the column at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this method will throw <code>ERROR_INVALID_RANGE</code> despite
- * the fact that a single column of data may be visible in the table.
- * This occurs when the programmer uses the table like a list, adding
- * items but never creating a column.
- *
- * @param index the index of the column to return
- * @return the column at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn getColumn (int index) {
- checkWidget();
- if (!(0 <= index && index < columnCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return columns [index];
-}
-/**
- * Returns the number of columns contained in the receiver.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this value is zero, despite the fact that visually, one column
- * of items is may be visible. This occurs when the programmer uses
- * the table like a list, adding items but never creating a column.
- *
- * @return the number of columns
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getColumnCount () {
- checkWidget();
- return columnCount;
-}
-/**
- * Returns an array of <code>TableColumn</code>s which are the
- * columns in the receiver. If no <code>TableColumn</code>s were
- * created by the programmer, the array is empty, despite the fact
- * that visually, one column of items may be visible. This occurs
- * when the programmer uses the table like a list, adding items but
- * never creating a column.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn [] getColumns () {
- checkWidget();
- TableColumn [] result = new TableColumn [columnCount];
- System.arraycopy (columns, 0, result, 0, columnCount);
- return result;
-}
-/**
- * Returns the width in pixels of a grid line.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getGridLineWidth () {
- checkWidget();
- /* FIXME */
- return 0;
-}
-
-
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (int index) {
- checkWidget();
- if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return items [index];
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (Point pt) {
- checkWidget();
-
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int clientX = pt.x;
- int clientY = pt.y - clist.column_title_area_height;
- if (clientY <= 0) return null;
-
- int[] row = new int[1], column = new int[1];
- row[0] = -1;
- OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
- if (row[0] == -1) return null;
- return items[row[0]];
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return itemCount;
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height;
-}
-/**
- * Returns an array of <code>TableItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getItems () {
- checkWidget();
- TableItem [] result = new TableItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-
-
-
-/*
- * === SELECTION STORY ===
- */
-
-/**
- * Returns an array of <code>TableItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem[] getSelection () {
- checkWidget();
- return selection;
-}
-
-/**
- * Get the selection from the OS.
- */
-private TableItem[] _getNativeSelection () {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- switch (clist.selection_mode) {
- case OS.GTK_SELECTION_SINGLE: return getSelection_single();
- case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
- case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
- case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
- default: error(SWT.ERROR_UNSPECIFIED);
- }
- /* can never get here */
- return null;
-}
-private TableItem[] getSelection_single () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- if (length == 0) return new TableItem[0];
- int index = OS.g_list_nth_data (clist.selection, 0);
- return new TableItem [] {items[index]};
-}
-private TableItem[] getSelection_browse () {
- /* same as single */
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- if (length == 0) return new TableItem[0];
- int index = OS.g_list_nth_data (clist.selection, 0);
- return new TableItem [] {items[index]};
-}
-private TableItem[] getSelection_multiple () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- TableItem [] result = new TableItem [length];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (clist.selection, i);
- result [i] = items [index];
- }
- return result;
-}
-private TableItem[] getSelection_extended () {
- GtkCList clist = new GtkCList();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection==0) return new TableItem[0];
- int length = OS.g_list_length (clist.selection);
- TableItem [] result = new TableItem [length];
- for (int i=0; i<length; i++) {
- int index = OS.g_list_nth_data (clist.selection, i);
- result [i] = items [index];
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- return selection.length;
-}
-private int _getNativeSelectionCount () {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int selectionList = clist.selection;
- if (selectionList==0) return 0;
- return OS.g_list_length (clist.selection);
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (OS.g_list_length (list) == 0) return -1;
- return OS.g_list_nth_data (list, 0);
-}
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- int [] indices = new int [length];
- for (int i=0; i<length; i++) {
- indices [i] = OS.g_list_nth_data (list, i);
- }
- return indices;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- GtkCList widget = new GtkCList ();
- OS.memmove (widget, handle, GtkCList.sizeof);
- int list = widget.selection;
- int length = OS.g_list_length (list);
- for (int i=0; i<length; i++) {
- if (index == OS.g_list_nth_data (list, i)) return true;
- }
- return false;
-}
-
-
-
-
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- return -clist.voffset / (clist.row_height + 1);
-}
-
-/**
- * Searches the receiver's list starting at the first column
- * (index 0) until a column is found that is equal to the
- * argument, and returns the index of that column. If no column
- * is found, returns -1.
- *
- * @param column the search column
- * @return the index of the column
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableColumn column) {
- checkWidget();
- if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<columnCount; i++) {
- if (columns [i] == column) return i;
- }
- return -1;
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<itemCount; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-void releaseWidget () {
- int columnCount = 0;
- for (int i=0; i<columnCount; i++) {
- TableColumn column = columns [i];
-// if (!column.isDisposed ()) column.releaseWidget ();
- if (column != null && !column.isDisposed ()) column.releaseWidget ();
- }
- columns = null;
- int itemCount = 0;
- for (int i=0; i<itemCount; i++) {
- TableItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
- }
- items = null;
- itemBeingSelected = null;
- if (check != 0) OS.gdk_pixmap_unref (check);
- if (uncheck != 0) OS.gdk_pixmap_unref (uncheck);
- check = uncheck = 0;
- super.releaseWidget ();
-}
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_clist_remove (handle, index);
- TableItem item = items [index];
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- item.releaseWidget ();
-}
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- int index = end;
- while (index >= start) {
- OS.gtk_clist_remove (handle, index);
- items [index].releaseWidget ();
- --index;
- }
- int first = index + 1, last = end + 1;
- System.arraycopy (items, last, items, first, itemCount - last);
- for (int i=itemCount-(last-first); i<itemCount; i++) items [i] = null;
- itemCount = itemCount - (last - first);
- if (first > start) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-/**
- * Removes the items from the receiver's list at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- int last = -1;
- for (int i=0; i<newIndices.length; i++) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- OS.gtk_clist_remove (handle, index);
- // BUG - disposed callback could remove an item
- items [index].releaseWidget ();
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
- last = index;
- }
- }
-}
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.gtk_clist_clear (handle);
- items = new TableItem [4];
- itemCount = 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_row (handle, index, 0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=start; i<=end; i++) {
- OS.gtk_clist_select_row (handle, i, 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- for (int i=0; i<indices.length; i++) {
- OS.gtk_clist_select_row (handle, indices [i], 0);
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_select_all (handle);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- selection = _getNativeSelection();
-}
-
-/**
- * Returns <code>true</code> if the receiver's header is visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's header's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getHeaderVisible () {
- checkWidget();
- return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_CLIST_SHOW_TITLES) != 0;
-}
-
-/**
- * Marks the receiver's header as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHeaderVisible (boolean show) {
- /* FIXME
- * We should investigate why this optimization is not working.
- */
-// boolean isVisibleNow = getHeaderVisible();
-// if (show==isVisibleNow) return;
- if (show) {
- OS.gtk_clist_column_titles_show (handle);
- OS.gtk_clist_column_titles_passive(handle);
- } else {
- OS.gtk_clist_column_titles_hide (handle);
- }
-}
-/**
- * Returns <code>true</code> if the receiver's lines are visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the visibility state of the lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getLinesVisible() {
- checkWidget();
- return false;
-}
-/**
- * Marks the receiver's lines as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLinesVisible (boolean show) {
- checkWidget();
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * The current selected is first cleared, then the new item is selected.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (int index) {
- deselectAll ();
- select (index);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- deselectAll ();
- select (start, end);
- selection = _getNativeSelection();
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int[])
- */
-public void setSelection (int [] indices) {
- deselectAll ();
- select (indices);
- selection = _getNativeSelection();
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (TableItem [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- deselectAll ();
- int length = items.length;
- if (length == 0) return;
- if ((style & SWT.SINGLE) != 0) length = 1;
- for (int i=length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) select (index);
- }
- selection = items; /* FIXME */
-}
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showSelection()
- */
-public void showItem (TableItem item) {
-// error(SWT.ERROR_NOT_IMPLEMENTED);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showItem(TableItem)
- */
-public void showSelection () {
- checkWidget();
- setTopIndex (getSelectionIndex ());
-}
-
-int processSelection (int int0, int int1, int int2) {
- selection = _getNativeSelection();
- itemBeingSelected = items [int0];
- Event event = new Event ();
- event.item = itemBeingSelected;
- sendEvent (SWT.Selection, event);
- return 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- OS.gtk_widget_grab_focus(handle);
-
- // First, see if we have a single or double click
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- boolean isDoubleClick = (gdkEvent.type == OS.GDK_2BUTTON_PRESS);
-
- // We can't just use the x and y coordinates from the Gdk event,
- // because the actual items are drawn on a special X window
- Point where = _gdkWindowGetPointer();
- int eventType;
- if (isDoubleClick) {
- eventType = SWT.MouseDoubleClick;
- Event event = new Event ();
- event.item=itemBeingSelected;
- event.x = where.x; event.y = where.y;
- sendEvent (SWT.DefaultSelection, event);
- return 1;
- }
-
- eventType = SWT.MouseDown;
- sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, where.x, where.y);
- if (gdkEvent.button == 3 && menu != null) menu.setVisible (true);
-
-
- if ((style&SWT.CHECK) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int clientX = where.x;
- int clientY = where.y - clist.column_title_area_height;
- if (clientY <= 0) return 1;
- int[] row = new int[1], column = new int[1];
- row[0] = -1;
- OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
- if (row[0] == -1) return -1;
- int leftmost = 2;
- if (clientX < leftmost) return 1;
- if (clientX > leftmost+check_width) return 1;
-
- TableItem item = items [row[0]];
- item._setChecked(!item._getChecked());
- Event event = new Event ();
- event.detail = SWT.CHECK;
- event.item = item;
- postEvent (SWT.Selection, event);
- }
- return 1;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java
deleted file mode 100644
index eab13dbec9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java
+++ /dev/null
@@ -1,403 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a column in a table widget.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd> Move, Resize, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TableColumn extends Item {
- Table parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (parent.getColumnCount ());
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the column header is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-void createWidget (int index) {
- parent.createItem (this, index);
- text = "";
-}
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Gets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @return the resizable attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getResizable () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return false;
- GtkCList gtkclist = new GtkCList();
- OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
- int chandle=gtkclist.column;
- GtkCListColumn gtkcolumn = new GtkCListColumn();
- OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
- return (gtkcolumn.resizeable == 1) ? true : false;
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return 0;
- GtkCList gtkclist = new GtkCList();
- OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
- int chandle=gtkclist.column;
- GtkCListColumn gtkcolumn = new GtkCListColumn();
- OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
- return gtkcolumn.width;
-}
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- */
-public void pack () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- text = null;
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- int index = parent.indexOf (this);
- if (index == -1 || index == 0) return;
- int table = parent.handle;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int justification = 0;
- if ((style & SWT.LEFT) == SWT.LEFT) justification |= OS.GTK_JUSTIFY_LEFT;
- if ((style & SWT.CENTER) == SWT.CENTER) justification |= OS.GTK_JUSTIFY_CENTER;
- if ((style & SWT.RIGHT) == SWT.RIGHT) justification |= OS.GTK_JUSTIFY_RIGHT;
- OS.gtk_clist_set_column_justification (table, index, justification);
-}
-/**
- * Sets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @param resizable the resize attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setResizable (boolean resizable) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- OS.gtk_clist_set_column_resizeable (table, index, resizable);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_clist_set_column_title (table, index, buffer);
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int index = parent.indexOf (this);
- if (index == -1) return;
- int table = parent.handle;
- OS.gtk_clist_set_column_width (table, index, width);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java
deleted file mode 100644
index 680b4e1961..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java
+++ /dev/null
@@ -1,503 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents an item in a table.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TableItem extends Item {
- Table parent;
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
- _setChecked(false);
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
- _setChecked(false);
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent at a column in the table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding column rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int CELL_SPACING=1;
- GtkCList table = new GtkCList();
- OS.memmove(table, parent.handle, GtkCList.sizeof);
- int columnHandle = table.column;
- columnHandle= columnHandle+index*GtkCListColumn.sizeof;
- GtkCListColumn column=new GtkCListColumn();
- OS.memmove(column, columnHandle, GtkCListColumn.sizeof);
- GtkAdjustment adjustment=new GtkAdjustment();
- OS.memmove(adjustment, table.vadjustment, GtkAdjustment.sizeof);
- float vaj = adjustment.value;
- OS.memmove(adjustment, table.hadjustment, GtkAdjustment.sizeof);
- float haj = adjustment.value;
- int x=(short)column.area_x+table.hoffset;
- int width=(short)column.area_width;
- int height=parent.getItemHeight();
- int row=parent.indexOf(this);
- int y=table.column_title_area_height+height*row+(row+2)*CELL_SPACING-(int)vaj;
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Return whether or not the receiver has a check box and can
- * be checked.
- */
-boolean isCheckable() {
- return (parent.style & SWT.CHECK) != 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- return _getChecked();
-}
-
-boolean _getChecked () {
- int row = parent.indexOf (this);
- if (row == -1) return false;
- int clist = parent.handle;
-
- int[] text = new int[1];
- int[] spacing = new int[1];
- int[] pixmap = new int[1];
- int[] mask = new int[1];
- OS.gtk_clist_get_pixtext(clist, row, 0, text, spacing, pixmap, mask);
-
- return pixmap[0]==parent.check;
-}
-
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((parent.style & SWT.CHECK) == 0) return false;
- return false;
-}
-
-/**
-* Gets the image at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the image
-* @return the image
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public Image getImage (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-/**
- * Returns a rectangle describing the size and location
- * relative to its parent of an image at a column in the
- * table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding image rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getImageBounds (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return new Rectangle (0, 0, 0, 0);
-}
-/**
- * Gets the image indent.
- *
- * @return the indent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getImageIndent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return 0;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
-* Gets the item text at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the item
-* @return the item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_CANNOT_GET_TEXT)
-* when the operation fails
-*/
-public String getText (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-/**
- * Sets the checked state of the receiver.
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget();
- _setChecked (checked);
-}
-void _setChecked (boolean checked) {
- if ((parent.style & SWT.CHECK) == 0) return; /* needed here because we don't verify in the constructor */
-
- int row = parent.indexOf (this);
- if (row == -1) return;
- int ctable = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- if (checked) OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, parent.check, 0);
- else OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, parent.uncheck, 0);
-}
-
-/**
- * Sets the grayed state of the receiver.
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
-}
-/**
- * Sets the receiver's image at a column.
- *
- * @param index the column index
- * @param image the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (int index, Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-// if (index == 0) {
-// setImage (image);
-// return;
-// }
- int row = parent.indexOf (this);
- if (row == -1) return;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- int ctable = parent.handle;
- if (text != null) {
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_clist_set_pixtext (ctable, row, index, buffer, (byte) 2, pixmap, mask);
- } else {
- OS.gtk_clist_set_pixmap (ctable, row, index, pixmap, mask);
- }
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int row = parent.indexOf (this);
- if (row == -1) return;
- super.setImage (image);
- int ctable = parent.handle;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- if (text != null) {
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, pixmap, mask);
- } else {
- OS.gtk_clist_set_pixmap (ctable, row, 0, pixmap, mask);
- }
-}
-/**
- * Sets the image for multiple columns in the Table.
- *
- * @param images the array of new images
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image [] images) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<images.length; i++) {
- setImage (i, images [i]);
- }
-}
-/**
- * Sets the image indent.
- *
- * @param indent the new indent
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImageIndent (int indent) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-/**
- * Sets the receiver's text at a column
- *
- * @param index the column index
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (int index, String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == 0) {
- setText (string);
- return;
- }
- int row = parent.indexOf (this);
- if (row == -1) return;
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- if (image != null) {
- OS.gtk_clist_set_pixtext(ctree, row, index, buffer, (byte) 2, image.pixmap, image.mask);
- } else {
- OS.gtk_clist_set_text (ctree, row, index, buffer);
- }
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int row = parent.indexOf (this);
- if (row == -1) return;
- super.setText (string);
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- if (image != null) {
- OS.gtk_clist_set_pixtext(ctree, row, 0, buffer, (byte) 2, image.pixmap, image.mask);
- } else {
- OS.gtk_clist_set_text (ctree, row, 0, buffer);
- }
-}
-/**
- * Sets the text for multiple columns in the table.
- *
- * @param strings the array of new strings
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String [] strings) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (strings == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<strings.length; i++) {
- String string = strings [i];
- if (string != null) setText (i, string);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java
deleted file mode 100644
index b6f5f5c74e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java
+++ /dev/null
@@ -1,1226 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that allow the user to enter and modify text.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Verify</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-
-public class Text extends Scrollable {
- int textLimit = 0xFFFF;
- boolean visibility = true;
- public final static int LIMIT;
- public final static String DELIMITER;
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0x7FFFFFFF;
- DELIMITER = "\n";
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Text (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- if ((style & SWT.SINGLE) != 0) {
- handle = OS.gtk_entry_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- } else {
- scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- handle = OS.gtk_text_new (0, 0);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- }
-}
-
-void setHandleStyle() {
- OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
- if ((style & SWT.SINGLE) == 0)
- OS.gtk_text_set_word_wrap (handle, (style & SWT.WRAP) != 0 ? 1 : 0);
- if (scrolledHandle!=0) setScrollingPolicy();
- // When 2.0 arrives, we'll be able to set the flat appearance
-
-}
-
-void configure() {
- _connectParent();
- if (scrolledHandle != 0) {
- OS.gtk_container_add (scrolledHandle, handle);
- }
-}
-
-void showHandle() {
- if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents();
- signal_connect_after (handle, "changed", SWT.Modify, 2);
- signal_connect (handle, "insert_text", SWT.Verify, 5);
- signal_connect (handle, "delete_text", SWT.Verify, 4);
- signal_connect (handle, "activate", SWT.Selection, 2);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is not called for texts.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is verified, by sending
- * it one of the messages defined in the <code>VerifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #removeVerifyListener
- */
-public void addVerifyListener (VerifyListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Verify, typedListener);
-}
-
-/**
- * Appends a string.
- * <p>
- * The new text is appended to the text at
- * the end of the widget.
- * </p>
- *
- * @param string the string to be appended
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void append (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string);
- if ((style & SWT.SINGLE) != 0) {
- OS.gtk_entry_append_text(handle, buffer);
- } else {
- int length = getCharCount();
- int [] position = new int [] {length};
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
- OS.gtk_editable_set_position (handle, position [0]);
- }
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- return style | SWT.MULTI;
- }
- return style | SWT.SINGLE;
-}
-/**
- * Clears the selection.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void clearSelection () {
- checkWidget ();
- int position = OS.gtk_editable_get_position (handle);
- OS.gtk_editable_delete_selection(handle);
- OS.gtk_editable_set_position (handle, position);
-}
-
-/**
- * Copies the selected text.
- * <p>
- * The current selection is copied to the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void copy () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
- GtkEditable widget = new GtkEditable ();
- OS.memmove(widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
- OS.memmove (handle, widget, GtkEditable.sizeof);
-}
-/**
- * Cuts the selected text.
- * <p>
- * The current selection is first copied to the
- * clipboard and then deleted from the widget.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void cut () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
- OS.memmove (handle, widget, GtkEditable.sizeof);
- OS.gtk_editable_delete_text(handle, start, end);
-}
-
-/**
- * Gets the line number of the caret.
- * <p>
- * The line number of the caret is returned.
- * </p>
- *
- * @return the line number
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretLineNumber () {
- checkWidget ();
- int addr_index=getCaretPosition();
- String tmpString= new String(getText(0,addr_index));
- return getLineNumberInString(tmpString,'\n');
-}
-
-/**
- * Gets the location the caret.
- * <p>
- * The location of the caret is returned.
- * </p>
- *
- * @return a point, the location of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCaretLocation () {
- checkWidget ();
- GtkText gtktext = new GtkText ();
- OS.memmove (gtktext, handle, GtkText.sizeof);
- return new Point (gtktext.cursor_pos_x, gtktext.cursor_pos_y);
-}
-
-/**
- * Gets the position of the caret.
- * <p>
- * The character position of the caret is returned.
- * </p>
- *
- * @return the position of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretPosition () {
- checkWidget ();
- //return OS.gtk_text_get_point (handle);
- return OS.gtk_editable_get_position (handle);
-}
-
-
-/**
- * Gets the number of characters.
- *
- * @return number of characters in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCharCount () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int address = OS.gtk_editable_get_chars (handle, 0, -1);
- int length = OS.strlen (address);
- OS.g_free (address);
- return length;
- }
- return OS.gtk_text_get_length (handle);
-}
-
-/**
- * Gets the line delimiter.
- *
- * @return a string that is the line delimiter
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getLineDelimiter () {
- checkWidget ();
- return "\n";
-}
-/**
- * Gets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getDoubleClickEnabled () {
- checkWidget ();
- return true;
-}
-/**
- * Gets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public char getEchoChar () {
- checkWidget ();
- return visibility ? '\0' : '*';
-}
-
-/**
- * Gets the editable state.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEditable () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- return widget.editable!=0;
-}
-
-/**
- * Gets the number of lines.
- *
- * @return the number of lines in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineCount () {
- checkWidget ();
- return getLineNumberInString(new String(getText()),'\n') + 1;
-}
-/**
- * Gets the height of a line.
- *
- * @return the height of a row of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineHeight () {
- checkWidget ();
- Font font = getFont();
- GdkFont gdkfont = new GdkFont();
- int fontHandle = font.handle;
- OS.memmove(gdkfont, fontHandle, GdkFont.sizeof);
- return gdkfont.ascent + gdkfont.descent;
-
-}
-/**
- * Gets the position of the selected text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p>
- *
- * @return the start and end of the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- return new Point (widget.selection_start_pos, widget.selection_end_pos);
-}
-/**
- * Gets the number of selected characters.
- *
- * @return the number of selected characters.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- return end - start;
-}
-/**
- * Gets the selected text.
- *
- * @return the selected text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getSelectionText () {
- checkWidget ();
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos,widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos,widget.selection_end_pos);
- int address = OS.gtk_editable_get_chars (handle, start, end);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Gets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @return the number of tab characters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTabs () {
- checkWidget ();
- GtkText widget= new GtkText();
- OS.memmove(widget, handle, GtkText.sizeof);
- return widget.default_tab_width;
-}
-
-/**
- * Gets the widget text.
- * <p>
- * The text for a text widget is the characters in the widget.
- * </p>
- *
- * @return the widget text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int address = OS.gtk_editable_get_chars (handle, 0, -1);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Gets a range of text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N-1 where N is
- * the number of characters in the widget.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- * @return the range of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText (int start, int end) {
- checkWidget ();
- int address = OS.gtk_editable_get_chars (handle, start, end);
- if (address == 0) return null;
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- return new String (buffer2, 0, buffer2.length);
-}
-
-/**
- * Returns the maximum number of characters that the receiver is capable of holding.
- * <p>
- * If this has not been changed by <code>setTextLimit()</code>,
- * it will be the constant <code>Text.LIMIT</code>.
- * </p>
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return textLimit;
- return LIMIT;
-}
-
-/**
- * Returns the zero-relative index of the line which is currently
- * at the top of the receiver.
- * <p>
- * This index can change when lines are scrolled or new lines are added or removed.
- * </p>
- *
- * @return the index of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return 0;
- GtkText widget = new GtkText ();
- OS.memmove (widget, handle, GtkText.sizeof);
- int topCharIndex=widget.first_line_start_index;
- return (getLineNumberInString(getText(0,topCharIndex), '\n'));
- //Since getText uses substring (start, end + 1),so topCharIndex-1
-}
-
-/**
- * Gets the top pixel.
- * <p>
- * The top pixel is the pixel position of the line
- * that is currently at the top of the widget. On
- * some platforms, a text widget can be scrolled by
- * pixels instead of lines so that a partial line
- * is displayed at the top of the widget.
- * </p><p>
- * The top pixel changes when the widget is scrolled.
- * The top pixel does not include the widget trimming.
- * </p>
- *
- * @return the pixel position of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopPixel () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return 0;
- GtkText widget= new GtkText();
- OS.memmove(widget, handle, GtkText.sizeof);
- return widget.first_onscreen_ver_pixel;
-}
-
-boolean getWrap () {
- checkWidget ();
- return false;
-}
-
-/**
- * Inserts a string.
- * <p>
- * The old selection is replaced with the new text.
- * </p>
- *
- * @param string the string
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void insert (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
- int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
- OS.gtk_editable_delete_text (handle, start, end);
- int [] position = new int [] {start};
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
-}
-
-/**
- * Pastes text from clipboard.
- * <p>
- * The selected text is deleted from the widget
- * and new text inserted from the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void paste () {
- checkWidget ();
- byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
- byte [] compound = Converter.wcsToMbcs (null, "COMPOUND_TEXT", true);
- int clipboard_atom = OS.gdk_atom_intern (clipboard, 0);
- int compound_atom = OS.gdk_atom_intern (compound, 0);
- OS.gtk_selection_convert(handle, clipboard_atom, compound_atom, 0);
-}
-
-int processModify (int arg0, int arg1, int int2) {
- sendEvent (SWT.Modify);
- return 0;
-}
-
-int processVerify (int int0, int int1, int int2) {
- if (!hooks (SWT.Verify)) return 0;
- if (int2 != 0) {
- // Insert
- if (int0 == 0 || int1==0){
- return 0;
- }
-// int length = OS.strlen (int0);
- byte [] buffer1 = new byte [int1];
- OS.memmove (buffer1, int0, buffer1.length);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String oldText = new String (buffer2, 0, buffer2.length);
- int [] position = new int [1];
- OS.memmove (position, int2, 4);
- if (position [0] == -1) position [0] = OS.gtk_text_get_length (handle);
- String newText = verifyText (oldText, position [0], position [0]); //WRONG POSITION
- if (newText == null) {
- byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, insert_text);
- return 0;
- }
- if (newText != oldText) {
- int windowProc5 = getDisplay ().windowProc5;
- byte [] buffer3 = Converter.wcsToMbcs (null, newText);
- OS.gtk_signal_handler_block_by_func (handle, windowProc5, SWT.Verify);
- OS.gtk_editable_insert_text (handle, buffer3, buffer3.length, position);
- OS.gtk_signal_handler_unblock_by_func (handle, windowProc5, SWT.Verify);
- byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, insert_text);
- return 0;
- }
- } else {
- // Delete
- int address = OS.gtk_editable_get_chars (handle, int0, int1);
- int length = OS.strlen (address);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, address, length);
- OS.g_free (address);
- char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
- String oldText = new String (buffer2, 0, buffer2.length);
- String newText = verifyText (oldText, int0, int1);
- if (newText == null) {
- byte [] delete_text = Converter.wcsToMbcs (null, "delete-text", true);
- OS.gtk_signal_emit_stop_by_name (handle, delete_text);
- return 0;
- }
- }
- return 0;
-}
-
-int processSelection (int int0, int int1, int int2) {
- postEvent (SWT.DefaultSelection);
- return 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is verified.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #addVerifyListener
- */
-public void removeVerifyListener (VerifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Verify, listener);
-}
-
-/**
- * Selects all the text in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- OS.gtk_editable_select_region (handle, 0, -1);
-}
-
-/**
- * Sets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @param doubleClick the new double click flag
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDoubleClickEnabled (boolean doubleClick) {
- checkWidget ();
-}
-
-/**
- * Sets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @param echo the new echo character
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEchoChar (char echo) {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- OS.gtk_entry_set_visibility (handle, visibility = echo == '\0');
- }
-}
-
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- OS.gtk_editable_set_editable (handle, editable);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * regular array indexing rules.
- * </p>
- *
- * @param start new caret position
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start) {
- checkWidget ();
- OS.gtk_editable_set_position (handle, start);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start, int end) {
- checkWidget ();
- OS.gtk_editable_set_position (handle, start);
- OS.gtk_editable_select_region (handle, start, end);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param selection the point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget ();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_editable_set_position (handle, selection.x);
- OS.gtk_editable_select_region (handle, selection.x, selection.y);
-}
-
- /**
- * Sets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @param tabs the number of tabs
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
-*/
-public void setTabs (int tabs) {
- checkWidget ();
- GtkText widget= new GtkText();
- widget.default_tab_width=tabs;
- OS.memmove(handle, widget, GtkText.sizeof);
-}
-
-/**
- * Sets the contents of the receiver to the given string.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.gtk_editable_delete_text (handle, 0, -1);
- int [] position = new int [1];
- byte [] buffer = Converter.wcsToMbcs (null, string);
- OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
- OS.gtk_editable_set_position (handle, 0);
-}
-
-/**
- * Sets the maximum number of characters that the receiver
- * is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget ();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- if ((style & SWT.SINGLE) != 0) {
- textLimit = (short) limit;
- OS.gtk_entry_set_max_length (handle, (short) limit);
- }
-}
-
-/**
- * Sets the zero-relative index of the line which is currently
- * at the top of the receiver. This index can change when lines
- * are scrolled or new lines are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- if (index > getLineCount()) return;
- GtkAdjustment adjustment = new GtkAdjustment();
- int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
- OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
- int adjust = (int)(index*adjustment.upper/getLineCount());
- if (adjust <= 0) {
- adjust = 0;
- verticalBar.setSelection(0);
- } else {
- verticalBar.setSelection(adjust);
- }
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- int topindex=getTopIndex();
- int lineheight = getLineHeight();
- while( topindex != index) {
- adjust=adjust+lineheight;
- verticalBar.setSelection(adjust+lineheight);
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- topindex=getTopIndex();
- }
-}
-
-void setWrap (boolean wrap) {
- checkWidget ();
- OS.gtk_text_set_word_wrap(handle, wrap ? 1 : 0);
-}
-
-/**
- * Shows the selection.
- * <p>
- * If the selection is already showing
- * in the receiver, this method simply returns. Otherwise,
- * lines are scrolled until the selection is visible.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- int start_pos, end_pos, pos;
- pos = OS.gtk_editable_get_position (handle);
- GtkEditable widget = new GtkEditable ();
- OS.memmove (widget, handle, GtkEditable.sizeof);
- start_pos = Math.min(widget.selection_start_pos, widget.selection_end_pos) ;
- end_pos = Math.max(widget.selection_start_pos, widget.selection_end_pos) ;
- GtkText gtktext = new GtkText ();
- OS.memmove (gtktext, handle, GtkText.sizeof);
- int topCharIndex=gtktext.first_line_start_index;
- if ( (topCharIndex > start_pos && topCharIndex < end_pos) || topCharIndex==start_pos ||
- topCharIndex == end_pos) return;
- if (pos < start_pos || pos > end_pos) {
- GtkAdjustment adjustment = new GtkAdjustment();
- int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
- OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
- String tmpString= new String(getText(0,start_pos));
- int currentln=getLineNumberInString(tmpString, '\n');
- int adjust = (int)(currentln*adjustment.upper/getLineCount()-adjustment.page_increment);
- if (adjust <= 0)
- OS.gtk_adjustment_set_value (verticalBar.handle, 0);
- else
- OS.gtk_adjustment_set_value (verticalBar.handle, adjust);
- OS.gtk_adjustment_value_changed(verticalBar.handle);
- OS.gtk_editable_set_position (handle, widget.selection_end_pos);
- OS.gtk_editable_select_region (handle, widget.selection_start_pos, widget.selection_end_pos);
- }
-
-}
-
-String verifyText (String string, int start, int end) {
- Event event = new Event ();
- event.text = string;
- event.start = start;
- event.end = end;
- sendEvent (SWT.Verify, event);
- if (!event.doit) return null;
- return event.text;
-}
-
-int getLineNumberInString( String string,char delimiter) {
- int count=0;
- for (int i=0; i<string.length (); i++) {
- if (string.charAt (i) == delimiter) count++;
- }
- return count;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java
deleted file mode 100644
index e1e5bedcf0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java
+++ /dev/null
@@ -1,351 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class ToolBar extends Composite {
- int boxHandle, tempHandle;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- /* FIXME
- * We do not need an event box here, as event boxes
- * have real X windows.
- */
- boxHandle = OS.gtk_event_box_new ();
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- int orientation = ((style&SWT.VERTICAL)!=0)?
- OS.GTK_ORIENTATION_VERTICAL : OS.GTK_ORIENTATION_HORIZONTAL;
- handle = OS.gtk_toolbar_new (orientation, OS.GTK_TOOLBAR_BOTH);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-
- tempHandle = OS.gtk_fixed_new();
- if (tempHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void setHandleStyle() {
- int relief = ((style&SWT.FLAT)!=0)? OS.GTK_RELIEF_NONE : OS.GTK_RELIEF_NORMAL;
- OS.gtk_toolbar_set_button_relief(handle, relief);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add (boxHandle, handle);
- // invisible handle to temporarily hold control (non-item) items
- OS.gtk_toolbar_insert_widget (handle,tempHandle,new byte[1], new byte[1],0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (layout != null) super.computeSize(wHint, hHint, changed);
- return _computeSize (wHint, hHint, changed);
-}
-
-int eventHandle () {
- return boxHandle;
-}
-
-void showHandle() {
- OS.gtk_widget_show (boxHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
- // don't show the temp fixed
-}
-
-void register() {
- super.register ();
- WidgetTable.put (boxHandle, this);
-}
-
-void deregister() {
- super.deregister ();
- WidgetTable.remove (boxHandle);
-}
-
-int topHandle() { return boxHandle; }
-int parentingHandle() { return tempHandle; }
-
-/**
- * Returns whether the argument points to an OS widget that is
- * implementing the receiver, i.e., one of my own handles
- */
-boolean isMyHandle(int h) {
- if (h==handle) return true;
- if (h==tempHandle) return true;
- if (h==boxHandle) return true;
- return false;
-}
-void _connectChild (int h) {
- // When we put a widget as a tool item, we don't know which item it is, yet.
- OS.gtk_fixed_put(tempHandle, h, (short)0, (short)0);
-}
-
-
-/*
- * === GEOMETRY ===
- */
-
-boolean _setSize (int width, int height) { UtilFuncs.setSize(boxHandle, width, height); return true; }
-
-
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (int index) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getItems()[index];
-}
-
-
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (Point point) {
- return null;
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- /* FIXME
- * This code will return the wrong count for items,
- * as list includes Window children
- */
-// int list = OS.gtk_container_children (handle);
-// return OS.g_list_length (list);
- // TEMPORARY CODE
- return getItems ().length;
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem [] getItems () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int count = 0;
- int list = OS.gtk_container_children (handle);
- int length = OS.g_list_length (list);
- ToolItem [] result = new ToolItem [length];
- for (int i=0; i<length; i++) {
- int data = OS.g_list_nth_data (list, i);
- Widget widget = WidgetTable.get (data);
- if (widget instanceof ToolItem) {
- result [count++] = (ToolItem) widget;
- }
- }
- if (length == count) return result;
- ToolItem [] newResult = new ToolItem [count];
- System.arraycopy (result, 0, newResult, 0, count);
- return newResult;
-}
-/**
- * Returns the number of rows in the receiver. When
- * the receiver has the <code>WRAP</code> style, the
- * number of rows can be greater than one. Otherwise,
- * the number of rows is always one.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-
-public int getRowCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return 1;
-}
-
-Control _childFromHandle(int h) {
- Widget child = WidgetTable.get(h);
- if (child==null) return null;
- if (child instanceof ToolItem) return null; // ToolItems are not our children
- return (Control)child;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (ToolItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- // TEMPORARY CODE
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- if (item == items[i]) return i;
- }
- return -1;
-}
-int processResize (int int0, int int1, int int2) {
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- Control control = items [i].control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (items [i].getBounds ());
- }
- }
- return 0;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = tempHandle = 0;
-}
-
-void releaseWidget () {
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- ToolItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- super.releaseWidget ();
-}
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style; // & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java
deleted file mode 100644
index e20c76f1c0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java
+++ /dev/null
@@ -1,744 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a button in a tool bar.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-
-public class ToolItem extends Item {
- int boxHandle;
- ToolBar parent;
- Control control;
- Image hotImage, disabledImage;
- int currentpixmap;
- boolean drawHotImage;
- int position;
- boolean configured=false;
- boolean shown=false;
- private int tooltipsHandle;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- position = parent.getItemCount ();
- createWidget (position);
-}
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- int count = parent.getItemCount ();
- if (!(0 <= index && index <= count)) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- position = index;
- createWidget (index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
- * the event object detail field contains the value <code>SWT.ARROW</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int bits = SWT.SEPARATOR | SWT.RADIO | SWT.CHECK | SWT.PUSH;
- switch (style & bits) {
- case SWT.RADIO:
- case SWT.CHECK:
- _createToggleHandle(index); return;
- case SWT.SEPARATOR:
- _createSeparatorHandle(index); return;
- case SWT.PUSH:
- default:
- _createPushHandle(index); return;
- }
-}
-
-private void _createSeparatorHandle(int index) {
- boxHandle = OS.gtk_event_box_new();
- if (boxHandle==0) error(SWT.ERROR_NO_HANDLES);
- boolean isVertical = (parent.getStyle()&SWT.VERTICAL) != 0;
- handle = isVertical? OS.gtk_hseparator_new() : OS.gtk_vseparator_new();
- if (handle==0) error(SWT.ERROR_NO_HANDLES);
-}
-private void _createPushHandle(int index) {
- handle = OS.gtk_toolbar_insert_element (parent.handle,
- OS.GTK_TOOLBAR_CHILD_BUTTON,
- 0, new byte[1], null, null,
- 0, 0, 0,
- index);
- configured=true;
- shown=true;
-}
-private void _createToggleHandle(int index) {
- handle = OS.gtk_toolbar_insert_element (parent.handle,
- OS.GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
- 0, new byte[1], null, null,
- 0, 0, 0,
- index);
- configured=true;
- shown=true;
-}
-
-
-void configure() {
- // configure is done for non-separators
- if (configured) return;
- OS.gtk_toolbar_insert_widget (
- parent.handle,
- topHandle(),
- new byte[1], new byte[1],
- position);
- OS.gtk_container_add(boxHandle, handle);
-}
-
-void showHandle() {
- if (shown) return;
- if ((parent.getStyle()&SWT.VERTICAL)!=0) OS.gtk_widget_set_usize(handle, 15, 3);
- else OS.gtk_widget_set_usize(handle, 3, 15);
- OS.gtk_widget_show(boxHandle);
- OS.gtk_widget_show(handle);
-}
-
-void register() {
- super.register ();
- if (boxHandle != 0) WidgetTable.put (boxHandle, this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- boxHandle = 0;
-}
-
-void deregister() {
- super.deregister ();
- if (boxHandle != 0) WidgetTable.remove (boxHandle);
-}
-
-int topHandle() {
- return (boxHandle==0)? handle : boxHandle;
-}
-
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Rectangle (widget.alloc_x, widget.alloc_y, widget.alloc_width, widget.alloc_height);
-}
-/**
- * Returns the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return control;
-}
-
-/**
- * Returns the receiver's disabled image if it has one, or null
- * if it does not.
- * <p>
- * The disabled image is displayed when the receiver is disabled.
- * </p>
- *
- * @return the receiver's disabled image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getDisabledImage () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- error(SWT.ERROR_NOT_IMPLEMENTED);
- return null;
-}
-
-public Display getDisplay () {
- ToolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return (widget.flags & OS.GTK_SENSITIVE) != 0;
-}
-/**
- * Returns the receiver's hot image if it has one, or null
- * if it does not.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @return the receiver's hot image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getHotImage () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
-}
-/**
- * Returns the receiver's parent, which must be a <code>ToolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolBar getParent () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- return OS.gtk_toggle_button_get_active (handle);
-}
-/**
- * Returns the receiver's tool tip text, or null if it has not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return "";
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return widget.alloc_width;
-}
-void hookEvents () {
- if ((style & SWT.SEPARATOR) != 0) return;
- signal_connect(handle, "clicked", SWT.Selection, 2);
- signal_connect(handle, "enter-notify-event", SWT.MouseEnter, 3);
- signal_connect(handle, "leave-notify-event", SWT.MouseExit, 3);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return getEnabled () && parent.isEnabled ();
-}
-
-int processMouseEnter (int int0, int int1, int int2) {
- drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
- if ( drawHotImage && (currentpixmap != 0) ) {
- OS.gtk_pixmap_set (currentpixmap, hotImage.pixmap, hotImage.mask);
- }
- return 0;
-}
-
-int processMouseExit (int int0, int int1, int int2) {
- if (drawHotImage) {
- drawHotImage = false;
- if (currentpixmap != 0 && image != null){
- OS.gtk_pixmap_set (currentpixmap, image.pixmap, image.mask);
- }
- }
- return 0;
-}
-/*
-int processPaint (int int0, int int1, int int2) {
- if (ignorePaint) return 0;
- Image currentImage = drawHotImage ? hotImage : image;
- if (!getEnabled()) {
- Display display = getDisplay ();
- currentImage = disabledImage;
- if (currentImage == null) {
- currentImage = new Image (display, image, SWT.IMAGE_DISABLE);
- }
- }
- if (currentpixmap != 0 && currentImage != null)
- OS.gtk_pixmap_set (currentpixmap, currentImage.pixmap, currentImage.mask);
- return 0;
-}
-*/
-int processSelection (int int0, int int1, int int2) {
- if ((style & SWT.RADIO) != 0) {
- this.setSelection (true);
- ToolItem [] items = parent.getItems ();
- int index = 0;
- while (index < items.length && items [index] != this) index++;
- ToolItem item;
- int i = index;
- while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- i = index;
- while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- }
- Event event = new Event ();
- postEvent (SWT.Selection, event);
- return 0;
-}
-void releaseWidget () {
- super.releaseWidget ();
- tooltipsHandle = 0;
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Sets the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget ();
- if (control != null) {
- if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- if ((style & SWT.SEPARATOR) == 0) return;
- Control newControl = control;
- Control oldControl = this.control;
- if (oldControl == newControl) return;
- if (oldControl != null) {
- int topHandle = control.topHandle ();
- int tempHandle = parent.tempHandle;
- OS.gtk_widget_reparent (topHandle, tempHandle);
- }
- this.control = newControl;
- if (newControl != null) {
- if (handle != boxHandle) {
- WidgetTable.remove (handle);
- OS.gtk_widget_destroy (handle);
- handle = boxHandle;
- }
- int topHandle = control.topHandle ();
- OS.gtk_widget_reparent (topHandle, boxHandle);
- //OS.gtk_widget_show (topHandle);
- } else {
- boolean isVertical = (parent.getStyle () & SWT.VERTICAL) != 0;
- handle = isVertical ? OS.gtk_hseparator_new () : OS.gtk_vseparator_new ();
- if (handle == 0) error(SWT.ERROR_NO_HANDLES);
- OS.gtk_container_add (boxHandle, handle);
- }
-}
-/**
- * Sets the receiver's disabled image to the argument, which may be
- * null indicating that no disabled image should be displayed.
- * <p>
- * The disbled image is displayed when the receiver is disabled.
- * </p>
- *
- * @param image the disabled image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDisabledImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) != 0) return;
- disabledImage = image;
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise.
- * <p>
- * A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * </p>
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-/**
- * Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @param image the hot image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHotImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) != 0) return;
- hotImage = image;
-}
-public void setImage (Image image) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- super.setImage (image);
- if ((style & SWT.SEPARATOR) != 0) return;
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- if (image != null) {
- int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
- OS.gtk_container_add (handle, pixmap);
- OS.gtk_widget_show (pixmap);
- currentpixmap = pixmap;
- }
-}
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_toggle_button_set_active (handle, selected);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-public void setText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- if ((style & SWT.ARROW) != 0) return;
- int length = string.length ();
- char [] text = new char [length + 1];
- char [] pattern = new char [length + 1];
- string.getChars (0, length, text, 0);
- int i = 0, j = 0;
- while (i < length) {
- pattern [j] = ' ';
- if (text [i] == '&') {
- i++;
- if (i < length && text [i] != '&') {
- pattern [j] = '_';
- }
- }
- text [j++] = text [i++];
- }
- while (j < i) {
- text [j] = pattern [j] = '\0';
- j++;
- }
- int list = OS.gtk_container_children (handle);
- if (list != 0) {
- int widget = OS.g_list_nth_data (list, 0);
- if (widget != 0) OS.gtk_widget_destroy (widget);
- }
- byte [] buffer1 = Converter.wcsToMbcs (null, text);
- int label = OS.gtk_label_new (buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
- OS.gtk_label_set_pattern (label, buffer2);
- OS.gtk_container_add (handle, label);
- OS.gtk_widget_show (label);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new();
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- OS.gtk_tooltips_set_tip(tooltipsHandle, handle, buffer, null);
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if ((style & SWT.SEPARATOR) == 0) return;
-
- Point size = control.computeSize(width, SWT.DEFAULT);
- control.setSize(size);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java
deleted file mode 100644
index dfc7b30b0e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java
+++ /dev/null
@@ -1,388 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement rubber banding rectangles.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Move</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tracker extends Widget {
- Composite parent;
- Display display;
- boolean tracking, stippled;
- Rectangle [] rectangles = new Rectangle [0];
-
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tracker (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- display = parent.getDisplay ();
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the tracker on the currently active
- * display if there is one. If there is no current display, the
- * tracker is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the tracker on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Tracker (Display display, int style) {
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = style;
- this.display = display;
-}
-
-
-
-/*
- * === ADD / REMOVE LISTENERS ===
- */
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
-}
-
-
-
-
-/*
- * === PUBLIC ACCESSORS ===
- */
-
-public Display getDisplay () {
- return display;
-}
-
-/**
- * Returns the bounds of the Rectangles being drawn.
- *
- * @return the bounds of the Rectangles being drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle [] getRectangles () {
- checkWidget();
- return rectangles;
-}
-
-/**
- * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
- *
- * @return the stippled effect of the rectangles
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getStippled () {
- checkWidget();
- return stippled;
-}
-
-/**
- * Specify the rectangles that should be drawn.
- *
- * @param rectangles the bounds of the rectangles to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setRectangles (Rectangle [] rectangles) {
- checkWidget();
- this.rectangles = rectangles;
-}
-
-/**
- * Change the appearance of the line used to draw the rectangles.
- *
- * @param stippled <code>true</code> if rectangle should appear stippled
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setStippled (boolean stippled) {
- checkWidget();
- this.stippled = stippled;
-}
-
-
-
-/*
- * === PUBLIC FUNCTIONALITY ===
- */
-
-/**
- * Stop displaying the tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget();
- tracking = false;
-}
-
-/**
- * Start displaying the Tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean open () {
- checkWidget();
- int xWindow = calculateWindow();
- boolean cancelled=false;
- tracking = true;
- drawRectangles ();
-
- int[] newX = new int[1];
- int[] newY = new int[1];
- int[] oldX = new int[1];
- int[] oldY = new int[1];
- OS.gdk_window_get_pointer(xWindow, oldX,oldY, 0);
-
- while (tracking) {
- if (parent != null && parent.isDisposed ()) break;
- int eventType = waitEvent();
- switch (eventType) {
- case OS.GDK_BUTTON_RELEASE:
- case OS.GDK_MOTION_NOTIFY:
- OS.gdk_window_get_pointer(xWindow, newX,newY, 0);
- if (oldX [0] != newX [0] || oldY [0] != newY [0]) {
- drawRectangles ();
- for (int i=0; i<rectangles.length; i++) {
- rectangles [i].x += newX [0] - oldX [0];
- rectangles [i].y += newY [0] - oldY [0];
- }
- Event event = new Event();
- event.x = newX[0];
- event.y = newY[0];
- sendEvent (SWT.Move,event);
- drawRectangles ();
- oldX [0] = newX [0]; oldY [0] = newY [0];
- }
- tracking = (eventType != OS.GDK_BUTTON_RELEASE);
- break;
- case OS.GDK_KEY_PRESS:
-// error(SWT.ERROR_NOT_IMPLEMENTED);
- /*
- XKeyEvent keyEvent = new XKeyEvent ();
- OS.memmove (keyEvent, xEvent, XKeyEvent.sizeof);
- if (keyEvent.keycode != 0) {
- int [] keysym = new int [1];
- OS.XLookupString (keyEvent, null, 0, keysym, null);
- keysym [0] &= 0xFFFF;
- tracking = keysym [0] != OS.XK_Escape && keysym [0] != OS.XK_Cancel;
- cancelled = !tracking;
- }*/
- break;
- } // switch
- } // while
- drawRectangles(); // clean up our mess
- tracking = false;
- return !cancelled;
-}
-
-
-
-private void drawRectangles () {
- int xWindow = calculateWindow();
- if (parent != null) {
- if (parent.isDisposed ()) return;
- parent.getShell ().update ();
- } else {
- display.update ();
- }
-
- int gc = OS.gdk_gc_new(xWindow);
- if (gc==0) error(SWT.ERROR_UNSPECIFIED);
-
- /* White foreground */
- int colormap = OS.gdk_colormap_get_system();
- GdkColor color = new GdkColor();
- OS.gdk_color_white(colormap, color);
- OS.gdk_gc_set_foreground(gc, color);
-
- /* Draw on top of inferior widgets */
- OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
-
- /* XOR */
- OS.gdk_gc_set_function(gc, OS.GDK_XOR);
-
- for (int i=0; i<rectangles.length; i++) {
- Rectangle rect = rectangles [i];
- OS.gdk_draw_rectangle(xWindow, gc, 0, rect.x, rect.y, rect.width, rect.height);
- }
- OS.gdk_gc_destroy(gc);
-}
-/*
- * Wait for an event to show up.
- * Return the event's type as a GdkEventType.
- */
-private int waitEvent() {
- int[] eventType = new int[1];
- int eventPtr;
-
- while (true) {
- eventPtr = OS.gdk_event_get();
- if (eventPtr != 0) {
- // hack, must implement memmove properly
- // GdkEvent event = new GdkEvent(eventPtr);
- OS.memmove(eventType, eventPtr, 4);
- OS.gdk_event_free(eventPtr);
- return eventType[0];
- }
- else {
- try { Thread.sleep(50); } catch (Exception ex) {}
- }
- }
-}
-
-/*
- * Figure which GdkWindow we'll draw on.
- * That's normally the root X window, or the parent's GdkWindow if we have a parent.
- */
-private int calculateWindow() {
- int answer;
- if (parent == null) {
- answer = OS.GDK_ROOT_PARENT();
- } else {
- answer = parent._gdkWindow();
- }
- if (answer==0) error(SWT.ERROR_UNSPECIFIED);
- return answer;
-}
-
-public void setCursor (Cursor value) {
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java
deleted file mode 100644
index 95833415cb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java
+++ /dev/null
@@ -1,968 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class provide a selectable user interface object
- * that displays a hierarchy of items and issue notificiation when an
- * item in the hierarchy is selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TreeItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tree extends Composite {
- TreeItem [] items;
- boolean selected, doubleSelected;
- int check, uncheck;
- static int CELL_SPACING = 1;
-
- /*
- * NOT DONE - These need to be moved to display,
- * they are not thread safe. Consider moving the
- * methods that access them to Display.
- */
- static TreeItem [] Items;
- static int Index, Count, Sibling;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tree (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- /*
- * To be compatible with Windows, force the H_SCROLL
- * and V_SCROLL style bits. On Windows, it is not
- * possible to create a tree without scroll bars.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-boolean _setSize(int width, int height) {
- if (!UtilFuncs.setSize (eventBoxHandle, width, height)) return false;
- UtilFuncs.setSize (scrolledHandle, width, height);
- return true;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection, typedListener);
- addListener (SWT.DefaultSelection, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when an item in the receiver is expanded or collapsed
- * by sending it one of the messages defined in the <code>TreeListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #removeTreeListener
- */
-public void addTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Expand, typedListener);
- addListener (SWT.Collapse, typedListener);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-void configure() {
- _connectParent();
- OS.gtk_container_add(eventBoxHandle, fixedHandle);
- OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
- OS.gtk_container_add (scrolledHandle, handle);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
-
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- fixedHandle = OS.gtk_fixed_new ();
- if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-
- scrolledHandle = OS.gtk_scrolled_window_new(0,0);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- handle = OS.gtk_ctree_new (1, 0);
- if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
-}
-
-int createCheckPixmap(boolean checked) {
- /*
- * The box will occupy the whole item width.
- */
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int check_height = clist.row_height-1;
- int check_width = check_height;
-
- GdkVisual visual = new GdkVisual();
- OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
- int pixmap = OS.gdk_pixmap_new(0, check_width, check_height, visual.depth);
-
- int gc = OS.gdk_gc_new(pixmap);
-
- GdkColor fgcolor = new GdkColor();
- fgcolor.pixel = 0xFFFFFFFF;
- fgcolor.red = (short) 0xFFFF;
- fgcolor.green = (short) 0xFFFF;
- fgcolor.blue = (short) 0xFFFF;
- OS.gdk_gc_set_foreground(gc, fgcolor);
- OS.gdk_draw_rectangle(pixmap, gc, 1, 0,0, check_width,check_height);
-
- fgcolor = new GdkColor();
- fgcolor.pixel = 0;
- fgcolor.red = (short) 0;
- fgcolor.green = (short) 0;
- fgcolor.blue = (short) 0;
- OS.gdk_gc_set_foreground(gc, fgcolor);
-
- OS.gdk_draw_line(pixmap, gc, 0,0, 0,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, check_width-1,check_height-1, check_width-1,0);
- OS.gdk_draw_line(pixmap, gc, check_width-1,0, 0,0);
-
- /* now the cross check */
- if (checked) {
- OS.gdk_draw_line(pixmap, gc, 0,0, check_width-1,check_height-1);
- OS.gdk_draw_line(pixmap, gc, 0,check_height-1, check_width-1,0);
- }
-
- OS.gdk_gc_destroy(gc);
- return pixmap;
-}
-
-void createItem (TreeItem item, int node, int index) {
- int id = 0;
- while (id < items.length && items [id] != null) id++;
- if (id == items.length) {
- TreeItem [] newItems = new TreeItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
-
- /* Feature in GTK.
- * When the selection policy is BROWSE (which is what we use for SINGLE),
- * the first item added gets automatically selected. This leads to some
- * nontrivial complications which one better avoid. The hack is to
- * temporarily put a value other than GTK_SELECTION_BROWSE into the
- * selectionMode field just for the insertion. Do not use the policy
- * changing API because this will cause a selection callback.
- */
-// GtkCTree ctree = new GtkCTree ();
-// OS.memmove (ctree, handle, GtkCTree.sizeof);
-// int selection_mode = ctree.selection_mode;
-// ctree.selection_mode = OS.GTK_SELECTION_MULTIPLE;
-// OS.memmove (handle, ctree, GtkCTree.sizeof);
- int [] sm = new int [1];
- OS.memmove (sm, handle+148, 1);
- int selectionMode = sm[0];
- sm [0] = OS.GTK_SELECTION_MULTIPLE;
- OS.memmove (handle+148, sm, 1);
-// FIXME
- int sibling = index == -1 ? 0 : findSibling (node, index);
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- item.handle = OS.gtk_ctree_insert_node (handle, node, sibling, null, (byte) 2, uncheck, 0, uncheck, 0, false, false);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- if (item.handle == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.gtk_ctree_node_set_row_data (handle, item.handle, id + 1);
-
-// OS.memmove (ctree, handle, GtkCTree.sizeof);
-// ctree.selection_mode = selection_mode;
-// OS.memmove (handle, ctree, GtkCTree.sizeof);
- sm [0] = selectionMode;
- OS.memmove (handle+148, sm, 1);
- items [id] = item;
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new TreeItem [4];
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll() {
- checkWidget();
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_unselect_recursive (handle, root);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-void destroyItem (TreeItem item) {
- int node = item.handle;
- Callback GtkCTreeFunc = new Callback (this, "GtkCTreeDispose", 3);
- int address = GtkCTreeFunc.getAddress ();
- OS.gtk_ctree_post_recursive (handle, node, address, 0);
- GtkCTreeFunc.dispose ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Collapse);
- OS.gtk_ctree_remove_node (handle, node);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Collapse);
-}
-
-int findSibling (int node, int index) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Index = 0;
- Sibling = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeFindSibling", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, index);
- GtkCTreeCountItems.dispose ();
- if (Sibling == node) Sibling = 0;
- return Sibling;
-}
-
-public boolean forceFocus () {
- checkWidget ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- boolean result = super.forceFocus ();
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- return result;
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getItem (Point point) {
- checkWidget ();
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, point.x, point.y, row, column);
- if (code == 0) return null;
- int node = OS.gtk_ctree_node_nth (handle, row [0]);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- return items [index];
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. The
- * number that is returned is the number of roots in the
- * tree.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return getItemCount (0);
-}
-
-int getItemCount (int node) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Count = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeCountItems", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, node);
- GtkCTreeCountItems.dispose ();
- return Count;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- return clist.row_height + CELL_SPACING;
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. These
- * are the roots of the tree.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget();
- return getItems (0);
-}
-
-TreeItem [] getItems (int node) {
- int depth = 1;
- if (node != 0) {
- int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- depth = row.level + 1;
- }
- Count = 0;
- Callback GtkCTreeCountItems = new Callback (this, "GtkCTreeCountItems", 3);
- int address0 = GtkCTreeCountItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address0, node);
- GtkCTreeCountItems.dispose ();
- Items = new TreeItem [Count];
- Count = 0;
- Callback GtkCTreeGetItems = new Callback (this, "GtkCTreeGetItems", 3);
- int address1 = GtkCTreeGetItems.getAddress ();
- OS.gtk_ctree_post_recursive_to_depth (handle, node, depth, address1, node);
- GtkCTreeGetItems.dispose ();
- TreeItem [] result = Items;
- Items = null;
- return result;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget ();
- return null;
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem[] getSelection () {
- checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return new TreeItem [0];
- int length = OS.g_list_length (clist.selection);
- TreeItem [] result = new TreeItem [length];
- for (int i=0; i<length; i++) {
- int node = OS.g_list_nth_data (clist.selection, i);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- result [i] = items [index];
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return 0;
- return OS.g_list_length (clist.selection);
-}
-
-int GtkCTreeCountItems (int ctree, int node, int data) {
- if (data != node) Count++;
- return 0;
-}
-
-int GtkCTreeFindSibling (int ctree, int node, int data) {
- if (Index == -1) return 0;
- Index = data == Index ? -1 : Index + 1;
- Sibling = node;
- return 0;
-}
-
-int GtkCTreeGetItems (int ctree, int node, int data) {
- if (data != node) {
- int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
- Items [Count++] = items [index];
- }
- return 0;
-}
-
-int GtkCTreeDispose (int ctree, int node, int data) {
- int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
- OS.gtk_ctree_node_set_row_data (ctree, node, 0);
- TreeItem item = items [index];
- item.releaseWidget ();
- item.releaseHandle ();
- items [index] = null;
- return 0;
-}
-
-void hookEvents () {
- //TO DO - get rid of enter/exit for mouse crossing border
- super.hookEvents ();
- signal_connect (handle, "tree_select_row", SWT.Selection, 4);
- signal_connect (handle, "tree_unselect_row", SWT.Selection, 4);
- signal_connect (handle, "tree_expand", SWT.Expand, 3);
- signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-
-boolean isMyHandle(int h) {
- if (h==fixedHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
-int processCollapse (int int0, int int1, int int2) {
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- /*
- * This code is intentionally commented.
- * Not yet sure if freezing improves the
- * look when a tree is collapsed.
- */
-// OS.gtk_clist_freeze (handle);
- sendEvent (SWT.Collapse, event);
-// OS.gtk_clist_thaw (handle);
- return 0;
-}
-
-int processExpand (int int0, int int1, int int2) {
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- OS.gtk_clist_freeze (handle);
- sendEvent (SWT.Expand, event);
- OS.gtk_clist_thaw (handle);
- boolean [] expanded = new boolean [1];
- OS.gtk_ctree_get_node_info (handle, int0, null, null, null, null, null, null, null, expanded);
- if (!expanded [0]) {
- OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
- OS.gtk_ctree_expand (handle, int0);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Expand);
- }
- return 0;
-}
-
-int processMouseDown (int callData, int arg1, int int2) {
- doubleSelected = false;
- int result = super.processMouseDown (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) selected = true;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- if ((style & SWT.CHECK) != 0) {
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- int node = OS.gtk_ctree_node_nth (handle, row [0]);
- int crow = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row_data = new GtkCTreeRow ();
- OS.memmove (row_data, crow, GtkCTreeRow.sizeof);
- GtkCTree ctree = new GtkCTree();
- OS.memmove (ctree, handle, GtkCTree.sizeof);
- int nX = ctree.hoffset + ctree.tree_indent * row_data.level - 2;
- int nY = ctree.voffset + (ctree.row_height + 1) * row [0] + 2;
- int [] unused = new int [1], check_width = new int [1], check_height = new int [1];
- OS.gdk_window_get_geometry (check, unused, unused, check_width, check_height, unused);
- if (nX <= x && x <= nX + check_width [0]) {
- if (nY <= y && y <= nY + check_height [0]) {
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap = new int [1], mask = new int [1];
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- byte [] text = Converter.wcsToMbcs (null, items [index].getText (), true);
- OS.gtk_ctree_get_node_info (handle, node, null, spacing, pixmap, mask, pixmap, mask, is_leaf, expanded);
- pixmap [0] = pixmap [0] == check ? uncheck : check;
- OS.gtk_ctree_set_node_info (handle, node, text, spacing [0], pixmap [0], mask [0], pixmap [0], mask [0], is_leaf [0], expanded [0]);
- Event event = new Event ();
- event.detail = SWT.CHECK;
- event.item = items [index];
- postEvent (SWT.Selection, event);
- }
- }
- }
- }
- }
- if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) doubleSelected = true;
- }
- }
- return result;
-}
-
-int processMouseUp (int callData, int arg1, int int2) {
- int result = super.processMouseUp (callData, arg1, int2);
- /*
- * Feature in GTK. When an item is reselected in a
- * mulit-select tree, GTK does not issue notification.
- * The fix is to detect that the mouse was released over
- * a selected item when no selection signal was set and
- * issue a fake selection event.
- *
- * Feature in GTK. Double selection can only be implemented
- * in a mouse up handler for a tree unlike the list,the event
- * that caused the select signal is not included when the select
- * signal is issued.
- */
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
- int x = (int) gdkEvent.x, y = (int) gdkEvent.y;
- if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
- if ((style & SWT.SINGLE) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- int list = clist.selection;
- if (list != 0 && OS.g_list_length (list) != 0) {
- int node = OS.g_list_nth_data (list, 0);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- Event event = new Event ();
- event.item = items [index];
- if (doubleSelected) {
- postEvent (SWT.DefaultSelection, event);
- } else {
- postEvent (SWT.Selection, event);
- }
- }
- selected = false;
- }
- if ((style & SWT.MULTI) != 0) {
- int [] row = new int [1], column = new int [1];
- int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
- if (code != 0) {
- int focus = OS.gtk_ctree_node_nth (handle, row [0]);
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- if (selected && clist.selection != 0) {
- int length = OS.g_list_length (clist.selection);
- for (int i=0; i<length; i++) {
- int node = OS.g_list_nth_data (clist.selection, i);
- if (node == focus) {
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- Event event = new Event ();
- event.item = items [index];
- if (doubleSelected) {
- postEvent (SWT.DefaultSelection, event);
- } else {
- postEvent (SWT.Selection, event);
- }
- }
- }
- }
- }
- selected = false;
- }
- }
- doubleSelected = false;
- return result;
-}
-
-int processSelection (int int0, int int1, int int2) {
- if ((style & SWT.SINGLE) != 0) {
- selected = true;
- return 0;
- }
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
- int focus = OS.gtk_ctree_node_nth (handle, clist.focus_row);
- if (focus != int0) return 0;
- if ((style & SWT.MULTI) != 0) selected = false;
- int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
- Event event = new Event ();
- event.item = items [index];
- postEvent (SWT.Selection, event);
- return 0;
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- if (check != 0) OS.gdk_pixmap_unref (check);
- if (uncheck != 0) OS.gdk_pixmap_unref (uncheck);
- check = uncheck = 0;
- super.releaseWidget ();
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- OS.gtk_ctree_remove_node (handle, 0);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = new TreeItem [4];
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when items in the receiver are expanded or collapsed..
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #addTreeListener
- */
-public void removeTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Expand, listener);
- eventTable.unhook (SWT.Collapse, listener);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_select_recursive (handle, root);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
-}
-
-void setHandleStyle () {
- int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_EXTENDED : OS.GTK_SELECTION_BROWSE;
- OS.gtk_clist_set_selection_mode (handle, mode);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#deselectAll()
- */
-public void setSelection (TreeItem [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- int root = OS.gtk_ctree_node_nth (handle, 0);
- if (root == 0) return;
- OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_ctree_unselect_recursive (handle, root);
- int index = 0, length = items.length;
- while (index < length) {
- TreeItem item = items [index];
- if (item != null) {
- if (item.isDisposed ()) break;
- OS.gtk_ctree_select (handle, item.handle);
- }
- index++;
- }
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
- if (index != length) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-
-void showHandle() {
- OS.gtk_widget_show (eventBoxHandle);
- OS.gtk_widget_show (fixedHandle);
- OS.gtk_widget_show (scrolledHandle);
- OS.gtk_widget_show (handle);
- OS.gtk_widget_realize (handle);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showItem(TreeItem)
- */
-public void showSelection () {
- checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
- if (clist.selection == 0) return;
- if (OS.g_list_length (clist.selection) == 0) return;
- int node = OS.g_list_nth_data (clist.selection, 0);
- int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
- showItem (items [index]);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled
- * and expanded until the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showSelection()
- */
-public void showItem (TreeItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- int node = item.handle;
- int visibility = OS.gtk_ctree_node_is_visible (handle, node);
- if (visibility != OS.GTK_VISIBILITY_NONE) return;
- if (!OS.gtk_ctree_is_viewable (handle, node)) {
- int parent = node;
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
- do {
- int data = OS.g_list_nth_data (parent, 0);
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- if ((parent = row.parent) == 0) break;
- OS.gtk_ctree_expand (handle, parent);
- } while (true);
- OS.gtk_signal_handler_unblock_by_data (handle, SWT.Expand);
- }
- OS.gtk_ctree_node_moveto (handle, node, 0, 0.0f, 0.0f);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java
deleted file mode 100644
index cafd7782d3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java
+++ /dev/null
@@ -1,496 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a hierarchy of tree items in a tree widget.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TreeItem extends Item {
- Tree parent;
- int index;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, 0, -1);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style, int index) {
- super (parent, style);
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- this.parent = parent;
- parent.createItem (this, 0, index);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style) {
- super (checkNull (parentItem).getParent(), style);
- this.parent = parentItem.getParent ();
- parent.createItem (this, parentItem.handle, -1);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style, int index) {
- super (checkNull (parentItem).getParent (), style);
- if (index < 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- this.parent = parentItem.getParent ();
- parent.createItem (this, parentItem.handle, index);
-}
-
-static TreeItem checkNull (TreeItem item) {
- if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- int ctree = parent.handle;
- GtkCTree tree = new GtkCTree();
- OS.memmove(tree, ctree, GtkCTree.sizeof);
-
- GtkAdjustment adjustment = new GtkAdjustment ();
- OS.memmove (adjustment, tree.vadjustment, GtkAdjustment.sizeof);
- float vaj = adjustment.value;
- OS.memmove (adjustment, tree.hadjustment, GtkAdjustment.sizeof);
- float haj = adjustment.value;
- int columnHandle = tree.column;
-
- int height=parent.getItemHeight();
-
- int row_list = tree.row_list; int level=0;
- int count = OS.g_list_length (row_list);
- int index=0;
- while (index<count) {
- int data = OS.g_list_nth (row_list, index);
- if (handle == data){
- int rowHandle = OS.g_list_nth_data (row_list, index);
- GtkCTreeRow row = new GtkCTreeRow();
- OS.memmove(row, rowHandle, GtkCTreeRow.sizeof);
- level = row.level;
- break;
- }
- index++;
- }
- int y = height*index + Tree.CELL_SPACING + tree.voffset + 2;
-
- int [] buffer = new int [1]; byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, buffer, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
- int length = OS.strlen (buffer[0]);
- byte [] buffer1 = new byte [length];
- OS.memmove (buffer1, buffer[0], length);
- int styleHandle = OS.gtk_ctree_node_get_row_style(ctree, handle);
- if (styleHandle == 0)
- styleHandle = OS.gtk_widget_get_style(ctree);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, styleHandle, GtkStyle.sizeof);
- int width = OS.gdk_string_width(style.font, buffer1);
-
-// x = (short)column.area_x+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
- int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
-
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int ctree = parent.handle;
- int [] pixmap = new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, null, pixmap, null, null, null, null, null);
- return pixmap [0] == parent.check;
-}
-
-public Display getDisplay () {
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is expanded,
- * and false otherwise.
- * <p>
- *
- * @return the expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getExpanded () {
- checkWidget();
- int ctree = parent.handle;
- boolean [] buffer = new boolean [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, null, null, null, null, null, null, buffer);
- return buffer [0];
-}
-
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed() {
- checkWidget();
- return false;
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- return parent.getItemCount (handle);
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s which are the
- * direct item children of the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget();
- return parent.getItems (handle);
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Tree</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Tree getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget();
- int data = OS.g_list_nth_data (handle, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
- if (row.parent == 0) return null;
- int ctree = parent.handle;
- int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;
- return parent.items [index];
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Sets the checked state of the receiver.
- * <p>
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return;
- int ctree = parent.handle;
- byte [] spacing = new byte [1];
- int [] pixmap = new int [1], mask = new int [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap, mask, pixmap, mask, is_leaf, expanded);
- if (checked && pixmap [0] == parent.check) return;
- if (!checked && pixmap [0] == parent.uncheck) return;
- pixmap [0] = checked ? parent.check : parent.uncheck;
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap [0], mask [0], pixmap [0], mask [0], is_leaf [0], expanded [0]);
-}
-
-/**
- * Sets the grayed state of the receiver.
- * <p>
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
-}
-
-/**
- * Sets the expanded state of the receiver.
- * <p>
- *
- * @param expanded the new expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setExpanded (boolean expanded) {
- checkWidget();
- int ctree = parent.handle;
- if (expanded) {
- OS.gtk_signal_handler_block_by_data (ctree, SWT.Expand);
- OS.gtk_ctree_expand (ctree, handle);
- OS.gtk_signal_handler_unblock_by_data (ctree, SWT.Expand);
- } else {
- OS.gtk_signal_handler_block_by_data (ctree, SWT.Collapse);
- OS.gtk_ctree_collapse (ctree, handle);
- OS.gtk_signal_handler_unblock_by_data (ctree, SWT.Collapse);
- }
-}
-
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((parent.style & SWT.CHECK) != 0) return;
- this.image = image;
- int pixmap = 0, mask = 0;
- if (image != null) {
- pixmap = image.pixmap;
- mask = image.mask;
- }
- int ctree = parent.handle;
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, null, null, null, null, is_leaf, expanded);
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap, mask, pixmap, mask, is_leaf [0], expanded [0]);
-}
-
-/**
- * This label will be displayed to the right of the bitmap,
- * or, if the receiver doesn't have a bitmap to the right of
- * the horizontal hierarchy connector line.
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- int ctree = parent.handle;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- byte [] spacing = new byte [1];
- boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
- int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
- OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
- OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap_closed [0], mask_closed [0], pixmap_opened [0], mask_opened [0], is_leaf [0], expanded [0]);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java
deleted file mode 100644
index 8f37202228..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-class Trim {
- int top=0, bottom=0, left=0, right=0;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java
deleted file mode 100644
index a956c281ed..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * This class contains static helpers wrapping some common
- * widget-inspecific operations like get the size of a gtk widget.
- */
-class UtilFuncs {
-
-/*
- * === GEOMETRY ===
- */
-
-static Point getLocation (int handle) {
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_x, widget.alloc_y);
-}
-
-static boolean setLocation(int parentHandle, int handle, int x, int y) {
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- boolean sameOrigin = (widget.alloc_x == x && widget.alloc_y == y);
-
- // GtkFixed does not leave us alone.
- // Instead, it maintains its own list of geometries for the children.
- // Moreover, it will post a RESIZE on the queue that will cause
- // disturbance to all our brother; to avoid that, we temporarily
- // clear the VISIBLE flag, and do the synchronous update ourselves
- GtkObject gtkChild = new GtkObject();
- OS.memmove (gtkChild, handle, GtkObject.sizeof);
- OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_VISIBLE);
- OS.gtk_fixed_move(parentHandle, handle, (short)x, (short)y );
- OS.memmove(handle, gtkChild, GtkObject.sizeof);
-
-
-// OS.gtk_widget_set_uposition(handle, (short)x, (short)y);
- /*
- byte[] aux_info_id = org.eclipse.swt.internal.Converter.wcsToMbcs (null, "gtk-aux-info", true);
- int aux_info_key_id = OS.g_quark_from_static_string(aux_info_id);
- if (aux_info_key_id == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
- int aux_info = OS.gtk_object_get_data_by_id(handle, aux_info_key_id);
- int[] xy = new int[1];
- // ???
- OS.memmove(aux_info, xy, 4);
- */
-
- // force allocation update NOW
- GtkAllocation alloc = new GtkAllocation();
- alloc.x = (short) x;
- alloc.y = (short) y;
- alloc.width = (short) widget.alloc_width;
- alloc.height = (short) widget.alloc_height;
- OS.memmove(handle, widget, GtkWidget.sizeof);
- OS.gtk_widget_size_allocate(handle, alloc);
-
- return (!sameOrigin);
-}
-
-static Point getSize (int handle) {
- if (handle==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- return new Point (widget.alloc_width, widget.alloc_height);
-}
-
-
-static boolean setSize(int handle, int width, int height) {
- if (handle==0) {
- SWT.error(SWT.ERROR_UNSPECIFIED);
- }
-
- /* Feature in Gtk.
- * Gtk will refuse to set the size of any widget to anything smaller than 3x3.
- */
- if (height <= 3) height = 3;
- if (width <= 3) width = 3;
-
- // first, see if we actually need to change anything
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- int alloc_width = widget.alloc_width & 0xFFFF;
- int alloc_height = widget.alloc_height & 0xFFFF;
- if (alloc_width == width && alloc_height == height) {
- return false;
- }
-
- OS.gtk_widget_set_usize (handle, width, height);
- // force child allocation update
- GtkAllocation alloc = new GtkAllocation();
- alloc.x = (short) widget.alloc_x;
- alloc.y = (short) widget.alloc_y;
- alloc.width = (short) width;
- alloc.height = (short) height;
- OS.gtk_widget_size_allocate(handle, alloc);
- return true;
-}
-
-static void setZeroSize(int handle) {
- // CHEATING. For some reason,
- // the it will refuse to change its size to anything smaller
- setSize(handle, 3,3);
-}
-
-static int getFont(int widget) {
- int hStyle = OS.gtk_widget_get_style(widget);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
- return style.font;
-}
-
-static void setFont(int handle, int font) {
- OS.gtk_widget_ensure_style(handle);
- // We can't just get the widget's style and set
- // its font, because the style slot may point to the
- // default font; therefore we have to obtain a clone
- // of the style
- GtkWidget widget = new GtkWidget ();
- OS.memmove (widget, handle, GtkWidget.sizeof);
- int hStyle = OS.gtk_style_copy(widget.style);
- GtkStyle style = new GtkStyle();
- OS.memmove(style, hStyle, GtkStyle.sizeof);
-
- OS.gdk_font_unref(style.font);
- style.font = font;
- OS.memmove (hStyle, style, GtkStyle.sizeof);
- OS.gtk_widget_set_style (handle, hStyle);
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java
deleted file mode 100644
index 7ee66f7080..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java
+++ /dev/null
@@ -1,921 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.events.*;
-
-/**
- * This class is the abstract superclass of all user interface objects.
- * Widgets are created, disposed and issue notification to listeners
- * when events occur which affect them.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Dispose</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation. However, it has not been marked
- * final to allow those outside of the SWT development team to implement
- * patched versions of the class in order to get around specific
- * limitations in advance of when those limitations can be addressed
- * by the team. Any class built using subclassing to access the internals
- * of this class will likely fail to compile or run between releases and
- * may be strongly platform specific. Subclassing should not be attempted
- * without an intimate and detailed understanding of the workings of the
- * hierarchy. No support is provided for user-written classes which are
- * implemented as subclasses of this class.
- * </p>
- *
- * @see #checkSubclass
- */
-
-public abstract class Widget {
-
- public int handle;
- int style, state;
- EventTable eventTable;
- Object data;
- String [] keys;
- Object [] values;
-
- /* Global state flags */
-// static final int AUTOMATIC = 1<<0;
-// static final int ACTIVE = 1<<1;
-// static final int AUTOGRAB = 1<<2;
-// static final int MULTIEXPOSE = 1<<3;
-// static final int RESIZEREDRAW = 1<<4;
-// static final int WRAP = 1<<5;
-// static final int DISABLED = 1<<6;
-// static final int HIDDEN = 1<<7;
-// static final int FOREGROUND = 1<<8;
-// static final int BACKGROUND = 1<<9;
- static final int DISPOSED = 1<<10;
- static final int HANDLE = 1<<11;
- static final int CANVAS = 1<<12;
-
- /* Default widths for widgets */
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
- static final char Mnemonic = '&';
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Widget () {}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see #checkSubclass
- * @see #getStyle
- */
-public Widget (Widget parent, int style) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- this.style = style;
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when an event of the given type occurs. When the
- * event does occur in the widget, the listener is notified by
- * sending it the <code>handleEvent()</code> message.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #removeListener
- */
-public void addListener (int eventType, Listener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new EventTable ();
- eventTable.hook (eventType, handler);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when the widget is disposed. When the widget is
- * disposed, the listener is notified by sending it the
- * <code>widgetDisposed()</code> message.
- *
- * @param listener the listener which should be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void addDisposeListener (DisposeListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Dispose, typedListener);
-}
-static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
- int mask = int0 | int1 | int2 | int3 | int4 | int5;
- if ((style & mask) == 0) style |= int0;
- if ((style & int0) != 0) style = (style & ~mask) | int0;
- if ((style & int1) != 0) style = (style & ~mask) | int1;
- if ((style & int2) != 0) style = (style & ~mask) | int2;
- if ((style & int3) != 0) style = (style & ~mask) | int3;
- if ((style & int4) != 0) style = (style & ~mask) | int4;
- if ((style & int5) != 0) style = (style & ~mask) | int5;
- return style;
-}
-
-/**
- * Checks that this class can be subclassed.
- * <p>
- * The SWT class library is intended to be subclassed
- * only at specific, controlled points (most notably,
- * <code>Composite</code> and <code>Canvas</code> when
- * implementing new widgets). This method enforces this
- * rule unless it is overridden.
- * </p><p>
- * <em>IMPORTANT:</em> By providing an implementation of this
- * method that allows a subclass of a class which does not
- * normally allow subclassing to be created, the implementer
- * agrees to be fully responsible for the fact that any such
- * subclass will likely fail between SWT releases and will be
- * strongly platform specific. No support is provided for
- * user-written classes which are implemented in this fashion.
- * </p><p>
- * The ability to subclass outside of the allowed SWT classes,
- * is intended purely to enable those not on the SWT development
- * team to implement patches in order to get around specific
- * limitations in advance of when those limitations can be
- * addressed by the team. Subclassing should not be attempted
- * without an intimate and detailed understanding of the hierarchy.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Throws an <code>SWTException</code> if the receiver can not
- * be accessed by the caller. This may include both checks on
- * the state of the receiver and more generally on the entire
- * execution context. This method <em>should</em> be called by
- * widget implementors to enforce the standard SWT invariants.
- * <p>
- * Currently, it is an error to invoke any method (other than
- * <code>isDisposed()</code>) on a widget that has had its
- * <code>dispose()</code> method called. It is also an error
- * to call widget methods from any thread that is different
- * from the thread that created the widget.
- * </p><p>
- * In future releases of SWT, there may be more or fewer error
- * checks and exceptions may be thrown for different reasons.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-
-/*
- * HANDLE CODE
- *
- * HANDLE CODE 1: HANDLE CREATION CODE - The createWidget() cycle.
- */
-
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- configure ();
- setHandleStyle ();
- register ();
- setInitialSize ();
- showHandle ();
-}
-
-void register () {
- if (handle == 0) return;
- if ((state & HANDLE) != 0) WidgetTable.put (handle, this);
-}
-
-void createHandle (int index) {}
-void configure () {}
-void setHandleStyle () {}
-void setInitialSize () {}
-void hookEvents () {}
-void showHandle () {}
-int paintHandle () { return 0; }
-
-/* HANDLE CODE 3:
- * Handle Destruction
- */
-
-void deregister () {
- if (handle == 0) return;
- if ((state & HANDLE) != 0) WidgetTable.remove (handle);
-}
-void destroyWidget () {
- int topHandle = topHandle ();
- releaseHandle ();
- if (topHandle != 0 && (state & HANDLE) != 0) {
- OS.gtk_widget_destroy (topHandle);
- }
-}
-/**
- * Disposes of the operating system resources associated with
- * the receiver and all its descendents. After this method has
- * been invoked, the receiver and all descendents will answer
- * <code>true</code> when sent the message <code>isDisposed()</code>.
- * Any internal connections between the widgets in the tree will
- * have been removed to facilitate garbage collection.
- * <p>
- * NOTE: This method is not called recursively on the descendents
- * of the receiver. This means that, widget implementers can not
- * detect when a widget is being disposed of by re-implementing
- * this method, but should instead listen for the <code>Dispose</code>
- * event.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #addDisposeListener
- * @see #removeDisposeListener
- * @see #checkWidget
- */
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed()) return;
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- releaseChild ();
- releaseWidget ();
- destroyWidget ();
-}
-
-void error (int code) {
- throw new SWTError (code);
-}
-
-
-
-/**
- * Returns the application defined widget data associated
- * with the receiver, or null if it has not been set. The
- * <em>widget data</em> is a single, unnamed field that is
- * stored with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @return the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return data;
-}
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData (String key) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-/**
- * Returns the <code>Display</code> that is associated with
- * the receiver.
- * <p>
- * A widget's display is either provided when it is created
- * (for example, top level <code>Shell</code>s) or is the
- * same as its parent's display.
- * </p>
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public abstract Display getDisplay ();
-String getName () {
-// String string = getClass ().getName ();
-// int index = string.lastIndexOf ('.');
-// if (index == -1) return string;
- String string = getClass ().getName ();
- int index = string.length ();
- while ((--index > 0) && (string.charAt (index) != '.'));
- return string.substring (index + 1, string.length ());
-}
-String getNameText () {
- return "";
-}
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created. This can occur when the underlying
- * operating system does not support a particular combination of
- * requested styles. For example, if the platform widget used to
- * implement a particular SWT widget always has scroll bars, the
- * result of calling this method would always have the
- * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return style;
-}
-
-/**
- * Returns <code>true</code> if the widget has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the widget.
- * When a widget has been disposed, it is an error to
- * invoke any other method using the widget.
- * </p>
- *
- * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- if (handle != 0) return false;
- if ((state & HANDLE) != 0) return true;
- return (state & DISPOSED) != 0;
-}
-
-/**
- * Returns <code>true</code> if there are any listeners
- * for the specified event type associated with the receiver,
- * and <code>false</code> otherwise.
- *
- * @param eventType the type of event
- * @return true if the event is hooked
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected boolean isListening (int eventType) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return hooks (eventType);
-}
-
-
-/*
- * Returns <code>true</code> if the specified eventType is
- * hooked, and <code>false</code> otherwise. Implementations
- * of SWT can avoid creating objects and sending events
- * when an event happens in the operating system but
- * there are no listeners hooked for the event.
- *
- * @param eventType the event to be checked
- *
- * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
- *
- * @see #isListening
- */
-boolean hooks (int eventType) {
- if (eventTable == null) return false;
- return eventTable.hooks (eventType);
-}
-
-boolean isValidThread () {
- return getDisplay ().isValidThread ();
-}
-public boolean isValidWidget () {
- if (handle != 0) return true;
- if ((state & HANDLE) != 0) return false;
- return (state & DISPOSED) == 0;
-}
-
-boolean isValidSubclass() {
- return Display.isValidClass(getClass());
-}
-
-char mbcsToWcs (char ch) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return ch;
- byte [] buffer;
- if (key <= 0xFF) {
- buffer = new byte [1];
- buffer [0] = (byte) key;
- } else {
- buffer = new byte [2];
- buffer [0] = (byte) ((key >> 8) & 0xFF);
- buffer [1] = (byte) (key & 0xFF);
- }
- char [] result = Converter.mbcsToWcs (null, buffer);
- if (result.length == 0) return 0;
- return result [0];
-}
-/**
- * Notifies all of the receiver's listeners for events
- * of the given type that one such event has occurred by
- * invoking their <code>handleEvent()</code> method.
- *
- * @param eventType the type of event which has occurred
- * @param event the event data
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- eventTable.sendEvent (event);
-}
-void postEvent (int eventType) {
- if (eventTable == null) return;
- postEvent (eventType, new Event ());
-}
-void postEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- getDisplay ().postEvent (event);
-}
-
-int processEvent (int eventNumber, int int0, int int1, int int2) {
- switch (eventNumber) {
- case SWT.Arm: return processArm (int0, int1, int2);
- case SWT.Collapse: return processCollapse (int0, int1, int2);
- case SWT.Expand: return processExpand (int0, int1, int2);
- case SWT.Dispose: return processDispose (int0, int1, int2);
- case SWT.DefaultSelection: return processDoubleSelection (int0, int1, int2);
- case SWT.FocusIn: return processFocusIn (int0, int1, int2);
- case SWT.FocusOut: return processFocusOut (int0, int1, int2);
- case SWT.Help: return processHelp (int0, int1, int2);
- case SWT.Hide: return processHide (int0, int1, int2);
- case SWT.KeyDown: return processKeyDown (int0, int1, int2);
- case SWT.KeyUp: return processKeyUp (int0, int1, int2);
- case SWT.Iconify: return processIconify (int0, int1, int2);
- case SWT.Deiconify: return processDeiconify (int0, int1, int2);
- case SWT.Modify: return processModify (int0, int1, int2);
- case SWT.MouseDown: return processMouseDown (int0, int1, int2);
- case SWT.MouseEnter: return processMouseEnter (int0, int1, int2);
- case SWT.MouseExit: return processMouseExit (int0, int1, int2);
- case SWT.MouseHover: return processMouseHover (int0, int1, int2);
- case SWT.MouseMove: return processMouseMove (int0, int1, int2);
- case SWT.MouseUp: return processMouseUp (int0, int1, int2);
- case SWT.Paint: return processPaint (int0, int1, int2);
- case SWT.Resize: return processResize (int0, int1, int2);
- case SWT.Show: return processShow (int0, int1, int2);
- case SWT.Selection: return processSelection (int0, int1, int2);
- case SWT.Verify: return processVerify (int0, int1, int2);
- }
- return 0;
-}
-
-int processArm (int int0, int int1, int int2) {
- return 0;
-}
-
-/*
- * Item expand/collapse in a tree.
- */
-int processCollapse (int int0, int int1, int int2) {
- return 1; // stop emission
-}
-int processExpand (int int0, int int1, int int2) {
- return 1; // stop emission
-}
-
-/*
- * Close a Shell, triggered by delete_event
- */
-int processDispose (int arg0, int arg1, int int2) {
- return 1;
-}
-
-/*
- * The WM has Iconified/Deiconified a Shell.
- * The Gtk event is map_event/unmap_event
- */
-int processIconify (int int0, int int1, int int2) {
- return 0;
-}
-int processDeiconify (int int0, int int1, int int2) {
- return 0;
-}
-
-int processHelp (int int0, int int1, int int2) {
- return 0;
-}
-int processHide (int int0, int int1, int int2) {
- return 0;
-}
-int processFocusIn(int int0, int int1, int int2) {
- return 0;
-}
-int processFocusOut(int int0, int int1, int int2) {
- return 0;
-}
-int processKeyDown (int arg0, int arg1, int int2) {
- return 0;
-}
-int processKeyUp (int arg0, int arg1, int int2) {
- return 0;
-}
-int processModify (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseDown (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseEnter (int arg0, int arg1, int int2) {
- return 0;
-}
-int processMouseExit (int arg0, int arg1, int int2) {
- /* Do nothing */
- return 0;
-}
-int processMouseHover (int arg0, int arg1, int int2) {
- /* Do nothing */
- return 0;
-}
-int processMouseMove (int arg0, int arg1, int int2) {
- /* Do nothing */
- /* Even though we do nothing, we still need to at least
- * motify the X Server we are ready to process more events.
- * However, only OS controls can receive this event.
- */
- return 0;
-}
-
-int processMouseUp (int arg0, int arg1, int int2) {
- return 0;
-}
-int processPaint (int int0, int int1, int int2) {
- return 0;
-}
-int processResize (int int0, int int1, int int2) {
- return 0;
-}
-int processSelection (int int0, int int1, int int2) {
- return 0;
-}
-int processShow (int int0, int int1, int int2) {
- return 0;
-}
-int processDoubleSelection (int int0, int int1, int int2) {
- return 0;
-}
-int processVerify (int int0, int int1, int int2) {
- sendEvent (SWT.Verify);
- return 0;
-}
-
-void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
- byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
- int proc=0;
- switch (numArgs) {
- case 2: proc=getDisplay().windowProc2; break;
- case 3: proc=getDisplay().windowProc3; break;
- case 4: proc=getDisplay().windowProc4; break;
- case 5: proc=getDisplay().windowProc5; break;
- default: error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
-}
-void signal_connect_after (int handle, String eventName, int swtEvent, int numArgs) {
- byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
- int proc=0;
- switch (numArgs) {
- case 2: proc=getDisplay().windowProc2; break;
- case 3: proc=getDisplay().windowProc3; break;
- case 4: proc=getDisplay().windowProc4; break;
- case 5: proc=getDisplay().windowProc5; break;
- default: error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.gtk_signal_connect_after (handle, buffer, proc, swtEvent);
-}
-
-void releaseChild () {
- /* Do nothing */
-}
-void releaseHandle () {
- handle = 0;
- state |= DISPOSED;
-}
-void releaseWidget () {
- sendEvent (SWT.Dispose);
- deregister ();
- eventTable = null;
- data = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-public void removeListener (int eventType, Listener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
-* Warning: API under construction.
-*/
-protected void removeListener (int eventType, SWTEventListener handler) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when the widget is disposed.
- *
- * @param listener the listener which should no longer be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void removeDisposeListener (DisposeListener listener) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Dispose, listener);
-}
-void sendEvent (int eventType) {
- if (eventTable == null) return;
- sendEvent (eventType, new Event ());
-}
-void sendEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.widget = this;
- event.type = eventType;
- eventTable.sendEvent (event);
-}
-/**
- * Sets the application defined widget data associated
- * with the receiver to be the argument. The <em>widget
- * data</em> is a single, unnamed field that is stored
- * with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @param data the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- */
-public void setData (Object data) {
- checkWidget();
- this.data = data;
-}
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given value.
- * <p>
- * Applications may associate arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getData
- */
-public void setData (String key, Object value) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- String string = "*Disposed*";
- if (!isDisposed ()) {
- string = "*Wrong Thread*";
- if (isValidThread ()) string = getNameText ();
- }
- return getName () + " {" + string + "}";
-}
-int topHandle () {
- return handle;
-}
-char wcsToMbcs (char ch) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return ch;
- byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false);
- if (buffer.length == 1) return (char) buffer [0];
- if (buffer.length == 2) {
- return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
- }
- return 0;
-}
-
-byte[] string2bytesConvertMnemonic(String string) {
- //FIXME need to double _'s
- char [] t = new char [string.length ()];
- string.getChars (0, t.length, t, 0);
- for (int i=0; i<t.length; i++) {if (t [i] == '&') t [i] = '_';}
- return Converter.wcsToMbcs (null, t, true);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java
deleted file mode 100644
index df5065116a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-class WidgetTable {
- static int FreeSlot = 0;
- static int GrowSize = 1024;
- static int [] IndexTable = new int [GrowSize];
- static Widget [] WidgetTable = new Widget [GrowSize];
- static {
- for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
- IndexTable [GrowSize - 1] = -1;
- }
-
-public static synchronized Widget get (int handle) {
- if (handle == 0) return null;
- int index = OS.gtk_object_get_user_data (handle) - 1;
- if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
- return null;
-}
-
-public synchronized static void put(int handle, Widget widget) {
- if (handle == 0) return;
- if (FreeSlot == -1) {
- int length = (FreeSlot = IndexTable.length) + GrowSize;
- int[] newIndexTable = new int[length];
- Widget[] newWidgetTable = new Widget [length];
- System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
- System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
- for (int i = FreeSlot; i < length - 1; i++) {
- newIndexTable[i] = i + 1;
- }
- newIndexTable[length - 1] = -1;
- IndexTable = newIndexTable;
- WidgetTable = newWidgetTable;
- }
- int index = FreeSlot + 1;
- OS.gtk_object_set_user_data (handle, index);
- int oldSlot = FreeSlot;
- FreeSlot = IndexTable[oldSlot];
- IndexTable [oldSlot] = -2;
- WidgetTable [oldSlot] = widget;
-}
-
-public static synchronized Widget remove (int handle) {
- if (handle == 0) return null;
- Widget widget = null;
- int index = OS.gtk_object_get_user_data (handle) - 1;
- if (0 <= index && index < WidgetTable.length) {
- widget = WidgetTable [index];
- WidgetTable [index] = null;
- IndexTable [index] = FreeSlot;
- FreeSlot = index;
- OS.gtk_object_set_user_data (handle, 0);
- }
- return widget;
-}
-
-public static synchronized Shell [] shells () {
- int length = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) length++;
- }
- int index = 0;
- Shell [] result = new Shell [length];
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) {
- result [index++] = (Shell) widget;
- }
- }
- return result;
-}
-
-public static synchronized int size () {
- int size = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- if (WidgetTable [i] != null) size++;
- }
- return size;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Color.java
deleted file mode 100755
index c8edd74f01..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Color.java
+++ /dev/null
@@ -1,332 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage the operating system resources that
- * implement SWT's RGB color model. To create a color you can either
- * specify the individual color components as integers in the range
- * 0 to 255 or provide an instance of an <code>RGB</code>.
- * <p>
- * Application code must explicitly invoke the <code>Color.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see RGB
- */
-public final class Color {
- /**
- * the handle to the OS color resource
- * (Warning: This field is platform dependent)
- */
- public XColor handle;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
-Color() {
-}
-/**
- * Constructs a new instance of this class given a device and the
- * desired red, green and blue values expressed as ints in the range
- * 0 to 255 (where 0 is black and 255 is full brightness). On limited
- * color devices, the color instance created by this call may not have
- * the same RGB values as the ones specified by the arguments. The
- * RGB values on the returned instance will be the color values of
- * the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, int red, int green, int blue) {
- init(device, red, green, blue);
-}
-/**
- * Constructs a new instance of this class given a device and an
- * <code>RGB</code> describing the desired red, green and blue values.
- * On limited color devices, the color instance created by this call
- * may not have the same RGB values as the ones specified by the
- * argument. The RGB values on the returned instance will be the color
- * values of the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param RGB the RGB values of the desired color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
- * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, RGB rgb) {
- if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, rgb.red, rgb.green, rgb.blue);
-}
-/**
- * Disposes of the operating system resources associated with
- * the color. Applications must dispose of all colors which
- * they allocate.
- */
-public void dispose() {
- if (handle == null) return;
- if (device.isDisposed()) return;
- int xDisplay = device.xDisplay;
- int pixel = handle.pixel;
- if (device.colorRefCount != null) {
- /* If this was the last reference, remove the color from the list */
- if (--device.colorRefCount[pixel] == 0) {
- device.xcolors[pixel] = null;
- }
- }
- int colormap = OS.XDefaultColormap(xDisplay, OS.XDefaultScreen(xDisplay));
- OS.XFreeColors(xDisplay, colormap, new int[] { pixel }, 1, 0);
- device = null;
- handle = null;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Color)) return false;
- Color color = (Color)object;
- XColor xColor = color.handle;
- if (handle == xColor) return true;
- return device == color.device && handle.red == xColor.red &&
- handle.green == xColor.green && handle.blue == xColor.blue;
-}
-/**
- * Returns the amount of blue in the color, from 0 to 255.
- *
- * @return the blue component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getBlue () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle.blue >> 8) & 0xFF;
-}
-/**
- * Returns the amount of green in the color, from 0 to 255.
- *
- * @return the green component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getGreen () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle.green >> 8) & 0xFF;
-}
-/**
- * Returns the amount of red in the color, from 0 to 255.
- *
- * @return the red component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getRed () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle.red >> 8) & 0xFF;
-}
-/**
- * Returns an <code>RGB</code> representing the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public RGB getRGB () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return new RGB((handle.red >> 8) & 0xFF, (handle.green >> 8) & 0xFF, (handle.blue >> 8) & 0xFF);
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- if (isDisposed()) return 0;
- return handle.red ^ handle.green ^ handle.blue;
-}
-void init(Device device, int red, int green, int blue) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if ((red > 255) || (red < 0) ||
- (green > 255) || (green < 0) ||
- (blue > 255) || (blue < 0)) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- XColor xColor = new XColor();
- xColor.red = (short)((red & 0xFF) | ((red & 0xFF) << 8));
- xColor.green = (short)((green & 0xFF) | ((green & 0xFF) << 8));
- xColor.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8));
- handle = xColor;
- int xDisplay = device.xDisplay;
- int screen = OS.XDefaultScreen(xDisplay);
- int colormap = OS.XDefaultColormap(xDisplay, screen);
- /* 1. Try to allocate the color */
- if (OS.XAllocColor(xDisplay, colormap, xColor) != 0) {
- if (device.colorRefCount != null) {
- /* Make a copy of the color to put in the colors array */
- XColor colorCopy = new XColor();
- colorCopy.red = xColor.red;
- colorCopy.green = xColor.green;
- colorCopy.blue = xColor.blue;
- colorCopy.pixel = xColor.pixel;
- device.xcolors[colorCopy.pixel] = colorCopy;
- device.colorRefCount[xColor.pixel]++;
- }
- return;
- }
- /**
- * 2. Allocation failed. Query the entire colormap and
- * find the closest match which can be allocated.
- * This should never occur on a truecolor display.
- */
- Visual visual = new Visual();
- OS.memmove(visual, OS.XDefaultVisual(xDisplay, screen), Visual.sizeof);
- int mapEntries = visual.map_entries;
- XColor[] queried = new XColor[mapEntries];
- int[] distances = new int[mapEntries];
- /**
- * Query all colors in the colormap and calculate the distance
- * from each to the desired color.
- */
- for (int i = 0; i < mapEntries; i++) {
- XColor color = new XColor();
- color.pixel = i;
- queried[i] = color;
- OS.XQueryColor(xDisplay, colormap, color);
- int r = red - ((color.red >> 8) & 0xFF);
- int g = green - ((color.green >> 8) & 0xFF);
- int b = blue - ((color.blue >> 8) & 0xFF);
- distances[i] = r*r + g*g + b*b;
- }
- /**
- * Try to allocate closest matching queried color.
- * The allocation can fail if the closest matching
- * color is allocated privately, so go through them
- * in order of increasing distance.
- */
- for (int i = 0; i < mapEntries; i++) {
- int minDist = 0x30000;
- int minIndex = 0;
- for (int j = 0; j < mapEntries; j++) {
- if (distances[j] < minDist) {
- minDist = distances[j];
- minIndex = j;
- }
- }
- XColor queriedColor = queried[minIndex];
- XColor osColor = new XColor();
- osColor.red = queriedColor.red;
- osColor.green = queriedColor.green;
- osColor.blue = queriedColor.blue;
- if (OS.XAllocColor(xDisplay, colormap, osColor) != 0) {
- /* Allocation succeeded. Copy the fields into the handle */
- xColor.red = osColor.red;
- xColor.green = osColor.green;
- xColor.blue = osColor.blue;
- xColor.pixel = osColor.pixel;
- if (device.colorRefCount != null) {
- /* Put osColor in the colors array */
- device.xcolors[osColor.pixel] = osColor;
- device.colorRefCount[osColor.pixel]++;
- }
- return;
- }
- /* The allocation failed; matching color is allocated privately */
- distances[minIndex] = 0x30000;
- }
- /**
- * 3. Couldn't allocate any of the colors in the colormap.
- * This means all colormap entries were allocated privately
- * by other applications. Give up and allocate black.
- */
- XColor osColor = new XColor();
- OS.XAllocColor(xDisplay, colormap, osColor);
- /* Copy the fields into the handle */
- xColor.red = osColor.red;
- xColor.green = osColor.green;
- xColor.blue = osColor.blue;
- xColor.pixel = osColor.pixel;
- if (device.colorRefCount != null) {
- /* Put osColor in the colors array */
- device.xcolors[osColor.pixel] = osColor;
- device.colorRefCount[osColor.pixel]++;
- }
-}
-/**
- * Returns <code>true</code> if the color has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the color.
- * When a color has been disposed, it is an error to
- * invoke any other method using the color.
- *
- * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == null;
-}
-public static Color motif_new(Device device, XColor xColor) {
- if (device == null) device = Device.getDevice();
- Color color = new Color();
- color.handle = xColor;
- color.device = device;
- return color;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Color {*DISPOSED*}";
- return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Cursor.java
deleted file mode 100755
index 5792deab48..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Cursor.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * specify the appearance of the on-screen pointer. To create a
- * cursor you specify the device and either a simple cursor style
- * describing one of the standard operating system provided cursors
- * or the image and mask data for the desired appearance.
- * <p>
- * Application code must explicitly invoke the <code>Cursor.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>
- * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
- * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
- * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
- * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
- * </dd>
- * </dl>
- */
-public final class Cursor {
- /**
- * the handle to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
-Cursor () {
-}
-/**
- * Constructs a new cursor given a device and a style
- * constant describing the desired cursor appearance.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param style the style of cursor to allocate
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
- * </ul>
- *
- * @see Cursor for the supported style values
- */
-public Cursor (Device device, int style) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- int shape = 0;
- switch (style) {
- case SWT.CURSOR_ARROW: shape = OS.XC_left_ptr; break;
- case SWT.CURSOR_WAIT: shape = OS.XC_watch; break;
- case SWT.CURSOR_HAND: shape = OS.XC_hand2; break;
- case SWT.CURSOR_CROSS: shape = OS.XC_cross; break;
- case SWT.CURSOR_APPSTARTING: shape = OS.XC_watch; break;
- case SWT.CURSOR_HELP: shape = OS.XC_question_arrow; break;
- case SWT.CURSOR_SIZEALL: shape = OS.XC_diamond_cross; break;
- case SWT.CURSOR_SIZENESW: shape = OS.XC_sizing; break;
- case SWT.CURSOR_SIZENS: shape = OS.XC_double_arrow; break;
- case SWT.CURSOR_SIZENWSE: shape = OS.XC_sizing; break;
- case SWT.CURSOR_SIZEWE: shape = OS.XC_sb_h_double_arrow; break;
- case SWT.CURSOR_SIZEN: shape = OS.XC_top_side; break;
- case SWT.CURSOR_SIZES: shape = OS.XC_bottom_side; break;
- case SWT.CURSOR_SIZEE: shape = OS.XC_right_side; break;
- case SWT.CURSOR_SIZEW: shape = OS.XC_left_side; break;
- case SWT.CURSOR_SIZENE: shape = OS.XC_top_right_corner; break;
- case SWT.CURSOR_SIZESE: shape = OS.XC_bottom_right_corner; break;
- case SWT.CURSOR_SIZESW: shape = OS.XC_bottom_left_corner; break;
- case SWT.CURSOR_SIZENW: shape = OS.XC_top_left_corner; break;
- case SWT.CURSOR_UPARROW: shape = OS.XC_sb_up_arrow; break;
- case SWT.CURSOR_IBEAM: shape = OS.XC_xterm; break;
- case SWT.CURSOR_NO: shape = OS.XC_X_cursor; break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.handle = OS.XCreateFontCursor(device.xDisplay, shape);
-}
-/**
- * Constructs a new cursor given a device, image and mask
- * data describing the desired cursor appearance, and the x
- * and y co-ordinates of the <em>hotspot</em> (that is, the point
- * within the area covered by the cursor which is considered
- * to be where the on-screen pointer is "pointing").
- * <p>
- * The mask data is allowed to be null, but in this case the source
- * must be an ImageData representing an icon that specifies both
- * color data and mask data.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param source the color data for the cursor
- * @param mask the mask data for the cursor (or null)
- * @param hotspotX the x coordinate of the cursor's hotspot
- * @param hotspotY the y coordinate of the cursor's hotspot
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
- * size, or either is not of depth one, or if the hotspot is outside
- * the bounds of the image</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
- * </ul>
- */
-public Cursor (Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) {
- if (source.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- mask = source.getTransparencyMask();
- }
- /* Check the bounds. Mask must be the same size as source */
- if (mask.width != source.width || mask.height != source.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Check depths */
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (source.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- /* Check the hotspots */
- if (hotspotX >= source.width || hotspotX < 0 ||
- hotspotY >= source.height || hotspotY < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Swap the bits if necessary */
- byte[] sourceData = new byte[source.data.length];
- byte[] maskData = new byte[mask.data.length];
- /* Swap the bits in each byte */
- byte[] data = source.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- sourceData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- sourceData[i] = (byte) ~sourceData[i];
- }
- data = mask.data;
- for (int i = 0; i < data.length; i++) {
- byte s = data[i];
- maskData[i] = (byte)(((s & 0x80) >> 7) |
- ((s & 0x40) >> 5) |
- ((s & 0x20) >> 3) |
- ((s & 0x10) >> 1) |
- ((s & 0x08) << 1) |
- ((s & 0x04) << 3) |
- ((s & 0x02) << 5) |
- ((s & 0x01) << 7));
- maskData[i] = (byte) ~maskData[i];
- }
- int xDisplay = device.xDisplay;
- int drawable = OS.XDefaultRootWindow(xDisplay);
- int sourcePixmap = OS.XCreateBitmapFromData(xDisplay, drawable, sourceData, source.width, source.height);
- int maskPixmap = OS.XCreateBitmapFromData(xDisplay, drawable, maskData, source.width, source.height);
- /* Get the colors */
- int screenNum = OS.XDefaultScreen(xDisplay);
- XColor foreground = new XColor();
- foreground.pixel = OS.XBlackPixel(xDisplay, screenNum);
- foreground.red = foreground.green = foreground.blue = 0;
- XColor background = new XColor();
- background.pixel = OS.XWhitePixel(xDisplay, screenNum);
- background.red = background.green = background.blue = (short)0xFFFF;
- /* Create the cursor */
- handle = OS.XCreatePixmapCursor(xDisplay, maskPixmap, sourcePixmap, foreground, background, hotspotX, hotspotY);
- /* Dispose the pixmaps */
- OS.XFreePixmap(xDisplay, sourcePixmap);
- OS.XFreePixmap(xDisplay, maskPixmap);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-}
-/**
- * Disposes of the operating system resources associated with
- * the cursor. Applications must dispose of all cursors which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- if (device.isDisposed()) return;
- OS.XFreeCursor(device.xDisplay, handle);
- device = null;
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Cursor)) return false;
- Cursor cursor = (Cursor)object;
- return device == cursor.device && handle == cursor.handle;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-/**
- * Returns <code>true</code> if the cursor has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the cursor.
- * When a cursor has been disposed, it is an error to
- * invoke any other method using the cursor.
- *
- * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-public static Cursor motif_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Cursor cursor = new Cursor();
- cursor.device = device;
- cursor.handle = handle;
- return cursor;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return "Cursor {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
deleted file mode 100755
index 82d8ba4e6a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
+++ /dev/null
@@ -1,691 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-public abstract class Device implements Drawable {
- /**
- * the handle to the X Display
- * (Warning: This field is platform dependent)
- */
- public int xDisplay;
-
- /* Arguments for XtOpenDisplay */
- String display_name;
- String application_name;
- String application_class;
-
- /* Debugging */
- public static boolean DEBUG;
- boolean debug = DEBUG;
- public boolean tracking = DEBUG;
- Error [] errors;
- Object [] objects;
-
- /* Colormap and reference count for this display */
- XColor [] xcolors;
- int [] colorRefCount;
-
- /* System Colors */
- Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE;
- Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED;
- Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE;
-
- /* System Font */
- int systemFont;
- String characterSetName;
- String characterSetRegistry;
-
- /* Warning and Error Handlers */
- boolean warnings = true;
- Callback xErrorCallback, xtWarningCallback, xIOErrorCallback, xtErrorCallback;
- int xErrorProc, xtWarningProc, xIOErrorProc, xtErrorProc;
- int xNullErrorProc, xtNullWarningProc, xNullIOErrorProc, xtNullErrorProc;
-
- /* Parsing Tables */
- int tabMapping, crMapping, tabPointer, crPointer;
-
- /*
- * TEMPORARY CODE. When a graphics object is
- * created and the device parameter is null,
- * the current Display is used. This presents
- * a problem because SWT graphics does not
- * reference classes in SWT widgets. The correct
- * fix is to remove this feature. Unfortunately,
- * too many application programs rely on this
- * feature.
- *
- * This code will be removed in the future.
- */
- protected static Device CurrentDevice;
- protected static Runnable DeviceFinder;
- static {
- try {
- Class.forName ("org.eclipse.swt.widgets.Display");
- } catch (Throwable e) {}
- }
-
-/*
-* TEMPORARY CODE
-*/
-static Device getDevice () {
- if (DeviceFinder != null) DeviceFinder.run();
- Device device = CurrentDevice;
- CurrentDevice = null;
- return device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * You must dispose the device when it is no longer required.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #create
- * @see #init
- * @see DeviceData
- */
-public Device(DeviceData data) {
- if (data != null) {
- display_name = data.display_name;
- application_name = data.application_name;
- application_class = data.application_class;
- tracking = data.tracking;
- debug = data.debug;
- }
- create (data);
- init ();
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
- }
-
- /* Initialize the system font slot */
- Font font = getSystemFont ();
- FontData fd = font.getFontData ()[0];
- systemFont = font.handle;
- characterSetName = fd.characterSetName;
- characterSetRegistry = fd.characterSetRegistry;
-}
-
-protected void checkDevice () {
- if (xDisplay == 0) SWT.error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-protected void create (DeviceData data) {
-}
-
-protected void destroy () {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver. After this method has been invoked, the receiver
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- *
- * @see #release
- * @see #destroy
- * @see #checkDevice
- */
-public void dispose () {
- if (isDisposed()) return;
- checkDevice ();
- release ();
- destroy ();
- xDisplay = 0;
- if (tracking) {
- objects = null;
- errors = null;
- }
-}
-
-void dispose_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == object) {
- objects [i] = null;
- errors [i] = null;
- return;
- }
- }
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- int screen = OS.XDefaultScreen (xDisplay);
- int width = OS.XDisplayWidth (xDisplay, screen);
- int height = OS.XDisplayHeight (xDisplay, screen);
- return new Rectangle (0, 0, width, height);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- */
-public Rectangle getClientArea () {
- return getBounds ();
-}
-
-/**
- * Returns the bit depth of the screen, which is the number of
- * bits it takes to represent the number of unique colors that
- * the screen is currently capable of displaying. This number
- * will typically be one of 1, 8, 15, 16, 24 or 32.
- *
- * @return the depth of the screen
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getDepth () {
- checkDevice ();
- int xScreenPtr = OS.XDefaultScreenOfDisplay (xDisplay);
- return OS.XDefaultDepthOfScreen (xScreenPtr);
-}
-
-/**
- * Returns a <code>DeviceData</code> based on the receiver.
- * Modifications made to this <code>DeviceData</code> will not
- * affect the receiver.
- *
- * @return a <code>DeviceData</code> containing the device's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see DeviceData
- */
-public DeviceData getDeviceData () {
- checkDevice ();
- DeviceData data = new DeviceData ();
- data.display_name = display_name;
- data.application_name = application_name;
- data.application_class = application_class;
- data.debug = debug;
- data.tracking = tracking;
- int count = 0, length = 0;
- if (tracking) length = objects.length;
- for (int i=0; i<length; i++) {
- if (objects [i] != null) count++;
- }
- int index = 0;
- data.objects = new Object [count];
- data.errors = new Error [count];
- for (int i=0; i<length; i++) {
- if (objects [i] != null) {
- data.objects [index] = objects [i];
- data.errors [index] = errors [i];
- index++;
- }
- }
- return data;
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- int xScreenNum = OS.XDefaultScreen (xDisplay);
- int width = OS.XDisplayWidth (xDisplay, xScreenNum);
- int height = OS.XDisplayHeight (xDisplay, xScreenNum);
- int mmX = OS.XDisplayWidthMM (xDisplay, xScreenNum);
- int mmY = OS.XDisplayHeightMM (xDisplay, xScreenNum);
- /* 0.03937 mm/inch */
- double inchesX = mmX * 0.03937;
- double inchesY = mmY * 0.03937;
- int x = (int)((width / inchesX) + 0.5);
- int y = (int)((height / inchesY) + 0.5);
- return new Point (x, y);
-}
-
-/**
- * Returns <code>FontData</code> objects which describe
- * the fonts which match the given arguments. If the
- * <code>faceName</code> is null, all fonts will be returned.
- *
- * @param faceName the name of the font to look for, or null
- * @param scalable true if scalable fonts should be returned.
- * @return the matching font data
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData [] getFontList (String faceName, boolean scalable) {
- checkDevice ();
- String xlfd;
- if (faceName == null) {
- xlfd = "-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
- } else {
- int dashIndex = faceName.indexOf('-');
- if (dashIndex < 0) {
- xlfd = "-*-" + faceName + "-*-*-*-*-*-*-*-*-*-*-*-*";
- } else {
- xlfd = "-" + faceName + "-*-*-*-*-*-*-*-*-*-*-*-*";
- }
- }
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, xlfd, true);
- int [] ret = new int [1];
- int listPtr = OS.XListFonts (xDisplay, buffer1, 65535, ret);
- int ptr = listPtr;
- int [] intBuf = new int [1];
- FontData [] fd = new FontData [ret [0]];
- int fdIndex = 0;
- for (int i = 0; i < ret [0]; i++) {
- OS.memmove (intBuf, ptr, 4);
- int charPtr = intBuf [0];
- int length = OS.strlen (charPtr);
- byte [] buffer2 = new byte [length];
- OS.memmove (buffer2, charPtr, length);
- /* Use the character encoding for the default locale */
- char [] chars = Converter.mbcsToWcs (null, buffer2);
- FontData data = FontData.motif_new (new String (chars));
- boolean isScalable = data.averageWidth == 0 && data.pixels == 0 && data.points == 0;
- if (isScalable == scalable) {
- fd [fdIndex++] = data;
- }
- ptr += 4;
- }
- OS.XFreeFontNames (listPtr);
- if (fdIndex == ret [0]) return fd;
- FontData [] result = new FontData [fdIndex];
- System.arraycopy (fd, 0, result, 0, fdIndex);
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- XColor xColor = null;
- switch (id) {
- case SWT.COLOR_BLACK: return COLOR_BLACK;
- case SWT.COLOR_DARK_RED: return COLOR_DARK_RED;
- case SWT.COLOR_DARK_GREEN: return COLOR_DARK_GREEN;
- case SWT.COLOR_DARK_YELLOW: return COLOR_DARK_YELLOW;
- case SWT.COLOR_DARK_BLUE: return COLOR_DARK_BLUE;
- case SWT.COLOR_DARK_MAGENTA: return COLOR_DARK_MAGENTA;
- case SWT.COLOR_DARK_CYAN: return COLOR_DARK_CYAN;
- case SWT.COLOR_GRAY: return COLOR_GRAY;
- case SWT.COLOR_DARK_GRAY: return COLOR_DARK_GRAY;
- case SWT.COLOR_RED: return COLOR_RED;
- case SWT.COLOR_GREEN: return COLOR_GREEN;
- case SWT.COLOR_YELLOW: return COLOR_YELLOW;
- case SWT.COLOR_BLUE: return COLOR_BLUE;
- case SWT.COLOR_MAGENTA: return COLOR_MAGENTA;
- case SWT.COLOR_CYAN: return COLOR_CYAN;
- case SWT.COLOR_WHITE: return COLOR_WHITE;
- }
- if (xColor == null) return COLOR_BLACK;
- return Color.motif_new (this, xColor);
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return Font.motif_new (this, systemFont);
-}
-
-/**
- * Returns <code>true</code> if the underlying window system prints out
- * warning messages on the console, and <code>setWarnings</code>
- * had previously been called with <code>true</code>.
- *
- * @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getWarnings () {
- checkDevice ();
- return warnings;
-}
-
-protected void init () {
-
- /* Create the warning and error callbacks */
- xErrorCallback = new Callback (this, "xErrorProc", 2);
- xNullErrorProc = xErrorCallback.getAddress ();
- if (xNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- xtWarningCallback = new Callback (this, "xtWarningProc", 1);
- xtNullWarningProc = xtWarningCallback.getAddress ();
- if (xtNullWarningProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- xIOErrorCallback = new Callback (this, "xIOErrorProc", 1);
- xNullIOErrorProc = xIOErrorCallback.getAddress ();
- if (xNullIOErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- xtErrorCallback = new Callback (this, "xtErrorProc", 1);
- xtNullErrorProc = xtErrorCallback.getAddress ();
- if (xtNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- /* Set the warning and error handlers */
- if (debug) OS.XSynchronize (xDisplay, true);
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- xErrorProc = OS.XSetErrorHandler (xNullErrorProc);
- if (!debug) OS.XSetErrorHandler (xErrorProc);
- xtWarningProc = OS.XtAppSetWarningHandler (xtContext, xtNullWarningProc);
- if (!debug) OS.XtAppSetWarningHandler (xtContext, xtWarningProc);
- xIOErrorProc = OS.XSetIOErrorHandler (xNullIOErrorProc);
- if (!debug) OS.XSetIOErrorHandler (xIOErrorProc);
- xtErrorProc = OS.XtAppSetErrorHandler (xtContext, xtNullErrorProc);
- if (!debug) OS.XtAppSetErrorHandler (xtContext, xtErrorProc);
-
- /* Only use palettes for <= 8 bpp default visual */
- int xScreenPtr = OS.XDefaultScreenOfDisplay (xDisplay);
- int defaultDepth = OS.XDefaultDepthOfScreen (xScreenPtr);
- if (defaultDepth <= 8) {
- int numColors = 1 << defaultDepth;
- colorRefCount = new int [numColors];
- xcolors = new XColor [numColors];
- }
-
- /*
- * The following colors are listed in the Windows
- * Programmer's Reference as the colors in the default
- * palette.
- */
- COLOR_BLACK = new Color (this, 0,0,0);
- COLOR_DARK_RED = new Color (this, 0x80,0,0);
- COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
- COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
- COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
- COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
- COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
- COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
- COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
- COLOR_RED = new Color (this, 0xFF,0,0);
- COLOR_GREEN = new Color (this, 0,0xFF,0);
- COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
- COLOR_BLUE = new Color (this, 0,0,0xFF);
- COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
- COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
- COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
-
- /* Create the parsing tables */
- byte[] tabBuffer = {(byte) '\t', 0};
- tabPointer = OS.XtMalloc (tabBuffer.length);
- OS.memmove (tabPointer, tabBuffer, tabBuffer.length);
- int tabString = OS.XmStringComponentCreate(OS.XmSTRING_COMPONENT_TAB, 0, null);
- int [] argList = {
- OS.XmNpattern, tabPointer,
- OS.XmNsubstitute, tabString,
- };
- tabMapping = OS.XmParseMappingCreate(argList, argList.length / 2);
- OS.XmStringFree(tabString);
- byte[] crBuffer = {(byte) '\n', 0};
- crPointer = OS.XtMalloc (crBuffer.length);
- OS.memmove (crPointer, crBuffer, crBuffer.length);
- int crString = OS.XmStringComponentCreate(OS.XmSTRING_COMPONENT_SEPARATOR, 0, null);
- argList = new int[] {
- OS.XmNpattern, crPointer,
- OS.XmNsubstitute, crString,
- };
- crMapping = OS.XmParseMappingCreate(argList, argList.length / 2);
- OS.XmStringFree(crString);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public abstract int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public abstract void internal_dispose_GC (int handle, GCData data);
-
-/**
- * Returns <code>true</code> if the device has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the device.
- * When a device has been disposed, it is an error to
- * invoke any other method using the device.
- *
- * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return xDisplay == 0;
-}
-
-void new_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == null) {
- objects [i] = object;
- errors [i] = new Error ();
- return;
- }
- }
- Object [] newObjects = new Object [objects.length + 128];
- System.arraycopy (objects, 0, newObjects, 0, objects.length);
- newObjects [objects.length] = object;
- objects = newObjects;
- Error [] newErrors = new Error [errors.length + 128];
- System.arraycopy (errors, 0, newErrors, 0, errors.length);
- newErrors [errors.length] = new Error ();
- errors = newErrors;
-}
-
-protected void release () {
- /* Free the parsing tables */
- OS.XtFree(tabPointer);
- OS.XtFree(crPointer);
- int[] parseTable = {tabMapping, crMapping};
- OS.XmParseTableFree(parseTable, parseTable.length);
- tabPointer = crPointer = tabMapping = crMapping = 0;
-
- /*
- * Free the palette. Note that this disposes all colors on
- * the display that were allocated using the Color constructor.
- */
- if (xcolors != null) {
- int xScreen = OS.XDefaultScreen (xDisplay);
- int xColormap = OS.XDefaultColormap (xDisplay, xScreen);
- int [] pixel = new int [1];
- for (int i = 0; i < xcolors.length; i++) {
- XColor color = xcolors [i];
- if (color != null) {
- pixel [0] = color.pixel;
- while (colorRefCount [i] > 0) {
- OS.XFreeColors (xDisplay, xColormap, pixel, 1, 0);
- --colorRefCount [i];
- }
- }
- }
- }
- xcolors = null;
- colorRefCount = null;
-
- COLOR_BLACK = COLOR_DARK_RED = COLOR_DARK_GREEN = COLOR_DARK_YELLOW =
- COLOR_DARK_BLUE = COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED =
- COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
-
- /* Free the Xt error handler */
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- OS.XtAppSetErrorHandler (xtContext, xtErrorProc);
- xtErrorCallback.dispose (); xtErrorCallback = null;
- xtNullErrorProc = xtErrorProc = 0;
-
- /* Free the Xt Warning handler */
- OS.XtAppSetWarningHandler (xtContext, xtWarningProc);
- xtWarningCallback.dispose (); xtWarningCallback = null;
- xtNullWarningProc = xtWarningProc = 0;
-
- /* Free the X IO error handler */
- OS.XSetIOErrorHandler (xIOErrorProc);
- xIOErrorCallback.dispose (); xIOErrorCallback = null;
- xNullIOErrorProc = xIOErrorProc = 0;
-
- /* Free the X error handler */
- /*
- * Bug in Motif. For some reason, when a pixmap is
- * set into a button or label, despite the fact that
- * the pixmap is cleared from the widget before it
- * is disposed, Motif still references the pixmap
- * and attempts to dispose it in XtDestroyApplicationContext().
- * The fix is to install the null error handler to avoid the
- * warning.
- *
- * NOTE: The warning callback is leaked.
- */
- OS.XSetErrorHandler (xNullErrorProc);
-// OS.XSetErrorHandler (xErrorProc);
-// xErrorCallback.dispose (); xErrorCallback = null;
-// xNullErrorProc = xErrorProc = 0;
-}
-
-/**
- * If the underlying window system supports printing warning messages
- * to the console, setting warnings to <code>true</code> prevents these
- * messages from being printed. If the argument is <code>false</code>
- * message printing is not blocked.
- *
- * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setWarnings (boolean warnings) {
- checkDevice ();
- this.warnings = warnings;
- if (debug) return;
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- if (warnings) {
- OS.XSetErrorHandler (xErrorProc);
- OS.XtAppSetWarningHandler (xtContext, xtWarningProc);
- } else {
- OS.XSetErrorHandler (xNullErrorProc);
- OS.XtAppSetWarningHandler (xtContext, xtNullWarningProc);
- }
-}
-
-int xErrorProc (int xDisplay, int xErrorEvent) {
- if (DEBUG || (debug && warnings)) {
- new SWTError ().printStackTrace ();
- OS.Call (xErrorProc, xDisplay, xErrorEvent);
- }
- return 0;
-}
-
-int xIOErrorProc (int xDisplay) {
- if (DEBUG || debug) {
- new SWTError ().printStackTrace ();
- OS.Call (xIOErrorProc, xDisplay, 0);
- }
- return 0;
-}
-
-int xtErrorProc (int message) {
- if (DEBUG || debug) {
- new SWTError ().printStackTrace ();
- OS.Call (xtErrorProc, message, 0);
- }
- return 0;
-}
-
-int xtWarningProc (int message) {
- if (DEBUG || (debug && warnings)) {
- new SWTError ().printStackTrace ();
- OS.Call (xtWarningProc, message, 0);
- }
- return 0;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/DeviceData.java
deleted file mode 100755
index d92b594936..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/DeviceData.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DeviceData {
- /*
- * Motif only fields.
- */
- public String display_name;
- public String application_name;
- public String application_class;
-
- /*
- * Debug fields - may not be honoured
- * on some SWT platforms.
- */
- public boolean debug;
- public boolean tracking;
- public Error [] errors;
- public Object [] objects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Font.java
deleted file mode 100755
index 75489d66f2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Font.java
+++ /dev/null
@@ -1,400 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * define how text looks when it is displayed. Fonts may be constructed
- * by providing a device and either name, size and style information
- * or a <code>FontData</code> object which encapsulates this data.
- * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see FontData
- */
-public final class Font {
- /**
- * the handle to the OS font resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
-Font () {
-}
-/**
- * Constructs a new font given a device and font data
- * which describes the desired font's appearance.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param fd the FontData that describes the desired font (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
- * </ul>
- */
-public Font (Device device, FontData fd) {
- init(device, fd);
-}
-/**
- * Constructs a new font given a device, a font name,
- * the height of the desired font in points, and a font
- * style.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
- * </ul>
- */
-public Font (Device device, String fontFamily, int height, int style) {
- if (fontFamily == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new FontData(fontFamily, height, style));
-}
-/**
- * Disposes of the operating system resources associated with
- * the font. Applications must dispose of all fonts which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- if (device.isDisposed()) return;
- if (handle == device.systemFont) return;
-
- /* Free the fonts associated with the font list */
- int [] buffer = new int [1];
- int xDisplay = device.xDisplay;
- if (OS.XmFontListInitFontContext (buffer, handle)) {
- int context = buffer [0];
- int fontListEntry;
- while ((fontListEntry = OS.XmFontListNextEntry (context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont (fontListEntry, buffer);
- if (buffer [0] == OS.XmFONT_IS_FONT) {
- OS.XFreeFont(xDisplay, fontPtr);
- } else {
- OS.XFreeFontSet(xDisplay, fontPtr);
- }
- }
- OS.XmFontListFreeFontContext (context);
- }
-
- /* Free the font list */
- OS.XmFontListFree (handle);
- device = null;
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Font)) return false;
- Font font = (Font)object;
- return device == font.device && handle == font.handle;
-}
-/**
- * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however,
- * a <code>Font</code> object <em>may</em> be composed of multiple X
- * fonts. To support this case, we return an array of font data objects.
- *
- * @return an array of font data objects describing the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData[] getFontData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int xDisplay = device.xDisplay;
- /**
- * Create a font context to iterate over each element in the font list.
- * If a font context can not be created, return null.
- */
- int[] buffer = new int[1];
- if (!OS.XmFontListInitFontContext(buffer, handle)) return null;
- int context = buffer[0];
- XFontStruct fontStruct = new XFontStruct();
- int fontListEntry;
- int[] fontStructPtr = new int[1];
- int[] fontNamePtr = new int[1];
- String[] xlfds = new String[0];
- /* Go through each entry in the font list */
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == OS.XmFONT_IS_FONT) {
- /* FontList contains a single font */
- OS.memmove(fontStruct,fontPtr,20 * 4);
- int propPtr = fontStruct.properties;
- for (int i = 0; i < fontStruct.n_properties; i++) {
- /* Reef through properties looking for XAFONT */
- int[] prop = new int[2];
- OS.memmove(prop, propPtr, 8);
- if (prop[0] == OS.XA_FONT) {
- /* Found it, prop[1] points to the string */
- StringBuffer stringBuffer = new StringBuffer();
- int ptr = OS.XmGetAtomName(xDisplay, prop[1]);
- int length = OS.strlen(ptr);
- byte[] nameBuf = new byte[length];
- OS.memmove(nameBuf, ptr, length);
- /* Use the character encoding for the default locale */
- String xlfd = new String(Converter.mbcsToWcs(null, nameBuf)).toLowerCase();
- /* Add the xlfd to the array */
- String[] newXlfds = new String[xlfds.length + 1];
- System.arraycopy(xlfds, 0, newXlfds, 0, xlfds.length);
- newXlfds[newXlfds.length - 1] = xlfd;
- xlfds = newXlfds;
- OS.XtFree(ptr);
- break;
- }
- propPtr += 8;
- }
- }
- else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet(fontPtr,fontStructPtr,fontNamePtr);
- int [] fontStructs = new int[nFonts];
- OS.memmove(fontStructs,fontStructPtr[0],nFonts * 4);
- for (int i = 0; i < nFonts; i++) { // Go through each fontStruct in the font set.
- OS.memmove(fontStruct,fontStructs[i],20 * 4);
- int propPtr = fontStruct.properties;
- for (int j = 0; j < fontStruct.n_properties; j++) {
- // Reef through properties looking for XAFONT
- int[] prop = new int[2];
- OS.memmove(prop, propPtr, 8);
- if (prop[0] == OS.XA_FONT) {
- /* Found it, prop[1] points to the string */
- StringBuffer stringBuffer = new StringBuffer();
- int ptr = OS.XmGetAtomName(xDisplay, prop[1]);
- int length = OS.strlen(ptr);
- byte[] nameBuf = new byte[length];
- OS.memmove(nameBuf, ptr, length);
- String xlfd = new String(Converter.mbcsToWcs(null, nameBuf)).toLowerCase();
- /* Add the xlfd to the array */
- String[] newXlfds = new String[xlfds.length + 1];
- System.arraycopy(xlfds, 0, newXlfds, 0, xlfds.length);
- newXlfds[newXlfds.length - 1] = xlfd;
- xlfds = newXlfds;
- OS.XFree(ptr);
- break;
- }
- propPtr += 8;
- }
- }
- }
- }
- OS.XmFontListFreeFontContext(context);
- if (xlfds.length == 0) return null;
- FontData[] fontData = new FontData[xlfds.length];
- /* Construct each fontData out of the xlfd */
- try {
- for (int i = 0; i < xlfds.length; i++) {
- fontData[i] = FontData.motif_new(xlfds[i]);
- }
- } catch (Exception e) {
- /**
- * Some font servers, for example, xfstt, do not pass
- * reasonable font properties to the client, so we
- * cannot construct a FontData for these. Return null.
- */
- return null;
- }
- return fontData;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-int loadFont(int xDisplay, FontData fd) {
- /* Use the character encoding for the default locale */
- byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
- return OS.XLoadQueryFont(xDisplay, buffer);
-}
-int loadFontSet(int xDisplay, FontData fd) {
- /* Use the character encoding for the default locale */
- byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
- int [] missing_charset = new int [1];
- int [] missing_charset_count = new int [1];
- int [] def_string = new int [1];
- return OS.XCreateFontSet(xDisplay, buffer, missing_charset, missing_charset_count, def_string);
-}
-int matchFont(int xDisplay, FontData fd, boolean fontSet) {
- int font = fontSet ? loadFontSet(xDisplay, fd) : loadFont(xDisplay, fd);
- if (font != 0) return font;
- if (fd.slant != null) {
- fd.slant = null;
- font = fontSet ? loadFontSet(xDisplay, fd) : loadFont(xDisplay, fd);
- if (font != 0) return font;
- }
- if (fd.weight != null) {
- fd.weight = null;
- font = fontSet ? loadFontSet(xDisplay, fd) : loadFont(xDisplay, fd);
- if (font != 0) return font;
- }
- if (fd.points != 0) {
- fd.points = 0;
- font = fontSet ? loadFontSet(xDisplay, fd) : loadFont(xDisplay, fd);
- if (font != 0) return font;
- }
- return 0;
-}
-void init (Device device, FontData fd) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- int xDisplay = device.xDisplay;
- int fontListEntry;
-// int fontStruct = loadFont(xDisplay, fd);
-// if (fontStruct == 0) {
-// /*
-// * If the desired font can not be loaded, the XLFD fields are wildcard
-// * in order to preserve the font style and height. If there is no
-// * font with the desired style and height, the slant, weight and points
-// * are wildcard in that order, until a font can be loaded.
-// */
-// FontData newFD = new FontData();
-// newFD.slant = fd.slant;
-// newFD.weight = fd.weight;
-// newFD.points = fd.points;
-// newFD.characterSetName = fd.characterSetName;
-// if (newFD.characterSetName == null) {
-// newFD.characterSetName = device.characterSetName;
-// }
-// newFD.characterSetRegistry = fd.characterSetRegistry;
-// if (newFD.characterSetRegistry == null) {
-// newFD.characterSetRegistry = device.characterSetRegistry;
-// }
-// fontStruct = matchFont(xDisplay, newFD, false);
-//
-// /* Failed to load any font. Use the system font. */
-// if (fontStruct == 0) {
-// handle = device.systemFont;
-// if (handle != 0) return;
-// }
-// }
-// fontListEntry = OS.XmFontListEntryCreate(OS.XmFONTLIST_DEFAULT_TAG, OS.XmFONT_IS_FONT, fontStruct);
- if (fd.lang != null) {
- String lang = fd.lang;
- String country = fd.country;
- String variant = fd.variant;
- String osLocale = lang;
- if (country != null) osLocale += "_" + country;
- if (variant != null) osLocale += "." + variant;
- int length = osLocale.length();
- byte [] buffer = new byte[length + 1];
- for (int i=0; i<length; i++) {
- buffer[i] = (byte)osLocale.charAt(i);
- }
- OS.setlocale (OS.LC_CTYPE, buffer);
- }
- int fontSet = loadFontSet(xDisplay, fd);
- if (fontSet == 0) {
- /*
- * If the desired font can not be loaded, the XLFD fields are wildcard
- * in order to preserve the font style and height. If there is no
- * font with the desired style and height, the slant, weight and points
- * are wildcard in that order, until a font can be loaded.
- */
- FontData newFD = new FontData();
- newFD.slant = fd.slant;
- newFD.weight = fd.weight;
- newFD.points = fd.points;
- newFD.characterSetName = fd.characterSetName;
- if (newFD.characterSetName == null) {
- newFD.characterSetName = device.characterSetName;
- }
- newFD.characterSetRegistry = fd.characterSetRegistry;
- if (newFD.characterSetRegistry == null) {
- newFD.characterSetRegistry = device.characterSetRegistry;
- }
- fontSet = matchFont(xDisplay, newFD, true);
- }
- if (fd.lang != null) OS.setlocale (OS.LC_CTYPE, new byte [0]);
-
- /* Failed to load any font. Use the system font. */
- if (fontSet == 0) {
- handle = device.systemFont;
- if (handle != 0) return;
- }
- fontListEntry = OS.XmFontListEntryCreate(OS.XmFONTLIST_DEFAULT_TAG, OS.XmFONT_IS_FONTSET, fontSet);
- if (fontListEntry == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- handle = OS.XmFontListAppendEntry(0, fontListEntry);
- OS.XmFontListEntryFree(new int[]{fontListEntry});
-}
-/**
- * Returns <code>true</code> if the font has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the font.
- * When a font has been disposed, it is an error to
- * invoke any other method using the font.
- *
- * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-public static Font motif_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Font font = new Font();
- font.device = device;
- font.handle = handle;
- return font;
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return "Font {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java
deleted file mode 100755
index 078f50318d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java
+++ /dev/null
@@ -1,521 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe operating system fonts.
- * Only the public API of this type is platform independent.
- * <p>
- * For platform-independent behaviour, use the get and set methods
- * corresponding to the following properties:
- * <dl>
- * <dt>height</dt><dd>the height of the font in points</dd>
- * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
- * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
- * </dl>
- * If extra, platform-dependent functionality is required:
- * <ul>
- * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
- * corresponds to a Windows <code>LOGFONT</code> structure whose fields
- * may be retrieved and modified.</li>
- * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * </ul>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- *
- * @see Font
- */
-public final class FontData {
- /**
- * The company that produced the font
- * Warning: This field is platform dependent.
- */
- public String foundry;
- /**
- * The common name of the font
- * Warning: This field is platform dependent.
- */
- public String fontFamily;
- /**
- * The weight ("normal", "bold")
- * Warning: This field is platform dependent.
- */
- public String weight;
- /**
- * The slant ("o" for oblique, "i" for italic)
- * Warning: This field is platform dependent.
- */
- public String slant;
- /**
- * The set width of the font
- * Warning: This field is platform dependent.
- */
- public String setWidth;
- /**
- * Additional font styles
- * Warning: This field is platform dependent.
- */
- public String addStyle;
- /**
- * The height of the font in pixels
- * Warning: This field is platform dependent.
- */
- public int pixels;
- /**
- * The height of the font in tenths of a point
- * Warning: This field is platform dependent.
- */
- public int points;
- /**
- * The horizontal screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int horizontalResolution;
- /**
- * The vertical screen resolution for which the font was designed
- * Warning: This field is platform dependent.
- */
- public int verticalResolution;
- /**
- * The font spacing ("m" for monospace, "p" for proportional)
- * Warning: This field is platform dependent.
- */
- public String spacing;
- /**
- * The average character width for the font
- * Warning: This field is platform dependent.
- */
- public int averageWidth;
- /**
- * The ISO character set registry
- * Warning: This field is platform dependent.
- */
- public String characterSetRegistry;
- /**
- * The ISO character set name
- * Warning: This field is platform dependent.
- */
- public String characterSetName;
-
- /**
- * The locales of the font
- * (Warning: These fields are platform dependent)
- */
- String lang, country, variant;
-/**
- * Constructs a new un-initialized font data.
- */
-public FontData () {
-}
-/**
- * Constructs a new FontData given a string representation
- * in the form generated by the <code>FontData.toString</code>
- * method.
- * <p>
- * Note that the representation varies between platforms,
- * and a FontData can only be created from a string that was
- * generated on the same platform.
- * </p>
- *
- * @param string the string representation of a <code>FontData</code> (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
- * </ul>
- *
- * @see #toString
- */
-public FontData(String string) {
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int start = 0;
- int end = string.indexOf('|');
- if (end == -1) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- String version1 = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- String name = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int height = 0;
- try {
- height = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int style = 0;
- try {
- style = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String platform = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String version2 = string.substring(start, end);
-
- if (platform.equals("MOTIF") && version2.equals("1")) {
- start = end + 1;
- end = string.length();
- if (end == -1) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- String xlfd = string.substring(start, end);
- setXlfd(xlfd);
- return;
- }
- setName(name);
- setHeight(height);
- setStyle(style);
-}
-/**
- * Constructs a new font data given a font name,
- * the height of the desired font in points,
- * and a font style.
- *
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- */
-public FontData (String name, int height, int style) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
- points = height * 10;
- if ((style & SWT.BOLD) != 0)
- weight = "bold";
- else
- weight = "medium";
- if ((style & SWT.ITALIC) != 0)
- slant = "i";
- else
- slant = "r";
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof FontData) &&
- getXlfd().equals(((FontData)object).getXlfd()));
-}
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight
- */
-public int getHeight() {
- return points / 10;
-}
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this <code>FontData</code>
- *
- * @see #setName
- */
-public String getName() {
- StringBuffer buffer = new StringBuffer();
- if (foundry != null) {
- buffer.append(foundry);
- buffer.append("-");
- }
- if (fontFamily != null) buffer.append(fontFamily);
- return buffer.toString();
-}
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the <code>SWT</code> constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this <code>FontData</code>
- *
- * @see #setStyle
- */
-public int getStyle() {
- int style = 0;
- if (weight.equals("bold"))
- style |= SWT.BOLD;
- if (slant.equals("i"))
- style |= SWT.ITALIC;
- return style;
-}
-String getXlfd() {
- String s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
- s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = s12 = s13 = s14 = "*";
-
- if (foundry != null) s1 = foundry;
- if (fontFamily != null) s2 = fontFamily;
- if (weight != null) s3 = weight;
- if (slant != null) s4 = slant;
- if (setWidth != null) s5 = setWidth;
- if (addStyle != null) s6 = addStyle;
- if (pixels != 0) s7 = Integer.toString(pixels);
- if (points != 0) s8 = Integer.toString(points);
- if (horizontalResolution != 0) s9 = Integer.toString(horizontalResolution);
- if (verticalResolution != 0) s10 = Integer.toString(verticalResolution);
- if (spacing != null) s11 = spacing;
- if (averageWidth != 0) s12 = Integer.toString(averageWidth);
- if (characterSetRegistry != null) s13 = characterSetRegistry;
- if (characterSetName != null) s14 = characterSetName;
-
- return "-" + s1+ "-" + s2 + "-" + s3 + "-" + s4 + "-" + s5 + "-" + s6 + "-" + s7 + "-" + s8 + "-"
- + s9 + "-" + s10 + "-" + s11 + "-" + s12 + "-" + s13 + "-" + s14;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return getXlfd().hashCode();
-}
-public static FontData motif_new(String xlfd) {
- FontData fontData = new FontData();
- fontData.setXlfd(xlfd);
- return fontData;
-}
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the <code>FontData</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- *
- * @see #getHeight
- */
-public void setHeight(int height) {
- if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- points = height * 10;
-}
-/**
- * Sets the name of the receiver.
- * <p>
- * Some platforms support font foundries. On these platforms, the name
- * of the font specified in setName() may have one of the following forms:
- * <ol>
- * <li>a face name (for example, "courier")</li>
- * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
- * </ol>
- * In either case, the name returned from getName() will include the
- * foundry.
- * </p>
- * <p>
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in <code>setName()</code> and
- * <code>getName()</code>.
- * </p>
- *
- * @param name the name of the font data (must not be null)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * </ul>
- *
- * @see #getName
- */
-public void setName(String name) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int dash = name.indexOf('-');
- if (dash != -1) {
- foundry = name.substring(0, dash);
- fontFamily = name.substring(dash + 1);
- } else {
- fontFamily = name;
- }
-}
-/**
- * Sets the locale of the receiver.
- * <p>
- * The locale determines which platform character set this
- * font is going to use. Widgets and graphics operations that
- * use this font will convert UNICODE strings to the platform
- * character set of the specified locale.
- * </p>
- * <p>
- * On platforms which there are multiple character sets for a
- * given language/country locale, the variant portion of the
- * locale will determine the character set.
- * </p>
- *
- * @param locale the <code>String</code> representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(String locale) {
- lang = country = variant = null;
- if (locale != null) {
- char sep = '_';
- int length = locale.length();
- int firstSep, secondSep;
-
- firstSep = locale.indexOf(sep);
- if (firstSep == -1) {
- firstSep = secondSep = length;
- } else {
- secondSep = locale.indexOf(sep, firstSep + 1);
- if (secondSep == -1) secondSep = length;
- }
- if (firstSep > 0) lang = locale.substring(0, firstSep);
- if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
- if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
- }
-}
-/**
- * Sets the style of the receiver to the argument which must
- * be a bitwise OR of one or more of the <code>SWT</code>
- * constants NORMAL, BOLD and ITALIC.
- *
- * @param style the new style for this <code>FontData</code>
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- if ((style & SWT.BOLD) == SWT.BOLD)
- weight = "bold";
- else
- weight = "normal";
- if ((style & SWT.ITALIC) == SWT.ITALIC)
- slant = "i";
- else
- slant = "r";
-}
-void setXlfd(String xlfd) {
- int start, stop;
- start = 1;
- stop = xlfd.indexOf ("-", start);
- foundry = xlfd.substring(start, stop);
- if (foundry.equals("*")) foundry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- fontFamily = xlfd.substring(start, stop);
- if (fontFamily.equals("*")) fontFamily = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- weight = xlfd.substring(start, stop);
- if (weight.equals("*")) weight = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- slant = xlfd.substring(start, stop);
- if (slant.equals("*")) slant = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- setWidth = xlfd.substring(start, stop);
- if (setWidth.equals("*")) setWidth = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- addStyle = xlfd.substring(start, stop);
- if (addStyle.equals("*")) addStyle = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- String s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- pixels = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- points = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- horizontalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- verticalResolution = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- spacing = xlfd.substring(start, stop);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- s = xlfd.substring(start, stop);
- if (!s.equals("") && !s.equals("*"))
- averageWidth = Integer.parseInt(s);
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetRegistry = xlfd.substring(start, stop);
- if (characterSetRegistry.equals("*")) characterSetRegistry = null;
- start = stop + 1;
- stop = xlfd.indexOf ("-", start);
- characterSetName = xlfd.substring(start);
- if (characterSetName.equals("*")) characterSetName = null;
-}
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * <code>FontData(String)</code> constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public String toString() {
- return "1|" + fontFamily + "|" + getHeight() + "|" + getStyle() + "|" +
- "MOTIF|1|" + getXlfd();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontMetrics.java
deleted file mode 100755
index 97dd248150..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontMetrics.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * <code>FontMetrics</code> are obtained from <code>GC</code>s
- * using the <code>getFontMetrics()</code> method.
- *
- * @see GC#getFontMetrics
- */
-public final class FontMetrics {
- int ascent, descent, averageCharWidth, leading, height;
-FontMetrics() {
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontMetrics)) return false;
- FontMetrics metrics = (FontMetrics)object;
- return ascent == metrics.ascent && descent == metrics.descent &&
- averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
- height == metrics.height;
-}
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's <em>ascent</em> is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return ascent;
-}
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- return averageCharWidth;
-}
-/**
- * Returns the descent of the font described by the receiver. A
- * font's <em>descent</em> is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return descent;
-}
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's <em>height</em> is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return height;
-}
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's <em>leading area</em> is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return leading;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
-}
-public static FontMetrics motif_new(int ascent, int descent, int averageCharWidth, int leading, int height) {
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.ascent = ascent;
- fontMetrics.descent = descent;
- fontMetrics.averageCharWidth = averageCharWidth;
- fontMetrics.leading = leading;
- fontMetrics.height = height;
- return fontMetrics;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
deleted file mode 100755
index 9b6c4c1955..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
+++ /dev/null
@@ -1,2500 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Class <code>GC</code> is where all of the drawing capabilities that are
- * supported by SWT are located. Instances are used to draw on either an
- * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
- * <p>
- * Application code must explicitly invoke the <code>GC.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required. This is <em>particularly</em>
- * important on Windows95 and Windows98 where the operating system has a limited
- * number of device contexts available.
- * </p>
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-public final class GC {
- /**
- * the handle to the OS device context
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- Drawable drawable;
- GCData data;
-
-GC() {
-}
-/**
- * Constructs a new instance of this class which has been
- * configured to draw on the specified drawable. Sets the
- * foreground and background color in the GC to match those
- * in the drawable.
- * <p>
- * You must dispose the graphics context when it is no longer required.
- * </p>
- * @param drawable the drawable to draw on
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
- * <li>ERROR_INVALID_ARGUMENT
- * - if the drawable is an image that is not a bitmap or an icon
- * - if the drawable is an image or printer that is already selected
- * into another graphics context</li>
- * </ul>
- */
-public GC (Drawable drawable) {
- if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- GCData data = new GCData();
- int xGC = drawable.internal_new_GC(data);
- init(drawable, data, xGC);
-}
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(int x, int y, int width, int height, int destX, int destY) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- OS.XSetGraphicsExposures (xDisplay, handle, true);
- OS.XCopyArea(xDisplay, xDrawable, xDrawable, handle, x, y, width, height, destX, destY);
- OS.XSetGraphicsExposures (xDisplay, handle, false);
- boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
- if (data.image != null) return;
- if (disjoint) {
- OS.XClearArea (xDisplay, xDrawable, x, y, width, height, true);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.XClearArea (xDisplay, xDrawable, newX, y, Math.abs (deltaX), height, true);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.XClearArea (xDisplay, xDrawable, x, newY, width, Math.abs (deltaY), true);
- }
- }
-}
-/**
- * Copies a rectangular area of the receiver at the specified
- * position into the image, which must be of type <code>SWT.BITMAP</code>.
- *
- * @param x the x coordinate in the receiver of the area to be copied
- * @param y the y coordinate in the receiver of the area to be copied
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap or has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- Rectangle rect = image.getBounds();
- int xDisplay = data.display;
- int xGC = OS.XCreateGC(xDisplay, image.pixmap, 0, null);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.XSetSubwindowMode (xDisplay, xGC, OS.IncludeInferiors);
- OS.XCopyArea(xDisplay, data.drawable, image.pixmap, xGC, x, y, rect.width, rect.height, 0, 0);
- OS.XFreeGC(xDisplay, xGC);
-}
-/**
- * Disposes of the operating system resources associated with
- * the graphics context. Applications must dispose of all GCs
- * which they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- if (data.device.isDisposed()) return;
-
- /* Free resources */
- int clipRgn = data.clipRgn;
- if (clipRgn != 0) OS.XDestroyRegion(clipRgn);
- Image image = data.image;
- if (image != null) image.memGC = null;
- int renderTable = data.renderTable;
- if (renderTable != 0) OS.XmRenderTableFree(renderTable);
-
- /* Dispose the GC */
- drawable.internal_dispose_GC(handle, data);
-
- data.display = data.drawable = data.colormap = data.fontList =
- data.clipRgn = data.renderTable = 0;
- drawable = null;
- data.device = null;
- data.image = null;
- data = null;
- handle = 0;
-}
-/**
- * Draws the outline of a circular or elliptical arc
- * within the specified rectangular area.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be drawn
- * @param y the y coordinate of the upper-left corner of the arc to be drawn
- * @param width the width of the arc to be drawn
- * @param height the height of the arc to be drawn
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- OS.XDrawArc(data.display,data.drawable,handle,x,y,width,height,startAngle * 64 ,endAngle * 64);
-}
-/**
- * Draws a rectangle, based on the specified arguments, which has
- * the appearance of the platform's <em>focus rectangle</em> if the
- * platform supports such a notion, and otherwise draws a simple
- * rectangle in the receiver's forground color.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void drawFocus (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- /*
- * When the drawable is not a widget, the highlight
- * color is zero.
- */
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- int highlightColor = 0;
- int widget = OS.XtWindowToWidget (xDisplay, xDrawable);
- if (widget != 0) {
- int [] argList = {OS.XmNhighlightColor, 0};
- OS.XtGetValues (widget, argList, argList.length / 2);
- highlightColor = argList [1];
- }
-
- /* Draw the focus rectangle */
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCForeground, values);
- OS.XSetForeground (xDisplay, handle, highlightColor);
- OS.XDrawRectangle (xDisplay, xDrawable, handle, x, y, width - 1, height - 1);
- OS.XSetForeground (xDisplay, handle, values.foreground);
-}
-/**
- * Draws the given image in the receiver at the specified
- * coordinates.
- *
- * @param image the image to draw
- * @param x the x coordinate of where to draw
- * @param y the y coordinate of where to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true);
-}
-/**
- * Copies a rectangular area from the source image into a (potentially
- * different sized) rectangular area in the receiver. If the source
- * and destination areas are of differing sizes, then the source
- * area will be stretched or shrunk to fit the destination area
- * as it is copied. The copy fails if any of the given coordinates
- * are negative or lie outside the bounds of their respective images.
- *
- * @param image the source image
- * @param srcX the x coordinate in the source image to copy from
- * @param srcY the y coordinate in the source image to copy from
- * @param srcWidth the width in pixels to copy from the source
- * @param srcHeight the height in pixels to copy from the source
- * @param destX the x coordinate in the destination to copy to
- * @param destY the y coordinate in the destination to copy to
- * @param destWidth the width in pixels of the destination rectangle
- * @param destHeight the height in pixels of the destination rectangle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
- if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false);
-}
-void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
- int[] width = new int[1];
- int[] height = new int[1];
- int[] depth = new int[1];
- int[] unused = new int[1];
- OS.XGetGeometry(data.display, srcImage.pixmap, unused, unused, unused, width, height, unused, depth);
- int imgWidth = width[0];
- int imgHeight = height[0];
- if (simple) {
- srcWidth = destWidth = imgWidth;
- srcHeight = destHeight = imgHeight;
- } else {
- simple = srcX == 0 && srcY == 0 &&
- srcWidth == destWidth && destWidth == imgWidth &&
- srcHeight == destHeight && destHeight == imgHeight;
- if (srcX + srcWidth > imgWidth || srcY + srcHeight > imgHeight) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
- if (srcImage.alpha != -1 || srcImage.alphaData != null) {
- drawImageAlpha(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, imgWidth, imgHeight, depth[0]);
- } else if (srcImage.transparentPixel != -1 || srcImage.mask != 0) {
- drawImageMask(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, imgWidth, imgHeight, depth[0]);
- } else {
- drawImage(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, imgWidth, imgHeight, depth[0]);
- }
-}
-void drawImageAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, int depth) {
- /* Simple cases */
- if (srcImage.alpha == 0) return;
- if (srcImage.alpha == 255) {
- drawImage(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, imgWidth, imgHeight, depth);
- return;
- }
-
- /* Check the clipping */
- Rectangle rect = getClipping();
- rect = rect.intersection(new Rectangle(destX, destY, destWidth, destHeight));
- if (rect.isEmpty()) return;
-
- /* Optimization. Recalculate the src and dest rectangles so that
- * only the clipping area is drawn.
- */
- int sx1 = srcX + (((rect.x - destX) * srcWidth) / destWidth);
- int sx2 = srcX + ((((rect.x + rect.width) - destX) * srcWidth) / destWidth);
- int sy1 = srcY + (((rect.y - destY) * srcHeight) / destHeight);
- int sy2 = srcY + ((((rect.y + rect.height) - destY) * srcHeight) / destHeight);
- destX = rect.x;
- destY = rect.y;
- destWidth = rect.width;
- destHeight = rect.height;
- srcX = sx1;
- srcY = sy1;
- srcWidth = Math.max(1, sx2 - sx1);
- srcHeight = Math.max(1, sy2 - sy1);
-
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- int xDestImagePtr = 0, xSrcImagePtr = 0;
- try {
- /* Get the background pixels */
- xDestImagePtr = OS.XGetImage(xDisplay, xDrawable, destX, destY, destWidth, destHeight, OS.AllPlanes, OS.ZPixmap);
- if (xDestImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- XImage xDestImage = new XImage();
- OS.memmove(xDestImage, xDestImagePtr, XImage.sizeof);
- byte[] destData = new byte[xDestImage.bytes_per_line * xDestImage.height];
- OS.memmove(destData, xDestImage.data, destData.length);
-
- /* Get the foreground pixels */
- xSrcImagePtr = OS.XGetImage(xDisplay, srcImage.pixmap, srcX, srcY, srcWidth, srcHeight, OS.AllPlanes, OS.ZPixmap);
- if (xSrcImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- XImage xSrcImage = new XImage();
- OS.memmove(xSrcImage, xSrcImagePtr, XImage.sizeof);
- byte[] srcData = new byte[xSrcImage.bytes_per_line * xSrcImage.height];
- OS.memmove(srcData, xSrcImage.data, srcData.length);
-
- /* Compose the pixels */
- int srcOrder = xSrcImage.byte_order == OS.MSBFirst ? ImageData.MSB_FIRST : ImageData.LSB_FIRST;
- int destOrder = xDestImage.byte_order == OS.MSBFirst ? ImageData.MSB_FIRST : ImageData.LSB_FIRST;
- if (xSrcImage.depth <= 8) {
- XColor[] xcolors = data.device.xcolors;
- if (xcolors == null) SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- byte[] reds = new byte[xcolors.length];
- byte[] greens = new byte[xcolors.length];
- byte[] blues = new byte[xcolors.length];
- for (int i = 0; i < xcolors.length; i++) {
- XColor color = xcolors[i];
- if (color == null) continue;
- reds[i] = (byte)((color.red >> 8) & 0xFF);
- greens[i] = (byte)((color.green >> 8) & 0xFF);
- blues[i] = (byte)((color.blue >> 8) & 0xFF);
- }
- ImageData.blit(ImageData.BLIT_ALPHA,
- srcData, xSrcImage.bits_per_pixel, xSrcImage.bytes_per_line, srcOrder, 0, 0, srcWidth, srcHeight, reds, greens, blues,
- srcImage.alpha, srcImage.alphaData, imgWidth,
- destData, xDestImage.bits_per_pixel, xDestImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, reds, greens, blues,
- false, false);
- } else {
- int srcRedMask = xSrcImage.red_mask;
- int srcGreenMask = xSrcImage.green_mask;
- int srcBlueMask = xSrcImage.blue_mask;
- int destRedMask = xDestImage.red_mask;
- int destGreenMask = xDestImage.green_mask;
- int destBlueMask = xDestImage.blue_mask;
-
- /*
- * Feature in X. XGetImage does not retrieve the RGB masks if the drawable
- * is a Pixmap. The fix is to detect that the masks are not valid and use
- * the default visual masks instead.
- *
- * NOTE: It is safe to use the default Visual masks, since we always
- * create images with these masks.
- */
- int visual = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay));
- Visual xVisual = new Visual();
- OS.memmove(xVisual, visual, Visual.sizeof);
- if (srcRedMask == 0 && srcGreenMask == 0 && srcBlueMask == 0) {
- srcRedMask = xVisual.red_mask;
- srcGreenMask = xVisual.green_mask;
- srcBlueMask = xVisual.blue_mask;
- }
- if (destRedMask == 0 && destGreenMask == 0 && destBlueMask == 0) {
- destRedMask = xVisual.red_mask;
- destGreenMask = xVisual.green_mask;
- destBlueMask = xVisual.blue_mask;
- }
-
- ImageData.blit(ImageData.BLIT_ALPHA,
- srcData, xSrcImage.bits_per_pixel, xSrcImage.bytes_per_line, srcOrder, 0, 0, srcWidth, srcHeight, srcRedMask, srcGreenMask, srcBlueMask,
- srcImage.alpha, srcImage.alphaData, imgWidth,
- destData, xDestImage.bits_per_pixel, xDestImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, destRedMask, destGreenMask, destBlueMask,
- false, false);
- }
-
- /* Draw the composed pixels */
- OS.memmove(xDestImage.data, destData, destData.length);
- OS.XPutImage(xDisplay, xDrawable, handle, xDestImagePtr, 0, 0, destX, destY, destWidth, destHeight);
- } finally {
- if (xSrcImagePtr != 0) OS.XDestroyImage(xSrcImagePtr);
- if (xDestImagePtr != 0) OS.XDestroyImage(xDestImagePtr);
- }
-}
-void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, int depth) {
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- int colorPixmap = srcImage.pixmap;
- /* Generate the mask if necessary. */
- if (srcImage.transparentPixel != -1) srcImage.createMask();
- int maskPixmap = srcImage.mask;
- int foreground = 0x00000000;
- if (!(simple || (srcWidth == destWidth && srcHeight == destHeight))) {
- /* Stretch the color and mask*/
- int xImagePtr = scalePixmap(xDisplay, colorPixmap, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false, false);
- int xMaskPtr = scalePixmap(xDisplay, maskPixmap, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false, false);
-
- /* Create color scaled pixmaps */
- colorPixmap = OS.XCreatePixmap(xDisplay, xDrawable, destWidth, destHeight, depth);
- int tempGC = OS.XCreateGC(xDisplay, colorPixmap, 0, null);
- OS.XPutImage(xDisplay, colorPixmap, tempGC, xImagePtr, 0, 0, 0, 0, destWidth, destHeight);
- OS.XDestroyImage(xImagePtr);
- OS.XFreeGC(xDisplay, tempGC);
-
- /* Create mask scaled pixmaps */
- maskPixmap = OS.XCreatePixmap(xDisplay, xDrawable, destWidth, destHeight, 1);
- tempGC = OS.XCreateGC(xDisplay, maskPixmap, 0, null);
- OS.XPutImage(xDisplay, maskPixmap, tempGC, xMaskPtr, 0, 0, 0, 0, destWidth, destHeight);
- OS.XDestroyImage(xMaskPtr);
- OS.XFreeGC(xDisplay, tempGC);
-
- /* Change the source rectangle */
- srcX = srcY = 0;
- srcWidth = destWidth;
- srcHeight = destHeight;
-
- foreground = ~foreground;
- }
-
- /* Do the blts */
- XGCValues values = new XGCValues();
- OS.XGetGCValues(xDisplay, handle, OS.GCForeground | OS. GCBackground | OS.GCFunction, values);
- OS.XSetFunction(xDisplay, handle, OS.GXxor);
- OS.XCopyArea(xDisplay, colorPixmap, xDrawable, handle, srcX, srcY, srcWidth, srcHeight, destX, destY);
- OS.XSetForeground(xDisplay, handle, foreground);
- OS.XSetBackground(xDisplay, handle, ~foreground);
- OS.XSetFunction(xDisplay, handle, OS.GXand);
- OS.XCopyPlane(xDisplay, maskPixmap, xDrawable, handle, srcX, srcY, srcWidth, srcHeight, destX, destY, 1);
- OS.XSetFunction(xDisplay, handle, OS.GXxor);
- OS.XCopyArea(xDisplay, colorPixmap, xDrawable, handle, srcX, srcY, srcWidth, srcHeight, destX, destY);
- OS.XSetForeground(xDisplay, handle, values.foreground);
- OS.XSetBackground(xDisplay, handle, values.background);
- OS.XSetFunction(xDisplay, handle, values.function);
-
- /* Destroy scaled pixmaps */
- if (srcImage.pixmap != colorPixmap) OS.XFreePixmap(xDisplay, colorPixmap);
- if (srcImage.mask != maskPixmap) OS.XFreePixmap(xDisplay, maskPixmap);
- /* Destroy the image mask if the there is a GC created on the image */
- if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
-}
-void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, int depth) {
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- /* Simple case: no stretching */
- if ((srcWidth == destWidth) && (srcHeight == destHeight)) {
- OS.XCopyArea(xDisplay, srcImage.pixmap, xDrawable, handle, srcX, srcY, srcWidth, srcHeight, destX, destY);
- return;
- }
-
- /* Streching case */
- int xImagePtr = scalePixmap(xDisplay, srcImage.pixmap, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false, false);
- OS.XPutImage(xDisplay, xDrawable, handle, xImagePtr, 0, 0, destX, destY, destWidth, destHeight);
- OS.XDestroyImage(xImagePtr);
-}
-static int scalePixmap(int display, int pixmap, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean flipX, boolean flipY) {
- int xSrcImagePtr = OS.XGetImage(display, pixmap, srcX, srcY, srcWidth, srcHeight, OS.AllPlanes, OS.ZPixmap);
- if (xSrcImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- XImage xSrcImage = new XImage();
- OS.memmove(xSrcImage, xSrcImagePtr, XImage.sizeof);
- byte[] srcData = new byte[xSrcImage.bytes_per_line * xSrcImage.height];
- OS.memmove(srcData, xSrcImage.data, srcData.length);
- int error = 0, xImagePtr = 0;
- int visual = OS.XDefaultVisual(display, OS.XDefaultScreen(display));
- switch (xSrcImage.bits_per_pixel) {
- case 1: {
- int bitOrder = xSrcImage.bitmap_bit_order == OS.MSBFirst ? ImageData.MSB_FIRST : ImageData.LSB_FIRST;
- int bplX = ((destWidth + 7) / 8 + 3) & 0xFFFC;
- int bufSize = bplX * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 1, xSrcImage.bytes_per_line, bitOrder, 0, 0, srcWidth, srcHeight, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 1, bplX, bitOrder, 0, 0, destWidth, destHeight, null, null, null,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImagePtr = OS.XCreateImage(display, visual, 1, OS.XYBitmap, 0, bufPtr, destWidth, destHeight, 32, bplX);
- if (xImagePtr == 0) break;
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- xImage.byte_order = OS.MSBFirst;
- xImage.bitmap_unit = 8;
- xImage.bitmap_bit_order = xSrcImage.bitmap_bit_order;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- break;
- }
- case 4: {
- /* Untested */
- int bplX = (destWidth + 3) & 0xFFFC;
- int bufSize = bplX * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 4, xSrcImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, srcWidth, srcHeight, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 4, bplX, ImageData.MSB_FIRST, 0, 0, destWidth, destHeight, null, null, null,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImagePtr = OS.XCreateImage(display, visual, 4, OS.ZPixmap, 0, bufPtr, destWidth, destHeight, 32, bplX);
- break;
- }
- case 8: {
- int bplX = (destWidth + 3) & 0xFFFC;
- int bufSize = bplX * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 8, xSrcImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, srcWidth, srcHeight, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 8, bplX, ImageData.MSB_FIRST, 0, 0, destWidth, destHeight, null, null, null,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImagePtr = OS.XCreateImage(display, visual, 8, OS.ZPixmap, 0, bufPtr, destWidth, destHeight, 32, bplX);
- break;
- }
- case 16: {
- xImagePtr = OS.XCreateImage(display, visual, 16, OS.ZPixmap, 0, 0, destWidth, destHeight, 32, 0);
- if (xImagePtr == 0) break;
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- int bufSize = xImage.bytes_per_line * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 16, xSrcImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, srcWidth, srcHeight, 0, 0, 0,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 16, xImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, destWidth, destHeight, 0, 0, 0,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImage.data = bufPtr;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- break;
- }
- case 24: {
- xImagePtr = OS.XCreateImage(display, visual, 24, OS.ZPixmap, 0, 0, destWidth, destHeight, 32, 0);
- if (xImagePtr == 0) break;
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- int bufSize = xImage.bytes_per_line * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 24, xSrcImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, srcWidth, srcHeight, 0, 0, 0,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 24, xImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, destWidth, destHeight, 0, 0, 0,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImage.data = bufPtr;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- break;
- }
- case 32: {
- xImagePtr = OS.XCreateImage(display, visual, 24, OS.ZPixmap, 0, 0, destWidth, destHeight, 32, 0);
- if (xImagePtr == 0) break;
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- int bufSize = xImage.bytes_per_line * destHeight;
- byte[] buf = new byte[bufSize];
- ImageData.blit(ImageData.BLIT_SRC,
- srcData, 32, xSrcImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, srcWidth, srcHeight, 0, 0, 0,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 32, xImage.bytes_per_line, ImageData.MSB_FIRST, 0, 0, destWidth, destHeight, 0, 0, 0,
- flipX, flipY);
- int bufPtr = OS.XtMalloc(bufSize);
- OS.memmove(bufPtr, buf, bufSize);
- xImage.data = bufPtr;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- break;
- }
- default:
- error = SWT.ERROR_UNSUPPORTED_DEPTH;
- }
- OS.XDestroyImage(xSrcImagePtr);
- if (xImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (error != 0) {
- if (xImagePtr != 0) OS.XDestroyImage(xImagePtr);
- SWT.error(error);
- }
- return xImagePtr;
-}
-/**
- * Draws a line, using the foreground color, between the points
- * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
- *
- * @param x1 the first point's x coordinate
- * @param y1 the first point's y coordinate
- * @param x2 the second point's x coordinate
- * @param y2 the second point's y coordinate
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawLine (int x1, int y1, int x2, int y2) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- OS.XDrawLine (data.display, data.drawable, handle, x1, y1, x2, y2);
-}
-/**
- * Draws the outline of an oval, using the foreground color,
- * within the specified rectangular area.
- * <p>
- * The result is a circle or ellipse that fits within the
- * rectangle specified by the <code>x</code>, <code>y</code>,
- * <code>width</code>, and <code>height</code> arguments.
- * </p><p>
- * The oval covers an area that is <code>width + 1</code>
- * pixels wide and <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper left corner of the oval to be drawn
- * @param y the y coordinate of the upper left corner of the oval to be drawn
- * @param width the width of the oval to be drawn
- * @param height the height of the oval to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawOval(int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.XDrawArc(data.display, data.drawable, handle, x, y, width, height, 0, 23040);
-}
-/**
- * Draws the closed polygon which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the vertices of the polygon. Lines are drawn between
- * each consecutive pair, and between the first pair and last pair in the
- * array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- // Motif does not have a native drawPolygon() call. Instead we ensure
- // that the first and last points are the same and call drawPolyline().
-
- int length = pointArray.length;
-
- // Need at least 3 points to define the polygon. If 2 or fewer points
- // passed in, it is either a line or point so just call drawPolyline().
- // Check what happens when XOR is implemented. We may not be able to
- // do this optimization.
-
- if (length < 4) {
- drawPolyline(pointArray);
- return;
- }
-
- // If first and last points are the same, the polygon is already closed.
- // Just call drawPolyline().
- //
- // Check what happens when XOR is implemented. We may not be able to
- // do this optimization.
-
- if (pointArray[0] == pointArray[length - 2] && (pointArray[1] == pointArray[length - 1])) {
- drawPolyline(pointArray);
- return;
- }
-
- // Grow the list of points by one element and make sure the first and last
- // points are the same. This will close the polygon and we can use the
- // drawPolyline() call.
-
- int newPoints[] = new int[length + 2];
- for (int i = 0; i < length ; i++)
- newPoints[i] = pointArray[i];
- newPoints[length] = pointArray[0];
- newPoints[length + 1] = pointArray[1];
-
- drawPolyline(newPoints);
-}
-/**
- * Draws the polyline which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the corners of the polyline. Lines are drawn between
- * each consecutive pair, but not between the first pair and last pair in
- * the array.
- *
- * @param pointArray an array of alternating x and y values which are the corners of the polyline
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolyline(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- short[] xPoints = new short[pointArray.length];
- for (int i = 0; i<pointArray.length;i++) {
- xPoints[i] = (short) pointArray[i];
- }
- OS.XDrawLines(data.display,data.drawable,handle,xPoints,xPoints.length / 2, OS.CoordModeOrigin);
-}
-/**
- * Draws the outline of the rectangle specified by the arguments,
- * using the receiver's foreground color. The left and right edges
- * of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- OS.XDrawRectangle (data.display, data.drawable, handle, x, y, width, height);
-}
-/**
- * Draws the outline of the specified rectangle, using the receiver's
- * foreground color. The left and right edges of the rectangle are at
- * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
- * and bottom edges are at <code>rect.y</code> and
- * <code>rect.y + rect.height</code>.
- *
- * @param rect the rectangle to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Draws the outline of the round-cornered rectangle specified by
- * the arguments, using the receiver's foreground color. The left and
- * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- * The <em>roundness</em> of the corners is specified by the
- * <code>arcWidth</code> and <code>arcHeight</code> arguments.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- // X does not have a native for drawing round rectangles. Do the work in Java
- // and use drawLine() drawArc() calls.
-
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny - nh;
- }
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- int naw2 = naw / 2;
- int nah2 = nah / 2;
-
- int xDisplay = data.display;
- int xDrawable = data.drawable;
-
- if (nw > naw) {
- if (nh > nah) {
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny, naw, nah, 5760, 5760);
- OS.XDrawLine(xDisplay, xDrawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
- OS.XDrawArc(xDisplay, xDrawable, handle, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.XDrawLine(xDisplay, xDrawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
- OS.XDrawArc(xDisplay, xDrawable, handle, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.XDrawLine(xDisplay,xDrawable,handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny + nh - nah, naw, nah, 11520, 5760);
- OS.XDrawLine(xDisplay, xDrawable, handle, nx, ny + nah2, nx, ny + nh - nah2);
- } else {
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny, naw, nh, 5760, 11520);
- OS.XDrawLine(xDisplay, xDrawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
- OS.XDrawArc(xDisplay, xDrawable, handle, nx + nw - naw, ny, naw, nh, 17280, 11520);
- OS.XDrawLine(xDisplay,xDrawable,handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
- }
- } else {
- if (nh > nah) {
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny, nw, nah, 0, 11520);
- OS.XDrawLine(xDisplay, xDrawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny + nh - nah, nw, nah, 11520, 11520);
- OS.XDrawLine(xDisplay,xDrawable,handle, nx, ny + nah2, nx, ny + nh - nah2);
- } else {
- OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny, nw, nh, 0, 23040);
- }
- }
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. The background of the rectangular area where
- * the string is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y) {
- drawString(string, x, y, false);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the string is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y, boolean isTransparent) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreate (buffer, OS.XmFONTLIST_DEFAULT_TAG);
- if (isTransparent) {
- OS.XmStringDraw (data.display, data.drawable, data.fontList, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null);
- } else {
- OS.XmStringDrawImage (data.display, data.drawable, data.fontList, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null);
- }
-// OS.XmStringDrawUnderline (display, drawable, fontList, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null, 0);
- OS.XmStringFree (xmString);
-}
-void createRenderTable() {
- int xDisplay = data.display;
- int fontList = data.fontList;
- /* Get the width of the tabs */
- byte[] buffer = {(byte)' ', 0};
- int xmString = OS.XmStringCreate(buffer, OS.XmFONTLIST_DEFAULT_TAG);
- int tabWidth = OS.XmStringWidth(fontList, xmString) * 8;
- OS.XmStringFree(xmString);
-
- /* Create the tab list */
- int [] tabs = new int[16];
- int tab = OS.XmTabCreate(tabWidth, (byte) OS.XmPIXELS, (byte) OS.XmRELATIVE, (byte) OS.XmALIGNMENT_BEGINNING, null);
- for (int i = 0; i < tabs.length; i++) tabs[i] = tab;
- int tabList = OS.XmTabListInsertTabs(0, tabs, tabs.length, 0);
-
- /* Create a font context to iterate over the elements in the font list */
- int[] fontBuffer = new int[1];
- if (!OS.XmFontListInitFontContext(fontBuffer, fontList)) {
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int context = fontBuffer[0], fontListEntry = 0;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- int[] renditions = new int[4]; int renditionCount = 0;
-
- /* Create a rendition for each entry in the font list */
- int shellHandle = OS.XtAppCreateShell (null, null, widgetClass, xDisplay, null, 0);
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, fontBuffer);
- int fontType = (fontBuffer [0] == 0) ? OS.XmFONT_IS_FONT : OS.XmFONT_IS_FONTSET;
- if (fontPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int [] argList = {
- OS.XmNtabList, tabList,
- OS.XmNfont, fontPtr,
- OS.XmNfontType, fontType,
- };
- int rendition = OS.XmRenditionCreate(shellHandle, OS.XmFONTLIST_DEFAULT_TAG, argList, argList.length / 2);
- renditions[renditionCount++] = rendition;
- if (renditionCount == renditions.length) {
- int[] newArray = new int[renditions.length + 4];
- System.arraycopy(newArray, 0, renditions, 0, renditionCount);
- renditions = newArray;
- }
- }
- OS.XmFontListFreeFontContext(context);
- OS.XmTabFree(tab);
- OS.XmTabListFree(tabList);
- OS.XtDestroyWidget (shellHandle);
-
- /* Create the render table from the renditions */
- data.renderTable = OS.XmRenderTableAddRenditions(0, renditions, renditionCount, OS.XmMERGE_REPLACE);
- for (int i = 0; i < renditionCount; i++) OS.XmRenditionFree(renditions[i]);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. The background of the rectangular area where
- * the text is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y) {
- drawText(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, boolean isTransparent) {
- int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB;
- if (isTransparent) flags |= SWT.DRAW_TRANSPARENT;
- drawText(string, x, y, flags);
-}
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion, line delimiter and mnemonic
- * processing are performed according to the specified flags. If
- * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- * <p>
- * The parameter <code>flags</code> may be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * </p>
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param flags the flags specifing how to process the text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, int flags) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (data.renderTable == 0) createRenderTable();
- int renderTable = data.renderTable;
-
- char mnemonic=0;
- int tableLength = 0;
- Device device = data.device;
- int[] parseTable = new int[2];
- char[] text = new char[string.length()];
- string.getChars(0, text.length, text, 0);
- if ((flags & SWT.DRAW_DELIMITER) != 0) parseTable[tableLength++] = device.crMapping;
- if ((flags & SWT.DRAW_TAB) != 0) parseTable[tableLength++] = device.tabMapping;
- if ((flags & SWT.DRAW_MNEMONIC) != 0) mnemonic = stripMnemonic(text);
-
- String codePage = getCodePage();
- byte[] buffer = Converter.wcsToMbcs(codePage, text, true);
- int xmString = OS.XmStringParseText(buffer, 0, OS.XmFONTLIST_DEFAULT_TAG, OS.XmCHARSET_TEXT, parseTable, tableLength, 0);
- if (mnemonic != 0) {
- byte [] buffer1 = Converter.wcsToMbcs(codePage, new char[]{mnemonic}, true);
- int xmStringUnderline = OS.XmStringCreate (buffer1, OS.XmFONTLIST_DEFAULT_TAG);
- OS.XmStringDrawUnderline(data.display, data.drawable, renderTable, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null, xmStringUnderline);
- OS.XmStringFree(xmStringUnderline);
- } else {
- if ((flags & SWT.DRAW_TRANSPARENT) != 0) {
- OS.XmStringDraw(data.display, data.drawable, renderTable, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null);
- } else {
- OS.XmStringDrawImage(data.display, data.drawable, renderTable, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null);
- }
- }
- OS.XmStringFree(xmString);
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof GC)) return false;
- return handle == ((GC)object).handle;
-}
-/**
- * Fills the interior of a circular or elliptical arc within
- * the specified rectangular area, with the receiver's background
- * color.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be filled
- * @param y the y coordinate of the upper-left corner of the arc to be filled
- * @param width the width of the arc to be filled
- * @param height the height of the arc to be filled
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawArc
- */
-public void fillArc(int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- int xDisplay = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground (xDisplay, handle, values.background);
- OS.XFillArc(xDisplay,data.drawable,handle,x,y,width,height,startAngle * 64 ,endAngle * 64);
- OS.XSetForeground (xDisplay, handle, values.foreground);
-}
-
-/**
- * Fills the interior of the specified rectangle with a gradient
- * sweeping from left to right or top to bottom progressing
- * from the receiver's foreground color to its background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled, may be negative
- * (inverts direction of gradient if horizontal)
- * @param height the height of the rectangle to be filled, may be negative
- * (inverts direction of gradient if vertical)
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if ((width == 0) || (height == 0)) return;
- int xDisplay = data.display;
- int xScreenNum = OS.XDefaultScreen(xDisplay);
- XGCValues values = new XGCValues();
- int fromColor, toColor;
- OS.XGetGCValues(xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
- fromColor = values.foreground;
- toColor = values.background;
- boolean swapColors = false;
- if (width < 0) {
- x += width; width = -width;
- if (! vertical) swapColors = true;
- }
- if (height < 0) {
- y += height; height = -height;
- if (vertical) swapColors = true;
- }
- if (swapColors) {
- final int t = fromColor;
- fromColor = toColor;
- toColor = t;
- }
- if (fromColor == toColor) {
- OS.XFillRectangle(xDisplay, data.drawable, handle, x, y, width, height);
- return;
- }
- /* X Window deals with a virtually limitless array of color formats
- * but we only distinguish between paletted and direct modes
- */
- final int xScreen = OS.XDefaultScreenOfDisplay(xDisplay);
- final int xVisual = OS.XDefaultVisual(xDisplay, xScreenNum);
- Visual visual = new Visual();
- OS.memmove(visual, xVisual, visual.sizeof);
- final int depth = OS.XDefaultDepthOfScreen(xScreen);
- final boolean directColor = (depth > 8);
-
- // This code is intentionally commented since elsewhere in SWT we
- // assume that depth <= 8 means we are in a paletted mode though
- // this is not always the case.
- //final boolean directColor = (visual.c_class == OS.TrueColor) || (visual.c_class == OS.DirectColor);
-
- XColor xColor = new XColor();
- xColor.pixel = fromColor;
- OS.XQueryColor(xDisplay, data.colormap, xColor);
- final RGB fromRGB = new RGB((xColor.red & 0xffff) >>> 8, (xColor.green & 0xffff) >>> 8, (xColor.blue & 0xffff) >>> 8);
- xColor.pixel = toColor;
- OS.XQueryColor(xDisplay, data.colormap, xColor);
- final RGB toRGB = new RGB((xColor.red & 0xffff) >>> 8, (xColor.green & 0xffff) >>> 8, (xColor.blue & 0xffff) >>> 8);
-
- final int redBits, greenBits, blueBits;
- if (directColor) {
- // RGB mapped display
- redBits = getChannelWidth(visual.red_mask);
- greenBits = getChannelWidth(visual.green_mask);
- blueBits = getChannelWidth(visual.blue_mask);
- } else {
- // Index display
- redBits = greenBits = blueBits = 0;
- }
- ImageData.fillGradientRectangle(this, data.device,
- x, y, width, height, vertical, fromRGB, toRGB,
- redBits, greenBits, blueBits);
-}
-
-/**
- * Computes the required channel width (depth) from a mask.
- */
-static int getChannelWidth(int mask) {
- int width = 0;
- while (mask != 0) {
- width += (mask & 1);
- mask >>>= 1;
- }
- return width;
-}
-
-/**
- * Fills the interior of an oval, within the specified
- * rectangular area, with the receiver's background
- * color.
- *
- * @param x the x coordinate of the upper left corner of the oval to be filled
- * @param y the y coordinate of the upper left corner of the oval to be filled
- * @param width the width of the oval to be filled
- * @param height the height of the oval to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawOval
- */
-public void fillOval (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- int display = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (display, handle, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground (display, handle, values.background);
- OS.XFillArc (display, data.drawable, handle, x, y, width, height, 0, 23040);
- OS.XSetForeground (display, handle, values.foreground);
-}
-/**
- * Fills the interior of the closed polygon which is defined by the
- * specified array of integer coordinates, using the receiver's
- * background color. The array contains alternating x and y values
- * which are considered to represent points which are the vertices of
- * the polygon. Lines are drawn between each consecutive pair, and
- * between the first pair and last pair in the array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawPolygon
- */
-public void fillPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- short[] xPoints = new short[pointArray.length];
- for (int i = 0; i<pointArray.length;i++) {
- xPoints[i] = (short) pointArray[i];
- }
- int xDisplay = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground (xDisplay, handle, values.background);
- OS.XFillPolygon(xDisplay, data.drawable, handle,xPoints, xPoints.length / 2, OS.Complex, OS.CoordModeOrigin);
- OS.XSetForeground (xDisplay, handle, values.foreground);
-}
-/**
- * Fills the interior of the rectangle specified by the arguments,
- * using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- int xDisplay = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground (xDisplay, handle, values.background);
- OS.XFillRectangle (xDisplay, data.drawable, handle, x, y, width, height);
- OS.XSetForeground (xDisplay, handle, values.foreground);
-}
-/**
- * Fills the interior of the specified rectangle, using the receiver's
- * background color.
- *
- * @param rectangle the rectangle to be filled
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- fillRectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Fills the interior of the round-cornered rectangle specified by
- * the arguments, using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRoundRectangle
- */
-public void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int nx = x;
- int ny = y;
- int nw = width;
- int nh = height;
- int naw = arcWidth;
- int nah = arcHeight;
-
- if (nw < 0) {
- nw = 0 - nw;
- nx = nx - nw;
- }
- if (nh < 0) {
- nh = 0 - nh;
- ny = ny -nh;
- }
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- int naw2 = naw / 2;
- int nah2 = nah / 2;
-
- int xDisplay = data.display;
- int xDrawable = data.drawable;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues(xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground(xDisplay, handle, values.background);
-
- if (nw > naw) {
- if (nh > nah) {
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny, naw, nah, 5760, 5760);
- OS.XFillRectangle(xDisplay, xDrawable, handle, nx + naw2, ny, nw - naw, nah2);
- OS.XFillArc(xDisplay, xDrawable, handle, nx + nw - naw, ny, naw, nah, 0, 5760);
- OS.XFillRectangle(xDisplay, xDrawable, handle, nx, ny + nah2, nw, nh - nah);
- OS.XFillArc(xDisplay, xDrawable, handle, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
- OS.XFillRectangle(xDisplay, xDrawable, handle, nx + naw2, ny + nh - nah2, nw - naw, nah2);
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny + nh - nah, naw, nah, 11520, 5760);
- } else {
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny, naw, nh, 5760, 11520);
- OS.XFillRectangle(xDisplay, xDrawable, handle, nx + naw2, ny, nw - naw, nh);
- OS.XFillArc(xDisplay, xDrawable, handle, nx + nw - naw, ny, naw, nh, 17280, 11520);
- }
- } else {
- if (nh > nah) {
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny, nw, nah, 0, 11520);
- OS.XFillRectangle(xDisplay, xDrawable, handle, nx, ny + nah2, nw, nh - nah);
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny + nh - nah, nw, nah, 11520, 11520);
- } else {
- OS.XFillArc(xDisplay, xDrawable, handle, nx, ny, nw, nh, 0, 23040);
- }
- }
- OS.XSetForeground(xDisplay, handle, values.foreground);
-}
-/**
- * Returns the <em>advance width</em> of the specified character in
- * the font which is currently selected into the receiver.
- * <p>
- * The advance width is defined as the horizontal distance the cursor
- * should move after printing the character in the selected font.
- * </p>
- *
- * @param ch the character to measure
- * @return the distance in the x direction to move past the character before painting the next
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getAdvanceWidth(char ch) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int fontList = data.fontList;
- byte[] charBuffer = Converter.wcsToMbcs(getCodePage (), new char[] { ch }, false);
- int val = charBuffer[0] & 0xFF;
- /* Create a font context to iterate over each element in the font list */
- int[] buffer = new int[1];
- if (!OS.XmFontListInitFontContext(buffer, fontList)) {
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int context = buffer[0];
- XFontStruct fontStruct = new XFontStruct();
- XCharStruct charStruct = new XCharStruct();
- int fontListEntry;
- int[] fontStructPtr = new int[1];
- int[] fontNamePtr = new int[1];
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == 0) {
- OS.memmove(fontStruct, fontPtr, XFontStruct.sizeof);
- /* FontList contains a single font */
- if (fontStruct.min_byte1 == 0 && fontStruct.max_byte1 == 0) {
- /* Single byte fontStruct */
- if (fontStruct.min_char_or_byte2 <= val && val <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- OS.memmove(charStruct, fontStruct.per_char + ((val - fontStruct.min_char_or_byte2) * XCharStruct.sizeof), XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.width;
- }
- }
- } else {
- /* Double byte fontStruct */
- int charsPerRow = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int row = 0;
- if (charBuffer.length > 1) row = charBuffer[1] - fontStruct.min_byte1;
- int col = charBuffer[0] - fontStruct.min_char_or_byte2;
- if (row <= fontStruct.max_byte1 && col <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- int offset = row * charsPerRow + col;
- OS.memmove(charStruct, fontStruct.per_char + offset * XCharStruct.sizeof, XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.width;
- }
- }
- }
- } else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet(fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int[nFonts];
- OS.memmove(fontStructs, fontStructPtr[0], nFonts * 4);
- /* Go through each fontStruct in the font set */
- for (int i = 0; i < nFonts; i++) {
- OS.memmove(fontStruct, fontStructs[i], XFontStruct.sizeof);
- if (fontStruct.min_byte1 == 0 && fontStruct.max_byte1 == 0) {
- /* Single byte fontStruct */
- if (fontStruct.min_char_or_byte2 <= val && val <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- OS.memmove(charStruct, fontStruct.per_char + (val - fontStruct.min_char_or_byte2 * XCharStruct.sizeof), XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.width;
- }
- }
- } else {
- /* Double byte fontStruct */
- int charsPerRow = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int row = 0;
- if (charBuffer.length > 1) row = charBuffer[1] - fontStruct.min_byte1;
- int col = charBuffer[0] - fontStruct.min_char_or_byte2;
- if (row <= fontStruct.max_byte1 && col <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- int offset = row * charsPerRow + col;
- OS.memmove(charStruct, fontStruct.per_char + offset * XCharStruct.sizeof, XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.width;
- }
- }
- }
- }
- }
- }
- OS.XmFontListFreeFontContext(context);
- return 0;
-}
-/**
- * Returns the background color.
- *
- * @return the receiver's background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int xDisplay = data.display;
- XGCValues values = new XGCValues();
- OS.XGetGCValues(xDisplay, handle, OS.GCBackground, values);
- XColor xColor = new XColor();
- xColor.pixel = values.background;
- OS.XQueryColor(xDisplay,data.colormap,xColor);
- return Color.motif_new(data.device, xColor);
-
-}
-/**
- * Returns the width of the specified character in the font
- * selected into the receiver.
- * <p>
- * The width is defined as the space taken up by the actual
- * character, not including the leading and tailing whitespace
- * or overhang.
- * </p>
- *
- * @param ch the character to measure
- * @return the width of the character
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getCharWidth(char ch) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int fontList = data.fontList;
- byte[] charBuffer = Converter.wcsToMbcs(getCodePage (), new char[] { ch }, false);
- int val = charBuffer[0] & 0xFF;
- /* Create a font context to iterate over each element in the font list */
- int[] buffer = new int[1];
- if (!OS.XmFontListInitFontContext(buffer, fontList)) {
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int context = buffer[0];
- XFontStruct fontStruct = new XFontStruct();
- XCharStruct charStruct = new XCharStruct();
- int fontListEntry;
- int[] fontStructPtr = new int[1];
- int[] fontNamePtr = new int[1];
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == 0) {
- OS.memmove(fontStruct, fontPtr, XFontStruct.sizeof);
- /* FontList contains a single font */
- if (fontStruct.min_byte1 == 0 && fontStruct.max_byte1 == 0) {
- /* Single byte fontStruct */
- if (fontStruct.min_char_or_byte2 <= val && val <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- OS.memmove(charStruct, fontStruct.per_char + ((val - fontStruct.min_char_or_byte2) * XCharStruct.sizeof), XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.rbearing - charStruct.lbearing;
- }
- }
- } else {
- /* Double byte fontStruct */
- int charsPerRow = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int row = 0;
- if (charBuffer.length > 1) row = charBuffer[1] - fontStruct.min_byte1;
- int col = charBuffer[0] - fontStruct.min_char_or_byte2;
- if (row <= fontStruct.max_byte1 && col <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- int offset = row * charsPerRow + col;
- OS.memmove(charStruct, fontStruct.per_char + offset * XCharStruct.sizeof, XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.rbearing - charStruct.lbearing;
- }
- }
- }
- } else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet(fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int[nFonts];
- OS.memmove(fontStructs, fontStructPtr[0], nFonts * 4);
- /* Go through each fontStruct in the font set */
- for (int i = 0; i < nFonts; i++) {
- OS.memmove(fontStruct, fontStructs[i], XFontStruct.sizeof);
- if (fontStruct.min_byte1 == 0 && fontStruct.max_byte1 == 0) {
- /* Single byte fontStruct */
- if (fontStruct.min_char_or_byte2 <= val && val <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- OS.memmove(charStruct, fontStruct.per_char + (val - fontStruct.min_char_or_byte2 * XCharStruct.sizeof), XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.rbearing - charStruct.lbearing;
- }
- }
- } else {
- /* Double byte fontStruct */
- int charsPerRow = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int row = 0;
- if (charBuffer.length > 1) row = charBuffer[1] - fontStruct.min_byte1;
- int col = charBuffer[0] - fontStruct.min_char_or_byte2;
- if (row <= fontStruct.max_byte1 && col <= fontStruct.max_char_or_byte2) {
- /* The font contains the character */
- int offset = row * charsPerRow + col;
- OS.memmove(charStruct, fontStruct.per_char + offset * XCharStruct.sizeof, XCharStruct.sizeof);
- if (charStruct.width != 0) {
- OS.XmFontListFreeFontContext(context);
- return charStruct.rbearing - charStruct.lbearing;
- }
- }
- }
- }
- }
- }
- OS.XmFontListFreeFontContext(context);
- return 0;
-}
-/**
- * Returns the bounding rectangle of the receiver's clipping
- * region. If no clipping region is set, the return value
- * will be a rectangle which covers the entire bounds of the
- * object the receiver is drawing on.
- *
- * @return the bounding rectangle of the clipping region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getClipping() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int clipRgn = data.clipRgn;
- if (clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.XGetGeometry(data.display, data.drawable, unused, unused, unused, width, height, unused, unused);
- return new Rectangle(0, 0, width[0], height[0]);
- }
- XRectangle rect = new XRectangle();
- OS.XClipBox(clipRgn, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the region managed by the argument to the current
- * clipping region of the receiver.
- *
- * @param region the region to fill with the clipping region
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void getClipping(Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int hRegion = region.handle;
- int clipRgn = data.clipRgn;
- if (clipRgn == 0) {
- int[] width = new int[1]; int[] height = new int[1];
- int[] unused = new int[1];
- OS.XGetGeometry(data.display, data.drawable, unused, unused, unused, width, height, unused, unused);
- OS.XSubtractRegion (hRegion, hRegion, hRegion);
- XRectangle rect = new XRectangle();
- rect.x = 0; rect.y = 0;
- rect.width = (short)width[0]; rect.height = (short)height[0];
- OS.XUnionRectWithRegion(rect, hRegion, hRegion);
- return;
- }
- OS.XSubtractRegion (hRegion, hRegion, hRegion);
- OS.XUnionRegion (clipRgn, hRegion, hRegion);
-}
-String getCodePage () {
- return Converter.getCodePage(data.display, data.fontList);
-}
-/**
- * Returns the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getFont () {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return Font.motif_new(data.device, data.fontList);
-}
-int getFontHeight () {
- int fontList = data.fontList;
- /* Create a font context to iterate over each element in the font list */
- int [] buffer = new int [1];
- if (!OS.XmFontListInitFontContext (buffer, fontList)) {
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int context = buffer [0];
-
- /* Values discovering during iteration */
- int height = 0;
- XFontStruct fontStruct = new XFontStruct ();
- int fontListEntry;
- int [] fontStructPtr = new int [1];
- int [] fontNamePtr = new int [1];
-
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry (context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont (fontListEntry, buffer);
- if (buffer [0] == 0) {
- /* FontList contains a single font */
- OS.memmove (fontStruct, fontPtr, XFontStruct.sizeof);
- int fontHeight = fontStruct.ascent + fontStruct.descent;
- if (fontHeight > height) height = fontHeight;
- } else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet (fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int [nFonts];
- OS.memmove (fontStructs, fontStructPtr [0], nFonts * 4);
-
- /* Go through each fontStruct in the font set */
- for (int i=0; i<nFonts; i++) {
- OS.memmove (fontStruct, fontStructs[i], XFontStruct.sizeof);
- int fontHeight = fontStruct.ascent + fontStruct.descent;
- if (fontHeight > height) height = fontHeight;
- }
- }
- }
-
- OS.XmFontListFreeFontContext (context);
- return height;
-}
-/**
- * Returns a FontMetrics which contains information
- * about the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return font metrics for the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontMetrics getFontMetrics() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int xDisplay = data.display;
- int fontList = data.fontList;
- /* Create a font context to iterate over each element in the font list */
- int[] buffer = new int[1];
- if (!OS.XmFontListInitFontContext(buffer, fontList)) {
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int context = buffer[0];
- /* Values discovering during iteration */
- int ascent = 0;
- int descent = 0;
- int averageCharWidth = 0, numAverageCharWidth = 0;
- int leading = 0;
- int height = 0;
-
- XFontStruct fontStruct = new XFontStruct();
- int fontListEntry;
- int[] fontStructPtr = new int[1];
- int[] fontNamePtr = new int[1];
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == 0) {
- /* FontList contains a single font */
- OS.memmove(fontStruct, fontPtr, XFontStruct.sizeof);
- ascent = ascent > fontStruct.max_bounds_ascent ? ascent : fontStruct.max_bounds_ascent;
- descent = descent > fontStruct.descent ? descent : fontStruct.descent;
- int tmp = fontStruct.ascent + fontStruct.descent;
- height = height > tmp ? height : tmp;
- tmp = fontStruct.ascent - fontStruct.max_bounds_ascent;
- leading = leading > tmp ? leading : tmp;
- /* Calculate average character width */
- int propPtr = fontStruct.properties;
- for (int i = 0; i < fontStruct.n_properties; i++) {
- /* Reef through properties looking for XAFONT */
- int[] prop = new int[2];
- OS.memmove(prop, propPtr, 8);
- if (prop[0] == OS.XA_FONT) {
- /* Found it, prop[1] points to the string */
- StringBuffer stringBuffer = new StringBuffer();
- int ptr = OS.XmGetAtomName(xDisplay, prop[1]);
- int strPtr = ptr;
- byte[] c = new byte[1];
- OS.memmove(c, strPtr, 1);
- while (c[0] != 0) {
- stringBuffer.append((char)c[0]);
- strPtr++;
- OS.memmove(c, strPtr, 1);
- }
- String xlfd = stringBuffer.toString().toLowerCase();
- int avg = FontData.motif_new(xlfd).averageWidth / 10;
- OS.XtFree(ptr);
- if (avg == 0) {
- /**
- * Not all fonts have average character width encoded
- * in the xlfd. This one doesn't, so do it the hard
- * way by averaging all the character widths.
- */
- int sum = 0, count = 0;
- int cols = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int perCharPtr = fontStruct.per_char;
- XCharStruct struct = new XCharStruct();
- for (int index = 0; index < cols; index++) {
- OS.memmove(struct, perCharPtr + (index * XCharStruct.sizeof), XCharStruct.sizeof);
- int w = struct.width;
- if (w != 0) {
- sum += w;
- count++;
- }
- }
- averageCharWidth += sum / count;
- } else {
- /* Average character width was in the xlfd */
- averageCharWidth += avg;
- }
- numAverageCharWidth++;
- break;
- }
- propPtr += 8;
- }
- }
- else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet(fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int[nFonts];
- OS.memmove(fontStructs, fontStructPtr[0], nFonts * 4);
- /* Go through each fontStruct in the font set */
- for (int i = 0; i < nFonts; i++) {
- OS.memmove(fontStruct, fontStructs[i], XFontStruct.sizeof);
- ascent = ascent > fontStruct.max_bounds_ascent ? ascent : fontStruct.max_bounds_ascent;
- descent = descent > fontStruct.descent ? descent : fontStruct.descent;
- int tmp = fontStruct.ascent + fontStruct.descent;
- height = height > tmp ? height : tmp;
- tmp = fontStruct.ascent - fontStruct.max_bounds_ascent;
- leading = leading > tmp ? leading : tmp;
- /* Calculate average character width */
- int propPtr = fontStruct.properties;
- for (int j = 0; j < fontStruct.n_properties; j++) {
- /* Reef through properties looking for XAFONT */
- int[] prop = new int[2];
- OS.memmove(prop, propPtr, 8);
- if (prop[0] == OS.XA_FONT) {
- /* Found it, prop[1] points to the string */
- StringBuffer stringBuffer = new StringBuffer();
- int ptr = OS.XmGetAtomName(xDisplay, prop[1]);
- int strPtr = ptr;
- byte[] c = new byte[1];
- OS.memmove(c, strPtr, 1);
- while (c[0] != 0) {
- stringBuffer.append((char)c[0]);
- strPtr++;
- OS.memmove(c, strPtr, 1);
- }
- String xlfd = stringBuffer.toString().toLowerCase();
- int avg = FontData.motif_new(xlfd).averageWidth / 10;
- OS.XFree(ptr);
- if (avg == 0) {
- /**
- * Not all fonts have average character width encoded
- * in the xlfd. This one doesn't, so do it the hard
- * way by averaging all the character widths.
- */
- int sum = 0, count = 0;
- int cols = fontStruct.max_char_or_byte2 - fontStruct.min_char_or_byte2 + 1;
- int perCharPtr = fontStruct.per_char;
- XCharStruct struct = new XCharStruct();
- for (int index = 0; index < cols; index++) {
- OS.memmove(struct, perCharPtr + (index * XCharStruct.sizeof), XCharStruct.sizeof);
- int w = struct.width;
- if (w != 0) {
- sum += w;
- count++;
- }
- }
- averageCharWidth += sum / count;
- } else {
- /* Average character width was in the xlfd */
- averageCharWidth += avg;
- }
- numAverageCharWidth++;
- break;
- }
- propPtr += 8;
- }
- }
- }
- }
- OS.XmFontListFreeFontContext(context);
- return FontMetrics.motif_new(ascent, descent, averageCharWidth / numAverageCharWidth, leading, height);
-}
-/**
- * Returns the receiver's foreground color.
- *
- * @return the color used for drawing foreground things
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getForeground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int xDisplay = data.display;
- XGCValues values = new XGCValues();
- OS.XGetGCValues(xDisplay, handle, OS.GCForeground, values);
- XColor xColor = new XColor();
- xColor.pixel = values.foreground;
- OS.XQueryColor(xDisplay,data.colormap,xColor);
- return Color.motif_new(data.device, xColor);
-
-}
-/**
- * Returns the receiver's line style, which will be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @return the style used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineStyle() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.lineStyle;
-}
-/**
- * Returns the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @return the receiver's line width
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineWidth() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- XGCValues values = new XGCValues();
- OS.XGetGCValues(data.display, handle, OS.GCLineWidth, values);
- return values.line_width;
-}
-/**
- * Returns <code>true</code> if this GC is drawing in the mode
- * where the resulting color in the destination is the
- * <em>exclusive or</em> of the color values in the source
- * and the destination, and <code>false</code> if it is
- * drawing in the mode where the destination color is being
- * replaced with the source color value.
- *
- * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getXORMode() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (data.display, handle, OS.GCFunction, values);
- return values.function == OS.GXxor;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-void init(Drawable drawable, GCData data, int xGC) {
- int xDisplay = data.display;
- int foreground = data.foreground;
- if (foreground != -1) OS.XSetForeground (xDisplay, xGC, foreground);
- int background = data.background;
- if (background != -1) OS.XSetBackground (xDisplay, xGC, background);
- Image image = data.image;
- if (image != null) {
- image.memGC = this;
- /*
- * The transparent pixel mask might change when drawing on
- * the image. Destroy it so that it is regenerated when
- * necessary.
- */
- if (image.transparentPixel != -1) image.destroyMask();
- }
- this.drawable = drawable;
- this.data = data;
- handle = xGC;
-}
-/**
- * Returns <code>true</code> if the receiver has a clipping
- * region set into it, and <code>false</code> otherwise.
- * If this method returns false, the receiver will draw on all
- * available space in the destination. If it returns true,
- * it will draw only in the area that is covered by the region
- * that can be accessed with <code>getClipping(region)</code>.
- *
- * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isClipped() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.clipRgn != 0;
-}
-/**
- * Returns <code>true</code> if the GC has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the GC.
- * When a GC has been disposed, it is an error to
- * invoke any other method using the GC.
- *
- * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-public static GC motif_new(Drawable drawable, GCData data) {
- GC gc = new GC();
- int xGC = drawable.internal_new_GC(data);
- gc.init(drawable, data, xGC);
- return gc;
-}
-/**
- * Sets the background color. The background color is used
- * for fill operations and as the background color when text
- * is drawn.
- *
- * @param color the new background color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.XSetBackground(data.display, handle, color.handle.pixel);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the arguments.
- *
- * @param x the x coordinate of the clipping rectangle
- * @param y the y coordinate of the clipping rectangle
- * @param width the width of the clipping rectangle
- * @param height the height of the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int clipRgn = data.clipRgn;
- if (clipRgn == 0) {
- clipRgn = OS.XCreateRegion ();
- } else {
- OS.XSubtractRegion (clipRgn, clipRgn, clipRgn);
- }
- XRectangle rect = new XRectangle ();
- rect.x = (short) x; rect.y = (short) y;
- rect.width = (short) width; rect.height = (short) height;
- OS.XSetClipRectangles (data.display, handle, 0, 0, rect, 1, OS.Unsorted);
- OS.XUnionRectWithRegion(rect, clipRgn, clipRgn);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the argument.
- *
- * @param rect the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Rectangle rect) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) {
- OS.XSetClipMask (data.display, handle, OS.None);
- return;
- }
- setClipping (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the region specified
- * by the argument.
- *
- * @param rect the clipping region.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int clipRgn = data.clipRgn;
- if (region == null) {
- OS.XSetClipMask (data.display, handle, OS.None);
- if (clipRgn != 0) {
- OS.XDestroyRegion (clipRgn);
- clipRgn = 0;
- }
- } else {
- if (clipRgn == 0) {
- clipRgn = OS.XCreateRegion ();
- } else {
- OS.XSubtractRegion (clipRgn, clipRgn, clipRgn);
- }
- OS.XUnionRegion (region.handle, clipRgn, clipRgn);
- OS.XSetRegion (data.display, handle, region.handle);
- }
-}
-/**
- * Sets the font which will be used by the receiver
- * to draw and measure text to the argument. If the
- * argument is null, then a default font appropriate
- * for the platform will be used instead.
- *
- * @param font the new font for the receiver, or null to indicate a default font
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setFont (Font font) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (font == null) {
- data.fontList = data.device.systemFont;
- } else {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- data.fontList = font.handle;
- }
- if (data.renderTable != 0) OS.XmRenderTableFree(data.renderTable);
- data.renderTable = 0;
-}
-/**
- * Sets the foreground color. The foreground color is used
- * for drawing operations including when text is drawn.
- *
- * @param color the new foreground color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setForeground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.XSetForeground(data.display, handle, color.handle.pixel);
-}
-/**
- * Sets the receiver's line style to the argument, which must be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @param lineStyle the style to be used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineStyle(int lineStyle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int xDisplay = data.display;
- switch (lineStyle) {
- case SWT.LINE_SOLID:
- data.lineStyle = lineStyle;
- OS.XSetLineAttributes(xDisplay, handle, 0, OS.LineSolid, OS.CapButt, OS.JoinMiter);
- return;
- case SWT.LINE_DASH:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2},2);
- break;
- case SWT.LINE_DOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {3, 1},2);
- break;
- case SWT.LINE_DASHDOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2, 3, 1},4);
- break;
- case SWT.LINE_DASHDOTDOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2, 3, 1, 3, 1},6);
- break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- data.lineStyle = lineStyle;
- OS.XSetLineAttributes(xDisplay, handle, 0, OS.LineDoubleDash, OS.CapButt, OS.JoinMiter);
-
-}
-/**
- * Sets the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @param lineWidth the width of a line
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineWidth(int width) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data.lineStyle == SWT.LINE_SOLID) {
- OS.XSetLineAttributes(data.display, handle, width, OS.LineSolid, OS.CapButt, OS.JoinMiter);
- } else {
- OS.XSetLineAttributes(data.display, handle, width, OS.LineDoubleDash, OS.CapButt, OS.JoinMiter);
- }
-}
-/**
- * If the argument is <code>true</code>, puts the receiver
- * in a drawing mode where the resulting color in the destination
- * is the <em>exclusive or</em> of the color values in the source
- * and the destination, and if the argument is <code>false</code>,
- * puts the receiver in a drawing mode where the destination color
- * is replaced with the source color value.
- *
- * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setXORMode(boolean xor) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (xor)
- OS.XSetFunction(data.display, handle, OS.GXxor);
- else
- OS.XSetFunction(data.display, handle, OS.GXcopy);
-}
-/**
- * Returns the extent of the given string. No tab
- * expansion or carriage return processing will be performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point stringExtent(String string) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (string.length () == 0) return new Point(0, getFontHeight());
- byte[] buffer = Converter.wcsToMbcs(getCodePage (), string, true);
- int xmString = OS.XmStringCreate(buffer, OS.XmFONTLIST_DEFAULT_TAG);
- int fontList = data.fontList;
- int width = OS.XmStringWidth(fontList, xmString);
- int height = OS.XmStringHeight(fontList, xmString);
- OS.XmStringFree(xmString);
- return new Point(width, height);
-}
-char stripMnemonic(char[] text) {
- char mnemonic=0;
- int i=0, j=0;
- while (i < text.length) {
- if ((text [j++] = text [i++]) == '&') {
- if (i == text.length) {continue;}
- if (text [i] == '&') {i++; continue;}
- if (mnemonic == 0) mnemonic = text [i];
- j--;
- }
- }
- while (j < text.length) text [j++] = 0;
- return mnemonic;
-}
-/**
- * Returns the extent of the given string. Tab expansion and
- * carriage return processing are performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string) {
- return textExtent(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
-}
-/**
- * Returns the extent of the given string. Tab expansion, line
- * delimiter and mnemonic processing are performed according to
- * the specified flags, which can be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @param flags the flags specifing how to process the text
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string, int flags) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (string.length () == 0) return new Point(0, getFontHeight());
- if (data.renderTable == 0) createRenderTable();
- int renderTable = data.renderTable;
-
- int tableLength = 0;
- Device device = data.device;
- int[] parseTable = new int[2];
- char[] text = new char[string.length()];
- string.getChars(0, text.length, text, 0);
- if ((flags & SWT.DRAW_DELIMITER) != 0) parseTable[tableLength++] = device.crMapping;
- if ((flags & SWT.DRAW_TAB) != 0) parseTable[tableLength++] = device.tabMapping;
- if ((flags & SWT.DRAW_MNEMONIC) != 0) stripMnemonic(text);
-
- byte[] buffer = Converter.wcsToMbcs(getCodePage(), text, true);
- int xmString = OS.XmStringParseText(buffer, 0, OS.XmFONTLIST_DEFAULT_TAG, OS.XmCHARSET_TEXT, parseTable, tableLength, 0);
- int width = OS.XmStringWidth(renderTable, xmString);
- int height = OS.XmStringHeight(renderTable, xmString);
- OS.XmStringFree(xmString);
- return new Point(width, height);
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "GC {*DISPOSED*}";
- return "GC {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java
deleted file mode 100755
index 3e0af475c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are descriptions of GCs in terms
- * of unallocated platform-specific data fields.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
- * API for SWT. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms, and should never be called from application code.
- * </p>
- *
- * @private
- */
-public final class GCData {
- public Device device;
- public Image image;
- public int display;
- public int drawable;
- public int foreground = -1;
- public int background = -1;
- public int fontList;
- public int colormap;
- public int clipRgn;
- public int lineStyle = SWT.LINE_SOLID;
- public int renderTable;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java
deleted file mode 100755
index 1e17ef0437..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java
+++ /dev/null
@@ -1,1288 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import java.io.*;
-
-/**
- * Instances of this class are graphics which have been prepared
- * for display on a specific device. That is, they are ready
- * to paint using methods such as <code>GC.drawImage()</code>
- * and display on widgets with, for example, <code>Button.setImage()</code>.
- * <p>
- * If loaded from a file format that supports it, an
- * <code>Image</code> may have transparency, meaning that certain
- * pixels are specified as being transparent when drawn. Examples
- * of file formats that support transparency are GIF and PNG.
- * </p><p>
- * There are two primary ways to use <code>Images</code>.
- * The first is to load a graphic file from disk and create an
- * <code>Image</code> from it. This is done using an <code>Image</code>
- * constructor, for example:
- * <pre>
- * Image i = new Image(device, "C:\\graphic.bmp");
- * </pre>
- * A graphic file may contain a color table specifying which
- * colors the image was intended to possess. In the above example,
- * these colors will be mapped to the closest available color in
- * SWT. It is possible to get more control over the mapping of
- * colors as the image is being created, using code of the form:
- * <pre>
- * ImageData data = new ImageData("C:\\graphic.bmp");
- * RGB[] rgbs = data.getRGBs();
- * // At this point, rgbs contains specifications of all
- * // the colors contained within this image. You may
- * // allocate as many of these colors as you wish by
- * // using the Color constructor Color(RGB), then
- * // create the image:
- * Image i = new Image(device, data);
- * </pre>
- * <p>
- * Applications which require even greater control over the image
- * loading process should use the support provided in class
- * <code>ImageLoader</code>.
- * </p><p>
- * Application code must explicitely invoke the <code>Image.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see Color
- * @see ImageData
- * @see ImageLoader
- */
-public final class Image implements Drawable {
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
- */
- public int type;
-
- /**
- * The handle to the OS pixmap resource.
- * Warning: This field is platform dependent.
- */
- public int pixmap;
-
- /**
- * The handle to the OS mask resource.
- * Warning: This field is platform dependent.
- */
- public int mask;
-
- /**
- * The device where this image was created.
- */
- Device device;
-
- /**
- * specifies the transparent pixel
- * (Warning: This field is platform dependent)
- */
- int transparentPixel = -1;
-
- /**
- * The GC the image is currently selected in.
- * Warning: This field is platform dependent.
- */
- GC memGC;
-
- /**
- * The alpha data of the image.
- * Warning: This field is platform dependent.
- */
- byte[] alphaData;
-
- /**
- * The global alpha value to be used for every pixel.
- * Warning: This field is platform dependent.
- */
- int alpha = -1;
-
- /**
- * Specifies the default scanline padding.
- * Warning: This field is platform dependent.
- */
- static final int DEFAULT_SCANLINE_PAD = 4;
-
-Image() {
-}
-/**
- * Constructs an empty instance of this class with the
- * specified width and height. The result may be drawn upon
- * by creating a GC and using any of its drawing operations,
- * as shown in the following example:
- * <pre>
- * Image i = new Image(device, width, height);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param width the width of the new image
- * @param height the height of the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
- * </ul>
- */
-public Image(Device device, int width, int height) {
- init(device, width, height);
-}
-/**
- * Constructs a new instance of this class based on the
- * provided image, with an appearance that varies depending
- * on the value of the flag. The possible flag values are:
- * <dl>
- * <dt><b>IMAGE_COPY</b></dt>
- * <dd>the result is an identical copy of srcImage</dd>
- * <dt><b>IMAGE_DISABLE</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
- * <dt><b>IMAGE_GRAY</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
- * </dl>
- *
- * @param device the device on which to create the image
- * @param srcImage the image to use as the source
- * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
- * is otherwise in an invalid state</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
-public Image(Device device, Image srcImage, int flag) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int xDisplay = device.xDisplay;
- this.type = srcImage.type;
- this.mask = 0;
- int[] unused = new int[1];
- int[] w = new int[1];
- int[] h = new int[1];
- OS.XGetGeometry(xDisplay, srcImage.pixmap, unused, unused, unused, w, h, unused, unused);
- int width = w[0];
- int height = h[0];
- int drawable = OS.XDefaultRootWindow(xDisplay);
- /* Don't create the mask here if flag is SWT.IMAGE_GRAY. See below.*/
- if (flag != SWT.IMAGE_GRAY && srcImage.mask != 0) {
- /* Generate the mask if necessary. */
- if (srcImage.transparentPixel != -1) srcImage.createMask();
- int mask = OS.XCreatePixmap(xDisplay, drawable, width, height, 1);
- int gc = OS.XCreateGC(xDisplay, mask, 0, null);
- OS.XCopyArea(xDisplay, srcImage.mask, mask, gc, 0, 0, width, height, 0, 0);
- OS.XFreeGC(xDisplay, gc);
- this.mask = mask;
- /* Destroy the image mask if the there is a GC created on the image */
- if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
- }
- switch (flag) {
- case SWT.IMAGE_COPY:
- int[] depth = new int[1];
- OS.XGetGeometry(xDisplay, srcImage.pixmap, unused, unused, unused, unused, unused, unused, depth);
- int pixmap = OS.XCreatePixmap(xDisplay, drawable, width, height, depth[0]);
- int gc = OS.XCreateGC(xDisplay, pixmap, 0, null);
- OS.XCopyArea(xDisplay, srcImage.pixmap, pixmap, gc, 0, 0, width, height, 0, 0);
- OS.XFreeGC(xDisplay, gc);
- this.pixmap = pixmap;
- transparentPixel = srcImage.transparentPixel;
- alpha = srcImage.alpha;
- if (srcImage.alphaData != null) {
- alphaData = new byte[srcImage.alphaData.length];
- System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
- }
- return;
- case SWT.IMAGE_DISABLE:
- /* Get src image data */
- XImage srcXImage = new XImage();
- int srcXImagePtr = OS.XGetImage(xDisplay, srcImage.pixmap, 0, 0, width, height, OS.AllPlanes, OS.ZPixmap);
- OS.memmove(srcXImage, srcXImagePtr, XImage.sizeof);
- byte[] srcData = new byte[srcXImage.bytes_per_line * srcXImage.height];
- OS.memmove(srcData, srcXImage.data, srcData.length);
- /* Create destination image */
- int destPixmap = OS.XCreatePixmap(xDisplay, drawable, width, height, srcXImage.depth);
- XImage destXImage = new XImage();
- int destXImagePtr = OS.XGetImage(xDisplay, drawable, 0, 0, width, height, OS.AllPlanes, OS.ZPixmap);
- OS.memmove(destXImage, destXImagePtr, XImage.sizeof);
- byte[] destData = new byte[destXImage.bytes_per_line * destXImage.height];
- /* Find the colors to map to */
- Color zeroColor = device.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color oneColor = device.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- int zeroPixel = zeroColor.handle.pixel;
- int onePixel = oneColor.handle.pixel;
- switch (srcXImage.bits_per_pixel) {
- case 1:
- /**
- * Nothing we can reasonably do here except copy
- * the bitmap; we can't make it a higher color depth.
- * Short-circuit the rest of the code and return.
- */
- gc = OS.XCreateGC(xDisplay, drawable, 0, null);
- pixmap = OS.XCreatePixmap(xDisplay, drawable, width, height, 1);
- OS.XCopyArea(xDisplay, srcImage.pixmap, pixmap, gc, 0, 0, width, height, 0, 0);
- OS.XDestroyImage(srcXImagePtr);
- OS.XDestroyImage(destXImagePtr);
- OS.XFreeGC(xDisplay, gc);
- return;
- case 4:
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- break;
- case 8:
- int index = 0;
- int srcPixel, r, g, b;
- XColor[] colors = new XColor[256];
- int colormap = OS.XDefaultColormap(xDisplay, OS.XDefaultScreen(xDisplay));
- for (int y = 0; y < srcXImage.height; y++) {
- for (int x = 0; x < srcXImage.bytes_per_line; x++) {
- srcPixel = srcData[index + x] & 0xFF;
- /* Get the RGB values of srcPixel */
- if (colors[srcPixel] == null) {
- XColor color = new XColor();
- color.pixel = srcPixel;
- OS.XQueryColor(xDisplay, colormap, color);
- colors[srcPixel] = color;
- }
- XColor xColor = colors[srcPixel];
- r = (xColor.red >> 8) & 0xFF;
- g = (xColor.green >> 8) & 0xFF;
- b = (xColor.blue >> 8) & 0xFF;
- /* See if the rgb maps to 0 or 1 */
- if ((r * r + g * g + b * b) < 98304) {
- /* Map down to 0 */
- destData[index + x] = (byte)zeroPixel;
- } else {
- /* Map up to 1 */
- destData[index + x] = (byte)onePixel;
- }
- }
- index += srcXImage.bytes_per_line;
- }
- break;
- case 16:
- index = 0;
- /* Get masks */
- Visual visual = new Visual();
- int screenNum = OS.XDefaultScreen(xDisplay);
- int visualPtr = OS.XDefaultVisual(xDisplay, screenNum);
- OS.memmove(visual, visualPtr, Visual.sizeof);
- int redMask = visual.red_mask;
- int greenMask = visual.green_mask;
- int blueMask = visual.blue_mask;
- /* Calculate mask shifts */
- int[] shift = new int[1];
- getOffsetForMask(16, redMask, srcXImage.byte_order, shift);
- int rShift = 24 - shift[0];
- getOffsetForMask(16, greenMask, srcXImage.byte_order, shift);
- int gShift = 24 - shift[0];
- getOffsetForMask(16, blueMask, srcXImage.byte_order, shift);
- int bShift = 24 - shift[0];
- byte zeroLow = (byte)(zeroPixel & 0xFF);
- byte zeroHigh = (byte)((zeroPixel >> 8) & 0xFF);
- byte oneLow = (byte)(onePixel & 0xFF);
- byte oneHigh = (byte)((onePixel >> 8) & 0xFF);
- for (int y = 0; y < srcXImage.height; y++) {
- int xIndex = 0;
- for (int x = 0; x < srcXImage.bytes_per_line; x += 2) {
- srcPixel = ((srcData[index + xIndex + 1] & 0xFF) << 8) | (srcData[index + xIndex] & 0xFF);
- r = (srcPixel & redMask) << rShift >> 16;
- g = (srcPixel & greenMask) << gShift >> 16;
- b = (srcPixel & blueMask) << bShift >> 16;
- /* See if the rgb maps to 0 or 1 */
- if ((r * r + g * g + b * b) < 98304) {
- /* Map down to 0 */
- destData[index + xIndex] = zeroLow;
- destData[index + xIndex + 1] = zeroHigh;
- } else {
- /* Map up to 1 */
- destData[index + xIndex] = oneLow;
- destData[index + xIndex + 1] = oneHigh;
- }
- xIndex += srcXImage.bits_per_pixel / 8;
- }
- index += srcXImage.bytes_per_line;
- }
- break;
- case 24:
- case 32:
- index = 0;
- /* Get masks */
- visual = new Visual();
- screenNum = OS.XDefaultScreen(xDisplay);
- visualPtr = OS.XDefaultVisual(xDisplay, screenNum);
- OS.memmove(visual, visualPtr, Visual.sizeof);
- redMask = visual.red_mask;
- greenMask = visual.green_mask;
- blueMask = visual.blue_mask;
- /* Calculate mask shifts */
- shift = new int[1];
- getOffsetForMask(srcXImage.bits_per_pixel, redMask, srcXImage.byte_order, shift);
- rShift = shift[0];
- getOffsetForMask(srcXImage.bits_per_pixel, greenMask, srcXImage.byte_order, shift);
- gShift = shift[0];
- getOffsetForMask(srcXImage.bits_per_pixel, blueMask, srcXImage.byte_order, shift);
- bShift = shift[0];
- byte zeroR = (byte)zeroColor.getRed();
- byte zeroG = (byte)zeroColor.getGreen();
- byte zeroB = (byte)zeroColor.getBlue();
- byte oneR = (byte)oneColor.getRed();
- byte oneG = (byte)oneColor.getGreen();
- byte oneB = (byte)oneColor.getBlue();
- for (int y = 0; y < srcXImage.height; y++) {
- int xIndex = 0;
- for (int x = 0; x < srcXImage.width; x++) {
- r = srcData[index + xIndex + rShift] & 0xFF;
- g = srcData[index + xIndex + gShift] & 0xFF;
- b = srcData[index + xIndex + bShift] & 0xFF;
- /* See if the rgb maps to 0 or 1 */
- if ((r * r + g * g + b * b) < 98304) {
- /* Map down to 0 */
- destData[index + xIndex + rShift] = zeroR;
- destData[index + xIndex + gShift] = zeroG;
- destData[index + xIndex + bShift] = zeroB;
- } else {
- /* Map up to 1 */
- destData[index + xIndex + rShift] = oneR;
- destData[index + xIndex + gShift] = oneG;
- destData[index + xIndex + bShift] = oneB;
- }
- xIndex += destXImage.bits_per_pixel / 8;
- }
- index += srcXImage.bytes_per_line;
- }
- break;
- default:
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- OS.memmove(destXImage.data, destData, destData.length);
- gc = OS.XCreateGC(xDisplay, destPixmap, 0, null);
- OS.XPutImage(xDisplay, destPixmap, gc, destXImagePtr, 0, 0, 0, 0, width, height);
- OS.XDestroyImage(destXImagePtr);
- OS.XDestroyImage(srcXImagePtr);
- OS.XFreeGC(xDisplay, gc);
- this.pixmap = destPixmap;
- return;
- case SWT.IMAGE_GRAY:
- ImageData data = srcImage.getImageData();
- PaletteData palette = data.palette;
- ImageData newData = data;
- if (!palette.isDirect) {
- /* Convert the palette entries to gray. */
- RGB [] rgbs = palette.getRGBs();
- for (int i=0; i<rgbs.length; i++) {
- if (data.transparentPixel != i) {
- RGB color = rgbs [i];
- int red = color.red;
- int green = color.green;
- int blue = color.blue;
- int intensity = (red+red+green+green+green+green+green+blue) >> 3;
- color.red = color.green = color.blue = intensity;
- }
- }
- newData.palette = new PaletteData(rgbs);
- } else {
- /* Create a 8 bit depth image data with a gray palette. */
- RGB[] rgbs = new RGB[256];
- for (int i=0; i<rgbs.length; i++) {
- rgbs[i] = new RGB(i, i, i);
- }
- newData = new ImageData(width, height, 8, new PaletteData(rgbs));
- newData.maskData = data.maskData;
- newData.maskPad = data.maskPad;
-
- /* Convert the pixels. */
- int[] scanline = new int[width];
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- int redShift = palette.redShift;
- int greenShift = palette.greenShift;
- int blueShift = palette.blueShift;
- for (int y=0; y<height; y++) {
- int offset = y * newData.bytesPerLine;
- data.getPixels(0, y, width, scanline, 0);
- for (int x=0; x<width; x++) {
- int pixel = scanline[x];
- int red = pixel & redMask;
- red = (redShift < 0) ? red >>> -redShift : red << redShift;
- int green = pixel & greenMask;
- green = (greenShift < 0) ? green >>> -greenShift : green << greenShift;
- int blue = pixel & blueMask;
- blue = (blueShift < 0) ? blue >>> -blueShift : blue << blueShift;
- newData.data[offset++] =
- (byte)((red+red+green+green+green+green+green+blue) >> 3);
- }
- }
- }
- init (device, newData);
- break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-/**
- * Constructs an empty instance of this class with the
- * width and height of the specified rectangle. The result
- * may be drawn upon by creating a GC and using any of its
- * drawing operations, as shown in the following example:
- * <pre>
- * Image i = new Image(device, boundsRectangle);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param bounds a rectangle specifying the image's width and height (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
- * </ul>
- */
-public Image(Device device, Rectangle bounds) {
- if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, bounds.width, bounds.height);
-}
-/**
- * Constructs an instance of this class from the given
- * <code>ImageData</code>.
- *
- * @param device the device on which to create the image
- * @param data the image data to create the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
- * </ul>
- */
-public Image(Device device, ImageData image) {
- init(device, image);
-}
-/**
- * Constructs an instance of this class, whose type is
- * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
- * objects. The two images must be the same size, and the mask image
- * must have a color depth of 1. Pixel transparency in either image
- * will be ignored. If either image is an icon to begin with, an
- * exception is thrown.
- * <p>
- * The mask image should contain white wherever the icon is to be visible,
- * and black wherever the icon is to be transparent. In addition,
- * the source image should contain black wherever the icon is to be
- * transparent.
- * </p>
- *
- * @param device the device on which to create the icon
- * @param source the color data for the icon
- * @param mask the mask data for the icon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
- * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
- * if the mask is not monochrome, or if either the source or mask
- * is already an icon</li>
- * </ul>
- */
-public Image(Device device, ImageData source, ImageData mask) {
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (source.width != mask.width || source.height != mask.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
- image.maskPad = mask.scanlinePad;
- image.maskData = mask.data;
- init(device, image);
-}
-/**
- * Constructs an instance of this class by loading its representation
- * from the specified input stream. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p><p>
- * This constructor may be used to load a resource as follows:
- * </p>
- * <pre>
- * new Image(device, clazz.getResourceAsStream("file.gif"));
- * </pre>
- *
- * @param device the device on which to create the image
- * @param stream the input stream to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device device, InputStream stream) {
- init(device, new ImageData(stream));
-}
-/**
- * Constructs an instance of this class by loading its representation
- * from the file with the specified name. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading
- * a single image only. If the specified file contains
- * multiple images, only the first one will be used.
- *
- * @param device the device on which to create the image
- * @param filename the name of the file to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image(Device device, String filename) {
- init(device, new ImageData(filename));
-}
-/**
- * Create the receiver's mask if necessary.
- */
-void createMask() {
- if (mask != 0) return;
- int xDisplay = device.xDisplay;
- int drawable = OS.XDefaultRootWindow(xDisplay);
- int screenDepth = OS.XDefaultDepthOfScreen(OS.XDefaultScreenOfDisplay(xDisplay));
- int visual = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay));
- ImageData maskImage = getImageData().getTransparencyMask();
- int maskPixmap = OS.XCreatePixmap(xDisplay, drawable, maskImage.width, maskImage.height, 1);
- XColor[] xcolors = device.xcolors;
- int gc = OS.XCreateGC(xDisplay, maskPixmap, 0, null);
- int error = Image.putImage(maskImage, 0, 0, maskImage.width, maskImage.height, 0, 0, maskImage.width, maskImage.height, xDisplay, visual, screenDepth, xcolors, null, true, maskPixmap, gc);
- OS.XFreeGC(xDisplay, gc);
- this.mask = maskPixmap;
-}
-/**
- * Disposes of the operating system resources associated with
- * the image. Applications must dispose of all images which
- * they allocate.
- */
-public void dispose () {
- if (pixmap == 0) return;
- if (device.isDisposed()) return;
- int xDisplay = device.xDisplay;
- if (pixmap != 0) OS.XFreePixmap (xDisplay, pixmap);
- if (mask != 0) OS.XFreePixmap (xDisplay, mask);
- device = null;
- memGC = null;
- pixmap = mask = 0;
-}
-/**
- * Destroy the receiver's mask if it exists.
- */
-void destroyMask() {
- if (mask == 0) return;
- OS.XFreePixmap (device.xDisplay, mask);
- mask = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Image)) return false;
- Image image = (Image)object;
- return device == image.device && pixmap == image.pixmap &&
- transparentPixel == image.transparentPixel &&
- mask == image.mask;
-}
-/**
- * Returns the color to which to map the transparent pixel, or null if
- * the receiver has no transparent pixel.
- * <p>
- * There are certain uses of Images that do not support transparency
- * (for example, setting an image into a button or label). In these cases,
- * it may be desired to simulate transparency by using the background
- * color of the widget to paint the transparent pixels of the image.
- * Use this method to check which color will be used in these cases
- * in place of transparency. This value may be set with setBackground().
- * <p>
- *
- * @return the background color of the image, or null if there is no transparency in the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (transparentPixel == -1) return null;
- XColor xColor = new XColor();
- xColor.pixel = transparentPixel;
- int xDisplay = device.xDisplay;
- int colormap = OS.XDefaultColormap(xDisplay, OS.XDefaultScreen(xDisplay));
- OS.XQueryColor(xDisplay, colormap, xColor);
- return Color.motif_new(device, xColor);
-}
-/**
- * Returns the bounds of the receiver. The rectangle will always
- * have x and y values of 0, and the width and height of the
- * image.
- *
- * @return a rectangle specifying the image's bounds
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- */
-public Rectangle getBounds () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int [] unused = new int [1]; int [] width = new int [1]; int [] height = new int [1];
- OS.XGetGeometry (device.xDisplay, pixmap, unused, unused, unused, width, height, unused, unused);
- return new Rectangle(0, 0, width [0], height [0]);
-}
-/**
- * Returns an <code>ImageData</code> based on the receiver
- * Modifications made to this <code>ImageData</code> will not
- * affect the Image.
- *
- * @return an <code>ImageData</code> containing the image's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- *
- * @see ImageData
- */
-public ImageData getImageData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Rectangle srcBounds = getBounds();
- int width = srcBounds.width;
- int height = srcBounds.height;
- int xDisplay = device.xDisplay;
- int xSrcImagePtr = OS.XGetImage(xDisplay, pixmap, 0, 0, width, height, OS.AllPlanes, OS.ZPixmap);
- if (xSrcImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- XImage xSrcImage = new XImage();
- OS.memmove(xSrcImage, xSrcImagePtr, XImage.sizeof);
-
- /* Get the data and palette of the source image. */
- PaletteData palette = null;
- int length = xSrcImage.bytes_per_line * xSrcImage.height;
- byte[] srcData = new byte[length];
- OS.memmove(srcData, xSrcImage.data, length);
- switch (xSrcImage.bits_per_pixel) {
- case 1:
- palette = new PaletteData(new RGB[] {
- new RGB(0, 0, 0),
- new RGB(255, 255, 255)
- });
- break;
- case 4:
- /*
- * We currently don't run on a 4-bit server, so 4-bit images
- * should not exist.
- */
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- case 8:
- /* Normalize the pixels in the source image data (by making the
- * pixel values sequential starting at pixel 0). Reserve normalized
- * pixel 0 so that it maps to real pixel 0. This assumes pixel 0 is
- * always used in the image.
- */
- byte[] normPixel = new byte[256];
- for (int index = 0; index < normPixel.length; index++) {
- normPixel[index] = 0;
- }
- int numPixels = 1;
- int index = 0;
- for (int y = 0; y < xSrcImage.height; y++) {
- for (int x = 0; x < xSrcImage.bytes_per_line; x++) {
- int srcPixel = srcData[index + x] & 0xFF;
- if (srcPixel != 0 && normPixel[srcPixel] == 0) {
- normPixel[srcPixel] = (byte)numPixels++;
- }
- srcData[index + x] = normPixel[srcPixel];
- }
- index += xSrcImage.bytes_per_line;
- }
-
- /* Create a palette with only the RGB values used in the image. */
- int colormap = OS.XDefaultColormap(xDisplay, OS.XDefaultScreen(xDisplay));
- RGB[] rgbs = new RGB[numPixels];
- XColor color = new XColor();
- for (int srcPixel = 0; srcPixel < normPixel.length; srcPixel++) {
- /* If the pixel value was used in the image, get its RGB values. */
- if (srcPixel == 0 || normPixel[srcPixel] != 0) {
- color.pixel = srcPixel;
- OS.XQueryColor(xDisplay, colormap, color);
- int rgbIndex = normPixel[srcPixel] & 0xFF;
- rgbs[rgbIndex] = new RGB((color.red >> 8) & 0xFF, (color.green >> 8) & 0xFF, (color.blue >> 8) & 0xFF);
- }
- }
- palette = new PaletteData(rgbs);
- break;
- case 16:
- /* Byte swap the data if necessary */
- if (xSrcImage.byte_order == OS.MSBFirst) {
- for (int i = 0; i < srcData.length; i += 2) {
- byte b = srcData[i];
- srcData[i] = srcData[i+1];
- srcData[i+1] = b;
- }
- }
- break;
- case 24:
- break;
- case 32:
- /* Byte swap the data if necessary */
- if (xSrcImage.byte_order == OS.LSBFirst) {
- for (int i = 0; i < srcData.length; i += 4) {
- byte b = srcData[i];
- srcData[i] = srcData[i+3];
- srcData[i+3] = b;
- b = srcData[i+1];
- srcData[i+1] = srcData[i+2];
- srcData[i+2] = b;
- }
- }
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- if (palette == null) {
- /*
- * For some reason, the XImage does not have the mask information.
- * We must get it from the defualt visual.
- */
- int visual = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay));
- Visual v = new Visual();
- OS.memmove(v, visual, Visual.sizeof);
- palette = new PaletteData(v.red_mask, v.green_mask, v.blue_mask);
- }
- ImageData data = new ImageData(width, height, xSrcImage.bits_per_pixel, palette);
- data.data = srcData;
- if (transparentPixel == -1 && type == SWT.ICON && mask != 0) {
- /* Get the icon mask data */
- data.maskPad = 4;
- int xMaskPtr = OS.XGetImage(xDisplay, mask, 0, 0, width, height, OS.AllPlanes, OS.ZPixmap);
- if (xMaskPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- XImage xMask = new XImage();
- OS.memmove(xMask, xMaskPtr, XImage.sizeof);
- data.maskData = new byte[xMask.bytes_per_line * xMask.height];
- OS.memmove(data.maskData, xMask.data, data.maskData.length);
- OS.XDestroyImage(xMaskPtr);
- /* Bit swap the mask data if necessary */
- if (xMask.bitmap_bit_order == OS.LSBFirst) {
- byte[] maskData = data.maskData;
- for (int i = 0; i < maskData.length; i++) {
- byte b = maskData[i];
- maskData[i] = (byte)(((b & 0x01) << 7) | ((b & 0x02) << 5) |
- ((b & 0x04) << 3) | ((b & 0x08) << 1) | ((b & 0x10) >> 1) |
- ((b & 0x20) >> 3) | ((b & 0x40) >> 5) | ((b & 0x80) >> 7));
- }
- }
- }
- data.transparentPixel = transparentPixel;
- data.alpha = alpha;
- if (alpha == -1 && alphaData != null) {
- data.alphaData = new byte[alphaData.length];
- System.arraycopy(alphaData, 0, data.alphaData, 0, alphaData.length);
- }
- OS.XDestroyImage(xSrcImagePtr);
- return data;
-}
-/**
- * Get the offset for the given mask.
- *
- * For 24 and 32-bit masks, the offset indicates which byte holds the
- * data for the given mask (indexed from 0).
- * For example, in 0x0000FF00, the byte offset is 1.
- *
- * For 16-bit masks, the offset indicates which bit holds the most significant
- * data for the given mask (indexed from 1).
- * For example, in 0x7E0, the bit offset is 11.
- *
- * The different semantics are necessary because 24- and 32-bit images
- * have their color components aligned on byte boundaries, and 16-bit images
- * do not.
- */
-static boolean getOffsetForMask(int bitspp, int mask, int byteOrder, int[] poff) {
- if (bitspp % 8 != 0) {
- return false;
- }
- switch (mask) {
- /* 24-bit and 32-bit masks */
- case 0x000000FF:
- poff[0] = 0;
- break;
- case 0x0000FF00:
- poff[0] = 1;
- break;
- case 0x00FF0000:
- poff[0] = 2;
- break;
- case 0xFF000000:
- poff[0] = 3;
- break;
- /* 16-bit masks */
- case 0x001F:
- poff[0] = 5;
- break;
- case 0x03E0:
- poff[0] = 10;
- break;
- case 0x07E0:
- poff[0] = 11;
- break;
- case 0x7C00:
- poff[0] = 15;
- break;
- case 0xF800:
- poff[0] = 16;
- break;
- default:
- return false;
- }
- if (bitspp == 16) {
- return true;
- }
- if (poff[0] >= bitspp / 8) {
- return false;
- }
- if (byteOrder == OS.MSBFirst) {
- poff[0] = (bitspp/8 - 1) - poff[0];
- }
- return true;
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return pixmap;
-}
-void init(Device device, int width, int height) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- /* Create the pixmap */
- if (width <= 0 | height <= 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- this.type = SWT.BITMAP;
- int xDisplay = device.xDisplay;
- int screen = OS.XDefaultScreenOfDisplay(xDisplay);
- int depth = OS.XDefaultDepthOfScreen(screen);
- int screenNum = OS.XDefaultScreen(xDisplay);
- int drawable = OS.XDefaultRootWindow(xDisplay);
- int pixmap = OS.XCreatePixmap(xDisplay, drawable, width, height, depth);
- if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Fill the bitmap with white */
- int xGC = OS.XCreateGC(xDisplay, drawable, 0, null);
- OS.XSetForeground(xDisplay, xGC, OS.XWhitePixel(xDisplay, screenNum));
- OS.XFillRectangle(xDisplay, pixmap, xGC, 0, 0, width, height);
- OS.XFreeGC(xDisplay, xGC);
- this.pixmap = pixmap;
-}
-void init(Device device, ImageData image) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int xDisplay = device.xDisplay;
- int drawable = OS.XDefaultRootWindow(xDisplay);
- int screenDepth = OS.XDefaultDepthOfScreen(OS.XDefaultScreenOfDisplay(xDisplay));
- int visual = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay));
- int pixmap = OS.XCreatePixmap(xDisplay, drawable, image.width, image.height, screenDepth);
- if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int gc = OS.XCreateGC(xDisplay, pixmap, 0, null);
- int[] transPixel = null;
- if (image.transparentPixel != -1) transPixel = new int[]{image.transparentPixel};
- int error = putImage(image, 0, 0, image.width, image.height, 0, 0, image.width, image.height, xDisplay, visual, screenDepth, device.xcolors, transPixel, false, pixmap, gc);
- OS.XFreeGC(xDisplay, gc);
- if (error != 0) {
- OS.XFreePixmap (xDisplay, pixmap);
- SWT.error(error);
- }
- if (image.getTransparencyType() == SWT.TRANSPARENCY_MASK || image.transparentPixel != -1) {
- if (image.transparentPixel != -1) transparentPixel = transPixel[0];
- ImageData maskImage = image.getTransparencyMask();
- int mask = OS.XCreatePixmap(xDisplay, drawable, image.width, image.height, 1);
- gc = OS.XCreateGC(xDisplay, mask, 0, null);
- error = putImage(maskImage, 0, 0, maskImage.width, maskImage.height, 0, 0, maskImage.width, maskImage.height, xDisplay, visual, screenDepth, device.xcolors, null, true, mask, gc);
- OS.XFreeGC(xDisplay, gc);
- if (error != 0) {
- OS.XFreePixmap (xDisplay, pixmap);
- OS.XFreePixmap (xDisplay, mask);
- SWT.error(error);
- }
- this.mask = mask;
- if (image.getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- this.type = SWT.ICON;
- } else {
- this.type = SWT.BITMAP;
- }
- } else {
- this.type = SWT.BITMAP;
- this.mask = 0;
- this.alpha = image.alpha;
- if (image.alpha == -1 && image.alphaData != null) {
- this.alphaData = new byte[image.alphaData.length];
- System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length);
- }
- }
- this.pixmap = pixmap;
-}
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (type != SWT.BITMAP || memGC != null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- int xDisplay = device.xDisplay;
- int xGC = OS.XCreateGC (xDisplay, pixmap, 0, null);
- if (xGC == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- if (data != null) {
- data.device = device;
- data.display = xDisplay;
- data.drawable = pixmap;
- data.fontList = device.systemFont;
- data.colormap = OS.XDefaultColormap (xDisplay, OS.XDefaultScreen (xDisplay));
- data.image = this;
- }
- return xGC;
-}
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int gc, GCData data) {
- int xDisplay = 0;
- if (data != null) xDisplay = data.display;
- if (xDisplay == 0 && device != null) xDisplay = device.xDisplay;
- if (xDisplay == 0) SWT.error (SWT.ERROR_NO_HANDLES);;
- OS.XFreeGC(xDisplay, gc);
-}
-/**
- * Returns <code>true</code> if the image has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the image.
- * When an image has been disposed, it is an error to
- * invoke any other method using the image.
- *
- * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return pixmap == 0;
-}
-public static Image motif_new(Device device, int type, int pixmap, int mask) {
- if (device == null) device = Device.getDevice();
- Image image = new Image();
- image.device = device;
- image.type = type;
- image.pixmap = pixmap;
- image.mask = mask;
- return image;
-}
-/**
- * Put a device-independent image of any depth into a drawable of any depth,
- * stretching if necessary.
- */
-static int putImage(ImageData image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, int display, int visual, int screenDepth, XColor[] xcolors, int[] transparentPixel, boolean isMask, int drawable, int gc) {
- PaletteData palette = image.palette;
- if (!(((image.depth == 1 || image.depth == 2 || image.depth == 4 || image.depth == 8) && !palette.isDirect) ||
- ((image.depth == 8) || (image.depth == 16 || image.depth == 24 || image.depth == 32) && palette.isDirect)))
- return SWT.ERROR_UNSUPPORTED_DEPTH;
-
- boolean flipX = destWidth < 0;
- boolean flipY = destHeight < 0;
- if (flipX) {
- destWidth = -destWidth;
- destX = destX - destWidth;
- }
- if (flipY) {
- destHeight = -destHeight;
- destY = destY - destHeight;
- }
- byte[] srcReds = null, srcGreens = null, srcBlues = null;
- if (!palette.isDirect) {
- RGB[] rgbs = palette.getRGBs();
- int length = rgbs.length;
- srcReds = new byte[length];
- srcGreens = new byte[length];
- srcBlues = new byte[length];
- for (int i = 0; i < rgbs.length; i++) {
- RGB rgb = rgbs[i];
- if (rgb == null) continue;
- srcReds[i] = (byte)rgb.red;
- srcGreens[i] = (byte)rgb.green;
- srcBlues[i] = (byte)rgb.blue;
- }
- }
- byte[] destReds = null, destGreens = null, destBlues = null;
- int destRedMask = 0, destGreenMask = 0, destBlueMask = 0;
- final boolean screenDirect;
- if (screenDepth <= 8) {
- if (xcolors == null) return SWT.ERROR_UNSUPPORTED_DEPTH;
- destReds = new byte[xcolors.length];
- destGreens = new byte[xcolors.length];
- destBlues = new byte[xcolors.length];
- for (int i = 0; i < xcolors.length; i++) {
- XColor color = xcolors[i];
- if (color == null) continue;
- destReds[i] = (byte)((color.red >> 8) & 0xFF);
- destGreens[i] = (byte)((color.green >> 8) & 0xFF);
- destBlues[i] = (byte)((color.blue >> 8) & 0xFF);
- }
- screenDirect = false;
- } else {
- Visual xVisual = new Visual();
- OS.memmove(xVisual, visual, Visual.sizeof);
- destRedMask = xVisual.red_mask;
- destGreenMask = xVisual.green_mask;
- destBlueMask = xVisual.blue_mask;
- screenDirect = true;
- }
- if (transparentPixel != null) {
- int transRed = 0, transGreen = 0, transBlue = 0;
- if (palette.isDirect) {
- RGB rgb = palette.getRGB(transparentPixel[0]);
- transRed = rgb.red;
- transGreen = rgb.green;
- transBlue = rgb.blue;
- } else {
- RGB[] rgbs = palette.getRGBs();
- if (transparentPixel[0] < rgbs.length) {
- RGB rgb = rgbs[transparentPixel[0]];
- transRed = rgb.red;
- transGreen = rgb.green;
- transBlue = rgb.blue;
- }
- }
- transparentPixel[0] = ImageData.closestMatch(screenDepth, (byte)transRed, (byte)transGreen, (byte)transBlue,
- destRedMask, destGreenMask, destBlueMask, destReds, destGreens, destBlues);
- }
-
- /* Depth 1 */
- if (image.depth == 1) {
-
- int bplX = ((destWidth + 7) / 8 + 3) & 0xFFFC;
- int bufSize = bplX * destHeight;
- byte[] buf = new byte[bufSize];
- int bufPtr = OS.XtMalloc(bufSize);
- int xImagePtr = OS.XCreateImage(display, visual, 1, OS.XYBitmap, 0, bufPtr, destWidth, destHeight, 32, bplX);
- if (xImagePtr == 0) {
- OS.XtFree(bufPtr);
- return SWT.ERROR_NO_HANDLES;
- }
- int foreground = 1, background = 0;
- if (!isMask) {
- foreground = 0;
- if (srcReds.length > 1) {
- foreground = ImageData.closestMatch(screenDepth, srcReds[1], srcGreens[1], srcBlues[1],
- destRedMask, destGreenMask, destBlueMask, destReds, destGreens, destBlues);
- }
- if (srcReds.length > 0) {
- background = ImageData.closestMatch(screenDepth, srcReds[0], srcGreens[0], srcBlues[0],
- destRedMask, destGreenMask, destBlueMask, destReds, destGreens, destBlues);
- }
- }
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- xImage.byte_order = OS.MSBFirst;
- xImage.bitmap_unit = 8;
- xImage.bitmap_bit_order = OS.MSBFirst;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- int destOrder = ImageData.MSB_FIRST;
- ImageData.blit(ImageData.BLIT_SRC,
- image.data, 1, image.bytesPerLine, image.getByteOrder(), srcX, srcY, srcWidth, srcHeight, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, 1, bplX, destOrder, 0, 0, destWidth, destHeight, null, null, null,
- flipX, flipY);
-
- OS.memmove(xImage.data, buf, bufSize);
- XGCValues values = new XGCValues();
- OS.XGetGCValues(display, gc, OS.GCForeground | OS.GCBackground, values);
- OS.XSetForeground(display, gc, foreground);
- OS.XSetBackground(display, gc, background);
- OS.XPutImage(display, drawable, gc, xImagePtr, 0, 0, destX, destY, destWidth, destHeight);
- OS.XSetForeground(display, gc, values.foreground);
- OS.XSetBackground(display, gc, values.background);
- OS.XDestroyImage(xImagePtr);
- return 0;
- }
-
- /* Depths other than 1 */
- int xImagePtr = OS.XCreateImage(display, visual, screenDepth, OS.ZPixmap, 0, 0, destWidth, destHeight, 32, 0);
- if (xImagePtr == 0) return SWT.ERROR_NO_HANDLES;
- XImage xImage = new XImage();
- OS.memmove(xImage, xImagePtr, XImage.sizeof);
- int bufSize = xImage.bytes_per_line * destHeight;
- byte[] buf = new byte[bufSize];
- int bufPtr = OS.XtMalloc(bufSize);
- xImage.data = bufPtr;
- OS.memmove(xImagePtr, xImage, XImage.sizeof);
- int srcOrder = image.getByteOrder();
- int destOrder = xImage.byte_order == OS.MSBFirst ? ImageData.MSB_FIRST : ImageData.LSB_FIRST;
- if (palette.isDirect) {
- if (screenDirect) {
- ImageData.blit(ImageData.BLIT_SRC,
- image.data, image.depth, image.bytesPerLine, srcOrder, srcX, srcY, srcWidth, srcHeight, palette.redMask, palette.greenMask, palette.blueMask,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, xImage.bits_per_pixel, xImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, xImage.red_mask, xImage.green_mask, xImage.blue_mask,
- flipX, flipY);
- } else {
- ImageData.blit(ImageData.BLIT_SRC,
- image.data, image.depth, image.bytesPerLine, srcOrder, srcX, srcY, srcWidth, srcHeight, palette.redMask, palette.greenMask, palette.blueMask,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, xImage.bits_per_pixel, xImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, destReds, destGreens, destBlues,
- flipX, flipY);
- }
- } else {
- if (screenDirect) {
- ImageData.blit(ImageData.BLIT_SRC,
- image.data, image.depth, image.bytesPerLine, srcOrder, srcX, srcY, srcWidth, srcHeight, srcReds, srcGreens, srcBlues,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, xImage.bits_per_pixel, xImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, xImage.red_mask, xImage.green_mask, xImage.blue_mask,
- flipX, flipY);
- } else {
- ImageData.blit(ImageData.BLIT_SRC,
- image.data, image.depth, image.bytesPerLine, srcOrder, srcX, srcY, srcWidth, srcHeight, srcReds, srcGreens, srcBlues,
- ImageData.ALPHA_OPAQUE, null, 0,
- buf, xImage.bits_per_pixel, xImage.bytes_per_line, destOrder, 0, 0, destWidth, destHeight, destReds, destGreens, destBlues,
- flipX, flipY);
- }
- }
- OS.memmove(xImage.data, buf, bufSize);
- OS.XPutImage(display, drawable, gc, xImagePtr, 0, 0, destX, destY, destWidth, destHeight);
- OS.XDestroyImage(xImagePtr);
- return 0;
-}
-/**
- * Sets the color to which to map the transparent pixel.
- * <p>
- * There are certain uses of <code>Images</code> that do not support
- * transparency (for example, setting an image into a button or label).
- * In these cases, it may be desired to simulate transparency by using
- * the background color of the widget to paint the transparent pixels
- * of the image. This method specifies the color that will be used in
- * these cases. For example:
- * <pre>
- * Button b = new Button();
- * image.setBackground(b.getBackground());>
- * b.setImage(image);
- * </pre>
- * </p><p>
- * The image may be modified by this operation (in effect, the
- * transparent regions may be filled with the supplied color). Hence
- * this operation is not reversible and it is not legal to call
- * this function twice or with a null argument.
- * </p><p>
- * This method has no effect if the receiver does not have a transparent
- * pixel value.
- * </p>
- *
- * @param color the color to use when a transparent pixel is specified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (transparentPixel == -1) return;
- /* Generate the mask if necessary. */
- if (mask == 0) createMask();
- Rectangle bounds = getBounds();
- int[] unused = new int[1];
- int[] depth = new int[1];
- int xDisplay = device.xDisplay;
- OS.XGetGeometry(xDisplay, pixmap, unused, unused, unused, unused, unused, unused, depth);
- int drawable = OS.XDefaultRootWindow(xDisplay);
- int tempPixmap = OS.XCreatePixmap(xDisplay, drawable, bounds.width, bounds.height, depth[0]);
- int xGC = OS.XCreateGC(xDisplay, tempPixmap, 0, null);
- OS.XSetForeground(xDisplay, xGC, color.handle.pixel);
- OS.XFillRectangle(xDisplay, tempPixmap, xGC, 0, 0, bounds.width, bounds.height);
- OS.XSetClipMask(xDisplay, xGC, mask);
- OS.XCopyArea(xDisplay, pixmap, tempPixmap, xGC, 0, 0, bounds.width, bounds.height, 0, 0);
- OS.XSetClipMask(xDisplay, xGC, OS.None);
- OS.XCopyArea(xDisplay, tempPixmap, pixmap, xGC, 0, 0, bounds.width, bounds.height, 0, 0);
- OS.XFreePixmap(xDisplay, tempPixmap);
- OS.XFreeGC(xDisplay, xGC);
- /* Destroy the receiver's mask if the there is a GC created on it */
- if (memGC != null) destroyMask();
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return "Image {" + pixmap + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Region.java
deleted file mode 100755
index 07b2c22791..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Region.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent areas of an x-y coordinate
- * system that are aggregates of the areas covered by a number
- * of rectangles.
- * <p>
- * Application code must explicitly invoke the <code>Region.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- */
-public final class Region {
- /**
- * the OS resource for the region
- * (Warning: This field is platform dependent)
- */
- public int handle;
-/**
- * Constructs a new empty region.
- */
-public Region () {
- handle = OS.XCreateRegion ();
-}
-Region (int handle) {
- this.handle = handle;
-}
-/**
- * Adds the given rectangle to the collection of rectangles
- * the receiver maintains to describe its area.
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Rectangle rect) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- XRectangle xRect = new XRectangle();
- xRect.x = (short)rect.x;
- xRect.y = (short)rect.y;
- xRect.width = (short)rect.width;
- xRect.height = (short)rect.height;
- OS.XUnionRectWithRegion(xRect, handle, handle);
-}
-/**
- * Adds all of the rectangles which make up the area covered
- * by the argument to the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @param region the region to merge
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Region region) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.XUnionRegion(handle, region.handle, handle);
-}
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (int x, int y) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return OS.XPointInRegion(handle, x, y);
-}
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (Point pt) {
- if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-/**
- * Disposes of the operating system resources associated with
- * the region. Applications must dispose of all regions which
- * they allocate.
- */
-public void dispose () {
- if (handle != 0) OS.XDestroyRegion(handle);
- handle = 0;
-}
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (this == object) return true;
- if (!(object instanceof Region)) return false;
- Region region = (Region)object;
- return handle == region.handle;
-}
-/**
- * Returns a rectangle which represents the rectangular
- * union of the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @return a bounding rectangle for the region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#union
- */
-public Rectangle getBounds() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- XRectangle rect = new XRectangle();
- OS.XClipBox(handle, rect);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-/**
- * Returns <code>true</code> if the rectangle described by the
- * arguments intersects with any of the rectangles the receiver
- * mainains to describe its area, and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (int x, int y, int width, int height) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return OS.XRectInRegion (handle, x, y, width, height) != OS.RectangleOut;
-}
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with any of the rectangles the receiver mainains to describe
- * its area and <code>false</code> otherwise.
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * Returns <code>true</code> if the region has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the region.
- * When a region has been disposed, it is an error to
- * invoke any other method using the region.
- *
- * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isEmpty () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return OS.XEmptyRegion(handle);
-}
-public static Region motif_new(int handle) {
- return new Region(handle);
-}
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return "Region {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/Converter.java
deleted file mode 100755
index d39a45448b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/Converter.java
+++ /dev/null
@@ -1,381 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- */
-
-public final class Converter {
-
- static final byte [] NULL_BYTE_ARRAY = new byte [1];
- static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
- static final char [] EMPTY_CHAR_ARRAY = new char [0];
-
- static String CodePage;
- static byte[] Unicode;
-
- /* Converter cache */
- static String LastMBToWCCodePage;
- static String LastWCToMBCodePage;
- static int LastWCToMB;
- static int LastMBToWC;
-
- /* Buffers cache */
- static int BufferSize;
- static int BufferTimes2;
- static int BufferTimes4;
-
- static {
- Unicode = getAsciiBytes("UCS-2");
-
- int length, item = OS.nl_langinfo (OS.CODESET);
- if (item != 0 && (length = OS.strlen (item)) > 0) {
- byte [] buffer = new byte [length];
- OS.memmove (buffer, item, length);
- CodePage = new String (buffer);
- if (OS.IsSunOS) {
- if (length > 3 && CodePage.indexOf ("ISO") == 0) {
- CodePage = CodePage.substring (3, length - 3);
- }
- }
- } else {
- if (OS.IsLinux) CodePage = "ISO-8859-1";
- else if (OS.IsAIX) CodePage = "ISO8859-1";
- else if (OS.IsSunOS) CodePage = "8859-1";
- else CodePage = "iso8859_1";
- }
-
- BufferSize = 512;
- BufferTimes2 = OS.XtMalloc (BufferSize * 2);
- BufferTimes4 = OS.XtMalloc (BufferSize * 4);
- }
-
-/**
- * Returns the default code page for the platform where the
- * application is currently running.
- *
- * @return the default code page
- */
-public static String defaultCodePage () {
- return CodePage;
-}
-
-/**
- * Returns the code page for the specified font list.
- * (Warning this method is platform dependent.)
- *
- * @return the code page for the font list
- */
-public static String getCodePage (int xDisplay, int fontList) {
- int[] buffer = new int[1];
- if (!OS.XmFontListInitFontContext(buffer, fontList)) return null;
- int context = buffer[0];
- XFontStruct fontStruct = new XFontStruct();
- int fontListEntry;
- int[] fontStructPtr = new int[1];
- int[] fontNamePtr = new int[1];
- String codePage = null;
- /* Go through each entry in the font list */
- while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == OS.XmFONT_IS_FONT) {
- /* FontList contains a single font */
- OS.memmove(fontStruct,fontPtr,20 * 4);
- int propPtr = fontStruct.properties;
- for (int i = 0; i < fontStruct.n_properties; i++) {
- /* Reef through properties looking for XAFONT */
- int[] prop = new int[2];
- OS.memmove(prop, propPtr, 8);
- if (prop[0] == OS.XA_FONT) {
- /* Found it, prop[1] points to the string */
- StringBuffer stringBuffer = new StringBuffer();
- int ptr = OS.XmGetAtomName(xDisplay, prop[1]);
- int length = OS.strlen(ptr);
- byte[] nameBuf = new byte[length];
- OS.memmove(nameBuf, ptr, length);
- /* Use the character encoding for the default locale */
- String xlfd = new String(Converter.mbcsToWcs(null, nameBuf)).toLowerCase();
- int start = xlfd.lastIndexOf ('-');
- if (start != -1 && start > 0) {
- start = xlfd.lastIndexOf ('-', start - 1);
- if (start != -1) {
- codePage = xlfd.substring (start + 1, xlfd.length ());
- if (codePage.indexOf ("iso") == 0) {
- if (OS.IsLinux) {
- codePage = "ISO-" + codePage.substring (3, codePage.length ());
- }
- }
- }
- }
- OS.XtFree(ptr);
- break;
- }
- propPtr += 8;
- }
- }
- else {
- /* FontList contains a fontSet */
-
- /* Get the font set locale */
- int localePtr = OS.XLocaleOfFontSet(fontPtr);
- int length = OS.strlen (localePtr);
- byte [] locale = new byte [length + 1];
- OS.memmove (locale, localePtr, length);
-
- /* Get code page for the font set locale */
- OS.setlocale (OS.LC_CTYPE, locale);
- int codesetPtr = OS.nl_langinfo (OS.CODESET);
- length = OS.strlen (codesetPtr);
- byte [] codeset = new byte [length];
- OS.memmove (codeset, codesetPtr, length);
- codePage = getAsciiString (codeset);
-
- /* Reset the locale */
- OS.setlocale (OS.LC_CTYPE, new byte[1]);
- }
- }
- OS.XmFontListFreeFontContext(context);
- return codePage;
-}
-
-static byte[] getAsciiBytes (String str) {
- int length = str.length ();
- byte [] buffer = new byte [length + 1];
- for (int i=0; i<length; i++) {
- buffer [i] = (byte)str.charAt (i);
- }
- return buffer;
-}
-
-static String getAsciiString (byte [] buffer) {
- int length = buffer.length;
- char [] chars = new char [length];
- for (int i=0; i<length; i++) {
- chars [i] = (char)buffer [i];
- }
- return new String (chars);
-}
-
-/**
- * Converts an array of bytes representing the platform's encoding,
- * in the given code page, of some character data into an array of
- * matching unicode characters.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of bytes to be converted
- * @return the unicode conversion
- */
-public static char [] mbcsToWcs (String codePage, byte [] buffer) {
-
- /* Check for the simple cases */
- if (buffer == null) {
- return EMPTY_CHAR_ARRAY;
- }
- int length = buffer.length;
- if (length == 0) {
- return EMPTY_CHAR_ARRAY;
- }
-
- /*
- * Optimize for English ASCII encoding. If no conversion is
- * performed, it is safe to return any object that will also not
- * be converted if this routine is called again with the result.
- * This ensures that double conversion will not be performed
- * on the same bytes. Note that this relies on the fact that
- * lead bytes are never in the range 0..0x7F.
- */
- char [] wideCharStr = new char [length];
- for (int i=0; i<length; i++) {
- if ((buffer [i] & 0xFF) <= 0x7F) {
- wideCharStr [i] = (char) buffer [i]; // all bytes <= 0x7F, so no ((char) (buffer[i]&0xFF)) needed
- } else {
- synchronized (Converter.class) {
- String cp = codePage != null ? codePage : CodePage;
- if (LastMBToWC != 0 && !cp.equals (LastMBToWCCodePage)) {
- OS.iconv_close (LastMBToWC);
- LastMBToWC = 0;
- }
- if (LastMBToWC == 0) {
- LastMBToWCCodePage = cp;
- LastMBToWC = OS.iconv_open (Unicode, getAsciiBytes (cp));
- }
- int cd = LastMBToWC;
- if (cd == 0) return EMPTY_CHAR_ARRAY;
- int inBytes = length;
- int outBytes = length * 2;
- int ptr1, ptr2;
- if (length <= BufferSize * 2) {
- ptr1 = BufferTimes2;
- ptr2 = BufferTimes4;
- } else {
- ptr1 = OS.XtMalloc (inBytes);
- ptr2 = OS.XtMalloc (outBytes);
- }
- int [] inBuf = {ptr1};
- int [] inBytesLeft = {inBytes};
- int [] outBuf = {ptr2};
- int [] outBytesLeft = {outBytes};
- OS.memmove (ptr1, buffer, inBytes);
- int result = OS.iconv (cd, inBuf, inBytesLeft, outBuf, outBytesLeft);
- outBytes = outBuf [0] - ptr2;
- wideCharStr = new char [outBytes / 2];
- OS.memmove (wideCharStr, ptr2, outBytes);
- if (ptr1 != BufferTimes2) OS.XtFree (ptr1);
- if (ptr2 != BufferTimes4) OS.XtFree (ptr2);
- }
- return wideCharStr;
- }
- }
- return wideCharStr;
-}
-
-/**
- * Free any cached resources.
- */
-public static void release () {
- synchronized (Converter.class) {
- if (BufferTimes2 != 0) OS.XtFree (BufferTimes2);
- if (BufferTimes4 != 0) OS.XtFree (BufferTimes4);
- if (LastWCToMB != 0) OS.iconv_close (LastWCToMB);
- if (LastMBToWC != 0) OS.iconv_close (LastMBToWC);
- LastMBToWC = LastWCToMB = BufferTimes4 = BufferTimes2 = 0;
- }
-}
-
-/**
- * Converts an array of chars (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of chars to be converted
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (String codePage, char [] buffer) {
- return wcsToMbcs (codePage, buffer, false);
-}
-
-/**
- * Converts an array of chars (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page. If the termination flag is true, the resulting
- * byte data will be null (zero) terminated.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of chars to be converted
- * @param terminate <code>true</code> if the result should be null terminated and false otherwise.
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
-
- /* Check for the simple cases */
- if (buffer == null) {
- return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- }
- int length = buffer.length;
- if (length == 0) {
- return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- }
-
- /*
- * Optimize for English ASCII encoding. This optimization
- * relies on the fact that lead bytes can never be in the
- * range 0..0x7F.
- */
- byte [] mbcs = new byte [(terminate) ? length + 1 : length];
- for (int i=0; i<length; i++) {
- if ((buffer [i] & 0xFFFF) <= 0x7F) {
- mbcs [i] = (byte) buffer [i];
- } else {
- synchronized (Converter.class) {
- String cp = codePage != null ? codePage : CodePage;
- if (LastWCToMB != 0 && !cp.equals (LastWCToMBCodePage)) {
- OS.iconv_close (LastWCToMB);
- LastWCToMB = 0;
- }
- if (LastWCToMB == 0) {
- LastWCToMBCodePage = cp;
- LastWCToMB = OS.iconv_open (getAsciiBytes (cp), Unicode);
- }
- int cd = LastWCToMB;
- if (cd == 0) return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- int inBytes = length * 2;
- int outBytes = length * 4;
- int ptr1, ptr2;
- if (length <= BufferSize) {
- ptr1 = BufferTimes2;
- ptr2 = BufferTimes4;
- } else {
- ptr1 = OS.XtMalloc (inBytes);
- ptr2 = OS.XtMalloc (outBytes);
- }
- int [] inBuf = {ptr1};
- int [] inBytesLeft = {inBytes};
- int [] outBuf = {ptr2};
- int [] outBytesLeft = {outBytes};
- OS.memmove (ptr1, buffer, inBytes);
- int result = OS.iconv (cd, inBuf, inBytesLeft, outBuf, outBytesLeft);
- outBytes = outBuf [0] - ptr2;
- mbcs = new byte [outBytes];
- OS.memmove (mbcs, ptr2, outBytes);
- if (ptr1 != BufferTimes2) OS.XtFree (ptr1);
- if (ptr2 != BufferTimes4) OS.XtFree (ptr2);
- }
- return mbcs;
- }
- }
- return mbcs;
-}
-
-/**
- * Converts a String (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page.
- *
- * @param codePage the code page to use for conversion
- * @param string the string to be converted
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (String codePage, String string) {
- return wcsToMbcs (codePage, string, false);
-}
-
-/**
- * Converts a String (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page. If the termination flag is true, the resulting
- * byte data will be null (zero) terminated.
- *
- * @param codePage the code page to use for conversion
- * @param string the string to be converted
- * @param terminate <code>true</code> if the result should be null terminated and false otherwise.
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
- if (terminate) {
- if (string == null) return NULL_BYTE_ARRAY;
- int count = string.length ();
- char [] buffer = new char [count + 1];
- string.getChars (0, count, buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
- } else {
- if (string == null) return EMPTY_BYTE_ARRAY;
- int count = string.length ();
- char [] buffer = new char [count];
- string.getChars (0, count, buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java
deleted file mode 100755
index f23fa76e27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java
+++ /dev/null
@@ -1,703 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object that
- * issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Button extends Control {
- Image image, bitmap, disabled;
- static final byte [] ARM_AND_ACTIVATE;
- static {
- String name = "ArmAndActivate";
- int length = name.length();
- char [] unicode = new char [length];
- name.getChars (0, length, unicode, 0);
- byte [] buffer = new byte [length + 1];
- for (int i = 0; i < length; i++) {
- buffer[i] = (byte) unicode[i];
- }
- ARM_AND_ACTIVATE = buffer;
- }
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Button (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the control is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
- if ((style & SWT.PUSH) != 0) {
- return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
- }
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
- return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
- }
- if ((style & SWT.ARROW) != 0) {
- return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
- }
- return style;
-}
-void click () {
- OS.XtCallActionProc (handle, ARM_AND_ACTIVATE, new XAnyEvent (), null, 0);
-}
-/**
-* Computes the preferred size.
-*/
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.ARROW) != 0) {
- Display display = getDisplay ();
- width += display.scrolledMarginX;
- height += display.scrolledMarginY;
- return new Point (width, height);
- }
- XtWidgetGeometry result = new XtWidgetGeometry ();
- result.request_mode = OS.CWWidth | OS.CWHeight;
- int [] argList2 = {OS.XmNrecomputeSize, 1};
- OS.XtSetValues(handle, argList2, argList2.length / 2);
- OS.XtQueryGeometry (handle, null, result);
- int [] argList3 = {OS.XmNrecomputeSize, 0};
- OS.XtSetValues(handle, argList3, argList3.length / 2);
- width += result.width;
- height += result.height;
- /**
- * Feature in Motif. If a button's labelType is XmSTRING but it
- * has no label set into it yet, recomputing the size will
- * not take into account the height of the font, as we would
- * like it to. Take care of this case.
- */
- int [] argList = {OS.XmNlabelType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == OS.XmSTRING) {
- int [] argList1 = {OS.XmNlabelString, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
- int xmString = argList1 [1];
- if (OS.XmStringEmpty (xmString)) height += getFontHeight ();
- }
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- int [] argList4 = new int [] {OS.XmNmarginLeft, 0, OS.XmNmarginRight, 0, OS.XmNmarginTop, 0, OS.XmNmarginBottom, 0};
- OS.XtGetValues (handle, argList4, argList4.length / 2);
- if (wHint != SWT.DEFAULT) width = wHint + argList4 [1] + argList4 [3] + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + argList4 [5] + argList4 [7] + (border * 2);
- }
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int borderWidth = (style & SWT.BORDER) != 0 ? 1 : 0;
- int parentHandle = parent.handle;
-
- /* ARROW button */
- if ((style & SWT.ARROW) != 0) {
- int alignment = OS.XmARROW_UP;
- if ((style & SWT.UP) != 0) alignment = OS.XmARROW_UP;
- if ((style & SWT.DOWN) != 0) alignment = OS.XmARROW_DOWN;
- if ((style & SWT.LEFT) != 0) alignment = OS.XmARROW_LEFT;
- if ((style & SWT.RIGHT) != 0) alignment = OS.XmARROW_RIGHT;
- int [] argList = {
- OS.XmNtraversalOn, 0,
- OS.XmNarrowDirection, alignment,
- OS.XmNborderWidth, borderWidth,
- OS.XmNancestorSensitive, 1,
- };
- handle = OS.XmCreateArrowButton (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.FLAT) != 0) {
- int [] argList1 = {OS.XmNshadowThickness, 1};
- OS.XtSetValues (handle, argList1, argList1.length / 2);
- }
- return;
- }
-
- /* Compute alignment */
- int alignment = OS.XmALIGNMENT_BEGINNING;
- if ((style & SWT.CENTER) != 0) alignment = OS.XmALIGNMENT_CENTER;
- if ((style & SWT.RIGHT) != 0) alignment = OS.XmALIGNMENT_END;
-
- /* TOGGLE button */
- if ((style & SWT.TOGGLE) != 0) {
- /*
- * Bug in Motif. When XmNindicatorOn is set to false,
- * Motif doesn't reset the shadow thickness to give a
- * push button look. The fix is to set the shadow
- * thickness when ever this resource is changed.
- */
- Display display = getDisplay ();
- int thickness = display.buttonShadowThickness;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNrecomputeSize, 0,
- OS.XmNindicatorOn, 0,
- OS.XmNshadowThickness, (style & SWT.FLAT) != 0 ? 1 : thickness,
- OS.XmNalignment, alignment,
- OS.XmNborderWidth, borderWidth,
- };
- handle = OS.XmCreateToggleButton (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- /* CHECK or RADIO button */
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- /*
- * Bug in Motif. For some reason, a toggle button
- * with XmNindicatorType XmONE_OF_MANY must have this
- * value set at creation or the highlight color will
- * not be correct. The fix is to set these values
- * on create.
- */
- int indicatorType = OS.XmONE_OF_MANY;
- if ((style & SWT.CHECK) != 0) indicatorType = OS.XmN_OF_MANY;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNrecomputeSize, 0,
- OS.XmNindicatorType, indicatorType,
- OS.XmNalignment, alignment,
- OS.XmNborderWidth, borderWidth,
- };
- handle = OS.XmCreateToggleButton (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- /* PUSH button */
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNrecomputeSize, 0,
- OS.XmNalignment, alignment,
- OS.XmNborderWidth, borderWidth,
- /*
- * This code is intentionally commented. On some
- * platforms, the standard behavior is that push
- * buttons are tab groups, traversed with the tab
- * key. On Motif, push buttons are tab items,
- * that are traversed with the arrow keys. This
- * behavior is unspecifed so the line remains
- * commented.
- */
-// OS.XmNnavigationType, OS.XmTAB_GROUP,
- };
- handle = OS.XmCreatePushButton (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & SWT.FLAT) != 0) {
- int [] argList1 = {OS.XmNshadowThickness, 1};
- OS.XtSetValues (handle, argList1, argList1.length / 2);
- }
-}
-void createWidget (int index) {
- super.createWidget (index);
- if ((style & SWT.PUSH) == 0) return;
- if (getShell ().parent == null) return;
- int [] argList = new int [] {OS.XmNdefaultButtonShadowThickness, 1};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-int defaultBackground () {
- return getDisplay ().buttonBackground;
-}
-int defaultFont () {
- return getDisplay ().buttonFont;
-}
-int defaultForeground () {
- return getDisplay ().buttonForeground;
-}
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the alignment will indicate the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) {
- int [] argList = {OS.XmNarrowDirection, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int direction = argList [1];
- if (direction == OS.XmARROW_UP) return SWT.UP;
- if (direction == OS.XmARROW_DOWN) return SWT.DOWN;
- if (direction == OS.XmARROW_LEFT) return SWT.LEFT;
- if (direction == OS.XmARROW_RIGHT) return SWT.RIGHT;
- return SWT.UP;
- }
- int [] argList = {OS.XmNalignment, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int alignment = argList [1];
- if (alignment == OS.XmALIGNMENT_BEGINNING) return SWT.LEFT;
- if (alignment == OS.XmALIGNMENT_CENTER) return SWT.CENTER;
- if (alignment == OS.XmALIGNMENT_END)return SWT.RIGHT;
- return SWT.CENTER;
-}
-boolean getDefault () {
- if ((style & SWT.PUSH) == 0) return false;
- int [] argList = {OS.XmNshowAsDefault, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-String getNameText () {
- return getText ();
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed. If the receiver is of any other type,
- * this method returns false.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int [] argList = {OS.XmNset, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) return "";
- int [] argList = {OS.XmNlabelString, 0, OS.XmNmnemonic, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int xmString = argList [1];
- int mnemonic = argList [3];
- if (mnemonic == OS.XK_VoidSymbol) mnemonic = 0;
- if (xmString == 0) error (SWT.ERROR_CANNOT_GET_TEXT);
- char [] result = null;
- int address = OS.XmStringUnparse (
- xmString,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address != 0) {
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- result = Converter.mbcsToWcs (getCodePage (), buffer);
- }
- if (xmString != 0) OS.XmStringFree (xmString);
- int count = 0;
- if (mnemonic != 0) count++;
- for (int i=0; i<result.length-1; i++)
- if (result [i] == Mnemonic) count++;
- char [] newResult = result;
- if ((count != 0) || (mnemonic != 0)) {
- newResult = new char [result.length + count];
- int i = 0, j = 0;
- while (i < result.length) {
- if ((mnemonic != 0) && (result [i] == mnemonic)) {
- if (j < newResult.length) newResult [j++] = Mnemonic;
- mnemonic = 0;
- }
- if ((newResult [j++] = result [i++]) == Mnemonic)
- if (j < newResult.length) newResult [j++] = Mnemonic;
- }
- }
- return new String (newResult);
-}
-void hookEvents () {
- super.hookEvents ();
- int callback = OS.XmNactivateCallback;
- int windowProc = getDisplay ().windowProc;
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) callback = OS.XmNvalueChangedCallback;
- OS.XtAddCallback (handle, callback, windowProc, SWT.Selection);
-}
-boolean mnemonicHit (char key) {
- if (!setFocus ()) return false;
- click ();
- return true;
-}
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-int processFocusIn () {
- super.processFocusIn ();
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if ((style & SWT.PUSH) == 0) return 0;
- getShell ().setDefaultButton (this, false);
- return 0;
-}
-int processFocusOut () {
- super.processFocusOut ();
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if ((style & SWT.PUSH) == 0) return 0;
- if (getDefault ()) {
- getShell ().setDefaultButton (null, false);
- }
- return 0;
-}
-int processSelection (int callData) {
- if ((style & SWT.RADIO) != 0) {
- if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) selectRadio ();
- }
- return super.processSelection (callData);
-}
-void propagateWidget (boolean enabled) {
- propagateHandle (enabled, handle);
- /*
- * Arrow do not participate in focus traversal.
- */
- if (enabled && (style & SWT.ARROW) != 0) {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-void releaseWidget () {
- super.releaseWidget ();
- int [] argList = {
- OS.XmNlabelPixmap, OS.XmUNSPECIFIED_PIXMAP,
- OS.XmNlabelInsensitivePixmap, OS.XmUNSPECIFIED_PIXMAP,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (bitmap != null) bitmap.dispose ();
- if (disabled != null) disabled.dispose ();
- image = bitmap = disabled = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-void selectRadio () {
- Control [] children = parent._getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (this != child && child instanceof Button) {
- Button button = (Button) child;
- if ((button.getStyle () & SWT.RADIO) != 0) {
- if (button.getSelection ()) {
- button.setSelection (false);
- button.postEvent (SWT.Selection);
- }
- }
- }
- }
- setSelection (true);
-}
-/**
- * Controls how text, images and arrows will be displayed
- * in the receiver. The argument should be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the argument indicates the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget();
- if ((style & SWT.ARROW) != 0) {
- int [] argList = {OS.XmNarrowDirection, OS.XmARROW_UP};
- if ((alignment & SWT.UP) != 0) argList [1] = OS.XmARROW_UP;
- if ((alignment & SWT.DOWN) != 0) argList [1] = OS.XmARROW_DOWN;
- if ((alignment & SWT.LEFT) != 0) argList [1] = OS.XmARROW_LEFT;
- if ((alignment & SWT.RIGHT) != 0) argList [1] = OS.XmARROW_RIGHT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- return;
- }
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- int [] argList = {OS.XmNalignment, OS.XmALIGNMENT_BEGINNING};
- if ((alignment & SWT.CENTER) != 0) argList [1] = OS.XmALIGNMENT_CENTER;
- if ((alignment & SWT.RIGHT) != 0) argList [1] = OS.XmALIGNMENT_END;
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-void setBackgroundPixel (int pixel) {
- super.setBackgroundPixel (pixel);
- int [] argList = {OS.XmNlabelType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == OS.XmPIXMAP) setBitmap (image);
-}
-void setBitmap (Image image) {
- int labelPixmap = OS.XmUNSPECIFIED_PIXMAP;
- int labelInsensitivePixmap = OS.XmUNSPECIFIED_PIXMAP;
- if (bitmap != null) bitmap.dispose ();
- if (disabled != null) disabled.dispose ();
- bitmap = disabled = null;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- Display display = getDisplay ();
- switch (image.type) {
- case SWT.BITMAP:
- labelPixmap = image.pixmap;
- disabled = new Image (display, image, SWT.IMAGE_DISABLE);
- labelInsensitivePixmap = disabled.pixmap;
- break;
- case SWT.ICON:
- Rectangle rect = image.getBounds ();
- bitmap = new Image (display, rect.width, rect.height);
- GC gc = new GC (bitmap);
- gc.setBackground (getBackground ());
- gc.fillRectangle (rect);
- gc.drawImage (image, 0, 0);
- gc.dispose ();
- labelPixmap = bitmap.pixmap;
- disabled = new Image (display, bitmap, SWT.IMAGE_DISABLE);
- labelInsensitivePixmap = disabled.pixmap;
- break;
- default:
- error (SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
- int [] argList = {
- OS.XmNlabelType, OS.XmPIXMAP,
- OS.XmNlabelPixmap, labelPixmap,
- OS.XmNlabelInsensitivePixmap, labelInsensitivePixmap,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-void setDefault (boolean value) {
- if ((style & SWT.PUSH) == 0) return;
- if (getShell ().parent == null) return;
- int [] argList = {OS.XmNshowAsDefault, (value ? 1 : 0)};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- setBitmap (this.image = image);
-}
-/**
- * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
- * <code>RADIO</code>, or <code>TOGGLE</code>.
- *
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int [] argList = {OS.XmNset, selected ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the button label. The label may include
- * the mnemonic character but must not contain line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.ARROW) != 0) return;
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
- int i=0, j=0, mnemonic=0;
- while (i < text.length) {
- if ((text [j++] = text [i++]) == Mnemonic) {
- if (i == text.length) {continue;}
- if (text [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = text [i];
- j--;
- }
- }
- while (j < text.length) text [j++] = 0;
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), text, true);
- int xmString = OS.XmStringParseText (
- buffer,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- if (xmString == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
- if (mnemonic == 0) mnemonic = OS.XK_VoidSymbol;
- int [] argList = {
- OS.XmNlabelType, OS.XmSTRING,
- OS.XmNlabelString, xmString,
- OS.XmNmnemonic, mnemonic,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (xmString != 0) OS.XmStringFree (xmString);
-}
-int traversalCode (int key, XKeyEvent xEvent) {
- return super.traversalCode (key, xEvent) | SWT.TRAVERSE_MNEMONIC;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java
deleted file mode 100755
index 456e7b27ef..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a surface for drawing
- * arbitrary graphics.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are <em>not</em> constructed
- * from aggregates of other controls. That is, they are either
- * painted using SWT graphics calls or are handled by native
- * methods.
- * </p>
- *
- * @see Composite
- */
-public class Canvas extends Composite {
- Caret caret;
-
-Canvas () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-/**
- * Returns the caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- *
- * @return the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Caret getCaret () {
- checkWidget();
- return caret;
-}
-
-short [] getIMECaretPos () {
- if (caret == null) return super.getIMECaretPos ();
- int width = caret.width;
- if (width <= 0) width = 2;
- return new short[]{(short) (caret.x + width), (short) (caret.y + caret.height)};
-}
-int processFocusIn () {
- int result = super.processFocusIn ();
- if (caret != null) caret.setFocus ();
- return result;
-}
-int processFocusOut () {
- int result = super.processFocusOut ();
- if (caret != null) caret.killFocus ();
- return result;
-}
-
-int processPaint (int callData) {
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- int result = super.processPaint (callData);
- if (isFocus) caret.setFocus ();
- return result;
-}
-
-void redrawWidget (int x, int y, int width, int height, boolean all) {
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.redrawWidget (x, y, width, height, all);
- if (isFocus) caret.setFocus ();
-}
-
-void releaseWidget () {
- if (caret != null) {
- caret.releaseWidget ();
- caret.releaseHandle ();
- }
- caret = null;
- super.releaseWidget();
-}
-
-/**
- * Scrolls a rectangular area of the receiver by first copying
- * the source area to the destination and then causing the area
- * of the source which is not covered by the destination to
- * be repainted. Children that intersect the rectangle are
- * optionally moved during the operation. In addition, outstanding
- * paint events are flushed before the source area is copied to
- * ensure that the contents of the canvas are drawn correctly.
- *
- * @param destX the x coordinate of the destination
- * @param destY the y coordinate of the destination
- * @param x the x coordinate of the source
- * @param y the y coordinate of the source
- * @param width the width of the area
- * @param height the height of the area
- * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- checkWidget();
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- if (!isVisible ()) return;
-
- /* Hide the caret */
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
-
- /* Flush outstanding exposes */
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return;
- XAnyEvent xEvent = new XAnyEvent ();
- OS.XSync (xDisplay, false); OS.XSync (xDisplay, false);
- while (OS.XCheckWindowEvent (xDisplay, xWindow, OS.ExposureMask, xEvent)) {
- OS.XtDispatchEvent (xEvent);
- }
-
- /* Scroll the window */
- int xGC = OS.XCreateGC (xDisplay, xWindow, 0, null);
- OS.XCopyArea (xDisplay, xWindow, xWindow, xGC, x, y, width, height, destX, destY);
- OS.XFreeGC (xDisplay, xGC);
- boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
- if (disjoint) {
- OS.XClearArea (xDisplay, xWindow, x, y, width, height, true);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.XClearArea (xDisplay, xWindow, newX, y, Math.abs (deltaX), height, true);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.XClearArea (xDisplay, xWindow, x, newY, width, Math.abs (deltaY), true);
- }
- }
-
- /* Show the caret */
- if (isFocus) caret.setFocus ();
-}
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.setBounds (x, y, width, height);
- if (isFocus) caret.setFocus ();
-}
-/**
- * Sets the receiver's caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- * @param caret the new caret for the receiver, may be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCaret (Caret caret) {
- checkWidget();
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (hasFocus ()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) {
- if (newCaret.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- newCaret.setFocus ();
- }
- }
-}
-
-public void setLocation (int x, int y) {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.setLocation (x, y);
- if (isFocus) caret.setFocus ();
-}
-public void setSize (int width, int height) {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.setSize (width, height);
- if (isFocus) caret.setFocus ();
-}
-void updateCaret () {
- if (caret == null) return;
- if (!IsDBLocale) return;
- short [] point = getIMECaretPos ();
- int ptr = OS.XtMalloc (4);
- OS.memmove (ptr, point, 4);
- int[] argList = {OS.XmNspotLocation, ptr};
- OS.XmImSetValues (handle, argList, argList.length / 2);
- if (ptr != 0) OS.XtFree (ptr);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java
deleted file mode 100755
index 72d90cbe85..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java
+++ /dev/null
@@ -1,490 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an i-beam that is typically used
- * as the insertion point for text.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Caret extends Widget {
- Canvas parent;
- Image image;
- int x, y, width, height;
- boolean moved, resized;
- boolean isVisible, isShowing;
- int blinkRate = 500;
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Caret (Canvas parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-boolean blinkCaret () {
- if (!isVisible) return true;
- if (!isShowing) return showCaret ();
- if (blinkRate == 0) return true;
- return hideCaret ();
-}
-void createWidget (int index) {
- super.createWidget (index);
- isVisible = true;
- if (parent.getCaret () == null) {
- parent.setCaret (this);
- }
-}
-boolean drawCaret () {
- if (parent == null) return false;
- if (parent.isDisposed ()) return false;
- int handle = parent.handle;
- int window = OS.XtWindow (handle);
- if (window == 0) return false;
- int xDisplay = OS.XtDisplay (handle);
- int gc = OS.XCreateGC (xDisplay, window, 0, null);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int foreground = argList [1];
- int background = argList [3];
- int color = foreground ^ background;
- OS.XSetFunction (xDisplay, gc, OS.GXxor);
- OS.XSetForeground (xDisplay, gc, color);
- int nWidth = width, nHeight = height;
- if (image != null) {
- Rectangle rect = image.getBounds ();
- nWidth = rect.width;
- nHeight = rect.height;
- }
- if (nWidth <= 0) nWidth = 2;
- OS.XFillRectangle (xDisplay, window, gc, x, y, nWidth, nHeight);
- OS.XFreeGC (xDisplay, gc);
- return true;
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Rectangle (x, y, rect.width, rect.height);
- }
- return new Rectangle (x, y, width, height);
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- return parent.getFont ();
-}
-/**
- * Returns the image that the receiver will use to paint the caret.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- return new Point (x, y);
-}
-/**
- * Returns the receiver's parent, which must be a <code>Canvas</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Canvas getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns a point describing the receiver's size.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Point (rect.width, rect.height);
- }
- return new Point (width, height);
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return isVisible;
-}
-boolean hideCaret () {
- Display display = getDisplay ();
- if (display.currentCaret != this) return false;
- if (!isShowing) return true;
- isShowing = false;
- return drawCaret ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return isVisible && parent.isVisible () && parent.hasFocus ();
-}
-boolean isFocusCaret () {
- Display display = getDisplay ();
- return this == display.currentCaret;
-}
-void killFocus () {
- Display display = getDisplay ();
- if (display.currentCaret != this) return;
- if (isVisible) hideCaret ();
- display.setCurrentCaret (null);
-}
-void releaseChild () {
- super.releaseChild ();
- if (this == parent.getCaret ()) parent.setCaret (null);
-}
-void releaseWidget () {
- super.releaseWidget ();
- Display display = getDisplay ();
- if (display.currentCaret == this) {
- if (isVisible) hideCaret ();
- display.setCurrentCaret (null);
- }
- parent = null;
- image = null;
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean samePosition, sameExtent, showing;
- samePosition = (this.x == x) && (this.y == y);
- sameExtent = (this.width == width) && (this.height == height);
- if ((samePosition) && (sameExtent)) return;
- if (isShowing) hideCaret ();
- this.x = x; this.y = y;
- this.width = width; this.height = height;
- if (sameExtent) {
- moved = true;
- if (isVisible ()) {
- moved = false;
- parent.updateCaret ();
- }
- } else {
- resized = true;
- if (isVisible ()) {
- moved = false;
- parent.updateCaret ();
- resized = false;
- }
- }
- if (isShowing) showCaret ();
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- checkWidget();
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-void setFocus () {
- Display display = getDisplay ();
- if (display.currentCaret == this) return;
- display.setCurrentCaret (this);
- if (isVisible) showCaret ();
-}
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
- if (font != null && font.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-/**
- * Sets the image that the receiver will use to paint the caret
- * to the image specified by the argument, or to the default
- * which is a filled rectangle if the argument is null
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (isShowing) hideCaret ();
- this.image = image;
- if (isShowing) showCaret ();
-}
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- setBounds (x, y, width, height);
-}
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- checkWidget();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-/**
- * Sets the receiver's size to the point specified by the arguments.
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- setBounds (x, y, width, height);
-}
-/**
- * Sets the receiver's size to the point specified by the argument.
- *
- * @param size the new extent for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- checkWidget();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible == isVisible) return;
- if (isVisible = visible) {
- showCaret ();
- } else {
- hideCaret ();
- }
-}
-boolean showCaret () {
- if (getDisplay ().currentCaret != this) return false;
- if (isShowing) return true;
- isShowing = true;
- return drawCaret ();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ColorDialog.java
deleted file mode 100755
index c3dbc44990..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ColorDialog.java
+++ /dev/null
@@ -1,528 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-
-/**
- * Instances of this class allow the user to select a color
- * from a predefined set of available colors.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ColorDialog extends Dialog {
- private static final int DEPTH_4 = 0; // index for COLOR_SWATCH_EXTENTS
- private static final int DEPTH_8 = 1; // index for COLOR_SWATCH_EXTENTS
- private static final int COLOR_SWATCH_EXTENTS[] = {40, 10}; // extents of the squares drawn to display a
- // color out of 4 bit and 8 bit color depth
- private static final int COLOR_SWATCH_BORDER = 1; // border between each color pad
-
- private Shell shell; // the dialog shell
- private Canvas colorsCanvas;
- private Label sampleLabel;
- private Canvas sampleCanvas;
- private Label selectionLabel;
- private Canvas selectionCanvas;
- private Button ok;
- private Button cancel;
-
- private boolean okSelected; // true if the dialog was hidden
- // because the ok button was selected
- private RGB rgb;
- private int colorDepth; // color depth of the display
- private int colorSwatchExtent; // the size of on square used
- // to display one color
- private Color colorGrid[][]; // the colors displayed in the dialog
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog(Shell parent) {
- this(parent, SWT.NULL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog(Shell parent, int style) {
- super(parent, style | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
- checkSubclass ();
-}
-
-void createChildren() {
- Shell dialog = getDialogShell();
- GridData gridData = new GridData();
- GridLayout layout = new GridLayout();
- final int ButtonHeight = 30;
- final int ColorChooserWidth = COLOR_SWATCH_EXTENTS[DEPTH_8] * 32 - COLOR_SWATCH_BORDER; // extent of one color field multiplied with number of fields in a row
- final int ColorChooserHeight = COLOR_SWATCH_EXTENTS[DEPTH_8] * 8 - COLOR_SWATCH_BORDER; // extent of one color field multiplied with number of rows
-
- layout.numColumns = 3;
- layout.marginWidth = 15;
- layout.marginHeight = 15;
- layout.horizontalSpacing = 10;
- layout.verticalSpacing = 2;
- dialog.setLayout(layout);
-
- // row one
- colorsCanvas = new Canvas(dialog, SWT.BORDER);
- gridData.widthHint = ColorChooserWidth;
- gridData.heightHint = ColorChooserHeight;
- gridData.verticalSpan = 2;
- gridData.horizontalSpan = 2;
- colorsCanvas.setLayoutData(gridData);
-
- // create ok and cancel buttons (row two and three)
- createOkCancel();
-
- // row three - empty row
- Label fillLabel = new Label(dialog, SWT.NULL);
- gridData = new GridData();
- gridData.heightHint = 5;
- gridData.horizontalSpan = layout.numColumns;
- fillLabel.setLayoutData(gridData);
-
- // row four - setup group box with sample text and canvas
- createSampleGroup(ColorChooserWidth);
- createSelectionGroup();
-}
-void createSampleGroup(int colorChooserWidth) {
- Shell dialog = getDialogShell();
- Group sampleGroup = new Group(dialog, SWT.NULL);
- GridData gridData = new GridData();
- GridLayout layout = new GridLayout();
- int sampleGroupWidth;
-
- sampleGroup.setText(SWT.getMessage("SWT_Sample"));
- gridData.horizontalAlignment = GridData.FILL;
- sampleGroup.setLayoutData(gridData);
- sampleGroup.setLayout(layout);
- sampleGroupWidth = (colorChooserWidth - layout.marginWidth * 4 - layout.horizontalSpacing * 4) / 2;
-
- sampleLabel = new Label(sampleGroup, SWT.CENTER | SWT.BORDER);
- sampleLabel.setAlignment(SWT.CENTER);
- sampleLabel.setText(SWT.getMessage("SWT_A_Sample_Text"));
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.widthHint = sampleGroupWidth;
- sampleLabel.setLayoutData(gridData);
-
- sampleCanvas = new Canvas(sampleGroup, SWT.BORDER);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.heightHint = 15;
- gridData.widthHint = sampleGroupWidth;
- sampleCanvas.setLayoutData(gridData);
-}
-void createSelectionGroup() {
- Shell dialog = getDialogShell();
- Group selectionGroup = new Group(dialog, SWT.NULL);
- GridData gridData = new GridData();
- GridLayout layout = new GridLayout();
-
- selectionGroup.setText(SWT.getMessage("SWT_Selection"));
- gridData.horizontalAlignment = GridData.FILL;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setLayout(layout);
-
- selectionLabel = new Label(selectionGroup, SWT.CENTER | SWT.BORDER);
- selectionLabel.setAlignment(SWT.CENTER);
- selectionLabel.setText(SWT.getMessage("SWT_Current_Selection"));
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- selectionLabel.setLayoutData(gridData);
-
- selectionCanvas = new Canvas(selectionGroup, SWT.BORDER);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.heightHint = 15;
- selectionCanvas.setLayoutData(gridData);
-}
-void disposeColors() {
- for (int row = 0; row < colorGrid.length; row++) {
- for (int column = 0; column < colorGrid[row].length; column++) {
- colorGrid[row][column].dispose();
- }
- }
-}
-void drawColor(int xIndex, int yIndex, Color color, GC gc) {
- int colorSwatchExtent = getColorSwatchExtent();
- int colorExtent = colorSwatchExtent - COLOR_SWATCH_BORDER;
-
- gc.setBackground(color);
- gc.fillRectangle(
- xIndex * colorSwatchExtent, yIndex * colorSwatchExtent,
- colorExtent, colorExtent);
-}
-Canvas getColorCanvas() {
- return colorsCanvas;
-}
-int getColorDepth() {
- return colorDepth;
-}
-Color [][] getColorGrid() {
- return colorGrid;
-}
-int getColorSwatchExtent() {
- return colorSwatchExtent;
-}
-/**
- * Returns the currently selected color in the receiver.
- *
- * @return the RGB value for the selected color, may be null
- *
- * @see PaletteData#getRGBs
- */
-public RGB getRGB() {
- return rgb;
-}
-Canvas getSampleCanvas() {
- return sampleCanvas;
-}
-Label getSampleText() {
- return sampleLabel;
-}
-Canvas getSelectionCanvas() {
- return selectionCanvas;
-}
-Label getSelectionText() {
- return selectionLabel;
-}
-void handleEvents(Event event) {
- Color selectionColor;
-
- if (event.type == SWT.Paint) {
- paint(event);
- }
- else
- if (event.type == SWT.MouseDown) {
- mouseDown(event);
- }
- else
- if (event.type == SWT.MouseMove) {
- mouseMove(event);
- }
- else
- if (event.type == SWT.Selection) {
- if (event.widget == getOKButton()) {
- setOkSelected(true);
- getDialogShell().setVisible(false);
- }
- else
- if (event.widget == getCancelButton()) {
- setOkSelected(false);
- getDialogShell().setVisible(false);
- }
- }
-}
-void initialize4BitColors() {
- Display display = getDialogShell().getDisplay();
-
- colorGrid[0][0] = new Color(display, 0, 0, 0);
- colorGrid[0][1] = new Color(display, 255, 255, 255);
- colorGrid[1][0] = new Color(display, 128, 128, 128);
- colorGrid[1][1] = new Color(display, 192, 192, 192);
-
- colorGrid[2][0] = new Color(display, 0, 0, 128);
- colorGrid[2][1] = new Color(display, 0, 0, 255);
- colorGrid[3][0] = new Color(display, 0, 128, 128);
- colorGrid[3][1] = new Color(display, 0, 255, 255);
-
- colorGrid[4][0] = new Color(display, 0, 128, 0);
- colorGrid[4][1] = new Color(display, 0, 255, 0);
- colorGrid[5][0] = new Color(display, 128, 128, 0);
- colorGrid[5][1] = new Color(display, 255, 255, 0);
-
- colorGrid[6][0] = new Color(display, 128, 0, 0);
- colorGrid[6][1] = new Color(display, 255, 0, 0);
- colorGrid[7][0] = new Color(display, 128, 0, 128);
- colorGrid[7][1] = new Color(display, 255, 0, 255);
-}
-void initialize8BitColors() {
- Display display = getDialogShell().getDisplay();
- int numColumns = colorGrid.length;
- int numRows = colorGrid[0].length;
- int iterationStep = 51;
- int row = 0;
- int column = 0;
- int red;
- int green;
- int blue;
-
- for (red = 0; red <= 255; red += iterationStep) {
- for (blue = 0; blue <= 255; blue += iterationStep) {
- if (blue == iterationStep && column < 20) { // hack to evenly distribute 256 colors on 32 columns
- blue += iterationStep;
- }
- for (green = 0; green <= 255; green += iterationStep) {
- if (row == 2 || row == 5) { // hack to evenly distribute 256 colors on 8 rows
- colorGrid[column][row++] = new Color(display, red, green - iterationStep / 2, blue);
- }
- if (row == numRows) {
- row = 0;
- column++;
- }
- colorGrid[column][row++] = new Color(display, red, green, blue);
- }
- }
- }
-}
-void initializeWidgets() {
- Display display = getDialogShell().getDisplay();
- Color selectionColor;
- if (rgb != null) {
- selectionColor = new Color(display, rgb);
- getSelectionCanvas().setBackground(selectionColor);
- getSelectionText().setBackground(selectionColor);
- selectionColor.dispose();
- }
- setColorDepth(display.getDepth());
-}
-void installListeners() {
- Canvas colorCanvas = getColorCanvas();
- Listener listener = new Listener() {
- public void handleEvent(Event event) {handleEvents(event);}
- };
-
- getOKButton().addListener(SWT.Selection, listener);
- getCancelButton().addListener(SWT.Selection, listener);
- colorCanvas.addListener(SWT.Paint, listener);
- colorCanvas.addListener(SWT.MouseDown, listener);
- colorCanvas.addListener(SWT.MouseMove, listener);
-}
-void mouseDown(Event event) {
- int swatchExtent = getColorSwatchExtent();
- Color colorGrid[][] = getColorGrid();
- Color color = colorGrid[event.x / swatchExtent][event.y / swatchExtent];
-
- getSelectionCanvas().setBackground(color);
- getSelectionText().setBackground(color);
-}
-void mouseMove(Event event) {
- int swatchExtent = getColorSwatchExtent();
- Color colorGrid[][] = getColorGrid();
- Color color = colorGrid[event.x / swatchExtent][event.y / swatchExtent];
-
- getSampleCanvas().setBackground(color);
- getSampleText().setBackground(color);
-}
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return the selected color, or null if the dialog was
- * cancelled, no color was selected, or an error
- * occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public RGB open() {
- Color selectionColor;
- Shell dialog = new Shell(getParent(), getStyle() | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
-
- setDialogShell(dialog);
- createChildren();
- installListeners();
- openModal();
- rgb = null;
- if (isOkSelected() == true) {
- selectionColor = getSelectionCanvas().getBackground();
- rgb = new RGB(
- selectionColor.getRed(),
- selectionColor.getGreen(),
- selectionColor.getBlue());
- }
- disposeColors();
- // Fix for 1G5NLY7
- if (dialog.isDisposed() == false) {
- dialog.dispose();
- }
- return rgb;
-}
-void paint(Event event) {
- Color colorGrid[][] = getColorGrid();
-
- for (int column = 0; column < colorGrid.length; column++) {
- for (int row = 0; row < colorGrid[0].length; row++) {
- drawColor(column, row, colorGrid[column][row], event.gc);
- }
- }
-}
-void setColorDepth(int bits) {
- colorDepth = bits;
- if (bits == 4) {
- colorSwatchExtent = COLOR_SWATCH_EXTENTS[DEPTH_4];
- colorGrid = new Color[8][2];
- initialize4BitColors();
- }
- else {
- colorSwatchExtent = COLOR_SWATCH_EXTENTS[DEPTH_8];
- colorGrid = new Color[32][8];
- initialize8BitColors();
- }
-}
-/**
- * Returns the receiver's selected color to be the argument.
- *
- * @param rgb the new RGB value for the selected color, may be
- * null to let the platform to select a default when
- * open() is called
- *
- * @see PaletteData#getRGBs
- */
-public void setRGB(RGB rgb) {
- this.rgb = rgb;
-}
-/**
- * Create the widgets of the dialog.
- */
-void createOkCancel() {
- Shell dialog = getDialogShell();
- GridData gridData;
-
- ok = new Button(dialog, SWT.PUSH);
- ok.setText(SWT.getMessage("SWT_OK"));
- dialog.setDefaultButton(ok);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.widthHint = 70;
- ok.setLayoutData(gridData);
-
- cancel = new Button(dialog, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel"));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- cancel.setLayoutData(gridData);
-}
-/**
- * Answer the cancel button
- */
-Button getCancelButton() {
- return cancel;
-}
-
-/**
- * Answer the dialog shell.
- */
-Shell getDialogShell() {
- return shell;
-}
-/**
- * Answer the ok button.
- */
-Button getOKButton() {
- return ok;
-}
-
-boolean isOkSelected() {
- return okSelected;
-}
-/**
- * Open the receiver and set its size to the size calculated by
- * the layout manager.
- */
-void openDialog() {
- Shell dialog = getDialogShell();
- Point pt;
- Rectangle displayRect;
- int widthLimit;
-
- // Start everything off by setting the shell size to its computed size.
- pt = dialog.computeSize(-1, -1, false);
-
- // Ensure that the width of the shell fits the display.
- displayRect = dialog.getDisplay().getBounds();
- widthLimit = displayRect.width * 7 / 8;
- if (pt.x > widthLimit) {
- pt = dialog.computeSize (widthLimit, -1, false);
- }
- dialog.setBounds (0, 0, pt.x, pt.y);
- dialog.setText(getText());
- // Open the window.
- dialog.open();
-}
-/**
- * Initialize the widgets of the receiver, open the dialog
- * and block the method until the dialog is closed by the user.
- */
-void openModal() {
- Shell dialog = getDialogShell();
- Display display = dialog.getDisplay();
-
- initializeWidgets();
- openDialog();
- while (dialog.isDisposed() == false && dialog.getVisible() == true) {
- if (display.readAndDispatch() == false) {
- display.sleep();
- }
- }
-}
-
-void setOkSelected(boolean newOkSelected) {
- okSelected = newOkSelected;
-}
-/**
- * Set the shell used as the dialog window.
- */
-void setDialogShell(Shell shell) {
- this.shell = shell;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Combo.java
deleted file mode 100755
index fa5a9d2bda..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Combo.java
+++ /dev/null
@@ -1,1282 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are controls that allow the user
- * to choose an item from a list of items, or optionally
- * enter a new value by typing it into an editable text
- * field. Often, <code>Combo</code>s are used in the same place
- * where a single selection <code>List</code> widget could
- * be used but space is limited. A <code>Combo</code> takes
- * less space than a <code>List</code> widget and shows
- * similar information.
- * <p>
- * Note: Since <code>Combo</code>s can contain both a list
- * and an editable text field, it is possible to confuse methods
- * which access one versus the other (compare for example,
- * <code>clearSelection()</code> and <code>deselectAll()</code>).
- * The API documentation is careful to indicate either "the
- * receiver's list" or the "the receiver's text field" to
- * distinguish between the two cases.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see List
- */
-public class Combo extends Composite {
- /**
- * the operating system limit for the number of characters
- * that the text field in an instance of this class can hold
- */
- public static int LIMIT;
-
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0x7FFFFFFF;
- }
-
- boolean ignoreSelect;
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Combo (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.XmComboBoxAddItem(handle, xmString, -1, false);
- OS.XmStringFree (xmString);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
-
- /*
- * Feature in Motif. When an index is out of range,
- * the list widget adds the item at the end. This
- * behavior is not wrong but it is unwanted. The
- * fix is to check the range before adding the item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index <= argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.XmComboBoxAddItem(handle, xmString, index + 1, false);
- OS.XmStringFree (xmString);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a combo box that has a border using Windows style
- * bits. All combo boxes draw their own border and
- * do not use the standard Windows border styles.
- * Therefore, no matter what style bits are specified,
- * clear the BORDER bits so that the SWT style will
- * match the Windows widget.
- *
- * The Windows behavior is currently implemented on
- * all platforms.
- */
- style &= ~SWT.BORDER;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
- if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
- return style;
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget();
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XmTextClearSelection (argList[1], OS.XtLastTimestampProcessed (xDisplay));
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int [] argList = {
- OS.XmNlist, 0,
- OS.XmNtextField, 0,
- OS.XmNitemCount, 0,
- OS.XmNmarginWidth, 0,
- OS.XmNshadowThickness, 0,
- OS.XmNhighlightThickness, 0,
- OS.XmNarrowSize, 0,
- OS.XmNarrowSpacing, 0,
- };
- OS.XtGetValues(handle, argList, argList.length / 2);
- XtWidgetGeometry result = new XtWidgetGeometry ();
- result.request_mode = OS.CWWidth;
- OS.XtQueryGeometry (argList[1], null, result);
- int width = result.width, height = getTextHeight();
- int[] argList2 = {OS.XmNmarginWidth, 0, OS.XmNshadowThickness, 0};
- OS.XtGetValues(argList[3], argList2, argList2.length / 2);
- if ((style & SWT.READ_ONLY) == 0) width += (2 * argList[7]);
- if ((style & SWT.DROP_DOWN) != 0) {
- width += argList[13] + argList[15];
- } else {
- int itemCount = (argList[5] == 0) ? 5 : argList[5];
- height += (getItemHeight () * itemCount);
- }
- width += (2 * argList[9])
- + (2 * argList[11])
- + (2 * argList2[1])
- + (2 * argList2[3]);
- if (argList[5] == 0) width = DEFAULT_WIDTH;
- if (hHint != SWT.DEFAULT) height = hHint;
- if (wHint != SWT.DEFAULT) width = wHint;
- Rectangle rect = computeTrim (0, 0, width, height);
- return new Point (rect.width, rect.height);
-}
-void createHandle (int index) {
- state |= HANDLE;
-
- /*
- * Feature in Motif. When items are added or removed
- * from a combo, it may request and be granted, a new
- * preferred size. This behavior is unwanted. The fix
- * is to create a parent for the list that will disallow
- * geometry requests.
- */
- int parentHandle = parent.handle;
- int [] argList1 = {OS.XmNancestorSensitive, 1};
- formHandle = OS.XmCreateForm (parentHandle, null, argList1, argList1.length / 2);
- if (formHandle == 0) error (SWT.ERROR_NO_HANDLES);
- int comboBoxType = OS.XmDROP_DOWN_COMBO_BOX;
- if ((style & SWT.SIMPLE) != 0) {
- comboBoxType = OS.XmCOMBO_BOX;
- } else if ((style & SWT.READ_ONLY) != 0) {
- comboBoxType = OS.XmDROP_DOWN_LIST;
- }
- int [] argList2 = {
- OS.XmNcomboBoxType, comboBoxType,
- OS.XmNtopAttachment, OS.XmATTACH_FORM,
- OS.XmNbottomAttachment, OS.XmATTACH_FORM,
- OS.XmNleftAttachment, OS.XmATTACH_FORM,
- OS.XmNrightAttachment, OS.XmATTACH_FORM,
- OS.XmNresizable, 0,
- };
- handle = OS.XmCreateComboBox (formHandle, null, argList2, argList2.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- if (index == -1) return;
- int [] argList = {OS.XmNtextField, 0, OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- if (OS.XmListPosSelected (argList[3], index + 1)) {
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (argList[1], new byte[1]);
- OS.XmTextSetInsertionPosition (argList[1], 0);
- display.setWarnings (warnings);
- OS.XmListDeselectAllItems (argList[3]);
- }
-}
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget();
- int [] argList = {OS.XmNtextField, 0, OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (argList[1], new byte[1]);
- OS.XmTextSetInsertionPosition (argList[1], 0);
- display.setWarnings(warnings);
- OS.XmListDeselectAllItems (argList[3]);
-}
-
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] argList = {OS.XmNitemCount, 0, OS.XmNitems, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- if (argList [3] == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int ptr = argList [3] + (index * 4);
- int [] buffer1 = new int [1];
- OS.memmove (buffer1, ptr, 4);
- ptr = buffer1 [0];
- int address = OS.XmStringUnparse (
- ptr,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- return decodeString(new String (Converter.mbcsToWcs (getCodePage (), buffer)));
-}
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- int [] listHandleArgs = {OS.XmNlist, 0};
- OS.XtGetValues (handle, listHandleArgs, listHandleArgs.length / 2);
- int [] argList = {OS.XmNlistSpacing, 0, OS.XmNhighlightThickness, 0};
- OS.XtGetValues (listHandleArgs[1], argList, argList.length / 2);
- int spacing = argList [1], highlight = argList [3];
- /* Result is from empirical analysis on Linux and AIX */
- return getFontHeight () + spacing + (2 * highlight);
-}
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int [] argList = {OS.XmNitems, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int items = argList [1], itemCount = argList [3];
- int [] buffer1 = new int [1];
- String [] result = new String [itemCount];
- String codePage = getCodePage ();
- for (int i = 0; i < itemCount; i++) {
- OS.memmove (buffer1, items, 4);
- int ptr = buffer1 [0];
- int address = OS.XmStringUnparse (
- ptr,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- result[i] = decodeString(new String (Converter.mbcsToWcs (codePage, buffer)));
- items += 4;
- }
- return result;
-}
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget();
- int [] start = new int [1], end = new int [1];
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XmTextGetSelectionPosition (argList[1], start, end);
- if (start [0] == end [0]) {
- start [0] = end [0] = OS.XmTextGetInsertionPosition (argList[1]);
- }
- return new Point (start [0], end [0]);
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- int [] argList = {OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- int index = OS.XmListGetKbdItemPos (argList[1]);
- if (OS.XmListPosSelected (argList[1], index)) return index - 1;
- int [] count = new int [1], positions = new int [1];
- if (!OS.XmListGetSelectedPos (argList[1], positions, count)) return -1;
- if (count [0] == 0) return -1;
- int address = positions [0];
- int [] indices = new int [1];
- OS.memmove (indices, address, 4);
- OS.XtFree (address);
- return indices [0] - 1;
-}
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- int ptr = OS.XmTextGetString (argList[1]);
- if (ptr == 0) return "";
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- return decodeString(new String (Converter.mbcsToWcs (getCodePage (), buffer)));
-}
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget();
- if ((style & SWT.DROP_DOWN) != 0) {
- /*
- * Bug in MOTIF. For some reason, XtQueryGeometry ()
- * returns the wrong height when the combo is not realized.
- * The fix is to force the combo to be realized by forcing
- * the shell to be realized.
- */
- if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
- XtWidgetGeometry result = new XtWidgetGeometry ();
- result.request_mode = OS.CWHeight;
- OS.XtQueryGeometry (handle, null, result);
- return result.height;
- } else {
- /* Calculate text field height. */
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int [] argList2 = {OS.XmNmarginHeight, 0};
- OS.XtGetValues (argList[1], argList2, argList2.length / 2);
- int height = getFontHeight ();
- XRectangle rect = new XRectangle ();
- OS.XmWidgetGetDisplayRect (argList[1], rect);
- height += (rect.y * 2) + (2 * argList2[1]);
-
- /* Add in combo box margins. */
- int [] argList3 = {OS.XmNmarginHeight, 0, OS.XmNshadowThickness, 0, OS.XmNhighlightThickness, 0};
- OS.XtGetValues(handle, argList3, argList3.length / 2);
- height += (2 * argList3[1]) + (2 * argList3[3]) + (2 * argList3[5]);
-
- return height;
- }
-}
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return OS.XmTextGetMaxLength (argList[1]);
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNselectionCallback, windowProc, SWT.Selection);
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XtAddCallback (argList[1], OS.XmNactivateCallback, windowProc, SWT.DefaultSelection);
- OS.XtAddCallback (argList[1], OS.XmNvalueChangedCallback, windowProc, SWT.Modify);
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) return -1;
-
- int [] argList = {OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- int index = OS.XmListItemPos (argList[1], xmString);
- OS.XmStringFree (xmString);
- return index - 1;
-}
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] argList = {OS.XmNitems, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int items = argList [1], itemCount = argList [3];
- if (!((0 <= start) && (start < itemCount))) return -1;
- byte [] buffer1 = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer1);
- if (xmString == 0) return -1;
- int index = start;
- items += start * 4;
- int [] buffer2 = new int [1];
- while (index < itemCount) {
- OS.memmove (buffer2, items, 4);
- if (OS.XmStringCompare (buffer2 [0], xmString)) break;
- items += 4; index++;
- }
- OS.XmStringFree (xmString);
- if (index == itemCount) return -1;
- return index;
-}
-int processSelection (int callData) {
- /*
- * Bug in MOTIF. If items have been added and removed from a
- * combo then users are able to select an empty drop-down item
- * in the combo once and force a resulting callback. In such
- * cases we want to eat this callback so that listeners are not
- * notified.
- */
- if (ignoreSelect || getSelectionIndex() == -1)
- return 0;
-
- return super.processSelection(callData);
-}
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- /*
- * Feature in Motif. An index out of range handled
- * correctly by the list widget but causes an unwanted
- * Xm Warning. The fix is to check the range before
- * deleting an item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- OS.XmComboBoxDeletePos (handle, index + 1);
-}
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- if (start > end) return;
- /*
- * Feature in Motif. An index out of range handled
- * correctly by the list widget but causes an unwanted
- * Xm Warning. The fix is to check the range before
- * deleting an item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= start && start < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- int newEnd = Math.min (end, argList [1] - 1);
- for (int i = start; i <= newEnd; i++) {
- OS.XmComboBoxDeletePos (handle, start + 1);
- }
- if (end >= argList [1]) error (SWT.ERROR_INVALID_RANGE);
-}
-void register () {
- super.register ();
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- WidgetTable.put(argList[1], this);
-}
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-
- int [] argList = {OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int index = OS.XmListItemPos (argList[1], xmString);
-
- OS.XmStringFree (xmString);
- if (index == 0) error (SWT.ERROR_INVALID_ARGUMENT);
- OS.XmComboBoxDeletePos (handle, index);
-}
-/**
- * Removes all of the items from the receiver's list.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- int [] argList = {OS.XmNtextField, 0, OS.XmNlist, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (argList[1], new byte[1]);
- OS.XmTextSetInsertionPosition (argList[1], 0);
- display.setWarnings(warnings);
- OS.XmListDeselectAllItems (argList[3]);
-
- for (int i = 0; i < argList[5]; i++) {
- OS.XmComboBoxDeletePos(handle, 1);
- }
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index == -1) {
- int [] argList = {OS.XmNtextField, 0, OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (argList[1], new byte[1]);
- OS.XmTextSetInsertionPosition (argList[1], 0);
- display.setWarnings (warnings);
- OS.XmListDeselectAllItems (argList[3]);
- } else {
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) return;
- int [] argList2 = {OS.XmNselectedPosition, index};
- ignoreSelect = true;
- OS.XtSetValues(handle, argList2, argList2.length / 2);
- ignoreSelect = false;
- }
-}
-/**
-* Sets the widget bounds.
-*/
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- int newHeight = ((style & SWT.DROP_DOWN) != 0) ? getTextHeight() : height;
- super.setBounds (x, y, width, newHeight);
-}
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- int [] argList = {OS.XmNlist, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [3])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- boolean isSelected = OS.XmListPosSelected (argList[1], index + 1);
- OS.XmListReplaceItemsPosUnselected (argList[1], new int [] {xmString}, 1, index + 1);
- if (isSelected) OS.XmListSelectPos (argList[1], index + 1, false);
- OS.XmStringFree (xmString);
-}
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- if (items.length == 0) {
- removeAll();
- return;
- }
-
- int index = 0;
- int [] table = new int [items.length];
- String codePage = getCodePage ();
- while (index < items.length) {
- String string = items [index];
- if (string == null) break;
- byte [] buffer = Converter.wcsToMbcs (codePage, encodeString(string), true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) break;
- table [index++] = xmString;
- }
- int ptr = OS.XtMalloc (index * 4);
- OS.memmove (ptr, table, index * 4);
- int [] argList = {OS.XmNitems, ptr, OS.XmNitemCount, index};
- OS.XtSetValues (handle, argList, argList.length / 2);
- for (int i=0; i<index; i++) OS.XmStringFree (table [i]);
- OS.XtFree (ptr);
- if (index < items.length) error (SWT.ERROR_ITEM_NOT_ADDED);
-}
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
-
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
-
- /* Clear the highlight before setting the selection. */
- int position = OS.XmTextGetLastPosition (argList[1]);
-
- /*
- * Bug in MOTIF. XmTextSetSelection () fails to set the
- * selection when the receiver is not realized. The fix
- * is to force the receiver to be realized by forcing the
- * shell to be realized. If the receiver is realized before
- * the shell, MOTIF fails to draw the text widget and issues
- * lots of X BadDrawable errors.
- */
- if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
-
- /* Set the selection. */
- int xDisplay = OS.XtDisplay (argList[1]);
- if (xDisplay == 0) return;
- int nStart = Math.min (Math.max (Math.min (selection.x, selection.y), 0), position);
- int nEnd = Math.min (Math.max (Math.max (selection.x, selection.y), 0), position);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetSelection (argList[1], nStart, nEnd, OS.XtLastTimestampProcessed (xDisplay));
-
- /* Force the i-beam to follow the highlight/selection. */
- OS.XmTextSetInsertionPosition (argList[1], nEnd);
- display.setWarnings(warnings);
-}
-/**
-* Sets the widget size.
-*/
-public void setSize (int width, int height) {
- checkWidget();
- int newHeight = ((style & SWT.DROP_DOWN) != 0) ? getTextHeight () : height;
- super.setSize (width, newHeight);
-}
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /*
- * The read-only and non-read-only cases must be handled
- * separately here because the platform will allow the
- * text of a read-only combo to be set to any value,
- * regardless of whether it appears in the combo's item
- * list or not.
- */
- if ((style & SWT.READ_ONLY) != 0) {
- int index = indexOf (string);
- if (index != -1) select (index);
- } else {
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) return;
- int [] argList = {OS.XmNtextField, 0, OS.XmNlist, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int index = OS.XmListItemPos (argList[3], xmString);
- if (index > 0) {
- /* The list contains the item. */
- OS.XmComboBoxSelectItem(handle, xmString);
- } else {
- /* The list does not contain the item. */
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (argList[1], buffer);
- OS.XmTextSetInsertionPosition (argList[1], 0);
- display.setWarnings(warnings);
- }
- OS.XmStringFree (xmString);
- /*
- * Bug in Linux. When the widget is multi-line
- * it does not send a Modify to notify the application
- * that the text has changed. The fix is to send the event.
- */
- if (OS.IsLinux && (style & SWT.MULTI) != 0) sendEvent (SWT.Modify);
- }
-}
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XmTextSetMaxLength (argList[1], limit);
-}
-
-void deregister () {
- super.deregister ();
- int [] argList = {OS.XmNtextField, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- WidgetTable.remove (argList[1]);
-}
-void enableWidget (boolean enabled) {
- super.enableWidget (enabled);
- int [] argList = {
- OS.XmNlist, 0,
- OS.XmNtextField, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- enableHandle (enabled, argList [1]);
- enableHandle (enabled, argList [3]);
-}
-/**
- * Bug in Motif.
- * Empty strings in the combo will cause GPFs if a) they
- * are the only items in the combo or b) if they are
- * included in an array which is set as the value of the
- * combo's items resource. To protect against these GPFs,
- * make sure that no empty strings are added to the combo.
- * The solution is to add a space to empty strings or
- * strings which are all spaces. This space is removed
- * when answering the text of items which are all spaces.
- */
-String encodeString(String string) {
- for (int i = 0; i < string.length(); i++) {
- if (string.charAt(i) != ' ') {
- return string;
- }
- }
- return string + ' ';
-}
-/**
- * Bug in Motif.
- * Empty strings in the combo will cause GPFs if a) they
- * are the only items in the combo or b) if they are
- * included in an array which is set as the value of the
- * combo's items resource. To protect against these GPFs,
- * make sure that no empty strings are added to the combo.
- * The solution is to add a space to empty strings or
- * strings which include only spaces. A space is removed
- * when answering the text of items which are all spaces.
- */
-String decodeString(String string) {
- if (string.length() == 0) return string;
-
- for (int i = 0; i < string.length(); i++) {
- if (string.charAt(i) != ' ') {
- return string;
- }
- }
- return string.substring(0, string.length() - 1);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
deleted file mode 100755
index 3fe3f64336..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
+++ /dev/null
@@ -1,652 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are controls which are capable
- * of containing other controls.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are constructed from aggregates
- * of other controls.
- * </p>
- *
- * @see Canvas
- */
-public class Composite extends Scrollable {
- Layout layout;
- int damagedRegion;
- Control [] tabList;
-
-Composite () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Composite (Composite parent, int style) {
- super (parent, style);
-}
-Control [] _getChildren () {
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int ptr = argList [1], count = argList [3];
- if (count == 0 || ptr == 0) return new Control [0];
- int [] handles = new int [count];
- OS.memmove (handles, ptr, count * 4);
- Control [] children = new Control [count];
- int i = 0, j = 0;
- while (i < count) {
- int handle = handles [i];
- if (handle != 0) {
- Widget widget = WidgetTable.get (handle);
- if (widget != null && widget != this) {
- if (widget instanceof Control) {
- children [j++] = (Control) widget;
- }
- }
- }
- i++;
- }
- if (i == j) return children;
- Control [] newChildren = new Control [j];
- System.arraycopy (children, 0, newChildren, 0, j);
- return newChildren;
-}
-Control [] _getTabList () {
- if (tabList == null) return tabList;
- int index = 0, count = 0;
- while (index < tabList.length) {
- if (!tabList [index].isDisposed ()) count++;
- index++;
- }
- if (index == count) return tabList;
- Control [] newList = new Control [count];
- index = 0;
- for (int i=0; i<tabList.length; i++) {
- if (!tabList [index].isDisposed ()) {
- newList [index++] = tabList [i];
- }
- }
- tabList = newList;
- return tabList;
-}
-/**
-* Computes the preferred size.
-*/
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size;
- if (layout != null) {
- if ((wHint == SWT.DEFAULT) || (hHint == SWT.DEFAULT)) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = new Point (wHint, hHint);
- }
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = computeTrim (0, 0, size.x, size.y);
- return new Point (trim.width, trim.height);
-}
-Control [] computeTabList () {
- Control result [] = super.computeTabList ();
- if (result.length == 0) return result;
- Control [] list = tabList != null ? _getTabList () : _getChildren ();
- for (int i=0; i<list.length; i++) {
- Control child = list [i];
- Control [] childList = child.computeTabList ();
- if (childList.length != 0) {
- Control [] newResult = new Control [result.length + childList.length];
- System.arraycopy (result, 0, newResult, 0, result.length);
- System.arraycopy (childList, 0, newResult, result.length, childList.length);
- result = newResult;
- }
- }
- return result;
-}
-protected void checkSubclass () {
- /* Do nothing - Subclassing is allowed */
-}
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
- int parentHandle = parent.handle;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) == 0) {
- int border = (style & SWT.BORDER) != 0 ? 1 : 0;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNborderWidth, border,
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNtraversalOn, (style & SWT.NO_FOCUS) != 0 ? 0 : 1,
- };
- handle = OS.XmCreateDrawingArea (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- Display display = getDisplay ();
- OS.XtOverrideTranslations (handle, display.tabTranslations);
- OS.XtOverrideTranslations (handle, display.arrowTranslations);
- } else {
- createScrolledHandle (parentHandle);
- }
-}
-void createScrolledHandle (int topHandle) {
- int [] argList = {OS.XmNancestorSensitive, 1};
- scrolledHandle = OS.XmCreateMainWindow (topHandle, null, argList, argList.length / 2);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- Display display = getDisplay ();
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- int thickness = display.buttonShadowThickness;
- int [] argList1 = {
- OS.XmNmarginWidth, 3,
- OS.XmNmarginHeight, 3,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNshadowType, OS.XmSHADOW_IN,
- OS.XmNshadowThickness, thickness,
- };
- formHandle = OS.XmCreateForm (scrolledHandle, null, argList1, argList1.length / 2);
- if (formHandle == 0) error (SWT.ERROR_NO_HANDLES);
- int [] argList2 = {
- OS.XmNtopAttachment, OS.XmATTACH_FORM,
- OS.XmNbottomAttachment, OS.XmATTACH_FORM,
- OS.XmNleftAttachment, OS.XmATTACH_FORM,
- OS.XmNrightAttachment, OS.XmATTACH_FORM,
- OS.XmNresizable, 0,
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- };
- handle = OS.XmCreateDrawingArea (formHandle, null, argList2, argList2.length / 2);
- } else {
- int [] argList3 = {
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNtraversalOn, (style & SWT.NO_FOCUS) != 0 ? 0 : 1,
- };
- handle = OS.XmCreateDrawingArea (scrolledHandle, null, argList3, argList3.length / 2);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- OS.XtOverrideTranslations (handle, display.tabTranslations);
- OS.XtOverrideTranslations (handle, display.arrowTranslations);
-}
-int defaultBackground () {
- return getDisplay ().compositeBackground;
-}
-int defaultForeground () {
- return getDisplay ().compositeForeground;
-}
-public boolean forceFocus () {
- checkWidget();
- Control [] children = _getChildren ();
- int [] traversals = new int [children.length];
- int [] argList = new int [] {OS.XmNtraversalOn, 0};
- for (int i=0; i<children.length; i++) {
- OS.XtGetValues (children [i].handle, argList, argList.length / 2);
- traversals [i] = argList [1];
- argList [1] = 0;
- OS.XtSetValues (children [i].handle, argList, argList.length / 2);
- }
- boolean result = super.forceFocus ();
- for (int i=0; i<children.length; i++) {
- argList [1] = traversals [i];
- OS.XtSetValues (children [i].handle, argList, argList.length / 2);
- }
- return result;
-}
-/**
- * Returns an array containing the receiver's children.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of children, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return an array of children
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control [] getChildren () {
- checkWidget();
- return _getChildren ();
-}
-int getChildrenCount () {
- /*
- * NOTE: The current implementation will count
- * non-registered children.
- * */
- int [] argList = {OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns layout which is associated with the receiver, or
- * null if one has not been set.
- *
- * @return the receiver's layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Layout getLayout () {
- checkWidget();
- return layout;
-}
-/**
- * Gets the last specified tabbing order for the control.
- *
- * @return tabList the ordered list of controls representing the tab order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setTabList
- */
-public Control [] getTabList () {
- checkWidget ();
- Control [] tabList = _getTabList ();
- if (tabList == null) {
- int count = 0;
- Control [] list =_getChildren ();
- for (int i=0; i<list.length; i++) {
- if (list [i].isTabGroup ()) count++;
- }
- tabList = new Control [count];
- int index = 0;
- for (int i=0; i<list.length; i++) {
- if (list [i].isTabGroup ()) {
- tabList [index++] = list [i];
- }
- }
- }
- return tabList;
-}
-void hookEvents () {
- super.hookEvents ();
- if ((state & CANVAS) != 0) {
- int windowProc = getDisplay ().windowProc;
- OS.XtInsertEventHandler (handle, 0, true, windowProc, -1, OS.XtListTail);
- }
-}
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the receiver does not have a layout, do nothing.
- * <p>
- * This is equivalent to calling <code>layout(true)</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout () {
- checkWidget();
- layout (true);
-}
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the the argument is <code>true</code> the layout must not rely
- * on any cached information it is keeping about the children. If it
- * is <code>false</code> the layout may (potentially) simplify the
- * work it is doing by assuming that the state of the none of the
- * receiver's children has changed since the last layout.
- * If the receiver does not have a layout, do nothing.
- *
- * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout (boolean changed) {
- checkWidget();
- if (layout == null) return;
- int count = getChildrenCount ();
- if (count == 0) return;
- layout.layout (this, changed);
-}
-Point minimumSize () {
- Control [] children = _getChildren ();
- int width = 0, height = 0;
- for (int i=0; i<children.length; i++) {
- Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
- }
- return new Point (width, height);
-}
-void moveAbove (int handle1, int handle2) {
- if (handle1 == handle2) return;
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int ptr = argList [1], count = argList [3];
- if (count == 0 || ptr == 0) return;
- int [] handles = new int [count];
- OS.memmove (handles, ptr, count * 4);
- if (handle2 == 0) handle2 = handles [0];
- int i = 0, index1 = -1, index2 = -1;
- while (i < count) {
- int handle = handles [i];
- if (handle == handle1) index1 = i;
- if (handle == handle2) index2 = i;
- if (index1 != -1 && index2 != -1) break;
- i++;
- }
- if (index1 == -1 || index2 == -1) return;
- if (index1 == index2) return;
- if (index1 < index2) {
- System.arraycopy (handles, index1 + 1, handles, index1, index2 - index1 - 1);
- handles [index2 - 1] = handle1;
- } else {
- System.arraycopy (handles, index2, handles, index2 + 1, index1 - index2);
- handles [index2] = handle1;
- }
- OS.memmove (ptr, handles, count * 4);
-}
-void moveBelow (int handle1, int handle2) {
- if (handle1 == handle2) return;
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int ptr = argList [1], count = argList [3];
- if (count == 0 || ptr == 0) return;
- int [] handles = new int [count];
- OS.memmove (handles, ptr, count * 4);
- if (handle2 == 0) handle2 = handles [count - 1];
- int i = 0, index1 = -1, index2 = -1;
- while (i < count) {
- int handle = handles [i];
- if (handle == handle1) index1 = i;
- if (handle == handle2) index2 = i;
- if (index1 != -1 && index2 != -1) break;
- i++;
- }
- if (index1 == -1 || index2 == -1) return;
- if (index1 == index2) return;
- if (index1 < index2) {
- System.arraycopy (handles, index1 + 1, handles, index1, index2 - index1);
- handles [index2] = handle1;
- } else {
- System.arraycopy (handles, index2 + 1, handles, index2 + 2, index1 - index2 - 1);
- handles [index2 + 1] = handle1;
- }
- OS.memmove (ptr, handles, count * 4);
-}
-int processNonMaskable (int callData) {
- if ((state & CANVAS) != 0) {
- XExposeEvent xEvent = new XExposeEvent ();
- OS.memmove (xEvent, callData, XExposeEvent.sizeof);
- if (xEvent.type == OS.GraphicsExpose) processPaint (callData);
- }
- return 0;
-}
-int processPaint (int callData) {
- if ((state & CANVAS) == 0) {
- return super.processPaint (callData);
- }
- if (!hooks (SWT.Paint)) return 0;
- if ((style & SWT.NO_MERGE_PAINTS) != 0) {
- return super.processPaint (callData);
- }
- XExposeEvent xEvent = new XExposeEvent ();
- OS.memmove (xEvent, callData, XExposeEvent.sizeof);
- int exposeCount = xEvent.count;
- if (exposeCount == 0) {
- XAnyEvent event = new XAnyEvent ();
- Display display = getDisplay ();
- display.exposeCount = 0;
- int checkExposeProc = display.checkExposeProc;
- OS.XCheckIfEvent (xEvent.display, event, checkExposeProc, xEvent.window);
- exposeCount = display.exposeCount;
- }
- if (exposeCount == 0 && damagedRegion == 0) {
- return super.processPaint (callData);
- }
- if (damagedRegion == 0) damagedRegion = OS.XCreateRegion ();
- OS.XtAddExposureToRegion (callData, damagedRegion);
- if (exposeCount != 0) return 0;
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return 0;
- Event event = new Event ();
- GC gc = event.gc = new GC (this);
- OS.XSetRegion (xDisplay, gc.handle, damagedRegion);
- XRectangle rect = new XRectangle ();
- OS.XClipBox (damagedRegion, rect);
- OS.XDestroyRegion (damagedRegion);
- damagedRegion = 0;
- event.time = OS.XtLastTimestampProcessed (xDisplay);
- event.x = rect.x; event.y = rect.y;
- event.width = rect.width; event.height = rect.height;
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 0;
-}
-void propagateChildren (boolean enabled) {
- super.propagateChildren (enabled);
- Control [] children = _getChildren ();
- for (int i = 0; i < children.length; i++) {
- Control child = children [i];
- if (child.getEnabled ()) {
- child.propagateChildren (enabled);
- }
- }
-}
-void realizeChildren () {
- super.realizeChildren ();
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- children [i].realizeChildren ();
- }
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_BACKGROUND) == 0 && (style & SWT.NO_REDRAW_RESIZE) != 0) return;
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return;
- int flags = 0;
- XSetWindowAttributes attributes = new XSetWindowAttributes ();
- if ((style & SWT.NO_BACKGROUND) != 0) {
- flags |= OS.CWBackPixmap;
- attributes.background_pixmap = OS.None;
- }
- if ((style & SWT.NO_REDRAW_RESIZE) == 0) {
- flags |= OS.CWBitGravity;
- attributes.bit_gravity = OS.ForgetGravity;
- }
- if (flags != 0) {
- OS.XChangeWindowAttributes (xDisplay, xWindow, flags, attributes);
- }
- }
-}
-void redrawWidget (int x, int y, int width, int height, boolean all) {
- super.redrawWidget (x, y, width, height, all);
- if (!all) return;
- Control [] children = _getChildren ();
- for (int i = 0; i < children.length; i++) {
- Control child = children [i];
- Point location = child.getClientLocation ();
- child.redrawWidget (x - location.x, y - location.y, width, height, all);
- }
-}
-void releaseChildren () {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (!child.isDisposed ()) {
- child.releaseWidget ();
- child.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseChildren ();
- super.releaseWidget ();
- layout = null;
- tabList = null;
- if (damagedRegion != 0) OS.XDestroyRegion (damagedRegion);
- damagedRegion = 0;
-}
-void setBackgroundPixel (int pixel) {
- super.setBackgroundPixel (pixel);
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_BACKGROUND) != 0) {
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return;
- XSetWindowAttributes attributes = new XSetWindowAttributes ();
- attributes.background_pixmap = OS.None;
- OS.XChangeWindowAttributes (xDisplay, xWindow, OS.CWBackPixmap, attributes);
- }
- }
-}
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- if (layout != null) layout (false);
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget();
- this.layout = layout;
-}
-public void setSize (int width, int height) {
- super.setSize (width, height);
- if (layout != null) layout (false);
-}
-/**
- * Sets the tabbing order for the specified controls to
- * match the order that they occur in the argument list.
- *
- * @param tabList the ordered list of controls representing the tab order; must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTabList (Control [] tabList) {
- checkWidget ();
- if (tabList == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<tabList.length; i++) {
- Control control = tabList [i];
- if (control == null) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- this.tabList = tabList;
-}
-boolean setTabGroupFocus () {
- if (isTabItem ()) return setTabItemFocus ();
- if ((style & SWT.NO_FOCUS) == 0) {
- boolean takeFocus = true;
- if ((state & CANVAS) != 0) {
- takeFocus = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
- }
- if (takeFocus && setTabItemFocus ()) return true;
- }
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.isTabItem () && child.setTabItemFocus ()) return true;
- }
- return false;
-}
-boolean setTabItemFocus () {
- if ((style & SWT.NO_FOCUS) == 0) {
- boolean takeFocus = true;
- if ((state & CANVAS) != 0) {
- takeFocus = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
- }
- if (takeFocus) {
- if (!isShowing ()) return false;
- if (forceFocus ()) return true;
- }
- }
- return super.setTabItemFocus ();
-}
-int traversalCode (int key, XKeyEvent xEvent) {
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_FOCUS) != 0) return 0;
- if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) return 0;
- }
- return super.traversalCode (key, xEvent);
-}
-boolean translateMnemonic (char key, XKeyEvent xEvent) {
- if (super.translateMnemonic (key, xEvent)) return true;
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.translateMnemonic (key, xEvent)) return true;
- }
- return false;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
deleted file mode 100755
index 2fe265adcf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
+++ /dev/null
@@ -1,2681 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Control is the abstract superclass of all windowed user interface classes.
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b>
- * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
- * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Control extends Widget implements Drawable {
- Composite parent;
- int fontList;
- Menu menu;
- String toolTipText;
- Object layoutData;
-Control () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Control (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control gains or loses focus, by sending
- * it one of the messages defined in the <code>FocusListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #removeFocusListener
- */
-public void addFocusListener(FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.FocusIn,typedListener);
- addListener(SWT.FocusOut,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard, by sending
- * it one of the messages defined in the <code>KeyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #removeKeyListener
- */
-public void addKeyListener(KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.KeyUp,typedListener);
- addListener(SWT.KeyDown,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when mouse buttons are pressed and released, by sending
- * it one of the messages defined in the <code>MouseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #removeMouseListener
- */
-public void addMouseListener(MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseDown,typedListener);
- addListener(SWT.MouseUp,typedListener);
- addListener(SWT.MouseDoubleClick,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse passes or hovers over controls, by sending
- * it one of the messages defined in the <code>MouseTrackListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #removeMouseTrackListener
- */
-public void addMouseTrackListener (MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseEnter,typedListener);
- addListener (SWT.MouseExit,typedListener);
- addListener (SWT.MouseHover,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse moves, by sending it one of the
- * messages defined in the <code>MouseMoveListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #removeMouseMoveListener
- */
-public void addMouseMoveListener(MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.MouseMove,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver needs to be painted, by sending it
- * one of the messages defined in the <code>PaintListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #removePaintListener
- */
-public void addPaintListener(PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Paint,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when traversal events occur, by sending it
- * one of the messages defined in the <code>TraverseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #removeTraverseListener
- */
-public void addTraverseListener (TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Traverse,typedListener);
-}
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size of the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- return computeSize (wHint, hHint, true);
-}
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p><p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
- * @return the preferred size of the control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = DEFAULT_WIDTH;
- int height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2;
- height += border * 2;
- return new Point (width, height);
-}
-
-Control computeTabGroup () {
- if (isTabGroup ()) return this;
- return parent.computeTabGroup ();
-}
-
-Control computeTabRoot () {
- Control [] tabList = parent._getTabList ();
- if (tabList != null) {
- int index = 0;
- while (index < tabList.length) {
- if (tabList [index] == this) break;
- index++;
- }
- if (index == tabList.length) {
- if (isTabGroup ()) return this;
- }
- }
- return parent.computeTabRoot ();
-}
-
-Control [] computeTabList () {
- if (isTabGroup ()) {
- if (getVisible () && getEnabled ()) {
- return new Control [] {this};
- }
- }
- return new Control [0];
-}
-
-void createWidget (int index) {
- super.createWidget (index);
-
- /*
- * Register for the IME. This is necessary on single byte
- * platforms as well as double byte platforms in order to
- * get composed characters. For example, accented characters
- * on a German locale.
- */
- OS.XmImRegister (handle, 0);
-
- /*
- * Feature in MOTIF. When a widget is created before the
- * parent has been realized, the widget is created behind
- * all siblings in the Z-order. When a widget is created
- * after the parent has been realized, it is created in
- * front of all siblings. This is not incorrect but is
- * unexpected. The fix is to force all widgets to always
- * be created behind their siblings.
- */
- int topHandle = topHandle ();
- if (OS.XtIsRealized (topHandle)) {
- int window = OS.XtWindow (topHandle);
- if (window != 0) {
- int display = OS.XtDisplay (topHandle);
- if (display != 0) OS.XLowerWindow (display, window);
- }
- /*
- * Make that the widget has been properly realized
- * because the widget was created after the parent
- * has been realized. This is not part of the fix
- * for Z-order in the code above.
- */
- realizeChildren ();
- }
-
- /*
- * Bug in Motif. Under certain circumstances, when a
- * text widget is created as a child of another control
- * that has drag and drop, starting a drag in the text
- * widget causes a protection fault. The fix is to
- * disable the built in drag and drop for all widgets
- * by overriding the drag start traslation.
- */
- Display display = getDisplay ();
- OS.XtOverrideTranslations (handle, display.dragTranslations);
-
- /*
- * Feature in Motif. When the XmNfontList resource is set for
- * a widget, Motif creates a copy of the fontList and disposes
- * the copy when the widget is disposed. This means that when
- * the programmer queries the font, not only will the handle be
- * different but the font will be unexpectedly disposed when
- * the widget is disposed. This can cause GP's when the font
- * is set in another widget. The fix is to cache the font the
- * the programmer provides. The initial value of the cache is
- * the default font for the widget.
- */
- fontList = defaultFont ();
-}
-int defaultBackground () {
- return getDisplay ().defaultBackground;
-}
-int defaultFont () {
- return getDisplay ().defaultFontList;
-}
-int defaultForeground () {
- return getDisplay ().defaultForeground;
-}
-void enableWidget (boolean enabled) {
- enableHandle (enabled, handle);
-}
-char findMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while (index < length && string.charAt (index) != Mnemonic) index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != Mnemonic) return string.charAt (index);
- index++;
- } while (index < length);
- return '\0';
-}
-int fontHandle () {
- return handle;
-}
-/**
- * Forces the receiver to have the <em>keyboard focus</em>, causing
- * all keyboard events to be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setFocus
- */
-public boolean forceFocus () {
- checkWidget();
- Decorations shell = menuShell ();
- shell.setSavedFocus (this);
- shell.bringToTop ();
- return OS.XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
-}
-/**
- * Returns the receiver's background color.
- *
- * @return the background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getBackground () {
- checkWidget();
- return Color.motif_new (getDisplay (), getXColor (getBackgroundPixel ()));
-}
-int getBackgroundPixel () {
- int [] argList = {OS.XmNbackground, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the receiver's border width.
- *
- * @return the border width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getBorderWidth () {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNborderWidth, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0, OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- int borders = argList [9] * 2;
- return new Rectangle ((short) argList [1], (short) argList [3], argList [5] + borders, argList [7] + borders);
-}
-Point getClientLocation () {
- short [] handle_x = new short [1], handle_y = new short [1];
- OS.XtTranslateCoords (handle, (short) 0, (short) 0, handle_x, handle_y);
- short [] topHandle_x = new short [1], topHandle_y = new short [1];
- OS.XtTranslateCoords (parent.handle, (short) 0, (short) 0, topHandle_x, topHandle_y);
- return new Point (handle_x [0] - topHandle_x [0], handle_y [0] - topHandle_y [0]);
-}
-String getCodePage () {
- return Converter.getCodePage (OS.XtDisplay (handle), fontList);
-}
-/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] argList = {OS.XmNsensitive, 0};
- OS.XtGetValues (topHandle (), argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- return Font.motif_new (getDisplay (), fontList);
-}
-
-int getFontAscent () {
-
- /* Create a font context to iterate over each element in the font list */
- int [] buffer = new int [1];
- if (!OS.XmFontListInitFontContext (buffer, fontList)) {
- error (SWT.ERROR_NO_HANDLES);
- }
- int context = buffer [0];
-
- /* Values discovering during iteration */
- int ascent = 0;
- XFontStruct fontStruct = new XFontStruct ();
- int fontListEntry;
- int [] fontStructPtr = new int [1];
- int [] fontNamePtr = new int [1];
-
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry (context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont (fontListEntry, buffer);
- if (buffer [0] == 0) {
- /* FontList contains a single font */
- OS.memmove (fontStruct, fontPtr, XFontStruct.sizeof);
- int fontAscent = Math.max (fontStruct.ascent, fontStruct.max_bounds_ascent);
- if (fontAscent > ascent) ascent = fontAscent;
- } else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet (fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int [nFonts];
- OS.memmove (fontStructs, fontStructPtr [0], nFonts * 4);
-
- /* Go through each fontStruct in the font set */
- for (int i=0; i<nFonts; i++) {
- OS.memmove (fontStruct, fontStructs[i], XFontStruct.sizeof);
- int fontAscent = Math.max (fontStruct.ascent, fontStruct.max_bounds_ascent);
- if (fontAscent > ascent) ascent = fontAscent;
- }
- }
- }
-
- OS.XmFontListFreeFontContext (context);
- return ascent;
-}
-
-int getFontHeight () {
-
- /* Create a font context to iterate over each element in the font list */
- int [] buffer = new int [1];
- if (!OS.XmFontListInitFontContext (buffer, fontList)) {
- error (SWT.ERROR_NO_HANDLES);
- }
- int context = buffer [0];
-
- /* Values discovering during iteration */
- int height = 0;
- XFontStruct fontStruct = new XFontStruct ();
- int fontListEntry;
- int [] fontStructPtr = new int [1];
- int [] fontNamePtr = new int [1];
-
- /* Go through each entry in the font list. */
- while ((fontListEntry = OS.XmFontListNextEntry (context)) != 0) {
- int fontPtr = OS.XmFontListEntryGetFont (fontListEntry, buffer);
- if (buffer [0] == 0) {
- /* FontList contains a single font */
- OS.memmove (fontStruct, fontPtr, XFontStruct.sizeof);
- int fontAscent = Math.max (fontStruct.ascent, fontStruct.max_bounds_ascent);
- int fontDescent = Math.max (fontStruct.descent, fontStruct.max_bounds_descent);
- int fontHeight = fontAscent + fontDescent;
- if (fontHeight > height) height = fontHeight;
- } else {
- /* FontList contains a fontSet */
- int nFonts = OS.XFontsOfFontSet (fontPtr, fontStructPtr, fontNamePtr);
- int [] fontStructs = new int [nFonts];
- OS.memmove (fontStructs, fontStructPtr [0], nFonts * 4);
-
- /* Go through each fontStruct in the font set */
- for (int i=0; i<nFonts; i++) {
- OS.memmove (fontStruct, fontStructs[i], XFontStruct.sizeof);
- int fontAscent = Math.max (fontStruct.ascent, fontStruct.max_bounds_ascent);
- int fontDescent = Math.max (fontStruct.descent, fontStruct.max_bounds_descent);
- int fontHeight = fontAscent + fontDescent;
- if (fontHeight > height) height = fontHeight;
- }
- }
- }
-
- OS.XmFontListFreeFontContext (context);
- return height;
-}
-//int getFontList () {
-// int fontHandle = fontHandle ();
-// int [] argList = {OS.XmNfontList, 0};
-// OS.XtGetValues (fontHandle, argList, argList.length / 2);
-// if (argList [1] != 0) return argList [1];
-// if (fontList == 0) fontList = defaultFont ();
-// return fontList;
-//}
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getForeground () {
- checkWidget();
- return Color.motif_new (getDisplay (), getXColor (getForegroundPixel ()));
-}
-int getForegroundPixel () {
- int [] argList = {OS.XmNforeground, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-short [] getIMECaretPos () {
- return new short[]{0, 0};
-}
-/**
- * Returns layout data which is associated with the receiver.
- *
- * @return the receiver's layout data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Object getLayoutData () {
- checkWidget();
- return layoutData;
-}
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- return new Point ((short) argList [1], (short) argList [3]);
-}
-/**
- * Returns the receiver's pop up menu if it has one, or null
- * if it does not. All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget();
- return menu;
-}
-int getNavigationType () {
- int [] argList = {OS.XmNnavigationType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the receiver's parent, which must be a <code>Composite</code>
- * or null when the receiver is a shell that was created with null or
- * a display for a parent.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Composite getParent () {
- checkWidget();
- return parent;
-}
-Control [] getPath () {
- int count = 0;
- Shell shell = getShell ();
- Control control = this;
- while (control != shell) {
- count++;
- control = control.parent;
- }
- control = this;
- Control [] result = new Control [count];
- while (control != shell) {
- result [--count] = control;
- control = control.parent;
- }
- return result;
-}
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget();
- return parent.getShell ();
-}
-/**
- * Returns a point describing the receiver's size. The
- * x coordinate of the result is the width of the receiver.
- * The y coordinate of the result is the height of the
- * receiver.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- int borders = argList [5] * 2;
- return new Point (argList [1] + borders, argList [3] + borders);
-}
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNmappedWhenManaged, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-XColor getXColor (int pixel) {
- int display = OS.XtDisplay (handle);
- if (display == 0) return null;
- int [] argList = {OS.XmNcolormap, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int colormap = argList [1];
- if (colormap == 0) return null;
- XColor color = new XColor ();
- color.pixel = pixel;
- OS.XQueryColor (display, colormap, color);
- return color;
-}
-boolean hasFocus () {
- return this == getDisplay ().getFocusControl ();
-}
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.XtAddEventHandler (handle, OS.KeyPressMask, false, windowProc, SWT.KeyDown);
- OS.XtAddEventHandler (handle, OS.KeyReleaseMask, false, windowProc, SWT.KeyUp);
- OS.XtAddEventHandler (handle, OS.ButtonPressMask, false, windowProc, SWT.MouseDown);
- OS.XtAddEventHandler (handle, OS.ButtonReleaseMask, false, windowProc, SWT.MouseUp);
- OS.XtAddEventHandler (handle, OS.PointerMotionMask, false, windowProc, SWT.MouseMove);
- OS.XtAddEventHandler (handle, OS.EnterWindowMask, false, windowProc, SWT.MouseEnter);
- OS.XtAddEventHandler (handle, OS.LeaveWindowMask, false, windowProc, SWT.MouseExit);
- OS.XtInsertEventHandler (handle, OS.ExposureMask, false, windowProc, SWT.Paint, OS.XtListTail);
- OS.XtInsertEventHandler (handle, OS.FocusChangeMask, false, windowProc, SWT.FocusIn, OS.XtListTail);
- OS.XtAddCallback (handle, OS.XmNhelpCallback, windowProc, SWT.Help);
-}
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- checkWidget();
- if (!OS.XtIsRealized (handle)) {
- Shell shell = getShell ();
- shell.realizeWidget ();
- }
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int xGC = OS.XCreateGC (xDisplay, xWindow, 0, null);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.XSetGraphicsExposures (xDisplay, xGC, false);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0, OS.XmNcolormap, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (data != null) {
- data.device = getDisplay ();
- data.display = xDisplay;
- data.drawable = xWindow;
- data.foreground = argList [1];
- data.background = argList [3];
- data.fontList = fontList;
- data.colormap = argList [5];
- }
- return xGC;
-}
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int xGC, GCData data) {
- checkWidget ();
- int xDisplay = 0;
- if (data != null) xDisplay = data.display;
- if (xDisplay == 0 && handle != 0) xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.XFreeGC (xDisplay, xGC);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-/**
- * Returns <code>true</code> if the receiver has the user-interface
- * focus, and <code>false</code> otherwise.
- *
- * @return the receiver's focus state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isFocusControl () {
- checkWidget();
- return hasFocus ();
-}
-/**
- * Returns <code>true</code> if the underlying operating
- * system supports this reparenting, otherwise <code>false</code>
- *
- * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isReparentable () {
- checkWidget();
- return false;
-}
-boolean isShowing () {
- /*
- * This is not complete. Need to check if the
- * widget is obscurred by a parent or sibling.
- */
- if (!isVisible ()) return false;
- Control control = this;
- while (control != null) {
- Point size = control.getSize ();
- if (size.x == 1 || size.y == 1) {
- return false;
- }
- control = control.parent;
- }
- return true;
-}
-boolean isTabGroup () {
- int code = traversalCode (0, null);
- if ((code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0) return false;
- return (code & (SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_TAB_NEXT)) != 0;
-}
-boolean isTabItem () {
- int code = traversalCode (0, null);
- return (code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0;
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return getVisible () && parent.isVisible ();
-}
-void manageChildren () {
- OS.XtSetMappedWhenManaged (handle, false);
- OS.XtManageChild (handle);
- int [] argList1 = {OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
- OS.XtResizeWidget (handle, 1, 1, argList1 [1]);
- OS.XtSetMappedWhenManaged (handle, true);
-}
-Decorations menuShell () {
- return parent.menuShell ();
-}
-boolean mnemonicHit (char key) {
- return false;
-}
-boolean mnemonicMatch (char key) {
- return false;
-}
-/**
- * Moves the receiver above the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the top of the drawing order. The control at
- * the top of the drawing order will not be covered by other
- * controls even if they occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveAbove (Control control) {
- checkWidget();
- if (control != null && control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- setZOrder (control, true);
-}
-/**
- * Moves the receiver below the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the bottom of the drawing order. The control at
- * the bottom of the drawing order will be covered by all other
- * controls which occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveBelow (Control control) {
- checkWidget();
- if (control != null && control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- setZOrder (control, false);
-}
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack () {
- checkWidget();
- pack (true);
-}
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- * <p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack (boolean changed) {
- checkWidget();
- setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
-}
-int processDefaultSelection (int callData) {
- postEvent (SWT.DefaultSelection);
- return 0;
-}
-int processFocusIn () {
- sendEvent (SWT.FocusIn);
- // widget could be disposed at this point
- if (handle == 0) return 0;
- processIMEFocusIn ();
- return 0;
-}
-int processFocusOut () {
- sendEvent (SWT.FocusOut);
- // widget could be disposed at this point
- if (handle == 0) return 0;
- processIMEFocusOut ();
- return 0;
-}
-int processHelp (int callData) {
- sendHelpEvent (callData);
- return 0;
-}
-int processIMEFocusIn () {
- if (!(hooks (SWT.KeyDown) || hooks (SWT.KeyUp))) return 0;
- short [] point = getIMECaretPos ();
- int ptr = OS.XtMalloc (4);
- OS.memmove (ptr, point, 4);
-
- /*
- * Bug in Motif. On Linux Japanese only, XmImSetFocusValues will cause
- * a GPF. The fix is to call XmImVaSetFocusValues instead.
- */
- OS.XmImVaSetFocusValues (handle,
- OS.XmNforeground, getForegroundPixel(),
- OS.XmNbackground, getBackgroundPixel(),
- OS.XmNspotLocation, ptr,
- OS.XmNfontList, fontList,
- 0);
-
- if (ptr != 0) OS.XtFree (ptr);
- return 0;
-}
-int processIMEFocusOut () {
- if (!(hooks (SWT.KeyDown) || hooks (SWT.KeyUp))) return 0;
- OS.XmImUnsetFocus (handle);
- return 0;
-}
-int processKeyDown (int callData) {
- XKeyEvent xEvent = new XKeyEvent ();
- OS.memmove (xEvent, callData, XKeyEvent.sizeof);
- if (xEvent.keycode != 0) {
- sendKeyEvent (SWT.KeyDown, xEvent);
- } else {
- sendIMEKeyEvent (SWT.KeyDown, xEvent);
- }
- return 0;
-}
-int processKeyUp (int callData) {
- XKeyEvent xEvent = new XKeyEvent ();
- OS.memmove (xEvent, callData, XKeyEvent.sizeof);
- if (menu != null && xEvent.state == OS.ShiftMask) {
- byte [] buffer = new byte [1];
- int [] keysym = new int [1];
- OS.XLookupString (xEvent, buffer, buffer.length, keysym, null);
- if (keysym [0] == OS.XK_F10) {
- menu.setVisible (true);
- return 0;
- }
- }
- sendKeyEvent (SWT.KeyUp, xEvent);
- return 0;
-}
-int processModify (int callData) {
- sendEvent (SWT.Modify);
- return 0;
-}
-int processMouseDown (int callData) {
- Display display = getDisplay ();
- Shell shell = getShell ();
- display.hideToolTip ();
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- sendMouseEvent (SWT.MouseDown, xEvent.button, xEvent);
- if (xEvent.button == 2 && hooks (SWT.DragDetect)) {
- sendEvent (SWT.DragDetect);
- }
- if (xEvent.button == 3 && menu != null) {
- OS.XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
- menu.setVisible (true);
- }
- int clickTime = display.getDoubleClickTime ();
- int lastTime = display.lastTime, eventTime = xEvent.time;
- int lastButton = display.lastButton, eventButton = xEvent.button;
- if (lastButton == eventButton && lastTime != 0 && Math.abs (lastTime - eventTime) <= clickTime) {
- sendMouseEvent (SWT.MouseDoubleClick, eventButton, xEvent);
- }
- display.lastTime = eventTime == 0 ? 1 : eventTime;
- display.lastButton = eventButton;
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
- if (!shell.isDisposed ()) {
- shell.setActiveControl (this);
- }
- return 0;
-}
-int processMouseEnter (int callData) {
- XCrossingEvent xEvent = new XCrossingEvent ();
- OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- if (xEvent.mode != OS.NotifyNormal) return 0;
- if (xEvent.subwindow != 0) return 0;
- Event event = new Event ();
- event.x = xEvent.x;
- event.y = xEvent.y;
- postEvent (SWT.MouseEnter, event);
- return 0;
-}
-int processMouseMove (int callData) {
- Display display = getDisplay ();
- display.addMouseHoverTimeOut (handle);
- XMotionEvent xEvent = new XMotionEvent ();
- OS.memmove (xEvent, callData, XMotionEvent.sizeof);
- sendMouseEvent (SWT.MouseMove, 0, xEvent);
- return 0;
-}
-int processMouseExit (int callData) {
- Display display = getDisplay ();
- display.removeMouseHoverTimeOut ();
- display.hideToolTip ();
- XCrossingEvent xEvent = new XCrossingEvent ();
- OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- if (xEvent.mode != OS.NotifyNormal) return 0;
- if (xEvent.subwindow != 0) return 0;
- Event event = new Event ();
- event.x = xEvent.x;
- event.y = xEvent.y;
- postEvent (SWT.MouseExit, event);
- return 0;
-}
-int processMouseHover (int id) {
- Display display = getDisplay ();
- Event event = new Event ();
- Point local = toControl (display.getCursorLocation ());
- event.x = local.x; event.y = local.y;
- postEvent (SWT.MouseHover, event);
- display.showToolTip (handle, toolTipText);
- return 0;
-}
-int processMouseUp (int callData) {
- Display display = getDisplay ();
- display.hideToolTip ();
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- sendMouseEvent (SWT.MouseUp, xEvent.button, xEvent);
- return 0;
-}
-int processPaint (int callData) {
- if (!hooks (SWT.Paint)) return 0;
- XExposeEvent xEvent = new XExposeEvent ();
- OS.memmove (xEvent, callData, XExposeEvent.sizeof);
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return 0;
- Event event = new Event ();
- event.count = xEvent.count;
- event.time = OS.XtLastTimestampProcessed (xDisplay);
- event.x = xEvent.x; event.y = xEvent.y;
- event.width = xEvent.width; event.height = xEvent.height;
- GC gc = event.gc = new GC (this);
- XRectangle rect = new XRectangle ();
- rect.x = (short) xEvent.x; rect.y = (short) xEvent.y;
- rect.width = (short) xEvent.width; rect.height = (short) xEvent.height;
- OS.XSetClipRectangles (xDisplay, gc.handle, 0, 0, rect, 1, OS.Unsorted);
- sendEvent (SWT.Paint, event);
- if (!gc.isDisposed ()) gc.dispose ();
- event.gc = null;
- return 0;
-}
-int processSelection (int callData) {
- postEvent (SWT.Selection);
- return 0;
-}
-int processSetFocus (int callData) {
-
- /* Get the focus change event */
- XFocusChangeEvent xEvent = new XFocusChangeEvent ();
- OS.memmove (xEvent, callData, XFocusChangeEvent.sizeof);
-
- /* Ignore focus changes caused by grabbing and ungrabing */
- if (xEvent.mode != OS.NotifyNormal) return 0;
-
- /* Only process focus callbacks between windows */
- if (xEvent.detail != OS.NotifyAncestor &&
- xEvent.detail != OS.NotifyInferior &&
- xEvent.detail != OS.NotifyNonlinear) return 0;
-
- /*
- * Ignore focus change events when the window getting or losing
- * focus is a menu. Because XmGetFocusWidget() does not answer
- * the menu shell (it answers the menu parent), it is necessary
- * to use XGetInputFocus() to get the real X focus window.
- */
- int xDisplay = xEvent.display;
- if (xDisplay == 0) return 0;
- int [] unused = new int [1], xWindow = new int [1];
- OS.XGetInputFocus (xDisplay, xWindow, unused);
- if (xWindow [0] != 0) {
- int widget = OS.XtWindowToWidget (xDisplay, xWindow [0]);
- if (widget != 0 && OS.XtClass (widget) == OS.XmMenuShellWidgetClass ()) return 0;
- }
-
- /* Process the focus change for the widget */
- switch (xEvent.type) {
- case OS.FocusIn: {
- Shell shell = getShell ();
- processFocusIn ();
- // widget could be disposed at this point
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
- if (!shell.isDisposed ()) {
- shell.setActiveControl (this);
- }
- break;
- }
- case OS.FocusOut: {
- Shell shell = getShell ();
- Display display = getDisplay ();
-
- processFocusOut ();
- // widget could be disposed at this point
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
- if (!shell.isDisposed ()) {
- Control control = display.getFocusControl ();
- if (control == null || shell != control.getShell () ) {
- shell.setActiveControl (null);
- }
- }
- break;
- }
- }
- return 0;
-}
-
-void propagateChildren (boolean enabled) {
- propagateWidget (enabled);
-}
-void propagateWidget (boolean enabled) {
- propagateHandle (enabled, handle);
-}
-void realizeChildren () {
- if (!isEnabled ()) propagateWidget (false);
-}
-/**
- * Causes the entire bounds of the receiver to be marked
- * as needing to be redrawn. The next time a paint request
- * is processed, the control will be completely painted.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw () {
- checkWidget();
- redrawWidget (0, 0, 0, 0, false);
-}
-/**
- * Causes the rectangular area of the receiver specified by
- * the arguments to be marked as needing to be redrawn.
- * The next time a paint request is processed, that area of
- * the receiver will be painted. If the <code>all</code> flag
- * is <code>true</code>, any children of the receiver which
- * intersect with the specified area will also paint their
- * intersecting areas. If the <code>all</code> flag is
- * <code>false</code>, the children will not be painted.
- *
- * @param x the x coordinate of the area to draw
- * @param y the y coordinate of the area to draw
- * @param width the width of the area to draw
- * @param height the height of the area to draw
- * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget ();
- if (width <= 0 || height <= 0) return;
- redrawWidget (x, y, width, height, all);
-}
-void redrawWidget (int x, int y, int width, int height, boolean all) {
- redrawHandle (x, y, width, height, handle);
-}
-void releaseWidget () {
- /*
- * Restore the default font for the widget in case the
- * application disposes the widget font in the dispose
- * callback. If a font is disposed while it is still
- * in use in the widget, Motif GP's.
- */
- int fontList = defaultFont ();
- if (this.fontList != fontList) {
- int fontHandle = fontHandle ();
- int [] argList2 = {OS.XmNfontList, fontList};
- OS.XtSetValues (fontHandle, argList2, argList2.length / 2);
- }
- super.releaseWidget ();
- Display display = getDisplay ();
- display.releaseToolTipHandle (handle);
- toolTipText = null;
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- menu = null;
- OS.XmImUnregister (handle);
- parent = null;
- layoutData = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control gains or loses focus.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #addFocusListener
- */
-public void removeFocusListener(FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.FocusIn, listener);
- eventTable.unhook(SWT.FocusOut, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #addKeyListener
- */
-public void removeKeyListener(KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.KeyUp, listener);
- eventTable.unhook(SWT.KeyDown, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when mouse buttons are pressed and released.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #addMouseListener
- */
-public void removeMouseListener(MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.MouseDown, listener);
- eventTable.unhook(SWT.MouseUp, listener);
- eventTable.unhook(SWT.MouseDoubleClick, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse moves.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #addMouseMoveListener
- */
-public void removeMouseMoveListener(MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.MouseMove, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse passes or hovers over controls.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #addMouseTrackListener
- */
-public void removeMouseTrackListener(MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseEnter, listener);
- eventTable.unhook (SWT.MouseExit, listener);
- eventTable.unhook (SWT.MouseHover, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver needs to be painted.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #addPaintListener
- */
-public void removePaintListener(PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Paint, listener);
-}/**
- * Removes the listener from the collection of listeners who will
- * be notified when traversal events occur.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #addTraverseListener
- */
-public void removeTraverseListener(TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Traverse, listener);
-}
-void sendHelpEvent (int callData) {
- Control control = this;
- while (control != null) {
- if (control.hooks (SWT.Help)) {
- control.postEvent (SWT.Help);
- return;
- }
- control = control.parent;
- }
-}
-byte [] sendIMEKeyEvent (int type, XKeyEvent xEvent) {
- /*
- * Bug in Motif. On Linux only, XmImMbLookupString () does not return
- * XBufferOverflow as the status if the buffer is too small. The fix
- * is to pass a large buffer.
- */
- byte [] buffer = new byte [512];
- int [] status = new int [1], unused = new int [1];
- int length = OS.XmImMbLookupString (handle, xEvent, buffer, buffer.length, unused, status);
- if (status [0] == OS.XBufferOverflow) {
- buffer = new byte [length];
- length = OS.XmImMbLookupString (handle, xEvent, buffer, length, unused, status);
- }
- if (length == 0) return null;
-
- /* Convert from MBCS to UNICODE and send the event */
- /* Use the character encoding for the default locale */
- char [] result = Converter.mbcsToWcs (null, buffer);
- int index = 0;
- while (index < result.length) {
- if (result [index] == 0) break;
- Event event = new Event ();
- event.time = xEvent.time;
- event.character = result [index];
- setInputState (event, xEvent);
- postEvent (type, event);
- index++;
- }
- return buffer;
-}
-void sendKeyEvent (int type, XKeyEvent xEvent) {
- Event event = new Event ();
- event.time = xEvent.time;
- setKeyState (event, xEvent);
- Control control = this;
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_FOCUS) != 0) {
- Display display = getDisplay ();
- control = display.getFocusControl ();
- }
- }
- if (control != null) {
- control.postEvent (type, event);
- }
-}
-void sendMouseEvent (int type, int button, XInputEvent xEvent) {
- Event event = new Event ();
- event.time = xEvent.time;
- event.button = button;
- event.x = xEvent.x; event.y = xEvent.y;
- setInputState (event, xEvent);
- postEvent (type, event);
-}
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- checkWidget();
- if (color == null) {
- setBackgroundPixel (defaultBackground ());
- } else {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- setBackgroundPixel (color.handle.pixel);
- }
-}
-void setBackgroundPixel (int pixel) {
- int [] argList = {OS.XmNforeground, 0, OS.XmNhighlightColor, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XmChangeColor (handle, pixel);
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- /*
- * Feature in Motif. Motif will not allow a window
- * to have a zero width or zero height. The fix is
- * to ensure these values are never zero.
- */
- int topHandle = topHandle ();
- int [] argList = {
- OS.XmNx, 0, /* 1 */
- OS.XmNy, 0, /* 3 */
- OS.XmNwidth, 0, /* 5 */
- OS.XmNheight, 0, /* 7 */
- OS.XmNborderWidth, 0, /* 9 */
- };
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- int newWidth = Math.max (width - (argList [9] * 2), 1);
- int newHeight = Math.max (height - (argList [9] * 2), 1);
- boolean sameOrigin = (x == (short) argList [1]) && (y == (short) argList [3]);
- boolean sameExtent = (newWidth == argList [5]) && (newHeight == argList [7]);
- if (sameOrigin && sameExtent) return;
- OS.XtConfigureWidget (topHandle, x, y, newWidth, newHeight, argList [9]);
- if (!sameOrigin) sendEvent (SWT.Move);
- if (!sameExtent) sendEvent (SWT.Resize);
-}
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-/**
- * If the argument is <code>true</code>, causes the receiver to have
- * all mouse events delivered to it until the method is called with
- * <code>false</code> as the argument.
- *
- * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCapture (boolean capture) {
- checkWidget();
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- if (capture) {
- int window = OS.XtWindow (handle);
- if (window == 0) return;
- OS.XGrabPointer (
- display,
- window,
- 0,
- OS.ButtonPressMask | OS.ButtonReleaseMask | OS.PointerMotionMask,
- OS.GrabModeAsync,
- OS.GrabModeAsync,
- OS.None,
- OS.None,
- OS.CurrentTime);
- } else {
- OS.XUngrabPointer (display, OS.CurrentTime);
- }
-}
-/**
- * Sets the receiver's cursor to the cursor specified by the
- * argument, or to the default cursor for that kind of control
- * if the argument is null.
- * <p>
- * When the mouse pointer passes over a control its appearance
- * is changed to match the control's cursor.
- * </p>
- *
- * @param cursor the new cursor (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCursor (Cursor cursor) {
- checkWidget();
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- int window = OS.XtWindow (handle);
- if (window == 0) {
- if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
- window = OS.XtWindow (handle);
- if (window == 0) return;
- }
- if (cursor == null) {
- OS.XUndefineCursor (display, window);
- } else {
- if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int xCursor = cursor.handle;
- OS.XDefineCursor (display, window, xCursor);
- OS.XFlush (display);
- }
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- enableWidget (enabled);
- if (!enabled || (isEnabled () && enabled)) {
- propagateChildren (enabled);
- }
-}
-/**
- * Causes the receiver to have the <em>keyboard focus</em>,
- * such that all keyboard events will be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #forceFocus
- */
-public boolean setFocus () {
- checkWidget();
- Decorations shell = menuShell ();
- shell.setSavedFocus (this);
- shell.bringToTop ();
- return OS.XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
-}
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
- int fontList = 0;
- if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- fontList = font.handle;
- }
- if (fontList == 0) fontList = defaultFont ();
- setFontList (fontList);
-}
-void setFontList (int fontList) {
- this.fontList = fontList;
-
- /*
- * Feature in Motif. Setting the font in a widget
- * can cause the widget to automatically resize in
- * the OS. This behavior is unwanted. The fix is
- * to force the widget to resize to original size
- * after every font change.
- */
- int [] argList1 = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
-
- /* Set the font list */
- int fontHandle = fontHandle ();
- int [] argList2 = {OS.XmNfontList, fontList};
- OS.XtSetValues (fontHandle, argList2, argList2.length / 2);
-
- /* Restore the widget size */
- OS.XtSetValues (handle, argList1, argList1.length / 2);
-}
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- checkWidget();
- if (color == null) {
- setForegroundPixel (defaultForeground ());
- } else {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- setForegroundPixel (color.handle.pixel);
- }
-}
-void setForegroundPixel (int pixel) {
- int [] argList = {OS.XmNforeground, pixel};
- OS.XtSetValues (handle, argList, argList.length / 2);
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return;
- OS.XClearArea (xDisplay, xWindow, 0, 0, 0, 0, true);
-}
-void setGrabCursor (int cursor) {
- /* | window attributes eventMask grabMask |
- handle xtIsWidget ifFalse: [^self].
- (window := handle xtWindow) isNull ifTrue: [^self].
- attributes := OSXWindowAttributesPtr new.
- XDisplay
- xGetWindowAttributes: window
- windowAttributesReturn: attributes.
- grabMask := ((((((((((ButtonPressMask bitOr: ButtonReleaseMask) bitOr:
- EnterWindowMask) bitOr: LeaveWindowMask) bitOr: PointerMotionMask) bitOr:
- PointerMotionHintMask) bitOr: Button1MotionMask) bitOr: Button2MotionMask) bitOr:
- Button3MotionMask) bitOr: Button4MotionMask) bitOr: Button5MotionMask) bitOr: ButtonMotionMask.
- eventMask := attributes yourEventMask bitAnd: grabMask.
- XDisplay xChangeActivePointerGrab: eventMask cursor: aCursor time: CurrentTime.
- */
-}
-/**
- * Sets the layout data associated with the receiver to the argument.
- *
- * @param layoutData the new layout data for the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayoutData (Object layoutData) {
- checkWidget();
- this.layoutData = layoutData;
-}
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- boolean sameOrigin = (x == (short) argList [1]) && (y == (short) argList [3]);
- if (sameOrigin) return;
- OS.XtMoveWidget (topHandle, x, y);
- if (!sameOrigin) sendEvent (SWT.Move);
-}
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-/**
- * Sets the receiver's pop up menu to the argument.
- * All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget();
- if (menu != null) {
- if (menu.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.POP_UP) == 0) {
- error (SWT.ERROR_MENU_NOT_POP_UP);
- }
- if (menu.parent != menuShell ()) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
- this.menu = menu;
-}
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers <code>true</code> if the parent is successfully changed.
- *
- * @param parent the new parent for the control.
- * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean setParent (Composite parent) {
- checkWidget();
- if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return false;
-}
-
-/**
- * If the argument is <code>false</code>, causes subsequent drawing
- * operations in the receiver to be ignored. No drawing of any kind
- * can occur in the receiver until the flag is set to true.
- * Graphics operations that occurred while the flag was
- * <code>false</code> are lost. When the flag is set to <code>true</code>,
- * the entire widget is marked as needing to be redrawn.
- * <p>
- * Note: This operation is a hint and may not be supported on some
- * platforms or for some widgets.
- * </p>
- *
- * @param redraw the new redraw state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- * @see #update
- */
-public void setRedraw (boolean redraw) {
- checkWidget();
-}
-boolean setTabGroupFocus () {
- return setTabItemFocus ();
-}
-boolean setTabItemFocus () {
- if (!isShowing ()) return false;
- return setFocus ();
-}
-/**
- * Sets the receiver's size to the point specified by the arguments.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- /*
- * Feature in Motif. Motif will not allow a window
- * to have a zero width or zero height. The fix is
- * to ensure these values are never zero.
- */
- int topHandle = topHandle ();
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- int newWidth = Math.max (width - (argList [5] * 2), 1);
- int newHeight = Math.max (height - (argList [5] * 2), 1);
- boolean sameExtent = (newWidth == argList [1]) && (newHeight == argList [3]);
- if (sameExtent) return;
- OS.XtResizeWidget (topHandle, newWidth, newHeight, argList [5]);
- if (!sameExtent) sendEvent (SWT.Resize);
-}
-/**
- * Sets the receiver's size to the point specified by the argument.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause them to be
- * set to zero instead.
- * </p>
- *
- * @param size the new size for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- Display display = getDisplay ();
- display.setToolTipText (handle, toolTipText = string);
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- int topHandle = topHandle ();
- int [] argList = {OS.XmNmappedWhenManaged, 0};
- OS.XtGetValues (topHandle, argList, argList.length / 2);
- if ((argList [1] != 0) == visible) return;
- OS.XtSetMappedWhenManaged (topHandle, visible);
- sendEvent (visible ? SWT.Show : SWT.Hide);
-}
-void setZOrder (Control control, boolean above) {
- /*
- * Feature in Xt. We cannot use XtMakeGeometryRequest() to
- * restack widgets because this call can fail under certain
- * conditions. For example, XtMakeGeometryRequest() answers
- * XtGeometryNo when attempting to bring a child widget that
- * is larger than the parent widget to the front. The fix
- * is to use X calls instead.
- */
- int topHandle1 = topHandle ();
- int display = OS.XtDisplay (topHandle1);
- if (display == 0) return;
- if (!OS.XtIsRealized (topHandle1)) {
- Shell shell = this.getShell ();
- shell.realizeWidget ();
- }
- int window1 = OS.XtWindow (topHandle1);
- if (window1 == 0) return;
- if (control == null) {
- if (above) {
- OS.XRaiseWindow (display, window1);
- if (parent != null) parent.moveAbove (topHandle1, 0);
- } else {
- OS.XLowerWindow (display, window1);
- if (parent != null) parent.moveBelow (topHandle1, 0);
- }
- return;
- }
- int topHandle2 = control.topHandle ();
- if (display != OS.XtDisplay (topHandle2)) return;
- if (!OS.XtIsRealized (topHandle2)) {
- Shell shell = control.getShell ();
- shell.realizeWidget ();
- }
- int window2 = OS.XtWindow (topHandle2);
- if (window2 == 0) return;
- XWindowChanges struct = new XWindowChanges ();
- struct.sibling = window2;
- struct.stack_mode = above ? OS.Above : OS.Below;
- /*
- * Feature in X. If the receiver is a top level, XConfigureWindow ()
- * will fail (with a BadMatch error) for top level shells because top
- * level shells are reparented by the window manager and do not share
- * the same X window parent. This is the correct behavior but it is
- * unexpected. The fix is to use XReconfigureWMWindow () instead.
- * When the receiver is not a top level shell, XReconfigureWMWindow ()
- * behaves the same as XConfigureWindow ().
- */
- int screen = OS.XDefaultScreen (display);
- int flags = OS.CWStackMode | OS.CWSibling;
- OS.XReconfigureWMWindow (display, window1, screen, flags, struct);
- if (above) {
- if (parent != null) parent.moveAbove (topHandle1, topHandle2);
- } else {
- if (parent != null) parent.moveBelow (topHandle1, topHandle2);
- }
-}
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in display relative coordinates,
- * to coordinates relative to the receiver.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toControl (Point point) {
- checkWidget();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (handle, (short) 0, (short) 0, root_x, root_y);
- return new Point (point.x - root_x [0], point.y - root_y [0]);
-}
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in coordinates relative to
- * the receiver, to display relative coordinates.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toDisplay (Point point) {
- checkWidget();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (handle, (short) point.x, (short) point.y, root_x, root_y);
- return new Point (root_x [0], root_y [0]);
-}
-boolean translateMnemonic (char key, XKeyEvent xEvent) {
- if (!isVisible () || !isEnabled ()) return false;
- Event event = new Event();
- event.doit = mnemonicMatch (key);
- event.detail = SWT.TRAVERSE_MNEMONIC;
- event.time = xEvent.time;
- setKeyState (event, xEvent);
- return traverse (event);
-}
-boolean translateMnemonic (int key, XKeyEvent xEvent) {
- if (xEvent.state == 0) {
- int code = traversalCode (key, xEvent);
- if ((code & SWT.TRAVERSE_MNEMONIC) == 0) return false;
- } else {
- if (xEvent.state != OS.Mod1Mask) return false;
- }
- Decorations shell = menuShell ();
- if (shell.isVisible () && shell.isEnabled ()) {
- char ch = mbcsToWcs (key);
- return ch != 0 && shell.translateMnemonic (ch, xEvent);
- }
- return false;
-}
-boolean translateTraversal (int key, XKeyEvent xEvent) {
- int detail = SWT.TRAVERSE_NONE;
- int code = traversalCode (key, xEvent);
- boolean all = false;
- switch (key) {
- case OS.XK_Escape:
- case OS.XK_Cancel: {
- Shell shell = getShell ();
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- detail = SWT.TRAVERSE_ESCAPE;
- break;
- }
- case OS.XK_Return: {
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- detail = SWT.TRAVERSE_RETURN;
- break;
- }
- case OS.XK_Tab: {
- boolean next = (xEvent.state & OS.ShiftMask) == 0;
- /*
- * NOTE: This code emulates a bug/feature on Windows where
- * the default is that that Shift+Tab and Ctrl+Tab traverses
- * instead of going to the widget. StyledText currently
- * relies on this behavior.
- */
- switch (xEvent.state) {
- case OS.ControlMask:
- case OS.ShiftMask:
- code |= SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_TAB_NEXT;
- }
- detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
- break;
- }
- case OS.XK_Up:
- case OS.XK_Left:
- case OS.XK_Down:
- case OS.XK_Right: {
- boolean next = key == OS.XK_Down || key == OS.XK_Right;
- detail = next ? SWT.TRAVERSE_ARROW_NEXT : SWT.TRAVERSE_ARROW_PREVIOUS;
- break;
- }
- case OS.XK_Page_Up:
- case OS.XK_Page_Down: {
- all = true;
- if ((xEvent.state & OS.ControlMask) == 0) return false;
- detail = key == OS.XK_Page_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
- break;
- }
- default:
- return false;
- }
- Event event = new Event ();
- event.doit = (code & detail) != 0;
- event.detail = detail;
- event.time = xEvent.time;
- setKeyState (event, xEvent);
- Shell shell = getShell ();
- Control control = this;
- do {
- if (control.traverse (event)) return true;
- if (control == shell) return false;
- control = control.parent;
- } while (all && control != null);
- return false;
-}
-int traversalCode (int key, XKeyEvent xEvent) {
- int [] argList = new int [] {OS.XmNtraversalOn, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == 0) return 0;
- int code = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS;
- Shell shell = getShell ();
- if (shell.parent != null) code |= SWT.TRAVERSE_ESCAPE;
- if (getNavigationType () == OS.XmNONE) {
- code |= SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS;
- }
- return code;
-}
-boolean traverse (Event event) {
- sendEvent (SWT.Traverse, event);
- if (isDisposed ()) return false;
- if (!event.doit) return false;
- switch (event.detail) {
- case SWT.TRAVERSE_NONE: return true;
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character);
- case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true);
- case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false);
- }
- return false;
-}
-/**
- * Based on the argument, perform one of the expected platform
- * traversal action. The argument should be one of the constants:
- * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
- * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
- * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
- *
- * @param traversal the type of traversal
- * @return true if the traversal succeeded
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean traverse (int traversal) {
- checkWidget();
- if (!isFocusControl () && !setFocus ()) return false;
- Event event = new Event ();
- event.doit = true;
- event.detail = traversal;
- return traverse (event);
-}
-boolean traverseEscape () {
- Shell shell = getShell ();
- if (shell.parent == null) return false;
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- shell.close ();
- return true;
-}
-boolean traverseGroup (boolean next) {
- Control root = computeTabRoot ();
- Control group = computeTabGroup ();
- Control [] list = root.computeTabList ();
- int length = list.length;
- int index = 0;
- while (index < length) {
- if (list [index] == group) break;
- index++;
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in focus in
- * or out events. Ensure that a disposed widget is
- * not accessed.
- */
- if (index == length) return false;
- int start = index, offset = (next) ? 1 : -1;
- while ((index = ((index + offset + length) % length)) != start) {
- Control control = list [index];
- if (!control.isDisposed () && control.setTabGroupFocus ()) {
- if (!isDisposed () && !isFocusControl ()) return true;
- }
- }
- if (group.isDisposed ()) return false;
- return group.setTabGroupFocus ();
-}
-boolean traverseItem (boolean next) {
- Control [] children = parent._getChildren ();
- int length = children.length;
- int index = 0;
- while (index < length) {
- if (children [index] == this) break;
- index++;
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in focus in
- * or out events. Ensure that a disposed widget is
- * not accessed.
- */
- int start = index, offset = (next) ? 1 : -1;
- while ((index = (index + offset + length) % length) != start) {
- Control child = children [index];
- if (!child.isDisposed () && child.isTabItem ()) {
- if (child.setTabItemFocus ()) return true;
- }
- }
- return false;
-}
-boolean traversePage (boolean next) {
- return false;
-}
-boolean traverseMnemonic (char key) {
- return mnemonicHit (key);
-}
-boolean traverseReturn () {
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- button.click ();
- return true;
-}
-/**
- * Forces all outstanding paint requests for the widget tree
- * to be processed before this method returns.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- */
-public void update () {
- checkWidget();
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- int window = OS.XtWindow (handle);
- if (window == 0) return;
- XAnyEvent event = new XAnyEvent ();
- OS.XSync (display, false); OS.XSync (display, false);
- while (OS.XCheckWindowEvent (display, window, OS.ExposureMask, event)) {
- OS.XtDispatchEvent (event);
- }
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Decorations.java
deleted file mode 100755
index 5c03cd3d7c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Decorations.java
+++ /dev/null
@@ -1,596 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide the appearance and
- * behavior of <code>Shells</code>, but are not top
- * level shells or dialogs. Class <code>Shell</code>
- * shares a significant amount of code with this class,
- * and is a subclass.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations.
- * For example, some window managers only support resizable
- * windows and will always assume the RESIZE style, even if
- * it is not set.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- *
- * @see #getMinimized
- * @see #getMaximized
- * @see Shell
- * @see SWT
- */
-public class Decorations extends Canvas {
- String label;
- Image image;
- int dialogHandle;
- boolean minimized, maximized;
- Menu menuBar;
- Menu [] menus;
- Control savedFocus;
- Button defaultButton, saveDefault;
-Decorations () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Decorations (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-void add (Menu menu) {
- if (menus == null) menus = new Menu [4];
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == null) {
- menus [i] = menu;
- return;
- }
- }
- Menu [] newMenus = new Menu [menus.length + 4];
- newMenus [menus.length] = menu;
- System.arraycopy (menus, 0, newMenus, 0, menus.length);
- menus = newMenus;
-}
-void bringToTop () {
- /*
- * Feature in X. Calling XSetInputFocus() when the
- * widget is not viewable causes an X bad match error.
- * The fix is to call XSetInputFocus() when the widget
- * is viewable.
- */
- if (minimized) return;
- if (!isVisible ()) return;
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- int window = OS.XtWindow (handle);
- if (window == 0) return;
- OS.XSetInputFocus (display, window, OS.RevertToParent, OS.CurrentTime);
-}
-static int checkStyle (int style) {
- if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
- style |= SWT.TITLE;
- }
- return style;
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-Control computeTabGroup () {
- return this;
-}
-
-Control computeTabRoot () {
- return this;
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- Rectangle trim = super.computeTrim (x, y, width, height);
- if (menuBar != null) {
- XtWidgetGeometry request = new XtWidgetGeometry ();
- XtWidgetGeometry result = new XtWidgetGeometry ();
- request.request_mode = OS.CWWidth;
- request.width = trim.width;
- OS.XtQueryGeometry (menuBar.handle, request, result);
- trim.height += result.height;
- }
- return trim;
-}
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
- createScrolledHandle (parent.handle);
-}
-void createWidget (int index) {
- super.createWidget (index);
- label = "";
-}
-int dialogHandle () {
- if (dialogHandle != 0) return dialogHandle;
- return dialogHandle = OS.XmCreateDialogShell (handle, null, null, 0);
-}
-/**
- * Returns the receiver's default button if one had
- * previously been set, otherwise returns null.
- *
- * @return the default button or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setDefaultButton
- */
-public Button getDefaultButton () {
- checkWidget();
- return defaultButton;
-}
-/**
- * Returns the receiver's image if it had previously been
- * set using <code>setImage()</code>. The image is typically
- * displayed by the window manager when the instance is
- * marked as iconified, and may also be displayed somewhere
- * in the trim when the instance is in normal or maximized
- * states.
- * <p>
- * Note: This method will return null if called before
- * <code>setImage()</code> is called. It does not provide
- * access to a window manager provided, "default" image
- * even if one exists.
- * </p>
- *
- * @return the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * maximized, and false otherwise.
- * <p>
- *
- * @return the maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public boolean getMaximized () {
- checkWidget();
- return maximized;
-}
-/**
- * Returns the receiver's menu bar if one had previously
- * been set, otherwise returns null.
- *
- * @return the menu bar or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenuBar () {
- checkWidget();
- return menuBar;
-}
-/**
- * Returns <code>true</code> if the receiver is currently
- * minimized, and false otherwise.
- * <p>
- *
- * @return the minimized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public boolean getMinimized () {
- checkWidget();
- return minimized;
-}
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return label;
-}
-Decorations menuShell () {
- return this;
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- int [] argList = {OS.XmNmenuBar, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- if (argList [1] != 0) propagateHandle (enabled, argList [1]);
-}
-void releaseHandle () {
- super.releaseHandle ();
- dialogHandle = 0;
-}
-void releaseWidget () {
- if (menus != null) {
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if (menu != null && !menu.isDisposed ()) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- }
- }
- menuBar = null;
- menus = null;
- super.releaseWidget ();
- defaultButton = saveDefault = null;
- label = null;
-}
-void remove (Menu menu) {
- if (menus == null) return;
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == menu) {
- menus [i] = null;
- return;
- }
- }
-}
-/**
- * If the argument is not null, sets the receiver's default
- * button to the argument, and if the argument is null, sets
- * the receiver's default button to the first button which
- * was set as the receiver's default button (called the
- * <em>saved default button</em>). If no default button had
- * previously been set, or the saved default button was
- * disposed, the receiver's default button will be set to
- * null.
- *
- * @param the new default button
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultButton (Button button) {
- checkWidget();
- setDefaultButton (button, true);
-}
-void setDefaultButton (Button button, boolean save) {
- if (button == null) {
- if (defaultButton == saveDefault) return;
- } else {
- if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((button.style & SWT.PUSH) == 0) return;
- if (button == defaultButton) return;
- }
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (false);
- }
- if ((defaultButton = button) == null) defaultButton = saveDefault;
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (true);
- }
- if (save || saveDefault == null) saveDefault = defaultButton;
- if (saveDefault != null && saveDefault.isDisposed ()) saveDefault = null;
-}
-/**
- * Sets the receiver's image to the argument, which may
- * be null. The image is typically displayed by the window
- * manager when the instance is marked as iconified, and
- * may also be displayed somewhere in the trim when the
- * instance is in normal or maximized states.
- *
- * @param image the new image (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- int pixmap = 0, mask = 0;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- switch (image.type) {
- case SWT.BITMAP:
- pixmap = image.pixmap;
- break;
- case SWT.ICON:
- pixmap = image.pixmap;
- mask = image.mask;
- break;
- default:
- error (SWT.ERROR_INVALID_IMAGE);
- }
- }
- this.image = image;
- int [] argList = {
- OS.XmNiconPixmap, pixmap,
- OS.XmNiconMask, mask,
- };
- int topHandle = topHandle ();
- OS.XtSetValues (topHandle, argList, argList.length / 2);
-}
-/**
- * Sets the maximized state of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the maximized state, and if the argument is
- * <code>false</code> and the receiver was previously maximized,
- * causes the receiver to switch back to either the minimized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public void setMaximized (boolean maximized) {
- checkWidget();
- this.maximized = maximized;
-}
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenuBar (Menu menu) {
- checkWidget();
- if (menuBar == menu) return;
- if (menu != null) {
- if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
-
- /* Ensure the new menu bar is correctly enabled */
- if (menuBar != null) {
- if (!isEnabled () && menuBar.getEnabled ()) {
- propagateHandle (true, menuBar.handle);
- }
- }
- if (menu != null) {
- if (!isEnabled ()) {
- propagateHandle (false, menu.handle);
- }
- }
-
- /*
- * Bug in Motif. When a XmMainWindowSetAreas () is used
- * to replace an existing menu, both menus must be managed
- * before the call to XmMainWindowSetAreas () or the new
- * menu will not be layed out properly.
- */
- int newHandle = (menu != null) ? menu.handle : 0;
- int oldHandle = (menuBar != null) ? menuBar.handle : 0;
- menuBar = menu;
- int hHandle = (horizontalBar != null) ? horizontalBar.handle : 0;
- int vHandle = (verticalBar != null) ? verticalBar.handle : 0;
- if (newHandle != 0) {
- OS.XtSetMappedWhenManaged (newHandle, false);
- OS.XtManageChild (newHandle);
- }
- int clientHandle = (formHandle != 0) ? formHandle : handle;
- OS.XmMainWindowSetAreas (scrolledHandle, newHandle, 0, hHandle, vHandle, clientHandle);
- if (oldHandle != 0) OS.XtUnmanageChild (oldHandle);
- if (newHandle != 0) {
- OS.XtSetMappedWhenManaged (newHandle, true);
- }
-
- /*
- * Bug in Motif. When a menu bar is removed after the
- * main window has been realized, the main window does
- * not layout the new menu bar or the work window.
- * The fix is to force a layout by temporarily resizing
- * the main window.
- */
- if (newHandle == 0 && OS.XtIsRealized (scrolledHandle)) {
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- OS.XtResizeWidget (scrolledHandle, argList [1] + 1, argList [3], argList [5]);
- OS.XtResizeWidget (scrolledHandle, argList [1], argList [3], argList [5]);
- }
-}
-/**
- * Sets the minimized stated of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the minimized state, and if the argument is
- * <code>false</code> and the receiver was previously minimized,
- * causes the receiver to switch back to either the maximized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public void setMinimized (boolean minimized) {
- checkWidget();
- this.minimized = minimized;
-}
-void setSavedFocus (Control control) {
- if (this == control) return;
- savedFocus = control;
-}
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- label = string;
-}
-public void setVisible (boolean visible) {
- super.setVisible (visible);
- if (!visible) return;
- if (savedFocus != null && !savedFocus.isDisposed ()) {
- savedFocus.setFocus ();
- }
- savedFocus = null;
-}
-
-boolean traverseItem (boolean next) {
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/DirectoryDialog.java
deleted file mode 100755
index 19c97575e4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/DirectoryDialog.java
+++ /dev/null
@@ -1,317 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select a directory.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class DirectoryDialog extends Dialog {
- String filterPath = "";
- boolean cancel = true;
- String message = "";
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-int activate (int widget, int client, int call) {
- cancel = client == OS.XmDIALOG_CANCEL_BUTTON;
- OS.XtUnmanageChild (widget);
- return 0;
-}
-/**
- * Returns the path which the dialog will use to filter
- * the directories it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the selected directory,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
-
- /* Get the parent */
- boolean destroyContext;
- Display appContext = Display.getCurrent ();
- if (destroyContext = (appContext == null)) appContext = new Display ();
- int display = appContext.xDisplay;
- int parentHandle = appContext.shellHandle;
- if ((parent != null) && (parent.getDisplay () == appContext))
- parentHandle = parent.shellHandle;
-
- /* Compute the dialog title */
- /*
- * Feature in Motif. It is not possible to set a shell
- * title to an empty string. The fix is to set the title
- * to be a single space.
- */
- String string = title;
- if (string.length () == 0) string = " ";
-
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, string, true);
- int xmStringPtr1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Compute the filter */
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, "*", true);
- int xmStringPtr2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Compute the filter path */
- if (filterPath == null) filterPath = "";
- /* Use the character encoding for the default locale */
- byte [] buffer3 = Converter.wcsToMbcs (null, filterPath, true);
- int xmStringPtr3 = OS.XmStringParseText (
- buffer3,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Use the character encoding for the default locale */
- byte [] buffer7 = Converter.wcsToMbcs (null, "Selection", true);
- int xmStringPtr4 = OS.XmStringParseText (
- buffer7,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Create the dialog */
- int [] argList1 = {
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNdialogStyle, OS.XmDIALOG_PRIMARY_APPLICATION_MODAL,
- OS.XmNwidth, OS.XDisplayWidth (display, OS.XDefaultScreen (display)) * 4 / 9,
- OS.XmNdialogTitle, xmStringPtr1,
- OS.XmNpattern, xmStringPtr2,
- OS.XmNdirectory, xmStringPtr3,
- OS.XmNfilterLabelString, xmStringPtr4
- };
-
- /*
- * Feature in Linux. For some reason, the XmCreateFileSelectionDialog()
- * will not accept NULL for the widget name. This works fine on the other
- * Motif platforms and in the other XmCreate calls on Linux. The fix is
- * to pass in a NULL terminated string, not a NULL pointer.
- */
- byte [] name = new byte [] {0};
- int dialog = OS.XmCreateFileSelectionDialog (parentHandle, name, argList1, argList1.length / 2);
- int child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_HELP_BUTTON);
- if (child != 0) OS.XtUnmanageChild (child);
- child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_LIST);
- if (child != 0) {
- int parent2 = OS.XtParent(child);
- if (parent2 !=0) OS.XtUnmanageChild (parent2);
- }
- child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_LIST_LABEL);
- if (child != 0) OS.XtUnmanageChild (child);
- child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_TEXT);
- if (child != 0) OS.XtUnmanageChild (child);
- child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_SELECTION_LABEL);
- if (child != 0) OS.XtUnmanageChild (child);
- OS.XmStringFree (xmStringPtr1);
- OS.XmStringFree (xmStringPtr2);
- OS.XmStringFree (xmStringPtr3);
- OS.XmStringFree (xmStringPtr4);
-
- // Add label widget for message text.
- /* Use the character encoding for the default locale */
- byte [] buffer4 = Converter.wcsToMbcs (null, message, true);
- int xmString1 = OS.XmStringGenerate(buffer4, null, OS.XmCHARSET_TEXT, null);
- int [] argList = {
- OS.XmNlabelType, OS.XmSTRING,
- OS.XmNlabelString, xmString1
- };
- int textArea = OS.XmCreateLabel(dialog, name, argList, argList.length/2);
- OS.XtManageChild(textArea);
- OS.XmStringFree (xmString1);
-
- /* Hook the callbacks. */
- Callback callback = new Callback (this, "activate", 3);
- int address = callback.getAddress ();
- OS.XtAddCallback (dialog, OS.XmNokCallback, address, OS.XmDIALOG_OK_BUTTON);
- OS.XtAddCallback (dialog, OS.XmNcancelCallback, address, OS.XmDIALOG_CANCEL_BUTTON);
-
- /* Open the dialog and dispatch events. */
- cancel = true;
- OS.XtManageChild (dialog);
-
-//BOGUS - should be a pure OS message loop (no SWT AppContext)
- while (OS.XtIsRealized (dialog) && OS.XtIsManaged (dialog))
- if (!appContext.readAndDispatch ()) appContext.sleep ();
-
- /* Set the new path, file name and filter. */
- String directoryPath="";
- if (!cancel) {
- int [] argList2 = {OS.XmNdirMask, 0};
- OS.XtGetValues (dialog, argList2, argList2.length / 2);
- int xmString3 = argList2 [1];
- int ptr = OS.XmStringUnparse (
- xmString3,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (ptr != 0) {
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- /* Use the character encoding for the default locale */
- directoryPath = new String (Converter.mbcsToWcs (null, buffer));
- }
- OS.XmStringFree (xmString3);
- int length = directoryPath.length ();
- if (length != 0) {
- if (directoryPath.charAt (length -1) == '/') {
- directoryPath = directoryPath.substring (0, length - 1);
- } else {
- if (length > 1 && directoryPath.charAt (length - 2) == '/' && directoryPath.charAt (length - 1) == '*') {
- directoryPath = directoryPath.substring (0, length - 2);
- }
- }
- }
- }
-
- /* Destroy the dialog and update the display. */
- if (OS.XtIsRealized (dialog)) OS.XtDestroyWidget (dialog);
- if (destroyContext) appContext.dispose ();
- callback.dispose ();
-
-// (shell == nil or: [shell isDestroyed not]) ifTrue: [dialog xtDestroyWidget].
-// OSWidget updateDisplay.
-// entryPoint unbind.
-
- if (cancel) return null;
- return directoryPath;
-}
-/**
- * Sets the path which the dialog will use to filter
- * the directories it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java
deleted file mode 100755
index b43aa94d47..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java
+++ /dev/null
@@ -1,2032 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are responsible for managing the
- * connection between SWT and the underlying operating
- * system. Their most important function is to implement
- * the SWT event loop in terms of the platform event model.
- * They also provide various methods for accessing information
- * about the operating system, and have overall control over
- * the operating system resources which SWT allocates.
- * <p>
- * Applications which are built with SWT will <em>almost always</em>
- * require only a single display. In particular, some platforms
- * which SWT supports will not allow more than one <em>active</em>
- * display. In other words, some platforms do not support
- * creating a new display if one already exists that has not been
- * sent the <code>dispose()</code> message.
- * <p>
- * In SWT, the thread which creates a <code>Display</code>
- * instance is distinguished as the <em>user-interface thread</em>
- * for that display.
- * </p>
- * The user-interface thread for a particular display has the
- * following special attributes:
- * <ul>
- * <li>
- * The event loop for that display must be run from the thread.
- * </li>
- * <li>
- * Some SWT API methods (notably, most of the public methods in
- * <code>Widget</code> and its subclasses), may only be called
- * from the thread. (To support multi-threaded user-interface
- * applications, class <code>Display</code> provides inter-thread
- * communication methods which allow threads other than the
- * user-interface thread to request that it perform operations
- * on their behalf.)
- * </li>
- * <li>
- * The thread is not allowed to construct other
- * <code>Display</code>s until that display has been disposed.
- * (Note that, this is in addition to the restriction mentioned
- * above concerning platform support for multiple displays. Thus,
- * the only way to have multiple simultaneously active displays,
- * even on platforms which support it, is to have multiple threads.)
- * </li>
- * </ul>
- * Enforcing these attributes allows SWT to be implemented directly
- * on the underlying operating system's event model. This has
- * numerous benefits including smaller footprint, better use of
- * resources, safer memory management, clearer program logic,
- * better performance, and fewer overall operating system threads
- * required. The down side however, is that care must be taken
- * (only) when constructing multi-threaded applications to use the
- * inter-thread communication mechanisms which this class provides
- * when required.
- * </p><p>
- * All SWT API methods which may only be called from the user-interface
- * thread are distinguished in their documentation by indicating that
- * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
- * SWT exception.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see #syncExec
- * @see #asyncExec
- * @see #wake
- * @see #readAndDispatch
- * @see #sleep
- * @see #dispose
- */
-public class Display extends Device {
-
- /* Motif Only Public Fields */
- public XAnyEvent xEvent = new XAnyEvent ();
-
- /* Windows, Events and Callbacks */
- Callback windowCallback;
- int windowProc, shellHandle;
- static boolean XtInitialized;
- static Object XInitLock = new Object ();
- static String APP_NAME = "SWT";
- byte [] displayName, appName, appClass;
- Event [] eventQueue;
- XKeyEvent keyEvent = new XKeyEvent ();
-
- /* Default Fonts, Colors, Insets, Widths and Heights. */
- int defaultFont, defaultFontList;
- int listFont, textFont, buttonFont, labelFont;
- int dialogBackground, dialogForeground;
- int buttonBackground, buttonForeground, buttonShadowThickness;
- int compositeBackground, compositeForeground;
- int compositeTopShadow, compositeBottomShadow, compositeBorder;
- int listBackground, listForeground, listSelect, textBackground, textForeground;
- int labelBackground, labelForeground, scrollBarBackground, scrollBarForeground;
- int scrolledInsetX, scrolledInsetY, scrolledMarginX, scrolledMarginY;
- int defaultBackground, defaultForeground;
- int textHighlightThickness;
-
- /* System Colors */
- XColor COLOR_WIDGET_DARK_SHADOW, COLOR_WIDGET_NORMAL_SHADOW, COLOR_WIDGET_LIGHT_SHADOW;
- XColor COLOR_WIDGET_HIGHLIGHT_SHADOW, COLOR_WIDGET_BACKGROUND, COLOR_WIDGET_BORDER;
- XColor COLOR_LIST_FOREGROUND, COLOR_LIST_BACKGROUND, COLOR_LIST_SELECTION, COLOR_LIST_SELECTION_TEXT;
- Color COLOR_INFO_BACKGROUND;
-
- /* Initial Guesses for Shell Trimmings. */
- int borderTrimWidth = 4, borderTrimHeight = 4;
- int resizeTrimWidth = 6, resizeTrimHeight = 6;
- int titleBorderTrimWidth = 5, titleBorderTrimHeight = 28;
- int titleResizeTrimWidth = 6, titleResizeTrimHeight = 29;
- int titleTrimWidth = 0, titleTrimHeight = 23;
-
- /* Sync/Async Widget Communication */
- Synchronizer synchronizer = new Synchronizer (this);
- Thread thread;
-
- /* Display Shutdown */
- Runnable [] disposeList;
-
- /* Timers */
- int [] timerIDs;
- Runnable [] timerList;
- Callback timerCallback;
- int timerProc;
-
- /* Key Mappings. */
- static int [] [] KeyTable = {
-
- /* Keyboard and Mouse Masks */
- {OS.XK_Alt_L, SWT.ALT},
- {OS.XK_Alt_R, SWT.ALT},
- {OS.XK_Shift_L, SWT.SHIFT},
- {OS.XK_Shift_R, SWT.SHIFT},
- {OS.XK_Control_L, SWT.CONTROL},
- {OS.XK_Control_R, SWT.CONTROL},
-
-// {OS.VK_LBUTTON, SWT.BUTTON1},
-// {OS.VK_MBUTTON, SWT.BUTTON3},
-// {OS.VK_RBUTTON, SWT.BUTTON2},
-
- /* Non-Numeric Keypad Constants */
- {OS.XK_Up, SWT.ARROW_UP},
- {OS.XK_Down, SWT.ARROW_DOWN},
- {OS.XK_Left, SWT.ARROW_LEFT},
- {OS.XK_Right, SWT.ARROW_RIGHT},
- {OS.XK_Page_Up, SWT.PAGE_UP},
- {OS.XK_Page_Down, SWT.PAGE_DOWN},
- {OS.XK_Home, SWT.HOME},
- {OS.XK_End, SWT.END},
- {OS.XK_Insert, SWT.INSERT},
-// {OS.XK_Delete, SWT.DELETE},
-
- /* Functions Keys */
- {OS.XK_F1, SWT.F1},
- {OS.XK_F2, SWT.F2},
- {OS.XK_F3, SWT.F3},
- {OS.XK_F4, SWT.F4},
- {OS.XK_F5, SWT.F5},
- {OS.XK_F6, SWT.F6},
- {OS.XK_F7, SWT.F7},
- {OS.XK_F8, SWT.F8},
- {OS.XK_F9, SWT.F9},
- {OS.XK_F10, SWT.F10},
- {OS.XK_F11, SWT.F11},
- {OS.XK_F12, SWT.F12},
-
- /* Numeric Keypad Constants */
- /*
- {OS.XK_KP_Add, SWT.KP_PLUS},
- {OS.XK_KP_Subtract, SWT.KP_MINUS},
- {OS.XK_KP_Multiply, SWT.KP_TIMES},
- {OS.XK_KP_Divide, SWT.KP_DIVIDE},
- {OS.XK_KP_Decimal, SWT.KP_PERIOD},
- {OS.XK_KP_Enter, SWT.KP_ENTER},
- {OS.XK_KP_0, SWT.KP_0},
- {OS.XK_KP_1, SWT.KP_1},
- {OS.XK_KP_2, SWT.KP_2},
- {OS.XK_KP_3, SWT.KP_3},
- {OS.XK_KP_4, SWT.KP_4},
- {OS.XK_KP_5, SWT.KP_5},
- {OS.XK_KP_6, SWT.KP_6},
- {OS.XK_KP_7, SWT.KP_7},
- {OS.XK_KP_8, SWT.KP_8},
- {OS.XK_KP_9, SWT.KP_9},
- */
- };
-
- /* Multiple Displays. */
- static Display Default;
- static Display [] Displays = new Display [4];
-
- /* Double Click */
- int lastTime, lastButton;
-
- /* Current caret */
- Caret currentCaret;
- Callback caretCallback;
- int caretID, caretProc;
-
- /* Workaround for GP when disposing a display */
- static boolean DisplayDisposed;
-
- /* Package Name */
- static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets.";
- /*
- * This code is intentionally commented. In order
- * to support CLDC, .class cannot be used because
- * it does not compile on some Java compilers when
- * they are targeted for CLDC.
- */
-// static {
-// String name = Display.class.getName ();
-// int index = name.lastIndexOf ('.');
-// PACKAGE_PREFIX = name.substring (0, index + 1);
-// }
-
- /* Mouse Hover */
- Callback mouseHoverCallback;
- int mouseHoverID, mouseHoverProc;
- int mouseHoverHandle, toolTipHandle;
-
- /* Xt Translations */
- int dragTranslations;
- int arrowTranslations, tabTranslations;
-
- /* Check Expose Proc */
- Callback checkExposeCallback;
- int checkExposeProc, exposeCount;
- XExposeEvent xExposeEvent = new XExposeEvent ();
-
- /* Check Resize Proc */
- Callback checkResizeCallback;
- int checkResizeProc, resizeWidth, resizeHeight, resizeCount, resizeWindow;
- XConfigureEvent xConfigureEvent = new XConfigureEvent ();
-
- /* Wake and Sleep */
- Callback wakeCallback;
- int wakeProc, read_fd, write_fd, inputID;
- byte [] wake_buffer = new byte [1];
- int [] timeout = new int [2];
- byte [] fd_set;
-
- /* Display Data */
- Object data;
- String [] keys;
- Object [] values;
-
- /*
- * TEMPORARY CODE. Install the runnable that
- * gets the current display. This code will
- * be removed in the future.
- */
- static {
- DeviceFinder = new Runnable () {
- public void run () {
- Device device = getCurrent ();
- if (device == null) {
- device = getDefault ();
- }
- setDevice (device);
- }
- };
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static void setDevice (Device device) {
- CurrentDevice = device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * Note: The resulting display is marked as the <em>current</em>
- * display. If this is the first display which has been
- * constructed since the application started, it is also
- * marked as the <em>default</em> display.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see #getCurrent
- * @see #getDefault
- * @see Widget#checkSubclass
- * @see Shell
- */
-public Display () {
- this (null);
-}
-public Display (DeviceData data) {
- super (checkNull (data));
-}
-static DeviceData checkNull (DeviceData data) {
- if (data == null) data = new DeviceData ();
- if (data.application_name == null) {
- data.application_name = APP_NAME;
- }
- if (data.application_class == null) {
- data.application_class = APP_NAME;
- }
- return data;
-}
-protected void checkDevice () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-void addMouseHoverTimeOut (int handle) {
- if (mouseHoverID != 0) OS.XtRemoveTimeOut (mouseHoverID);
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- mouseHoverID = OS.XtAppAddTimeOut (xtContext, 400, mouseHoverProc, handle);
- mouseHoverHandle = handle;
-}
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-public void asyncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.asyncExec (runnable);
-}
-/**
- * Causes the system hardware to emit a short sound
- * (if it supports this capability).
- */
-public void beep () {
- checkDevice ();
- OS.XBell (xDisplay, 100);
- OS.XFlush (xDisplay);
-}
-int caretProc (int clientData, int id) {
- caretID = 0;
- if (currentCaret == null) return 0;
- if (currentCaret.blinkCaret ()) {
- int blinkRate = currentCaret.blinkRate;
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- caretID = OS.XtAppAddTimeOut (xtContext, blinkRate, caretProc, 0);
- } else {
- currentCaret = null;
- }
- return 0;
-}
-int checkExposeProc (int display, int event, int window) {
- OS.memmove (xExposeEvent, event, XExposeEvent.sizeof);
- if (xExposeEvent.window != window) return 0;
- switch (xExposeEvent.type) {
- case OS.Expose:
- case OS.GraphicsExpose:
- exposeCount++;
- break;
- }
- return 0;
-}
-int checkResizeProc (int display, int event, int arg) {
- OS.memmove (xConfigureEvent, event, XConfigureEvent.sizeof);
- if (xConfigureEvent.window != resizeWindow) return 0;
- switch (xConfigureEvent.type) {
- case OS.ConfigureNotify:
- int width = xConfigureEvent.width;
- int height = xConfigureEvent.height;
- if (width != resizeWidth || height != resizeHeight) {
- resizeCount++;
- }
- break;
- }
- return 0;
-}
-static synchronized void checkDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] != null && Displays [i].thread == thread) {
- SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- }
-}
-protected void checkSubclass () {
- if (!Display.isValidClass (getClass ())) {
- error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-protected void create (DeviceData data) {
- checkSubclass ();
- checkDisplay (thread = Thread.currentThread ());
- createDisplay (data);
- register (this);
- if (Default == null) Default = this;
-}
-void createDisplay (DeviceData data) {
-
- /* Initialize X and Xt */
- synchronized (XInitLock) {
- if (!XtInitialized) {
- /*
- * This code is intentionally commented.
- */
-// OS.XInitThreads ();
-// OS.XtToolkitThreadInitialize ();
- OS.XtToolkitInitialize ();
- }
- XtInitialized = true;
- }
-
- /* Create the AppContext */
- int [] argc = new int [] {0};
- int xtContext = OS.XtCreateApplicationContext ();
- OS.XtSetLanguageProc (xtContext, 0, 0);
-
- /* Compute the display name, application name and class */
- String display_name = null;
- String application_name = APP_NAME;
- String application_class = APP_NAME;
- if (data != null) {
- if (data.display_name != null) display_name = data.display_name;
- if (data.application_name != null) application_name = data.application_name;
- if (data.application_class != null) application_class = data.application_class;
- }
- /* Use the character encoding for the default locale */
- if (display_name != null) displayName = Converter.wcsToMbcs (null, display_name, true);
- if (application_name != null) appName = Converter.wcsToMbcs (null, application_name, true);
- if (application_class != null) appClass = Converter.wcsToMbcs (null, application_class, true);
-
- /* Create the XDisplay */
- xDisplay = OS.XtOpenDisplay (xtContext, displayName, appName, appClass, 0, 0, argc, 0);
- DisplayDisposed = false;
-}
-synchronized static void deregister (Display display) {
- for (int i=0; i<Displays.length; i++) {
- if (display == Displays [i]) Displays [i] = null;
- }
-}
-protected void destroy () {
- if (this == Default) Default = null;
- deregister (this);
- destroyDisplay ();
-}
-void destroyDisplay () {
- /*
- * Bug in Motif. For some reason, XtAppCreateShell GP's when called
- * after an application context has been destroyed. The fix is to
- * destroy the default XmDisplay associated with the X Display for
- * the application context. The following code fragment GP's without
- * this work around:
- *
- * int xContext = OS.XtCreateApplicationContext();
- * int xDisplay = OS.XtOpenDisplay(xContext, null, null, null, null, 0, new int[1], null);
- * OS.XtAppCreateShell(null, null, OS.topLevelShellWidgetClass(), xDisplay, null, 0);
- * OS.XtDestroyApplicationContext(xContext);
- * xContext = OS.XtCreateApplicationContext();
- * xDisplay = OS.XtOpenDisplay(xContext, null, null, null, null, 0, new int[1], null);
- * OS.XtAppCreateShell(null, null, OS.topLevelShellWidgetClass(), xDisplay, null, 0);
- * OS.XtDestroyApplicationContext(xContext);
- */
- OS.XtDestroyWidget (OS.XmGetXmDisplay (xDisplay));
-
- /*
- * Destroy AppContext (this destroys the display)
- */
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- OS.XtDestroyApplicationContext (xtContext);
- DisplayDisposed = true;
-}
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread just before the
- * receiver is disposed.
- *
- * @param runnable code to run at dispose time.
- */
-public void disposeExec (Runnable runnable) {
- checkDevice ();
- if (disposeList == null) disposeList = new Runnable [4];
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] == null) {
- disposeList [i] = runnable;
- return;
- }
- }
- Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
- System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
- newDisposeList [disposeList.length] = runnable;
- disposeList = newDisposeList;
-}
-void error (int code) {
- SWT.error(code);
-}
-boolean filterEvent (XAnyEvent event) {
-
- /* Check the event and find the widget */
- if (event.type != OS.KeyPress) return false;
- if (!OS.IsLinux && OS.XFilterEvent(event, OS.None)) return true;
-
- /* Move the any event into the key event */
- OS.memmove (keyEvent, event, XKeyEvent.sizeof);
- if (keyEvent.keycode == 0) return false;
- int xWindow = keyEvent.window;
- if (xWindow == 0) return false;
- int handle = OS.XtWindowToWidget (xDisplay, xWindow);
- if (handle == 0) return false;
- handle = OS.XmGetFocusWidget (handle);
- if (handle == 0) return false;
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return false;
-
- /* Get the unaffected character and keysym */
- int oldState = keyEvent.state;
- keyEvent.state = 0;
- byte [] buffer1 = new byte [4];
- int [] buffer2 = new int [1];
- int key = 0;
- if (OS.XLookupString (keyEvent, buffer1, 1, buffer2, null) != 0) {
- key = buffer1 [0] & 0xFF;
- }
- int keysym = buffer2 [0] & 0xFFFF;
- keyEvent.state = oldState;
-
- /* Check for a mnemonic key */
- if (key != 0) {
- if (widget.translateMnemonic (key, keyEvent)) return true;
- }
-
- /* Check for a traversal key */
- if (keysym == 0) return false;
- switch (keysym) {
- case OS.XK_Escape:
- case OS.XK_Cancel:
- case OS.XK_Tab:
- case OS.XK_Return:
- case OS.XK_Up:
- case OS.XK_Down:
- case OS.XK_Left:
- case OS.XK_Right:
- case OS.XK_Page_Up:
- case OS.XK_Page_Down:
- if (widget.translateTraversal (keysym, keyEvent)) return true;
- }
-
- /* Answer false because the event was not processed */
- return false;
-}
-/**
- * Given the operating system handle for a widget, returns
- * the instance of the <code>Widget</code> subclass which
- * represents it in the currently running application, if
- * such exists, or null if no matching widget can be found.
- *
- * @param handle the handle for the widget
- * @return the SWT widget that the handle represents
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Widget findWidget (int handle) {
- checkDevice ();
- return WidgetTable.get (handle);
-}
-/**
- * Returns the currently active <code>Shell</code>, or null
- * if no shell belonging to the currently running application
- * is active.
- *
- * @return the active shell or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getActiveShell () {
- checkDevice ();
- Control control = getFocusControl ();
- if (control == null) return null;
- return control.getShell ();
-}
-/**
- * Returns the display which the currently running thread is
- * the user-interface thread for, or null if the currently
- * running thread is not a user-interface thread for any display.
- *
- * @return the current display
- */
-public static synchronized Display getCurrent () {
- return findDisplay (Thread.currentThread ());
-}
-/**
- * Returns the display which the given thread is the
- * user-interface thread for, or null if the given thread
- * is not a user-interface thread for any display.
- *
- * @param thread the user-interface thread
- * @return the display for the given thread
- */
-public static synchronized Display findDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == thread) {
- return display;
- }
- }
- return null;
-}
-/**
- * Returns the control which the on-screen pointer is currently
- * over top of, or null if it is not currently over one of the
- * controls built by the currently running application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getCursorControl () {
- checkDevice ();
- int [] unused = new int [1], buffer = new int [1];
- int xWindow, xParent = OS.XDefaultRootWindow (xDisplay);
- do {
- if (OS.XQueryPointer (
- xDisplay, xParent, unused, buffer,
- unused, unused, unused, unused, unused) == 0) return null;
- if ((xWindow = buffer [0]) != 0) xParent = xWindow;
- } while (xWindow != 0);
- int handle = OS.XtWindowToWidget (xDisplay, xParent);
- if (handle == 0) return null;
- do {
- Widget widget = WidgetTable.get (handle);
- if (widget != null && widget instanceof Control) {
- Control control = (Control) widget;
- if (control.getEnabled ()) return control;
- }
- } while ((handle = OS.XtParent (handle)) != 0);
- return null;
-}
-/**
- * Returns the location of the on-screen pointer relative
- * to the top left corner of the screen.
- *
- * @return the cursor location
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCursorLocation () {
- checkDevice ();
- int window = OS.XDefaultRootWindow (xDisplay);
- int [] rootX = new int [1];
- int [] rootY = new int [1];
- int [] unused = new int [1];
- OS.XQueryPointer(xDisplay, window, unused, unused, rootX, rootY, unused, unused, unused);
- return new Point (rootX [0], rootY [0]);
-}
-/**
- * Returns the default display. One is created (making the
- * thread that invokes this method its user-interface thread)
- * if it did not already exist.
- *
- * @return the default display
- */
-public static synchronized Display getDefault () {
- if (Default == null) Default = new Display ();
- return Default;
-}
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData (String key) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-/**
- * Returns the application defined, display specific data
- * associated with the receiver, or null if it has not been
- * set. The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @return the display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData () {
- checkDevice ();
- return data;
-}
-/**
- * Returns the longest duration, in milliseconds, between
- * two mouse button clicks that will be considered a
- * <em>double click</em> by the underlying operating system.
- *
- * @return the double click time
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getDoubleClickTime () {
- checkDevice ();
- return OS.XtGetMultiClickTime (xDisplay);
-}
-/**
- * Returns the control which currently has keyboard focus,
- * or null if keyboard events are not currently going to
- * any of the controls built by the currently running
- * application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getFocusControl () {
- checkDevice ();
- int [] buffer1 = new int [1], buffer2 = new int [1];
- OS.XGetInputFocus (xDisplay, buffer1, buffer2);
- int xWindow = buffer1 [0];
- if (xWindow == 0) return null;
- int handle = OS.XtWindowToWidget (xDisplay, xWindow);
- if (handle == 0) return null;
- handle = OS.XmGetFocusWidget (handle);
- if (handle == 0) return null;
- do {
- Widget widget = WidgetTable.get (handle);
- if (widget != null && widget instanceof Control) {
- Control window = (Control) widget;
- if (window.getEnabled ()) return window;
- }
- } while ((handle = OS.XtParent (handle)) != 0);
- return null;
-}
-/**
- * Returns the maximum allowed depth of icons on this display.
- * On some platforms, this may be different than the actual
- * depth of the display.
- *
- * @return the maximum icon depth
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIconDepth () {
- return getDepth ();
-}
-/**
- * Returns an array containing all shells which have not been
- * disposed and have the receiver as their display.
- *
- * @return the receiver's shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkDevice ();
- /*
- * NOTE: Need to check that the shells that belong
- * to another display have not been disposed by the
- * other display's thread as the shells list is being
- * processed.
- */
- int count = 0;
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- count++;
- }
- }
- if (count == shells.length) return shells;
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- result [index++] = shell;
- }
- }
- return result;
-}
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or null if no such runnable is currently being invoked by
- * the user-interface thread.
- * <p>
- * Note: If a runnable invoked by asyncExec is currently
- * running, this method will return null.
- * </p>
- *
- * @return the receiver's sync-interface thread
- */
-public Thread getSyncThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return synchronizer.syncThread;
-}
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- XColor xColor = null;
- switch (id) {
- case SWT.COLOR_INFO_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
- case SWT.COLOR_INFO_BACKGROUND: return COLOR_INFO_BACKGROUND;
- case SWT.COLOR_TITLE_FOREGROUND: return super.getSystemColor (SWT.COLOR_WHITE);
- case SWT.COLOR_TITLE_BACKGROUND: return super.getSystemColor (SWT.COLOR_DARK_BLUE);
- case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: return super.getSystemColor (SWT.COLOR_BLUE);
- case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: return super.getSystemColor (SWT.COLOR_DARK_GRAY);
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: return super.getSystemColor (SWT.COLOR_GRAY);
- case SWT.COLOR_WIDGET_DARK_SHADOW: xColor = COLOR_WIDGET_DARK_SHADOW; break;
- case SWT.COLOR_WIDGET_NORMAL_SHADOW: xColor = COLOR_WIDGET_NORMAL_SHADOW; break;
- case SWT.COLOR_WIDGET_LIGHT_SHADOW: xColor = COLOR_WIDGET_LIGHT_SHADOW; break;
- case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: xColor = COLOR_WIDGET_HIGHLIGHT_SHADOW; break;
- case SWT.COLOR_WIDGET_BACKGROUND: xColor = COLOR_WIDGET_BACKGROUND; break;
- case SWT.COLOR_WIDGET_FOREGROUND:
- case SWT.COLOR_WIDGET_BORDER: xColor = COLOR_WIDGET_BORDER; break;
- case SWT.COLOR_LIST_FOREGROUND: xColor = COLOR_LIST_FOREGROUND; break;
- case SWT.COLOR_LIST_BACKGROUND: xColor = COLOR_LIST_BACKGROUND; break;
- case SWT.COLOR_LIST_SELECTION: xColor = COLOR_LIST_SELECTION; break;
- case SWT.COLOR_LIST_SELECTION_TEXT: xColor = COLOR_LIST_SELECTION_TEXT; break;
- default:
- return super.getSystemColor (id);
- }
- if (xColor == null) return super.getSystemColor (SWT.COLOR_BLACK);
- return Color.motif_new (this, xColor);
-}
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return Font.motif_new (this, defaultFontList);
-}
-/**
- * Returns the user-interface thread for the receiver.
- *
- * @return the receiver's user-interface thread
- */
-public Thread getThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return thread;
-}
-void hideToolTip () {
- if (toolTipHandle != 0) {
- int shellHandle = OS.XtParent(toolTipHandle);
- OS.XtDestroyWidget(shellHandle);
- }
- toolTipHandle = 0;
-}
-protected void init () {
- super.init ();
- initializeDisplay ();
- initializeButton ();
- initializeComposite ();
- initializeDialog ();
- initializeLabel ();
- initializeList ();
- initializeScrollBar ();
- initializeText ();
- initializeSystemColors ();
- initializeDefaults ();
- initializeTranslations ();
-}
-void initializeButton () {
-
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
-
- /* Get the push button information */
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreatePushButton (shellHandle, null, null, 0);
- OS.XtManageChild (widgetHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {
- OS.XmNforeground, 0, /* 1 */
- OS.XmNbackground, 0, /* 3 */
- OS.XmNshadowThickness, 0, /* 5 */
- OS.XmNfontList, 0, /* 7 */
- };
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- buttonForeground = argList [1]; buttonBackground = argList [3];
- buttonShadowThickness = argList [5];
- /**
- * Feature in Motif. Querying the font list from the widget and
- * then destroying the shell (and the widget) could cause the
- * font list to be freed as well. The fix is to make a copy of
- * the font list, then to free it when the display is disposed.
- */
- buttonFont = OS.XmFontListCopy (argList [7]);
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeComposite () {
- int widgetClass = OS.TopLevelShellWidgetClass ();
- int shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- int scrolledHandle = OS.XmCreateMainWindow (shellHandle, null, null, 0);
- int [] argList1 = {OS.XmNorientation, OS.XmHORIZONTAL};
- int hScrollHandle = OS.XmCreateScrollBar (scrolledHandle, null, argList1, argList1.length / 2);
- OS.XtManageChild (hScrollHandle);
- int [] argList2 = {OS.XmNorientation, OS.XmVERTICAL};
- int vScrollHandle = OS.XmCreateScrollBar (scrolledHandle, null, argList2, argList2.length / 2);
- OS.XtManageChild (vScrollHandle);
- OS.XtManageChild (scrolledHandle);
- int [] argList5 = {
- OS.XmNmarginWidth, 3,
- OS.XmNmarginHeight, 3,
- };
- int formHandle = OS.XmCreateForm (scrolledHandle, null, argList5, argList5.length / 2);
- OS.XtManageChild (formHandle);
- int [] argList6 = {
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNtopAttachment, OS.XmATTACH_FORM,
- OS.XmNbottomAttachment, OS.XmATTACH_FORM,
- OS.XmNleftAttachment, OS.XmATTACH_FORM,
- OS.XmNrightAttachment, OS.XmATTACH_FORM,
- };
- int widgetHandle = OS.XmCreateDrawingArea (formHandle, null, argList6, argList6.length / 2);
- OS.XtManageChild (widgetHandle);
- OS.XmMainWindowSetAreas (scrolledHandle, 0, 0, hScrollHandle, vScrollHandle, formHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- int screen = OS.XDefaultScreen (xDisplay);
- OS.XtResizeWidget (shellHandle, OS.XDisplayWidth (xDisplay, screen), OS.XDisplayHeight (xDisplay, screen), 0);
- OS.XtRealizeWidget (shellHandle);
- int [] argList3 = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (scrolledHandle, argList3, argList3.length / 2);
- int [] argList8 = {OS.XmNx, 0, OS.XmNy, 0, OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (formHandle, argList8, argList8.length / 2);
- int [] argList4 = {
- OS.XmNx, 0, /* 1 */
- OS.XmNy, 0, /* 3 */
- OS.XmNwidth, 0, /* 5 */
- OS.XmNheight, 0, /* 7 */
- OS.XmNforeground, 0, /* 9 */
- OS.XmNbackground, 0, /* 11 */
- OS.XmNtopShadowColor, 0, /* 13 */
- OS.XmNbottomShadowColor, 0, /* 15 */
- OS.XmNborderColor, 0, /* 17 */
- };
- OS.XtGetValues (widgetHandle, argList4, argList4.length / 2);
- scrolledInsetX = argList4 [1] + argList8 [1];
- scrolledInsetY = argList4 [3] + argList8 [3];
- scrolledMarginX = argList3 [1] - argList8 [1] - argList4 [1] - argList4 [5];
- scrolledMarginY = argList3 [3] - argList8 [3] - argList4 [3] - argList4 [7];
- compositeForeground = argList4 [9]; compositeBackground = argList4 [11];
- compositeTopShadow = argList4 [13]; compositeBottomShadow = argList4 [15];
- compositeBorder = argList4 [17];
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeDefaults () {
- defaultFontList = labelFont;
- defaultForeground = compositeForeground;
- defaultBackground = compositeBackground;
-
- /**
- * Initialize the default font id to the first
- * font in the default font list
- */
- int [] buffer = new int [1];
- if (!OS.XmFontListInitFontContext (buffer, defaultFontList)) {
- return;
- }
- int context = buffer [0];
- XFontStruct fontStruct = new XFontStruct ();
- int [] fontStructPtr = new int [1];
- int [] fontNamePtr = new int [1];
-
- /* Take the first entry from the font list */
- int fontListEntry = OS.XmFontListNextEntry (context);
- int fontPtr = OS.XmFontListEntryGetFont (fontListEntry, buffer);
- if (buffer [0] == 0) {
- /* FontList contains a single font */
- OS.memmove (fontStruct, fontPtr, XFontStruct.sizeof);
- defaultFont = fontStruct.fid;
- } else {
- /* FontList contains a fontSet */
- /* Take the first font in the font set */
- int nFonts = OS.XFontsOfFontSet (fontPtr, fontStructPtr, fontNamePtr);
- if (nFonts > 0) {
- int [] fontStructs = new int [1];
- OS.memmove (fontStructs, fontStructPtr [0], 4);
- OS.memmove (fontStruct, fontStructs [0], XFontStruct.sizeof);
- defaultFont = fontStruct.fid;
- }
- }
- OS.XmFontListFreeFontContext (context);
-}
-void initializeDialog () {
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateDialogShell (shellHandle, null, null, 0);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- dialogForeground = argList [1]; dialogBackground = argList [3];
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeDisplay () {
-
- /* Create the callbacks */
- windowCallback = new Callback (this, "windowProc", 4);
- windowProc = windowCallback.getAddress ();
- if (windowProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- timerCallback = new Callback (this, "timerProc", 2);
- timerProc = timerCallback.getAddress ();
- if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- caretCallback = new Callback (this, "caretProc", 2);
- caretProc = caretCallback.getAddress ();
- if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- mouseHoverCallback = new Callback (this, "mouseHoverProc", 2);
- mouseHoverProc = mouseHoverCallback.getAddress ();
- if (mouseHoverProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- checkExposeCallback = new Callback (this, "checkExposeProc", 3);
- checkExposeProc = checkExposeCallback.getAddress ();
- if (checkExposeProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- checkResizeCallback = new Callback (this, "checkResizeProc", 3);
- checkResizeProc = checkResizeCallback.getAddress ();
- if (checkResizeProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- wakeCallback = new Callback (this, "wakeProc", 3);
- wakeProc = wakeCallback.getAddress ();
- if (wakeProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- /* Create and install the pipe used to wake up from sleep */
- int [] filedes = new int [2];
- if (OS.pipe (filedes) != 0) error (SWT.ERROR_NO_HANDLES);
- read_fd = filedes [0]; write_fd = filedes [1];
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- inputID = OS.XtAppAddInput (xtContext, read_fd, OS.XtInputReadMask, wakeProc, 0);
- fd_set = new byte [4 * OS.FD_SETSIZE() / OS.NFDBITS()];
-
- /*
- * Use dynamic Drag and Drop Protocol styles.
- * Preregistered protocol is not supported.
- */
- int xmDisplay = OS.XmGetXmDisplay (xDisplay);
- int [] args = new int [] {
- OS.XmNenableThinThickness, 1,
- OS.XmNdragInitiatorProtocolStyle, OS.XmDRAG_DYNAMIC,
- OS.XmNdragReceiverProtocolStyle, OS.XmDRAG_DYNAMIC,
- };
- OS.XtSetValues (xmDisplay, args, args.length / 2);
-
- /* Create the hidden Override shell parent */
- int xScreen = OS.XDefaultScreen (xDisplay);
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtResizeWidget (shellHandle, OS.XDisplayWidth (xDisplay, xScreen), OS.XDisplayHeight (xDisplay, xScreen), 0);
- OS.XtRealizeWidget (shellHandle);
-
- /*
- * Bug in MOTIF. For some reason, calls to XmGetPixmap ()
- * and XmGetPixmapByDepth fail to find the pixmap unless at
- * least one message box has been created. The fix is to
- * create and destroy a message box.
- */
-// int dialog = OS.XmCreateInformationDialog (shellHandle, null, null, 0);
-// OS.XtDestroyWidget (dialog);
-}
-void initializeLabel () {
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateLabel (shellHandle, null, null, 0);
- OS.XtManageChild (widgetHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0, OS.XmNfontList, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- labelForeground = argList [1]; labelBackground = argList [3];
- /**
- * Feature in Motif. Querying the font list from the widget and
- * then destroying the shell (and the widget) could cause the
- * font list to be freed as well. The fix is to make a copy of
- * the font list, then to free it when the display is disposed.
- */
- labelFont = OS.XmFontListCopy (argList [5]);
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeList () {
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateScrolledList (shellHandle, null, null, 0);
- OS.XtManageChild (widgetHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0, OS.XmNfontList, 0, OS.XmNselectColor, 0, OS.XmNhighlightColor, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- listForeground = argList [1];
- listBackground = argList [3];
-
- /**
- * Feature in Motif. Querying the font list from the widget and
- * then destroying the shell (and the widget) could cause the
- * font list to be freed as well. The fix is to make a copy of
- * the font list, then to free it when the display is disposed.
- */
- listFont = OS.XmFontListCopy (argList [5]);
-
- /**
- * Feature in Motif. If the value of resource XmNselectColor is
- * XmDEFAULT_SELECT_COLOR then querying for this resource gives
- * the value of the selection color to use, which is between the
- * background and bottom shadow colors. If the resource value
- * that is returned is XmDEFAULT_SELECT_COLOR, and not the color,
- * since there is no API to query the color, use the list foreground
- * color.
- */
- switch (argList [7]) {
- case OS.XmDEFAULT_SELECT_COLOR:
- case OS.XmREVERSED_GROUND_COLORS:
- listSelect = listForeground;
- break;
- case OS.XmHIGHLIGHT_COLOR:
- listSelect = argList [9];
- break;
- default:
- listSelect = argList [7]; // the middle color to use
- }
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeScrollBar () {
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateScrollBar (shellHandle, null, null, 0);
- OS.XtManageChild (widgetHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- scrollBarForeground = argList [1]; scrollBarBackground = argList [3];
- OS.XtDestroyWidget (shellHandle);
-}
-void initializeSystemColors () {
- int [] argList = {OS.XmNcolormap, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- int colormap = argList [1];
-
- COLOR_WIDGET_DARK_SHADOW = new XColor();
- COLOR_WIDGET_DARK_SHADOW.pixel = compositeBottomShadow;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_DARK_SHADOW);
-
- COLOR_WIDGET_NORMAL_SHADOW = new XColor();
- COLOR_WIDGET_NORMAL_SHADOW.pixel = compositeBottomShadow;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_NORMAL_SHADOW);
-
- COLOR_WIDGET_LIGHT_SHADOW = new XColor();
- COLOR_WIDGET_LIGHT_SHADOW.pixel = compositeTopShadow;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_LIGHT_SHADOW);
-
- COLOR_WIDGET_HIGHLIGHT_SHADOW = new XColor();
- COLOR_WIDGET_HIGHLIGHT_SHADOW.pixel = compositeTopShadow;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_HIGHLIGHT_SHADOW);
-
- COLOR_WIDGET_BACKGROUND = new XColor();
- COLOR_WIDGET_BACKGROUND.pixel = compositeBackground;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_BACKGROUND);
-
- COLOR_WIDGET_BORDER = new XColor();
- COLOR_WIDGET_BORDER.pixel = compositeBorder;
- OS.XQueryColor (xDisplay, colormap, COLOR_WIDGET_BORDER);
-
- COLOR_LIST_FOREGROUND = new XColor();
- COLOR_LIST_FOREGROUND.pixel = listForeground;
- OS.XQueryColor (xDisplay, colormap, COLOR_LIST_FOREGROUND);
-
- COLOR_LIST_BACKGROUND = new XColor();
- COLOR_LIST_BACKGROUND.pixel = listBackground;
- OS.XQueryColor (xDisplay, colormap, COLOR_LIST_BACKGROUND);
-
- COLOR_LIST_SELECTION = new XColor();
- COLOR_LIST_SELECTION.pixel = listSelect;
- OS.XQueryColor (xDisplay, colormap, COLOR_LIST_SELECTION);
-
- COLOR_LIST_SELECTION_TEXT = new XColor();
- COLOR_LIST_SELECTION_TEXT.pixel = listBackground;
- OS.XQueryColor (xDisplay, colormap, COLOR_LIST_SELECTION_TEXT);
-
- COLOR_INFO_BACKGROUND = new Color (this, 0xFF, 0xFF, 0xE1);
-}
-void initializeText () {
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateScrolledText (shellHandle, null, null, 0);
- OS.XtManageChild (widgetHandle);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0, OS.XmNfontList, 0, OS.XmNhighlightThickness, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- textForeground = argList [1]; textBackground = argList [3];
- textHighlightThickness = argList[7];
- /**
- * Feature in Motif. Querying the font list from the widget and
- * then destroying the shell (and the widget) could cause the
- * font list to be freed as well. The fix is to make a copy of
- * the font list, then to free it when the display is disposed.
- */
- textFont = OS.XmFontListCopy (argList [5]);
- OS.XtDestroyWidget (shellHandle);
-
-}
-void initializeTranslations () {
- byte [] buffer1 = Converter.wcsToMbcs (null, "<Key>osfUp:\n<Key>osfDown:\n<Key>osfLeft:\n<Key>osfRight:\0");
- arrowTranslations = OS.XtParseTranslationTable (buffer1);
- byte [] buffer2 = Converter.wcsToMbcs (null, "~Meta ~Alt <Key>Tab:\nShift ~Meta ~Alt <Key>Tab:\0");
- tabTranslations = OS.XtParseTranslationTable (buffer2);
- byte [] buffer3 = Converter.wcsToMbcs (null, "<Btn2Down>:\0");
- dragTranslations = OS.XtParseTranslationTable (buffer3);
-}
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
- int xDrawable = OS.XDefaultRootWindow (xDisplay);
- int xGC = OS.XCreateGC (xDisplay, xDrawable, 0, null);
- if (xGC == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.XSetSubwindowMode (xDisplay, xGC, OS.IncludeInferiors);
- if (data != null) {
- data.device = this;
- data.display = xDisplay;
- data.drawable = xDrawable;
- data.fontList = defaultFontList;
- data.colormap = OS.XDefaultColormap (xDisplay, OS.XDefaultScreen (xDisplay));
- }
- return xGC;
-}
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int gc, GCData data) {
- OS.XFreeGC(xDisplay, gc);
-}
-boolean isValidThread () {
- return thread == Thread.currentThread ();
-}
-static boolean isValidClass (Class clazz) {
- String name = clazz.getName ();
- int index = name.lastIndexOf ('.');
- return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
-}
-int mouseHoverProc (int handle, int id) {
- mouseHoverID = mouseHoverHandle = 0;
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processMouseHover(id);
-}
-void postEvent (Event event) {
- /*
- * Place the event at the end of the event queue.
- * This code is always called in the Display's
- * thread so it must be re-enterant but does not
- * need to be synchronized.
- */
- if (eventQueue == null) eventQueue = new Event [4];
- int index = 0;
- int length = eventQueue.length;
- while (index < length) {
- if (eventQueue [index] == null) break;
- index++;
- }
- if (index == length) {
- Event [] newQueue = new Event [length + 4];
- System.arraycopy (eventQueue, 0, newQueue, 0, length);
- eventQueue = newQueue;
- }
- eventQueue [index] = event;
-}
-/**
- * Reads an event from the operating system's event queue,
- * dispatches it appropriately, and returns <code>true</code>
- * if there is potentially more work to do, or <code>false</code>
- * if the caller can sleep until another event is placed on
- * the event queue.
- * <p>
- * In addition to checking the system event queue, this method also
- * checks if any inter-thread messages (created by <code>syncExec()</code>
- * or <code>asyncExec()</code>) are waiting to be processed, and if
- * so handles them before returning.
- * </p>
- *
- * @return <code>false</code> if the caller can sleep upon return from this method
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #sleep
- * @see #wake
- */
-public boolean readAndDispatch () {
- checkDevice ();
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- int status = OS.XtAppPending (xtContext);
- if (status == 0) {
- OS.XtAppAddTimeOut (xtContext, 1, 0, 0);
- OS.XtAppProcessEvent (xtContext, OS.XtIMTimer);
- } else {
- if ((status & OS.XtIMTimer) != 0) {
- OS.XtAppProcessEvent (xtContext, OS.XtIMTimer);
- status = OS.XtAppPending (xtContext);
- }
- if ((status & OS.XtIMAlternateInput) != 0) {
- OS.XtAppProcessEvent (xtContext, OS.XtIMAlternateInput);
- status = OS.XtAppPending (xtContext);
- }
- if ((status & OS.XtIMXEvent) != 0) {
- OS.XtAppNextEvent (xtContext, xEvent);
- if (!filterEvent (xEvent)) OS.XtDispatchEvent (xEvent);
- }
- runDeferredEvents ();
- return true;
- }
- return runAsyncMessages ();
-}
-static synchronized void register (Display display) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] == null) {
- Displays [i] = display;
- return;
- }
- }
- Display [] newDisplays = new Display [Displays.length + 4];
- System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
- newDisplays [Displays.length] = display;
- Displays = newDisplays;
-}
-protected void release () {
-
- /* Release shells */
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
- }
- }
- while (readAndDispatch ()) {};
-
- /* Run dispose list */
- if (disposeList != null) {
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] != null) disposeList [i].run ();
- }
- }
- disposeList = null;
-
- /* Release synchronizer */
- synchronizer.releaseSynchronizer ();
- synchronizer = null;
- releaseDisplay ();
-
- super.release ();
-}
-void releaseDisplay () {
-
- /* Destroy the hidden Override shell parent */
- if (shellHandle != 0) OS.XtDestroyWidget (shellHandle);
- shellHandle = 0;
-
- /* Dispose the caret callback */
- if (caretID != 0) OS.XtRemoveTimeOut (caretID);
- caretID = caretProc = 0;
- caretCallback.dispose ();
- caretCallback = null;
-
- /* Dispose the timer callback */
- if (timerIDs != null) {
- for (int i=0; i<timerIDs.length; i++) {
- if (timerIDs [i] != 0) OS.XtRemoveTimeOut (timerIDs [i]);
- }
- }
- timerIDs = null;
- timerList = null;
- timerProc = 0;
- timerCallback.dispose ();
- timerCallback = null;
-
- /* Dispose the mouse hover callback */
- if (mouseHoverID != 0) OS.XtRemoveTimeOut (mouseHoverID);
- mouseHoverID = mouseHoverProc = mouseHoverHandle = toolTipHandle = 0;
- mouseHoverCallback.dispose ();
- mouseHoverCallback = null;
-
- /* Dispose window, expose and resize callbacks */
- windowCallback.dispose (); windowCallback = null;
- checkExposeCallback.dispose (); checkExposeCallback = null;
- checkExposeProc = 0;
- checkResizeCallback.dispose (); checkResizeCallback = null;
- checkResizeProc = 0;
-
- /* Dispose the wake callback, id and pipe */
- if (inputID != 0) OS.XtRemoveInput (inputID);
- wakeCallback.dispose (); wakeCallback = null;
- wakeProc = 0;
- OS.close (read_fd);
- OS.close (write_fd);
-
- /* Free the font lists */
- if (buttonFont != 0) OS.XmFontListFree (buttonFont);
- if (labelFont != 0) OS.XmFontListFree (labelFont);
- if (textFont != 0) OS.XmFontListFree (textFont);
- if (listFont != 0) OS.XmFontListFree (listFont);
- listFont = textFont = labelFont = buttonFont = 0;
- defaultFontList = defaultFont = 0;
-
- /* Free the translations (no documentation describes how to do this) */
- //OS.XtFree (arrowTranslations);
- //OS.XtFree (tabTranslations);
- //OS.XtFree (dragTranslations);
-
- /* Release references */
- thread = null;
- xEvent = null;
- buttonBackground = buttonForeground = 0;
- defaultBackground = defaultForeground = 0;
- COLOR_WIDGET_DARK_SHADOW = COLOR_WIDGET_NORMAL_SHADOW = COLOR_WIDGET_LIGHT_SHADOW =
- COLOR_WIDGET_HIGHLIGHT_SHADOW = COLOR_WIDGET_BACKGROUND = COLOR_WIDGET_BORDER =
- COLOR_LIST_FOREGROUND = COLOR_LIST_BACKGROUND = COLOR_LIST_SELECTION = COLOR_LIST_SELECTION_TEXT = null;
- COLOR_INFO_BACKGROUND = null;
-}
-void releaseToolTipHandle (int handle) {
- if (mouseHoverHandle == handle) removeMouseHoverTimeOut ();
- if (toolTipHandle != 0) {
- int shellHandle = OS.XtParent(toolTipHandle);
- int shellParent = OS.XtParent(shellHandle);
- if (handle == shellParent) toolTipHandle = 0;
- }
-}
-void removeMouseHoverTimeOut () {
- if (mouseHoverID != 0) OS.XtRemoveTimeOut (mouseHoverID);
- mouseHoverID = mouseHoverHandle = 0;
-}
-boolean runAsyncMessages () {
- return synchronizer.runAsyncMessages ();
-}
-boolean runDeferredEvents () {
- /*
- * Run deferred events. This code is always
- * called in the Display's thread so it must
- * be re-enterant need not be synchronized.
- */
- while (eventQueue != null) {
-
- /* Take an event off the queue */
- Event event = eventQueue [0];
- if (event == null) break;
- int length = eventQueue.length;
- System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
- eventQueue [length] = null;
-
- /* Run the event */
- Widget widget = event.widget;
- if (widget != null && !widget.isDisposed ()) {
- Widget item = event.item;
- if (item == null || !item.isDisposed ()) {
- widget.notifyListeners (event.type, event);
- }
- }
-
- /*
- * At this point, the event queue could
- * be null due to a recursive invokation
- * when running the event.
- */
- }
-
- /* Clear the queue */
- eventQueue = null;
- return true;
-}
-/**
- * On platforms which support it, sets the application name
- * to be the argument. On Motif, for example, this can be used
- * to set the name used for resource lookup.
- *
- * @param name the new app name
- */
-public static void setAppName (String name) {
- APP_NAME = name;
-}
-void setCurrentCaret (Caret caret) {
- if (caretID != 0) OS.XtRemoveTimeOut (caretID);
- caretID = 0;
- currentCaret = caret;
- if (currentCaret != null) {
- int blinkRate = currentCaret.blinkRate;
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- caretID = OS.XtAppAddTimeOut (xtContext, blinkRate, caretProc, 0);
- }
-}
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given argument.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public void setData (String key, Object value) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-/**
- * Sets the application defined, display specific data
- * associated with the receiver, to the argument.
- * The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param data the new display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #getData
- * @see #disposeExec
- */
-public void setData (Object data) {
- checkDevice ();
- this.data = data;
-}
-/**
- * Sets the synchronizer used by the display to be
- * the argument, which can not be null.
- *
- * @param synchronizer the new synchronizer for the display (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSynchronizer (Synchronizer synchronizer) {
- checkDevice ();
- if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (this.synchronizer != null) {
- this.synchronizer.runAsyncMessages();
- }
- this.synchronizer = synchronizer;
-}
-void setToolTipText (int handle, String toolTipText) {
- if (toolTipHandle == 0) return;
- int shellHandle = OS.XtParent (toolTipHandle);
- int shellParent = OS.XtParent (shellHandle);
- if (handle != shellParent) return;
- showToolTip (handle, toolTipText);
-}
-void showToolTip (int handle, String toolTipText) {
- int shellHandle = 0;
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, toolTipText, true);
- if (toolTipHandle != 0) {
- shellHandle = OS.XtParent (toolTipHandle);
- int shellParent = OS.XtParent (shellHandle);
- if (handle != shellParent) return;
- int xmString = OS.XmStringGenerate (buffer, null, OS.XmCHARSET_TEXT, null);
- int [] argList = {OS.XmNlabelString, xmString};
- OS.XtSetValues (toolTipHandle, argList, argList.length / 2);
- if (xmString != 0) OS.XmStringFree (xmString);
- } else {
- int widgetClass = OS.OverrideShellWidgetClass ();
- int [] argList1 = {OS.XmNmwmDecorations, 0, OS.XmNborderWidth, 1};
- shellHandle = OS.XtCreatePopupShell (null, widgetClass, handle, argList1, argList1.length / 2);
- Color infoForeground = getSystemColor (SWT.COLOR_INFO_FOREGROUND);
- Color infoBackground = getSystemColor (SWT.COLOR_INFO_BACKGROUND);
- int foregroundPixel = infoForeground.handle.pixel;
- int backgroundPixel = infoBackground.handle.pixel;
- int [] argList2 = {
- OS.XmNforeground, foregroundPixel,
- OS.XmNbackground, backgroundPixel,
- OS.XmNalignment, OS.XmALIGNMENT_BEGINNING,
- };
- toolTipHandle = OS.XmCreateLabel (shellHandle, buffer, argList2, argList2.length / 2);
- OS.XtManageChild (toolTipHandle);
- }
- if (toolTipText == null || toolTipText.length () == 0) {
- OS.XtPopdown (shellHandle);
- } else {
- /*
- * Feature in X. There is no way to query the size of a cursor.
- * The fix is to use the default cursor size which is 16x16.
- */
- int xWindow = OS.XDefaultRootWindow (xDisplay);
- int [] rootX = new int [1], rootY = new int [1], unused = new int [1], mask = new int [1];
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, rootX, rootY, unused, unused, mask);
- int x = rootX [0] + 16, y = rootY [0] + 16;
-
- /*
- * Ensure that the tool tip is on the screen.
- */
- int screen = OS.XDefaultScreen (xDisplay);
- int width = OS.XDisplayWidth (xDisplay, screen);
- int height = OS.XDisplayHeight (xDisplay, screen);
- int [] argList4 = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (toolTipHandle, argList4, argList4.length / 2);
- x = Math.max (0, Math.min (x, width - argList4 [1]));
- y = Math.max (0, Math.min (y, height - argList4 [3]));
- OS.XtMoveWidget (shellHandle, x, y);
- int flags = OS.Button1Mask | OS.Button2Mask | OS.Button3Mask;
- if ((mask [0] & flags) == 0) OS.XtPopup (shellHandle, OS.XtGrabNone);
- }
-}
-/**
- * Causes the user-interface thread to <em>sleep</em> (that is,
- * to be put in a state where it does not consume CPU cycles)
- * until an event is received or it is otherwise awakened.
- *
- * @return <code>true</code> if an event requiring dispatching was placed on the queue.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #wake
- */
-public boolean sleep () {
- checkDevice ();
- /*
- * This code is intentionally commented.
- */
-// int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
-// /*
-// * Bug in Xt. Under certain circumstances Xt waits
-// * forever looking for X events, ignoring alternate
-// * inputs. The fix is to never sleep forever.
-// */
-// int sleepID = OS.XtAppAddTimeOut (xtContext, 100, 0, 0);
-// boolean result = OS.XtAppPeekEvent (xtContext, xEvent);
-// if (sleepID != 0) OS.XtRemoveTimeOut (sleepID);
-// return result;
-
- int display_fd = OS.ConnectionNumber (xDisplay);
- int max_fd = display_fd > read_fd ? display_fd : read_fd;
- OS.FD_ZERO (fd_set);
- OS.FD_SET (display_fd, fd_set);
- OS.FD_SET (read_fd, fd_set);
- timeout [0] = 0;
- timeout [1] = 100;
- OS.select (max_fd + 1, fd_set, null, null, timeout);
- return OS.FD_ISSET (display_fd, fd_set);
-}
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void syncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.syncExec (runnable);
-}
-int textWidth (String string, int fontList) {
- if (string.length () == 0) return 0;
- String codePage = Converter.getCodePage (xDisplay, fontList);
- byte [] textBuffer = Converter.wcsToMbcs (codePage, string, true);
- int xmString = OS.XmStringGenerate (textBuffer, null, OS.XmCHARSET_TEXT, null);
- int width = OS.XmStringWidth (fontList, xmString);
- OS.XmStringFree (xmString);
- return width;
-}
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread after the specified
- * number of milliseconds have elapsed.
- *
- * @param milliseconds the delay before running the runnable
- * @param runnable code to run on the user-interface thread
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void timerExec (int milliseconds, Runnable runnable) {
- checkDevice ();
- if (timerList == null) timerList = new Runnable [4];
- if (timerIDs == null) timerIDs = new int [4];
- int index = 0;
- while (index < timerList.length) {
- if (timerList [index] == null) break;
- index++;
- }
- if (index == timerList.length) {
- Runnable [] newTimerList = new Runnable [timerList.length + 4];
- System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
- timerList = newTimerList;
- int [] newTimerIDs = new int [timerIDs.length + 4];
- System.arraycopy (timerIDs, 0, newTimerIDs, 0, timerIDs.length);
- timerIDs = newTimerIDs;
- }
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- int timerID = OS.XtAppAddTimeOut (xtContext, milliseconds, timerProc, index);
- if (timerID != 0) {
- timerIDs [index] = timerID;
- timerList [index] = runnable;
- }
-}
-int timerProc (int index, int id) {
- if (timerList == null) return 0;
- if (0 <= index && index < timerList.length) {
- Runnable runnable = timerList [index];
- timerList [index] = null;
- timerIDs [index] = 0;
- if (runnable != null) runnable.run ();
- }
- return 0;
-}
-static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- }
- return 0;
-}
-static int untranslateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [1] == key) return KeyTable [i] [0];
- }
- return 0;
-}
-public void update () {
- checkDevice ();
- XAnyEvent event = new XAnyEvent ();
- int mask = OS.ExposureMask | OS.ResizeRedirectMask |
- OS.StructureNotifyMask | OS.SubstructureNotifyMask |
- OS.SubstructureRedirectMask;
- OS.XSync (xDisplay, false); OS.XSync (xDisplay, false);
- while (OS.XCheckMaskEvent (xDisplay, mask, event)) OS.XtDispatchEvent (event);
-}
-/**
- * If the receiver's user-interface thread was <code>sleep</code>'ing,
- * causes it to be awakened and start running again. Note that this
- * method may be called from any thread.
- *
- * @see #sleep
- */
-public void wake () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- /* Write a single byte to the wake up pipe */
- while (OS.write (write_fd, wake_buffer, 1) != 1);
-}
-int wakeProc (int closure, int source, int id) {
- /* Read a single byte from the wake up pipe */
- while (OS.read (read_fd, wake_buffer, 1) != 1);
- return 0;
-}
-int windowProc (int handle, int clientData, int callData, int unused) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processEvent (clientData, callData);
-}
-String wrapText (String text, int fontList, int width) {
- String Lf = "\n";
- text = convertToLf (text);
- int length = text.length ();
- if (width <= 0 || length == 0 || length == 1) return text;
- StringBuffer result = new StringBuffer ();
- int lineStart = 0, lineEnd = 0;
- while (lineStart < length) {
- lineEnd = text.indexOf (Lf, lineStart);
- boolean noLf = lineEnd == -1;
- if (noLf) lineEnd = length;
- int nextStart = lineEnd + Lf.length ();
- while (lineEnd > lineStart + 1 && Compatibility.isWhitespace (text.charAt (lineEnd - 1))) {
- lineEnd--;
- }
- int wordStart = lineStart, wordEnd = lineStart;
- int i = lineStart;
- while (i < lineEnd) {
- int lastStart = wordStart, lastEnd = wordEnd;
- wordStart = i;
- while (i < lineEnd && !Compatibility.isWhitespace (text.charAt (i))) {
- i++;
- }
- wordEnd = i - 1;
- String line = text.substring (lineStart, wordEnd + 1);
- int lineWidth = textWidth (line, fontList);
- while (i < lineEnd && Compatibility.isWhitespace (text.charAt (i))) {
- i++;
- }
- if (lineWidth > width) {
- if (lastStart == wordStart) {
- while (wordStart < wordEnd) {
- line = text.substring (lineStart, wordStart + 1);
- lineWidth = textWidth (line, fontList);
- if (lineWidth >= width) break;
- wordStart++;
- }
- if (wordStart == lastStart) wordStart++;
- lastEnd = wordStart - 1;
- }
- line = text.substring (lineStart, lastEnd + 1);
- result.append (line); result.append (Lf);
- i = wordStart; lineStart = wordStart; wordEnd = wordStart;
- }
- }
- if (lineStart < lineEnd) {
- result.append (text.substring (lineStart, lineEnd));
- }
- if (!noLf) {
- result.append (Lf);
- }
- lineStart = nextStart;
- }
- return result.toString ();
-}
-
-String convertToLf(String text) {
- char Cr = '\r';
- char Lf = '\n';
- int length = text.length ();
- if (length == 0) return text;
-
- /* Check for an LF or CR/LF. Assume the rest of the string
- * is formated that way. This will not work if the string
- * contains mixed delimiters. */
- int i = text.indexOf (Lf, 0);
- if (i == -1 || i == 0) return text;
- if (text.charAt (i - 1) != Cr) return text;
-
- /* The string is formatted with CR/LF.
- * Create a new string with the LF line delimiter. */
- i = 0;
- StringBuffer result = new StringBuffer ();
- while (i < length) {
- int j = text.indexOf (Cr, i);
- if (j == -1) j = length;
- String s = text.substring (i, j);
- result.append (s);
- i = j + 2;
- result.append (Lf);
- }
- return result.toString ();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FileDialog.java
deleted file mode 100755
index 88592b3c27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FileDialog.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select or enter a file name.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SAVE, OPEN, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FileDialog extends Dialog {
- int dialog;
- String [] filterNames = new String [0];
- String [] filterExtensions = new String [0];
- String filterPath = "";
- String fullPath = "";
- String fileName = "";
- boolean cancel = false;
- static final String FILTER = "*";
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-int cancelPressed (int widget, int client, int call) {
- cancel = true;
- OS.XtUnmanageChild (widget);
- return 0;
-}
-void extractValues() {
- filterPath = fullPath = "";
- int [] argList2 = {OS.XmNdirectory, 0, OS.XmNdirSpec, 0};
- OS.XtGetValues (dialog, argList2, argList2.length / 2);
-
- int xmString3 = argList2 [1];
- int ptr = OS.XmStringUnparse (
- xmString3,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (ptr != 0) {
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- /* Use the character encoding for the default locale */
- filterPath = new String (Converter.mbcsToWcs (null, buffer));
- }
- OS.XmStringFree (xmString3);
-
- int xmString4 = argList2 [3];
- ptr = OS.XmStringUnparse (
- xmString4,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (ptr != 0) {
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- /* Use the character encoding for the default locale */
- fullPath = new String (Converter.mbcsToWcs (null, buffer));
- }
- OS.XmStringFree (xmString4);
-
- int length = filterPath.length ();
- if (length != 0 && filterPath.charAt (length - 1) == '/') {
- filterPath = filterPath.substring (0, length - 1);
- int index = fullPath.lastIndexOf ('/');
- fileName = fullPath.substring (index + 1, fullPath.length ());
- }
-}
-/**
- * Returns the path of the first file that was
- * selected in the dialog relative to the filter path,
- * or null if none is available.
- *
- * @return the relative path of the file
- */
-public String getFileName () {
- return fileName;
-}
-
-/**
- * Returns the paths of all files that were selected
- * in the dialog relative to the filter path, or null
- * if none are available.
- *
- * @return the relative paths of the files
- */
-public String [] getFileNames () {
- return new String [] {fileName};
-}
-
-/**
- * Returns the file extensions which the dialog will
- * use to filter the files it shows.
- *
- * @return the file extensions filter
- */
-public String [] getFilterExtensions () {
- return filterExtensions;
-}
-
-/**
- * Returns the file names which the dialog will
- * use to filter the files it shows.
- *
- * @return the file name filter
- */
-public String [] getFilterNames () {
- return filterNames;
-}
-
-/**
- * Returns the path which the dialog will use to filter
- * the files it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-int okPressed (int widget, int client, int call) {
- extractValues();
-
- // preferred case, a file is selected
- if (!fileName.equals("")) {
- OS.XtUnmanageChild (widget);
- return 0;
- }
-
- // no file selected, so go into the current directory
- int [] argList1 = {OS.XmNdirMask, 0};
- OS.XtGetValues (dialog, argList1, argList1.length / 2);
- int directoryHandle = argList1[1];
- int [] argList2 = {OS.XmNpattern,directoryHandle};
- OS.XtSetValues (dialog, argList2, argList2.length / 2);
- OS.XmStringFree (directoryHandle);
-
- return 0;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the first selected file,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
-
- /* Get the parent */
- boolean destroyContext;
- Display appContext = Display.getCurrent ();
- if (destroyContext = (appContext == null)) appContext = new Display ();
- int display = appContext.xDisplay;
- int parentHandle = appContext.shellHandle;
- if ((parent != null) && (parent.getDisplay () == appContext))
- parentHandle = parent.shellHandle;
-
- /* Compute the dialog title */
- /*
- * Feature in Motif. It is not possible to set a shell
- * title to an empty string. The fix is to set the title
- * to be a single space.
- */
- String string = title;
- if (string.length () == 0) string = " ";
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, string, true);
- int xmStringPtr1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Compute the filter */
- String mask = FILTER;
- if (filterExtensions == null) filterExtensions = new String [0];
- if (filterNames == null) filterNames = new String [0];
- if (filterExtensions.length != 0) {
- /* Motif does not support multiple filters, so ignore them
- * if there are more than one, or if there is a ; separator.
- */
- if (filterExtensions.length == 1) {
- String filter = filterExtensions [0];
- if (filter.indexOf (';', 0) == -1) mask = filter;
- }
- }
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, mask, true);
- int xmStringPtr2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Compute the filter path */
- if (filterPath == null) filterPath = "";
- /* Use the character encoding for the default locale */
- byte [] buffer3 = Converter.wcsToMbcs (null, filterPath, true);
- int xmStringPtr3 = OS.XmStringParseText (
- buffer3,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
-
- /* Create the dialog */
- int [] argList1 = {
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNdialogStyle, OS.XmDIALOG_PRIMARY_APPLICATION_MODAL,
- OS.XmNwidth, OS.XDisplayWidth (display, OS.XDefaultScreen (display)) * 4 / 9,
- OS.XmNdialogTitle, xmStringPtr1,
- OS.XmNpattern, xmStringPtr2,
- OS.XmNdirectory, xmStringPtr3,
- };
- /*
- * Feature in Linux. For some reason, the XmCreateFileSelectionDialog()
- * will not accept NULL for the widget name. This works fine on the other
- * Motif platforms and in the other XmCreate calls on Linux. The fix is
- * to pass in a NULL terminated string, not a NULL pointer.
- */
- byte [] name = new byte [] {0};
- dialog = OS.XmCreateFileSelectionDialog (parentHandle, name, argList1, argList1.length / 2);
- int child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_HELP_BUTTON);
- if (child != 0) OS.XtUnmanageChild (child);
- OS.XmStringFree (xmStringPtr1);
- OS.XmStringFree (xmStringPtr2);
- OS.XmStringFree (xmStringPtr3);
-/*
- string := OSWidget xmStringAt: XmNdirectory handle: dialog.
- OSWidget xmStringAt: XmNdirSpec put: string, fileName handle: dialog.
-
- "Select the matching file in the list and scroll to show it."
- child := dialog xmFileSelectionBoxGetChild: XmDIALOGLIST.
- child isNull ifFalse: [
- string := OSWidget xmStringAt: XmNdirSpec handle: dialog.
- string := PlatformConverter wcsToMbcs: 0 buffer: string.
- xmString := OSXmString xmStringCreateLocalized: string asPSZ.
- child
- xmListSelectItem: xmString notify: false;
- xmListSetItem: xmString.
- xmString xmStringFree.
-
- "Bug in Solaris. For some reason, the horizontal scroll bar in the dialog
- list refuses to be displayed. This stops the dialog list from scrolling
- horizontally and displaying the file names. This does not happen on other
- Motif platforms. The fix is to force the horizontal scroll bar to be displayed
- by explicitly setting the scroll bar display policy."
- OSWidget resourceAt: XmNscrollBarDisplayPolicy put: XmSTATIC handle: child].
-*/
-
- /* Hook the callbacks. */
- Callback cancelCallback = new Callback (this, "cancelPressed", 3);
- int cancelAddress = cancelCallback.getAddress ();
- OS.XtAddCallback (dialog, OS.XmNcancelCallback, cancelAddress, 0);
- Callback okCallback = new Callback (this, "okPressed", 3);
- int okAddress = okCallback.getAddress ();
- OS.XtAddCallback (dialog, OS.XmNokCallback, okAddress, 0);
-
-/*
- shell == nil ifFalse: [
- shell minimized ifTrue: [shell minimized: false]].
-*/
- OS.XtManageChild (dialog);
-
-//BOGUS - should be a pure OS message loop (no SWT AppContext)
- while (OS.XtIsRealized (dialog) && OS.XtIsManaged (dialog))
- if (!appContext.readAndDispatch ()) appContext.sleep ();
-
- /* Destroy the dialog and update the display. */
- if (OS.XtIsRealized (dialog)) OS.XtDestroyWidget (dialog);
- if (destroyContext) appContext.dispose ();
- okCallback.dispose ();
- cancelCallback.dispose ();
-
-// (shell == nil or: [shell isDestroyed not]) ifTrue: [dialog xtDestroyWidget].
-// OSWidget updateDisplay.
-// entryPoint unbind.
-
- if (cancel) return null;
- return fullPath;
-}
-
-/**
- * Set the initial filename which the dialog will
- * select by default when opened to the argument,
- * which may be null. The name will be prefixed with
- * the filter path when one is supplied.
- *
- * @param string the file name
- */
-public void setFileName (String string) {
- fileName = string;
-}
-
-/**
- * Set the file extensions which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param extensions the file extension filter
- */
-public void setFilterExtensions (String [] extensions) {
- filterExtensions = extensions;
-}
-
-/**
- * Sets the file names which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param names the file name filter
- */
-public void setFilterNames (String [] names) {
- filterNames = names;
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the files it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontDialog.java
deleted file mode 100755
index cb3dc66572..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontDialog.java
+++ /dev/null
@@ -1,934 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import java.text.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * Instances of this class allow the user to select a font
- * from all available fonts in the system.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FontDialog extends Dialog {
- private static final String TEXT_SAMPLE = "AaBbYyZz";
- private static final String TEXT_FONT_NOT_LOADED = "Could not load selected font"; // text used in place of sample text when the selected font could not be loaded
- private static final String SCALABLE_SIZES[] = new String[] {"8", "10", "11", "12", "14", "16", "18", "22", "24", "26"};
- private static final int DEFAULT_SIZE = 14;
- private static final String DEFAULT_STYLE = FontExtStyles.MEDIUM;
-
- private Shell shell; // the dialog shell
- private Combo characterSet;
- private Combo faceName;
- private Combo fontSize;
- private Combo fontStyle;
- private Combo extendedStyle;
- private Label sampleLabel;
- private Button ok;
- private Button cancel;
-
- private boolean okSelected; // true if the dialog was hidden
- // because the ok button was selected
- private FontData dialogResult;
- private Hashtable characterSets = new Hashtable(); // maps character sets to a hashtable
- // that maps the fonts in that
- // character set to FontStyles objects
- private FontData initialSelection; // can be set by the programmer and
- private Font sampleFont; // the sample font for the font data selected by the user.
- // Used to correctly clean up allocated fonts
- // will be used to initialize the font
- // combo boxes when the dialog is opened
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog(Shell parent) {
- this(parent, SWT.NULL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog(Shell parent, int style) {
- super(parent, style | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
- checkSubclass ();
-}
-
-/**
- * Add the fonts found in 'fonts' to the list of fonts.
- * Fonts are stored by character set and face name. For each character
- * set/face name combination there is one FontExtStyles object that
- * captures the different extended styles and the sizes and styles
- * available for that extended style.
- */
-void addFonts(FontData fonts[]) {
- FontData font;
- String faceName;
- String characterSet;
- Hashtable characterSets = getFonts();
- Hashtable faceNames;
- FontExtStyles fontExtStyles;
-
- for (int i = 0; i < fonts.length; i++) {
- font = fonts[i];
- characterSet = getTranslatedCharSet(font);
- faceNames = (Hashtable) characterSets.get(characterSet);
- faceName = getTranslatedFaceName(font);
- if (faceNames == null) {
- faceNames = new Hashtable();
- characterSets.put(characterSet, faceNames);
- }
- fontExtStyles = (FontExtStyles) faceNames.get(faceName);
- if (fontExtStyles == null) {
- fontExtStyles = new FontExtStyles(font.getName()); // use original face name for FontExtStyles
- faceNames.put(faceName, fontExtStyles);
- }
- fontExtStyles.add(font);
- }
- setFonts(characterSets);
-}
-/**
- * Create the widgets of the dialog.
- */
-void createChildren() {
- Shell dialog = getDialogShell();
- Label characterSetLabel = new Label(dialog, SWT.NULL);
- Label faceNameLabel = new Label(dialog, SWT.NULL);
- Label extendedStyleLabel = new Label(dialog, SWT.NULL);
- Label fontSizeLabel;
- Label fontStyleLabel;
- Label fillLabel;
- Group sampleGroup;
- GridData gridData;
- GridLayout layout = new GridLayout();
- final int ColumnOneWidth = 200;
- final int ColumnTwoWidth = 150;
- final int ColumnThreeWidth = 100;
-
- layout.numColumns = 4;
- layout.marginWidth = 15;
- layout.marginHeight = 15;
- layout.horizontalSpacing = 10;
- layout.verticalSpacing = 2;
- dialog.setLayout(layout);
-
- // row one
- characterSetLabel.setText(SWT.getMessage("SWT_Character_set") + ":");
- faceNameLabel.setText(SWT.getMessage("SWT_Font") + ":");
- extendedStyleLabel.setText(SWT.getMessage("SWT_Extended_style") + ":");
-
- new Label(dialog, SWT.NULL);
-
- // row two
- characterSet = new Combo(dialog, SWT.SIMPLE | SWT.V_SCROLL);
- gridData = new GridData();
- gridData.widthHint = ColumnOneWidth;
- gridData.heightHint = 150;
- gridData.verticalSpan = 2;
- characterSet.setData(new Integer(-1));
- characterSet.setLayoutData(gridData);
-
- faceName = new Combo(dialog, SWT.SIMPLE | SWT.V_SCROLL);
- gridData = new GridData();
- gridData.widthHint = ColumnTwoWidth;
- gridData.heightHint = 150;
- gridData.verticalSpan = 2;
- gridData.verticalAlignment = GridData.FILL;
- faceName.setData(new Integer(-1));
- faceName.setLayoutData(gridData);
-
- extendedStyle = new Combo(dialog, SWT.SIMPLE | SWT.V_SCROLL);
- gridData = new GridData();
- gridData.widthHint = ColumnThreeWidth;
- gridData.heightHint = 150;
- gridData.verticalSpan = 2;
- gridData.verticalAlignment = GridData.FILL;
- extendedStyle.setData(new Integer(-1));
- extendedStyle.setLayoutData(gridData);
-
- // create ok and cancel buttons (row two and three)
- createOkCancel();
-
- // row four
- createEmptyRow();
-
- // row five
- fontSizeLabel = new Label(dialog, SWT.NULL);
- fontSizeLabel.setText(SWT.getMessage("SWT_Size") + ":");
- fontStyleLabel = new Label(dialog, SWT.NULL);
- fontStyleLabel.setText(SWT.getMessage("SWT_Style") + ":");
-
- fillLabel = new Label(dialog, SWT.NULL);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- fillLabel.setLayoutData(gridData);
-
- // row six
- fontSize = new Combo(dialog, SWT.SIMPLE | SWT.V_SCROLL);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.heightHint = 110;
- fontSize.setData(new Integer(-1));
- fontSize.setLayoutData(gridData);
-
- fontStyle = new Combo(dialog, SWT.SIMPLE | SWT.V_SCROLL);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- fontStyle.setData(new Integer(-1));
- fontStyle.setLayoutData(gridData);
-
- fillLabel = new Label(dialog, SWT.NULL);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- fillLabel.setLayoutData(gridData);
-
- // row seven
- createEmptyRow();
-
- // row eight
- sampleGroup = new Group(dialog, SWT.NULL);
- sampleGroup.setText(SWT.getMessage("SWT_Sample"));
- gridData = new GridData();
- gridData.heightHint = 70;
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- sampleGroup.setLayoutData(gridData);
-
- // setup group box with sample text
- layout = new GridLayout();
- layout.marginWidth = 10;
- layout.marginHeight = 10;
- sampleGroup.setLayout(layout);
-
- sampleLabel = new Label(sampleGroup, SWT.CENTER);
- sampleLabel.setText(TEXT_SAMPLE);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalAlignment = GridData.FILL;
- sampleLabel.setLayoutData(gridData);
-
- dialog.setSize(445, 410);
-}
-/**
- * Returns the combo used to display all available character sets.
- */
-Combo getCharacterSetCombo() {
- return characterSet;
-}
-/**
- * Returns the combo used to display all extended styles of
- * the selected font.
- */
-Combo getExtStyleCombo() {
- return extendedStyle;
-}
-/**
- * Returns the combo used to display the face names of the
- * fonts in the selected character set.
- */
-Combo getFaceNameCombo() {
- return faceName;
-}
-/**
- * Returns a FontData object describing the font that was
- * selected in the dialog, or null if none is available.
- *
- * @return the FontData for the selected font, or null
- */
-public FontData getFontData() {
- return dialogResult;
-}
-/**
- * Returns the collection of fonts that are displayed by the
- * receiver.
- * See the class definition for an explanation of the structure
- * of the returned Hashtable.
- */
-Hashtable getFonts() {
- return characterSets;
-}
-/**
- * Return the sample font created from the selected font metrics.
- * This font is set into the sampleLabel.
- */
-Font getSampleFont() {
- return sampleFont;
-}
-/**
- * Returns the label used to display a sample of the selected font.
- */
-Label getSampleLabel() {
- return sampleLabel;
-}
-/**
- * Returns the selected character set in the format used to load
- * fonts.
- */
-String getSelectedCharSet() {
- String translatedCharSet = getCharacterSetCombo().getText();
- String platformCharSet;
- int characterSetIndex = translatedCharSet.indexOf("(");
-
- if (characterSetIndex == -1) {
- platformCharSet = translatedCharSet;
- }
- else {
- platformCharSet = translatedCharSet.substring(
- characterSetIndex + 1, translatedCharSet.length()-1);
- }
- return platformCharSet;
-}
-/**
- * Returns the selected face name in the format used to load
- * fonts.
- */
-String getSelectedFaceName() {
- String translatedFaceName = getFaceNameCombo().getText();
- String platformFaceName;
- int foundryIndex = translatedFaceName.indexOf("(");
-
- if (foundryIndex == -1) { // if this is true, the face name is not selected from the list
- platformFaceName = translatedFaceName;
- }
- else {
- platformFaceName = translatedFaceName.substring(
- 0, translatedFaceName.indexOf(" ("));
- }
- return platformFaceName;
-}
-/**
- * Returns the selected font foundry in the format used to load
- * fonts.
- */
-String getSelectedFoundry() {
- String translatedFaceName = getFaceNameCombo().getText();
- String foundry = new String();
- int foundryIndex = translatedFaceName.indexOf("(");
-
- if (foundryIndex != -1) {
- foundry = translatedFaceName.substring(
- foundryIndex + 1, translatedFaceName.length()-1);
- }
- return foundry;
-}
-/**
- * Returns a FontData object that can be used to load the selected
- * font.
- */
-FontData getSelectionFontData() {
- String fontSize = getSizeCombo().getText();
- String style = getStyleCombo().getText();
- String extStyle = getExtStyleCombo().getText();
- int styleBits = SWT.NULL;
- Integer fontSizeInt = null;
- FontData fontData;
-
- if (style.indexOf(FontExtStyles.BOLD) != -1) {
- styleBits |= SWT.BOLD;
- }
- if (style.indexOf(FontExtStyles.ITALIC) != -1) {
- styleBits |= SWT.ITALIC;
- }
- try {
- fontSizeInt = Integer.valueOf(fontSize);
- }
- catch (NumberFormatException exception) {}
- if (fontSizeInt != null) {
- fontData = new FontData(
- getSelectedFaceName(),
- fontSizeInt.intValue(),
- styleBits);
- }
- else {
- fontData = new FontData();
- fontData.setName(getSelectedFaceName());
- fontData.setStyle(styleBits);
- }
- if (extStyle.length() > 0) {
- fontData.addStyle = extStyle;
- }
- fontData.characterSetRegistry = getSelectedCharSet();
- fontData.foundry = getSelectedFoundry();
- return fontData;
-}
-/**
- * Returns the combo box used to display the available sizes of
- * the selected font.
- */
-Combo getSizeCombo() {
- return fontSize;
-}
-/**
- * Returns the combo box used to display the available styles of
- * the selected font.
- */
-Combo getStyleCombo() {
- return fontStyle;
-}
-/**
- * Returns the character set found in 'fontData' prefixed
- * with a string explaining the character set.
- */
-String getTranslatedCharSet(FontData fontData) {
- String characterSet = fontData.characterSetRegistry;
- String translatedCharSet = null;
-
- if (characterSet.startsWith("iso8859") == true) {
- translatedCharSet = "Western";
- }
- else
- if (characterSet.startsWith("iso646") == true) {
- translatedCharSet = "ASCII";
- }
- else
- if (characterSet.startsWith("ucs") == true) {
- translatedCharSet = "Unicode";
- }
- else
- if (characterSet.startsWith("jis") == true) {
- translatedCharSet = "Japanese";
- }
- else
- if (characterSet.startsWith("gb") == true) {
- translatedCharSet = "Simplified Chinese";
- }
- else
- if (characterSet.startsWith("cns") == true) {
- translatedCharSet = "Traditional Chinese";
- }
- else
- if (characterSet.startsWith("ks") == true) {
- translatedCharSet = "Korean";
- }
- if (translatedCharSet != null) {
- translatedCharSet += " (" + characterSet + ')';
- }
- else {
- translatedCharSet = characterSet;
- }
- return translatedCharSet;
-}
-/**
- * Returns the face name as specified in FontData.familyName followed by
- * the foundry set in parantheses if available.
- * We display the face name first so that the list box sorts the fonts by
- * face name, not by foundry. Users generally want to select fonts based
- * on the face name and not by foundry. Once they've found the desired
- * face name in the list they can compare the font variations from
- * different foundries if available.
- */
-String getTranslatedFaceName(FontData fontData) {
- StringBuffer faceNameBuffer;
-
- if (fontData.foundry != null && fontData.foundry.length() > 0) {
- faceNameBuffer = new StringBuffer(fontData.fontFamily);
- faceNameBuffer.append(" (");
- faceNameBuffer.append(fontData.foundry);
- faceNameBuffer.append(')');
- }
- else {
- faceNameBuffer = new StringBuffer(fontData.getName());
- }
- return faceNameBuffer.toString();
-}
-/**
- * Handle the events the receiver is listening to.
- * Combo selections cause the downstream combos to be initialized
- * with font data and the sample text to be updated.
- */
-void handleEvents(Event event) {
- int oldSelectionIndex;
- int newSelectionIndex;
-
- if (event.widget instanceof Combo) {
- oldSelectionIndex = ((Integer) event.widget.getData()).intValue();
- newSelectionIndex = ((Combo) event.widget).getSelectionIndex();
- // work around broken getSelectionIndex
- newSelectionIndex = ((Combo) event.widget).indexOf(((Combo) event.widget).getText());
- event.widget.setData(new Integer(newSelectionIndex));
- if (newSelectionIndex != oldSelectionIndex) {
- if (event.widget == getCharacterSetCombo()) {
- initFaceNameCombo();
- }
- else
- if (event.widget == getFaceNameCombo()) {
- initExtStyleCombo();
- }
- else
- if (event.widget == getExtStyleCombo()) {
- initFontDataCombos();
- }
- }
- updateSample();
- }
- else
- if (event.widget == getOKButton()) {
- setOkSelected(true);
- getDialogShell().setVisible(false);
- }
- else
- if (event.widget == getCancelButton()) {
- setOkSelected(false);
- getDialogShell().setVisible(false);
- }
-}
-/**
- * Initialize the extended styles combo with the extended styles
- * available for the selected font.
- * Downstream combos are initialized as well (style and size).
- */
-void initExtStyleCombo() {
- String characterSet = getCharacterSetCombo().getText();
- String faceName = getFaceNameCombo().getText();
- Hashtable faceNames = (Hashtable) getFonts().get(characterSet);
- FontExtStyles fontExtStyles = (FontExtStyles) faceNames.get(faceName);
- Combo extStyleCombo = getExtStyleCombo();
-
- setItemsSorted(extStyleCombo, fontExtStyles.getExtStyles());
- extStyleCombo.select(0);
- initFontDataCombos();
-}
-/**
- * Initialize the face name combo box with all font names
- * available in the selected character set.
- * Downstream combos are initialized as well (extended style).
- */
-void initFaceNameCombo() {
- Hashtable faceNames = (Hashtable) getFonts().get(getCharacterSetCombo().getText());
- Combo faceNameCombo = getFaceNameCombo();
-
- faceNameCombo.removeAll();
- setItemsSorted(faceNameCombo, faceNames);
-// faceNameCombo.select(0);
-// initExtStyleCombo();
-}
-/**
- * Initialize the styles and size combos with the styles and sizes
- * the selected font is available in.
- */
-void initFontDataCombos() {
- String characterSet = getCharacterSetCombo().getText();
- String faceName = getFaceNameCombo().getText();
- Hashtable faceNames = (Hashtable) getFonts().get(characterSet);
- FontExtStyles fontStyles = (FontExtStyles) faceNames.get(faceName);
-
- initSizeCombo(fontStyles);
- initStyleCombo(fontStyles);
-}
-/**
- * Initialize the size combo with the sizes the selected font
- * is available in.
- * If the selected font is scalable a selection of preset sizes
- * is used.
- */
-void initSizeCombo(FontExtStyles fontExtStyles) {
- Combo sizeCombo = getSizeCombo();
- String previousSize = sizeCombo.getText();
- sizeCombo.removeAll();
-
- int selectionIndex = -1;
-
- if (fontExtStyles.isScalable()) {
- sizeCombo.setItems(SCALABLE_SIZES);
- selectionIndex = sizeCombo.indexOf(String.valueOf(DEFAULT_SIZE));
- }
- else {
- Vector sizes = fontExtStyles.getSizes(getExtStyleCombo().getText());
- for (int i = 0; i < sizes.size(); i++) {
- Integer size = (Integer) sizes.elementAt(i);
- sizeCombo.add(size.toString());
- // select the largest height if there's no font
- // size that is at least as high as SelectionSize
- if (size.intValue() >= DEFAULT_SIZE && selectionIndex == -1)
- selectionIndex = i;
- }
- }
-
- int indexOfPreviousSelection = sizeCombo.indexOf(previousSize);
- if (indexOfPreviousSelection != -1)
- selectionIndex = indexOfPreviousSelection;
-
- if (selectionIndex == -1) // last resort case, should not happen
- selectionIndex = sizeCombo.getItemCount() - 1;
-
- sizeCombo.select(selectionIndex);
-}
-/**
- * Initialize the styles combo with the styles the selected font
- * is available in.
- */
-void initStyleCombo(FontExtStyles fontExtStyles) {
- Combo styleCombo = getStyleCombo();
- String previousStyle = styleCombo.getText();
- styleCombo.removeAll();
-
- Enumeration styleEnum = fontExtStyles.getStyles(getExtStyleCombo().getText()).elements();
- while (styleEnum.hasMoreElements())
- styleCombo.add((String)styleEnum.nextElement());
-
- int selectionIndex = styleCombo.indexOf(previousStyle);
- if (selectionIndex == -1)
- selectionIndex = styleCombo.indexOf(DEFAULT_STYLE);
- if (selectionIndex == -1) // last resort
- selectionIndex = 0;
-
- styleCombo.select(selectionIndex);
-}
-
-/**
- * Initialize the widgets of the receiver with the data of
- * all installed fonts.
- * If the user specified a default font preselect that font in
- * the combo boxes.
- */
-void initializeWidgets() {
- Combo characterSetCombo = getCharacterSetCombo();
- Display display = getDialogShell().getDisplay();
- FontData initialFontData = getFontData();
- Font initialFont;
-
- addFonts(display.getFontList(null, false)); // get all fonts availabe on the current display
- addFonts(display.getFontList(null, true));
- setItemsSorted(characterSetCombo, getFonts());
-
- if (initialFontData != null) {
- initialFont = new Font(display, initialFontData); // verify that the initial font data is a valid font
- setFontCombos(initialFont.getFontData()[0]);
- initialFont.dispose();
- updateSample();
- }
-}
-/**
- * Register the receiver to receive events.
- */
-void installListeners() {
- Listener listener = new Listener() {
- public void handleEvent(Event event) {handleEvents(event);}
- };
-
- getOKButton().addListener(SWT.Selection, listener);
- getCancelButton().addListener(SWT.Selection, listener);
- getCharacterSetCombo().addListener(SWT.Selection, listener);
- getFaceNameCombo().addListener(SWT.Selection, listener);
- getSizeCombo().addListener(SWT.Selection, listener);
- getStyleCombo().addListener(SWT.Selection, listener);
- getExtStyleCombo().addListener(SWT.Selection, listener);
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a FontData object describing the font that was selected,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public FontData open() {
- FontData dialogResult = null;
- Font sampleFont;
- Shell dialog = new Shell(getParent(), getStyle() | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
-
- setDialogShell(dialog);
- createChildren();
- installListeners();
- openModal();
- if (isOkSelected() == true) {
- dialogResult = getSelectionFontData();
- setFontData(dialogResult);
- }
- // Fix for 1FRTJZV
- sampleFont = getSampleFont();
- if (sampleFont != null) {
- sampleFont.dispose();
- }
- // Fix for 1G5NLY7
- if (dialog.isDisposed() == false) {
- dialog.dispose();
- }
- return dialogResult;
-}
-/**
- * Initialize the combo boxes with the data of the preselected
- * font specified by the user.
- */
-void setFontCombos(FontData fontData) {
- String characterSet = getTranslatedCharSet(fontData);
- String faceName = getTranslatedFaceName(fontData);
- Hashtable faceNames = (Hashtable) getFonts().get(characterSet);
- FontExtStyles fontStyles = (FontExtStyles) faceNames.get(faceName);
- String value;
-
- getCharacterSetCombo().setText(characterSet);
- initFaceNameCombo();
-
- getFaceNameCombo().setText(faceName);
- initExtStyleCombo();
-
- getExtStyleCombo().setText(fontData.addStyle);
- initSizeCombo(fontStyles);
-
- value = Integer.toString(fontData.getHeight());
- getSizeCombo().setText(value);
- initStyleCombo(fontStyles);
-
- value = FontExtStyles.getStyleString(fontData.getStyle());
- getStyleCombo().setText(value);
-}
-/**
- * Sets a FontData object describing the font to be
- * selected by default in the dialog, or null to let
- * the platform choose one.
- *
- * @param fontData the FontData to use initially, or null
- */
-public void setFontData(FontData fontData) {
- dialogResult = fontData;
-}
-/**
- * Set the fonts that are displayed by the receiver to 'fonts'.
- */
-void setFonts(Hashtable fonts) {
- characterSets = fonts;
-}
-/**
- * Set the contents of 'combo' to the keys of 'items'.
- * Keys are sorted in ascending order first and have to be Strings.
- */
-void setItemsSorted(Combo combo, Hashtable items) {
- Enumeration itemKeys = items.keys();
- String item;
- String sortedItems[] = new String[items.size()];
- int index = 0;
-
- while (itemKeys.hasMoreElements() == true) {
- sortedItems[index++] = (String) itemKeys.nextElement();
- }
- sort(sortedItems);
- combo.setItems(sortedItems);
-}
-/**
- * Set the sample font created from the selected font metrics
- * to 'newSampleFont'.
- * This font is set into the sampleLabel.
- */
-void setSampleFont(Font newSampleFont) {
- // only dispose fonts we created. See 1FRTK1M for details.
- if (sampleFont != null) {
- sampleFont.dispose();
- }
- sampleFont = newSampleFont;
- getSampleLabel().setFont(sampleFont);
-}
-/**
- * Sort 'items' in ascending order.
- */
-void sort(String items[]) {
- Collator collator = Collator.getInstance();
-
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap = length/2; gap > 0; gap /= 2) {
- for (int i = gap; i < length; i++) {
- for (int j = i-gap; j >= 0; j -= gap) {
- if (collator.compare(items[j], items[j+gap]) > 0) {
- String swap = items[j];
- items[j] = items[j+gap];
- items[j+gap] = swap;
- }
- }
- }
- }
-}
-/**
- * Set the font of the sample text to the selected font.
- * Display an error in place of the sample text if the selected
- * font could not be loaded.
- */
-void updateSample() {
- Display display = getDialogShell().getDisplay();
- FontData selectionFontData = getSelectionFontData();
- Font sampleFont;
-
- // sampleFont may not be the same as the one specified in selectionFontData.
- // This happens when selectionFontData specifies a font alias. In that case,
- // Font loads the real font. See 1FG3UWX for details.
- sampleFont = new Font(display, selectionFontData);
- setSampleFont(sampleFont);
-}
-/**
- * Fill one row in the grid layout with empty widgets.
- * Used to achieve a bigger vertical spacing between separate
- * groups of widgets (ie. new rows of Text/Combo combinations).
- */
-void createEmptyRow() {
- Shell dialog = getDialogShell();
- Label fillLabel = new Label(dialog, SWT.NULL);
- GridData gridData = new GridData();
-
- gridData.heightHint = 5;
- gridData.horizontalSpan = ((GridLayout) dialog.getLayout()).numColumns;
- fillLabel.setLayoutData(gridData);
-}
-/**
- * Create the widgets of the dialog.
- */
-void createOkCancel() {
- Shell dialog = getDialogShell();
- GridData gridData;
-
- ok = new Button(dialog, SWT.PUSH);
- ok.setText(SWT.getMessage("SWT_OK"));
- dialog.setDefaultButton(ok);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.widthHint = 70;
- ok.setLayoutData(gridData);
-
- cancel = new Button(dialog, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel"));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- cancel.setLayoutData(gridData);
-}
-/**
- * Returns the cancel button
- */
-Button getCancelButton() {
- return cancel;
-}
-
-/**
- * Returns the dialog shell.
- */
-Shell getDialogShell() {
- return shell;
-}
-/**
- * Returns the ok button.
- */
-Button getOKButton() {
- return ok;
-}
-
-boolean isOkSelected() {
- return okSelected;
-}
-/**
- * Open the receiver and set its size to the size calculated by
- * the layout manager.
- */
-void openDialog() {
- Shell dialog = getDialogShell();
- Point pt;
- Rectangle displayRect;
- int widthLimit;
-
- // Start everything off by setting the shell size to its computed size.
- pt = dialog.computeSize(-1, -1, false);
-
- // Ensure that the width of the shell fits the display.
- displayRect = dialog.getDisplay().getBounds();
- widthLimit = displayRect.width * 7 / 8;
- if (pt.x > widthLimit) {
- pt = dialog.computeSize (widthLimit, -1, false);
- }
- dialog.setBounds (0, 0, pt.x, pt.y);
- dialog.setText(getText());
- // Open the window.
- dialog.open();
-}
-/**
- * Initialize the widgets of the receiver, open the dialog
- * and block the method until the dialog is closed by the user.
- */
-void openModal() {
- Shell dialog = getDialogShell();
- Display display = dialog.getDisplay();
-
- initializeWidgets();
- setFontData(null);
- openDialog();
- while (dialog.isDisposed() == false && dialog.getVisible() == true) {
- if (display.readAndDispatch() == false) {
- display.sleep();
- }
- }
-}
-/**
- * Set whether the dialog was closed by selecting the ok button.
- */
-void setOkSelected(boolean newOkSelected) {
- okSelected = newOkSelected;
-}
-/**
- * Set the shell used as the dialog window.
- */
-void setDialogShell(Shell shell) {
- this.shell = shell;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyle.java
deleted file mode 100755
index 6b32686a4a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyle.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Vector;
-
-/**
- * This class stores the sizes and styles for a font extended style.
- * A font on X can have different styles and sizes depending on the
- * extended style of a font.
- */
-class FontExtStyle {
- private Vector sizes;
- private Vector styles;
-/**
- * Create a new instance of the receiver
- */
-FontExtStyle() {
- sizes = new Vector();
- styles = new Vector();
-}
-/**
- * Add size to the existing sizes of the receiver.
- * Insert in ascending sort order.
- */
-void addSize(int size) {
- Vector sizes = getSizes();
- Integer sizeInteger;
- Integer newSizeInteger = new Integer(size);
-
- if (sizes.contains(newSizeInteger) == false) {
- for (int i = 0; i < sizes.size(); i++) {
- sizeInteger = (Integer) sizes.elementAt(i);
- if (sizeInteger.intValue() > size) {
- sizes.insertElementAt(newSizeInteger, i);
- return;
- }
- }
- sizes.addElement(newSizeInteger);
- }
-}
-/**
- * Add the 'style' to the list of styles.
- * Styles are sorted in the order "medium", "medium italic", "bold",
- * "bold italic"
- * @param style - the font style. Can be "medium", "medium italic",
- * "bold", "bold italic"
- */
-void addStyle(String style) {
- Vector styles = getStyles();
- String existingStyle;
-
- if (styles.contains(style) == true) {
- return;
- }
- // "medium" always goes to top of list
- if (style.equals(FontExtStyles.MEDIUM) == true) {
- styles.insertElementAt(style, 0);
- }
- else {
- // order is: "medium" "medium italic" "bold" "bold italic"
- for (int i = 0; i < styles.size(); i++) {
- existingStyle = (String) styles.elementAt(i);
- if (existingStyle.startsWith(FontExtStyles.BOLD) == true &&
- (style.startsWith(FontExtStyles.MEDIUM) == true ||
- style.equals(FontExtStyles.BOLD) == true)) {
- styles.insertElementAt(style, i);
- return;
- }
- }
- styles.addElement(style);
- }
-}
-/**
- * Answer the sizes that are available for the existing font.
- * Vector is empty if the font is scalable.
- */
-Vector getSizes() {
- return sizes;
-}
-/**
- * Answer the styles that are available for this extended style.
- */
-Vector getStyles() {
- return styles;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyles.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyles.java
deleted file mode 100755
index 0314f9bb21..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyles.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This class stores the extended styles that are available for a
- * font as well as the sizes and styles that are available for each
- * extended styles.
- */
-class FontExtStyles {
- final static String MEDIUM = "medium";
- final static String BOLD = "bold";
- final static String ITALIC = "italic";
-
- private String faceName;
- private boolean isScalable = false;
- private Hashtable extStyles = new Hashtable(); // keys are extended styles,
- // values a Vector with the
- // corresponding sizes or null
- // if the font is scalable
-/**
- * Create a new instance of the receiver for the font with the
- * name 'faceName'.
- */
-FontExtStyles(String faceName) {
- this.faceName = faceName;
-}
-/**
- * Add the extended style, style and size data of 'fontData'
- * to the receiver.
- * The face name in 'fontData' has to match the face name of
- * the receiver.
- */
-void add(FontData fontData) {
- Hashtable extStyles = getExtStyles();
- FontExtStyle extStyle;
- Integer height;
- String style;
-
- if (fontData.getName().equals(getFaceName()) == false) {
- return;
- }
- extStyle = (FontExtStyle) extStyles.get(fontData.addStyle);
- if (extStyle == null) {
- extStyle = new FontExtStyle();
- extStyles.put(fontData.addStyle, extStyle);
- }
- if (fontData.getHeight() == 0) {
- setScalable(true);
- }
- else { // add the font size if the font is not scalable
- extStyle.addSize(fontData.getHeight());
- }
- // add the style
- style = getStyleString(fontData.getStyle());
- extStyle.addStyle(style);
-}
-/**
- * Answer the extended styles stored by the receiver.
- * See the class definition for an explanation of the returned
- * data structure.
- */
-Hashtable getExtStyles() {
- return extStyles;
-}
-/**
- * Answer the face name of the receiver.
- * The extended styles are stored for this face name.
- */
-String getFaceName() {
- return faceName;
-}
-/**
- * Answer the font sizes of the receiver for the extended style
- * identified by 'extStyle'.
- * @return the font sizes of the receiver for the extended style
- * identified by 'extStyle'.
- * Empty collection if isScalable() answers true.
- */
-Vector getSizes(String extStyle) {
- return ((FontExtStyle) getExtStyles().get(extStyle)).getSizes();
-}
-/**
- * Answer the string displayed for 'style'
- * @param style - the font style. Can be SWT.BOLD, SWT.ITALIC
- * or both combined with logical OR.
- */
-static String getStyleString(int style) {
- String styleString;
-
- if ((style & SWT.BOLD) != 0) {
- styleString = BOLD;
- }
- else {
- styleString = MEDIUM;
- }
- if ((style & SWT.ITALIC) != 0) {
- styleString += ' ' + ITALIC;
- }
- return styleString;
-}
-/**
- * Answer the font styles of the receiver for the extended style
- * identified by 'extStyle'.
- */
-Vector getStyles(String extStyle) {
- return ((FontExtStyle) getExtStyles().get(extStyle)).getStyles();
-}
-/**
- * Answer whether the receiver is scalable or not.
- * @return true=receiver is scalable. false=receiver is not
- * scalable. It stores all available font sizes.
- */
-boolean isScalable() {
- return isScalable;
-}
-/**
- * Set whether the receiveris scalable..
- * @param newIsScalable - true=receiver is scalable.
- * false=receiver is not scalable. It stores all available font sizes.
- */
-void setScalable(boolean newIsScalable) {
- isScalable = newIsScalable;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java
deleted file mode 100755
index 7550594d83..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class provide an etched border
- * with an optional title.
- * <p>
- * Shadow styles are hints and may not be honoured
- * by the platform. To create a group with the
- * default shadow style for the platform, do not
- * specify a shadow style.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Group extends Composite {
- int labelHandle;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Group (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- style |= SWT.NO_FOCUS;
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- int trimX, trimY, trimWidth, trimHeight;
- int [] argList = {
- OS.XmNwidth, 0,
- OS.XmNheight, 0,
- OS.XmNshadowThickness, 0,
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int thickness = argList [5];
- int marginWidth = argList [7];
- int marginHeight = argList [9];
- int borderWidth = getBorderWidth ();
- trimX = x - marginWidth + thickness - borderWidth;
- trimY = y - marginHeight + thickness - borderWidth;
- trimWidth = width + ((marginWidth + thickness + borderWidth) * 2);
- trimHeight = height + ((marginHeight + thickness + borderWidth) * 2);
- if (OS.XtIsManaged (labelHandle)) {
- int [] argList2 = {OS.XmNy, 0, OS.XmNheight, 0};
- OS.XtGetValues (labelHandle, argList2, argList2.length / 2);
- int labelHeight = ((short) argList2 [1]) + argList2 [3];
- trimY = y - labelHeight;
- trimHeight = height + labelHeight + (marginHeight + thickness);
- }
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-void createHandle (int index) {
- state |= HANDLE;
-
- /*
- * Feature in Motif. When a widget is managed or unmanaged,
- * it may request and be granted, a new size in the OS. This
- * behavior is unwanted. The fix is to create a parent for
- * the list that will disallow geometry requests.
- */
- int border = (style & SWT.BORDER) != 0 ? 1 : 0;
- int [] argList1 = {
- OS.XmNancestorSensitive, 1,
- OS.XmNborderWidth, border,
- };
- int parentHandle = parent.handle;
- formHandle = OS.XmCreateForm (parentHandle, null, argList1, argList1.length / 2);
- if (formHandle == 0) error (SWT.ERROR_NO_HANDLES);
- int [] argList2 = {
- OS.XmNshadowType, shadowType (),
- OS.XmNtopAttachment, OS.XmATTACH_FORM,
- OS.XmNbottomAttachment, OS.XmATTACH_FORM,
- OS.XmNleftAttachment, OS.XmATTACH_FORM,
- OS.XmNrightAttachment, OS.XmATTACH_FORM,
- OS.XmNresizable, 0,
- };
- handle = OS.XmCreateFrame (formHandle, null, argList2, argList2.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- int [] argList3 = {OS.XmNchildType, OS.XmFRAME_TITLE_CHILD};
- labelHandle = OS.XmCreateLabel (handle, null, argList3, argList3.length / 2);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void createWidget (int index) {
- super.createWidget (index);
- /*
- * Bug in Motif. For some reason, if a form has not been realized,
- * calling XtResizeWidget () on the form does not lay out properly.
- * The fix is to force the widget to be realized by forcing the shell
- * to be realized.
- */
- getShell ().realizeWidget ();
-}
-void enableWidget (boolean enabled) {
- super.enableWidget (enabled);
- enableHandle (enabled, labelHandle);
-}
-int fontHandle () {
- return labelHandle;
-}
-public Rectangle getClientArea () {
- checkWidget();
- int [] argList = {
- OS.XmNwidth, 0,
- OS.XmNheight, 0,
- OS.XmNshadowThickness, 0,
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int thickness = argList [5];
- int marginWidth = argList [7];
- int marginHeight = argList [9];
- int x = marginWidth + thickness;
- int y = marginHeight + thickness;
- int width = argList [1] - ((marginWidth + thickness) * 2) - 1;
- int height = argList [3] - ((marginHeight + thickness) * 2) - 1;
- if (OS.XtIsManaged (labelHandle)) {
- int [] argList2 = {OS.XmNy, 0, OS.XmNheight, 0};
- OS.XtGetValues (labelHandle, argList2, argList2.length / 2);
- y = ((short) argList2 [1]) + argList2 [3];
- height = argList [3] - y - (marginHeight + thickness) - 1;
- }
- return new Rectangle (x, y, width, height);
-}
-/**
- * Returns the receiver's text, which is the string that the
- * is used as the <em>title</em>. If the text has not previously
- * been set, returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- int [] argList = {OS.XmNlabelString, 0};
- OS.XtGetValues (labelHandle, argList, 1);
- int xmString = argList [1];
- int address = OS.XmStringUnparse (
- xmString,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) return "";
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- OS.XmStringFree (xmString);
- return new String (Converter.mbcsToWcs (getCodePage (), buffer));
-}
-boolean mnemonicHit (char key) {
- return setFocus ();
-}
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- propagateHandle (enabled, labelHandle);
-}
-void redrawWidget (int x, int y, int width, int height, boolean all) {
- super.redrawWidget (x, y, width, height, all);
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (handle, (short) x, (short) y, root_x, root_y);
- short [] label_x = new short [1], label_y = new short [1];
- OS.XtTranslateCoords (labelHandle, (short) 0, (short) 0, label_x, label_y);
- redrawHandle (root_x [0] - label_x [0], root_y [0] - label_y [0], width, height, labelHandle);
-}
-void releaseHandle () {
- super.releaseHandle ();
- labelHandle = 0;
-}
-/**
- * Sets the receiver's text, which is the string that will
- * be displayed as the receiver's <em>title</em>, to the argument,
- * which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringParseText (
- buffer,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- int [] argList = {OS.XmNlabelString, xmString};
- OS.XtSetValues (labelHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString);
- if (string.length () == 0) {
- OS.XtUnmanageChild (labelHandle);
- } else {
- OS.XtManageChild (labelHandle);
- }
-}
-int shadowType () {
- if ((style & SWT.SHADOW_IN) != 0) return OS.XmSHADOW_IN;
- if ((style & SWT.SHADOW_OUT) != 0) return OS.XmSHADOW_OUT;
- if ((style & SWT.SHADOW_ETCHED_IN) != 0) return OS.XmSHADOW_ETCHED_IN;
- if ((style & SWT.SHADOW_ETCHED_OUT) != 0) return OS.XmSHADOW_ETCHED_OUT;
- return OS.XmSHADOW_ETCHED_IN;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java
deleted file mode 100755
index cb4bae0fd4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java
+++ /dev/null
@@ -1,453 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a non-selectable
- * user interface object that displays a string or image.
- * When SEPARATOR is specified, displays a single
- * vertical or horizontal line.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
- * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Label extends Control {
- String text = "";
- Image image, bitmap, disabled;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Label (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- if ((style & SWT.SEPARATOR) != 0) return style;
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.SEPARATOR) != 0) {
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
- }
- int [] argList = {OS.XmNlabelType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int labelType = argList [1];
- if (labelType == OS.XmSTRING && (style & SWT.WRAP) != 0 && wHint != SWT.DEFAULT) {
- /* If we are wrapping text, calculate the height based on wHint. */
- int [] argList4 = {
- OS.XmNmarginTop, 0, /* 1 */
- OS.XmNmarginBottom, 0, /* 3 */
- OS.XmNmarginHeight, 0, /* 5 */
- OS.XmNmarginWidth, 0, /* 7 */
- };
- OS.XtGetValues (handle, argList4, argList4.length / 2);
- int unavailable = 2 * (argList4 [7] + getBorderWidth());
- Display display = getDisplay ();
- String string = display.wrapText (text, fontList, wHint - unavailable);
- GC gc = new GC(this);
- Point extent = gc.textExtent(string);
- gc.dispose();
- height = extent.y + argList4 [1] + argList4 [3] + argList4 [5] * 2 + border * 2;
- } else {
- /* If we are not wrapping, ask the widget for its geometry. */
- XtWidgetGeometry result = new XtWidgetGeometry ();
- result.request_mode = OS.CWWidth | OS.CWHeight;
- int [] argList2 = {OS.XmNrecomputeSize, 1};
- OS.XtSetValues(handle, argList2, argList2.length / 2);
- OS.XtQueryGeometry (handle, null, result);
- int [] argList3 = {OS.XmNrecomputeSize, 0};
- OS.XtSetValues(handle, argList3, argList3.length / 2);
- width += result.width;
- height += result.height;
- }
-
- /**
- * Feature in Motif. If a label's labelType is XmSTRING but it
- * has no label set into it yet, recomputing the size will
- * not take into account the height of the font, as we would
- * like it to. Take care of this case.
- */
- if (labelType == OS.XmSTRING && text.length () == 0) {
- height += getFontHeight ();
- width = 0;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int parentHandle = parent.handle;
- int borderWidth = (style & SWT.BORDER) != 0 ? 1 : 0;
- if ((style & SWT.SEPARATOR) != 0) {
- int separatorType = separatorType ();
- int orientation = (style & SWT.HORIZONTAL) != 0 ? OS.XmHORIZONTAL : OS.XmVERTICAL;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNborderWidth, borderWidth,
- OS.XmNorientation, orientation,
- OS.XmNseparatorType, separatorType,
- };
- handle = OS.XmCreateSeparator (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- int alignment = OS.XmALIGNMENT_BEGINNING;
- if ((style & SWT.CENTER) != 0) alignment = OS.XmALIGNMENT_CENTER;
- if ((style & SWT.RIGHT) != 0) alignment = OS.XmALIGNMENT_END;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNrecomputeSize, 0,
- OS.XmNalignment, alignment,
- OS.XmNborderWidth, borderWidth,
- };
- handle = OS.XmCreateLabel (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-int defaultBackground () {
- return getDisplay ().labelBackground;
-}
-int defaultFont () {
- return getDisplay ().labelFont;
-}
-int defaultForeground () {
- return getDisplay ().labelForeground;
-}
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return SWT.LEFT;
- int [] argList = {OS.XmNalignment, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int alignment = argList [1];
- if (alignment == OS.XmALIGNMENT_BEGINNING) return SWT.LEFT;
- if (alignment == OS.XmALIGNMENT_CENTER) return SWT.CENTER;
- if (alignment == OS.XmALIGNMENT_END)return SWT.RIGHT;
- return SWT.LEFT;
-}
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-String getNameText () {
- return getText ();
-}
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return "";
- return text;
-}
-boolean mnemonicHit (char key) {
- Composite control = this.parent;
- while (control != null) {
- Control [] children = control._getChildren ();
- int index = 0;
- while (index < children.length) {
- if (children [index] == this) break;
- index++;
- }
- index++;
- if (index < children.length) {
- if (children [index].setFocus ()) return true;
- }
- control = control.parent;
- }
- return false;
-}
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- /*
- * Labels never participate in focus traversal when
- * either enabled or disabled.
- */
- if (enabled) {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-void releaseWidget () {
- super.releaseWidget ();
- int [] argList = {
- OS.XmNlabelPixmap, OS.XmUNSPECIFIED_PIXMAP,
- OS.XmNlabelInsensitivePixmap, OS.XmUNSPECIFIED_PIXMAP,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (bitmap != null) bitmap.dispose ();
- if (disabled != null) disabled.dispose ();
- image = bitmap = disabled = null;
-}
-int separatorType () {
- if ((style & (SWT.SHADOW_IN)) != 0) return OS.XmSHADOW_ETCHED_IN;
- if ((style & (SWT.SHADOW_OUT)) != 0) return OS.XmSHADOW_ETCHED_OUT;
- return OS.XmSHADOW_ETCHED_IN;
-}
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- int [] argList = {OS.XmNalignment, OS.XmALIGNMENT_BEGINNING};
- if ((alignment & SWT.CENTER) != 0) argList [1] = OS.XmALIGNMENT_CENTER;
- if ((alignment & SWT.RIGHT) != 0) argList [1] = OS.XmALIGNMENT_END;
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-void setBackgroundPixel (int pixel) {
- super.setBackgroundPixel (pixel);
- int [] argList = {OS.XmNlabelType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == OS.XmPIXMAP) setBitmap (image);
-}
-void setBitmap (Image image) {
- int labelPixmap = OS.XmUNSPECIFIED_PIXMAP;
- int labelInsensitivePixmap = OS.XmUNSPECIFIED_PIXMAP;
- if (bitmap != null) bitmap.dispose ();
- if (disabled != null) disabled.dispose ();
- bitmap = disabled = null;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- Display display = getDisplay ();
- switch (image.type) {
- case SWT.BITMAP:
- labelPixmap = image.pixmap;
- disabled = new Image (display, image, SWT.IMAGE_DISABLE);
- labelInsensitivePixmap = disabled.pixmap;
- break;
- case SWT.ICON:
- Rectangle rect = image.getBounds ();
- bitmap = new Image (display, rect.width, rect.height);
- GC gc = new GC (bitmap);
- gc.setBackground (getBackground ());
- gc.fillRectangle (rect);
- gc.drawImage (image, 0, 0);
- gc.dispose ();
- labelPixmap = bitmap.pixmap;
- disabled = new Image (display, bitmap, SWT.IMAGE_DISABLE);
- labelInsensitivePixmap = disabled.pixmap;
- break;
- default:
- error (SWT.ERROR_NOT_IMPLEMENTED);
- }
- }
- int [] argList = {
- OS.XmNlabelType, OS.XmPIXMAP,
- OS.XmNlabelPixmap, labelPixmap,
- OS.XmNlabelInsensitivePixmap, labelInsensitivePixmap,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- if ((style & SWT.WRAP) != 0) setText (text);
-}
-public void setFont (Font font) {
- super.setFont (font);
- if ((style & SWT.WRAP) != 0) setText (text);
-}
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- setBitmap (this.image = image);
-}
-public void setSize (int width, int height) {
- super.setSize (width, height);
- if ((style & SWT.WRAP) != 0) setText (text);
-}
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
-
- /* Strip out mnemonic marker symbols, and remember the mnemonic. */
- char [] unicode = new char [string.length ()];
- string.getChars (0, unicode.length, unicode, 0);
- int i=0, j=0, mnemonic=0;
- while (i < unicode.length) {
- if ((unicode [j++] = unicode [i++]) == Mnemonic) {
- if (i == unicode.length) {continue;}
- if (unicode [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = unicode [i];
- j--;
- }
- }
- while (j < unicode.length) unicode [j++] = 0;
-
- /* Wrap the text if necessary, and convert to mbcs. */
- byte [] buffer;
- if ((style & SWT.WRAP) != 0) {
- int [] argList = {
- OS.XmNwidth, 0, /* 1 */
- OS.XmNmarginLeft, 0, /* 3 */
- OS.XmNmarginRight, 0, /* 5 */
- OS.XmNborderWidth, 0, /* 7 */
- OS.XmNmarginWidth, 0, /* 9 */
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int width = argList [1] - argList [3] - argList [5] - argList [7] * 2 - argList [9] * 2;
- Display display = getDisplay ();
- if (mnemonic != 0) string = new String (unicode);
- string = display.wrapText (string, fontList, width);
- buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- } else {
- buffer = Converter.wcsToMbcs (getCodePage (), unicode, true);
- }
-
- int xmString = OS.XmStringGenerate(buffer, null, OS.XmCHARSET_TEXT, null);
- if (xmString == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
-
- /*
- * Bug in Solaris. If a mnemonic is defined to be a character
- * that appears in a string in a position that follows a '\n',
- * Solaris segment faults. For example, a label with text
- * "Hello\nthe&re" would GP since "r" appears after '\n'.
- *
- * The fix is to remove mnemonics from labels that contain
- * '\n', which is fine since such labels generally just act
- * as descriptive texts anyways.
- */
- if (mnemonic == 0 || string.indexOf ('\n') != -1) {
- mnemonic = OS.XK_VoidSymbol;
- }
- int [] argList = {
- OS.XmNlabelType, OS.XmSTRING,
- OS.XmNlabelString, xmString,
- OS.XmNmnemonic, mnemonic,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (xmString != 0) OS.XmStringFree (xmString);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/List.java
deleted file mode 100755
index 75cd09993a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/List.java
+++ /dev/null
@@ -1,1527 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-
-/**
- * Instances of this class represent a selectable user interface
- * object that displays a list of strings and issues notificiation
- * when a string selected. A list may be single or multi select.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class List extends Scrollable {
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public List (Composite parent, int style) {
- /**
- * Feature in Motif. It is not possible to create
- * scrolled list that will never show the vertical
- * scroll bar. Therefore, not matter what style
- * bits are specified, set the V_SCROLL bits to
- * match the widget Motif creates.
- */
- super (parent, checkStyle (style | SWT.V_SCROLL));
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.XmListAddItemUnselected (handle, xmString, 0);
- OS.XmStringFree (xmString);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- /*
- * Feature in Motif. When an index is out of range,
- * the list widget adds the item at the end. This
- * behavior is not wrong but it is unwanted. The
- * fix is to check the range before adding the item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index <= argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.XmListAddItemUnselected (handle, xmString, index + 1);
- OS.XmStringFree (xmString);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the selection changes.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- XtWidgetGeometry result = new XtWidgetGeometry ();
- result.request_mode = OS.CWWidth;
- OS.XtQueryGeometry (handle, null, result);
- int width = result.width, height = 0;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- if (hHint == SWT.DEFAULT || wHint == SWT.DEFAULT) {
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int count = argList [1];
- if (hHint == SWT.DEFAULT) {
- if (count == 0) {
- height = DEFAULT_HEIGHT;
- } else {
- height = getItemHeight () * count;
- }
- }
- if (wHint == SWT.DEFAULT && count == 0) {
- width = DEFAULT_WIDTH;
- }
- }
- Rectangle rect = computeTrim (0, 0, width, height);
- return new Point (rect.width, rect.height);
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- Display display = getDisplay ();
- int border = getBorderWidth ();
- int trimX = x - border;
- int trimY = y - border;
- int trimWidth = width + (border * 2);
- int trimHeight = height + (border * 2);
- if (horizontalBar != null) {
- int [] argList = {OS.XmNheight, 0};
- OS.XtGetValues (horizontalBar.handle, argList, argList.length / 2);
- /**
- * Motif adds four pixels between the bottom of the
- * list and the horizontal scroll bar. Add those now.
- */
- trimHeight += argList [1] + 4;
- trimY -= display.scrolledInsetY;
- if (verticalBar != null) {
- trimX -= display.scrolledInsetX;
- }
- }
- if (verticalBar != null) {
- int [] argList = {OS.XmNwidth, 0};
- OS.XtGetValues (verticalBar.handle, argList, argList.length / 2);
- trimWidth += argList [1];
- trimX -= display.scrolledInsetX;
- if (horizontalBar != null) {
- trimY -= display.scrolledInsetY;
- }
- }
- int [] argList = {
- OS.XmNhighlightThickness, 0, /* 1 */
- OS.XmNshadowThickness, 0, /* 3 */
- OS.XmNlistMarginWidth, 0, /* 5 */
- OS.XmNlistMarginHeight, 0 /* 7 */
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int thickness = argList [1] + (argList [3] * 2);
- trimWidth += thickness + argList [5] + 1;
- trimHeight += thickness + argList [7] + 1;
- trimX -= argList [1] + argList [3] + argList [5];
- trimY -= argList [1] + argList [3] + argList [7];
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-void createHandle (int index) {
- state |= HANDLE;
-
- /*
- * Feature in Motif. When items are added or removed
- * from a list, it may request and be granted, a new
- * preferred size. This behavior is unwanted. The fix
- * is to create a parent for the list that will disallow
- * geometry requests.
- */
- int parentHandle = parent.handle;
- int [] argList1 = {OS.XmNancestorSensitive, 1};
- formHandle = OS.XmCreateForm (parentHandle, null, argList1, argList1.length / 2);
- if (formHandle == 0) error (SWT.ERROR_NO_HANDLES);
- int selectionPolicy = OS.XmBROWSE_SELECT, listSizePolicy = OS.XmCONSTANT;
- if ((style & SWT.MULTI) != 0) {
- selectionPolicy = OS.XmEXTENDED_SELECT;
- if ((style & SWT.SIMPLE) != 0) selectionPolicy = OS.XmMULTIPLE_SELECT;
- }
- if ((style & SWT.H_SCROLL) == 0) listSizePolicy = OS.XmVARIABLE;
- int [] argList2 = {
- OS.XmNlistSizePolicy, listSizePolicy,
- OS.XmNselectionPolicy, selectionPolicy,
- OS.XmNtopAttachment, OS.XmATTACH_FORM,
- OS.XmNbottomAttachment, OS.XmATTACH_FORM,
- OS.XmNleftAttachment, OS.XmATTACH_FORM,
- OS.XmNrightAttachment, OS.XmATTACH_FORM,
- OS.XmNresizable, 0,
-// OS.XmNmatchBehavior, OS.XmNONE,
- };
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) == 0) {
- handle = OS.XmCreateList (formHandle, null, argList2, argList2.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- } else {
- handle = OS.XmCreateScrolledList (formHandle, null, argList2, argList2.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- scrolledHandle = OS.XtParent (handle);
- }
-}
-ScrollBar createScrollBar (int type) {
- return createStandardBar (type);
-}
-int defaultBackground () {
- return getDisplay ().listBackground;
-}
-int defaultFont () {
- return getDisplay ().listFont;
-}
-int defaultForeground () {
- return getDisplay ().listForeground;
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- /*
- * Note: We rely on the fact that XmListDeselectPos ()
- * fails silently when the indices are out of range.
- */
- if (index != -1) OS.XmListDeselectPos (handle, index + 1);
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- if (start > end) return;
- /*
- * Note: We rely on the fact that XmListDeselectPos ()
- * fails silently when the indices are out of range.
- */
- for (int i=start; i<=end; i++) {
- int index = i + 1;
- if (index != 0) OS.XmListDeselectPos (handle, index);
- }
-}
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- /*
- * Note: We rely on the fact that XmListDeselectPos ()
- * fails silently when the indices are out of range.
- */
- for (int i=0; i<indices.length; i++) {
- int index = indices [i] + 1;
- if (index != 0) OS.XmListDeselectPos (handle, index);
- }
-}
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- OS.XmListDeselectAllItems (handle);
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * has the focus in the receiver, or -1 if no item is has focus.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getFocusIndex () {
- checkWidget();
- return OS.XmListGetKbdItemPos (handle) - 1;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] argList = {OS.XmNitemCount, 0, OS.XmNitems, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- if (argList [3] == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int ptr = argList [3] + (index * 4);
- int [] buffer1 = new int [1];
- OS.memmove (buffer1, ptr, 4);
- ptr = buffer1 [0];
- int address = OS.XmStringUnparse (
- ptr,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- return new String (Converter.mbcsToWcs (getCodePage (), buffer));
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- int [] argList = {
- OS.XmNlistSpacing, 0,
- OS.XmNhighlightThickness, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int spacing = argList [1], highlight = argList [3];
-
- /* Result is from empirical analysis on Linux and AIX */
- return getFontHeight () + spacing + highlight + 1;
-}
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int [] argList = {OS.XmNitems, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int items = argList [1], itemCount = argList [3];
- int [] buffer1 = new int [1];
- String [] result = new String [itemCount];
- String codePage = getCodePage ();
- for (int i=0; i<itemCount; i++) {
- OS.memmove (buffer1, items, 4);
- int ptr = buffer1 [0];
- int address = OS.XmStringUnparse (
- ptr,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- result[i] = new String (Converter.mbcsToWcs (codePage, buffer));
- items += 4;
- }
- return result;
-}
-/**
- * Returns an array of <code>String</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public String [] getSelection () {
- checkWidget();
- int [] argList = {OS.XmNselectedItems, 0, OS.XmNselectedItemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int items = argList [1], itemCount = argList [3];
- int [] buffer1 = new int [1];
- String [] result = new String [itemCount];
- String codePage = getCodePage ();
- for (int i=0; i<itemCount; i++) {
- OS.memmove (buffer1, items, 4);
- int ptr = buffer1 [0];
- int address = OS.XmStringUnparse (
- ptr,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- result[i] = new String (Converter.mbcsToWcs (codePage, buffer));
- items += 4;
- }
- return result;
-}
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- int [] argList = {OS.XmNselectedItemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- int index = OS.XmListGetKbdItemPos (handle);
- if (OS.XmListPosSelected (handle, index)) return index - 1;
- int [] count = new int [1], positions = new int [1];
- if (!OS.XmListGetSelectedPos (handle, positions, count)) return -1;
- if (count [0] == 0) return -1;
- int address = positions [0];
- int [] indices = new int [1];
- OS.memmove (indices, address, 4);
- OS.XtFree (address);
- return indices [0] - 1;
-}
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- int [] count = new int [1], positions = new int [1];
- OS.XmListGetSelectedPos (handle, positions, count);
- int [] result = new int [count [0]];
- OS.memmove (result, positions [0], count [0] * 4);
- if (positions [0] != 0) OS.XtFree (positions [0]);
- for (int i=0; i<result.length; i++) --result [i];
- return result;
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- int [] argList = {OS.XmNtopItemPosition, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] - 1;
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNbrowseSelectionCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNextendedSelectionCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdefaultActionCallback, windowProc, SWT.DefaultSelection);
-}
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) return -1;
- int index = OS.XmListItemPos (handle, xmString);
- OS.XmStringFree (xmString);
- return index - 1;
-}
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] argList = {OS.XmNitems, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int items = argList [1], itemCount = argList [3];
- if (!((0 <= start) && (start < itemCount))) return -1;
- byte [] buffer1 = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer1);
- if (xmString == 0) return -1;
- int index = start;
- items += start * 4;
- int [] buffer2 = new int [1];
- while (index < itemCount) {
- OS.memmove (buffer2, items, 4);
- if (OS.XmStringCompare (buffer2 [0], xmString)) break;
- items += 4; index++;
- }
- OS.XmStringFree (xmString);
- if (index == itemCount) return -1;
- return index;
-}
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- if (index == -1) return false;
- return OS.XmListPosSelected (handle, index + 1);
-}
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- /*
- * Feature in Motif. An index out of range handled
- * correctly by the list widget but causes an unwanted
- * Xm Warning. The fix is to check the range before
- * deleting an item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- OS.XmListDeletePos (handle, index + 1);
-}
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- if (start > end) return;
- int count = end - start + 1;
- /*
- * Feature in Motif. An index out of range handled
- * correctly by the list widget but causes an unwanted
- * Xm Warning. The fix is to check the range before
- * deleting an item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= start && start < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- OS.XmListDeleteItemsPos (handle, count, start + 1);
- if (end >= argList [1]) error (SWT.ERROR_INVALID_RANGE);
-}
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
- int index = OS.XmListItemPos (handle, xmString);
- OS.XmStringFree (xmString);
- if (index == 0) error (SWT.ERROR_INVALID_ARGUMENT);
- OS.XmListDeletePos (handle, index);
-}
-/**
- * Removes the items from the receiver at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- /*
- * Feature in Motif. An index out of range handled
- * correctly by the list widget but causes an unwanted
- * Xm Warning. The fix is to check the range before
- * deleting an item.
- */
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int length = 0, count = argList [1];
- int [] newIndices = new int [indices.length];
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (!(0 <= index && index < count)) break;
- newIndices [length++] = index + 1;
- }
- OS.XmListDeletePositions (handle, newIndices, length);
- if (length < indices.length) error (SWT.ERROR_INVALID_RANGE);
-}
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.XmListDeselectAllItems (handle);
- OS.XmListDeleteAllItems (handle);
- /*
- * Bug in AIX. When all list items are deleted
- * from a scrolled list that is currently showing a
- * horizontal scroll bar, the horizontal scroll bar
- * is hidden, but the list does not grow to take up
- * the space once occupied by the bar. The fix is
- * of force a resize of the list.
- */
- if ((style & SWT.H_SCROLL) != 0) OS.XtResizeWindow (handle);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index == -1) return;
- if (OS.XmListPosSelected (handle, index + 1)) return;
- /*
- * Feature in MOTIF. The X/MOTIF 1.2 spec says that XmListSelectPos ()
- * in a XmEXTENDED_SELECT list widget will add the index to the selected
- * indices. The observed behavior does not match the spec. The fix is
- * to temporarily switch the XmNselectionPolicy to XmMULTIPLE_SELECT
- * and then switch it back because XmListSelectPost () works as specified
- * for XmMULTIPLE_SELECT list widgets.
- */
- int [] argList = {OS.XmNselectionPolicy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int oldPolicy = argList [1];
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmMULTIPLE_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- /*
- * Note: We rely on the fact that XmListSelectPos ()
- * fails silently when the indices are out of range.
- */
- OS.XmListSelectPos (handle, index + 1, false);
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmEXTENDED_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- if (start > end) return;
- if ((style & SWT.SINGLE) != 0) {
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int index = Math.min (argList[1] - 1, end) + 1;
- if (index != 0 && index >= start) OS.XmListSelectPos (handle, index, false);
- return;
- }
- /*
- * Feature in MOTIF. The X/MOTIF 1.2 spec says that XmListSelectPos ()
- * in a XmEXTENDED_SELECT list widget will add the index to the selected
- * indices. The observed behavior does not match the spec. The fix is
- * to temporarily switch the XmNselectionPolicy to XmMULTIPLE_SELECT
- * and then switch it back because XmListSelectPos () works as specified
- * for XmMULTIPLE_SELECT list widgets.
- */
- int [] argList = {OS.XmNselectionPolicy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int oldPolicy = argList [1];
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmMULTIPLE_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- /*
- * Note: We rely on the fact that XmListSelectPos ()
- * fails silently when the indices are out of range.
- */
- for (int i=start; i<=end; i++) {
- int index = i + 1;
- if ((index != 0) && !OS.XmListPosSelected (handle, index)) {
- OS.XmListSelectPos (handle, index, false);
- }
- }
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmEXTENDED_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SINGLE) != 0) {
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int count = argList [1];
- for (int i = 0; i < indices.length; i++) {
- int index = indices [i];
- if (0 <= index && index < count) {
- select (index);
- return;
- }
- }
- return;
- }
- /*
- * Feature in MOTIF. The X/MOTIF 1.2 spec says that XmListSelectPos ()
- * in a XmEXTENDED_SELECT list widget will add the index to the selected
- * indices. The observed behavior does not match the spec. The fix is
- * to temporarily switch the XmNselectionPolicy to XmMULTIPLE_SELECT
- * and then switch it back because XmListSelectPos () works as specified
- * for XmMULTIPLE_SELECT list widgets.
- */
- int [] argList = {OS.XmNselectionPolicy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int oldPolicy = argList [1];
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmMULTIPLE_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- /*
- * Note: We rely on the fact that XmListSelectPos ()
- * fails silently when the indices are out of range.
- */
- for (int i=0; i<indices.length; i++) {
- int index = indices [i] + 1;
- if ((index != 0) && !OS.XmListPosSelected (handle, index)) {
- OS.XmListSelectPos (handle, index, false);
- }
- }
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmEXTENDED_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-void select (String [] items) {
- checkWidget();
- int [] table = new int [items.length];
- String codePage = getCodePage ();
- for (int i=0; i<items.length; i++) {
- String string = items [i];
- byte [] buffer = Converter.wcsToMbcs (codePage, string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- table [i] = xmString;
- }
- int ptr = OS.XtMalloc (items.length * 4);
- OS.memmove (ptr, table, items.length * 4);
- int [] argList = {OS.XmNselectedItems, ptr, OS.XmNselectedItemCount, table.length};
- OS.XtSetValues (handle, argList, argList.length / 2);
- for (int i=0; i<table.length; i++) OS.XmStringFree (table [i]);
- OS.XtFree (ptr);
- OS.XmListUpdateSelectedList (handle);
-}
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return;
- /*
- * Feature in MOTIF. The X/MOTIF 1.2 spec says that XmListSelectPos ()
- * in a XmEXTENDED_SELECT list widget will add the index to the selected
- * indices. The observed behavior does not match the spec. The fix is
- * to temporarily switch the XmNselectionPolicy to XmMULTIPLE_SELECT
- * and then switch it back because XmListSelectPos () works as specified
- * for XmMULTIPLE_SELECT list widgets.
- */
- int [] argList = {OS.XmNselectionPolicy, 0, OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int oldPolicy = argList [1];
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmMULTIPLE_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- for (int i=0; i<argList[3]; i++) {
- int index = i + 1;
- if (!OS.XmListPosSelected (handle, index)) {
- OS.XmListSelectPos (handle, index, false);
- }
- }
- if (oldPolicy == OS.XmEXTENDED_SELECT) {
- argList [1] = OS.XmEXTENDED_SELECT;
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- /*
- * Bug in AIX. When the receiver has a vertical scroll bar
- * that is currently not visible and no horizontal scroll bar
- * and is resized to be smaller in both the width and height
- * and goes from the state where the width of the longest item
- * is smaller than the width of the list to the state where the
- * width of the longest item is longer than the width of the
- * list, the list hides the vertical scroll bar and leaves a
- * blank space where it should be. This often happens when a
- * shell containing a list that matches the above criteria is
- * maximized and then restored. This is just one of a number
- * of repeatable cases where the scrolled window hides the
- * scroll bars but does not resize the list. The fix is to
- * detect these cases and force the scroll bars to be layed
- * out properly by growing and then shrinking the scrolled
- * window.
- */
-// fixHScroll := hScroll ~~ nil and: [
-// hScroll isVisible not and: [
-// height ~~ (self dimensionAt: XmNheight)]].
-// fixVScroll := vScroll ~~ nil and: [
-// vScroll isVisible not and: [
-// width ~~ (self dimensionAt: XmNwidth)]].
-// (fixHScroll or: [fixVScroll]) ifFalse: [^self].
-
- /* Grow and shrink the scrolled window by one pixel */
- if (scrolledHandle == 0) return;
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- OS.XtResizeWidget (scrolledHandle, argList [1] + 1, argList [3], argList [5]);
- OS.XtResizeWidget (scrolledHandle, argList [1], argList [3], argList [5]);
-}
-void setFocusIndex (int index) {
- OS.XmListSetKbdItemPos (handle, index + 1);
-}
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- int [] argList = {OS.XmNitemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (!(0 <= index && index < argList [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- boolean isSelected = OS.XmListPosSelected (handle, index + 1);
- OS.XmListReplaceItemsPosUnselected (handle, new int [] {xmString}, 1, index + 1);
- if (isSelected) OS.XmListSelectPos (handle, index + 1, false);
- OS.XmStringFree (xmString);
-}
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- /*
- * Bug in AIX. When all list items are replaced
- * in a scrolled list that is currently showing a
- * horizontal scroll bar, the horizontal scroll bar
- * is hidden, but the list does not grow to take up
- * the space once occupied by the bar. The fix is
- * of force the horizontal bar to be recomputed by
- * removing all items and resizing the list.
- */
- OS.XmListSetPos (handle, 0);
- OS.XmListDeselectAllItems (handle);
- if ((style & SWT.H_SCROLL) != 0) {
- OS.XmListDeleteAllItems (handle);
- }
- int index = 0;
- int [] table = new int [items.length];
- String codePage = getCodePage ();
- while (index < items.length) {
- String string = items [index];
- if (string == null) break;
- byte [] buffer = Converter.wcsToMbcs (codePage, string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString == 0) break;
- table [index++] = xmString;
- }
- int ptr = OS.XtMalloc (index * 4);
- OS.memmove (ptr, table, index * 4);
- int [] argList = {OS.XmNitems, ptr, OS.XmNitemCount, index};
- OS.XtSetValues (handle, argList, argList.length / 2);
- for (int i=0; i<index; i++) OS.XmStringFree (table [i]);
- OS.XtFree (ptr);
- /*
- * Bug in Motif. Resize the list to work around
- * the horizontal scroll bar display bug described
- * above.
- */
- if ((style & SWT.H_SCROLL) != 0) {
- OS.XtResizeWindow (handle);
- }
- if (index < items.length) error (SWT.ERROR_ITEM_NOT_ADDED);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (int index) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (index);
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (start, end);
-}
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selection is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int[])
- */
-public void setSelection(int[] indices) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (indices);
-}
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- String codePage = getCodePage ();
- if ((style & SWT.SINGLE) != 0) {
- for (int i=items.length-1; i>=0; --i) {
- String string = items [i];
- if (string != null) {
- byte [] buffer = Converter.wcsToMbcs (codePage, string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString != 0) {
- int index = OS.XmListItemPos (handle, xmString);
- if (index != 0) OS.XmListSelectPos (handle, index, false);
- OS.XmStringFree (xmString);
- if ((index != 0) && OS.XmListPosSelected (handle, index)) return;
- }
- }
- }
- OS.XmListDeselectAllItems (handle);
- return;
- }
- OS.XmListDeselectAllItems (handle);
- int length = 0;
- int [] table = new int [items.length];
- for (int i=0; i<items.length; i++) {
- String string = items [i];
- if (string != null) {
- byte [] buffer = Converter.wcsToMbcs (codePage, string, true);
- int xmString = OS.XmStringCreateLocalized (buffer);
- if (xmString != 0) table [length++] = xmString;
- }
- }
- int ptr = OS.XtMalloc (length * 4);
- OS.memmove (ptr, table, length * 4);
- int [] argList = {OS.XmNselectedItems, ptr, OS.XmNselectedItemCount, length};
- OS.XtSetValues (handle, argList, argList.length / 2);
- for (int i=0; i<length; i++) OS.XmStringFree (table [i]);
- OS.XtFree (ptr);
- OS.XmListUpdateSelectedList (handle);
-}
-public void setSize (int width, int height) {
- super.setSize (width, height);
- /*
- * Bug in AIX. When the receiver has a vertical scroll bar
- * that is currently not visible and no horizontal scroll bar
- * and is resized to be smaller in both the width and height
- * and goes from the state where the width of the longest item
- * is smaller than the width of the list to the state where the
- * width of the longest item is longer than the width of the
- * list, the list hides the vertical scroll bar and leaves a
- * blank space where it should be. This often happens when a
- * shell containing a list that matches the above criteria is
- * maximized and then restored. This is just one of a number
- * of repeatable cases where the scrolled window hides the
- * scroll bars but does not resize the list. The fix is to
- * detect these cases and force the scroll bars to be layed
- * out properly by growing and then shrinking the scrolled
- * window.
- */
-// fixHScroll := hScroll ~~ nil and: [
-// hScroll isVisible not and: [
-// height ~~ (self dimensionAt: XmNheight)]].
-// fixVScroll := vScroll ~~ nil and: [
-// vScroll isVisible not and: [
-// width ~~ (self dimensionAt: XmNwidth)]].
-// (fixHScroll or: [fixVScroll]) ifFalse: [^self].
-
- /* Grow and shrink the scrolled window by one pixel */
- if (scrolledHandle == 0) return;
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- OS.XtResizeWidget (scrolledHandle, argList [1] + 1, argList [3], argList [5]);
- OS.XtResizeWidget (scrolledHandle, argList [1], argList [3], argList [5]);
-}
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- int [] argList = {OS.XmNitemCount, 0, OS.XmNvisibleItemCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int newIndex = Math.max (1, Math.min (index + 1, argList [1]));
- int lastIndex = Math.max (1, argList [1] - argList [3] + 1);
- if (newIndex > lastIndex) newIndex = lastIndex;
- OS.XmListSetPos (handle, newIndex);
-}
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- int [] buffer = new int [1], positions = new int [1];
- if (!OS.XmListGetSelectedPos (handle, positions, buffer)) return;
- if (buffer [0] == 0) return;
- int address = positions [0];
- int [] indices = new int [1];
- OS.memmove (indices, address, 4);
- OS.XtFree (address);
- int index = indices [0];
- int [] argList = {
- OS.XmNtopItemPosition, 0,
- OS.XmNvisibleItemCount, 0,
- OS.XmNitemCount, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int topIndex = argList [1], visibleCount = argList [3], count = argList [5];
- int bottomIndex = Math.min (topIndex + visibleCount - 1, count);
- if ((topIndex <= index) && (index <= bottomIndex)) return;
- int lastIndex = Math.max (1, count - visibleCount + 1);
- int newTop = Math.min (Math.max (index - (visibleCount / 2), 1), lastIndex);
- OS.XmListSetPos (handle, newTop);
-}
-int topHandle () {
- /*
- * Normally, when a composite has both a form handle
- * and a scrolled handle, the scrolled handle is the
- * parent of the form handle. In the case of a list,
- * both handles are present but the form handle is
- * parent of the scrolled handle and therefore is
- * the top handle of the list.
- */
- return formHandle;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Menu.java
deleted file mode 100755
index 036f385781..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Menu.java
+++ /dev/null
@@ -1,720 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are user interface objects that contain
- * menu items.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BAR, DROP_DOWN, POP_UP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Help, Hide, Show </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Menu extends Widget {
- boolean hasLocation;
- MenuItem cascade, defaultItem;
- Decorations parent;
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Control parent) {
- this (checkNull(parent).getShell (), SWT.POP_UP);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Decorations parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (Menu parentMenu) {
- this (checkNull(parentMenu).parent, SWT.DROP_DOWN);
-}
-/**
-* Creates a new instance of the widget.
-*/
-public Menu (MenuItem parentItem) {
- this (checkNull(parentItem).parent);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>MenuListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #removeMenuListener
- */
-public void addMenuListener(MenuListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Hide,typedListener);
- addListener(SWT.Show,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
-}
-static Control checkNull (Control control) {
- if (control == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return control;
-}
-static Menu checkNull (Menu menu) {
- if (menu == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return menu;
-}
-static MenuItem checkNull (MenuItem item) {
- if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-void createHandle (int index) {
- state |= HANDLE;
-
- /*
- * Bug in Motif. For some reason, creating a menu after any application context
- * and shell have been destroyed will segment fault unless a new application
- * context and shell have been created in the current thread. The fix is to
- * detect this case and create and destroy a temporary application context and
- * shell.
- */
- int xDisplay = 0, shellHandle = 0;
- if (Display.DisplayDisposed) {
- int [] argc = new int [] {0};
- int xtContext = OS.XtCreateApplicationContext ();
- xDisplay = OS.XtOpenDisplay (xtContext, null, null, null, 0, 0, argc, 0);
- shellHandle = OS.XtAppCreateShell (null, null, OS.TopLevelShellWidgetClass (), xDisplay, null, 0);
- }
-
- /* BAR menu */
- if ((style & SWT.BAR) != 0) {
- int parentHandle = parent.scrolledHandle;
- int [] argList = {OS.XmNancestorSensitive, 1};
- handle = OS.XmCreateMenuBar (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- /* POPUP and PULLDOWN menus */
-
- /*
- * Bug in Motif. When an existing popup menu is destroyed just
- * before creating a new popup menu and the new menu is managed,
- * the cursor changes to the menu cursor but the new menu is not
- * displayed. Also, Motif fails to show a popup menu when the
- * mouse is released. Both problems stem from the fact that the
- * popup menu is in the widget tree of a visible shell. The fix
- * is to create all popup menus as children of a hidden dialog
- * shell. Menus created this way are automatically destroyed
- * when the shell is destroyed.
- */
- byte [] buffer = new byte [1];
- int [] argList = {OS.XmNancestorSensitive, 1};
- if ((style & SWT.POP_UP) != 0) {
- int parentHandle = parent.dialogHandle ();
- handle = OS.XmCreatePopupMenu (parentHandle, buffer, argList, argList.length / 2);
- } else {
- /*
- * Bug in Linux. For some reason, when the parent of the pulldown
- * menu is not the main window handle, XtDestroyWidget() occasionally
- * segment faults when the shell is destroyed. The fix is to ensure
- * that the parent is the main window.
- */
- int parentHandle = parent.scrolledHandle;
- handle = OS.XmCreatePulldownMenu (parentHandle, buffer, argList, argList.length / 2);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-
- /* Workaround for bug in Motif */
- if (Display.DisplayDisposed) {
- if (shellHandle != 0) OS.XtDestroyWidget (shellHandle);
- if (xDisplay != 0) {
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- OS.XtDestroyApplicationContext (xtContext);
- }
- }
-}
-void createWidget (int index) {
- super.createWidget (index);
- parent.add (this);
-}
-/**
- * Returns the default menu item or null if none has
- * been previously set.
- *
- * @return the default menu item.
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getDefaultItem () {
- checkWidget();
- return defaultItem;
-}
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] argList = {OS.XmNsensitive, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getItem (int index) {
- checkWidget();
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- int [] handles = new int [argList [3]];
- OS.memmove (handles, argList [1], argList[3] * 4);
- int i = 0, count = 0;
- while (i < argList [3]) {
- if (OS.XtIsManaged (handles [i])) {
- if (index == count) break;
- count++;
- }
- i++;
- }
- if (index != count) error (SWT.ERROR_INVALID_RANGE);
- Widget widget = WidgetTable.get (handles [i]);
- if (!(widget instanceof MenuItem)) error (SWT.ERROR_CANNOT_GET_ITEM);
- return (MenuItem) widget;
-}
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == 0 || argList [3] == 0) return 0;
- int [] handles = new int [argList [3]];
- OS.memmove (handles, argList [1], argList [3] * 4);
- int count = 0;
- for (int i=0; i<argList [3]; i++) {
- if (OS.XtIsManaged (handles [i])) count++;
- }
- return count;
-}
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem [] getItems () {
- checkWidget();
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int ptr = argList [1], count = argList [3];
- if (count == 0 || ptr == 0) return new MenuItem [0];
- int [] handles = new int [count];
- OS.memmove (handles, ptr, count * 4);
- MenuItem [] items = new MenuItem [count];
- int i = 0, j = 0;
- while (i < count) {
- Widget item = WidgetTable.get (handles [i]);
- if (item != null) items [j++] = (MenuItem) item;
- i++;
- }
- if (i == j) return items;
- MenuItem [] newItems = new MenuItem [j];
- System.arraycopy (items, 0, newItems, 0, j);
- return newItems;
-}
-String getNameText () {
- String result = "";
- MenuItem [] items = getItems ();
- int length = items.length;
- if (length > 0) {
- for (int i=0; i<length-1; i++) {
- result = result + items [i].getNameText() + ", ";
- }
- result = result + items [length-1].getNameText ();
- }
- return result;
-}
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Decorations getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getParentItem () {
- checkWidget();
- return cascade;
-}
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParentMenu () {
- checkWidget();
- if (cascade != null) return cascade.parent;
- return null;
-}
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget();
- return parent.getShell ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return OS.XtIsManaged (handle);
-}
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNhelpCallback, windowProc, SWT.Help);
- OS.XtAddCallback (handle, OS.XmNmapCallback, windowProc, SWT.Show);
- OS.XtAddCallback (handle, OS.XmNunmapCallback, windowProc, SWT.Hide);
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (MenuItem item) {
- checkWidget();
- int [] argList = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int [] handles = new int [argList [3]];
- OS.memmove (handles, argList [1], handles.length * 4);
- int index = 0;
- for (int i=0; i<handles.length; i++) {
- if (OS.XtIsManaged (handles [i])) {
- if (handles [i] == item.handle) return index;
- index++;
- }
- }
- return -1;
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- Menu parentMenu = getParentMenu ();
- if (parentMenu == null) return getEnabled ();
- return getEnabled () && parentMenu.isEnabled ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return getVisible ();
-}
-int processHelp (int callData) {
- sendHelpEvent (callData);
- return 0;
-}
-int processHide (int callData) {
- sendEvent (SWT.Hide);
- return 0;
-}
-int processShow (int callData) {
- /*
- * SWT.Selection events are posted to allow stepping
- * in the VA/Java debugger. SWT.Show events are
- * sent to ensure that application event handler
- * code runs before the menu is displayed. This
- * means that SWT.Show events would normally occur
- * before SWT.Selection events. While this is not
- * strictly incorrect, applications often use the
- * SWT.Selection event to update the state of menu
- * items and would like the ordering of events to
- * be the other way around.
- *
- * The fix is to run the deferred events before
- * the menu is shown. This means that stepping
- * through a selection event that was caused by
- * a popup menu will fail in VA/Java.
- */
- Display display = getDisplay ();
- display.runDeferredEvents ();
- sendEvent (SWT.Show);
- return 0;
-}
-void releaseChild () {
- super.releaseChild ();
- if (cascade != null) cascade.setMenu (null);
- if (((style & SWT.BAR) != 0) && (this == parent.menuBar)) parent.setMenuBar (null);
-}
-void releaseWidget () {
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- super.releaseWidget ();
- if (parent != null) parent.remove (this);
- parent = null;
- cascade = defaultItem = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the menu events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #addMenuListener
- */
-public void removeMenuListener(MenuListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Hide, listener);
- eventTable.unhook(SWT.Show, listener);
-}
-void sendHelpEvent (int callData) {
- if (hooks (SWT.Help)) {
- postEvent (SWT.Help);
- return;
- }
- parent.sendHelpEvent (callData);
-}
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultItem (MenuItem item) {
- checkWidget();
- if (item != null && item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- defaultItem = item;
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the display.
- * <p>
- * Note: This is different from most widgets where the
- * location of the widget is relative to the parent.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
- int [] argList = {OS.XmNx, x, OS.XmNy, y};
- OS.XtSetValues (handle, argList, argList.length / 2);
- hasLocation = true;
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
- if (visible) {
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int xWindow = OS.XDefaultRootWindow (xDisplay);
- if (xWindow == 0) return;
- int [] rootX = new int [1], rootY = new int [1], unused = new int [1], mask = new int [1];
- if (OS.XQueryPointer (xDisplay, xWindow, unused, unused, rootX, rootY, unused, unused, mask) == 0) {
- return;
- }
- if (!hasLocation) {
- /*
- * Bug in Motif. For some reason, when a menu is popped up
- * under the mouse, the menu will not highlight until the
- * mouse exits and then enters the menu again. The fix is
- * to pop the menu up outside the current mouse position
- * causing highlighting to work properly when the user
- * waits for the menu to appear.
- */
- rootX[0] += 1; rootY[0] += 1;
- int [] argList = {OS.XmNx, rootX [0], OS.XmNy, rootY [0]};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- OS.XtManageChild (handle);
- /*
- * Feature in Motif. There is no API to force the menu
- * to accept keyboard traversal when popped up using
- * XtManageChild. The fix is to call undocumented API
- * to do this.
- */
- int flags = OS.Button1Mask | OS.Button2Mask | OS.Button3Mask;
- if ((mask [0] & flags) == 0) OS._XmSetMenuTraversal (handle, true);
- } else {
- OS.XtUnmanageChild (handle);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java
deleted file mode 100755
index 4b0908639f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java
+++ /dev/null
@@ -1,815 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Arm, Help, Selection</dd>
- * </dl>
- *<p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class MenuItem extends Item {
- int accelerator;
- Menu parent, menu;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (OS.XmLAST_POSITION);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- if (index == OS.XmLAST_POSITION) error (SWT.ERROR_INVALID_RANGE);
- createWidget (index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the arm events are generated for the control, by sending
- * it one of the messages defined in the <code>ArmListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #removeArmListener
- */
-public void addArmListener (ArmListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Arm, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int parentHandle = parent.handle;
- int [] argList1 = {OS.XmNchildren, 0, OS.XmNnumChildren, 0};
- OS.XtGetValues (parentHandle, argList1, argList1.length / 2);
- if (index != OS.XmLAST_POSITION && argList1 [1] != 0) {
- int [] handles = new int [argList1 [3]];
- OS.memmove (handles, argList1 [1], argList1 [3] * 4);
- int i = 0, count = 0;
- while (i < argList1 [3]) {
- if (OS.XtIsManaged (handles [i])) {
- if (index == count) break;
- count++;
- }
- i++;
- }
- if (index != count) error (SWT.ERROR_INVALID_RANGE);
- index = i;
- }
- if ((style & SWT.SEPARATOR) != 0) {
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNorientation, (parent.style & SWT.BAR) != 0 ? OS.XmVERTICAL : OS.XmHORIZONTAL,
- OS.XmNpositionIndex, index,
- };
- handle = OS.XmCreateSeparatorGadget (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNpositionIndex, index,
- };
- if ((style & SWT.PUSH) != 0) {
- handle = OS.XmCreatePushButtonGadget (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- handle = OS.XmCreateToggleButtonGadget (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- handle = OS.XmCreateCascadeButtonGadget (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void destroyWidget () {
- /*
- * Feature in Motif. When a popup menu item
- * is destroyed, the menu does not recompute
- * the menu size until the next time the menu
- * is managed. This means that the user can
- * watch the menu get updated as new items are
- * added and old ones deleted. The fix is to
- * unmanaged the item before destroying it to
- * force the menu to recompute the menu size.
- */
- OS.XtUnmanageChild (handle);
- super.destroyWidget ();
-}
-/**
- * Return the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @return the accelerator
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAccelerator () {
- checkWidget();
- return accelerator;
-}
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] argList = {OS.XmNsensitive, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the receiver's cascade menu if it has one or null
- * if it does not. Only <code>CASCADE</code> menu items can have
- * a pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget();
- return menu;
-}
-String getNameText () {
- if ((style & SWT.SEPARATOR) != 0) return "|";
- return super.getNameText ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- int [] argList = {OS.XmNset, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
-* Returns the button label. The label may
-* include the mnemonic character but must not contain line
-* delimiters.
-*/
-String getText2 () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) return "";
- int [] argList = {OS.XmNlabelString, 0, OS.XmNmnemonic, 0, OS.XmNacceleratorText, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int xmString1 = argList [1], xmString2 = argList [5];
- int mnemonic = argList [3];
- if (mnemonic == OS.XK_VoidSymbol) mnemonic = 0;
- if (xmString1 == 0) error (SWT.ERROR_CANNOT_GET_TEXT);
- char [] result = null;
- int address = OS.XmStringUnparse (
- xmString1,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address != 0) {
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- /* Use the character encoding for the default locale */
- result = Converter.mbcsToWcs (null, buffer);
- }
- String accelText = "";
- if (xmString1 != 0) OS.XmStringFree (xmString1);
- if (xmString2 != 0) {
- address = OS.XmStringUnparse (
- xmString2,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- OS.XmOUTPUT_ALL);
- if (address != 0) {
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- OS.XtFree (address);
- /* Use the character encoding for the default locale */
- accelText = '\t' + new String (Converter.mbcsToWcs (null, buffer));
- }
- }
- if (xmString2 != 0) OS.XmStringFree (xmString2);
- if (result == null) return accelText;
- int count = 0;
- if (mnemonic != 0) count++;
- for (int i=0; i<result.length-1; i++)
- if (result [i] == Mnemonic) count++;
- char [] newResult = result;
- if ((count != 0) || (mnemonic != 0)) {
- newResult = new char [result.length + count];
- int i = 0, j = 0;
- while (i < result.length) {
- if ((mnemonic != 0) && (result [i] == mnemonic)) {
- if (j < newResult.length) newResult [j++] = Mnemonic;
- mnemonic = 0;
- }
- if ((newResult [j++] = result [i++]) == Mnemonic)
- if (j < newResult.length) newResult [j++] = Mnemonic;
- }
- }
- return new String (newResult) + accelText;
-}
-void hookEvents () {
- if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = parent.getShell ().getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNhelpCallback, windowProc, SWT.Help);
- if ((style & SWT.CASCADE) != 0) {
- OS.XtAddCallback (handle, OS.XmNactivateCallback, windowProc, SWT.Arm);
- OS.XtAddCallback (handle, OS.XmNcascadingCallback, windowProc, SWT.Arm);
- } else {
- OS.XtAddCallback (handle, OS.XmNarmCallback, windowProc, SWT.Arm);
- }
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Selection);
- } else {
- OS.XtAddCallback (handle, OS.XmNactivateCallback, windowProc, SWT.Selection);
- }
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- return getEnabled ();
-}
-String keysymName (int keysym) {
- switch (keysym) {
- case 8: return "BackSpace";
- case 9: return "Tab";
- /*
- * Bug in Motif. For some reason, the XmNaccelerator
- * resource will not accept Linefeed and prints Xt
- * warnings. The fix is to use Return instead.
- */
-// case 10: return "Linefeed";
- case 10:
- case 13: return "Return";
- case 27: return "Escape";
- case 127: return "Delete";
- }
- if (('0' <= keysym && keysym <= '9') ||
- ('a' <= keysym && keysym <= 'z') ||
- ('A' <= keysym && keysym <= 'Z')) {
- return new String (new char [] {(char) keysym});
- }
- /**
- * Note that XKeysymToString returns a value in a static
- * area which must not be modified or freed.
- */
- int ptr = OS.XKeysymToString (keysym);
- if (ptr == 0) return "";
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, buffer.length);
- /* Use the character encoding for the default locale */
- return new String (Converter.mbcsToWcs (null, buffer));
-}
-void manageChildren () {
- OS.XtManageChild (handle);
-}
-int processArm (int callData) {
- postEvent (SWT.Arm);
- return 0;
-}
-int processHelp (int callData) {
- if (hooks (SWT.Help)) {
- postEvent (SWT.Help);
- return 0;
- }
- parent.sendHelpEvent (callData);
- return 0;
-}
-int processSelection (int callData) {
- XmAnyCallbackStruct struct = new XmAnyCallbackStruct ();
- OS.memmove (struct, callData, XmAnyCallbackStruct.sizeof);
- Event event = new Event ();
- if (struct.event != 0) {
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, struct.event, XAnyEvent.sizeof);
- event.time = xEvent.time;
- switch (xEvent.type) {
- case OS.ButtonPress:
- case OS.ButtonRelease:
- case OS.KeyPress:
- case OS.KeyRelease:
- setInputState (event, xEvent);
- break;
- }
- }
- postEvent (SWT.Selection, event);
- return 0;
-}
-void releaseChild () {
- super.releaseChild ();
- if (menu != null) menu.dispose ();
- menu = null;
-}
-void releaseWidget () {
- if (menu != null && !menu.isDisposed()) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- menu = null;
- super.releaseWidget ();
- accelerator = 0;
- if (this == parent.defaultItem) {
- parent.defaultItem = null;
- }
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the arm events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #addArmListener
- */
-public void removeArmListener (ArmListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Arm, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @param accelerator an integer that is the bit-wise OR of masks and a key
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAccelerator (int accelerator) {
- checkWidget();
- this.accelerator = accelerator;
- int ptr = 0;
- if (accelerator != 0) {
- String ctrl, alt, shift;
- ctrl = alt = shift = "";
- if ((accelerator & SWT.ALT) != 0) alt = "Meta ";
- if ((accelerator & SWT.SHIFT) != 0) shift = "Shift ";
- if ((accelerator & SWT.CTRL) != 0) ctrl = "Ctrl ";
- int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
- int newKey = Display.untranslateKey (keysym);
- if (newKey != 0) {
- keysym = newKey;
- } else {
- keysym = wcsToMbcs ((char) keysym);
- }
- /*
- * Feature in Motif. Motif does not activate an accelerator
- * when the CapsLoc, NumLoc and NumLock+CapsLoc keys are pressed.
- * In order to activate accelerators when these keys are pressed,
- * it is necessary to look for all of these key sequences.
- */
- String key = ctrl + alt + shift + "<Key>" + keysymName (keysym);
- String allKeys = key + ",Lock " + key + ",Mod2 " + key + ",Lock Mod2 " + key;
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, allKeys, true);
- ptr = OS.XtMalloc (buffer.length);
- if (ptr != 0) OS.memmove (ptr, buffer, buffer.length);
- }
- int [] argList = {OS.XmNaccelerator, ptr};
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (ptr != 0) OS.XtFree (ptr);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget();
- /* Check to make sure the new menu is valid */
- if ((style & SWT.CASCADE) == 0) {
- error (SWT.ERROR_MENUITEM_NOT_CASCADE);
- }
- if (menu != null) {
- if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.DROP_DOWN) == 0) {
- error (SWT.ERROR_MENU_NOT_DROP_DOWN);
- }
- if (menu.parent != parent.parent) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
-
- /* Assign the new menu */
- Menu oldMenu = this.menu;
- if (oldMenu == menu) return;
- if (oldMenu != null) oldMenu.cascade = null;
- this.menu = menu;
- int menuHandle = 0;
-
- /* Set the new menu in the OS */
- if (menu != null) {
- menu.cascade = this;
- menuHandle = menu.handle;
- }
- int [] argList = {OS.XmNsubMenuId, menuHandle};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- int [] argList = {OS.XmNset, selected ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
-* Sets the widget text.
-* <p>
-* @param string the widget text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- if ((style & (SWT.ARROW | SWT.SEPARATOR)) != 0) return;
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
- boolean accel = false;
- int i=0, j=0, mnemonic=0;
- while (i < text.length) {
- if (text [i] == '\t') {accel = true; break;};
- if ((text [j++] = text [i++]) == Mnemonic) {
- if (i == text.length) {continue;}
- if (text [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = text [i];
- j--;
- }
- }
- byte [] buffer2;
- if (accel && ++i < text.length) {
- char [] accelText = new char [text.length - i];
- System.arraycopy (text, i, accelText, 0, accelText.length);
- /* Use the character encoding for the default locale */
- buffer2 = Converter.wcsToMbcs (null, accelText, true);
- } else {
- buffer2 = new byte [1];
- }
- int xmString2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- if (xmString2 == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
- while (j < text.length) text [j++] = 0;
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, text, true);
- int xmString1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- if (xmString1 == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
- if (mnemonic == 0) mnemonic = OS.XK_VoidSymbol;
- int [] argList = {
- OS.XmNlabelType, OS.XmSTRING,
- OS.XmNlabelString, xmString1,
- OS.XmNmnemonic, mnemonic,
- OS.XmNacceleratorText, xmString2,
- };
- OS.XtSetValues (handle, argList, argList.length / 2);
- if (xmString1 != 0) OS.XmStringFree (xmString1);
- if (xmString2 != 0) OS.XmStringFree (xmString2);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java
deleted file mode 100755
index b765da7833..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java
+++ /dev/null
@@ -1,416 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class are used used to inform or warn the user.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
- * <dd>OK, OK | CANCEL</dd>
- * <dd>YES | NO, YES | NO | CANCEL</dd>
- * <dd>RETRY | CANCEL</dd>
- * <dd>ABORT | RETRY | IGNORE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class MessageBox extends Dialog {
- int button;
- String message = "";
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent, int style) {
- super (parent, checkStyle (style));
- checkSubclass ();
-}
-int activate (int widget, int client, int call) {
- OS.XtUnmanageChild (widget);
- button = client;
- return 0;
-}
-static int checkStyle (int style) {
- if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) == 0) style |= SWT.APPLICATION_MODAL;
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
-int createHandle (int parentHandle, int [] argList) {
- if ((style & SWT.ICON_ERROR) != 0) return OS.XmCreateErrorDialog (parentHandle, null, argList, argList.length / 2);
- if ((style & SWT.ICON_INFORMATION) != 0) return OS.XmCreateInformationDialog (parentHandle, null, argList, argList.length / 2);
- if ((style & SWT.ICON_QUESTION) != 0) return OS.XmCreateQuestionDialog (parentHandle, null, argList, argList.length / 2);
- if ((style & SWT.ICON_WARNING) != 0) return OS.XmCreateWarningDialog (parentHandle, null, argList, argList.length / 2);
- return OS.XmCreateMessageDialog (parentHandle, null, argList, argList.length / 2);
-}
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public int open () {
-
- /* Create the dialog.*/
- boolean destroyContext;
- Display appContext = Display.getCurrent ();
- if (destroyContext = (appContext == null)) appContext = new Display ();
- int display = appContext.xDisplay;
- int parentHandle = appContext.shellHandle;
- if (parent != null && parent.getDisplay () == appContext)
- parentHandle = parent.shellHandle;
-
- /* Compute the dialog title */
- /*
- * Feature in Motif. It is not possible to set a shell
- * title to an empty string. The fix is to set the title
- * to be a single space.
- */
- String string = title;
- if (string.length () == 0) string = " ";
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int xmStringPtr = OS.XmStringParseText (
- buffer,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /*
- * Feature in Motif. The modal values are only hints
- * to the window manager. For example Enlightenment treats all modes
- * as SWT.APPLICATION_MODAL. The generic Motif
- * Window Manager honours all modes.
- */
- int dialogStyle = OS.XmDIALOG_MODELESS;
- if ((style & SWT.PRIMARY_MODAL) != 0) dialogStyle = OS.XmDIALOG_PRIMARY_APPLICATION_MODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) dialogStyle = OS.XmDIALOG_FULL_APPLICATION_MODAL;
- if ((style & SWT.SYSTEM_MODAL) != 0) dialogStyle = OS.XmDIALOG_SYSTEM_MODAL;
- if (parent != null && dialogStyle == OS.XmDIALOG_MODELESS) {
- dialogStyle = OS.XmDIALOG_PRIMARY_APPLICATION_MODAL;
- }
- int [] argList = {
- OS.XmNnoResize, 1,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNdialogStyle, dialogStyle,
- OS.XmNdialogTitle, xmStringPtr,
- };
- int dialog = createHandle (parentHandle, argList);
- OS.XmStringFree (xmStringPtr);
- setMessage (dialog);
- setButtons (dialog);
-
- /* Hook the callbacks. */
- Callback callback = new Callback (this, "activate", 3);
- int address = callback.getAddress ();
- OS.XtAddCallback (dialog, OS.XmNokCallback, address, OS.XmDIALOG_OK_BUTTON);
- OS.XtAddCallback (dialog, OS.XmNcancelCallback, address, OS.XmDIALOG_CANCEL_BUTTON);
- OS.XtAddCallback (dialog, OS.XmNhelpCallback, address, OS.XmDIALOG_HELP_BUTTON);
-
- /* Open the dialog and dispatch events. */
-/*
- shell == nil ifFalse: [
- shell minimized ifTrue: [shell minimized: false]].
-*/
- OS.XtManageChild (dialog);
-
-//BOGUS - should be a pure OS message loop (no SWT AppContext)
- while (OS.XtIsRealized (dialog) && OS.XtIsManaged (dialog))
- if (!appContext.readAndDispatch()) appContext.sleep ();
-
- /* Destroy the dialog and update the display. */
- if (OS.XtIsRealized (dialog)) OS.XtDestroyWidget (dialog);
- if (destroyContext) appContext.dispose ();
- callback.dispose ();
-
-// (shell == nil or: [shell isDestroyed not]) ifTrue: [dialog xtDestroyWidget].
-// OSWidget updateDisplay.
-// entryPoint unbind.
-
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
- if (button == OS.XmDIALOG_OK_BUTTON) return SWT.YES;
- if (button == OS.XmDIALOG_CANCEL_BUTTON) return SWT.NO;
- return SWT.CANCEL;
- };
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- return (button == OS.XmDIALOG_OK_BUTTON) ? SWT.YES : SWT.NO;
- }
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
- return (button == OS.XmDIALOG_OK_BUTTON) ? SWT.OK : SWT.CANCEL;
- }
- if ((style & SWT.OK) == SWT.OK) return SWT.OK;
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- return (button == OS.XmDIALOG_OK_BUTTON) ? SWT.RETRY : SWT.CANCEL;
- }
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
- if (button == OS.XmDIALOG_OK_BUTTON) return SWT.ABORT;
- if (button == OS.XmDIALOG_CANCEL_BUTTON) return SWT.RETRY;
- return SWT.IGNORE;
- }
- return SWT.CANCEL;
-}
-void setButtons (int dialogHandle) {
-
- /* Get the button children */
- int ok = OS.XmMessageBoxGetChild (dialogHandle, OS.XmDIALOG_OK_BUTTON);
- int cancel = OS.XmMessageBoxGetChild (dialogHandle, OS.XmDIALOG_CANCEL_BUTTON);
- int help = OS.XmMessageBoxGetChild (dialogHandle, OS.XmDIALOG_HELP_BUTTON);
- OS.XtUnmanageChild (help);
-
- /* Set the button labels */
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) return;
- if ((style & SWT.OK) == SWT.OK) {
- OS.XtUnmanageChild (cancel);
- return;
- }
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
- OS.XtManageChild (help);
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Yes"), true);
- int xmString1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_No"), true);
- int xmString2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer3 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Cancel"), true);
- int xmString3 = OS.XmStringParseText (
- buffer3,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- int [] argList = {OS.XmNokLabelString, xmString1, OS.XmNcancelLabelString, xmString2, OS.XmNhelpLabelString, xmString3};
- OS.XtSetValues (dialogHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString1); OS.XmStringFree (xmString2); OS.XmStringFree (xmString3);
- return;
- }
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Yes"), true);
- int xmString1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_No"), true);
- int xmString2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- int [] argList = {OS.XmNokLabelString, xmString1, OS.XmNcancelLabelString, xmString2};
- OS.XtSetValues (dialogHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString1); OS.XmStringFree (xmString2);
- return;
- }
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true);
- int xmString1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Cancel"), true);
- int xmString2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- int [] argList = {OS.XmNokLabelString, xmString1, OS.XmNcancelLabelString, xmString2};
- OS.XtSetValues (dialogHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString1); OS.XmStringFree (xmString2);
- return;
- }
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
- OS.XtManageChild (help);
- /* Use the character encoding for the default locale */
- byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Abort"), true);
- int xmString1 = OS.XmStringParseText (
- buffer1,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true);
- int xmString2 = OS.XmStringParseText (
- buffer2,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- /* Use the character encoding for the default locale */
- byte [] buffer3 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Ignore"), true);
- int xmString3 = OS.XmStringParseText (
- buffer3,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- int [] argList = {OS.XmNokLabelString, xmString1, OS.XmNcancelLabelString, xmString2, OS.XmNhelpLabelString, xmString3};
- OS.XtSetValues (dialogHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString1); OS.XmStringFree (xmString2); OS.XmStringFree (xmString3);
- return;
- }
-}
-void setMessage (int dialogHandle) {
- String text = message;
- int label = OS.XmMessageBoxGetChild (dialogHandle, OS.XmDIALOG_MESSAGE_LABEL);
- if (label != 0) {
- int [] argList = {OS.XmNfontList, 0};
- OS.XtGetValues (label, argList, argList.length / 2);
- int fontList = argList [1];
- if (fontList != 0) {
- Display display = parent.getDisplay ();
- int xDisplay = display.xDisplay;
- int screen = OS.XDefaultScreen (xDisplay);
- int width = OS.XDisplayWidth (xDisplay, screen);
- text = display.wrapText (message, fontList, width * 3 / 5);
- }
- }
- /* Use the character encoding for the default locale */
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- int xmString = OS.XmStringGenerate(buffer, null, OS.XmCHARSET_TEXT, null);
- int [] argList = {OS.XmNmessageString, xmString};
- OS.XtSetValues (dialogHandle, argList, argList.length / 2);
- OS.XmStringFree (xmString);
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java
deleted file mode 100755
index a06fff2cf2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java
+++ /dev/null
@@ -1,310 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent is an unselectable
- * user interface object that is used to display progress,
- * typically in the form of a bar.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class ProgressBar extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ProgressBar (Composite parent, int style) {
- /*
- * Feature in Motif. If you set the progress bar's value to 0,
- * the thumb does not disappear. In order to make this happen,
- * we hide the widget when the value is set to zero by changing
- * its colors to render it invisible, which means that it
- * would not visible unless a border is present. The fix is to
- * always ensure that there is a border, which will be drawn
- * even when the value is 0.
- */
- super (parent, checkStyle (style | SWT.BORDER));
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- Display display = getDisplay ();
- int hScroll = display.scrolledMarginX;
- int vScroll = display.scrolledMarginY;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += hScroll * 10;
- height += vScroll;
- } else {
- width += hScroll;
- height += vScroll * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int background = defaultBackground ();
- int parentHandle = parent.handle;
- int [] argList = {
- OS.XmNshowArrows, 0,
- OS.XmNsliderSize, 1,
- OS.XmNtraversalOn, 0,
- OS.XmNtroughColor, background,
- OS.XmNtopShadowColor, background,
- OS.XmNbottomShadowColor, background,
- OS.XmNshadowThickness, 1,
- OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
- OS.XmNorientation, ((style & SWT.H_SCROLL) != 0) ? OS.XmHORIZONTAL : OS.XmVERTICAL,
- OS.XmNprocessingDirection, ((style & SWT.H_SCROLL) != 0) ? OS.XmMAX_ON_RIGHT : OS.XmMAX_ON_TOP,
- OS.XmNancestorSensitive, 1,
- };
- handle = OS.XmCreateScrollBar (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void disableButtonPress () {
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return;
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int event_mask = OS.XtBuildEventMask (handle);
- XSetWindowAttributes attributes = new XSetWindowAttributes ();
- attributes.event_mask = event_mask & ~OS.ButtonPressMask;
- OS.XChangeWindowAttributes (xDisplay, xWindow, OS.CWEventMask, attributes);
-}
-void disableTraversal () {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] argList = {OS.XmNmaximum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] argList = {OS.XmNminimum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] argList = {
- OS.XmNminimum, 0,
- OS.XmNsliderSize, 0,
- OS.XmNbackground, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int minimum = argList [1], sliderSize = argList [3], background = argList [5];
- if (sliderSize == 1 && background == defaultBackground()) sliderSize = 0;
- return minimum + sliderSize;
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- /*
- * ProgressBars never participate in focus traversal when
- * either enabled or disabled.
- */
- if (enabled) {
- disableTraversal ();
- disableButtonPress ();
- }
-}
-void realizeChildren () {
- super.realizeChildren ();
- disableButtonPress ();
-}
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNmaximum, value, OS.XmNvalue, 0};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {
- OS.XmNminimum, 0,
- OS.XmNmaximum, 0,
- OS.XmNsliderSize, 0,
- OS.XmNvalue, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int minimum = argList [1];
- int maximum = argList [3];
- int sliderSize = argList [5];
-
- if (value >= maximum) return;
- int selection = sliderSize + minimum;
- if (value > selection) selection = value;
- argList [1] = value;
- argList [7] = value;
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
- setThumb(selection - value);
-}
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {
- OS.XmNminimum, 0,
- OS.XmNmaximum, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int minimum = argList [1];
- int maximum = argList [3];
-
- int selection = value;
- if (selection < minimum) selection = minimum;
- if (selection > maximum) selection = maximum;
- setThumb(selection - minimum);
-}
-void setThumb (int sliderSize) {
- Display display = getDisplay ();
- int backgroundPixel = defaultBackground ();
- int [] argList1 = new int [] {
- OS.XmNbackground, 0,
- OS.XmNminimum, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
- if (sliderSize == 0) {
- if (argList1 [1] != backgroundPixel) {
- OS.XmChangeColor (handle, backgroundPixel);
- }
- } else {
- if (argList1 [1] != display.listForeground) {
- OS.XmChangeColor (handle, display.listForeground);
- }
- }
- int [] argList2 = new int [] {
- OS.XmNsliderSize, (sliderSize == 0) ? 1 : sliderSize,
- OS.XmNtroughColor, backgroundPixel,
- OS.XmNtopShadowColor, backgroundPixel,
- OS.XmNbottomShadowColor, backgroundPixel,
- OS.XmNvalue, argList1[3]
- };
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList2, argList2.length / 2);
- display.setWarnings (warnings);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
deleted file mode 100755
index 683cf52928..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user interface object
- * that allows the user to drag a rubber banded outline of the sash within
- * the parent control.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Sash extends Control {
- boolean dragging;
- int startX, startY, lastX, lastY;
- int cursor;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Sash (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
- * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int border = (style & SWT.BORDER) != 0 ? 1 : 0;
- int [] argList = {
- OS.XmNborderWidth, border,
- OS.XmNmarginWidth, 0,
- OS.XmNmarginHeight, 0,
- OS.XmNresizePolicy, OS.XmRESIZE_NONE,
- OS.XmNancestorSensitive, 1,
- OS.XmNtraversalOn, 0,
- };
- int parentHandle = parent.handle;
- handle = OS.XmCreateDrawingArea (parentHandle, null, argList, argList.length / 2);
-}
-void drawBand (int x, int y, int width, int height) {
- int display = OS.XtDisplay (parent.handle);
- if (display == 0) return;
- int window = OS.XtWindow (parent.handle);
- if (window == 0) return;
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0};
- OS.XtGetValues (parent.handle, argList, argList.length / 2);
- int color = argList [1] ^ argList [3];
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- int stipplePixmap = OS.XCreateBitmapFromData (display, window, bits, 8, 8);
- int gc = OS.XCreateGC (display, window, 0, null);
- OS.XSetForeground (display, gc, color);
- OS.XSetStipple (display, gc, stipplePixmap);
- OS.XSetSubwindowMode (display, gc, OS.IncludeInferiors);
- OS.XSetFillStyle (display, gc, OS.FillStippled);
- OS.XSetFunction (display, gc, OS.GXxor);
- OS.XFillRectangle (display, window, gc, x, y, width, height);
- OS.XFreePixmap (display, stipplePixmap);
- OS.XFreeGC (display, gc);
-}
-int processMouseDown (int callData) {
- super.processMouseDown (callData);
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- if (xEvent.button != 1) return 0;
- startX = xEvent.x; startY = xEvent.y;
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0, OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int border = argList [9], width = argList [5] + (border * 2), height = argList [7] + (border * 2);
- lastX = ((short) argList [1]) - border; lastY = ((short) argList [3]) - border;
- Event event = new Event ();
- event.detail = SWT.DRAG;
- event.time = xEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- sendEvent (SWT.Selection, event);
- if (event.doit) {
- dragging = true;
- OS.XmUpdateDisplay (handle);
- drawBand (lastX = event.x, lastY = event.y, width, height);
- }
- return 0;
-}
-int processMouseMove (int callData) {
- super.processMouseMove (callData);
- XMotionEvent xEvent = new XMotionEvent ();
- OS.memmove (xEvent, callData, XMotionEvent.sizeof);
- if (!dragging || (xEvent.state & OS.Button1Mask) == 0) return 0;
- int [] argList1 = {OS.XmNx, 0, OS.XmNy, 0, OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
- int border = argList1 [9], x = ((short) argList1 [1]) - border, y = ((short) argList1 [3]) - border;
- int width = argList1 [5] + (border * 2), height = argList1 [7] + (border * 2);
- int [] argList2 = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (parent.handle, argList2, argList2.length / 2);
- int parentBorder = argList2 [5];
- int parentWidth = argList2 [1] + (parentBorder * 2);
- int parentHeight = argList2 [3] + (parentBorder * 2);
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- newX = Math.min (Math.max (0, xEvent.x + x - startX - parentBorder), parentWidth - width);
- } else {
- newY = Math.min (Math.max (0, xEvent.y + y - startY - parentBorder), parentHeight - height);
- }
- if (newX == lastX && newY == lastY) return 0;
- drawBand (lastX, lastY, width, height);
- Event event = new Event ();
- event.detail = SWT.DRAG;
- event.time = xEvent.time;
- event.x = newX; event.y = newY;
- event.width = width; event.height = height;
- sendEvent (SWT.Selection, event);
- if (event.doit) {
- lastX = event.x; lastY = event.y;
- OS.XmUpdateDisplay (handle);
- drawBand (lastX, lastY, width, height);
- }
- return 0;
-}
-int processMouseUp (int callData) {
- super.processMouseUp (callData);
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- if (xEvent.button != 1) return 0;
- if (!dragging) return 0;
- dragging = false;
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int border = argList [5];
- int width = argList [1] + (border * 2), height = argList [3] + (border * 2);
- Event event = new Event ();
- event.time = xEvent.time;
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- drawBand (lastX, lastY, width, height);
- sendEvent (SWT.Selection, event);
- return 0;
-}
-void propagateWidget (boolean enabled) {
- propagateHandle (enabled, handle);
- /*
- * Sashes do not participate in focus traversal.
- */
- if (enabled) {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-void realizeChildren () {
- super.realizeChildren ();
- int window = OS.XtWindow (handle);
- if (window == 0) return;
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- if ((style & SWT.HORIZONTAL) != 0) {
- cursor = OS.XCreateFontCursor (display, OS.XC_sb_v_double_arrow);
- } else {
- cursor = OS.XCreateFontCursor (display, OS.XC_sb_h_double_arrow);
- }
- OS.XDefineCursor (display, window, cursor);
-}
-void releaseWidget () {
- super.releaseWidget ();
- if (cursor != 0) {
- int display = OS.XtDisplay (handle);
- if (display != 0) OS.XFreeCursor (display, cursor);
- }
- cursor = 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
deleted file mode 100755
index f6fbf68b7a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
+++ /dev/null
@@ -1,338 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent a selectable user
- * interface object that present a range of continuous
- * numeric values.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Scale extends Control {
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scale (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- Display display = getDisplay ();
- int hScroll = display.scrolledMarginX;
- int vScroll = display.scrolledMarginY;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += hScroll * 10;
- height += vScroll;
- } else {
- width += hScroll;
- height += vScroll * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int [] argList = {
- OS.XmNtitleString, 0,
- OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
- OS.XmNorientation, ((style & SWT.H_SCROLL) != 0) ? OS.XmHORIZONTAL : OS.XmVERTICAL,
- OS.XmNprocessingDirection, ((style & SWT.H_SCROLL) != 0) ? OS.XmMAX_ON_RIGHT : OS.XmMAX_ON_BOTTOM,
- OS.XmNancestorSensitive, 1,
- };
- int parentHandle = parent.handle;
- handle = OS.XmCreateScale (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- return 1;
-}
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] argList = {OS.XmNmaximum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] argList = {OS.XmNminimum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] argList = {OS.XmNscaleMultiple, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] argList = {OS.XmNvalue, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdragCallback, windowProc, SWT.Selection);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int increment) {
- checkWidget();
-}
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNmaximum, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNminimum, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int pageIncrement) {
- checkWidget();
- if (pageIncrement < 1) return;
- int [] argList = {OS.XmNscaleMultiple, pageIncrement};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int selection) {
- checkWidget();
- if (selection < 0) return;
- int [] argList = {OS.XmNvalue, selection};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ScrollBar.java
deleted file mode 100755
index 8badb23e19..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ScrollBar.java
+++ /dev/null
@@ -1,698 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given scroll bar will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the scroll bar represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, scroll bars will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, scroll bars are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the scroll bar's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the scroll bar will not change.
- * </p><p>
- * Scroll bars are created by specifying either <code>H_SCROLL</code>,
- * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
- * They are accessed from the <code>Scrollable</code> using
- * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
- * </p><p>
- * Note: Scroll bars are not Controls. On some platforms, scroll bars
- * that appear as part of some standard controls such as a text or list
- * have no operating system resources and are not children of the control.
- * For this reason, scroll bars are treated specially. To create a control
- * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see Slider
- * @see Scrollable
- * @see Scrollable#getHorizontalBar
- * @see Scrollable#getVerticalBar
- */
-public class ScrollBar extends Widget {
- Scrollable parent;
-ScrollBar () {
- /* Do Nothing */
-}
-ScrollBar (Scrollable parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
- OS.XmNorientation, ((style & SWT.H_SCROLL) != 0) ? OS.XmHORIZONTAL : OS.XmVERTICAL,
- OS.XmNtraversalOn, 0,
- };
- int parentHandle = parent.scrolledHandle;
- handle = OS.XmCreateScrollBar (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] argList = {OS.XmNsensitive, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- int [] argList = {OS.XmNincrement, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] argList = {OS.XmNmaximum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] argList = {OS.XmNminimum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] argList = {OS.XmNpageIncrement, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the receiver's parent, which must be scrollable.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Scrollable getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] argList = {OS.XmNvalue, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * For horizontal scroll bars, returns the height of the
- * instance, and for vertical scroll bars, returns the width
- * of the instance.
- *
- * @return the scroll bar size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int borders = argList [5] * 2;
- return new Point (argList [1] + borders, argList [3] + borders);
-}
-/**
- * Answers the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public int getThumb () {
- checkWidget();
- int [] argList = {OS.XmNsliderSize, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return OS.XtIsManaged (handle);
-}
-void hookEvents () {
- int windowProc = parent.getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdragCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNtoBottomCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNincrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdecrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNpageIncrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNpageDecrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNtoTopCallback, windowProc, SWT.Selection);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * <p>
- * Note: Because of the strong connection between a scroll bar
- * and the widget which contains it (its parent), a scroll bar
- * will not indicate that it is enabled if its parent is not.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return getVisible () && parent.isVisible ();
-}
-void manageChildren () {
- OS.XtManageChild (handle);
-}
-int processSelection (int callData) {
- XmAnyCallbackStruct struct = new XmAnyCallbackStruct ();
- OS.memmove (struct, callData, XmAnyCallbackStruct.sizeof);
- Event event = new Event ();
- switch (struct.reason) {
- case OS.XmCR_DRAG: event.detail = SWT.DRAG; break;
- /*
- * Do not set the detail field to SWT.DRAG
- * to indicate that the dragging has ended.
- */
-// case OS.XmCR_VALUE_CHANGED: break;
- case OS.XmCR_TO_TOP: event.detail = SWT.HOME; break;
- case OS.XmCR_TO_BOTTOM: event.detail = SWT.END; break;
- case OS.XmCR_DECREMENT: event.detail = SWT.ARROW_UP; break;
- case OS.XmCR_INCREMENT: event.detail = SWT.ARROW_DOWN; break;
- case OS.XmCR_PAGE_DECREMENT: event.detail = SWT.PAGE_UP; break;
- case OS.XmCR_PAGE_INCREMENT: event.detail = SWT.PAGE_DOWN; break;
- }
-
- /*
- * Feature in Motif. When a scroll bar is selected,
- * it does not make the shell active. The fix is to
- * make the shell active.
- */
- Shell shell = parent.getShell ();
- shell.bringToTop ();
-
- sendEvent (SWT.Selection, event);
- return 0;
-}
-void propagateWidget (boolean enabled) {
- propagateHandle (enabled, handle);
- /*
- * Scroll bars never participate in focus traversal.
- */
- if (enabled) {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-}
-void releaseChild () {
- super.releaseChild ();
- if (parent.horizontalBar == this) parent.horizontalBar = null;
- if (parent.verticalBar == this) parent.verticalBar = null;
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNincrement, value};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNmaximum, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {
- OS.XmNminimum, 0,
- OS.XmNmaximum, 0,
- OS.XmNsliderSize, 0,
- };
- /*
- * Feature in Motif. For some reason, when minimium
- * is set to be greater than or equal to maximum, Motif
- * does not set the minimum. Instead, the value is
- * changed and the minimum stays the same. This behavior
- * differs from setting the maximum where the slider size
- * is always decreased to make room for the new maximum.
- * The fix is to decrease the slider to make room for
- * the new minimum.
- */
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [3] - value - argList [5] < 0) {
- argList [5] = argList [3] - value;
- }
- argList [1] = value;
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNpageIncrement, value};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int selection) {
- checkWidget();
- if (selection < 0) return;
- int [] argList = {OS.XmNvalue, selection};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNsliderSize, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int [] argList = {
- OS.XmNvalue, selection,
- OS.XmNminimum, minimum,
- OS.XmNmaximum, maximum,
- OS.XmNsliderSize, thumb,
- OS.XmNincrement, increment,
- OS.XmNpageIncrement, pageIncrement,
- };
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- /*
- * Feature in Motif. Hiding or showing a scroll bar
- * can cause the widget to automatically resize in
- * the OS. This behavior is unwanted. The fix is
- * to force the widget to resize to original size.
- */
- int scrolledHandle = parent.scrolledHandle;
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
-
- /* Hide or show the scroll bar */
- if (visible) {
- OS.XtManageChild (handle);
- } else {
- OS.XtUnmanageChild (handle);
- }
-
- /* Restore the size */
- OS.XtSetValues (scrolledHandle, argList, argList.length / 2);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java
deleted file mode 100755
index 6f924b85ba..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java
+++ /dev/null
@@ -1,309 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all classes which
- * represent controls that have standard scroll bars.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>H_SCROLL, V_SCROLL</dd>
- * <dt><b>Events:</b>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Scrollable extends Control {
- int scrolledHandle, formHandle;
- ScrollBar horizontalBar, verticalBar;
-Scrollable () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scrollable (Composite parent, int style) {
- super (parent, style);
-}
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getClientArea
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- int border = getBorderWidth ();
- int trimX = x - border, trimY = y - border;
- int trimWidth = width + (border * 2), trimHeight = height + (border * 2);
- if (horizontalBar != null) {
- Display display = getDisplay ();
- trimY -= display.scrolledInsetY;
- trimHeight += display.scrolledInsetY + display.scrolledMarginY;
- if (verticalBar == null) {
- trimX -= display.scrolledInsetX;
- trimWidth += display.scrolledInsetX * 2;
- trimHeight -= display.scrolledInsetY * 2;
- }
- }
- if (verticalBar != null) {
- Display display = getDisplay ();
- trimX -= display.scrolledInsetX;
- trimWidth += display.scrolledInsetX + display.scrolledMarginX;
- if (horizontalBar == null) {
- trimY -= display.scrolledInsetY;
- trimHeight += display.scrolledInsetY * 2;
- trimWidth -= display.scrolledInsetX * 2;
- }
- }
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-ScrollBar createScrollBar (int type) {
- return new ScrollBar (this, type);
-}
-ScrollBar createStandardBar (int style) {
- if (scrolledHandle == 0) return null;
- ScrollBar bar = new ScrollBar ();
- bar.parent = this;
- bar.style = style;
- bar.state |= HANDLE;
- int [] argList = {OS.XmNhorizontalScrollBar, 0, OS.XmNverticalScrollBar, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- if (style == SWT.H_SCROLL) bar.handle = argList [1];
- if (style == SWT.V_SCROLL) bar.handle = argList [3];
- bar.hookEvents ();
- bar.register ();
- return bar;
-}
-void createWidget (int index) {
- super.createWidget (index);
- if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
- if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
-}
-void deregister () {
- super.deregister ();
- if (formHandle != 0) WidgetTable.remove (formHandle);
- if (scrolledHandle != 0) WidgetTable.remove (scrolledHandle);
-}
-void enableWidget (boolean enabled) {
- super.enableWidget (enabled);
- if (formHandle != 0) enableHandle (enabled, formHandle);
- if (scrolledHandle != 0) {
- enableHandle (enabled, scrolledHandle);
- int [] argList = {
- OS.XmNhorizontalScrollBar, 0,
- OS.XmNverticalScrollBar, 0,
- };
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- if (argList [1] != 0) enableHandle (enabled, argList [1]);
- if (argList [3] != 0) enableHandle (enabled, argList [3]);
- }
-}
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data (that is,
- * not covered by the "trimmings").
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeTrim
- */
-public Rectangle getClientArea () {
- checkWidget();
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return new Rectangle (0, 0, argList [1], argList [3]);
-}
-/**
- * Returns the receiver's horizontal scroll bar if it has
- * one, and null if it does not.
- *
- * @return the horizontal scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getHorizontalBar () {
- checkWidget();
- return horizontalBar;
-}
-/**
- * Returns the receiver's vertical scroll bar if it has
- * one, and null if it does not.
- *
- * @return the vertical scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getVerticalBar () {
- checkWidget();
- return verticalBar;
-}
-boolean isTabGroup () {
- if ((state & CANVAS) != 0) return true;
- return super.isTabGroup ();
-}
-void manageChildren () {
- if (scrolledHandle != 0) {
- OS.XtSetMappedWhenManaged (scrolledHandle, false);
- OS.XtManageChild (scrolledHandle);
- }
- if (formHandle != 0) {
- OS.XtSetMappedWhenManaged (formHandle, false);
- OS.XtManageChild (formHandle);
- }
- super.manageChildren ();
- if (formHandle != 0) {
- int [] argList = {OS.XmNborderWidth, 0};
- OS.XtGetValues (formHandle, argList, argList.length / 2);
- OS.XtResizeWidget (formHandle, 1, 1, argList [1]);
- OS.XtSetMappedWhenManaged (formHandle, true);
- }
- if (scrolledHandle != 0) {
- int [] argList = {OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- OS.XtResizeWidget (scrolledHandle, 1, 1, argList [1]);
- OS.XtSetMappedWhenManaged (scrolledHandle, true);
- }
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- if (formHandle != 0) propagateHandle (enabled, formHandle);
- if (scrolledHandle != 0) {
- propagateHandle (enabled, scrolledHandle);
- if (horizontalBar != null) horizontalBar.propagateWidget (enabled);
- if (verticalBar != null) verticalBar.propagateWidget (enabled);
- }
-}
-void redrawWidget (int x, int y, int width, int height, boolean all) {
- super.redrawWidget (x, y, width, height, all);
- /*
- * Uncomment this code to force the window trimmings to redraw.
- */
-// if (formHandle == 0 && scrolledHandle == 0) return;
-// short [] root_x = new short [1], root_y = new short [1];
-// OS.XtTranslateCoords (handle, (short) x, (short) y, root_x, root_y);
-// if (formHandle != 0) {
-// short [] form_x = new short [1], form_y = new short [1];
-// OS.XtTranslateCoords (formHandle, (short) 0, (short) 0, form_x, form_y);
-// redrawHandle (root_x [0] - form_x [0], root_y [0] - form_y [0], width, height, formHandle);
-// }
-// if (scrolledHandle != 0) {
-// short [] scrolled_x = new short [1], scrolled_y = new short [1];
-// OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, scrolled_x, scrolled_y);
-// redrawHandle (root_x [0] - scrolled_x [0], root_y [0] - scrolled_y [0], width, height, scrolledHandle);
-// if (horizontalBar != null && horizontalBar.getVisible ()) {
-// int horizontalHandle = horizontalBar.handle;
-// short [] hscroll_x = new short [1], hscroll_y = new short [1];
-// OS.XtTranslateCoords (horizontalHandle, (short) 0, (short) 0, hscroll_x, hscroll_y);
-// redrawHandle (root_x [0] - hscroll_x [0], root_y [0] - hscroll_y [0], width, height, horizontalHandle);
-// }
-// if (verticalBar != null && verticalBar.getVisible ()) {
-// int verticalHandle = verticalBar.handle;
-// short [] vscroll_x = new short [1], vscroll_y = new short [1];
-// OS.XtTranslateCoords (verticalHandle, (short) 0, (short) 0, vscroll_x, vscroll_y);
-// redrawHandle (root_x [0] - vscroll_x [0], root_y [0] - vscroll_y [0], width, height, verticalHandle);
-// }
-// }
-}
-void register () {
- super.register ();
- if (formHandle != 0) WidgetTable.put (formHandle, this);
- if (scrolledHandle != 0) WidgetTable.put (scrolledHandle, this);
-}
-void releaseHandle () {
- super.releaseHandle ();
- scrolledHandle = formHandle = 0;
-}
-void releaseWidget () {
- if (horizontalBar != null) {
- horizontalBar.releaseWidget ();
- horizontalBar.releaseHandle ();
- }
- if (verticalBar != null) {
- verticalBar.releaseWidget ();
- verticalBar.releaseHandle ();
- }
- horizontalBar = verticalBar = null;
- super.releaseWidget ();
-}
-void setBackgroundPixel (int pixel) {
- super.setBackgroundPixel (pixel);
- if (scrolledHandle != 0) {
- int [] argList1 = {
- OS.XmNhorizontalScrollBar, 0,
- OS.XmNverticalScrollBar, 0,
- };
- OS.XtGetValues (scrolledHandle, argList1, argList1.length / 2);
- if (argList1 [1] != 0) OS.XmChangeColor (argList1 [1], pixel);
- if (argList1 [3] != 0) OS.XmChangeColor (argList1 [3], pixel);
- }
-}
-int topHandle () {
- if (scrolledHandle != 0) return scrolledHandle;
- if (formHandle != 0) return formHandle;
- return handle;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
deleted file mode 100755
index ea7545bdc9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
+++ /dev/null
@@ -1,1166 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent the "windows"
- * which the desktop or "window manager" is managing.
- * Instances that do not have a parent (that is, they
- * are built using the constructor, which takes a
- * <code>Display</code> as the argument) are described
- * as <em>top level</em> shells. Instances that do have
- * a parent are described as <em>secondary</em> or
- * <em>dialog</em> shells.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations
- * and modality. For example, some window managers only
- * support resizable windows and will always assume the
- * RESIZE style, even if it is not set. In addition, if a
- * modality style is not supported, it is "upgraded" to a
- * more restrictive modality style that is supported. For
- * example, if <code>PRIMARY_MODAL</code> is not supported,
- * it would be upgraded to <code>APPLICATION_MODAL</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * </p>
- * <p>
- * IMPORTANT: This class is not intended to be subclassed.
- * </p>
- *
- * @see Decorations
- * @see SWT
- */
-public class Shell extends Decorations {
- Display display;
- int shellHandle;
- boolean reparented, realized;
- int oldX, oldY, oldWidth, oldHeight;
- Control lastActive;
-
- static final byte [] WM_DELETE_WINDOW = Converter.wcsToMbcs(null, "WM_DELETE_WINDOW\0");
-/**
- * Constructs a new instance of this class. This is equivalent
- * to calling <code>Shell((Display) null)</code>.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell () {
- this ((Display) null);
-}
-/**
- * Constructs a new instance of this class given only the style
- * value describing its behavior and appearance. This is equivalent
- * to calling <code>Shell((Display) null, style)</code>.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (int style) {
- this ((Display) null, style);
-}
-/**
- * Constructs a new instance of this class given only the display
- * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display) {
- this (display, SWT.SHELL_TRIM);
-}
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display, int style) {
- this (display, null, style, 0);
-}
-Shell (Display display, Shell parent, int style, int handle) {
- super ();
- checkSubclass ();
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.parent = parent;
- this.display = display;
- this.handle = handle;
- createWidget (0);
-}
-/**
- * Constructs a new instance of this class given only its
- * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent) {
- this (parent, SWT.DIALOG_TRIM);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent, int style) {
- this (parent != null ? parent.getDisplay () : null, parent, style, 0);
-}
-
-static int checkStyle (int style) {
- style = Decorations.checkStyle (style);
- int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
- int bits = style & ~mask;
- if ((style & SWT.SYSTEM_MODAL) != 0) return bits | SWT.SYSTEM_MODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) return bits | SWT.APPLICATION_MODAL;
- if ((style & SWT.PRIMARY_MODAL) != 0) return bits | SWT.PRIMARY_MODAL;
- return bits;
-}
-
-public static Shell motif_new (Display display, int handle) {
- return new Shell (display, null, SWT.NO_TRIM, handle);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when operations are performed on the receiver,
- * by sending the listener one of the messages defined in the
- * <code>ShellListener</code> interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #removeShellListener
- */
-public void addShellListener(ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Activate,typedListener);
- addListener(SWT.Close,typedListener);
- addListener(SWT.Deactivate,typedListener);
- addListener(SWT.Iconify,typedListener);
- addListener(SWT.Deiconify,typedListener);
-}
-void adjustTrim () {
- if (OS.XtIsSubclass (shellHandle, OS.OverrideShellWidgetClass ())) {
- return;
- }
-
- /* Query the trim insets */
- int shellWindow = OS.XtWindow (shellHandle);
- if (shellWindow == 0) return;
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0) return;
-
- /* Find the direct child of the root window */
- int [] unused = new int [1];
- int [] rootWindow = new int [1];
- int [] parent = new int [1];
- int [] ptr = new int [1];
- int trimWindow = shellWindow;
- OS.XQueryTree (xDisplay, trimWindow, rootWindow, parent, ptr, unused);
- if (ptr [0] != 0) OS.XFree (ptr [0]);
- if (parent [0] == 0) return;
- while (parent [0] != rootWindow [0]) {
- trimWindow = parent [0];
- OS.XQueryTree (xDisplay, trimWindow, unused, parent, ptr, unused);
- if (ptr [0] != 0) OS.XFree (ptr [0]);
- if (parent [0] == 0) return;
- }
-
- /**
- * Translate the coordinates of the shell window to the
- * coordinates of the direct child of the root window
- */
- if (shellWindow == trimWindow) return;
-
- /* Query the border width of the direct child of the root window */
- int [] trimBorder = new int [1];
- int [] trimWidth = new int [1];
- int [] trimHeight = new int [1];
- OS.XGetGeometry (xDisplay, trimWindow, unused, unused, unused, trimWidth, trimHeight, trimBorder, unused);
-
- /* Query the border width of the direct child of the shell window */
- int [] shellBorder = new int [1];
- int [] shellWidth = new int [1];
- int [] shellHeight = new int [1];
- OS.XGetGeometry (xDisplay, shellWindow, unused, unused, unused, shellWidth, shellHeight, shellBorder, unused);
-
- /* Calculate the trim */
- int width = (trimWidth [0] + (trimBorder [0] * 2)) - (shellWidth [0] + (shellBorder [0] * 2));
- int height = (trimHeight [0] + (trimBorder [0] * 2)) - (shellHeight [0] + (shellBorder [0] * 2));
-
- /* Update the trim guesses to match the query */
- boolean hasTitle = false, hasResize = false, hasBorder = false;
- if ((style & SWT.NO_TRIM) == 0) {
- hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
- hasResize = (style & SWT.RESIZE) != 0;
- hasBorder = (style & SWT.BORDER) != 0;
- }
- if (hasTitle) {
- if (hasResize) {
- display.titleResizeTrimWidth = width;
- display.titleResizeTrimHeight = height;
- return;
- }
- if (hasBorder) {
- display.titleBorderTrimWidth = width;
- display.titleBorderTrimHeight = height;
- return;
- }
- display.titleTrimWidth = width;
- display.titleTrimHeight = height;
- return;
- }
- if (hasResize) {
- display.resizeTrimWidth = width;
- display.resizeTrimHeight = height;
- return;
- }
- if (hasBorder) {
- display.borderTrimWidth = width;
- display.borderTrimHeight = height;
- return;
- }
-}
-/**
- * Requests that the window manager close the receiver in
- * the same way it would be closed when the user clicks on
- * the "close box" or performs some other platform specific
- * key or mouse combination that indicates the window
- * should be removed.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget();
- closeWidget ();
-}
-void closeWidget () {
- if (!isEnabled ()) return;
- Control widget = parent;
- while (widget != null && !(widget.getShell ().isModal ())) {
- widget = widget.parent;
- }
- if (widget == null) {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (shell != this && shell.isModal () && shell.isVisible ()) {
- shell.bringToTop ();
- return;
- }
- }
- }
- Event event = new Event ();
- sendEvent (SWT.Close, event);
- if (event.doit && !isDisposed ()) dispose ();
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- Rectangle trim = super.computeTrim (x, y, width, height);
- int trimWidth = trimWidth (), trimHeight = trimHeight ();
- trim.x -= trimWidth / 2; trim.y -= trimHeight - (trimWidth / 2);
- trim.width += trimWidth; trim.height += trimHeight + imeHeight ();
- return trim;
-}
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
- int decorations = 0;
- if ((style & SWT.NO_TRIM) == 0) {
- if ((style & SWT.MIN) != 0) decorations |= OS.MWM_DECOR_MINIMIZE;
- if ((style & SWT.MAX) != 0) decorations |= OS.MWM_DECOR_MAXIMIZE;
- if ((style & SWT.RESIZE) != 0) decorations |= OS.MWM_DECOR_RESIZEH;
- if ((style & SWT.BORDER) != 0) decorations |= OS.MWM_DECOR_BORDER;
- if ((style & SWT.MENU) != 0) decorations |= OS.MWM_DECOR_MENU;
- if ((style & SWT.TITLE) != 0) decorations |= OS.MWM_DECOR_TITLE;
- /*
- * Feature in Motif. Under some Window Managers (Sawmill), in order
- * to get any border at all from the window manager it is necessary
- * to set MWM_DECOR_BORDER. The fix is to force these bits when any
- * kind of border is requested.
- */
- if ((style & SWT.RESIZE) != 0) decorations |= OS.MWM_DECOR_BORDER;
- }
-
- /*
- * Note: Motif treats the modal values as hints to the Window Manager.
- * For example, Enlightenment treats all modes except for SWT.MODELESS
- * as SWT.APPLICATION_MODAL. The Motif Window Manager honours all modes.
- */
- int inputMode = OS.MWM_INPUT_MODELESS;
- if ((style & SWT.PRIMARY_MODAL) != 0) inputMode = OS.MWM_INPUT_PRIMARY_APPLICATION_MODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) inputMode = OS.MWM_INPUT_FULL_APPLICATION_MODAL;
- if ((style & SWT.SYSTEM_MODAL) != 0) inputMode = OS.MWM_INPUT_SYSTEM_MODAL;
-
- /*
- * Bug in Motif. For some reason, if the title string
- * length is not a multiple of 4, Motif occasionally
- * draws garbage after the last character in the title.
- * The fix is to pad the title.
- */
- byte [] buffer = {(byte)' ', 0, 0, 0};
- int ptr = OS.XtMalloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] argList1 = {
- OS.XmNmwmInputMode, inputMode,
- OS.XmNmwmDecorations, decorations,
- OS.XmNoverrideRedirect, (style & SWT.ON_TOP) != 0 ? 1 : 0,
- OS.XmNtitle, ptr,
- };
- byte [] appClass = display.appClass;
- if (parent == null && (style & SWT.ON_TOP) == 0) {
- int xDisplay = display.xDisplay;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (display.appName, appClass, widgetClass, xDisplay, argList1, argList1.length / 2);
- } else {
- int widgetClass = OS.TransientShellWidgetClass ();
-// if ((style & SWT.ON_TOP) != 0) {
-// widgetClass = OS.OverrideShellWidgetClass ();
-// }
- int parentHandle = display.shellHandle;
- if (parent != null) parentHandle = parent.handle;
- shellHandle = OS.XtCreatePopupShell (appClass, widgetClass, parentHandle, argList1, argList1.length / 2);
- }
- OS.XtFree (ptr);
- if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- /* Create scrolled handle */
- createScrolledHandle (shellHandle);
-
- /*
- * Feature in Motif. There is no way to get the single pixel
- * border surrounding a TopLevelShell or a TransientShell.
- * Also, attempts to set a border on either the shell handle
- * or the main window handle fail. The fix is to set the border
- * on the client area.
- */
- if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.RESIZE)) == 0) {
- int [] argList2 = {OS.XmNborderWidth, 1};
- OS.XtSetValues (handle, argList2, argList2.length / 2);
- }
-
- /*
- * Feature in Motif. There is no Motif API to negociate for the
- * status line. The fix is to force the status line to appear
- * by creating a hidden text widget. This is much safer than
- * using X API because this may conflict with Motif.
- *
- * Note that XmNtraversalOn must be set to FALSE or the shell
- * will not take focus when the user clicks on it.
- */
- int [] argList3 = {OS.XmNtraversalOn, 0};
- int textHandle = OS.XmCreateTextField (handle, null, argList3, argList3.length / 2);
- if (textHandle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-void deregister () {
- super.deregister ();
- WidgetTable.remove (shellHandle);
-}
-void destroyWidget () {
- /*
- * Hide the shell before calling XtDestroyWidget ()
- * so that the shell will disappear without having
- * to dispatch events. Otherwise, the user will be
- * able to interact with the trimmings between the
- * time that the shell is destroyed and the next
- * event is dispatched.
- */
- if (OS.XtIsRealized (shellHandle)) {
- if (OS.XtIsTopLevelShell (shellHandle)) {
- OS.XtUnmapWidget (shellHandle);
- } else {
- OS.XtPopdown (shellHandle);
- }
- }
- super.destroyWidget ();
-}
-
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed()) return;
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when the dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
-// Display oldDisplay = display;
-
- /*
- * Feature in Motif. When an override-redirected shell
- * is disposed, Motif does not assign a new active top
- * level shell. The parent shell appears to be active,
- * but XGetInputFocus returns the root window, not the
- * parent. The fix is to make the parent be the active
- * top level shell when the child shell is disposed.
- */
- Composite parent = this.parent;
- int [] argList = {OS.XmNoverrideRedirect, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- super.dispose ();
- if (parent != null && argList [1] != 0) {
- Shell shell = parent.getShell ();
- shell.bringToTop ();
- }
-
- /*
- * This code intentionally commented.
- */
-// if (oldDisplay != null) oldDisplay.update ();
-}
-void enableWidget (boolean enabled) {
- super.enableWidget (enabled);
- enableHandle (enabled, shellHandle);
-}
-public int getBorderWidth () {
- checkWidget();
- int [] argList = {OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- return argList [1];
-}
-public Rectangle getBounds () {
- checkWidget();
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, root_x, root_y);
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- int border = argList [5];
- int trimWidth = trimWidth (), trimHeight = trimHeight ();
- int width = argList [1] + trimWidth + (border * 2);
- int height = argList [3] + trimHeight + (border * 2);
- return new Rectangle (root_x [0], root_y [0], width, height);
-}
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-/**
- * Returns the receiver's input method editor mode. This
- * will be the result of bitwise OR'ing together one or
- * more of the following constants defined in class
- * <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @return the IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public int getImeInputMode () {
- checkWidget();
- return SWT.NONE;
-}
-public Point getLocation () {
- checkWidget();
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, root_x, root_y);
- return new Point (root_x [0], root_y [0]);
-}
-public Shell getShell () {
- checkWidget();
- return this;
-}
-/**
- * Returns an array containing all shells which are
- * descendents of the receiver.
- * <p>
- * @return the dialog shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkWidget();
- int count = 0;
- Shell [] shells = display.getShells ();
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) count++;
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) {
- result [index++] = shells [i];
- }
- }
- return result;
-}
-public Point getSize () {
- checkWidget();
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0, OS.XmNborderWidth, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- int border = argList [5];
- int trimWidth = trimWidth (), trimHeight = trimHeight ();
- int width = argList [1] + trimWidth + (border * 2);
- int height = argList [3] + trimHeight + (border * 2);
- return new Point (width, height);
-}
-public boolean getVisible () {
- checkWidget();
- if (!OS.XtIsRealized (handle)) return false;
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return false;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return false;
- XWindowAttributes attributes = new XWindowAttributes ();
- OS.XGetWindowAttributes (xDisplay, xWindow, attributes);
- if (attributes.map_state == OS.IsViewable) return true;
- int [] argList = {OS.XmNmappedWhenManaged, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- return minimized && attributes.map_state == OS.IsUnviewable && argList [1] != 0;
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = display.windowProc;
-// OS.XtAddEventHandler (shellHandle, OS.StructureNotifyMask, false, windowProc, SWT.Resize);
- OS.XtInsertEventHandler (shellHandle, OS.StructureNotifyMask, false, windowProc, SWT.Resize, OS.XtListTail);
- if (OS.XtIsSubclass (shellHandle, OS.OverrideShellWidgetClass ())) return;
- OS.XtInsertEventHandler (shellHandle, OS.FocusChangeMask, false, windowProc, SWT.FocusIn, OS.XtListTail);
- int [] argList = {OS.XmNdeleteResponse, OS.XmDO_NOTHING};
- OS.XtSetValues (shellHandle, argList, argList.length / 2);
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay != 0) {
- int atom = OS.XmInternAtom (xDisplay, WM_DELETE_WINDOW, false);
- OS.XmAddWMProtocolCallback (shellHandle, atom, windowProc, SWT.Dispose);
- }
-}
-int imeHeight () {
- if (!IsDBLocale) return 0;
-// realizeWidget ();
- int [] argList1 = {OS.XmNheight, 0};
- OS.XtGetValues (shellHandle, argList1, argList1.length / 2);
- int [] argList2 = {OS.XmNheight, 0};
- OS.XtGetValues (scrolledHandle, argList2, argList2.length / 2);
- return argList1 [1] - argList2 [1];
-}
-public boolean isEnabled () {
- checkWidget();
- return getEnabled ();
-}
-boolean isModal () {
- checkWidget();
- int [] argList = {OS.XmNmwmInputMode, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- return (argList [1] != -1 && argList [1] != OS.MWM_INPUT_MODELESS);
-}
-public boolean isVisible () {
- checkWidget();
- return getVisible ();
-}
-void manageChildren () {
- OS.XtSetMappedWhenManaged (shellHandle, false);
- super.manageChildren ();
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0) return;
- int width = OS.XDisplayWidth (xDisplay, OS.XDefaultScreen (xDisplay)) * 5 / 8;
- int height = OS.XDisplayHeight (xDisplay, OS.XDefaultScreen (xDisplay)) * 5 / 8;
- OS.XtResizeWidget (shellHandle, width, height, 0);
-}
-/**
- * Moves the receiver to the top of the drawing order for
- * the display on which it was created (so that all other
- * shells on that display, which are not the receiver's
- * children will be drawn behind it), marks it visible,
- * and sets focus to its default button (if it has one).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Control#setVisible
- * @see Decorations#setDefaultButton
-*/
-public void open () {
- checkWidget();
- setVisible (true);
-}
-int processDispose (int callData) {
- closeWidget ();
- return 0;
-}
-
-int processResize (int callData) {
- XConfigureEvent xEvent = new XConfigureEvent ();
- OS.memmove (xEvent, callData, XConfigureEvent.sizeof);
- switch (xEvent.type) {
- case OS.ReparentNotify: {
- if (reparented) return 0;
- reparented = true;
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, root_x, root_y);
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- xEvent.x = root_x [0]; xEvent.y = root_y [0];
- xEvent.width = argList [1]; xEvent.height = argList [3];
- // FALL THROUGH
- }
- case OS.ConfigureNotify:
- if (!reparented) return 0;
- if (oldX != xEvent.x || oldY != xEvent.y) sendEvent (SWT.Move);
- if (oldWidth != xEvent.width || oldHeight != xEvent.height) {
- XAnyEvent event = new XAnyEvent ();
- display.resizeWindow = xEvent.window;
- display.resizeWidth = xEvent.width;
- display.resizeHeight = xEvent.height;
- display.resizeCount = 0;
- int checkResizeProc = display.checkResizeProc;
- OS.XCheckIfEvent (xEvent.display, event, checkResizeProc, 0);
- if (display.resizeCount == 0) {
- sendEvent (SWT.Resize);
- if (layout != null) layout (false);
- }
- }
- if (xEvent.x != 0) oldX = xEvent.x;
- if (xEvent.y != 0) oldY = xEvent.y;
- oldWidth = xEvent.width;
- oldHeight = xEvent.height;
- return 0;
- case OS.UnmapNotify:
- int [] argList = {OS.XmNmappedWhenManaged, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- if (argList [1] != 0) {
- minimized = true;
- sendEvent (SWT.Iconify);
- }
- return 0;
- case OS.MapNotify:
- if (minimized) {
- minimized = false;
- sendEvent (SWT.Deiconify);
- }
- return 0;
- }
- return 0;
-}
-
-int processSetFocus (int callData) {
- XFocusChangeEvent xEvent = new XFocusChangeEvent ();
- OS.memmove (xEvent, callData, XFocusChangeEvent.sizeof);
- int handle = OS.XtWindowToWidget (xEvent.display, xEvent.window);
- if (handle != shellHandle) return super.processSetFocus (callData);
- if (xEvent.mode != OS.NotifyNormal) return 0;
- if (xEvent.detail != OS.NotifyNonlinear) return 0;
- switch (xEvent.type) {
- case OS.FocusIn:
- postEvent (SWT.Activate);
- break;
- case OS.FocusOut:
- postEvent (SWT.Deactivate);
- break;
- }
- return 0;
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- propagateHandle (enabled, shellHandle);
-}
-void realizeWidget () {
- if (realized) return;
- OS.XtRealizeWidget (shellHandle);
- realizeChildren ();
- realized = true;
-}
-void register () {
- super.register ();
- WidgetTable.put (shellHandle, this);
-}
-void releaseHandle () {
- super.releaseHandle ();
- shellHandle = 0;
-}
-void releaseShells () {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- shell.releaseWidget ();
- shell.releaseHandle ();
- }
- }
-}
-void releaseWidget () {
- releaseShells ();
- super.releaseWidget ();
- display = null;
- lastActive = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when operations are performed on the receiver.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #addShellListener
- */
-public void removeShellListener(ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Activate, listener);
- eventTable.unhook(SWT.Close, listener);
- eventTable.unhook(SWT.Deactivate, listener);
- eventTable.unhook(SWT.Iconify,listener);
- eventTable.unhook(SWT.Deiconify,listener);
-}
-void saveBounds () {
- if (!reparented) return;
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, root_x, root_y);
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (scrolledHandle, argList, argList.length / 2);
- int trimWidth = trimWidth (), trimHeight = trimHeight ();
- oldX = root_x [0] - trimWidth; oldY = root_y [0] - trimHeight;
- oldWidth = argList [1]; oldHeight = argList [3];
-}
-
-void setActiveControl (Control control) {
- if (control != null && control.isDisposed ()) control = null;
- if (lastActive != null && lastActive.isDisposed ()) lastActive = null;
- if (lastActive == control) return;
-
- /*
- * Compute the list of controls to be activated and
- * deactivated by finding the first common parent
- * control.
- */
- Control [] activate = (control == null) ? new Control[0] : control.getPath ();
- Control [] deactivate = (lastActive == null) ? new Control[0] : lastActive.getPath ();
- lastActive = control;
- int index = 0, length = Math.min (activate.length, deactivate.length);
- while (index < length) {
- if (activate [index] != deactivate [index]) break;
- index++;
- }
-
- /*
- * It is possible (but unlikely), that application
- * code could have destroyed some of the widgets. If
- * this happens, keep processing those widgets that
- * are not disposed.
- */
- for (int i=deactivate.length-1; i>=index; --i) {
- if (!deactivate [i].isDisposed ()) {
- deactivate [i].sendEvent (SWT.Deactivate);
- }
- }
- for (int i=activate.length-1; i>=index; --i) {
- if (!activate [i].isDisposed ()) {
- activate [i].sendEvent (SWT.Activate);
- }
- }
-}
-
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- /*
- * Feature in Motif. Motif will not allow a window
- * to have a zero width or zero height. The fix is
- * to ensure these values are never zero.
- */
- saveBounds ();
- int newWidth = Math.max (width - trimWidth (), 1);
- int newHeight = Math.max (height - trimHeight (), 1);
- if (!reparented) {
- super.setBounds (x, y, newWidth, newHeight);
- return;
- }
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- OS.XtConfigureWidget (shellHandle, x, y, newWidth, newHeight, 0);
- if (isFocus) caret.setFocus ();
-}
-/**
- * Sets the input method editor mode to the argument which
- * should be the result of bitwise OR'ing together one or more
- * of the following constants defined in class <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @param mode the new IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public void setImeInputMode (int mode) {
- checkWidget();
-}
-public void setLocation (int x, int y) {
- checkWidget();
- saveBounds ();
- if (!reparented) {
- super.setLocation(x, y);
- return;
- }
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- OS.XtMoveWidget (shellHandle, x, y);
- if (isFocus) caret.setFocus ();
-}
-public void setMinimized (boolean minimized) {
- checkWidget();
-
- /*
- * Bug in MOTIF. For some reason, the receiver does not keep the
- * value of the XmNiconic resource up to date when the user minimizes
- * and restores the window. As a result, a window that is minimized
- * by the user and then restored by the programmer is not restored.
- * This happens because the XmNiconic resource is unchanged when the
- * window is minimized by the user and subsequent attempts to set the
- * resource fail because the new value of the resource is the same as
- * the old value. The fix is to force XmNiconic to be up to date
- * before setting the desired value.
- */
- int [] argList = {OS.XmNiconic, 0};
- OS.XtGetValues (shellHandle, argList, argList.length / 2);
- if ((argList [1] != 0) != this.minimized) {
- argList [1] = this.minimized ? 1 : 0;
- OS.XtSetValues (shellHandle, argList, argList.length / 2);
- }
-
- /* Minimize or restore the shell */
- argList [1] = (this.minimized = minimized) ? 1 : 0;
- OS.XtSetValues (shellHandle, argList, argList.length / 2);
-
- /* Force the XWindowAttributes to be up to date */
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay != 0) OS.XSync (xDisplay, false);
-}
-
-public void setSize (int width, int height) {
- checkWidget();
- /*
- * Feature in Motif. Motif will not allow a window
- * to have a zero width or zero height. The fix is
- * to ensure these values are never zero.
- */
- saveBounds ();
- int newWidth = Math.max (width - trimWidth (), 1);
- int newHeight = Math.max (height - trimHeight (), 1);
- if (!reparented) {
- super.setSize(newWidth, newHeight);
- return;
- }
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- OS.XtResizeWidget (shellHandle, newWidth, newHeight, 0);
- if (isFocus) caret.setFocus ();
-}
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
-
- /*
- * Feature in Motif. It is not possible to set a shell
- * title to an empty string. The fix is to set the title
- * to be a single space.
- */
- /* Use the character encoding for the default locale */
- if (string.length () == 0) string = " ";
- byte [] buffer1 = Converter.wcsToMbcs (null, string, true);
- int length = buffer1.length - 1;
-
- /*
- * Bug in Motif. For some reason, if the title string
- * length is not a multiple of 4, Motif occasionally
- * draws garbage after the last character in the title.
- * The fix is to pad the title.
- */
- byte [] buffer2 = buffer1;
- if ((length % 4) != 0) {
- buffer2 = new byte [(length + 3) / 4 * 4];
- System.arraycopy (buffer1, 0, buffer2, 0, length);
- }
-
- /* Set the title for the shell */
- int ptr = OS.XtMalloc (buffer2.length + 1);
- OS.memmove (ptr, buffer2, buffer2.length);
- int [] argList = {OS.XmNtitle, ptr};
- OS.XtSetValues (shellHandle, argList, argList.length / 2);
- OS.XtFree (ptr);
-}
-public void setVisible (boolean visible) {
- checkWidget();
- realizeWidget ();
-
- /* Show the shell */
- if (visible) {
-
- /* Map the widget */
- OS.XtSetMappedWhenManaged (shellHandle, true);
- if (OS.XtIsTopLevelShell (shellHandle)) {
- OS.XtMapWidget (shellHandle);
- } else {
- OS.XtPopup (shellHandle, OS.XtGrabNone);
- }
-
- /*
- * Force the shell to be fully exposed before returning.
- * This ensures that the shell coordinates are correct
- * when queried directly after showing the shell.
- */
- do {
- display.update ();
- } while (!isVisible ());
- adjustTrim ();
-
- /* Set the saved focus widget */
- if (savedFocus != null && !savedFocus.isDisposed ()) {
- savedFocus.setFocus ();
- }
- savedFocus = null;
-
- sendEvent (SWT.Show);
- return;
- }
-
- /* Hide the shell */
- OS.XtSetMappedWhenManaged (shellHandle, false);
- if (OS.XtIsTopLevelShell (shellHandle)) {
- OS.XtUnmapWidget (shellHandle);
- } else {
- OS.XtPopdown (shellHandle);
- }
-
- /* If the shell is iconified, hide the icon */
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0) return;
- OS.XWithdrawWindow (xDisplay, xWindow, OS.XDefaultScreen (xDisplay));
-
- sendEvent (SWT.Hide);
-}
-int topHandle () {
- return shellHandle;
-}
-int trimHeight () {
- if ((style & SWT.NO_TRIM) != 0) return 0;
- boolean hasTitle = false, hasResize = false, hasBorder = false;
- hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
- hasResize = (style & SWT.RESIZE) != 0;
- hasBorder = (style & SWT.BORDER) != 0;
- if (hasTitle) {
- if (hasResize) return display.titleResizeTrimHeight;
- if (hasBorder) return display.titleBorderTrimHeight;
- return display.titleTrimHeight;
- }
- if (hasResize) return display.resizeTrimHeight;
- if (hasBorder) return display.borderTrimHeight;
- return 0;
-}
-int trimWidth () {
- if ((style & SWT.NO_TRIM) != 0) return 0;
- boolean hasTitle = false, hasResize = false, hasBorder = false;
- hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
- hasResize = (style & SWT.RESIZE) != 0;
- hasBorder = (style & SWT.BORDER) != 0;
- if (hasTitle) {
- if (hasResize) return display.titleResizeTrimWidth;
- if (hasBorder) return display.titleBorderTrimWidth;
- return display.titleTrimWidth;
- }
- if (hasResize) return display.resizeTrimWidth;
- if (hasBorder) return display.borderTrimWidth;
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Slider.java
deleted file mode 100755
index f8cbf10cdf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Slider.java
+++ /dev/null
@@ -1,512 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given slider will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the slider represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, sliders will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, sliders are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the slider's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the slider will not change.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see ScrollBar
- */
-public class Slider extends Control {
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Slider (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- Display display = getDisplay ();
- int hScroll = display.scrolledMarginX;
- int vScroll = display.scrolledMarginY;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += hScroll * 10;
- height += vScroll;
- } else {
- width += hScroll;
- height += vScroll * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int [] argList = {
- OS.XmNancestorSensitive, 1,
- OS.XmNhighlightThickness, display.textHighlightThickness,
- OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
- OS.XmNorientation, ((style & SWT.H_SCROLL) != 0) ? OS.XmHORIZONTAL : OS.XmVERTICAL,
- };
- int parentHandle = parent.handle;
- handle = OS.XmCreateScrollBar (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- int [] argList = {OS.XmNincrement, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] argList = {OS.XmNmaximum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] argList = {OS.XmNminimum, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] argList = {OS.XmNpageIncrement, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] argList = {OS.XmNvalue, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-/**
- * Returns the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getThumb () {
- checkWidget();
- int [] argList = {OS.XmNsliderSize, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdragCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNtoBottomCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNincrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNdecrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNpageIncrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNpageDecrementCallback, windowProc, SWT.Selection);
- OS.XtAddCallback (handle, OS.XmNtoTopCallback, windowProc, SWT.Selection);
-}
-int processSelection (int callData) {
- XmAnyCallbackStruct struct = new XmAnyCallbackStruct ();
- OS.memmove (struct, callData, XmAnyCallbackStruct.sizeof);
- Event event = new Event ();
- switch (struct.reason) {
- case OS.XmCR_DRAG: event.detail = SWT.DRAG; break;
- /*
- * Do not set the detail field to SWT.DRAG
- * to indicate that the dragging has ended.
- */
-// case OS.XmCR_VALUE_CHANGED: break;
- case OS.XmCR_TO_TOP: event.detail = SWT.HOME; break;
- case OS.XmCR_TO_BOTTOM: event.detail = SWT.END; break;
- case OS.XmCR_DECREMENT: event.detail = SWT.ARROW_UP; break;
- case OS.XmCR_INCREMENT: event.detail = SWT.ARROW_DOWN; break;
- case OS.XmCR_PAGE_DECREMENT: event.detail = SWT.PAGE_UP; break;
- case OS.XmCR_PAGE_INCREMENT: event.detail = SWT.PAGE_DOWN; break;
- }
- sendEvent (SWT.Selection, event);
- return 0;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNincrement, value};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNmaximum, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {
- OS.XmNminimum, 0,
- OS.XmNmaximum, 0,
- OS.XmNsliderSize, 0,
- };
- /*
- * Feature in Motif. For some reason, when minimium
- * is set to be greater than or equal to maximum, Motif
- * does not set the minimum. Instead, the value is
- * changed and the minimum stays the same. This behavior
- * differs from setting the maximum where the slider size
- * is always decreased to make room for the new maximum.
- * The fix is to decrease the slider to make room for
- * the new minimum.
- */
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [3] - value - argList [5] < 0) {
- argList [5] = argList [3] - value;
- }
- argList [1] = value;
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNpageIncrement, value};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- if (value < 0) return;
- int [] argList = {OS.XmNvalue, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget();
- if (value < 1) return;
- int [] argList = {OS.XmNsliderSize, value};
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int [] argList = {
- OS.XmNvalue, selection,
- OS.XmNminimum, minimum,
- OS.XmNmaximum, maximum,
- OS.XmNsliderSize, thumb,
- OS.XmNincrement, increment,
- OS.XmNpageIncrement, pageIncrement,
- };
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XtSetValues (handle, argList, argList.length / 2);
- display.setWarnings (warnings);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
deleted file mode 100755
index f4dfb00d3d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
+++ /dev/null
@@ -1,1517 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that allow the user to enter and modify text.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Verify</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Text extends Scrollable {
- char echoCharacter;
- boolean ignoreChange;
- String hiddenText;
- XmTextVerifyCallbackStruct textVerify;
- int drawCount;
-
- public static final int LIMIT;
- public static final String DELIMITER;
-
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0x7FFFFFFF;
- DELIMITER = "\n";
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Text (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is not called for texts.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is verified, by sending
- * it one of the messages defined in the <code>VerifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #removeVerifyListener
- */
-public void addVerifyListener (VerifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Verify, typedListener);
-}
-/**
- * Appends a string.
- * <p>
- * The new text is appended to the text at
- * the end of the widget.
- * </p>
- *
- * @param string the string to be appended
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void append (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int position = OS.XmTextGetLastPosition (handle);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetInsertionPosition (handle, position);
- OS.XmTextInsert (handle, position, buffer);
- position = OS.XmTextGetLastPosition (handle);
- OS.XmTextSetInsertionPosition (handle, position);
- display.setWarnings(warnings);
-}
-static int checkStyle (int style) {
- if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- return style | SWT.MULTI;
- }
- return style | SWT.SINGLE;
-}
-/**
- * Clears the selection.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void clearSelection () {
- checkWidget();
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- OS.XmTextClearSelection (handle, OS.XtLastTimestampProcessed (xDisplay));
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = wHint;
- int height = hHint;
- if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- int ptr = OS.XmTextGetString (handle);
- if (ptr == 0) return new Point (0, 0);
- int size = OS.strlen (ptr);
- if (size == 0) {
- if (hHint == SWT.DEFAULT) {
- if ((style & SWT.SINGLE) != 0) {
- height = getLineHeight ();
- } else {
- height = DEFAULT_HEIGHT;
- }
- }
- if (wHint == SWT.DEFAULT) {
- width = DEFAULT_WIDTH;
- }
- } else {
- byte [] buffer = new byte [size + 1];
- OS.memmove (buffer, ptr, size);
- int xmString = OS.XmStringParseText (
- buffer,
- 0,
- OS.XmFONTLIST_DEFAULT_TAG,
- OS.XmCHARSET_TEXT,
- null,
- 0,
- 0);
- if (hHint == SWT.DEFAULT) {
- if ((style & SWT.SINGLE) != 0) {
- height = getLineHeight ();
- } else {
- height = OS.XmStringHeight (fontList, xmString);
- }
- }
- if (wHint == SWT.DEFAULT) width = OS.XmStringWidth(fontList, xmString);
- OS.XmStringFree (xmString);
- }
- OS.XtFree (ptr);
- }
- if (horizontalBar != null) {
- int [] argList1 = {OS.XmNheight, 0};
- OS.XtGetValues (horizontalBar.handle, argList1, argList1.length / 2);
- height += argList1 [1] + 4;
- }
- if (verticalBar != null) {
- int [] argList1 = {OS.XmNwidth, 0};
- OS.XtGetValues (verticalBar.handle, argList1, argList1.length / 2);
- width += argList1 [1] + 4;
- }
- XRectangle rect = new XRectangle ();
- OS.XmWidgetGetDisplayRect (handle, rect);
- width += rect.x * 2; height += rect.y * 2;
- if ((style & (SWT.MULTI | SWT.BORDER)) != 0) height++;
- return new Point (width, height);
-}
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- Rectangle trim = super.computeTrim(x, y, width, height);
- XRectangle rect = new XRectangle ();
- OS.XmWidgetGetDisplayRect (handle, rect);
- trim.x -= rect.x;
- trim.y -= rect.y;
- trim.width += rect.x;
- trim.height += rect.y;
- if ((style & (SWT.MULTI | SWT.BORDER)) != 0) trim.height += 3;
- return trim;
-}
-/**
- * Copies the selected text.
- * <p>
- * The current selection is copied to the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void copy () {
- checkWidget();
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- OS.XmTextCopy (handle, OS.XtLastTimestampProcessed (xDisplay));
-}
-void createHandle (int index) {
- state |= HANDLE;
- int [] argList1 = {
- OS.XmNverifyBell, 0,
- OS.XmNeditMode, (style & SWT.SINGLE) != 0 ? OS.XmSINGLE_LINE_EDIT : OS.XmMULTI_LINE_EDIT,
- OS.XmNscrollHorizontal, (style & SWT.H_SCROLL) != 0 ? 1 : 0,
- OS.XmNscrollVertical, (style & SWT.V_SCROLL) != 0 ? 1 : 0,
- OS.XmNwordWrap, (style & SWT.WRAP) != 0 ? 1: 0,
- OS.XmNeditable, (style & SWT.READ_ONLY) != 0 ? 0 : 1,
- OS.XmNcursorPositionVisible, (style & SWT.READ_ONLY) != 0 && (style & SWT.SINGLE) != 0 ? 0 : 1,
-// OS.XmNmarginWidth, 3,
-// OS.XmNmarginHeight, 1,
- OS.XmNancestorSensitive, 1,
- };
- int parentHandle = parent.handle;
- if ((style & SWT.SINGLE) != 0) {
- handle = OS.XmCreateTextField (parentHandle, null, argList1, argList1.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- int [] argList2 = new int [] {OS.XmNcursorPositionVisible, 0};
- OS.XtSetValues (handle, argList2, argList2.length / 2);
- if ((style & SWT.BORDER) == 0) {
- int [] argList3 = new int [] {
- OS.XmNmarginHeight, 0,
- OS.XmNshadowThickness, 0,
- };
- OS.XtSetValues (handle, argList3, argList3.length / 2);
- }
- } else {
- handle = OS.XmCreateScrolledText (parentHandle, null, argList1, argList1.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- scrolledHandle = OS.XtParent (handle);
- }
-}
-ScrollBar createScrollBar (int type) {
- return createStandardBar (type);
-}
-/**
- * Cuts the selected text.
- * <p>
- * The current selection is first copied to the
- * clipboard and then deleted from the widget.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void cut () {
- checkWidget();
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- OS.XmTextCut (handle, OS.XtLastTimestampProcessed (xDisplay));
-}
-int defaultBackground () {
- return getDisplay ().textBackground;
-}
-int defaultFont () {
- return getDisplay ().textFont;
-}
-int defaultForeground () {
- return getDisplay ().textForeground;
-}
-/**
- * Gets the line number of the caret.
- * <p>
- * The line number of the caret is returned.
- * </p>
- *
- * @return the line number
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretLineNumber () {
- checkWidget();
- return getLineNumber (OS.XmTextGetInsertionPosition (handle));
-}
-/**
- * Gets the location the caret.
- * <p>
- * The location of the caret is returned.
- * </p>
- *
- * @return a point, the location of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCaretLocation () {
- checkWidget();
- int position;
- if (textVerify != null) {
- position = textVerify.currInsert;
- } else {
- position = OS.XmTextGetInsertionPosition (handle);
- }
- short [] x = new short [1], y = new short [1];
- OS.XmTextPosToXY (handle, position, x, y);
- return new Point (x [0], y [0] - getFontAscent ());
-}
-/**
- * Gets the position of the caret.
- * <p>
- * The character position of the caret is returned.
- * </p>
- *
- * @return the position of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretPosition () {
- checkWidget();
- return OS.XmTextGetInsertionPosition (handle);
-}
-/**
- * Gets the number of characters.
- *
- * @return number of characters in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCharCount () {
- checkWidget();
- return OS.XmTextGetLastPosition (handle);
-}
-/**
- * Gets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getDoubleClickEnabled () {
- checkWidget();
- int [] argList = {OS.XmNselectionArrayCount, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 1;
-}
-/**
- * Gets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public char getEchoChar () {
- checkWidget();
- return echoCharacter;
-}
-/**
- * Gets the editable state.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEditable () {
- checkWidget();
- /*
- * Bug in MOTIF. For some reason, when XmTextGetEditable () is called
- * from inside an XmNvalueChangedCallback or XmNModifyVerifyCallback,
- * it always returns TRUE. Calls to XmTextGetEditable () outside of
- * these callbacks return the correct value. The fix is to query the
- * resource directly instead of using the convenience function.
- */
- int [] argList = {OS.XmNeditable, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-/**
- * Gets the number of lines.
- *
- * @return the number of lines in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineCount () {
- checkWidget();
- return getLineNumber (echoCharacter != '\0' ? hiddenText.length () : OS.XmTextGetLastPosition (handle));
-}
-/**
- * Gets the line delimiter.
- *
- * @return a string that is the line delimiter
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getLineDelimiter () {
- checkWidget();
- return "\n";
-}
-/**
- * Gets the height of a line.
- *
- * @return the height of a row of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineHeight () {
- checkWidget();
- return getFontHeight ();
-}
-int getLineNumber (int position) {
- if (position == 0) return 0;
- int count = 0, start = 0, page = 1024;
- char [] buffer = new char [page + 1];
- /*
- * Bug in Linux. For some reason, XmTextGetSubstringWcs () does
- * not copy wchar_t characters into the buffer. Instead, it
- * copies 4 bytes per character. This does not happen on other
- * platforms such as AIX. The fix is to call XmTextGetSubstring ()
- * instead on Linux and rely on the fact that Metrolink Motif 1.2
- * does not support multibyte locales.
- */
- byte [] buffer1 = null;
- if (OS.IsLinux) buffer1 = new byte [page + 1];
- int end = ((position + page - 1) / page) * page;
- while (start < end) {
- int length = page;
- if (start + page > position) length = position - start;
- if (echoCharacter != '\0') {
- hiddenText.getChars (start, start + length, buffer, 0);
- } else {
- if (OS.IsLinux) {
- OS.XmTextGetSubstring (handle, start, length, buffer1.length, buffer1);
- for (int i=0; i<length; i++) buffer [i] = (char) buffer1 [i];
- } else {
- OS.XmTextGetSubstringWcs (handle, start, length, buffer.length, buffer);
- }
- }
- for (int i=0; i<length; i++) {
- if (buffer [i] == '\n') count++;
- }
- start += page;
- }
- return count;
-}
-int getNavigationType () {
- /*
- * Bug in Motif. On Solaris only, the implementation
- * of XtGetValues for XmText does not check for a zero
- * pointer in the arg list and GP's. The fix is to
- * allocate and free memory for the arg list value.
- */
- if ((style & SWT.SINGLE) != 0) {
- return super.getNavigationType ();
- }
- int ptr = OS.XtMalloc (4);
- if (ptr == 0) return OS.XmNONE;
- int [] argList = {OS.XmNnavigationType, ptr};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int [] buffer = new int [1];
- OS.memmove (buffer, ptr, 4);
- OS.XtFree (ptr);
- return buffer [0];
-}
-/**
- * Gets the position of the selected text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p>
- *
- * @return the start and end of the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget();
- if (textVerify != null) {
- return new Point (textVerify.startPos, textVerify.endPos);
- }
- int [] start = new int [1], end = new int [1];
- OS.XmTextGetSelectionPosition (handle, start, end);
- if (start [0] == end [0]) {
- start [0] = end [0] = OS.XmTextGetInsertionPosition (handle);
- }
- return new Point (start [0], end [0]);
-}
-/**
- * Gets the number of selected characters.
- *
- * @return the number of selected characters.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- if (textVerify != null) {
- return textVerify.endPos - textVerify.startPos;
- }
- int [] start = new int [1], end = new int [1];
- OS.XmTextGetSelectionPosition (handle, start, end);
- return end [0] - start [0];
-}
-/**
- * Gets the selected text.
- *
- * @return the selected text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getSelectionText () {
- checkWidget();
- if (echoCharacter != '\0' || textVerify != null) {
- Point selection = getSelection ();
- return getText (selection.x, selection.y);
- }
- int ptr = OS.XmTextGetSelection (handle);
- if (ptr == 0) return "";
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- return new String (Converter.mbcsToWcs (getCodePage (), buffer));
-}
-/**
- * Gets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @return the number of tab characters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTabs () {
- checkWidget();
- /* Tabs are not supported in MOTIF. */
- return 8;
-}
-/**
- * Gets the widget text.
- * <p>
- * The text for a text widget is the characters in the widget.
- * </p>
- *
- * @return the widget text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if (echoCharacter != '\0') return hiddenText;
- int ptr = OS.XmTextGetString (handle);
- if (ptr == 0) return "";
- int length = OS.strlen (ptr);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, ptr, length);
- OS.XtFree (ptr);
- return new String (Converter.mbcsToWcs (getCodePage (), buffer));
-}
-/**
- * Gets a range of text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N-1 where N is
- * the number of characters in the widget.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- * @return the range of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText (int start, int end) {
- checkWidget();
- int numChars = end - start + 1;
- if (numChars < 0 || start < 0) return "";
- if (echoCharacter != '\0') {
- return hiddenText.substring (start, Math.min (hiddenText.length (), end));
- }
- int length = (numChars * 4 /* MB_CUR_MAX */) + 1;
- byte [] buffer = new byte [length];
- int code = OS.XmTextGetSubstring (handle, start, numChars, length, buffer);
- if (code == OS.XmCOPY_FAILED) return "";
- char [] unicode = Converter.mbcsToWcs (getCodePage (), buffer);
- if (code == OS.XmCOPY_TRUNCATED) {
- numChars = OS.XmTextGetLastPosition (handle) - start;
- }
- return new String (unicode, 0, numChars);
-}
-/**
- * Returns the maximum number of characters that the receiver is capable of holding.
- * <p>
- * If this has not been changed by <code>setTextLimit()</code>,
- * it will be the constant <code>Text.LIMIT</code>.
- * </p>
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- return OS.XmTextGetMaxLength (handle);
-}
-/**
- * Returns the zero-relative index of the line which is currently
- * at the top of the receiver.
- * <p>
- * This index can change when lines are scrolled or new lines are added or removed.
- * </p>
- *
- * @return the index of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return 0;
- if (scrolledHandle == 0) return 0;
- int [] argList1 = {OS.XmNverticalScrollBar, 0};
- OS.XtGetValues (scrolledHandle, argList1, argList1.length / 2);
- if (argList1 [1] == 0) return 0;
- int [] argList2 = {OS.XmNvalue, 0};
- OS.XtGetValues (argList1 [1], argList2, argList2.length / 2);
- return argList2 [1];
-}
-/**
- * Gets the top pixel.
- * <p>
- * The top pixel is the pixel position of the line
- * that is currently at the top of the widget. On
- * some platforms, a text widget can be scrolled by
- * pixels instead of lines so that a partial line
- * is displayed at the top of the widget.
- * </p><p>
- * The top pixel changes when the widget is scrolled.
- * The top pixel does not include the widget trimming.
- * </p>
- *
- * @return the pixel position of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopPixel () {
- checkWidget();
- return getTopIndex () * getLineHeight ();
-}
-boolean getWrap () {
- checkWidget();
- int [] argList = {OS.XmNwordWrap, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.XtAddCallback (handle, OS.XmNactivateCallback, windowProc, SWT.DefaultSelection);
- OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Modify);
- OS.XtAddCallback (handle, OS.XmNmodifyVerifyCallback, windowProc, SWT.Verify);
-}
-int inputContext () {
- /* Answer zero. The text widget uses the default MOTIF input context. */
- return 0;
-}
-/**
- * Inserts a string.
- * <p>
- * The old selection is replaced with the new text.
- * </p>
- *
- * @param string the string
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void insert (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] start = new int [1], end = new int [1];
- OS.XmTextGetSelectionPosition (handle, start, end);
- if (start [0] == end [0]) {
- start [0] = end [0] = OS.XmTextGetInsertionPosition (handle);
- }
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextReplace (handle, start [0], end [0], buffer);
- int position = start [0] + buffer.length - 1;
- OS.XmTextSetInsertionPosition (handle, position);
- display.setWarnings (warnings);
-}
-/**
- * Pastes text from clipboard.
- * <p>
- * The selected text is deleted from the widget
- * and new text inserted from the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void paste () {
- checkWidget();
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- /*
- * Bug in Motif. Despite the fact that the documentation
- * claims that XmText functions work for XmTextFields, when
- * a text field is passed to XmTextPaste, Motif segment faults.
- * The fix is to call XmTextFieldPaste instead.
- */
- if ((style & SWT.SINGLE) != 0) {
- OS.XmTextFieldPaste (handle);
- } else {
- OS.XmTextPaste (handle);
- }
- display.setWarnings (warnings);
-}
-int processFocusIn () {
- super.processFocusIn ();
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if ((style & SWT.READ_ONLY) != 0) return 0;
- if ((style & SWT.MULTI) != 0) return 0;
- int [] argList = {OS.XmNcursorPositionVisible, 1};
- OS.XtSetValues (handle, argList, argList.length / 2);
- return 0;
-}
-int processFocusOut () {
- super.processFocusOut ();
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if ((style & SWT.READ_ONLY) != 0) return 0;
- if ((style & SWT.MULTI) != 0) return 0;
- int [] argList = {OS.XmNcursorPositionVisible, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- return 0;
-}
-int processIMEFocusIn () {
- return 0;
-}
-int processIMEFocusOut () {
- return 0;
-}
-int processModify (int callData) {
- if (!ignoreChange) super.processModify (callData);
- return 0;
-}
-int processVerify (int callData) {
- super.processVerify (callData);
- if (echoCharacter == '\0' && !hooks (SWT.Verify)) return 0;
- XmTextVerifyCallbackStruct textVerify = new XmTextVerifyCallbackStruct ();
- OS.memmove (textVerify, callData, XmTextVerifyCallbackStruct.sizeof);
- XmTextBlockRec textBlock = new XmTextBlockRec ();
- OS.memmove (textBlock, textVerify.text, XmTextBlockRec.sizeof);
- byte [] buffer = new byte [textBlock.length];
- OS.memmove (buffer, textBlock.ptr, textBlock.length);
- String codePage = getCodePage ();
- String text = new String (Converter.mbcsToWcs (codePage, buffer));
- String newText = text;
- if (!ignoreChange) {
- Event event = new Event ();
- if (textVerify.event != 0) {
- XKeyEvent xEvent = new XKeyEvent ();
- OS.memmove (xEvent, textVerify.event, XKeyEvent.sizeof);
- event.time = xEvent.time;
- setKeyState (event, xEvent);
- }
- event.start = textVerify.startPos;
- event.end = textVerify.endPos;
- event.doit = textVerify.doit == 1;
- event.text = text;
- sendEvent (SWT.Verify, event);
- newText = event.text;
- textVerify.doit = (byte) ((event.doit && newText != null) ? 1 : 0);
- }
- if (newText != null) {
- if (echoCharacter != '\0' && (textVerify.doit != 0)) {
- String prefix = hiddenText.substring (0, textVerify.startPos);
- String suffix = hiddenText.substring (textVerify.endPos, hiddenText.length ());
- hiddenText = prefix + newText + suffix;
- char [] charBuffer = new char [newText.length ()];
- for (int i=0; i<charBuffer.length; i++) {
- charBuffer [i] = echoCharacter;
- }
- newText = new String (charBuffer);
- }
- if (newText != text) {
- byte [] buffer2 = Converter.wcsToMbcs (codePage, newText, true);
- int length = buffer2.length;
- int ptr = OS.XtMalloc (length);
- OS.memmove (ptr, buffer2, length);
- textBlock.ptr = ptr;
- textBlock.length = buffer2.length - 1;
- OS.memmove (textVerify.text, textBlock, XmTextBlockRec.sizeof);
- }
- }
- OS.memmove (callData, textVerify, XmTextVerifyCallbackStruct.sizeof);
- textVerify = null;
- return 0;
-}
-void releaseWidget () {
- super.releaseWidget ();
- hiddenText = null;
- textVerify = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is verified.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #addVerifyListener
- */
-public void removeVerifyListener (VerifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Verify, listener);
-}
-byte [] sendIMEKeyEvent (int type, XKeyEvent xEvent) {
- /*
- * Bug in Motif. On Solaris and Linux, XmImMbLookupString () clears
- * the characters from the IME. This causes tht characters to be
- * stolen from the text widget. The fix is to detect that the IME
- * has been cleared and use XmTextInsert () to insert the stolen
- * characters. This problem does not happen on AIX.
- */
- byte [] mbcs = super.sendIMEKeyEvent (type, xEvent);
- if (mbcs == null || xEvent.keycode != 0) return null;
- int [] unused = new int [1];
- byte [] buffer = new byte [2];
- int length = OS.XmImMbLookupString (handle, xEvent, buffer, buffer.length, unused, unused);
- if (length != 0) return null;
- int [] start = new int [1], end = new int [1];
- OS.XmTextGetSelectionPosition (handle, start, end);
- if (start [0] == end [0]) {
- start [0] = end [0] = OS.XmTextGetInsertionPosition (handle);
- }
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextReplace (handle, start [0], end [0], mbcs);
- int position = start [0] + mbcs.length - 1;
- OS.XmTextSetInsertionPosition (handle, position);
- display.setWarnings (warnings);
- return mbcs;
-}
-/**
- * Selects all the text in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- /* Clear the highlight before setting the selection. */
- int position = OS.XmTextGetLastPosition (handle);
-// OS.XmTextSetHighlight (handle, 0, position, OS.XmHIGHLIGHT_NORMAL);
-
- /*
- * Bug in MOTIF. XmTextSetSelection () fails to set the
- * selection when the receiver is not realized. The fix
- * is to force the receiver to be realized by forcing the
- * shell to be realized. If the receiver is realized before
- * the shell, MOTIF fails to draw the text widget and issues
- * lots of X BadDrawable errors.
- */
- if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
-
- /* Set the selection. */
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetSelection (handle, 0, position, OS.XtLastTimestampProcessed (xDisplay));
-
- /* Force the i-beam to follow the highlight/selection. */
- OS.XmTextSetInsertionPosition (handle, 0);
- display.setWarnings (warnings);
-}
-/**
-* Sets the bounds.
-*/
-public void setBounds (int x, int y, int width, int height) {
- /*
- * Bug in Motif. For some reason an Xm warning is
- * output whenever a Text widget's caret is beyond
- * the visible region during a resize. The fix is
- * to temporarily turn off warnings below.
- */
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- super.setBounds (x, y, width, height);
- display.setWarnings(warnings);
-
- /*
- * Bug in Motif. When the receiver is a Text widget
- * (not a Text Field) and is resized to be smaller than
- * the inset that surrounds the text and the selection
- * is set, the receiver scrolls to the left. When the
- * receiver is resized larger, the text is not scrolled
- * back. The fix is to detect this case and scroll the
- * text back.
- */
-// inset := self inset.
-// nWidth := self dimensionAt: XmNwidth.
-// self noWarnings: [super resizeWidget].
-// nWidth > inset x ifTrue: [^self].
-// self showPosition: self topCharacter
-}
-/**
- * Sets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @param doubleClick the new double click flag
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDoubleClickEnabled (boolean doubleClick) {
- checkWidget();
- int [] argList = {OS.XmNselectionArrayCount, doubleClick ? 4 : 1};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @param echo the new echo character
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEchoChar (char echo) {
- checkWidget();
- if (echoCharacter == echo) return;
- String newText;
- if (echo == 0) {
- newText = hiddenText;
- hiddenText = null;
- } else {
- newText = hiddenText = getText();
- }
- echoCharacter = echo;
- Point selection = getSelection();
- boolean oldValue = ignoreChange;
- ignoreChange = true;
- setText(newText);
- setSelection(selection);
- ignoreChange = oldValue;
-}
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEditable (boolean editable) {
- checkWidget();
- OS.XmTextSetEditable (handle, editable);
- style &= ~SWT.READ_ONLY;
- if (!editable) style |= SWT.READ_ONLY;
- if ((style & SWT.MULTI) != 0) return;
- int [] argList = {OS.XmNcursorPositionVisible, editable && hasFocus () ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
-* Sets the redraw flag.
-*/
-public void setRedraw (boolean redraw) {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return;
- if (redraw) {
- if (--drawCount == 0) OS.XmTextEnableRedisplay(handle);
- } else {
- if (drawCount++ == 0) OS.XmTextDisableRedisplay(handle);
- }
-}
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * regular array indexing rules.
- * </p>
- *
- * @param start new caret position
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start) {
- checkWidget();
- /* Clear the selection and highlight before moving the i-beam. */
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int position = OS.XmTextGetLastPosition (handle);
- int nStart = Math.min (Math.max (start, 0), position);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
-// OS.XmTextSetHighlight (handle, 0, position, OS.XmHIGHLIGHT_NORMAL);
- OS.XmTextClearSelection (handle, OS.XtLastTimestampProcessed (xDisplay));
-
- /* Set the i-beam position. */
- OS.XmTextSetInsertionPosition (handle, nStart);
- display.setWarnings (warnings);
-}
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start, int end) {
- checkWidget();
- /* Clear the highlight before setting the selection. */
- int position = OS.XmTextGetLastPosition (handle);
-// OS.XmTextSetHighlight (handle, 0, position, OS.XmHIGHLIGHT_NORMAL);
-
- /*
- * Bug in MOTIF. XmTextSetSelection () fails to set the
- * selection when the receiver is not realized. The fix
- * is to force the receiver to be realized by forcing the
- * shell to be realized. If the receiver is realized before
- * the shell, MOTIF fails to draw the text widget and issues
- * lots of X BadDrawable errors.
- */
- if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
-
- /* Set the selection. */
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return;
- int nStart = Math.min (Math.max (Math.min (start, end), 0), position);
- int nEnd = Math.min (Math.max (Math.max (start, end), 0), position);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetSelection (handle, nStart, nEnd, OS.XtLastTimestampProcessed (xDisplay));
-
- /* Force the i-beam to follow the highlight/selection. */
- OS.XmTextSetInsertionPosition (handle, nEnd);
- display.setWarnings (warnings);
-}
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param selection the point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSelection (selection.x, selection.y);
-}
-public void setSize (int width, int height) {
- /*
- * Bug in Motif. For some reason an Xm warning is
- * output whenever a Text widget's caret is beyond
- * the visible region during a resize. The fix is
- * to temporarily turn off warnings below.
- */
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- super.setSize (width, height);
- display.setWarnings(warnings);
- /*
- * Bug in Motif. When the receiver is a Text widget
- * (not a Text Field) and is resized to be smaller than
- * the inset that surrounds the text and the selection
- * is set, the receiver scrolls to the left. When the
- * receiver is resized larger, the text is not scrolled
- * back. The fix is to detect this case and scroll the
- * text back.
- */
-// inset := self inset.
-// nWidth := self dimensionAt: XmNwidth.
-// self noWarnings: [super resizeWidget].
-// nWidth > inset x ifTrue: [^self].
-// self showPosition: self topCharacter
-}
- /**
- * Sets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @param tabs the number of tabs
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
-*/
-public void setTabs (int tabs) {
- checkWidget();
- /* Do nothing. Tabs are not supported in MOTIF. */
-}
-/**
- * Sets the contents of the receiver to the given string.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (getCodePage (), string, true);
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- OS.XmTextSetString (handle, buffer);
- OS.XmTextSetInsertionPosition (handle, 0);
- display.setWarnings(warnings);
- /*
- * Bug in Linux. When the widget is multi-line
- * it does not send a Modify to notify the application
- * that the text has changed. The fix is to send the event.
- */
- if (OS.IsLinux && (style & SWT.MULTI) != 0) sendEvent (SWT.Modify);
-}
-/**
- * Sets the maximum number of characters that the receiver
- * is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- OS.XmTextSetMaxLength (handle, limit);
-}
-/**
- * Sets the zero-relative index of the line which is currently
- * at the top of the receiver. This index can change when lines
- * are scrolled or new lines are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return;
- if (scrolledHandle == 0) return;
- int [] argList1 = {OS.XmNverticalScrollBar, 0};
- OS.XtGetValues (scrolledHandle, argList1, argList1.length / 2);
- if (argList1 [1] == 0) return;
- int [] argList2 = {OS.XmNvalue, 0};
- OS.XtGetValues (argList1 [1], argList2, argList2.length / 2);
- OS.XmTextScroll (handle, index - argList2 [1]);
-}
-void setWrap (boolean wrap) {
- checkWidget();
- int [] argList = {OS.XmNwordWrap, wrap ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Shows the selection.
- * <p>
- * If the selection is already showing
- * in the receiver, this method simply returns. Otherwise,
- * lines are scrolled until the selection is visible.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- Display display = getDisplay ();
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- int position = OS.XmTextGetInsertionPosition (handle);
- OS.XmTextShowPosition (handle, position);
- display.setWarnings (warnings);
-}
-int traversalCode (int key, XKeyEvent xEvent) {
- int bits = super.traversalCode (key, xEvent);
- if ((style & SWT.MULTI) != 0) {
- bits &= ~SWT.TRAVERSE_RETURN;
- if (key == OS.XK_Tab && xEvent != null) {
- boolean next = (xEvent.state & OS.ShiftMask) == 0;
- if (next && (xEvent.state & OS.ControlMask) == 0) {
- bits &= ~(SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS);
- }
- }
- }
- return bits;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java
deleted file mode 100755
index 10a0d355d7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java
+++ /dev/null
@@ -1,428 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class ToolBar extends Composite {
- int drawCount, itemCount;
- ToolItem [] items;
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-
- /*
- * Ensure that either of HORIZONTAL or VERTICAL is set.
- * NOTE: HORIZONTAL and VERTICAL have the same values
- * as H_SCROLL and V_SCROLL so it is necessary to first
- * clear these bits to avoid scroll bars and then reset
- * the bits using the original style supplied by the
- * programmer.
- */
- this.style = checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = wHint, height = hHint;
- if (wHint == SWT.DEFAULT) width = 0x7FFFFFFF;
- if (hHint == SWT.DEFAULT) height = 0x7FFFFFFF;
- int [] result = layout (width, height, false);
- int border = getBorderWidth () * 2;
- Point extent = new Point (result [1], result [2]);
- if (wHint != SWT.DEFAULT) extent.x = wHint;
- if (hHint != SWT.DEFAULT) extent.y = hHint;
- extent.x += border;
- extent.y += border;
- return extent;
-}
-void createHandle (int index) {
- super.createHandle (index);
- state &= ~CANVAS;
-}
-void createItem (ToolItem item, int index) {
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE);
- if (itemCount == items.length) {
- ToolItem [] newItems = new ToolItem [itemCount + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- item.createWidget (index);
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
-}
-void createWidget (int index) {
- super.createWidget (index);
- items = new ToolItem [4];
- itemCount = 0;
-}
-void destroyItem (ToolItem item) {
- int index = 0;
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) return;
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (int index) {
- checkWidget();
- ToolItem [] items = getItems ();
- if (0 <= index && index < items.length) return items [index];
- error (SWT.ERROR_INVALID_RANGE);
- return null;
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (Point pt) {
- checkWidget();
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- Rectangle rect = items [i].getBounds ();
- if (rect.contains (pt)) return items [i];
- }
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- return itemCount;
-}
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem [] getItems () {
- checkWidget();
- ToolItem [] result = new ToolItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-/**
- * Returns the number of rows in the receiver. When
- * the receiver has the <code>WRAP</code> style, the
- * number of rows can be greater than one. Otherwise,
- * the number of rows is always one.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getRowCount () {
- checkWidget();
- Rectangle rect = getClientArea ();
- return layout (rect.width, rect.height, false) [0];
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (ToolItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-int [] layoutHorizontal (int nWidth, int nHeight, boolean resize) {
- int xSpacing = 0, ySpacing = (style & SWT.NO_FOCUS) != 0 ? 4 : 2;
- int marginWidth = 0, marginHeight = 0;
- ToolItem [] children = getItems ();
- int length = children.length;
- int x = marginWidth, y = marginHeight;
- int maxHeight = 0, maxX = 0, rows = 1;
- boolean wrap = (style & SWT.WRAP) != 0;
- for (int i=0; i<length; i++) {
- ToolItem child = children [i];
- Rectangle rect = child.getBounds ();
- if (wrap && i != 0 && x + rect.width > nWidth) {
- rows++;
- x = marginWidth; y += ySpacing + maxHeight;
- maxHeight = 0;
- }
- maxHeight = Math.max (maxHeight, rect.height);
- if (resize) {
- child.setBounds (x, y, rect.width, rect.height);
- }
- x += xSpacing + rect.width;
- maxX = Math.max (maxX, x);
- }
- return new int [] {rows, maxX, y + maxHeight};
-}
-int [] layoutVertical (int nWidth, int nHeight, boolean resize) {
- int xSpacing = (style & SWT.NO_FOCUS) != 0 ? 4 : 2, ySpacing = 0;
- int marginWidth = 0, marginHeight = 0;
- ToolItem [] children = getItems ();
- int length = children.length;
- int x = marginWidth, y = marginHeight;
- int maxWidth = 0, maxY = 0, cols = 1;
- boolean wrap = (style & SWT.WRAP) != 0;
- for (int i=0; i<length; i++) {
- ToolItem child = children [i];
- Rectangle rect = child.getBounds ();
- if (wrap && i != 0 && y + rect.height > nHeight) {
- cols++;
- x += xSpacing + maxWidth; y = marginHeight;
- maxWidth = 0;
- }
- maxWidth = Math.max (maxWidth, rect.width);
- if (resize) {
- child.setBounds (x, y, rect.width, rect.height);
- }
- y += ySpacing + rect.height;
- maxY = Math.max (maxY, y);
- }
- return new int [] {cols, x + maxWidth, maxY};
-}
-int [] layout (int nWidth, int nHeight, boolean resize) {
- if ((style & SWT.VERTICAL) != 0) {
- return layoutVertical (nWidth, nHeight, resize);
- } else {
- return layoutHorizontal (nWidth, nHeight, resize);
- }
-}
-boolean mnemonicHit (char key) {
- for (int i = 0; i < items.length; i++) {
- ToolItem item = items [i];
- if (item != null) {
- char mnemonic = findMnemonic (item.getText ());
- if (mnemonic != '\0') {
- if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) {
- OS.XmProcessTraversal (item.handle, OS.XmTRAVERSE_CURRENT);
- item.click (false, null);
- return true;
- }
- }
- }
- }
- return false;
-}
-boolean mnemonicMatch (char key) {
- for (int i = 0; i < items.length; i++) {
- ToolItem item = items [i];
- if (item != null) {
- char mnemonic = findMnemonic (item.getText ());
- if (mnemonic != '\0') {
- if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) {
- return true;
- }
- }
- }
- }
- return false;
-}
-void propagateWidget (boolean enabled) {
- super.propagateWidget (enabled);
- for (int i=0; i<itemCount; i++) {
- items [i].propagateWidget (enabled);
- }
-}
-void relayout () {
- if (drawCount > 0) return;
- Rectangle rect = getClientArea ();
- layout (rect.width, rect.height, true);
-}
-void relayout (int width, int height) {
- if (drawCount > 0) return;
- layout (width, height, true);
-}
-void releaseWidget () {
- for (int i=0; i<itemCount; i++) {
- ToolItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- super.releaseWidget ();
-}
-void setBackgroundPixel (int pixel) {
- super.setBackgroundPixel (pixel);
- for (int i = 0; i < items.length; i++) {
- if (items[i] != null) {
- items[i].setBackgroundPixel (pixel);
- }
- }
-}
-public void setBounds (int x, int y, int width, int height) {
- super.setBounds (x, y, width, height);
- Rectangle rect = getClientArea ();
- relayout (rect.width, rect.height);
-}
-public void setRedraw (boolean redraw) {
- checkWidget();
- if (redraw) {
- if (--drawCount == 0) relayout();
- } else {
- drawCount++;
- }
-}
-public void setSize (int width, int height) {
- super.setSize (width, height);
- Rectangle rect = getClientArea ();
- relayout (rect.width, rect.height);
-}
-int traversalCode (int key, XKeyEvent xEvent) {
- return super.traversalCode (key, xEvent) | SWT.TRAVERSE_MNEMONIC;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolDrawable.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolDrawable.java
deleted file mode 100755
index df81e73f8f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolDrawable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.motif.*;
-
-class ToolDrawable implements Drawable {
-
- Device device;
- int display;
- int drawable;
- int fontList;
- int colormap;
-
-public int internal_new_GC (GCData data) {
- int xGC = OS.XCreateGC (display, drawable, 0, null);
- if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (data != null) {
- data.device = device;
- data.display = display;
- data.drawable = drawable;
- data.fontList = fontList;
- data.colormap = colormap;
- }
- return xGC;
-}
-
-public void internal_dispose_GC (int xGC, GCData data) {
- OS.XFreeGC (display, xGC);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
deleted file mode 100755
index ae8dcb103e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
+++ /dev/null
@@ -1,1045 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a button in a tool bar.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class ToolItem extends Item {
- ToolBar parent;
- Image hotImage, disabledImage;
- String toolTipText;
- Control control;
- boolean set;
-
- static final int DEFAULT_WIDTH = 24;
- static final int DEFAULT_HEIGHT = 22;
- static final int DEFAULT_SEPARATOR_WIDTH = 8;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
- parent.relayout ();
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, index);
- parent.relayout ();
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
- * the event object detail field contains the value <code>SWT.ARROW</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
-}
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-void createHandle (int index) {
- state |= HANDLE;
- int parentHandle = parent.handle;
- if ((style & SWT.SEPARATOR) != 0) {
- int orientation = (parent.style & SWT.HORIZONTAL) != 0 ? OS.XmVERTICAL : OS.XmHORIZONTAL;
- int [] argList = {
- OS.XmNheight, orientation == OS.XmVERTICAL ? DEFAULT_HEIGHT : DEFAULT_SEPARATOR_WIDTH,
- OS.XmNwidth, orientation == OS.XmHORIZONTAL ? DEFAULT_WIDTH : DEFAULT_SEPARATOR_WIDTH,
- OS.XmNancestorSensitive, 1,
- OS.XmNpositionIndex, index,
- OS.XmNorientation, orientation,
- OS.XmNseparatorType, (parent.style & SWT.FLAT) != 0 ? OS.XmSHADOW_ETCHED_IN : OS.XmSHADOW_ETCHED_OUT,
- };
- handle = OS.XmCreateSeparator (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- int [] argList = {
- OS.XmNwidth, DEFAULT_WIDTH,
- OS.XmNheight, DEFAULT_HEIGHT,
- OS.XmNrecomputeSize, 0,
- OS.XmNhighlightThickness, (parent.style & SWT.NO_FOCUS) != 0 ? 0 : 1,
- OS.XmNmarginWidth, 2,
- OS.XmNmarginHeight, 1,
- OS.XmNtraversalOn, (parent.style & SWT.NO_FOCUS) != 0 ? 0 : 1,
- OS.XmNpositionIndex, index,
- OS.XmNshadowType, OS.XmSHADOW_OUT,
- OS.XmNancestorSensitive, 1,
- };
- handle = OS.XmCreateDrawnButton (parentHandle, null, argList, argList.length / 2);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- int pixel = parent.getBackgroundPixel ();
- setBackgroundPixel (pixel);
-}
-
-void click (boolean dropDown, XInputEvent xEvent) {
- if ((style & SWT.RADIO) != 0) {
- selectRadio ();
- } else {
- if ((style & SWT.CHECK) != 0) setSelection(!set);
- }
- Event event = new Event ();
- if ((style & SWT.DROP_DOWN) != 0) {
- if (dropDown) event.detail = SWT.ARROW;
- }
- if (xEvent != null) setInputState (event, xEvent);
- postEvent (SWT.Selection, event);
-}
-
-Point computeSize () {
- if ((style & SWT.SEPARATOR) != 0) {
- int [] argList = {
- OS.XmNwidth, 0,
- OS.XmNheight, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int width = argList [1], height = argList [3];
- return new Point(width, height);
- }
- int [] argList = {
- OS.XmNmarginHeight, 0,
- OS.XmNmarginWidth, 0,
- OS.XmNshadowThickness, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int marginHeight = argList [1], marginWidth = argList [3];
- int shadowThickness = argList [5];
- if ((parent.style & SWT.FLAT) != 0) {
- Display display = getDisplay ();
- shadowThickness = Math.min (2, display.buttonShadowThickness);
- }
- int textWidth = 0, textHeight = 0;
- if (text.length () != 0) {
- GC gc = new GC (parent);
- int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_MNEMONIC;
- Point textExtent = gc.textExtent (text, flags);
- textWidth = textExtent.x;
- textHeight = textExtent.y;
- gc.dispose ();
- }
- int imageWidth = 0, imageHeight = 0;
- if (image != null) {
- Rectangle rect = image.getBounds ();
- imageWidth = rect.width;
- imageHeight = rect.height;
- }
- int width = 0, height = 0;
- if ((parent.style & SWT.RIGHT) != 0) {
- width = imageWidth + textWidth;
- height = Math.max (imageHeight, textHeight);
- if (imageWidth != 0 && textWidth != 0) width += 2;
- } else {
- height = imageHeight + textHeight;
- if (imageHeight != 0 && textHeight != 0) height += 2;
- width = Math.max (imageWidth, textWidth);
- }
- if ((style & SWT.DROP_DOWN) != 0) width += 12;
-
- if (width != 0) {
- width += (marginWidth + shadowThickness) * 2 + 2;
- } else {
- width = DEFAULT_WIDTH;
- }
- if (height != 0) {
- height += (marginHeight + shadowThickness) * 2 + 2;
- } else {
- height = DEFAULT_HEIGHT;
- }
- return new Point (width, height);
-}
-void createWidget (int index) {
- super.createWidget (index);
- toolTipText = "";
- parent.relayout ();
-}
-public void dispose () {
- if (isDisposed()) return;
- ToolBar parent = this.parent;
- super.dispose ();
- parent.relayout ();
-}
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0, OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return new Rectangle ((short) argList [1], (short) argList [3], argList [5], argList [7]);
-}
-/**
- * Returns the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-/**
- * Returns the receiver's disabled image if it has one, or null
- * if it does not.
- * <p>
- * The disabled image is displayed when the receiver is disabled.
- * </p>
- *
- * @return the receiver's disabled image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getDisabledImage () {
- checkWidget();
- return disabledImage;
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] argList = {OS.XmNsensitive, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1] != 0;
-}
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's hot image if it has one, or null
- * if it does not.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @return the receiver's hot image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getHotImage () {
- checkWidget();
- return hotImage;
-}
-/**
- * Returns the receiver's parent, which must be a <code>ToolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolBar getParent () {
- checkWidget();
- return parent;
-}
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- return set;
-}
-/**
- * Returns the receiver's tool tip text, or null if it has not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- checkWidget();
- int [] argList = {OS.XmNwidth, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- return argList [1];
-}
-boolean hasCursor () {
- int [] unused = new int [1], buffer = new int [1];
- int xDisplay = OS.XtDisplay (handle);
- int xWindow, xParent = OS.XDefaultRootWindow (xDisplay);
- do {
- if (OS.XQueryPointer (
- xDisplay, xParent, unused, buffer,
- unused, unused, unused, unused, unused) == 0) return false;
- if ((xWindow = buffer [0]) != 0) xParent = xWindow;
- } while (xWindow != 0);
- return handle == OS.XtWindowToWidget (xDisplay, xParent);
-}
-void hookEvents () {
- super.hookEvents ();
- if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = getDisplay ().windowProc;
- OS.XtAddEventHandler (handle, OS.KeyPressMask, false, windowProc, SWT.KeyDown);
- OS.XtAddEventHandler (handle, OS.KeyReleaseMask, false, windowProc, SWT.KeyUp);
- OS.XtAddEventHandler (handle, OS.ButtonPressMask, false, windowProc, SWT.MouseDown);
- OS.XtAddEventHandler (handle, OS.ButtonReleaseMask, false, windowProc, SWT.MouseUp);
- OS.XtAddEventHandler (handle, OS.PointerMotionMask, false, windowProc, SWT.MouseMove);
- OS.XtAddEventHandler (handle, OS.EnterWindowMask, false, windowProc, SWT.MouseEnter);
- OS.XtAddEventHandler (handle, OS.LeaveWindowMask, false, windowProc, SWT.MouseExit);
- OS.XtAddCallback (handle, OS.XmNexposeCallback, windowProc, SWT.Paint);
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-void manageChildren () {
- OS.XtManageChild (handle);
-}
-void redraw () {
- int display = OS.XtDisplay (handle);
- if (display == 0) return;
- int window = OS.XtWindow (handle);
- if (window == 0) return;
- OS.XClearArea (display, window, 0, 0, 0, 0, true);
-}
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-void releaseWidget () {
- Display display = getDisplay ();
- display.releaseToolTipHandle (handle);
- super.releaseWidget ();
- parent = null;
- control = null;
- toolTipText = null;
- image = disabledImage = hotImage = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Selection, listener);
- eventTable.unhook(SWT.DefaultSelection,listener);
-}
-void selectRadio () {
- this.setSelection (true);
- ToolItem [] items = parent.getItems ();
- int index = 0;
- while (index < items.length && items [index] != this) index++;
- ToolItem item;
- int i = index;
- while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- i = index;
- while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
-}
-void setBackgroundPixel(int pixel) {
- int [] argList = {OS.XmNforeground, 0, OS.XmNhighlightColor, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XmChangeColor (handle, pixel);
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-void setBounds (int x, int y, int width, int height) {
- if (control != null) control.setBounds(x, y, width, height);
- /*
- * Feature in Motif. Motif will not allow a window
- * to have a zero width or zero height. The fix is
- * to ensure these values are never zero.
- */
- int newWidth = Math.max (width, 1), newHeight = Math.max (height, 1);
- OS.XtConfigureWidget (handle, x, y, newWidth, newHeight, 0);
-}
-/**
- * Sets the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- if ((style & SWT.SEPARATOR) == 0) return;
- this.control = control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getBounds ());
- }
-}
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise.
- * <p>
- * A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * </p>
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
-}
-/**
- * Sets the receiver's disabled image to the argument, which may be
- * null indicating that no disabled image should be displayed.
- * <p>
- * The disbled image is displayed when the receiver is disabled.
- * </p>
- *
- * @param image the disabled image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDisabledImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- disabledImage = image;
- if (!getEnabled ()) redraw ();
-}
-/**
- * Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @param image the hot image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHotImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- hotImage = image;
- if ((parent.style & SWT.FLAT) != 0) redraw ();
-}
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setImage (image);
- Point size = computeSize ();
- setSize (size.x, size.y);
- redraw ();
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- if (selected == set) return;
- set = selected;
- setDrawPressed (set);
-}
-
-void setSize (int width, int height) {
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] != width || argList [3] != height) {
- OS.XtResizeWidget (handle, width, height, 0);
- parent.relayout ();
- }
-}
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setText (string);
- Point size = computeSize ();
- setSize (size.x, size.y);
- redraw ();
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- checkWidget();
- if ((style & SWT.SEPARATOR) == 0) return;
- if (width < 0) return;
- int [] argList = {OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- setSize (width, argList [1]);
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getBounds ());
- }
-}
-void setDrawPressed (boolean value) {
- int shadowType = value ? OS.XmSHADOW_IN : OS.XmSHADOW_OUT;
- int [] argList = {OS.XmNshadowType, shadowType};
- OS.XtSetValues(handle, argList, argList.length / 2);
-}
-int processKeyDown (int callData) {
- XKeyEvent xEvent = new XKeyEvent ();
- OS.memmove (xEvent, callData, XKeyEvent.sizeof);
-
- /*
- * Forward the key event to the parent.
- * This is necessary so that mouse listeners
- * in the parent will be called, despite the
- * fact that the event did not really occur
- * in X in the parent. This is done to be
- * compatible with Windows.
- */
- xEvent.window = OS.XtWindow (parent.handle);
-// OS.memmove (callData, xEvent, XKeyEvent.sizeof);
- parent.processKeyDown (callData);
- return 0;
-}
-int processKeyUp (int callData) {
- XKeyEvent xEvent = new XKeyEvent ();
- OS.memmove (xEvent, callData, XKeyEvent.sizeof);
- int [] keysym = new int [1];
- OS.XLookupString (xEvent, null, 0, keysym, null);
- keysym [0] &= 0xFFFF;
- switch (keysym [0]) {
- case OS.XK_space:
- case OS.XK_Return:
- click (keysym [0] == OS.XK_Return, xEvent);
- break;
- }
- /*
- * Forward the key event to the parent.
- * This is necessary so that mouse listeners
- * in the parent will be called, despite the
- * fact that the event did not really occur
- * in X in the parent. This is done to be
- * compatible with Windows.
- */
- xEvent.window = OS.XtWindow (parent.handle);
-// OS.memmove (callData, xEvent, XKeyEvent.sizeof);
- parent.processKeyUp (callData);
- return 0;
-}
-int processMouseDown (int callData) {
- Display display = getDisplay ();
-// Shell shell = parent.getShell ();
- display.hideToolTip ();
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- if (xEvent.button == 1) {
- if (!set && (style & SWT.RADIO) == 0) {
- setDrawPressed (!set);
- }
- }
-
- /*
- * Forward the mouse event to the parent.
- * This is necessary so that mouse listeners
- * in the parent will be called, despite the
- * fact that the event did not really occur
- * in X in the parent. This is done to be
- * compatible with Windows.
- */
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- xEvent.window = OS.XtWindow (parent.handle);
- xEvent.x += argList [1]; xEvent.y += argList [3];
- OS.memmove (callData, xEvent, XButtonEvent.sizeof);
- parent.processMouseDown (callData);
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
-// if (!shell.isDisposed()) {
-// shell.setActiveControl (parent);
-// }
- return 0;
-}
-int processMouseEnter (int callData) {
- XCrossingEvent xEvent = new XCrossingEvent ();
- OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- if ((xEvent.state & OS.Button1Mask) != 0) setDrawPressed (!set);
- else if ((parent.style & SWT.FLAT) != 0) redraw ();
- return 0;
-}
-int processMouseExit (int callData) {
- Display display = getDisplay ();
- display.removeMouseHoverTimeOut ();
- display.hideToolTip ();
- XCrossingEvent xEvent = new XCrossingEvent ();
- OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- if ((xEvent.state & OS.Button1Mask) != 0) setDrawPressed (set);
- else if ((parent.style & SWT.FLAT) != 0) redraw ();
- return 0;
-}
-Point toControl (Point point) {
- short [] root_x = new short [1], root_y = new short [1];
- OS.XtTranslateCoords (handle, (short) 0, (short) 0, root_x, root_y);
- return new Point (point.x - root_x [0], point.y - root_y [0]);
-}
-boolean translateMnemonic (int key, XKeyEvent xEvent) {
- return parent.translateMnemonic (key, xEvent);
-}
-boolean translateTraversal (int key, XKeyEvent xEvent) {
- return parent.translateTraversal (key, xEvent);
-}
-int processMouseHover (int id) {
- Display display = getDisplay ();
- Point local = toControl (display.getCursorLocation ());
- display.showToolTip (handle, toolTipText);
- return 0;
-}
-int processMouseMove (int callData) {
- Display display = getDisplay ();
- display.addMouseHoverTimeOut (handle);
-
- /*
- * Forward the mouse event to the parent.
- * This is necessary so that mouse listeners
- * in the parent will be called, despite the
- * fact that the event did not really occur
- * in X in the parent. This is done to be
- * compatible with Windows.
- */
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- xEvent.window = OS.XtWindow (parent.handle);
- xEvent.x += argList [1]; xEvent.y += argList [3];
- /*
- * This code is intentionally commented.
- * Currently, the implementation of the
- * mouse move code in the parent interferes
- * with tool tips for tool items.
- */
-// OS.memmove (callData, xEvent, XButtonEvent.sizeof);
-// parent.processMouseMove (callData);
- parent.sendMouseEvent (SWT.MouseMove, 0, xEvent);
-
- return 0;
-}
-int processMouseUp (int callData) {
- Display display = getDisplay ();
- display.hideToolTip();
- XButtonEvent xEvent = new XButtonEvent ();
- OS.memmove (xEvent, callData, XButtonEvent.sizeof);
- if (xEvent.button == 1) {
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int width = argList [1], height = argList [3];
- if (0 <= xEvent.x && xEvent.x < width && 0 <= xEvent.y && xEvent.y < height) {
- click (xEvent.x > width - 12, xEvent);
- }
- setDrawPressed(set);
- }
-
- /*
- * Forward the mouse event to the parent.
- * This is necessary so that mouse listeners
- * in the parent will be called, despite the
- * fact that the event did not really occur
- * in X in the parent. This is done to be
- * compatible with Windows.
- */
- int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- xEvent.window = OS.XtWindow (parent.handle);
- xEvent.x += argList [1]; xEvent.y += argList [3];
- OS.memmove (callData, xEvent, XButtonEvent.sizeof);
- parent.processMouseUp (callData);
-
- return 0;
-}
-int processPaint (int callData) {
- if ((style & SWT.SEPARATOR) != 0) return 0;
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay == 0) return 0;
- int xWindow = OS.XtWindow (handle);
- if (xWindow == 0) return 0;
- int [] argList = {
- OS.XmNcolormap, 0,
- OS.XmNwidth, 0,
- OS.XmNheight, 0,
- };
- OS.XtGetValues (handle, argList, argList.length / 2);
- int width = argList [3], height = argList [5];
-
- Image currentImage = image;
- boolean enabled = getEnabled();
-
- if ((parent.style & SWT.FLAT) != 0) {
- Display display = getDisplay ();
- boolean hasCursor = hasCursor ();
-
- /* Set the shadow thickness */
- int thickness = 0;
- if (set || (hasCursor && enabled)) {
- thickness = Math.min (2, display.buttonShadowThickness);
- }
- argList = new int [] {OS.XmNshadowThickness, thickness};
- OS.XtSetValues (handle, argList, argList.length / 2);
-
- /* Determine if hot image should be used */
- if (enabled && hasCursor && hotImage != null) {
- currentImage = hotImage;
- }
- }
-
- ToolDrawable wrapper = new ToolDrawable ();
- wrapper.device = getDisplay ();
- wrapper.display = xDisplay;
- wrapper.drawable = xWindow;
- wrapper.fontList = parent.fontList;
- wrapper.colormap = argList [1];
- GC gc = new GC (wrapper);
-
- XmAnyCallbackStruct cb = new XmAnyCallbackStruct ();
- OS.memmove (cb, callData, XmAnyCallbackStruct.sizeof);
- if (cb.event != 0) {
- XExposeEvent xEvent = new XExposeEvent ();
- OS.memmove (xEvent, cb.event, XExposeEvent.sizeof);
- Rectangle rect = new Rectangle (xEvent.x, xEvent.y, xEvent.width, xEvent.height);
- gc.setClipping (rect);
- }
-
- if (!enabled) {
- Display display = getDisplay ();
- currentImage = disabledImage;
- if (currentImage == null) {
- currentImage = new Image (display, image, SWT.IMAGE_DISABLE);
- }
- Color disabledColor = display.getSystemColor (SWT.COLOR_WIDGET_NORMAL_SHADOW);
- gc.setForeground (disabledColor);
- } else {
- gc.setForeground (parent.getForeground ());
- }
- gc.setBackground (parent.getBackground ());
-
- int textX = 0, textY = 0, textWidth = 0, textHeight = 0;
- if (text.length () != 0) {
- int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_MNEMONIC;
- Point textExtent = gc.textExtent (text, flags);
- textWidth = textExtent.x;
- textHeight = textExtent.y;
- }
- int imageX = 0, imageY = 0, imageWidth = 0, imageHeight = 0;
- if (currentImage != null) {
- Rectangle imageBounds = currentImage.getBounds ();
- imageWidth = imageBounds.width;
- imageHeight = imageBounds.height;
- }
-
- int spacing = 0;
- if (textWidth != 0 && imageWidth != 0) spacing = 2;
- if ((parent.style & SWT.RIGHT) != 0) {
- imageX = (width - imageWidth - textWidth - spacing) / 2;
- imageY = (height - imageHeight) / 2;
- textX = spacing + imageX + imageWidth;
- textY = (height - textHeight) / 2;
- } else {
- imageX = (width - imageWidth) / 2;
- imageY = (height - imageHeight - textHeight - spacing) / 2;
- textX = (width - textWidth) / 2;
- textY = spacing + imageY + imageHeight;
- }
-
- if ((style & SWT.DROP_DOWN) != 0) {
- textX -= 6; imageX -=6;
- }
- if (textWidth > 0) {
- int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_MNEMONIC;
- gc.drawText(text, textX, textY, flags);
- }
- if (imageWidth > 0) gc.drawImage(currentImage, imageX, imageY);
- if ((style & SWT.DROP_DOWN) != 0) {
- int startX = width - 12, startY = (height - 2) / 2;
- int [] arrow = {startX, startY, startX + 3, startY + 3, startX + 6, startY};
- gc.setBackground (parent.getForeground ());
- gc.fillPolygon (arrow);
- gc.drawPolygon (arrow);
- }
- gc.dispose ();
-
- if (!enabled && disabledImage == null) {
- if (currentImage != null) currentImage.dispose ();
- }
- return 0;
-}
-void propagateWidget (boolean enabled) {
- propagateHandle (enabled, handle);
- /*
- * Tool items participate in focus traversal only when
- * the tool bar takes focus.
- */
- if ((parent.style & SWT.NO_FOCUS) != 0) {
- if (enabled) {
- int [] argList = {OS.XmNtraversalOn, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java
deleted file mode 100755
index d7c6c476aa..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java
+++ /dev/null
@@ -1,577 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement rubber banding rectangles.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Move</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tracker extends Widget {
- Composite parent;
- Display display;
- boolean tracking, stippled;
- Rectangle [] rectangles, proportions;
- int cursorOrientation = SWT.NONE;
- int cursor;
- final static int STEPSIZE_SMALL = 1;
- final static int STEPSIZE_LARGE = 9;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tracker (Composite parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- display = parent.getDisplay ();
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the tracker on the currently active
- * display if there is one. If there is no current display, the
- * tracker is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the tracker on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Tracker (Display display, int style) {
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.display = display;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Move,typedListener);
-}
-
-Point adjustMoveCursor (int xDisplay, int xWindow) {
- final int unused[] = new int[1];
- int actualX[] = new int[1];
- int actualY[] = new int[1];
-
- Rectangle bounds = computeBounds ();
- int newX = bounds.x + bounds.width / 2;
- int newY = bounds.y;
-
- OS.XWarpPointer (xDisplay, OS.None, xWindow, 0, 0, 0, 0, newX, newY);
- /*
- * The call to XWarpPointer does not always place the pointer on the
- * exact location that is specified, so do a query (below) to get the
- * actual location of the pointer after it has been moved.
- */
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, actualX, actualY, unused, unused, unused);
- return new Point (actualX[0], actualY[0]);
-}
-Point adjustResizeCursor (int xDisplay, int xWindow) {
- int newX, newY;
- Rectangle bounds = computeBounds ();
-
- if ((cursorOrientation & SWT.LEFT) != 0) {
- newX = bounds.x;
- } else if ((cursorOrientation & SWT.RIGHT) != 0) {
- newX = bounds.x + bounds.width;
- } else {
- newX = bounds.x + bounds.width / 2;
- }
-
- if ((cursorOrientation & SWT.UP) != 0) {
- newY = bounds.y;
- } else if ((cursorOrientation & SWT.DOWN) != 0) {
- newY = bounds.y + bounds.height;
- } else {
- newY = bounds.y + bounds.height / 2;
- }
-
- final int unused[] = new int[1];
- int actualX[] = new int[1];
- int actualY[] = new int[1];
- OS.XWarpPointer (xDisplay, SWT.NONE, xWindow, 0, 0, 0, 0, newX, newY);
- /*
- * The call to XWarpPointer does not always place the pointer on the
- * exact location that is specified, so do a query (below) to get the
- * actual location of the pointer after it has been moved.
- */
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, actualX, actualY, unused, unused, unused);
- return new Point (actualX[0], actualY[0]);
-}
-static int checkStyle (int style) {
- if ((style & (SWT.LEFT | SWT.RIGHT | SWT.UP | SWT.DOWN)) == 0) {
- style |= SWT.LEFT | SWT.RIGHT | SWT.UP | SWT.DOWN;
- }
- return style;
-}
-/**
- * Stop displaying the tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget ();
- tracking = false;
-}
-Rectangle computeBounds () {
- int xMin = rectangles [0].x;
- int yMin = rectangles [0].y;
- int xMax = rectangles [0].x + rectangles [0].width;
- int yMax = rectangles [0].y + rectangles [0].height;
-
- for (int i = 1; i < rectangles.length; i++) {
- if (rectangles [i].x < xMin) xMin = rectangles [i].x;
- if (rectangles [i].y < yMin) yMin = rectangles [i].y;
- int rectRight = rectangles [i].x + rectangles [i].width;
- if (rectRight > xMax) xMax = rectRight;
- int rectBottom = rectangles [i].y + rectangles [i].height;
- if (rectBottom > yMax) yMax = rectBottom;
- }
-
- return new Rectangle (xMin, yMin, xMax - xMin, yMax - yMin);
-}
-
-Rectangle [] computeProportions (Rectangle [] rects) {
- Rectangle [] result = new Rectangle [rects.length];
- Rectangle bounds = computeBounds ();
- for (int i = 0; i < rects.length; i++) {
- result[i] = new Rectangle (
- (rects[i].x - bounds.x) * 100 / bounds.width,
- (rects[i].y - bounds.y) * 100 / bounds.height,
- rects[i].width * 100 / bounds.width,
- rects[i].height * 100 / bounds.height);
- }
- return result;
-}
-
-void drawRectangles () {
- if (parent != null) {
- if (parent.isDisposed ()) return;
- parent.getShell ().update ();
- } else {
- display.update ();
- }
- int xDisplay = display.xDisplay;
- int color = OS.XWhitePixel (xDisplay, 0);
- int xWindow = OS.XDefaultRootWindow (xDisplay);
- if (parent != null) {
- xWindow = OS.XtWindow (parent.handle);
- if (xWindow == 0) return;
- int [] argList = {OS.XmNforeground, 0, OS.XmNbackground, 0};
- OS.XtGetValues (parent.handle, argList, argList.length / 2);
- color = argList [1] ^ argList [3];
- }
- int gc = OS.XCreateGC (xDisplay, xWindow, 0, null);
- OS.XSetForeground (xDisplay, gc, color);
- OS.XSetSubwindowMode (xDisplay, gc, OS.IncludeInferiors);
- OS.XSetFunction (xDisplay, gc, OS.GXxor);
- int stipplePixmap = 0;
- if (stippled) {
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- stipplePixmap = OS.XCreateBitmapFromData (xDisplay, xWindow, bits, 8, 8);
- OS.XSetStipple (xDisplay, gc, stipplePixmap);
- OS.XSetFillStyle (xDisplay, gc, OS.FillStippled);
- OS.XSetLineAttributes (xDisplay, gc, 3, OS.LineSolid, OS.CapButt, OS.JoinMiter);
- }
- for (int i=0; i<rectangles.length; i++) {
- Rectangle rect = rectangles [i];
- OS.XDrawRectangle (xDisplay, xWindow, gc, rect.x, rect.y, rect.width, rect.height);
- }
- if (stippled) {
- OS.XFreePixmap (xDisplay, stipplePixmap);
- }
- OS.XFreeGC (xDisplay, gc);
-}
-public Display getDisplay () {
- return display;
-}
-/**
- * Returns the bounds of the Rectangles being drawn.
- *
- * @return the bounds of the Rectangles being drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle [] getRectangles () {
- checkWidget ();
- return rectangles;
-}
-/**
- * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
- *
- * @return the stippled effect of the rectangles
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getStippled () {
- checkWidget ();
- return stippled;
-}
-
-void moveRectangles (int xChange, int yChange) {
- if (xChange < 0 && ((style & SWT.LEFT) == 0)) return;
- if (xChange > 0 && ((style & SWT.RIGHT) == 0)) return;
- if (yChange < 0 && ((style & SWT.UP) == 0)) return;
- if (yChange > 0 && ((style & SWT.DOWN) == 0)) return;
- for (int i = 0; i < rectangles.length; i++) {
- rectangles [i].x += xChange;
- rectangles [i].y += yChange;
- }
-}
-
-/**
- * Start displaying the Tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean open () {
- checkWidget ();
- if (rectangles == null) return false;
- int xDisplay = display.xDisplay;
- int color = OS.XWhitePixel (xDisplay, 0);
- int xWindow = OS.XDefaultRootWindow (xDisplay);
- if (parent != null) {
- xWindow = OS.XtWindow (parent.handle);
- if (xWindow == 0) return false;
- }
- boolean cancelled = false;
- tracking = true;
- drawRectangles ();
- int [] oldX = new int [1], oldY = new int [1];
- int [] unused = new int [1];
- Point cursorPos;
- if ((style & SWT.MENU) != 0) {
- if ((style & SWT.RESIZE) != 0) {
- cursorPos = adjustResizeCursor (xDisplay, xWindow);
- } else {
- cursorPos = adjustMoveCursor (xDisplay, xWindow);
- }
- oldX [0] = cursorPos.x; oldY [0] = cursorPos.y;
- } else {
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, oldX, oldY, unused, unused, unused);
- }
-
- XAnyEvent xEvent = new XAnyEvent ();
- int [] newX = new int [1], newY = new int [1];
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- /*
- * Tracker behaves like a Dialog with its own OS event loop.
- */
- while (tracking) {
- if (parent != null && parent.isDisposed ()) break;
- OS.XtAppNextEvent (xtContext, xEvent);
- switch (xEvent.type) {
- case OS.MotionNotify:
- if (cursor != 0) {
- OS.XChangeActivePointerGrab (
- xDisplay,
- OS.ButtonPressMask | OS.ButtonReleaseMask | OS.PointerMotionMask,
- cursor,
- OS.CurrentTime);
- }
- // fall through
- case OS.ButtonRelease:
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, newX, newY, unused, unused, unused);
- if (oldX [0] != newX [0] || oldY [0] != newY [0]) {
- drawRectangles ();
- Event event = new Event ();
- event.x = newX [0];
- event.y = newY [0];
- if ((style & SWT.RESIZE) != 0) {
- resizeRectangles (newX [0] - oldX [0], newY [0] - oldY [0]);
- sendEvent (SWT.Resize, event);
- cursorPos = adjustResizeCursor (xDisplay, xWindow);
- newX [0] = cursorPos.x; newY [0] = cursorPos.y;
- } else {
- moveRectangles (newX [0] - oldX [0], newY [0] - oldY [0]);
- sendEvent (SWT.Move, event);
- }
- /*
- * It is possible (but unlikely) that application code
- * could have disposed the widget in the move event.
- * If this happens then return false to indicate that
- * the move failed.
- */
- if (isDisposed ()) return false;
- drawRectangles ();
- oldX [0] = newX [0]; oldY [0] = newY [0];
- }
- tracking = xEvent.type != OS.ButtonRelease;
- break;
- case OS.KeyPress:
- XKeyEvent keyEvent = new XKeyEvent ();
- OS.memmove (keyEvent, xEvent, XKeyEvent.sizeof);
- if (keyEvent.keycode != 0) {
- int [] keysym = new int [1];
- OS.XLookupString (keyEvent, null, 0, keysym, null);
- keysym [0] &= 0xFFFF;
- int xChange = 0, yChange = 0;
- int stepSize = ((keyEvent.state & OS.ControlMask) != 0) ? STEPSIZE_SMALL : STEPSIZE_LARGE;
- switch (keysym [0]) {
- case OS.XK_Return:
- tracking = false;
- /*
- * Eat the subsequent KeyRelease event
- */
- OS.XtAppNextEvent (xtContext, xEvent);
- break;
- case OS.XK_Escape:
- case OS.XK_Cancel:
- tracking = false;
- cancelled = true;
- /*
- * Eat the subsequent KeyRelease event
- */
- OS.XtAppNextEvent (xtContext, xEvent);
- break;
- case OS.XK_Left:
- xChange = -stepSize;
- break;
- case OS.XK_Right:
- xChange = stepSize;
- break;
- case OS.XK_Up:
- yChange = -stepSize;
- break;
- case OS.XK_Down:
- yChange = stepSize;
- break;
- }
- if (xChange != 0 || yChange != 0) {
- drawRectangles ();
- Event event = new Event ();
- event.x = oldX[0] + xChange;
- event.y = oldY[0] + yChange;
- if ((style & SWT.RESIZE) != 0) {
- resizeRectangles (xChange, yChange);
- sendEvent (SWT.Resize, event);
- cursorPos = adjustResizeCursor (xDisplay, xWindow);
- } else {
- moveRectangles (xChange, yChange);
- sendEvent (SWT.Move, event);
- cursorPos = adjustMoveCursor (xDisplay, xWindow);
- }
- /*
- * It is possible (but unlikely) that application code
- * could have disposed the widget in the move event.
- * If this happens then return false to indicate that
- * the move failed.
- */
- if (isDisposed ()) return false;
- drawRectangles ();
- oldX[0] = cursorPos.x; oldY[0] = cursorPos.y;
- }
- }
- break;
- case OS.EnterNotify:
- case OS.LeaveNotify:
- /*
- * Do not dispatch these
- */
- break;
- default:
- OS.XtDispatchEvent (xEvent);
- }
- }
- drawRectangles ();
- tracking = false;
- return !cancelled;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
-}
-void resizeRectangles (int xChange, int yChange) {
- /*
- * If the cursor orientation has not been set in the orientation of
- * this change then try to set it here.
- */
- if (xChange < 0 && ((style & SWT.LEFT) != 0) && ((cursorOrientation & SWT.RIGHT) == 0)) {
- cursorOrientation |= SWT.LEFT;
- } else if (xChange > 0 && ((style & SWT.RIGHT) != 0) && ((cursorOrientation & SWT.LEFT) == 0)) {
- cursorOrientation |= SWT.RIGHT;
- } else if (yChange < 0 && ((style & SWT.UP) != 0) && ((cursorOrientation & SWT.DOWN) == 0)) {
- cursorOrientation |= SWT.UP;
- } else if (yChange > 0 && ((style & SWT.DOWN) != 0) && ((cursorOrientation & SWT.UP) == 0)) {
- cursorOrientation |= SWT.DOWN;
- }
- Rectangle bounds = computeBounds ();
- if ((cursorOrientation & SWT.LEFT) != 0) {
- bounds.x += xChange;
- bounds.width -= xChange;
- } else if ((cursorOrientation & SWT.RIGHT) != 0) {
- bounds.width += xChange;
- }
- if ((cursorOrientation & SWT.UP) != 0) {
- bounds.y += yChange;
- bounds.height -= yChange;
- } else if ((cursorOrientation & SWT.DOWN) != 0) {
- bounds.height += yChange;
- }
- /*
- * The following are conditions under which the resize should not be applied
- */
- if (bounds.width < 0 || bounds.height < 0) return;
-
- Rectangle [] newRects = new Rectangle [rectangles.length];
- for (int i = 0; i < rectangles.length; i++) {
- Rectangle proportion = proportions[i];
- newRects[i] = new Rectangle (
- proportion.x * bounds.width / 100 + bounds.x,
- proportion.y * bounds.height / 100 + bounds.y,
- proportion.width * bounds.width / 100,
- proportion.height * bounds.height / 100);
- }
- rectangles = newRects;
-}
-
-public void setCursor (Cursor value) {
- checkWidget ();
- cursor = 0;
- if (value != null) cursor = value.handle;
-}
-/**
- * Specify the rectangles that should be drawn.
- *
- * @param rectangles the bounds of the rectangles to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setRectangles (Rectangle [] rectangles) {
- checkWidget ();
- this.rectangles = rectangles;
- proportions = computeProportions (rectangles);
-}
-/**
- * Change the appearance of the line used to draw the rectangles.
- *
- * @param stippled <code>true</code> if rectangle should appear stippled
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setStippled (boolean stippled) {
- checkWidget ();
- this.stippled = stippled;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java
deleted file mode 100755
index 187774b1d5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java
+++ /dev/null
@@ -1,921 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * This class is the abstract superclass of all user interface objects.
- * Widgets are created, disposed and issue notification to listeners
- * when events occur which affect them.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Dispose</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation. However, it has not been marked
- * final to allow those outside of the SWT development team to implement
- * patched versions of the class in order to get around specific
- * limitations in advance of when those limitations can be addressed
- * by the team. Any class built using subclassing to access the internals
- * of this class will likely fail to compile or run between releases and
- * may be strongly platform specific. Subclassing should not be attempted
- * without an intimate and detailed understanding of the workings of the
- * hierarchy. No support is provided for user-written classes which are
- * implemented as subclasses of this class.
- * </p>
- *
- * @see #checkSubclass
- */
-public abstract class Widget {
- public int handle;
- int style, state;
- EventTable eventTable;
- Object data;
- String [] keys;
- Object [] values;
-
- /* Global state flags */
-// static final int AUTOMATIC = 0x00000001;
-// static final int ACTIVE = 0x00000002;
-// static final int AUTOGRAB = 0x00000004;
-// static final int MULTIEXPOSE = 0x00000008;
-// static final int RESIZEREDRAW = 0x00000010;
-// static final int WRAP = 0x00000020;
-// static final int DISABLED = 0x00000040;
-// static final int HIDDEN = 0x00000080;
-// static final int FOREGROUND = 0x00000100;
-// static final int BACKGROUND = 0x00000200;
- static final int DISPOSED = 0x00000400;
- static final int HANDLE = 0x00000800;
- static final int CANVAS = 0x00001000;
-
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
-
- /* Global widget variables */
- static final char Mnemonic = '&';
-
- /* DBCS flags */
- static final boolean IsDBLocale;
- static {
- IsDBLocale = OS.MB_CUR_MAX () != 1;
- }
-Widget () {
- /* Do nothing */
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see #checkSubclass
- * @see #getStyle
- */
-public Widget (Widget parent, int style) {
- checkSubclass ();
- checkParent (parent);
- this.style = style;
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when an event of the given type occurs. When the
- * event does occur in the widget, the listener is notified by
- * sending it the <code>handleEvent()</code> message.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #removeListener
- */
-public void addListener (int eventType, Listener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new EventTable ();
- eventTable.hook (eventType, handler);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when the widget is disposed. When the widget is
- * disposed, the listener is notified by sending it the
- * <code>widgetDisposed()</code> message.
- *
- * @param listener the listener which should be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void addDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Dispose, typedListener);
-}
-static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
- int mask = int0 | int1 | int2 | int3 | int4 | int5;
- if ((style & mask) == 0) style |= int0;
- if ((style & int0) != 0) style = (style & ~mask) | int0;
- if ((style & int1) != 0) style = (style & ~mask) | int1;
- if ((style & int2) != 0) style = (style & ~mask) | int2;
- if ((style & int3) != 0) style = (style & ~mask) | int3;
- if ((style & int4) != 0) style = (style & ~mask) | int4;
- if ((style & int5) != 0) style = (style & ~mask) | int5;
- return style;
-}
-void checkParent (Widget parent) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (parent.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-/**
- * Checks that this class can be subclassed.
- * <p>
- * IMPORTANT: By providing an implementation of this method that
- * allows subclassing in a subclass of this class, you agree to
- * be fully responsible for the fact that any such subclass will
- * likely fail between releases and will be strongly platform
- * specific. No support is provided for classes which are implemented
- * as subclasses of this class. The use of subclassing is intended
- * purely to enable those outside of the development team to implement
- * a patched version of the class in an emergency. Subclassing should
- * not be attempted without an intimate and detailed understanding of
- * the hierarchy.
- *
- * @exception SWTError <ul>
- * <li>ERROR_ILLEGAL_SUBCLASS when called</li>
- * </ul>
- */
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-/**
-* Checks access to a widget.
-* <p>
-* Throws an exception when access to the widget
-* is denied.
-*
-* It is an error to call a method on a widget that
-* has been disposed or to call a method on a widget
-* from a thread that is different from the thread
-* that created the widget. There may be more or
-* less error checks in future or different versions
-* of SWT may issue different errors.
-*
-* This method is intended to be called by widget
-* implementors to enforce the standard SWT error
-* checking prologue in API methods.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-void createHandle (int index) {
- /* Do nothing */
-}
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- register ();
- manageChildren ();
-}
-void deregister () {
- if (handle == 0) return;
- WidgetTable.remove (handle);
-}
-void destroyWidget () {
- int topHandle = topHandle ();
- releaseHandle ();
- if (topHandle != 0) {
- OS.XtDestroyWidget (topHandle);
- }
-}
-/**
- * Disposes of the operating system resources associated with
- * the receiver and all its descendents. After this method has
- * been invoked, the receiver and all descendents will answer
- * <code>true</code> when sent the message <code>isDisposed()</code>.
- * Any internal connections between the widgets in the tree will
- * have been removed to facilitate garbage collection.
- * <p>
- * NOTE: This method is not called recursively on the descendents
- * of the receiver. This means that, widget implementers can not
- * detect when a widget is being disposed of by re-implementing
- * this method, but should instead listen for the <code>Dispose</code>
- * event.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #addDisposeListener
- * @see #removeDisposeListener
- * @see #checkWidget
- */
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed()) return;
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- releaseChild ();
- releaseWidget ();
- destroyWidget ();
-}
-void enableHandle (boolean enabled, int widgetHandle) {
- int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
- OS.XtSetValues (widgetHandle, argList, argList.length / 2);
-}
-void error (int code) {
- SWT.error(code);
-}
-/**
- * Returns the application defined widget data associated
- * with the receiver, or null if it has not been set. The
- * <em>widget data</em> is a single, unnamed field that is
- * stored with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @return the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData () {
- checkWidget();
- return data;
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData (String key) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the <code>Display</code> that is associated with
- * the receiver.
- * <p>
- * A widget's display is either provided when it is created
- * (for example, top level <code>Shell</code>s) or is the
- * same as its parent's display.
- * </p>
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public abstract Display getDisplay ();
-String getName () {
- String string = getClass ().getName ();
- int index = string.lastIndexOf ('.');
- if (index == -1) return string;
- return string.substring (index + 1, string.length ());
-}
-String getNameText () {
- return "";
-}
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created. This can occur when the underlying
- * operating system does not support a particular combination of
- * requested styles. For example, if the platform widget used to
- * implement a particular SWT widget always has scroll bars, the
- * result of calling this method would always have the
- * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- checkWidget();
- return style;
-}
-void hookEvents () {
- /* Do nothing */
-}
-boolean hooks (int eventType) {
- if (eventTable == null) return false;
- return eventTable.hooks (eventType);
-}
-/**
- * Returns <code>true</code> if the widget has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the widget.
- * When a widget has been disposed, it is an error to
- * invoke any other method using the widget.
- * </p>
- *
- * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- if (handle != 0) return false;
- if ((state & HANDLE) != 0) return true;
- return (state & DISPOSED) != 0;
-}
-/**
- * Return the listening state.
- * <p>
- * Returns true if there is a listener, listening for the eventType.
- * Otherwise, returns false.
- *
- * @param eventType the type of event
- * @return true if the event is hooked
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when the name is null</li>
- * </ul>
- */
-protected boolean isListening (int eventType) {
- checkWidget();
- return hooks (eventType);
-}
-boolean isValidSubclass () {
- return Display.isValidClass (getClass ());
-}
-boolean isValidThread () {
- return getDisplay ().isValidThread ();
-}
-void manageChildren () {
- /* Do nothing */
-}
-char mbcsToWcs (int ch) {
- return mbcsToWcs (ch, null);
-}
-char mbcsToWcs (int ch, String codePage) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return (char) ch;
- byte [] buffer;
- if (key <= 0xFF) {
- buffer = new byte [1];
- buffer [0] = (byte) key;
- } else {
- buffer = new byte [2];
- buffer [0] = (byte) ((key >> 8) & 0xFF);
- buffer [1] = (byte) (key & 0xFF);
- }
- char [] result = Converter.mbcsToWcs (codePage, buffer);
- if (result.length == 0) return 0;
- return result [0];
-}
-/**
- * Notifies all of the receiver's listeners for events
- * of the given type that one such event has occurred by
- * invoking their <code>handleEvent()</code> method.
- *
- * @param eventType the type of event which has occurred
- * @param event the event data
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- eventTable.sendEvent (event);
-}
-void postEvent (int eventType) {
- if (eventTable == null) return;
- postEvent (eventType, new Event ());
-}
-void postEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- Display display = getDisplay ();
- if (event.time == 0) {
- event.time = OS.XtLastTimestampProcessed (display.xDisplay);
- }
- display.postEvent (event);
-}
-int processArm (int callData) {
- return 0;
-}
-int processDispose (int callData) {
- return 0;
-}
-int processDefaultSelection (int callData) {
- return 0;
-}
-int processEvent (int eventNumber, int callData) {
- switch (eventNumber) {
- case SWT.Arm: return processArm (callData);
- case SWT.Dispose: return processDispose (callData);
- case SWT.DefaultSelection: return processDefaultSelection (callData);
- case SWT.FocusIn: return processSetFocus (callData);
- case SWT.Help: return processHelp (callData);
- case SWT.Hide: return processHide (callData);
- case SWT.KeyDown: return processKeyDown (callData);
- case SWT.KeyUp: return processKeyUp (callData);
- case SWT.Modify: return processModify (callData);
- case SWT.MouseDown: return processMouseDown (callData);
- case SWT.MouseEnter: return processMouseEnter (callData);
- case SWT.MouseExit: return processMouseExit (callData);
- case SWT.MouseHover: return processMouseHover (callData);
- case SWT.MouseMove: return processMouseMove (callData);
- case SWT.MouseUp: return processMouseUp (callData);
- case SWT.Paint: return processPaint (callData);
- case SWT.Resize: return processResize (callData);
- case SWT.Show: return processShow (callData);
- case SWT.Selection: return processSelection (callData);
- case SWT.Verify: return processVerify (callData);
- case -1: return processNonMaskable (callData);
- }
- return 0;
-}
-int processHelp (int callData) {
- return 0;
-}
-int processHide (int callData) {
- return 0;
-}
-int processKeyDown (int callData) {
- return 0;
-}
-int processKeyUp (int callData) {
- return 0;
-}
-int processModify (int callData) {
- return 0;
-}
-int processMouseDown (int callData) {
- return 0;
-}
-int processMouseEnter (int callData) {
- return 0;
-}
-int processMouseExit (int callData) {
- return 0;
-}
-int processMouseHover (int id) {
- return 0;
-}
-int processMouseMove (int callData) {
- return 0;
-}
-int processMouseUp (int callData) {
- return 0;
-}
-int processNonMaskable (int callData) {
- return 0;
-}
-int processPaint (int callData) {
- return 0;
-}
-int processResize (int callData) {
- return 0;
-}
-int processSelection (int callData) {
- return 0;
-}
-int processSetFocus (int callData) {
- return 0;
-}
-int processShow (int callData) {
- return 0;
-}
-int processVerify (int callData) {
- return 0;
-}
-void propagateHandle (boolean enabled, int widgetHandle) {
- int xDisplay = OS.XtDisplay (widgetHandle);
- if (xDisplay == 0) return;
- int xWindow = OS.XtWindow (widgetHandle);
- if (xWindow == 0) return;
- /*
- * Get the event mask from the widget. The event mask
- * returned by XtBuildEventMask () includes the masks
- * associated with all callbacks and event handlers
- * that have been hooked on the widget.
- */
- int event_mask = OS.XtBuildEventMask (widgetHandle);
- int do_not_propagate_mask =
- OS.KeyPressMask | OS.KeyReleaseMask | OS.ButtonPressMask |
- OS.ButtonReleaseMask | OS.PointerMotionMask;
- if (!enabled) {
- /*
- * Attempting to propogate EnterWindowMask and LeaveWindowMask
- * causes an X error so these must be specially cleared out from
- * the event mask, not included in the propogate mask.
- */
- event_mask &= ~(do_not_propagate_mask | OS.EnterWindowMask | OS.LeaveWindowMask);
- do_not_propagate_mask = 0;
- }
- XSetWindowAttributes attributes = new XSetWindowAttributes ();
- attributes.event_mask = event_mask;
- attributes.do_not_propagate_mask = do_not_propagate_mask;
- OS.XChangeWindowAttributes (xDisplay, xWindow, OS.CWDontPropagate | OS.CWEventMask, attributes);
- int [] argList = {OS.XmNtraversalOn, enabled ? 1 : 0};
- OS.XtSetValues (widgetHandle, argList, argList.length / 2);
-}
-void redrawHandle (int x, int y, int width, int height, int widgetHandle) {
- int display = OS.XtDisplay (widgetHandle);
- if (display == 0) return;
- int window = OS.XtWindow (widgetHandle);
- if (window == 0) return;
- int [] argList = {OS.XmNborderWidth, 0, OS.XmNborderColor, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- if (argList [1] != 0) {
- /* Force the border to repaint by setting the color */
- OS.XtSetValues (widgetHandle, argList, argList.length / 2);
- }
- OS.XClearArea (display, window, x, y, width, height, true);
-}
-void register () {
- if (handle == 0) return;
- WidgetTable.put (handle, this);
-}
-void releaseChild () {
- /* Do nothing */
-}
-void releaseHandle () {
- handle = 0;
- state |= DISPOSED;
-}
-void releaseWidget () {
- sendEvent (SWT.Dispose);
- deregister ();
- eventTable = null;
- data = null;
- keys = null;
- values = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-public void removeListener (int eventType, Listener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
-* Warning: API under construction.
-*/
-protected void removeListener (int eventType, SWTEventListener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when the widget is disposed.
- *
- * @param listener the listener which should no longer be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void removeDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Dispose, listener);
-}
-void sendEvent (int eventType) {
- if (eventTable == null) return;
- sendEvent (eventType, new Event ());
-}
-void setInputState (Event event, XInputEvent xEvent) {
- if ((xEvent.state & OS.Mod1Mask) != 0) event.stateMask |= SWT.ALT;
- if ((xEvent.state & OS.ShiftMask) != 0) event.stateMask |= SWT.SHIFT;
- if ((xEvent.state & OS.ControlMask) != 0) event.stateMask |= SWT.CONTROL;
- if ((xEvent.state & OS.Button1Mask) != 0) event.stateMask |= SWT.BUTTON1;
- if ((xEvent.state & OS.Button2Mask) != 0) event.stateMask |= SWT.BUTTON2;
- if ((xEvent.state & OS.Button3Mask) != 0) event.stateMask |= SWT.BUTTON3;
-}
-void setKeyState (Event event, XKeyEvent xEvent) {
- if (xEvent.keycode != 0) {
- byte [] buffer = new byte [1];
- int [] keysym = new int [1];
- OS.XLookupString (xEvent, buffer, buffer.length, keysym, null);
- /*
- * Bug in MOTIF. On Solaris only, XK_F11 and XK_F12 are not
- * translated correctly by XLookupString(). They are mapped
- * to 0x1005FF10 and 0x1005FF11 respectively. The fix is to
- * look for these values explicitly and correct them.
- */
- if (OS.IsSunOS && keysym [0] != 0) {
- switch (keysym [0]) {
- case 0x1005FF10:
- keysym [0] = OS.XK_F11;
- buffer [0] = 0;
- break;
- case 0x1005FF11:
- keysym [0] = OS.XK_F12;
- buffer [0] = 0;
- break;
- }
- /*
- * Bug in MOTIF. On Solaris only, there is garbage in the
- * high 16-bits for Keysyms such as XK_Down. Since Keysyms
- * must be 16-bits to fit into a Character, mask away the
- * high 16-bits on all platforms.
- */
- keysym [0] &= 0xFFFF;
- }
- if (buffer [0] == 0) {
- event.keyCode = Display.translateKey (keysym [0]);
- /*
- * If translateKey () could not find a translation for the keysym
- * then attempt some known keysyms for which we can provide the
- * appropriate character.
- */
- if (event.keyCode == 0) {
- switch (keysym [0]) {
- case OS.XK_ISO_Left_Tab: event.character = '\t'; break;
- /*
- * Bug in Motif. When CTRL+space is pressed XLookupString
- * does not fill buffer [0] with anything, so we fill in
- * the event's character here.
- */
- case OS.XK_space: event.character = ' '; break;
- }
- }
- } else {
- event.character = mbcsToWcs (buffer [0] & 0xFF);
- }
- }
- setInputState (event, xEvent);
-}
-void sendEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- if (event.time == 0) {
- Display display = getDisplay ();
- event.time = OS.XtLastTimestampProcessed (display.xDisplay);
- }
- eventTable.sendEvent (event);
-}
-/**
- * Sets the application defined widget data associated
- * with the receiver to be the argument. The <em>widget
- * data</em> is a single, unnamed field that is stored
- * with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @param data the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- */
-public void setData (Object data) {
- checkWidget();
- this.data = data;
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given value.
- * <p>
- * Applications may associate arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getData
- */
-public void setData (String key, Object value) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- String string = "*Disposed*";
- if (!isDisposed ()) {
- string = "*Wrong Thread*";
- if (isValidThread ()) string = getNameText ();
- }
- return getName () + " {" + string + "}";
-}
-int topHandle () {
- return handle;
-}
-boolean translateMnemonic (int key, XKeyEvent xEvent) {
- return false;
-}
-boolean translateTraversal (int key, XKeyEvent xEvent) {
- return false;
-}
-int wcsToMbcs (char ch) {
- return wcsToMbcs (ch, null);
-}
-int wcsToMbcs (char ch, String codePage) {
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return ch;
- byte [] buffer = Converter.wcsToMbcs (codePage, new char [] {ch}, false);
- if (buffer.length == 1) return (char) buffer [0];
- if (buffer.length == 2) {
- return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
- }
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/WidgetTable.java
deleted file mode 100755
index 19073205ad..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/WidgetTable.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-
-class WidgetTable {
- static int FreeSlot = 0;
- static int GrowSize = 1024;
- static int [] IndexTable = new int [GrowSize];
- static Shell [] Shells = new Shell [GrowSize / 8];
- static Widget [] WidgetTable = new Widget [GrowSize];
- static int [] ArgList = {OS.XmNuserData, 0};
- static {
- for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
- IndexTable [GrowSize - 1] = -1;
- }
-public static synchronized Widget get (int handle) {
- if (handle == 0) return null;
- if (OS.XtIsSubclass (handle, OS.ShellWidgetClass ())) {
- for (int i=0; i<Shells.length; i++) {
- Widget shell = Shells [i];
- if ((shell != null) && (shell.topHandle () == handle)) return shell;
- }
- return null;
- }
- ArgList [1] = 0;
- OS.XtGetValues (handle, ArgList, ArgList.length / 2);
- if (ArgList [1] == 0) return null;
- int index = ArgList [1] - 1;
- if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
- return null;
-}
-public synchronized static void put (int handle, Widget widget) {
- if (handle == 0) return;
- if (OS.XtIsSubclass (handle, OS.ShellWidgetClass ())) {
- for (int i=0; i<Shells.length; i++) {
- if (Shells [i] == null) {
- Shells [i] = (Shell) widget;
- return;
- }
- }
- Shell [] newShells = new Shell [Shells.length + GrowSize / 8];
- System.arraycopy (Shells, 0, newShells, 0, Shells.length);
- newShells [Shells.length] = (Shell) widget;
- Shells = newShells;
- return;
- }
- if (FreeSlot == -1) {
- int length = (FreeSlot = IndexTable.length) + GrowSize;
- int [] newIndexTable = new int [length];
- Widget [] newWidgetTable = new Widget [length];
- System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
- System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
- for (int i=FreeSlot; i<length-1; i++) {
- newIndexTable [i] = i + 1;
- }
- newIndexTable [length - 1] = -1;
- IndexTable = newIndexTable;
- WidgetTable = newWidgetTable;
- }
- ArgList [1] = FreeSlot + 1;
- OS.XtSetValues (handle, ArgList, ArgList.length / 2);
- int oldSlot = FreeSlot;
- FreeSlot = IndexTable [oldSlot];
- IndexTable [oldSlot] = -2;
- WidgetTable [oldSlot] = widget;
-}
-public static synchronized Widget remove (int handle) {
- if (handle == 0) return null;
- if (OS.XtIsSubclass (handle, OS.ShellWidgetClass ())) {
- for (int i=0; i<Shells.length; i++) {
- Widget shell = Shells [i];
- if ((shell != null) && (shell.topHandle () == handle)) {
- Shells [i] = null;
- return shell;
- }
- }
- return null;
- }
- ArgList [1] = 0;
- Widget widget = null;
- OS.XtGetValues (handle, ArgList, ArgList.length / 2);
- int index = ArgList [1] - 1;
- if (0 <= index && index < WidgetTable.length) {
- widget = WidgetTable [index];
- WidgetTable [index] = null;
- IndexTable [index] = FreeSlot;
- FreeSlot = index;
- ArgList [1] = 0;
- OS.XtSetValues (handle, ArgList, ArgList.length / 2);
- }
- return widget;
-}
-public static synchronized Shell [] shells () {
- int length = 0;
- for (int i=0; i<Shells.length; i++) {
- if (Shells [i] != null) length++;
- }
- int index = 0;
- Shell [] result = new Shell [length];
- for (int i=0; i<Shells.length; i++) {
- Shell widget = Shells [i];
- if (widget != null) result [index++] = widget;
- }
- return result;
-}
-public static synchronized int size () {
- int length = 0;
- for (int i=0; i<Shells.length; i++) {
- if (Shells [i] != null) length++;
- }
- for (int i=0; i<WidgetTable.length; i++) {
- if (WidgetTable [i] != null) length++;
- }
- return length;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Color.java
deleted file mode 100755
index dce4d319ec..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Color.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage the operating system resources that
- * implement SWT's RGB color model. To create a color you can either
- * specify the individual color components as integers in the range
- * 0 to 255 or provide an instance of an <code>RGB</code>.
- * <p>
- * Application code must explicitly invoke the <code>Color.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see RGB
- */
-public final class Color {
-
- /**
- * the handle to the OS color resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this color was created
- */
- Device device;
-
-Color() {
-}
-
-/**
- * Constructs a new instance of this class given a device and the
- * desired red, green and blue values expressed as ints in the range
- * 0 to 255 (where 0 is black and 255 is full brightness). On limited
- * color devices, the color instance created by this call may not have
- * the same RGB values as the ones specified by the arguments. The
- * RGB values on the returned instance will be the color values of
- * the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, int red, int green, int blue) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, red, green, blue);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new instance of this class given a device and an
- * <code>RGB</code> describing the desired red, green and blue values.
- * On limited color devices, the color instance created by this call
- * may not have the same RGB values as the ones specified by the
- * argument. The RGB values on the returned instance will be the color
- * values of the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param RGB the RGB values of the desired color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
- * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, RGB rgb) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, rgb.red, rgb.green, rgb.blue);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the color. Applications must dispose of all colors which
- * they allocate.
- */
-public void dispose() {
- if (handle == -1) return;
-
- handle = -1;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Color)) return false;
- Color color = (Color) object;
- return device == color.device && (handle & 0xFFFFFF) == (color.handle & 0xFFFFFF);
-}
-
-/**
- * Returns the amount of blue in the color, from 0 to 255.
- *
- * @return the blue component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getBlue () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return handle & 0xFF;
-}
-
-/**
- * Returns the amount of green in the color, from 0 to 255.
- *
- * @return the green component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getGreen () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle & 0xFF00) >> 8;
-}
-
-/**
- * Returns the amount of red in the color, from 0 to 255.
- *
- * @return the red component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getRed () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle & 0xFF0000) >> 16;
-}
-
-/**
- * Returns an <code>RGB</code> representing the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public RGB getRGB () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return new RGB((handle & 0xFF0000) >> 16, (handle & 0xFF00) >> 8, handle & 0xFF);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-void init(Device device, int red, int green, int blue) {
- if (red > 255 || red < 0 || green > 255 || green < 0 || blue > 255 || blue < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.device = device;
- handle = (blue & 0xFF) | ((green & 0xFF) << 8) | ((red & 0xFF) << 16);
-}
-
-/**
- * Returns <code>true</code> if the color has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the color.
- * When a color has been disposed, it is an error to
- * invoke any other method using the color.
- *
- * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == -1;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Color {*DISPOSED*}";
- return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
-}
-
-public static Color photon_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Color color = new Color();
- color.handle = handle;
- color.device = device;
- return color;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Cursor.java
deleted file mode 100755
index 2f1eff889d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Cursor.java
+++ /dev/null
@@ -1,298 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * specify the appearance of the on-screen pointer. To create a
- * cursor you specify the device and either a simple cursor style
- * describing one of the standard operating system provided cursors
- * or the image and mask data for the desired appearance.
- * <p>
- * Application code must explicitly invoke the <code>Cursor.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>
- * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
- * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
- * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
- * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
- * </dd>
- * </dl>
- */
-public final class Cursor {
-
- /**
- * the type to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- /**
- * the handle to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int bitmap;
-
- /**
- * the device where this cursor was created
- */
- Device device;
-
-Cursor() {
-}
-
-/**
- * Constructs a new cursor given a device and a style
- * constant describing the desired cursor appearance.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param style the style of cursor to allocate
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
- * </ul>
- *
- * @see Cursor for the supported style values
- */
-public Cursor(Device device, int style) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- switch (style) {
- case SWT.CURSOR_ARROW: type = OS.Ph_CURSOR_POINTER; break;
- case SWT.CURSOR_WAIT: type = OS.Ph_CURSOR_CLOCK; break;
- case SWT.CURSOR_HAND: type = OS.Ph_CURSOR_FINGER; break;
- case SWT.CURSOR_CROSS: type = OS.Ph_CURSOR_CROSSHAIR; break;
- case SWT.CURSOR_APPSTARTING: type = OS.Ph_CURSOR_POINT_WAIT; break;
- case SWT.CURSOR_HELP: type = OS.Ph_CURSOR_QUESTION_POINT; break;
- case SWT.CURSOR_SIZEALL: type = OS.Ph_CURSOR_MOVE; break;
- case SWT.CURSOR_SIZENESW: type = OS.Ph_CURSOR_MOVE; break;
- case SWT.CURSOR_SIZENS: type = OS.Ph_CURSOR_DRAG_VERTICAL; break;
- case SWT.CURSOR_SIZENWSE: type = OS.Ph_CURSOR_MOVE; break;
- case SWT.CURSOR_SIZEWE: type = OS.Ph_CURSOR_DRAG_HORIZONTAL; break;
- case SWT.CURSOR_SIZEN: type = OS.Ph_CURSOR_DRAG_TOP; break;
- case SWT.CURSOR_SIZES: type = OS.Ph_CURSOR_DRAG_BOTTOM; break;
- case SWT.CURSOR_SIZEE: type = OS.Ph_CURSOR_DRAG_RIGHT; break;
- case SWT.CURSOR_SIZEW: type = OS.Ph_CURSOR_DRAG_LEFT; break;
- case SWT.CURSOR_SIZENE: type = OS.Ph_CURSOR_DRAG_TR; break;
- case SWT.CURSOR_SIZESE: type = OS.Ph_CURSOR_DRAG_BR; break;
- case SWT.CURSOR_SIZESW: type = OS.Ph_CURSOR_DRAG_BL; break;
- case SWT.CURSOR_SIZENW: type = OS.Ph_CURSOR_DRAG_TL; break;
- case SWT.CURSOR_UPARROW: type = OS.Ph_CURSOR_FINGER; break;
- case SWT.CURSOR_IBEAM: type = OS.Ph_CURSOR_INSERT; break;
- case SWT.CURSOR_NO: type = OS.Ph_CURSOR_DONT; break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (type == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new cursor given a device, image and mask
- * data describing the desired cursor appearance, and the x
- * and y co-ordinates of the <em>hotspot</em> (that is, the point
- * within the area covered by the cursor which is considered
- * to be where the on-screen pointer is "pointing").
- * <p>
- * The mask data is allowed to be null, but in this case the source
- * must be an ImageData representing an icon that specifies both
- * color data and mask data.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param source the color data for the cursor
- * @param mask the mask data for the cursor (or null)
- * @param hotspotX the x coordinate of the cursor's hotspot
- * @param hotspotY the y coordinate of the cursor's hotspot
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
- * size, or either is not of depth one, or if the hotspot is outside
- * the bounds of the image</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
- * </ul>
- */
-public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) {
- if (source.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- mask = source.getTransparencyMask();
- }
- /* Check the bounds. Mask must be the same size as source */
- if (mask.width != source.width || mask.height != source.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Check color depths */
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (source.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- /* Check the hotspots */
- if (hotspotX >= source.width || hotspotX < 0 ||
- hotspotY >= source.height || hotspotY < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- type = OS.Ph_CURSOR_BITMAP;
-
- short w = (short)source.width;
- short h = (short)source.height;
- ImageData mask1 = new ImageData(w, h, 1, source.palette);
- ImageData mask2 = new ImageData(w, h, 1, mask.palette);
- for (int y=0; y<h; y++) {
- for (int x=0; x<w; x++) {
- int mask1_pixel, src_pixel = source.getPixel(x, y);
- int mask2_pixel, mask_pixel = mask.getPixel(x, y);
- if (src_pixel == 0 && mask_pixel == 0) {
- // BLACK
- mask1_pixel = 0;
- mask2_pixel = 1;
- } else if (src_pixel == 0 && mask_pixel == 1) {
- // WHITE - cursor color
- mask1_pixel = 1;
- mask2_pixel = 0;
- } else if (src_pixel == 1 && mask_pixel == 0) {
- // SCREEN
- mask1_pixel = 0;
- mask2_pixel = 0;
- } else {
- /*
- * Feature in Photon. It is not possible to have
- * the reverse screen case using the Photon support.
- * Reverse screen will be the same as screen.
- */
- // REVERSE SCREEN -> SCREEN
- mask1_pixel = 0;
- mask2_pixel = 0;
- }
- mask1.setPixel(x, y, mask1_pixel);
- mask2.setPixel(x, y, mask2_pixel);
- }
- }
-
- PhCursorDef_t cursor = new PhCursorDef_t();
- cursor.size1_x = w;
- cursor.size1_y = h;
- cursor.offset1_x = (short)-hotspotX;
- cursor.offset1_y = (short)-hotspotY;
- cursor.bytesperline1 = (byte)mask1.bytesPerLine;
- cursor.color1 = OS.Ph_CURSOR_DEFAULT_COLOR;
- cursor.size2_x = w;
- cursor.size2_y = h;
- cursor.offset2_x = (short)-hotspotX;
- cursor.offset2_y = (short)-hotspotY;
- cursor.bytesperline2 = (byte)mask2.bytesPerLine;
- cursor.color2 = 0x000000;
- int mask1Size = cursor.bytesperline1 * cursor.size1_y;
- int mask2Size = cursor.bytesperline2 * cursor.size2_y;
- bitmap = OS.malloc(PhCursorDef_t.sizeof + mask1Size + mask2Size);
- if (bitmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.memmove(bitmap, cursor, PhCursorDef_t.sizeof);
- OS.memmove(bitmap + PhCursorDef_t.sizeof, mask1.data, mask1Size);
- OS.memmove(bitmap + PhCursorDef_t.sizeof + mask1Size, mask2.data, mask2Size);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the cursor. Applications must dispose of all cursors which
- * they allocate.
- */
-public void dispose () {
- if (type == 0) return;
- if (type == OS.Ph_CURSOR_BITMAP && bitmap != 0) {
- OS.free(bitmap);
- }
- type = bitmap = 0;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Cursor)) return false;
- Cursor cursor = (Cursor) object;
- return device == cursor.device && type == cursor.type &&
- bitmap == cursor.bitmap;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return bitmap ^ type;
-}
-
-/**
- * Returns <code>true</code> if the cursor has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the cursor.
- * When a cursor has been disposed, it is an error to
- * invoke any other method using the cursor.
- *
- * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return type == 0;
-}
-
-public static Cursor photon_new(Device device, int type, int bitmap) {
- if (device == null) device = Device.getDevice();
- Cursor cursor = new Cursor();
- cursor.type = type;
- cursor.bitmap = bitmap;
- cursor.device = device;
- return cursor;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return "Cursor {" + type + "," + bitmap + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java
deleted file mode 100755
index 62a8ef0606..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java
+++ /dev/null
@@ -1,467 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-public abstract class Device implements Drawable {
-
- /* Debugging */
- public static boolean DEBUG;
- boolean debug = DEBUG;
- public boolean tracking = DEBUG;
- Error [] errors;
- Object [] objects;
-
- boolean disposed;
-
- /*
- * TEMPORARY CODE. When a graphics object is
- * created and the device parameter is null,
- * the current Display is used. This presents
- * a problem because SWT graphics does not
- * reference classes in SWT widgets. The correct
- * fix is to remove this feature. Unfortunately,
- * too many application programs rely on this
- * feature.
- *
- * This code will be removed in the future.
- */
- protected static Device CurrentDevice;
- protected static Runnable DeviceFinder;
- static {
- try {
- Class.forName ("org.eclipse.swt.widgets.Display");
- } catch (Throwable e) {}
- }
-
-static Device getDevice () {
- if (DeviceFinder != null) DeviceFinder.run();
- Device device = CurrentDevice;
- CurrentDevice = null;
- return device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * You must dispose the device when it is no longer required.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #create
- * @see #init
- * @see DeviceData
- */
-public Device(DeviceData data) {
- if (data != null) {
- debug = data.debug;
- tracking = data.tracking;
- }
- create (data);
- init ();
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
- }
-}
-
-protected void checkDevice () {
- if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-protected void create (DeviceData data) {
-}
-
-protected void destroy () {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver. After this method has been invoked, the receiver
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- *
- * @see #release
- * @see #destroy
- * @see #checkDevice
- */
-public void dispose () {
- if (isDisposed()) return;
- checkDevice ();
- release ();
- destroy ();
- disposed = true;
- if (tracking) {
- objects = null;
- errors = null;
- }
-}
-
-void dispose_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == object) {
- objects [i] = null;
- errors [i] = null;
- return;
- }
- }
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- PgDisplaySettings_t settings = new PgDisplaySettings_t ();
- OS.PgGetVideoMode (settings);
- return new Rectangle (0, 0, settings.xres, settings.yres);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- */
-public Rectangle getClientArea () {
- checkDevice ();
- PhRect_t rect = new PhRect_t ();
- OS.PhWindowQueryVisible (OS.Ph_QUERY_GRAPHICS, 0, 1, rect);
- int width = rect.lr_x - rect.ul_x + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Rectangle (rect.ul_x, rect.ul_y, width, height);
-}
-
-/**
- * Returns the bit depth of the screen, which is the number of
- * bits it takes to represent the number of unique colors that
- * the screen is currently capable of displaying. This number
- * will typically be one of 1, 8, 15, 16, 24 or 32.
- *
- * @return the depth of the screen
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getDepth () {
- checkDevice ();
- PgDisplaySettings_t settings = new PgDisplaySettings_t ();
- OS.PgGetVideoMode (settings);
- PgVideoModeInfo_t mode_info = new PgVideoModeInfo_t ();
- OS.PgGetVideoModeInfo ((short) settings.mode, mode_info);
- return mode_info.bits_per_pixel;
-}
-
-/**
- * Returns a <code>DeviceData</code> based on the receiver.
- * Modifications made to this <code>DeviceData</code> will not
- * affect the receiver.
- *
- * @return a <code>DeviceData</code> containing the device's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see DeviceData
- */
-public DeviceData getDeviceData () {
- checkDevice();
- DeviceData data = new DeviceData ();
- data.debug = debug;
- data.tracking = tracking;
- int count = 0, length = 0;
- if (tracking) length = objects.length;
- for (int i=0; i<length; i++) {
- if (objects [i] != null) count++;
- }
- int index = 0;
- data.objects = new Object [count];
- data.errors = new Error [count];
- for (int i=0; i<length; i++) {
- if (objects [i] != null) {
- data.objects [index] = objects [i];
- data.errors [index] = errors [i];
- index++;
- }
- }
- return data;
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- //NOT DONE
- return new Point (96, 96);
-}
-
-/**
- * Returns <code>FontData</code> objects which describe
- * the fonts which match the given arguments. If the
- * <code>faceName</code> is null, all fonts will be returned.
- *
- * @param faceName the name of the font to look for, or null
- * @param scalable true if scalable fonts should be returned.
- * @return the matching font data
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData [] getFontList (String faceName, boolean scalable) {
- checkDevice ();
- int flags = OS.PHFONT_FIXED | OS.PHFONT_PROP | OS.PFFONT_DONT_SHOW_LEGACY;
- flags |= scalable ? OS.PHFONT_SCALABLE : OS.PHFONT_BITMAP;
- int nfonts = OS.PfQueryFonts(OS.PHFONT_ALL_FONTS, flags, 0, 0);
- if (nfonts <= 0) return new FontData[0];
-
- int list_ptr = OS.malloc(nfonts * FontDetails.sizeof);
- nfonts = OS.PfQueryFonts(OS.PHFONT_ALL_FONTS, flags, list_ptr, nfonts);
- int ptr = list_ptr;
- int nFds = 0;
- FontData[] fds = new FontData[faceName != null ? 4 : nfonts];
- FontDetails details = new FontDetails();
- for (int i = 0; i < nfonts; i++) {
- OS.memmove(details, ptr, FontDetails.sizeof);
- String name = new String(Converter.mbcsToWcs(null, details.desc)).trim();
- if (faceName == null || Compatibility.equalsIgnoreCase(faceName, name)) {
- int size;
- if (details.losize == 0 && details.hisize == 0) size = 9; // This value was taken from the PhAB editor
- else size = details.losize;
- flags = details.flags & ~(OS.PHFONT_INFO_PROP | OS.PHFONT_INFO_FIXED);
- while (flags != 0) {
- int style;
- if ((flags & OS.PHFONT_INFO_PLAIN) != 0) {
- style = SWT.NORMAL;
- flags &= ~OS.PHFONT_INFO_PLAIN;
- } else if ((flags & OS.PHFONT_INFO_BOLD) != 0) {
- style = SWT.BOLD;
- flags &= ~OS.PHFONT_INFO_BOLD;
- } else if ((flags & OS.PHFONT_INFO_ITALIC) != 0) {
- style = SWT.ITALIC;
- flags &= ~OS.PHFONT_INFO_ITALIC;
- } else if ((flags & OS.PHFONT_INFO_BLDITC) != 0) {
- style = SWT.BOLD | SWT.ITALIC;
- flags &= ~OS.PHFONT_INFO_BLDITC;
- } else break;
- if (nFds == fds.length) {
- FontData[] newFds = new FontData[fds.length + nfonts];
- System.arraycopy(fds, 0, newFds, 0, nFds);
- fds = newFds;
- }
- fds[nFds++] = new FontData(name, size, style);
- }
- }
- ptr += FontDetails.sizeof;
- }
- OS.free(list_ptr);
-
- if (nFds == fds.length) return fds;
-
- FontData[] result = new FontData[nFds];
- System.arraycopy(fds, 0, result, 0, nFds);
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- int color = 0x000000;
- switch (id) {
- case SWT.COLOR_BLACK: color = 0x000000; break;
- case SWT.COLOR_DARK_RED: color = 0x800000; break;
- case SWT.COLOR_DARK_GREEN: color = 0x008000; break;
- case SWT.COLOR_DARK_YELLOW: color = 0x808000; break;
- case SWT.COLOR_DARK_BLUE: color = 0x000080; break;
- case SWT.COLOR_DARK_MAGENTA: color = 0x800080; break;
- case SWT.COLOR_DARK_CYAN: color = 0x008080; break;
- case SWT.COLOR_GRAY: color = 0x808080; break;
- case SWT.COLOR_DARK_GRAY: color = 0x404040; break;
- case SWT.COLOR_RED: color = 0xFF0000; break;
- case SWT.COLOR_GREEN: color = 0x00FF00; break;
- case SWT.COLOR_YELLOW: color = 0xFFFF00; break;
- case SWT.COLOR_BLUE: color = 0x0000FF; break;
- case SWT.COLOR_MAGENTA: color = 0xFF00FF; break;
- case SWT.COLOR_CYAN: color = 0x00FFFF; break;
- case SWT.COLOR_WHITE: color = 0xFFFFFF; break;
- }
- return Color.photon_new (this, color);
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return Font.photon_new (this, Font.DefaultFont);
-}
-
-/**
- * Returns <code>true</code> if the underlying window system prints out
- * warning messages on the console, and <code>setWarnings</code>
- * had previously been called with <code>true</code>.
- *
- * @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getWarnings () {
- checkDevice ();
- return false;
-}
-
-protected void init () {
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public abstract int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public abstract void internal_dispose_GC (int handle, GCData data);
-
-/**
- * Returns <code>true</code> if the device has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the device.
- * When a device has been disposed, it is an error to
- * invoke any other method using the device.
- *
- * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return disposed;
-}
-
-void new_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == null) {
- objects [i] = object;
- errors [i] = new Error ();
- return;
- }
- }
- Object [] newObjects = new Object [objects.length + 128];
- System.arraycopy (objects, 0, newObjects, 0, objects.length);
- newObjects [objects.length] = object;
- objects = newObjects;
- Error [] newErrors = new Error [errors.length + 128];
- System.arraycopy (errors, 0, newErrors, 0, errors.length);
- newErrors [errors.length] = new Error ();
- errors = newErrors;
-}
-
-protected void release () {
-}
-
-/**
- * If the underlying window system supports printing warning messages
- * to the console, setting warnings to <code>true</code> prevents these
- * messages from being printed. If the argument is <code>false</code>
- * message printing is not blocked.
- *
- * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setWarnings (boolean warnings) {
- checkDevice ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/DeviceData.java
deleted file mode 100755
index 27fe10271d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/DeviceData.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DeviceData {
- /*
- * Debug fields - may not be honoured
- * on some SWT platforms.
- */
- public boolean debug;
- public boolean tracking;
- public Error [] errors;
- public Object [] objects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Font.java
deleted file mode 100755
index 7a373583f3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Font.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * define how text looks when it is displayed. Fonts may be constructed
- * by providing a device and either name, size and style information
- * or a <code>FontData</code> object which encapsulates this data.
- * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see FontData
- */
-public final class Font {
-
- /**
- * the handle to the OS font resource
- * (Warning: This field is platform dependent)
- */
- public byte[] handle;
-
- /**
- * the device where this font was created
- */
- Device device;
-
- static final byte[] DefaultFontName = {(byte)'h', (byte)'e', (byte)'l', (byte)'v'};
- static final byte[] DefaultFont = {(byte)'h', (byte)'e', (byte)'l', (byte)'v', (byte)'1', (byte)'2'};
-
-Font() {
-}
-
-/**
- * Constructs a new font given a device and font data
- * which describes the desired font's appearance.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param fd the FontData that describes the desired font (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
- * </ul>
- */
-public Font(Device device, FontData fd) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, fd.getName(), fd.getHeight(), fd.getStyle(), fd.stem);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new font given a device, a font name,
- * the height of the desired font in points, and a font
- * style.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
- * </ul>
- */
-public Font(Device device, String name, int height, int style) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, name, height, style, null);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the font. Applications must dispose of all fonts which
- * they allocate.
- */
-public void dispose() {
- if (handle == null) return;
-
- handle = null;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Font)) return false;
- byte[] h = ((Font)object).handle;
- if (h == handle) return true;
- if (h == null || handle == null) return false;
- if (h.length != handle.length) return false;
- for (int i = 0; i < handle.length; i++) {
- if (handle[i] != h[i]) return false;
- }
- return true;
-}
-
-/**
- * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however,
- * a <code>Font</code> object <em>may</em> be composed of multiple X
- * fonts. To support this case, we return an array of font data objects.
- *
- * @return an array of font data objects describing the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData[] getFontData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return new FontData[]{new FontData(handle)};
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- if (handle == null) return 0;
- return handle.hashCode();
-}
-
-/**
- * Returns <code>true</code> if the font has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the font.
- * When a font has been disposed, it is an error to
- * invoke any other method using the font.
- *
- * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == null;
-}
-
-void init(Device device, String name, int height, int style, byte[] stem) {
- if (height < 0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (stem != null) {
- handle = stem;
- } else {
- byte[] description = (name == null) ? null : Converter.wcsToMbcs(null, name, true);
- int osStyle = 0;
- if ((style & SWT.BOLD) != 0) osStyle |= OS.PF_STYLE_BOLD;
- if ((style & SWT.ITALIC) != 0) osStyle |= OS.PF_STYLE_ITALIC;
- byte[] buffer = new byte[OS.MAX_FONT_TAG];
- handle = OS.PfGenerateFontName(description, osStyle, height, buffer);
- if (handle == null) handle = OS.PfGenerateFontName(DefaultFontName, osStyle, height, buffer);
- }
- if (handle == null) handle = DefaultFont;
- FontQueryInfo info = new FontQueryInfo();
- if (OS.PfQueryFontInfo(handle, info) == 0) handle = info.font;
-}
-
-public static Font photon_new(Device device, byte[] stem) {
- if (device == null) device = Device.getDevice();
- Font font = new Font();
- font.init(device, null, 0, 0, stem);
- return font;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return "Font {" + new String(handle).trim() + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java
deleted file mode 100755
index 36c58e834c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java
+++ /dev/null
@@ -1,395 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe operating system fonts.
- * Only the public API of this type is platform independent.
- * <p>
- * For platform-independent behaviour, use the get and set methods
- * corresponding to the following properties:
- * <dl>
- * <dt>height</dt><dd>the height of the font in points</dd>
- * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
- * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
- * </dl>
- * If extra, platform-dependent functionality is required:
- * <ul>
- * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
- * corresponds to a Windows <code>LOGFONT</code> structure whose fields
- * may be retrieved and modified.</li>
- * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * </ul>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- *
- * @see Font
- */
-public final class FontData {
-
- /**
- * the font name
- * (Warning: This field is platform dependent)
- */
- String name;
-
- /**
- * The height of the font data in points
- * (Warning: This field is platform dependent)
- */
- int height;
-
- /**
- * the font style
- * (Warning: This field is platform dependent)
- */
- int style;
-
- /**
- * A Photon stem
- * (Warning: This field is platform dependent)
- */
- public byte[] stem;
-
- /**
- * The locales of the font
- * (Warning: These fields are platform dependent)
- */
- String lang, country, variant;
-
-FontData(byte[] stem) {
- FontQueryInfo info = new FontQueryInfo();
- if (OS.PfQueryFontInfo(stem, info) == 0) {
- this.stem = info.font;
- name = new String(Converter.mbcsToWcs(null, info.desc)).trim();
- if ((info.style & OS.PHFONT_INFO_PLAIN) != 0) style = SWT.NORMAL;
- else if ((info.style & OS.PHFONT_INFO_BOLD) != 0) style = SWT.BOLD;
- else if ((info.style & OS.PHFONT_INFO_ITALIC) != 0) style = SWT.ITALIC;
- else if ((info.style & OS.PHFONT_INFO_BLDITC) != 0) style = SWT.BOLD | SWT.ITALIC;
- else style = SWT.NORMAL;
- /*
- * For some reason, sometimes PfQueryFontInfo does not
- * set the size of the font. In that case, the size is
- * parsed from the stem.
- */
- if (info.size != 0) {
- height = info.size;
- } else {
- String fontName = new String(Converter.mbcsToWcs(null, this.stem)).trim();
- int end = fontName.length();
- for (int i = end - 1; i >= 0; i--) {
- if (Character.isDigit(fontName.charAt(i))) break;
- end--;
- }
- int start = end;
- for (int i = end - 1; i >= 0; i--) {
- if (!Character.isDigit(fontName.charAt(i))) break;
- start--;
- }
- try {
- height = Integer.parseInt(fontName.substring(start, end));
- } catch (NumberFormatException e) {}
- }
- } else {
- this.stem = stem;
- }
-}
-
-/**
- * Constructs a new un-initialized font data.
- */
-public FontData() {
- this("", 12, SWT.NORMAL);
-}
-
-/**
- * Constructs a new FontData given a string representation
- * in the form generated by the <code>FontData.toString</code>
- * method.
- * <p>
- * Note that the representation varies between platforms,
- * and a FontData can only be created from a string that was
- * generated on the same platform.
- * </p>
- *
- * @param string the string representation of a <code>FontData</code> (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
- * </ul>
- *
- * @see #toString
- */
-public FontData(String string) {
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int start = 0;
- int end = string.indexOf('|');
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- String version1 = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- String name = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int height = 0;
- try {
- height = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int style = 0;
- try {
- style = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- setName(name);
- setHeight(height);
- setStyle(style);
- if (end == -1) return;
- String platform = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- String version2 = string.substring(start, end);
-
- if (platform.equals("PHOTON") && version2.equals("1")) {
- return;
- }
-}
-
-/**
- * Constructs a new font data given a font name,
- * the height of the desired font in points,
- * and a font style.
- *
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- */
-public FontData(String name, int height, int style) {
- setName(name);
- setHeight(height);
- setStyle(style);
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontData)) return false;
- FontData data = (FontData)object;
- return name == name && height == data.height && style == data.style;
-}
-
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight
- */
-public int getHeight() {
- return height;
-}
-
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this <code>FontData</code>
- *
- * @see #setName
- */
-public String getName() {
- return name;
-}
-
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the <code>SWT</code> constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this <code>FontData</code>
- *
- * @see #setStyle
- */
-public int getStyle() {
- return style;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return name.hashCode() ^ height ^ style;
-}
-
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the <code>FontData</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- *
- * @see #getHeight
- */
-public void setHeight(int height) {
- if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.height = height;
-}
-
-/**
- * Sets the name of the receiver.
- * <p>
- * Some platforms support font foundries. On these platforms, the name
- * of the font specified in setName() may have one of the following forms:
- * <ol>
- * <li>a face name (for example, "courier")</li>
- * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
- * </ol>
- * In either case, the name returned from getName() will include the
- * foundry.
- * </p>
- * <p>
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in <code>setName()</code> and
- * <code>getName()</code>.
- * </p>
- *
- * @param name the name of the font data (must not be null)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * </ul>
- *
- * @see #getName
- */
-public void setName(String name) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.name = name;
-}
-
-/**
- * Sets the locale of the receiver.
- * <p>
- * The locale determines which platform character set this
- * font is going to use. Widgets and graphics operations that
- * use this font will convert UNICODE strings to the platform
- * character set of the specified locale.
- * </p>
- * <p>
- * On platforms which there are multiple character sets for a
- * given language/country locale, the variant portion of the
- * locale will determine the character set.
- * </p>
- *
- * @param locale the <code>String</code> representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(String locale) {
- lang = country = variant = null;
- if (locale != null) {
- char sep = '_';
- int length = locale.length();
- int firstSep, secondSep;
-
- firstSep = locale.indexOf(sep);
- if (firstSep == -1) {
- firstSep = secondSep = length;
- } else {
- secondSep = locale.indexOf(sep, firstSep + 1);
- if (secondSep == -1) secondSep = length;
- }
- if (firstSep > 0) lang = locale.substring(0, firstSep);
- if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
- if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
- }
-}
-
-/**
- * Sets the style of the receiver to the argument which must
- * be a bitwise OR of one or more of the <code>SWT</code>
- * constants NORMAL, BOLD and ITALIC.
- *
- * @param style the new style for this <code>FontData</code>
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- this.style = style;
-}
-
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * <code>FontData(String)</code> constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("1|");
- buffer.append(getName());
- buffer.append("|");
- buffer.append(getHeight());
- buffer.append("|");
- buffer.append(getStyle());
- buffer.append("|");
- buffer.append("PHOTON|1|");
- return buffer.toString();
-}
-
-public static FontData photon_new(byte[] stem) {
- return new FontData(stem);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontMetrics.java
deleted file mode 100755
index ad618d1c5c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontMetrics.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * <code>FontMetrics</code> are obtained from <code>GC</code>s
- * using the <code>getFontMetrics()</code> method.
- *
- * @see GC#getFontMetrics
- */
-public final class FontMetrics {
-
- /**
- * A Photon FontQueryInfo struct
- * (Warning: This field is platform dependent)
- */
- FontQueryInfo handle;
-
-FontMetrics() {
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontMetrics)) return false;
- FontQueryInfo info = ((FontMetrics)object).handle;
- if (info == handle) return true;
- if (info == null || handle == null) return false;
- if (handle.size == info.size &&
- handle.style == info.style &&
- handle.ascender == info.ascender &&
- handle.descender == info.descender &&
- handle.width == info.width &&
- handle.lochar == info.lochar &&
- handle.hichar == info.hichar &&
- handle.desc.length == info.desc.length &&
- handle.font.length == info.font.length)
- {
- for (int i = handle.font.length - 1; i >= 0; i--) {
- if (handle.font[i] != info.font[i]) return false;
- }
- return true;
- }
- return false;
-}
-
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's <em>ascent</em> is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return -handle.ascender;
-}
-
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- if ((handle.style & OS.PHFONT_INFO_FIXED) != 0) return handle.width;
- return handle.width / 2;
-}
-
-/**
- * Returns the descent of the font described by the receiver. A
- * font's <em>descent</em> is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return handle.descender;
-}
-
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's <em>height</em> is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return -handle.ascender + handle.descender;
-}
-
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's <em>leading area</em> is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return 0;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- if (handle == null) return 0;
- return handle.size ^ handle.style ^ handle.ascender ^
- handle.descender ^ handle.width ^
- handle.lochar ^ handle.hichar ^ handle.font.hashCode() ^
- handle.desc.hashCode();
-}
-
-public static FontMetrics photon_new(FontQueryInfo handle) {
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.handle = handle;
- return fontMetrics;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java
deleted file mode 100755
index ab551d0e4d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java
+++ /dev/null
@@ -1,2486 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
-/**
- * Class <code>GC</code> is where all of the drawing capabilities that are
- * supported by SWT are located. Instances are used to draw on either an
- * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
- * <p>
- * Application code must explicitly invoke the <code>GC.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required. This is <em>particularly</em>
- * important on Windows95 and Windows98 where the operating system has a limited
- * number of device contexts available.
- * </p>
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-public final class GC {
- /**
- * the handle to the OS device context
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- Drawable drawable;
- GCData data;
-
- static final int DefaultBack = 0xffffff;
- static final int DefaultFore = 0x000000;
- static final byte[][] DashList = {
- { }, // SWT.LINE_SOLID
- { 10, 4 }, // SWT.LINE_DASH
- { 2, 2 }, // SWT.LINE_DOT
- { 10, 4, 2, 4 }, // SWT.LINE_DASHDOT
- { 10, 4, 2, 4, 2, 4 } // SWT.LINE_DASHDOTDOT
- };
- // Photon Draw Buffer Size for off screen drawing.
- static int DrawBufferSize = 48 * 1024;
-
-GC() {
-}
-
-/**
- * Constructs a new instance of this class which has been
- * configured to draw on the specified drawable. Sets the
- * foreground and background color in the GC to match those
- * in the drawable.
- * <p>
- * You must dispose the graphics context when it is no longer required.
- * </p>
- * @param drawable the drawable to draw on
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
- * <li>ERROR_INVALID_ARGUMENT
- * - if the drawable is an image that is not a bitmap or an icon
- * - if the drawable is an image or printer that is already selected
- * into another graphics context</li>
- * </ul>
- */
-public GC(Drawable drawable) {
- int flags = OS.PtEnter(0);
- try {
- if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- GCData data = new GCData ();
- int hDC = drawable.internal_new_GC (data);
- Device device = data.device;
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- data.device = device;
- init (drawable, data, hDC);
- if (device.tracking) device.new_Object(this);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Copies a rectangular area of the receiver at the specified
- * position into the image, which must be of type <code>SWT.BITMAP</code>.
- *
- * @param x the x coordinate in the receiver of the area to be copied
- * @param y the y coordinate in the receiver of the area to be copied
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap or has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int flags = OS.PtEnter(0);
- try {
- Rectangle bounds = image.getBounds();
- int memImage = 0;
- PhRect_t rect = new PhRect_t();
- rect.ul_x = (short)x; rect.ul_y = (short)y;
- rect.lr_x = (short)(x + bounds.width - 1); rect.lr_y = (short)(y + bounds.height - 1);
- boolean sharedMem = true;
- int rid = data.rid;
- int widget = data.widget;
- if (rid == OS.Ph_DEV_RID) {
- memImage = OS.PgShmemCreate(OS.PgReadScreenSize(rect), null);
- if (memImage != 0) memImage = OS.PgReadScreen(rect, memImage);
- } else if (widget != 0) {
- short [] widget_x = new short [1], widget_y = new short [1];
- OS.PtGetAbsPosition(widget, widget_x, widget_y);
- rect.ul_x += widget_x[0];
- rect.ul_y += widget_y[0];
- rect.lr_x += widget_y[0];
- rect.lr_y += widget_y[0];
- memImage = OS.PgShmemCreate(OS.PgReadScreenSize(rect), null);
- if (memImage != 0) memImage = OS.PgReadScreen(rect, memImage);
- } else if (data.image != null) {
- memImage = OS.PiCropImage(data.image.handle, rect, 0);
- sharedMem = false;
- }
- if (memImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, memImage, PhImage_t.sizeof);
- PhPoint_t trans = new PhPoint_t();
- PhPoint_t pos = new PhPoint_t();
- PhDim_t scale = new PhDim_t();
- scale.w = (short)bounds.width;
- scale.h = (short)bounds.height;
- int mc = OS.PmMemCreateMC(image.handle, scale, trans);
- OS.PmMemStart(mc);
- OS.PgSetDrawBufferSize(DrawBufferSize);
- if (phImage.palette != 0) OS.PgSetPalette(phImage.palette, 0, (short)0, (short)phImage.colors, OS.Pg_PALSET_SOFT, 0);
- OS.PgDrawImage(phImage.image, phImage.type, pos, scale, phImage.bpl, 0);
- if (phImage.palette != 0) OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PmMemFlush(mc, image.handle);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
- if (sharedMem) {
- OS.PgShmemDestroy(memImage);
- } else {
- phImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(memImage, phImage, PhImage_t.sizeof);
- OS.PhReleaseImage(memImage);
- OS.free(memImage);
- }
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(int x, int y, int width, int height, int destX, int destY) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width == 0 || height == 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
-
- int flags = OS.PtEnter(0);
- try {
- boolean overlaps = (destX < x + width) && (destY < y + height) &&
- (destX + width > x) && (destY + height > y);
- int widget = data.widget;
- Image image = data.image;
- if (image != null) {
- int drawImage = image.handle;
- PhImage_t phDrawImage = new PhImage_t();
- OS.memmove(phDrawImage, drawImage, PhImage_t.sizeof);
- if (overlaps) {
- PhPoint_t trans = new PhPoint_t();
- PhDim_t scale = new PhDim_t();
- scale.w = (short)width;
- scale.h = (short)height;
- PhPoint_t pos = new PhPoint_t();
- pos.x = (short)-x;
- pos.y = (short)-y;
- PhDim_t dim = new PhDim_t();
- dim.w = (short)Math.min(phDrawImage.size_w, x + width);
- dim.h = (short)Math.min(phDrawImage.size_h, y + height);
- /* Feature on Photon - It is only possible to draw on images of
- type Pg_IMAGE_PALETTE_BYTE and Pg_IMAGE_DIRECT_888.
- */
- int type = OS.Pg_IMAGE_PALETTE_BYTE;
- if ((phDrawImage.type & OS.Pg_IMAGE_CLASS_MASK) == OS.Pg_IMAGE_CLASS_DIRECT) {
- type = OS.Pg_IMAGE_DIRECT_888;
- }
- int memImage = OS.PhCreateImage(null, (short)width, (short)height, type, phDrawImage.palette, phDrawImage.colors, 0);
- int mc = OS.PmMemCreateMC(memImage, scale, trans);
- OS.PmMemStart(mc);
- OS.PgSetDrawBufferSize(DrawBufferSize);
- if (phDrawImage.palette != 0) OS.PgSetPalette(phDrawImage.palette, 0, (short)0, (short)phDrawImage.colors, OS.Pg_PALSET_SOFT, 0);
- OS.PgDrawImage(phDrawImage.image, phDrawImage.type, pos, dim, phDrawImage.bpl, 0);
- if (phDrawImage.palette != 0) OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PmMemFlush(mc, memImage);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
- x = (short)0;
- y = (short)0;
- drawImage = memImage;
- OS.memmove(phDrawImage, drawImage, PhImage_t.sizeof);
- phDrawImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(drawImage, phDrawImage, PhImage_t.sizeof);
- }
- PhPoint_t pos = new PhPoint_t();
- pos.x = (short)(destX - x);
- pos.y = (short)(destY - y);
- PhRect_t clip = new PhRect_t();
- clip.ul_x = (short)destX;
- clip.ul_y = (short)destY;
- clip.lr_x = (short)(destX + width - 1);
- clip.lr_y = (short)(destY + height - 1);
- PhDim_t dim = new PhDim_t();
- dim.w = (short)Math.min(phDrawImage.size_w, x + width);
- dim.h = (short)Math.min(phDrawImage.size_h, y + height);
- int prevContext = setGC();
- setGCClipping();
- OS.PgSetUserClip(clip);
- if (phDrawImage.palette != 0) OS.PgSetPalette(phDrawImage.palette, 0, (short)0, (short)phDrawImage.colors, OS.Pg_PALSET_SOFT, 0);
- OS.PgDrawImage(phDrawImage.image, phDrawImage.type, pos, dim, phDrawImage.bpl, 0);
- if (phDrawImage.palette != 0) OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PgSetUserClip(null);
- unsetGC(prevContext);
- if (drawImage != image.handle) {
- OS.PhReleaseImage(drawImage);
- OS.free(drawImage);
- }
- } else if (widget != 0) {
- int rid = OS.PtWidgetRid(widget);
- if (rid == 0) return;
- PhRect_t rect = new PhRect_t();
- rect.ul_x = (short)x;
- rect.ul_y = (short)y;
- rect.lr_x = (short)(x + width - 1);
- rect.lr_y = (short)(y + height - 1);
- PhPoint_t delta = new PhPoint_t();
- delta.x = (short)deltaX;
- delta.y = (short)deltaY;
- int clipRects = data.clipRects;
- int child_clip = getClipping(widget, data.topWidget, true, true);
- if (clipRects == 0 && child_clip == 0) {
- OS.PhBlit(rid, rect, delta);
- } else {
- int dest = OS.PhGetTile();
- OS.memmove(dest, rect, PhRect_t.sizeof);
- OS.PhTranslateTiles(dest, delta);
- short[] unused = new short[1];
- int clip = child_clip;
- if (clipRects != 0) {
- clip = OS.PhRectsToTiles(clipRects, data.clipRectsCount);
- if (child_clip != 0) {
- clip = OS.PhIntersectTilings(clip, child_clip, unused);
- OS.PhFreeTiles(child_clip);
- }
- }
- int dest_tiles = OS.PhIntersectTilings(dest, clip, unused);
- OS.PhFreeTiles(clip);
- OS.PhFreeTiles(dest);
- PhPoint_t inverseDelta = new PhPoint_t();
- inverseDelta.x = (short)(-delta.x);
- inverseDelta.y = (short)(-delta.y);
- OS.PhTranslateTiles(dest_tiles, inverseDelta);
- int[] src_rects_count = new int[1];
- int src_rects = OS.PhTilesToRects(dest_tiles, src_rects_count);
- OS.PhFreeTiles(dest_tiles);
- PhRect_t src_rect = new PhRect_t();
- for (int i = 0; i<src_rects_count[0]; i++) {
- OS.memmove(src_rect, src_rects + (i * PhRect_t.sizeof), PhRect_t.sizeof);
- OS.PhBlit(rid, src_rect, delta);
- }
- OS.free(src_rects);
- }
- if (!overlaps) {
- OS.PtDamageExtent (widget, rect);
- } else {
- int src = OS.PhGetTile();
- int dest = OS.PhGetTile();
- OS.memmove(src, rect, PhRect_t.sizeof);
- OS.memmove(dest, rect, PhRect_t.sizeof);
- OS.PhTranslateTiles(dest, delta);
- int damage_tile = OS.PhClipTilings(src, dest, null);
- int[] damage_rects_count = new int[1];
- int damage_rects = OS.PhTilesToRects(damage_tile, damage_rects_count);
- OS.PhFreeTiles(dest);
- OS.PhFreeTiles(damage_tile);
- for (int i=0; i<damage_rects_count[0]; i++) {
- OS.memmove(rect, damage_rects + (i * PhRect_t.sizeof), PhRect_t.sizeof);
- OS.PtDamageExtent (widget, rect);
- }
- OS.free(damage_rects);
- }
- }
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the graphics context. Applications must dispose of all GCs
- * which they allocate.
- */
-public void dispose() {
- int flags = OS.PtEnter(0);
- try {
- if (handle == 0) return;
-
- int clipRects = data.clipRects;
- if (clipRects != 0) {
- OS.free(clipRects);
- data.clipRects = data.clipRectsCount = 0;
- }
- Image image = data.image;
- if (image != null) image.memGC = null;
-
- /*
- * Dispose the HDC.
- */
- Device device = data.device;
- drawable.internal_dispose_GC(handle, data);
- drawable = null;
- handle = 0;
- data.image = null;
- data.font = null;
- data.rid = data.widget = data.topWidget = 0;
- if (device.tracking) device.dispose_Object(this);
- data.device = null;
- data = null;
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the outline of a circular or elliptical arc
- * within the specified rectangular area.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be drawn
- * @param y the y coordinate of the upper-left corner of the arc to be drawn
- * @param width the width of the arc to be drawn
- * @param height the height of the arc to be drawn
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawArc (int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (startAngle > 0) {
- if (endAngle > 0) {
- //No need to modify start angle.
- endAngle += startAngle;
- } else {
- int newStartAngle;
- int newStopAngle = startAngle;
- if (startAngle > Math.abs(endAngle)) {
- newStartAngle = startAngle - Math.abs(endAngle);
- } else {
- newStartAngle = startAngle + 360 - Math.abs(endAngle);
- }
- startAngle = newStartAngle;
- endAngle = newStopAngle;
- }
- } else {
- if (endAngle > 0) {
- endAngle = endAngle + startAngle;
- startAngle = 360 - Math.abs(startAngle);
- } else {
- int newStopAngle = 360 + startAngle;
- startAngle = newStopAngle - Math.abs(endAngle);
- endAngle = newStopAngle;
- }
- }
- startAngle = (int) (startAngle * 65536 / 360);
- endAngle = (int) (endAngle * 65536 / 360);
-
- PhPoint_t center = new PhPoint_t();
- center.x = (short)(x + (width / 2));
- center.y = (short)(y + (height / 2));
- PhPoint_t radii = new PhPoint_t();
- radii.x = (short)(width / 2);
- radii.y = (short)(height / 2);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawArc(center, radii, startAngle, endAngle, OS.Pg_ARC | OS.Pg_DRAW_STROKE);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws a rectangle, based on the specified arguments, which has
- * the appearance of the platform's <em>focus rectangle</em> if the
- * platform supports such a notion, and otherwise draws a simple
- * rectangle in the receiver's forground color.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void drawFocus (int x, int y, int width, int height) {
- width = (width < 0 ? -width : width) - 1;
- height = (height < 0 ? -height : height) - 1;
- drawRectangle(x, y, width, height);
-}
-
-/**
- * Draws the given image in the receiver at the specified
- * coordinates.
- *
- * @param image the image to draw
- * @param x the x coordinate of where to draw
- * @param y the y coordinate of where to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true);
-}
-
-/**
- * Copies a rectangular area from the source image into a (potentially
- * different sized) rectangular area in the receiver. If the source
- * and destination areas are of differing sizes, then the source
- * area will be stretched or shrunk to fit the destination area
- * as it is copied. The copy fails if any of the given coordinates
- * are negative or lie outside the bounds of their respective images.
- *
- * @param image the source image
- * @param srcX the x coordinate in the source image to copy from
- * @param srcY the y coordinate in the source image to copy from
- * @param srcWidth the width in pixels to copy from the source
- * @param srcHeight the height in pixels to copy from the source
- * @param destX the x coordinate in the destination to copy to
- * @param destY the y coordinate in the destination to copy to
- * @param destWidth the width in pixels of the destination rectangle
- * @param destHeight the height in pixels of the destination rectangle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
- if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false);
-}
-void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
- int flags = OS.PtEnter(0);
- try {
- int drawImage = image.handle;
- PhImage_t phDrawImage = new PhImage_t();
- OS.memmove(phDrawImage, drawImage, PhImage_t.sizeof);
- int imgWidth = phDrawImage.size_w;
- int imgHeight = phDrawImage.size_h;
- if (simple) {
- srcWidth = destWidth = imgWidth;
- srcHeight = destHeight = imgHeight;
- } else {
- simple = srcX == 0 && srcY == 0 &&
- srcWidth == destWidth && destWidth == imgWidth &&
- srcHeight == destHeight && destHeight == imgHeight;
- if (srcX + srcWidth > imgWidth || srcY + srcHeight > imgHeight) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
- if (srcWidth != destWidth || srcHeight != destHeight) {
- drawImage = scaleImage(image, phDrawImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight);
- srcX = (short)0;
- srcY = (short)0;
- srcWidth = (short)destWidth;
- srcHeight = (short)destHeight;
- OS.memmove(phDrawImage, drawImage, PhImage_t.sizeof);
- }
- PhPoint_t pos = new PhPoint_t();
- pos.x = (short)(destX - srcX);
- pos.y = (short)(destY - srcY);
- PhDim_t dim = new PhDim_t();
- dim.w = (short)Math.min(phDrawImage.size_w, srcX + srcWidth);
- dim.h = (short)Math.min(phDrawImage.size_h, srcY + srcHeight);
- PhRect_t clip = new PhRect_t();
- clip.ul_x = (short)destX;
- clip.ul_y = (short)destY;
- clip.lr_x = (short)(destX + destWidth - 1);
- clip.lr_y = (short)(destY + destHeight - 1);
- int prevContext = setGC();
- setGCClipping();
- OS.PgSetUserClip(clip);
- if (phDrawImage.palette != 0) OS.PgSetPalette(phDrawImage.palette, 0, (short)0, (short)phDrawImage.colors, OS.Pg_PALSET_SOFT, 0);
- if (phDrawImage.alpha != 0) {
- drawImageAlpha(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, phDrawImage, drawImage, pos, dim);
- } else if (image.transparentPixel != -1) {
- drawImageTransparent(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, phDrawImage, drawImage, pos, dim);
- } else if (phDrawImage.mask_bm != 0) {
- drawImageMask(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, phDrawImage, drawImage, pos, dim);
- } else {
- drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, phDrawImage, drawImage, pos, dim);
- }
- if (phDrawImage.palette != 0) OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PgSetUserClip(null);
- unsetGC(prevContext);
- if (drawImage != image.handle) {
- phDrawImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(drawImage, phDrawImage, PhImage_t.sizeof);
- OS.PhReleaseImage(drawImage);
- OS.free(drawImage);
- }
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-void drawImageAlpha(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, PhImage_t phImage, int imgHandle, PhPoint_t pos, PhDim_t dim) {
- PgAlpha_t phAlpha = new PgAlpha_t();
- OS.memmove(phAlpha, phImage.alpha, PgAlpha_t.sizeof);
- if ((phAlpha.alpha_op & OS.Pg_ALPHA_OP_SRC_GLOBAL) != 0) {
- OS.PgSetAlpha(phAlpha.alpha_op, null, 0, phAlpha.src_global_alpha, phAlpha.dest_global_alpha);
- OS.PgAlphaOn();
- OS.PgDrawImage(phImage.image, phImage.type, pos, dim, phImage.bpl, 0);
- OS.PgAlphaOff();
- return;
- }
-
- /*
- * Feature/Bug in Photon - When drawing images with alpha blending
- * enabled, there is a limitation in the size of the alpha map.
- * This limitation is probably related to the draw buffer size and
- * it seems to be worse when drawing to a memory context. The
- * fix/workaround is to draw the image line by line.
- */
- PgMap_t imageMap = new PgMap_t();
- OS.memmove(imageMap, phImage.alpha + 4, PgMap_t.sizeof);
- PgMap_t lineMap = new PgMap_t();
- lineMap.dim_w = imageMap.dim_w;
- lineMap.dim_h = 1;
- /*
- * Feature in Photon - The alpha map set in a graphics context by
- * PgSetAlpha is freed when the graphics context is destroyed.
- */
- lineMap.map = OS.malloc(lineMap.dim_w);
- OS.PgSetAlpha(phAlpha.alpha_op, lineMap, 0, phAlpha.src_global_alpha, phAlpha.dest_global_alpha);
- OS.PgAlphaOn();
- pos.y = (short)(destY);
- int end = dim.h;
- dim.h = (short)1;
- for (int y=srcY; y<end; y+=lineMap.dim_h) {
- OS.memmove(lineMap.map, imageMap.map + (imageMap.dim_w * y), lineMap.dim_w);
- /*
- * Bug in Photon - When drawing an image to a memory context created by
- * PmMemCreateMC at a negative position, the alpha map is not offset.
- */
- if (data.image != null && pos.x < 0) {
- OS.memmove(lineMap.map, lineMap.map - pos.x, lineMap.dim_w + pos.x);
- }
- OS.PgDrawImage(phImage.image + (phImage.bpl * y), phImage.type, pos, dim, phImage.bpl, 0);
- /*
- * Flushing is necessary in order to change the alpha map.
- */
- if (data.image != null) OS.PmMemFlush(handle, data.image.handle);
- else OS.PgFlush();
- pos.y += lineMap.dim_h;
- }
- OS.PgAlphaOff();
-}
-void drawImageTransparent(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, PhImage_t phImage, int imgHandle, PhPoint_t pos, PhDim_t dim) {
- /* Generate the mask if necessary */
- if (phImage.mask_bm == 0) {
- createMask(imgHandle, phImage.type, image.transparentPixel);
- OS.memmove(phImage, imgHandle, PhImage_t.sizeof);
- }
- OS.PgDrawTImage(phImage.image, phImage.type, pos, dim, phImage.bpl, 0, phImage.mask_bm, phImage.mask_bpl);
- /* Destroy the mask if there is a GC created on the image */
- if (image.memGC != null && image.handle == imgHandle) {
- OS.free(phImage.mask_bm);
- phImage.mask_bm = 0;
- phImage.mask_bpl = 0;
- OS.memmove(imgHandle, phImage, PhImage_t.sizeof);
- }
-}
-void drawImageMask(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, PhImage_t phImage, int imgHandle, PhPoint_t pos, PhDim_t dim) {
- OS.PgDrawTImage(phImage.image, phImage.type, pos, dim, phImage.bpl, 0, phImage.mask_bm, phImage.mask_bpl);
-}
-void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, PhImage_t phImage, int imgHandle, PhPoint_t pos, PhDim_t dim) {
- OS.PgDrawImage(phImage.image, phImage.type, pos, dim, phImage.bpl, 0);
-}
-static void createMask(int image, int type, int transparent) {
- if ((type & OS.Pg_IMAGE_CLASS_MASK) == OS.Pg_IMAGE_CLASS_PALETTE) {
- transparent = (transparent & 0xFF) | OS.Pt_INDEX_COLOR;
- } else {
- switch (type) {
- case OS.Pg_IMAGE_DIRECT_888:
- transparent = ((transparent & 0xFF) << 16) | (transparent & 0xFF00) | ((transparent & 0xFF0000) >> 16);
- break;
- case OS.Pg_IMAGE_DIRECT_8888:
- transparent = ((transparent & 0xFF00) << 8) | ((transparent & 0xFF0000) >> 8) | ((transparent & 0xFF000000) >> 24);
- break;
- case OS.Pg_IMAGE_DIRECT_565:
- transparent = ((transparent & 0xF800) << 8) | ((transparent & 0x7E0) << 5) | ((transparent & 0x1F) << 3);
- break;
- case OS.Pg_IMAGE_DIRECT_555:
- transparent = ((transparent & 0x7C00) << 9) | ((transparent & 0x3E0) << 6) | ((transparent & 0x1F) << 3);
- break;
- case OS.Pg_IMAGE_DIRECT_444:
- transparent = ((transparent & 0xF00) << 12) | ((transparent & 0xF0) << 8) | ((transparent & 0xF) << 4);
- break;
- }
- }
- OS.PhMakeTransBitmap(image, transparent);
-}
-static int scaleImage(Image image, PhImage_t phImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- PhPoint_t trans = new PhPoint_t();
- PhDim_t scale = new PhDim_t();
- scale.w = (short)srcWidth;
- scale.h = (short)srcHeight;
- PhPoint_t pos = new PhPoint_t();
- pos.x = (short)-srcX;
- pos.y = (short)-srcY;
- PhDim_t dim = new PhDim_t();
- dim.w = (short)Math.min(phImage.size_w, srcX + srcWidth);
- dim.h = (short)Math.min(phImage.size_h, srcY + srcHeight);
- /*
- * Feature on Photon - It is only possible to draw on images of
- * type Pg_IMAGE_PALETTE_BYTE and Pg_IMAGE_DIRECT_888.
- */
- int type = OS.Pg_IMAGE_PALETTE_BYTE;
- if ((phImage.type & OS.Pg_IMAGE_CLASS_MASK) == OS.Pg_IMAGE_CLASS_DIRECT) {
- type = OS.Pg_IMAGE_DIRECT_888;
- }
- /* Scale the image */
- int memImage = OS.PhCreateImage(null, (short)destWidth, (short)destHeight, type, phImage.palette, phImage.colors, 0);
- if (memImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int mc = OS.PmMemCreateMC(memImage, scale, trans);
- if (mc == 0) {
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.PmMemStart(mc);
- OS.PgSetDrawBufferSize(DrawBufferSize);
- if (phImage.palette != 0) OS.PgSetPalette(phImage.palette, 0, (short)0, (short)phImage.colors, OS.Pg_PALSET_SOFT, 0);
- OS.PgDrawImage(phImage.image, phImage.type, pos, dim, phImage.bpl, 0);
- if (phImage.palette != 0) OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PmMemFlush(mc, memImage);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
-
- PhImage_t phMemImage = new PhImage_t();
- OS.memmove(phMemImage, memImage, PhImage_t.sizeof);
- if (image.transparentPixel != -1) {
- /* Generate the mask if it was created originally */
- if (phImage.mask_bm != 0) {
- createMask(memImage, phImage.type, image.transparentPixel);
- }
- } else if (phImage.mask_bm != 0) {
- /* Scale the mask */
- int[] palette = new int[2];
- palette[0] = 0x000000;
- palette[1] = 0xffffff;
- int palettePtr = OS.malloc(palette.length * 4);
- OS.memmove(palettePtr, palette, palette.length * 4);
- /*
- * Feature on Photon - It is only possible to draw on images of
- * type Pg_IMAGE_PALETTE_BYTE and Pg_IMAGE_DIRECT_888.
- */
- int maskImage = OS.PhCreateImage(null, (short)destWidth, (short)destHeight, OS.Pg_IMAGE_PALETTE_BYTE, palettePtr, palette.length, 0);
- if (maskImage == 0) {
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- mc = OS.PmMemCreateMC(maskImage, scale, trans);
- if (mc == 0) {
- Image.destroyImage(maskImage);
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.PmMemStart(mc);
- OS.PgSetDrawBufferSize(DrawBufferSize);
- OS.PgSetFillColor(palette[0]);
- OS.PgSetTextColor(palette[1]);
- OS.PgDrawBitmap(phImage.mask_bm, OS.Pg_BACK_FILL, pos, dim, phImage.mask_bpl, 0);
- OS.PmMemFlush(mc, maskImage);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
- OS.free(palettePtr);
-
- /* Transfer the mask to the scaled image */
- OS.PhMakeTransBitmap(maskImage, 0 | OS.Pt_INDEX_COLOR);
- PhImage_t phMaskImage = new PhImage_t();
- OS.memmove(phMaskImage, maskImage, PhImage_t.sizeof);
- phMemImage.mask_bm = phMaskImage.mask_bm;
- phMemImage.mask_bpl = phMaskImage.mask_bpl;
- OS.memmove(memImage, phMemImage, PhImage_t.sizeof);
-
- /* Release the temporary image but not the mask data */
- phMaskImage.mask_bm = 0;
- phMaskImage.mask_bpl = 0;
- phMaskImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(maskImage, phMaskImage, PhImage_t.sizeof);
- OS.PhReleaseImage(maskImage);
- OS.free(maskImage);
- } else if (phImage.alpha != 0) {
- PgAlpha_t alpha = new PgAlpha_t();
- OS.memmove(alpha, phImage.alpha, PgAlpha_t.sizeof);
- int alphaPtr = OS.malloc(PgAlpha_t.sizeof);
- if (alphaPtr == 0) {
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
-
- /* Scale alpha data */
- if (alpha.src_alpha_map_map != 0) {
- int[] palette = new int[256];
- for (int i = 0; i < palette.length; i++) {
- palette[i] = i;
- }
- int palettePtr = OS.malloc(palette.length * 4);
- OS.memmove(palettePtr, palette, palette.length * 4);
- /*
- * Feature on Photon - It is only possible to draw on images of
- * type Pg_IMAGE_PALETTE_BYTE and Pg_IMAGE_DIRECT_888.
- */
- int alphaImage = OS.PhCreateImage(null, (short)destWidth, (short)destHeight, OS.Pg_IMAGE_PALETTE_BYTE, palettePtr, palette.length, 0);
- if (alphaImage == 0) {
- OS.free(palettePtr);
- OS.free(alphaPtr);
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- mc = OS.PmMemCreateMC(alphaImage, scale, trans);
- if (mc == 0) {
- OS.free(palettePtr);
- OS.free(alphaPtr);
- Image.destroyImage(alphaImage);
- Image.destroyImage(memImage);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.PmMemStart(mc);
- OS.PgSetPalette(palettePtr, 0, (short)0, (short)palette.length, OS.Pg_PALSET_SOFT, 0);
- OS.PgDrawImage(alpha.src_alpha_map_map, OS.Pg_IMAGE_PALETTE_BYTE, pos, dim, alpha.src_alpha_map_bpl, 0);
- OS.PgSetPalette(0, 0, (short)0, (short)-1, 0, 0);
- OS.PmMemFlush(mc, alphaImage);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
- OS.free(palettePtr);
-
- /* Transfer the image to the scaled image alpha data*/
- PhImage_t phAlphaImage = new PhImage_t();
- OS.memmove(phAlphaImage, alphaImage, PhImage_t.sizeof);
- alpha.src_alpha_map_bpl = (short)phAlphaImage.bpl;
- alpha.src_alpha_map_dim_w = (short)phAlphaImage.bpl;
- alpha.src_alpha_map_dim_h = (short)phAlphaImage.size_h;
- alpha.src_alpha_map_map = phAlphaImage.image;
-
- /* Release the temporary image but not the image data */
- phAlphaImage.image = 0;
- phAlphaImage.bpl = 0;
- phAlphaImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(alphaImage, phAlphaImage, PhImage_t.sizeof);
- OS.PhReleaseImage(alphaImage);
- OS.free(alphaImage);
- }
-
- OS.memmove(alphaPtr, alpha, PgAlpha_t.sizeof);
- phMemImage.alpha = alphaPtr;
- OS.memmove(memImage, phMemImage, PhImage_t.sizeof);
- }
- return memImage;
-}
-
-/**
- * Draws a line, using the foreground color, between the points
- * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
- *
- * @param x1 the first point's x coordinate
- * @param y1 the first point's y coordinate
- * @param x2 the second point's x coordinate
- * @param y2 the second point's y coordinate
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawLine (int x1, int y1, int x2, int y2) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawILine(x1, y1, x2, y2);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the outline of an oval, using the foreground color,
- * within the specified rectangular area.
- * <p>
- * The result is a circle or ellipse that fits within the
- * rectangle specified by the <code>x</code>, <code>y</code>,
- * <code>width</code>, and <code>height</code> arguments.
- * </p><p>
- * The oval covers an area that is <code>width + 1</code>
- * pixels wide and <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper left corner of the oval to be drawn
- * @param y the y coordinate of the upper left corner of the oval to be drawn
- * @param width the width of the oval to be drawn
- * @param height the height of the oval to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawOval (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhPoint_t center = new PhPoint_t();
- center.x = (short)x; center.y = (short)y;
- PhPoint_t radii = new PhPoint_t();
- // Don't subtract one, so that the bottom/right edges are drawn
- radii.x = (short)(x + width); radii.y = (short)(y + height);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawEllipse(center, radii, OS.Pg_DRAW_STROKE | OS.Pg_EXTENT_BASED);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the closed polygon which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the vertices of the polygon. Lines are drawn between
- * each consecutive pair, and between the first pair and last pair in the
- * array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- short[] points = new short[pointArray.length];
- for (int i = pointArray.length - 1; i >= 0; i--) {
- points[i] = (short)pointArray[i];
- }
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawPolygon(points, pointArray.length / 2, new PhPoint_t(), OS.Pg_DRAW_STROKE | OS.Pg_CLOSED);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the polyline which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the corners of the polyline. Lines are drawn between
- * each consecutive pair, but not between the first pair and last pair in
- * the array.
- *
- * @param pointArray an array of alternating x and y values which are the corners of the polyline
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolyline(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- short[] points = new short[pointArray.length];
- for (int i = pointArray.length - 1; i >= 0; i--) {
- points[i] = (short)pointArray[i];
- }
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawPolygon(points, pointArray.length / 2, new PhPoint_t(), OS.Pg_DRAW_STROKE);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the outline of the rectangle specified by the arguments,
- * using the receiver's foreground color. The left and right edges
- * of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- // Don't subtract one, so that the bottom/right edges are drawn
- OS.PgDrawIRect(x, y, x + width, y + height, OS.Pg_DRAW_STROKE);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the outline of the specified rectangle, using the receiver's
- * foreground color. The left and right edges of the rectangle are at
- * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
- * and bottom edges are at <code>rect.y</code> and
- * <code>rect.y + rect.height</code>.
- *
- * @param rect the rectangle to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Draws the outline of the round-cornered rectangle specified by
- * the arguments, using the receiver's foreground color. The left and
- * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- * The <em>roundness</em> of the corners is specified by the
- * <code>arcWidth</code> and <code>arcHeight</code> arguments.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhRect_t rect = new PhRect_t();
- rect.ul_x = (short)x; rect.ul_y = (short)y;
- // Don't subtract one, so that the bottom/right edges are drawn
- rect.lr_x = (short)(x + width); rect.lr_y = (short)(y + height);
- PhPoint_t radii = new PhPoint_t();
- radii.x = (short)(arcWidth / 2); radii.y = (short)(arcHeight / 2);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawRoundRect(rect, radii, OS.Pg_DRAW_STROKE);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. The background of the rectangular area where
- * the string is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y) {
- drawString(string, x, y, false);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the string is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y, boolean isTransparent) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- int drawFlags = OS.Pg_TEXT_LEFT | OS.Pg_TEXT_TOP;
- if (!isTransparent) drawFlags |= OS.Pg_BACK_FILL;
- byte[] buffer = Converter.wcsToMbcs(null, string, false);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawText(buffer, buffer.length, (short)x, (short)y, drawFlags);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. The background of the rectangular area where
- * the text is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y) {
- drawText(string, x, y, false);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, boolean isTransparent) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- int drawFlags = OS.Pg_TEXT_LEFT | OS.Pg_TEXT_TOP;
- if (!isTransparent) drawFlags |= OS.Pg_BACK_FILL;
- string = replaceTabs(string, 8);
- byte[] buffer = Converter.wcsToMbcs(null, string, false);
- PhRect_t rect = new PhRect_t();
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgExtentMultiText(rect, null, data.font, buffer, buffer.length, 0);
- rect.lr_x += (short)(x - rect.ul_x);
- rect.lr_y += (short)(y - rect.ul_y);
- rect.ul_x = (short)x;
- rect.ul_y = (short)y;
- OS.PgDrawMultiTextArea(buffer, buffer.length, rect, drawFlags, OS.Pg_TEXT_LEFT | OS.Pg_TEXT_TOP, 0);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion, line delimiter and mnemonic
- * processing are performed according to the specified flags. If
- * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- * <p>
- * The parameter <code>flags</code> may be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * </p>
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param flags the flags specifing how to process the text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, int flags) {
- drawText(string, x, y, (flags & SWT.DRAW_TRANSPARENT) != 0);
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
-}
-
-/**
- * Fills the interior of a circular or elliptical arc within
- * the specified rectangular area, with the receiver's background
- * color.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be filled
- * @param y the y coordinate of the upper-left corner of the arc to be filled
- * @param width the width of the arc to be filled
- * @param height the height of the arc to be filled
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawArc
- */
-public void fillArc (int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (startAngle > 0) {
- if (endAngle > 0) {
- //No need to modify start angle.
- endAngle += startAngle;
- } else {
- int newStartAngle;
- int newStopAngle = startAngle;
- if (startAngle > Math.abs(endAngle)) {
- newStartAngle = startAngle - Math.abs(endAngle);
- } else {
- newStartAngle = startAngle + 360 - Math.abs(endAngle);
- }
- startAngle = newStartAngle;
- endAngle = newStopAngle;
- }
- } else {
- if (endAngle > 0) {
- endAngle = endAngle + startAngle;
- startAngle = 360 - Math.abs(startAngle);
- } else {
- int newStopAngle = 360 + startAngle;
- startAngle = newStopAngle - Math.abs(endAngle);
- endAngle = newStopAngle;
- }
- }
- startAngle = (int) (startAngle * 65536 / 360);
- endAngle = (int) (endAngle * 65536 / 360);
-
- PhPoint_t center = new PhPoint_t();
- center.x = (short)(x + (width / 2));
- center.y = (short)(y + (height / 2));
- PhPoint_t radii = new PhPoint_t();
- radii.x = (short)(width / 2);
- radii.y = (short)(height / 2);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawArc(center, radii, startAngle, endAngle, OS.Pg_ARC_PIE | OS.Pg_DRAW_FILL);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Fills the interior of the specified rectangle with a gradient
- * sweeping from left to right or top to bottom progressing
- * from the receiver's foreground color to its background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled, may be negative
- * (inverts direction of gradient if horizontal)
- * @param height the height of the rectangle to be filled, may be negative
- * (inverts direction of gradient if vertical)
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if ((width == 0) || (height == 0)) return;
- int fromColor = data.foreground;
- int toColor = data.background;
- boolean swapColors = false;
- if (width < 0) {
- x += width; width = -width;
- if (! vertical) swapColors = true;
- }
- if (height < 0) {
- y += height; height = -height;
- if (vertical) swapColors = true;
- }
- if (swapColors) {
- final int t = toColor;
- toColor = fromColor;
- fromColor = t;
- }
- PhPoint_t upperLeft = new PhPoint_t();
- upperLeft.x = (short)x;
- upperLeft.y = (short)y;
- PhPoint_t lowerRight = new PhPoint_t();
- lowerRight.x = (short)(x + width - 1);
- lowerRight.y = (short)(y + height - 1);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawGradient(upperLeft, lowerRight,
- vertical ? OS.Pg_GRAD_VERTICAL : OS.Pg_GRAD_HORIZONTAL, OS.Pg_GRAD_LINEAR,
- vertical ? height : width, fromColor, toColor, 0, 0, 0, null);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Fills the interior of an oval, within the specified
- * rectangular area, with the receiver's background
- * color.
- *
- * @param x the x coordinate of the upper left corner of the oval to be filled
- * @param y the y coordinate of the upper left corner of the oval to be filled
- * @param width the width of the oval to be filled
- * @param height the height of the oval to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawOval
- */
-public void fillOval (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhPoint_t center = new PhPoint_t();
- center.x = (short)x; center.y = (short)y;
- PhPoint_t radii = new PhPoint_t();
- radii.x = (short)(x + width);
- radii.y = (short)(y + height);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawEllipse(center, radii, OS.Pg_DRAW_FILL | OS.Pg_EXTENT_BASED);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Fills the interior of the closed polygon which is defined by the
- * specified array of integer coordinates, using the receiver's
- * background color. The array contains alternating x and y values
- * which are considered to represent points which are the vertices of
- * the polygon. Lines are drawn between each consecutive pair, and
- * between the first pair and last pair in the array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawPolygon
- */
-public void fillPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- short[] points = new short[pointArray.length];
- for (int i = pointArray.length - 1; i >= 0; i--) {
- points[i] = (short)pointArray[i];
- }
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawPolygon(points, pointArray.length / 2, new PhPoint_t(), OS.Pg_DRAW_FILL | OS.Pg_CLOSED);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Fills the interior of the rectangle specified by the arguments,
- * using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width == 0 || height == 0) return;
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawIRect(x, y, x + width - 1, y + height - 1, OS.Pg_DRAW_FILL);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Fills the interior of the specified rectangle, using the receiver's
- * background color.
- *
- * @param rectangle the rectangle to be filled
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- fillRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Fills the interior of the round-cornered rectangle specified by
- * the arguments, using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRoundRectangle
- */
-public void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhRect_t rect = new PhRect_t();
- rect.ul_x = (short)x; rect.ul_y = (short)y;
- rect.lr_x = (short)(x + width - 1); rect.lr_y = (short)(y + height - 1);
- PhPoint_t radii = new PhPoint_t();
- radii.x = (short)(arcWidth / 2); radii.y = (short)(arcHeight / 2);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- setGCClipping();
- OS.PgDrawRoundRect(rect, radii, OS.Pg_DRAW_FILL);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Returns the <em>advance width</em> of the specified character in
- * the font which is currently selected into the receiver.
- * <p>
- * The advance width is defined as the horizontal distance the cursor
- * should move after printing the character in the selected font.
- * </p>
- *
- * @param ch the character to measure
- * @return the distance in the x direction to move past the character before painting the next
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getAdvanceWidth(char ch) {
- return getCharWidth(ch);
-}
-
-/**
- * Returns the background color.
- *
- * @return the receiver's background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return Color.photon_new(data.device, data.background);
-}
-
-/**
- * Returns the width of the specified character in the font
- * selected into the receiver.
- * <p>
- * The width is defined as the space taken up by the actual
- * character, not including the leading and tailing whitespace
- * or overhang.
- * </p>
- *
- * @param ch the character to measure
- * @return the width of the character
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getCharWidth(char ch) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- String string = new String(new char[] {ch});
- Point point = stringExtent(string);
- return point.x;
-}
-
-/**
- * Returns the bounding rectangle of the receiver's clipping
- * region. If no clipping region is set, the return value
- * will be a rectangle which covers the entire bounds of the
- * object the receiver is drawing on.
- *
- * @return the bounding rectangle of the clipping region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getClipping() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- PhRect_t rect = new PhRect_t();
- int rid = data.rid;
- int widget = data.widget;
- Image image = data.image;
- if (rid == OS.Ph_DEV_RID) {
- OS.PhRegionQuery (rid, null, rect, 0, 0);
- } else if (widget != 0) {
- OS.PtWidgetCanvas(widget, rect);
- } else if (image != null) {
- PhImage_t img = new PhImage_t();
- OS.memmove(img, image.handle, PhImage_t.sizeof);
- rect.lr_x = (short)(img.size_w - 1);
- rect.lr_y = (short)(img.size_h - 1);
- }
- int clipRects = data.clipRects;
- if (clipRects != 0) {
- int clipRectsCount = data.clipRectsCount;
- int clip_ptr = OS.malloc(PhRect_t.sizeof);
- OS.memmove(clip_ptr, clipRects, PhRect_t.sizeof);
- for (int i = 1; i < clipRectsCount; i++) {
- OS.PhRectUnion (clip_ptr, clipRects + (i * 4));
- }
- int rect_ptr = OS.malloc(PhRect_t.sizeof);
- OS.memmove(rect_ptr, rect, PhRect_t.sizeof);
- boolean intersect = OS.PhRectIntersect(rect_ptr, clip_ptr) != 0;
- OS.memmove(rect, rect_ptr, PhRect_t.sizeof);
- OS.free(rect_ptr);
- OS.free(clip_ptr);
- if (!intersect) return new Rectangle(0, 0, 0, 0);
- }
- int width = rect.lr_x - rect.ul_x + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Rectangle(rect.ul_x, rect.ul_y, width, height);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the region managed by the argument to the current
- * clipping region of the receiver.
- *
- * @param region the region to fill with the clipping region
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void getClipping (Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int flags = OS.PtEnter(0);
- try {
- if (region.handle != 0 && region.handle != Region.EMPTY_REGION) {
- OS.PhFreeTiles(region.handle);
- }
- int clipRects = data.clipRects;
- if (clipRects != 0) {
- region.handle = OS.PhRectsToTiles(clipRects, data.clipRectsCount);
- } else {
- region.handle = OS.PhGetTile();
- PhRect_t rect = new PhRect_t ();
- int rid = data.rid;
- int widget = data.widget;
- Image image = data.image;
- if (rid == OS.Ph_DEV_RID) {
- OS.PhRegionQuery (rid, null, rect, 0, 0);
- } else if (widget != 0) {
- OS.PtWidgetCanvas(widget, rect);
- } else if (image != null) {
- PhImage_t img = new PhImage_t();
- OS.memmove(img, image.handle, PhImage_t.sizeof);
- rect.lr_x = (short)(img.size_w - 1);
- rect.lr_y = (short)(img.size_h - 1);
- }
- OS.memmove(region.handle, rect, PhRect_t.sizeof);
- }
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Returns the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getFont () {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return Font.photon_new(data.device, data.font);
-}
-
-/**
- * Returns a FontMetrics which contains information
- * about the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return font metrics for the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontMetrics getFontMetrics() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- FontQueryInfo info = new FontQueryInfo();
- OS.PfQueryFontInfo(data.font, info);
- return FontMetrics.photon_new(info);
-}
-
-/**
- * Returns the receiver's foreground color.
- *
- * @return the color used for drawing foreground things
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getForeground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return Color.photon_new(data.device, data.foreground);
-}
-
-/**
- * Returns the receiver's line style, which will be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @return the style used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineStyle() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.lineStyle;
-}
-
-/**
- * Returns the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @return the receiver's line width
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineWidth() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.lineWidth;
-}
-
-/**
- * Returns <code>true</code> if this GC is drawing in the mode
- * where the resulting color in the destination is the
- * <em>exclusive or</em> of the color values in the source
- * and the destination, and <code>false</code> if it is
- * drawing in the mode where the destination color is being
- * replaced with the source color value.
- *
- * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getXORMode() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.xorMode;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-void init(Drawable drawable, GCData data, int context) {
- int prevContext;
- Image image = data.image;
- if (image == null) {
- prevContext = OS.PgSetGC(context);
- } else {
- prevContext = OS.PmMemStart(context);
- OS.PgSetDrawBufferSize(DrawBufferSize);
- }
-
- if (data.foreground == -1) data.foreground = DefaultFore;
- OS.PgSetStrokeColor(data.foreground);
- OS.PgSetTextColor(data.foreground);
- if (data.background == -1) data.background = DefaultBack;
- OS.PgSetFillColor(data.background);
- if (data.font == null) data.font = Font.DefaultFont;
- OS.PgSetFont(data.font);
-
- if (image == null) {
- OS.PgSetGC(prevContext);
- } else {
- image.memGC = this;
- OS.PmMemStop(context);
-
-
- /*
- * Destroy the mask when it is generated from a transparent
- * pixel since drawing on the image might change the mask.
- */
- if (image.transparentPixel != -1) {
- PhImage_t phImage = new PhImage_t ();
- OS.memmove(phImage, image.handle, PhImage_t.sizeof);
- if (phImage.mask_bm != 0) {
- OS.free(phImage.mask_bm);
- phImage.mask_bm = 0;
- phImage.mask_bpl = 0;
- OS.memmove(image.handle, phImage, PhImage_t.sizeof);
- }
- }
- }
- this.drawable = drawable;
- this.data = data;
- handle = context;
-}
-
-/**
- * Returns <code>true</code> if the receiver has a clipping
- * region set into it, and <code>false</code> otherwise.
- * If this method returns false, the receiver will draw on all
- * available space in the destination. If it returns true,
- * it will draw only in the area that is covered by the region
- * that can be accessed with <code>getClipping(region)</code>.
- *
- * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isClipped() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return data.clipRects != 0;
-}
-
-/**
- * Returns <code>true</code> if the GC has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the GC.
- * When a GC has been disposed, it is an error to
- * invoke any other method using the GC.
- *
- * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-static String replaceTabs(String text, int spaces) {
- int length = text.length();
- int index = text.indexOf('\t', 0);
- if (index == -1) return text;
-
- int start = 0;
- StringBuffer result = new StringBuffer();
- StringBuffer spaceString = new StringBuffer();
- while (spaces-- > 0) {
- spaceString.append(' ');
- }
- while (index != -1 && index < length) {
- result.append(text.substring(start, index));
- result.append(spaceString);
- index = text.indexOf('\t', start = index + 1);
- }
- if (index == -1) result.append(text.substring(start, length));
- return result.toString();
-}
-
-/**
- * Sets the background color. The background color is used
- * for fill operations and as the background color when text
- * is drawn.
- *
- * @param color the new background color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- OS.PgSetFillColor(data.background = color.handle);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the arguments.
- *
- * @param x the x coordinate of the clipping rectangle
- * @param y the y coordinate of the clipping rectangle
- * @param width the width of the clipping rectangle
- * @param height the height of the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int clipRects = data.clipRects;
- if (clipRects != 0)
- OS.free(clipRects);
- clipRects = OS.malloc(PhRect_t.sizeof);
- int clipRectsCount = 1;
- PhRect_t rect = new PhRect_t();
- rect.ul_x = (short)x;
- rect.ul_y = (short)y;
- rect.lr_x = (short)(x + width - 1);
- rect.lr_y = (short)(y + height - 1);
- OS.memmove(clipRects, rect, PhRect_t.sizeof);
- int prevContext = setGC();
- OS.PgSetMultiClip(clipRectsCount, clipRects);
- data.clipRects = clipRects;
- data.clipRectsCount = clipRectsCount;
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the argument.
- *
- * @param rect the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Rectangle rect) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) {
- int flags = OS.PtEnter(0);
- try {
- int clipRects = data.clipRects;
- if (clipRects != 0)
- OS.free(clipRects);
- data.clipRects = data.clipRectsCount = 0;
- int prevContext = setGC();
- OS.PgSetMultiClip(0, 0);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
- } else
- setClipping (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the region specified
- * by the argument.
- *
- * @param rect the clipping region.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int clipRects = data.clipRects;
- int clipRectsCount = data.clipRectsCount;
- if (clipRects != 0)
- OS.free(clipRects);
- if (region == null || region.handle == 0) {
- clipRects = clipRectsCount = 0;
- } else if (region.handle == Region.EMPTY_REGION) {
- clipRects = OS.malloc(PhRect_t.sizeof);
- clipRectsCount = 1;
- } else {
- int[] clip_rects_count = new int[1];
- clipRects = OS.PhTilesToRects(region.handle, clip_rects_count);
- clipRectsCount = clip_rects_count[0];
- }
- int prevContext = setGC();
- OS.PgSetMultiClip(clipRectsCount, clipRects);
- data.clipRects = clipRects;
- data.clipRectsCount = clipRectsCount;
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the font which will be used by the receiver
- * to draw and measure text to the argument. If the
- * argument is null, then a default font appropriate
- * for the platform will be used instead.
- *
- * @param font the new font for the receiver, or null to indicate a default font
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setFont (Font font) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (font != null && font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- byte[] newFont = font == null ? Font.DefaultFont : font.handle;
- OS.PgSetFont(newFont);
- data.font = newFont;
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the foreground color. The foreground color is used
- * for drawing operations including when text is drawn.
- *
- * @param color the new foreground color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setForeground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- int foreColor = data.foreground = color.handle;
- OS.PgSetStrokeColor(foreColor);
- OS.PgSetTextColor(foreColor);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the receiver's line style to the argument, which must be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @param lineStyle the style to be used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineStyle(int lineStyle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- byte[] dashList;
- switch (lineStyle) {
- case SWT.LINE_SOLID: dashList = DashList[0]; break;
- case SWT.LINE_DASH: dashList = DashList[1]; break;
- case SWT.LINE_DOT: dashList = DashList[2]; break;
- case SWT.LINE_DASHDOT: dashList = DashList[3]; break;
- case SWT.LINE_DASHDOTDOT: dashList = DashList[4]; break;
- default:
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- return;
- }
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- data.lineStyle = lineStyle;
- OS.PgSetStrokeDash(dashList, dashList.length, 0x10000);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Sets the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @param lineWidth the width of a line
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineWidth(int lineWidth) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- data.lineWidth = lineWidth;
- OS.PgSetStrokeWidth(lineWidth);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-int setGC() {
- if (data.image != null) return OS.PmMemStart(handle);
- else if (data.rid == OS.Ph_DEV_RID || data.widget != 0) return OS.PgSetGC(handle);
- else return 0;
-}
-
-void setGCClipping() {
- int rid = data.rid;
- int widget = data.widget;
- if (rid == OS.Ph_DEV_RID) OS.PgSetRegion(rid);
- else if (widget != 0) OS.PgSetRegion(OS.PtWidgetRid(widget));
- else if (data.image != null) return;
-
- /* NOTE: PgSetRegion resets the clipping rectangle */
- OS.PgSetMultiClip(data.clipRectsCount, data.clipRects);
-
- if (widget == 0) return;
-
- int clip_tile = getClipping(widget, data.topWidget, true, true);
- int[] clip_rects_count = new int[1];
- int clip_rects = OS.PhTilesToRects(clip_tile, clip_rects_count);
- OS.PhFreeTiles(clip_tile);
- if (clip_rects_count[0] == 0) {
- clip_rects_count[0] = 1;
- OS.free(clip_rects);
- clip_rects = OS.malloc(PhRect_t.sizeof);
- }
- OS.PgSetClipping((short)clip_rects_count[0], clip_rects);
- OS.free(clip_rects);
-}
-
-int getClipping(int widget, int topWidget, boolean clipChildren, boolean clipSiblings) {
- int child_tile = 0;
- int widget_tile = OS.PhGetTile(); // NOTE: PhGetTile native initializes the tile
-
- PhRect_t rect = new PhRect_t ();
- int args [] = {OS.Pt_ARG_FLAGS, 0, 0, OS.Pt_ARG_BASIC_FLAGS, 0, 0};
-
- /* Get the rectangle of all siblings in front of the widget */
- if (clipSiblings && OS.PtWidgetClass(topWidget) != OS.PtWindow()) {
- int temp_widget = topWidget;
- while ((temp_widget = OS.PtWidgetBrotherInFront(temp_widget)) != 0) {
- if (OS.PtWidgetIsRealized(temp_widget)) {
- int tile = OS.PhGetTile();
- if (child_tile == 0) child_tile = tile;
- else child_tile = OS.PhAddMergeTiles(tile, child_tile, null);
- OS.PtWidgetExtent(temp_widget, tile); // NOTE: tile->rect
- args [1] = args [4] = 0;
- OS.PtGetResources(temp_widget, args.length / 3, args);
- if ((args [1] & OS.Pt_HIGHLIGHTED) != 0) {
- int basic_flags = args [4];
- OS.memmove(rect, tile, PhRect_t.sizeof);
- if ((basic_flags & OS.Pt_TOP_ETCH) != 0) rect.ul_y++;
- if ((basic_flags & OS.Pt_BOTTOM_ETCH) != 0) rect.lr_y--;
- if ((basic_flags & OS.Pt_RIGHT_ETCH) != 0) rect.ul_x++;
- if ((basic_flags & OS.Pt_LEFT_ETCH) != 0) rect.lr_x--;
- OS.memmove(tile, rect, PhRect_t.sizeof);
- }
- }
- }
- /* Translate the siblings rectangles to the widget's coordinates */
- OS.PtWidgetCanvas(topWidget, widget_tile); // NOTE: widget_tile->rect
- OS.PhDeTranslateTiles(child_tile, widget_tile); // NOTE: widget_tile->rect.ul
- }
-
- /* Get the rectangle of the widget's children */
- if (clipChildren) {
- int temp_widget = OS.PtWidgetChildBack(widget);
- while (temp_widget != 0) {
- if (OS.PtWidgetIsRealized(temp_widget)) {
- int tile = OS.PhGetTile();
- if (child_tile == 0) child_tile = tile;
- else child_tile = OS.PhAddMergeTiles(tile, child_tile, null);
- OS.PtWidgetExtent(temp_widget, tile); // NOTE: tile->rect
- args [1] = args [4] = 0;
- OS.PtGetResources(temp_widget, args.length / 3, args);
- if ((args [1] & OS.Pt_HIGHLIGHTED) != 0) {
- int basic_flags = args [4];
- OS.memmove(rect, tile, PhRect_t.sizeof);
- if ((basic_flags & OS.Pt_TOP_ETCH) != 0) rect.ul_y++;
- if ((basic_flags & OS.Pt_BOTTOM_ETCH) != 0) rect.lr_y--;
- if ((basic_flags & OS.Pt_RIGHT_ETCH) != 0) rect.ul_x++;
- if ((basic_flags & OS.Pt_LEFT_ETCH) != 0) rect.lr_x--;
- OS.memmove(tile, rect, PhRect_t.sizeof);
- }
- }
- temp_widget = OS.PtWidgetBrotherInFront(temp_widget);
- }
- }
-
- /* Get the widget's rectangle */
- OS.PtWidgetCanvas(widget, widget_tile); // NOTE: widget_tile->rect
- OS.PhDeTranslateTiles(widget_tile, widget_tile); // NOTE: widget_tile->rect.ul
-
- /* Clip the widget's rectangle from the child/siblings rectangle's */
- if (child_tile != 0) {
- int clip_tile = OS.PhClipTilings(widget_tile, child_tile, null);
- OS.PhFreeTiles(child_tile);
- return clip_tile;
- }
- return widget_tile;
-}
-
-/**
- * If the argument is <code>true</code>, puts the receiver
- * in a drawing mode where the resulting color in the destination
- * is the <em>exclusive or</em> of the color values in the source
- * and the destination, and if the argument is <code>false</code>,
- * puts the receiver in a drawing mode where the destination color
- * is replaced with the source color value.
- *
- * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setXORMode(boolean xor) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- data.xorMode = xor;
- if (xor) OS.PgSetDrawMode(OS.Pg_DRAWMODE_XOR);
- else OS.PgSetDrawMode(OS.Pg_DRAWMODE_OPAQUE);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-}
-
-/**
- * Returns the extent of the given string. No tab
- * expansion or carriage return processing will be performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point stringExtent(String string) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- PhRect_t rect = new PhRect_t();
- int size = string.length();
- char[] buffer = new char[size];
- string.getChars(0, size, buffer, 0);
-
- int flags = OS.PtEnter(0);
- try {
- OS.PfExtentWideText(rect, null, data.font, buffer, size * 2);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-
- int width;
- if (size == 0) width = 0;
- else width = rect.lr_x - (rect.ul_x < 0 ? rect.ul_x : 0) + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Point(width, height);
-}
-
-/**
- * Returns the extent of the given string. Tab expansion and
- * carriage return processing are performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- PhRect_t rect = new PhRect_t();
- string = replaceTabs(string, 8);
- int size = string.length();
- byte [] buffer = Converter.wcsToMbcs (null, string, false);
-
- int flags = OS.PtEnter(0);
- try {
- int prevContext = setGC();
- OS.PgExtentMultiText(rect, null, data.font, buffer, buffer.length, 0);
- unsetGC(prevContext);
- } finally {
- if (flags >= 0) OS.PtLeave(flags);
- }
-
- int width;
- if (size == 0) width = 0;
- else width = rect.lr_x - (rect.ul_x < 0 ? rect.ul_x : 0) + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Point(width, height);
-}
-
-/**
- * Returns the extent of the given string. Tab expansion, line
- * delimiter and mnemonic processing are performed according to
- * the specified flags, which can be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @param flags the flags specifing how to process the text
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string, int flags) {
- return textExtent(string);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "GC {*DISPOSED*}";
- return "GC {" + handle + "}";
-}
-
-void unsetGC(int prevContext) {
- Image image = data.image;
- if (image != null) {
- OS.PmMemFlush(handle, image.handle);
- OS.PmMemStop(handle);
- } else if (data.rid == OS.Ph_DEV_RID || data.widget != 0) {
- OS.PgSetGC(prevContext);
-// OS.PgFlush();
- }
-}
-
-public static GC photon_new(Drawable drawable, GCData data) {
- GC gc = new GC();
- int context = drawable.internal_new_GC(data);
- gc.init(drawable, data, context);
- return gc;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GCData.java
deleted file mode 100755
index efbec5b5f5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GCData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class are descriptions of GCs in terms
- * of unallocated platform-specific data fields.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
- * API for SWT. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms, and should never be called from application code.
- * </p>
- *
- * @private
- */
-public final class GCData {
- public Device device;
- public Image image;
- public int rid;
- public int widget, topWidget;
- public int foreground = -1;
- public int background = -1;
- public byte[] font;
- public boolean xorMode;
- public int lineStyle = SWT.LINE_SOLID;
- public int lineWidth = 1;
- public int clipRectsCount;
- public int clipRects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java
deleted file mode 100755
index 80d95fbf3a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java
+++ /dev/null
@@ -1,980 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import java.io.*;
-
-/**
- * Instances of this class are graphics which have been prepared
- * for display on a specific device. That is, they are ready
- * to paint using methods such as <code>GC.drawImage()</code>
- * and display on widgets with, for example, <code>Button.setImage()</code>.
- * <p>
- * If loaded from a file format that supports it, an
- * <code>Image</code> may have transparency, meaning that certain
- * pixels are specified as being transparent when drawn. Examples
- * of file formats that support transparency are GIF and PNG.
- * </p><p>
- * There are two primary ways to use <code>Images</code>.
- * The first is to load a graphic file from disk and create an
- * <code>Image</code> from it. This is done using an <code>Image</code>
- * constructor, for example:
- * <pre>
- * Image i = new Image(device, "C:\\graphic.bmp");
- * </pre>
- * A graphic file may contain a color table specifying which
- * colors the image was intended to possess. In the above example,
- * these colors will be mapped to the closest available color in
- * SWT. It is possible to get more control over the mapping of
- * colors as the image is being created, using code of the form:
- * <pre>
- * ImageData data = new ImageData("C:\\graphic.bmp");
- * RGB[] rgbs = data.getRGBs();
- * // At this point, rgbs contains specifications of all
- * // the colors contained within this image. You may
- * // allocate as many of these colors as you wish by
- * // using the Color constructor Color(RGB), then
- * // create the image:
- * Image i = new Image(device, data);
- * </pre>
- * <p>
- * Applications which require even greater control over the image
- * loading process should use the support provided in class
- * <code>ImageLoader</code>.
- * </p><p>
- * Application code must explicitely invoke the <code>Image.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see Color
- * @see ImageData
- * @see ImageLoader
- */
-public final class Image implements Drawable {
-
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
- */
- public int type;
-
- /**
- * the OS resource of the image
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this image was created
- */
- Device device;
-
- /**
- * specifies the transparent pixel
- * (Warning: This field is platform dependent)
- */
- int transparentPixel = -1;
-
- /**
- * the GC which is drawing on the image
- * (Warning: This field is platform dependent)
- */
- GC memGC;
-
- /**
- * specifies the default scanline padding
- * (Warning: This field is platform dependent)
- */
- static final int DEFAULT_SCANLINE_PAD = 4;
-
-Image () {
-}
-
-/**
- * Constructs an empty instance of this class with the
- * specified width and height. The result may be drawn upon
- * by creating a GC and using any of its drawing operations,
- * as shown in the following example:
- * <pre>
- * Image i = new Image(device, width, height);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param width the width of the new image
- * @param height the height of the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
- * </ul>
- */
-public Image(Device device, int width, int height) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, width, height);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new instance of this class based on the
- * provided image, with an appearance that varies depending
- * on the value of the flag. The possible flag values are:
- * <dl>
- * <dt><b>IMAGE_COPY</b></dt>
- * <dd>the result is an identical copy of srcImage</dd>
- * <dt><b>IMAGE_DISABLE</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
- * <dt><b>IMAGE_GRAY</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
- * </dl>
- *
- * @param device the device on which to create the image
- * @param srcImage the image to use as the source
- * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
- * is otherwise in an invalid state</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
-public Image(Device device, Image srcImage, int flag) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- switch (flag) {
- case SWT.IMAGE_COPY:
- case SWT.IMAGE_DISABLE:
- this.type = srcImage.type;
- int imageHandle = srcImage.handle;
- if (imageHandle != 0) {
- imageHandle = OS.PiDuplicateImage (imageHandle, 0);
- if (imageHandle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- PhImage_t phImage = new PhImage_t();
- if (flag == SWT.IMAGE_COPY) {
- /*
- * Bug in Photon - The image returned by PiDuplicateImage
- * has the same mask_bm as the original image.
- */
- OS.memmove (phImage, imageHandle, PhImage_t.sizeof);
- if (phImage.mask_bm != 0) {
- int length = phImage.mask_bpl * phImage.size_h;
- int ptr = OS.malloc (length);
- OS.memmove(ptr, phImage.mask_bm, length);
- phImage.mask_bm = ptr;
- OS.memmove (imageHandle, phImage, PhImage_t.sizeof);
- }
- /*
- * Bug in Photon - The image returned by PiDuplicateImage
- * has the same alpha as the original image.
- */
- if (phImage.alpha != 0) {
- PgAlpha_t alpha = new PgAlpha_t();
- OS.memmove(alpha, phImage.alpha, PgAlpha_t.sizeof);
- if (alpha.src_alpha_map_map != 0) {
- int length = alpha.src_alpha_map_dim_w * alpha.src_alpha_map_dim_h;
- int ptr = OS.malloc(length);
- OS.memmove(ptr, alpha.src_alpha_map_map, length);
- }
- int ptr = OS.malloc(PgAlpha_t.sizeof);
- OS.memmove(ptr, alpha, PgAlpha_t.sizeof);
- phImage.alpha = ptr;
- OS.memmove (imageHandle, phImage, PhImage_t.sizeof);
- }
- transparentPixel = srcImage.transparentPixel;
- } else {
- OS.PhMakeGhostBitmap(imageHandle);
- OS.memmove (phImage, imageHandle, PhImage_t.sizeof);
- phImage.mask_bm = phImage.ghost_bitmap;
- phImage.mask_bpl = phImage.ghost_bpl;
- phImage.ghost_bitmap = 0;
- phImage.ghost_bpl = 0;
- phImage.alpha = 0;
- OS.memmove (imageHandle, phImage, PhImage_t.sizeof);
- }
- }
- handle = imageHandle;
- if (device.tracking) device.new_Object(this);
- return;
- case SWT.IMAGE_GRAY:
- Rectangle r = srcImage.getBounds();
- ImageData data = srcImage.getImageData();
- PaletteData palette = data.palette;
- ImageData newData = data;
- if (!palette.isDirect) {
- /* Convert the palette entries to gray. */
- RGB [] rgbs = palette.getRGBs();
- for (int i=0; i<rgbs.length; i++) {
- if (data.transparentPixel != i) {
- RGB color = rgbs [i];
- int red = color.red;
- int green = color.green;
- int blue = color.blue;
- int intensity = (red+red+green+green+green+green+green+blue) >> 3;
- color.red = color.green = color.blue = intensity;
- }
- }
- newData.palette = new PaletteData(rgbs);
- } else {
- /* Create a 8 bit depth image data with a gray palette. */
- RGB[] rgbs = new RGB[256];
- for (int i=0; i<rgbs.length; i++) {
- rgbs[i] = new RGB(i, i, i);
- }
- newData = new ImageData(r.width, r.height, 8, new PaletteData(rgbs));
- newData.maskData = data.maskData;
- newData.maskPad = data.maskPad;
-
- /* Convert the pixels. */
- int[] scanline = new int[r.width];
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- int redShift = palette.redShift;
- int greenShift = palette.greenShift;
- int blueShift = palette.blueShift;
- for (int y=0; y<r.height; y++) {
- int offset = y * newData.bytesPerLine;
- data.getPixels(0, y, r.width, scanline, 0);
- for (int x=0; x<r.width; x++) {
- int pixel = scanline[x];
- int red = pixel & redMask;
- red = (redShift < 0) ? red >>> -redShift : red << redShift;
- int green = pixel & greenMask;
- green = (greenShift < 0) ? green >>> -greenShift : green << greenShift;
- int blue = pixel & blueMask;
- blue = (blueShift < 0) ? blue >>> -blueShift : blue << blueShift;
- newData.data[offset++] =
- (byte)((red+red+green+green+green+green+green+blue) >> 3);
- }
- }
- }
- init (device, newData);
- if (device.tracking) device.new_Object(this);
- return;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-/**
- * Constructs an empty instance of this class with the
- * width and height of the specified rectangle. The result
- * may be drawn upon by creating a GC and using any of its
- * drawing operations, as shown in the following example:
- * <pre>
- * Image i = new Image(device, boundsRectangle);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param bounds a rectangle specifying the image's width and height (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
- * </ul>
- */
-public Image(Device device, Rectangle bounds) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, bounds.width, bounds.height);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class from the given
- * <code>ImageData</code>.
- *
- * @param device the device on which to create the image
- * @param data the image data to create the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
- * </ul>
- */
-public Image(Device device, ImageData data) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, data);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class, whose type is
- * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
- * objects. The two images must be the same size, and the mask image
- * must have a color depth of 1. Pixel transparency in either image
- * will be ignored. If either image is an icon to begin with, an
- * exception is thrown.
- * <p>
- * The mask image should contain white wherever the icon is to be visible,
- * and black wherever the icon is to be transparent. In addition,
- * the source image should contain black wherever the icon is to be
- * transparent.
- * </p>
- *
- * @param device the device on which to create the icon
- * @param source the color data for the icon
- * @param mask the mask data for the icon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
- * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
- * if the mask is not monochrome, or if either the source or mask
- * is already an icon</li>
- * </ul>
- */
-public Image(Device device, ImageData source, ImageData mask) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (source.width != mask.width || source.height != mask.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
- image.maskPad = mask.scanlinePad;
- image.maskData = mask.data;
- init(device, image);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the specified input stream. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p><p>
- * This constructor may be used to load a resource as follows:
- * </p>
- * <pre>
- * new Image(device, clazz.getResourceAsStream("file.gif"));
- * </pre>
- *
- * @param device the device on which to create the image
- * @param stream the input stream to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image (Device device, InputStream stream) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new ImageData(stream));
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the file with the specified name. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading
- * a single image only. If the specified file contains
- * multiple images, only the first one will be used.
- *
- * @param device the device on which to create the image
- * @param filename the name of the file to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image (Device device, String filename) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new ImageData(filename));
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the image. Applications must dispose of all images which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- destroyImage(handle);
- handle = 0;
- memGC = null;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Image)) return false;
- Image image = (Image) object;
- return device == image.device && handle == image.handle;
-}
-
-/**
- * Returns the color to which to map the transparent pixel, or null if
- * the receiver has no transparent pixel.
- * <p>
- * There are certain uses of Images that do not support transparency
- * (for example, setting an image into a button or label). In these cases,
- * it may be desired to simulate transparency by using the background
- * color of the widget to paint the transparent pixels of the image.
- * Use this method to check which color will be used in these cases
- * in place of transparency. This value may be set with setBackground().
- * <p>
- *
- * @return the background color of the image, or null if there is no transparency in the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (transparentPixel == -1) return null;
-
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, handle, PhImage_t.sizeof);
- int color = 0;
- if ((phImage.type & OS.Pg_IMAGE_CLASS_MASK) == OS.Pg_IMAGE_CLASS_PALETTE) {
- int phPalette = phImage.palette;
- if (phPalette == 0 || transparentPixel > phImage.colors) return null;
- int[] pgColor = new int[1];
- OS.memmove(pgColor, phPalette + (transparentPixel * 4), 4);
- color = pgColor[0];
- } else {
- switch (phImage.type) {
- case OS.Pg_IMAGE_DIRECT_888:
- color = ((transparentPixel & 0xFF) << 16) | (transparentPixel & 0xFF00) | ((transparentPixel & 0xFF0000) >> 16);
- break;
- case OS.Pg_IMAGE_DIRECT_8888:
- color = ((transparentPixel & 0xFF00) << 8) | ((transparentPixel & 0xFF0000) >> 8) | ((transparentPixel & 0xFF000000) >> 24);
- break;
- case OS.Pg_IMAGE_DIRECT_565:
- color = ((transparentPixel & 0xF800) << 8) | ((transparentPixel & 0x7E0) << 5) | ((transparentPixel & 0x1F) << 3);
- break;
- case OS.Pg_IMAGE_DIRECT_555:
- color = ((transparentPixel & 0x7C00) << 9) | ((transparentPixel & 0x3E0) << 6) | ((transparentPixel & 0x1F) << 3);
- break;
- case OS.Pg_IMAGE_DIRECT_444:
- color = ((transparentPixel & 0xF00) << 12) | ((transparentPixel & 0xF0) << 8) | ((transparentPixel & 0xF) << 4);
- break;
- default:
- return null;
- }
- }
- return Color.photon_new(device, color);
-}
-
-/**
- * Returns the bounds of the receiver. The rectangle will always
- * have x and y values of 0, and the width and height of the
- * image.
- *
- * @return a rectangle specifying the image's bounds
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- */
-public Rectangle getBounds() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhImage_t image = new PhImage_t();
- OS.memmove(image, handle, PhImage_t.sizeof);
- return new Rectangle(0, 0, image.size_w, image.size_h);
-}
-
-/**
- * Returns an <code>ImageData</code> based on the receiver
- * Modifications made to this <code>ImageData</code> will not
- * affect the Image.
- *
- * @return an <code>ImageData</code> containing the image's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- *
- * @see ImageData
- */
-public ImageData getImageData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, handle, PhImage_t.sizeof);
- int depth = 0;
- PaletteData palette = null;
- switch (phImage.type) {
- case OS.Pg_IMAGE_DIRECT_555:
- depth = 16;
- palette = new PaletteData(0x7C00,0x3E0,0x1F);
- break;
- case OS.Pg_IMAGE_DIRECT_565:
- depth = 16;
- palette = new PaletteData(0xF800,0x7E0,0x1F);
- break;
- case OS.Pg_IMAGE_DIRECT_444:
- depth = 16;
- palette = new PaletteData(0xF00,0xF0,0xF);
- break;
- case OS.Pg_IMAGE_DIRECT_888:
- depth = 24;
- palette = new PaletteData(0xFF,0xFF00,0xFF0000);
- break;
- case OS.Pg_IMAGE_DIRECT_8888:
- depth = 32;
- palette = new PaletteData(0xFF00,0xFF0000,0xFF000000);
- break;
- case -1:
- depth = 1;
- palette = new PaletteData(new RGB[] {new RGB(0,0,0), new RGB(255,255,255)});
- break;
- case OS.Pg_IMAGE_PALETTE_NIBBLE:
- case OS.Pg_IMAGE_PALETTE_BYTE:
- depth = phImage.type == OS.Pg_IMAGE_PALETTE_BYTE ? 8 : 4;
- RGB[] rgbs = new RGB[phImage.colors];
- int[] colors = new int[phImage.colors];
- OS.memmove(colors, phImage.palette, colors.length * 4);
- for (int i = 0; i < rgbs.length; i++) {
- int rgb = colors[i];
- rgbs[i] = new RGB((rgb & 0xFF0000) >> 16, (rgb & 0xFF00) >> 8, rgb & 0xFF);
- }
- palette = new PaletteData(rgbs);
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
-
- int calcBpl, scanLinePad, bpl = phImage.bpl;
- int width = phImage.size_w, height = phImage.size_h;
- int dataBytesPerLine = (width * depth + 7) / 8;
- for (scanLinePad = 1; scanLinePad < 128; scanLinePad++) {
- calcBpl = (dataBytesPerLine + (scanLinePad - 1)) / scanLinePad * scanLinePad;
- if (bpl == calcBpl) break;
- }
- byte[] data = new byte[height * bpl];
- OS.memmove(data, phImage.image, data.length);
-
- ImageData imageData = new ImageData(width, height, depth, palette, scanLinePad, data);
-
- if (transparentPixel != -1) {
- imageData.transparentPixel = transparentPixel;
- } else if (phImage.mask_bm != 0) {
- imageData.maskData = new byte[height * phImage.mask_bpl];
- OS.memmove(imageData.maskData, phImage.mask_bm, imageData.maskData.length);
- imageData.maskPad = 4;
- } else if (phImage.alpha != 0) {
- PgAlpha_t alpha = new PgAlpha_t();
- OS.memmove(alpha, phImage.alpha, PgAlpha_t.sizeof);
- imageData.alpha = alpha.src_global_alpha;
- if ((alpha.alpha_op & OS.Pg_ALPHA_OP_SRC_MAP) != 0 && alpha.src_alpha_map_map != 0) {
- int length = alpha.src_alpha_map_dim_w * alpha.src_alpha_map_dim_h;
- imageData.alphaData = new byte[length];
- OS.memmove(imageData.alphaData, alpha.src_alpha_map_map, length);
- }
- }
-
- return imageData;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-void init(Device device, int width, int height) {
- if (width <= 0 | height <= 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- this.device = device;
- this.type = SWT.BITMAP;
-
- handle = OS.PhCreateImage(null, (short)width, (short)height, OS.Pg_IMAGE_DIRECT_888, 0, 0, 0);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-}
-
-void init(Device device, ImageData i) {
- if (i == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
-
- /* Photon does not support 1 & 2-bit images. Convert to 4-bit image. */
- if (i.depth == 1 || i.depth == 2) {
- ImageData img = new ImageData(i.width, i.height, 4, i.palette);
- ImageData.blit(ImageData.BLIT_SRC,
- i.data, i.depth, i.bytesPerLine, img.getByteOrder(), 0, 0, i.width, i.height, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- img.data, img.depth, img.bytesPerLine, img.getByteOrder(), 0, 0, img.width, img.height, null, null, null,
- false, false);
- img.transparentPixel = i.transparentPixel;
- img.maskPad = i.maskPad;
- img.maskData = i.maskData;
- img.alpha = i.alpha;
- img.alphaData = i.alphaData;
- i = img;
- }
-
- int type = 0;
- int[] phPalette = null;
- if (!i.palette.isDirect) {
- switch (i.depth) {
- case 4: type = OS.Pg_IMAGE_PALETTE_NIBBLE; break;
- case 8: type = OS.Pg_IMAGE_PALETTE_BYTE; break;
- default: SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- RGB[] rgbs = i.palette.getRGBs();
- phPalette = new int[rgbs.length];
- for (int j=0; j<rgbs.length; j++) {
- RGB rgb = rgbs[j];
- phPalette[j] = ((rgb.red & 0xFF) << 16) | ((rgb.green & 0xFF) << 8) | (rgb.blue & 0xFF);
- }
- } else {
- final PaletteData palette = i.palette;
- final int redMask = palette.redMask;
- final int greenMask = palette.greenMask;
- final int blueMask = palette.blueMask;
- int newDepth = i.depth;
- int newOrder = ImageData.MSB_FIRST;
- PaletteData newPalette = null;
-
- switch (i.depth) {
- case 8:
- newDepth = 16;
- newOrder = ImageData.LSB_FIRST;
- newPalette = new PaletteData(0xF800, 0x7E0, 0x1F);
- type = OS.Pg_IMAGE_DIRECT_565;
- break;
- case 16:
- newOrder = ImageData.LSB_FIRST;
- if (redMask == 0x7C00 && greenMask == 0x3E0 && blueMask == 0x1F) {
- type = OS.Pg_IMAGE_DIRECT_555;
- } else if (redMask == 0xF800 && greenMask == 0x7E0 && blueMask == 0x1F) {
- type = OS.Pg_IMAGE_DIRECT_565;
- } else if (redMask == 0xF00 && greenMask == 0xF0 && blueMask == 0xF) {
- type = OS.Pg_IMAGE_DIRECT_444;
- } else {
- type = OS.Pg_IMAGE_DIRECT_565;
- newPalette = new PaletteData(0xF800, 0x7E0, 0x1F);
- }
- break;
- case 24:
- if (redMask == 0xFF && greenMask == 0xFF00 && blueMask == 0xFF0000) {
- type = OS.Pg_IMAGE_DIRECT_888;
- } else {
- type = OS.Pg_IMAGE_DIRECT_888;
- newPalette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
- }
- break;
- case 32:
- if (redMask == 0xFF00 && greenMask == 0xFF0000 && blueMask == 0xFF000000) {
- type = OS.Pg_IMAGE_DIRECT_8888;
- } else {
- type = OS.Pg_IMAGE_DIRECT_8888;
- newPalette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
- }
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- if (newPalette != null) {
- ImageData img = new ImageData(i.width, i.height, newDepth, newPalette);
- ImageData.blit(ImageData.BLIT_SRC,
- i.data, i.depth, i.bytesPerLine, i.getByteOrder(), 0, 0, i.width, i.height, redMask, greenMask, blueMask,
- ImageData.ALPHA_OPAQUE, null, 0,
- img.data, img.depth, img.bytesPerLine, newOrder, 0, 0, img.width, img.height, newPalette.redMask, newPalette.greenMask, newPalette.blueMask,
- false, false);
- if (i.transparentPixel != -1) {
- img.transparentPixel = newPalette.getPixel(palette.getRGB(i.transparentPixel));
- }
- img.maskPad = i.maskPad;
- img.maskData = i.maskData;
- img.alpha = i.alpha;
- img.alphaData = i.alphaData;
- i = img;
- }
- }
- int handle = OS.malloc(PhImage_t.sizeof);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- PhImage_t phImage = new PhImage_t();
- phImage.type = type;
- phImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- int size = i.data.length;
- int ptr = OS.malloc(size);
- if (ptr == 0) {
- OS.free(handle);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.memmove(ptr, i.data, size);
- phImage.image = ptr;
- phImage.size_w = (short)i.width;
- phImage.size_h = (short)i.height;
- phImage.bpl = i.bytesPerLine;
- if (phPalette != null) {
- size = phPalette.length * 4;
- ptr = OS.malloc(size);
- if (ptr == 0) {
- OS.free(phImage.image);
- OS.free(handle);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.memmove(ptr, phPalette, size);
- phImage.palette = ptr;
- phImage.colors = phPalette.length;
- }
- if (i.getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- this.type = SWT.ICON;
- int maskBpl = (i.width * 1 + 7) / 8;
- maskBpl = (maskBpl + (i.maskPad - 1)) / i.maskPad * i.maskPad;
- size = maskBpl * i.height;
- ptr = OS.malloc(size);
- if (ptr == 0) {
- if (phImage.palette != 0) OS.free(phImage.palette);
- OS.free(phImage.image);
- OS.free(handle);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.memmove(ptr, i.maskData, size);
- phImage.mask_bm = ptr;
- phImage.mask_bpl = maskBpl;
- } else {
- this.type = SWT.BITMAP;
- if (i.transparentPixel != -1) {
- /*
- * The PhImage_t field transparent can not used to store the
- * transparent pixel because it is overwritten when a GC is
- * created on the image.
- */
- transparentPixel = i.transparentPixel;
- } else if (i.alpha != -1 || i.alphaData != null) {
- PgAlpha_t alpha = new PgAlpha_t();
- alpha.alpha_op = i.alpha != -1 ? OS.Pg_ALPHA_OP_SRC_GLOBAL : OS.Pg_ALPHA_OP_SRC_MAP;
- alpha.alpha_op |= OS.Pg_BLEND_SRC_SRC_ALPHA | OS.Pg_BLEND_DST_ONE_MINUS_SRC_ALPHA;
- alpha.src_global_alpha = (byte)i.alpha;
- if (i.alpha == -1 && i.alphaData != null) {
- ptr = OS.malloc(i.alphaData.length);
- if (ptr == 0) {
- if (phImage.palette != 0) OS.free(phImage.palette);
- OS.free(phImage.image);
- OS.free(handle);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.memmove(ptr, i.alphaData, i.alphaData.length);
- alpha.src_alpha_map_bpl = (short)i.width;
- alpha.src_alpha_map_dim_w = (short)i.width;
- alpha.src_alpha_map_dim_h = (short)i.height;
- alpha.src_alpha_map_map = ptr;
- }
- ptr = OS.malloc(PgAlpha_t.sizeof);
- if (ptr == 0) {
- if (alpha.src_alpha_map_map != 0) OS.free(alpha.src_alpha_map_map);
- if (phImage.palette != 0) OS.free(phImage.palette);
- OS.free(phImage.image);
- OS.free(handle);
- SWT.error(SWT.ERROR_NO_HANDLES);
- }
- OS.memmove(ptr, alpha, PgAlpha_t.sizeof);
- phImage.alpha = ptr;
- }
- }
- OS.memmove(handle, phImage, PhImage_t.sizeof);
- this.handle = handle;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- /*
- * Create a new GC that can draw into the image.
- * Only supported for bitmaps.
- */
- if (type != SWT.BITMAP || memGC != null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, handle, PhImage_t.sizeof);
- PhDim_t dim = new PhDim_t();
- dim.w = phImage.size_w;
- dim.h = phImage.size_h;
- PhPoint_t trans = new PhPoint_t();
- int pmMC = OS.PmMemCreateMC(handle, dim, trans);
- if (pmMC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- data.device = device;
- data.image = this;
- return pmMC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int pmMC, GCData data) {
- OS.PmMemReleaseMC(pmMC);
-}
-
-/**
- * Returns <code>true</code> if the image has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the image.
- * When an image has been disposed, it is an error to
- * invoke any other method using the image.
- *
- * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Sets the color to which to map the transparent pixel.
- * <p>
- * There are certain uses of <code>Images</code> that do not support
- * transparency (for example, setting an image into a button or label).
- * In these cases, it may be desired to simulate transparency by using
- * the background color of the widget to paint the transparent pixels
- * of the image. This method specifies the color that will be used in
- * these cases. For example:
- * <pre>
- * Button b = new Button();
- * image.setBackground(b.getBackground());>
- * b.setImage(image);
- * </pre>
- * </p><p>
- * The image may be modified by this operation (in effect, the
- * transparent regions may be filled with the supplied color). Hence
- * this operation is not reversible and it is not legal to call
- * this function twice or with a null argument.
- * </p><p>
- * This method has no effect if the receiver does not have a transparent
- * pixel value.
- * </p>
- *
- * @param color the color to use when a transparent pixel is specified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (transparentPixel == -1) return;
-
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, handle, PhImage_t.sizeof);
- int phPalette = phImage.palette;
- if (phPalette == 0 || transparentPixel > phImage.colors) return;
- int[] pgColor = new int[]{ color.handle };
- OS.memmove(phPalette + (transparentPixel * 4), pgColor, 4);
-}
-
-static void destroyImage(int image) {
- if (image == 0) return;
- PhImage_t phImage = new PhImage_t();
- OS.memmove(phImage, image, PhImage_t.sizeof);
- phImage.flags = OS.Ph_RELEASE_IMAGE_ALL;
- OS.memmove(image, phImage, PhImage_t.sizeof);
- OS.PhReleaseImage(image);
- OS.free(image);
-}
-
-public static Image photon_new(Device device, int type, int handle) {
- if (device == null) device = Device.getDevice();
- Image image = new Image();
- image.type = type;
- image.handle = handle;
- image.device = device;
- return image;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return "Image {" + handle + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Region.java
deleted file mode 100755
index 29822f7673..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Region.java
+++ /dev/null
@@ -1,321 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent areas of an x-y coordinate
- * system that are aggregates of the areas covered by a number
- * of rectangles.
- * <p>
- * Application code must explicitly invoke the <code>Region.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- */
-public final class Region {
-
- /**
- * the OS resource for the region
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- static int EMPTY_REGION = -1;
-
-/**
- * Constructs a new empty region.
- */
-public Region () {
- handle = EMPTY_REGION;
-}
-Region(int handle) {
- this.handle = handle;
-}
-
-
-/**
- * Adds the given rectangle to the collection of rectangles
- * the receiver maintains to describe its area.
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Rectangle rect) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (handle == 0) return;
- int tile_ptr = OS.PhGetTile();
- PhTile_t tile = new PhTile_t();
- tile.rect_ul_x = (short)rect.x;
- tile.rect_ul_y = (short)rect.y;
- tile.rect_lr_x = (short)(rect.x + rect.width - 1);
- tile.rect_lr_y = (short)(rect.y + rect.height - 1);
- OS.memmove(tile_ptr, tile, PhTile_t.sizeof);
- if (handle == EMPTY_REGION) handle = tile_ptr;
- else handle = OS.PhAddMergeTiles (handle, tile_ptr, null);
-}
-
-/**
- * Adds all of the rectangles which make up the area covered
- * by the argument to the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @param region the region to merge
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Region region) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (handle == 0) return;
- if (region.handle == EMPTY_REGION) return;
- int copy = OS.PhCopyTiles(region.handle);
- if (handle == EMPTY_REGION) handle = copy;
- else handle = OS.PhAddMergeTiles (handle, copy, null);
-}
-
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (int x, int y) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (handle == 0 || handle == EMPTY_REGION) return false;
- int tile_ptr = OS.PhGetTile();
- PhTile_t tile = new PhTile_t();
- tile.rect_ul_x = tile.rect_lr_x = (short)x;
- tile.rect_ul_y = tile.rect_lr_y = (short)y;
- OS.memmove(tile_ptr, tile, PhTile_t.sizeof);
- int intersection = OS.PhIntersectTilings (tile_ptr, handle, null);
- boolean result = intersection != 0;
- OS.PhFreeTiles(tile_ptr);
- OS.PhFreeTiles(intersection);
- return result;
-}
-
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (Point pt) {
- if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the region. Applications must dispose of all regions which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- if (handle != EMPTY_REGION) OS.PhFreeTiles (handle);
- handle = 0;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (this == object) return true;
- if (!(object instanceof Region)) return false;
- Region region = (Region)object;
- return handle == region.handle;
-}
-
-/**
- * Returns a rectangle which represents the rectangular
- * union of the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @return a bounding rectangle for the region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#union
- */
-public Rectangle getBounds() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (handle == 0 || handle == EMPTY_REGION) return new Rectangle(0, 0, 0, 0);
- PhTile_t tile = new PhTile_t();
- int temp_tile;
- int rect_ptr = OS.malloc(PhRect_t.sizeof);
- OS.memmove(rect_ptr, handle, PhRect_t.sizeof);
- OS.memmove(tile, handle, PhTile_t.sizeof);
- while ((temp_tile = tile.next) != 0) {
- OS.PhRectUnion (rect_ptr, temp_tile);
- OS.memmove(tile, temp_tile, PhTile_t.sizeof);
- }
- PhRect_t rect = new PhRect_t();
- OS.memmove(rect, rect_ptr, PhRect_t.sizeof);
- OS.free(rect_ptr);
- int width = rect.lr_x - rect.ul_x + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Rectangle(rect.ul_x, rect.ul_y, width, height);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-/**
- * Returns <code>true</code> if the rectangle described by the
- * arguments intersects with any of the rectangles the receiver
- * mainains to describe its area, and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (int x, int y, int width, int height) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (handle == 0 || handle == EMPTY_REGION) return false;
- int tile_ptr = OS.PhGetTile();
- PhTile_t tile = new PhTile_t();
- tile.rect_ul_x = (short)x;
- tile.rect_ul_y = (short)y;
- tile.rect_lr_x = (short)(x + width - 1);
- tile.rect_lr_y = (short)(y + height - 1);
- OS.memmove(tile_ptr, tile, PhTile_t.sizeof);
- int intersection = OS.PhIntersectTilings (tile_ptr, handle, null);
- boolean result = intersection != 0;
- OS.PhFreeTiles(tile_ptr);
- OS.PhFreeTiles(intersection);
- return result;
-}
-
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with any of the rectangles the receiver mainains to describe
- * its area and <code>false</code> otherwise.
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Returns <code>true</code> if the region has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the region.
- * When a region has been disposed, it is an error to
- * invoke any other method using the region.
- *
- * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isEmpty () {
- return getBounds().isEmpty();
-
-}
-
-public static Region photon_new(int handle) {
- return new Region(handle);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return "Region {" + handle + "}";
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/Converter.java
deleted file mode 100755
index 70732e3336..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/Converter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- */
-
-public final class Converter {
- public static final byte [] NullByteArray = new byte [1];
- public static final char [] NullCharArray = new char [1];
- public static final byte [] EmptyByteArray = new byte [0];
- public static final char [] EmptyCharArray = new char [0];
-/**
- * Returns the default code page for the platform where the
- * application is currently running.
- *
- * @return the default code page
- */
-public static String defaultCodePage () {
- /*
- | ptr cp |
- DefaultCodePage == nil ifFalse: [^DefaultCodePage].
- cp := ''. "$NON-NLS$"
- (ptr := OSStringZ address: (NlLanginfo callWith: 49)) isNull
- ifFalse: [cp := String copyFromOSMemory: ptr].
- cp isEmpty ifFalse: [
- IsSunOS ifTrue: [
- (cp size > 3 and: [(cp copyFrom: 1 to: 3) = 'ISO'])
- ifTrue: [cp := cp copyFrom: 4 to: cp size]].
- ^DefaultCodePage := cp].
- IsAIX ifTrue: [^DefaultCodePage := 'ISO8859-1'].
- IsSunOS ifTrue: [^DefaultCodePage := '8859-1'].
- ^DefaultCodePage := 'iso8859_1'
- */
- return null;
-}
-static boolean is7BitAscii (byte [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if ((buffer [i] & 0xFF) > 0x7F) return false;
- }
- return true;
-}
-static boolean is7BitAscii (char [] buffer) {
- for (int i=0; i<buffer.length; i++) {
- if (buffer [i] > 0x7F) return false;
- }
- return true;
-}
-public static char [] mbcsToWcs (String codePage, byte [] buffer) {
- //SLOW AND BOGUS
- return new String (buffer).toCharArray ();
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, String string) {
- return wcsToMbcs (codePage, string, false);
-}
-public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
- //SLOW AND BOGUS
- int count = string.length ();
- if (terminate) count++;
- char [] buffer = new char [count];
- string.getChars (0, string.length (), buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
-}
-/* TEMPORARY CODE */
-public static byte [] wcsToMbcs (String codePage, char [] buffer) {
- return wcsToMbcs (codePage, buffer, false);
-}
-public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
- //SLOW AND BOGUS
- if (!terminate) return new String (buffer).getBytes ();
- byte [] buffer1 = new String (buffer).getBytes ();
- byte [] buffer2 = new byte [buffer1.length + 1];
- System.arraycopy (buffer1, 0, buffer2, 0, buffer1.length);
- return buffer2;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
deleted file mode 100755
index 47632df247..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
+++ /dev/null
@@ -1,616 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object that
- * issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Button extends Control {
- Image image;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Button (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
- if ((style & SWT.PUSH) != 0) {
- return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
- }
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
- return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
- }
- if ((style & SWT.ARROW) != 0) {
- return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
- }
- return style;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the control is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-void click () {
- int rid = OS.PtWidgetRid (handle);
- if (rid == 0) return;
- PhEvent_t event = new PhEvent_t ();
- event.emitter_rid = rid;
- event.emitter_handle = handle;
- event.collector_rid = rid;
- event.collector_handle = handle;
- event.flags = OS.Ph_EVENT_DIRECT;
- event.processing_flags = OS.Ph_FAKE_EVENT;
- event.type = OS.Ph_EV_BUT_PRESS;
- event.num_rects = 1;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- pe.click_count = 1;
- pe.buttons = OS.Ph_BUTTON_SELECT;
- PhRect_t rect = new PhRect_t ();
- int ptr = OS.malloc (PhEvent_t.sizeof + PhPointerEvent_t.sizeof + PhRect_t.sizeof);
- OS.memmove (ptr, event, PhEvent_t.sizeof);
- OS.memmove (ptr + PhEvent_t.sizeof, rect, PhRect_t.sizeof);
- OS.memmove (ptr + PhEvent_t.sizeof + PhRect_t.sizeof, pe, PhPointerEvent_t.sizeof);
- OS.PtSendEventToWidget (handle, ptr);
- OS.PtFlush ();
- event.type = OS.Ph_EV_BUT_RELEASE;
- event.subtype = OS.Ph_EV_RELEASE_REAL;
- OS.memmove (ptr, event, PhEvent_t.sizeof);
- OS.memmove (ptr + PhEvent_t.sizeof, rect, PhRect_t.sizeof);
- OS.memmove (ptr + PhEvent_t.sizeof + PhRect_t.sizeof, pe, PhPointerEvent_t.sizeof);
- OS.PtSendEventToWidget (handle, ptr);
- OS.free (ptr);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.ARROW) != 0) {
- if (wHint != SWT.DEFAULT) width += wHint;
- else width = 17;
- if (hHint != SWT.DEFAULT) height += hHint;
- else height = 17;
- return new Point (width, height);
- }
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- width = dim.w; height = dim.h;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- int [] args = {
- OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 1
- OS.Pt_ARG_MARGIN_HEIGHT, 0, 0, // 4
- OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 7
- OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 10
- OS.Pt_ARG_MARGIN_TOP, 0, 0, // 13
- OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 16
- };
- OS.PtGetResources (handle, args.length / 3, args);
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) {
- width = area.size_w + (args [1] * 2) + args [7] + args [10];
- }
- if (hHint != SWT.DEFAULT) {
- height = area.size_h + (args [4] * 2) + args [13] + args [16];
- }
- }
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int parentHandle = parent.handle;
-
- /* ARROW button */
- if ((style & SWT.ARROW) != 0) {
- int [] args = {
- OS.Pt_ARG_BASIC_FLAGS, OS.Pt_HORIZONTAL_GRADIENT, OS.Pt_STATIC_GRADIENT | OS.Pt_HORIZONTAL_GRADIENT,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (display.PtButton, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- /* Compute alignment */
- int alignment = OS.Pt_LEFT;
- if ((style & SWT.CENTER) != 0) alignment = OS.Pt_CENTER;
- if ((style & SWT.RIGHT) != 0) alignment = OS.Pt_RIGHT;
-
- /* CHECK or RADIO button */
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- int [] args = {
- OS.Pt_ARG_HORIZONTAL_ALIGNMENT, alignment, 0,
- OS.Pt_ARG_INDICATOR_TYPE, (style & SWT.CHECK) != 0 ? OS.Pt_N_OF_MANY : OS.Pt_ONE_OF_MANY, 0,
- OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
-
- handle = OS.PtCreateWidget (display.PtToggleButton, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- /* PUSH or TOGGLE button */
- int [] args = {
- OS.Pt_ARG_FLAGS, (style & SWT.TOGGLE) != 0 ? OS.Pt_TOGGLE : 0, OS.Pt_TOGGLE,
- OS.Pt_ARG_HORIZONTAL_ALIGNMENT, alignment, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (display.PtButton, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the alignment will indicate the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) {
- if ((style & SWT.UP) != 0) return SWT.UP;
- if ((style & SWT.DOWN) != 0) return SWT.DOWN;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.UP;
- }
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-boolean getDefault () {
- if ((style & SWT.PUSH) == 0) return false;
- int [] args = {OS.Pt_ARG_BEVEL_CONTRAST, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1] == 100;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed. If the receiver is of any other type,
- * this method returns false.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_SET) != 0;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) return "";
- int [] args = {
- OS.Pt_ARG_TEXT_STRING, 0, 0,
- OS.Pt_ARG_ACCEL_KEY, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return "";
- int length = OS.strlen (args [1]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, args [1], length);
- char [] result = Converter.mbcsToWcs (null, buffer);
- int count = 0;
- int mnemonic = 0;
- if (args [4] != 0) {
- int length2 = OS.strlen (args [4]);
- if (length2 > 0) {
- byte [] buffer2 = new byte [length2];
- OS.memmove (buffer2, args [4], length2);
- char [] result2 = Converter.mbcsToWcs (null, buffer2);
- if (result2.length > 0) mnemonic = result2 [0];
- }
- }
- if (mnemonic != 0) count++;
- for (int i=0; i<result.length-1; i++)
- if (result [i] == Mnemonic) count++;
- char [] newResult = result;
- if ((count != 0) || (mnemonic != 0)) {
- newResult = new char [result.length + count];
- int i = 0, j = 0;
- while (i < result.length) {
- if ((mnemonic != 0) && (result [i] == mnemonic)) {
- if (j < newResult.length) newResult [j++] = Mnemonic;
- mnemonic = 0;
- }
- if ((newResult [j++] = result [i++]) == Mnemonic)
- if (j < newResult.length) newResult [j++] = Mnemonic;
- }
- }
- return new String (newResult);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
-}
-
-int processActivate (int info) {
- if (setFocus ()) click ();
- return OS.Pt_CONTINUE;
-}
-
-int processFocusIn (int info) {
- int result = super.processFocusIn (info);
- // widget could be disposed at this point
- if (handle == 0) return result;
- if ((style & SWT.PUSH) == 0) return result;
- getShell ().setDefaultButton (this, false);
- return result;
-}
-
-int processFocusOut (int info) {
- int result = super.processFocusOut (info);
- // widget could be disposed at this point
- if (handle == 0) return result;
- if ((style & SWT.PUSH) == 0) return result;
- if (getDefault ()) {
- getShell ().setDefaultButton (null, false);
- }
- return result;
-}
-
-int processPaint (int damage) {
- if ((style & SWT.ARROW) != 0) {
- OS.PtSuperClassDraw (OS.PtButton (), handle, damage);
- PhRect_t rect = new PhRect_t ();
- OS.PtCalcCanvas (handle, rect);
- int flags = 0;
- if ((style & SWT.RIGHT) != 0) flags = 2;
- if ((style & SWT.LEFT) != 0) flags = 1;
- if ((style & SWT.DOWN) != 0) flags = 8;
- if ((style & SWT.UP) != 0) flags = 4;
- OS.PgDrawArrow (rect, (short)0, 0x000000, flags);
- } else if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- OS.PtSuperClassDraw (OS.PtToggleButton (), handle, damage);
- } else {
- OS.PtSuperClassDraw (OS.PtButton (), handle, damage);
- }
- return super.processPaint (damage);
-}
-
-int processSelection (int info) {
- if ((style & SWT.RADIO) != 0) {
- if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) selectRadio ();
- }
- postEvent (SWT.Selection);
- return OS.Pt_CONTINUE;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-void selectRadio () {
- Control [] children = parent._getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (this != child && child instanceof Button) {
- Button button = (Button) child;
- if ((button.style & SWT.RADIO) != 0) {
- if (button.getSelection ()) {
- button.setSelection (false);
- button.postEvent (SWT.Selection);
- }
- }
- }
- }
- setSelection (true);
-}
-
-/**
- * Controls how text, images and arrows will be displayed
- * in the receiver. The argument should be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the argument indicates the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget();
- if ((style & SWT.ARROW) != 0) {
- if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
- style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- OS.PtDamageWidget (handle);
- return;
- }
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int [] args = {OS.Pt_ARG_HORIZONTAL_ALIGNMENT, OS.Pt_LEFT, 0};
- if ((style & SWT.CENTER) != 0) args [1] = OS.Pt_CENTER;
- if ((style & SWT.RIGHT) != 0) args [1] = OS.Pt_RIGHT;
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-void setDefault (boolean value) {
- if ((style & SWT.PUSH) == 0) return;
- if (getShell ().parent == null) return;
- int [] args = {OS.Pt_ARG_BEVEL_CONTRAST, value ? 100 : 20, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
- * <code>RADIO</code>, or <code>TOGGLE</code>.
- *
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int [] args = {OS.Pt_ARG_FLAGS, selected ? OS.Pt_SET : 0, OS.Pt_SET};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if ((style & SWT.ARROW) != 0) return;
- this.image = image;
- int imageHandle = 0;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- imageHandle = copyPhImage (image.handle);
- }
- int [] args = {
- OS.Pt_ARG_LABEL_IMAGE, imageHandle, 0,
- OS.Pt_ARG_LABEL_TYPE, OS.Pt_IMAGE, 0
- };
- OS.PtSetResources (handle, args.length / 3, args);
- if (imageHandle != 0) OS.free (imageHandle);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the button label. The label may include
- * the mnemonic character but must not contain line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.ARROW) != 0) return;
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
- int i=0, j=0;
- char mnemonic=0;
- while (i < text.length) {
- if ((text [j++] = text [i++]) == Mnemonic) {
- if (i == text.length) {continue;}
- if (text [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = text [i];
- j--;
- }
- }
- while (j < text.length) text [j++] = 0;
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int ptr2 = 0;
- if (mnemonic != 0) {
- byte [] buffer2 = Converter.wcsToMbcs (null, new char []{mnemonic}, true);
- ptr2 = OS.malloc (buffer2.length);
- OS.memmove (ptr2, buffer2, buffer2.length);
- }
- replaceMnemonic (mnemonic, true, true);
- int [] args = {
- OS.Pt_ARG_TEXT_STRING, ptr, 0,
- OS.Pt_ARG_LABEL_TYPE, OS.Pt_Z_STRING, 0,
- OS.Pt_ARG_ACCEL_KEY, ptr2, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
- OS.free (ptr2);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java
deleted file mode 100755
index b2e2d2d97c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a surface for drawing
- * arbitrary graphics.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are <em>not</em> constructed
- * from aggregates of other controls. That is, they are either
- * painted using SWT graphics calls or are handled by native
- * methods.
- * </p>
- *
- * @see Composite
- */
-public class Canvas extends Composite {
- Caret caret;
-
-Canvas () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-
-/**
- * Returns the caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- *
- * @return the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Caret getCaret () {
- checkWidget();
- return caret;
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddEventHandler (handle, OS.Ph_EV_DRAG, windowProc, SWT.MouseMove);
-}
-
-int processFocusIn (int info) {
- int result = super.processFocusIn (info);
- if (caret != null) caret.setFocus ();
- return result;
-}
-int processFocusOut (int info) {
- int result = super.processFocusOut (info);
- if (caret != null) caret.killFocus ();
- return result;
-}
-
-int processPaint (int callData) {
- boolean isVisible = caret != null && caret.isVisible ();
- if (isVisible) caret.hideCaret ();
- int result = super.processPaint (callData);
- if (isVisible) caret.showCaret ();
- return result;
-}
-
-int processMouse (int info) {
- /*
- * Bug in Photon. Despite the fact that we are returning
- * Pt_END when a button is pressed, for some reason, the
- * single-line text widget does not end the processing and
- * the callback is sent to the parent. This causes us to
- * call PhInitDrag () which interferes with drag selection
- * in the text widget. The fix is to only call PhInitDrag ()
- * when there are no children.
- */
- if (OS.PtWidgetChildFront (handle) != 0) {
- return super.processMouse (info);
- }
-
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- switch (ev.type) {
- case OS.Ph_EV_BUT_PRESS:
- int data = OS.PhGetData (cbinfo.event);
- if (data == 0) return OS.Pt_END;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- PhRect_t rect = new PhRect_t ();
- PhPoint_t pos = new PhPoint_t();
- pos.x = pe.pos_x;
- pos.y = pe.pos_y;
- rect.ul_x = rect.lr_x = (short) (pos.x + ev.translation_x);
- rect.ul_y = rect.lr_y = (short) (pos.y + ev.translation_y);
- int rid = OS.PtWidgetRid (handle);
-// int input_group = OS.PhInputGroup (cbinfo.event);
- int input_group = OS.PhInputGroup (0);
- OS.PhInitDrag (rid, OS.Ph_DRAG_KEY_MOTION | OS.Ph_DRAG_TRACK | OS.Ph_TRACK_DRAG, rect, null, input_group, null, null, null, pos, null);
- }
- return super.processMouse (info);
-}
-
-public void redraw () {
- checkWidget();
- boolean isVisible = caret != null && caret.isVisible ();
- if (isVisible) caret.hideCaret ();
- super.redraw ();
- if (isVisible) caret.showCaret ();
-}
-
-public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget();
- boolean isVisible = caret != null && caret.isVisible ();
- if (isVisible) caret.hideCaret ();
- super.redraw (x, y, width, height, all);
- if (isVisible) caret.showCaret ();
-}
-
-void releaseWidget () {
- if (caret != null) {
- caret.releaseWidget ();
- caret.releaseHandle ();
- }
- caret = null;
- super.releaseWidget();
-}
-
-/**
- * Scrolls a rectangular area of the receiver by first copying
- * the source area to the destination and then causing the area
- * of the source which is not covered by the destination to
- * be repainted. Children that intersect the rectangle are
- * optionally moved during the operation. In addition, outstanding
- * paint events are flushed before the source area is copied to
- * ensure that the contents of the canvas are drawn correctly.
- *
- * @param destX the x coordinate of the destination
- * @param destY the y coordinate of the destination
- * @param x the x coordinate of the source
- * @param y the y coordinate of the source
- * @param width the width of the area
- * @param height the height of the area
- * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- checkWidget();
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- if (!isVisible ()) return;
- boolean isVisible = (caret != null) && (caret.isVisible ());
- if (isVisible) caret.hideCaret ();
- GC gc = new GC (this);
- gc.copyArea (x, y, width, height, destX, destY);
- gc.dispose ();
- if (isVisible) caret.showCaret ();
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- checkWidget();
- boolean isVisible = (caret != null) && (caret.isVisible ());
- if (isVisible) caret.hideCaret ();
- super.setBounds (x, y, width, height, move, resize);
- if (isVisible) caret.showCaret ();
-}
-
-/**
- * Sets the receiver's caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- * @param caret the new caret for the receiver, may be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCaret (Caret caret) {
- checkWidget();
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (isFocusControl ()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) {
- if (newCaret.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- newCaret.setFocus ();
- }
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
deleted file mode 100755
index c8065670f4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
+++ /dev/null
@@ -1,491 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an i-beam that is typically used
- * as the insertion point for text.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Caret extends Widget {
- Canvas parent;
- Image image;
- int x, y, width, height;
- boolean moved, resized;
- boolean isVisible, isShowing;
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-// int blinkRate = 500;
-
-public Caret (Canvas parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-
-//boolean blinkCaret () {
-// if (!isVisible) return true;
-// if (!isShowing) return showCaret ();
-// if (blinkRate == 0) return true;
-// return hideCaret ();
-//}
-
-void createWidget (int index) {
- super.createWidget (index);
- isVisible = true;
- if (parent.getCaret () == null) {
- parent.setCaret (this);
- }
-}
-
-boolean drawCaret () {
- if (parent == null) return false;
- if (parent.isDisposed ()) return false;
- int handle = parent.handle;
- if (!OS.PtWidgetIsRealized (handle)) return false;
- int phGC = OS.PgCreateGC (0); // NOTE: PgCreateGC ignores the parameter
- if (phGC == 0) return false;
- int [] args = {OS.Pt_ARG_COLOR, 0, 0, OS.Pt_ARG_FILL_COLOR, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int foreground = args [1];
- int background = args [4];
- int color = foreground ^ ~background;
- int prevContext = OS.PgSetGC (phGC);
- OS.PgSetRegion (OS.PtWidgetRid (handle));
- OS.PgSetDrawMode (OS.Pg_DRAWMODE_XOR);
- OS.PgSetFillColor (color);
- int nWidth = width, nHeight = height;
- if (image != null) {
- Rectangle rect = image.getBounds ();
- nWidth = rect.width;
- nHeight = rect.height;
- }
- if (nWidth <= 0) nWidth = 2;
- OS.PgDrawIRect (x, y, x + nWidth - 1, y + nHeight - 1, OS.Pg_DRAW_FILL);
- OS.PgSetGC (prevContext);
- OS.PgDestroyGC (phGC);
- return true;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Rectangle (x, y, rect.width, rect.height);
- }
- return new Rectangle (x, y, width, height);
-}
-
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- return parent.getFont ();
-}
-
-/**
- * Returns the image that the receiver will use to paint the caret.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- return new Point (x, y);
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Canvas</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Canvas getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns a point describing the receiver's size.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Point (rect.width, rect.height);
- }
- return new Point (width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return isVisible;
-}
-
-boolean hideCaret () {
-// Display display = getDisplay ();
-// if (display.currentCaret != this) return false;
- if (!isShowing) return true;
- isShowing = false;
- return drawCaret ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return isVisible && parent.isVisible () && parent.hasFocus ();
-}
-
-void killFocus () {
-// Display display = getDisplay ();
-// if (display.currentCaret != this) return;
- if (isVisible) hideCaret ();
-// display.setCurrentCaret (null);
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (this == parent.getCaret ()) parent.setCaret (null);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
-// Display display = getDisplay ();
-// if (display.currentCaret == this) {
-// if (isVisible) hideCaret ();
-// display.setCurrentCaret (null);
-// }
- parent = null;
- image = null;
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean samePosition, sameExtent, showing;
- samePosition = (this.x == x) && (this.y == y);
- sameExtent = (this.width == width) && (this.height == height);
- if ((samePosition) && (sameExtent)) return;
- if (showing = isShowing) hideCaret ();
- this.x = x; this.y = y;
- this.width = width; this.height = height;
- if (sameExtent) {
- moved = true;
- if (isVisible ()) {
- moved = false;
- }
- } else {
- resized = true;
- if (isVisible ()) {
- moved = false;
- resized = false;
- }
- }
- if (showing) showCaret ();
-}
-
-void setFocus () {
-// Display display = getDisplay ();
-// if (display.currentCaret == this) return;
-// display.setCurrentCaret (this);
- if (isVisible) showCaret ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
- if (font != null && font.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-/**
- * Sets the image that the receiver will use to paint the caret
- * to the image specified by the argument, or to the default
- * which is a filled rectangle if the argument is null
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (isShowing) hideCaret ();
- this.image = image;
- if (isShowing) showCaret ();
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- setBounds (x, y, width, height);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- checkWidget();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's size to the point specified by the arguments.
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- setBounds (x, y, width, height);
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- *
- * @param size the new extent for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- checkWidget();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible == isVisible) return;
- if (isVisible = visible) {
- showCaret ();
- } else {
- hideCaret ();
- }
-}
-
-boolean showCaret () {
-// if (getDisplay ().currentCaret != this) return false;
- if (isShowing) return true;
- isShowing = true;
- return drawCaret ();
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ColorDialog.java
deleted file mode 100755
index c4f56c6ce5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ColorDialog.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a color
- * from a predefined set of available colors.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ColorDialog extends Dialog {
- RGB rgb;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the currently selected color in the receiver.
- *
- * @return the RGB value for the selected color, may be null
- *
- * @see PaletteData#getRGBs
- */
-public RGB getRGB () {
- return rgb;
-}
-
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return the selected color, or null if the dialog was
- * cancelled, no color was selected, or an error
- * occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public RGB open () {
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.shellHandle;
- byte[] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
- PtColorSelectInfo_t info = new PtColorSelectInfo_t();
- info.flags = OS.Pt_COLORSELECT_MODAL;
- if (rgb != null) info.rgb = (rgb. blue & 0xFF) | ((rgb.green & 0xFF) << 8) | ((rgb.red & 0xFF) << 16);
- rgb = null;
-
- OS.PtColorSelect(parentHandle, title, info);
-
- if ((info.flags & OS.Pt_COLORSELECT_ACCEPT) != 0) {
- int color = info.rgb;
- rgb = new RGB ((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF);
- }
- return rgb;
-}
-
-/**
- * Returns the receiver's selected color to be the argument.
- *
- * @param rgb the new RGB value for the selected color, may be
- * null to let the platform to select a default when
- * open() is called
- *
- * @see PaletteData#getRGBs
- */
-public void setRGB (RGB rgb) {
- this.rgb = rgb;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
deleted file mode 100755
index de91a0586d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
+++ /dev/null
@@ -1,1065 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are controls that allow the user
- * to choose an item from a list of items, or optionally
- * enter a new value by typing it into an editable text
- * field. Often, <code>Combo</code>s are used in the same place
- * where a single selection <code>List</code> widget could
- * be used but space is limited. A <code>Combo</code> takes
- * less space than a <code>List</code> widget and shows
- * similar information.
- * <p>
- * Note: Since <code>Combo</code>s can contain both a list
- * and an editable text field, it is possible to confuse methods
- * which access one versus the other (compare for example,
- * <code>clearSelection()</code> and <code>deselectAll()</code>).
- * The API documentation is careful to indicate either "the
- * receiver's list" or the "the receiver's text field" to
- * distinguish between the two cases.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see List
- */
-public class Combo extends Composite {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Combo (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a combo box that has a border using Windows style
- * bits. All combo boxes draw their own border and
- * do not use the standard Windows border styles.
- * Therefore, no matter what style bits are specified,
- * clear the BORDER bits so that the SWT style will
- * match the Windows widget.
- *
- * The Windows behavior is currently implemented on
- * all platforms.
- */
- style &= ~SWT.BORDER;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
- if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
- return style;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- //NOT DONE: this only works with a DROP_DOWN combo
- if ((style & SWT.SIMPLE) != 0) return new Point(100, 100);
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = dim.w;
- int height = dim.h;
- int text = OS.PtWidgetChildBack(handle);
- OS.PtWidgetPreferredSize(text, dim);
- height += dim.h;
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- OS.PtSetAreaFromWidgetCanvas (text, rect, area);
- width += area.size_w;
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- OS.Pt_ARG_TEXT_FONT, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- int maxWidth = 0;
- rect = new PhRect_t();
- int [] items = new int [1];
- for (int i = 0; i < args [1]; i++) {
- OS.memmove (items, args [4] + (i * 4), 4);
- int length = OS.strlen (items [0]);
- OS.PfExtentText(rect, null, args [7], items [0], length);
- maxWidth = Math.max(maxWidth, rect.lr_x - rect.ul_x + 1);
- }
- width += maxWidth;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- rect = new PhRect_t ();
- area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) width = area.size_w;
- if (hHint != SWT.DEFAULT) height = area.size_h;
- }
- return new Point(width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtComboBox;
- int parentHandle = parent.handle;
- int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
- int [] args = {
- OS.Pt_ARG_TEXT_FLAGS, textFlags, OS.Pt_EDITABLE,
- OS.Pt_ARG_CBOX_MAX_VISIBLE_COUNT, 5, 0,
- OS.Pt_ARG_CBOX_FLAGS, (style & SWT.SIMPLE) != 0 ? OS.Pt_COMBOBOX_STATIC: 0, OS.Pt_COMBOBOX_STATIC,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_CBOX_SELECTION_ITEM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == index) {
- args = new int [] {
- OS.Pt_ARG_TEXT_STRING, 0, 0,
- OS.Pt_ARG_CBOX_SELECTION_ITEM, 0, 0
- };
- OS.PtSetResources (handle, args.length / 3, args);
- }
-}
-
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_TEXT_STRING, 0, 0,
- OS.Pt_ARG_CBOX_SELECTION_ITEM, 0, 0
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.PtListAddItems (handle, new int [] {ptr}, 1, 0);
- OS.free (ptr);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int result = OS.PtListAddItems (handle, new int [] {ptr}, 1, index + 1);
- OS.free (ptr);
- if (result != 0) {
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (0 <= index && index <= args [1]) error (SWT.ERROR_ITEM_NOT_ADDED);
- error (SWT.ERROR_INVALID_RANGE);
- }
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget();
- OS.PtTextSetSelection (handle, new int [] {0}, new int [] {0});
-}
-
-void deregister () {
- super.deregister ();
- int child = OS.PtWidgetChildBack (handle);
- WidgetTable.remove (child);
-}
-
-int focusHandle () {
-
- /*
- * Fetuare in Photon. The combo box does not receive
- * Pt_CB_GOT_FOCUS and Pt_CB_LOST_FOCUS callbacks itself.
- * Only the internal PtText receives them. The fix is to
- * add these callbacks in the internal PtText.
- */
- return OS.PtWidgetChildBack (handle);
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- int [] items = new int [1];
- OS.memmove (items, args [4] + (index * 4), 4);
- int length = OS.strlen (items [0]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, items [0], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- //NOT DONE - NOT NEEDED
- return 0;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- int [] items = new int [args [1]];
- OS.memmove (items, args [4], args [1] * 4);
- String [] result = new String [args [1]];
- for (int i=0; i<args [1]; i++) {
- int length = OS.strlen (items [i]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, items [i], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- result [i] = new String (unicode);
- }
- return result;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget();
- if (((style & SWT.DROP_DOWN) != 0) && ((style & SWT.READ_ONLY) != 0)) {
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int length = 0;
- if (args [1] != 0) length = OS.strlen (args [1]);
- return new Point (0, length);
- }
-// if (textVerify != null) {
-// return new Point (textVerify.start_pos, textVerify.end_pos);
-// }
- int [] start = new int [1], end = new int [1];
- OS.PtTextGetSelection (handle, start, end);
- if (start [0] == -1) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- start [0] = end [0] = args [1];
- }
- return new Point (start [0], end [0]);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_CBOX_SELECTION_ITEM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return -1;
- return args [1] - 1;
-}
-
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return "";
- int length = OS.strlen (args [1]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, args [1], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget();
- //NOT DONE - Only works for DROP_DOWN
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int height = dim.h;
- int text = OS.PtWidgetChildBack(handle);
- OS.PtWidgetPreferredSize(text, dim);
- height += dim.h;
- return height;
-}
-
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_MAX_LENGTH, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-boolean hasFocus () {
- return OS.PtIsFocused (handle) != 0;
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_SELECTION, windowProc, SWT.Selection);
- OS.PtAddCallback (handle, OS.Pt_CB_TEXT_CHANGED, windowProc, SWT.Modify);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- return OS.PtListItemPos(handle, buffer) - 1;
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- // NOT DONE - start is ignored
- return indexOf (string);
-}
-
-int processModify (int info) {
- sendEvent (SWT.Modify);
- return OS.Pt_CONTINUE;
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtComboBox (), handle, damage);
- sendPaintEvent (damage);
- return OS.Pt_CONTINUE;
-}
-
-int processSelection (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.reason_subtype == OS.Pt_LIST_SELECTION_FINAL) {
- postEvent(SWT.Selection);
- }
- return OS.Pt_CONTINUE;
-}
-
-void register () {
- super.register ();
- int child = OS.PtWidgetChildBack (handle);
- WidgetTable.put (child, this);
-}
-
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 < start && start <= end && end < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- int count = end - start + 1;
- int result = OS.PtListDeleteItemPos (handle, count, start + 1);
- if (result != 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) error (SWT.ERROR_INVALID_RANGE);
- int result = OS.PtListDeleteItemPos (handle, 1, index + 1);
- if (result != 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
- remove (index);
-}
-
-/**
- * Removes all of the items from the receiver's list.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.PtListDeleteAllItems (handle);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index < 0) return;
- int [] args = new int [] {OS.Pt_ARG_CBOX_SELECTION_ITEM, index + 1, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- checkWidget();
- int newHeight = ((style & SWT.DROP_DOWN) != 0) ? getTextHeight() : height;
- super.setBounds (x, y, width, newHeight, move, resize);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.PtListReplaceItemPos (handle, new int [] {ptr}, 1, index + 1);
- OS.free (ptr);
-}
-
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.PtListDeleteAllItems (handle);
- int[] itemsPtr = new int [items.length];
- for (int i=0; i<itemsPtr.length; i++) {
- byte [] buffer = Converter.wcsToMbcs (null, items [i], true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- itemsPtr [i] = ptr;
- }
- OS.PtListAddItems (handle, itemsPtr, itemsPtr.length, 0);
- for (int i=0; i<itemsPtr.length; i++) {
- OS.free (itemsPtr [i]);
- }
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.PtTextSetSelection (handle, new int [] {selection.x}, new int [] {selection.y});
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- if ((style & SWT.READ_ONLY) != 0) {
- int index = OS.PtListItemPos(handle, buffer);
- if (index > 0) {
- int [] args = new int [] {OS.Pt_ARG_CBOX_SELECTION_ITEM, index, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-// sendEvent (SWT.Modify);
- }
- return;
- }
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {OS.Pt_ARG_TEXT_STRING, ptr, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- int [] args = new int [] {OS.Pt_ARG_MAX_LENGTH, limit, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-int traversalCode (int key_sym, PhKeyEvent_t ke) {
- int code = super.traversalCode (key_sym, ke);
- if (key_sym == OS.Pk_Up || key_sym == OS.Pk_Down) {
- code &= ~(SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS);
- }
- if ((style & SWT.READ_ONLY) == 0) {
- if (key_sym == OS.Pk_Up || key_sym == OS.Pk_Down) {
- code &= ~(SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS);
- }
- }
- return code;
-}
-
-boolean translateTraversal (int key_sym, PhKeyEvent_t phEvent) {
- boolean translated = super.translateTraversal (key_sym, phEvent);
- if (!translated && key_sym == OS.Pk_Return) {
- postEvent (SWT.DefaultSelection);
- return false;
- }
- return translated;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
deleted file mode 100755
index e077b4587f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
+++ /dev/null
@@ -1,687 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are controls which are capable
- * of containing other controls.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are constructed from aggregates
- * of other controls.
- * </p>
- *
- * @see Canvas
- */
-public class Composite extends Scrollable {
- Layout layout;
- Control [] tabList;
-
-Composite () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Composite (Composite parent, int style) {
- super (parent, style);
-}
-
-Control [] _getChildren () {
- int count = 0;
- int child = OS.PtWidgetChildFront (handle);
- while (child != 0) {
- child = OS.PtWidgetBrotherBehind (child);
- count++;
- }
- Control [] children = new Control [count];
- int i = 0, j = 0;
- child = OS.PtWidgetChildFront (handle);
- while (i < count) {
- Widget widget = WidgetTable.get (child);
- if (widget != null && widget != this) {
- if (widget instanceof Control) {
- children [j++] = (Control) widget;
- }
- }
- i++;
- child = OS.PtWidgetBrotherBehind (child);
- }
- if (i == j) return children;
- Control [] newChildren = new Control [j];
- System.arraycopy (children, 0, newChildren, 0, j);
- return newChildren;
-}
-
-Control [] _getTabList () {
- if (tabList == null) return tabList;
- int index = 0, count = 0;
- while (index < tabList.length) {
- if (!tabList [index].isDisposed ()) count++;
- index++;
- }
- if (index == count) return tabList;
- Control [] newList = new Control [count];
- index = 0;
- for (int i=0; i<tabList.length; i++) {
- if (!tabList [index].isDisposed ()) {
- newList [index++] = tabList [i];
- }
- }
- tabList = newList;
- return tabList;
-}
-
-protected void checkSubclass () {
- /* Do nothing - Subclassing is allowed */
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size;
- if (layout != null) {
- if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = new Point (wHint, hHint);
- }
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = computeTrim (0, 0, size.x, size.y);
- return new Point (trim.width, trim.height);
-}
-
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
- int parentHandle = parent.handle;
- createScrolledHandle (parentHandle);
-}
-
-void createScrollBars () {
- if (scrolledHandle == 0) return;
- if ((style & SWT.H_SCROLL) != 0) {
- horizontalBar = new ScrollBar (this, SWT.HORIZONTAL);
- }
- if ((style & SWT.V_SCROLL) != 0) {
- verticalBar = new ScrollBar (this, SWT.VERTICAL);
- }
-}
-
-public boolean forceFocus () {
- checkWidget();
- /*
- * Bug in Photon. PtContainerGiveFocus() is supposed to give
- * focus to the widget even if the widget's Pt_GET_FOCUS flag
- * is not set. This does not happen when the widget is a
- * PtContainer. The fix is to set the flag before calling it.
- */
- int [] args = {OS.Pt_ARG_FLAGS, OS.Pt_GETS_FOCUS, OS.Pt_GETS_FOCUS};
- OS.PtSetResources (handle, args.length / 3, args);
- boolean result = super.forceFocus ();
- args [1] = 0;
- OS.PtSetResources (handle, args.length / 3, args);
- return result;
-}
-
-void createScrolledHandle (int parentHandle) {
- int etches = OS.Pt_ALL_ETCHES | OS.Pt_ALL_OUTLINES;
- int [] args = new int [] {
- OS.Pt_ARG_FLAGS, hasBorder () ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_BASIC_FLAGS, hasBorder () ? etches : 0, etches,
- OS.Pt_ARG_CONTAINER_FLAGS, 0, OS.Pt_ENABLE_CUA | OS.Pt_ENABLE_CUA_ARROWS,
- OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- scrolledHandle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
- if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- Display display = getDisplay ();
- etches = OS.Pt_TOP_OUTLINE | OS.Pt_LEFT_OUTLINE;
- args = new int [] {
- OS.Pt_ARG_FLAGS, OS.Pt_HIGHLIGHTED, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_BASIC_FLAGS, etches, etches,
- OS.Pt_ARG_WIDTH, display.SCROLLBAR_WIDTH, 0,
- OS.Pt_ARG_HEIGHT, display.SCROLLBAR_HEIGHT, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- OS.PtCreateWidget (OS.PtContainer (), scrolledHandle, args.length / 3, args);
- int clazz = display.PtContainer;
- args = new int [] {
- OS.Pt_ARG_CONTAINER_FLAGS, 0, OS.Pt_ENABLE_CUA | OS.Pt_ENABLE_CUA_ARROWS,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, scrolledHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- createScrollBars ();
-}
-
-public Rectangle getClientArea () {
- checkWidget();
- if (scrolledHandle == 0) return super.getClientArea ();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (handle, area);
- return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h);
-}
-
-int getClipping(int widget, int topWidget, boolean clipChildren, boolean clipSiblings) {
- int child_tile = 0;
- int widget_tile = OS.PhGetTile(); // NOTE: PhGetTile native initializes the tile
-
- PhRect_t rect = new PhRect_t ();
- int args [] = {OS.Pt_ARG_FLAGS, 0, 0, OS.Pt_ARG_BASIC_FLAGS, 0, 0};
-
- /* Get the rectangle of all siblings in front of the widget */
- if (clipSiblings && OS.PtWidgetClass(topWidget) != OS.PtWindow()) {
- int temp_widget = topWidget;
- while ((temp_widget = OS.PtWidgetBrotherInFront(temp_widget)) != 0) {
- if (OS.PtWidgetIsRealized(temp_widget)) {
- int tile = OS.PhGetTile();
- if (child_tile == 0) child_tile = tile;
- else child_tile = OS.PhAddMergeTiles(tile, child_tile, null);
- OS.PtWidgetExtent(temp_widget, tile); // NOTE: tile->rect
- args [1] = args [4] = 0;
- OS.PtGetResources(temp_widget, args.length / 3, args);
- if ((args [1] & OS.Pt_HIGHLIGHTED) != 0) {
- int basic_flags = args [4];
- OS.memmove(rect, tile, PhRect_t.sizeof);
- if ((basic_flags & OS.Pt_TOP_ETCH) != 0) rect.ul_y++;
- if ((basic_flags & OS.Pt_BOTTOM_ETCH) != 0) rect.lr_y--;
- if ((basic_flags & OS.Pt_RIGHT_ETCH) != 0) rect.ul_x++;
- if ((basic_flags & OS.Pt_LEFT_ETCH) != 0) rect.lr_x--;
- OS.memmove(tile, rect, PhRect_t.sizeof);
- }
- }
- }
- /* Translate the siblings rectangles to the widget's coordinates */
- OS.PtWidgetCanvas(topWidget, widget_tile); // NOTE: widget_tile->rect
- OS.PhDeTranslateTiles(child_tile, widget_tile); // NOTE: widget_tile->rect.ul
- }
-
- /* Get the rectangle of the widget's children */
- if (clipChildren) {
- int temp_widget = OS.PtWidgetChildBack(widget);
- while (temp_widget != 0) {
- if (OS.PtWidgetIsRealized(temp_widget)) {
- int tile = OS.PhGetTile();
- if (child_tile == 0) child_tile = tile;
- else child_tile = OS.PhAddMergeTiles(tile, child_tile, null);
- OS.PtWidgetExtent(temp_widget, tile); // NOTE: tile->rect
- args [1] = args [4] = 0;
- OS.PtGetResources(temp_widget, args.length / 3, args);
- if ((args [1] & OS.Pt_HIGHLIGHTED) != 0) {
- int basic_flags = args [4];
- OS.memmove(rect, tile, PhRect_t.sizeof);
- if ((basic_flags & OS.Pt_TOP_ETCH) != 0) rect.ul_y++;
- if ((basic_flags & OS.Pt_BOTTOM_ETCH) != 0) rect.lr_y--;
- if ((basic_flags & OS.Pt_RIGHT_ETCH) != 0) rect.ul_x++;
- if ((basic_flags & OS.Pt_LEFT_ETCH) != 0) rect.lr_x--;
- OS.memmove(tile, rect, PhRect_t.sizeof);
- }
- }
- temp_widget = OS.PtWidgetBrotherInFront(temp_widget);
- }
- }
-
- /* Get the widget's rectangle */
- OS.PtWidgetCanvas(widget, widget_tile); // NOTE: widget_tile->rect
- OS.PhDeTranslateTiles(widget_tile, widget_tile); // NOTE: widget_tile->rect.ul
-
- /* Clip the widget's rectangle from the child/siblings rectangle's */
- if (child_tile != 0) {
- int clip_tile = OS.PhClipTilings(widget_tile, child_tile, null);
- OS.PhFreeTiles(child_tile);
- return clip_tile;
- }
- return widget_tile;
-}
-
-/**
- * Returns an array containing the receiver's children.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of children, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return an array of children
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control [] getChildren () {
- checkWidget();
- return _getChildren ();
-}
-
-int getChildrenCount () {
- int count = 0;
- int child = OS.PtWidgetChildFront (handle);
- while (child != 0) {
- child = OS.PtWidgetBrotherBehind (child);
- count++;
- }
- return count;
-}
-
-/**
- * Returns layout which is associated with the receiver, or
- * null if one has not been set.
- *
- * @return the receiver's layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Layout getLayout () {
- checkWidget();
- return layout;
-}
-
-boolean hasBorder () {
- return (style & SWT.BORDER) != 0;
-}
-
-boolean hasFocus () {
- return OS.PtIsFocused (handle) == 2;
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_RESIZE, windowProc, SWT.Resize);
-}
-
-/**
- * Gets the last specified tabbing order for the control.
- *
- * @return tabList the ordered list of controls representing the tab order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setTabList
- */
-public Control [] getTabList () {
- checkWidget ();
- Control [] tabList = _getTabList ();
-// if (tabList == null) {
-// int count = 0;
-// Control [] list =_getChildren ();
-// for (int i=0; i<list.length; i++) {
-// if (list [i].isTabGroup ()) count++;
-// }
-// tabList = new Control [count];
-// int index = 0;
-// for (int i=0; i<list.length; i++) {
-// if (list [i].isTabGroup ()) {
-// tabList [index++] = list [i];
-// }
-// }
-// }
- return tabList;
-}
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the receiver does not have a layout, do nothing.
- * <p>
- * This is equivalent to calling <code>layout(true)</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout () {
- checkWidget();
- layout (true);
-}
-
-Point minimumSize () {
- Control [] children = _getChildren ();
- int width = 0, height = 0;
- for (int i=0; i<children.length; i++) {
- Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
- }
- return new Point (width, height);
-}
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the the argument is <code>true</code> the layout must not rely
- * on any cached information it is keeping about the children. If it
- * is <code>false</code> the layout may (potentially) simplify the
- * work it is doing by assuming that the state of the none of the
- * receiver's children has changed since the last layout.
- * If the receiver does not have a layout, do nothing.
- *
- * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout (boolean changed) {
- checkWidget();
- if (layout == null) return;
- int count = getChildrenCount ();
- if (count == 0) return;
- layout.layout (this, changed);
-}
-
-int processMouse (int info) {
-
- /* Set focus for a canvas with no children */
- if (OS.PtWidgetChildFront (handle) == 0) {
- if ((state & CANVAS) != 0 && (style & SWT.NO_FOCUS) == 0) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- switch (ev.type) {
- case OS.Ph_EV_BUT_PRESS: {
- int data = OS.PhGetData (cbinfo.event);
- if (data == 0) return OS.Pt_END;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- if (pe.buttons == OS.Ph_BUTTON_SELECT) {
- setFocus ();
- }
- }
- }
- }
- }
- return super.processMouse (info);
-}
-
-int processPaint (int damage) {
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_BACKGROUND) == 0) {
-
- /* Get the clipping tiles for children and siblings */
- int clip_tile = getClipping (handle, topHandle (), true, true);
-
- /* Translate the clipping to the current GC coordinates */
- short [] abs_x = new short [1], abs_y = new short [1];
- OS.PtGetAbsPosition (handle, abs_x, abs_y);
- short [] dis_abs_x = new short [1], dis_abs_y = new short [1];
- OS.PtGetAbsPosition (OS.PtFindDisjoint (handle), dis_abs_x, dis_abs_y);
- PhPoint_t delta = new PhPoint_t ();
- delta.x = (short) (abs_x [0] - dis_abs_x [0]);
- delta.y = (short) (abs_y [0] - dis_abs_y [0]);
- OS.PhTranslateTiles(clip_tile, delta);
-
- /* Set the clipping */
- int[] clip_rects_count = new int [1];
- int clip_rects = OS.PhTilesToRects (clip_tile, clip_rects_count);
- OS.PhFreeTiles (clip_tile);
- if (clip_rects_count [0] == 0) {
- clip_rects_count [0] = 1;
- OS.free (clip_rects);
- clip_rects = OS.malloc (PhRect_t.sizeof);
- }
- OS.PgSetMultiClip (clip_rects_count[0], clip_rects);
- OS.free (clip_rects);
-
- /* Draw the widget */
- OS.PtSuperClassDraw (OS.PtContainer (), handle, damage);
-
- /* Reset the clipping */
- OS.PgSetMultiClip (0, 0);
- }
- }
- return super.processPaint (damage);
-}
-
-int processResize (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_CONTINUE;
- PtContainerCallback_t cbdata = new PtContainerCallback_t ();
- OS.memmove(cbdata, cbinfo.cbdata, PtContainerCallback_t.sizeof);
- if (cbdata.new_dim_w == cbdata.old_dim_w && cbdata.new_dim_h == cbdata.old_dim_h) {
- return OS.Pt_CONTINUE;
- }
- sendEvent (SWT.Resize);
- if (layout != null) layout (false);
- return OS.Pt_CONTINUE;
-}
-
-void releaseChildren () {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (!child.isDisposed ()) {
- child.releaseWidget ();
- child.releaseHandle ();
- }
- }
-}
-
-void releaseWidget () {
- releaseChildren ();
- super.releaseWidget ();
- layout = null;
- tabList = null;
-}
-
-void resizeClientArea () {
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (scrolledHandle, args.length / 3, args);
- resizeClientArea (args [1], args [4]);
-}
-
-boolean sendResize () {
- return false;
-}
-
-void resizeClientArea (int width, int height) {
- if (scrolledHandle == 0) return;
-
- /* Calculate the insets */
- int [] args = {
- OS.Pt_ARG_BASIC_FLAGS, 0, 0,
- OS.Pt_ARG_BEVEL_WIDTH, 0, 0,
- };
- OS.PtGetResources (scrolledHandle, args.length / 3, args);
- int flags = args [1];
- int bevel = args [4];
- int top = 0, left = 0, right = 0, bottom = 0;
- if ((flags & OS.Pt_TOP_ETCH) != 0) top++;
- if ((flags & OS.Pt_TOP_OUTLINE) != 0) top++;
- if ((flags & OS.Pt_TOP_INLINE) != 0) top++;
- if ((flags & OS.Pt_TOP_BEVEL) != 0) top += bevel;
- if ((flags & OS.Pt_BOTTOM_ETCH) != 0) bottom++;
- if ((flags & OS.Pt_BOTTOM_OUTLINE) != 0) bottom++;
- if ((flags & OS.Pt_BOTTOM_INLINE) != 0) bottom++;
- if ((flags & OS.Pt_BOTTOM_BEVEL) != 0) bottom += bevel;
- if ((flags & OS.Pt_RIGHT_ETCH) != 0) right++;
- if ((flags & OS.Pt_RIGHT_OUTLINE) != 0) right++;
- if ((flags & OS.Pt_RIGHT_INLINE) != 0) right++;
- if ((flags & OS.Pt_RIGHT_BEVEL) != 0) right += bevel;
- if ((flags & OS.Pt_LEFT_ETCH) != 0) left++;
- if ((flags & OS.Pt_LEFT_OUTLINE) != 0) left++;
- if ((flags & OS.Pt_LEFT_INLINE) != 0) left++;
- if ((flags & OS.Pt_LEFT_BEVEL) != 0) left += bevel;
-
- int clientWidth = width - (left + right);
- int clientHeight = height - (top + bottom);
-
- int vBarWidth = 0, hBarHeight = 0;
- boolean isVisibleHBar = horizontalBar != null && horizontalBar.getVisible ();
- boolean isVisibleVBar = verticalBar != null && verticalBar.getVisible ();
- if (isVisibleHBar) {
- args = new int [] {OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (horizontalBar.handle, args.length / 3, args);
- clientHeight -= (hBarHeight = args [1]);
- }
- if (isVisibleVBar) {
- args = new int [] {OS.Pt_ARG_WIDTH, 0, 0};
- OS.PtGetResources (verticalBar.handle, args.length / 3, args);
- clientWidth -= (vBarWidth = args [1]);
- }
- if (isVisibleHBar) {
- horizontalBar.setBounds (0, clientHeight, clientWidth, hBarHeight);
- }
- if (isVisibleVBar) {
- verticalBar.setBounds (clientWidth, 0, vBarWidth, clientHeight);
- }
- args = new int [] {
- OS.Pt_ARG_WIDTH, Math.max (clientWidth, 0), 0,
- OS.Pt_ARG_HEIGHT, Math.max (clientHeight, 0), 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- PhPoint_t pt = new PhPoint_t ();
- pt.x = (short) clientWidth;
- pt.y = (short) clientHeight;
- int ptr = OS.malloc (PhPoint_t.sizeof);
- OS.memmove (ptr, pt, PhPoint_t.sizeof);
- args = new int [] {OS.Pt_ARG_POS, ptr, 0};
- OS.PtSetResources (OS.PtWidgetChildBack (scrolledHandle), args.length / 3, args);
- OS.free (ptr);
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- super.setBounds (x, y, width, height, move, resize);
- if (resize) resizeClientArea (width, height);
-}
-
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget();
- this.layout = layout;
-}
-
-/**
- * Sets the tabbing order for the specified controls to
- * match the order that they occur in the argument list.
- *
- * @param tabList the ordered list of controls representing the tab order; must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTabList (Control [] tabList) {
- checkWidget ();
- if (tabList == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<tabList.length; i++) {
- Control control = tabList [i];
- if (control == null) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
-// Shell shell = control.getShell ();
-// while (control != shell && control != this) {
-// control = control.parent;
-// }
-// if (control != this) error (SWT.ERROR_INVALID_PARENT);
- if (control.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- /*
- * This code is intentionally commented. It is
- * not yet clear whether setting the tab list
- * should force the widget to be a tab group
- * instead of a tab item or non-traversable.
- */
-// Control [] children = _getChildren ();
-// for (int i=0; i<children.length; i++) {
-// Control control = children [i];
-// if (control != null) {
-// if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
-// int index = 0;
-// while (index < tabList.length) {
-// if (tabList [index] == control) break;
-// index++;
-// }
-// int hwnd = control.handle;
-// int bits = OS.GetWindowLong (hwnd, OS.GWL_STYLE);
-// if (index == tabList.length) {
-// bits &= ~OS.WS_TABSTOP;
-// } else {
-// bits |= OS.WS_TABSTOP;
-// }
-// OS.SetWindowLong (hwnd, OS.GWL_STYLE, bits);
-// }
-// }
- this.tabList = tabList;
-}
-
-int traversalCode (int key_sym, PhKeyEvent_t ke) {
- if ((state & CANVAS) != 0 && hooks (SWT.KeyDown)) return 0;
- return super.traversalCode (key_sym, ke);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
deleted file mode 100755
index 1d1ebf5f05..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ /dev/null
@@ -1,2329 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-
-/**
- * Control is the abstract superclass of all windowed user interface classes.
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b>
- * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
- * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Control extends Widget implements Drawable {
- Composite parent;
- Menu menu;
- Object layoutData;
- String toolTipText;
- int toolTipHandle;
-
-Control () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Control (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget (0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control gains or loses focus, by sending
- * it one of the messages defined in the <code>FocusListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #removeFocusListener
- */
-public void addFocusListener (FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.FocusIn,typedListener);
- addListener (SWT.FocusOut,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard, by sending
- * it one of the messages defined in the <code>KeyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #removeKeyListener
- */
-public void addKeyListener (KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.KeyUp,typedListener);
- addListener (SWT.KeyDown,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when mouse buttons are pressed and released, by sending
- * it one of the messages defined in the <code>MouseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #removeMouseListener
- */
-public void addMouseListener (MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseDown,typedListener);
- addListener (SWT.MouseUp,typedListener);
- addListener (SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse passes or hovers over controls, by sending
- * it one of the messages defined in the <code>MouseTrackListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #removeMouseTrackListener
- */
-public void addMouseTrackListener (MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseEnter,typedListener);
- addListener (SWT.MouseExit,typedListener);
- addListener (SWT.MouseHover,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse moves, by sending it one of the
- * messages defined in the <code>MouseMoveListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #removeMouseMoveListener
- */
-public void addMouseMoveListener (MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseMove,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver needs to be painted, by sending it
- * one of the messages defined in the <code>PaintListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #removePaintListener
- */
-public void addPaintListener (PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Paint,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when traversal events occur, by sending it
- * one of the messages defined in the <code>TraverseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #removeTraverseListener
- */
-public void addTraverseListener (TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Traverse,typedListener);
-}
-
-/**
- * Forces the receiver to have the <em>keyboard focus</em>, causing
- * all keyboard events to be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setFocus
- */
-public boolean forceFocus () {
- checkWidget();
- int shellHandle = OS.PtFindDisjoint (handle);
- OS.PtWindowToFront (shellHandle);
- OS.PtContainerGiveFocus (handle, null);
- return hasFocus ();
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size of the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- return computeSize (wHint, hHint, true);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p><p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
- * @return the preferred size of the control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = DEFAULT_WIDTH;
- int height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2;
- height += border * 2;
- return new Point (width, height);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- setZOrder ();
- realizeWidget ();
-}
-
-byte [] defaultFont () {
- Display display = getDisplay ();
- return display.TEXT_FONT;
-}
-
-/**
- * Returns the receiver's background color.
- *
- * @return the background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getBackground () {
- checkWidget();
- int [] args = {OS.Pt_ARG_FILL_COLOR, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return Color.photon_new (getDisplay (), args [1]);
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_TEXT_FONT, 0, 0,
- OS.Pt_ARG_LIST_FONT, 0, 0,
- OS.Pt_ARG_TITLE_FONT, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- byte [] font;
- int ptr = args [1];
- if (ptr == 0) ptr = args [4];
- if (ptr == 0) ptr = args [7];
- if (ptr == 0) {
- font = defaultFont ();
- } else {
- int length = OS.strlen (ptr);
- font = new byte [length + 1];
- OS.memmove (font, ptr, length);
- }
- return Font.photon_new (getDisplay (), font);
-}
-
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getForeground () {
- checkWidget();
- int [] args = {OS.Pt_ARG_COLOR, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return Color.photon_new (getDisplay (), args [1]);
-}
-
-/**
- * Returns the receiver's border width.
- *
- * @return the border width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getBorderWidth () {
- checkWidget();
- int topHandle = topHandle ();
- int [] args = {
- OS.Pt_ARG_BASIC_FLAGS, 0, 0,
- OS.Pt_ARG_FLAGS, 0, 0,
-// OS.Pt_ARG_BEVEL_WIDTH, 0, 0,
- };
- OS.PtGetResources (topHandle, args.length / 3, args);
- if ((args [4] & OS.Pt_HIGHLIGHTED) == 0) return 0;
- int border = 0;
- int flags = args [1];
- if ((flags & OS.Pt_ALL_ETCHES) != 0) border++;
- if ((flags & OS.Pt_ALL_OUTLINES) != 0) border++;
- if ((flags & OS.Pt_ALL_INLINES) != 0) border++;
-// if ((flags & OS.Pt_ALL_BEVELS) != 0) border += args [7];
- return border;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- int topHandle = topHandle ();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (topHandle, area);
- return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h);
-}
-
-/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_BLOCKED) == 0;
-}
-
-/**
- * Returns layout data which is associated with the receiver.
- *
- * @return the receiver's layout data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Object getLayoutData () {
- checkWidget();
- return layoutData;
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- int topHandle = topHandle ();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (topHandle, area);
- return new Point (area.pos_x, area.pos_y);
-}
-
-/**
- * Returns the receiver's pop up menu if it has one, or null
- * if it does not. All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget();
- return null;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Composite</code>
- * or null when the receiver is a shell that was created with null or
- * a display for a parent.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Composite getParent () {
- checkWidget();
- return parent;
-}
-
-Control [] getPath () {
- int count = 0;
- Shell shell = getShell ();
- Control control = this;
- while (control != shell) {
- count++;
- control = control.parent;
- }
- control = this;
- Control [] result = new Control [count];
- while (control != shell) {
- result [--count] = control;
- control = control.parent;
- }
- return result;
-}
-
-/**
- * Returns a point describing the receiver's size. The
- * x coordinate of the result is the width of the receiver.
- * The y coordinate of the result is the height of the
- * receiver.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- int topHandle = topHandle ();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (topHandle, area);
- return new Point (area.size_w, area.size_h);
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget();
- return parent.getShell ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- int topHandle = topHandle ();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (topHandle, args.length / 3, args);
- return (args [1] & OS.Pt_DELAY_REALIZE) == 0;
-}
-
-boolean hasFocus () {
- return OS.PtIsFocused (handle) != 0;
-}
-
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- int focusHandle = focusHandle ();
- OS.PtAddFilterCallback (handle, OS.Ph_EV_KEY, windowProc, SWT.KeyDown);
- OS.PtAddEventHandler (handle, OS.Ph_EV_BUT_PRESS, windowProc, SWT.MouseDown);
- OS.PtAddEventHandler (handle, OS.Ph_EV_BUT_RELEASE, windowProc, SWT.MouseUp);
- OS.PtAddEventHandler (handle, OS.Ph_EV_PTR_MOTION, windowProc, SWT.MouseMove);
- OS.PtAddEventHandler (handle, OS.Ph_EV_BOUNDARY, windowProc, SWT.MouseEnter);
- OS.PtAddCallback (focusHandle, OS.Pt_CB_GOT_FOCUS, windowProc, SWT.FocusIn);
- OS.PtAddCallback (focusHandle, OS.Pt_CB_LOST_FOCUS, windowProc, SWT.FocusOut);
- OS.PtAddCallback (handle, OS.Pt_CB_MENU, windowProc, SWT.Show);
-}
-
-int focusHandle () {
- return handle;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- checkWidget();
- int phGC = OS.PgCreateGC(0); // NOTE: PgCreateGC ignores the parameter
- if (phGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- int [] args = {OS.Pt_ARG_COLOR, 0, 0, OS.Pt_ARG_FILL_COLOR, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- data.device = getDisplay ();
- data.widget = handle;
- data.topWidget = topHandle ();
- data.foreground = args [1];
- data.background = args [4];
- data.font = getFont ().handle;
- return phGC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int phGC, GCData data) {
- checkWidget ();
- OS.PgDestroyGC(phGC);
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-
-public boolean isFocusAncestor () {
- Display display = getDisplay ();
- Control control = display.getFocusControl ();
- while (control != null && control != this) {
- control = control.parent;
- }
- return control == this;
-}
-
-/**
- * Returns <code>true</code> if the receiver has the user-interface
- * focus, and <code>false</code> otherwise.
- *
- * @return the receiver's focus state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isFocusControl () {
- checkWidget();
- return hasFocus ();
-}
-
-/**
- * Returns <code>true</code> if the underlying operating
- * system supports this reparenting, otherwise <code>false</code>
- *
- * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isReparentable () {
- checkWidget();
- return false;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return OS.PtWidgetIsRealized (handle);
-}
-
-Decorations menuShell () {
- return parent.menuShell ();
-}
-
-/**
- * Moves the receiver above the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the top of the drawing order. The control at
- * the top of the drawing order will not be covered by other
- * controls even if they occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveAbove (Control control) {
- checkWidget();
- int topHandle1 = topHandle ();
- if (control == null) {
- OS.PtWidgetToFront (topHandle1);
- OS.PtWindowToFront (topHandle1);
- return;
- }
- if (control.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- int topHandle2 = control.topHandle ();
- OS.PtWidgetInsert (topHandle1, topHandle2, 0);
-}
-
-/**
- * Moves the receiver below the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the bottom of the drawing order. The control at
- * the bottom of the drawing order will be covered by all other
- * controls which occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveBelow (Control control) {
- checkWidget();
- int topHandle1 = topHandle ();
- if (control == null) {
- OS.PtWidgetToBack (topHandle1);
- OS.PtWindowToBack (topHandle1);
- return;
- }
- if (control.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- int topHandle2 = control.topHandle ();
- OS.PtWidgetInsert (topHandle1, topHandle2, 1);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack () {
- checkWidget();
- pack (true);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- * <p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack (boolean changed) {
- checkWidget();
- setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
-}
-
-int processPaint (int damage) {
- sendPaintEvent (damage);
- return OS.Pt_CONTINUE;
-}
-
-int processFocusIn (int info) {
- sendEvent (SWT.FocusIn);
- if (isDisposed ()) return OS.Pt_CONTINUE;
-
- int index = 0;
- Shell shell = getShell ();
- Control [] focusIn = getPath ();
- Control lastFocus = shell.lastFocus;
- if (lastFocus != null) {
- if (!lastFocus.isDisposed ()) {
- Control [] focusOut = lastFocus.getPath ();
- int length = Math.min (focusIn.length, focusOut.length);
- while (index < length) {
- if (focusIn [index] != focusOut [index]) break;
- index++;
- }
- for (int i=focusOut.length-1; i>=index; --i) {
- focusOut [i].sendEvent (SWT.Deactivate);
- }
- }
- shell.lastFocus = null;
- }
- for (int i=focusIn.length-1; i>=index; --i) {
- focusIn [i].sendEvent (SWT.Activate);
- }
-
- /*
- * Feature in Photon. Cannot return Pt_END
- * or the text widget will not take focus.
- */
- return OS.Pt_CONTINUE;
-}
-
-int processFocusOut (int info) {
- sendEvent (SWT.FocusOut);
- if (isDisposed ()) return OS.Pt_CONTINUE;
-
- Shell shell = getShell ();
- shell.lastFocus = this;
- Display display = getDisplay ();
- Control focusControl = display.getFocusControl ();
- if (focusControl == null || shell != focusControl.getShell ()) {
- Control [] focusOut = getPath ();
- for (int i=focusOut.length-1; i>=0; --i) {
- focusOut [i].sendEvent (SWT.Deactivate);
- }
- shell.lastFocus = null;
- }
-
- /*
- * Feature in Photon. Cannot return Pt_END
- * or the text widget will not take focus.
- */
- return OS.Pt_CONTINUE;
-}
-
-int processKey (int info) {
- if (!hasFocus ()) return OS.Pt_PROCESS;
- if (info == 0) return OS.Pt_PROCESS;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_PROCESS;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) {
- return OS.Pt_PROCESS;
- }
- int data = OS.PhGetData (cbinfo.event);
- if (data == 0) return OS.Pt_PROCESS;
- PhKeyEvent_t ke = new PhKeyEvent_t ();
- OS.memmove (ke, data, PhKeyEvent_t.sizeof);
-
- /*
- * Feature in Photon. When the user presses certain keys
- * (such as the arrow keys), Photon sends 2 event for one
- * key press. The first event has only the scan code while
- * the second has the keysym and other information. This
- * also happens for key release. The fix is to ignore the
- * first event.
- */
- if (ke.key_flags == OS.Pk_KF_Scan_Valid) {
- return OS.Pt_PROCESS;
- }
- if ((ke.key_flags & OS.Pk_KF_Key_Repeat) != 0) {
- if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
- switch (ke.key_sym) {
- case OS.Pk_Alt_L:
- case OS.Pk_Alt_R:
- case OS.Pk_Control_L:
- case OS.Pk_Control_R:
- case OS.Pk_Shift_L:
- case OS.Pk_Shift_R:
- return OS.Pt_PROCESS;
- }
- }
- }
-
- /* Determine if this is a traverse event */
- if ((ke.key_flags & (OS.Pk_KF_Key_Down | OS.Pk_KF_Key_Repeat)) != 0) {
-
- /*
- * Fetuare in Photon. The key_sym value is not valid when Ctrl
- * or Alt is pressed. The fix is to detect this case and try to
- * use the key_cap value.
- */
- int key = ke.key_sym;
- if ((ke.key_flags & OS.Pk_KF_Sym_Valid) == 0) {
- key = 0;
- if ((ke.key_flags & OS.Pk_KF_Cap_Valid) != 0) {
- if (ke.key_cap == OS.Pk_Tab && (ke.key_mods & OS.Pk_KM_Ctrl) != 0) {
- key = OS.Pk_Tab;
- }
- }
- }
- switch (key) {
- case OS.Pk_Escape:
- case OS.Pk_Return:
- case OS.Pk_KP_Tab:
- case OS.Pk_Tab:
- case OS.Pk_Up:
- case OS.Pk_Down:
- case OS.Pk_Left:
- case OS.Pk_Right: {
- if (key != OS.Pk_Return) {
- ev.processing_flags |= OS.Ph_NOT_CUAKEY;
- OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof);
- }
- if (translateTraversal (key, ke)) {
- ev.processing_flags |= OS.Ph_CONSUMED;
- OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof);
- return OS.Pt_PROCESS;
- }
- }
- }
- }
- Display display = getDisplay ();
- Event event = new Event ();
- event.time = ev.timestamp;
- int type = SWT.KeyUp;
- if ((ke.key_flags & (OS.Pk_KF_Key_Down | OS.Pk_KF_Key_Repeat)) != 0) {
- type = SWT.KeyDown;
- }
- if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
- event.keyCode = Display.translateKey (ke.key_sym);
- if (event.keyCode == 0) {
- switch (ke.key_sym) {
- case OS.Pk_BackSpace: event.character = '\b'; break;
- case OS.Pk_Tab: event.character = '\t'; break;
- case OS.Pk_Linefeed: event.character = '\n'; break;
- case OS.Pk_Clear: event.character = 0xB; break;
- case OS.Pk_Return: event.character = '\r'; break;
- case OS.Pk_Pause: event.character = 0x13; break;
- case OS.Pk_Scroll_Lock: event.character = 0x14; break;
- case OS.Pk_Escape: event.character = 0x1B; break;
- case OS.Pk_Delete: event.character = 0x7F; break;
- default:
- event.character = (char) ke.key_sym;
- }
- }
- display.lastKey = event.keyCode;
- display.lastAscii = event.character;
- }
- setKeyState(event, ke);
- if (type == SWT.KeyUp) {
- if (event.keyCode == 0) event.keyCode = display.lastKey;
- if (event.character == 0) event.character = (char) display.lastAscii;
- }
- postEvent (type, event);
-
- return OS.Pt_PROCESS;
-}
-
-int processMouse (int info) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) {
- return OS.Pt_CONTINUE;
- }
- Event event = new Event ();
- switch (ev.type) {
- case OS.Ph_EV_BUT_PRESS:
- event.type = SWT.MouseDown;
- break;
- case OS.Ph_EV_BUT_RELEASE:
- if (ev.subtype != OS.Ph_EV_RELEASE_PHANTOM) {
- return OS.Pt_END;
- }
- event.type = SWT.MouseUp;
- break;
- case OS.Ph_EV_PTR_MOTION_BUTTON:
- case OS.Ph_EV_PTR_MOTION_NOBUTTON:
- event.type = SWT.MouseMove;
- break;
- case OS.Ph_EV_DRAG:
- if (ev.subtype != OS.Ph_EV_DRAG_MOTION_EVENT) {
- return OS.Pt_END;
- }
- event.type = SWT.MouseMove;
- break;
- }
- event.time = ev.timestamp;
- int data = OS.PhGetData (cbinfo.event);
- if (data == 0) return OS.Pt_END;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- event.x = pe.pos_x + ev.translation_x;
- event.y = pe.pos_y + ev.translation_y;
- if (ev.type == OS.Ph_EV_BUT_PRESS || ev.type == OS.Ph_EV_BUT_RELEASE) {
- switch (pe.buttons) {
- case OS.Ph_BUTTON_SELECT: event.button = 1; break;
- case OS.Ph_BUTTON_ADJUST: event.button = 2; break;
- case OS.Ph_BUTTON_MENU: event.button = 3; break;
- }
- }
- setMouseState (ev.type, event, pe);
- postEvent (event.type, event);
- if (ev.type == OS.Ph_EV_BUT_PRESS && pe.click_count == 2) {
- Event clickEvent = new Event ();
- clickEvent.time = event.time;
- clickEvent.x = event.x;
- clickEvent.y = event.y;
- clickEvent.button = event.button;
- clickEvent.stateMask = event.stateMask;
- postEvent (SWT.MouseDoubleClick, clickEvent);
- }
- ev.processing_flags |= OS.Ph_CONSUMED;
- OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof);
- return OS.Pt_CONTINUE;
-}
-
-int processMouseEnter (int info) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- int rects = OS.PhGetRects (cbinfo.event);
- PhRect_t rect = new PhRect_t ();
- OS.memmove (rect, rects, PhRect_t.sizeof);
- Event event = new Event ();
- event.time = ev.timestamp;
- event.x = rect.ul_x;
- event.y = rect.ul_y;
- switch (ev.subtype) {
- case OS.Ph_EV_PTR_ENTER:
- case OS.Ph_EV_PTR_ENTER_FROM_CHILD:
- sendEvent (SWT.MouseEnter, event);
- break;
- case OS.Ph_EV_PTR_LEAVE:
- case OS.Ph_EV_PTR_LEAVE_TO_CHILD:
- sendEvent (SWT.MouseExit, event);
- break;
- case OS.Ph_EV_PTR_STEADY:
- postEvent (SWT.MouseHover, event);
- destroyToolTip (toolTipHandle);
- toolTipHandle = createToolTip (toolTipText, handle, getFont ().handle);
- break;
- case OS.Ph_EV_PTR_UNSTEADY:
- destroyToolTip (toolTipHandle);
- toolTipHandle = 0;
- break;
- }
- return OS.Pt_END;
-}
-
-int processShow (int info) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.reason == OS.Pt_CB_MENU) {
- if (menu != null && !menu.isDisposed ()) {
- menu.setVisible (true);
- }
- }
- return OS.Pt_CONTINUE;
-}
-
-void realizeWidget() {
- int parentHandle = parent.handle;
- if (OS.PtWidgetIsRealized (parentHandle)) {
- OS.PtRealizeWidget (topHandle ());
- }
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- if (toolTipHandle != 0) destroyToolTip (toolTipHandle);
- toolTipHandle = 0;
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- menu = null;
- parent = null;
- layoutData = null;
-}
-
-/**
- * Causes the entire bounds of the receiver to be marked
- * as needing to be redrawn. The next time a paint request
- * is processed, the control will be completely painted.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw () {
- checkWidget();
- OS.PtDamageWidget (handle);
-}
-
-/**
- * Causes the rectangular area of the receiver specified by
- * the arguments to be marked as needing to be redrawn.
- * The next time a paint request is processed, that area of
- * the receiver will be painted. If the <code>all</code> flag
- * is <code>true</code>, any children of the receiver which
- * intersect with the specified area will also paint their
- * intersecting areas. If the <code>all</code> flag is
- * <code>false</code>, the children will not be painted.
- *
- * @param x the x coordinate of the area to draw
- * @param y the y coordinate of the area to draw
- * @param width the width of the area to draw
- * @param height the height of the area to draw
- * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw (int x, int y, int width, int height, boolean allChildren) {
- checkWidget ();
- if (width <= 0 || height <= 0) return;
- PhRect_t rect = new PhRect_t ();
- rect.ul_x = (short) x;
- rect.ul_y = (short) y;
- rect.lr_x = (short) (x + width - 1);
- rect.lr_y = (short) (y + height - 1);
- OS.PtDamageExtent (handle, rect);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control gains or loses focus.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #addFocusListener
- */
-public void removeFocusListener(FocusListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.FocusIn, listener);
- eventTable.unhook (SWT.FocusOut, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #addKeyListener
- */
-public void removeKeyListener(KeyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.KeyUp, listener);
- eventTable.unhook (SWT.KeyDown, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse passes or hovers over controls.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #addMouseTrackListener
- */
-public void removeMouseTrackListener(MouseTrackListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseEnter, listener);
- eventTable.unhook (SWT.MouseExit, listener);
- eventTable.unhook (SWT.MouseHover, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when mouse buttons are pressed and released.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #addMouseListener
- */
-public void removeMouseListener (MouseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseDown, listener);
- eventTable.unhook (SWT.MouseUp, listener);
- eventTable.unhook (SWT.MouseDoubleClick, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse moves.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #addMouseMoveListener
- */
-public void removeMouseMoveListener(MouseMoveListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseMove, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver needs to be painted.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #addPaintListener
- */
-public void removePaintListener(PaintListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Paint, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when traversal events occur.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #addTraverseListener
- */
-public void removeTraverseListener(TraverseListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Traverse, listener);
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int topHandle = topHandle ();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (topHandle, area);
- boolean sameOrigin = x == area.pos_x && y == area.pos_y;
- boolean sameExtent = width == area.size_w && height == area.size_h;
- if (move && resize) {
- area.pos_x = (short) x;
- area.pos_y = (short) y;
- area.size_w = (short) (Math.max (width, 0));
- area.size_h = (short) (Math.max (height, 0));
- int ptr = OS.malloc (PhArea_t.sizeof);
- OS.memmove (ptr, area, PhArea_t.sizeof);
- int [] args = {OS.Pt_ARG_AREA, ptr, 0};
- OS.PtSetResources (topHandle, args.length / 3, args);
- OS.free (ptr);
- } else {
- if (move) {
- PhPoint_t pt = new PhPoint_t ();
- pt.x = (short) x;
- pt.y = (short) y;
- int ptr = OS.malloc (PhPoint_t.sizeof);
- OS.memmove (ptr, pt, PhPoint_t.sizeof);
- int [] args = {OS.Pt_ARG_POS, ptr, 0};
- OS.PtSetResources (topHandle, args.length / 3, args);
- OS.free (ptr);
- }
- if (resize) {
- int [] args = {
- OS.Pt_ARG_WIDTH, Math.max (width, 0), 0,
- OS.Pt_ARG_HEIGHT, Math.max (height, 0), 0,
- };
- OS.PtSetResources (topHandle, args.length / 3, args);
- }
- }
- if (!OS.PtWidgetIsRealized (topHandle)) {
- OS.PtExtentWidgetFamily (topHandle);
- }
- if (!sameOrigin & move) sendEvent (SWT.Move);
- if (!sameExtent & resize & sendResize()) sendEvent (SWT.Resize);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- setBounds (x, y, width, height, true, true);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * If the argument is <code>true</code>, causes the receiver to have
- * all mouse events delivered to it until the method is called with
- * <code>false</code> as the argument.
- *
- * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCapture (boolean capture) {
- checkWidget();
-}
-
-/**
- * Sets the receiver's cursor to the cursor specified by the
- * argument, or to the default cursor for that kind of control
- * if the argument is null.
- * <p>
- * When the mouse pointer passes over a control its appearance
- * is changed to match the control's cursor.
- * </p>
- *
- * @param cursor the new cursor (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCursor (Cursor cursor) {
- checkWidget();
- int type = OS.Ph_CURSOR_INHERIT;
- int bitmap = 0;
- if (cursor != null) {
- if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- type = cursor.type;
- bitmap = cursor.bitmap;
- }
- int [] args = new int []{
- OS.Pt_ARG_CURSOR_TYPE, type, 0,
- OS.Pt_ARG_BITMAP_CURSOR, bitmap, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-
- /*
- * Bug in Photon. For some reason, the widget cursor will
- * not change, when the new cursor is a bitmap cursor, if
- * the flag Ph_CURSOR_NO_INHERIT is reset. The fix is to reset
- * this flag after changing the cursor type to Ph_CURSOR_BITMAP.
- */
- if (type == OS.Ph_CURSOR_BITMAP) {
- type &= ~OS.Ph_CURSOR_NO_INHERIT;
- args = new int []{OS.Pt_ARG_CURSOR_TYPE, type, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Causes the receiver to have the <em>keyboard focus</em>,
- * such that all keyboard events will be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #forceFocus
- */
-public boolean setFocus () {
- checkWidget();
- return forceFocus ();
-}
-
-void sendPaintEvent (int damage) {
- if (!hooks(SWT.Paint)) return;
-
- /* Translate the damage to widget coordinates */
- short [] widgetX = new short [1];
- short [] widgetY = new short [1];
- OS.PtGetAbsPosition (handle, widgetX, widgetY);
- short [] shellX = new short [1];
- short [] shellY = new short [1];
- int shellHandle = OS.PtFindDisjoint (handle);
- OS.PtGetAbsPosition (shellHandle, shellX, shellY);
- PhPoint_t pt = new PhPoint_t ();
- pt.x = (short) (shellX [0] - widgetX [0]);
- pt.y = (short) (shellY [0] - widgetY [0]);
- damage = OS.PhCopyTiles (damage);
- damage = OS.PhTranslateTiles (damage, pt);
-
- /* Send the paint event */
- PhTile_t tile = new PhTile_t ();
- OS.memmove (tile, damage, PhTile_t.sizeof);
- if (tile.rect_ul_x != tile.rect_lr_x || tile.rect_ul_y != tile.rect_lr_y) {
- Event event = new Event ();
- event.x = tile.rect_ul_x;
- event.y = tile.rect_ul_y;
- event.width = tile.rect_lr_x - tile.rect_ul_x + 1;
- event.height = tile.rect_lr_y - tile.rect_ul_y + 1;
- Region region = Region.photon_new (tile.next);
- GC gc = event.gc = new GC (this);
- gc.setClipping (region);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- }
- OS.PhFreeTiles (damage);
-}
-
-boolean sendResize () {
- return true;
-}
-
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- checkWidget();
- int pixel = OS.Pt_DEFAULT_COLOR;
- if (color != null) {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- pixel = color.handle;
- }
- int [] args = {OS.Pt_ARG_FILL_COLOR, pixel, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
- byte[] buffer;
- if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- buffer = font.handle;
- } else {
- buffer = defaultFont();
- }
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {
- OS.Pt_ARG_TEXT_FONT, ptr, 0,
- OS.Pt_ARG_LIST_FONT, ptr, 0,
- OS.Pt_ARG_TITLE_FONT, ptr, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- checkWidget();
- int pixel = OS.Pt_DEFAULT_COLOR;
- if (color != null) {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- pixel = color.handle;
- }
- int [] args = {OS.Pt_ARG_COLOR, pixel, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the layout data associated with the receiver to the argument.
- *
- * @param layoutData the new layout data for the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayoutData (Object layoutData) {
- checkWidget();
- this.layoutData = layoutData;
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- setBounds (x, y, 0, 0, true, false);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- checkWidget();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's pop up menu to the argument.
- * All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget();
- int flags = 0;
- if (menu != null) {
- if (menu.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- flags = OS.Pt_MENUABLE;
- }
- int [] args = {
- OS.Pt_ARG_FLAGS, flags, OS.Pt_ALL_BUTTONS | OS.Pt_MENUABLE,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- this.menu = menu;
-}
-
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers <code>true</code> if the parent is successfully changed.
- *
- * @param parent the new parent for the control.
- * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean setParent (Composite parent) {
- checkWidget();
- if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return false;
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause them to be
- * set to zero instead.
- * </p>
- *
- * @param size the new size for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- checkWidget();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-/**
- * If the argument is <code>false</code>, causes subsequent drawing
- * operations in the receiver to be ignored. No drawing of any kind
- * can occur in the receiver until the flag is set to true.
- * Graphics operations that occurred while the flag was
- * <code>false</code> are lost. When the flag is set to <code>true</code>,
- * the entire widget is marked as needing to be redrawn.
- * <p>
- * Note: This operation is a hint and may not be supported on some
- * platforms or for some widgets.
- * </p>
- *
- * @param redraw the new redraw state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- * @see #update
- */
-public void setRedraw (boolean redraw) {
- checkWidget();
- if (redraw) {
- OS.PtContainerRelease (handle);
- } else {
- OS.PtContainerHold (handle);
- }
-}
-/**
- * Sets the receiver's size to the point specified by the arguments.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- setBounds (0, 0, width, height, false, true);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- int topHandle = topHandle ();
- int [] args = {
- OS.Pt_ARG_FLAGS, visible ? 0 : OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
- };
- OS.PtSetResources (topHandle, args.length / 3, args);
- if (visible) {
- sendEvent (SWT.Show);
- OS.PtRealizeWidget (topHandle);
- } else {
- OS.PtUnrealizeWidget (topHandle);
- sendEvent(SWT.Hide);
- }
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-
-void setZOrder() {
- OS.PtWidgetToBack (topHandle ());
-}
-
-void sort (int [] items) {
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap=length/2; gap>0; gap/=2) {
- for (int i=gap; i<length; i++) {
- for (int j=i-gap; j>=0; j-=gap) {
- if (items [j] <= items [j + gap]) {
- int swap = items [j];
- items [j] = items [j + gap];
- items [j + gap] = swap;
- }
- }
- }
- }
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in display relative coordinates,
- * to coordinates relative to the receiver.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toControl (Point point) {
- checkWidget();
- short [] x = new short [1], y = new short [1];
- OS.PtGetAbsPosition (handle, x, y);
- return new Point (point.x - x [0], point.y - y [0]);
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in coordinates relative to
- * the receiver, to display relative coordinates.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toDisplay (Point point) {
- checkWidget();
- short [] x = new short [1], y = new short [1];
- OS.PtGetAbsPosition (handle, x, y);
- return new Point (point.x + x [0], point.y + y [0]);
-}
-
-boolean translateTraversal (int key_sym, PhKeyEvent_t phEvent) {
- int detail = 0;
- boolean shift = (phEvent.key_mods & OS.Pk_KM_Shift) != 0;
- boolean control = (phEvent.key_mods & OS.Pk_KM_Ctrl) != 0;
- switch (key_sym) {
- case OS.Pk_Escape:
- Shell shell = getShell ();
- if (shell.parent == null) return false;
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- detail = SWT.TRAVERSE_ESCAPE;
- break;
- case OS.Pk_Return:
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- detail = SWT.TRAVERSE_RETURN;
- break;
- case OS.Pk_Tab:
- case OS.Pk_KP_Tab:
- detail = SWT.TRAVERSE_TAB_NEXT;
- if (shift) detail = SWT.TRAVERSE_TAB_PREVIOUS;
- break;
- case OS.Pk_Up:
- case OS.Pk_Left:
- detail = SWT.TRAVERSE_ARROW_PREVIOUS;
- break;
- case OS.Pk_Down:
- case OS.Pk_Right:
- detail = SWT.TRAVERSE_ARROW_NEXT;
- break;
- default:
- return false;
- }
- boolean doit = (detail & traversalCode (key_sym, phEvent)) != 0;
- if (!doit && control && (key_sym == OS.Pk_Tab || key_sym == OS.Pk_Tab)) {
- doit = true;
- control = false;
- }
- if (hooks (SWT.Traverse)) {
- Event event = new Event();
- event.doit = doit;
- event.detail = detail;
- setKeyState (event, phEvent);
- sendEvent (SWT.Traverse, event);
- if (isDisposed ()) return true;
- doit = event.doit;
- detail = event.detail;
- }
- if (doit) {
- switch (detail) {
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true, control);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false, control);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- }
- }
- return false;
-}
-
-int traversalCode (int key_sym, PhKeyEvent_t ke) {
- return
- SWT.TRAVERSE_ESCAPE | SWT.TRAVERSE_RETURN |
- SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS |
- SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS;
-}
-
-/**
- * Based on the argument, perform one of the expected platform
- * traversal action. The argument should be one of the constants:
- * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
- * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
- * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
- *
- * @param traversal the type of traversal
- * @return true if the traversal succeeded
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean traverse (int traversal) {
- checkWidget();
- if (!isFocusControl () && !setFocus ()) return false;
- switch (traversal) {
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true, false);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false, false);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- }
- return false;
-}
-
-boolean traverseEscape () {
- Shell shell = getShell ();
- if (shell.parent == null) return false;
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- shell.close ();
- return true;
-}
-
-boolean traverseGroup (boolean next, boolean control) {
- if (control) {
- if (next) return OS.PtGlobalFocusPrevContainer (handle, null) != 0;
- return OS.PtGlobalFocusNextContainer (handle, null) != 0;
- }
- if (next) return OS.PtGlobalFocusPrev (handle, null) != 0;
- return OS.PtGlobalFocusNext (handle, null) != 0;
-}
-
-boolean traverseItem (boolean next) {
- if (next) return OS.PtContainerFocusPrev (handle, null) != 0;
- return OS.PtContainerFocusNext (handle, null) != 0;
-}
-
-boolean traverseReturn () {
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- button.click ();
- return true;
-}
-
-/**
- * Forces all outstanding paint requests for the widget tree
- * to be processed before this method returns.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- */
-public void update () {
- checkWidget();
- OS.PtFlush ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Decorations.java
deleted file mode 100755
index d422d45615..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Decorations.java
+++ /dev/null
@@ -1,499 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide the appearance and
- * behavior of <code>Shells</code>, but are not top
- * level shells or dialogs. Class <code>Shell</code>
- * shares a significant amount of code with this class,
- * and is a subclass.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations.
- * For example, some window managers only support resizable
- * windows and will always assume the RESIZE style, even if
- * it is not set.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- *
- * @see #getMinimized
- * @see #getMaximized
- * @see Shell
- * @see SWT
- */
-public class Decorations extends Canvas {
- Menu menuBar;
- Menu [] menus;
- String text = "";
- Image image;
- Button defaultButton, saveDefault;
-
-Decorations () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Decorations (Composite parent, int style) {
- super (parent, style);
-}
-
-static int checkStyle (int style) {
- if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
- style |= SWT.TITLE;
- }
- return style;
-}
-
-void add (Menu menu) {
- if (menus == null) menus = new Menu [4];
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == null) {
- menus [i] = menu;
- return;
- }
- }
- Menu [] newMenus = new Menu [menus.length + 4];
- newMenus [menus.length] = menu;
- System.arraycopy (menus, 0, newMenus, 0, menus.length);
- menus = newMenus;
-}
-
-void bringToTop () {
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns the receiver's default button if one had
- * previously been set, otherwise returns null.
- *
- * @return the default button or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setDefaultButton
- */
-public Button getDefaultButton () {
- checkWidget();
- return defaultButton;
-}
-
-/**
- * Returns the receiver's image if it had previously been
- * set using <code>setImage()</code>. The image is typically
- * displayed by the window manager when the instance is
- * marked as iconified, and may also be displayed somewhere
- * in the trim when the instance is in normal or maximized
- * states.
- * <p>
- * Note: This method will return null if called before
- * <code>setImage()</code> is called. It does not provide
- * access to a window manager provided, "default" image
- * even if one exists.
- * </p>
- *
- * @return the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-
-/**
- * Returns <code>true</code> if the receiver is currently
- * maximized, and false otherwise.
- * <p>
- *
- * @return the maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public boolean getMaximized () {
- checkWidget();
- return false;
-}
-
-/**
- * Returns <code>true</code> if the receiver is currently
- * minimized, and false otherwise.
- * <p>
- *
- * @return the minimized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public boolean getMinimized () {
- checkWidget();
- return false;
-}
-
-/**
- * Returns the receiver's menu bar if one had previously
- * been set, otherwise returns null.
- *
- * @return the menu bar or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenuBar () {
- checkWidget();
- return menuBar;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- return text;
-}
-
-boolean hasBorder () {
- return false;
-}
-
-Decorations menuShell () {
- return this;
-}
-
-void releaseWidget () {
- if (menus != null) {
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if (menu != null && !menu.isDisposed ()) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- }
- }
- menuBar = null;
- menus = null;
- image = null;
- super.releaseWidget ();
- defaultButton = saveDefault = null;
- text = null;
-}
-
-void remove (Menu menu) {
- if (menus == null) return;
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == menu) {
- menus [i] = null;
- return;
- }
- }
-}
-
-void resizeBounds (int width, int height) {
- int menuHeight = 0;
- if (menuBar != null) {
- PhDim_t dim = new PhDim_t ();
- int menuHandle = menuBar.handle;
- if (!OS.PtWidgetIsRealized (menuHandle)) {
- OS.PtExtentWidgetFamily (menuHandle);
- }
- OS.PtWidgetPreferredSize (menuHandle, dim);
- menuHeight = dim.h;
- int [] args = {OS.Pt_ARG_HEIGHT, menuHeight, 0};
- OS.PtSetResources (menuHandle, args.length / 3, args);
- height = height - menuHeight;
- }
- PhArea_t area = new PhArea_t ();
- area.pos_y = (short) menuHeight;
- area.size_w = (short) Math.max (width, 0);
- area.size_h = (short) Math.max (height ,0);
- int ptr = OS.malloc (PhArea_t.sizeof);
- OS.memmove (ptr, area, PhArea_t.sizeof);
- int [] args = new int [] {OS.Pt_ARG_AREA, ptr, 0};
- OS.PtSetResources (scrolledHandle, args.length / 3, args);
- OS.free (ptr);
- resizeClientArea (width, height);
-}
-
-/**
- * If the argument is not null, sets the receiver's default
- * button to the argument, and if the argument is null, sets
- * the receiver's default button to the first button which
- * was set as the receiver's default button (called the
- * <em>saved default button</em>). If no default button had
- * previously been set, or the saved default button was
- * disposed, the receiver's default button will be set to
- * null.
- *
- * @param the new default button
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultButton (Button button) {
- checkWidget();
- setDefaultButton (button, true);
-}
-void setDefaultButton (Button button, boolean save) {
- if (button == null) {
- if (defaultButton == saveDefault) return;
- } else {
- if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((button.style & SWT.PUSH) == 0) return;
- if (button == defaultButton) return;
- }
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (false);
- }
- if ((defaultButton = button) == null) defaultButton = saveDefault;
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (true);
- }
- if (save || saveDefault == null) saveDefault = defaultButton;
- if (saveDefault != null && saveDefault.isDisposed ()) saveDefault = null;
-}
-
-/**
- * Sets the receiver's image to the argument, which may
- * be null. The image is typically displayed by the window
- * manager when the instance is marked as iconified, and
- * may also be displayed somewhere in the trim when the
- * instance is in normal or maximized states.
- *
- * @param image the new image (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- this.image = image;
-}
-
-/**
- * Sets the maximized state of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the maximized state, and if the argument is
- * <code>false</code> and the receiver was previously maximized,
- * causes the receiver to switch back to either the minimized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public void setMaximized (boolean maximized) {
- checkWidget();
-}
-
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenuBar (Menu menu) {
- checkWidget();
- if (menu != null && menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- //NOT DONE
-}
-
-/**
- * Sets the minimized stated of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the minimized state, and if the argument is
- * <code>false</code> and the receiver was previously minimized,
- * causes the receiver to switch back to either the maximized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public void setMinimized (boolean minimized) {
- checkWidget();
-}
-
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/DirectoryDialog.java
deleted file mode 100755
index b4858d9107..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/DirectoryDialog.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select a directory.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class DirectoryDialog extends Dialog {
- String message = "", filterPath = "";
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the path which the dialog will use to filter
- * the directories it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the selected directory,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.shellHandle;
- byte [] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
- byte [] root_dir = null;
- if (filterPath != null) {
- root_dir = Converter.wcsToMbcs (null, filterPath, true);
- }
- byte [] file_spec = null;
- int flags = OS.Pt_FSR_NO_FCHECK | OS.Pt_FSR_NO_SELECT_FILES | OS.Pt_FSR_SELECT_DIRS;
- PtFileSelectionInfo_t info = new PtFileSelectionInfo_t ();
- OS.PtFileSelection (parentHandle, null, title, root_dir, file_spec, null, null, null, info, flags);
- if (info.ret == OS.Pt_FSDIALOG_BTN2) return null;
- int length = 0;
- while (length < info.path.length && info.path [length] != 0) length++;
- byte [] path = new byte [length];
- System.arraycopy (info.path, 0, path, 0, length);
- return new String (Converter.mbcsToWcs (null, path));
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the directories it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
deleted file mode 100755
index af5b6e446b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
+++ /dev/null
@@ -1,1608 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are responsible for managing the
- * connection between SWT and the underlying operating
- * system. Their most important function is to implement
- * the SWT event loop in terms of the platform event model.
- * They also provide various methods for accessing information
- * about the operating system, and have overall control over
- * the operating system resources which SWT allocates.
- * <p>
- * Applications which are built with SWT will <em>almost always</em>
- * require only a single display. In particular, some platforms
- * which SWT supports will not allow more than one <em>active</em>
- * display. In other words, some platforms do not support
- * creating a new display if one already exists that has not been
- * sent the <code>dispose()</code> message.
- * <p>
- * In SWT, the thread which creates a <code>Display</code>
- * instance is distinguished as the <em>user-interface thread</em>
- * for that display.
- * </p>
- * The user-interface thread for a particular display has the
- * following special attributes:
- * <ul>
- * <li>
- * The event loop for that display must be run from the thread.
- * </li>
- * <li>
- * Some SWT API methods (notably, most of the public methods in
- * <code>Widget</code> and its subclasses), may only be called
- * from the thread. (To support multi-threaded user-interface
- * applications, class <code>Display</code> provides inter-thread
- * communication methods which allow threads other than the
- * user-interface thread to request that it perform operations
- * on their behalf.)
- * </li>
- * <li>
- * The thread is not allowed to construct other
- * <code>Display</code>s until that display has been disposed.
- * (Note that, this is in addition to the restriction mentioned
- * above concerning platform support for multiple displays. Thus,
- * the only way to have multiple simultaneously active displays,
- * even on platforms which support it, is to have multiple threads.)
- * </li>
- * </ul>
- * Enforcing these attributes allows SWT to be implemented directly
- * on the underlying operating system's event model. This has
- * numerous benefits including smaller footprint, better use of
- * resources, safer memory management, clearer program logic,
- * better performance, and fewer overall operating system threads
- * required. The down side however, is that care must be taken
- * (only) when constructing multi-threaded applications to use the
- * inter-thread communication mechanisms which this class provides
- * when required.
- * </p><p>
- * All SWT API methods which may only be called from the user-interface
- * thread are distinguished in their documentation by indicating that
- * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
- * SWT exception.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see #syncExec
- * @see #asyncExec
- * @see #wake
- * @see #readAndDispatch
- * @see #sleep
- * @see #dispose
- */
-public class Display extends Device {
-
- /**** TEMPORARY CODE FOR EMULATED TABLE ***/
- static int textHighlightThickness = 0;
-
- /* TEMPORARY HACK FOR PHOTON */
- public boolean embedded;
-
- /* Photon Only Public Fields */
- public int app_context;
-// public int phEventSize = PhEvent_t.sizeof + 1024;
-// public int phEvent = OS.malloc (phEventSize);
-
- /* Deferred Events */
- Event [] eventQueue;
-
- /* Events Dispatching and Callback */
- Callback windowCallback, drawCallback, workCallback, inputCallback, hotkeyCallback;
- int windowProc, drawProc, workProc, inputProc, hotkeyProc, input, pulse;
- boolean idle;
-
- /* Sync/Async Widget Communication */
- Synchronizer synchronizer = new Synchronizer (this);
- Thread thread = Thread.currentThread ();
-
- /* Display Shutdown */
- Runnable [] disposeList;
-
- /* Timers */
- int [] timers;
- Runnable [] timerList;
- Callback timerCallback;
- int timerProc, timerHandle;
-
- /* Keyboard */
- int lastKey, lastAscii;
-
- /* Key Mappings. */
- private static final int [] [] KeyTable = {
-
- /* Keyboard and Mouse Masks */
- {OS.Pk_Alt_L, SWT.ALT},
- {OS.Pk_Alt_R, SWT.ALT},
- {OS.Pk_Shift_L, SWT.SHIFT},
- {OS.Pk_Shift_R, SWT.SHIFT},
- {OS.Pk_Control_L, SWT.CONTROL},
- {OS.Pk_Control_R, SWT.CONTROL},
-
-// {OS.VK_LBUTTON, SWT.BUTTON1},
-// {OS.VK_MBUTTON, SWT.BUTTON3},
-// {OS.VK_RBUTTON, SWT.BUTTON2},
-
- /* Non-Numeric Keypad Constants */
- {OS.Pk_Up, SWT.ARROW_UP},
- {OS.Pk_Down, SWT.ARROW_DOWN},
- {OS.Pk_Left, SWT.ARROW_LEFT},
- {OS.Pk_Right, SWT.ARROW_RIGHT},
- {OS.Pk_Prior, SWT.PAGE_UP},
- {OS.Pk_Next, SWT.PAGE_DOWN},
- {OS.Pk_Home, SWT.HOME},
- {OS.Pk_End, SWT.END},
- {OS.Pk_Insert, SWT.INSERT},
-// {OS.Pk_Delete, SWT.DELETE},
-// {OS.Pk_Escape, 0x001B},
-
- /* Functions Keys */
- {OS.Pk_F1, SWT.F1},
- {OS.Pk_F2, SWT.F2},
- {OS.Pk_F3, SWT.F3},
- {OS.Pk_F4, SWT.F4},
- {OS.Pk_F5, SWT.F5},
- {OS.Pk_F6, SWT.F6},
- {OS.Pk_F7, SWT.F7},
- {OS.Pk_F8, SWT.F8},
- {OS.Pk_F9, SWT.F9},
- {OS.Pk_F10, SWT.F10},
- {OS.Pk_F11, SWT.F11},
- {OS.Pk_F12, SWT.F12},
-
-
- /* Numeric Keypad Constants */
- /*
- {OS.XK_KP_Add, SWT.KP_PLUS},
- {OS.XK_KP_Subtract, SWT.KP_MINUS},
- {OS.XK_KP_Multiply, SWT.KP_TIMES},
- {OS.XK_KP_Divide, SWT.KP_DIVIDE},
- {OS.XK_KP_Decimal, SWT.KP_PERIOD},
- {OS.XK_KP_Enter, SWT.KP_ENTER},
- {OS.XK_KP_0, SWT.KP_0},
- {OS.XK_KP_1, SWT.KP_1},
- {OS.XK_KP_2, SWT.KP_2},
- {OS.XK_KP_3, SWT.KP_3},
- {OS.XK_KP_4, SWT.KP_4},
- {OS.XK_KP_5, SWT.KP_5},
- {OS.XK_KP_6, SWT.KP_6},
- {OS.XK_KP_7, SWT.KP_7},
- {OS.XK_KP_8, SWT.KP_8},
- {OS.XK_KP_9, SWT.KP_9},
- */
- };
-
- /* Multiple Displays. */
- static Display Default;
- static Display [] Displays = new Display [4];
-
- /* Window Classes */
- static int ClassesPtr;
- static int PtButton;
- static int PtList;
- static int PtLabel;
- static int PtWindow;
- static int PtToggleButton;
- static int PtComboBox;
- static int PtText;
- static int PtMultiText;
- static int PtScrollbar;
- static int PtScrollContainer;
- static int PtScrollArea;
- static int PtContainer;
- static int PtProgress;
- static int PtPanelGroup;
- static int PtPane;
- static int PtTree;
- static int PtSlider;
- static int PtSeparator;
-
- /* Colors */
- int WIDGET_DARK_SHADOW, WIDGET_NORMAL_SHADOW, WIDGET_LIGHT_SHADOW;
- int WIDGET_HIGHLIGHT_SHADOW, WIDGET_BACKGROUND, WIDGET_FOREGROUND, WIDGET_BORDER;
- int LIST_FOREGROUND, LIST_BACKGROUND, LIST_SELECTION, LIST_SELECTION_TEXT;
- int INFO_FOREGROUND, INFO_BACKGROUND;
-
- /* Fonts */
- byte [] TEXT_FONT, LIST_FONT;
-
- /* ScrollBars */
- int SCROLLBAR_WIDTH;
- int SCROLLBAR_HEIGHT;
- int SCROLLBAR_VERTICAL_BASIC_FLAGS;
- int SCROLLBAR_HORIZONTAL_BASIC_FLAGS;
-
- /* Package name */
- static final String PACKAGE_NAME;
- static {
- String name = Display.class.getName ();
- int index = name.lastIndexOf ('.');
- PACKAGE_NAME = name.substring (0, index + 1);
- }
-
- /* Photon Draw Buffer - shared by all widgets */
- static int DrawBufferSize = 1024 * 48;
-
- /* Display Data */
- Object data;
- String [] keys;
- Object [] values;
-
- /*
- * TEMPORARY CODE. Install the runnable that
- * gets the current display. This code will
- * be removed in the future.
- */
- static {
- DeviceFinder = new Runnable () {
- public void run () {
- Device device = getCurrent ();
- if (device == null) {
- device = getDefault ();
- }
- setDevice (device);
- }
- };
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static void setDevice (Device device) {
- CurrentDevice = device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * Note: The resulting display is marked as the <em>current</em>
- * display. If this is the first display which has been
- * constructed since the application started, it is also
- * marked as the <em>default</em> display.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see #getCurrent
- * @see #getDefault
- * @see Widget#checkSubclass
- * @see Shell
- */
-public Display () {
- this (null);
-}
-
-public Display (DeviceData data) {
- super (data);
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-public void asyncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.asyncExec (runnable);
-}
-
-/**
- * Causes the system hardware to emit a short sound
- * (if it supports this capability).
- */
-public void beep () {
- checkDevice ();
- OS.PtBeep ();
-}
-
-protected void checkDevice () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-synchronized void checkDisplay () {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] != null && Displays [i].thread == thread) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- }
-}
-
-protected void checkSubclass () {
- if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-String convertToLf (String text) {
- int length = text.length ();
- if (length == 0) return text;
-
- /* Check for an LF or CR/LF. Assume the rest of the string
- * is formated that way. This will not work if the string
- * contains mixed delimiters. */
- int i = text.indexOf ('\n', 0);
- if (i == -1 || i == 0) return text;
- if (text.charAt (i - 1) != '\r') return text;
-
- /* The string is formatted with CR/LF.
- * Create a new string with the LF line delimiter. */
- i = 0;
- StringBuffer result = new StringBuffer ();
- while (i < length) {
- int j = text.indexOf ('\r', i);
- if (j == -1) j = length;
- String s = text.substring (i, j);
- result.append (s);
- i = j + 2;
- result.append ('\n');
- }
- return result.toString ();
-}
-
-protected void create (DeviceData data) {
- checkSubclass ();
- checkDisplay ();
- createDisplay (data);
- register ();
- if (Default == null) Default = this;
-}
-
-void createDisplay (DeviceData data) {
- OS.PtInit (null);
- OS.PgSetDrawBufferSize (DrawBufferSize);
- app_context = OS.PtCreateAppContext ();
-}
-
-synchronized void deregister () {
- for (int i=0; i<Displays.length; i++) {
- if (this == Displays [i]) Displays [i] = null;
- }
-}
-
-protected void destroy () {
- if (this == Default) Default = null;
- deregister ();
- destroyDisplay ();
-}
-
-void destroyDisplay () {
- // NEED to destroy app_context ???
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread just before the
- * receiver is disposed.
- *
- * @param runnable code to run at dispose time.
- */
-public void disposeExec (Runnable runnable) {
- checkDevice ();
- if (disposeList == null) disposeList = new Runnable [4];
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] == null) {
- disposeList [i] = runnable;
- return;
- }
- }
- Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
- System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
- newDisposeList [disposeList.length] = runnable;
- disposeList = newDisposeList;
-}
-
-int drawProc (int handle, int damage) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return 0;
- return widget.processPaint (damage);
-}
-
-void error (int code) {
- SWT.error(code);
-}
-
-/**
- * Returns the display which the given thread is the
- * user-interface thread for, or null if the given thread
- * is not a user-interface thread for any display.
- *
- * @param thread the user-interface thread
- * @return the display for the given thread
- */
-public static synchronized Display findDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == thread) {
- return display;
- }
- }
- return null;
-}
-
-/**
- * Given the operating system handle for a widget, returns
- * the instance of the <code>Widget</code> subclass which
- * represents it in the currently running application, if
- * such exists, or null if no matching widget can be found.
- *
- * @param handle the handle for the widget
- * @return the SWT widget that the handle represents
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Widget findWidget (int handle) {
- checkDevice ();
- return WidgetTable.get (handle);
-}
-
-/**
- * Returns the currently active <code>Shell</code>, or null
- * if no shell belonging to the currently running application
- * is active.
- *
- * @return the active shell or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getActiveShell () {
- checkDevice ();
- int handle = 0;
- while ((handle = OS.PtNextTopLevelWidget (handle)) != 0) {
- int state = OS.PtWindowGetState (handle);
- if (state != -1 && (state & OS.Ph_WM_STATE_ISFOCUS) != 0) {
- Widget widget = WidgetTable.get (handle);
- if (widget instanceof Shell) return (Shell) widget;
- }
- }
- return null;
-}
-
-/**
- * Returns the control which the on-screen pointer is currently
- * over top of, or null if it is not currently over one of the
- * controls built by the currently running application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getCursorControl () {
- checkDevice ();
- int ig = OS.PhInputGroup (0);
- PhCursorInfo_t info = new PhCursorInfo_t ();
- OS.PhQueryCursor ((short) ig, info);
- PhRect_t rect = new PhRect_t ();
- rect.ul_x = rect.lr_x = info.pos_x;
- rect.ul_y = rect.lr_y = info.pos_y;
- int handle = 0;
- //DOESN'T WORK WHEN SHELLS OVERLAP (NEED Z ORDER)
- while ((handle = OS.PtNextTopLevelWidget (handle)) != 0) {
- int child = handle, parent = 0;
- short [] x = new short [1], y = new short [1];
- do {
- OS.PtGetAbsPosition (child, x, y);
- rect.ul_x = rect.lr_x = (short) (info.pos_x - x [0]);
- rect.ul_y = rect.lr_y = (short) (info.pos_y - y [0]);
- if ((child = OS.PtHit (child, 1, rect)) == 0) break;
- parent = child;
- if (OS.PtWidgetIsClassMember (child, OS.PtContainer ()) == 0) break;
- } while (child != 0);
- if (parent != 0) {
- do {
- Widget widget = WidgetTable.get (parent);
- if (widget != null && widget instanceof Control) {
- Control control = (Control) widget;
- if (control.getEnabled ()) return control;
- return control;
- }
- } while ((parent = OS.PtWidgetParent (parent)) != 0);
- }
- }
- return null;
-}
-
-/**
- * Returns the location of the on-screen pointer relative
- * to the top left corner of the screen.
- *
- * @return the cursor location
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCursorLocation () {
- checkDevice ();
- int ig = OS.PhInputGroup (0);
- PhCursorInfo_t info = new PhCursorInfo_t ();
- OS.PhQueryCursor ((short)ig, info);
- return new Point (info.pos_x, info.pos_y);
-}
-
-/**
- * Returns the display which the currently running thread is
- * the user-interface thread for, or null if the currently
- * running thread is not a user-interface thread for any display.
- *
- * @return the current display
- */
-public static synchronized Display getCurrent () {
- Thread current = Thread.currentThread ();
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == current) return display;
- }
- return null;
-}
-
-/**
- * Returns the default display. One is created (making the
- * thread that invokes this method its user-interface thread)
- * if it did not already exist.
- *
- * @return the default display
- */
-public static synchronized Display getDefault () {
- if (Default == null) Default = new Display ();
- return Default;
-}
-
-/**
- * On platforms which support it, sets the application name
- * to be the argument. On Motif, for example, this can be used
- * to set the name used for resource lookup.
- *
- * @param name the new app name
- */
-public static void setAppName (String name) {
- /* Do nothing */
-}
-
-/**
- * Returns the longest duration, in milliseconds, between
- * two mouse button clicks that will be considered a
- * <em>double click</em> by the underlying operating system.
- *
- * @return the double click time
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getDoubleClickTime () {
- checkDevice ();
- //NOT DONE
- return 250;
-}
-
-/**
- * Returns the control which currently has keyboard focus,
- * or null if keyboard events are not currently going to
- * any of the controls built by the currently running
- * application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getFocusControl () {
- checkDevice ();
- int handle = 0;
- while ((handle = OS.PtNextTopLevelWidget (handle)) != 0) {
- int state = OS.PtWindowGetState (handle);
- if (state != -1 && (state & OS.Ph_WM_STATE_ISFOCUS) != 0) {
- int focusHandle = OS.PtContainerFindFocus (handle);
- if (focusHandle != 0) {
- Widget widget = WidgetTable.get (focusHandle);
- if (widget instanceof Control) return (Control) widget;
- }
- return null;
- }
- }
- return null;
-}
-
-/**
- * Returns the maximum allowed depth of icons on this display.
- * On some platforms, this may be different than the actual
- * depth of the display.
- *
- * @return the maximum icon depth
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIconDepth () {
- return getDepth ();
-}
-
-/**
- * Returns an array containing all shells which have not been
- * disposed and have the receiver as their display.
- *
- * @return the receiver's shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkDevice ();
- /*
- * NOTE: Need to check that the shells that belong
- * to another display have not been disposed by the
- * other display's thread as the shells list is being
- * processed.
- */
- int count = 0;
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- count++;
- }
- }
- if (count == shells.length) return shells;
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- result [index++] = shell;
- }
- }
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- int color = 0x000000;
- switch (id) {
- case SWT.COLOR_INFO_FOREGROUND: color = INFO_FOREGROUND; break;
- case SWT.COLOR_INFO_BACKGROUND: color = INFO_BACKGROUND; break;
- case SWT.COLOR_TITLE_FOREGROUND: color = 0x000000; break;
- case SWT.COLOR_TITLE_BACKGROUND: color = 0x6493E7; break;
- case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: color = 0x0000FF; break;
- case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: color = 0x000000; break;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: color = 0xABBBD3; break;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: color = 0x0000FF; break;
- case SWT.COLOR_WIDGET_DARK_SHADOW: color = WIDGET_DARK_SHADOW; break;
- case SWT.COLOR_WIDGET_NORMAL_SHADOW: color = WIDGET_NORMAL_SHADOW; break;
- case SWT.COLOR_WIDGET_LIGHT_SHADOW: color = WIDGET_LIGHT_SHADOW; break;
- case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: color = WIDGET_HIGHLIGHT_SHADOW; break;
- case SWT.COLOR_WIDGET_BACKGROUND: color = WIDGET_BACKGROUND; break;
- case SWT.COLOR_WIDGET_FOREGROUND: color = WIDGET_FOREGROUND; break;
- case SWT.COLOR_WIDGET_BORDER: color = WIDGET_BORDER; break;
- case SWT.COLOR_LIST_FOREGROUND: color = LIST_FOREGROUND; break;
- case SWT.COLOR_LIST_BACKGROUND: color = LIST_BACKGROUND; break;
- case SWT.COLOR_LIST_SELECTION: color = LIST_SELECTION; break;
- case SWT.COLOR_LIST_SELECTION_TEXT: color = LIST_SELECTION_TEXT; break;
- default:
- return super.getSystemColor (id);
- }
- return Color.photon_new (this, color);
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- return Font.photon_new (this, TEXT_FONT);
-}
-
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or null if no such runnable is currently being invoked by
- * the user-interface thread.
- * <p>
- * Note: If a runnable invoked by asyncExec is currently
- * running, this method will return null.
- * </p>
- *
- * @return the receiver's sync-interface thread
- */
-public Thread getSyncThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return synchronizer.syncThread;
-}
-
-/**
- * Returns the user-interface thread for the receiver.
- *
- * @return the receiver's user-interface thread
- */
-public Thread getThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return thread;
-}
-
-int hotkeyProc (int handle, int data, int info) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return OS.Pt_CONTINUE;
- return widget.processHotkey (data, info);
-}
-
-protected void init () {
- super.init ();
- initializeDisplay ();
- initializeWidgetClasses ();
- initializeWidgetColors ();
- initializeWidgetFonts ();
- initializeScrollbars ();
-}
-
-void initializeDisplay () {
- windowCallback = new Callback (this, "windowProc", 3);
- windowProc = windowCallback.getAddress ();
- if (windowProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- drawCallback = new Callback (this, "drawProc", 2);
- drawProc = drawCallback.getAddress ();
- if (drawProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- workCallback = new Callback (this, "workProc", 1);
- workProc = workCallback.getAddress ();
- if (workProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- inputCallback = new Callback (this, "inputProc", 4);
- inputProc = inputCallback.getAddress ();
- if (inputProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- timerCallback = new Callback (this, "timerProc", 3);
- timerProc = timerCallback.getAddress ();
- if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- hotkeyCallback = new Callback (this, "hotkeyProc", 3);
- hotkeyProc = hotkeyCallback.getAddress ();
- if (hotkeyProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- pulse = OS.PtAppCreatePulse (app_context, -1);
- input = OS.PtAppAddInput (app_context, pulse, inputProc, 0);
- int [] args = {
- OS.Pt_ARG_REGION_OPAQUE, 0, ~0,
- OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0,
- OS.Pt_ARG_REGION_SENSE, OS.Ph_EV_TIMER, ~0,
- };
- OS.PtSetParentWidget (0);
- timerHandle = OS.PtCreateWidget (OS.PtRegion (), 0, args.length / 3, args);
- if (timerHandle == 0) error (SWT.ERROR_NO_HANDLES);
- OS.PtRealizeWidget (timerHandle);
-}
-
-void initializeScrollbars () {
- OS.PtSetParentWidget (0);
- int shellHandle = OS.PtCreateWidget (OS.PtWindow (), 0, 0, null);
- int textHandle = OS.PtCreateWidget (OS.PtMultiText (), shellHandle, 0, null);
- int child = OS.PtWidgetChildFront (textHandle);
- while (child != 0) {
- if (OS.PtWidgetClass (child) == OS.PtScrollbar ()) {
- int [] args = new int [] {
- OS.Pt_ARG_ORIENTATION, 0, 0,
- OS.Pt_ARG_WIDTH, 0, 0,
- OS.Pt_ARG_HEIGHT, 0, 0,
- OS.Pt_ARG_BASIC_FLAGS, 0, 0,
- };
- OS.PtGetResources (child, args.length / 3, args);
- switch (args [1]) {
- case OS.Pt_HORIZONTAL:
- SCROLLBAR_HEIGHT = args [7];
- SCROLLBAR_HORIZONTAL_BASIC_FLAGS = args [10];
- break;
- case OS.Pt_VERTICAL:
- SCROLLBAR_WIDTH = args [4];
- SCROLLBAR_VERTICAL_BASIC_FLAGS = args [10];
- break;
- }
- }
- child = OS.PtWidgetBrotherBehind (child);
- }
- OS.PtDestroyWidget (shellHandle);
-}
-
-void initializeWidgetClasses () {
- int [] args = {OS.Pt_SET_DRAW_F, drawProc, 0};
- int [] buffer = {
- OS.PtCreateWidgetClass (OS.PtButton (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtList (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtLabel (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtWindow (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtToggleButton (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtComboBox (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtText (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtMultiText (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtScrollbar (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtScrollContainer (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtScrollArea (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtContainer (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtProgress (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtPanelGroup (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtPane (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtTree (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtSlider (), 0, args.length / 3, args), 0, 0,
- OS.PtCreateWidgetClass (OS.PtSeparator (), 0, args.length / 3, args), 0, 0,
- };
- ClassesPtr = OS.malloc (buffer.length * 4);
- OS.memmove (ClassesPtr, buffer, buffer.length * 4);
- PtButton = ClassesPtr;
- PtList = ClassesPtr + 12;
- PtLabel = ClassesPtr + 24;
- PtWindow = ClassesPtr + 36;
- PtToggleButton = ClassesPtr + 48;
- PtComboBox = ClassesPtr + 60;
- PtText = ClassesPtr + 72;
- PtMultiText = ClassesPtr + 84;
- PtScrollbar = ClassesPtr + 96;
- PtScrollContainer = ClassesPtr + 108;
- PtScrollArea = ClassesPtr + 120;
- PtContainer = ClassesPtr + 132;
- PtProgress = ClassesPtr + 144;
- PtPanelGroup = ClassesPtr + 156;
- PtPane = ClassesPtr + 168;
- PtTree = ClassesPtr + 180;
- PtSlider = ClassesPtr + 192;
- PtSeparator = ClassesPtr + 204;
-}
-
-void initializeWidgetColors () {
- OS.PtSetParentWidget (0);
- int [] args = {
- OS.Pt_ARG_WINDOW_STATE, OS.Ph_WM_STATE_ISHIDDEN, ~0,
- };
- int shellHandle = OS.PtCreateWidget (OS.PtWindow (), 0, args.length / 3, args);
- args = new int [] {
- OS.Pt_ARG_COLOR, 0, 0,
- OS.Pt_ARG_FILL_COLOR, 0, 0,
- };
- OS.PtGetResources (shellHandle, args.length / 3, args);
- WIDGET_FOREGROUND = args [1];
- WIDGET_BACKGROUND = args [4];
-
- int handle = OS.PtCreateWidget (OS.PtList (), shellHandle, 0, null);
- args = new int [] {
- OS.Pt_ARG_COLOR, 0, 0,
- OS.Pt_ARG_FILL_COLOR, 0, 0,
- OS.Pt_ARG_SELECTION_FILL_COLOR, 0, 0,
- OS.Pt_ARG_SELECTION_TEXT_COLOR, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- LIST_FOREGROUND = args [1];
- LIST_BACKGROUND = args [4];
- LIST_SELECTION = args [7];
- LIST_SELECTION_TEXT = args [10];
-
- /*
- * Feature in Photon. The values of Pt_ARG_DARK_BEVEL_COLOR and
- * Pt_ARG_LIGHT_BEVEL_COLOR are not initialized until the widget
- * is realized. The fix is to realize the shell, but don't
- * display it.
- */
- handle = OS.PtCreateWidget (OS.PtButton (), shellHandle, 0, null);
- OS.PtRealizeWidget(shellHandle);
- args = new int [] {
- OS.Pt_ARG_OUTLINE_COLOR, 0, 0,
- OS.Pt_ARG_OUTLINE_COLOR, 0, 0,
- OS.Pt_ARG_DARK_BEVEL_COLOR, 0, 0,
- OS.Pt_ARG_BEVEL_COLOR, 0, 0,
- OS.Pt_ARG_LIGHT_BEVEL_COLOR, 0, 0,
- OS.Pt_ARG_BALLOON_COLOR, 0, 0,
- OS.Pt_ARG_BALLOON_FILL_COLOR, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- WIDGET_BORDER = args [1];
- WIDGET_DARK_SHADOW = args [4];
- WIDGET_NORMAL_SHADOW = args [7];
- WIDGET_LIGHT_SHADOW = args [10];
- WIDGET_HIGHLIGHT_SHADOW = args [13];
- INFO_FOREGROUND = args [16];
- INFO_BACKGROUND = args [19];
-
- OS.PtDestroyWidget (shellHandle);
-}
-
-void initializeWidgetFonts () {
- OS.PtSetParentWidget (0);
- int shellHandle = OS.PtCreateWidget (OS.PtWindow (), 0, 0, null);
- int listHandle = OS.PtCreateWidget (OS.PtList (), shellHandle, 0, null);
- int [] args = {OS.Pt_ARG_LIST_FONT, 0, 0};
- OS.PtGetResources (listHandle, args.length / 3, args);
- int count = OS.strlen (args [1]);
- LIST_FONT = new byte [count + 1];
- OS.memmove (LIST_FONT, args [1], count);
- int textHandle = OS.PtCreateWidget (OS.PtText (), shellHandle, 0, null);
- args = new int [] {OS.Pt_ARG_TEXT_FONT, 0, 0};
- OS.PtGetResources (textHandle, args.length / 3, args);
- count = OS.strlen (args [1]);
- TEXT_FONT = new byte [count + 1];
- OS.memmove (TEXT_FONT, args [1], count);
- OS.PtDestroyWidget (shellHandle);
-}
-
-int inputProc (int data, int rcvid, int message, int size) {
- if (embedded) {
- runDeferredEvents ();
- runAsyncMessages ();
- }
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
- int phGC = OS.PgCreateGC(0); // NOTE: PgCreateGC ignores the parameter
- if (phGC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- data.device = this;
- data.rid = OS.Ph_DEV_RID;
- return phGC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int phGC, GCData data) {
- OS.PgDestroyGC(phGC);
-}
-
-boolean isValidThread () {
- return thread == Thread.currentThread ();
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData (String key) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the application defined, display specific data
- * associated with the receiver, or null if it has not been
- * set. The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @return the display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData () {
- checkDevice ();
- return data;
-}
-static boolean isValidClass (Class clazz) {
- String name = clazz.getName ();
- int index = name.lastIndexOf ('.');
- return name.substring (0, index + 1).equals (PACKAGE_NAME);
-}
-
-void postEvent (Event event) {
- /*
- * Place the event at the end of the event queue.
- * This code is always called in the Display's
- * thread so it must be re-enterant but does not
- * need to be synchronized.
- */
- if (eventQueue == null) eventQueue = new Event [4];
- int index = 0;
- int length = eventQueue.length;
- while (index < length) {
- if (eventQueue [index] == null) break;
- index++;
- }
- if (index == length) {
- Event [] newQueue = new Event [length + 4];
- System.arraycopy (eventQueue, 0, newQueue, 0, length);
- eventQueue = newQueue;
- }
- eventQueue [index] = event;
- if (embedded) wake ();
-}
-
-/**
- * Reads an event from the operating system's event queue,
- * dispatches it appropriately, and returns <code>true</code>
- * if there is potentially more work to do, or <code>false</code>
- * if the caller can sleep until another event is placed on
- * the event queue.
- * <p>
- * In addition to checking the system event queue, this method also
- * checks if any inter-thread messages (created by <code>syncExec()</code>
- * or <code>asyncExec()</code>) are waiting to be processed, and if
- * so handles them before returning.
- * </p>
- *
- * @return <code>false</code> if the caller can sleep upon return from this method
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #sleep
- * @see #wake
- */
-public boolean readAndDispatch () {
- checkDevice ();
- idle = false;
- int id = OS.PtAppAddWorkProc (app_context, workProc, 0);
- OS.PtAppProcessEvent (app_context);
- OS.PtAppRemoveWorkProc (app_context, id);
- if (!idle) {
- runDeferredEvents ();
- return true;
- }
- return runAsyncMessages ();
-}
-
-synchronized void register () {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] == null) {
- Displays [i] = this;
- return;
- }
- }
- Display [] newDisplays = new Display [Displays.length + 4];
- System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
- newDisplays [Displays.length] = this;
- Displays = newDisplays;
-}
-
-protected void release () {
- super.release ();
-
- /* Release shells */
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
- }
- }
- while (readAndDispatch ()) {};
-
- /* Run dispose list */
- if (disposeList != null) {
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] != null) disposeList [i].run ();
- }
- }
- disposeList = null;
-
- /* Release synchronizer */
- synchronizer.releaseSynchronizer ();
- synchronizer = null;
-
- releaseDisplay ();
-}
-
-void releaseDisplay () {
-
- OS.PtDestroyWidget (timerHandle);
-
- /* Free the classes array */
- OS.free (ClassesPtr);
-
- /* Free pulses and input proc */
- OS.PtAppRemoveInput (app_context, input);
- OS.PtAppDeletePulse (app_context, pulse);
-
- /* Free the timers */
- if (timers != null) {
- for (int i=0; i<timers.length; i++) {
- if (timers [i] != 0) OS.PtDestroyWidget (timers [i]);
- }
- }
- timers = null;
- timerList = null;
- timerProc = 0;
- timerCallback.dispose ();
- timerCallback = null;
-
- /* Free the window proc */
- windowCallback.dispose ();
- windowCallback = null;
-
- /* Free callbacks */
- drawCallback.dispose();
- drawCallback = null;
- workCallback.dispose();
- workCallback = null;
- inputCallback.dispose();
- inputCallback = null;
- hotkeyCallback.dispose();
- hotkeyCallback = null;
-
- /* Release references */
- thread = null;
- data = null;
- keys = null;
- values = null;
-}
-
-boolean runAsyncMessages () {
- return synchronizer.runAsyncMessages ();
-}
-
-boolean runDeferredEvents () {
- /*
- * Run deferred events. This code is always
- * called in the Display's thread so it must
- * be re-enterant need not be synchronized.
- */
- while (eventQueue != null) {
-
- /* Take an event off the queue */
- Event event = eventQueue [0];
- if (event == null) break;
- int length = eventQueue.length;
- System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
- eventQueue [length] = null;
-
- /* Run the event */
- Widget widget = event.widget;
- if (widget != null && !widget.isDisposed ()) {
- Widget item = event.item;
- if (item == null || !item.isDisposed ()) {
- widget.notifyListeners (event.type, event);
- }
- }
-
- /*
- * At this point, the event queue could
- * be null due to a recursive invokation
- * when running the event.
- */
- }
-
- /* Clear the queue */
- eventQueue = null;
- return true;
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given argument.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public void setData (String key, Object value) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Sets the application defined, display specific data
- * associated with the receiver, to the argument.
- * The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param data the new display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #getData
- * @see #disposeExec
- */
-public void setData (Object data) {
- checkDevice ();
- this.data = data;
-}
-
-/**
- * Sets the synchronizer used by the display to be
- * the argument, which can not be null.
- *
- * @param synchronizer the new synchronizer for the display (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSynchronizer (Synchronizer synchronizer) {
- checkDevice ();
- if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (this.synchronizer != null) {
- this.synchronizer.runAsyncMessages();
- }
- this.synchronizer = synchronizer;
-}
-
-/**
- * Causes the user-interface thread to <em>sleep</em> (that is,
- * to be put in a state where it does not consume CPU cycles)
- * until an event is received or it is otherwise awakened.
- *
- * @return <code>true</code> if an event requiring dispatching was placed on the queue.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #wake
- */
-public boolean sleep () {
- checkDevice ();
- OS.PtAppProcessEvent (app_context);
- runDeferredEvents ();
- return true;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void syncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.syncExec (runnable);
-}
-
-int textWidth (String string, byte[] font) {
- if (string.length () == 0) return 0;
- byte [] textBuffer = Converter.wcsToMbcs (null, string, false);
- PhRect_t rect = new PhRect_t ();
- OS.PfExtentText(rect, null, font, textBuffer, textBuffer.length);
- if (rect.lr_x == rect.ul_x) return 0;
- return rect.lr_x - rect.ul_x + 1;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread after the specified
- * number of milliseconds have elapsed.
- *
- * @param milliseconds the delay before running the runnable
- * @param runnable code to run on the user-interface thread
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void timerExec (int milliseconds, Runnable runnable) {
- checkDevice ();
- if (timerList == null) timerList = new Runnable [4];
- if (timers == null) timers = new int [4];
- int index = 0;
- while (index < timerList.length) {
- if (timerList [index] == null) break;
- index++;
- }
- if (index == timerList.length) {
- Runnable [] newTimerList = new Runnable [timerList.length + 4];
- System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
- timerList = newTimerList;
- int [] newTimers = new int [timers.length + 4];
- System.arraycopy (timers, 0, newTimers, 0, timers.length);
- timers = newTimers;
- }
- int [] args = {OS.Pt_ARG_TIMER_INITIAL, milliseconds, 0};
- int handle = OS.PtCreateWidget (OS.PtTimer (), timerHandle, args.length / 3, args);
- OS.PtRealizeWidget (handle);
- if (handle != 0) {
- OS.PtAddCallback (handle, OS.Pt_CB_TIMER_ACTIVATE, timerProc, index);
- timerList [index] = runnable;
- timers [index] = handle;
- }
-
-}
-int timerProc (int handle, int index, int info) {
- if (timerList == null) return 0;
- if (0 <= index && index < timerList.length) {
- Runnable runnable = timerList [index];
- timerList [index] = null;
- OS.PtDestroyWidget (timers [index]);
- timers [index] = 0;
- if (runnable != null) runnable.run ();
- }
- return 0;
-}
-
-static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- }
- return 0;
-}
-
-static int untranslateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [1] == key) return KeyTable [i] [0];
- }
- return 0;
-}
-
-public void update() {
- checkDevice ();
- Shell[] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- shell.update ();
- }
- }
-}
-
-/**
- * If the receiver's user-interface thread was <code>sleep</code>'ing,
- * causes it to be awakened and start running again. Note that this
- * method may be called from any thread.
- *
- * @see #sleep
- */
-public void wake () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-// int flags = OS.PtEnter (0);
- OS.PtAppPulseTrigger (app_context, pulse);
-// if (flags >= 0) OS.PtLeave (flags);
-}
-
-int windowProc (int handle, int data, int info) {
- Widget widget = WidgetTable.get (handle);
- if (widget == null) return OS.Pt_CONTINUE;
- return widget.processEvent (handle, data, info);
-}
-
-int workProc (int data) {
- idle = true;
- return OS.Pt_CONTINUE;
-}
-
-String wrapText (String text, byte[] font, int width) {
- text = convertToLf (text);
- int length = text.length ();
- if (width <= 0 || length == 0 || length == 1) return text;
- StringBuffer result = new StringBuffer ();
- int lineStart = 0, lineEnd = 0;
- while (lineStart < length) {
- lineEnd = text.indexOf ('\n', lineStart);
- boolean noLf = lineEnd == -1;
- if (noLf) lineEnd = length;
- int nextStart = lineEnd + 1;
- while (lineEnd > lineStart + 1 && Compatibility.isWhitespace (text.charAt (lineEnd - 1))) {
- lineEnd--;
- }
- int wordStart = lineStart, wordEnd = lineStart;
- int i = lineStart;
- while (i < lineEnd) {
- int lastStart = wordStart, lastEnd = wordEnd;
- wordStart = i;
- while (i < lineEnd && !Compatibility.isWhitespace (text.charAt (i))) {
- i++;
- }
- wordEnd = i - 1;
- String line = text.substring (lineStart, wordEnd + 1);
- int lineWidth = textWidth (line, font);
- while (i < lineEnd && Compatibility.isWhitespace (text.charAt (i))) {
- i++;
- }
- if (lineWidth > width) {
- if (lastStart == wordStart) {
- while (wordStart < wordEnd) {
- line = text.substring (lineStart, wordStart + 1);
- lineWidth = textWidth (line, font);
- if (lineWidth >= width) break;
- wordStart++;
- }
- if (wordStart == lastStart) wordStart++;
- lastEnd = wordStart - 1;
- }
- line = text.substring (lineStart, lastEnd + 1);
- result.append (line); result.append ('\n');
- i = wordStart; lineStart = wordStart; wordEnd = wordStart;
- }
- }
- if (lineStart < lineEnd) {
- result.append (text.substring (lineStart, lineEnd));
- }
- if (!noLf) {
- result.append ('\n');
- }
- lineStart = nextStart;
- }
- return result.toString ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FileDialog.java
deleted file mode 100755
index 258bffd8d5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FileDialog.java
+++ /dev/null
@@ -1,265 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select or enter a file name.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SAVE, OPEN, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FileDialog extends Dialog {
- String [] filterNames = new String [0];
- String [] filterExtensions = new String [0];
- String filterPath = "", fileName = "";
- static final String FILTER = "*";
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the path of the first file that was
- * selected in the dialog relative to the filter path,
- * or null if none is available.
- *
- * @return the relative path of the file
- */
-public String getFileName () {
- return fileName;
-}
-
-/**
- * Returns the paths of all files that were selected
- * in the dialog relative to the filter path, or null
- * if none are available.
- *
- * @return the relative paths of the files
- */
-public String [] getFileNames () {
- return new String [] {fileName};
-}
-
-/**
- * Returns the file extensions which the dialog will
- * use to filter the files it shows.
- *
- * @return the file extensions filter
- */
-public String [] getFilterExtensions () {
- return filterExtensions;
-}
-
-/**
- * Returns the file names which the dialog will
- * use to filter the files it shows.
- *
- * @return the file name filter
- */
-public String [] getFilterNames () {
- return filterNames;
-}
-
-/**
- * Returns the path which the dialog will use to filter
- * the files it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the first selected file,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.shellHandle;
- byte [] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
- byte [] root_dir = null;
- if (filterPath != null) {
- root_dir = Converter.wcsToMbcs (null, filterPath, true);
- }
-
- /* Compute the filter */
- String mask = FILTER;
- /*
- * Photon does not support filter names.
- */
- if (filterNames == null) filterNames = new String [0];
- /*
- * Photon supports only one filter with multiple patterns
- * separated by commas.
- */
- if (filterExtensions == null) filterExtensions = new String [0];
- if (filterExtensions.length > 0) {
- String comma = ",";
- mask = comma;
- for (int i=0; i<filterExtensions.length; i++) {
- String ext = filterExtensions [i];
- int length = ext.length();
- int end, start = 0;
- do {
- int index = end = ext.indexOf(';', start);
- if (end < 0) end = length;
- String subExt = ext.substring(start, end).trim();
- if (subExt.length() > 0) {
- subExt += comma;
- if (mask.indexOf(comma + subExt) == -1) mask += subExt;
- }
- start = end + 1;
- } while (end < length);
- }
- mask = mask.substring(1, Math.max(1, mask.length() - 1));
- }
- byte [] file_spec = Converter.wcsToMbcs (null, mask, true);
-
- int flags = OS.Pt_FSR_NO_FCHECK;
- PtFileSelectionInfo_t info = new PtFileSelectionInfo_t ();
- OS.PtFileSelection (parentHandle, null, title, root_dir, file_spec, null, null, null, info, flags);
- if (info.ret == OS.Pt_FSDIALOG_BTN2) return null;
- int length = 0;
- while (length < info.path.length && info.path [length] != 0) length++;
- byte [] path = new byte [length];
- System.arraycopy (info.path, 0, path, 0, length);
- String fullPath = new String (Converter.mbcsToWcs (null, path));
- length = fullPath.length ();
- if (length != 0) {
- int index = length - 1;
- while (index >= 0 && (fullPath.charAt (index) != '/')) --index;
- fileName = fullPath.substring (index + 1, length);
- filterPath = fullPath.substring (0, index);
- }
- return fullPath;
-}
-
-/**
- * Set the initial filename which the dialog will
- * select by default when opened to the argument,
- * which may be null. The name will be prefixed with
- * the filter path when one is supplied.
- *
- * @param string the file name
- */
-public void setFileName (String string) {
- fileName = string;
-}
-
-/**
- * Set the file extensions which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param extensions the file extension filter
- */
-public void setFilterExtensions (String [] extensions) {
- filterExtensions = extensions;
-}
-
-/**
- * Sets the file names which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param names the file name filter
- */
-public void setFilterNames (String [] names) {
- filterNames = names;
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the files it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java
deleted file mode 100755
index 2bdfea8df5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to select a font
- * from all available fonts in the system.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FontDialog extends Dialog {
- FontData fontData;
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-/**
- * Returns a FontData object describing the font that was
- * selected in the dialog, or null if none is available.
- *
- * @return the FontData for the selected font, or null
- */
-public FontData getFontData() {
- return fontData;
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a FontData object describing the font that was selected,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public FontData open () {
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.shellHandle;
- byte [] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
-
- byte[] font = null;
- if (fontData != null) {
- if (fontData.stem != null) {
- font = fontData.stem;
- } else {
- byte[] description = Converter.wcsToMbcs(null, fontData.getName(), true);
- int osStyle = 0, style = fontData.getStyle();
- if ((style & SWT.BOLD) != 0) osStyle |= OS.PF_STYLE_BOLD;
- if ((style & SWT.ITALIC) != 0) osStyle |= OS.PF_STYLE_ITALIC;
- int size = fontData.getHeight();
- font = OS.PfGenerateFontName(description, osStyle, size, new byte[OS.MAX_FONT_TAG]);
- }
- fontData = null;
- }
-
- int fontPtr = OS.PtFontSelection (parentHandle, null, title, font, -1, OS.PHFONT_ALL_FONTS | OS.PFFONT_DONT_SHOW_LEGACY, null);
-
- if (fontPtr != 0) {
- int length = OS.strlen(fontPtr);
- font = new byte[length];
- OS.memmove(font, fontPtr, length);
- fontData = FontData.photon_new(font);
- }
- return fontData;
-}
-/**
- * Sets a FontData object describing the font to be
- * selected by default in the dialog, or null to let
- * the platform choose one.
- *
- * @param fontData the FontData to use initially, or null
- */
-public void setFontData (FontData fontData) {
- this.fontData = fontData;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
deleted file mode 100755
index fdd6a06b2d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an etched border
- * with an optional title.
- * <p>
- * Shadow styles are hints and may not be honoured
- * by the platform. To create a group with the
- * default shadow style for the platform, do not
- * specify a shadow style.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Group extends Composite {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Group (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- Point titleSize = getTitleSize();
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- int width = size.x; int height = size.y;
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- Rectangle trim = computeTrim (0, 0, width, height);
- width = Math.max (trim.width, titleSize.x + 6);
- height = trim.height + titleSize.y;
- return new Point (width, height);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtPane;
- int parentHandle = parent.handle;
- int [] args = {
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns the receiver's text, which is the string that the
- * is used as the <em>title</em>. If the text has not previously
- * been set, returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- int [] args = {OS.Pt_ARG_TITLE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return "";
- int length = OS.strlen (args [1]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, args [1], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-
-Point getTitleSize() {
- int width = 0, height = 0;
- int [] args = {
- OS.Pt_ARG_TITLE, 0, 0,
- OS.Pt_ARG_TITLE_FONT, 0, 0,
- OS.Pt_ARG_CONTAINER_FLAGS, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if ((OS.Pt_ARG_CONTAINER_FLAGS & OS.Pt_SHOW_TITLE) != 0) {
- PhRect_t rect = new PhRect_t();
- if (args [1] != 0) {
- int length = OS.strlen (args [1]);
- OS.PfExtentText(rect, null, args [4], args [1], length);
- }
- int inset = 4;
- width = inset + rect.lr_x - rect.ul_x + 1;
- height = inset + rect.lr_y - rect.ul_y + 1;
- }
- return new Point(width, height);
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtPane (), handle, damage);
- sendPaintEvent (damage);
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Sets the receiver's text, which is the string that will
- * be displayed as the receiver's <em>title</em>, to the argument,
- * which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int flags = OS.Pt_SHOW_TITLE | OS.Pt_ETCH_TITLE_AREA | OS.Pt_GRADIENT_TITLE_AREA;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {
- OS.Pt_ARG_TITLE, ptr, 0,
- OS.Pt_ARG_CONTAINER_FLAGS, string.length () == 0 ? 0 : flags, flags,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
deleted file mode 100755
index f52072dd21..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
+++ /dev/null
@@ -1,435 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a non-selectable
- * user interface object that displays a string or image.
- * When SEPARATOR is specified, displays a single
- * vertical or horizontal line.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
- * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Label extends Control {
- String text = "";
- Image image;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Label (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-static int checkStyle (int style) {
- if ((style & SWT.SEPARATOR) != 0) return style;
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) {
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
- }
-
- if ((style & SWT.WRAP) != 0) {
- int [] args = {
- OS.Pt_ARG_LABEL_TYPE, 0, 0, // 1
- OS.Pt_ARG_TEXT_FONT, 0, 0, // 4
- OS.Pt_ARG_LINE_SPACING, 0, 0, // 7
- OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 10
- OS.Pt_ARG_MARGIN_HEIGHT, 0, 0, // 13
- OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 16
- OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 19
- OS.Pt_ARG_MARGIN_TOP, 0, 0, // 22
- OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 25
- };
- OS.PtGetResources (handle, args.length / 3, args);
- /* If we are wrapping text, calculate the height based on wHint. */
- if (args [1] == OS.Pt_Z_STRING) {
- int length = OS.strlen (args [4]);
- byte [] font = new byte [length + 1];
- OS.memmove (font, args [4], length);
- Display display = getDisplay ();
- PhRect_t rect = new PhRect_t ();
- String string = text;
- if (wHint != SWT.DEFAULT) {
- string = display.wrapText (text, font, wHint);
- }
- if (hHint != SWT.DEFAULT) {
- rect.ul_y = 0;
- rect.lr_y = (short)(hHint - 1);
- } else {
- byte [] buffer = Converter.wcsToMbcs (null, string, false);
- OS.PgExtentMultiText (rect, null, font, buffer, buffer.length, args [7]);
- }
- PhArea_t area = new PhArea_t ();
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- int width = area.size_w;
- int height = area.size_h;
- width += (args [10] * 2) + args [16] + args [19];
- height += (args [13] * 2) + args [22] + args [25];
- return new Point (width, height);
- }
- }
-
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = dim.w, height = dim.h;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- int [] args = {
- OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 1
- OS.Pt_ARG_MARGIN_HEIGHT, 0, 0, // 4
- OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 7
- OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 10
- OS.Pt_ARG_MARGIN_TOP, 0, 0, // 13
- OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 16
- };
- OS.PtGetResources (handle, args.length / 3, args);
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) {
- width = area.size_w + (args [1] * 2) + args [7] + args [10];
- }
- if (hHint != SWT.DEFAULT) {
- height = area.size_h + (args [4] * 2) + args [13] + args [16];
- }
- }
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int parentHandle = parent.handle;
-
- if ((style & SWT.SEPARATOR) != 0) {
- int clazz = display.PtSeparator;
- int orientation = (style & SWT.HORIZONTAL) != 0 ? OS.Pt_SEP_HORIZONTAL : OS.Pt_SEP_VERTICAL;
- int type = OS.Pt_ETCHED_IN;
- if ((style & (SWT.SHADOW_OUT)) != 0) type = OS.Pt_ETCHED_OUT;
- int [] args = {
- OS.Pt_ARG_SEP_FLAGS, orientation, OS.Pt_SEP_VERTICAL | OS.Pt_SEP_HORIZONTAL,
- OS.Pt_ARG_SEP_TYPE, type, 0,
- OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
-
- int clazz = display.PtLabel;
- int alignment = OS.Pt_LEFT;
- if ((style & SWT.CENTER) != 0) alignment = OS.Pt_CENTER;
- if ((style & SWT.RIGHT) != 0) alignment = OS.Pt_RIGHT;
- int verticalAlign = (style & SWT.WRAP) != 0 ? OS.Pt_TOP : OS.Pt_CENTER;
- boolean hasBorder = (style & SWT.BORDER) != 0;
- int [] args = {
- OS.Pt_ARG_FLAGS, hasBorder ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_HORIZONTAL_ALIGNMENT, alignment, 0,
- OS.Pt_ARG_VERTICAL_ALIGNMENT, verticalAlign, 0,
- OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return 0;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return "";
- return text;
-}
-
-int processPaint (int damage) {
- int clazz = OS.PtLabel ();
- if ((style & SWT.SEPARATOR) != 0) clazz = OS.PtSeparator ();
- OS.PtSuperClassDraw (clazz, handle, damage);
- return super.processPaint (damage);
-}
-
-int processActivate (int info) {
- Composite control = this.parent;
- while (control != null) {
- Control [] children = control._getChildren ();
- int index = 0;
- while (index < children.length) {
- if (children [index] == this) break;
- index++;
- }
- index++;
- if (index < children.length) {
- if (children [index].setFocus ()) return OS.Pt_CONTINUE;
- }
- control = control.parent;
- }
- return OS.Pt_CONTINUE;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
- text = null;
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int [] args = {OS.Pt_ARG_HORIZONTAL_ALIGNMENT, OS.Pt_LEFT, 0};
- if ((style & SWT.CENTER) != 0) args [1] = OS.Pt_CENTER;
- if ((style & SWT.RIGHT) != 0) args [1] = OS.Pt_RIGHT;
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- super.setBounds (x, y, width, height, move, resize);
- if (resize && (style & SWT.WRAP) != 0) setText (text);
-}
-
-public boolean setFocus () {
- checkWidget();
- return false;
-}
-
-public void setFont (Font font) {
- super.setFont (font);
- if ((style & SWT.WRAP) != 0) setText (text);
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- this.image = image;
- int imageHandle = 0;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- imageHandle = copyPhImage (image.handle);
- }
- int [] args = {
- OS.Pt_ARG_LABEL_IMAGE, imageHandle, 0,
- OS.Pt_ARG_LABEL_TYPE, OS.Pt_IMAGE, 0
- };
- OS.PtSetResources (handle, args.length / 3, args);
- if (imageHandle != 0) OS.free (imageHandle);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- text = string;
- char [] unicode = new char [string.length ()];
- string.getChars (0, unicode.length, unicode, 0);
- int i=0, j=0;
- char mnemonic=0;
- while (i < unicode.length) {
- if ((unicode [j++] = unicode [i++]) == Mnemonic) {
- if (i == unicode.length) {continue;}
- if (unicode [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = unicode [i];
- j--;
- }
- }
- while (j < unicode.length) unicode [j++] = 0;
- /* Wrap the text if necessary, and convert to mbcs. */
- byte [] buffer;
- if ((style & SWT.WRAP) != 0) {
- int [] args = {
- OS.Pt_ARG_TEXT_FONT, 0, 0, // 1
- OS.Pt_ARG_WIDTH, 0, 0, // 4
- OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 7
- OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 10
- OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 13
- };
- OS.PtGetResources (handle, args.length / 3, args);
- int length = OS.strlen (args [1]);
- byte [] font = new byte [length + 1];
- OS.memmove (font, args [1], length);
- int border = 0;
- if ((style & SWT.BORDER) != 0) border = 2;
- int width = args [4];
- width -= (args [7] * 2) + args [10] + args [13] + border * 2;
- Display display = getDisplay ();
- if (mnemonic != '\0') string = new String (unicode);
- string = display.wrapText (string, font, width);
- buffer = Converter.wcsToMbcs (null, string, true);
- } else {
- buffer = Converter.wcsToMbcs (null, unicode, true);
- }
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int ptr2 = 0;
- if (mnemonic != 0) {
- byte [] buffer2 = Converter.wcsToMbcs (null, new char []{mnemonic}, true);
- ptr2 = OS.malloc (buffer2.length);
- OS.memmove (ptr2, buffer2, buffer2.length);
- }
- replaceMnemonic (mnemonic, true, true);
- int [] args = {
- OS.Pt_ARG_TEXT_STRING, ptr, 0,
- OS.Pt_ARG_LABEL_TYPE, OS.Pt_Z_STRING, 0,
- OS.Pt_ARG_ACCEL_KEY, ptr2, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
- OS.free (ptr2);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
deleted file mode 100755
index f33563f24c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
+++ /dev/null
@@ -1,1229 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface
- * object that displays a list of strings and issues notificiation
- * when a string selected. A list may be single or multi select.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class List extends Scrollable {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public List (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.PtListAddItems (handle, new int [] {ptr}, 1, 0);
- OS.free (ptr);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the selection changes.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int result = OS.PtListAddItems (handle, new int [] {ptr}, 1, index + 1);
- OS.free (ptr);
- if (result != 0) {
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (0 <= index && index <= args [1]) error (SWT.ERROR_ITEM_NOT_ADDED);
- error (SWT.ERROR_INVALID_RANGE);
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
-
- /**
- * Feature in Photon - The preferred width calculated by
- * PtWidgetPreferredSize is the current width.
- */
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = 0, height = dim.h;
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- OS.Pt_ARG_LIST_FONT, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- PhRect_t rect = new PhRect_t();
- int [] items = new int [1];
- for (int i = 0; i < args [1]; i++) {
- OS.memmove (items, args [4] + (i * 4), 4);
- int length = OS.strlen (items [0]);
- OS.PfExtentText(rect, null, args [7], items [0], length);
- width = Math.max(width, rect.lr_x - rect.ul_x + 1);
- }
- rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (width + 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- width = area.size_w;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- rect = new PhRect_t ();
- area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- ScrollBar scroll;
- if (wHint != SWT.DEFAULT) {
- width = area.size_w;
- if ((scroll = getVerticalBar()) != null)
- width += scroll.getSize().x;
- }
- if (hHint != SWT.DEFAULT) {
- height = area.size_h;
- if ((scroll = getHorizontalBar()) != null)
- height += scroll.getSize().y;
- }
- }
- return new Point(width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtList;
- int parentHandle = parent.handle;
- int mode = OS.Pt_SELECTION_MODE_SINGLE | OS.Pt_SELECTION_MODE_AUTO;
- if ((style & SWT.MULTI) != 0) {
- if ((style & SWT.SIMPLE) != 0) {
- mode = OS.Pt_SELECTION_MODE_MULTIPLE | OS.Pt_SELECTION_MODE_NOCLEAR
- | OS.Pt_SELECTION_MODE_TOGGLE | OS.Pt_SELECTION_MODE_NOMOVE;
- } else {
- mode = OS.Pt_SELECTION_MODE_MULTIPLE | OS.Pt_SELECTION_MODE_AUTO;
- }
- }
- mode |= OS.Pt_SELECTION_MODE_NOFOCUS;
- boolean hasBorder = (style & SWT.BORDER) != 0;
- int [] args = {
- OS.Pt_ARG_FLAGS, hasBorder ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_SELECTION_MODE, mode, 0,
- OS.Pt_ARG_FLAGS, OS.Pt_SELECTABLE | OS.Pt_SELECT_NOREDRAW, OS.Pt_SELECTABLE | OS.Pt_SELECT_NOREDRAW,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- createStandardScrollBars ();
-}
-
-byte [] defaultFont () {
- Display display = getDisplay ();
- return display.LIST_FONT;
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget();
- if (index < 0) return;
- OS.PtListUnselectPos (handle, index + 1);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget();
- if (start > end) return;
- if ((style & SWT.SINGLE) != 0) {
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- int index = Math.min (count - 1, end);
- if (index >= start) deselect (index);
- return;
- }
- for (int i=start; i<=end; i++) {
- OS.PtListUnselectPos (handle, i + 1);
- }
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (indices.length == 0) return;
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (index != -1) {
- OS.PtListUnselectPos (handle, index + 1);
- }
- }
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- for (int i=0; i<count; i++) {
- OS.PtListUnselectPos (handle, i + 1);
- }
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * has the focus in the receiver, or -1 if no item is has focus.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getFocusIndex () {
- return getSelectionIndex ();
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- int [] items = new int [1];
- OS.memmove (items, args [4] + (index * 4), 4);
- int length = OS.strlen (items [0]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, items [0], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_TOTAL_HEIGHT, 0, 0,
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_LIST_FONT, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [4] == 0) {
- int ptr = OS.malloc(1);
- PhRect_t rect = new PhRect_t ();
- OS.PfExtentText(rect, null, args [7], ptr, 1);
- OS.free(ptr);
- int inset = 4;
- return inset + (rect.lr_y - rect.ul_y + 1);
- }
- return args [1] / args [4];
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0,
- OS.Pt_ARG_ITEMS, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- int [] items = new int [args [1]];
- OS.memmove (items, args [4], args [1] * 4);
- String [] result = new String [args [1]];
- for (int i=0; i<args [1]; i++) {
- int length = OS.strlen (items [i]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, items [i], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- result [i] = new String (unicode);
- }
- return result;
-
-}
-
-/**
- * Returns an array of <code>String</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public String [] getSelection () {
- checkWidget();
- int [] indices = getSelectionIndices ();
- String [] result = new String [indices.length];
- for (int i=0; i<indices.length; i++) {
- result [i] = getItem (indices [i]);
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_SEL_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_SEL_COUNT, 0, 0,
- OS.Pt_ARG_SELECTION_INDEXES, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return -1;
- short [] buffer = new short [1];
- OS.memmove (buffer, args [4], 2);
- return buffer [0] - 1;
-}
-
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_SEL_COUNT, 0, 0,
- OS.Pt_ARG_SELECTION_INDEXES, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- short [] indices = new short [args [1]];
- OS.memmove (indices, args [4], args [1] * 2);
- int [] result = new int [args [1]];
- for (int i=0; i<args [1]; i++) {
- result [i] = indices [i] - 1;
- }
- return result;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_TOP_ITEM_POS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1] - 1;
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_SELECTION, windowProc, SWT.Selection);
- OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, SWT.DefaultSelection);
-}
-
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget();
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- return OS.PtListItemPos(handle, buffer) - 1;
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- // NOT DONE - start is ignored
- return indexOf (string);
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_SEL_COUNT, 0, 0,
- OS.Pt_ARG_SELECTION_INDEXES, 0, 0,
- };
- OS.PtGetResources (handle, args.length / 3, args);
- short [] buffer = new short [1];
- for (int i=0; i<args [1]; i++) {
- OS.memmove (buffer, args [4] + (i * 2), 2);
- if (buffer [0] == index + 1) return true;
- }
- return false;
-}
-
-int processDefaultSelection (int info) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_END;
- int[] click_count = new int [1];
- OS.memmove(click_count, cbinfo.cbdata, 4);
- if (click_count [0] > 1) postEvent (SWT.DefaultSelection);
- return OS.Pt_CONTINUE;
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtList (), handle, damage);
- return super.processPaint (damage);
-}
-
-int processSelection (int info) {
- postEvent (SWT.Selection);
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) error (SWT.ERROR_INVALID_RANGE);
- int result = OS.PtListDeleteItemPos (handle, 1, index + 1);
- if (result != 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
- remove (index);
-}
-
-/**
- * Removes the items from the receiver at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- for (int i=0; i<newIndices.length; i++ ) {
- int index = newIndices [i];
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- int result = OS.PtListDeleteItemPos (handle, 1, index + 1);
- if (result != 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 < start && start <= end && end < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- int count = end - start + 1;
- int result = OS.PtListDeleteItemPos (handle, count, start + 1);
- if (result != 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- OS.PtListDeleteAllItems (handle);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget();
- if (start > end) return;
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- if ((style & SWT.SINGLE) != 0) {
- int index = Math.min (count - 1, end);
- if (index >= start) select (index);
- return;
- }
- int gotoIndex = -1;
- for (int index=end; index>=start; index--) {
- if (0 <= index && index < count) {
- gotoIndex = index;
- OS.PtListSelectPos (handle, index + 1);
- }
- }
- if (gotoIndex != -1) OS.PtListGotoPos (handle, gotoIndex + 1);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (indices.length == 0) return;
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- int gotoIndex = -1;
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (0 <= index && index < count) {
- gotoIndex = index;
- OS.PtListSelectPos (handle, index + 1);
- }
- }
- if (gotoIndex != -1) OS.PtListGotoPos (handle, gotoIndex + 1);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index < 0) return;
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (index < args [1]) {
- OS.PtListSelectPos (handle, index + 1);
- OS.PtListGotoPos (handle, index + 1);
- }
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return;
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
- for (int i=0; i<count; i++) {
- OS.PtListSelectPos (handle, i + 1);
- }
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] args = new int [] {OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [1])) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- OS.PtListReplaceItemPos (handle, new int [] {ptr}, 1, index + 1);
- OS.free (ptr);
-}
-
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.PtListDeleteAllItems (handle);
- int[] itemsPtr = new int [items.length];
- for (int i=0; i<itemsPtr.length; i++) {
- byte [] buffer = Converter.wcsToMbcs (null, items [i], true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- itemsPtr [i] = ptr;
- }
- OS.PtListAddItems (handle, itemsPtr, itemsPtr.length, 0);
- for (int i=0; i<itemsPtr.length; i++) {
- OS.free (itemsPtr [i]);
- }
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (start, end);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (int index) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (index);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selection is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int[])
- */
-public void setSelection(int[] indices) {
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (indices);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (String [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.MULTI) != 0) deselectAll ();
- for (int i=items.length-1; i>=0; --i) {
- int index = 0;
- String string = items [i];
- if (string != null) {
- while ((index = indexOf (string, index)) != -1) {
- select (index);
- if (((style & SWT.SINGLE) != 0) && isSelected (index)) return;
- index++;
- }
- }
- }
- if ((style & SWT.SINGLE) != 0) deselectAll ();
-}
-
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_TOP_ITEM_POS, index + 1, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- int [] args = new int [] {
- OS.Pt_ARG_LIST_SEL_COUNT, 0, 0,
- OS.Pt_ARG_SELECTION_INDEXES, 0, 0,
- OS.Pt_ARG_TOP_ITEM_POS, 0, 0,
- OS.Pt_ARG_VISIBLE_COUNT, 0, 0,
- OS.Pt_ARG_LIST_ITEM_COUNT, 0, 0
- };
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return;
- short [] buffer = new short [1];
- OS.memmove (buffer, args [4], 2);
- int index = buffer [0] - 1;
- int topIndex = args [7] - 1, visibleCount = args [10], count = args [13];
- int bottomIndex = Math.min (topIndex + visibleCount - 1, count);
- if ((topIndex <= index) && (index <= bottomIndex)) return;
- int lastIndex = Math.max (1, count - visibleCount + 1);
- int newTop = Math.min (Math.max (index - (visibleCount / 2), 1), lastIndex);
- args = new int [] {OS.Pt_ARG_TOP_ITEM_POS, newTop, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-int traversalCode (int key_sym, PhKeyEvent_t ke) {
- int code = super.traversalCode (key_sym, ke);
- if (key_sym == OS.Pk_Up || key_sym == OS.Pk_Down) {
- code &= ~(SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS);
- }
- return code;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java
deleted file mode 100755
index 6d6fad0b07..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java
+++ /dev/null
@@ -1,656 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are user interface objects that contain
- * menu items.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BAR, DROP_DOWN, POP_UP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Help, Hide, Show </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Menu extends Widget {
- int x, y;
- boolean hasLocation;
- Decorations parent;
- MenuItem cascade, defaultItem;
-
-public Menu (Control parent) {
- this (checkNull (parent).getShell (), SWT.POP_UP);
-}
-
-public Menu (Decorations parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-
-public Menu (Menu parentMenu) {
- this (checkNull (parentMenu).parent, SWT.DROP_DOWN);
-}
-
-public Menu (MenuItem parentItem) {
- this (checkNull (parentItem).parent);
-}
-
-static Control checkNull (Control control) {
- if (control == null) error (SWT.ERROR_NULL_ARGUMENT);
- return control;
-}
-
-static Menu checkNull (Menu menu) {
- if (menu == null) error (SWT.ERROR_NULL_ARGUMENT);
- return menu;
-}
-
-static MenuItem checkNull (MenuItem item) {
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>MenuListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #removeMenuListener
- */
-public void addMenuListener (MenuListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Hide,typedListener);
- addListener (SWT.Show,typedListener);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int parentHandle = parent.topHandle ();
- if ((style & SWT.BAR) != 0) {
- int [] args = {
- OS.Pt_ARG_FLAGS, 0, OS.Pt_GETS_FOCUS,
- OS.Pt_ARG_FLAGS, OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
- };
- handle = OS.PtCreateWidget (OS.PtMenuBar (), parentHandle, args.length / 3, args);
- } else {
- handle = OS.PtCreateWidget (OS.PtMenu (), parentHandle, 0, null);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- parent.add (this);
-}
-
-/**
- * Returns the default menu item or null if none has
- * been previously set.
- *
- * @return the default menu item.
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getDefaultItem () {
- checkWidget();
- return defaultItem;
-}
-
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_BLOCKED) == 0;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int count = 0;
- int child = OS.PtWidgetChildBack (handle);
- if (child != 0 && (style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (child != 0) {
- child = OS.PtWidgetBrotherInFront (child);
- count++;
- }
- return count;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getItem (int index) {
- checkWidget();
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- int i = 0;
- int child = OS.PtWidgetChildBack (handle);
- if (child != 0 && (style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (child != 0) {
- Widget widget = WidgetTable.get (child);
- if (widget != null && widget instanceof MenuItem) {
- if (i++ == index) return (MenuItem) widget;
- }
- child = OS.PtWidgetBrotherInFront (child);
- }
- error (SWT.ERROR_INVALID_RANGE);
- return null;
-}
-
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem [] getItems () {
- checkWidget();
- int count = 0;
- int child = OS.PtWidgetChildBack (handle);
- if (child != 0 && (style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (child != 0) {
- child = OS.PtWidgetBrotherInFront (child);
- count++;
- }
- MenuItem [] items = new MenuItem [count];
- int i = 0, j = 0;
- child = OS.PtWidgetChildBack (handle);
- if (child != 0 && (style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (i < count) {
- Widget widget = WidgetTable.get (child);
- if (widget != null && widget instanceof MenuItem) {
- items [j++] = (MenuItem) widget;
- }
- i++;
- child = OS.PtWidgetBrotherInFront (child);
- }
- if (i == j) return items;
- MenuItem [] newItems = new MenuItem [j];
- System.arraycopy (items, 0, newItems, 0, j);
- return newItems;
-}
-
-String getNameText () {
- String result = "";
- MenuItem [] items = getItems ();
- int length = items.length;
- if (length > 0) {
- for (int i=0; i<length-1; i++) {
- result = result + items [i].getNameText() + ", ";
- }
- result = result + items [length-1].getNameText ();
- }
- return result;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Decorations getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getParentItem () {
- checkWidget();
- return cascade;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParentMenu () {
- checkWidget();
- if (cascade != null) return cascade.parent;
- return null;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget();
- return parent.getShell ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return true;
-}
-
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_UNREALIZED, windowProc, SWT.Hide);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (MenuItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int i = 0;
- int child = OS.PtWidgetChildBack (handle);
- if (child != 0 && (style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (child != 0) {
- Widget widget = WidgetTable.get (child);
- if (item == widget) return i;
- if (widget != null && widget instanceof MenuItem) i++;
- child = OS.PtWidgetBrotherInFront (child);
- }
- return -1;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- Menu parentMenu = getParentMenu ();
- if (parentMenu == null) return getEnabled ();
- return getEnabled () && parentMenu.isEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return getVisible ();
-}
-
-int processHide (int info) {
- if (cascade != null) {
- int [] args = {OS.Pt_ARG_MENU_FLAGS, 0, OS.Pt_MENU_CHILD};
- OS.PtSetResources (handle, args.length / 3, args);
- int shellHandle = parent.topHandle ();
- OS.PtReParentWidget (handle, shellHandle);
- }
- sendEvent (SWT.Hide);
- return OS.Pt_CONTINUE;
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (cascade != null) cascade.setMenu (null);
- if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
- parent.setMenuBar (null);
- }
-}
-
-void releaseWidget () {
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- super.releaseWidget ();
- if (parent != null) parent.remove (this);
- parent = null;
- cascade = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the menu events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #addMenuListener
- */
-public void removeMenuListener (MenuListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Hide, listener);
- eventTable.unhook (SWT.Show, listener);
-}
-
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultItem (MenuItem item) {
- checkWidget();
- if (item != null && item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- defaultItem = item;
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the display.
- * <p>
- * Note: This is different from most widgets where the
- * location of the widget is relative to the parent.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- this.x = x; this.y = y;
- hasLocation = true;
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if ((style & SWT.POP_UP) == 0) return;
- if (visible == OS.PtWidgetIsRealized (handle)) return;
- if (visible) {
- PhPoint_t pt = new PhPoint_t ();
- pt.x = (short) x;
- pt.y = (short) y;
- if (!hasLocation) {
- int ig = OS.PhInputGroup (0);
- PhCursorInfo_t info = new PhCursorInfo_t ();
- OS.PhQueryCursor ((short) ig, info);
- pt.x = info.last_press_x;
- pt.y = info.last_press_y;
- }
- int ptr = OS.malloc (PhPoint_t.sizeof);
- OS.memmove (ptr, pt, PhPoint_t.sizeof);
- int [] args = {OS.Pt_ARG_POS, ptr, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
- sendEvent (SWT.Show);
- OS.PtRealizeWidget (handle);
- } else {
- OS.PtUnrealizeWidget(handle);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
deleted file mode 100755
index 8dcf36a546..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
+++ /dev/null
@@ -1,789 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Arm, Help, Selection</dd>
- * </dl>
- *<p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class MenuItem extends Item {
- Menu parent, menu;
- int accelerator;
- boolean enabled = true;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style) {
- this (parent, style, parent.getItemCount());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the arm events are generated for the control, by sending
- * it one of the messages defined in the <code>ArmListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #removeArmListener
- */
-public void addArmListener (ArmListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Arm, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int count = parent.getItemCount();
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- int parentHandle = parent.handle;
- if ((style & SWT.SEPARATOR) != 0) {
- handle = OS.PtCreateWidget (OS.PtSeparator (), parentHandle, 0, null);
- } else if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- int [] args = {
- OS.Pt_ARG_INDICATOR_TYPE, (style & SWT.CHECK) != 0 ? OS.Pt_N_OF_MANY : OS.Pt_ONE_OF_MANY, 0
- };
- handle = OS.PtCreateWidget (OS.PtToggleButton (), parentHandle, args.length / 3, args);
- } else {
- handle = OS.PtCreateWidget (OS.PtMenuButton (), parentHandle, 0, null);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if (index != count) {
- int i = 0;
- int child = OS.PtWidgetChildBack (parentHandle);
- /*
- * Feature in Photon. Menu bars have an extra widget which
- * is the parent of all menu items. PtValidParent() can not be
- * used, since it does not return that widget.
- */
- if (child != 0 && (parent.style & SWT.BAR) != 0) child = OS.PtWidgetChildBack (child);
- while (i != index && child != 0) {
- child = OS.PtWidgetBrotherInFront (child);
- i++;
- }
- OS.PtWidgetInsert (topHandle (), child, 1);
- }
- if (OS.PtWidgetIsRealized (parentHandle)) {
- OS.PtRealizeWidget (topHandle ());
- }
-}
-
-/**
- * Return the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @return the accelerator
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAccelerator () {
- checkWidget();
- return accelerator;
-}
-
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- /*
- * Bug in Photon. The Pt_BLOCKED flag of a menu item is cleared
- * when its parent menu is realized. The fix is to remember
- * the menu item state and reset it when the menu item is
- * realized.
- */
-// int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
-// OS.PtGetResources (handle, args.length / 3, args);
-// return (args [1] & OS.Pt_BLOCKED) == 0;
- return enabled;
-}
-
-/**
- * Returns the receiver's cascade menu if it has one or null
- * if it does not. Only <code>CASCADE</code> menu items can have
- * a pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget();
- return menu;
-}
-
-String getNameText () {
- if ((style & SWT.SEPARATOR) != 0) return "|";
- return super.getNameText ();
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_SET) != 0;
-}
-
-void hookEvents () {
- if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = getDisplay ().windowProc;
- if ((style & SWT.CASCADE) != 0) {
- OS.PtAddCallback (handle, OS.Pt_CB_ARM, windowProc, SWT.Arm);
- }
- OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
- if ((parent.style & SWT.BAR) == 0) {
- OS.PtAddCallback (handle, OS.Pt_CB_REALIZED, windowProc, SWT.Show);
- }
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- return getEnabled () && parent.isEnabled ();
-}
-
-int processActivate (int info) {
- showMenu ();
- return OS.Pt_CONTINUE;
-}
-
-int processSelection (int info) {
- if ((style & SWT.CASCADE) != 0) {
- int [] args = {OS.Pt_ARG_BUTTON_TYPE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if ((args [1] & (OS.Pt_MENU_RIGHT | OS.Pt_MENU_DOWN)) != 0) {
- return OS.Pt_CONTINUE;
- }
- }
- Event event = new Event ();
- if (info != 0) {
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event != 0) {
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- int data = OS.PhGetData (cbinfo.event);
- if (data != 0) {
- switch (ev.type) {
- case OS.Ph_EV_KEY:
- PhKeyEvent_t ke = new PhKeyEvent_t ();
- OS.memmove (ke, data, PhKeyEvent_t.sizeof);
- setKeyState (event, ke);
- break;
- case OS.Ph_EV_BUT_PRESS:
- case OS.Ph_EV_BUT_RELEASE:
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- setMouseState (ev.type, event, pe);
- break;
- }
- }
- }
- }
- postEvent (SWT.Selection, event);
- return OS.Pt_CONTINUE;
-}
-
-int processShow (int info) {
- /*
- * Bug in Photon. The Pt_BLOCKED flag of a menu item is cleared
- * when its parent menu is realized. The fix is to remember
- * the menu item state and reset it when the menu item is
- * realized.
- */
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- return OS.Pt_CONTINUE;
-}
-
-int processArm(int info) {
- postEvent (SWT.Arm);
- showMenu ();
- return OS.Pt_CONTINUE;
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (menu != null) menu.dispose ();
- menu = null;
-}
-
-void releaseWidget () {
- if (menu != null && !menu.isDisposed ()) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- menu = null;
- super.releaseWidget ();
- if (accelerator != 0) removeAccelerator ();
- accelerator = 0;
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the arm events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #addArmListener
- */
-public void removeArmListener (ArmListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Arm, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-void removeAccelerator () {
- if (accelerator == 0) return;
-
- int keyMods = 0;
- if ((accelerator & SWT.ALT) != 0) keyMods |= OS.Pk_KM_Alt;
- if ((accelerator & SWT.SHIFT) != 0) keyMods |= OS.Pk_KM_Shift;
- if ((accelerator & SWT.CONTROL) != 0) keyMods |= OS.Pk_KM_Ctrl;
- int key = (accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CONTROL));
- Display display = getDisplay ();
- int keyCode = display.untranslateKey (key);
- if (keyCode != 0) key = keyCode;
- else key = Character.toLowerCase ((char)key);
- Shell shell = parent.getShell ();
- OS.PtRemoveHotkeyHandler(shell.shellHandle, key, keyMods, (short)0, handle, display.hotkeyProc);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @param accelerator an integer that is the bit-wise OR of masks and a key
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAccelerator (int accelerator) {
- checkWidget();
- removeAccelerator ();
-
- this.accelerator = accelerator;
- if (accelerator == 0) return;
-
- int keyMods = 0;
- if ((accelerator & SWT.ALT) != 0) keyMods |= OS.Pk_KM_Alt;
- if ((accelerator & SWT.SHIFT) != 0) keyMods |= OS.Pk_KM_Shift;
- if ((accelerator & SWT.CONTROL) != 0) keyMods |= OS.Pk_KM_Ctrl;
- int key = (accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CONTROL));
- Display display = getDisplay ();
- int keyCode = display.untranslateKey (key);
- if (keyCode != 0) key = keyCode;
- else key = Character.toLowerCase ((char)key);
- Shell shell = parent.getShell ();
- OS.PtAddHotkeyHandler(shell.shellHandle, key, keyMods, (short)0, handle, display.hotkeyProc);
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- this.enabled = enabled;
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-public void setImage (Image image) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setImage (image);
-
- //NOT DONE - The OS has support
-}
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget();
- if ((style & SWT.CASCADE) == 0) {
- error (SWT.ERROR_MENUITEM_NOT_CASCADE);
- }
- if (menu != null) {
- if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.DROP_DOWN) == 0) {
- error (SWT.ERROR_MENU_NOT_DROP_DOWN);
- }
- if (menu.parent != parent.parent) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
- Menu oldMenu = this.menu;
- if (oldMenu == menu) return;
- this.menu = menu;
- if (oldMenu != null) {
- oldMenu.cascade = null;
- if ((parent.style & SWT.BAR) == 0) {
- int [] args = {OS.Pt_ARG_BUTTON_TYPE, OS.Pt_MENU_TEXT, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
- }
- if (menu != null) {
- menu.cascade = this;
- if ((parent.style & SWT.BAR) == 0) {
- int [] args = {OS.Pt_ARG_BUTTON_TYPE, OS.Pt_MENU_RIGHT, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
- }
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int [] args = {OS.Pt_ARG_FLAGS, selected ? OS.Pt_SET : 0, OS.Pt_SET};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
- boolean accel = false;
- int i=0, j=0;
- char mnemonic=0;
- while (i < text.length) {
- if (text [i] == '\t') {accel = true; break;};
- if ((text [j++] = text [i++]) == Mnemonic) {
- if (i == text.length) {continue;}
- if (text [i] == Mnemonic) {i++; continue;}
- if (mnemonic == 0) mnemonic = text [i];
- j--;
- }
- }
- int keyMods = 0;
- byte [] buffer2 = new byte [1];
- if (accel && ++i < text.length) {
- int start = i;
-// while (i < text.length) {
-// if (text [i] == '+') {
-// String str = new String (text, start, i - start);
-// if (str.equals ("Ctrl")) keyMods |= OS.Pk_KM_Ctrl;
-// if (str.equals ("Shift")) keyMods |= OS.Pk_KM_Shift;
-// if (str.equals ("Alt")) keyMods |= OS.Pk_KM_Alt;
-// start = i + 1;
-// }
-// i++;
-// }
- if (start < text.length) {
- char [] accelText = new char [text.length - start];
- System.arraycopy (text, start, accelText, 0, accelText.length);
- buffer2 = Converter.wcsToMbcs (null, accelText, true);
- }
- }
- while (j < text.length) text [j++] = 0;
- byte [] buffer1 = Converter.wcsToMbcs (null, text, true);
- int ptr1 = OS.malloc (buffer1.length);
- OS.memmove (ptr1, buffer1, buffer1.length);
- int ptr2 = OS.malloc (buffer2.length);
- OS.memmove (ptr2, buffer2, buffer2.length);
- int ptr3 = 0;
- if (mnemonic != 0) {
- byte [] buffer3 = Converter.wcsToMbcs (null, new char []{mnemonic}, true);
- ptr3 = OS.malloc (buffer3.length);
- OS.memmove (ptr3, buffer3, buffer3.length);
- }
- if ((parent.style & SWT.BAR) != 0) {
- replaceMnemonic (mnemonic, false, true);
- }
- int [] args = {
- OS.Pt_ARG_TEXT_STRING, ptr1, 0,
- OS.Pt_ARG_ACCEL_TEXT, ptr2, 0,
- OS.Pt_ARG_MODIFIER_KEYS, keyMods, keyMods,
- OS.Pt_ARG_ACCEL_KEY, ptr3, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr1);
- OS.free (ptr2);
- OS.free (ptr3);
- /*
- * Bug on Photon. When a the text is set on a menu
- * item that is realized, the menu item does not resize
- * to show the new text. The fix is to force the item
- * to recalculate the size.
- */
- if (OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
-}
-
-void showMenu() {
- if (menu == null) return;
- int menuHandle = menu.handle;
- if (!OS.PtWidgetIsRealized (menuHandle)) {
- if ((parent.style & SWT.BAR) == 0) {
- int [] args = {OS.Pt_ARG_MENU_FLAGS, OS.Pt_MENU_CHILD, OS.Pt_MENU_CHILD};
- OS.PtSetResources (menuHandle, args.length / 3, args);
- }
- OS.PtReParentWidget (menuHandle, handle);
-
- /*
- * Bug in Photon. PtPositionMenu does not position the menu
- * properly when the menu is a direct child a menu bar item.
- * The fix is to position the menu ourselfs.
- */
- if ((parent.style & SWT.BAR) != 0) {
- PhPoint_t pt = new PhPoint_t ();
- short [] x = new short [1], y = new short [1];
- OS.PtGetAbsPosition (handle, x, y);
- pt.x = x [0];
- pt.y = y [0];
- int [] args = {OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- pt.y += args [1];
- int ptr = OS.malloc (PhPoint_t.sizeof);
- OS.memmove (ptr, pt, PhPoint_t.sizeof);
- args = new int [] {OS.Pt_ARG_POS, ptr, 0};
- OS.PtSetResources (menuHandle, args.length / 3, args);
- OS.free (ptr);
- } else {
- OS.PtPositionMenu (menuHandle, null);
- }
-
- menu.sendEvent (SWT.Show);
- OS.PtRealizeWidget (menuHandle);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java
deleted file mode 100755
index 5ee7e571ba..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class are used used to inform or warn the user.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
- * <dd>OK, OK | CANCEL</dd>
- * <dd>YES | NO, YES | NO | CANCEL</dd>
- * <dd>RETRY | CANCEL</dd>
- * <dd>ABORT | RETRY | IGNORE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class MessageBox extends Dialog {
- String message = "";
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent, int style) {
- super (parent, checkStyle (style));
- checkSubclass ();
-}
-static int checkStyle (int style) {
- if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) == 0) style |= SWT.APPLICATION_MODAL;
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public int open () {
- String[] buttons = null;
- if ((style & SWT.OK) == SWT.OK) buttons = new String[]{"&Ok"};
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) buttons = new String[]{"&Ok", "&Cancel"};
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) buttons = new String[]{"&Yes", "&No"};
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) buttons = new String[]{"&Yes", "&No", "&Cancel"};
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) buttons = new String[]{"&Retry", "&Cancel"};
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) buttons = new String[]{"&Abort", "&Retry", "&Ignore"};
- if (buttons == null) buttons = new String[]{"&Ok"};
-
- int phImage = 0;
-// int iconBits = 0;
-// if ((style & SWT.ICON_ERROR) != 0) iconBits = OS.MB_ICONERROR;
-// if ((style & SWT.ICON_INFORMATION) != 0) iconBits = OS.MB_ICONINFORMATION;
-// if ((style & SWT.ICON_QUESTION) != 0) iconBits = OS.MB_ICONQUESTION;
-// if ((style & SWT.ICON_WARNING) != 0) iconBits = OS.MB_ICONWARNING;
-// if ((style & SWT.ICON_WORKING) != 0) iconBits = OS.MB_ICONINFORMATION;
-
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.shellHandle;
-
- byte [] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
- byte [] message = null;
- if (this.message != null) message = Converter.wcsToMbcs (null, this.message, true);
-
- int[] buttonsPtr = new int [buttons.length];
- for (int i=0; i<buttons.length; i++) {
- byte[] text = Converter.wcsToMbcs (null, buttons [i], true);
- int textPtr = OS.malloc (text.length);
- OS.memmove (textPtr, text, text.length);
- buttonsPtr [i] = textPtr;
- }
-
- int button = OS.PtAlert (parentHandle, null, title, phImage, message, null, buttons.length, buttonsPtr, null, 0, buttons.length, OS.Pt_MODAL);
-
- for (int i=0; i<buttons.length; i++) {
- OS.free (buttonsPtr [i]);
- }
-
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
- if (button == 1) return SWT.ABORT;
- if (button == 2) return SWT.RETRY;
- return SWT.IGNORE;
- }
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- return (button == 1) ? SWT.RETRY : SWT.CANCEL;
- }
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
- if (button == 1) return SWT.YES;
- if (button == 2) return SWT.NO;
- return SWT.CANCEL;
- }
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- return (button == 1) ? SWT.YES : SWT.NO;
- }
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
- return (button == 1) ? SWT.OK : SWT.CANCEL;
- }
- if ((style & SWT.OK) == SWT.OK && button == 1) return SWT.OK;
- return SWT.CANCEL;
-}
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
deleted file mode 100755
index 900c5a5e06..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent is an unselectable
- * user interface object that is used to display progress,
- * typically in the form of a bar.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ProgressBar extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ProgressBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-/*
-* Not done - check Windows
-*/
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = wHint, height = hHint;
- if ((style & SWT.HORIZONTAL) != 0) {
- if (width == SWT.DEFAULT) {
- width = 64;
-// width = getMaximum() - getMinimum() + 1;
- }
- if (height == SWT.DEFAULT) height = 15;
- } else {
- if (height == SWT.DEFAULT) {
- height = 64;
-// height = getMaximum() - getMinimum() + 1;
- }
- if (width == SWT.DEFAULT) width = 15;
- }
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (width - 1);
- rect.lr_y = (short) (height - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- width = area.size_w;
- height = area.size_h;
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtProgress;
- int parentHandle = parent.handle;
- int [] args = {
-// OS.Pt_ARG_GAUGE_FLAGS, OS.Pt_GAUGE_LIVE, OS.Pt_GAUGE_LIVE,
- OS.Pt_ARG_ORIENTATION, (style & SWT.HORIZONTAL) != 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtProgress (), handle, damage);
- return super.processPaint (damage);
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] args = {OS.Pt_ARG_GAUGE_VALUE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- int minimum = getMinimum();
- if (0 <= minimum && minimum < value) {
- int [] args = {OS.Pt_ARG_MAXIMUM, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- int maximum = getMaximum();
- if (0 <= value && value < maximum) {
- int [] args = {OS.Pt_ARG_MINIMUM, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- if (value < 0) return;
- int [] args = {OS.Pt_ARG_GAUGE_VALUE, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
deleted file mode 100755
index dad7d18af5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user interface object
- * that allows the user to drag a rubber banded outline of the sash within
- * the parent control.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Sash extends Control {
- boolean dragging;
- int startX, startY, lastX, lastY;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Sash (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
- * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtContainer;
- int parentHandle = parent.handle;
- int cursor = ((style & SWT.HORIZONTAL) != 0) ? OS.Ph_CURSOR_DRAG_VERTICAL : OS.Ph_CURSOR_DRAG_HORIZONTAL;
- int [] args = {
- OS.Pt_ARG_CURSOR_TYPE, cursor, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void drawBand (int x, int y, int width, int height) {
- if (parent == null) return;
- if (parent.isDisposed ()) return;
- int parentHandle = parent.handle;
- if (!OS.PtWidgetIsRealized (parentHandle)) return;
- int phGC = OS.PgCreateGC (0); // NOTE: PgCreateGC ignores the parameter
- if (phGC == 0) return;
- int [] args = {OS.Pt_ARG_COLOR, 0, 0, OS.Pt_ARG_FILL_COLOR, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int foreground = args [1];
- int background = args [4];
- int color = foreground ^ ~background;
- int prevContext = OS.PgSetGC (phGC);
- OS.PgSetRegion (OS.PtWidgetRid (parentHandle));
- OS.PgSetDrawMode (OS.Pg_DRAWMODE_XOR);
- OS.PgSetFillColor (color);
- OS.PgDrawIRect (x, y, x + width - 1, y + height - 1, OS.Pg_DRAW_FILL);
- OS.PgSetGC (prevContext);
- OS.PgDestroyGC (phGC);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddEventHandler (handle, OS.Ph_EV_DRAG, windowProc, SWT.MouseMove);
-}
-
-int processMouse (int info) {
- int result = super.processMouse (info);
-
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- int data = OS.PhGetData (cbinfo.event);
- if (data == 0) return OS.Pt_END;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- if (pe.buttons != OS.Ph_BUTTON_SELECT) return result;
-
- int x = pe.pos_x + ev.translation_x;
- int y = pe.pos_y + ev.translation_y;
- PhArea_t area = new PhArea_t();
- OS.PtWidgetArea (handle, area);
- Event event = new Event ();
- int width = event.width = area.size_w;
- int height = event.height = area.size_h;
- switch (ev.type) {
- case OS.Ph_EV_BUT_PRESS:
- PhRect_t rect = new PhRect_t ();
- PhPoint_t pos = new PhPoint_t();
- pos.x = pe.pos_x;
- pos.y = pe.pos_y;
- rect.ul_x = rect.lr_x = (short) (pos.x + ev.translation_x);
- rect.ul_y = rect.lr_y = (short) (pos.y + ev.translation_y);
- int rid = OS.PtWidgetRid (handle);
-// int input_group = OS.PhInputGroup (cbinfo.event);
- int input_group = OS.PhInputGroup (0);
- OS.PhInitDrag (rid, OS.Ph_DRAG_KEY_MOTION | OS.Ph_DRAG_TRACK | OS.Ph_TRACK_DRAG, rect, null, input_group, null, null, null, pos, null);
-
- /* Compute the banding rectangle */
- startX = x;
- startY = y;
- lastX = area.pos_x;
- lastY = area.pos_y;
-
- /* The event must be sent because doit flag is used */
- event.x = lastX; event.y = lastY;
- event.detail = SWT.DRAG;
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the selection
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Selection, event);
- if (isDisposed ()) return OS.Pt_END;
-
- /* Draw the banding rectangle */
- if (event.doit) {
- dragging = true;
- menuShell ().bringToTop ();
- OS.PtFlush ();
- drawBand (lastX = event.x, lastY = event.y, width, height);
- }
- break;
- case OS.Ph_EV_BUT_RELEASE:
- if (ev.subtype != OS.Ph_EV_RELEASE_PHANTOM) {
- return result;
- }
- /* Compute the banding rectangle */
- if (!dragging) return result;
- dragging = false;
-
- /* The event must be sent because doit flag is used */
- event.x = lastX; event.y = lastY;
- drawBand (lastX, lastY, width, height);
- sendEvent (SWT.Selection, event);
- // widget could be disposed at this point
- break;
- case OS.Ph_EV_PTR_MOTION_BUTTON:
- case OS.Ph_EV_PTR_MOTION_NOBUTTON:
- case OS.Ph_EV_DRAG:
- if (ev.subtype != OS.Ph_EV_DRAG_MOTION_EVENT) {
- return result;
- }
- if (!dragging) return result;
-
- /* Compute the banding rectangle */
- x += area.pos_x;
- y += area.pos_y;
- Rectangle r = parent.getClientArea ();
- int clientWidth = r.width;
- int clientHeight = r.height;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- newX = Math.min (Math.max (0, x - startX), clientWidth - width);
- } else {
- newY = Math.min (Math.max (0, y - startY), clientHeight - height);
- }
- if ((newX == lastX) && (newY == lastY)) return result;
- drawBand (lastX, lastY, width, height);
-
- /* The event must be sent because doit flag is used */
- event.x = newX; event.y = newY;
- event.detail = SWT.DRAG;
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the selection
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Selection, event);
- if (isDisposed ()) return OS.Pt_END;
-
- /* Draw the banding rectangle */
- if (event.doit) {
- lastX = event.x; lastY = event.y;
- OS.PtFlush ();
- drawBand (lastX, lastY, width, height);
- }
- break;
- }
- return result;
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtContainer (), handle, damage);
- sendPaintEvent (damage);
- return OS.Pt_CONTINUE;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
deleted file mode 100755
index 4d2396fd2a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
+++ /dev/null
@@ -1,351 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user
- * interface object that present a range of continuous
- * numeric values.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Scale extends Control {
-
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scale (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = dim.w * 7; int height = dim.h;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) width = area.size_w;
- if (hHint != SWT.DEFAULT) height = area.size_h;
- }
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtSlider;
- int parentHandle = parent.handle;
- int [] args = {
- OS.Pt_ARG_MAXIMUM, 100, 0,
- OS.Pt_ARG_PAGE_INCREMENT, 10, 0,
- OS.Pt_ARG_SLIDER_SIZE, 10, 0,
- OS.Pt_ARG_ORIENTATION, (style & SWT.HORIZONTAL) != 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL, 0,
- OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_SLIDER_MOVE, windowProc, SWT.Selection);
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtSlider (), handle, damage);
- return super.processPaint (damage);
-}
-
-int processSelection (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- sendEvent(SWT.Selection);
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, value - 1, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java
deleted file mode 100755
index 42d693ce5d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java
+++ /dev/null
@@ -1,690 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given scroll bar will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the scroll bar represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, scroll bars will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, scroll bars are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the scroll bar's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the scroll bar will not change.
- * </p><p>
- * Scroll bars are created by specifying either <code>H_SCROLL</code>,
- * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
- * They are accessed from the <code>Scrollable</code> using
- * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
- * </p><p>
- * Note: Scroll bars are not Controls. On some platforms, scroll bars
- * that appear as part of some standard controls such as a text or list
- * have no operating system resources and are not children of the control.
- * For this reason, scroll bars are treated specially. To create a control
- * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see Slider
- * @see Scrollable
- * @see Scrollable#getHorizontalBar
- * @see Scrollable#getVerticalBar
- */
-public class ScrollBar extends Widget {
- Scrollable parent;
-
-ScrollBar (Scrollable parent, int style, int handle) {
- super (parent, checkStyle (style));
- this.parent = parent;
- this.handle = handle;
- state |= HANDLE;
- createWidget (0);
-}
-
-ScrollBar (Scrollable parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget (0);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- if (handle != 0) return;
- Display display = getDisplay ();
- int parentHandle = parent.scrolledHandle;
- int orientation, sizeArg, size, basicFlags;
- if ((style & SWT.HORIZONTAL) != 0) {
- orientation = OS.Pt_HORIZONTAL;
- sizeArg = OS.Pt_ARG_HEIGHT;
- size = display.SCROLLBAR_HEIGHT;
- basicFlags = display.SCROLLBAR_HORIZONTAL_BASIC_FLAGS;
- } else {
- orientation = OS.Pt_VERTICAL;
- sizeArg = OS.Pt_ARG_WIDTH;
- size = display.SCROLLBAR_WIDTH;
- basicFlags = display.SCROLLBAR_VERTICAL_BASIC_FLAGS;
- }
- int [] args = {
- sizeArg, size, 0,
- OS.Pt_ARG_MAXIMUM, 100, 0,
- OS.Pt_ARG_PAGE_INCREMENT, 10, 0,
- OS.Pt_ARG_SLIDER_SIZE, 10, 0,
- OS.Pt_ARG_BASIC_FLAGS, basicFlags, ~0,
- OS.Pt_ARG_ORIENTATION, orientation, 0,
- OS.Pt_ARG_FLAGS, 0, OS.Pt_GETS_FOCUS,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (OS.PtScrollbar (), parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_BLOCKED) == 0;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the receiver's parent, which must be scrollable.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Scrollable getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * For horizontal scroll bars, returns the height of the
- * instance, and for vertical scroll bars, returns the width
- * of the instance.
- *
- * @return the scroll bar size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return new Point (args [1], args [4]);
-}
-
-/**
- * Answers the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public int getThumb () {
- checkWidget();
- int [] args = {OS.Pt_ARG_SLIDER_SIZE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- int topHandle = topHandle ();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (topHandle, args.length / 3, args);
- return (args [1] & OS.Pt_DELAY_REALIZE) == 0;
-}
-
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_SCROLL_MOVE, windowProc, SWT.Selection);
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * <p>
- * Note: Because of the strong connection between a scroll bar
- * and the widget which contains it (its parent), a scroll bar
- * will not indicate that it is enabled if its parent is not.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return OS.PtWidgetIsRealized (handle);
-}
-
-int processSelection (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_CONTINUE;
- PtScrollbarCallback_t cb = new PtScrollbarCallback_t ();
- OS.memmove (cb, cbinfo.cbdata, PtScrollbarCallback_t.sizeof);
- Event event = new Event ();
- switch (cb.action) {
- case OS.Pt_SCROLL_DRAGGED:
- event.detail = SWT.DRAG;
- break;
- case OS.Pt_SCROLL_TO_MIN:
- event.detail = SWT.HOME;
- break;
- case OS.Pt_SCROLL_TO_MAX:
- event.detail = SWT.END;
- break;
- case OS.Pt_SCROLL_INCREMENT:
- event.detail = SWT.ARROW_DOWN;
- break;
- case OS.Pt_SCROLL_DECREMENT :
- event.detail = SWT.ARROW_UP;
- break;
- case OS.Pt_SCROLL_PAGE_DECREMENT:
- event.detail = SWT.PAGE_UP;
- break;
- case OS.Pt_SCROLL_PAGE_INCREMENT:
- event.detail = SWT.PAGE_DOWN;
- break;
- }
- sendEvent(SWT.Selection, event);
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-void setBounds (int x, int y, int width, int height) {
- PhArea_t area = new PhArea_t ();
- area.pos_x = (short) x;
- area.pos_y = (short) y;
- area.size_w = (short) (Math.max (width, 0));
- area.size_h = (short) (Math.max (height, 0));
- int ptr = OS.malloc (PhArea_t.sizeof);
- OS.memmove (ptr, area, PhArea_t.sizeof);
- int [] args = {OS.Pt_ARG_AREA, ptr, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, value - 1, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_SLIDER_SIZE, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int [] args = {
- OS.Pt_ARG_SCROLL_POSITION, selection, 0,
- OS.Pt_ARG_INCREMENT, increment, 0,
- OS.Pt_ARG_PAGE_INCREMENT, pageIncrement, 0,
- OS.Pt_ARG_SLIDER_SIZE, thumb, 0,
- OS.Pt_ARG_MINIMUM, minimum, 0,
- OS.Pt_ARG_MAXIMUM, maximum - 1, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible == OS.PtWidgetIsRealized (handle)) return;
- int [] args = {
- OS.Pt_ARG_FLAGS, visible ? 0 : OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
- };
- OS.PtSetResources (handle, args.length / 3, args);
- if (visible) {
- sendEvent (SWT.Show);
- OS.PtRealizeWidget (handle);
- parent.resizeClientArea ();
- } else {
- OS.PtUnrealizeWidget (handle);
- parent.resizeClientArea ();
- sendEvent(SWT.Hide);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java
deleted file mode 100755
index a69c07d7bc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all classes which
- * represent controls that have standard scroll bars.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>H_SCROLL, V_SCROLL</dd>
- * <dt><b>Events:</b>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public abstract class Scrollable extends Control {
- int scrolledHandle;
- ScrollBar horizontalBar, verticalBar;
-
-Scrollable () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scrollable (Composite parent, int style) {
- super (parent, style);
-}
-
-void createStandardScrollBars () {
- /* Search the handle to find the scroll bars */
- int child = OS.PtWidgetChildFront (handle);
- while (child != 0) {
- if (OS.PtWidgetClass (child) == OS.PtScrollbar ()) {
- int [] args = {OS.Pt_ARG_ORIENTATION, 0, 0};
- OS.PtGetResources (child, args.length / 3, args);
- switch (args [1]) {
- case OS.Pt_HORIZONTAL:
- horizontalBar = new ScrollBar (this, SWT.HORIZONTAL, child);
- break;
- case OS.Pt_VERTICAL:
- verticalBar = new ScrollBar (this, SWT.VERTICAL, child);
- break;
- }
- }
- child = OS.PtWidgetBrotherBehind (child);
- }
-}
-
-void deregister () {
- super.deregister ();
- if (scrolledHandle != 0) WidgetTable.remove (scrolledHandle);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getClientArea
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.ul_x = (short) x;
- rect.ul_y = (short) y;
- rect.lr_x = (short) (x + width - 1);
- rect.lr_y = (short) (y + height - 1);
- OS.PtSetAreaFromWidgetCanvas (scrolledHandle != 0 ? scrolledHandle : handle, rect, area);
- if (horizontalBar != null && horizontalBar.getVisible ()) {
- Point size = horizontalBar.getSize ();
- area.size_h += size.y;
- }
- if (verticalBar != null && verticalBar.getVisible ()) {
- Point size = verticalBar.getSize ();
- area.size_w += size.x;
- }
- return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data (that is,
- * not covered by the "trimmings").
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeTrim
- */
-public Rectangle getClientArea () {
- checkWidget();
- PhRect_t rect = new PhRect_t ();
- int vParent = OS.PtValidParent (handle, OS.PtContainer ());
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtCalcCanvas (vParent, rect);
- int width = rect.lr_x - rect.ul_x + 1;
- int height = rect.lr_y - rect.ul_y + 1;
- return new Rectangle (0, 0, width, height);
-}
-
-/**
- * Returns the receiver's horizontal scroll bar if it has
- * one, and null if it does not.
- *
- * @return the horizontal scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getHorizontalBar () {
- checkWidget();
- return horizontalBar;
-}
-
-/**
- * Returns the receiver's vertical scroll bar if it has
- * one, and null if it does not.
- *
- * @return the vertical scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getVerticalBar () {
- checkWidget();
- return verticalBar;
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- scrolledHandle = 0;
-}
-
-void resizeClientArea () {
- /* Do nothing */
-}
-
-void releaseWidget () {
- if (horizontalBar != null) {
- horizontalBar.releaseWidget ();
- horizontalBar.releaseHandle ();
- }
- if (verticalBar != null) {
- verticalBar.releaseWidget ();
- verticalBar.releaseHandle ();
- }
- horizontalBar = verticalBar = null;
- super.releaseWidget ();
-}
-
-void register () {
- super.register ();
- if (scrolledHandle != 0) WidgetTable.put (scrolledHandle, this);
-}
-
-int topHandle () {
- if (scrolledHandle == 0) return handle;
- return scrolledHandle;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java
deleted file mode 100755
index d2bd70750a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java
+++ /dev/null
@@ -1,919 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent the "windows"
- * which the desktop or "window manager" is managing.
- * Instances that do not have a parent (that is, they
- * are built using the constructor, which takes a
- * <code>Display</code> as the argument) are described
- * as <em>top level</em> shells. Instances that do have
- * a parent are described as <em>secondary</em> or
- * <em>dialog</em> shells.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations
- * and modality. For example, some window managers only
- * support resizable windows and will always assume the
- * RESIZE style, even if it is not set. In addition, if a
- * modality style is not supported, it is "upgraded" to a
- * more restrictive modality style that is supported. For
- * example, if <code>PRIMARY_MODAL</code> is not supported,
- * it would be upgraded to <code>APPLICATION_MODAL</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * </p>
- * <p>
- * IMPORTANT: This class is not intended to be subclassed.
- * </p>
- *
- * @see Decorations
- * @see SWT
- */
-public class Shell extends Decorations {
- int shellHandle;
- Display display;
- int blockedList;
- Control lastFocus;
-
-/**
- * Constructs a new instance of this class. This is equivalent
- * to calling <code>Shell((Display) null)</code>.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell () {
- this ((Display) null);
-}
-
-/**
- * Constructs a new instance of this class given only the style
- * value describing its behavior and appearance. This is equivalent
- * to calling <code>Shell((Display) null, style)</code>.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (int style) {
- this ((Display) null, style);
-}
-
-/**
- * Constructs a new instance of this class given only the display
- * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display) {
- this (display, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE);
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display, int style) {
- this (display, null, style, 0);
-}
-
-Shell (Display display, Shell parent, int style, int handle) {
- super ();
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.parent = parent;
- this.display = display;
- this.handle = handle;
- createWidget (0);
-}
-
-/**
- * Constructs a new instance of this class given only its
- * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent) {
- this (parent, SWT.TITLE | SWT.CLOSE | SWT.BORDER);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent, int style) {
- this (parent != null ? parent.getDisplay () : null, parent, style, 0);
-}
-
-public static Shell photon_new (Display display, int handle) {
- return new Shell (display, null, SWT.NO_TRIM, handle);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when operations are performed on the receiver,
- * by sending the listener one of the messages defined in the
- * <code>ShellListener</code> interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #removeShellListener
- */
-public void addShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Close,typedListener);
- addListener (SWT.Iconify,typedListener);
- addListener (SWT.Deiconify,typedListener);
- addListener (SWT.Activate, typedListener);
- addListener (SWT.Deactivate, typedListener);
-}
-
-void bringToTop () {
- OS.PtWidgetToFront (shellHandle);
-}
-
-static int checkStyle (int style) {
- style = Decorations.checkStyle (style);
- int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
- int bits = style & ~mask;
- if ((style & SWT.SYSTEM_MODAL) != 0) return bits | SWT.SYSTEM_MODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) return bits | SWT.APPLICATION_MODAL;
- if ((style & SWT.PRIMARY_MODAL) != 0) return bits | SWT.PRIMARY_MODAL;
- return bits;
-}
-
-void closeWidget () {
- Event event = new Event ();
- event.time = (int) System.currentTimeMillis ();
- sendEvent (SWT.Close, event);
- if (event.doit && !isDisposed ()) dispose ();
-}
-
-/**
- * Requests that the window manager close the receiver in
- * the same way it would be closed when the user clicks on
- * the "close box" or performs some other platform specific
- * key or mouse combination that indicates the window
- * should be removed.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget();
- closeWidget ();
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- int [] args = {OS.Pt_ARG_WINDOW_RENDER_FLAGS, 0, 0};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- int flags = args [1];
- int [] left = new int [1], top = new int [1];
- int [] right = new int [1], bottom = new int [1];
- OS.PtFrameSize (flags, 0, left, top, right, bottom);
- int trimX = x - left [0];
- int trimY = y - top [0];
- int trimWidth = width + left [0] + right [0];
- int trimHeight = height + top [0] + bottom [0];
- if (menuBar != null) {
- PhDim_t dim = new PhDim_t ();
- int menuHandle = menuBar.handle;
- if (!OS.PtWidgetIsRealized (menuHandle)) {
- OS.PtExtentWidgetFamily (menuHandle);
- }
- OS.PtWidgetPreferredSize (menuHandle, dim);
- trimHeight += dim.h;
- trimY -= dim.h;
- }
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-
-void createHandle (int index) {
- state |= HANDLE | CANVAS;
- if (handle != 0) {
- int clazz = display.PtContainer;
- int [] args = {
- OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- shellHandle = OS.PtCreateWidget (clazz, handle, args.length / 3, args);
- if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES);
- } else {
- int parentHandle = 0;
- if (parent != null) parentHandle = parent.topHandle ();
- PhRect_t rect = new PhRect_t ();
- OS.PhWindowQueryVisible (OS.Ph_QUERY_GRAPHICS, 0, 1, rect);
- int width = (short) ((rect.lr_x - rect.ul_x + 1) * 5 / 8);
- int height = (short) ((rect.lr_y - rect.ul_y + 1) * 5 / 8);
- int decorations = 0;
- int flags =
- OS.Ph_WM_RENDER_MIN | OS.Ph_WM_RENDER_MAX | OS.Ph_WM_RENDER_RESIZE |
- OS.Ph_WM_RENDER_BORDER | OS.Ph_WM_RENDER_MENU | OS.Ph_WM_RENDER_MIN |
- OS.Ph_WM_RENDER_TITLE;
- if ((style & SWT.NO_TRIM) == 0) {
- if ((style & SWT.MIN) != 0) decorations |= OS.Ph_WM_RENDER_MIN;
- if ((style & SWT.MAX) != 0) decorations |= OS.Ph_WM_RENDER_MAX;
- if ((style & SWT.RESIZE) != 0) {
- decorations |= OS.Ph_WM_RENDER_BORDER | OS.Ph_WM_RENDER_RESIZE;
- }
- if ((style & SWT.BORDER) != 0) decorations |= OS.Ph_WM_RENDER_BORDER;
- if ((style & SWT.MENU) != 0) decorations |= OS.Ph_WM_RENDER_MENU;
- if ((style & SWT.TITLE) != 0) decorations |= OS.Ph_WM_RENDER_TITLE;
- }
- int notifyFlags =
- OS.Ph_WM_ICON | OS.Ph_WM_FOCUS |
- OS.Ph_WM_MOVE | OS.Ph_WM_RESIZE;
- int windowState = OS.Ph_WM_STATE_ISFOCUS;
- if ((style & SWT.ON_TOP) != 0) windowState = OS.Ph_WM_STATE_ISFRONT;
- int titlePtr = OS.malloc (1);
- int [] args = {
- OS.Pt_ARG_WIDTH, width, 0,
- OS.Pt_ARG_HEIGHT, height, 0,
- OS.Pt_ARG_WINDOW_TITLE, titlePtr, 0,
- OS.Pt_ARG_WINDOW_RENDER_FLAGS, decorations, flags,
- OS.Pt_ARG_WINDOW_MANAGED_FLAGS, 0, OS.Ph_WM_CLOSE,
- OS.Pt_ARG_WINDOW_NOTIFY_FLAGS, notifyFlags, notifyFlags,
- OS.Pt_ARG_WINDOW_STATE, windowState, ~0,
- OS.Pt_ARG_FLAGS, OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
- OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- OS.PtSetParentWidget (parentHandle);
- shellHandle = OS.PtCreateWidget (OS.PtWindow (), parentHandle, args.length / 3, args);
- OS.free (titlePtr);
- if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
- createScrolledHandle (shellHandle);
- if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.RESIZE)) == 0) {
- int [] args = {
- OS.Pt_ARG_FLAGS, OS.Pt_HIGHLIGHTED, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_BASIC_FLAGS, OS.Pt_ALL_OUTLINES, ~0,
- };
- OS.PtSetResources (scrolledHandle, args.length / 3, args);
- }
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- resizeBounds (args [1], args [4]);
-}
-
-void deregister () {
- super.deregister ();
- WidgetTable.remove (shellHandle);
-}
-
-
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-
-/**
- * Returns the receiver's input method editor mode. This
- * will be the result of bitwise OR'ing together one or
- * more of the following constants defined in class
- * <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @return the IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public int getImeInputMode () {
- checkWidget();
- return 0;
-}
-
-public boolean isEnabled () {
- checkWidget();
- return getEnabled ();
-}
-
-public Point getLocation () {
- checkWidget();
- //NOT DONE - shell location is 0,0 when queried before event loop
- return super.getLocation ();
-}
-
-public boolean getMaximized () {
- checkWidget();
- int state = OS.PtWindowGetState (shellHandle);
- if (state != -1) return (state & (OS.Ph_WM_STATE_ISMAX | OS.Ph_WM_STATE_ISMAXING)) != 0;
- int [] args = {OS.Pt_ARG_WINDOW_STATE, 0, OS.Ph_WM_STATE_ISMAX};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- return (args [1] & OS.Ph_WM_STATE_ISMAX) != 0;
-}
-
-public boolean getMinimized () {
- checkWidget();
- int state = OS.PtWindowGetState (shellHandle);
- if (state != -1) return (state & OS.Ph_WM_STATE_ISICONIFIED) != 0;
- int [] args = {OS.Pt_ARG_WINDOW_STATE, 0, OS.Ph_WM_STATE_ISICONIFIED};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- return (args [1] & OS.Ph_WM_STATE_ISICONIFIED) != 0;
-}
-
-public Shell getShell () {
- checkWidget();
- return this;
-}
-
-/**
- * Returns an array containing all shells which are
- * descendents of the receiver.
- * <p>
- * @return the dialog shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkWidget();
- int count = 0;
- Shell [] shells = display.getShells ();
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) count++;
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) {
- result [index++] = shells [i];
- }
- }
- return result;
-}
-
-public Point getSize () {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_WINDOW_RENDER_FLAGS, 0, 0,
- OS.Pt_ARG_WIDTH, 0, 0,
- OS.Pt_ARG_HEIGHT, 0, 0,
- };
- OS.PtGetResources (shellHandle, args.length / 3, args);
- int flags = args [1];
- int [] left = new int [1], top = new int [1];
- int [] right = new int [1], bottom = new int [1];
- OS.PtFrameSize (flags, 0, left, top, right, bottom);
- int width = args [4] + left [0] + right [0];
- int height = args [7] + top [0] + bottom [0];
- return new Point (width, height);
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (shellHandle, OS.Pt_CB_WINDOW, windowProc, SWT.Move);
- OS.PtAddCallback (shellHandle, OS.Pt_CB_RESIZE, windowProc, SWT.Resize);
-}
-
-/**
- * Moves the receiver to the top of the drawing order for
- * the display on which it was created (so that all other
- * shells on that display, which are not the receiver's
- * children will be drawn behind it), marks it visible,
- * and sets focus to its default button (if it has one).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Control#setVisible
- * @see Decorations#setDefaultButton
-*/
-public void open () {
- checkWidget();
- bringToTop ();
- setVisible (true);
-}
-
-int processEvent (int widget, int data, int info) {
- if (widget == shellHandle && data == SWT.Resize) {
- return processShellResize (info);
- }
- return super.processEvent (widget, data, info);
-}
-
-int processHotkey (int data, int info) {
- if (data != 0) {
- Widget widget = WidgetTable.get (data);
- if (widget instanceof MenuItem) {
- MenuItem item = (MenuItem) widget;
- if (item.isEnabled ()) item.processSelection (info);
- }
- }
- return OS.Pt_CONTINUE;
-}
-
-int processMove (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_CONTINUE;
- PhWindowEvent_t we = new PhWindowEvent_t ();
- OS.memmove (we, cbinfo.cbdata, PhWindowEvent_t.sizeof);
- switch (we.event_f) {
- case OS.Ph_WM_CLOSE:
- closeWidget ();
- break;
- case OS.Ph_WM_ICON:
- if ((we.state_f & OS.Ph_WM_STATE_ISICONIFIED) != 0) {
- sendEvent (SWT.Iconify);
- } else {
- sendEvent (SWT.Deiconify);
- }
- break;
- case OS.Ph_WM_FOCUS:
- switch (we.event_state) {
- case OS.Ph_WM_EVSTATE_FOCUS: sendEvent (SWT.Activate); break;
- case OS.Ph_WM_EVSTATE_FOCUSLOST: sendEvent (SWT.Deactivate); break;
- }
- break;
- case OS.Ph_WM_MOVE:
- sendEvent (SWT.Move);
- break;
- }
- return OS.Pt_CONTINUE;
-}
-
-int processShellResize (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_CONTINUE;
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- resizeBounds (args [1], args [4]);
- return OS.Pt_CONTINUE;
-}
-
-void register () {
- super.register ();
- WidgetTable.put (shellHandle, this);
-}
-
-void realizeWidget() {
- /* Do nothing */
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- shellHandle = 0;
-}
-
-void releaseShells () {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- /*
- * Feature in Photon. A shell may have child shells that have been
- * temporarily reparented to NULL because they were shown without
- * showing the parent. In this case, Photon will not destroy the
- * child shells because they are not in the widget hierarchy.
- * The fix is to detect this case and destroy the shells.
- */
- if (shell.parent != null && OS.PtWidgetParent (shell.shellHandle) == 0) {
- shell.dispose ();
- } else {
- shell.releaseWidget ();
- shell.releaseHandle ();
- }
- }
- }
-}
-
-void releaseWidget () {
- releaseShells ();
- super.releaseWidget ();
- if (blockedList != 0) OS.PtUnblockWindows (blockedList);
- blockedList = 0;
- lastFocus = null;
- display = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when operations are performed on the receiver.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #addShellListener
- */
-public void removeShellListener (ShellListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Close, listener);
- eventTable.unhook (SWT.Iconify,listener);
- eventTable.unhook (SWT.Deiconify,listener);
- eventTable.unhook (SWT.Activate, listener);
- eventTable.unhook (SWT.Deactivate, listener);
-}
-
-void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- checkWidget();
- if (OS.PtWidgetClass (shellHandle) != OS.PtWindow ()) {
- super.setBounds (x, y, width, height, move, resize);
- if (resize) resizeBounds (width, height);
- return;
- }
- int [] args = {OS.Pt_ARG_WINDOW_RENDER_FLAGS, 0, 0};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- int flags = args [1];
- int [] left = new int [1], top = new int [1];
- int [] right = new int [1], bottom = new int [1];
- OS.PtFrameSize (flags, 0, left, top, right, bottom);
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (shellHandle, area);
- int frameWidth = area.size_w + left [0] + right [0];
- int frameHeight = area.size_h + top [0] + bottom [0];
- if (!move) {
- x = area.pos_x;
- y = area.pos_y;
- }
- if (!resize) {
- width = frameWidth;
- height = frameHeight;
- }
- boolean sameOrigin = x == area.pos_x && y == area.pos_y;
- boolean sameExtent = width == frameWidth && height == frameHeight;
- area.pos_x = (short) x;
- area.pos_y = (short) y;
- area.size_w = (short) (Math.max (width - left [0] - right [0], 0));
- area.size_h = (short) (Math.max (height - top [0] - bottom [0], 0));
-//TO DO - for some reason shell will move but won't resize after realize
- int ptr = OS.malloc (PhArea_t.sizeof);
- OS.memmove (ptr, area, PhArea_t.sizeof);
- args = new int [] {OS.Pt_ARG_AREA, ptr, 0};
- OS.PtSetResources (shellHandle, args.length / 3, args);
- OS.free (ptr);
- /*
- * Feature in Photon. The shell does not issue WM_SIZE
- * event notificatoin until it is realized. The fix is
- * to detect size changes and send the events.
- */
- if (!OS.PtWidgetIsRealized (shellHandle)) {
- if (!sameOrigin & move) sendEvent (SWT.Move);
- if (!sameExtent & resize) {
- resizeBounds (width, height);
- sendEvent (SWT.Resize);
- }
- }
-}
-
-public void setImage (Image image) {
-}
-
-/**
- * Sets the input method editor mode to the argument which
- * should be the result of bitwise OR'ing together one or more
- * of the following constants defined in class <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @param mode the new IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public void setImeInputMode (int mode) {
- checkWidget();
-}
-
-public void setMaximized (boolean maximized) {
- checkWidget();
- int bits = 0;
- if (maximized) bits = OS.Ph_WM_STATE_ISMAX;
- int [] args = {OS.Pt_ARG_WINDOW_STATE, bits, OS.Ph_WM_STATE_ISMAX};
- OS.PtSetResources (shellHandle, args.length / 3, args);
- if (OS.PtWidgetIsRealized (shellHandle)) {
- PhWindowEvent_t event = new PhWindowEvent_t ();
- event.rid = OS.PtWidgetRid (shellHandle);
- event.event_f = maximized ? OS.Ph_WM_MAX : OS.Ph_WM_RESTORE;
- OS.PtForwardWindowEvent (event);
- }
-}
-
-public void setMenuBar (Menu menu) {
- checkWidget();
- if (menuBar == menu) return;
- if (menu != null) {
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- if (menuBar != null) {
- int menuHandle = menuBar.handle;
- int [] args = {
- OS.Pt_ARG_FLAGS, OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
- };
- OS.PtSetResources (menuHandle, args.length / 3, args);
- OS.PtUnrealizeWidget (menuBar.handle);
- }
- menuBar = menu;
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (shellHandle, args.length / 3, args);
- int width = args [1], height = args [4];
- if (menuBar != null) {
- int menuHandle = menu.handle;
- args = new int [] {
- OS.Pt_ARG_WIDTH, width, 0,
- OS.Pt_ARG_FLAGS, 0, OS.Pt_DELAY_REALIZE,
- };
- OS.PtSetResources (menuHandle, args.length / 3, args);
- OS.PtRealizeWidget (menuHandle);
- }
- resizeBounds(width, height);
-}
-
-public void setMinimized (boolean minimized) {
- checkWidget();
- int bits = 0;
- if (minimized) bits = OS.Ph_WM_STATE_ISICONIFIED;
- int [] args = {OS.Pt_ARG_WINDOW_STATE, bits, OS.Ph_WM_STATE_ISICONIFIED};
- OS.PtSetResources (shellHandle, args.length / 3, args);
- if (OS.PtWidgetIsRealized (shellHandle)) {
- PhWindowEvent_t event = new PhWindowEvent_t ();
- event.rid = OS.PtWidgetRid (shellHandle);
- event.event_f = OS.Ph_WM_HIDE;
- event.event_state = (short) (minimized ? OS.Ph_WM_EVSTATE_HIDE : OS.Ph_WM_EVSTATE_UNHIDE);
- OS.PtForwardWindowEvent (event);
- }
-}
-
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- text = string;
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {OS.Pt_ARG_WINDOW_TITLE, ptr, 0};
- OS.PtSetResources (shellHandle, args.length / 3, args);
- OS.free (ptr);
-}
-
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible == OS.PtWidgetIsRealized (shellHandle)) return;
-
- /*
- * Feature in Photon. It is not possible to show a PtWindow
- * whose parent is not realized. The fix is to temporarily
- * reparent the child shell to NULL and then realize the child
- * shell.
- */
- if (parent != null) {
- Shell shell = parent.getShell ();
- int parentHandle = shell.shellHandle;
- if (!OS.PtWidgetIsRealized (parentHandle)) {
- OS.PtReParentWidget (shellHandle, visible ? OS.Pt_NO_PARENT : parentHandle);
- }
- }
-
- if (visible) {
- int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
- switch (style & mask) {
- case SWT.PRIMARY_MODAL:
- if (parent != null) {
- int parentHandle = parent.getShell ().shellHandle;
- blockedList = OS.PtBlockWindow (parentHandle, (short) 0, 0);
- }
- break;
- case SWT.APPLICATION_MODAL:
- case SWT.SYSTEM_MODAL:
- blockedList = OS.PtBlockAllWindows (shellHandle, (short) 0, 0);
- break;
- }
- } else {
- if (blockedList != 0) OS.PtUnblockWindows (blockedList);
- blockedList = 0;
- }
- super.setVisible (visible);
-
- /*
- * Feature in Photon. When a shell is shown, it may have child
- * shells that have been temporarily reparented to NULL because
- * the child was shown before the parent. The fix is to reparent
- * the child shells back to the correct parent.
- */
- if (visible) {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- int childHandle = shells [i].shellHandle;
- if (OS.PtWidgetParent (childHandle) == 0) {
- OS.PtReParentWidget (childHandle, shellHandle);
- }
- }
- }
-
- OS.PtSyncWidget (shellHandle);
- OS.PtFlush ();
-}
-
-int topHandle () {
- return shellHandle;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
deleted file mode 100755
index 35cc284c33..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
+++ /dev/null
@@ -1,506 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given slider will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the slider represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, sliders will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, sliders are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the slider's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the slider will not change.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see ScrollBar
- */
-public class Slider extends Control {
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Slider (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- //NOT DONE - hard coding value to be the same as list's scrollbars
- int width = 17, height = 100;
- if ((style & SWT.HORIZONTAL) != 0) {
- width = 100; height = 17;
- }
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) width = area.size_w;
- if (hHint != SWT.DEFAULT) height = area.size_h;
- }
- return new Point (width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtScrollbar;
- int parentHandle = parent.handle;
- int [] args = {
- OS.Pt_ARG_MAXIMUM, 100, 0,
- OS.Pt_ARG_PAGE_INCREMENT, 10, 0,
- OS.Pt_ARG_SLIDER_SIZE, 10, 0,
- OS.Pt_ARG_ORIENTATION, (style & SWT.HORIZONTAL) != 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-public Point getSize () {
- checkWidget();
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return new Point (args [1], args [4]);
-}
-
-/**
- * Returns the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getThumb () {
- checkWidget();
- int [] args = {OS.Pt_ARG_SLIDER_SIZE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-void hookEvents () {
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_SCROLL_MOVE, windowProc, SWT.Selection);
-}
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtScrollbar (), handle, damage);
- return super.processPaint (damage);
-}
-
-int processSelection (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.cbdata == 0) return OS.Pt_CONTINUE;
- PtScrollbarCallback_t cb = new PtScrollbarCallback_t ();
- OS.memmove (cb, cbinfo.cbdata, PtScrollbarCallback_t.sizeof);
- Event event = new Event ();
- switch (cb.action) {
- case OS.Pt_SCROLL_DRAGGED:
- event.detail = SWT.DRAG;
- break;
- case OS.Pt_SCROLL_TO_MIN:
- event.detail = SWT.HOME;
- break;
- case OS.Pt_SCROLL_TO_MAX:
- event.detail = SWT.END;
- break;
- case OS.Pt_SCROLL_INCREMENT:
- event.detail = SWT.ARROW_DOWN;
- break;
- case OS.Pt_SCROLL_DECREMENT :
- event.detail = SWT.ARROW_UP;
- break;
- case OS.Pt_SCROLL_PAGE_DECREMENT:
- event.detail = SWT.PAGE_UP;
- break;
- case OS.Pt_SCROLL_PAGE_INCREMENT:
- event.detail = SWT.PAGE_DOWN;
- break;
- }
- sendEvent(SWT.Selection, event);
- return OS.Pt_CONTINUE;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MAXIMUM, value - 1, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_MINIMUM, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_PAGE_INCREMENT, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_SCROLL_POSITION, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget();
- int [] args = {OS.Pt_ARG_SLIDER_SIZE, value, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- int [] args = {
- OS.Pt_ARG_SCROLL_POSITION, selection, 0,
- OS.Pt_ARG_INCREMENT, increment, 0,
- OS.Pt_ARG_PAGE_INCREMENT, pageIncrement, 0,
- OS.Pt_ARG_SLIDER_SIZE, thumb, 0,
- OS.Pt_ARG_MINIMUM, minimum, 0,
- OS.Pt_ARG_MAXIMUM, maximum - 1, 0,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
deleted file mode 100755
index d4e8ffd035..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
+++ /dev/null
@@ -1,554 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>TabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabFolder extends Composite {
- TabItem [] items;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabFolder (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = dim.w, height = dim.h;
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget();
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int [] args = {
- OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 1
- OS.Pt_ARG_MARGIN_TOP, 0, 0, // 4
- OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 7
- OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 10
-// OS.Pt_ARG_BASIC_FLAGS, 0, 0, // 13
- };
- OS.PtGetResources(handle, args.length / 3, args);
- int trimX = x - args [10];
- int trimY = y - (dim.h - args [1]);
- int trimWidth = width + args [7] + args [10];
- int trimHeight = height + dim.h;
- return new Rectangle (trimX, trimY, trimWidth, trimHeight);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int clazz = display.PtPanelGroup;
- int parentHandle = parent.handle;
- int [] args = {
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new TabItem [4];
-}
-
-void createItem (TabItem item, int index) {
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [2];
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- if (count == items.length) {
- TabItem [] newItems = new TabItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- int oldPtr = args [1];
- int newPtr = OS.malloc ((count + 1) * 4);
- if (newPtr == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- int offset = 0;
- for (int i=0; i<count; i++) {
- if (i == index) offset = 1;
- int [] address = new int [1];
- OS.memmove (address, oldPtr + (i * 4), 4);
- int length = OS.strlen (address [0]);
- int str = OS.malloc (length + 1);
- if (str == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.memmove (str, address [0], length + 1);
- OS.memmove (newPtr + ((i + offset) * 4), new int [] {str}, 4);
- }
- int str = OS.malloc (1);
- if (str == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.memmove (newPtr + ((index) * 4), new int [] {str}, 4);
- args = new int [] {OS.Pt_ARG_PG_PANEL_TITLES, newPtr, count + 1};
- OS.PtSetResources (handle, args.length / 3, args);
- for (int i=0; i<count+1; i++) {
- int [] address = new int [1];
- OS.memmove (address, newPtr + (i * 4), 4);
- OS.free (address [0]);
- }
- OS.free (newPtr);
- System.arraycopy (items, index, items, index + 1, count - index);
- items [index] = item;
-}
-
-void destroyItem (TabItem item) {
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [2];
- int index = 0;
- while (index < count) {
- if (items [index] == item) break;
- index++;
- }
- int oldPtr = args [1];
- int newPtr = OS.malloc ((count - 1) * 4);
- if (newPtr == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- int offset = 0;
- for (int i=0; i<count; i++) {
- if (i == index) {
- offset = -1;
- continue;
- }
- int [] address = new int [1];
- OS.memmove (address, oldPtr + (i * 4), 4);
- int length = OS.strlen (address [0]);
- int str = OS.malloc (length + 1);
- if (str == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- OS.memmove (str, address [0], length + 1);
- OS.memmove (newPtr + ((i + offset) * 4), new int [] {str}, 4);
- }
- args = new int [] {OS.Pt_ARG_PG_PANEL_TITLES, newPtr, count - 1};
- OS.PtSetResources (handle, args.length / 3, args);
- for (int i=0; i<count-1; i++) {
- int [] address = new int [1];
- OS.memmove (address, newPtr + (i * 4), 4);
- OS.free (address [0]);
- }
- OS.free (newPtr);
- if (index != count) {
- System.arraycopy (items, index + 1, items, index, --count - index);
- }
- items [count] = null;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem getItem (int index) {
- checkWidget();
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (!(0 <= index && index < args [2])) error (SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getItems () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- TabItem [] result = new TabItem [args [2]];
- System.arraycopy (items, 0, result, 0, result.length);
- return result;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [2];
-}
-
-/**
- * Returns an array of <code>TabItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getSelection () {
- checkWidget();
- int index = getSelectionIndex ();
- if (index == -1) return new TabItem [0];
- return new TabItem [] {items [index]};
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget();
- int [] args = {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1] == OS.Pt_PG_INVALID ? -1 : args [1];
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_PG_PANEL_SWITCHING, windowProc, SWT.Selection);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TabItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = getItemCount ();
- for (int i=0; i<count; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-int processPaint (int damage) {
- OS.PtSuperClassDraw (OS.PtPanelGroup (), handle, damage);
- sendPaintEvent (damage);
- return OS.Pt_CONTINUE;
-}
-
-int processResize (int info) {
- int result = super.processResize (info);
- int [] args = {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int index = args [1];
- if (index != OS.Pt_PG_INVALID) {
- TabItem item = items [index];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
- }
- }
- return result;
-}
-
-int processSelection (int info) {
- if (info == 0) return OS.Pt_CONTINUE;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- short[] oldIndex = new short[1];
- short[] newIndex = new short[1];
- OS.memmove(oldIndex, cbinfo.cbdata + 8, 2);
- OS.memmove(newIndex, cbinfo.cbdata + 10, 2);
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [2];
- Control oldControl = null;
- int index = oldIndex [0];
- TabItem oldItem = items [index];
- if (0 <= index && index < count) oldControl = oldItem.control;
- Control newControl = null;
- index = newIndex [0];
- TabItem newItem = items [index];
- if (0 <= index && index < count) newControl = newItem.control;
- if (oldControl != null) oldControl.setVisible (false);
- if (newControl != null) {
- newControl.setBounds (getClientArea ());
- newControl.setVisible (true);
- }
- Event event = new Event ();
- event.item = newItem;
- postEvent (SWT.Selection, event);
- return OS.Pt_CONTINUE;
-}
-
-void releaseWidget () {
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [2];
- for (int i=0; i<count; i++) {
- TabItem item = items [i];
- if (!item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- super.releaseWidget ();
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int index) {
- checkWidget();
- int [] args = {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int oldIndex = args [1];
- if (oldIndex != OS.Pt_PG_INVALID) {
- TabItem item = items [oldIndex];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setVisible (false);
- }
- }
- args = new int[]{OS.Pt_ARG_PG_CURRENT_INDEX, index, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- args = new int[]{OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int newIndex = args [1];
- if (newIndex != -1) {
- TabItem item = items [newIndex];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
- control.setVisible (true);
- }
- }
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (TabItem [] items) {
- checkWidget();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (items.length == 0) {
- setSelection (-1);
- return;
- }
- for (int i=items.length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) setSelection (index);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
deleted file mode 100755
index 03826cc987..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
+++ /dev/null
@@ -1,258 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * corresponding to a tab for a page in a tab folder.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabItem extends Item {
- TabFolder parent;
- Control control;
- String toolTipText;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style) {
- this(parent, style, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns the control that is used to fill the client area of
- * the tab folder when the user selects the tab item. If no
- * control has been set, return <code>null</code>.
- * <p>
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-
-public Display getDisplay () {
- TabFolder parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>TabFolder</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabFolder getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- control = null;
- parent = null;
- toolTipText = null;
-}
-
-/**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- Control oldControl = this.control, newControl = control;
- this.control = control;
- int index = parent.indexOf (this);
- if (index != parent.getSelectionIndex ()) return;
- if (newControl != null) {
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
- }
- if (oldControl != null) oldControl.setVisible (false);
-}
-
-public void setImage (Image image) {
- checkWidget();
- //NOT SUPPORTED
-}
-
-public void setText (String text) {
- checkWidget();
- super.setText (text);
- int index = parent.indexOf (this);
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (parent.handle, args.length / 3, args);
- int count = args [2];
- int oldPtr = args [1];
- int newPtr = OS.malloc (count * 4);
- for (int i=0; i<count; i++) {
- int str;
- if (i == index) {
- byte [] buffer = Converter.wcsToMbcs (null, text);
- str = OS.malloc (buffer.length + 1);
- OS.memmove (str, buffer, buffer.length);
- } else {
- int [] address = new int [1];
- OS.memmove (address, oldPtr + (i * 4), 4);
- int length = OS.strlen (address [0]);
- str = OS.malloc (length + 1);
- OS.memmove (str, address [0], length + 1);
- }
- OS.memmove (newPtr + (i * 4), new int [] {str}, 4);
- }
- args = new int [] {OS.Pt_ARG_PG_PANEL_TITLES, newPtr, count};
- OS.PtSetResources (parent.handle, args.length / 3, args);
- for (int i=0; i<count; i++) {
- int [] address = new int [1];
- OS.memmove (address, newPtr + (i * 4), 4);
- OS.free (address [0]);
- }
- OS.free (newPtr);
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
deleted file mode 100755
index 2c2086e88a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
+++ /dev/null
@@ -1,1376 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that allow the user to enter and modify text.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Verify</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Text extends Scrollable {
- char echoCharacter;
- boolean ignoreChange;
- String hiddenText;
- int tabs, lastModifiedText;
- PtTextCallback_t textVerify;
-
- public static final int LIMIT;
- public static final String DELIMITER;
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = 0x7FFFFFFF;
- DELIMITER = "\n";
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Text (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- return style | SWT.MULTI;
- }
- return style | SWT.SINGLE;
-}
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- PhDim_t dim = new PhDim_t ();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtWidgetPreferredSize (handle, dim);
- int width = dim.w, height = dim.h;
- if ((style & SWT.MULTI) != 0) {
- int child = OS.PtWidgetChildBack (handle);
- OS.PtWidgetPreferredSize (child, dim);
- width += dim.w - 1;
- height += dim.h - 1;
- }
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- ScrollBar scroll;
- if (wHint != SWT.DEFAULT) {
- width = area.size_w;
- if ((scroll = getVerticalBar ()) != null) width += scroll.getSize().x;
- }
- if (hHint != SWT.DEFAULT) {
- height = area.size_h;
- if ((scroll = getHorizontalBar ()) != null) height += scroll.getSize().y;
- }
- }
- return new Point(width, height);
-}
-/**
- * Clears the selection.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void clearSelection () {
- checkWidget();
- int [] position = {0};
- if ((style & SWT.SINGLE) != 0) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- position [0] = args [1];
- }
- OS.PtTextSetSelection (handle, position, position);
-}
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int parentHandle = parent.handle;
- boolean hasBorder = (style & SWT.BORDER) != 0;
- int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
- if ((style & SWT.SINGLE) != 0) {
- int clazz = display.PtText;
- int [] args = {
- OS.Pt_ARG_FLAGS, hasBorder ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_FLAGS, OS.Pt_CALLBACKS_ACTIVE, OS.Pt_CALLBACKS_ACTIVE,
- OS.Pt_ARG_TEXT_FLAGS, textFlags, OS.Pt_EDITABLE,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- return;
- }
- int clazz = display.PtMultiText;
- int wrapFlags = (style & SWT.WRAP) != 0 ? OS.Pt_EMT_WORD | OS.Pt_EMT_CHAR : 0;
- int [] args = {
- OS.Pt_ARG_FLAGS, hasBorder ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_FLAGS, OS.Pt_CALLBACKS_ACTIVE, OS.Pt_CALLBACKS_ACTIVE,
- OS.Pt_ARG_TEXT_FLAGS, textFlags, OS.Pt_EDITABLE,
- OS.Pt_ARG_MULTITEXT_WRAP_FLAGS, wrapFlags, OS.Pt_EMT_WORD | OS.Pt_EMT_CHAR,
- OS.Pt_ARG_SCROLLBAR_X_DISPLAY, (style & SWT.H_SCROLL) != 0 ? OS.Pt_ALWAYS : OS.Pt_NEVER, 0,
- OS.Pt_ARG_SCROLLBAR_Y_DISPLAY, (style & SWT.V_SCROLL) != 0 ? OS.Pt_ALWAYS : OS.Pt_NEVER, 0,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- createStandardScrollBars ();
-}
-
-void createWidget (int index) {
- super.createWidget (index);
-// doubleClick = true;
- setTabStops (tabs = 8);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is not called for texts.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is verified, by sending
- * it one of the messages defined in the <code>VerifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #removeVerifyListener
- */
-public void addVerifyListener (VerifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Verify, typedListener);
-}
-
-/**
- * Appends a string.
- * <p>
- * The new text is appended to the text at
- * the end of the widget.
- * </p>
- *
- * @param string the string to be appended
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void append (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, false);
- OS.PtTextModifyText (handle, 0, 0, -1, buffer, buffer.length);
-}
-
-/**
- * Copies the selected text.
- * <p>
- * The current selection is copied to the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void copy () {
- checkWidget();
- int [] start = new int [1], end = new int [1];
- int length = OS.PtTextGetSelection (handle, start, end);
- if (length <= 0) return;
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- byte[] buffer = new byte[length + 1];
- OS.memmove (buffer, args [1] + start [0], length);
- int ig = OS.PhInputGroup (0);
- OS.PhClipboardCopyString((short)ig, buffer);
-}
-
-/**
- * Cuts the selected text.
- * <p>
- * The current selection is first copied to the
- * clipboard and then deleted from the widget.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void cut () {
- checkWidget();
- int [] start = new int [1], end = new int [1];
- int length = OS.PtTextGetSelection (handle, start, end);
- if (length <= 0) return;
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- byte[] buffer = new byte[length + 1];
- OS.memmove (buffer, args [1] + start [0], length);
- int ig = OS.PhInputGroup (0);
- OS.PhClipboardCopyString((short)ig, buffer);
- buffer = new byte[0];
- OS.PtTextModifyText (handle, start [0], end [0], start [0], buffer, buffer.length);
-}
-
-void deregister () {
- super.deregister ();
-
- /*
- * Bug in Photon. Even though the Pt_CB_GOT_FOCUS callback
- * is added to the multi-line text, the widget parameter
- * in the callback is a child of the multi-line text. The fix
- * is to register that child so that the lookup in the widget
- * table will find the muti-line text.
- */
- if ((style & SWT.MULTI) == 0) return;
- int child = OS.PtWidgetChildBack (handle);
- WidgetTable.remove (child);
-}
-
-/**
- * Gets the line number of the caret.
- * <p>
- * The line number of the caret is returned.
- * </p>
- *
- * @return the line number
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretLineNumber () {
- checkWidget();
- //NOT DONE - NOT NEEDED
- return 0;
-}
-
-/**
- * Gets the location the caret.
- * <p>
- * The location of the caret is returned.
- * </p>
- *
- * @return a point, the location of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCaretLocation () {
- checkWidget();
- //NOT DONE - NOT NEEDED
- return null;
-}
-
-/**
- * Gets the position of the caret.
- * <p>
- * The character position of the caret is returned.
- * </p>
- *
- * @return the position of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretPosition () {
- checkWidget();
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Gets the number of characters.
- *
- * @return number of characters in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCharCount () {
- checkWidget();
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return 0;
- return OS.strlen (args [1]);
-}
-
-/**
- * Gets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getDoubleClickEnabled () {
- checkWidget();
- //NOT DONE - NOT NEEDED
- return false;
-}
-
-/**
- * Gets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public char getEchoChar () {
- checkWidget();
- return echoCharacter;
-}
-
-/**
- * Gets the editable state.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEditable () {
- checkWidget();
- int [] args = {OS.Pt_ARG_TEXT_FLAGS, 0, 0};
- OS.PtGetResources(handle, args.length / 3, args);
- return (args [1] & OS.Pt_EDITABLE) != 0;
-}
-
-/**
- * Gets the number of lines.
- *
- * @return the number of lines in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineCount () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return 1;
- int [] args = {OS.Pt_ARG_MULTITEXT_NUM_LINES, 0, 0};
- OS.PtGetResources(handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Gets the line delimiter.
- *
- * @return a string that is the line delimiter
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getLineDelimiter () {
- checkWidget();
- return "\n";
-}
-
-/**
- * Gets the height of a line.
- *
- * @return the height of a row of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineHeight () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) {
- PhDim_t dim = new PhDim_t ();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
- OS.PtWidgetPreferredSize (handle, dim);
- PhRect_t extent = new PhRect_t ();
- OS.PtWidgetExtent(handle, extent);
- PhRect_t canvas = new PhRect_t ();
- OS.PtWidgetCanvas (handle, canvas);
- int topBorder = canvas.ul_y - extent.ul_y;
- int bottomBorder = extent.lr_y - canvas.lr_y;
- return dim.h - topBorder - bottomBorder;
- }
- int ptr = OS.malloc (20);
- int [] args = {
- OS.Pt_ARG_MULTITEXT_QUERY_LINE, ptr, 1,
- OS.Pt_ARG_MULTITEXT_LINE_SPACING, 0, 0
- };
- OS.PtGetResources (handle, args.length / 3, args);
- int [] line = new int [1];
- OS.memmove (line, args [1] + 8, 4);
- PhRect_t extent = new PhRect_t ();
- OS.memmove (extent, line [0] + 10, 8);
- OS.free(ptr);
- return extent.lr_y - extent.ul_y + 1 + args [4];
-}
-
-String getNameText () {
- if ((style & SWT.SINGLE) != 0) return getText ();
- return getText (0, Math.min(getCharCount () - 1, 10));
-}
-
-/**
- * Gets the position of the selected text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p>
- *
- * @return the start and end of the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget();
- if (textVerify != null) {
- return new Point (textVerify.start_pos, textVerify.end_pos);
- }
- int [] start = new int [1], end = new int [1];
- OS.PtTextGetSelection (handle, start, end);
- if (start [0] == -1) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- start [0] = end [0] = args [1];
- }
- return new Point (start [0], end [0]);
-}
-
-/**
- * Gets the number of selected characters.
- *
- * @return the number of selected characters.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget();
- Point selection = getSelection ();
- return selection.y - selection.x;
-}
-
-/**
- * Gets the selected text.
- *
- * @return the selected text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getSelectionText () {
- checkWidget();
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- Point selection = getSelection ();
- return getText ().substring (selection.x, selection.y);
-}
-
-/**
- * Gets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @return the number of tab characters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTabs () {
- checkWidget();
- return tabs;
-}
-
-int getTabWidth (int tabs) {
- int [] args = new int [] {OS.Pt_ARG_TEXT_FONT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- PhRect_t rect = new PhRect_t ();
- int ptr = OS.malloc (1);
- OS.memmove (ptr, new byte [] {' '}, 1);
- OS.PfExtentText(rect, null, args [1], ptr, 1);
- OS.free (ptr);
- int width = rect.lr_x - rect.ul_x + 1;
- return width * tabs;
-}
-
-/**
- * Gets a range of text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N-1 where N is
- * the number of characters in the widget.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- * @return the range of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText (int start, int end) {
- checkWidget();
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- //NOT DONE - use OS in SINGLE text
- return getText ().substring (start, end + 1);
-}
-
-/**
- * Gets the widget text.
- * <p>
- * The text for a text widget is the characters in the widget.
- * </p>
- *
- * @return the widget text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget();
- if (echoCharacter != '\0') return hiddenText;
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] == 0) return "";
- int length = OS.strlen (args [1]);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, args [1], length);
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-
-/**
- * Returns the maximum number of characters that the receiver is capable of holding.
- * <p>
- * If this has not been changed by <code>setTextLimit()</code>,
- * it will be the constant <code>Text.LIMIT</code>.
- * </p>
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget();
- int [] args = new int [] {OS.Pt_ARG_MAX_LENGTH, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-/**
- * Returns the zero-relative index of the line which is currently
- * at the top of the receiver.
- * <p>
- * This index can change when lines are scrolled or new lines are added or removed.
- * </p>
- *
- * @return the index of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return 0;
- int [] args = {OS.Pt_ARG_MULTITEXT_TOP_LINE, 0, 0};
- OS.PtGetResources(handle, args.length / 3, args);
- return args [1] - 1;
-}
-
-/**
- * Gets the top pixel.
- * <p>
- * The top pixel is the pixel position of the line
- * that is currently at the top of the widget. On
- * some platforms, a text widget can be scrolled by
- * pixels instead of lines so that a partial line
- * is displayed at the top of the widget.
- * </p><p>
- * The top pixel changes when the widget is scrolled.
- * The top pixel does not include the widget trimming.
- * </p>
- *
- * @return the pixel position of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopPixel () {
- checkWidget();
- //NOT DONE - NOT NEEDED
- return 0;
-}
-
-void hookEvents () {
- super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_MODIFY_VERIFY, windowProc, SWT.Verify);
- OS.PtAddCallback (handle, OS.Pt_CB_TEXT_CHANGED, windowProc, SWT.Modify);
-}
-
-/**
- * Inserts a string.
- * <p>
- * The old selection is replaced with the new text.
- * </p>
- *
- * @param string the string
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void insert (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, false);
- int [] start = new int [1], end = new int [1];
- OS.PtTextGetSelection (handle, start, end);
- if (start [0] == -1) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- start [0] = end [0] = args [1];
- }
- OS.PtTextModifyText (handle, start [0], end [0], start [0], buffer, buffer.length);
-}
-
-/**
- * Pastes text from clipboard.
- * <p>
- * The selected text is deleted from the widget
- * and new text inserted from the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void paste () {
- checkWidget();
- int ig = OS.PhInputGroup (0);
- int ptr = OS.PhClipboardPasteString((short)ig);
- if (ptr == 0) return;
- int length = OS.strlen (ptr);
- int [] start = new int [1], end = new int [1];
- OS.PtTextGetSelection (handle, start, end);
- if (start [0] == -1) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- start [0] = end [0] = args [1];
- }
- OS.PtTextModifyText (handle, start [0], end [0], end [0], ptr, length);
- OS.free(ptr);
-}
-
-int processEvent (int widget, int data, int info) {
-
- /*
- * Bug in Photon. Even though the Pt_CB_GOT_FOCUS callback
- * is added to the multi-line text, the widget parameter
- * in the callback is a child of the multi-line text. The fix
- * is to register that child so that the lookup in the widget
- * table will find the muti-line text and avoid multiple
- * Pt_CB_LOST_FOCUS callbacks.
- */
- if ((style & SWT.MULTI) != 0) {
- if (widget != handle && data == SWT.FocusOut) {
- return OS.Pt_CONTINUE;
- }
- }
- return super.processEvent (widget, data, info);
-}
-
-int processModify (int info) {
- if (lastModifiedText != 0) {
- OS.free (lastModifiedText);
- lastModifiedText = 0;
- }
- if (!ignoreChange) sendEvent (SWT.Modify);
- return OS.Pt_CONTINUE;
-}
-
-int processPaint (int damage) {
- if ((style & SWT.SINGLE) != 0) {
- OS.PtSuperClassDraw (OS.PtText (), handle, damage);
- } else {
- OS.PtSuperClassDraw (OS.PtMultiText (), handle, damage);
- }
- return super.processPaint (damage);
-}
-
-int processVerify (int info) {
- if (lastModifiedText != 0) {
- OS.free (lastModifiedText);
- lastModifiedText = 0;
- }
- super.processVerify (info);
- if (echoCharacter == '\0' && !hooks (SWT.Verify)) return 0;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- PtTextCallback_t textVerify = new PtTextCallback_t ();
- OS.memmove (textVerify, cbinfo.cbdata, PtTextCallback_t.sizeof);
- byte [] buffer = new byte [textVerify.length];
- OS.memmove (buffer, textVerify.text, buffer.length);
- String text = new String (Converter.mbcsToWcs (null, buffer));
- String newText = text;
- if (!ignoreChange) {
- Event event = new Event ();
- event.start = textVerify.start_pos;
- event.end = textVerify.end_pos;
- event.doit = textVerify.doit != 0;
- event.text = text;
- sendEvent (SWT.Verify, event);
- newText = event.text;
- textVerify.doit = (event.doit && newText != null) ? 1 : 0;
- }
- if (newText != null) {
- if (echoCharacter != '\0' && (textVerify.doit != 0)) {
- String prefix = hiddenText.substring (0, textVerify.start_pos);
- String suffix = hiddenText.substring (textVerify.end_pos, hiddenText.length ());
- hiddenText = prefix + newText + suffix;
- char [] charBuffer = new char [newText.length ()];
- for (int i=0; i<charBuffer.length; i++) {
- charBuffer [i] = echoCharacter;
- }
- newText = new String (charBuffer);
- }
- if (newText != text) {
- byte [] buffer2 = Converter.wcsToMbcs (null, newText, true);
- int length = buffer2.length - 1;
- if (length == textVerify.length) {
- OS.memmove(textVerify.text, buffer2, length);
- } else {
- int ptr = OS.malloc (length);
- OS.memmove (ptr, buffer2, buffer2.length);
- textVerify.new_insert += length - textVerify.length;
- textVerify.text = ptr;
- textVerify.length = length;
- lastModifiedText = ptr;
- }
- }
- }
- OS.memmove (cbinfo.cbdata, textVerify, PtTextCallback_t.sizeof);
- textVerify = null;
- return 0;
-}
-
-void register () {
- super.register ();
-
- /*
- * Bug in Photon. Even though the Pt_CB_GOT_FOCUS callback
- * is added to the multi-line text, the widget parameter
- * in the callback is a child of the multi-line text. The fix
- * is to register that child so that the lookup in the widget
- * table will find the muti-line text.
- */
- if ((style & SWT.MULTI) == 0) return;
- int child = OS.PtWidgetChildBack (handle);
- WidgetTable.put (child, this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- if (lastModifiedText != 0) OS.free (lastModifiedText);
- lastModifiedText = 0;
- hiddenText = null;
- textVerify = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is verified.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #addVerifyListener
- */
-public void removeVerifyListener (VerifyListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Verify, listener);
-}
-
-/**
- * Selects all the text in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget();
- OS.PtTextSetSelection (handle, new int [0], new int [] {-1});
-}
-
-/**
- * Sets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @param echo the new echo character
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEchoChar (char echo) {
- checkWidget();
- if (echoCharacter == echo) return;
- String newText;
- if (echo == 0) {
- newText = hiddenText;
- hiddenText = null;
- } else {
- newText = hiddenText = getText();
- }
- echoCharacter = echo;
- Point selection = getSelection();
- boolean oldValue = ignoreChange;
- ignoreChange = true;
- setText(newText);
- setSelection(selection.x, selection.y);
- ignoreChange = oldValue;
-}
-
-/**
- * Sets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @param doubleClick the new double click flag
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDoubleClickEnabled (boolean doubleClick) {
- checkWidget();
- //NOT DONE - NOT NEEDED
-}
-
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEditable (boolean editable) {
- checkWidget();
- style &= ~SWT.READ_ONLY;
- if (!editable) style |= SWT.READ_ONLY;
- int [] args = {OS.Pt_ARG_TEXT_FLAGS, editable ? OS.Pt_EDITABLE : 0, OS.Pt_EDITABLE};
- OS.PtSetResources(handle, args.length / 3, args);
-}
-
-public void setFont (Font font) {
- super.setFont (font);
- setTabStops (tabs);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * regular array indexing rules.
- * </p>
- *
- * @param start new caret position
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int position) {
- checkWidget();
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, position, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-
- /*
- * Feature in Photon. On a single-line text, the selection is
- * not cleared when setting the cursor position. The fix is to
- * set the selection start and end values to the specified
- * position.
- */
- if ((style & SWT.SINGLE) != 0) {
- int [] selection = {position};
- OS.PtTextSetSelection (handle, selection, selection);
- }
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param selection the point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSelection (selection.x, selection.y);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start, int end) {
- checkWidget();
- OS.PtTextSetSelection (handle, new int [] {start}, new int [] {end});
-
- /*
- * Feature in Photon. On a multi-line text, the caret position
- * is not changed with the selection start and end values are
- * the same. The fix is to detect this case and change the
- * cursor position.
- */
- if ((style & SWT.MULTI) != 0 && start == end) {
- int [] args = {OS.Pt_ARG_CURSOR_POSITION, start, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- }
-}
-
- /**
- * Sets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @param tabs the number of tabs
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
-*/
-public void setTabs (int tabs) {
- checkWidget();
- if (tabs < 0) return;
- setTabStops (this.tabs = tabs);
-}
-
-void setTabStops (int tabs) {
- if ((style & SWT.SINGLE) != 0) return;
- int tabsWidth = getTabWidth (tabs);
- int ptr = OS.malloc (4);
- OS.memmove (ptr, new int [] {tabsWidth}, 4);
- int [] args = {OS.Pt_ARG_MULTITEXT_TABS, ptr, 1};
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-/**
- * Sets the contents of the receiver to the given string.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {OS.Pt_ARG_TEXT_STRING, ptr, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- OS.free (ptr);
-}
-
-/**
- * Sets the maximum number of characters that the receiver
- * is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- int [] args = new int [] {OS.Pt_ARG_MAX_LENGTH, limit, 0};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the zero-relative index of the line which is currently
- * at the top of the receiver. This index can change when lines
- * are scrolled or new lines are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget();
- if ((style & SWT.SINGLE) != 0) return;
- int [] args = {OS.Pt_ARG_MULTITEXT_TOP_LINE, index + 1, 0};
- OS.PtSetResources(handle, args.length / 3, args);
-}
-
-/**
- * Shows the selection.
- * <p>
- * If the selection is already showing
- * in the receiver, this method simply returns. Otherwise,
- * lines are scrolled until the selection is visible.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget();
- //NOT DONE - NOT NEEDED
-}
-
-int traversalCode (int key_sym, PhKeyEvent_t ke) {
- if ((style & SWT.SINGLE) != 0) {
- int code = super.traversalCode (key_sym, ke);
- if (key_sym == OS.Pk_Right || key_sym == OS.Pk_Left) {
- code &= ~(SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS);
- }
- return code;
- }
- return SWT.TRAVERSE_ESCAPE;
-}
-
-boolean translateTraversal (int key_sym, PhKeyEvent_t phEvent) {
- boolean translated = super.translateTraversal (key_sym, phEvent);
- if ((style & SWT.SINGLE) != 0 && !translated && key_sym == OS.Pk_Return) {
- postEvent (SWT.DefaultSelection);
- return false;
- }
- return translated;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
deleted file mode 100755
index 1cb4f73c40..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
+++ /dev/null
@@ -1,315 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class ToolBar extends Composite {
- int itemCount;
- ToolItem [] items;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-
- /*
- * Ensure that either of HORIZONTAL or VERTICAL is set.
- * NOTE: HORIZONTAL and VERTICAL have the same values
- * as H_SCROLL and V_SCROLL so it is necessary to first
- * clear these bits to avoid scroll bars and then reset
- * the bits using the original style supplied by the
- * programmer.
- */
- this.style = checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
- int [] args = {
- OS.Pt_ARG_ORIENTATION, (style & SWT.VERTICAL) == 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL, 0,
- };
- OS.PtSetResources(handle, args.length / 3, args);
-}
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
-// if (layout != null) return super.computeSize (wHint, hHint, changed);
- checkWidget();
- PhDim_t dim = new PhDim_t();
- if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtWidgetPreferredSize(handle, dim);
- int width = dim.w, height = dim.h;
- if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- PhRect_t rect = new PhRect_t ();
- PhArea_t area = new PhArea_t ();
- rect.lr_x = (short) (wHint - 1);
- rect.lr_y = (short) (hHint - 1);
- OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
- if (wHint != SWT.DEFAULT) width = area.size_w;
- if (hHint != SWT.DEFAULT) height = area.size_h;
- }
- return new Point(width, height);
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
- int parentHandle = parent.handle;
-
- int [] args = {
- OS.Pt_ARG_FLAGS, hasBorder () ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
- OS.Pt_ARG_TOOLBAR_FLAGS, 0, OS.Pt_TOOLBAR_DRAGGABLE | OS.Pt_TOOLBAR_END_SEPARATOR,
- OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (OS.PtToolbar (), parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createItem (ToolItem item, int index) {
- if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE);
- if (itemCount == items.length) {
- ToolItem [] newItems = new ToolItem [itemCount + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- item.createWidget (index);
- System.arraycopy (items, index, items, index + 1, itemCount++ - index);
- items [index] = item;
-}
-
-void createWidget (int index) {
- super.createWidget (index);
- items = new ToolItem [4];
- itemCount = 0;
-}
-
-void destroyItem (ToolItem item) {
- int index = 0;
- while (index < itemCount) {
- if (items [index] == item) break;
- index++;
- }
- if (index == itemCount) return;
- System.arraycopy (items, index + 1, items, index, --itemCount - index);
- items [itemCount] = null;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget();
- return itemCount;
-}
-
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem [] getItems () {
- checkWidget();
- ToolItem [] result = new ToolItem [itemCount];
- System.arraycopy (items, 0, result, 0, itemCount);
- return result;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (int index) {
- checkWidget();
- int count = itemCount;
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (Point pt) {
- checkWidget();
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- Rectangle rect = items [i].getBounds ();
- if (rect.contains (pt)) return items [i];
- }
- return null;
-}
-
-/**
- * Returns the number of rows in the receiver. When
- * the receiver has the <code>WRAP</code> style, the
- * number of rows can be greater than one. Otherwise,
- * the number of rows is always one.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getRowCount () {
- checkWidget();
- return 1;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (ToolItem item) {
- checkWidget();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- int count = itemCount;
- for (int i=0; i<count; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- ToolItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- super.releaseWidget ();
-}
-
-/* TEMPORARY CODE. Hack for eclipse. */
-public void setData(Object data) {
- super.setData(data);
- if (data != null && data.getClass().getName().indexOf("org.eclipse.ui.internal.ShortcutBarPart") != -1) {
- int [] args = {
- OS.Pt_ARG_ORIENTATION, OS.Pt_VERTICAL, 0,
- };
- OS.PtSetResources(handle, args.length / 3, args);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
deleted file mode 100755
index f9a24d107c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
+++ /dev/null
@@ -1,799 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a button in a tool bar.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class ToolItem extends Item {
- ToolBar parent;
- Control control;
- String toolTipText;
- int toolTipHandle;
- Image hotImage, disabledImage;
- int button, arrow;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style) {
- this(parent, style, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
- * the event object detail field contains the value <code>SWT.ARROW</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-int createArrowImage () {
- short width = 5;
- short height = 4;
- int image = OS.PhCreateImage(null, width, height, OS.Pg_IMAGE_DIRECT_888, 0, 0, 0);
- if (image == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- PhDim_t dim = new PhDim_t();
- dim.w = width;
- dim.h = height;
- int mc = OS.PmMemCreateMC(image, dim, new PhPoint_t());
- if (mc == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.PmMemStart(mc);
- OS.PgSetFillColor(0xFFFFFF);
- OS.PgDrawIRect(0, 0, width, height, OS.Pg_DRAW_FILL);
- OS.PgSetStrokeColor(0x000000);
- OS.PgSetFillColor(0x000000);
- short [] points = {(short)0, (short)1, (short)2, (short)3, (short)4, (short)1};
- OS.PgDrawPolygon(points, points.length / 2, new PhPoint_t(), OS.Pg_DRAW_FILL | OS.Pg_DRAW_STROKE | OS.Pg_CLOSED);
- OS.PmMemFlush(mc, image);
- OS.PmMemStop(mc);
- OS.PmMemReleaseMC(mc);
- OS.PhMakeTransBitmap(image, 0xFFFFFF);
- return image;
-}
-
-void createHandle (int index) {
- state |= HANDLE;
- int count = parent.getItemCount();
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- int parentHandle = parent.handle;
-
- if ((style & SWT.SEPARATOR) != 0) {
- int [] args = {
-// OS.Pt_ARG_SEP_FLAGS, OS.Pt_SEP_VERTICAL, OS.Pt_SEP_VERTICAL | OS.Pt_SEP_HORIZONTAL,
-// OS.Pt_ARG_SEP_TYPE, OS.Pt_NOLINE, 0,
- OS.Pt_ARG_WIDTH, 2, 0,
- OS.Pt_ARG_RESIZE_FLAGS, OS.Pt_RESIZE_Y_ALWAYS, OS.Pt_RESIZE_XY_BITS,
- };
- handle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
- } else if ((style & SWT.DROP_DOWN) != 0) {
- int [] args = {
- OS.Pt_ARG_GROUP_ORIENTATION, OS.Pt_GROUP_HORIZONTAL, 0,
- OS.Pt_ARG_GROUP_FLAGS, OS.Pt_GROUP_EQUAL_SIZE_VERTICAL, OS.Pt_GROUP_EQUAL_SIZE_VERTICAL,
- };
- handle = OS.PtCreateWidget (OS.PtGroup (), parentHandle, args.length / 3, args);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- boolean rightAligned = (parent.style & SWT.RIGHT) != 0;
- args = new int [] {
- OS.Pt_ARG_BALLOON_POSITION, rightAligned ? OS.Pt_BALLOON_RIGHT : OS.Pt_BALLOON_BOTTOM, 0,
- OS.Pt_ARG_BASIC_FLAGS, 0, OS.Pt_RIGHT_ETCH | OS.Pt_RIGHT_OUTLINE,
- };
- button = OS.PtCreateWidget (OS.PtButton (), handle, args.length / 3, args);
- if (button == 0) error (SWT.ERROR_NO_HANDLES);
- int arrowImage = createArrowImage ();
- args = new int [] {
- OS.Pt_ARG_LABEL_IMAGE, arrowImage, 0,
- OS.Pt_ARG_LABEL_TYPE, OS.Pt_IMAGE, 0,
- OS.Pt_ARG_MARGIN_WIDTH, 1, 0,
- OS.Pt_ARG_BASIC_FLAGS, 0, OS.Pt_LEFT_ETCH | OS.Pt_LEFT_OUTLINE,
- };
- arrow = OS.PtCreateWidget (OS.PtButton (), handle, args.length / 3, args);
- OS.free (arrowImage);
- if (arrow == 0) error (SWT.ERROR_NO_HANDLES);
- } else {
- boolean rightAligned = (parent.style & SWT.RIGHT) != 0;
- boolean toggle = (style & (SWT.CHECK | SWT.RADIO)) != 0;
- int [] args = {
- OS.Pt_ARG_BALLOON_POSITION, rightAligned ? OS.Pt_BALLOON_RIGHT : OS.Pt_BALLOON_BOTTOM, 0,
- OS.Pt_ARG_FLAGS, toggle ? OS.Pt_TOGGLE : 0, OS.Pt_TOGGLE,
- };
- handle = button = OS.PtCreateWidget (OS.PtButton (), parentHandle, args.length / 3, args);
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if (index != count) {
- int i = 0;
- int child = OS.PtWidgetChildBack (parentHandle);
- /*
- * Feature in Photon. Tool bars have an extra widget which
- * is the parent of all tool items. PtValidParent() can not be
- * used, since it does not return that widget.
- */
- if (child != 0) child = OS.PtWidgetChildBack (child);
- while (i != index && child != 0) {
- child = OS.PtWidgetBrotherInFront (child);
- i++;
- }
- OS.PtWidgetInsert (topHandle (), child, 1);
- }
- if (OS.PtWidgetIsRealized (parentHandle)) {
- OS.PtRealizeWidget (topHandle ());
- }
-}
-
-void deregister () {
- super.deregister ();
- if ((style & SWT.DROP_DOWN) != 0) {
- WidgetTable.remove (button);
- WidgetTable.remove (arrow);
- }
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- PhArea_t area = new PhArea_t ();
- OS.PtWidgetArea (handle, area);
- return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h);
-}
-
-/**
- * Returns the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-
-/**
- * Returns the receiver's disabled image if it has one, or null
- * if it does not.
- * <p>
- * The disabled image is displayed when the receiver is disabled.
- * </p>
- *
- * @return the receiver's disabled image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getDisabledImage () {
- checkWidget();
- return disabledImage;
-}
-
-public Display getDisplay () {
- ToolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_BLOCKED) == 0;
-}
-
-/**
- * Returns the receiver's hot image if it has one, or null
- * if it does not.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @return the receiver's hot image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getHotImage () {
- checkWidget();
- return hotImage;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>ToolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolBar getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_SET) != 0;
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- checkWidget();
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
-}
-
-void hookEvents () {
- super.hookEvents ();
- if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = getDisplay ().windowProc;
- OS.PtAddEventHandler (handle, OS.Ph_EV_BOUNDARY, windowProc, SWT.MouseEnter);
- OS.PtAddCallback (button, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
- if ((style & SWT.DROP_DOWN) != 0) {
- OS.PtAddCallback (arrow, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
- }
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-
-int processEvent (int widget, int data, int info) {
- if (widget == arrow && data == SWT.Selection) {
- Event event = new Event ();
- event.detail = SWT.ARROW;
- postEvent (SWT.Selection, event);
- return OS.Pt_CONTINUE;
- }
- return super.processEvent (widget, data, info);
-}
-
-int processMouseEnter (int info) {
- if (info == 0) return OS.Pt_END;
- PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
- OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
- if (cbinfo.event == 0) return OS.Pt_END;
- PhEvent_t ev = new PhEvent_t ();
- OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
- switch (ev.subtype) {
- case OS.Ph_EV_PTR_STEADY:
- int [] args = {OS.Pt_ARG_TEXT_FONT, 0, 0};
- OS.PtGetResources (button, args.length / 3, args);
- int length = OS.strlen (args [1]);
- byte [] font = new byte [length + 1];
- OS.memmove (font, args [1], length);
- destroyToolTip (toolTipHandle);
- toolTipHandle = createToolTip (toolTipText, button, font);
- break;
- case OS.Ph_EV_PTR_UNSTEADY:
- destroyToolTip (toolTipHandle);
- toolTipHandle = 0;
- break;
- }
- return OS.Pt_END;
-}
-
-int processSelection (int info) {
- if ((style & SWT.RADIO) != 0) {
- setSelection (true);
- ToolItem [] items = parent.getItems ();
- int index = 0;
- while (index < items.length && items [index] != this) index++;
- ToolItem item;
- int i = index;
- while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- i = index;
- while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
- item.setSelection (false);
- }
- }
- postEvent (SWT.Selection);
- return OS.Pt_CONTINUE;
-}
-
-void register () {
- super.register ();
- if ((style & SWT.DROP_DOWN) != 0) {
- WidgetTable.put (button, this);
- WidgetTable.put (arrow, this);
- }
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseHandle () {
- super.releaseHandle ();
- arrow = button = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- if (toolTipHandle != 0) destroyToolTip (toolTipHandle);
- toolTipHandle = 0;
- parent = null;
- control = null;
- hotImage = null;
- disabledImage = null;
- toolTipText = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- if ((style & SWT.SEPARATOR) == 0) return;
- Control oldControl = this.control;
- this.control = control;
- if (oldControl != null) {
- OS.PtReParentWidget(oldControl.handle, parent.handle);
- }
- if (control != null && !control.isDisposed ()) {
- OS.PtReParentWidget(control.handle, handle);
- control.setBounds (getBounds ());
- }
-}
-
-/**
- * Sets the receiver's disabled image to the argument, which may be
- * null indicating that no disabled image should be displayed.
- * <p>
- * The disbled image is displayed when the receiver is disabled.
- * </p>
- *
- * @param image the disabled image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDisabledImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- disabledImage = image;
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise.
- * <p>
- * A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * </p>
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int [] args = {
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_BLOCKED, OS.Pt_BLOCKED,
- OS.Pt_ARG_FLAGS, enabled ? 0 : OS.Pt_GHOST, OS.Pt_GHOST,
- };
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-/**
- * Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @param image the hot image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHotImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
-
- /* TEMPORARY CODE: remove when when FLAT tool bars are implemented */
- if ((parent.style & SWT.FLAT) != 0) setImage (image);
-
- hotImage = image;
-}
-
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setImage (image);
-
- /* TEMPORARY CODE: remove when when FLAT tool bars are implemented */
- if ((parent.style & SWT.FLAT) != 0 && hotImage != null) return;
-
- int imageHandle = 0;
- int type = OS.Pt_Z_STRING;
- if (image != null) {
- imageHandle = copyPhImage (image.handle);
- int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (button, args.length / 3, args);
- if (args [1] != 0 && OS.strlen (args [1]) > 0) type = OS.Pt_TEXT_IMAGE;
- else type = OS.Pt_IMAGE;
- }
- int [] args = {
- OS.Pt_ARG_LABEL_IMAGE, imageHandle, 0,
- OS.Pt_ARG_LABEL_TYPE, type, 0
- };
- OS.PtSetResources (button, args.length / 3, args);
- if (imageHandle != 0) OS.free (imageHandle);
-
- /*
- * Bug on Photon. When a the text/image is set on a
- * DROP_DOWN item that is realized, the item does not resize
- * to show the new text/image. The fix is to force the item
- * to recalculate the size.
- */
- if ((style & SWT.DROP_DOWN) != 0) {
- if (OS.PtWidgetIsRealized (handle)) {
- OS.PtExtentWidget (handle);
- }
- }
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int [] args = {OS.Pt_ARG_FLAGS, selected ? OS.Pt_SET : 0, OS.Pt_SET};
- OS.PtSetResources (handle, args.length / 3, args);
-}
-
-public void setText (String string) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setText (string);
- int ptr = 0;
- int type = OS.Pt_IMAGE;
- if (string != null) {
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
- int [] args = {OS.Pt_ARG_LABEL_IMAGE, 0, 0};
- OS.PtGetResources (button, args.length / 3, args);
- if (args [1] != 0) type = OS.Pt_TEXT_IMAGE;
- else type = OS.Pt_Z_STRING;
- }
- int [] args = {
- OS.Pt_ARG_TEXT_STRING, ptr, 0,
- OS.Pt_ARG_LABEL_TYPE, type, 0,
- };
- OS.PtSetResources (button, args.length / 3, args);
- if (ptr != 0) OS.free (ptr);
-
- /*
- * Bug on Photon. When a the text/image is set on a
- * DROP_DOWN item that is realized, the item does not resize
- * to show the new text/image. The fix is to force the item
- * to recalculate the size.
- */
- if ((style & SWT.DROP_DOWN) != 0) {
- if (OS.PtWidgetIsRealized (handle)) {
- OS.PtExtentWidget (handle);
- }
- }
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- checkWidget();
- if ((style & SWT.SEPARATOR) == 0) return;
- if (width < 0) return;
- int [] args = {OS.Pt_ARG_WIDTH, width, 0};
- OS.PtSetResources (handle, args.length / 3, args);
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getBounds ());
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java
deleted file mode 100755
index dd6b5d7d95..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java
+++ /dev/null
@@ -1,376 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement rubber banding rectangles.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Move</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tracker extends Widget {
- Composite parent;
- Display display;
- boolean tracking, stippled;
- Rectangle [] rectangles = new Rectangle [0];
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the tracker on the currently active
- * display if there is one. If there is no current display, the
- * tracker is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the tracker on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Tracker (Display display, int style) {
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = style;
- this.display = display;
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tracker (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- this.display = parent.getDisplay ();
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Move,typedListener);
-}
-/**
- * Stop displaying the tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget();
- tracking = false;
-}
-
-void drawRectangles () {
- if (parent != null) {
- if (parent.isDisposed ()) return;
- parent.getShell ().update ();
- } else {
- display.update ();
- }
- int rid = OS.Ph_DEV_RID;
- if (parent != null) rid = OS.PtWidgetRid (parent.handle);
-
- int phGC = OS.PgCreateGC (0);
- if (phGC == 0) return;
- int prevContext = OS.PgSetGC (phGC);
- OS.PgSetRegion (rid);
- OS.PgSetDrawMode (OS.Pg_DRAWMODE_XOR);
- OS.PgSetFillColor (0xffffff);
-
- int bandWidth = 0;
- if (stippled) {
- bandWidth = 2;
- OS.PgSetFillTransPat (OS.Pg_PAT_HALF);
- }
- for (int i=0; i<rectangles.length; i++) {
- Rectangle r = rectangles [i];
- int x1 = r.x;
- int y1 = r.y;
- int x2 = r.x + r.width;
- int y2 = r.y + r.height;
- OS.PgDrawIRect(x1, y1, x2, y1 + bandWidth, OS.Pg_DRAW_FILL);
- OS.PgDrawIRect(x1, y1 + bandWidth + 1, x1 + bandWidth, y2 - bandWidth - 1, OS.Pg_DRAW_FILL);
- OS.PgDrawIRect(x2 - bandWidth, y1 + bandWidth + 1, x2, y2 - bandWidth - 1, OS.Pg_DRAW_FILL);
- OS.PgDrawIRect(x1, y2 - bandWidth, x2, y2, OS.Pg_DRAW_FILL);
- }
- OS.PgSetGC (prevContext);
- OS.PgDestroyGC (phGC);
-}
-
-public Display getDisplay () {
- return display;
-}
-
-/**
- * Returns the bounds of the Rectangles being drawn.
- *
- * @return the bounds of the Rectangles being drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle [] getRectangles () {
- checkWidget();
- return rectangles;
-}
-/**
- * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
- *
- * @return the stippled effect of the rectangles
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getStippled () {
- checkWidget();
- return stippled;
-}
-/**
- * Start displaying the Tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean open () {
- checkWidget();
- int sense = OS.Ph_EV_DRAG | OS.Ph_EV_KEY | OS.Ph_EV_BUT_PRESS |
- OS.Ph_EV_BUT_RELEASE | OS.Ph_EV_PTR_MOTION;
- int [] args = {
- OS.Pt_ARG_WIDTH, 0, 0,
- OS.Pt_ARG_HEIGHT, 0, 0,
- OS.Pt_ARG_REGION_OPAQUE, 0, ~0,
- OS.Pt_ARG_REGION_SENSE, sense, ~0,
- OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0,
- };
- OS.PtSetParentWidget (0);
- int handle = OS.PtCreateWidget (OS.PtRegion (), 0, args.length / 3, args);
- OS.PtRealizeWidget (handle);
- PhRect_t rect = new PhRect_t ();
- int rid = OS.PtWidgetRid (handle);
- int input_group = OS.PhInputGroup (0);
- OS.PhInitDrag (rid, OS.Ph_DRAG_KEY_MOTION | OS.Ph_TRACK_DRAG, rect, null, input_group, null, null, null, null, null);
- PhCursorInfo_t info = new PhCursorInfo_t ();
- OS.PhQueryCursor ((short)input_group, info);
- int oldX = info.pos_x;
- int oldY = info.pos_y;
- int size = PhEvent_t.sizeof + 1024;
- int buffer = OS.malloc (size);
- PhEvent_t event = new PhEvent_t ();
- Event ev = new Event ();
-
- drawRectangles ();
- boolean tracking = true;
- boolean cancelled = false;
- while (tracking && !cancelled) {
- if (parent != null && parent.isDisposed ()) break;
- int result = OS.PhEventNext (buffer, size);
- switch (result) {
- case OS.Ph_EVENT_MSG: break;
- case OS.Ph_RESIZE_MSG:
- size = OS.PhGetMsgSize (buffer);
- OS.free (buffer);
- buffer = OS.malloc (size);
- continue;
- }
- OS.memmove (event, buffer, PhEvent_t.sizeof);
- if (event.type == OS.Ph_EV_DRAG) {
- switch (event.subtype) {
- case OS.Ph_EV_DRAG_MOTION_EVENT: {
- int data = OS.PhGetData (buffer);
- if (data == 0) break;
- PhPointerEvent_t pe = new PhPointerEvent_t ();
- OS.memmove (pe, data, PhPointerEvent_t.sizeof);
- int newX = pe.pos_x;
- int newY = pe.pos_y;
- if (newX != oldX || newY != oldY) {
- drawRectangles ();
- for (int i=0; i<rectangles.length; i++) {
- rectangles [i].x += newX - oldX;
- rectangles [i].y += newY - oldY;
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the move
- * event. If this happens, return false to indicate
- * that the tracking has failed.
- */
- ev.x = newX;
- ev.y = newY;
- sendEvent (SWT.Move, ev);
- if (isDisposed ()) return false;
- drawRectangles ();
- oldX = newX;
- oldY = newY;
- }
- break;
- }
- case OS.Ph_EV_DRAG_KEY_EVENT: {
- int data = OS.PhGetData (buffer);
- if (data == 0) break;
- PhKeyEvent_t ke = new PhKeyEvent_t ();
- OS.memmove (ke, data, PhKeyEvent_t.sizeof);
- if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
- cancelled = ke.key_sym == OS.Pk_Escape;
- }
- break;
- }
- case OS.Ph_EV_DRAG_COMPLETE: {
- tracking = false;
- break;
- }
- }
- }
- OS.PtEventHandler (buffer);
- }
- drawRectangles ();
- tracking = false;
- OS.PtDestroyWidget (handle);
- return !cancelled;
-}
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
- display = null;
- rectangles = null;
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
-}
-public void setCursor (Cursor value) {
-}
-/**
- * Specify the rectangles that should be drawn.
- *
- * @param rectangles the bounds of the rectangles to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setRectangles (Rectangle [] rectangles) {
- checkWidget();
- if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT);
- this.rectangles = rectangles;
-}
-/**
- * Change the appearance of the line used to draw the rectangles.
- *
- * @param stippled <code>true</code> if rectangle should appear stippled
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setStippled (boolean stippled) {
- checkWidget();
- this.stippled = stippled;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
deleted file mode 100755
index 9602c63d11..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
+++ /dev/null
@@ -1,881 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * This class is the abstract superclass of all user interface objects.
- * Widgets are created, disposed and issue notification to listeners
- * when events occur which affect them.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Dispose</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation. However, it has not been marked
- * final to allow those outside of the SWT development team to implement
- * patched versions of the class in order to get around specific
- * limitations in advance of when those limitations can be addressed
- * by the team. Any class built using subclassing to access the internals
- * of this class will likely fail to compile or run between releases and
- * may be strongly platform specific. Subclassing should not be attempted
- * without an intimate and detailed understanding of the workings of the
- * hierarchy. No support is provided for user-written classes which are
- * implemented as subclasses of this class.
- * </p>
- *
- * @see #checkSubclass
- */
-public abstract class Widget {
- public int handle;
- int style, state;
- EventTable eventTable;
- Object data;
- String [] keys;
- Object [] values;
-
- static final int DISPOSED = 0x00000001;
- static final int HANDLE = 0x00000002;
- static final int CANVAS = 0x00000004;
-
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
-
- static final char Mnemonic = '&';
-
-Widget () {
- /* Do nothing */
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see #checkSubclass
- * @see #getStyle
- */
-public Widget (Widget parent, int style) {
- checkSubclass ();
- checkParent (parent);
- this.style = style;
-}
-
-static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
- int mask = int0 | int1 | int2 | int3 | int4 | int5;
- if ((style & mask) == 0) style |= int0;
- if ((style & int0) != 0) style = (style & ~mask) | int0;
- if ((style & int1) != 0) style = (style & ~mask) | int1;
- if ((style & int2) != 0) style = (style & ~mask) | int2;
- if ((style & int3) != 0) style = (style & ~mask) | int3;
- if ((style & int4) != 0) style = (style & ~mask) | int4;
- if ((style & int5) != 0) style = (style & ~mask) | int5;
- return style;
-}
-
-void checkParent (Widget parent) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (parent.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-
-int copyPhImage(int image) {
- if (image == 0) return 0;
- int imageHandle = OS.PiDuplicateImage (image, 0);
- /* Bug in Photon - The image returned by PiDuplicateImage
- has the same mask_bm as the original image.
- */
- PhImage_t phImage = new PhImage_t();
- OS.memmove (phImage, imageHandle, PhImage_t.sizeof);
- if (phImage.mask_bm != 0) {
- int length = phImage.mask_bpl * phImage.size_h;
- int ptr = OS.malloc (length);
- OS.memmove(ptr, phImage.mask_bm, length);
- phImage.mask_bm = ptr;
- OS.memmove (imageHandle, phImage, PhImage_t.sizeof);
- }
- return imageHandle;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when an event of the given type occurs. When the
- * event does occur in the widget, the listener is notified by
- * sending it the <code>handleEvent()</code> message.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #removeListener
- */
-public void addListener (int eventType, Listener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new EventTable ();
- eventTable.hook (eventType, handler);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when the widget is disposed. When the widget is
- * disposed, the listener is notified by sending it the
- * <code>widgetDisposed()</code> message.
- *
- * @param listener the listener which should be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void addDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Dispose, typedListener);
-}
-
-void createHandle (int index) {
- /* Do nothing */
-}
-
-int createToolTip (String string, int handle, byte [] font) {
- if (string == null || string.length () == 0 || handle == 0) {
- return 0;
- }
-
- int shellHandle = OS.PtFindDisjoint (handle);
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- Display display = getDisplay ();
- int fill = display.INFO_BACKGROUND;
- int text_color = display.INFO_FOREGROUND;
- int toolTipHandle = OS.PtInflateBalloon (shellHandle, handle, OS.Pt_BALLOON_RIGHT, buffer, font, fill, text_color);
-
- /*
- * Feature in Photon. The position of the inflated balloon
- * is relative to the widget position and not to the cursor
- * position. The fix is to re-position the balloon.
- */
- int ig = OS.PhInputGroup (0);
- PhCursorInfo_t info = new PhCursorInfo_t ();
- OS.PhQueryCursor ((short)ig, info);
- short [] absX = new short [1], absY = new short [1];
- OS.PtGetAbsPosition (shellHandle, absX, absY);
- int x = info.pos_x - absX [0] + 16;
- int y = info.pos_y - absY [0] + 16;
- PhArea_t shellArea = new PhArea_t ();
- OS.PtWidgetArea (shellHandle, shellArea);
- PhArea_t toolTipArea = new PhArea_t ();
- OS.PtWidgetArea (toolTipHandle, toolTipArea);
- x = Math.max (0, Math.min (x, shellArea.size_w - toolTipArea.size_w));
- y = Math.max (0, Math.min (y, shellArea.size_h - toolTipArea.size_h));
- PhPoint_t pt = new PhPoint_t ();
- pt.x = (short) x;
- pt.y = (short) y;
- int ptr = OS.malloc (PhPoint_t.sizeof);
- OS.memmove (ptr, pt, PhPoint_t.sizeof);
- int [] args = {OS.Pt_ARG_POS, ptr, 0};
- OS.PtSetResources (toolTipHandle, args.length / 3, args);
- OS.free (ptr);
-
- return toolTipHandle;
-}
-
-void createWidget (int index) {
- createHandle (index);
- hookEvents ();
- register ();
-}
-
-void deregister () {
- if (handle == 0) return;
- WidgetTable.remove (handle);
-}
-
-void destroyToolTip (int toolTipHandle) {
- if (toolTipHandle != 0) OS.PtDestroyWidget (toolTipHandle);
-}
-
-void destroyWidget () {
- int topHandle = topHandle ();
- releaseHandle ();
- if (topHandle != 0) {
- OS.PtDestroyWidget (topHandle);
- }
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver and all its descendents. After this method has
- * been invoked, the receiver and all descendents will answer
- * <code>true</code> when sent the message <code>isDisposed()</code>.
- * Any internal connections between the widgets in the tree will
- * have been removed to facilitate garbage collection.
- * <p>
- * NOTE: This method is not called recursively on the descendents
- * of the receiver. This means that, widget implementers can not
- * detect when a widget is being disposed of by re-implementing
- * this method, but should instead listen for the <code>Dispose</code>
- * event.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #addDisposeListener
- * @see #removeDisposeListener
- * @see #checkWidget
- */
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed()) return;
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- releaseChild ();
- releaseWidget ();
- destroyWidget ();
-}
-
-static void error (int code) {
- SWT.error(code);
-}
-
-/**
- * Returns the application defined widget data associated
- * with the receiver, or null if it has not been set. The
- * <em>widget data</em> is a single, unnamed field that is
- * stored with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @return the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData () {
- checkWidget();
- return data;
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData (String key) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the <code>Display</code> that is associated with
- * the receiver.
- * <p>
- * A widget's display is either provided when it is created
- * (for example, top level <code>Shell</code>s) or is the
- * same as its parent's display.
- * </p>
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public abstract Display getDisplay ();
-
-String getName () {
- String string = getClass ().getName ();
- int index = string.length ();
- while (--index > 0 && string.charAt (index) != '.');
- return string.substring (index + 1, string.length ());
-}
-
-String getNameText () {
- return "";
-}
-
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created. This can occur when the underlying
- * operating system does not support a particular combination of
- * requested styles. For example, if the platform widget used to
- * implement a particular SWT widget always has scroll bars, the
- * result of calling this method would always have the
- * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- checkWidget();
- return style;
-}
-
-boolean hooks (int eventType) {
- if (eventTable == null) return false;
- return eventTable.hooks (eventType);
-}
-
-void hookEvents () {
- /* Do nothing */
-}
-
-/**
- * Returns <code>true</code> if the widget has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the widget.
- * When a widget has been disposed, it is an error to
- * invoke any other method using the widget.
- * </p>
- *
- * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- if (handle != 0) return false;
- if ((state & HANDLE) != 0) return true;
- return (state & DISPOSED) != 0;
-}
-
-boolean isValidSubclass () {
- return Display.isValidClass (getClass ());
-}
-
-protected boolean isListening (int eventType) {
- checkWidget();
- return hooks (eventType);
-}
-
-boolean isValidThread () {
- return getDisplay ().isValidThread ();
-}
-
-/**
- * Notifies all of the receiver's listeners for events
- * of the given type that one such event has occurred by
- * invoking their <code>handleEvent()</code> method.
- *
- * @param eventType the type of event which has occurred
- * @param event the event data
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- eventTable.sendEvent (event);
-}
-
-void postEvent (int eventType) {
- if (eventTable == null) return;
- postEvent (eventType, new Event ());
-}
-
-void postEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- if (event.time == 0) {
- event.time = (int) System.currentTimeMillis ();
- }
- getDisplay ().postEvent (event);
-}
-
-int processActivate (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processArm (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processDefaultSelection (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processFocusIn (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processFocusOut (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processHide (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processHotkey (int data, int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processKey (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processEvent (int widget, int data, int info) {
- switch (data) {
- case SWT.Activate: return processActivate (info);
- case SWT.Arm: return processArm (info);
-// case SWT.Dispose: return processDispose (info);
- case SWT.DefaultSelection: return processDefaultSelection (info);
- case SWT.FocusIn: return processFocusIn (info);
- case SWT.FocusOut: return processFocusOut (info);
-// case SWT.Help: return processHelp (info);
- case SWT.Hide: return processHide (info);
- case SWT.KeyDown:
- case SWT.KeyUp: return processKey (info);
- case SWT.Modify: return processModify (info);
- case SWT.MouseDown:
- case SWT.MouseMove:
- case SWT.MouseUp: return processMouse (info);
- case SWT.MouseEnter: return processMouseEnter (info);
-// case SWT.MouseExit: return processMouseOut (info);
- case SWT.Move: return processMove (info);
-// case SWT.Paint: return processPaint (info);
- case SWT.Resize: return processResize (info);
- case SWT.Show: return processShow (info);
- case SWT.Selection: return processSelection (info);
- case SWT.Verify: return processVerify (info);
- }
- return OS.Pt_CONTINUE;
-}
-
-int processModify (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processMouse (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processMouseEnter (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processMove (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processPaint (int damage) {
- return OS.Pt_CONTINUE;
-}
-
-int processResize (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processShow (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processSelection (int info) {
- return OS.Pt_CONTINUE;
-}
-
-int processVerify (int info) {
- return OS.Pt_CONTINUE;
-}
-
-void releaseChild () {
- /* Do nothing */
-}
-
-void register () {
- if (handle == 0) return;
- WidgetTable.put (handle, this);
-}
-
-void releaseHandle () {
- handle = 0;
- state |= DISPOSED;
-}
-
-void releaseWidget () {
- sendEvent (SWT.Dispose);
- deregister ();
- eventTable = null;
- data = null;
- keys = null;
- values = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-public void removeListener (int eventType, Listener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-
-protected void removeListener (int eventType, SWTEventListener handler) {
- checkWidget();
- if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, handler);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when the widget is disposed.
- *
- * @param listener the listener which should no longer be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void removeDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Dispose, listener);
-}
-
-void replaceMnemonic (int mnemonic, boolean normal, boolean alt) {
- Display display = getDisplay ();
- int [] args = {OS.Pt_ARG_ACCEL_KEY, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- if (args [1] != 0) {
- int length = OS.strlen (args [1]);
- if (length > 0) {
- byte [] buffer = new byte [length];
- OS.memmove (buffer, args [1], length);
- char [] accelText = Converter.mbcsToWcs (null, buffer);
- if (accelText.length > 0) {
- char key = Character.toLowerCase (accelText [0]);
- if (normal) {
- OS.PtRemoveHotkeyHandler (handle, key, 0, (short)0, SWT.Activate, display.windowProc);
- }
- if (alt) {
- OS.PtRemoveHotkeyHandler (handle, key, OS.Pk_KM_Alt, (short)0, SWT.Activate, display.windowProc);
- }
- }
- }
- }
- if (mnemonic == 0) return;
- char key = Character.toLowerCase ((char)mnemonic);
- if (normal) {
- OS.PtAddHotkeyHandler (handle, key, 0, (short)0, SWT.Activate, display.windowProc);
- }
- if (alt) {
- OS.PtAddHotkeyHandler (handle, key, OS.Pk_KM_Alt, (short)0, SWT.Activate, display.windowProc);
- }
-}
-
-void sendEvent (int eventType) {
- if (eventTable == null) return;
- sendEvent (eventType, new Event ());
-}
-
-void sendEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.widget = this;
- event.type = eventType;
- if (event.time == 0) {
- event.time = (int) System.currentTimeMillis ();
- }
- eventTable.sendEvent (event);
-}
-
-/**
- * Sets the application defined widget data associated
- * with the receiver to be the argument. The <em>widget
- * data</em> is a single, unnamed field that is stored
- * with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @param data the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- */
-public void setData (Object data) {
- checkWidget();
- this.data = data;
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given value.
- * <p>
- * Applications may associate arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getData
- */
-public void setData (String key, Object value) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-void setKeyState(Event event, PhKeyEvent_t ke) {
- int key_mods = ke.key_mods;
- int button_state = ke.button_state;
- if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
- if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
- if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
- if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
- if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
- if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
- switch (event.type) {
- case SWT.KeyDown:
- case SWT.Traverse:
- if (event.keyCode == SWT.ALT) event.stateMask &= ~SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask &= ~SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask &= ~SWT.CONTROL;
- break;
- case SWT.KeyUp:
- if (event.keyCode == SWT.ALT) event.stateMask |= SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask |= SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask |= SWT.CONTROL;
- break;
- }
-}
-
-void setMouseState(int type, Event event, PhPointerEvent_t pe) {
- int key_mods = pe.key_mods;
- int buttons = pe.buttons;
- int button_state = pe.button_state;
- if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
- if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
- if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
- if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
- if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
- if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
- switch (type) {
- case OS.Ph_EV_BUT_PRESS:
- if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask &= ~SWT.BUTTON1;
- if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask &= ~SWT.BUTTON2;
- if (buttons == OS.Ph_BUTTON_MENU) event.stateMask &= ~SWT.BUTTON3;
- break;
- case OS.Ph_EV_BUT_RELEASE:
- case OS.Ph_EV_DRAG:
- if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask |= SWT.BUTTON1;
- if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask |= SWT.BUTTON2;
- if (buttons == OS.Ph_BUTTON_MENU) event.stateMask |= SWT.BUTTON3;
- break;
- }
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- String string = "*Disposed*";
- if (!isDisposed ()) {
- string = "*Wrong Thread*";
- if (isValidThread ()) string = getNameText ();
- }
- return getName () + " {" + string + "}";
-}
-
-int topHandle () {
- return handle;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/WidgetTable.java
deleted file mode 100755
index cb7244a6e6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/WidgetTable.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-
-class WidgetTable {
- static int FreeSlot = 0;
- static int GrowSize = 1024;
- static int [] IndexTable = new int [GrowSize];
- static Widget [] WidgetTable = new Widget [GrowSize];
- static int ArgPtr = OS.malloc (4);
- static int [] ArgBuffer = new int [1];
- static int [] SetArgs = new int [] {OS.Pt_ARG_USER_DATA, ArgPtr, 4};
- static int [] GetArgs = new int [] {OS.Pt_ARG_USER_DATA, 0, 0};
- static {
- for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
- IndexTable [GrowSize - 1] = -1;
- }
-public static synchronized Widget get (int handle) {
- if (handle == 0) return null;
- GetArgs [1] = 0;
- OS.PtGetResources (handle, GetArgs.length / 3, GetArgs);
- if (GetArgs [1] == 0) return null;
- OS.memmove (ArgBuffer, GetArgs [1], 4);
- if (ArgBuffer [0] == 0) return null;
- int index = ArgBuffer [0] - 1;
- if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
- return null;
-}
-public synchronized static void put(int handle, Widget widget) {
- if (handle == 0) return;
- if (FreeSlot == -1) {
- int length = (FreeSlot = IndexTable.length) + GrowSize;
- int[] newIndexTable = new int[length];
- Widget[] newWidgetTable = new Widget [length];
- System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
- System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
- for (int i = FreeSlot; i < length - 1; i++) {
- newIndexTable[i] = i + 1;
- }
- newIndexTable[length - 1] = -1;
- IndexTable = newIndexTable;
- WidgetTable = newWidgetTable;
- }
- ArgBuffer [0] = FreeSlot + 1;
- OS.memmove (ArgPtr, ArgBuffer, 4);
- OS.PtSetResources (handle, SetArgs.length / 3, SetArgs);
- int oldSlot = FreeSlot;
- FreeSlot = IndexTable[oldSlot];
- IndexTable [oldSlot] = -2;
- WidgetTable [oldSlot] = widget;
-}
-public static synchronized Widget remove (int handle) {
- if (handle == 0) return null;
- GetArgs [1] = 0;
- OS.PtGetResources (handle, GetArgs.length / 3, GetArgs);
- if (GetArgs [1] == 0) return null;
- OS.memmove (ArgBuffer, GetArgs [1], 4);
- if (ArgBuffer [0] == 0) return null;
- int index = ArgBuffer [0] - 1;
- Widget widget = null;
- if (0 <= index && index < WidgetTable.length) {
- widget = WidgetTable [index];
- WidgetTable [index] = null;
- IndexTable [index] = FreeSlot;
- FreeSlot = index;
- ArgBuffer [0] = 0;
- OS.memmove (ArgPtr, ArgBuffer, 4);
- OS.PtSetResources (handle, SetArgs.length / 3, SetArgs);
- }
- return widget;
-}
-public static synchronized Shell [] shells () {
- int length = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) length++;
- }
- int index = 0;
- Shell [] result = new Shell [length];
- for (int i=0; i<WidgetTable.length; i++) {
- Widget widget = WidgetTable [i];
- if (widget != null && widget instanceof Shell) {
- result [index++] = (Shell) widget;
- }
- }
- return result;
-}
-public static synchronized int size () {
- int size = 0;
- for (int i=0; i<WidgetTable.length; i++) {
- if (WidgetTable [i] != null) size++;
- }
- return size;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
deleted file mode 100755
index 6bbc3871d8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
+++ /dev/null
@@ -1,324 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage the operating system resources that
- * implement SWT's RGB color model. To create a color you can either
- * specify the individual color components as integers in the range
- * 0 to 255 or provide an instance of an <code>RGB</code>.
- * <p>
- * Application code must explicitly invoke the <code>Color.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see RGB
- */
-
-public final class Color {
-
- /**
- * the handle to the OS color resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this color was created
- */
- Device device;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Color() {
-}
-
-/**
- * Constructs a new instance of this class given a device and the
- * desired red, green and blue values expressed as ints in the range
- * 0 to 255 (where 0 is black and 255 is full brightness). On limited
- * color devices, the color instance created by this call may not have
- * the same RGB values as the ones specified by the arguments. The
- * RGB values on the returned instance will be the color values of
- * the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, int red, int green, int blue) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, red, green, blue);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new instance of this class given a device and an
- * <code>RGB</code> describing the desired red, green and blue values.
- * On limited color devices, the color instance created by this call
- * may not have the same RGB values as the ones specified by the
- * argument. The RGB values on the returned instance will be the color
- * values of the operating system color.
- * <p>
- * You must dispose the color when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param RGB the RGB values of the desired color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
- * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
- * </ul>
- *
- * @see #dispose
- */
-public Color (Device device, RGB rgb) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, rgb.red, rgb.green, rgb.blue);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the color. Applications must dispose of all colors which
- * they allocate.
- */
-public void dispose() {
- if (handle == -1) return;
- /*
- * If this is a palette-based device,
- * Decrease the reference count for this color.
- * If the reference count reaches 0, the slot may
- * be reused when another color is allocated.
- */
- int hPal = device.hPalette;
- if (hPal != 0) {
- int index = OS.GetNearestPaletteIndex(hPal, handle);
- int[] colorRefCount = device.colorRefCount;
- if (colorRefCount[index] > 0) {
- colorRefCount[index]--;
- }
- }
- handle = -1;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Color)) return false;
- Color color = (Color) object;
- return device == color.device && (handle & 0xFFFFFF) == (color.handle & 0xFFFFFF);
-}
-
-/**
- * Returns the amount of blue in the color, from 0 to 255.
- *
- * @return the blue component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getBlue () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle & 0xFF0000) >> 16;
-}
-
-/**
- * Returns the amount of green in the color, from 0 to 255.
- *
- * @return the green component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getGreen () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return (handle & 0xFF00) >> 8 ;
-}
-
-/**
- * Returns the amount of red in the color, from 0 to 255.
- *
- * @return the red component of the color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getRed () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return handle & 0xFF;
-}
-
-/**
- * Returns an <code>RGB</code> representing the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public RGB getRGB () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return new RGB(handle & 0xFF, (handle & 0xFF00) >> 8, (handle & 0xFF0000) >> 16);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-/**
- * Allocates the operating system resources associated
- * with the receiver.
- *
- * @param device the device on which to allocate the color
- * @param red the amount of red in the color
- * @param green the amount of green in the color
- * @param blue the amount of blue in the color
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- *
- * @see #dispose
- */
-void init(Device device, int red, int green, int blue) {
- if (red > 255 || red < 0 || green > 255 || green < 0 || blue > 255 || blue < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- this.device = device;
- handle = 0x02000000 | (red & 0xFF) | ((green & 0xFF) << 8) | ((blue & 0xFF) << 16);
-
- /* If this is not a palette-based device, return */
- int hPal = device.hPalette;
- if (hPal == 0) return;
-
- int[] colorRefCount = device.colorRefCount;
- /* Add this color to the default palette now */
- /* First find out if the color already exists */
- int index = OS.GetNearestPaletteIndex(hPal, handle);
- /* See if the nearest color actually is the color */
- byte[] entry = new byte[4];
- OS.GetPaletteEntries(hPal, index, 1, entry);
- if ((entry[0] == (byte)red) && (entry[1] == (byte)green) &&
- (entry[2] == (byte)blue)) {
- /* Found the color. Increment the ref count and return */
- colorRefCount[index]++;
- return;
- }
- /* Didn't find the color, allocate it now. Find the first free entry */
- int i = 0;
- while (i < colorRefCount.length) {
- if (colorRefCount[i] == 0) {
- index = i;
- break;
- }
- i++;
- }
- if (i == colorRefCount.length) {
- /* No free entries, use the closest one */
- /* Remake the handle from the actual rgbs */
- handle = (entry[0] & 0xFF) | ((entry[1] & 0xFF) << 8) |
- ((entry[2] & 0xFF) << 16);
- } else {
- /* Found a free entry */
- int offset = index * 4;
- entry = new byte[] { (byte)(red & 0xFF), (byte)(green & 0xFF), (byte)(blue & 0xFF), 0 };
- OS.SetPaletteEntries(hPal, index, 1, entry);
- }
- colorRefCount[index]++;
-}
-
-/**
- * Returns <code>true</code> if the color has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the color.
- * When a color has been disposed, it is an error to
- * invoke any other method using the color.
- *
- * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == -1;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Color {*DISPOSED*}";
- return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
-}
-
-/**
- * Invokes platform specific functionality to allocate a new color.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Color</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param handle the handle for the color
- *
- * @private
- */
-public static Color win32_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Color color = new Color();
- color.handle = handle;
- color.device = device;
- return color;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
deleted file mode 100755
index 297c234c80..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * specify the appearance of the on-screen pointer. To create a
- * cursor you specify the device and either a simple cursor style
- * describing one of the standard operating system provided cursors
- * or the image and mask data for the desired appearance.
- * <p>
- * Application code must explicitly invoke the <code>Cursor.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>
- * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
- * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
- * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
- * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
- * </dd>
- * </dl>
- */
-
-public final class Cursor {
-
- /**
- * the handle to the OS cursor resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this cursor was created
- */
- Device device;
-
- /**
- * data used to create a HAND cursor.
- */
- static final byte[] HAND_SOURCE = {
- (byte)0xf9,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x3f,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x07,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x03,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x00,(byte)0xff,(byte)0xff,
-
- (byte)0x10,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0x00,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0x80,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xc0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xe0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xf0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xf8,(byte)0x00,(byte)0xff,(byte)0xff,
- (byte)0xfc,(byte)0x01,(byte)0xff,(byte)0xff,
-
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
-
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff
- };
- static final byte[] HAND_MASK = {
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xc0,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,
-
- (byte)0x07,(byte)0xdb,(byte)0x00,(byte)0x00,
- (byte)0x67,(byte)0xfb,(byte)0x00,(byte)0x00,
- (byte)0x3f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x1f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x0f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x07,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x03,(byte)0xfe,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
-
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
-
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00
- };
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Cursor() {
-}
-
-/**
- * Constructs a new cursor given a device and a style
- * constant describing the desired cursor appearance.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param style the style of cursor to allocate
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
- * </ul>
- *
- * @see Cursor for the supported style values
- */
-public Cursor(Device device, int style) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- int lpCursorName = 0;
- switch (style) {
- case SWT.CURSOR_HAND: lpCursorName = OS.IDC_HAND; break;
- case SWT.CURSOR_ARROW: lpCursorName = OS.IDC_ARROW; break;
- case SWT.CURSOR_WAIT: lpCursorName = OS.IDC_WAIT; break;
- case SWT.CURSOR_CROSS: lpCursorName = OS.IDC_CROSS; break;
- case SWT.CURSOR_APPSTARTING: lpCursorName = OS.IDC_APPSTARTING; break;
- case SWT.CURSOR_HELP: lpCursorName = OS.IDC_HELP; break;
- case SWT.CURSOR_SIZEALL: lpCursorName = OS.IDC_SIZEALL; break;
- case SWT.CURSOR_SIZENESW: lpCursorName = OS.IDC_SIZENESW; break;
- case SWT.CURSOR_SIZENS: lpCursorName = OS.IDC_SIZENS; break;
- case SWT.CURSOR_SIZENWSE: lpCursorName = OS.IDC_SIZENWSE; break;
- case SWT.CURSOR_SIZEWE: lpCursorName = OS.IDC_SIZEWE; break;
- case SWT.CURSOR_SIZEN: lpCursorName = OS.IDC_SIZENS; break;
- case SWT.CURSOR_SIZES: lpCursorName = OS.IDC_SIZENS; break;
- case SWT.CURSOR_SIZEE: lpCursorName = OS.IDC_SIZEWE; break;
- case SWT.CURSOR_SIZEW: lpCursorName = OS.IDC_SIZEWE; break;
- case SWT.CURSOR_SIZENE: lpCursorName = OS.IDC_SIZENESW; break;
- case SWT.CURSOR_SIZESE: lpCursorName = OS.IDC_SIZENWSE; break;
- case SWT.CURSOR_SIZESW: lpCursorName = OS.IDC_SIZENESW; break;
- case SWT.CURSOR_SIZENW: lpCursorName = OS.IDC_SIZENWSE; break;
- case SWT.CURSOR_UPARROW: lpCursorName = OS.IDC_UPARROW; break;
- case SWT.CURSOR_IBEAM: lpCursorName = OS.IDC_IBEAM; break;
- case SWT.CURSOR_NO: lpCursorName = OS.IDC_NO; break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- handle = OS.LoadCursor(0, lpCursorName);
- /*
- * IDC_HAND is supported only on Windows 2000 and Windows 98.
- * Create a hand cursor if running in other Windows platforms.
- */
- if (handle == 0 && style == SWT.CURSOR_HAND) {
- int width = OS.GetSystemMetrics(OS.SM_CXCURSOR);
- int height = OS.GetSystemMetrics(OS.SM_CYCURSOR);
- if (width == 32 && height == 32) {
- int hInst = OS.GetModuleHandle(null);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- handle = OS.CreateCursor(hInst, 5, 0, 32, 32, HAND_SOURCE, HAND_MASK);
-
- }
- }
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new cursor given a device, image and mask
- * data describing the desired cursor appearance, and the x
- * and y co-ordinates of the <em>hotspot</em> (that is, the point
- * within the area covered by the cursor which is considered
- * to be where the on-screen pointer is "pointing").
- * <p>
- * The mask data is allowed to be null, but in this case the source
- * must be an ImageData representing an icon that specifies both
- * color data and mask data.
- * <p>
- * You must dispose the cursor when it is no longer required.
- * </p>
- *
- * @param device the device on which to allocate the cursor
- * @param source the color data for the cursor
- * @param mask the mask data for the cursor (or null)
- * @param hotspotX the x coordinate of the cursor's hotspot
- * @param hotspotY the y coordinate of the cursor's hotspot
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
- * size, or either is not of depth one, or if the hotspot is outside
- * the bounds of the image</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
- * </ul>
- */
-public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) {
- if (source.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- mask = source.getTransparencyMask();
- }
- /* Check the bounds. Mask must be the same size as source */
- if (mask.width != source.width || mask.height != source.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Check color depths */
- if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (source.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- /* Check the hotspots */
- if (hotspotX >= source.width || hotspotX < 0 ||
- hotspotY >= source.height || hotspotY < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /* Create the cursor */
- int hInst = OS.GetModuleHandle(null);
- if (OS.IsWinCE) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
- handle = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, source.data, mask.data);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the cursor. Applications must dispose of all cursors which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
-
- /*
- * It is an error in Windows to destroy the current
- * cursor. Check that the cursor that is about to
- * be destroyed is the current cursor. If so, set
- * the current cursor to be IDC_ARROW. Note that
- * Windows shares predefined cursors so the call to
- * LoadCursor() does not leak.
- */
- if (OS.GetCursor() == handle) {
- OS.SetCursor(OS.LoadCursor(0, OS.IDC_ARROW));
- }
-
- /*
- * The MSDN states that one should not destroy a shared
- * cursor, that is, one obtained from LoadCursor.
- * However, it does not appear to do any harm, so rather
- * than keep track of how a cursor was created, we just
- * destroy them all. If this causes problems in the future,
- * put the flag back in.
- */
- if (!OS.IsWinCE) OS.DestroyCursor(handle);
- handle = 0;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Cursor)) return false;
- Cursor cursor = (Cursor) object;
- return device == cursor.device && handle == cursor.handle;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-/**
- * Returns <code>true</code> if the cursor has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the cursor.
- * When a cursor has been disposed, it is an error to
- * invoke any other method using the cursor.
- *
- * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return "Cursor {" + handle + "}";
-}
-
-/**
- * Invokes platform specific functionality to allocate a new cursor.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Cursor</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param handle the handle for the cursor
- *
- * @private
- */
-public static Cursor win32_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Cursor cursor = new Cursor();
- cursor.handle = handle;
- cursor.device = device;
- return cursor;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
deleted file mode 100755
index 9342609721..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
+++ /dev/null
@@ -1,702 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-public abstract class Device implements Drawable {
-
- /* Debugging */
- public static boolean DEBUG;
- boolean debug = DEBUG;
- boolean tracking = DEBUG;
- Error [] errors;
- Object [] objects;
-
- /* Palette */
- public int hPalette = 0;
- int [] colorRefCount;
-
- /* System Font */
- int systemFont;
-
- /* Font Enumeration */
- int nFonts = 256;
- LOGFONT [] logFonts;
-
- boolean disposed;
-
- /*
- * TEMPORARY CODE. When a graphics object is
- * created and the device parameter is null,
- * the current Display is used. This presents
- * a problem because SWT graphics does not
- * reference classes in SWT widgets. The correct
- * fix is to remove this feature. Unfortunately,
- * too many application programs rely on this
- * feature.
- *
- * This code will be removed in the future.
- */
- protected static Device CurrentDevice;
- protected static Runnable DeviceFinder;
- static {
- try {
- Class.forName ("org.eclipse.swt.widgets.Display");
- } catch (Throwable e) {}
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static Device getDevice () {
- if (DeviceFinder != null) DeviceFinder.run();
- Device device = CurrentDevice;
- CurrentDevice = null;
- return device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * You must dispose the device when it is no longer required.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #create
- * @see #init
- * @see DeviceData
- */
-public Device(DeviceData data) {
- if (data != null) {
- debug = data.debug;
- tracking = data.tracking;
- }
- create (data);
- init ();
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
- }
-
- /* Initialize the system font slot */
- systemFont = getSystemFont().handle;
-}
-
-/**
- * Throws an <code>SWTException</code> if the receiver can not
- * be accessed by the caller. This may include both checks on
- * the state of the receiver and more generally on the entire
- * execution context. This method <em>should</em> be called by
- * device implementors to enforce the standard SWT invariants.
- * <p>
- * Currently, it is an error to invoke any method (other than
- * <code>isDisposed()</code> and <code>dispose()</code>) on a
- * device that has had its <code>dispose()</code> method called.
- * </p><p>
- * In future releases of SWT, there may be more or fewer error
- * checks and exceptions may be thrown for different reasons.
- * <p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-protected void checkDevice () {
- if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
-}
-
-/**
- * Creates the device in the operating system. If the device
- * does not have a handle, this method may do nothing depending
- * on the device.
- * <p>
- * This method is called before <code>init</code>.
- * </p><p>
- * Subclasses are supposed to reimplement this method and not
- * call the <code>super</code> implementation.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #init
- */
-protected void create (DeviceData data) {
-}
-
-int computePixels(int height) {
- int hDC = internal_new_GC (null);
- int pixels = -Compatibility.round(height * OS.GetDeviceCaps(hDC, OS.LOGPIXELSY), 72);
- internal_dispose_GC (hDC, null);
- return pixels;
-}
-
-int computePoints(LOGFONT logFont) {
- int hDC = internal_new_GC (null);
- int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY);
- int pixels = 0;
- if (logFont.lfHeight > 0) {
- /*
- * Feature in Windows. If the lfHeight of the LOGFONT structure
- * is positive, the lfHeight measures the height of the entire
- * cell, including internal leading, in logical units. Since the
- * height of a font in points does not include the internal leading,
- * we must subtract the internal leading, which requires a TEXTMETRIC,
- * which in turn requires font creation.
- */
- int hFont = OS.CreateFontIndirect(logFont);
- int oldFont = OS.SelectObject(hDC, hFont);
- TEXTMETRIC lptm = new TEXTMETRIC();
- OS.GetTextMetrics(hDC, lptm);
- OS.SelectObject(hDC, oldFont);
- OS.DeleteObject(hFont);
- pixels = logFont.lfHeight - lptm.tmInternalLeading;
- } else {
- pixels = -logFont.lfHeight;
- }
- internal_dispose_GC (hDC, null);
-
- return Compatibility.round(pixels * 72, logPixelsY);
-}
-
-/**
- * Destroys the device in the operating system and releases
- * the device's handle. If the device does not have a handle,
- * this method may do nothing depending on the device.
- * <p>
- * This method is called after <code>release</code>.
- * </p><p>
- * Subclasses are supposed to reimplement this method and not
- * call the <code>super</code> implementation.
- * </p>
- *
- * @see #dispose
- * @see #release
- */
-protected void destroy () {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver. After this method has been invoked, the receiver
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- *
- * @see #release
- * @see #destroy
- * @see #checkDevice
- */
-public void dispose () {
- if (isDisposed()) return;
- checkDevice ();
- release ();
- destroy ();
- disposed = true;
- if (tracking) {
- objects = null;
- errors = null;
- }
-}
-
-void dispose_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == object) {
- objects [i] = null;
- errors [i] = null;
- return;
- }
- }
-}
-
-int EnumFontFamProc (int lpelfe, int lpntme, int FontType, int lParam) {
- boolean isScalable = (FontType & OS.RASTER_FONTTYPE) == 0;
- if ((lParam == 1) != isScalable) return 1;
-
- /* Add the log font to the list of log fonts */
- if (nFonts == logFonts.length) {
- LOGFONT [] newLogFonts = new LOGFONT [logFonts.length + 128];
- System.arraycopy (logFonts, 0, newLogFonts, 0, nFonts);
- logFonts = newLogFonts;
- }
- LOGFONT logFont = logFonts [nFonts];
- if (logFont == null) logFont = new LOGFONT ();
- OS.MoveMemory (logFont, lpelfe, LOGFONT.sizeof);
- logFonts [nFonts++] = logFont;
- return 1;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- int hDC = internal_new_GC (null);
- int width = OS.GetDeviceCaps (hDC, OS.HORZRES);
- int height = OS.GetDeviceCaps (hDC, OS.VERTRES);
- internal_dispose_GC (hDC, null);
- return new Rectangle (0, 0, width, height);
-}
-
-/**
- * Returns a <code>DeviceData</code> based on the receiver.
- * Modifications made to this <code>DeviceData</code> will not
- * affect the receiver.
- *
- * @return a <code>DeviceData</code> containing the device's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see DeviceData
- */
-public DeviceData getDeviceData () {
- checkDevice();
- DeviceData data = new DeviceData ();
- data.debug = debug;
- data.tracking = tracking;
- int count = 0, length = 0;
- if (tracking) length = objects.length;
- for (int i=0; i<length; i++) {
- if (objects [i] != null) count++;
- }
- int index = 0;
- data.objects = new Object [count];
- data.errors = new Error [count];
- for (int i=0; i<length; i++) {
- if (objects [i] != null) {
- data.objects [index] = objects [i];
- data.errors [index] = errors [i];
- index++;
- }
- }
- return data;
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data.
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #getBounds
- */
-public Rectangle getClientArea () {
- return getBounds ();
-}
-
-/**
- * Returns the bit depth of the screen, which is the number of
- * bits it takes to represent the number of unique colors that
- * the screen is currently capable of displaying. This number
- * will typically be one of 1, 8, 15, 16, 24 or 32.
- *
- * @return the depth of the screen
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getDepth () {
- checkDevice ();
- int hDC = internal_new_GC (null);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- internal_dispose_GC (hDC, null);
- return bits * planes;
-}
-
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- int hDC = internal_new_GC (null);
- int dpiX = OS.GetDeviceCaps (hDC, OS.LOGPIXELSX);
- int dpiY = OS.GetDeviceCaps (hDC, OS.LOGPIXELSY);
- internal_dispose_GC (hDC, null);
- return new Point (dpiX, dpiY);
-}
-
-/**
- * Returns <code>FontData</code> objects which describe
- * the fonts which match the given arguments. If the
- * <code>faceName</code> is null, all fonts will be returned.
- *
- * @param faceName the name of the font to look for, or null
- * @param scalable true if scalable fonts should be returned.
- * @return the matching font data
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData [] getFontList (String faceName, boolean scalable) {
- checkDevice ();
-
- /* Create the callback */
- Callback callback = new Callback (this, "EnumFontFamProc", 4);
- int lpEnumFontFamProc = callback.getAddress ();
-
- /* Initialize the instance variables */
- logFonts = new LOGFONT [nFonts];
- for (int i=0; i<logFonts.length; i++) {
- logFonts [i] = new LOGFONT ();
- }
- nFonts = 0;
-
- /* Enumerate */
- int offset = 0;
- int hDC = internal_new_GC (null);
- if (faceName == null) {
- /* The user did not specify a face name, so they want all versions of all available face names */
- OS.EnumFontFamilies (hDC, null, lpEnumFontFamProc, scalable ? 1 : 0);
-
- /**
- * For bitmapped fonts, EnumFontFamilies only enumerates once for each font, regardless
- * of how many styles are available. If the user wants bitmapped fonts, enumerate on
- * each face name now.
- */
- offset = nFonts;
- for (int i=0; i<offset; i++) {
- LOGFONT lf = logFonts [i];
- /**
- * Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
- * should enumerate for each available style of that font. Instead, it only enumerates
- * once. The fix is to call EnumFontFamilies, which works as expected.
- */
- char [] buffer = new char [] {
- lf.lfFaceName0, lf.lfFaceName1, lf.lfFaceName2, lf.lfFaceName3,
- lf.lfFaceName4, lf.lfFaceName5, lf.lfFaceName6, lf.lfFaceName7,
- lf.lfFaceName8, lf.lfFaceName9, lf.lfFaceName10, lf.lfFaceName11,
- lf.lfFaceName12, lf.lfFaceName13, lf.lfFaceName14, lf.lfFaceName15,
- lf.lfFaceName16, lf.lfFaceName17, lf.lfFaceName18, lf.lfFaceName19,
- lf.lfFaceName20, lf.lfFaceName21, lf.lfFaceName22, lf.lfFaceName23,
- lf.lfFaceName24, lf.lfFaceName25, lf.lfFaceName26, lf.lfFaceName27,
- lf.lfFaceName28, lf.lfFaceName29, lf.lfFaceName30, lf.lfFaceName31,
- };
- TCHAR lpFaceName = new TCHAR (0, new String(buffer), true);
- OS.EnumFontFamilies (hDC, lpFaceName, lpEnumFontFamProc, scalable ? 1 : 0);
- }
- } else {
- /* Use the character encoding for the default locale */
- TCHAR lpFaceName = new TCHAR (0, faceName, true);
- /**
- * Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
- * should enumerate for each available style of that font. Instead, it only enumerates
- * once. The fix is to call EnumFontFamilies, which works as expected.
- */
- OS.EnumFontFamilies (hDC, lpFaceName, lpEnumFontFamProc, scalable ? 1 : 0);
- }
- internal_dispose_GC (hDC, null);
-
- /* Create the fontData from the logfonts */
- int count = nFonts - offset;
- FontData [] result = new FontData [count];
- for (int i=0; i<count; i++) {
- LOGFONT logFont = logFonts [i+offset];
- result [i] = FontData.win32_new (logFont, computePoints(logFont));
- }
-
- /* Clean up */
- callback.dispose ();
- logFonts = null;
- return result;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- int pixel = 0x02000000;
- switch (id) {
- case SWT.COLOR_WHITE: pixel = 0x02FFFFFF; break;
- case SWT.COLOR_BLACK: pixel = 0x02000000; break;
- case SWT.COLOR_RED: pixel = 0x020000FF; break;
- case SWT.COLOR_DARK_RED: pixel = 0x02000080; break;
- case SWT.COLOR_GREEN: pixel = 0x0200FF00; break;
- case SWT.COLOR_DARK_GREEN: pixel = 0x02008000; break;
- case SWT.COLOR_YELLOW: pixel = 0x0200FFFF; break;
- case SWT.COLOR_DARK_YELLOW: pixel = 0x02008080; break;
- case SWT.COLOR_BLUE: pixel = 0x02FF0000; break;
- case SWT.COLOR_DARK_BLUE: pixel = 0x02800000; break;
- case SWT.COLOR_MAGENTA: pixel = 0x02FF00FF; break;
- case SWT.COLOR_DARK_MAGENTA: pixel = 0x02800080; break;
- case SWT.COLOR_CYAN: pixel = 0x02FFFF00; break;
- case SWT.COLOR_DARK_CYAN: pixel = 0x02808000; break;
- case SWT.COLOR_GRAY: pixel = 0x02C0C0C0; break;
- case SWT.COLOR_DARK_GRAY: pixel = 0x02808080; break;
- }
- return Color.win32_new (this, pixel);
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- return Font.win32_new (this, hFont);
-}
-
-/**
- * Returns <code>true</code> if the underlying window system prints out
- * warning messages on the console, and <code>setWarnings</code>
- * had previously been called with <code>true</code>.
- *
- * @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getWarnings () {
- checkDevice ();
- return false;
-}
-
-/**
- * Initializes any internal resources needed by the
- * device.
- * <p>
- * This method is called after <code>create</code>.
- * </p><p>
- * If subclasses reimplement this method, they must
- * call the <code>super</code> implementation.
- * </p>
- *
- * @see #create
- */
-protected void init () {
-
- /*
- * If we're not on a device which supports palettes,
- * don't create one.
- */
- int hDC = internal_new_GC (null);
- int rc = OS.GetDeviceCaps (hDC, OS.RASTERCAPS);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- internal_dispose_GC (hDC, null);
-
- bits *= planes;
- if ((rc & OS.RC_PALETTE) == 0 || bits != 8) return;
-
- /*
- * The following colors are listed in the Windows
- * Programmer's Reference as the colors guaranteed
- * to be in the default system palette.
- */
- RGB [] rgbs = new RGB [] {
- new RGB (0,0,0),
- new RGB (0x80,0,0),
- new RGB (0,0x80,0),
- new RGB (0x80,0x80,0),
- new RGB (0,0,0x80),
- new RGB (0x80,0,0x80),
- new RGB (0,0x80,0x80),
- new RGB (0xC0,0xC0,0xC0),
- new RGB (0x80,0x80,0x80),
- new RGB (0xFF,0,0),
- new RGB (0,0xFF,0),
- new RGB (0xFF,0xFF,0),
- new RGB (0,0,0xFF),
- new RGB (0xFF,0,0xFF),
- new RGB (0,0xFF,0xFF),
- new RGB (0xFF,0xFF,0xFF),
- };
-
- /* 4 bytes header + 4 bytes per entry * 256 entries */
- byte [] logPalette = new byte [4 + 4 * 256];
-
- /* 2 bytes = special header */
- logPalette [0] = 0x00;
- logPalette [1] = 0x03;
-
- /* 2 bytes = number of colors, LSB first */
- logPalette [2] = 0;
- logPalette [3] = 1;
-
- /* Create the palette and reference counter */
- colorRefCount = new int [256];
- for (int i = 0; i < rgbs.length; i++) {
- colorRefCount [i] = 1;
- int offset = i * 4 + 4;
- logPalette [offset] = (byte) rgbs[i].red;
- logPalette [offset + 1] = (byte) rgbs[i].green;
- logPalette [offset + 2] = (byte) rgbs[i].blue;
- }
- hPalette = OS.CreatePalette (logPalette);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public abstract int internal_new_GC (GCData data);
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Device</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public abstract void internal_dispose_GC (int hDC, GCData data);
-
-/**
- * Returns <code>true</code> if the device has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the device.
- * When a device has been disposed, it is an error to
- * invoke any other method using the device.
- *
- * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return disposed;
-}
-
-void new_Object (Object object) {
- for (int i=0; i<objects.length; i++) {
- if (objects [i] == null) {
- objects [i] = object;
- errors [i] = new Error ();
- return;
- }
- }
- Object [] newObjects = new Object [objects.length + 128];
- System.arraycopy (objects, 0, newObjects, 0, objects.length);
- newObjects [objects.length] = object;
- objects = newObjects;
- Error [] newErrors = new Error [errors.length + 128];
- System.arraycopy (errors, 0, newErrors, 0, errors.length);
- newErrors [errors.length] = new Error ();
- errors = newErrors;
-}
-
-/**
- * Releases any internal resources back to the operating
- * system and clears all fields except the device handle.
- * <p>
- * When a device is destroyed, resources that were acquired
- * on behalf of the programmer need to be returned to the
- * operating system. For example, if the device allocated a
- * font to be used as the system font, this font would be
- * freed in <code>release</code>. Also,to assist the garbage
- * collector and minimize the amount of memory that is not
- * reclaimed when the programmer keeps a reference to a
- * disposed device, all fields except the handle are zero'd.
- * The handle is needed by <code>destroy</code>.
- * </p>
- * This method is called before <code>destroy</code>.
- * </p><p>
- * If subclasses reimplement this method, they must
- * call the <code>super</code> implementation.
- * </p>
- *
- * @see #dispose
- * @see #destroy
- */
-protected void release () {
- if (hPalette != 0) OS.DeleteObject (hPalette);
- hPalette = 0;
- colorRefCount = null;
- logFonts = null;
- nFonts = 0;
-}
-
-/**
- * If the underlying window system supports printing warning messages
- * to the console, setting warnings to <code>true</code> prevents these
- * messages from being printed. If the argument is <code>false</code>
- * message printing is not blocked.
- *
- * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setWarnings (boolean warnings) {
- checkDevice ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java
deleted file mode 100755
index 27fe10271d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DeviceData {
- /*
- * Debug fields - may not be honoured
- * on some SWT platforms.
- */
- public boolean debug;
- public boolean tracking;
- public Error [] errors;
- public Object [] objects;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java
deleted file mode 100755
index df4ea579e2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java
+++ /dev/null
@@ -1,219 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class manage operating system resources that
- * define how text looks when it is displayed. Fonts may be constructed
- * by providing a device and either name, size and style information
- * or a <code>FontData</code> object which encapsulates this data.
- * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see FontData
- */
-
-public final class Font {
-
- /**
- * the handle to the OS font resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this font was created
- */
- Device device;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Font() {
-}
-
-/**
- * Constructs a new font given a device and font data
- * which describes the desired font's appearance.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param fd the FontData that describes the desired font (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
- * </ul>
- */
-public Font(Device device, FontData fd) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, fd);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new font given a device, a font name,
- * the height of the desired font in points, and a font
- * style.
- * <p>
- * You must dispose the font when it is no longer required.
- * </p>
- *
- * @param device the device to create the font on
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
- * </ul>
- */
-public Font(Device device, String name, int height, int style) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new FontData (name, height, style));
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the font. Applications must dispose of all fonts which
- * they allocate.
- */
-public void dispose() {
- if (handle == 0) return;
- OS.DeleteObject(handle);
- handle = 0;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals(Object object) {
- if (object == this) return true;
- if (!(object instanceof Font)) return false;
- Font font = (Font) object;
- return device == font.device && handle == font.handle;
-}
-
-/**
- * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however,
- * a <code>Font</code> object <em>may</em> be composed of multiple X
- * fonts. To support this case, we return an array of font data objects.
- *
- * @return an array of font data objects describing the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontData[] getFontData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- LOGFONT logFont = new LOGFONT();
- OS.GetObject(handle, LOGFONT.sizeof, logFont);
- return new FontData[] {FontData.win32_new(logFont, device.computePoints(logFont))};
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-void init (Device device, FontData fd) {
- if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- LOGFONT logFont = fd.data;
- int lfHeight = logFont.lfHeight;
- logFont.lfHeight = device.computePixels(fd.height);
- handle = OS.CreateFontIndirect(logFont);
- logFont.lfHeight = lfHeight;
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-}
-
-/**
- * Returns <code>true</code> if the font has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the font.
- * When a font has been disposed, it is an error to
- * invoke any other method using the font.
- *
- * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return "Font {" + handle + "}";
-}
-
-/**
- * Invokes platform specific functionality to allocate a new font.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Font</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param handle the handle for the font
- *
- * @private
- */
-public static Font win32_new(Device device, int handle) {
- if (device == null) device = Device.getDevice();
- Font font = new Font();
- font.handle = handle;
- font.device = device;
- return font;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java
deleted file mode 100755
index 95d0038f78..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java
+++ /dev/null
@@ -1,680 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class describe operating system fonts.
- * Only the public API of this type is platform independent.
- * <p>
- * For platform-independent behaviour, use the get and set methods
- * corresponding to the following properties:
- * <dl>
- * <dt>height</dt><dd>the height of the font in points</dd>
- * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
- * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
- * </dl>
- * If extra, platform-dependent functionality is required:
- * <ul>
- * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
- * corresponds to a Windows <code>LOGFONT</code> structure whose fields
- * may be retrieved and modified.</li>
- * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * </ul>
- * Application code does <em>not</em> need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no <code>dispose()</code> method is provided.
- *
- * @see Font
- */
-
-public final class FontData {
-
- /**
- * A Win32 LOGFONT struct
- * (Warning: This field is platform dependent)
- */
- public LOGFONT data;
-
- /**
- * The height of the font data in points
- * (Warning: This field is platform dependent)
- */
- public int height;
-
- /**
- * The locales of the font
- * (Warning: These fields are platform dependent)
- */
- String lang, country, variant;
-
-/**
- * Constructs a new un-initialized font data.
- */
-public FontData() {
- data = new LOGFONT();
- // We set the charset field so that
- // wildcard searching will work properly
- // out of the box
- data.lfCharSet = OS.DEFAULT_CHARSET;
- height = 12;
-}
-
-/**
- * Constructs a new font data given the Windows <code>LOGFONT</code>
- * that it should represent.
- *
- * @param data the <code>LOGFONT</code> for the result
- */
-FontData(LOGFONT data, int height) {
- this.data = data;
- this.height = height;
-}
-
-/**
- * Constructs a new FontData given a string representation
- * in the form generated by the <code>FontData.toString</code>
- * method.
- * <p>
- * Note that the representation varies between platforms,
- * and a FontData can only be created from a string that was
- * generated on the same platform.
- * </p>
- *
- * @param string the string representation of a <code>FontData</code> (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
- * </ul>
- *
- * @see #toString
- */
-public FontData(String string) {
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int start = 0;
- int end = string.indexOf('|');
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- String version1 = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- String name = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int height = 0;
- try {
- height = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int style = 0;
- try {
- style = Integer.parseInt(string.substring(start, end));
- } catch (NumberFormatException e) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- start = end + 1;
- end = string.indexOf('|', start);
- data = new LOGFONT();
- data.lfCharSet = OS.DEFAULT_CHARSET;
- setName(name);
- setHeight(height);
- setStyle(style);
- if (end == -1) return;
- String platform = string.substring(start, end);
-
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- String version2 = string.substring(start, end);
-
- if (platform.equals("WINDOWS") && version2.equals("1")) {
- LOGFONT newData = new LOGFONT();
- try {
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfHeight = Integer.parseInt(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfWidth = Integer.parseInt(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfEscapement = Integer.parseInt(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfOrientation = Integer.parseInt(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfWeight = Integer.parseInt(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfItalic = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfUnderline = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfStrikeOut = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfCharSet = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfOutPrecision = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfClipPrecision = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfQuality = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- end = string.indexOf('|', start);
- if (end == -1) return;
- newData.lfPitchAndFamily = Byte.parseByte(string.substring(start, end));
- start = end + 1;
- } catch (NumberFormatException e) {
- setName(name);
- setHeight(height);
- setStyle(style);
- return;
- }
- char[] lfFaceName = new char[32];
- string.getChars(start, string.length(), lfFaceName, 0);
- newData.lfFaceName0 = lfFaceName[0];
- newData.lfFaceName1 = lfFaceName[1];
- newData.lfFaceName2 = lfFaceName[2];
- newData.lfFaceName3 = lfFaceName[3];
- newData.lfFaceName4 = lfFaceName[4];
- newData.lfFaceName5 = lfFaceName[5];
- newData.lfFaceName6 = lfFaceName[6];
- newData.lfFaceName7 = lfFaceName[7];
- newData.lfFaceName8 = lfFaceName[8];
- newData.lfFaceName9 = lfFaceName[9];
- newData.lfFaceName10 = lfFaceName[10];
- newData.lfFaceName11 = lfFaceName[11];
- newData.lfFaceName12 = lfFaceName[12];
- newData.lfFaceName13 = lfFaceName[13];
- newData.lfFaceName14 = lfFaceName[14];
- newData.lfFaceName15 = lfFaceName[15];
- newData.lfFaceName16 = lfFaceName[16];
- newData.lfFaceName17 = lfFaceName[17];
- newData.lfFaceName18 = lfFaceName[18];
- newData.lfFaceName19 = lfFaceName[19];
- newData.lfFaceName20 = lfFaceName[20];
- newData.lfFaceName21 = lfFaceName[21];
- newData.lfFaceName22 = lfFaceName[22];
- newData.lfFaceName23 = lfFaceName[23];
- newData.lfFaceName24 = lfFaceName[24];
- newData.lfFaceName25 = lfFaceName[25];
- newData.lfFaceName26 = lfFaceName[26];
- newData.lfFaceName27 = lfFaceName[27];
- newData.lfFaceName28 = lfFaceName[28];
- newData.lfFaceName29 = lfFaceName[29];
- newData.lfFaceName30 = lfFaceName[30];
- newData.lfFaceName31 = lfFaceName[31];
- data = newData;
- }
-}
-
-/**
- * Constructs a new font data given a font name,
- * the height of the desired font in points,
- * and a font style.
- *
- * @param name the name of the font (must not be null)
- * @param height the font height in points
- * @param style a bit or combination of NORMAL, BOLD, ITALIC
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- */
-public FontData(String name, int height, int style) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- data = new LOGFONT();
- setName(name);
- setHeight(height);
- setStyle(style);
- // We set the charset field so that
- // wildcard searching will work properly
- // out of the box
- data.lfCharSet = OS.DEFAULT_CHARSET;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontData)) return false;
- LOGFONT lf = ((FontData)object).data;
- return data.lfCharSet == lf.lfCharSet &&
- data.lfHeight == lf.lfHeight &&
- data.lfWidth == lf.lfWidth &&
- data.lfEscapement == lf.lfEscapement &&
- data.lfOrientation == lf.lfOrientation &&
- data.lfWeight == lf.lfWeight &&
- data.lfItalic == lf.lfItalic &&
- data.lfUnderline == lf.lfUnderline &&
- data.lfStrikeOut == lf.lfStrikeOut &&
- data.lfCharSet == lf.lfCharSet &&
- data.lfOutPrecision == lf.lfOutPrecision &&
- data.lfClipPrecision == lf.lfClipPrecision &&
- data.lfQuality == lf.lfQuality &&
- data.lfPitchAndFamily == lf.lfPitchAndFamily &&
- data.lfFaceName0 == lf.lfFaceName0 &&
- data.lfFaceName1 == lf.lfFaceName1 &&
- data.lfFaceName2 == lf.lfFaceName2 &&
- data.lfFaceName3 == lf.lfFaceName3 &&
- data.lfFaceName4 == lf.lfFaceName4 &&
- data.lfFaceName5 == lf.lfFaceName5 &&
- data.lfFaceName6 == lf.lfFaceName6 &&
- data.lfFaceName7 == lf.lfFaceName7 &&
- data.lfFaceName8 == lf.lfFaceName8 &&
- data.lfFaceName9 == lf.lfFaceName9 &&
- data.lfFaceName10 == lf.lfFaceName10 &&
- data.lfFaceName11 == lf.lfFaceName11 &&
- data.lfFaceName12 == lf.lfFaceName12 &&
- data.lfFaceName13 == lf.lfFaceName13 &&
- data.lfFaceName14 == lf.lfFaceName14 &&
- data.lfFaceName15 == lf.lfFaceName15 &&
- data.lfFaceName16 == lf.lfFaceName16 &&
- data.lfFaceName17 == lf.lfFaceName17 &&
- data.lfFaceName18 == lf.lfFaceName18 &&
- data.lfFaceName19 == lf.lfFaceName19 &&
- data.lfFaceName20 == lf.lfFaceName20 &&
- data.lfFaceName21 == lf.lfFaceName21 &&
- data.lfFaceName22 == lf.lfFaceName22 &&
- data.lfFaceName23 == lf.lfFaceName23 &&
- data.lfFaceName24 == lf.lfFaceName24 &&
- data.lfFaceName25 == lf.lfFaceName25 &&
- data.lfFaceName26 == lf.lfFaceName26 &&
- data.lfFaceName27 == lf.lfFaceName27 &&
- data.lfFaceName28 == lf.lfFaceName28 &&
- data.lfFaceName29 == lf.lfFaceName29 &&
- data.lfFaceName30 == lf.lfFaceName30 &&
- data.lfFaceName31 == lf.lfFaceName31;
-}
-
-int EnumLocalesProc(int lpLocaleString) {
-
- /* Get the locale ID */
- int length = 8;
- TCHAR buffer = new TCHAR(0, length);
- int byteCount = length * TCHAR.sizeof;
- OS.MoveMemory(buffer, lpLocaleString, byteCount);
- int lcid = Integer.parseInt(buffer.toString(0, buffer.strlen ()), 16);
-
- /* Check the language */
- int size = OS.GetLocaleInfo(lcid, OS.LOCALE_SISO639LANGNAME, buffer, length);
- String osLang = buffer.toString(0, size - 1);
- if (!lang.equals(osLang)) return 1;
-
- /* Check the country */
- if (country != null) {
- size = OS.GetLocaleInfo(lcid, OS.LOCALE_SISO3166CTRYNAME, buffer, length);
- String osCountry = buffer.toString(0, size - 1);
- if (!country.equals(osCountry)) return 1;
- }
-
- /* Get the charset */
- size = OS.GetLocaleInfo(lcid, OS.LOCALE_IDEFAULTANSICODEPAGE, buffer, length);
- int cp = Integer.parseInt(buffer.toString(0, size - 1));
- int [] lpCs = new int[8];
- OS.TranslateCharsetInfo(cp, lpCs, OS.TCI_SRCCODEPAGE);
- data.lfCharSet = (byte)lpCs[0];
-
- return 0;
-}
-
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight
- */
-public int getHeight() {
- return height;
-}
-
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this <code>FontData</code>
- *
- * @see #setName
- */
-public String getName() {
- char[] chars = {
- data.lfFaceName0, data.lfFaceName1, data.lfFaceName2, data.lfFaceName3,
- data.lfFaceName4, data.lfFaceName5, data.lfFaceName6, data.lfFaceName7,
- data.lfFaceName8, data.lfFaceName9, data.lfFaceName10, data.lfFaceName11,
- data.lfFaceName12, data.lfFaceName13, data.lfFaceName14, data.lfFaceName15,
- data.lfFaceName16, data.lfFaceName17, data.lfFaceName18, data.lfFaceName19,
- data.lfFaceName20, data.lfFaceName21, data.lfFaceName22, data.lfFaceName23,
- data.lfFaceName24, data.lfFaceName25, data.lfFaceName26, data.lfFaceName27,
- data.lfFaceName28, data.lfFaceName29, data.lfFaceName30, data.lfFaceName31,
- };
- int index = 0;
- while (index < chars.length) {
- if (chars [index] == 0) break;
- index++;
- }
- return new String (chars, 0, index);
-}
-
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the <code>SWT</code> constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this <code>FontData</code>
- *
- * @see #setStyle
- */
-public int getStyle() {
- int style = SWT.NORMAL;
- if (data.lfWeight == 700) style |= SWT.BOLD;
- if (data.lfItalic != 0) style |= SWT.ITALIC;
- return style;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return data.lfCharSet ^ data.lfHeight ^ data.lfWidth ^ data.lfEscapement ^
- data.lfOrientation ^ data.lfWeight ^ data.lfItalic ^data.lfUnderline ^
- data.lfStrikeOut ^ data.lfCharSet ^ data.lfOutPrecision ^
- data.lfClipPrecision ^ data.lfQuality ^ data.lfPitchAndFamily ^
- data.lfFaceName0 ^ data.lfFaceName1 ^ data.lfFaceName2 ^
- data.lfFaceName3 ^ data.lfFaceName4 ^ data.lfFaceName5 ^
- data.lfFaceName6 ^ data.lfFaceName7 ^ data.lfFaceName8 ^
- data.lfFaceName9 ^ data.lfFaceName10 ^ data.lfFaceName11 ^
- data.lfFaceName12 ^ data.lfFaceName13 ^ data.lfFaceName14 ^
- data.lfFaceName15 ^ data.lfFaceName16 ^ data.lfFaceName17 ^
- data.lfFaceName18 ^ data.lfFaceName19 ^ data.lfFaceName20 ^
- data.lfFaceName21 ^ data.lfFaceName22 ^ data.lfFaceName23 ^
- data.lfFaceName24 ^ data.lfFaceName25 ^ data.lfFaceName26 ^
- data.lfFaceName27 ^ data.lfFaceName28 ^ data.lfFaceName29 ^
- data.lfFaceName30 ^ data.lfFaceName31;
-}
-
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the <code>FontData</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
- * </ul>
- *
- * @see #getHeight
- */
-public void setHeight(int height) {
- if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.height = height;
-}
-
-/**
- * Sets the locale of the receiver.
- * <p>
- * The locale determines which platform character set this
- * font is going to use. Widgets and graphics operations that
- * use this font will convert UNICODE strings to the platform
- * character set of the specified locale.
- * </p>
- * <p>
- * On platforms which there are multiple character sets for a
- * given language/country locale, the variant portion of the
- * locale will determine the character set.
- * </p>
- *
- * @param locale the <code>String</code> representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(String locale) {
- lang = country = variant = null;
- if (locale != null) {
- char sep = '_';
- int length = locale.length();
- int firstSep, secondSep;
-
- firstSep = locale.indexOf(sep);
- if (firstSep == -1) {
- firstSep = secondSep = length;
- } else {
- secondSep = locale.indexOf(sep, firstSep + 1);
- if (secondSep == -1) secondSep = length;
- }
- if (firstSep > 0) lang = locale.substring(0, firstSep);
- if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
- if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
- }
- if (lang == null) {
- data.lfCharSet = OS.DEFAULT_CHARSET;
- } else {
- Callback callback = new Callback (this, "EnumLocalesProc", 1);
- int lpEnumLocalesProc = callback.getAddress ();
- OS.EnumSystemLocales(lpEnumLocalesProc, OS.LCID_SUPPORTED);
- callback.dispose ();
- }
-}
-
-/**
- * Sets the name of the receiver.
- * <p>
- * Some platforms support font foundries. On these platforms, the name
- * of the font specified in setName() may have one of the following forms:
- * <ol>
- * <li>a face name (for example, "courier")</li>
- * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
- * </ol>
- * In either case, the name returned from getName() will include the
- * foundry.
- * </p>
- * <p>
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in <code>setName()</code> and
- * <code>getName()</code>.
- * </p>
- *
- * @param name the name of the font data (must not be null)
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
- * </ul>
- *
- * @see #getName
- */
-public void setName(String name) {
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- char [] chars = new char [32];
-
- /* The field lfFaceName must be NULL terminated */
- int length = name.length();
- name.getChars (0, length <= 31 ? length : 31, chars, 0);
- data.lfFaceName0 = chars[0];
- data.lfFaceName1 = chars[1];
- data.lfFaceName2 = chars[2];
- data.lfFaceName3 = chars[3];
- data.lfFaceName4 = chars[4];
- data.lfFaceName5 = chars[5];
- data.lfFaceName6 = chars[6];
- data.lfFaceName7 = chars[7];
- data.lfFaceName8 = chars[8];
- data.lfFaceName9 = chars[9];
- data.lfFaceName10 = chars[10];
- data.lfFaceName11 = chars[11];
- data.lfFaceName12 = chars[12];
- data.lfFaceName13 = chars[13];
- data.lfFaceName14 = chars[14];
- data.lfFaceName15 = chars[15];
- data.lfFaceName16 = chars[16];
- data.lfFaceName17 = chars[17];
- data.lfFaceName18 = chars[18];
- data.lfFaceName19 = chars[19];
- data.lfFaceName20 = chars[20];
- data.lfFaceName21 = chars[21];
- data.lfFaceName22 = chars[22];
- data.lfFaceName23 = chars[23];
- data.lfFaceName24 = chars[24];
- data.lfFaceName25 = chars[25];
- data.lfFaceName26 = chars[26];
- data.lfFaceName27 = chars[27];
- data.lfFaceName28 = chars[28];
- data.lfFaceName29 = chars[29];
- data.lfFaceName30 = chars[30];
- data.lfFaceName31 = chars[31];
-}
-
-/**
- * Sets the style of the receiver to the argument which must
- * be a bitwise OR of one or more of the <code>SWT</code>
- * constants NORMAL, BOLD and ITALIC.
- *
- * @param style the new style for this <code>FontData</code>
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- if ((style & SWT.BOLD) == SWT.BOLD) {
- data.lfWeight = 700;
- } else {
- data.lfWeight = 0;
- }
- if ((style & SWT.ITALIC) == SWT.ITALIC) {
- data.lfItalic = 1;
- } else {
- data.lfItalic = 0;
- }
-}
-
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * <code>FontData(String)</code> constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("1|");
- buffer.append(getName());
- buffer.append("|");
- buffer.append(getHeight());
- buffer.append("|");
- buffer.append(getStyle());
- buffer.append("|");
- buffer.append("WINDOWS|1|");
- buffer.append(data.lfHeight);
- buffer.append("|");
- buffer.append(data.lfWidth);
- buffer.append("|");
- buffer.append(data.lfEscapement);
- buffer.append("|");
- buffer.append(data.lfOrientation);
- buffer.append("|");
- buffer.append(data.lfWeight);
- buffer.append("|");
- buffer.append(data.lfItalic);
- buffer.append("|");
- buffer.append(data.lfUnderline);
- buffer.append("|");
- buffer.append(data.lfStrikeOut);
- buffer.append("|");
- buffer.append(data.lfCharSet);
- buffer.append("|");
- buffer.append(data.lfOutPrecision);
- buffer.append("|");
- buffer.append(data.lfClipPrecision);
- buffer.append("|");
- buffer.append(data.lfQuality);
- buffer.append("|");
- buffer.append(data.lfPitchAndFamily);
- buffer.append("|");
- char[] faceName = {
- data.lfFaceName0, data.lfFaceName1, data.lfFaceName2, data.lfFaceName3,
- data.lfFaceName4, data.lfFaceName5, data.lfFaceName6, data.lfFaceName7,
- data.lfFaceName8, data.lfFaceName9, data.lfFaceName10, data.lfFaceName11,
- data.lfFaceName12, data.lfFaceName13, data.lfFaceName14, data.lfFaceName15,
- data.lfFaceName16, data.lfFaceName17, data.lfFaceName18, data.lfFaceName19,
- data.lfFaceName20, data.lfFaceName21, data.lfFaceName22, data.lfFaceName23,
- data.lfFaceName24, data.lfFaceName25, data.lfFaceName26, data.lfFaceName27,
- data.lfFaceName28, data.lfFaceName29, data.lfFaceName30, data.lfFaceName31,
- };
- int i = 0;
- while (i < faceName.length && faceName[i] != 0) {
- buffer.append(faceName[i++]);
- }
- return buffer.toString();
-}
-
-/**
- * Invokes platform specific functionality to allocate a new font data.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>FontData</code>. It is marked public only so that
- * it can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the <code>LOGFONT</code> for the font data
- *
- * @private
- */
-public static FontData win32_new(LOGFONT data, int height) {
- return new FontData(data, height);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java
deleted file mode 100755
index 8f0a103d15..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * <code>FontMetrics</code> are obtained from <code>GC</code>s
- * using the <code>getFontMetrics()</code> method.
- *
- * @see GC#getFontMetrics
- */
-
-public final class FontMetrics {
-
- /**
- * a Win32 TEXTMETRIC struct
- * (Warning: This field is platform dependent)
- */
- public TEXTMETRIC handle;
-
-/**
- * Prevents instances from being created outside the package.
- */
-FontMetrics() {
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof FontMetrics)) return false;
- TEXTMETRIC metric = ((FontMetrics)object).handle;
- return handle.tmHeight == metric.tmHeight &&
- handle.tmAscent == metric.tmAscent &&
- handle.tmDescent == metric.tmDescent &&
- handle.tmInternalLeading == metric.tmInternalLeading &&
- handle.tmExternalLeading == metric.tmExternalLeading &&
- handle.tmAveCharWidth == metric.tmAveCharWidth &&
- handle.tmMaxCharWidth == metric.tmMaxCharWidth &&
- handle.tmWeight == metric.tmWeight &&
- handle.tmOverhang == metric.tmOverhang &&
- handle.tmDigitizedAspectX == metric.tmDigitizedAspectX &&
- handle.tmDigitizedAspectY == metric.tmDigitizedAspectY &&
-// handle.tmFirstChar == metric.tmFirstChar &&
-// handle.tmLastChar == metric.tmLastChar &&
-// handle.tmDefaultChar == metric.tmDefaultChar &&
-// handle.tmBreakChar == metric.tmBreakChar &&
- handle.tmItalic == metric.tmItalic &&
- handle.tmUnderlined == metric.tmUnderlined &&
- handle.tmStruckOut == metric.tmStruckOut &&
- handle.tmPitchAndFamily == metric.tmPitchAndFamily &&
- handle.tmCharSet == metric.tmCharSet;
-}
-
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's <em>ascent</em> is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return handle.tmAscent - handle.tmInternalLeading;
-}
-
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- return handle.tmAveCharWidth;
-}
-
-/**
- * Returns the descent of the font described by the receiver. A
- * font's <em>descent</em> is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return handle.tmDescent;
-}
-
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's <em>height</em> is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return handle.tmHeight;
-}
-
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's <em>leading area</em> is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return handle.tmInternalLeading;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode() {
- return handle.tmHeight ^ handle.tmAscent ^ handle.tmDescent ^
- handle.tmInternalLeading ^ handle.tmExternalLeading ^
- handle.tmAveCharWidth ^ handle.tmMaxCharWidth ^ handle.tmWeight ^
- handle.tmOverhang ^ handle.tmDigitizedAspectX ^ handle.tmDigitizedAspectY ^
-// handle.tmFirstChar ^ handle.tmLastChar ^ handle.tmDefaultChar ^ handle.tmBreakChar ^
- handle.tmItalic ^ handle.tmUnderlined ^ handle.tmStruckOut ^
- handle.tmPitchAndFamily ^ handle.tmCharSet;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new font metrics.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>FontMetrics</code>. It is marked public only so that
- * it can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param tm the <code>TEXTMETRIC</code> containing information about a font
- *
- * @private
- */
-public static FontMetrics win32_new(TEXTMETRIC handle) {
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.handle = handle;
- return fontMetrics;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
deleted file mode 100755
index b90258c880..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ /dev/null
@@ -1,2290 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Class <code>GC</code> is where all of the drawing capabilities that are
- * supported by SWT are located. Instances are used to draw on either an
- * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
- * <p>
- * Application code must explicitly invoke the <code>GC.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required. This is <em>particularly</em>
- * important on Windows95 and Windows98 where the operating system has a limited
- * number of device contexts available.
- * </p>
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-
-public final class GC {
-
- /**
- * the handle to the OS device context
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- Drawable drawable;
- GCData data;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-GC() {
-}
-
-/**
- * Constructs a new instance of this class which has been
- * configured to draw on the specified drawable. Sets the
- * foreground and background color in the GC to match those
- * in the drawable.
- * <p>
- * You must dispose the graphics context when it is no longer required.
- * </p>
- * @param drawable the drawable to draw on
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
- * <li>ERROR_INVALID_ARGUMENT
- * - if the drawable is an image that is not a bitmap or an icon
- * - if the drawable is an image or printer that is already selected
- * into another graphics context</li>
- * </ul>
- */
-public GC(Drawable drawable) {
- if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- GCData data = new GCData ();
- int hDC = drawable.internal_new_GC (data);
- Device device = data.device;
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- data.device = device;
- init (drawable, data, hDC);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Copies a rectangular area of the receiver at the specified
- * position into the image, which must be of type <code>SWT.BITMAP</code>.
- *
- * @param x the x coordinate in the receiver of the area to be copied
- * @param y the y coordinate in the receiver of the area to be copied
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap or has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- /* Get the HDC for the device */
- Device device = data.device;
- int hDC = device.internal_new_GC(null);
-
- /* Copy the bitmap area */
- Rectangle rect = image.getBounds();
- int memHdc = OS.CreateCompatibleDC(hDC);
- int hOldBitmap = OS.SelectObject(memHdc, image.handle);
- OS.BitBlt(memHdc, 0, 0, rect.width, rect.height, handle, x, y, OS.SRCCOPY);
- OS.SelectObject(memHdc, hOldBitmap);
- OS.DeleteDC(memHdc);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-}
-
-/**
- * Copies a rectangular area of the receiver at the source
- * position onto the receiver at the destination position.
- *
- * @param srcX the x coordinate in the receiver of the area to be copied
- * @param srcY the y coordinate in the receiver of the area to be copied
- * @param width the width of the area to copy
- * @param height the height of the area to copy
- * @param destX the x coordinate in the receiver of the area to copy to
- * @param destY the y coordinate in the receiver of the area to copy to
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- /*
- * Feature in WinCE. The function WindowFromDC is not part of the
- * WinCE SDK. The fix is to remember the HWND.
- */
- int hwnd = data.hwnd;
- if (hwnd == 0) {
- OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
- } else {
- RECT lprcClip = null;
- int hrgn = OS.CreateRectRgn(0, 0, 0, 0);
- if (OS.GetClipRgn(handle, hrgn) == 1) {
- lprcClip = new RECT();
- OS.GetRgnBox(hrgn, lprcClip);
- }
- OS.DeleteObject(hrgn);
- RECT lprcScroll = new RECT();
- OS.SetRect(lprcScroll, srcX, srcY, srcX + width, srcY + height);
- int res = OS.ScrollWindowEx(hwnd, destX - srcX, destY - srcY, lprcScroll, lprcClip, 0, null, OS.SW_INVALIDATE | OS.SW_ERASE);
-
- /*
- * Feature in WinCE. ScrollWindowEx does not accept combined
- * vertical and horizontal scrolling. The fix is to do a
- * BitBlt and invalidate the appropriate source area.
- */
- if (res == 0 && OS.IsWinCE) {
- OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
- int deltaX = destX - srcX, deltaY = destY - srcY;
- boolean disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
- if (disjoint) {
- OS.InvalidateRect(hwnd, lprcScroll, true);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.SetRect(lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height);
- OS.InvalidateRect(hwnd, lprcScroll, true);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.SetRect(lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY));
- OS.InvalidateRect(hwnd, lprcScroll, true);
- }
- }
- }
- }
-}
-
-int createDIB(int width, int height) {
- int depth = 32;
- byte[] bmi = new byte[40 + (OS.IsWinCE ? 12 : 0)];
-
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = 0; bmi[2] = 0; bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(width & 0xFF);
- bmi[5] = (byte)((width >> 8) & 0xFF);
- bmi[6] = (byte)((width >> 16) & 0xFF);
- bmi[7] = (byte)((width >> 24) & 0xFF);
- /* LONG biHeight = height */
- bmi[8] = (byte)(-height & 0xFF);
- bmi[9] = (byte)((-height >> 8) & 0xFF);
- bmi[10] = (byte)((-height >> 16) & 0xFF);
- bmi[11] = (byte)((-height >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = depth */
- bmi[14] = (byte)(depth & 0xFF);
- bmi[15] = (byte)((depth >> 8) & 0xFF);
- if (OS.IsWinCE) {
- /* DWORD biCompression = BI_BITFIELDS = 3 */
- bmi[16] = 3; bmi[17] = bmi[18] = bmi[19] = 0;
- } else {
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- }
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed */
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
- /* Set the rgb colors into the bitmap info */
- if (OS.IsWinCE) {
- /* the 32 bit masks are 0xFF000000, 0xFF0000, 0xFF00 */
- bmi[40] = (byte)0xFF; bmi[41] = bmi[42] = bmi[43] = 0;
- bmi[44] = 0; bmi[45] = (byte)0xFF; bmi[46] = bmi[47] = 0;
- bmi[48] = bmi[49] = 0; bmi[50] = (byte)0xFF; bmi[51] = 0;
- }
-
- int[] pBits = new int[1];
- int hDib = OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
- if (hDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- return hDib;
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the graphics context. Applications must dispose of all GCs
- * which they allocate.
- */
-public void dispose() {
- if (handle == 0) return;
-
- /*
- * The only way for pens and brushes to get
- * selected into the HDC is for the receiver to
- * create them. When we are destroying the
- * hDC we also destroy any pens and brushes that
- * we have allocated. This code assumes that it
- * is OK to delete stock objects. This will
- * happen when a GC is disposed and the user has
- * not caused new pens or brushes to be allocated.
- */
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.DeleteObject(oldPen);
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.DeleteObject(oldBrush);
-
- /*
- * Put back the original bitmap into the device context.
- * This will ensure that we have not left a bitmap
- * selected in it when we delete the HDC.
- */
- int hNullBitmap = data.hNullBitmap;
- if (hNullBitmap != 0) {
- OS.SelectObject(handle, hNullBitmap);
- data.hNullBitmap = 0;
- }
- Image image = data.image;
- if (image != null) image.memGC = null;
-
- /*
- * Dispose the HDC.
- */
- Device device = data.device;
- drawable.internal_dispose_GC(handle, data);
- drawable = null;
- handle = 0;
- data.image = null;
- data.ps = null;
- if (device.tracking) device.dispose_Object(this);
- data.device = null;
- data = null;
-}
-
-/**
- * Draws the outline of a circular or elliptical arc
- * within the specified rectangular area.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be drawn
- * @param y the y coordinate of the upper-left corner of the arc to be drawn
- * @param width the width of the arc to be drawn
- * @param height the height of the arc to be drawn
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawArc (int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- /*
- * Feature in WinCE. The function Arc is not present in the
- * WinCE SDK. The fix is to emulate arc drawing by using
- * Polyline.
- */
- if (OS.IsWinCE) {
- /* compute arc with a simple linear interpolation */
- if (endAngle < 0) {
- startAngle += endAngle;
- endAngle = -endAngle;
- }
- if (endAngle > 360) endAngle = 360;
- int[] points = new int[(endAngle + 1) * 2];
- int cteX = 2 * x + width;
- int cteY = 2 * y + height;
- int index = 0;
- for (int i = 0; i <= endAngle; i++) {
- points[index++] = (Compatibility.cos(startAngle + i, width) + cteX) >> 1;
- points[index++] = (cteY - Compatibility.sin(startAngle + i, height)) >> 1;
- }
- OS.Polyline(handle, points, points.length / 2);
- } else {
- int x1, y1, x2, y2,tmp;
- boolean isNegative;
- if (endAngle >= 360 || endAngle <= -360) {
- x1 = x2 = x + width;
- y1 = y2 = y + height / 2;
- } else {
- isNegative = endAngle < 0;
-
- endAngle = endAngle + startAngle;
- if (isNegative) {
- // swap angles
- tmp = startAngle;
- startAngle = endAngle;
- endAngle = tmp;
- }
- x1 = Compatibility.cos(startAngle, width) + x + width/2;
- y1 = -1 * Compatibility.sin(startAngle, height) + y + height/2;
-
- x2 = Compatibility.cos(endAngle, width) + x + width/2;
- y2 = -1 * Compatibility.sin(endAngle, height) + y + height/2;
- }
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.Arc(handle, x,y,x+width+1,y+height+1,x1,y1,x2,y2 );
- OS.SelectObject(handle,oldBrush);
- }
-}
-
-/**
- * Draws a rectangle, based on the specified arguments, which has
- * the appearance of the platform's <em>focus rectangle</em> if the
- * platform supports such a notion, and otherwise draws a simple
- * rectangle in the receiver's forground color.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void drawFocus (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- RECT rect = new RECT();
- OS.SetRect(rect, x, y, x + width, y + height);
- OS.DrawFocusRect(handle, rect);
-}
-
-/**
- * Draws the given image in the receiver at the specified
- * coordinates.
- *
- * @param image the image to draw
- * @param x the x coordinate of where to draw
- * @param y the y coordinate of where to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true);
-}
-
-/**
- * Copies a rectangular area from the source image into a (potentially
- * different sized) rectangular area in the receiver. If the source
- * and destination areas are of differing sizes, then the source
- * area will be stretched or shrunk to fit the destination area
- * as it is copied. The copy fails if any of the given coordinates
- * are negative or lie outside the bounds of their respective images.
- *
- * @param image the source image
- * @param srcX the x coordinate in the source image to copy from
- * @param srcY the y coordinate in the source image to copy from
- * @param srcWidth the width in pixels to copy from the source
- * @param srcHeight the height in pixels to copy from the source
- * @param destX the x coordinate in the destination to copy to
- * @param destY the y coordinate in the destination to copy to
- * @param destWidth the width in pixels of the destination rectangle
- * @param destHeight the height in pixels of the destination rectangle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
- if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false);
-}
-
-void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
- switch (srcImage.type) {
- case SWT.BITMAP:
- drawBitmap(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
- break;
- case SWT.ICON:
- drawIcon(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- }
-}
-
-void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
- /* Simple case: no stretching, entire icon */
- if (simple) {
- OS.DrawIconEx(handle, destX, destY, srcImage.handle, 0, 0, 0, 0, OS.DI_NORMAL);
- return;
- }
-
- /* Get the icon info */
- ICONINFO srcIconInfo = new ICONINFO();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetIconInfo(srcImage.handle, srcIconInfo);
-
- /* Get the icon width and height */
- int hBitmap = srcIconInfo.hbmColor;
- if (hBitmap == 0) hBitmap = srcIconInfo.hbmMask;
- BITMAP bm = new BITMAP();
- OS.GetObject(hBitmap, BITMAP.sizeof, bm);
- int iconWidth = bm.bmWidth, iconHeight = bm.bmHeight;
- if (hBitmap == srcIconInfo.hbmMask) iconHeight /= 2;
-
- if (simple) {
- srcWidth = destWidth = iconWidth;
- srcHeight = destHeight = iconHeight;
- }
-
- /* Draw the icon */
- boolean failed = srcX + srcWidth > iconWidth || srcY + srcHeight > iconHeight;
- if (!failed) {
- simple = srcX == 0 && srcY == 0 &&
- srcWidth == destWidth && srcHeight == destHeight &&
- srcWidth == iconWidth && srcHeight == iconHeight;
- if (simple) {
- /* Simple case: no stretching, entire icon */
- OS.DrawIconEx(handle, destX, destY, srcImage.handle, 0, 0, 0, 0, OS.DI_NORMAL);
- } else {
- /* Get the HDC for the device */
- Device device = data.device;
- int hDC = device.internal_new_GC(null);
-
- /* Create the icon info and HDC's */
- ICONINFO newIconInfo = new ICONINFO();
- newIconInfo.fIcon = true;
- int srcHdc = OS.CreateCompatibleDC(hDC);
- int dstHdc = OS.CreateCompatibleDC(hDC);
-
- /* Blt the color bitmap */
- int srcColorY = srcY;
- int srcColor = srcIconInfo.hbmColor;
- if (srcColor == 0) {
- srcColor = srcIconInfo.hbmMask;
- srcColorY += iconHeight;
- }
- int oldSrcBitmap = OS.SelectObject(srcHdc, srcColor);
- newIconInfo.hbmColor = OS.CreateCompatibleBitmap(srcHdc, destWidth, destHeight);
- if (newIconInfo.hbmColor == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int oldDestBitmap = OS.SelectObject(dstHdc, newIconInfo.hbmColor);
- if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR);
- OS.StretchBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCCOPY);
-
- /* Blt the mask bitmap */
- OS.SelectObject(srcHdc, srcIconInfo.hbmMask);
- newIconInfo.hbmMask = OS.CreateBitmap(destWidth, destHeight, 1, 1, null);
- if (newIconInfo.hbmMask == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.SelectObject(dstHdc, newIconInfo.hbmMask);
- OS.StretchBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCCOPY);
-
- /* Select old bitmaps before creating the icon */
- OS.SelectObject(srcHdc, oldSrcBitmap);
- OS.SelectObject(dstHdc, oldDestBitmap);
-
- /* Create the new icon */
- int hIcon = OS.CreateIconIndirect(newIconInfo);
- if (hIcon == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* Draw the new icon */
- OS.DrawIconEx(handle, destX, destY, hIcon, destWidth, destHeight, 0, 0, OS.DI_NORMAL);
-
- /* Destroy the new icon and hdc's*/
- OS.DestroyIcon(hIcon);
- OS.DeleteObject(newIconInfo.hbmMask);
- OS.DeleteObject(newIconInfo.hbmColor);
- OS.DeleteDC(dstHdc);
- OS.DeleteDC(srcHdc);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
- }
- }
-
- /* Free icon info */
- OS.DeleteObject(srcIconInfo.hbmMask);
- if (srcIconInfo.hbmColor != 0) {
- OS.DeleteObject(srcIconInfo.hbmColor);
- }
-
- if (failed) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-}
-
-void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
- BITMAP bm = new BITMAP();
- OS.GetObject(srcImage.handle, BITMAP.sizeof, bm);
- int imgWidth = bm.bmWidth;
- int imgHeight = bm.bmHeight;
- if (simple) {
- srcWidth = destWidth = imgWidth;
- srcHeight = destHeight = imgHeight;
- } else {
- if (srcX + srcWidth > imgWidth || srcY + srcHeight > imgHeight) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- simple = srcX == 0 && srcY == 0 &&
- srcWidth == destWidth && destWidth == imgWidth &&
- srcHeight == destHeight && destHeight == imgHeight;
- }
- boolean mustRestore = false;
- GC memGC = srcImage.memGC;
- if (memGC != null && !memGC.isDisposed()) {
- mustRestore = true;
- GCData data = memGC.data;
- if (data.hNullBitmap != 0) {
- OS.SelectObject(memGC.handle, data.hNullBitmap);
- data.hNullBitmap = 0;
- }
- }
- if (srcImage.alpha != -1 || srcImage.alphaData != null) {
- drawBitmapAlpha(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
- } else if (srcImage.transparentPixel != -1) {
- drawBitmapTransparent(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
- } else {
- drawBitmap(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
- }
- if (mustRestore) {
- int hOldBitmap = OS.SelectObject(memGC.handle, srcImage.handle);
- memGC.data.hNullBitmap = hOldBitmap;
- }
-}
-
-void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
- /* Simple cases */
- if (srcImage.alpha == 0) return;
- if (srcImage.alpha == 255) {
- drawBitmap(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
- return;
- }
-
- /* Check clipping */
- Rectangle rect = getClipping();
- rect = rect.intersection(new Rectangle(destX, destY, destWidth, destHeight));
- if (rect.isEmpty()) return;
-
- /*
- * Optimization. Recalculate src and dest rectangles so that
- * only the clipping area is drawn.
- */
- int sx1 = srcX + (((rect.x - destX) * srcWidth) / destWidth);
- int sx2 = srcX + ((((rect.x + rect.width) - destX) * srcWidth) / destWidth);
- int sy1 = srcY + (((rect.y - destY) * srcHeight) / destHeight);
- int sy2 = srcY + ((((rect.y + rect.height) - destY) * srcHeight) / destHeight);
- destX = rect.x;
- destY = rect.y;
- destWidth = rect.width;
- destHeight = rect.height;
- srcX = sx1;
- srcY = sy1;
- srcWidth = Math.max(1, sx2 - sx1);
- srcHeight = Math.max(1, sy2 - sy1);
-
- /* Create resources */
- int srcHdc = OS.CreateCompatibleDC(handle);
- int oldSrcBitmap = OS.SelectObject(srcHdc, srcImage.handle);
- int memHdc = OS.CreateCompatibleDC(handle);
- int memDib = createDIB(Math.max(srcWidth, destWidth), Math.max(srcHeight, destHeight));
- int oldMemBitmap = OS.SelectObject(memHdc, memDib);
-
- BITMAP dibBM = new BITMAP();
- OS.GetObject(memDib, BITMAP.sizeof, dibBM);
- int sizeInBytes = dibBM.bmWidthBytes * dibBM.bmHeight;
-
- /* Get the background pixels */
- OS.BitBlt(memHdc, 0, 0, destWidth, destHeight, handle, destX, destY, OS.SRCCOPY);
- byte[] destData = new byte[sizeInBytes];
- OS.MoveMemory(destData, dibBM.bmBits, sizeInBytes);
-
- /* Get the foreground pixels */
- OS.BitBlt(memHdc, 0, 0, srcWidth, srcHeight, srcHdc, srcX, srcY, OS.SRCCOPY);
- byte[] srcData = new byte[sizeInBytes];
- OS.MoveMemory(srcData, dibBM.bmBits, sizeInBytes);
-
- /* Merge the alpha channel in place */
- int alpha = srcImage.alpha;
- final boolean hasAlphaChannel = (srcImage.alpha == -1);
- if (hasAlphaChannel) {
- final int apinc = imgWidth - srcWidth;
- final int spinc = dibBM.bmWidthBytes - srcWidth * 4;
- int ap = srcY * imgWidth + srcX, sp = 3;
- byte[] alphaData = srcImage.alphaData;
- for (int y = 0; y < srcHeight; ++y) {
- for (int x = 0; x < srcWidth; ++x) {
- srcData[sp] = alphaData[ap++];
- sp += 4;
- }
- ap += apinc;
- sp += spinc;
- }
- }
-
- /* Scale the foreground pixels with alpha */
- if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
- OS.MoveMemory(dibBM.bmBits, srcData, sizeInBytes);
- OS.StretchBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
- OS.MoveMemory(srcData, dibBM.bmBits, sizeInBytes);
-
- /* Compose the pixels */
- final int dpinc = dibBM.bmWidthBytes - destWidth * 4;
- int dp = 0;
- for (int y = 0; y < destHeight; ++y) {
- for (int x = 0; x < destWidth; ++x) {
- if (hasAlphaChannel) alpha = srcData[dp + 3] & 0xff;
- destData[dp] += ((srcData[dp] & 0xff) - (destData[dp] & 0xff)) * alpha / 255;
- destData[dp + 1] += ((srcData[dp + 1] & 0xff) - (destData[dp + 1] & 0xff)) * alpha / 255;
- destData[dp + 2] += ((srcData[dp + 2] & 0xff) - (destData[dp + 2] & 0xff)) * alpha / 255;
- dp += 4;
- }
- dp += dpinc;
- }
-
- /* Draw the composed pixels */
- OS.MoveMemory(dibBM.bmBits, destData, sizeInBytes);
- OS.BitBlt(handle, destX, destY, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY);
-
- /* Free resources */
- OS.SelectObject(memHdc, oldMemBitmap);
- OS.DeleteDC(memHdc);
- OS.DeleteObject(memDib);
- OS.SelectObject(srcHdc, oldSrcBitmap);
- OS.DeleteDC(srcHdc);
-}
-
-void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
-
- /* Get the HDC for the device */
- Device device = data.device;
- int hDC = device.internal_new_GC(null);
-
- /* Find the RGB values for the transparent pixel. */
- int transBlue = 0, transGreen = 0, transRed = 0;
- boolean isDib = bm.bmBits != 0;
- int hBitmap = srcImage.handle;
- int srcHdc = OS.CreateCompatibleDC(handle);
- int oldSrcBitmap = OS.SelectObject(srcHdc, hBitmap);
- byte[] originalColors = null;
- if (bm.bmBitsPixel <= 8) {
- if (isDib) {
- /* Palette-based DIBSECTION */
- if (OS.IsWinCE) {
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- pBits[0] = (byte)((srcImage.transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(srcHdc, 0, 0);
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- transBlue = (color & 0xFF0000) >> 16;
- transGreen = (color & 0xFF00) >> 8;
- transRed = color & 0xFF;
- } else {
- int maxColors = 1 << bm.bmBitsPixel;
- byte[] oldColors = new byte[maxColors * 4];
- int numColors = OS.GetDIBColorTable(srcHdc, 0, maxColors, oldColors);
- int offset = srcImage.transparentPixel * 4;
- byte[] newColors = new byte[oldColors.length];
- transRed = transGreen = transBlue = 0xff;
- newColors[offset] = (byte)transBlue;
- newColors[offset+1] = (byte)transGreen;
- newColors[offset+2] = (byte)transRed;
- OS.SetDIBColorTable(srcHdc, 0, maxColors, newColors);
- originalColors = oldColors;
- }
- } else {
- /* Palette-based bitmap */
- int numColors = 1 << bm.bmBitsPixel;
- byte[] bmi = new byte[40 + numColors * 4];
- /* Set the few fields necessary to get the RGB data out */
- bmi[0] = 40;
- bmi[12] = (byte)(bm.bmPlanes & 0xFF);
- bmi[13] = (byte)((bm.bmPlanes >> 8) & 0xFF);
- bmi[14] = (byte)(bm.bmBitsPixel & 0xFF);
- bmi[15] = (byte)((bm.bmBitsPixel >> 8) & 0xFF);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(srcHdc, srcImage.handle, 0, 0, 0, bmi, OS.DIB_RGB_COLORS);
- int offset = 40 + 4 * srcImage.transparentPixel;
- transRed = bmi[offset + 2] & 0xFF;
- transGreen = bmi[offset + 1] & 0xFF;
- transBlue = bmi[offset] & 0xFF;
- }
- } else {
- /* Direct color image */
- int pixel = srcImage.transparentPixel;
- switch (bm.bmBitsPixel) {
- case 16:
- transBlue = (pixel & 0x1F) << 3;
- transGreen = (pixel & 0x3E0) >> 2;
- transRed = (pixel & 0x7C00) >> 7;
- break;
- case 24:
- transBlue = (pixel & 0xFF0000) >> 16;
- transGreen = (pixel & 0xFF00) >> 8;
- transRed = pixel & 0xFF;
- break;
- case 32:
- transBlue = (pixel & 0xFF000000) >>> 24;
- transGreen = (pixel & 0xFF0000) >> 16;
- transRed = (pixel & 0xFF00) >> 8;
- break;
- }
- }
-
- /* Create the mask for the source image */
- int maskHdc = OS.CreateCompatibleDC(hDC);
- int maskBitmap = OS.CreateBitmap(imgWidth, imgHeight, 1, 1, null);
- int oldMaskBitmap = OS.SelectObject(maskHdc, maskBitmap);
- OS.SetBkColor(srcHdc, (transBlue << 16) | (transGreen << 8) | transRed);
- OS.BitBlt(maskHdc, 0, 0, imgWidth, imgHeight, srcHdc, 0, 0, OS.SRCCOPY);
- if (originalColors != null) OS.SetDIBColorTable(srcHdc, 0, 1 << bm.bmBitsPixel, originalColors);
-
- /* Draw the source bitmap transparently using invert/and mask/invert */
- int tempHdc = OS.CreateCompatibleDC(hDC);
- int tempBitmap = OS.CreateCompatibleBitmap(hDC, destWidth, destHeight);
- int oldTempBitmap = OS.SelectObject(tempHdc, tempBitmap);
- OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, handle, destX, destY, OS.SRCCOPY);
- if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR);
- OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
- OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, maskHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND);
- OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
- OS.BitBlt(handle, destX, destY, destWidth, destHeight, tempHdc, 0, 0, OS.SRCCOPY);
-
- /* Release resources */
- OS.SelectObject(tempHdc, oldTempBitmap);
- OS.DeleteDC(tempHdc);
- OS.DeleteObject(tempBitmap);
- OS.SelectObject(maskHdc, oldMaskBitmap);
- OS.DeleteDC(maskHdc);
- OS.DeleteObject(maskBitmap);
- OS.SelectObject(srcHdc, oldSrcBitmap);
- if (hBitmap != srcImage.handle) OS.DeleteObject(hBitmap);
- OS.DeleteDC(srcHdc);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-}
-
-void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
- int srcHdc = OS.CreateCompatibleDC(handle);
- int oldSrcBitmap = OS.SelectObject(srcHdc, srcImage.handle);
- int mode = 0, rop2 = 0;
- if (!OS.IsWinCE) {
- rop2 = OS.GetROP2(handle);
- mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
- } else {
- rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
- OS.SetROP2 (handle, rop2);
- }
- int dwRop = rop2 == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
- OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop);
- if (!OS.IsWinCE) {
- OS.SetStretchBltMode(handle, mode);
- }
- OS.SelectObject(srcHdc, oldSrcBitmap);
- OS.DeleteDC(srcHdc);
-}
-
-/**
- * Draws a line, using the foreground color, between the points
- * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
- *
- * @param x1 the first point's x coordinate
- * @param y1 the first point's y coordinate
- * @param x2 the second point's x coordinate
- * @param y2 the second point's y coordinate
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawLine (int x1, int y1, int x2, int y2) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (OS.IsWinCE) {
- int [] points = new int [] {x1, y1, x2, y2};
- OS.Polyline (handle, points, points.length / 2);
- } else {
- OS.MoveToEx (handle, x1, y1, 0);
- OS.LineTo (handle, x2, y2);
- }
- OS.SetPixel (handle, x2, y2, OS.GetTextColor (handle));
-}
-
-/**
- * Draws the outline of an oval, using the foreground color,
- * within the specified rectangular area.
- * <p>
- * The result is a circle or ellipse that fits within the
- * rectangle specified by the <code>x</code>, <code>y</code>,
- * <code>width</code>, and <code>height</code> arguments.
- * </p><p>
- * The oval covers an area that is <code>width + 1</code>
- * pixels wide and <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper left corner of the oval to be drawn
- * @param y the y coordinate of the upper left corner of the oval to be drawn
- * @param width the width of the oval to be drawn
- * @param height the height of the oval to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawOval (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- // Check performance impact of always setting null brush. If the user has not
- // set the background color, we may not have to do this work?
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.Ellipse(handle, x,y,x+width+1,y+height+1);
- OS.SelectObject(handle,oldBrush);
-}
-
-/**
- * Draws the closed polygon which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the vertices of the polygon. Lines are drawn between
- * each consecutive pair, and between the first pair and last pair in the
- * array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.Polygon(handle, pointArray, pointArray.length / 2);
- OS.SelectObject(handle, oldBrush);
-}
-
-/**
- * Draws the polyline which is defined by the specified array
- * of integer coordinates, using the receiver's foreground color. The array
- * contains alternating x and y values which are considered to represent
- * points which are the corners of the polyline. Lines are drawn between
- * each consecutive pair, but not between the first pair and last pair in
- * the array.
- *
- * @param pointArray an array of alternating x and y values which are the corners of the polyline
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawPolyline(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- OS.Polyline(handle, pointArray, pointArray.length / 2);
-}
-
-/**
- * Draws the outline of the rectangle specified by the arguments,
- * using the receiver's foreground color. The left and right edges
- * of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hOld = OS.SelectObject (handle, OS.GetStockObject (OS.NULL_BRUSH));
- OS.Rectangle (handle, x, y, x + width + 1, y + height + 1);
- OS.SelectObject (handle, hOld);
-}
-
-/**
- * Draws the outline of the specified rectangle, using the receiver's
- * foreground color. The left and right edges of the rectangle are at
- * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
- * and bottom edges are at <code>rect.y</code> and
- * <code>rect.y + rect.height</code>.
- *
- * @param rect the rectangle to draw
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Draws the outline of the round-cornered rectangle specified by
- * the arguments, using the receiver's foreground color. The left and
- * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
- * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
- * The <em>roundness</em> of the corners is specified by the
- * <code>arcWidth</code> and <code>arcHeight</code> arguments.
- *
- * @param x the x coordinate of the rectangle to be drawn
- * @param y the y coordinate of the rectangle to be drawn
- * @param width the width of the rectangle to be drawn
- * @param height the height of the rectangle to be drawn
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (OS.IsWinCE) {
- /*
- * Bug in WinCE PPC. On certain devices, RoundRect does not draw
- * all the pixels. The workaround is to draw a round rectangle
- * using lines and arcs.
- */
- if (width == 0 || height == 0) return;
- if (arcWidth == 0 || arcHeight == 0) {
- drawRectangle(x, y, width, height);
- return;
- }
- if (width < 0) {
- x += width;
- width = -width;
- }
- if (height < 0) {
- y += height;
- height = -height;
- };
- if (arcWidth < 0) arcWidth = -arcWidth;
- if (arcHeight < 0) arcHeight = -arcHeight;
- if (arcWidth > width) arcWidth = width;
- if (arcHeight > height) arcHeight = height;
-
- if (arcWidth < width) {
- drawLine(x+arcWidth/2, y, x+width-arcWidth/2, y);
- drawLine(x+arcWidth/2, y+height-1, x+width-arcWidth/2, y+height-1);
- }
- if (arcHeight < height) {
- drawLine(x, y+arcHeight/2, x, y+height-arcHeight/2);
- drawLine(x+width-1, y+arcHeight/2, x+width-1, y+height-arcHeight/2);
- }
- if (arcWidth != 0 && arcHeight != 0) {
- drawArc(x, y, arcWidth, arcHeight, 90, 90);
- drawArc(x+width-arcWidth-1, y, arcWidth, arcHeight, 0, 90);
- drawArc(x+width-arcWidth-1, y+height-arcHeight-1, arcWidth, arcHeight, 0, -90);
- drawArc(x, y+height-arcHeight-1, arcWidth, arcHeight, 180, 90);
- }
- } else {
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.RoundRect(handle, x,y,x+width,y+height, arcWidth, arcHeight);
- OS.SelectObject(handle,oldBrush);
- }
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. The background of the rectangular area where
- * the string is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-// TCHAR buffer = new TCHAR (getCodePage(), string, false);
- int length = string.length();
- char[] buffer = new char [length];
- string.getChars(0, length, buffer, 0);
- OS.ExtTextOutW(handle, x, y, 0, null, buffer, length, null);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. No tab expansion or carriage return processing
- * will be performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the string is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawString (String string, int x, int y, boolean isTransparent) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
-// TCHAR buffer = new TCHAR (getCodePage(), string, false);
- int length = string.length();
- char[] buffer = new char [length];
- string.getChars(0, length, buffer, 0);
- if (isTransparent) {
- int oldBkMode = OS.SetBkMode(handle, OS.TRANSPARENT);
- OS.ExtTextOutW(handle, x, y, 0, null, buffer, length, null);
- OS.SetBkMode(handle, oldBkMode);
- } else {
- OS.ExtTextOutW(handle, x, y, 0, null, buffer, length, null);
- }
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. The background of the rectangular area where
- * the text is being drawn will be filled with the receiver's
- * background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y) {
- drawText(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion and carriage return processing
- * are performed. If <code>isTransparent</code> is <code>true</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, boolean isTransparent) {
- int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB;
- if (isTransparent) flags |= SWT.DRAW_TRANSPARENT;
- drawText(string, x, y, flags);
-}
-
-/**
- * Draws the given string, using the receiver's current font and
- * foreground color. Tab expansion, line delimiter and mnemonic
- * processing are performed according to the specified flags. If
- * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
- * then the background of the rectangular area where the text is being
- * drawn will not be modified, otherwise it will be filled with the
- * receiver's background color.
- * <p>
- * The parameter <code>flags</code> may be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * </p>
- *
- * @param string the string to be drawn
- * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
- * @param flags the flags specifing how to process the text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void drawText (String string, int x, int y, int flags) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- RECT rect = new RECT();
- OS.SetRect(rect, x, y, 0x7FFF, 0x7FFF);
- TCHAR buffer = new TCHAR(getCodePage(), string, false);
- int uFormat = OS.DT_LEFT;
- if ((flags & SWT.DRAW_DELIMITER) == 0) uFormat |= OS.DT_SINGLELINE;
- if ((flags & SWT.DRAW_TAB) != 0) uFormat |= OS.DT_EXPANDTABS;
- if ((flags & SWT.DRAW_MNEMONIC) == 0) uFormat |= OS.DT_NOPREFIX;
- if ((flags & SWT.DRAW_TRANSPARENT) != 0) {
- int oldBkMode = OS.SetBkMode(handle, OS.TRANSPARENT);
- OS.DrawText(handle, buffer, buffer.length(), rect, uFormat);
- OS.SetBkMode(handle, oldBkMode);
- } else {
- OS.DrawText(handle, buffer, buffer.length(), rect, uFormat);
- }
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
-}
-
-/**
- * Fills the interior of a circular or elliptical arc within
- * the specified rectangular area, with the receiver's background
- * color.
- * <p>
- * The resulting arc begins at <code>startAngle</code> and extends
- * for <code>arcAngle</code> degrees, using the current color.
- * Angles are interpreted such that 0 degrees is at the 3 o'clock
- * position. A positive value indicates a counter-clockwise rotation
- * while a negative value indicates a clockwise rotation.
- * </p><p>
- * The center of the arc is the center of the rectangle whose origin
- * is (<code>x</code>, <code>y</code>) and whose size is specified by the
- * <code>width</code> and <code>height</code> arguments.
- * </p><p>
- * The resulting arc covers an area <code>width + 1</code> pixels wide
- * by <code>height + 1</code> pixels tall.
- * </p>
- *
- * @param x the x coordinate of the upper-left corner of the arc to be filled
- * @param y the y coordinate of the upper-left corner of the arc to be filled
- * @param width the width of the arc to be filled
- * @param height the height of the arc to be filled
- * @param startAngle the beginning angle
- * @param arcAngle the angular extent of the arc, relative to the start angle
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawArc
- */
-public void fillArc (int x, int y, int width, int height, int startAngle, int endAngle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- if (width < 0) {
- x = x + width;
- width = -width;
- }
- if (height < 0) {
- y = y + height;
- height = -height;
- }
-
- if (width == 0 || height == 0 || endAngle == 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /*
- * Feature in WinCE. The function Pie is not present in the
- * WinCE SDK. The fix is to emulate it by using Polygon.
- */
- if (OS.IsWinCE) {
- /* compute arc with a simple linear interpolation */
- if (endAngle < 0) {
- startAngle += endAngle;
- endAngle = -endAngle;
- }
- boolean drawSegments = true;
- if (endAngle >= 360) {
- endAngle = 360;
- drawSegments = false;
- }
- int[] points = new int[(endAngle + 1) * 2 + (drawSegments ? 4 : 0)];
- int cteX = 2 * x + width;
- int cteY = 2 * y + height;
- int index = (drawSegments ? 2 : 0);
- for (int i = 0; i <= endAngle; i++) {
- points[index++] = (Compatibility.cos(startAngle + i, width) + cteX) >> 1;
- points[index++] = (cteY - Compatibility.sin(startAngle + i, height)) >> 1;
- }
- if (drawSegments) {
- points[0] = points[points.length - 2] = cteX >> 1;
- points[1] = points[points.length - 1] = cteY >> 1;
- }
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.Polygon(handle, points, points.length / 2);
- OS.SelectObject(handle, oldPen);
- } else {
- int x1, y1, x2, y2,tmp;
- boolean isNegative;
- if (endAngle >= 360 || endAngle <= -360) {
- x1 = x2 = x + width;
- y1 = y2 = y + height / 2;
- } else {
- isNegative = endAngle < 0;
-
- endAngle = endAngle + startAngle;
- if (isNegative) {
- // swap angles
- tmp = startAngle;
- startAngle = endAngle;
- endAngle = tmp;
- }
- x1 = Compatibility.cos(startAngle, width) + x + width/2;
- y1 = -1 * Compatibility.sin(startAngle, height) + y + height/2;
-
- x2 = Compatibility.cos(endAngle, width) + x + width/2;
- y2 = -1 * Compatibility.sin(endAngle, height) + y + height/2;
- }
-
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.Pie(handle, x,y,x+width+1,y+height+1,x1,y1,x2,y2 );
- OS.SelectObject(handle,oldPen);
- }
-}
-
-/**
- * Fills the interior of the specified rectangle with a gradient
- * sweeping from left to right or top to bottom progressing
- * from the receiver's foreground color to its background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled, may be negative
- * (inverts direction of gradient if horizontal)
- * @param height the height of the rectangle to be filled, may be negative
- * (inverts direction of gradient if vertical)
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width == 0 || height == 0) return;
- int fromColor = OS.GetTextColor(handle);
- if (fromColor == OS.CLR_INVALID) {
- fromColor = OS.GetSysColor(OS.COLOR_WINDOWTEXT);
- }
- int toColor = OS.GetBkColor(handle);
- if (toColor == OS.CLR_INVALID) {
- toColor = OS.GetSysColor(OS.COLOR_WINDOW);
- }
- boolean swapColors = false;
- if (width < 0) {
- x += width; width = -width;
- if (! vertical) swapColors = true;
- }
- if (height < 0) {
- y += height; height = -height;
- if (vertical) swapColors = true;
- }
- if (swapColors) {
- final int t = fromColor;
- fromColor = toColor;
- toColor = t;
- }
- final RGB fromRGB = new RGB(fromColor & 0xff, (fromColor >>> 8) & 0xff, (fromColor >>> 16) & 0xff);
- final RGB toRGB = new RGB(toColor & 0xff, (toColor >>> 8) & 0xff, (toColor >>> 16) & 0xff);
- if ((fromRGB.red == toRGB.red) && (fromRGB.green == toRGB.green) && (fromRGB.blue == toRGB.blue)) {
- OS.PatBlt(handle, x, y, width, height, OS.PATCOPY);
- return;
- }
-
- /* Use GradientFill if supported, only on Windows 98, 2000 and newer */
- if (!OS.IsWinCE) {
- final int hHeap = OS.GetProcessHeap();
- final int pMesh = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY,
- GRADIENT_RECT.sizeof + TRIVERTEX.sizeof * 2);
- final int pVertex = pMesh + GRADIENT_RECT.sizeof;
-
- GRADIENT_RECT gradientRect = new GRADIENT_RECT();
- gradientRect.UpperLeft = 0;
- gradientRect.LowerRight = 1;
- OS.MoveMemory(pMesh, gradientRect, gradientRect.sizeof);
-
- TRIVERTEX trivertex = new TRIVERTEX();
- trivertex.x = x;
- trivertex.y = y;
- trivertex.Red = (short)((fromRGB.red << 8) | fromRGB.red);
- trivertex.Green = (short)((fromRGB.green << 8) | fromRGB.green);
- trivertex.Blue = (short)((fromRGB.blue << 8) | fromRGB.blue);
- trivertex.Alpha = -1;
- OS.MoveMemory(pVertex, trivertex, TRIVERTEX.sizeof);
-
- trivertex.x = x + width;
- trivertex.y = y + height;
- trivertex.Red = (short)((toRGB.red << 8) | toRGB.red);
- trivertex.Green = (short)((toRGB.green << 8) | toRGB.green);
- trivertex.Blue = (short)((toRGB.blue << 8) | toRGB.blue);
- trivertex.Alpha = -1;
- OS.MoveMemory(pVertex + TRIVERTEX.sizeof, trivertex, TRIVERTEX.sizeof);
-
- boolean success = OS.GradientFill(handle, pVertex, 2, pMesh, 1,
- vertical ? OS.GRADIENT_FILL_RECT_V : OS.GRADIENT_FILL_RECT_H);
- OS.HeapFree(hHeap, 0, pMesh);
- if (success) return;
- }
-
- final int depth = OS.GetDeviceCaps(handle, OS.BITSPIXEL);
- final int bitResolution = (depth >= 24) ? 8 : (depth >= 15) ? 5 : 0;
- ImageData.fillGradientRectangle(this, data.device,
- x, y, width, height, vertical, fromRGB, toRGB,
- bitResolution, bitResolution, bitResolution);
-}
-
-/**
- * Fills the interior of an oval, within the specified
- * rectangular area, with the receiver's background
- * color.
- *
- * @param x the x coordinate of the upper left corner of the oval to be filled
- * @param y the y coordinate of the upper left corner of the oval to be filled
- * @param width the width of the oval to be filled
- * @param height the height of the oval to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawOval
- */
-public void fillOval (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- /* Assumes that user sets the background color. */
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.Ellipse(handle, x,y,x+width+1,y+height+1);
- OS.SelectObject(handle,oldPen);
-}
-
-/**
- * Fills the interior of the closed polygon which is defined by the
- * specified array of integer coordinates, using the receiver's
- * background color. The array contains alternating x and y values
- * which are considered to represent points which are the vertices of
- * the polygon. Lines are drawn between each consecutive pair, and
- * between the first pair and last pair in the array.
- *
- * @param pointArray an array of alternating x and y values which are the vertices of the polygon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawPolygon
- */
-public void fillPolygon(int[] pointArray) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.Polygon(handle, pointArray, pointArray.length / 2);
- OS.SelectObject(handle,oldPen);
-}
-
-/**
- * Fills the interior of the rectangle specified by the arguments,
- * using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
- OS.SetROP2(handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
- int dwRop = rop2 == OS.R2_XORPEN ? OS.PATINVERT : OS.PATCOPY;
- OS.PatBlt(handle, x, y, width, height, dwRop);
-}
-
-/**
- * Fills the interior of the specified rectangle, using the receiver's
- * background color.
- *
- * @param rectangle the rectangle to be filled
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRectangle
- */
-public void fillRectangle (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- fillRectangle (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Fills the interior of the round-cornered rectangle specified by
- * the arguments, using the receiver's background color.
- *
- * @param x the x coordinate of the rectangle to be filled
- * @param y the y coordinate of the rectangle to be filled
- * @param width the width of the rectangle to be filled
- * @param height the height of the rectangle to be filled
- * @param arcWidth the horizontal diameter of the arc at the four corners
- * @param arcHeight the vertical diameter of the arc at the four corners
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #drawRoundRectangle
- */
-public void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.RoundRect(handle, x,y,x+width,y+height,arcWidth, arcHeight);
- OS.SelectObject(handle,oldPen);
-}
-
-/**
- * Returns the <em>advance width</em> of the specified character in
- * the font which is currently selected into the receiver.
- * <p>
- * The advance width is defined as the horizontal distance the cursor
- * should move after printing the character in the selected font.
- * </p>
- *
- * @param ch the character to measure
- * @return the distance in the x direction to move past the character before painting the next
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getAdvanceWidth(char ch) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (OS.IsWinCE) {
- SIZE size = new SIZE();
- OS.GetTextExtentPoint32W(handle, new char[]{ch}, 1, size);
- return size.cx;
- }
- int tch = ch;
- if (ch > 0x7F) {
- TCHAR buffer = new TCHAR(getCodePage(), ch, false);
- tch = buffer.tcharAt(0);
- }
- int[] width = new int[1];
- OS.GetCharWidth(handle, tch, tch, width);
- return width[0];
-}
-
-/**
- * Returns the background color.
- *
- * @return the receiver's background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int color = OS.GetBkColor(handle);
- if (color == OS.CLR_INVALID) {
- color = OS.GetSysColor(OS.COLOR_WINDOW);
- }
- return Color.win32_new(data.device, color);
-}
-
-/**
- * Returns the width of the specified character in the font
- * selected into the receiver.
- * <p>
- * The width is defined as the space taken up by the actual
- * character, not including the leading and tailing whitespace
- * or overhang.
- * </p>
- *
- * @param ch the character to measure
- * @return the width of the character
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getCharWidth(char ch) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- /* GetCharABCWidths only succeeds on truetype fonts */
- if (!OS.IsWinCE) {
- int tch = ch;
- if (ch > 0x7F) {
- TCHAR buffer = new TCHAR(getCodePage(), ch, false);
- tch = buffer.tcharAt (0);
- }
- int[] width = new int[3];
- if (OS.GetCharABCWidths(handle, tch, tch, width)) {
- return width[1];
- }
- }
-
- /* It wasn't a truetype font */
- TEXTMETRIC tm = new TEXTMETRIC();
- OS.GetTextMetricsW(handle, tm);
- SIZE size = new SIZE();
- OS.GetTextExtentPoint32W(handle, new char[]{ch}, 1, size);
- return size.cx - tm.tmOverhang;
-}
-
-/**
- * Returns the bounding rectangle of the receiver's clipping
- * region. If no clipping region is set, the return value
- * will be a rectangle which covers the entire bounds of the
- * object the receiver is drawing on.
- *
- * @return the bounding rectangle of the clipping region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Rectangle getClipping() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- RECT rect = new RECT();
- OS.GetClipBox(handle, rect);
- return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
-}
-
-/**
- * Sets the region managed by the argument to the current
- * clipping region of the receiver.
- *
- * @param region the region to fill with the clipping region
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void getClipping (Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int result = OS.GetClipRgn (handle, region.handle);
- if (result == 1) return;
- RECT rect = new RECT();
- OS.GetClipBox(handle, rect);
- OS.SetRectRgn(region.handle, rect.left, rect.top, rect.right, rect.bottom);
-}
-
-int getCodePage () {
- if (OS.IsWinCE) return OS.GetACP();
- int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(handle);
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
- return lpCs[1];
-}
-
-/**
- * Returns the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Font getFont () {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hFont = OS.GetCurrentObject(handle, OS.OBJ_FONT);
- return Font.win32_new(data.device, hFont);
-}
-
-/**
- * Returns a FontMetrics which contains information
- * about the font currently being used by the receiver
- * to draw and measure text.
- *
- * @return font metrics for the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public FontMetrics getFontMetrics() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- TEXTMETRIC lptm = new TEXTMETRIC();
- OS.GetTextMetrics(handle, lptm);
- return FontMetrics.win32_new(lptm);
-}
-
-/**
- * Returns the receiver's foreground color.
- *
- * @return the color used for drawing foreground things
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getForeground() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int color = OS.GetTextColor(handle);
- if (color == OS.CLR_INVALID) {
- color = OS.GetSysColor(OS.COLOR_WINDOWTEXT);
- }
- return Color.win32_new(data.device, color);
-}
-
-/**
- * Returns the receiver's line style, which will be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @return the style used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineStyle() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
- LOGPEN logPen = new LOGPEN();
- OS.GetObject(hPen, LOGPEN.sizeof, logPen);
- switch (logPen.lopnStyle) {
- case OS.PS_SOLID: return SWT.LINE_SOLID;
- case OS.PS_DASH: return SWT.LINE_DASH;
- case OS.PS_DOT: return SWT.LINE_DOT;
- case OS.PS_DASHDOT: return SWT.LINE_DASHDOT;
- case OS.PS_DASHDOTDOT: return SWT.LINE_DASHDOTDOT;
- default: return SWT.LINE_SOLID;
- }
-}
-
-/**
- * Returns the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @return the receiver's line width
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public int getLineWidth() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
- LOGPEN logPen = new LOGPEN();
- OS.GetObject(hPen, LOGPEN.sizeof, logPen);
- return logPen.x;
-}
-
-/**
- * Returns <code>true</code> if this GC is drawing in the mode
- * where the resulting color in the destination is the
- * <em>exclusive or</em> of the color values in the source
- * and the destination, and <code>false</code> if it is
- * drawing in the mode where the destination color is being
- * replaced with the source color value.
- *
- * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean getXORMode() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
- OS.SetROP2 (handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
- return rop2 == OS.R2_XORPEN;
-}
-
-void init(Drawable drawable, GCData data, int hDC) {
- int foreground = data.foreground;
- if (foreground != -1 && OS.GetTextColor(hDC) != foreground) {
- OS.SetTextColor(hDC, foreground);
- int hPen = OS.CreatePen(OS.PS_SOLID, 0, foreground);
- OS.SelectObject(hDC, hPen);
- }
- int background = data.background;
- if (background != -1 && OS.GetBkColor(hDC) != background) {
- OS.SetBkColor(hDC, background);
- int hBrush = OS.CreateSolidBrush(background);
- OS.SelectObject(hDC, hBrush);
- }
- int hFont = data.hFont;
- if (hFont != 0) OS.SelectObject (hDC, hFont);
- int hPalette = data.device.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette(hDC, hPalette, true);
- OS.RealizePalette(hDC);
- }
- Image image = data.image;
- if (image != null) {
- data.hNullBitmap = OS.SelectObject(hDC, image.handle);
- image.memGC = this;
- }
- this.drawable = drawable;
- this.data = data;
- handle = hDC;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-/**
- * Returns <code>true</code> if the receiver has a clipping
- * region set into it, and <code>false</code> otherwise.
- * If this method returns false, the receiver will draw on all
- * available space in the destination. If it returns true,
- * it will draw only in the area that is covered by the region
- * that can be accessed with <code>getClipping(region)</code>.
- *
- * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isClipped() {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int region = OS.CreateRectRgn(0, 0, 0, 0);
- int result = OS.GetClipRgn(handle, region);
- OS.DeleteObject(region);
- return (result > 0);
-}
-
-/**
- * Returns <code>true</code> if the GC has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the GC.
- * When a GC has been disposed, it is an error to
- * invoke any other method using the GC.
- *
- * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Sets the background color. The background color is used
- * for fill operations and as the background color when text
- * is drawn.
- *
- * @param color the new background color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (OS.GetBkColor(handle) == color.handle) return;
- OS.SetBkColor (handle, color.handle);
- int newBrush = OS.CreateSolidBrush (color.handle);
- int oldBrush = OS.SelectObject (handle, newBrush);
- OS.DeleteObject (oldBrush);
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the arguments.
- *
- * @param x the x coordinate of the clipping rectangle
- * @param y the y coordinate of the clipping rectangle
- * @param width the width of the clipping rectangle
- * @param height the height of the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (int x, int y, int width, int height) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hRgn = OS.CreateRectRgn (x, y, x + width, y + height);
- OS.SelectClipRgn (handle, hRgn);
- OS.DeleteObject (hRgn);
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the rectangular area specified
- * by the argument.
- *
- * @param rect the clipping rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Rectangle rect) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) {
- OS.SelectClipRgn (handle, 0);
- return;
- }
- setClipping (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Sets the area of the receiver which can be changed
- * by drawing operations to the region specified
- * by the argument.
- *
- * @param rect the clipping region.
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setClipping (Region region) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hRegion = 0;
- if (region != null) hRegion = region.handle;
- OS.SelectClipRgn (handle, hRegion);
-}
-
-/**
- * Sets the font which will be used by the receiver
- * to draw and measure text to the argument. If the
- * argument is null, then a default font appropriate
- * for the platform will be used instead.
- *
- * @param font the new font for the receiver, or null to indicate a default font
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-
-public void setFont (Font font) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (font == null) {
- OS.SelectObject(handle, data.device.systemFont);
- } else {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.SelectObject(handle, font.handle);
- }
-}
-
-/**
- * Sets the foreground color. The foreground color is used
- * for drawing operations including when text is drawn.
- *
- * @param color the new foreground color for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setForeground (Color color) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (OS.GetTextColor(handle) == color.handle) return;
- int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
- LOGPEN logPen = new LOGPEN();
- OS.GetObject(hPen, LOGPEN.sizeof, logPen);
- OS.SetTextColor (handle, color.handle);
- int newPen = OS.CreatePen (logPen.lopnStyle, logPen.x, color.handle);
- int oldPen = OS.SelectObject (handle, newPen);
- OS.DeleteObject (oldPen);
-}
-
-/**
- * Sets the receiver's line style to the argument, which must be one
- * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
- * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
- * <code>SWT.LINE_DASHDOTDOT</code>.
- *
- * @param lineStyle the style to be used for drawing lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineStyle(int lineStyle) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int style = -1;
- switch (lineStyle) {
- case SWT.LINE_SOLID: style = OS.PS_SOLID; break;
- case SWT.LINE_DASH: style = OS.PS_DASH; break;
- case SWT.LINE_DOT: style = OS.PS_DOT; break;
- case SWT.LINE_DASHDOT: style = OS.PS_DASHDOT; break;
- case SWT.LINE_DASHDOTDOT: style = OS.PS_DASHDOTDOT; break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
- LOGPEN logPen = new LOGPEN();
- OS.GetObject(hPen, LOGPEN.sizeof, logPen);
- if (logPen.lopnStyle == style) return;
- int newPen = OS.CreatePen(style, logPen.x, logPen.lopnColor);
- int oldPen = OS.SelectObject(handle, newPen);
- OS.DeleteObject(oldPen);
-}
-
-/**
- * Sets the width that will be used when drawing lines
- * for all of the figure drawing operations (that is,
- * <code>drawLine</code>, <code>drawRectangle</code>,
- * <code>drawPolyline</code>, and so forth.
- *
- * @param lineWidth the width of a line
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setLineWidth(int lineWidth) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
- LOGPEN logPen = new LOGPEN();
- OS.GetObject(hPen, LOGPEN.sizeof, logPen);
- if (logPen.x == lineWidth) return;
- int newPen = OS.CreatePen(logPen.lopnStyle, lineWidth, logPen.lopnColor);
- int oldPen = OS.SelectObject(handle, newPen);
- OS.DeleteObject(oldPen);
-}
-
-/**
- * If the argument is <code>true</code>, puts the receiver
- * in a drawing mode where the resulting color in the destination
- * is the <em>exclusive or</em> of the color values in the source
- * and the destination, and if the argument is <code>false</code>,
- * puts the receiver in a drawing mode where the destination color
- * is replaced with the source color value.
- *
- * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setXORMode(boolean xor) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (xor) {
- OS.SetROP2(handle, OS.R2_XORPEN);
- } else {
- OS.SetROP2(handle, OS.R2_COPYPEN);
- }
-}
-
-/**
- * Returns the extent of the given string. No tab
- * expansion or carriage return processing will be performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point stringExtent(String string) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- SIZE size = new SIZE();
- int length = string.length();
- if (length == 0) {
-// OS.GetTextExtentPoint32(handle, SPACE, SPACE.length(), size);
- OS.GetTextExtentPoint32W(handle, new char[]{' '}, 1, size);
- return new Point(0, size.cy);
- } else {
-// TCHAR buffer = new TCHAR (getCodePage(), string, false);
- char[] buffer = new char [length];
- string.getChars(0, length, buffer, 0);
- OS.GetTextExtentPoint32W(handle, buffer, length, size);
- return new Point(size.cx, size.cy);
- }
-}
-
-/**
- * Returns the extent of the given string. Tab expansion and
- * carriage return processing are performed.
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string) {
- return textExtent(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
-}
-
-/**
- * Returns the extent of the given string. Tab expansion, line
- * delimiter and mnemonic processing are performed according to
- * the specified flags, which can be a combination of:
- * <dl>
- * <dt><b>DRAW_DELIMITER</b></dt>
- * <dd>draw multiple lines</dd>
- * <dt><b>DRAW_TAB</b></dt>
- * <dd>expand tabs</dd>
- * <dt><b>DRAW_MNEMONIC</b></dt>
- * <dd>underline the mnemonic character</dd>
- * <dt><b>DRAW_TRANSPARENT</b></dt>
- * <dd>transparent background</dd>
- * </dl>
- * <p>
- * The <em>extent</em> of a string is the width and height of
- * the rectangular area it would cover if drawn in a particular
- * font (in this case, the current font in the receiver).
- * </p>
- *
- * @param string the string to measure
- * @param flags the flags specifing how to process the text
- * @return a point containing the extent of the string
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Point textExtent(String string, int flags) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (string.length () == 0) {
- SIZE size = new SIZE();
-// OS.GetTextExtentPoint32(handle, SPACE, SPACE.length(), size);
- OS.GetTextExtentPoint32W(handle, new char [] {' '}, 1, size);
- return new Point(0, size.cy);
- }
- RECT rect = new RECT();
- TCHAR buffer = new TCHAR(getCodePage(), string, false);
- int uFormat = OS.DT_LEFT | OS.DT_CALCRECT;
- if ((flags & SWT.DRAW_DELIMITER) == 0) uFormat |= OS.DT_SINGLELINE;
- if ((flags & SWT.DRAW_TAB) != 0) uFormat |= OS.DT_EXPANDTABS;
- if ((flags & SWT.DRAW_MNEMONIC) == 0) uFormat |= OS.DT_NOPREFIX;
- OS.DrawText(handle, buffer, buffer.length(), rect, uFormat);
- return new Point(rect.right, rect.bottom);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "GC {*DISPOSED*}";
- return "GC {" + handle + "}";
-}
-
-/**
- * Invokes platform specific functionality to allocate a new graphics context.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>GC</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param drawable the Drawable for the receiver.
- * @param data the data for the receiver.
- *
- * @return a new <code>GC</code>
- *
- * @private
- */
-public static GC win32_new(Drawable drawable, GCData data) {
- GC gc = new GC();
- int hDC = drawable.internal_new_GC(data);
- gc.init(drawable, data, hDC);
- return gc;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java
deleted file mode 100755
index 93b1799593..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * Instances of this class are descriptions of GCs in terms
- * of unallocated platform-specific data fields.
- * <p>
- * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
- * API for SWT. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms, and should never be called from application code.
- * </p>
- *
- * @private
- */
-
-public final class GCData {
- public Device device;
- public Image image;
- public int foreground = -1;
- public int background = -1;
- public int hFont;
- public int hNullBitmap;
- public int hwnd;
- public PAINTSTRUCT ps;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
deleted file mode 100755
index 81e442ec8b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ /dev/null
@@ -1,1888 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import java.io.*;
-
-/**
- * Instances of this class are graphics which have been prepared
- * for display on a specific device. That is, they are ready
- * to paint using methods such as <code>GC.drawImage()</code>
- * and display on widgets with, for example, <code>Button.setImage()</code>.
- * <p>
- * If loaded from a file format that supports it, an
- * <code>Image</code> may have transparency, meaning that certain
- * pixels are specified as being transparent when drawn. Examples
- * of file formats that support transparency are GIF and PNG.
- * </p><p>
- * There are two primary ways to use <code>Images</code>.
- * The first is to load a graphic file from disk and create an
- * <code>Image</code> from it. This is done using an <code>Image</code>
- * constructor, for example:
- * <pre>
- * Image i = new Image(device, "C:\\graphic.bmp");
- * </pre>
- * A graphic file may contain a color table specifying which
- * colors the image was intended to possess. In the above example,
- * these colors will be mapped to the closest available color in
- * SWT. It is possible to get more control over the mapping of
- * colors as the image is being created, using code of the form:
- * <pre>
- * ImageData data = new ImageData("C:\\graphic.bmp");
- * RGB[] rgbs = data.getRGBs();
- * // At this point, rgbs contains specifications of all
- * // the colors contained within this image. You may
- * // allocate as many of these colors as you wish by
- * // using the Color constructor Color(RGB), then
- * // create the image:
- * Image i = new Image(device, data);
- * </pre>
- * <p>
- * Applications which require even greater control over the image
- * loading process should use the support provided in class
- * <code>ImageLoader</code>.
- * </p><p>
- * Application code must explicitely invoke the <code>Image.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- *
- * @see Color
- * @see ImageData
- * @see ImageLoader
- */
-
-public final class Image implements Drawable {
-
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
- */
- public int type;
-
- /**
- * the OS resource of the image
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- /**
- * the device where this image was created
- */
- Device device;
-
- /**
- * specifies the transparent pixel
- * (Warning: This field is platform dependent)
- */
- int transparentPixel = -1;
-
- /**
- * the GC which is drawing on the image
- * (Warning: This field is platform dependent)
- */
- GC memGC;
-
- /**
- * the alpha data for the image
- * (Warning: This field is platform dependent)
- */
- byte[] alphaData;
-
- /**
- * the global alpha value to be used for every pixel
- * (Warning: This field is platform dependent)
- */
- int alpha = -1;
-
- /**
- * specifies the default scanline padding
- * (Warning: This field is platform dependent)
- */
- static final int DEFAULT_SCANLINE_PAD = 4;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Image () {
-}
-
-/**
- * Constructs an empty instance of this class with the
- * specified width and height. The result may be drawn upon
- * by creating a GC and using any of its drawing operations,
- * as shown in the following example:
- * <pre>
- * Image i = new Image(device, width, height);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param width the width of the new image
- * @param height the height of the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
- * </ul>
- */
-public Image(Device device, int width, int height) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, width, height);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs a new instance of this class based on the
- * provided image, with an appearance that varies depending
- * on the value of the flag. The possible flag values are:
- * <dl>
- * <dt><b>IMAGE_COPY</b></dt>
- * <dd>the result is an identical copy of srcImage</dd>
- * <dt><b>IMAGE_DISABLE</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
- * <dt><b>IMAGE_GRAY</b></dt>
- * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
- * </dl>
- *
- * @param device the device on which to create the image
- * @param srcImage the image to use as the source
- * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
- * is otherwise in an invalid state</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
-public Image(Device device, Image srcImage, int flag) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- switch (flag) {
- case SWT.IMAGE_COPY: {
- Rectangle r = srcImage.getBounds();
- this.type = srcImage.type;
- switch (type) {
- case SWT.BITMAP:
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Copy the bitmap */
- int hdcSource = OS.CreateCompatibleDC(hDC);
- int hdcDest = OS.CreateCompatibleDC(hDC);
- int hOldSrc = OS.SelectObject(hdcSource, srcImage.handle);
- handle = OS.CreateCompatibleBitmap(hdcSource, r.width, r.height);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int hOldDest = OS.SelectObject(hdcDest, handle);
- OS.BitBlt(hdcDest, 0, 0, r.width, r.height, hdcSource, 0, 0, OS.SRCCOPY);
- OS.SelectObject(hdcSource, hOldSrc);
- OS.SelectObject(hdcDest, hOldDest);
- OS.DeleteDC(hdcSource);
- OS.DeleteDC(hdcDest);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
- transparentPixel = srcImage.transparentPixel;
- alpha = srcImage.alpha;
- if (srcImage.alphaData != null) {
- alphaData = new byte[srcImage.alphaData.length];
- System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
- }
- break;
- case SWT.ICON:
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- handle = OS.CopyImage(srcImage.handle, OS.IMAGE_ICON, r.width, r.height, 0);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- }
- if (device.tracking) device.new_Object(this);
- return;
- }
- case SWT.IMAGE_DISABLE: {
- Rectangle r = srcImage.getBounds();
- this.type = srcImage.type;
- byte[] rgbBwBitmapInfo = {
- 40,0,0,0, /* biSize */
- (byte)(r.width & 0xFF), /* biWidth */
- (byte)((r.width & 0xFF00) >> 8),
- (byte)((r.width & 0xFF0000) >> 16),
- (byte)((r.width & 0xFF000000) >> 24),
- (byte)(r.height & 0xFF), /* biHeight */
- (byte)((r.height & 0xFF00) >> 8),
- (byte)((r.height & 0xFF0000) >> 16),
- (byte)((r.height & 0xFF000000) >> 24),
- 1,0, /* biPlanes */
- 1,0, /* biBitCount */
- 0,0,0,0, /* biCompression */
- 0,0,0,0, /* biSizeImage */
- 0,0,0,0, /* biXPelsPerMeter */
- 0,0,0,0, /* biYPelsPerMeter */
- 0,0,0,0, /* biClrUsed */
- 0,0,0,0, /* biClrImportant */
- 0,0,0,0, /* First color: black */
- (byte)0xFF,(byte)0xFF,(byte)0xFF,0 /* Second color: white */
- };
-
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Source DC */
- int hdcSource = OS.CreateCompatibleDC(hDC);
- if (hdcSource == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Monochrome (Intermediate) DC */
- int bwDC = OS.CreateCompatibleDC(hdcSource);
- if (bwDC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Destination DC */
- int hdcBmp = OS.CreateCompatibleDC(hDC);
- if (hdcBmp == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Monochrome (Intermediate) DIB section */
- int[] pbitsBW = new int[1];
- int hbmBW = OS.CreateDIBSection(bwDC, rgbBwBitmapInfo, OS.DIB_RGB_COLORS, pbitsBW, 0, 0);
- if (hbmBW == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- switch (type) {
- case SWT.BITMAP:
- /* Attach the bitmap to the source DC */
- int hOldSrc = OS.SelectObject(hdcSource, srcImage.handle);
- /* Create the destination bitmap */
- handle = OS.CreateCompatibleBitmap(hDC, r.width, r.height);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Attach the DIB section and the new bitmap to the DCs */
- int hOldBw = OS.SelectObject(bwDC, hbmBW);
- int hOldBmp = OS.SelectObject(hdcBmp, handle);
- /* BitBlt the bitmap into the monochrome DIB section */
- OS.BitBlt(bwDC, 0, 0, r.width, r.height, hdcSource, 0, 0, OS.SRCCOPY);
- /* Paint the destination rectangle in gray */
- RECT rect = new RECT();
- rect.left = 0;
- rect.top = 0;
- rect.right = r.width;
- rect.bottom = r.height;
- OS.FillRect(hdcBmp, rect, OS.GetSysColorBrush(OS.COLOR_3DFACE));
- /*
- * BitBlt the black bits in the monochrome bitmap into
- * COLOR_3DHILIGHT bits in the destination DC.
- * The magic ROP comes from Charles Petzold's book
- */
- int hb = OS.CreateSolidBrush(OS.GetSysColor(OS.COLOR_3DHILIGHT));
- int oldBrush = OS.SelectObject(hdcBmp, hb);
- OS.BitBlt(hdcBmp, 1, 1, r.width, r.height, bwDC, 0, 0, 0xB8074A);
- /*
- * BitBlt the black bits in the monochrome bitmap into
- * COLOR_3DSHADOW bits in the destination DC.
- */
- hb = OS.CreateSolidBrush(OS.GetSysColor(OS.COLOR_3DSHADOW));
- OS.DeleteObject(OS.SelectObject(hdcBmp, hb));
- OS.BitBlt(hdcBmp, 0, 0, r.width, r.height, bwDC, 0, 0, 0xB8074A);
- OS.DeleteObject(OS.SelectObject(hdcBmp, oldBrush));
- /* Free resources */
- OS.SelectObject(hdcSource, hOldSrc);
- OS.SelectObject(hdcBmp, hOldBmp);
- OS.SelectObject(bwDC, hOldBw);
- OS.DeleteDC(hdcSource);
- OS.DeleteDC(bwDC);
- OS.DeleteDC(hdcBmp);
- OS.DeleteObject(hbmBW);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
- break;
- case SWT.ICON:
- /* Get icon information */
- ICONINFO iconInfo = new ICONINFO();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.GetIconInfo(srcImage.handle, iconInfo))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int hdcMask = OS.CreateCompatibleDC(hDC);
- /* Create the destination bitmaps */
- if (iconInfo.hbmColor == 0)
- hOldSrc = OS.SelectObject(hdcSource, iconInfo.hbmMask);
- else
- hOldSrc = OS.SelectObject(hdcSource, iconInfo.hbmColor);
- int newHbmp = OS.CreateCompatibleBitmap(hdcSource, r.width, r.height);
- if (newHbmp == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int newHmask = OS.CreateBitmap(r.width, r.height, 1, 1, null);
- if (newHmask == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* BitBlt the source mask into the destination mask */
- int hOldMask = OS.SelectObject(hdcMask, newHmask);
- if (iconInfo.hbmColor != 0)
- OS.SelectObject(hdcSource, iconInfo.hbmMask);
- OS.SelectObject(hdcSource, iconInfo.hbmMask);
- OS.BitBlt(hdcMask, 0, 0, r.width, r.height, hdcSource, 0, 0, OS.SRCCOPY);
- /* Attach the monochrome DIB section and the destination bitmap to the DCs */
- hOldBw = OS.SelectObject(bwDC, hbmBW);
- /* BitBlt the bitmap into the monochrome DIB section */
- if (iconInfo.hbmColor == 0) {
- OS.SelectObject(hdcSource, iconInfo.hbmMask);
- OS.BitBlt(bwDC, 0, 0, r.width, r.height, hdcSource, 0, r.height, OS.SRCCOPY);
- } else {
- OS.SelectObject(hdcSource, iconInfo.hbmColor);
- OS.BitBlt(bwDC, 0, 0, r.width, r.height, hdcSource, 0, 0, OS.SRCCOPY);
- }
- /* Paint the destination rectangle in grey */
- rect = new RECT();
- rect.left = 0;
- rect.top = 0;
- rect.right = r.width;
- rect.bottom = r.height;
- hOldBmp = OS.SelectObject(hdcBmp, newHbmp);
- OS.FillRect(hdcBmp, rect, OS.GetSysColorBrush(OS.COLOR_3DFACE));
- /*
- * BitBlt the black bits in the monochrome bitmap into
- * COLOR_3DHILIGHT bits in the destination DC.
- * The magic ROP comes from Charles Petzold's book
- */
- hb = OS.CreateSolidBrush(OS.GetSysColor(OS.COLOR_3DSHADOW));
- oldBrush = OS.SelectObject(hdcBmp, hb);
- OS.BitBlt(hdcBmp, 0, 0, r.width, r.height, bwDC, 0, 0, 0xB8074A);
- /* Invert mask into hdcBw */
- OS.BitBlt(bwDC, 0, 0, r.width, r.height, hdcMask, 0, 0, OS.NOTSRCCOPY);
- /* Select black brush into destination */
- hb = OS.CreateSolidBrush(0);
- OS.DeleteObject(OS.SelectObject(hdcBmp, hb));
- /*
- * Copy black bits from monochrome bitmap into black bits in the
- * destination DC.
- */
- OS.BitBlt(hdcBmp, 0, 0, r.width, r.height, bwDC, 0, 0, 0xB8074A);
- OS.DeleteObject(OS.SelectObject(hdcBmp, oldBrush));
- /* Free resources */
- OS.SelectObject(hdcSource, hOldSrc);
- OS.DeleteDC(hdcSource);
- OS.SelectObject(bwDC, hOldBw);
- OS.DeleteDC(bwDC);
- OS.SelectObject(hdcBmp, hOldBmp);
- OS.DeleteDC(hdcBmp);
- OS.SelectObject(hdcMask, hOldMask);
- OS.DeleteDC(hdcMask);
- OS.DeleteObject(hbmBW);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
- /* Create the new iconinfo */
- ICONINFO newIconInfo = new ICONINFO();
- newIconInfo.fIcon = iconInfo.fIcon;
- newIconInfo.hbmMask = newHmask;
- newIconInfo.hbmColor = newHbmp;
- /* Create the new icon */
- handle = OS.CreateIconIndirect(newIconInfo);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* Free bitmaps */
- OS.DeleteObject(newHbmp);
- OS.DeleteObject(newHmask);
- if (iconInfo.hbmColor != 0)
- OS.DeleteObject(iconInfo.hbmColor);
- OS.DeleteObject(iconInfo.hbmMask);
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- }
- if (device.tracking) device.new_Object(this);
- return;
- }
- case SWT.IMAGE_GRAY: {
- Rectangle r = srcImage.getBounds();
- ImageData data = srcImage.getImageData();
- PaletteData palette = data.palette;
- ImageData newData = data;
- if (!palette.isDirect) {
- /* Convert the palette entries to gray. */
- RGB [] rgbs = palette.getRGBs();
- for (int i=0; i<rgbs.length; i++) {
- if (data.transparentPixel != i) {
- RGB color = rgbs [i];
- int red = color.red;
- int green = color.green;
- int blue = color.blue;
- int intensity = (red+red+green+green+green+green+green+blue) >> 3;
- color.red = color.green = color.blue = intensity;
- }
- }
- newData.palette = new PaletteData(rgbs);
- } else {
- /* Create a 8 bit depth image data with a gray palette. */
- RGB[] rgbs = new RGB[256];
- for (int i=0; i<rgbs.length; i++) {
- rgbs[i] = new RGB(i, i, i);
- }
- newData = new ImageData(r.width, r.height, 8, new PaletteData(rgbs));
- newData.maskData = data.maskData;
- newData.maskPad = data.maskPad;
-
- /* Convert the pixels. */
- int[] scanline = new int[r.width];
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- int redShift = palette.redShift;
- int greenShift = palette.greenShift;
- int blueShift = palette.blueShift;
- for (int y=0; y<r.height; y++) {
- int offset = y * newData.bytesPerLine;
- data.getPixels(0, y, r.width, scanline, 0);
- for (int x=0; x<r.width; x++) {
- int pixel = scanline[x];
- int red = pixel & redMask;
- red = (redShift < 0) ? red >>> -redShift : red << redShift;
- int green = pixel & greenMask;
- green = (greenShift < 0) ? green >>> -greenShift : green << greenShift;
- int blue = pixel & blueMask;
- blue = (blueShift < 0) ? blue >>> -blueShift : blue << blueShift;
- newData.data[offset++] =
- (byte)((red+red+green+green+green+green+green+blue) >> 3);
- }
- }
- }
- init (device, newData);
- if (device.tracking) device.new_Object(this);
- return;
- }
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-}
-
-/**
- * Constructs an empty instance of this class with the
- * width and height of the specified rectangle. The result
- * may be drawn upon by creating a GC and using any of its
- * drawing operations, as shown in the following example:
- * <pre>
- * Image i = new Image(device, boundsRectangle);
- * GC gc = new GC(i);
- * gc.drawRectangle(0, 0, 50, 50);
- * gc.dispose();
- * </pre>
- *
- * @param device the device on which to create the image
- * @param bounds a rectangle specifying the image's width and height (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
- * </ul>
- */
-public Image(Device device, Rectangle bounds) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, bounds.width, bounds.height);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class from the given
- * <code>ImageData</code>.
- *
- * @param device the device on which to create the image
- * @param data the image data to create the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
- * </ul>
- */
-public Image(Device device, ImageData data) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, data);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class, whose type is
- * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
- * objects. The two images must be the same size, and the mask image
- * must have a color depth of 1. Pixel transparency in either image
- * will be ignored. If either image is an icon to begin with, an
- * exception is thrown.
- * <p>
- * The mask image should contain white wherever the icon is to be visible,
- * and black wherever the icon is to be transparent. In addition,
- * the source image should contain black wherever the icon is to be
- * transparent.
- * </p>
- *
- * @param device the device on which to create the icon
- * @param source the color data for the icon
- * @param mask the mask data for the icon
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
- * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
- * if the mask is not monochrome, or if either the source or mask
- * is already an icon</li>
- * </ul>
- */
-public Image(Device device, ImageData source, ImageData mask) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (source.width != mask.width || source.height != mask.height) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (mask.depth != 1) {
- /*
- * Feature in Windows. 1-bit DIB sections are buggy on Win98, so we
- * create 4-bit DIBs when given a 1-bit ImageData. In order to allow
- * users to draw on the masks, we must also support 4-bit masks in
- * icon creation by converting them into 1-bit masks.
- */
- if (mask.depth != 4) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- PaletteData palette = new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255,255,255)});
- ImageData tempMask = new ImageData(mask.width, mask.height, 1, palette);
- /* Find index of black in mask palette */
- RGB[] rgbs = mask.getRGBs();
- int blackIndex = 0;
- while (blackIndex < rgbs.length) {
- if (rgbs[blackIndex].equals(palette.colors[0])) break;
- blackIndex++;
- }
- if (blackIndex == rgbs.length) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int[] pixels = new int[mask.width];
- for (int y = 0; y < mask.height; y++) {
- mask.getPixels(0, y, mask.width, pixels, 0);
- for (int i = 0; i < pixels.length; i++) {
- if (pixels[i] == blackIndex) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
- }
- }
- tempMask.setPixels(0, y, mask.width, pixels, 0);
- }
- mask = tempMask;
- }
- /* Create a temporary image and locate the black pixel */
- ImageData image;
- int blackIndex = 0;
- if (source.palette.isDirect) {
- image = new ImageData(source.width, source.height, source.depth, source.palette);
- } else {
- RGB black = new RGB(0, 0, 0);
- RGB[] rgbs = source.getRGBs();
- if (source.transparentPixel != -1) {
- /*
- * The source had transparency, so we can use the transparent pixel
- * for black.
- */
- RGB[] newRGBs = new RGB[rgbs.length];
- System.arraycopy(rgbs, 0, newRGBs, 0, rgbs.length);
- if (source.transparentPixel >= newRGBs.length) {
- /* Grow the palette with black */
- rgbs = new RGB[source.transparentPixel + 1];
- System.arraycopy(newRGBs, 0, rgbs, 0, newRGBs.length);
- for (int i = newRGBs.length; i <= source.transparentPixel; i++) {
- rgbs[i] = new RGB(0, 0, 0);
- }
- } else {
- newRGBs[source.transparentPixel] = black;
- rgbs = newRGBs;
- }
- blackIndex = source.transparentPixel;
- image = new ImageData(source.width, source.height, source.depth, new PaletteData(rgbs));
- } else {
- while (blackIndex < rgbs.length) {
- if (rgbs[blackIndex].equals(black)) break;
- blackIndex++;
- }
- if (blackIndex == rgbs.length) {
- /*
- * We didn't find black in the palette, and there is no transparent
- * pixel we can use.
- */
- if ((1 << source.depth) > rgbs.length) {
- /* We can grow the palette and add black */
- RGB[] newRGBs = new RGB[rgbs.length + 1];
- System.arraycopy(rgbs, 0, newRGBs, 0, rgbs.length);
- newRGBs[rgbs.length] = black;
- rgbs = newRGBs;
- } else {
- /* No room to grow the palette */
- blackIndex = -1;
- }
- }
- image = new ImageData(source.width, source.height, source.depth, new PaletteData(rgbs));
- }
- }
- if (blackIndex == -1) {
- /* There was no black in the palette, so just copy the data over */
- System.arraycopy(source.data, 0, image.data, 0, image.data.length);
- } else {
- /* Modify the source image to contain black wherever the mask is 0 */
- int[] imagePixels = new int[image.width];
- int[] maskPixels = new int[mask.width];
- for (int y = 0; y < image.height; y++) {
- source.getPixels(0, y, image.width, imagePixels, 0);
- mask.getPixels(0, y, mask.width, maskPixels, 0);
- for (int i = 0; i < imagePixels.length; i++) {
- if (maskPixels[i] == 0) imagePixels[i] = blackIndex;
- }
- image.setPixels(0, y, source.width, imagePixels, 0);
- }
- }
- /*
- * Make sure the mask is padded properly. Windows requires icon masks
- * to have a scanline pad of 2.
- */
- int bytesPerLine = (((mask.width + 7) / 8) + 1) / 2 * 2;
- byte[] newMaskData = new byte[bytesPerLine * mask.height];
- ImageData newMask = new ImageData(mask.width, mask.height, 1, mask.palette, 2, newMaskData);
- int[] maskPixels = new int[mask.width];
- for (int y = 0; y < mask.height; y++) {
- mask.getPixels(0, y, mask.width, maskPixels, 0);
- newMask.setPixels(0, y, newMask.width, maskPixels, 0);
- }
- /* Set the fields and create the icon */
- image.maskPad = newMask.scanlinePad;
- image.maskData = newMask.data;
- init(device, image);
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the specified input stream. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p><p>
- * This constructor may be used to load a resource as follows:
- * </p>
- * <pre>
- * new Image(device, clazz.getResourceAsStream("file.gif"));
- * </pre>
- *
- * @param device the device on which to create the image
- * @param stream the input stream to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image (Device device, InputStream stream) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new ImageData(stream));
- if (device.tracking) device.new_Object(this);
-}
-
-/**
- * Constructs an instance of this class by loading its representation
- * from the file with the specified name. Throws an error if an error
- * occurs while loading the image, or if the result is an image
- * of an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading
- * a single image only. If the specified file contains
- * multiple images, only the first one will be used.
- *
- * @param device the device on which to create the image
- * @param filename the name of the file to load the image from
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * </ul>
- */
-public Image (Device device, String filename) {
- if (device == null) device = Device.getDevice();
- if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- init(device, new ImageData(filename));
- if (device.tracking) device.new_Object(this);
-}
-
-/* Create a DIB from a DDB without using GetDIBits */
-int createDIBFromDDB(int hDC, int hBitmap, int width, int height) {
-
- /* Determine the DDB depth */
- byte[] bmi;
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- int depth = bits * planes;
-
- /* Determine the DIB palette */
- boolean isDirect = depth > 8;
- RGB[] rgbs = null;
- if (!isDirect) {
- int numColors = 1 << depth;
- byte[] logPalette = new byte[4 * numColors];
- OS.GetPaletteEntries(device.hPalette, 0, numColors, logPalette);
- rgbs = new RGB[numColors];
- for (int i = 0; i < numColors; i++) {
- rgbs[i] = new RGB(logPalette[i] & 0xFF, logPalette[i + 1] & 0xFF, logPalette[i + 2] & 0xFF);
- }
- }
-
- int biClrUsed = 0;
- boolean useBitfields = OS.IsWinCE && (depth == 16 || depth == 32);
- if (isDirect) bmi = new byte[40 + (useBitfields ? 12 : 0)];
- else bmi = new byte[40 + rgbs.length * 4];
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = 0; bmi[2] = 0; bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(width & 0xFF);
- bmi[5] = (byte)((width >> 8) & 0xFF);
- bmi[6] = (byte)((width >> 16) & 0xFF);
- bmi[7] = (byte)((width >> 24) & 0xFF);
- /* LONG biHeight = height */
- int height2 = -height;
- bmi[8] = (byte)(height2 & 0xFF);
- bmi[9] = (byte)((height2 >> 8) & 0xFF);
- bmi[10] = (byte)((height2 >> 16) & 0xFF);
- bmi[11] = (byte)((height2 >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = depth */
- bmi[14] = (byte)(depth & 0xFF);
- bmi[15] = (byte)((depth >> 8) & 0xFF);
- if (useBitfields) {
- /* DWORD biCompression = BI_BITFIELDS = 3 */
- bmi[16] = 3; bmi[17] = bmi[18] = bmi[19] = 0;
- } else {
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- }
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed */
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
- /* Set the rgb colors into the bitmap info */
- int offset = 40;
- if (isDirect) {
- if (useBitfields) {
- int redMask = 0;
- int greenMask = 0;
- int blueMask = 0;
- switch (depth) {
- case 16:
- redMask = 0x7C00;
- greenMask = 0x3E0;
- blueMask = 0x1F;
- break;
- case 24:
- redMask = 0xFF;
- greenMask = 0xFF00;
- blueMask = 0xFF0000;
- break;
- case 32:
- redMask = 0xFF00;
- greenMask = 0xFF0000;
- blueMask = 0xFF000000;
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- bmi[40] = (byte)((redMask & 0xFF) >> 0);
- bmi[41] = (byte)((redMask & 0xFF00) >> 8);
- bmi[42] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[43] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[44] = (byte)((greenMask & 0xFF) >> 0);
- bmi[45] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[46] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[47] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[48] = (byte)((blueMask & 0xFF) >> 0);
- bmi[49] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[50] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[51] = (byte)((blueMask & 0xFF000000) >> 24);
- }
- } else {
- for (int j = 0; j < rgbs.length; j++) {
- bmi[offset] = (byte)rgbs[j].blue;
- bmi[offset + 1] = (byte)rgbs[j].green;
- bmi[offset + 2] = (byte)rgbs[j].red;
- bmi[offset + 3] = 0;
- offset += 4;
- }
- }
- int[] pBits = new int[1];
- int hDib = OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
- if (hDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* Bitblt DDB into DIB */
- int hdcSource = OS.CreateCompatibleDC(hDC);
- int hdcDest = OS.CreateCompatibleDC(hDC);
- int hOldSrc = OS.SelectObject(hdcSource, hBitmap);
- int hOldDest = OS.SelectObject(hdcDest, hDib);
- OS.BitBlt(hdcDest, 0, 0, width, height, hdcSource, 0, 0, OS.SRCCOPY);
- OS.SelectObject(hdcSource, hOldSrc);
- OS.SelectObject(hdcDest, hOldDest);
- OS.DeleteDC(hdcSource);
- OS.DeleteDC(hdcDest);
-
- return hDib;
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the image. Applications must dispose of all images which
- * they allocate.
- */
-public void dispose () {
- if (handle == 0) return;
- if (type == SWT.ICON) {
- OS.DestroyIcon (handle);
- } else {
- OS.DeleteObject (handle);
- }
- handle = 0;
- memGC = null;
- if (device.tracking) device.dispose_Object(this);
- device = null;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof Image)) return false;
- Image image = (Image) object;
- return device == image.device && handle == image.handle;
-}
-
-/**
- * Returns the color to which to map the transparent pixel, or null if
- * the receiver has no transparent pixel.
- * <p>
- * There are certain uses of Images that do not support transparency
- * (for example, setting an image into a button or label). In these cases,
- * it may be desired to simulate transparency by using the background
- * color of the widget to paint the transparent pixels of the image.
- * Use this method to check which color will be used in these cases
- * in place of transparency. This value may be set with setBackground().
- * <p>
- *
- * @return the background color of the image, or null if there is no transparency in the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public Color getBackground() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (transparentPixel == -1) return null;
-
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Compute the background color */
- BITMAP bm = new BITMAP();
- OS.GetObject(handle, BITMAP.sizeof, bm);
- int hdcMem = OS.CreateCompatibleDC(hDC);
- int hOldObject = OS.SelectObject(hdcMem, handle);
- int red = 0, green = 0, blue = 0;
- if (bm.bmBitsPixel <= 8) {
- if (OS.IsWinCE) {
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- pBits[0] = (byte)((transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(hdcMem, 0, 0);
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- blue = (color & 0xFF0000) >> 16;
- green = (color & 0xFF00) >> 8;
- red = color & 0xFF;
- } else {
- byte[] color = new byte[4];
- int numColors = OS.GetDIBColorTable(hdcMem, transparentPixel, 1, color);
- blue = color[0] & 0xFF;
- green = color[1] & 0xFF;
- red = color[2] & 0xFF;
- }
- } else {
- switch (bm.bmBitsPixel) {
- case 16:
- blue = (transparentPixel & 0x1F) << 3;
- green = (transparentPixel & 0x3E0) >> 2;
- red = (transparentPixel & 0x7C00) >> 7;
- break;
- case 24:
- blue = (transparentPixel & 0xFF0000) >> 16;
- green = (transparentPixel & 0xFF00) >> 8;
- red = transparentPixel & 0xFF;
- break;
- case 32:
- blue = (transparentPixel & 0xFF000000) >>> 24;
- green = (transparentPixel & 0xFF0000) >> 16;
- red = (transparentPixel & 0xFF00) >> 8;
- break;
- default:
- return null;
- }
- }
- OS.SelectObject(hdcMem, hOldObject);
- OS.DeleteDC(hdcMem);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
- return Color.win32_new(device, 0x02000000 | (blue << 16) | (green << 8) | red);
-}
-
-/**
- * Returns the bounds of the receiver. The rectangle will always
- * have x and y values of 0, and the width and height of the
- * image.
- *
- * @return a rectangle specifying the image's bounds
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- */
-public Rectangle getBounds() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- switch (type) {
- case SWT.BITMAP:
- BITMAP bm = new BITMAP();
- OS.GetObject(handle, BITMAP.sizeof, bm);
- return new Rectangle(0, 0, bm.bmWidth, bm.bmHeight);
- case SWT.ICON:
- if (OS.IsWinCE) {
- int width = OS.GetSystemMetrics (OS.SM_CXICON);
- int height = OS.GetSystemMetrics (OS.SM_CYICON);
- return new Rectangle(0, 0, width, height);
- } else {
- ICONINFO info = new ICONINFO();
- OS.GetIconInfo(handle, info);
- int hBitmap = info.hbmColor;
- if (hBitmap == 0) hBitmap = info.hbmMask;
- bm = new BITMAP();
- OS.GetObject(hBitmap, BITMAP.sizeof, bm);
- if (hBitmap == info.hbmMask) bm.bmHeight /= 2;
- if (info.hbmColor != 0) OS.DeleteObject(info.hbmColor);
- if (info.hbmMask != 0) OS.DeleteObject(info.hbmMask);
- return new Rectangle(0, 0, bm.bmWidth, bm.bmHeight);
- }
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- return null;
- }
-}
-
-/**
- * Returns an <code>ImageData</code> based on the receiver
- * Modifications made to this <code>ImageData</code> will not
- * affect the Image.
- *
- * @return an <code>ImageData</code> containing the image's data and attributes
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
- * </ul>
- *
- * @see ImageData
- */
-public ImageData getImageData() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- BITMAP bm;
- int depth, width, height;
- switch (type) {
- case SWT.ICON: {
- ICONINFO info = new ICONINFO();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetIconInfo(handle, info);
- /* Get the basic BITMAP information */
- int hBitmap = info.hbmColor;
- if (hBitmap == 0) hBitmap = info.hbmMask;
- bm = new BITMAP();
- OS.GetObject(hBitmap, BITMAP.sizeof, bm);
- depth = bm.bmPlanes * bm.bmBitsPixel;
- width = bm.bmWidth;
- if (hBitmap == info.hbmMask) bm.bmHeight /= 2;
- height = bm.bmHeight;
- int numColors = 0;
- if (depth <= 8) numColors = 1 << depth;
- /* Create the BITMAPINFO */
- byte[] bmi = new byte[40 + numColors * 4];
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = bmi[2] = bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(width & 0xFF);
- bmi[5] = (byte)((width >> 8) & 0xFF);
- bmi[6] = (byte)((width >> 16) & 0xFF);
- bmi[7] = (byte)((width >> 24) & 0xFF);
- /* LONG biHeight = height */
- bmi[8] = (byte)(-height & 0xFF);
- bmi[9] = (byte)((-height >> 8) & 0xFF);
- bmi[10] = (byte)((-height >> 16) & 0xFF);
- bmi[11] = (byte)((-height >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = bm.bmPlanes * bm.bmBitsPixel */
- bmi[14] = (byte)(depth & 0xFF);
- bmi[15] = (byte)((depth >> 8) & 0xFF);
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed = 0 */
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
-
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Create the DC and select the bitmap */
- int hBitmapDC = OS.CreateCompatibleDC(hDC);
- int hOldBitmap = OS.SelectObject(hBitmapDC, hBitmap);
- /* Select the palette if necessary */
- int oldPalette = 0;
- if (depth <= 8) {
- int hPalette = device.hPalette;
- if (hPalette != 0) {
- oldPalette = OS.SelectPalette(hBitmapDC, hPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- }
- /* Find the size of the image and allocate data */
- int imageSize;
- /* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, hBitmap, 0, height, 0, bmi, OS.DIB_RGB_COLORS);
- imageSize = (bmi[20] & 0xFF) | ((bmi[21] & 0xFF) << 8) | ((bmi[22] & 0xFF) << 16) | ((bmi[23] & 0xFF) << 24);
- byte[] data = new byte[imageSize];
- /* Get the bitmap data */
- int hHeap = OS.GetProcessHeap();
- int lpvBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, hBitmap, 0, height, lpvBits, bmi, OS.DIB_RGB_COLORS);
- OS.MoveMemory(data, lpvBits, imageSize);
- /* Calculate the palette */
- PaletteData palette = null;
- if (depth <= 8) {
- RGB[] rgbs = new RGB[numColors];
- int srcIndex = 40;
- for (int i = 0; i < numColors; i++) {
- rgbs[i] = new RGB(bmi[srcIndex + 2] & 0xFF, bmi[srcIndex + 1] & 0xFF, bmi[srcIndex] & 0xFF);
- srcIndex += 4;
- }
- palette = new PaletteData(rgbs);
- } else if (depth == 16) {
- palette = new PaletteData(0x7C00, 0x3E0, 0x1F);
- } else if (depth == 24) {
- palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
- } else if (depth == 32) {
- palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
- } else {
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
-
- /* Do the mask */
- byte [] maskData = null;
- if (info.hbmColor == 0) {
- /* Do the bottom half of the mask */
- maskData = new byte[imageSize];
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, hBitmap, height, height, lpvBits, bmi, OS.DIB_RGB_COLORS);
- OS.MoveMemory(maskData, lpvBits, imageSize);
- } else {
- /* Do the entire mask */
- /* Create the BITMAPINFO */
- bmi = new byte[48];
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = bmi[2] = bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(width & 0xFF);
- bmi[5] = (byte)((width >> 8) & 0xFF);
- bmi[6] = (byte)((width >> 16) & 0xFF);
- bmi[7] = (byte)((width >> 24) & 0xFF);
- /* LONG biHeight = height */
- bmi[8] = (byte)(-height & 0xFF);
- bmi[9] = (byte)((-height >> 8) & 0xFF);
- bmi[10] = (byte)((-height >> 16) & 0xFF);
- bmi[11] = (byte)((-height >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = 1 */
- bmi[14] = 1;
- bmi[15] = 0;
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed = 0 */
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
- /* First color black */
- bmi[40] = bmi[41] = bmi[42] = bmi[43] = 0;
- /* Second color white */
- bmi[44] = bmi[45] = bmi[46] = (byte)0xFF;
- bmi[47] = 0;
- OS.SelectObject(hBitmapDC, info.hbmMask);
- /* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, 0, bmi, OS.DIB_RGB_COLORS);
- imageSize = (bmi[20] & 0xFF) | ((bmi[21] & 0xFF) << 8) | ((bmi[22] & 0xFF) << 16) | ((bmi[23] & 0xFF) << 24);
- maskData = new byte[imageSize];
- int lpvMaskBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, lpvMaskBits, bmi, OS.DIB_RGB_COLORS);
- OS.MoveMemory(maskData, lpvMaskBits, imageSize);
- OS.HeapFree(hHeap, 0, lpvMaskBits);
- /* Loop to invert the mask */
- for (int i = 0; i < maskData.length; i++) {
- maskData[i] ^= -1;
- }
- /* Make sure mask scanlinePad is 2 */
- int desiredScanline = (width + 7) / 8;
- desiredScanline = desiredScanline + (desiredScanline % 2);
- int realScanline = imageSize / height;
- if (realScanline != desiredScanline) {
- byte[] newData = new byte[desiredScanline * height];
- int srcIndex = 0;
- int destIndex = 0;
- for (int i = 0; i < height; i++) {
- System.arraycopy(maskData, srcIndex, newData, destIndex, desiredScanline);
- destIndex += desiredScanline;
- srcIndex += realScanline;
- }
- maskData = newData;
- }
- }
- /* Clean up */
- OS.HeapFree(hHeap, 0, lpvBits);
- OS.SelectObject(hBitmapDC, hOldBitmap);
- if (oldPalette != 0) {
- OS.SelectPalette(hBitmapDC, oldPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- OS.DeleteDC(hBitmapDC);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
- if (info.hbmColor != 0) OS.DeleteObject(info.hbmColor);
- if (info.hbmMask != 0) OS.DeleteObject(info.hbmMask);
- /* Construct and return the ImageData */
- ImageData imageData = new ImageData(width, height, depth, palette, 4, data);
- imageData.maskData = maskData;
-// imageData.maskPad = 4;
- imageData.maskPad = 2;
- return imageData;
- }
- case SWT.BITMAP: {
- /* Get the basic BITMAP information */
- bm = new BITMAP();
- OS.GetObject(handle, BITMAP.sizeof, bm);
- depth = bm.bmPlanes * bm.bmBitsPixel;
- width = bm.bmWidth;
- height = bm.bmHeight;
- /* Find out whether this is a DIB or a DDB. */
- boolean isDib = (bm.bmBits != 0);
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /*
- * Feature in WinCE. GetDIBits is not available in WinCE. The
- * workaround is to create a temporary DIB from the DDB and use
- * the bmBits field of DIBSECTION to retrieve the image data.
- */
- int handle = this.handle;
- if (OS.IsWinCE) {
- if (!isDib) {
- handle = createDIBFromDDB(hDC, handle, width, height);
- isDib = true;
- }
- }
- DIBSECTION dib = null;
- if (isDib) {
- dib = new DIBSECTION();
- OS.GetObject(handle, DIBSECTION.sizeof, dib);
- }
- /* Calculate number of colors */
- int numColors = 0;
- if (depth <= 8) {
- if (isDib) {
- numColors = dib.biClrUsed;
- } else {
- numColors = 1 << depth;
- }
- }
- /* Create the BITMAPINFO */
- byte[] bmi = null;
- if (!isDib) {
- bmi = new byte[40 + numColors * 4];
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = bmi[2] = bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(width & 0xFF);
- bmi[5] = (byte)((width >> 8) & 0xFF);
- bmi[6] = (byte)((width >> 16) & 0xFF);
- bmi[7] = (byte)((width >> 24) & 0xFF);
- /* LONG biHeight = height */
- bmi[8] = (byte)(-height & 0xFF);
- bmi[9] = (byte)((-height >> 8) & 0xFF);
- bmi[10] = (byte)((-height >> 16) & 0xFF);
- bmi[11] = (byte)((-height >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = bm.bmPlanes * bm.bmBitsPixel */
- bmi[14] = (byte)(depth & 0xFF);
- bmi[15] = (byte)((depth >> 8) & 0xFF);
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed = 0 */
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
- }
-
- /* Create the DC and select the bitmap */
- int hBitmapDC = OS.CreateCompatibleDC(hDC);
- int hOldBitmap = OS.SelectObject(hBitmapDC, handle);
- /* Select the palette if necessary */
- int oldPalette = 0;
- if (!isDib && depth <= 8) {
- int hPalette = device.hPalette;
- if (hPalette != 0) {
- oldPalette = OS.SelectPalette(hBitmapDC, hPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- }
- /* Find the size of the image and allocate data */
- int imageSize;
- if (isDib) {
- imageSize = dib.biSizeImage;
- } else {
- /* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, handle, 0, height, 0, bmi, OS.DIB_RGB_COLORS);
- imageSize = (bmi[20] & 0xFF) | ((bmi[21] & 0xFF) << 8) | ((bmi[22] & 0xFF) << 16) | ((bmi[23] & 0xFF) << 24);
- }
- byte[] data = new byte[imageSize];
- /* Get the bitmap data */
- if (isDib) {
- if (OS.IsWinCE && this.handle != handle) {
- /* get image data from the temporary DIB */
- OS.MoveMemory(data, dib.bmBits, imageSize);
- } else {
- OS.MoveMemory(data, bm.bmBits, imageSize);
- }
- } else {
- int hHeap = OS.GetProcessHeap();
- int lpvBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.GetDIBits(hBitmapDC, handle, 0, height, lpvBits, bmi, OS.DIB_RGB_COLORS);
- OS.MoveMemory(data, lpvBits, imageSize);
- OS.HeapFree(hHeap, 0, lpvBits);
- }
- /* Calculate the palette */
- PaletteData palette = null;
- if (isDib) {
- if (depth <= 8) {
- RGB[] rgbs = new RGB[numColors];
- if (OS.IsWinCE) {
- /*
- * Feature on WinCE. GetDIBColorTable is not supported.
- * The workaround is to set a pixel to the desired
- * palette index and use getPixel to get the corresponding
- * RGB value.
- */
- int red = 0, green = 0, blue = 0;
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- for (int i = 0; i < numColors; i++) {
- pBits[0] = (byte)((i << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(hBitmapDC, 0, 0);
- blue = (color & 0xFF0000) >> 16;
- green = (color & 0xFF00) >> 8;
- red = color & 0xFF;
- rgbs[i] = new RGB(red, green, blue);
- }
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- } else {
- byte[] colors = new byte[numColors * 4];
- OS.GetDIBColorTable(hBitmapDC, 0, numColors, colors);
- int colorIndex = 0;
- for (int i = 0; i < rgbs.length; i++) {
- rgbs[i] = new RGB(colors[colorIndex + 2] & 0xFF, colors[colorIndex + 1] & 0xFF, colors[colorIndex] & 0xFF);
- colorIndex += 4;
- }
- }
- palette = new PaletteData(rgbs);
- } else if (depth == 16) {
- palette = new PaletteData(0x7C00, 0x3E0, 0x1F);
- } else if (depth == 24 || depth == 32) {
- palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
- } else {
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- } else {
- if (depth <= 8) {
- RGB[] rgbs = new RGB[numColors];
- int srcIndex = 40;
- for (int i = 0; i < numColors; i++) {
- rgbs[i] = new RGB(bmi[srcIndex + 2] & 0xFF, bmi[srcIndex + 1] & 0xFF, bmi[srcIndex] & 0xFF);
- srcIndex += 4;
- }
- palette = new PaletteData(rgbs);
- } else if (depth == 16) {
- palette = new PaletteData(0x7C00, 0x3E0, 0x1F);
- } else if (depth == 24) {
- palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
- } else if (depth == 32) {
- palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
- } else {
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- }
- /* Clean up */
- OS.SelectObject(hBitmapDC, hOldBitmap);
- if (oldPalette != 0) {
- OS.SelectPalette(hBitmapDC, oldPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- if (OS.IsWinCE) {
- if (handle != this.handle) {
- /* free temporary DIB */
- OS.DeleteObject (handle);
- }
- }
- OS.DeleteDC(hBitmapDC);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
- /* Construct and return the ImageData */
- ImageData imageData = new ImageData(width, height, depth, palette, 4, data);
- imageData.transparentPixel = this.transparentPixel;
- imageData.alpha = alpha;
- if (alpha == -1 && alphaData != null) {
- imageData.alphaData = new byte[alphaData.length];
- System.arraycopy(alphaData, 0, imageData.alphaData, 0, alphaData.length);
- }
- return imageData;
- }
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- return null;
- }
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-void init(Device device, int width, int height) {
- if (width <= 0 || height <= 0) {
- SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- }
- this.device = device;
- type = SWT.BITMAP;
-
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Fill the bitmap with the current background color */
- handle = OS.CreateCompatibleBitmap(hDC, width, height);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int memDC = OS.CreateCompatibleDC(hDC);
- int hOldBitmap = OS.SelectObject(memDC, handle);
- OS.PatBlt(memDC, 0, 0, width, height, OS.PATCOPY);
- OS.SelectObject(memDC, hOldBitmap);
- OS.DeleteDC(memDC);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-}
-
-void init(Device device, ImageData i) {
- if (i == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- /*
- * BUG in Windows 98:
- * A monochrome DIBSection will display as solid black
- * on Windows 98 machines, even though it contains the
- * correct data. The fix is to convert 1-bit ImageData
- * into 4-bit ImageData before creating the image.
- */
- /* Windows does not support 2-bit images. Convert to 4-bit image. */
- if ((i.depth == 1 && i.getTransparencyType() != SWT.TRANSPARENCY_MASK) || i.depth == 2) {
- ImageData img = new ImageData(i.width, i.height, 4, i.palette);
- ImageData.blit(ImageData.BLIT_SRC,
- i.data, i.depth, i.bytesPerLine, i.getByteOrder(), 0, 0, i.width, i.height, null, null, null,
- ImageData.ALPHA_OPAQUE, null, 0,
- img.data, img.depth, img.bytesPerLine, i.getByteOrder(), 0, 0, img.width, img.height, null, null, null,
- false, false);
- img.transparentPixel = i.transparentPixel;
- img.maskPad = i.maskPad;
- img.maskData = i.maskData;
- img.alpha = i.alpha;
- img.alphaData = i.alphaData;
- i = img;
- }
- /*
- * Windows supports 16-bit mask of (0x7C00, 0x3E0, 0x1F),
- * 24-bit mask of (0xFF0000, 0xFF00, 0xFF) and 32-bit mask
- * (0xFF000000, 0xFF0000, 0xFF00). Make sure the image is
- * Windows-supported.
- */
- if (i.palette.isDirect) {
- final PaletteData palette = i.palette;
- final int redMask = palette.redMask;
- final int greenMask = palette.greenMask;
- final int blueMask = palette.blueMask;
- int newDepth = i.depth;
- int newOrder = ImageData.MSB_FIRST;
- PaletteData newPalette = null;
-
- switch (i.depth) {
- case 8:
- newDepth = 16;
- newOrder = ImageData.LSB_FIRST;
- newPalette = new PaletteData(0x7C00, 0x3E0, 0x1F);
- break;
- case 16:
- newOrder = ImageData.LSB_FIRST;
- if (!(redMask == 0x7C00 && greenMask == 0x3E0 && blueMask == 0x1F)) {
- newPalette = new PaletteData(0x7C00, 0x3E0, 0x1F);
- }
- break;
- case 24:
- if (!(redMask == 0xFF && greenMask == 0xFF00 && blueMask == 0xFF0000)) {
- newPalette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
- }
- break;
- case 32:
- if (!(redMask == 0xFF && greenMask == 0xFF00 && blueMask == 0xFF0000)) {
- newPalette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
- }
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- if (newPalette != null) {
- ImageData img = new ImageData(i.width, i.height, newDepth, newPalette);
- ImageData.blit(ImageData.BLIT_SRC,
- i.data, i.depth, i.bytesPerLine, i.getByteOrder(), 0, 0, i.width, i.height, redMask, greenMask, blueMask,
- ImageData.ALPHA_OPAQUE, null, 0,
- img.data, img.depth, img.bytesPerLine, newOrder, 0, 0, img.width, img.height, newPalette.redMask, newPalette.greenMask, newPalette.blueMask,
- false, false);
- if (i.transparentPixel != -1) {
- img.transparentPixel = newPalette.getPixel(palette.getRGB(i.transparentPixel));
- }
- img.maskPad = i.maskPad;
- img.maskData = i.maskData;
- img.alpha = i.alpha;
- img.alphaData = i.alphaData;
- i = img;
- }
- }
- /* Construct bitmap info header by hand */
- RGB[] rgbs = i.palette.getRGBs();
- byte[] bmi;
- boolean useBitfields = OS.IsWinCE && (i.depth == 16 || i.depth == 32);
- if (i.palette.isDirect)
- bmi = new byte[40 + (useBitfields ? 12 : 0)];
- else
- bmi = new byte[40 + rgbs.length * 4];
- /* DWORD biSize = 40 */
- bmi[0] = 40; bmi[1] = 0; bmi[2] = 0; bmi[3] = 0;
- /* LONG biWidth = width */
- bmi[4] = (byte)(i.width & 0xFF);
- bmi[5] = (byte)((i.width >> 8) & 0xFF);
- bmi[6] = (byte)((i.width >> 16) & 0xFF);
- bmi[7] = (byte)((i.width >> 24) & 0xFF);
- /* LONG biHeight = height */
- int height = -i.height;
- bmi[8] = (byte)(height & 0xFF);
- bmi[9] = (byte)((height >> 8) & 0xFF);
- bmi[10] = (byte)((height >> 16) & 0xFF);
- bmi[11] = (byte)((height >> 24) & 0xFF);
- /* WORD biPlanes = 1 */
- bmi[12] = 1;
- bmi[13] = 0;
- /* WORD biBitCount = depth */
- bmi[14] = (byte)(i.depth & 0xFF);
- bmi[15] = (byte)((i.depth >> 8) & 0xFF);
- if (useBitfields) {
- /* DWORD biCompression = BI_BITFIELDS = 3 */
- bmi[16] = 3; bmi[17] = bmi[18] = bmi[19] = 0;
- } else {
- /* DWORD biCompression = BI_RGB = 0 */
- bmi[16] = bmi[17] = bmi[18] = bmi[19] = 0;
- }
- /* DWORD biSizeImage = 0 (default) */
- bmi[20] = bmi[21] = bmi[22] = bmi[23] = 0;
- /* LONG biXPelsPerMeter = 0 */
- bmi[24] = bmi[25] = bmi[26] = bmi[27] = 0;
- /* LONG biYPelsPerMeter = 0 */
- bmi[28] = bmi[29] = bmi[30] = bmi[31] = 0;
- /* DWORD biClrUsed */
- if (rgbs == null) {
- bmi[32] = bmi[33] = bmi[34] = bmi[35] = 0;
- } else {
- bmi[32] = (byte)(rgbs.length & 0xFF);
- bmi[33] = (byte)((rgbs.length >> 8) & 0xFF);
- bmi[34] = (byte)((rgbs.length >> 16) & 0xFF);
- bmi[35] = (byte)((rgbs.length >> 24) & 0xFF);
- }
- /* DWORD biClrImportant = 0 */
- bmi[36] = bmi[37] = bmi[38] = bmi[39] = 0;
- /* Set the rgb colors into the bitmap info */
- int offset = 40;
- if (i.palette.isDirect) {
- if (useBitfields) {
- PaletteData palette = i.palette;
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- bmi[40] = (byte)((redMask & 0xFF) >> 0);
- bmi[41] = (byte)((redMask & 0xFF00) >> 8);
- bmi[42] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[43] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[44] = (byte)((greenMask & 0xFF) >> 0);
- bmi[45] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[46] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[47] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[48] = (byte)((blueMask & 0xFF) >> 0);
- bmi[49] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[50] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[51] = (byte)((blueMask & 0xFF000000) >> 24);
- }
- } else {
- for (int j = 0; j < rgbs.length; j++) {
- bmi[offset] = (byte)rgbs[j].blue;
- bmi[offset + 1] = (byte)rgbs[j].green;
- bmi[offset + 2] = (byte)rgbs[j].red;
- bmi[offset + 3] = 0;
- offset += 4;
- }
- }
- int[] pBits = new int[1];
- int hDib = OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
- if (hDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- /* In case of a scanline pad other than 4, do the work to convert it */
- byte[] data = i.data;
- if (i.scanlinePad != 4 && (i.bytesPerLine % 4 != 0)) {
- int newBpl = i.bytesPerLine + (4 - (i.bytesPerLine % 4));
- byte[] newData = new byte[i.height * newBpl];
- int srcPtr = 0;
- int destPtr = 0;
- for (int y = 0; y < i.height; y++) {
- System.arraycopy(data, srcPtr, newData, destPtr, i.bytesPerLine);
- srcPtr += i.bytesPerLine;
- destPtr += newBpl;
- }
- data = newData;
- }
- OS.MoveMemory(pBits[0], data, data.length);
- if (i.getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Create the color bitmap */
- int hdcSrc = OS.CreateCompatibleDC(hDC);
- OS.SelectObject(hdcSrc, hDib);
- int hBitmap = OS.CreateCompatibleBitmap(hDC, i.width, i.height);
- if (hBitmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- int hdcDest = OS.CreateCompatibleDC(hDC);
- OS.SelectObject(hdcDest, hBitmap);
- OS.BitBlt(hdcDest, 0, 0, i.width, i.height, hdcSrc, 0, 0, OS.SRCCOPY);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
- /* Create the mask */
-// int hHeap = OS.GetProcessHeap();
-// int bmBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, i.maskData.length);
-// OS.MoveMemory(bmBits, i.maskData, i.maskData.length);
-// BITMAP bm = new BITMAP();
-// bm.bmWidth = i.width;
-// bm.bmHeight = i.height;
-// bm.bmWidthBytes = (((i.width + 7) / 8) + 3) / 4 * 4;
-// bm.bmPlanes = 1;
-// bm.bmBitsPixel = 1;
-// bm.bmBits = bmBits;
-// int hMask = OS.CreateBitmapIndirect(bm);
-// OS.HeapFree(hHeap, 0, bmBits);
- int hMask = OS.CreateBitmap(i.width, i.height, 1, 1, i.maskData);
- if (hMask == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.SelectObject(hdcSrc, hMask);
- OS.PatBlt(hdcSrc, 0, 0, i.width, i.height, OS.DSTINVERT);
- OS.DeleteDC(hdcSrc);
- OS.DeleteDC(hdcDest);
-
- /* Create the icon */
- ICONINFO info = new ICONINFO();
- info.fIcon = true;
- info.hbmColor = hBitmap;
- info.hbmMask = hMask;
- int hIcon = OS.CreateIconIndirect(info);
- if (hIcon == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.DeleteObject(hBitmap);
- OS.DeleteObject(hMask);
- OS.DeleteObject(hDib);
- this.handle = hIcon;
- this.type = SWT.ICON;
- } else {
- this.handle = hDib;
- this.type = SWT.BITMAP;
- this.transparentPixel = i.transparentPixel;
- if (this.transparentPixel == -1) {
- this.alpha = i.alpha;
- if (i.alpha == -1 && i.alphaData != null) {
- this.alphaData = new byte[i.alphaData.length];
- System.arraycopy(i.alphaData, 0, this.alphaData, 0, alphaData.length);
- }
- }
- }
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- /*
- * Create a new GC that can draw into the image.
- * Only supported for bitmaps.
- */
- if (type != SWT.BITMAP || memGC != null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- /* Create a compatible HDC for the device */
- int hDC = device.internal_new_GC(null);
- int imageDC = OS.CreateCompatibleDC(hDC);
- device.internal_dispose_GC(hDC, null);
- if (imageDC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- if (data != null) {
- /* Set the GCData fields */
- data.device = device;
- data.image = this;
- data.hFont = device.systemFont;
- }
- return imageDC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int hDC, GCData data) {
- OS.DeleteDC(hDC);
-}
-
-/**
- * Returns <code>true</code> if the image has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the image.
- * When an image has been disposed, it is an error to
- * invoke any other method using the image.
- *
- * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Sets the color to which to map the transparent pixel.
- * <p>
- * There are certain uses of <code>Images</code> that do not support
- * transparency (for example, setting an image into a button or label).
- * In these cases, it may be desired to simulate transparency by using
- * the background color of the widget to paint the transparent pixels
- * of the image. This method specifies the color that will be used in
- * these cases. For example:
- * <pre>
- * Button b = new Button();
- * image.setBackground(b.getBackground());>
- * b.setImage(image);
- * </pre>
- * </p><p>
- * The image may be modified by this operation (in effect, the
- * transparent regions may be filled with the supplied color). Hence
- * this operation is not reversible and it is not legal to call
- * this function twice or with a null argument.
- * </p><p>
- * This method has no effect if the receiver does not have a transparent
- * pixel value.
- * </p>
- *
- * @param color the color to use when a transparent pixel is specified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void setBackground(Color color) {
- /*
- * Note. Not implemented on WinCE.
- */
- if (OS.IsWinCE) return;
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (transparentPixel == -1) return;
-
- /* Get the HDC for the device */
- int hDC = device.internal_new_GC(null);
-
- /* Change the background color in the image */
- BITMAP bm = new BITMAP();
- OS.GetObject(handle, BITMAP.sizeof, bm);
- int hdcMem = OS.CreateCompatibleDC(hDC);
- OS.SelectObject(hdcMem, handle);
- int maxColors = 1 << bm.bmBitsPixel;
- byte[] colors = new byte[maxColors * 4];
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- int numColors = OS.GetDIBColorTable(hdcMem, 0, maxColors, colors);
- int offset = transparentPixel * 4;
- colors[offset] = (byte)color.getBlue();
- colors[offset + 1] = (byte)color.getGreen();
- colors[offset + 2] = (byte)color.getRed();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- OS.SetDIBColorTable(hdcMem, 0, numColors, colors);
- OS.DeleteDC(hdcMem);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return "Image {" + handle + "}";
-}
-
-/**
- * Invokes platform specific functionality to allocate a new image.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param device the device on which to allocate the color
- * @param type the type of the image (<code>SWT.BITMAP</code> or <code>SWT.ICON</code>)
- * @param handle the OS handle for the image
- * @param hPalette the OS handle for the palette, or 0
- *
- * @private
- */
-public static Image win32_new(Device device, int type, int handle) {
- if (device == null) device = Device.getDevice();
- Image image = new Image();
- image.type = type;
- image.handle = handle;
- image.device = device;
- return image;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
deleted file mode 100755
index bf9e192b23..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package org.eclipse.swt.graphics;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-
-/**
- * Instances of this class represent areas of an x-y coordinate
- * system that are aggregates of the areas covered by a number
- * of rectangles.
- * <p>
- * Application code must explicitly invoke the <code>Region.dispose()</code>
- * method to release the operating system resources managed by each instance
- * when those instances are no longer required.
- * </p>
- */
-
-public final class Region {
-
- /**
- * the OS resource for the region
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
-/**
- * Constructs a new empty region.
- */
-public Region () {
- handle = OS.CreateRectRgn (0, 0, 0, 0);
-}
-
-/**
- * Constructs a new region given a handle to the operating
- * system resources that it should represent.
- *
- * @param handle the handle for the result
- */
-Region(int handle) {
- this.handle = handle;
-}
-
-/**
- * Adds the given rectangle to the collection of rectangles
- * the receiver maintains to describe its area.
- *
- * @param rect the rectangle to merge with the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Rectangle rect) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- int rectRgn = OS.CreateRectRgn (rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
- OS.CombineRgn (handle, handle, rectRgn, OS.RGN_OR);
- OS.DeleteObject (rectRgn);
-}
-
-/**
- * Adds all of the rectangles which make up the area covered
- * by the argument to the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @param region the region to merge
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public void add (Region region) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.CombineRgn (handle, handle, region.handle, OS.RGN_OR);
-}
-
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (int x, int y) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return OS.PtInRegion (handle, x, y);
-}
-
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver, and <code>false</code>
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean contains (Point pt) {
- if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the region. Applications must dispose of all regions which
- * they allocate.
- */
-public void dispose () {
- if (handle != 0) OS.DeleteObject (handle);
- handle = 0;
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode
- */
-public boolean equals (Object object) {
- if (this == object) return true;
- if (!(object instanceof Region)) return false;
- Region rgn = (Region)object;
- return handle == rgn.handle;
-}
-
-/**
- * Returns a rectangle which represents the rectangular
- * union of the collection of rectangles the receiver
- * maintains to describe its area.
- *
- * @return a bounding rectangle for the region
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#union
- */
-public Rectangle getBounds() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- RECT rect = new RECT();
- OS.GetRgnBox(handle, rect);
- return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public int hashCode () {
- return handle;
-}
-
-/**
- * Returns <code>true</code> if the rectangle described by the
- * arguments intersects with any of the rectangles the receiver
- * mainains to describe its area, and <code>false</code> otherwise.
- *
- * @param x the x coordinate of the origin of the rectangle
- * @param y the y coordinate of the origin of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (int x, int y, int width, int height) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- RECT r = new RECT ();
- OS.SetRect (r, x, y, x + width, y + height);
- return OS.RectInRegion (handle, r);
-}
-
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with any of the rectangles the receiver mainains to describe
- * its area and <code>false</code> otherwise.
- *
- * @param rect the rectangle to test for intersection
- * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- *
- * @see Rectangle#intersects
- */
-public boolean intersects (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * Returns <code>true</code> if the region has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the region.
- * When a region has been disposed, it is an error to
- * invoke any other method using the region.
- *
- * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
- */
-public boolean isDisposed() {
- return handle == 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- *
- * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
- * </ul>
- */
-public boolean isEmpty () {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- RECT rect = new RECT ();
- int result = OS.GetRgnBox (handle, rect);
- if (result == OS.NULLREGION) return true;
- return ((rect.right - rect.left) <= 0) || ((rect.bottom - rect.top) <= 0);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new region.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Region</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the handle for the region
- *
- * @private
- */
-public static Region win32_new(int handle) {
- return new Region(handle);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return "Region {" + handle + "}";
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java
deleted file mode 100644
index 3ee7ba148b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java
+++ /dev/null
@@ -1,458 +0,0 @@
-package org.eclipse.swt.internal;
-/*
- * (c) Copyright IBM Corp. 2001, 2002.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.internal.win32.GCP_RESULTS;
-import org.eclipse.swt.internal.win32.OS;
-import org.eclipse.swt.internal.win32.RECT;
-import org.eclipse.swt.internal.win32.TCHAR;
-import java.util.Hashtable;
-/*
- * Wraps Win32 API used to bidi enable the StyledText widget.
- */
-public class BidiUtil {
-
- // Keyboard language ids
- public static final int KEYBOARD_LATIN = 0;
- public static final int KEYBOARD_HEBREW = 1;
- public static final int KEYBOARD_ARABIC = 2;
-
- // getRenderInfo flag values
- public static final int CLASSIN = 1;
- public static final int LINKBEFORE = 2;
- public static final int LINKAFTER = 4;
-
- // variables used for providing a listener mechanism for keyboard language
- // switching
- static Hashtable map = new Hashtable ();
- static Hashtable oldProcMap = new Hashtable ();
- static Callback callback = new Callback (BidiUtil.class, "windowProc", 4);
-
- // GetCharacterPlacement constants
- static final int GCP_REORDER = 0x0002;
- static final int GCP_GLYPHSHAPE = 0x0010;
- static final int GCP_LIGATE = 0x0020;
- static final int GCP_CLASSIN = 0x00080000;
- static final byte GCPCLASS_ARABIC = 2;
- static final byte GCPCLASS_HEBREW = 2;
- static final byte GCPCLASS_LOCALNUMBER = 4;
- static final int GCPGLYPH_LINKBEFORE = 0x8000;
- static final int GCPGLYPH_LINKAFTER = 0x4000;
- // ExtTextOut constants
- static final int ETO_GLYPH_INDEX = 0x0010;
- // Windows primary language identifiers
- static final int LANG_ARABIC = 0x01;
- static final int LANG_HEBREW = 0x0d;
- // ActivateKeyboard constants
- static final int HKL_NEXT = 1;
- static final int HKL_PREV = 0;
-
- /*
- * Public character class constants are the same as Windows
- * platform constants.
- * Saves conversion of class array in getRenderInfo to arbitrary
- * constants for now.
- */
- public static final int CLASS_HEBREW = GCPCLASS_ARABIC;
- public static final int CLASS_ARABIC = GCPCLASS_HEBREW;
- public static final int CLASS_LOCALNUMBER = GCPCLASS_LOCALNUMBER;
- public static final int REORDER = GCP_REORDER;
- public static final int LIGATE = GCP_LIGATE;
- public static final int GLYPHSHAPE = GCP_GLYPHSHAPE;
-
-/**
- * Adds a language listener. The listener will get notified when the language of
- * the keyboard changes (via Alt-Shift on Win platforms). Do this by creating a
- * window proc for the Control so that the window messages for the Control can be
- * monitored.
- * <p>
- *
- * @param int the handle of the Control that is listening for keyboard language
- * changes
- * @param runnable the code that should be executed when a keyboard language change
- * occurs
- */
-public static void addLanguageListener (int hwnd, Runnable runnable) {
- map.put (new Integer (hwnd), runnable);
- int oldProc = OS.GetWindowLong (hwnd, OS.GWL_WNDPROC);
- oldProcMap.put (new Integer(hwnd), new Integer(oldProc));
- OS.SetWindowLong (hwnd, OS.GWL_WNDPROC, callback.getAddress ());
-}
-/**
- * Wraps the ExtTextOut function.
- * <p>
- *
- * @param gc the gc to use for rendering
- * @param renderBuffer the glyphs to render as an array of characters
- * @param renderDx the width of each glyph in renderBuffer
- * @param x x position to start rendering
- * @param y y position to start rendering
- */
-public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) {
- RECT rect = null;
- OS.ExtTextOutW(gc.handle, x, y, ETO_GLYPH_INDEX, rect, renderBuffer, renderBuffer.length, renderDx);
-}
-/**
- * Return ordering and rendering information for the given text. Wraps the GetFontLanguageInfo
- * and GetCharacterPlacement functions.
- * <p>
- *
- * @param gc the GC to use for measuring of this line, input parameter
- * @param text text that bidi data should be calculated for, input parameter
- * @param order an array of integers representing the visual position of each character in
- * the text array, output parameter
- * @param classBuffer an array of integers representing the type (e.g., ARABIC, HEBREW,
- * LOCALNUMBER) of each character in the text array, input/output parameter
- * @param dx an array of integers representing the pixel width of each glyph in the returned
- * glyph buffer, output paramteter
- * @param flags an integer representing rendering flag information, input parameter
- * @param offsets text segments that should be measured and reordered separately, input
- * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details.
- * @return buffer with the glyphs that should be rendered for the given text
- */
-public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) {
- int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle);
- int hHeap = OS.GetProcessHeap();
- int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(gc.handle);
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
- TCHAR textBuffer = new TCHAR(lpCs[1], text, false);
- int byteCount = textBuffer.length();
- boolean linkBefore = (flags & LINKBEFORE) == LINKBEFORE;
- boolean linkAfter = (flags & LINKAFTER) == LINKAFTER;
-
- GCP_RESULTS result = new GCP_RESULTS();
- result.lStructSize = GCP_RESULTS.sizeof;
- result.nGlyphs = byteCount;
- int lpOrder = result.lpOrder = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 4);
- int lpDx = result.lpDx = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 4);
- int lpClass = result.lpClass = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- int lpGlyphs = result.lpGlyphs = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 2);
-
- // set required dwFlags
- int dwFlags = 0;
- int glyphFlags = 0;
- if (((fontLanguageInfo & GCP_REORDER) == GCP_REORDER)) {
- dwFlags |= GCP_REORDER;
- }
- if ((fontLanguageInfo & GCP_LIGATE) == GCP_LIGATE) {
- dwFlags |= GCP_LIGATE;
- glyphFlags |= 0;
- }
- if ((fontLanguageInfo & GCP_GLYPHSHAPE) == GCP_GLYPHSHAPE) {
- dwFlags |= GCP_GLYPHSHAPE;
- if (linkBefore) {
- glyphFlags |= GCPGLYPH_LINKBEFORE;
- }
- if (linkAfter) {
- glyphFlags |= GCPGLYPH_LINKAFTER;
- }
- }
- byte[] lpGlyphs2;
- if (linkBefore || linkAfter) {
- lpGlyphs2 = new byte[2];
- lpGlyphs2[0]=(byte)glyphFlags;
- lpGlyphs2[1]=(byte)(glyphFlags >> 8);
- }
- else {
- lpGlyphs2 = new byte[] {(byte) glyphFlags};
- }
- OS.MoveMemory(result.lpGlyphs, lpGlyphs2, lpGlyphs2.length);
-
- if ((flags & CLASSIN) == CLASSIN) {
- // set classification values for the substring
- dwFlags |= GCP_CLASSIN;
- OS.MoveMemory(result.lpClass, classBuffer, classBuffer.length);
- }
-
- char[] glyphBuffer = new char[result.nGlyphs];
- int glyphCount = 0;
- for (int i=0; i<offsets.length-1; i++) {
- int offset = offsets [i];
- int length = offsets [i+1] - offsets [i];
-
- // The number of glyphs expected is <= length (segment length);
- // the actual number returned may be less in case of Arabic ligatures.
- result.nGlyphs = length;
- TCHAR textBuffer2 = new TCHAR(lpCs[1], text.substring(offset, offset + length), false);
- OS.GetCharacterPlacement(gc.handle, textBuffer2, textBuffer2.length(), 0, result, dwFlags);
-
- if (dx != null) {
- int [] dx2 = new int [result.nGlyphs];
- OS.MoveMemory(dx2, result.lpDx, dx2.length * 4);
- System.arraycopy (dx2, 0, dx, glyphCount, dx2.length);
- }
- if (order != null) {
- int [] order2 = new int [length];
- OS.MoveMemory(order2, result.lpOrder, order2.length * 4);
- for (int j=0; j<length; j++) {
- order2 [j] += glyphCount;
- }
- System.arraycopy (order2, 0, order, offset, length);
- }
- if (classBuffer != null) {
- byte [] classBuffer2 = new byte [length];
- OS.MoveMemory(classBuffer2, result.lpClass, classBuffer2.length);
- System.arraycopy (classBuffer2, 0, classBuffer, offset, length);
- }
- char[] glyphBuffer2 = new char[result.nGlyphs];
- OS.MoveMemory(glyphBuffer2, result.lpGlyphs, glyphBuffer2.length * 2);
- System.arraycopy (glyphBuffer2, 0, glyphBuffer, glyphCount, glyphBuffer2.length);
- glyphCount += glyphBuffer2.length;
-
- // We concatenate successive results of calls to GCP.
- // For Arabic, it is the only good method since the number of output
- // glyphs might be less than the number of input characters.
- // This assumes that the whole line is built by successive adjacent
- // segments without overlapping.
- result.lpOrder += length * 4;
- result.lpDx += length * 4;
- result.lpClass += length;
- result.lpGlyphs += glyphBuffer2.length * 2;
- }
-
- /* Free the memory that was allocated. */
- OS.HeapFree(hHeap, 0, lpGlyphs);
- OS.HeapFree(hHeap, 0, lpClass);
- OS.HeapFree(hHeap, 0, lpDx);
- OS.HeapFree(hHeap, 0, lpOrder);
- return glyphBuffer;
-}
-/**
- * Return bidi ordering information for the given text. Does not return rendering
- * information (e.g., glyphs, glyph distances). Use this method when you only need
- * ordering information. Doing so will improve performance. Wraps the
- * GetFontLanguageInfo and GetCharacterPlacement functions.
- * <p>
- *
- * @param gc the GC to use for measuring of this line, input parameter
- * @param text text that bidi data should be calculated for, input parameter
- * @param order an array of integers representing the visual position of each character in
- * the text array, output parameter
- * @param classBuffer an array of integers representing the type (e.g., ARABIC, HEBREW,
- * LOCALNUMBER) of each character in the text array, input/output parameter
- * @param flags an integer representing rendering flag information, input parameter
- * @param offsets text segments that should be measured and reordered separately, input
- * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details.
- */
-public static void getOrderInfo(GC gc, String text, int[] order, byte[] classBuffer, int flags, int [] offsets) {
- int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle);
- int hHeap = OS.GetProcessHeap();
- int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(gc.handle);
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
- TCHAR textBuffer = new TCHAR(lpCs[1], text, false);
- int byteCount = textBuffer.length();
-
- GCP_RESULTS result = new GCP_RESULTS();
- result.lStructSize = GCP_RESULTS.sizeof;
- result.nGlyphs = byteCount;
- int lpOrder = result.lpOrder = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 4);
- int lpClass = result.lpClass = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-
- // set required dwFlags, these values will affect how the text gets rendered and
- // ordered
- int dwFlags = 0;
- if (((fontLanguageInfo & GCP_REORDER) == GCP_REORDER)) {
- dwFlags |= GCP_REORDER;
- }
- if ((fontLanguageInfo & GCP_LIGATE) == GCP_LIGATE) {
- dwFlags |= GCP_LIGATE;
- }
- if ((fontLanguageInfo & GCP_GLYPHSHAPE) == GCP_GLYPHSHAPE) {
- dwFlags |= GCP_GLYPHSHAPE;
- }
- if ((flags & CLASSIN) == CLASSIN) {
- // set classification values for the substring, classification values
- // can be specified on input
- dwFlags |= GCP_CLASSIN;
- OS.MoveMemory(result.lpClass, classBuffer, classBuffer.length);
- }
-
- int glyphCount = 0;
- for (int i=0; i<offsets.length-1; i++) {
- int offset = offsets [i];
- int length = offsets [i+1] - offsets [i];
- // The number of glyphs expected is <= length (segment length);
- // the actual number returned may be less in case of Arabic ligatures.
- result.nGlyphs = length;
- TCHAR textBuffer2 = new TCHAR(lpCs[1], text.substring(offset, offset + length), false);
- OS.GetCharacterPlacement(gc.handle, textBuffer2, textBuffer2.length(), 0, result, dwFlags);
-
- if (order != null) {
- int [] order2 = new int [length];
- OS.MoveMemory(order2, result.lpOrder, order2.length * 4);
- for (int j=0; j<length; j++) {
- order2 [j] += glyphCount;
- }
- System.arraycopy (order2, 0, order, offset, length);
- }
- if (classBuffer != null) {
- byte [] classBuffer2 = new byte [length];
- OS.MoveMemory(classBuffer2, result.lpClass, classBuffer2.length);
- System.arraycopy (classBuffer2, 0, classBuffer, offset, length);
- }
- glyphCount += result.nGlyphs;
-
- // We concatenate successive results of calls to GCP.
- // For Arabic, it is the only good method since the number of output
- // glyphs might be less than the number of input characters.
- // This assumes that the whole line is built by successive adjacent
- // segments without overlapping.
- result.lpOrder += length * 4;
- result.lpClass += length;
- }
-
- /* Free the memory that was allocated. */
- OS.HeapFree(hHeap, 0, lpClass);
- OS.HeapFree(hHeap, 0, lpOrder);
-}
-/**
- * Return bidi attribute information for the font in the specified gc.
- * <p>
- *
- * @param gc the gc to query
- * @return bitwise OR of the REORDER, LIGATE and GLYPHSHAPE flags
- * defined by this class.
- */
-public static int getFontBidiAttributes(GC gc) {
- int fontStyle = 0;
- int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle);
- if (((fontLanguageInfo & GCP_REORDER) != 0)) {
- fontStyle |= REORDER;
- }
- if (((fontLanguageInfo & GCP_LIGATE) != 0)) {
- fontStyle |= LIGATE;
- }
- if (((fontLanguageInfo & GCP_GLYPHSHAPE) != 0)) {
- fontStyle |= GLYPHSHAPE;
- }
- return fontStyle;
-}
-/**
- * Return the active keyboard language.
- * <p>
- *
- * @return an integer representing the active keyboard language (KEYBOARD_HEBREW,
- * KEYBOARD_ARABIC, KEYBOARD_LATIN)
- */
-public static int getKeyboardLanguage() {
- int layout = OS.GetKeyboardLayout(0);
- // only interested in low 2 bytes, which is the primary
- // language identifier
- layout = layout & 0x000000FF;
- if (layout == LANG_HEBREW) return KEYBOARD_HEBREW;
- if (layout == LANG_ARABIC) return KEYBOARD_ARABIC;
- // return LATIN for all non-bidi languages
- return KEYBOARD_LATIN;
-}
-/**
- * Return the languages that are installed for the keyboard.
- * <p>
- *
- * @return integer array with an entry for each installed language
- */
-static int[] getKeyboardLanguageList() {
- int maxSize = 10;
- int[] tempList = new int[maxSize];
- int size = OS.GetKeyboardLayoutList(maxSize, tempList);
- int[] list = new int[size];
- System.arraycopy(tempList, 0, list, 0, size);
- return list;
-}
-/**
- * Return whether or not the platform supports a bidi language. Determine this
- * by looking at the languages that are installed for the keyboard.
- * <p>
- *
- * @return true if bidi is supported, false otherwise. Always
- * false on Windows CE.
- */
-public static boolean isBidiPlatform() {
- if (OS.IsWinCE) return false;
- int[] languages = getKeyboardLanguageList();
- for (int i=0; i<languages.length; i++) {
- int language = languages[i] & 0x000000FF;;
- if ((language == LANG_ARABIC) || (language == LANG_HEBREW)) {
- return true;
- }
- }
- return false;
-}
-/**
- * Removes the specified language listener.
- * <p>
- *
- * @param hwnd the handle of the Control that is listening for keyboard language changes
- */
-public static void removeLanguageListener (int hwnd) {
- map.remove (new Integer (hwnd));
- Integer proc = (Integer)oldProcMap.remove (new Integer (hwnd));
- OS.SetWindowLong (hwnd, OS.GWL_WNDPROC, proc.intValue());
-}
-/**
- * Switch the keyboard language to the specified language.
- * <p>
- *
- * @param language integer representing language. One of
- * KEYBOARD_HEBREW, KEYBOARD_ARABIC, KEYBOARD_LATIN.
- */
-public static void setKeyboardLanguage(int language) {
- // don't switch the keyboard if it doesn't need to be
- if (language == getKeyboardLanguage()) return;
-
- boolean isBidiLang = (language == KEYBOARD_HEBREW) || (language == KEYBOARD_ARABIC);
- // get the corresponding WIN language id for the
- // language
- if (isBidiLang) {
- int langId;
- if (language == KEYBOARD_HEBREW) langId = LANG_HEBREW;
- else langId = LANG_ARABIC;
- // get the list of active languages
- int[] list = getKeyboardLanguageList();
- // set to first language of the given type
- for (int i=0; i<list.length; i++) {
- int id = list[i] & 0x000000FF;
- if (id == langId) {
- OS.ActivateKeyboardLayout(list[i], 0);
- return;
- }
- }
- } else {
- // set to the first "Latin" language (anything not
- // hebrew or arabic)
- int[] list = getKeyboardLanguageList();
- for (int i=0; i<list.length; i++) {
- int id = list[i] & 0x000000FF;
- if ((id != LANG_HEBREW) && (id != LANG_ARABIC)) {
- OS.ActivateKeyboardLayout(list[i], 0);
- return;
- }
- }
- }
-
-}
-/**
- * Window proc to intercept keyboard language switch event (WS_INPUTLANGCHANGE).
- * Run the Control's registered runnable when the keyboard language is switched.
- *
- * @param hwnd handle of the control that is listening for the keyboard language
- * change event
- * @param msg window message
- */
-static int windowProc (int hwnd, int msg, int wParam, int lParam) {
- switch (msg) {
- case 0x51 /*OS.WM_INPUTLANGCHANGE*/:
- Runnable runnable = (Runnable) map.get (new Integer (hwnd));
- if (runnable != null) runnable.run ();
- break;
- }
- Integer oldProc = (Integer)oldProcMap.get(new Integer(hwnd));
- return OS.CallWindowProc (oldProc.intValue(), hwnd, msg, wParam, lParam);
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java
deleted file mode 100755
index df0dee396f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package org.eclipse.swt.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * This class implements the conversions between unicode characters
- * and the <em>platform supported</em> representation for characters.
- * <p>
- * Note that, unicode characters which can not be found in the platform
- * encoding will be converted to an arbitrary platform specific character.
- * </p>
- *
- * @deprecated
- */
-
-public final class Converter {
-
- static final byte [] NULL_BYTE_ARRAY = new byte [1];
- static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
- static final char [] EMPTY_CHAR_ARRAY = new char [0];
-
- static int CodePage;
- static {
- CodePage = OS.GetACP ();
- }
-
-/**
- * Returns the default code page for the platform where the
- * application is currently running.
- *
- * @return the default code page
- */
-public static int defaultCodePage () {
- return CodePage;
-}
-
-/**
- * Converts an array of bytes representing the platform's encoding,
- * in the given code page, of some character data into an array of
- * matching unicode characters.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of bytes to be converted
- * @return the unicode conversion
- */
-public static char [] mbcsToWcs (int codePage, byte [] buffer) {
-
- /* Check for the simple cases */
- if (codePage < 0 || buffer == null) {
- return EMPTY_CHAR_ARRAY;
- }
- int length = buffer.length;
- if (length == 0) {
- return EMPTY_CHAR_ARRAY;
- }
-
- /*
- * Optimize for English ASCII encoding. If no conversion is
- * performed, it is safe to return any object that will also not
- * be converted if this routine is called again with the result.
- * This ensures that double conversion will not be performed
- * on the same bytes. Note that this relies on the fact that
- * lead bytes are never in the range 0..0x7F.
- */
- char [] lpWideCharStr = new char [length];
- for (int i=0; i<length; i++) {
- if ((buffer [i] & 0xFF) <= 0x7F) {
- lpWideCharStr [i] = (char) buffer [i]; // all bytes <= 0x7F, so no ((char) (buffer[i]&0xFF)) needed
- } else {
- /* Convert from DBCS to UNICODE */
- int cp = codePage != 0 ? codePage : CodePage;
- int cchWideChar = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, length, null, 0);
- if (cchWideChar == 0) return EMPTY_CHAR_ARRAY;
- lpWideCharStr = new char [cchWideChar];
- OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, length, lpWideCharStr, cchWideChar);
- return lpWideCharStr;
- }
- }
- return lpWideCharStr;
-}
-
-/**
- * Converts an array of chars (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of chars to be converted
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (int codePage, char [] buffer) {
- return wcsToMbcs (0, buffer, false);
-}
-
-/**
- * Converts an array of chars (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page. If the termination flag is true, the resulting
- * byte data will be null (zero) terminated.
- *
- * @param codePage the code page to use for conversion
- * @param buffer the array of chars to be converted
- * @param terminate <code>true</code> if the result should be null terminated and false otherwise.
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (int codePage, char [] buffer, boolean terminate) {
-
- /* Check for the simple cases */
- if (codePage < 0 || buffer == null) {
- return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- }
- int length = buffer.length;
- if (length == 0) {
- return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- }
-
- /*
- * Optimize for English ASCII encoding. This optimization
- * relies on the fact that lead bytes can never be in the
- * range 0..0x7F.
- */
- byte [] mbcs = new byte [(terminate) ? length + 1 : length];
- for (int i=0; i<length; i++) {
- if ((buffer [i] & 0xFFFF) <= 0x7F) {
- mbcs [i] = (byte) buffer [i];
- } else {
- /* Convert from UNICODE to DBCS */
- int cp = codePage != 0 ? codePage : CodePage;
- int cchMultiByte = OS.WideCharToMultiByte (cp, 0, buffer, length, null, 0, null, null);
- if (cchMultiByte == 0) return (terminate) ? NULL_BYTE_ARRAY : EMPTY_BYTE_ARRAY;
- byte [] lpMultiByteStr = new byte [(terminate) ? cchMultiByte + 1 : cchMultiByte];
- OS.WideCharToMultiByte (cp, 0, buffer, length, lpMultiByteStr, cchMultiByte, null, null);
- return lpMultiByteStr;
- }
- }
- return mbcs;
-}
-
-/**
- * Converts a String (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page.
- *
- * @param codePage the code page to use for conversion
- * @param string the string to be converted
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (int codePage, String string) {
- return wcsToMbcs (0, string, false);
-}
-
-/**
- * Converts a String (containing unicode data) to an array
- * of bytes representing the platform's encoding, of those characters
- * in the given code page. If the termination flag is true, the resulting
- * byte data will be null (zero) terminated.
- *
- * @param codePage the code page to use for conversion
- * @param string the string to be converted
- * @param terminate <code>true</code> if the result should be null terminated and false otherwise.
- * @return the platform encoding
- */
-public static byte [] wcsToMbcs (int codePage, String string, boolean terminate) {
- if (terminate) {
- if (string == null) return NULL_BYTE_ARRAY;
- int count = string.length ();
- char [] buffer = new char [count + 1];
- string.getChars (0, count, buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
- } else {
- if (string == null) return EMPTY_BYTE_ARRAY;
- int count = string.length ();
- char [] buffer = new char [count];
- string.getChars (0, count, buffer, 0);
- return wcsToMbcs (codePage, buffer, false);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
deleted file mode 100755
index 03edbad9c9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
+++ /dev/null
@@ -1,635 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object that
- * issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Button extends Control {
- Image image;
- static final int ButtonProc;
- static final TCHAR ButtonClass = new TCHAR (0,"BUTTON", true);
- static final int CheckWidth, CheckHeight;
- static {
- int hBitmap = OS.LoadBitmap (0, OS.OBM_CHECKBOXES);
- if (hBitmap == 0) {
- CheckWidth = OS.GetSystemMetrics (OS.IsWinCE ? OS.SM_CXSMICON : OS.SM_CXVSCROLL);
- CheckHeight = OS.GetSystemMetrics (OS.IsWinCE ? OS.SM_CYSMICON : OS.SM_CYVSCROLL);
- } else {
- BITMAP bitmap = new BITMAP ();
- OS.GetObject (hBitmap, BITMAP.sizeof, bitmap);
- OS.DeleteObject (hBitmap);
- CheckWidth = bitmap.bmWidth / 4;
- CheckHeight = bitmap.bmHeight / 3;
- }
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ButtonClass, lpWndClass);
- ButtonProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Button (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the control is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ButtonProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
- if ((style & SWT.PUSH) != 0) {
- return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
- }
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
- return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
- }
- if ((style & SWT.ARROW) != 0) {
- return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
- }
- return style;
-}
-
-void click () {
- OS.SendMessage (handle, OS.BM_CLICK, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.ARROW) != 0) {
- if ((style & (SWT.UP | SWT.DOWN)) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- height += OS.GetSystemMetrics (OS.SM_CYVSCROLL);
- } else {
- width += OS.GetSystemMetrics (OS.SM_CXHSCROLL);
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
- }
- int extra = 0;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & (OS.BS_BITMAP | OS.BS_ICON)) == 0) {
- int oldFont = 0;
- int hDC = OS.GetDC (handle);
- int newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- TEXTMETRIC lptm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, lptm);
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) {
- height += lptm.tmHeight;
- } else {
- extra = Math.max (8, lptm.tmAveCharWidth);
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, buffer.length ());
- RECT rect = new RECT ();
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE;
- OS.DrawText (hDC, buffer, length, rect, flags);
- width += rect.right - rect.left;
- height += rect.bottom - rect.top;
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- } else {
- if (image != null) {
- Rectangle rect = image.getBounds ();
- width = rect.width;
- height = rect.height;
- extra = 8;
- }
- }
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- width += CheckWidth + extra;
- height = Math.max (height, CheckHeight + 3);
- }
- if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) {
- width += 10; height += 7;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_BTNTEXT);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the alignment will indicate the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & SWT.UP) != 0) return SWT.UP;
- if ((style & SWT.DOWN) != 0) return SWT.DOWN;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.UP;
- }
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-boolean getDefault () {
- if ((style & SWT.PUSH) == 0) return false;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & OS.BS_DEFPUSHBUTTON) != 0;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed. If the receiver is of any other type,
- * this method returns false.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int state = OS.SendMessage (handle, OS.BM_GETCHECK, 0, 0);
- return (state & OS.BST_CHECKED) != 0;
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-boolean mnemonicHit (char ch) {
- if (!setFocus ()) return false;
- /*
- * Feature in Windows. When a radio button gets focus,
- * it selects the button in WM_SETFOCUS. Therefore, it
- * is not necessary to click the button or send events
- * because this has already happened in WM_SETFOCUS.
- */
- if ((style & SWT.RADIO) == 0) click ();
- return true;
-}
-
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-void selectRadio () {
- Control [] children = parent._getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (this != child && child instanceof Button) {
- Button button = (Button) child;
- if ((button.style & SWT.RADIO) != 0) {
- if (button.getSelection ()) {
- button.setSelection (false);
- button.postEvent (SWT.Selection);
- }
- }
- }
- }
- setSelection (true);
-}
-
-/**
- * Controls how text, images and arrows will be displayed
- * in the receiver. The argument should be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is an <code>ARROW</code> button, in
- * which case, the argument indicates the direction of
- * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
- * <code>UP</code> or <code>DOWN</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.ARROW) != 0) {
- if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
- style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
- OS.InvalidateRect (handle, null, true);
- return;
- }
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits &= ~(OS.BS_LEFT | OS.BS_CENTER | OS.BS_RIGHT);
- if ((style & SWT.LEFT) != 0) bits |= OS.BS_LEFT;
- if ((style & SWT.CENTER) != 0) bits |= OS.BS_CENTER;
- if ((style & SWT.RIGHT) != 0) bits |= OS.BS_RIGHT;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- OS.InvalidateRect (handle, null, true);
-}
-
-void setDefault (boolean value) {
- if ((style & SWT.PUSH) == 0) return;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits &= ~OS.BS_DEFPUSHBUTTON;
- if (value) bits |= OS.BS_DEFPUSHBUTTON;
- OS.SendMessage (handle, OS.BM_SETSTYLE, bits, 1);
-}
-
-public boolean setFocus () {
- checkWidget();
- if ((style & SWT.ARROW) != 0) return false;
- if (!super.setFocus ()) return false;
- menuShell ().setDefaultButton (this, false);
- return true;
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- int hImage = 0, imageBits = 0, fImageType = 0;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hImage = image.handle;
- switch (image.type) {
- case SWT.BITMAP:
- imageBits = OS.BS_BITMAP;
- fImageType = OS.IMAGE_BITMAP;
- break;
- case SWT.ICON:
- imageBits = OS.BS_ICON;
- fImageType = OS.IMAGE_ICON;
- break;
- default:
- return;
- }
- }
- this.image = image;
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int oldBits = newBits;
- newBits &= ~(OS.BS_BITMAP | OS.BS_ICON);
- newBits |= imageBits;
- if (newBits != oldBits) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- }
- OS.SendMessage (handle, OS.BM_SETIMAGE, fImageType, hImage);
-}
-boolean setRadioFocus () {
- if ((style & SWT.RADIO) == 0 || !getSelection ()) return false;
- return setFocus ();
-}
-
-/**
- * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
- * <code>RADIO</code>, or <code>TOGGLE</code>.
- *
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int flags = selected ? OS.BST_CHECKED : OS.BST_UNCHECKED;
-
- /*
- * Feature in Windows. When BM_SETCHECK is used
- * to set the checked state of a radio or check
- * button, it sets the WM_TABSTOP style. This
- * is undocumented and unwanted. The fix is
- * to save and restore the window style bits.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- OS.SendMessage (handle, OS.BM_SETCHECK, flags, 0);
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
-
- /*
- * Feature in Windows. When a radio button gets focus,
- * it selects the button in WM_SETFOCUS. If the previous
- * saved focus widget was a radio button, allowing the shell
- * to automatically restore the focus to the previous radio
- * button will unexpectedly check that button. The fix is
- * to set the saved focus widget for the shell to be the
- * radio button so that when focus is restored, the focus
- * widget will be the new radio button.
- */
- if (!selected) return;
- if ((style & SWT.RADIO) == 0) return;
- menuShell ().setSavedFocus (this);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the button label. The label may include
- * the mnemonic character but must not contain line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int oldBits = newBits;
- newBits &= ~(OS.BS_BITMAP | OS.BS_ICON);
- if (newBits != oldBits) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- }
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SetWindowText (handle, buffer);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.BS_NOTIFY;
- if ((style & SWT.FLAT) != 0) bits |= OS.BS_FLAT;
- if ((style & SWT.ARROW) != 0) return bits | OS.BS_OWNERDRAW;
- if ((style & SWT.LEFT) != 0) bits |= OS.BS_LEFT;
- if ((style & SWT.CENTER) != 0) bits |= OS.BS_CENTER;
- if ((style & SWT.RIGHT) != 0) bits |= OS.BS_RIGHT;
- if ((style & SWT.PUSH) != 0) return bits | OS.BS_PUSHBUTTON | OS.WS_TABSTOP;
- if ((style & SWT.CHECK) != 0) return bits | OS.BS_CHECKBOX;
- if ((style & SWT.RADIO) != 0) return bits | OS.BS_RADIOBUTTON;
- if ((style & SWT.TOGGLE) != 0) return bits | OS.BS_PUSHLIKE | OS.BS_CHECKBOX;
- return bits | OS.BS_PUSHBUTTON | OS.WS_TABSTOP;
-}
-
-TCHAR windowClass () {
- return ButtonClass;
-}
-
-int windowProc () {
- return ButtonProc;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.ARROW) != 0) {
- return new LRESULT (OS.DLGC_STATIC);
- }
- return result;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- /*
- * Feature in Windows. When Windows sets focus to
- * a radio button, it sets the WM_TABSTOP style.
- * This is undocumented and unwanted. The fix is
- * to save and restore the window style bits.
- */
- int bits = 0;
- if ((style & SWT.RADIO) != 0) {
- bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- }
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- if ((style & SWT.RADIO) != 0) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- }
- return result;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- int code = wParam >> 16;
- switch (code) {
- case OS.BN_CLICKED:
- case OS.BN_DOUBLECLICKED:
- if ((style & (SWT.CHECK | SWT.TOGGLE)) != 0) {
- setSelection (!getSelection ());
- } else {
- if ((style & SWT.RADIO) != 0) {
- if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) {
- selectRadio ();
- } else {
- setSelection (!getSelection ());
- }
- }
- }
- postEvent (SWT.Selection);
- }
- return super.wmCommandChild (wParam, lParam);
-}
-
-LRESULT wmDrawChild (int wParam, int lParam) {
- if ((style & SWT.ARROW) == 0) return super.wmDrawChild (wParam, lParam);
- DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
- int uState = OS.DFCS_SCROLLLEFT;
- switch (style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) {
- case SWT.UP: uState = OS.DFCS_SCROLLUP; break;
- case SWT.DOWN: uState = OS.DFCS_SCROLLDOWN; break;
- case SWT.LEFT: uState = OS.DFCS_SCROLLLEFT; break;
- case SWT.RIGHT: uState = OS.DFCS_SCROLLRIGHT; break;
- }
- if ((style & SWT.FLAT) == SWT.FLAT) uState |= OS.DFCS_FLAT;
- if (!OS.IsWindowEnabled (handle)) uState |= OS.DFCS_INACTIVE;
- if ((struct.itemState & OS.ODS_SELECTED) != 0) uState |= OS.DFCS_PUSHED;
- RECT rect = new RECT ();
- OS.SetRect (rect, struct.left, struct.top, struct.right, struct.bottom);
- OS.DrawFrameControl (struct.hDC, rect, OS.DFC_SCROLL, uState);
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
deleted file mode 100755
index cbf533a366..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide a surface for drawing
- * arbitrary graphics.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are <em>not</em> constructed
- * from aggregates of other controls. That is, they are either
- * painted using SWT graphics calls or are handled by native
- * methods.
- * </p>
- *
- * @see Composite
- */
-
-public class Canvas extends Composite {
- Caret caret;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Canvas () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-
-/*
-* Not currently used.
-*/
-void clearArea (int x, int y, int width, int height) {
- checkWidget ();
- if (OS.IsWindowVisible (handle)) return;
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- int hDC = OS.GetDCEx (handle, 0, OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS);
- drawBackground (hDC, rect);
- OS.ReleaseDC (handle, hDC);
-}
-
-/**
- * Returns the caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- *
- * @return the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Caret getCaret () {
- checkWidget ();
- return caret;
-}
-
-void releaseWidget () {
- if (caret != null) caret.releaseWidget ();
- caret = null;
- super.releaseWidget ();
-}
-
-/**
- * Scrolls a rectangular area of the receiver by first copying
- * the source area to the destination and then causing the area
- * of the source which is not covered by the destination to
- * be repainted. Children that intersect the rectangle are
- * optionally moved during the operation. In addition, outstanding
- * paint events are flushed before the source area is copied to
- * ensure that the contents of the canvas are drawn correctly.
- *
- * @param destX the x coordinate of the destination
- * @param destY the y coordinate of the destination
- * @param x the x coordinate of the source
- * @param y the y coordinate of the source
- * @param width the width of the area
- * @param height the height of the area
- * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- checkWidget ();
-
- /* Remove the caret so it won't get scrolled */
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
-
- /* Flush outstanding WM_PAINT's and scroll the window */
- if (OS.IsWinCE) {
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- int deltaX = destX - x, deltaY = destY - y;
- int flags = OS.SW_INVALIDATE | OS.SW_ERASE;
- if (all) flags |= OS.SW_SCROLLCHILDREN;
- OS.ScrollWindowEx (handle, deltaX, deltaY, rect, null, 0, null, flags);
-
- /* Restore the caret */
- if (isFocus) caret.setFocus ();
-}
-
-/**
- * Sets the receiver's caret.
- * <p>
- * The caret for the control is automatically hidden
- * and shown when the control is painted or resized,
- * when focus is gained or lost and when an the control
- * is scrolled. To avoid drawing on top of the caret,
- * the programmer must hide and show the caret when
- * drawing in the window any other time.
- * </p>
- * @param caret the new caret for the receiver, may be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCaret (Caret caret) {
- checkWidget ();
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (isFocusControl ()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) {
- if (newCaret.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- newCaret.setFocus ();
- }
- }
-}
-
-public void setFont (Font font) {
- checkWidget ();
- super.setFont (font);
- if (caret != null) caret.setFont (font);
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_KILLFOCUS (wParam, lParam);
- if (caret != null) caret.killFocus ();
- return result;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- if (caret != null) caret.setFocus ();
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
deleted file mode 100755
index 331822c78d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
+++ /dev/null
@@ -1,556 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an i-beam that is typically used
- * as the insertion point for text.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Caret extends Widget {
- Canvas parent;
- int x, y, width, height;
- boolean moved, resized;
- boolean isVisible;
- Image image;
- Font font;
- LOGFONT oldFont;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Caret (Canvas parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget ();
-}
-
-void createWidget () {
- isVisible = true;
- if (parent.getCaret () == null) {
- parent.setCaret (this);
- }
-}
-
-int defaultFont () {
- int hwnd = parent.handle;
- int hwndIME = OS.ImmGetDefaultIMEWnd (hwnd);
- if (hwndIME == 0) return parent.defaultFont ();
- int hFont = OS.SendMessage (hwndIME, OS.WM_GETFONT, 0, 0);
- if (hFont == 0) return parent.defaultFont ();
- return hFont;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Rectangle (x, y, rect.width, rect.height);
- }
- return new Rectangle (x, y, width, height);
-}
-
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget();
- if (font == null) {
- int hFont = defaultFont ();
- return Font.win32_new (getDisplay (), hFont);
- }
- return font;
-}
-
-/**
- * Returns the image that the receiver will use to paint the caret.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget();
- return image;
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget();
- return new Point (x, y);
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Canvas</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Canvas getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns a point describing the receiver's size.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- if (image != null) {
- Rectangle rect = image.getBounds ();
- return new Point (rect.width, rect.height);
- }
- return new Point (width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return isVisible;
-}
-
-boolean hasFocus () {
- return parent.handle == OS.GetFocus ();
-}
-
-boolean isFocusCaret () {
- return parent.caret == this && hasFocus ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return isVisible && parent.isVisible () && hasFocus ();
-}
-
-void killFocus () {
- OS.DestroyCaret ();
- if (font != null) restoreIMEFont ();
-}
-
-void move () {
- moved = false;
- if (!OS.SetCaretPos (x, y)) return;
- if (OS.IsDBLocale) {
- POINT ptCurrentPos = new POINT ();
- if (!OS.GetCaretPos (ptCurrentPos)) return;
- COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM ();
- lpCompForm.dwStyle = OS.CFS_POINT;
- lpCompForm.x = ptCurrentPos.x;
- lpCompForm.y = ptCurrentPos.y;
- int hwnd = parent.handle;
- int hIMC = OS.ImmGetContext (hwnd);
- OS.ImmSetCompositionWindow (hIMC, lpCompForm);
- OS.ImmReleaseContext (hwnd, hIMC);
- }
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (this == parent.getCaret ()) parent.setCaret (null);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
- image = null;
- font = null;
- oldFont = null;
-}
-
-void resize () {
- resized = false;
- int hwnd = parent.handle;
- OS.DestroyCaret ();
- int hBitmap = 0;
- if (image != null) hBitmap = image.handle;
- OS.CreateCaret (hwnd, hBitmap, width, height);
- OS.SetCaretPos (x, y);
- OS.ShowCaret (hwnd);
- move ();
-}
-
-void restoreIMEFont () {
- if (!OS.IsDBLocale) return;
- if (oldFont == null) return;
- int hwnd = parent.handle;
- int hIMC = OS.ImmGetContext (hwnd);
- OS.ImmSetCompositionFont (hIMC, oldFont);
- OS.ImmReleaseContext (hwnd, hIMC);
- oldFont = null;
-}
-
-void saveIMEFont () {
- if (!OS.IsDBLocale) return;
- if (oldFont != null) return;
- int hwnd = parent.handle;
- int hIMC = OS.ImmGetContext (hwnd);
- oldFont = new LOGFONT ();
- if (OS.ImmGetCompositionFont (hIMC, oldFont)) oldFont = null;
- OS.ImmReleaseContext (hwnd, hIMC);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- boolean samePosition = this.x == x && this.y == y;
- boolean sameExtent = this.width == width && this.height == height;
- if (samePosition && sameExtent) return;
- this.x = x; this.y = y;
- this.width = width; this.height = height;
- if (sameExtent) {
- moved = true;
- if (isVisible && hasFocus ()) move ();
- } else {
- resized = true;
- if (isVisible && hasFocus ()) resize ();
- }
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-
-void setFocus () {
- int hwnd = parent.handle;
- int hBitmap = 0;
- if (image != null) hBitmap = image.handle;
- OS.CreateCaret (hwnd, hBitmap, width, height);
- move ();
- if (font != null) {
- int hFont = font.handle;
- saveIMEFont ();
- setIMEFont (hFont);
- }
- if (isVisible) OS.ShowCaret (hwnd);
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget();
- if (font != null && font.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- this.font = font;
- if (isVisible && hasFocus ()) {
- int hFont = 0;
- if (font != null) hFont = font.handle;
- if (hFont == 0) hFont = defaultFont ();
- saveIMEFont ();
- setIMEFont (hFont);
- }
-}
-
-/**
- * Sets the image that the receiver will use to paint the caret
- * to the image specified by the argument, or to the default
- * which is a filled rectangle if the argument is null
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- this.image = image;
- if (isVisible && hasFocus ()) resize ();
-}
-
-void setIMEFont (int hFont) {
- if (!OS.IsDBLocale) return;
- LOGFONT logFont = new LOGFONT ();
- if (OS.GetObject (hFont, LOGFONT.sizeof, logFont) != 0) {
- int hwnd = parent.handle;
- int hIMC = OS.ImmGetContext (hwnd);
- OS.ImmSetCompositionFont (hIMC, logFont);
- OS.ImmReleaseContext (hwnd, hIMC);
- }
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget();
- if (this.x == x && this.y == y) return;
- this.x = x; this.y = y;
- moved = true;
- if (isVisible && hasFocus ()) move ();
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- checkWidget();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's size to the point specified by the arguments.
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget();
- if (this.width == width && this.height == height) return;
- this.width = width; this.height = height;
- resized = true;
- if (isVisible && hasFocus ()) resize ();
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- *
- * @param size the new extent for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- checkWidget();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- if (visible == isVisible) return;
- isVisible = visible;
- int hwnd = parent.handle;
- if (OS.GetFocus () != hwnd) return;
- if (!isVisible) {
- OS.HideCaret (hwnd);
- } else {
- if (resized) {
- resize ();
- } else {
- if (moved) move ();
- }
- OS.ShowCaret (hwnd);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
deleted file mode 100755
index edcf4a82be..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class allow the user to select a color
- * from a predefined set of available colors.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class ColorDialog extends Dialog {
- RGB rgb;
-
-/**
- * Constructs a new instance of this class given only its parent.
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent) {
- this (parent, SWT.NULL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ColorDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-int CCHookProc (int hdlg, int uiMsg, int lParam, int lpData) {
- switch (uiMsg) {
- case OS.WM_INITDIALOG:
- if (title != null && title.length () != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, title, true);
- OS.SetWindowText (hdlg, buffer);
- }
- break;
- }
- return 0;
-}
-
-/**
- * Returns the currently selected color in the receiver.
- *
- * @return the RGB value for the selected color, may be null
- *
- * @see PaletteData#getRGBs
- */
-public RGB getRGB () {
- return rgb;
-}
-
-/**
- * Makes the receiver visible and brings it to the front
- * of the display.
- *
- * @return the selected color, or null if the dialog was
- * cancelled, no color was selected, or an error
- * occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public RGB open () {
-
- /* Get the owner HWND for the dialog */
- int hwndOwner = 0;
- if (parent != null) hwndOwner = parent.handle;
-
- /* Create the CCHookProc */
- Callback callback = new Callback (this, "CCHookProc", 4);
- int lpfnHook = callback.getAddress ();
-
- /* Open the dialog */
- int hHeap = OS.GetProcessHeap ();
- int lpCustColors = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, 16 * 4);
- CHOOSECOLOR lpcc = new CHOOSECOLOR ();
- lpcc.lStructSize = CHOOSECOLOR.sizeof;
- lpcc.Flags = OS.CC_ANYCOLOR | OS.CC_ENABLEHOOK;
- lpcc.lpfnHook = lpfnHook;
- lpcc.hwndOwner = hwndOwner;
- lpcc.lpCustColors = lpCustColors;
- if (rgb != null) {
- lpcc.Flags |= OS.CC_RGBINIT;
- int red = rgb.red & 0xFF;
- int green = (rgb.green << 8) & 0xFF00;
- int blue = (rgb.blue << 16) & 0xFF0000;
- lpcc.rgbResult = red | green | blue;
- }
- rgb = null;
- if (OS.ChooseColor (lpcc)) {
- int red = lpcc.rgbResult & 0xFF;
- int green = (lpcc.rgbResult >> 8) & 0xFF;
- int blue = (lpcc.rgbResult >> 16) & 0xFF;
- rgb = new RGB (red, green, blue);
- }
-
- /* Free the CCHookProc */
- callback.dispose ();
-
- /* Free the OS memory */
- if (lpCustColors != 0) OS.HeapFree (hHeap, 0, lpCustColors);
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (hwndOwner != 0) OS.UpdateWindow (hwndOwner);
-
- return rgb;
-}
-
-/**
- * Returns the receiver's selected color to be the argument.
- *
- * @param rgb the new RGB value for the selected color, may be
- * null to let the platform to select a default when
- * open() is called
- *
- * @see PaletteData#getRGBs
- */
-public void setRGB (RGB rgb) {
- this.rgb = rgb;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
deleted file mode 100755
index c8ef3991ef..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ /dev/null
@@ -1,1271 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are controls that allow the user
- * to choose an item from a list of items, or optionally
- * enter a new value by typing it into an editable text
- * field. Often, <code>Combo</code>s are used in the same place
- * where a single selection <code>List</code> widget could
- * be used but space is limited. A <code>Combo</code> takes
- * less space than a <code>List</code> widget and shows
- * similar information.
- * <p>
- * Note: Since <code>Combo</code>s can contain both a list
- * and an editable text field, it is possible to confuse methods
- * which access one versus the other (compare for example,
- * <code>clearSelection()</code> and <code>deselectAll()</code>).
- * The API documentation is careful to indicate either "the
- * receiver's list" or the "the receiver's text field" to
- * distinguish between the two cases.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see List
- */
-
-public class Combo extends Composite {
- boolean noSelection;
-
- /**
- * the operating system limit for the number of characters
- * that the text field in an instance of this class can hold
- */
- public static final int LIMIT;
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
- }
-
- static final int ComboProc;
- static final TCHAR ComboClass = new TCHAR (0,"COMBOBOX", true);
- /*
- * These are the undocumented control id's for the children of
- * a combo box. Since there are no constants for these values,
- * they may change with different versions of Windows (but have
- * been the same since Windows 3.0).
- */
- static final int CBID_LIST = 1000;
- static final int CBID_EDIT = 1001;
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ComboClass, lpWndClass);
- ComboProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Combo (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer);
- if (result == OS.CB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (result == OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, buffer);
- if (result == OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (result == OS.CB_ERR) {
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (0 <= index && index <= count) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ComboProc, handle, msg, wParam, lParam);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a combo box that has a border using Windows style
- * bits. All combo boxes draw their own border and
- * do not use the standard Windows border styles.
- * Therefore, no matter what style bits are specified,
- * clear the BORDER bits so that the SWT style will
- * match the Windows widget.
- *
- * The Windows behavior is currently implemented on
- * all platforms.
- */
- style &= ~SWT.BORDER;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
- if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
- return style;
-}
-
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget ();
- OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, -1);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- int itemHeight = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, 0, 0);
- int width = 0, height = 0;
- if ((style & SWT.SIMPLE) != 0) height = count * itemHeight;
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- RECT rect = new RECT ();
- int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX;
- int length = OS.GetWindowTextLength (handle);
- int cp = getCodePage ();
- TCHAR buffer = new TCHAR (cp, length + 1);
- OS.GetWindowText (handle, buffer, length);
- OS.DrawText (hDC, buffer, length, rect, flags);
- width = Math.max (width, rect.right - rect.left);
- for (int i=0; i<count; i++) {
- length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, i, 0);
- if (length != OS.CB_ERR) {
- if (length + 1 > buffer.length ()) buffer = new TCHAR (cp, length + 1);
- int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, i, buffer);
- if (result != OS.CB_ERR) {
- OS.DrawText (hDC, buffer, length, rect, flags);
- width = Math.max (width, rect.right - rect.left);
- }
- }
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int textHeight = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL) + 8;
- if ((style & SWT.DROP_DOWN) != 0) {
- height = textHeight + 6;
- } else {
- height += textHeight + 10;
- }
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_WINDOW);
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- int selection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
- if (index != selection) return;
- OS.SendMessage (handle, OS.CB_SETCURSEL, -1, 0);
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
-}
-
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget ();
- OS.SendMessage (handle, OS.CB_SETCURSEL, -1, 0);
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
-}
-
-boolean getEditable () {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & 0x0F) == OS.CBS_DROPDOWNLIST;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget ();
- int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
- if (length != OS.CB_ERR) {
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, index, buffer);
- if (result != OS.CB_ERR) return buffer.toString (0, length);
- }
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (0 <= index && index < count) error (SWT.ERROR_CANNOT_GET_ITEM);
- error (SWT.ERROR_INVALID_RANGE);
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (count == OS.CB_ERR) error (SWT.ERROR_CANNOT_GET_COUNT);
- return count;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, 0, 0);
- if (result == OS.CB_ERR) error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
- return result;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget ();
- int count = getItemCount ();
- String [] result = new String [count];
- for (int i=0; i<count; i++) result [i] = getItem (i);
- return result;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) != 0) {
- return new Point (0, OS.GetWindowTextLength (handle));
- }
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end);
- return new Point (start [0], end [0]);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- if (noSelection) return -1;
- return OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
-}
-
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-String getText (int start, int stop) {
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- return getText ().substring (start, stop - 1);
-}
-
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
- if (result == OS.CB_ERR) error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
- return result + 6;
-}
-
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndText == 0) return LIMIT;
- return OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0);
-}
-
-boolean hasFocus () {
- int hwndFocus = OS.GetFocus ();
- if (hwndFocus == handle) return true;
- if (hwndFocus == 0) return false;
- int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndFocus == hwndText) return true;
- int hwndList = OS.GetDlgItem (handle, CBID_LIST);
- if (hwndFocus == hwndList) return true;
- return false;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (!(0 <= start && start < count)) return -1;
- int index = start - 1, last = 0;
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- do {
- index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, buffer);
- if (index == OS.CB_ERR || index <= last) return -1;
- } while (!string.equals (getItem (index)));
- return index;
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- int code = OS.SendMessage (handle, OS.CB_DELETESTRING, index, 0);
- if (code == OS.CB_ERR) {
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
- error (SWT.ERROR_INVALID_RANGE);
- }
- if (length != OS.GetWindowTextLength (handle)) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event. If this happens, just return.
- */
- sendEvent (SWT.Modify);
- if (isDisposed ()) return;
- }
- /*
- * Bug in Windows. When the combo box is read only
- * with exactly one item that is currently selected
- * and that item is removed, the combo box does not
- * redraw to clear the text area. The fix is to
- * force a redraw.
- */
- if ((style & SWT.READ_ONLY) != 0) {
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (count == 0) OS.InvalidateRect (handle, null, false);
- }
-}
-
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget ();
- if (start > end) return;
- int length = OS.GetWindowTextLength (handle);
- for (int i=start; i<=end; i++) {
- int result = OS.SendMessage (handle, OS.CB_DELETESTRING, start, 0);
- if (result == OS.CB_ERR) {
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (0 <= i && i < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
- if (length != OS.GetWindowTextLength (handle)) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event. If this happens, just return.
- */
- sendEvent (SWT.Modify);
- if (isDisposed ()) return;
- }
- /*
- * Bug in Windows. When the combo box is read only
- * with exactly one item that is currently selected
- * and that item is removed, the combo box does not
- * redraw to clear the text area. The fix is to
- * force a redraw.
- */
- if ((style & SWT.READ_ONLY) != 0) {
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (count == 0) OS.InvalidateRect (handle, null, false);
- }
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
- remove (index);
-}
-
-/**
- * Removes all of the items from the receiver's list.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0);
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
- if (0 <= index && index < count) {
- int selection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
- int code = OS.SendMessage (handle, OS.CB_SETCURSEL, index, 0);
- if (code != OS.CB_ERR && code != selection) {
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
- }
- }
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- /*
- * Feature in Windows. If the combo box has the CBS_DROPDOWN
- * or CBS_DROPDOWNLIST style, Windows uses the height that the
- * programmer sets in SetWindowPos () to control height of the
- * drop down list. When the width is non-zero, Windows remembers
- * this value and sets the height to be the height of the text
- * field part of the combo box. If the width is zero, Windows
- * allows the height to have any value. Therefore, when the
- * programmer sets and then queries the height, the values can
- * be different depending on the width. The problem occurs when
- * the programmer uses computeSize () to determine the preferred
- * height (always the height of the text field) and then uses
- * this value to set the height of the combo box. The result
- * is a combo box with a zero size drop down list. The fix, is
- * to always set the height to show a fixed number of combo box
- * items and ignore the height value that the programmer supplies.
- */
- if ((style & SWT.DROP_DOWN) != 0) {
- int textHeight = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
- int itemHeight = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, 0, 0);
- super.setBounds (x, y, width, textHeight + 6 + (itemHeight * 5) + 2, flags);
- return;
- }
-
- /*
- * Bug in Windows. If the combo box has the CBS_SIMPLE style,
- * the list portion of the combo box is not redrawn when the
- * combo box is resized. The fix is to force a redraw when
- * the size has changed.
- */
- if (parent.hdwp != 0 || (flags & OS.SWP_NOSIZE) != 0 || !OS.IsWindowVisible (handle)) {
- super.setBounds (x, y, width, height, flags);
- return;
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- super.setBounds (x, y, width, height, flags);
- if ((rect.right - rect.left) != width || (rect.bottom - rect.top) != height) {
- if (OS.IsWinCE) {
- int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndText != 0) OS.InvalidateRect (hwndText, null, true);
- int hwndList = OS.GetDlgItem (handle, CBID_LIST);
- if (hwndList != 0) OS.InvalidateRect (hwndList, null, true);
- } else {
- int uFlags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, uFlags);
- }
- }
-}
-
-void setEditable (boolean editable) {
- error (SWT.ERROR_NOT_IMPLEMENTED);
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- remove (index);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event that might be sent when the index is removed.
- * If this happens, just exit.
- */
- if (isDisposed ()) return;
- add (string, index);
-}
-
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0);
- int codePage = getCodePage ();
- for (int i=0; i<items.length; i++) {
- String string = items [i];
- TCHAR buffer = new TCHAR (codePage, string, true);
- int code = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer);
- if (code == OS.CB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (code == OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
- }
-}
-
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget ();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- int bits = selection.x | (selection.y << 16);
- OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits);
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- if ((style & SWT.READ_ONLY) != 0) {
- int index = indexOf (string);
- if (index != -1) select (index);
- return;
- }
- if (OS.SetWindowText (handle, buffer)) {
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
- }
-}
-
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget ();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- OS.SendMessage (handle, OS.CB_LIMITTEXT, limit, 0);
-}
-
-boolean translateAccelerator (MSG msg) {
- if (super.translateAccelerator (msg)) return true;
-
- /*
- * In order to see key events for the text widget in a combo box,
- * filter the key events before they are dispatched to the text
- * widget and invoke the cooresponding key handler for the combo
- * box as if the key was sent directly to the combo box, not the
- * text field. The key is still dispatched to the text widget,
- * in the normal fashion. Note that we must call TranslateMessage
- * in order to process accented keys properly.
- */
- int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (msg.hwnd == hwndText) {
- switch (msg.message) {
- case OS.WM_CHAR:
- case OS.WM_SYSCHAR:
- case OS.WM_KEYDOWN: {
- Display display = getDisplay ();
- if (msg.message == OS.WM_KEYDOWN) {
- if (display.translateTraversal (msg, this)) return true;
- } else {
- if (display.translateMnemonic (msg, this)) return true;
- }
- }
- }
- OS.TranslateMessage (msg);
- switch (msg.message) {
- case OS.WM_CHAR: WM_CHAR (msg.wParam, msg.lParam); break;
- case OS.WM_IME_CHAR: WM_IME_CHAR (msg.wParam, msg.lParam); break;
- case OS.WM_KEYDOWN: WM_KEYDOWN (msg.wParam, msg.lParam); break;
- case OS.WM_KEYUP: WM_KEYUP (msg.wParam, msg.lParam); break;
- case OS.WM_SYSCHAR: WM_SYSCHAR (msg.wParam, msg.lParam); break;
- case OS.WM_SYSKEYDOWN: WM_SYSKEYDOWN (msg.wParam, msg.lParam); break;
- case OS.WM_SYSKEYUP: WM_SYSKEYUP (msg.wParam, msg.lParam); break;
- }
- OS.DispatchMessage (msg);
- return true;
- }
- return false;
-}
-
-boolean translateTraversal (MSG msg) {
- /*
- * Feature in Windows. For some reason, when the
- * user presses tab, return or escape, Windows beeps.
- * The fix is to look for these keys and not call
- * the window proc.
- */
- switch (msg.wParam) {
- case OS.VK_ESCAPE:
- /* Allow the escape key to close the combo box */
- if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) {
- return false;
- }
- // FALL THROUGH
- case OS.VK_TAB:
- case OS.VK_RETURN:
- boolean translated = super.translateTraversal (msg);
- if (!translated && msg.wParam == OS.VK_RETURN) {
- sendEvent (SWT.DefaultSelection);
- // widget could be disposed at this point
- }
- return true;
- }
- return super.translateTraversal (msg);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.CBS_AUTOHSCROLL | OS.CBS_NOINTEGRALHEIGHT | OS.WS_VSCROLL;
- if ((style & SWT.SIMPLE) != 0) return bits | OS.CBS_SIMPLE;
- if ((style & SWT.READ_ONLY) != 0) return bits | OS.CBS_DROPDOWNLIST;
- return bits | OS.CBS_DROPDOWN;
-}
-
-TCHAR windowClass () {
- return ComboClass;
-}
-
-int windowProc () {
- return ComboProc;
-}
-
-LRESULT WM_CHAR (int wParam, int lParam) {
- LRESULT result = super.WM_CHAR (wParam, lParam);
- if (result != null) return result;
- if (wParam == OS.VK_RETURN) {
- postEvent (SWT.DefaultSelection);
- }
- return result;
-}
-
-LRESULT WM_CTLCOLOR (int wParam, int lParam) {
- return wmColorChild (wParam, lParam);
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- int code = callWindowProc (OS.WM_GETDLGCODE, wParam, lParam);
- return new LRESULT (code | OS.DLGC_WANTARROWS);
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- /*
- * Return NULL - Focus notification is
- * done in WM_COMMAND by CBN_KILLFOCUS.
- */
- return null;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- /*
- * Return NULL - Focus notification is
- * done by WM_COMMAND with CBN_SETFOCUS.
- */
- return null;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- int code = wParam >> 16;
- switch (code) {
- case OS.CBN_EDITCHANGE:
- /*
- * Feature in Windows. If the combo box list selection is
- * queried using CB_GETCURSEL before the WM_COMMAND (with
- * CBM_EDITCHANGE) returns, CB_GETCURSEL returns the previous
- * selection in the list. It seems that the combo box sends
- * the WM_COMMAND before it makes the selection in the list box
- * match the entry field. The fix is remember that no selection
- * in the list should exist in this case.
- */
- noSelection = true;
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Modify);
- if (isDisposed ()) return LRESULT.ZERO;
- noSelection = false;
- break;
- case OS.CBN_SELCHANGE:
- /*
- * Feature in Windows. If the text in and editable combo box
- * is queried using GetWindowText () before the WM_COMMAND
- * (with CBM_SELCHANGE) returns, GetWindowText () returns is
- * the previous text in the combo box. It seems that the combo
- * box sends the WM_COMMAND before it updates the text field to
- * match the list selection. The fix is to force the text field
- * to match the list selection by re-selecting the list item.
- */
- int index = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
- if (index != OS.CB_ERR) OS.SendMessage (handle, OS.CB_SETCURSEL, index, 0);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Modify);
- if (isDisposed ()) return LRESULT.ZERO;
- postEvent (SWT.Selection);
- break;
- case OS.CBN_SETFOCUS:
- case OS.CBN_KILLFOCUS:
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the focus
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (code == OS.CBN_SETFOCUS ? SWT.FocusIn : SWT.FocusOut);
- if (isDisposed ()) return LRESULT.ZERO;
- break;
- }
- return super.wmCommandChild (wParam, lParam);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
deleted file mode 100755
index 57c57c05a8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ /dev/null
@@ -1,769 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are controls which are capable
- * of containing other controls.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * This class may be subclassed by custom control implementors
- * who are building controls that are constructed from aggregates
- * of other controls.
- * </p>
- *
- * @see Canvas
- */
-
-public class Composite extends Scrollable {
- Layout layout;
- int font, hdwp;
- Control [] tabList;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Composite () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Composite (Composite parent, int style) {
- super (parent, style);
-}
-Control [] _getChildren () {
- int count = 0;
- int hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
- if (hwndChild == 0) return new Control [0];
- while (hwndChild != 0) {
- count++;
- hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT);
- }
- Control [] children = new Control [count];
- int index = 0;
- hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
- while (hwndChild != 0) {
- Control control = WidgetTable.get (hwndChild);
- if (control != null && control != this) {
- children [index++] = control;
- }
- hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT);
- }
- if (count == index) return children;
- Control [] newChildren = new Control [index];
- System.arraycopy (children, 0, newChildren, 0, index);
- return newChildren;
-}
-
-Control [] _getTabList () {
- if (tabList == null) return tabList;
- int index = 0, count = 0;
- while (index < tabList.length) {
- if (!tabList [index].isDisposed ()) count++;
- index++;
- }
- if (index == count) return tabList;
- Control [] newList = new Control [count];
- index = 0;
- for (int i=0; i<tabList.length; i++) {
- if (!tabList [index].isDisposed ()) {
- newList [index++] = tabList [i];
- }
- }
- tabList = newList;
- return tabList;
-}
-
-protected void checkSubclass () {
- /* Do nothing - Subclassing is allowed */
-}
-
-Control [] computeTabList () {
- Control result [] = super.computeTabList ();
- if (result.length == 0) return result;
- Control [] list = tabList != null ? _getTabList () : _getChildren ();
- for (int i=0; i<list.length; i++) {
- Control child = list [i];
- Control [] childList = child.computeTabList ();
- if (childList.length != 0) {
- Control [] newResult = new Control [result.length + childList.length];
- System.arraycopy (result, 0, newResult, 0, result.length);
- System.arraycopy (childList, 0, newResult, result.length, childList.length);
- result = newResult;
- }
- }
- return result;
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- Point size;
- if (layout != null) {
- if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = new Point (wHint, hHint);
- }
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = computeTrim (0, 0, size.x, size.y);
- return new Point (trim.width, trim.height);
-}
-
-void createHandle () {
- super.createHandle ();
- state |= CANVAS;
-}
-void drawBackground (int hDC, RECT rect) {
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_BACKGROUND) != 0) return;
- }
- super.drawBackground (hDC, rect);
-}
-
-/**
- * Returns an array containing the receiver's children.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of children, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return an array of children
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control [] getChildren () {
- checkWidget ();
- return _getChildren ();
-}
-
-int getChildrenCount () {
- /*
- * NOTE: The current implementation will count
- * non-registered children.
- */
- int count = 0;
- int hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
- while (hwndChild != 0) {
- count++;
- hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT);
- }
- return count;
-}
-
-/**
- * Returns layout which is associated with the receiver, or
- * null if one has not been set.
- *
- * @return the receiver's layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Layout getLayout () {
- checkWidget ();
- return layout;
-}
-
-/**
- * Gets the last specified tabbing order for the control.
- *
- * @return tabList the ordered list of controls representing the tab order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setTabList
- */
-public Control [] getTabList () {
- checkWidget ();
- Control [] tabList = _getTabList ();
- if (tabList == null) {
- int count = 0;
- Control [] list =_getChildren ();
- for (int i=0; i<list.length; i++) {
- if (list [i].isTabGroup ()) count++;
- }
- tabList = new Control [count];
- int index = 0;
- for (int i=0; i<list.length; i++) {
- if (list [i].isTabGroup ()) {
- tabList [index++] = list [i];
- }
- }
- }
- return tabList;
-}
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the receiver does not have a layout, do nothing.
- * <p>
- * This is equivalent to calling <code>layout(true)</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout () {
- checkWidget ();
- layout (true);
-}
-
-/**
- * If the receiver has a layout, asks the layout to <em>lay out</em>
- * (that is, set the size and location of) the receiver's children.
- * If the the argument is <code>true</code> the layout must not rely
- * on any cached information it is keeping about the children. If it
- * is <code>false</code> the layout may (potentially) simplify the
- * work it is doing by assuming that the state of the none of the
- * receiver's children has changed since the last layout.
- * If the receiver does not have a layout, do nothing.
- *
- * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void layout (boolean changed) {
- checkWidget ();
- if (layout == null) return;
- int count = getChildrenCount ();
- if (count == 0) return;
- if (count > 1 && hdwp == 0) {
- hdwp = OS.BeginDeferWindowPos (count);
- }
- layout.layout (this, changed);
- int oldHdwp = hdwp;
- hdwp = 0;
- if (oldHdwp != 0) OS.EndDeferWindowPos (oldHdwp);
-}
-
-Point minimumSize () {
- Control [] children = _getChildren ();
- int width = 0, height = 0;
- for (int i=0; i<children.length; i++) {
- Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
- }
- return new Point (width, height);
-}
-
-void releaseChildren () {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (!child.isDisposed ()) {
- child.releaseWidget ();
- child.releaseHandle ();
- }
- }
-}
-
-void releaseWidget () {
- releaseChildren ();
- super.releaseWidget ();
- layout = null;
- tabList = null;
- int oldHdwp = hdwp;
- hdwp = 0;
- if (oldHdwp != 0) OS.EndDeferWindowPos (oldHdwp);
-}
-
-public boolean setFocus () {
- checkWidget ();
- if ((style & SWT.NO_FOCUS) != 0) return false;
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.setRadioFocus ()) return true;
- }
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.setFocus ()) return true;
- }
- return super.setFocus ();
-}
-
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget ();
- this.layout = layout;
-}
-
-/**
- * Sets the tabbing order for the specified controls to
- * match the order that they occur in the argument list.
- *
- * @param tabList the ordered list of controls representing the tab order; must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTabList (Control [] tabList) {
- checkWidget ();
- if (tabList == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<tabList.length; i++) {
- Control control = tabList [i];
- if (control == null) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
-// Shell shell = control.getShell ();
-// while (control != shell && control != this) {
-// control = control.parent;
-// }
-// if (control != this) error (SWT.ERROR_INVALID_PARENT);
- if (control.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- /*
- * This code is intentionally commented. It is
- * not yet clear whether setting the tab list
- * should force the widget to be a tab group
- * instead of a tab item or non-traversable.
- */
-// Control [] children = _getChildren ();
-// for (int i=0; i<children.length; i++) {
-// Control control = children [i];
-// if (control != null) {
-// if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
-// int index = 0;
-// while (index < tabList.length) {
-// if (tabList [index] == control) break;
-// index++;
-// }
-// int hwnd = control.handle;
-// int bits = OS.GetWindowLong (hwnd, OS.GWL_STYLE);
-// if (index == tabList.length) {
-// bits &= ~OS.WS_TABSTOP;
-// } else {
-// bits |= OS.WS_TABSTOP;
-// }
-// OS.SetWindowLong (hwnd, OS.GWL_STYLE, bits);
-// }
-// }
- this.tabList = tabList;
-}
-
-boolean setTabGroupFocus () {
- if (isTabItem ()) return setTabItemFocus ();
- if ((style & SWT.NO_FOCUS) == 0) {
- boolean takeFocus = true;
- if ((state & CANVAS) != 0) {
- takeFocus = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
- }
- if (takeFocus && setTabItemFocus ()) return true;
- }
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.isVisible () && child.setRadioFocus ()) return true;
- }
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.isTabItem () && child.setTabItemFocus ()) return true;
- }
- return false;
-}
-
-boolean setTabItemFocus () {
- if ((style & SWT.NO_FOCUS) == 0) {
- boolean takeFocus = true;
- if ((state & CANVAS) != 0) {
- takeFocus = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
- }
- if (takeFocus) {
- if (!isShowing ()) return false;
- if (forceFocus ()) return true;
- }
- }
- return super.setTabItemFocus ();
-}
-
-String toolTipText (NMTTDISPINFO hdr) {
- if ((hdr.uFlags & OS.TTF_IDISHWND) == 0) {
- return null;
- }
- int hwnd = hdr.idFrom;
- if (hwnd == 0) return null;
- Control control = WidgetTable.get (hwnd);
- if (control == null) return null;
- return control.toolTipText;
-}
-
-boolean translateMnemonic (char key) {
- if (super.translateMnemonic (key)) return true;
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.translateMnemonic (key)) return true;
- }
- return false;
-}
-
-void updateFont (Font oldFont, Font newFont) {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control control = children [i];
- if (!control.isDisposed ()) {
- control.updateFont (oldFont, newFont);
- }
- }
- super.updateFont (oldFont, newFont);
- layout (true);
-}
-
-int widgetStyle () {
- /* Temporary code to force SWT.CLIP_SIBLINGS */
- return super.widgetStyle () | OS.WS_CLIPCHILDREN;
-}
-
-LRESULT WM_ERASEBKGND (int wParam, int lParam) {
- if ((state & CANVAS) != 0) {
- return super.WM_ERASEBKGND (wParam, lParam);
- }
- drawBackground (wParam);
- return LRESULT.ONE;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
- if (result != null) return result;
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_FOCUS) != 0) return new LRESULT (OS.DLGC_STATIC);
- if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
- int flags = OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB;
- return new LRESULT (flags);
- }
- int count = getChildrenCount ();
- if (count != 0) return new LRESULT (OS.DLGC_STATIC);
- }
- return result;
-}
-
-LRESULT WM_GETFONT (int wParam, int lParam) {
- LRESULT result = super.WM_GETFONT (wParam, lParam);
- if (result != null) return result;
- int code = callWindowProc (OS.WM_GETFONT, wParam, lParam);
- if (code != 0) return new LRESULT (code);
- if (font == 0) font = defaultFont ();
- return new LRESULT (font);
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
-
- /* Set focus for a canvas with no children */
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_FOCUS) != 0) return result;
- if (OS.GetWindow (handle, OS.GW_CHILD) == 0) setFocus ();
- }
- return result;
-}
-
-LRESULT WM_NOTIFY (int wParam, int lParam) {
- if (!OS.IsWinCE) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- switch (hdr.code) {
- case OS.TTN_GETDISPINFOW:
- case OS.TTN_GETDISPINFOA: {
- NMTTDISPINFO lpnmtdi = new NMTTDISPINFO ();
- OS.MoveMemory (lpnmtdi, lParam, NMTTDISPINFO.sizeof);
- String string = toolTipText (lpnmtdi);
- if (string != null && string.length () != 0) {
- Shell shell = getShell ();
- string = Display.withCrLf (string);
- /*
- * Bug in Windows 98. For some reason, the tool bar control
- * sends both TTN_GETDISPINFOW and TTN_GETDISPINFOA to get
- * the tool tip text and the tab folder control sends only
- * TTN_GETDISPINFOW. The fix is to handle only TTN_GETDISPINFOW,
- * even though it should never be sent on Windows 98.
- */
- if (hdr.code == OS.TTN_GETDISPINFOW) {
- int length = string.length ();
- char [] buffer = new char [length + 1];
- string.getChars(0, length, buffer, 0);
- shell.setToolTipText (lpnmtdi, buffer);
- } else {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, string, true);
- shell.setToolTipText (lpnmtdi, buffer);
- }
- OS.MoveMemory (lParam, lpnmtdi, NMTTDISPINFO.sizeof);
- return LRESULT.ZERO;
- }
- break;
- }
- }
- }
- return super.WM_NOTIFY (wParam, lParam);
-}
-
-LRESULT WM_PAINT (int wParam, int lParam) {
- if ((state & CANVAS) == 0) {
- return super.WM_PAINT (wParam, lParam);
- }
-
- /*
- * This code is intentionally commented. Don't exit
- * early because the background must still be painted,
- * even though no application code will be painting
- * the widget.
- *
- * Do not uncomment this code.
- */
-// if (!hooks (SWT.Paint)) return null;
-
- /* Get the damage */
- int [] lpRgnData = null;
- boolean isComplex = false;
- boolean exposeRegion = false;
- if ((style & SWT.NO_MERGE_PAINTS) != 0) {
- int rgn = OS.CreateRectRgn (0, 0, 0, 0);
- isComplex = OS.GetUpdateRgn (handle, rgn, false) == OS.COMPLEXREGION;
- if (isComplex) {
- int nBytes = OS.GetRegionData (rgn, 0, null);
- lpRgnData = new int [nBytes / 4];
- exposeRegion = OS.GetRegionData (rgn, nBytes, lpRgnData) != 0;
- }
- OS.DeleteObject (rgn);
- }
-
- /* Set the clipping bits */
- int oldBits = 0;
- if (!OS.IsWinCE) {
- oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- }
-
- /* Create the paint GC */
- PAINTSTRUCT ps = new PAINTSTRUCT ();
- GCData data = new GCData ();
- data.ps = ps;
- GC gc = GC.win32_new (this, data);
- int hDC = gc.handle;
-
- /* Send the paint event */
- Event event = new Event ();
- event.gc = gc;
- if (isComplex && exposeRegion) {
- RECT rect = new RECT ();
- int nCount = lpRgnData [2];
- for (int i=0; i<nCount; i++) {
- OS.SetRect (rect,
- lpRgnData [8 + (i << 2)],
- lpRgnData [8 + (i << 2) + 1],
- lpRgnData [8 + (i << 2) + 2],
- lpRgnData [8 + (i << 2) + 3]);
- drawBackground (hDC, rect);
- event.x = rect.left;
- event.y = rect.top;
- event.width = rect.right - rect.left;
- event.height = rect.bottom - rect.top;
- event.count = nCount - 1 - i;
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the paint
- * event. If this happens, attempt to give back the
- * paint GC anyways because this is a scarce Windows
- * resource.
- */
- sendEvent (SWT.Paint, event);
- if (isDisposed ()) break;
- }
- } else {
- RECT rect = new RECT ();
- OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom);
- drawBackground (hDC, rect);
- event.x = ps.left;
- event.y = ps.top;
- event.width = ps.right - ps.left;
- event.height = ps.bottom - ps.top;
- sendEvent (SWT.Paint, event);
- }
- // widget could be disposed at this point
-
- /* Dispose the paint GC */
- event.gc = null;
- gc.dispose ();
-
- if (!OS.IsWinCE) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the paint
- * event. If this happens, don't attempt to restore
- * the style.
- */
- if (!isDisposed ()) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, oldBits);
- }
- }
- return LRESULT.ZERO;
-}
-
-LRESULT WM_SETFONT (int wParam, int lParam) {
- return super.WM_SETFONT (font = wParam, lParam);
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- /*
- * Begin deferred window positioning
- */
- int count = getChildrenCount ();
- if (count > 1 && hdwp == 0) {
- hdwp = OS.BeginDeferWindowPos (count);
- }
-
- /* Layout and resize */
- if (layout != null) layout.layout (this, false);
- LRESULT result = super.WM_SIZE (wParam, lParam);
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning the result of the
- * WM_SIZE message.
- */
- if (isDisposed ()) return result;
-
- /* End deferred window positioning */
- int oldHdwp = hdwp;
- hdwp = 0;
- if (oldHdwp != 0) OS.EndDeferWindowPos (oldHdwp);
-
- /* Damage the widget to cause a repaint */
- if ((state & CANVAS) != 0) {
- if ((style & SWT.NO_REDRAW_RESIZE) == 0) {
- if (hooks (SWT.Paint)) {
- OS.InvalidateRect (handle, null, true);
- }
- }
- }
- return result;
-}
-
-LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- int hwndChild = children [i].handle;
- OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0);
- }
- return null;
-}
-
-LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
- LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
- if (result != null) return result;
-
- /*
- * Check to see if the command is a system command or
- * a user menu item that was added to the system menu.
- */
- if ((wParam & 0xF000) == 0) return result;
-
- /*
- * Bug in Windows. When a vertical or horizontal scroll bar is
- * hidden or shown while the opposite scroll bar is being scrolled
- * by the user (with WM_HSCROLL code SB_LINEDOWN), the scroll bar
- * does not redraw properly. The fix is to detect this case and
- * redraw the non-client area.
- */
- if (!OS.IsWinCE) {
- int cmd = wParam & 0xFFF0;
- switch (cmd) {
- case OS.SC_HSCROLL:
- case OS.SC_VSCROLL:
- boolean showHBar = horizontalBar != null && horizontalBar.getVisible ();
- boolean showVBar = verticalBar != null && verticalBar.getVisible ();
- int code = callWindowProc (OS.WM_SYSCOMMAND, wParam, lParam);
- if ((showHBar != (horizontalBar != null && horizontalBar.getVisible ())) ||
- (showVBar != (verticalBar != null && verticalBar.getVisible ()))) {
- int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW;
- OS.RedrawWindow (handle, null, 0, flags);
- }
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
- }
- }
- /* Return the result */
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
deleted file mode 100755
index b3cc66a7a8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ /dev/null
@@ -1,3833 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Control is the abstract superclass of all windowed user interface classes.
- * <p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b>
- * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
- * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public abstract class Control extends Widget implements Drawable {
- /**
- * the handle to the OS resource
- * (Warning: This field is platform dependent)
- */
- public int handle;
-
- Composite parent;
- int drawCount, hCursor;
- int foreground, background;
- Menu menu;
- String toolTipText;
- Object layoutData;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Control () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Control (Composite parent, int style) {
- super (parent, style);
- this.parent = parent;
- createWidget ();
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control gains or loses focus, by sending
- * it one of the messages defined in the <code>FocusListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #removeFocusListener
- */
-public void addFocusListener (FocusListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.FocusIn,typedListener);
- addListener (SWT.FocusOut,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard, by sending
- * it one of the messages defined in the <code>KeyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #removeKeyListener
- */
-public void addKeyListener (KeyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.KeyUp,typedListener);
- addListener (SWT.KeyDown,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when mouse buttons are pressed and released, by sending
- * it one of the messages defined in the <code>MouseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #removeMouseListener
- */
-public void addMouseListener (MouseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseDown,typedListener);
- addListener (SWT.MouseUp,typedListener);
- addListener (SWT.MouseDoubleClick,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse passes or hovers over controls, by sending
- * it one of the messages defined in the <code>MouseTrackListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #removeMouseTrackListener
- */
-public void addMouseTrackListener (MouseTrackListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseEnter,typedListener);
- addListener (SWT.MouseExit,typedListener);
- addListener (SWT.MouseHover,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the mouse moves, by sending it one of the
- * messages defined in the <code>MouseMoveListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #removeMouseMoveListener
- */
-public void addMouseMoveListener (MouseMoveListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.MouseMove,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver needs to be painted, by sending it
- * one of the messages defined in the <code>PaintListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #removePaintListener
- */
-public void addPaintListener (PaintListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Paint,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when traversal events occur, by sending it
- * one of the messages defined in the <code>TraverseListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #removeTraverseListener
- */
-public void addTraverseListener (TraverseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Traverse,typedListener);
-}
-
-abstract int callWindowProc (int msg, int wParam, int lParam);
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size of the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- return computeSize (wHint, hHint, true);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a control is the size that it would
- * best be displayed at. The width hint and height hint arguments
- * allow the caller to ask a control questions such as "Given a particular
- * width, how high does the control need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p><p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
- * @return the preferred size of the control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = DEFAULT_WIDTH;
- int height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2;
- height += border * 2;
- return new Point (width, height);
-}
-
-Control computeTabGroup () {
- if (isTabGroup ()) return this;
- return parent.computeTabGroup ();
-}
-
-Control computeTabRoot () {
- Control [] tabList = parent._getTabList ();
- if (tabList != null) {
- int index = 0;
- while (index < tabList.length) {
- if (tabList [index] == this) break;
- index++;
- }
- if (index == tabList.length) {
- if (isTabGroup ()) return this;
- }
- }
- return parent.computeTabRoot ();
-}
-
-Control [] computeTabList () {
- if (isTabGroup ()) {
- if (getVisible () && getEnabled ()) {
- return new Control [] {this};
- }
- }
- return new Control [0];
-}
-
-void createHandle () {
- int hwndParent = 0;
- if (handle != 0) {
- hwndParent = handle;
- } else {
- if (parent != null) hwndParent = parent.handle;
- }
- handle = OS.CreateWindowEx (
- widgetExtStyle (),
- windowClass (),
- null,
- widgetStyle (),
- OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
- hwndParent,
- 0,
- OS.GetModuleHandle (null),
- null);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.IsDBLocale && parent != null) {
- int hIMC = OS.ImmGetContext (hwndParent);
- OS.ImmAssociateContext (handle, hIMC);
- OS.ImmReleaseContext (hwndParent, hIMC);
- }
-}
-
-void createWidget () {
- foreground = background = -1;
- createHandle ();
- register ();
- subclass ();
- setDefaultFont ();
-}
-
-int defaultBackground () {
- if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOW);
- return OS.GetSysColor (OS.COLOR_BTNFACE);
-}
-
-int defaultFont () {
- Display display = getDisplay ();
- return display.systemFont ();
-}
-
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_WINDOWTEXT);
-}
-
-void deregister () {
- WidgetTable.remove (handle);
-}
-
-void destroyWidget () {
- int hwnd = handle;
- releaseHandle ();
- if (hwnd != 0) {
- OS.DestroyWindow (hwnd);
- }
-}
-
-void drawBackground (int hDC) {
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- drawBackground (hDC, rect);
-}
-
-void drawBackground (int hDC, RECT rect) {
- Display display = getDisplay ();
- int hPalette = display.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette (hDC, hPalette, false);
- OS.RealizePalette (hDC);
- }
- int pixel = getBackgroundPixel ();
- int hBrush = findBrush (pixel);
- OS.FillRect (hDC, rect, hBrush);
-}
-
-int findBrush (int pixel) {
- return parent.findBrush (pixel);
-}
-
-int findCursor () {
- if (hCursor != 0) return hCursor;
- return parent.findCursor ();
-}
-
-char findMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while (index < length && string.charAt (index) != Mnemonic) index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != Mnemonic) return string.charAt (index);
- index++;
- } while (index < length);
- return '\0';
-}
-
-void fixFocus () {
- Shell shell = getShell ();
- Control control = this;
- while ((control = control.parent) != null) {
- if (control.setFocus () || control == shell) return;
- }
- OS.SetFocus (0);
-}
-
-/**
- * Forces the receiver to have the <em>keyboard focus</em>, causing
- * all keyboard events to be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setFocus
- */
-public boolean forceFocus () {
- checkWidget ();
- Decorations shell = menuShell ();
- shell.setSavedFocus (this);
- if (!isEnabled () || !isVisible () || !isActive ()) return false;
- if (isFocusControl ()) return true;
- shell.bringToTop ();
- /*
- * This code is intentionally commented.
- *
- * When setting focus to a control, it is
- * possible that application code can set
- * the focus to another control inside of
- * WM_SETFOCUS. In this case, the original
- * control will no longer have the focus
- * and the call to setFocus() will return
- * false indicating failure.
- *
- * We are still working on a solution at
- * this time.
- */
-// if (OS.GetFocus () != OS.SetFocus (handle)) return false;
- OS.SetFocus (handle);
- if (!isFocusControl ()) return false;
- shell.setDefaultButton (null, false);
- return true;
-}
-
-/**
- * Returns the receiver's background color.
- *
- * @return the background color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getBackground () {
- checkWidget ();
- return Color.win32_new (getDisplay (), getBackgroundPixel ());
-}
-
-int getBackgroundPixel () {
- if (background == -1) return defaultBackground ();
- return background;
-}
-
-/**
- * Returns the receiver's border width.
- *
- * @return the border width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getBorderWidth () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
- if ((bits & OS.WS_EX_CLIENTEDGE) != 0) return OS.GetSystemMetrics (OS.SM_CXEDGE);
- if ((bits & OS.WS_EX_STATICEDGE) != 0) return OS.GetSystemMetrics (OS.SM_CXBORDER);
- return 0;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent (or its display if its parent is null).
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget ();
- int hwndParent = 0;
- if (parent != null) {
- hwndParent = parent.handle;
- if (parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- OS.MapWindowPoints (0, hwndParent, rect, 2);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-int getCodePage () {
- int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- LOGFONT logFont = new LOGFONT ();
- OS.GetObject (hFont, LOGFONT.sizeof, logFont);
- int cs = logFont.lfCharSet & 0xFF;
- int [] lpCs = new int [8];
- if (OS.TranslateCharsetInfo (cs, lpCs, OS.TCI_SRCCHARSET)) {
- return lpCs [1];
- }
- return OS.GetACP ();
-}
-
-/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- return OS.IsWindowEnabled (handle);
-}
-
-/**
- * Returns the font that the receiver will use to paint textual information.
- *
- * @return the receiver's font
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getFont () {
- checkWidget ();
- int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (hFont == 0) hFont = defaultFont ();
- return Font.win32_new (getDisplay (), hFont);
-}
-
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Color getForeground () {
- checkWidget ();
- return Color.win32_new (getDisplay (), getForegroundPixel ());
-}
-
-int getForegroundPixel () {
- if (foreground == -1) return defaultForeground ();
- return foreground;
-}
-
-/**
- * Returns layout data which is associated with the receiver.
- *
- * @return the receiver's layout data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Object getLayoutData () {
- checkWidget ();
- return layoutData;
-}
-
-/**
- * Returns a point describing the receiver's location relative
- * to its parent (or its display if its parent is null).
- *
- * @return the receiver's location
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getLocation () {
- checkWidget ();
- int hwndParent = 0;
- if (parent != null) {
- hwndParent = parent.handle;
- if (parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- OS.MapWindowPoints (0, hwndParent, rect, 2);
- return new Point (rect.left, rect.top);
-}
-
-/**
- * Returns the receiver's pop up menu if it has one, or null
- * if it does not. All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget ();
- return menu;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Composite</code>
- * or null when the receiver is a shell that was created with null or
- * a display for a parent.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Composite getParent () {
- checkWidget ();
- return parent;
-}
-
-Control [] getPath () {
- int count = 0;
- Shell shell = getShell ();
- Control control = this;
- while (control != shell) {
- count++;
- control = control.parent;
- }
- control = this;
- Control [] result = new Control [count];
- while (control != shell) {
- result [--count] = control;
- control = control.parent;
- }
- return result;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget ();
- return parent.getShell ();
-}
-
-/**
- * Returns a point describing the receiver's size. The
- * x coordinate of the result is the width of the receiver.
- * The y coordinate of the result is the height of the
- * receiver.
- *
- * @return the receiver's size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget ();
- if (parent != null && parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Point (width, height);
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget ();
- return toolTipText;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & OS.WS_VISIBLE) != 0;
-}
-
-boolean hasCursor () {
- RECT rect = new RECT ();
- if (!OS.GetClientRect (handle, rect)) return false;
- if (OS.MapWindowPoints (handle, 0, rect, 2) == 0) return false;
- POINT pt = new POINT ();
- return (OS.GetCursorPos (pt) && OS.PtInRect (rect, pt));
-}
-
-boolean hasFocus () {
- /*
- * If a non-SWT child of the control has focus,
- * then this control is considered to have focus
- * even though it does not have focus in Windows.
- */
- int hwndFocus = OS.GetFocus ();
- while (hwndFocus != 0) {
- if (hwndFocus == handle) return true;
- if (WidgetTable.get (hwndFocus) != null) {
- return false;
- }
- hwndFocus = OS.GetParent (hwndFocus);
- }
- return false;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- checkWidget();
- int hDC;
- if (data == null || data.ps == null) {
- hDC = OS.GetDC (handle);
- } else {
- hDC = OS.BeginPaint (handle, data.ps);
- }
- if (hDC == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (data != null) {
- data.device = getDisplay ();
- data.foreground = getForegroundPixel ();
- data.background = getBackgroundPixel ();
- data.hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- data.hwnd = handle;
- }
- return hDC;
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Control</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int hDC, GCData data) {
- checkWidget ();
- if (data == null || data.ps == null) {
- OS.ReleaseDC (handle, hDC);
- } else {
- OS.EndPaint (handle, data.ps);
- }
-}
-
-boolean isActive () {
- Display display = getDisplay ();
- Shell modal = display.getModalShell ();
- if (modal != null && modal != this) {
- if ((modal.style & SWT.PRIMARY_MODAL) != 0) {
- Shell shell = getShell ();
- if (modal.parent == shell) {
- return false;
- }
- }
- int bits = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
- if ((modal.style & bits) != 0) {
- Control control = this;
- while (control != null) {
- if (control == modal) break;
- control = control.parent;
- }
- if (control != modal) return false;
- }
- }
- return getShell ().getEnabled ();
-}
-
-public boolean isDisposed () {
- return handle == 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- return getEnabled () && parent.isEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver has the user-interface
- * focus, and <code>false</code> otherwise.
- *
- * @return the receiver's focus state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isFocusControl () {
- checkWidget ();
- return hasFocus ();
-}
-
-boolean isFocusAncestor () {
- Display display = getDisplay ();
- Control control = display.getFocusControl ();
- while (control != null && control != this) {
- control = control.parent;
- }
- return control == this;
-}
-
-/**
- * Returns <code>true</code> if the underlying operating
- * system supports this reparenting, otherwise <code>false</code>
- *
- * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isReparentable () {
- checkWidget ();
- return true;
-}
-
-boolean isShowing () {
- /*
- * This is not complete. Need to check if the
- * widget is obscurred by a parent or sibling.
- */
- if (!isVisible ()) return false;
- Control control = this;
- while (control != null) {
- Point size = control.getSize ();
- if (size.x == 0 || size.y == 0) {
- return false;
- }
- control = control.parent;
- }
- return true;
- /*
- * Check to see if current damage is included.
- */
-// if (!OS.IsWindowVisible (handle)) return false;
-// int flags = OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS;
-// int hDC = OS.GetDCEx (handle, 0, flags);
-// int result = OS.GetClipBox (hDC, new RECT ());
-// OS.ReleaseDC (handle, hDC);
-// return result != OS.NULLREGION;
-}
-
-boolean isTabGroup () {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & OS.WS_TABSTOP) != 0;
-}
-
-boolean isTabItem () {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.WS_TABSTOP) != 0) return false;
- int code = OS.SendMessage (handle, OS.WM_GETDLGCODE, 0, 0);
- if ((code & OS.DLGC_STATIC) != 0) return false;
- if ((code & OS.DLGC_WANTALLKEYS) != 0) return false;
- if ((code & OS.DLGC_WANTARROWS) != 0) return false;
- if ((code & OS.DLGC_WANTTAB) != 0) return false;
- return true;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget ();
- return OS.IsWindowVisible (handle);
-}
-
-Decorations menuShell () {
- return parent.menuShell ();
-}
-
-boolean mnemonicHit (char key) {
- return false;
-}
-
-boolean mnemonicMatch (char key) {
- return false;
-}
-
-/**
- * Moves the receiver above the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the top of the drawing order. The control at
- * the top of the drawing order will not be covered by other
- * controls even if they occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveAbove (Control control) {
- checkWidget ();
- int hwndAbove = OS.HWND_TOP;
- if (control != null) {
- if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- int hwnd = control.handle;
- if (hwnd == 0 || hwnd == handle) return;
- hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV);
- /*
- * Bug in Windows. For some reason, when GetWindow ()
- * with GW_HWNDPREV is used to query the previous window
- * in the z-order with the first child, Windows returns
- * the first child instead of NULL. The fix is to detect
- * this case and move the control to the top.
- */
- if (hwndAbove == 0 || hwndAbove == hwnd) {
- hwndAbove = OS.HWND_TOP;
- }
- }
- int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- OS.SetWindowPos (handle, hwndAbove, 0, 0, 0, 0, flags);
-}
-
-/**
- * Moves the receiver below the specified control in the
- * drawing order. If the argument is null, then the receiver
- * is moved to the bottom of the drawing order. The control at
- * the bottom of the drawing order will be covered by all other
- * controls which occupy intersecting areas.
- *
- * @param the sibling control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void moveBelow (Control control) {
- checkWidget ();
- int hwndAbove = OS.HWND_BOTTOM;
- if (control != null) {
- if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- hwndAbove = control.handle;
- }
- if (hwndAbove == 0 || hwndAbove == handle) return;
- int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- OS.SetWindowPos (handle, hwndAbove, 0, 0, 0, 0, flags);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack () {
- checkWidget ();
- pack (true);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- * <p>
- * If the changed flag is <code>true</code>, it indicates that the receiver's
- * <em>contents</em> have changed, therefore any caches that a layout manager
- * containing the control may have been keeping need to be flushed. When the
- * control is resized, the changed flag will be <code>false</code>, so layout
- * manager caches can be retained.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeSize
- */
-public void pack (boolean changed) {
- checkWidget ();
- setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
-}
-
-/**
- * Causes the entire bounds of the receiver to be marked
- * as needing to be redrawn. The next time a paint request
- * is processed, the control will be completely painted.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw () {
- checkWidget ();
- if (!OS.IsWindowVisible (handle)) return;
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, null, 0, flags);
- }
-}
-
-/**
- * Causes the rectangular area of the receiver specified by
- * the arguments to be marked as needing to be redrawn.
- * The next time a paint request is processed, that area of
- * the receiver will be painted. If the <code>all</code> flag
- * is <code>true</code>, any children of the receiver which
- * intersect with the specified area will also paint their
- * intersecting areas. If the <code>all</code> flag is
- * <code>false</code>, the children will not be painted.
- *
- * @param x the x coordinate of the area to draw
- * @param y the y coordinate of the area to draw
- * @param width the width of the area to draw
- * @param height the height of the area to draw
- * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #update
- */
-public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget ();
- if (width <= 0 || height <= 0) return;
- if (!OS.IsWindowVisible (handle)) return;
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, rect, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, rect, 0, flags);
- }
-}
-
-void register () {
- WidgetTable.put (handle, this);
-}
-
-void releaseHandle () {
- handle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- if (OS.IsDBLocale) {
- OS.ImmAssociateContext (handle, 0);
- }
- if (toolTipText != null) {
- Shell shell = getShell ();
- shell.setToolTipText (handle, null);
- }
- toolTipText = null;
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- menu = null;
- deregister ();
- unsubclass ();
- parent = null;
- layoutData = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control gains or loses focus.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see FocusListener
- * @see #addFocusListener
- */
-public void removeFocusListener(FocusListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.FocusIn, listener);
- eventTable.unhook (SWT.FocusOut, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when keys are pressed and released on the system keyboard.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see KeyListener
- * @see #addKeyListener
- */
-public void removeKeyListener(KeyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.KeyUp, listener);
- eventTable.unhook (SWT.KeyDown, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse passes or hovers over controls.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseTrackListener
- * @see #addMouseTrackListener
- */
-public void removeMouseTrackListener(MouseTrackListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseEnter, listener);
- eventTable.unhook (SWT.MouseExit, listener);
- eventTable.unhook (SWT.MouseHover, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when mouse buttons are pressed and released.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseListener
- * @see #addMouseListener
- */
-public void removeMouseListener (MouseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseDown, listener);
- eventTable.unhook (SWT.MouseUp, listener);
- eventTable.unhook (SWT.MouseDoubleClick, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the mouse moves.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MouseMoveListener
- * @see #addMouseMoveListener
- */
-public void removeMouseMoveListener(MouseMoveListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.MouseMove, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver needs to be painted.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see PaintListener
- * @see #addPaintListener
- */
-public void removePaintListener(PaintListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook(SWT.Paint, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when traversal events occur.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TraverseListener
- * @see #addTraverseListener
- */
-public void removeTraverseListener(TraverseListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Traverse, listener);
-}
-
-boolean sendKeyEvent (int type, int msg, int wParam, int lParam) {
- Event event = new Event ();
- if (!setKeyState (event, type)) return true;
- return sendKeyEvent (type, msg, wParam, lParam, event);
-}
-
-boolean sendKeyEvent (int type, int msg, int wParam, int lParam, Event event) {
- postEvent (type, event);
- return true;
-}
-
-boolean sendMouseEvent (int type, int button, int msg, int wParam, int lParam) {
- Event event = new Event ();
- event.button = button;
- event.x = (short) (lParam & 0xFFFF);
- event.y = (short) (lParam >> 16);
- if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
- if ((wParam & OS.MK_SHIFT) != 0) event.stateMask |= SWT.SHIFT;
- if ((wParam & OS.MK_CONTROL) != 0) event.stateMask |= SWT.CONTROL;
- if ((wParam & OS.MK_LBUTTON) != 0) event.stateMask |= SWT.BUTTON1;
- if ((wParam & OS.MK_MBUTTON) != 0) event.stateMask |= SWT.BUTTON2;
- if ((wParam & OS.MK_RBUTTON) != 0) event.stateMask |= SWT.BUTTON3;
- switch (type) {
- case SWT.MouseDown:
- case SWT.MouseDoubleClick:
- if (button == 1) event.stateMask &= ~SWT.BUTTON1;
- if (button == 2) event.stateMask &= ~SWT.BUTTON2;
- if (button == 3) event.stateMask &= ~SWT.BUTTON3;
- break;
- case SWT.MouseUp:
- if (button == 1) event.stateMask |= SWT.BUTTON1;
- if (button == 2) event.stateMask |= SWT.BUTTON2;
- if (button == 3) event.stateMask |= SWT.BUTTON3;
- break;
- }
- return sendMouseEvent (type, msg, wParam, lParam, event);
-}
-
-boolean sendMouseEvent (int type, int msg, int wParam, int lParam, Event event) {
- postEvent (type, event);
- return true;
-}
-
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- checkWidget ();
- int pixel = -1;
- if (color != null) {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- pixel = color.handle;
- }
- setBackgroundPixel (pixel);
-}
-
-void setBackgroundPixel (int pixel) {
- if (background == pixel) return;
- background = pixel;
- OS.InvalidateRect (handle, null, true);
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the arguments. The <code>x</code> and
- * <code>y</code> arguments are relative to the receiver's
- * parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (int x, int y, int width, int height) {
- checkWidget ();
- setBounds (x, y, Math.max (0, width), Math.max (0, height), 0);
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- flags |= OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- if (parent == null) {
- OS.SetWindowPos (handle, 0, x, y, width, height, flags);
- return;
- }
- int count = parent.getChildrenCount ();
- if (parent.hdwp == 0) {
- if (count > 1) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.WS_CLIPSIBLINGS) == 0) flags |= OS.SWP_NOCOPYBITS;
- }
- OS.SetWindowPos (handle, 0, x, y, width, height, flags);
- return;
- }
- int hdwp = OS.DeferWindowPos (parent.hdwp, handle, 0, x, y, width, height, flags);
- if (hdwp == 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- if (count > 1) hdwp = OS.BeginDeferWindowPos (count);
- }
- parent.hdwp = hdwp;
-}
-
-/**
- * Sets the receiver's size and location to the rectangular
- * area specified by the argument. The <code>x</code> and
- * <code>y</code> fields of the rectangle are relative to
- * the receiver's parent (or its display if its parent is null).
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param rect the new bounds for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBounds (Rectangle rect) {
- checkWidget ();
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBounds (rect.x, rect.y, rect.width, rect.height);
-}
-
-/**
- * If the argument is <code>true</code>, causes the receiver to have
- * all mouse events delivered to it until the method is called with
- * <code>false</code> as the argument.
- *
- * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCapture (boolean capture) {
- checkWidget ();
- if (capture) {
- OS.SetCapture (handle);
- } else {
- if (OS.GetCapture () == handle) {
- OS.ReleaseCapture ();
- }
- }
-}
-
-/**
- * Sets the receiver's cursor to the cursor specified by the
- * argument, or to the default cursor for that kind of control
- * if the argument is null.
- * <p>
- * When the mouse pointer passes over a control its appearance
- * is changed to match the control's cursor.
- * </p>
- *
- * @param cursor the new cursor (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCursor (Cursor cursor) {
- checkWidget ();
- hCursor = 0;
- if (cursor != null) {
- if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- hCursor = cursor.handle;
- }
- int hwndCursor = OS.GetCapture ();
- if (hwndCursor == 0) {
- POINT pt = new POINT ();
- if (!OS.GetCursorPos (pt)) return;
- int hwnd = hwndCursor = OS.WindowFromPoint (pt);
- while (hwnd != 0 && hwnd != handle) {
- hwnd = OS.GetParent (hwnd);
- }
- if (hwnd == 0) return;
- }
- int lParam = OS.HTCLIENT | (OS.WM_MOUSEMOVE << 16);
- OS.SendMessage (hwndCursor, OS.WM_SETCURSOR, hwndCursor, lParam);
-}
-
-void setDefaultFont () {
- Display display = getDisplay ();
- int hFont = display.systemFont ();
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget ();
-
- /*
- * Feature in Windows. If the receiver has focus, disabling
- * the receiver causes no window to have focus. The fix is
- * to assign focus to the first ancestor window that takes
- * focus. If no window will take focus, set focus to the
- * desktop.
- */
- boolean fixFocus = false;
- if (!enabled) fixFocus = isFocusAncestor ();
- OS.EnableWindow (handle, enabled);
- if (fixFocus) fixFocus ();
-}
-
-/**
- * Causes the receiver to have the <em>keyboard focus</em>,
- * such that all keyboard events will be delivered to it.
- *
- * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #forceFocus
- */
-public boolean setFocus () {
- checkWidget ();
- return forceFocus ();
-}
-
-/**
- * Sets the font that the receiver will use to paint textual information
- * to the font specified by the argument, or to the default font for that
- * kind of control if the argument is null.
- *
- * @param font the new font (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setFont (Font font) {
- checkWidget ();
- int hFont = 0;
- if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- hFont = font.handle;
- }
- if (hFont == 0) hFont = defaultFont ();
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 1);
-}
-
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- *
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- checkWidget ();
- int pixel = -1;
- if (color != null) {
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- pixel = color.handle;
- }
- setForegroundPixel (pixel);
-}
-
-void setForegroundPixel (int pixel) {
- if (foreground == pixel) return;
- foreground = pixel;
- OS.InvalidateRect (handle, null, true);
-}
-
-boolean setInputState (Event event, int type) {
- if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
- if (OS.GetKeyState (OS.VK_SHIFT) < 0) event.stateMask |= SWT.SHIFT;
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) event.stateMask |= SWT.CONTROL;
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) event.stateMask |= SWT.BUTTON1;
- if (OS.GetKeyState (OS.VK_MBUTTON) < 0) event.stateMask |= SWT.BUTTON2;
- if (OS.GetKeyState (OS.VK_RBUTTON) < 0) event.stateMask |= SWT.BUTTON3;
- switch (type) {
- case SWT.KeyDown:
- case SWT.Traverse:
- if (event.keyCode == SWT.ALT) event.stateMask &= ~SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask &= ~SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask &= ~SWT.CONTROL;
- break;
- case SWT.KeyUp:
- if (event.keyCode == SWT.ALT) event.stateMask |= SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask |= SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask |= SWT.CONTROL;
- break;
- }
- return true;
-}
-
-boolean setKeyState (Event event, int type) {
- Display display = getDisplay ();
- if (display.lastAscii != 0) {
- event.character = mbcsToWcs ((char) display.lastAscii);
- }
- if (display.lastVirtual) {
- event.keyCode = Display.translateKey (display.lastKey);
- }
- if (event.keyCode == 0 && event.character == 0) {
- return false;
- }
- return setInputState (event, type);
-}
-
-/**
- * Sets the layout data associated with the receiver to the argument.
- *
- * @param layoutData the new layout data for the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayoutData (Object layoutData) {
- checkWidget ();
- this.layoutData = layoutData;
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget ();
- setBounds (x, y, 0, 0, OS.SWP_NOSIZE);
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the argument which is relative to the receiver's
- * parent (or its display if its parent is null).
- *
- * @param location the new location for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (Point location) {
- checkWidget ();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
-}
-
-/**
- * Sets the receiver's pop up menu to the argument.
- * All controls may optionally have a pop up
- * menu that is displayed when the user requests one for
- * the control. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pop up
- * menu is platform specific.
- *
- * @param menu the new pop up menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget ();
- if (menu != null) {
- if (menu.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.POP_UP) == 0) {
- error (SWT.ERROR_MENU_NOT_POP_UP);
- }
- if (menu.parent != menuShell ()) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
- this.menu = menu;
-}
-
-boolean setRadioFocus () {
- return false;
-}
-
-/**
- * If the argument is <code>false</code>, causes subsequent drawing
- * operations in the receiver to be ignored. No drawing of any kind
- * can occur in the receiver until the flag is set to true.
- * Graphics operations that occurred while the flag was
- * <code>false</code> are lost. When the flag is set to <code>true</code>,
- * the entire widget is marked as needing to be redrawn.
- * <p>
- * Note: This operation is a hint and may not be supported on some
- * platforms or for some widgets.
- * </p>
- *
- * @param redraw the new redraw state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- * @see #update
- */
-public void setRedraw (boolean redraw) {
- checkWidget ();
- /*
- * This code is intentionally commented.
- *
- * Feature in Windows. When WM_SETREDRAW is used to turn
- * off drawing in a widget, it clears the WS_VISIBLE bits
- * and then sets them when redraw is turned back on. This
- * means that WM_SETREDRAW will make a widget unexpectedly
- * visible.
- *
- * There is no fix at this time.
- */
-// if (drawCount == 0) {
-// int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
-// if ((bits & OS.WS_VISIBLE) == 0) return;
-// }
-
- if (redraw) {
- if (--drawCount == 0) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
- }
- } else {
- if (drawCount++ == 0) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- }
-}
-
-/**
- * Sets the receiver's size to the point specified by the arguments.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause that
- * value to be set to zero instead.
- * </p>
- *
- * @param width the new width for the receiver
- * @param height the new height for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (int width, int height) {
- checkWidget ();
- setBounds (0, 0, Math.max (0, width), Math.max (0, height), OS.SWP_NOMOVE);
-}
-
-/**
- * Sets the receiver's size to the point specified by the argument.
- * <p>
- * Note: Attempting to set the width or height of the
- * receiver to a negative number will cause them to be
- * set to zero instead.
- * </p>
- *
- * @param size the new size for the receiver
- * @param height the new height for the receiver
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSize (Point size) {
- checkWidget ();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-boolean setTabGroupFocus () {
- return setTabItemFocus ();
-}
-
-boolean setTabItemFocus () {
- if (!isShowing ()) return false;
- return setFocus ();
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget ();
- Shell shell = getShell ();
- shell.setToolTipText (handle, toolTipText = string);
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if (((bits & OS.WS_VISIBLE) != 0) == visible) return;
- if (visible) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the show
- * event. If this happens, just return.
- */
- sendEvent (SWT.Show);
- if (isDisposed ()) return;
- }
-
- /*
- * Feature in Windows. If the receiver has focus, hiding
- * the receiver causes no window to have focus. The fix is
- * to assign focus to the first ancestor window that takes
- * focus. If no window will take focus, set focus to the
- * desktop.
- */
-// boolean fixFocus = false;
-// if (!visible) fixFocus = isFocusAncestor ();
- OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE);
- if (!visible) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the show
- * event. If this happens, just return.
- */
- sendEvent (SWT.Hide);
- if (isDisposed ()) return;
- }
-// if (fixFocus) fixFocus ();
-}
-
-void sort (int [] items) {
- /* Shell Sort from K&R, pg 108 */
- int length = items.length;
- for (int gap=length/2; gap>0; gap/=2) {
- for (int i=gap; i<length; i++) {
- for (int j=i-gap; j>=0; j-=gap) {
- if (items [j] <= items [j + gap]) {
- int swap = items [j];
- items [j] = items [j + gap];
- items [j + gap] = swap;
- }
- }
- }
- }
-}
-
-void subclass () {
- int oldProc = windowProc ();
- int newProc = getDisplay ().windowProc;
- if (oldProc == newProc) return;
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, newProc);
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in display relative coordinates,
- * to coordinates relative to the receiver.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toControl (Point point) {
- checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- POINT pt = new POINT ();
- pt.x = point.x; pt.y = point.y;
- OS.ScreenToClient (handle, pt);
- return new Point (pt.x, pt.y);
-}
-
-/**
- * Returns a point which is the result of converting the
- * argument, which is specified in coordinates relative to
- * the receiver, to display relative coordinates.
- * <p>
- * @param point the point to be translated (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point toDisplay (Point point) {
- checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- POINT pt = new POINT ();
- pt.x = point.x; pt.y = point.y;
- OS.ClientToScreen (handle, pt);
- return new Point (pt.x, pt.y);
-}
-
-boolean translateAccelerator (MSG msg) {
- return menuShell ().translateAccelerator (msg);
-}
-
-boolean translateMnemonic (char key) {
- if (!isVisible () || !isEnabled ()) return false;
- Event event = new Event ();
- event.doit = mnemonicMatch (key);
- event.detail = SWT.TRAVERSE_MNEMONIC;
- Display display = getDisplay ();
- display.lastVirtual = false;
- display.lastKey = 0;
- display.lastAscii = key;
- if (!setKeyState (event, SWT.Traverse)) {
- return false;
- }
- return traverse (event);
-}
-
-boolean translateMnemonic (MSG msg) {
- int hwnd = msg.hwnd;
- if (OS.GetKeyState (OS.VK_MENU) >= 0) {
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & OS.DLGC_WANTALLKEYS) != 0) return false;
- if ((code & OS.DLGC_BUTTON) == 0) return false;
- }
- Decorations shell = menuShell ();
- if (shell.isVisible () && shell.isEnabled ()) {
- char ch = mbcsToWcs ((char) msg.wParam);
- return ch != 0 && shell.translateMnemonic (ch);
- }
- return false;
-}
-
-boolean translateTraversal (MSG msg) {
- int hwnd = msg.hwnd;
- int key = msg.wParam;
- int detail = SWT.TRAVERSE_NONE;
- boolean doit = true, all = false;
- boolean lastVirtual = false;
- int lastKey = key, lastAscii = 0;
- switch (key) {
- case OS.VK_ESCAPE: {
- lastAscii = 27;
- Shell shell = getShell ();
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & OS.DLGC_WANTALLKEYS) != 0) doit = false;
- if (shell.parent == null) doit = false;
- detail = SWT.TRAVERSE_ESCAPE;
- break;
- }
- case OS.VK_RETURN: {
- lastAscii = '\r';
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & OS.DLGC_WANTALLKEYS) != 0) doit = false;
- detail = SWT.TRAVERSE_RETURN;
- break;
- }
- case OS.VK_TAB: {
- /*
- * NOTE: This code causes Shift+Tab and Ctrl+Tab to
- * always attempt traversal which is not the correct.
- * This behavior is currently relied on by StyledText.
- */
- lastAscii = '\t';
- boolean next = OS.GetKeyState (OS.VK_SHIFT) >= 0;
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & (OS.DLGC_WANTTAB | OS.DLGC_WANTALLKEYS)) != 0) {
- if (next && OS.GetKeyState (OS.VK_CONTROL) >= 0) doit = false;
- }
- detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
- break;
- }
- case OS.VK_UP:
- case OS.VK_LEFT:
- case OS.VK_DOWN:
- case OS.VK_RIGHT: {
- lastVirtual = true;
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & (OS.DLGC_WANTARROWS /*| OS.DLGC_WANTALLKEYS*/)) != 0) doit = false;
- boolean next = key == OS.VK_DOWN || key == OS.VK_RIGHT;
- detail = next ? SWT.TRAVERSE_ARROW_NEXT : SWT.TRAVERSE_ARROW_PREVIOUS;
- break;
- }
- case OS.VK_PRIOR:
- case OS.VK_NEXT: {
- all = true;
- lastVirtual = true;
- if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return false;
- int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
- if ((code & OS.DLGC_WANTALLKEYS) != 0) doit = false;
- detail = key == OS.VK_PRIOR ? SWT.TRAVERSE_PAGE_PREVIOUS : SWT.TRAVERSE_PAGE_NEXT;
- break;
- }
- default:
- return false;
- }
- Event event = new Event ();
- event.doit = doit;
- event.detail = detail;
- Display display = getDisplay ();
- display.lastKey = lastKey;
- display.lastAscii = lastAscii;
- display.lastVirtual = lastVirtual;
- if (!setKeyState (event, SWT.Traverse)) {
- return false;
- }
- Shell shell = getShell ();
- Control control = this;
- do {
- if (control.traverse (event)) return true;
- if (control == shell) return false;
- control = control.parent;
- } while (all && control != null);
- return false;
-}
-
-boolean traverse (Event event) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the traverse
- * event. If this happens, return true to stop further
- * event processing.
- */
- sendEvent (SWT.Traverse, event);
- if (isDisposed ()) return false;
- if (!event.doit) return false;
- switch (event.detail) {
- case SWT.TRAVERSE_NONE: return true;
- case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
- case SWT.TRAVERSE_RETURN: return traverseReturn ();
- case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true);
- case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false);
- case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
- case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
- case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character);
- case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true);
- case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false);
- }
- return false;
-}
-
-/**
- * Based on the argument, perform one of the expected platform
- * traversal action. The argument should be one of the constants:
- * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
- * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
- * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
- *
- * @param traversal the type of traversal
- * @return true if the traversal succeeded
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean traverse (int traversal) {
- checkWidget ();
- if (!isFocusControl () && !setFocus ()) return false;
- Event event = new Event ();
- event.doit = true;
- event.detail = traversal;
- return traverse (event);
-}
-
-boolean traverseEscape () {
- Shell shell = getShell ();
- if (shell.parent == null) return false;
- if (!shell.isVisible () || !shell.isEnabled ()) return false;
- shell.close ();
- return true;
-}
-
-boolean traverseGroup (boolean next) {
- Control root = computeTabRoot ();
- Control group = computeTabGroup ();
- Control [] list = root.computeTabList ();
- int length = list.length;
- int index = 0;
- while (index < length) {
- if (list [index] == group) break;
- index++;
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in focus in
- * or out events. Ensure that a disposed widget is
- * not accessed.
- */
- if (index == length) return false;
- int start = index, offset = (next) ? 1 : -1;
- while ((index = ((index + offset + length) % length)) != start) {
- Control control = list [index];
- if (!control.isDisposed () && control.setTabGroupFocus ()) {
- if (!isDisposed () && !isFocusControl ()) return true;
- }
- }
- if (group.isDisposed ()) return false;
- return group.setTabGroupFocus ();
-}
-
-boolean traverseItem (boolean next) {
- Control [] children = parent._getChildren ();
- int length = children.length;
- int index = 0;
- while (index < length) {
- if (children [index] == this) break;
- index++;
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in focus in
- * or out events. Ensure that a disposed widget is
- * not accessed.
- */
- int start = index, offset = (next) ? 1 : -1;
- while ((index = (index + offset + length) % length) != start) {
- Control child = children [index];
- if (!child.isDisposed () && child.isTabItem ()) {
- if (child.setTabItemFocus ()) return true;
- }
- }
- return false;
-}
-
-boolean traverseMnemonic (char key) {
- return mnemonicHit (key);
-}
-
-boolean traversePage (boolean next) {
- return false;
-}
-
-boolean traverseReturn () {
- Button button = menuShell ().getDefaultButton ();
- if (button == null || button.isDisposed ()) return false;
- if (!button.isVisible () || !button.isEnabled ()) return false;
- button.click ();
- return true;
-}
-
-void unsubclass () {
- int newProc = windowProc ();
- int oldProc = getDisplay ().windowProc;
- if (oldProc == newProc) return;
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, newProc);
-}
-
-/**
- * Forces all outstanding paint requests for the widget tree
- * to be processed before this method returns.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #redraw
- */
-public void update () {
- checkWidget ();
- if (OS.IsWinCE) {
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
-}
-
-void updateFont (Font oldFont, Font newFont) {
- Font font = getFont ();
- if (font.equals (oldFont)) setFont (newFont);
-}
-
-int widgetExtStyle () {
- if ((style & SWT.BORDER) != 0) return OS.WS_EX_CLIENTEDGE;
- return 0;
-}
-
-int widgetStyle () {
- /* Force strict clipping by setting WS_CLIPSIBLINGS */
- return OS.WS_CHILD | OS.WS_VISIBLE | OS.WS_CLIPSIBLINGS;
-
- /*
- * This code is intentionally commented. When strict
- * clipping (clipping of both siblings and children)
- * was not enforced on all widgets, poorly written
- * application code could draw outside of the control.
- */
-// int bits = OS.WS_CHILD | OS.WS_VISIBLE;
-// if ((style & SWT.CLIP_SIBLINGS) != 0) bits |= OS.WS_CLIPSIBLINGS;
-// if ((style & SWT.CLIP_CHILDREN) != 0) bits |= OS.WS_CLIPCHILDREN;
-// return bits;
-}
-
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers <code>true</code> if the parent is successfully changed.
- *
- * @param parent the new parent for the control.
- * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-public boolean setParent (Composite parent) {
- checkWidget ();
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (OS.SetParent (handle, parent.handle) == 0) {
- return false;
- }
- this.parent = parent;
- return true;
-}
-
-abstract TCHAR windowClass ();
-
-abstract int windowProc ();
-
-int windowProc (int msg, int wParam, int lParam) {
- LRESULT result = null;
- switch (msg) {
- case OS.WM_ACTIVATE: result = WM_ACTIVATE (wParam, lParam); break;
- case OS.WM_CHAR: result = WM_CHAR (wParam, lParam); break;
- case OS.WM_CLEAR: result = WM_CLEAR (wParam, lParam); break;
- case OS.WM_CLOSE: result = WM_CLOSE (wParam, lParam); break;
- case OS.WM_COMMAND: result = WM_COMMAND (wParam, lParam); break;
- case OS.WM_CONTEXTMENU: result = WM_CONTEXTMENU (wParam, lParam); break;
- case OS.WM_CTLCOLORBTN:
- case OS.WM_CTLCOLORDLG:
- case OS.WM_CTLCOLOREDIT:
- case OS.WM_CTLCOLORLISTBOX:
- case OS.WM_CTLCOLORMSGBOX:
- case OS.WM_CTLCOLORSCROLLBAR:
- case OS.WM_CTLCOLORSTATIC: result = WM_CTLCOLOR (wParam, lParam); break;
- case OS.WM_CUT: result = WM_CUT (wParam, lParam); break;
- case OS.WM_DESTROY: result = WM_DESTROY (wParam, lParam); break;
- case OS.WM_DRAWITEM: result = WM_DRAWITEM (wParam, lParam); break;
- case OS.WM_ERASEBKGND: result = WM_ERASEBKGND (wParam, lParam); break;
- case OS.WM_GETDLGCODE: result = WM_GETDLGCODE (wParam, lParam); break;
- case OS.WM_HELP: result = WM_HELP (wParam, lParam); break;
- case OS.WM_HSCROLL: result = WM_HSCROLL (wParam, lParam); break;
- case OS.WM_IME_CHAR: result = WM_IME_CHAR (wParam, lParam); break;
- case OS.WM_IME_COMPOSITION: result = WM_IME_COMPOSITION (wParam, lParam); break;
- case OS.WM_INITMENUPOPUP: result = WM_INITMENUPOPUP (wParam, lParam); break;
- case OS.WM_GETFONT: result = WM_GETFONT (wParam, lParam); break;
- case OS.WM_KEYDOWN: result = WM_KEYDOWN (wParam, lParam); break;
- case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break;
- case OS.WM_KILLFOCUS: result = WM_KILLFOCUS (wParam, lParam); break;
- case OS.WM_LBUTTONDBLCLK: result = WM_LBUTTONDBLCLK (wParam, lParam); break;
- case OS.WM_LBUTTONDOWN: result = WM_LBUTTONDOWN (wParam, lParam); break;
- case OS.WM_LBUTTONUP: result = WM_LBUTTONUP (wParam, lParam); break;
- case OS.WM_MBUTTONDBLCLK: result = WM_MBUTTONDBLCLK (wParam, lParam); break;
- case OS.WM_MBUTTONDOWN: result = WM_MBUTTONDOWN (wParam, lParam); break;
- case OS.WM_MBUTTONUP: result = WM_MBUTTONUP (wParam, lParam); break;
- case OS.WM_MEASUREITEM: result = WM_MEASUREITEM (wParam, lParam); break;
- case OS.WM_MENUCHAR: result = WM_MENUCHAR (wParam, lParam); break;
- case OS.WM_MENUSELECT: result = WM_MENUSELECT (wParam, lParam); break;
- case OS.WM_MOUSEACTIVATE: result = WM_MOUSEACTIVATE (wParam, lParam); break;
- case OS.WM_MOUSEHOVER: result = WM_MOUSEHOVER (wParam, lParam); break;
- case OS.WM_MOUSELEAVE: result = WM_MOUSELEAVE (wParam, lParam); break;
- case OS.WM_MOUSEMOVE: result = WM_MOUSEMOVE (wParam, lParam); break;
- case OS.WM_MOUSEWHEEL: result = WM_MOUSEWHEEL (wParam, lParam); break;
- case OS.WM_MOVE: result = WM_MOVE (wParam, lParam); break;
- case OS.WM_NCACTIVATE: result = WM_NCACTIVATE (wParam, lParam); break;
- case OS.WM_NCCALCSIZE: result = WM_NCCALCSIZE (wParam, lParam); break;
- case OS.WM_NCHITTEST: result = WM_NCHITTEST (wParam, lParam); break;
- case OS.WM_NOTIFY: result = WM_NOTIFY (wParam, lParam); break;
- case OS.WM_PAINT: result = WM_PAINT (wParam, lParam); break;
- case OS.WM_PALETTECHANGED: result = WM_PALETTECHANGED (wParam, lParam); break;
- case OS.WM_PASTE: result = WM_PASTE (wParam, lParam); break;
- case OS.WM_QUERYNEWPALETTE: result = WM_QUERYNEWPALETTE (wParam, lParam); break;
- case OS.WM_QUERYOPEN: result = WM_QUERYOPEN (wParam, lParam); break;
- case OS.WM_RBUTTONDBLCLK: result = WM_RBUTTONDBLCLK (wParam, lParam); break;
- case OS.WM_RBUTTONDOWN: result = WM_RBUTTONDOWN (wParam, lParam); break;
- case OS.WM_RBUTTONUP: result = WM_RBUTTONUP (wParam, lParam); break;
- case OS.WM_SETCURSOR: result = WM_SETCURSOR (wParam, lParam); break;
- case OS.WM_SETFOCUS: result = WM_SETFOCUS (wParam, lParam); break;
- case OS.WM_SETFONT: result = WM_SETFONT (wParam, lParam); break;
- case OS.WM_SETTINGCHANGE: result = WM_SETTINGCHANGE (wParam, lParam); break;
- case OS.WM_SHOWWINDOW: result = WM_SHOWWINDOW (wParam, lParam); break;
- case OS.WM_SIZE: result = WM_SIZE (wParam, lParam); break;
- case OS.WM_SYSCHAR: result = WM_SYSCHAR (wParam, lParam); break;
- case OS.WM_SYSCOLORCHANGE: result = WM_SYSCOLORCHANGE (wParam, lParam); break;
- case OS.WM_SYSCOMMAND: result = WM_SYSCOMMAND (wParam, lParam); break;
- case OS.WM_SYSKEYDOWN: result = WM_SYSKEYDOWN (wParam, lParam); break;
- case OS.WM_SYSKEYUP: result = WM_SYSKEYUP (wParam, lParam); break;
- case OS.WM_TIMER: result = WM_TIMER (wParam, lParam); break;
- case OS.WM_UNDO: result = WM_UNDO (wParam, lParam); break;
- case OS.WM_VSCROLL: result = WM_VSCROLL (wParam, lParam); break;
- case OS.WM_WINDOWPOSCHANGING: result = WM_WINDOWPOSCHANGING (wParam, lParam); break;
- }
- if (result != null) return result.value;
- return callWindowProc (msg, wParam, lParam);
-}
-
-LRESULT WM_ACTIVATE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_CHAR (int wParam, int lParam) {
-
- /*
- * Do not report a lead byte as a key pressed.
- */
- Display display = getDisplay ();
- if (!OS.IsUnicode && OS.IsDBLocale) {
- byte lead = (byte) (wParam & 0xFF);
- if (OS.IsDBCSLeadByte (lead)) return null;
- }
-
- /*
- * Use VkKeyScan () to tell us if the character is a control
- * or a numeric key pad character with Num Lock down. On
- * international keyboards, the control key may be down when
- * the character is not a control character. In this case
- * use the last key (computed in WM_KEYDOWN) instead of wParam
- * as the keycode because there is not enough information to
- * compute the keycode in WPARAM.
- */
- display.lastAscii = wParam;
- if (display.lastKey == 0) {
- display.lastKey = wParam;
- display.lastVirtual = display.isVirtualKey (wParam);
- } else {
- int result = OS.IsWinCE ? 0 : OS.VkKeyScan ((short) wParam);
- if (!OS.IsWinCE && (result == -1 || (result >> 8) <= 2)) {
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
- display.lastVirtual = display.isVirtualKey (display.lastKey);
- }
- } else {
- display.lastKey = wParam;
- display.lastVirtual = false;
- }
- }
- if (!sendKeyEvent (SWT.KeyDown, OS.WM_CHAR, wParam, lParam)) {
- return LRESULT.ZERO;
- }
- return null;
-}
-
-LRESULT WM_CLEAR (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_CLOSE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_COMMAND (int wParam, int lParam) {
- /*
- * When the WM_COMMAND message is sent from a
- * menu, the HWND parameter in LPARAM is zero.
- */
- if (lParam == 0) {
- Decorations shell = menuShell ();
- if (shell.isEnabled ()) {
- int id = wParam & 0xFFFF;
- MenuItem item = shell.findMenuItem (id);
- if (item != null && item.isEnabled ()) {
- return item.wmCommandChild (wParam, lParam);
- }
- }
- return null;
- }
- Control control = WidgetTable.get (lParam);
- if (control == null) return null;
- return control.wmCommandChild (wParam, lParam);
-}
-
-LRESULT WM_CONTEXTMENU (int wParam, int lParam) {
- /*
- * Because context menus can be shared between controls
- * and the parent of all menus is the shell, the menu may
- * have been destroyed but not removed from the control.
- */
- if (menu == null || menu.isDisposed ()) return null;
- menu.setVisible (true);
- return LRESULT.ZERO;
-}
-
-LRESULT WM_CTLCOLOR (int wParam, int lParam) {
- Display display = getDisplay ();
- int hPalette = display.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette (wParam, hPalette, false);
- OS.RealizePalette (wParam);
- }
- Control control = WidgetTable.get (lParam);
- if (control == null) return null;
- return control.wmColorChild (wParam, lParam);
-}
-
-LRESULT WM_CUT (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_DESTROY (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_DRAWITEM (int wParam, int lParam) {
- DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
- if (struct.CtlType == OS.ODT_MENU) {
- Decorations shell = menuShell ();
- MenuItem item = shell.findMenuItem (struct.itemID);
- if (item == null) return null;
- return item.wmDrawChild (wParam, lParam);
- }
- Control control = WidgetTable.get (struct.hwndItem);
- if (control == null) return null;
- return control.wmDrawChild (wParam, lParam);
-}
-
-LRESULT WM_ERASEBKGND (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_GETFONT (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_HELP (int wParam, int lParam) {
- if (OS.IsWinCE) return null;
- HELPINFO lphi = new HELPINFO ();
- OS.MoveMemory (lphi, lParam, HELPINFO.sizeof);
- Decorations shell = menuShell ();
- if (!shell.isEnabled ()) return null;
- if (lphi.iContextType == OS.HELPINFO_MENUITEM) {
- MenuItem item = shell.findMenuItem (lphi.iCtrlId);
- if (item != null && item.isEnabled ()) {
- Widget widget = null;
- if (item.hooks (SWT.Help)) {
- widget = item;
- } else {
- Menu menu = item.parent;
- if (menu.hooks (SWT.Help)) widget = menu;
- }
- if (widget != null) {
- int hwndShell = shell.handle;
- OS.SendMessage (hwndShell, OS.WM_CANCELMODE, 0, 0);
- widget.postEvent (SWT.Help);
- return LRESULT.ONE;
- }
- }
- return null;
- }
- if (hooks (SWT.Help)) {
- postEvent (SWT.Help);
- return LRESULT.ONE;
- }
- return null;
-}
-
-LRESULT WM_HSCROLL (int wParam, int lParam) {
- if (lParam == 0) return null;
- Control control = WidgetTable.get (lParam);
- if (control == null) return null;
- return control.wmScrollChild (wParam, lParam);
-}
-
-LRESULT WM_IME_CHAR (int wParam, int lParam) {
- Display display = getDisplay ();
- display.lastKey = 0;
- display.lastAscii = wParam;
- display.lastVirtual = false;
- sendKeyEvent (SWT.KeyDown, OS.WM_IME_CHAR, wParam, lParam);
- sendKeyEvent (SWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam);
- display.lastKey = display.lastAscii = 0;
- return LRESULT.ZERO;
-}
-
-LRESULT WM_IME_COMPOSITION (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_INITMENUPOPUP (int wParam, int lParam) {
-
- /* Ignore WM_INITMENUPOPUP for an accelerator */
- Display display = getDisplay ();
- if (display.accelKeyHit) return null;
-
- /*
- * If the high order word of LPARAM is non-zero,
- * the menu is the system menu and we can ignore
- * WPARAM. Otherwise, use WPARAM to find the menu.
- */
- Shell shell = getShell ();
- Menu oldMenu = shell.activeMenu, newMenu = null;
- if ((lParam >> 16) == 0) {
- newMenu = menuShell ().findMenu (wParam);
- }
- Menu menu = newMenu;
- while (menu != null && menu != oldMenu) {
- menu = menu.getParentMenu ();
- }
- if (menu == null) {
- menu = shell.activeMenu;
- while (menu != null) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the hide
- * event. If this happens, stop searching up the
- * ancestor list because there is no longer a link
- * to follow.
- */
- menu.sendEvent (SWT.Hide);
- if (menu.isDisposed ()) break;
- menu = menu.getParentMenu ();
- Menu ancestor = newMenu;
- while (ancestor != null && ancestor != menu) {
- ancestor = ancestor.getParentMenu ();
- }
- if (ancestor != null) break;
- }
- }
-
- /*
- * The shell and the new menu may be disposed because of
- * sending the hide event to the ancestor menus but setting
- * a field to null in a disposed shell is not harmful.
- */
- if (newMenu != null && newMenu.isDisposed ()) newMenu = null;
- shell.activeMenu = newMenu;
-
- /*
- * Send the show event
- */
- if (newMenu != null && newMenu != oldMenu) {
- /*
- * SWT.Selection events are posted to allow stepping
- * in the VA/Java debugger. SWT.Show events are
- * sent to ensure that application event handler
- * code runs before the menu is displayed. This
- * means that SWT.Show events would normally occur
- * before SWT.Selection events. While this is not
- * strictly incorrect, applications often use the
- * SWT.Selection event to update the state of menu
- * items and would like the ordering of events to
- * be the other way around.
- *
- * The fix is to run the deferred events before
- * the menu is shown. This means that stepping
- * through a selection event that was caused by
- * a popup menu will fail in VA/Java.
- */
- display.runDeferredEvents ();
- newMenu.sendEvent (SWT.Show);
- // widget could be disposed at this point
- }
- return null;
-}
-
-LRESULT WM_KEYDOWN (int wParam, int lParam) {
-
- /*
- * Do not report a lead byte as a key pressed.
- */
- Display display = getDisplay ();
- if (!OS.IsUnicode && OS.IsDBLocale) {
- byte lead = (byte) (wParam & 0xFF);
- if (OS.IsDBCSLeadByte (lead)) {
- display.lastAscii = display.lastKey = 0;
- display.lastVirtual = false;
- return null;
- }
- }
-
- /* Ignore repeating modifier keys by testing key down state */
- if ((wParam == OS.VK_SHIFT) || (wParam == OS.VK_MENU) ||
- (wParam == OS.VK_CONTROL) || (wParam == OS.VK_CAPITAL) ||
- (wParam == OS.VK_NUMLOCK) || (wParam == OS.VK_SCROLL)) {
- if ((lParam & 0x40000000) != 0) return null;
- }
-
- /* Set last key and clear last ascii because a new key has been typed */
- display.lastAscii = 0;
- display.lastKey = wParam;
-
- /* Map the virtual key */
- int mapKey = OS.MapVirtualKey (display.lastKey, 2);
-
- /*
- * Bug in Windows 95 and NT. When the user types an accent key such
- * as ^ to get an accented character on a German keyboard, the accent
- * key should be ignored and the next key that the user types is the
- * accented key. On Windows 95 and NT, a call to ToAscii (), clears the
- * accented state such that the next WM_CHAR loses the accent. The fix
- * is to detect the accent key stroke (called a dead key) by testing the
- * high bit of the value returned by MapVirtualKey (). A further problem
- * is that the high bit on Windows NT is bit 32 while the high bit on
- * Windows 95 is bit 16. They should both be bit 32.
- */
- if (OS.IsWinNT) {
- if ((mapKey & 0x80000000) != 0) return null;
- } else {
- if ((mapKey & 0x8000) != 0) return null;
- }
-
- /*
- * If we are going to get a WM_CHAR, ensure that last key has
- * the correct character value for the key down and key up
- * events. It is not sufficient to ignore the WM_KEYDOWN
- * (when we know we are going to get a WM_CHAR) and compute
- * the key in WM_CHAR because there is not enough information
- * by the time we get the WM_CHAR. For example, when the user
- * types Ctrl+Shift+6 on a US keyboard, we get a WM_CHAR with
- * wParam=30. When the user types Ctrl+Shift+6 on a German
- * keyboard, we also get a WM_CHAR with wParam=30. On the US
- * keyboard Shift+6 is ^, on the German keyboard Shift+6 is &.
- * There is no way to map wParam=30 in WM_CHAR to the correct
- * value. Also, on international keyboards, the control key
- * may be down when the user has not entered a control character.
- */
- display.lastVirtual = (mapKey == 0);
- if (display.lastVirtual) {
- /*
- * Feature in Windows. The virtual key VK_DELETE is not
- * treated as both a virtual key and an ASCII key by Windows.
- * Therefore, we will not receive a WM_CHAR for this key.
- * The fix is to treat VK_DELETE as a special case and map
- * the ASCII value explictly (Delete is 127).
- */
- if (display.lastKey == OS.VK_DELETE) display.lastAscii = 127;
- /*
- * It is possible to get a WM_CHAR for a virtual key when
- * Num Lock is on. If the user types Home while Num Lock
- * is down, a WM_CHAR is issued with WPARM=55 (for the
- * character 7). If we are going to get a WM_CHAR we need
- * to ensure that the last key has the correct value. Note
- * that Ctrl+Home does not issue a WM_CHAR when Num Lock is
- * down.
- */
- if (OS.VK_NUMPAD0 <= display.lastKey && display.lastKey <= OS.VK_DIVIDE) {
- if (display.asciiKey (display.lastKey) != 0) return null;
- }
- } else {
- /*
- * Get the shifted state or convert to lower case if necessary.
- * If the user types Ctrl+A, LastKey should be $a, not $A. If
- * the user types Ctrl+Shift+A, LastKey should be $A. If the user
- * types Ctrl+Shift+6, the value of LastKey will depend on the
- * international keyboard.
- */
- if (OS.GetKeyState (OS.VK_SHIFT) < 0) {
- display.lastKey = display.shiftedKey (display.lastKey);
- if (display.lastKey == 0) display.lastKey = wParam;
- } else {
- display.lastKey = OS.CharLower ((short) mapKey);
- }
- /*
- * Some key combinations map to Windows ASCII keys depending
- * on the keyboard. For example, Ctrl+Alt+Q maps to @ on a
- * German keyboard. If the current key combination is special,
- * the correct character is placed in wParam for processing in
- * WM_CHAR. If this is the case, issue the key down event from
- * inside WM_CHAR.
- */
- int newKey = display.asciiKey (wParam);
- if (newKey != 0) {
- /*
- * When the user types Ctrl+Space, ToAscii () maps this to
- * Space. Normally, ToAscii () maps a key to a different
- * key if both a WM_KEYDOWN and a WM_CHAR will be issued.
- * To avoid the extra OSxKeyDown, look for VK_SPACE and
- * issue the event from WM_CHAR.
- */
- if (newKey == OS.VK_SPACE) {
- display.lastVirtual = true;
- return null;
- }
- if (newKey != wParam) return null;
- }
-
- /*
- * If the control key is not down at this point, then
- * the key that was pressed was an accent key. In that
- * case, do not issue the key down event.
- */
- if (OS.GetKeyState (OS.VK_CONTROL) >= 0) {
- display.lastKey = 0;
- return null;
- }
-
- /*
- * Virtual keys such as VK_RETURN are both virtual and ASCII keys.
- * Normally, these are marked virtual in WM_CHAR. Since we will not
- * be getting a WM_CHAR for the key at this point, we need to test LastKey
- * to see if it is virtual. This happens when the user types Ctrl+Tab.
- */
- display.lastVirtual = display.isVirtualKey (display.lastKey);
- display.lastAscii = display.controlKey (display.lastKey);
- }
- if (!sendKeyEvent (SWT.KeyDown, OS.WM_KEYDOWN, wParam, lParam)) {
- return LRESULT.ZERO;
- }
- return null;
-}
-
-LRESULT WM_KEYUP (int wParam, int lParam) {
- Display display = getDisplay ();
-
- /* Check for hardware keys */
- if (OS.IsWinCE) {
- if (OS.VK_APP1 <= wParam && wParam <= OS.VK_APP6) {
- display.lastVirtual = false;
- display.lastKey = display.lastAscii = 0;
- Event event = new Event ();
- event.detail = wParam - OS.VK_APP1 + 1;
- /* Check the bit 30 to get the key state */
- int type = (lParam & 0x40000000) != 0 ? SWT.HardKeyUp : SWT.HardKeyDown;
- if (setInputState (event, type)) sendEvent (type, event);
- return null;
- }
- }
-
- /*
- * If the key up is not hooked, reset last key
- * and last ascii in case the key down is hooked.
- */
- if (!hooks (SWT.KeyUp)) {
- display.lastVirtual = false;
- display.lastKey = display.lastAscii = 0;
- return null;
- }
-
- /* Map the virtual key. */
- int mapKey = OS.MapVirtualKey (wParam, 2);
-
- /*
- * Bug in Windows 95 and NT. When the user types an accent key such
- * as ^ to get an accented character on a German keyboard, the accent
- * key should be ignored and the next key that the user types is the
- * accented key. On Windows 95 and NT, a call to ToAscii(), clears the
- * accented state such that the next WM_CHAR loses the accent. The fix
- * is to detect the accent key stroke (called a dead key) by testing the
- * high bit of the value returned by MapVirtualKey(). A further problem
- * is that the high bit on Windows NT is bit 32 while the high bit on
- * Windows 95 is bit 16. They should both be bit 32.
- */
- if (OS.IsWinNT) {
- if ((mapKey & 0x80000000) != 0) return null;
- } else {
- if ((mapKey & 0x8000) != 0) return null;
- }
-
- display.lastVirtual = (mapKey == 0);
- if (display.lastVirtual) {
- display.lastKey = wParam;
- } else {
- if (display.lastKey == 0) {
- display.lastAscii = 0;
- return null;
- }
- display.lastVirtual = display.isVirtualKey (display.lastKey);
- }
-
- LRESULT result = null;
- if (!sendKeyEvent (SWT.KeyUp, OS.WM_KEYUP, wParam, lParam)) {
- result = LRESULT.ZERO;
- }
- display.lastVirtual = false;
- display.lastKey = display.lastAscii = 0;
- return result;
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- int code = callWindowProc (OS.WM_KILLFOCUS, wParam, lParam);
- Display display = getDisplay ();
- Shell shell = getShell ();
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the focus
- * out event. If this happens keep going to send
- * the deactivate events.
- */
- sendEvent (SWT.FocusOut);
- // widget could be disposed at this point
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
- if (!shell.isDisposed ()) {
- Control control = display.findControl (wParam);
- if (control == null || shell != control.getShell ()) {
- shell.setActiveControl (null);
- }
- }
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the focus
- * or deactivate events. If this happens, end the
- * processing of the Windows message by returning
- * zero as the result of the window proc.
- */
- if (isDisposed ()) return LRESULT.ZERO;
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. Windows sends the following
- * messages when the user double clicks the mouse:
- *
- * WM_LBUTTONDOWN - mouse down
- * WM_LBUTTONUP - mouse up
- * WM_LBUTTONDBLCLK - double click
- * WM_LBUTTONUP - mouse up
- *
- * Applications that expect matching mouse down/up
- * pairs will not see the second mouse down. The
- * fix is to send a mouse down event.
- */
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_LBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (OS.WM_LBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (result);
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- if (hooks (SWT.DragDetect)) {
- POINT pt = new POINT ();
- pt.x = (short) (lParam & 0xFFFF);
- pt.y = (short) (lParam >> 16);
- if (!OS.IsWinCE) {
- /*
- * The DragDetect function captures the mouse and tracks its movement until the user releases
- * the left button, presses the ESC key, or moves the mouse outside the drag rectangle around
- * the specified point. If the user moves the mouse outside of the drag rectangle, DragDetect
- * returns true.
- */
- if (OS.DragDetect (handle, pt)) {
- sendEvent (SWT.DragDetect);
- // widget could be disposed at this point
- } else {
- /*
- * The Mouse up event and the ESC key event have been consumed by DragDetect so
- * detect the cases and send the events.
- */
- if (OS.GetKeyState (OS.VK_ESCAPE) == 0) {
- sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam);
- // widget could be disposed at this point
- }
- }
- }
- }
- return new LRESULT (result);
-}
-
-LRESULT WM_LBUTTONUP (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam);
- int result = callWindowProc (OS.WM_LBUTTONUP, wParam, lParam);
- if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0)
- if (OS.GetCapture () == handle) OS.ReleaseCapture ();
- return new LRESULT (result);
-}
-
-LRESULT WM_MBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. Windows sends the following
- * messages when the user double clicks the mouse:
- *
- * WM_MBUTTONDOWN - mouse down
- * WM_MBUTTONUP - mouse up
- * WM_MLBUTTONDBLCLK - double click
- * WM_MBUTTONUP - mouse up
- *
- * Applications that expect matching mouse down/up
- * pairs will not see the second mouse down. The
- * fix is to send a mouse down event.
- */
- sendMouseEvent (SWT.MouseDown, 2, OS.WM_MBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 2, OS.WM_MBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (OS.WM_MBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (result);
-}
-
-LRESULT WM_MBUTTONDOWN (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseDown, 2, OS.WM_MBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (OS.WM_MBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture(handle);
- return new LRESULT (result);
-}
-
-LRESULT WM_MBUTTONUP (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 2, OS.WM_MBUTTONUP, wParam, lParam);
- int result = callWindowProc (OS.WM_MBUTTONUP, wParam, lParam);
- if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0)
- if (OS.GetCapture () == handle) OS.ReleaseCapture ();
- return new LRESULT (result);
-}
-
-LRESULT WM_MEASUREITEM (int wParam, int lParam) {
- MEASUREITEMSTRUCT struct = new MEASUREITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, MEASUREITEMSTRUCT.sizeof);
- if (struct.CtlType == OS.ODT_MENU) {
- Decorations shell = menuShell ();
- MenuItem item = shell.findMenuItem (struct.itemID);
- if (item == null) return null;
- return item.wmMeasureChild (wParam, lParam);
- }
- int hwnd = OS.GetDlgItem (handle, struct.CtlID);
- Control control = WidgetTable.get (hwnd);
- if (control == null) return null;
- return control.wmMeasureChild (wParam, lParam);
-}
-
-LRESULT WM_MENUCHAR (int wParam, int lParam) {
- Display display = getDisplay ();
- display.mnemonicKeyHit = false;
- /*
- * Feature in Windows. When the user types Alt+<key>
- * and <key> does not match a mnemonic in the System
- * menu or the menu bar, Windows beeps. This beep is
- * unexpected and unwanted by applications that look
- * for Alt+<key>. The fix is to detect the case and
- * stop Windows from beeping by closing the menu.
- */
- int type = wParam >> 16;
- if (type == 0 || type == OS.MF_SYSMENU) {
- return new LRESULT (OS.MNC_CLOSE << 16);
- }
- return null;
-}
-
-LRESULT WM_MENUSELECT (int wParam, int lParam) {
- int code = wParam >> 16;
- Shell shell = getShell ();
- if (code == -1 && lParam == 0) {
- Menu menu = shell.activeMenu;
- while (menu != null) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the hide
- * event. If this happens, stop searching up the
- * parent list because there is no longer a link
- * to follow.
- */
- menu.sendEvent (SWT.Hide);
- if (menu.isDisposed ()) break;
- menu = menu.getParentMenu ();
- }
- /*
- * The shell may be disposed because of sending the hide
- * event to the last active menu menu but setting a field
- * to null in a destroyed widget is not harmful.
- */
- shell.activeMenu = null;
- return null;
- }
- if ((code & OS.MF_SYSMENU) != 0) return null;
- if ((code & OS.MF_HILITE) != 0) {
- MenuItem item = null;
- Decorations menuShell = menuShell ();
- if ((code & OS.MF_POPUP) != 0) {
- int index = wParam & 0xFFFF;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_SUBMENU;
- if (OS.GetMenuItemInfo (lParam, index, true, info)) {
- Menu newMenu = menuShell.findMenu (info.hSubMenu);
- if (newMenu != null) item = newMenu.cascade;
- }
- } else {
- Menu newMenu = menuShell.findMenu (lParam);
- if (newMenu != null) {
- int id = wParam & 0xFFFF;
- item = menuShell.findMenuItem (id);
- }
- Menu oldMenu = shell.activeMenu;
- if (oldMenu != null) {
- Menu ancestor = oldMenu;
- while (ancestor != null && ancestor != newMenu) {
- ancestor = ancestor.getParentMenu ();
- }
- if (ancestor == newMenu) {
- ancestor = oldMenu;
- while (ancestor != newMenu) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the hide
- * event or the item about to be armed. If this
- * happens, stop searching up the ancestor list
- * because there is no longer a link to follow.
- */
- ancestor.sendEvent (SWT.Hide);
- if (ancestor.isDisposed ()) break;
- ancestor = ancestor.getParentMenu ();
- }
- /*
- * The shell and/or the item could be disposed when
- * processing hide events from above. If this happens,
- * ensure that the shell is not accessed and that no
- * arm event is sent to the item.
- */
- if (!shell.isDisposed ()) {
- if (newMenu != null && newMenu.isDisposed ()) {
- newMenu = null;
- }
- shell.activeMenu = newMenu;
- }
- if (item != null && item.isDisposed ()) item = null;
- }
- }
- }
- if (item != null) item.sendEvent (SWT.Arm);
- }
- return null;
-}
-
-LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_MOUSEHOVER (int wParam, int lParam) {
- int pos = OS.GetMessagePos ();
- Event event = new Event ();
- POINT pt = new POINT ();
- pt.x = (short) (pos & 0xFFFF);
- pt.y = (short) (pos >> 16);
- OS.ScreenToClient (handle, pt);
- event.x = pt.x;
- event.y = pt.y;
- postEvent (SWT.MouseHover, event);
- return null;
-}
-
-LRESULT WM_MOUSELEAVE (int wParam, int lParam) {
- int pos = OS.GetMessagePos ();
- Event event = new Event ();
- POINT pt = new POINT ();
- pt.x = (short) (pos & 0xFFFF);
- pt.y = (short) (pos >> 16);
- OS.ScreenToClient (handle, pt);
- event.x = pt.x;
- event.y = pt.y;
- postEvent (SWT.MouseExit, event);
- return null;
-}
-
-LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
- if (!OS.IsWinCE) {
- boolean hooksEnter = hooks (SWT.MouseEnter);
- if (hooksEnter || hooks (SWT.MouseExit) || hooks (SWT.MouseHover)) {
- TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT ();
- lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof;
- lpEventTrack.dwFlags = OS.TME_QUERY;
- lpEventTrack.hwndTrack = handle;
- OS.TrackMouseEvent (lpEventTrack);
- if (lpEventTrack.dwFlags == 0) {
- lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER;
- lpEventTrack.hwndTrack = handle;
- OS.TrackMouseEvent (lpEventTrack);
- if (hooksEnter) {
- Event event = new Event ();
- event.x = (short) (lParam & 0xFFFF);
- event.y = (short) (lParam >> 16);
- postEvent (SWT.MouseEnter, event);
- }
- } else {
- lpEventTrack.dwFlags = OS.TME_HOVER;
- OS.TrackMouseEvent (lpEventTrack);
- }
- }
- }
- Display display = getDisplay ();
- int pos = OS.GetMessagePos ();
- if (pos != display.lastMouse) {
- display.lastMouse = pos;
- sendMouseEvent (SWT.MouseMove, 0, OS.WM_MOUSEMOVE, wParam, lParam);
- }
- return null;
-}
-
-LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_MOVE (int wParam, int lParam) {
- sendEvent (SWT.Move);
- // widget could be disposed at this point
- return null;
-}
-
-LRESULT WM_NCACTIVATE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_NCCALCSIZE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_NCHITTEST (int wParam, int lParam) {
- if (!isActive ()) return new LRESULT (OS.HTTRANSPARENT);
- return null;
-}
-
-LRESULT WM_NOTIFY (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- int hwnd = hdr.hwndFrom;
- if (hwnd == 0) return null;
- Control control = WidgetTable.get (hwnd);
- if (control == null) return null;
- return control.wmNotifyChild (wParam, lParam);
-}
-
-LRESULT WM_PAINT (int wParam, int lParam) {
-
- /* Exit early - don't draw the background */
- if (!hooks (SWT.Paint)) return null;
-
- /* Get the damage */
- int rgn = 0;
- rgn = OS.CreateRectRgn (0, 0, 0, 0);
- OS.GetUpdateRgn (handle, rgn, false);
- int result = callWindowProc (OS.WM_PAINT, wParam, lParam);
- if (OS.IsWinCE) {
- RECT rect = new RECT ();
- OS.GetClipBox (rgn, rect);
- OS.InvalidateRect (handle, rect, false);
- } else {
- OS.InvalidateRgn (handle, rgn, false);
- }
- OS.DeleteObject (rgn);
-
- /* Create the paint GC */
- PAINTSTRUCT ps = new PAINTSTRUCT ();
- GCData data = new GCData ();
- data.ps = ps;
- GC gc = GC.win32_new (this, data);
-
- /* Send the paint event */
- Event event = new Event ();
- event.gc = gc;
- event.x = ps.left;
- event.y = ps.top;
- event.width = ps.right - ps.left;
- event.height = ps.bottom - ps.top;
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the paint
- * event. If this happens, attempt to give back the
- * paint GC anyways because this is a scarce Windows
- * resource.
- */
- sendEvent (SWT.Paint, event);
- // widget could be disposed at this point
-
- /* Dispose the paint GC */
- event.gc = null;
- gc.dispose ();
-
- if (result == 0) return LRESULT.ZERO;
- return new LRESULT (result);
-}
-
-LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_PASTE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_QUERYNEWPALETTE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_QUERYOPEN (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. Windows sends the following
- * messages when the user double clicks the mouse:
- *
- * WM_RBUTTONDOWN - mouse down
- * WM_RBUTTONUP - mouse up
- * WM_RBUTTONDBLCLK - double click
- * WM_LBUTTONUP - mouse up
- *
- * Applications that expect matching mouse down/up
- * pairs will not see the second mouse down. The
- * fix is to send a mouse down event.
- */
- sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 3, OS.WM_RBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (OS.WM_RBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (result);
-}
-
-LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (OS.WM_RBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (result);
-}
-
-LRESULT WM_RBUTTONUP (int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 3, OS.WM_RBUTTONUP, wParam, lParam);
- int result = callWindowProc (OS.WM_RBUTTONUP, wParam, lParam);
- if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0)
- if (OS.GetCapture () == handle) OS.ReleaseCapture ();
- return new LRESULT (result);
-}
-
-LRESULT WM_SETCURSOR (int wParam, int lParam) {
- int hitTest = lParam & 0xFFFF;
- if (hitTest == OS.HTCLIENT) {
- Control control = WidgetTable.get (wParam);
- if (control == null) return null;
- int hCursor = control.findCursor ();
- if (hCursor != 0) {
- OS.SetCursor (hCursor);
- return LRESULT.ONE;
- }
- }
- return null;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- int code = callWindowProc (OS.WM_SETFOCUS, wParam, lParam);
- Shell shell = getShell ();
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the focus
- * in event. If this happens keep going to send
- * the activate events.
- */
- sendEvent (SWT.FocusIn);
- // widget could be disposed at this point
-
- /*
- * It is possible that the shell may be
- * disposed at this point. If this happens
- * don't send the activate and deactivate
- * events.
- */
- if (!shell.isDisposed ()) {
- shell.setActiveControl (this);
- }
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the focus
- * or activate events. If this happens, end the
- * processing of the Windows message by returning
- * zero as the result of the window proc.
- */
- if (isDisposed ()) return LRESULT.ZERO;
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_SETFONT (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- sendEvent (SWT.Resize);
- // widget could be disposed at this point
- return null;
-}
-
-LRESULT WM_SYSCHAR (int wParam, int lParam) {
- Display display = getDisplay ();
-
- /* Set last key and last ascii because a new key has been typed */
- display.lastAscii = display.lastKey = wParam;
- display.lastVirtual = display.isVirtualKey (display.lastKey);
-
- /* Do not issue a key down if a menu bar mnemonic was invoked */
- if (!hooks (SWT.KeyDown)) return null;
- display.mnemonicKeyHit = true;
- int result = callWindowProc (OS.WM_SYSCHAR, wParam, lParam);
- if (!display.mnemonicKeyHit) {
- sendKeyEvent (SWT.KeyDown, OS.WM_SYSCHAR, wParam, lParam);
- }
- display.mnemonicKeyHit = false;
- return new LRESULT (result);
-}
-
-LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
- /*
- * Check to see if the command is a system command or
- * a user menu item that was added to the System menu.
- * When a user item is added to the System menu,
- * WM_SYSCOMMAND must always return zero.
- */
- if ((wParam & 0xF000) == 0) {
- Decorations shell = menuShell ();
- if (shell.isEnabled ()) {
- MenuItem item = shell.findMenuItem (wParam & 0xFFFF);
- if (item != null) item.wmCommandChild (wParam, lParam);
- }
- return LRESULT.ZERO;
- }
-
- /* Process the System Command */
- int cmd = wParam & 0xFFF0;
- switch (cmd) {
- case OS.SC_CLOSE:
- int hwndShell = menuShell ().handle;
- int bits = OS.GetWindowLong (hwndShell, OS.GWL_STYLE);
- if ((bits & OS.WS_SYSMENU) == 0) return LRESULT.ZERO;
- break;
- case OS.SC_KEYMENU:
- case OS.SC_HSCROLL:
- case OS.SC_VSCROLL:
- /*
- * Do not allow keyboard traversal of the menu bar
- * or scrolling when the shell is not enabled.
- */
- if (!menuShell ().isEnabled ()) return LRESULT.ZERO;
- break;
- case OS.SC_MINIMIZE:
- /* Save the focus widget when the shell is minimized */
- menuShell ().saveFocus ();
- break;
- }
- return null;
-}
-
-LRESULT WM_SYSKEYDOWN (int wParam, int lParam) {
- Display display = getDisplay ();
-
- /*
- * Feature in Windows. WM_SYSKEYDOWN is sent when
- * the user presses ALT-<aKey> or F10 without the ALT key.
- * In order to issue events for F10 (without the ALT key)
- * but ignore all other key presses without the ALT key,
- * make F10 a special case.
- */
- if (wParam != OS.VK_F10) {
- /* Make sure WM_SYSKEYDOWN was sent by ALT-<aKey>. */
- if ((lParam & 0x20000000) == 0) return null;
- }
-
- /* If are going to get a WM_SYSCHAR, ignore this message. */
- if (OS.MapVirtualKey (wParam, 2) != 0) return null;
-
- /* Ignore repeating keys for modifiers by testing key down state. */
- if ((wParam == OS.VK_SHIFT) || (wParam == OS.VK_MENU) ||
- (wParam == OS.VK_CONTROL) || (wParam == OS.VK_CAPITAL) ||
- (wParam == OS.VK_NUMLOCK) || (wParam == OS.VK_SCROLL))
- if ((lParam & 0x40000000) != 0) return null;
-
- /* Set last key and clear last ascii because a new key has been typed. */
- display.lastAscii = 0;
- display.lastKey = wParam;
- display.lastVirtual = true;
-
- if (!sendKeyEvent (SWT.KeyDown, OS.WM_SYSKEYDOWN, wParam, lParam)) {
- return LRESULT.ZERO;
- }
- return null;
-}
-
-LRESULT WM_SYSKEYUP (int wParam, int lParam) {
- return WM_KEYUP (wParam, lParam);
-}
-
-LRESULT WM_TIMER (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_UNDO (int wParam, int lParam) {
- return null;
-}
-
-LRESULT WM_VSCROLL (int wParam, int lParam) {
- if (lParam == 0) return null;
- Control control = WidgetTable.get (lParam);
- if (control == null) return null;
- return control.wmScrollChild (wParam, lParam);
-}
-
-LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
- return null;
-}
-
-LRESULT wmColorChild (int wParam, int lParam) {
- if (background == -1 && foreground == -1) return null;
- int forePixel = foreground, backPixel = background;
- if (forePixel == -1) forePixel = defaultForeground ();
- if (backPixel == -1) backPixel = defaultBackground ();
- OS.SetTextColor (wParam, forePixel);
- OS.SetBkColor (wParam, backPixel);
- return new LRESULT (findBrush (backPixel));
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- return null;
-}
-
-LRESULT wmDrawChild (int wParam, int lParam) {
- return null;
-}
-
-LRESULT wmMeasureChild (int wParam, int lParam) {
- return null;
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- return null;
-}
-
-LRESULT wmScrollChild (int wParam, int lParam) {
- return null;
-}
-
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
deleted file mode 100755
index 100b819f22..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
+++ /dev/null
@@ -1,644 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an area for dynamically
- * positioning the items they contain.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>CoolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class CoolBar extends Composite {
- CoolItem [] items;
- CoolItem [] originalItems;
- static final int ReBarProc;
- static final TCHAR ReBarClass = new TCHAR (0, OS.REBARCLASSNAME, true);
- static {
- INITCOMMONCONTROLSEX icex = new INITCOMMONCONTROLSEX ();
- icex.dwSize = INITCOMMONCONTROLSEX.sizeof;
- icex.dwICC = OS.ICC_COOL_CLASSES;
- OS.InitCommonControlsEx (icex);
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ReBarClass, lpWndClass);
- ReBarProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ReBarProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- style |= SWT.NO_FOCUS;
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, rowWidth = 0, height = 0, rowHeight = 0;
- RECT rect = new RECT ();
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_IDEALSIZE | OS.RBBIM_CHILDSIZE | OS.RBBIM_STYLE;
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- OS.SendMessage (handle, OS.RB_GETBANDBORDERS, i, rect);
- if ((rbBand.fStyle & OS.RBBS_BREAK) != 0) {
- width = Math.max (width, rowWidth);
- height += rowHeight;
- rowWidth = rowHeight = 0;
- } else if (i != 0) {
- rowWidth += 2;
- }
- rowWidth += rbBand.cxIdeal + rect.left + rect.right;
- rowHeight = Math.max (rowHeight, rbBand.cyMinChild + rect.top + rect.bottom);
- }
- width = Math.max (width, rowWidth);
- height += rowHeight - rect.top - rect.bottom;
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2;
- height += border * 2;
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-
- /*
- * Feature in Windows. When the control is created,
- * it does not use the default system font. A new HFONT
- * is created and destroyed when the control is destroyed.
- * This means that a program that queries the font from
- * this control, uses the font in another control and then
- * destroys this control will have the font unexpectedly
- * destroyed in the other control. The fix is to assign
- * the font ourselves each time the control is created.
- * The control will not destroy a font that it did not
- * create.
- */
- int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
-}
-
-void createItem (CoolItem item, int index) {
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- int id = 0;
- while (id < items.length && items [id] != null) id++;
- if (id == items.length) {
- CoolItem [] newItems = new CoolItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- int hHeap = OS.GetProcessHeap ();
- int lpText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_TEXT | OS.RBBIM_STYLE | OS.RBBIM_ID;
- rbBand.fStyle = OS.RBBS_VARIABLEHEIGHT | OS.RBBS_GRIPPERALWAYS;
- rbBand.lpText = lpText;
- rbBand.wID = id;
- if (OS.SendMessage (handle, OS.RB_INSERTBAND, index, rbBand) == 0) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- OS.HeapFree (hHeap, 0, lpText);
- items [item.id = id] = item;
- int length = originalItems.length;
- CoolItem [] newOriginals = new CoolItem [length + 1];
- System.arraycopy (originalItems, 0, newOriginals, 0, index);
- System.arraycopy (originalItems, index, newOriginals, index + 1, length - index);
- newOriginals [index] = item;
- originalItems = newOriginals;
-}
-
-void createWidget () {
- super.createWidget ();
- items = new CoolItem [4];
- originalItems = new CoolItem [0];
-}
-
-void destroyItem (CoolItem item) {
- int index = OS.SendMessage (handle, OS.RB_IDTOINDEX, item.id, 0);
- /*
- * Feature in Windows. When Windows removed a rebar
- * band, it makes the band child invisible. The fix
- * is to show the child.
- */
- Control control = item.control;
- boolean wasVisible = control != null && !control.isDisposed() && control.getVisible ();
- if (OS.SendMessage (handle, OS.RB_DELETEBAND, index, 0) == 0) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- items [item.id] = null;
- item.id = -1;
- if (wasVisible) control.setVisible (true);
- index = 0;
- while (index < originalItems.length) {
- if (originalItems [index] == item) break;
- index++;
- }
- int length = originalItems.length - 1;
- CoolItem [] newOriginals = new CoolItem [length];
- System.arraycopy (originalItems, 0, newOriginals, 0, index);
- System.arraycopy (originalItems, index + 1, newOriginals, index, length - index);
- originalItems = newOriginals;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public CoolItem getItem (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_ID;
- OS.SendMessage (handle, OS.RB_GETBANDINFO, index, rbBand);
- return items [rbBand.wID];
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
-}
-
-/**
- * Returns an array of zero-relative indices which map the order
- * that the items in the receiver were added in to
- * the order which they are currently being displayed.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's item order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getItemOrder () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- int [] indices = new int [count];
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_ID;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- CoolItem item = items [rbBand.wID];
- int index = 0;
- while (index<originalItems.length) {
- if (originalItems [index] == item) break;
- index++;
- }
- if (index == originalItems.length) error (SWT.ERROR_CANNOT_GET_ITEM);
- indices [i] = index;
- }
- return indices;
-}
-
-/**
- * Returns an array of <code>CoolItems</code>s which are the
- * items in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public CoolItem [] getItems () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- CoolItem [] result = new CoolItem [count];
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_ID;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- result [i] = items [rbBand.wID];
- }
- return result;
-}
-
-/**
- * Returns an array of points whose x and y coordinates describe
- * the widths and heights (respectively) of the items in the receiver.
- *
- * @return the receiver's item sizes
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point [] getItemSizes () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- Point [] sizes = new Point [count];
- for (int i=0; i<count; i++) {
- RECT rect = new RECT ();
- OS.SendMessage (handle, OS.RB_GETRECT, i, rect);
- sizes [i] = new Point (rect.right - rect.left, rect.bottom - rect.top);
- }
- return sizes;
-}
-
-/**
- * Returns an array of ints which describe the zero-relative
- * row number of the row which each of the items in the
- * receiver occurs in.
- *
- * @return the receiver's wrap indices
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int [] getWrapIndices () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- int [] indices = new int [count];
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_STYLE;
- int wrapCount = 0;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- if ((rbBand.fStyle & OS.RBBS_BREAK) != 0) indices [wrapCount++] = i;
- }
- int [] answer = new int [wrapCount];
- System.arraycopy(indices, 0, answer, 0, wrapCount);
- return answer;
-}
-
-/**
- * Searches the receiver's items, in the order they were
- * added, starting at the first item (index 0) until an item
- * is found that is equal to the argument, and returns the
- * index of that item. If no item is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item is disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (CoolItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- return OS.SendMessage (handle, OS.RB_IDTOINDEX, item.id, 0);
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- CoolItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- }
- }
- items = null;
- super.releaseWidget();
-}
-
-void setBackgroundPixel (int pixel) {
- if (background == pixel) return;
- background = pixel;
- if (pixel == -1) pixel = defaultBackground ();
- OS.SendMessage (handle, OS.RB_SETBKCOLOR, 0, pixel);
- setItemColors (OS.SendMessage (handle, OS.RB_GETTEXTCOLOR, 0, 0), pixel);
-}
-
-void setForegroundPixel (int pixel) {
- if (foreground == pixel) return;
- foreground = pixel;
- if (pixel == -1) pixel = defaultForeground ();
- OS.SendMessage (handle, OS.RB_SETTEXTCOLOR, 0, pixel);
- setItemColors (pixel, OS.SendMessage (handle, OS.RB_GETBKCOLOR, 0, 0));
-}
-
-void setItemColors (int foreColor, int backColor) {
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_COLORS;
- rbBand.clrFore = foreColor;
- rbBand.clrBack = backColor;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand);
- }
-}
-
-/**
- * Sets the receiver's item order, wrap indices, and item
- * sizes at once. This equivalent to calling the setter
- * methods for each of these values individually.
- *
- * @param itemOrder the new item order
- * @param wrapIndices the new wrap indices
- * @param size the new item sizes
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItemLayout (int [] itemOrder, int [] wrapIndices, Point [] sizes) {
- checkWidget ();
- setItemOrder (itemOrder);
- setItemSizes (sizes);
- setWrapIndices(wrapIndices);
-}
-
-/**
- * Sets the the order that the items in the receiver should
- * be displayed in to the given argument which is described
- * in terms of the zero-relative ordering of when the items
- * were added.
- *
- * @param itemOrder the new item order
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-void setItemOrder (int [] itemOrder) {
- if (itemOrder == null) error (SWT.ERROR_NULL_ARGUMENT);
- int itemCount = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- if (itemOrder.length != itemCount) error (SWT.ERROR_INVALID_ARGUMENT);
-
- /* Ensure that itemOrder does not contain any duplicates. */
- boolean [] set = new boolean [itemCount];
- for (int i=0; i<itemOrder.length; i++) {
- int index = itemOrder [i];
- if (index < 0 || index >= itemCount) error (SWT.ERROR_INVALID_RANGE);
- if (set [index]) error (SWT.ERROR_INVALID_ARGUMENT);
- set [index] = true;
- }
-
- for (int i=0; i<itemOrder.length; i++) {
- int id = originalItems [itemOrder [i]].id;
- int index = OS.SendMessage (handle, OS.RB_IDTOINDEX, id, 0);
- OS.SendMessage (handle, OS.RB_MOVEBAND, index, i);
- }
-}
-
-/**
- * Sets the width and height of the areas in the receiver which
- * are used to display its items to the ones specified by the
- * argument, which is an array of points whose x and y coordinates
- * describe the widths and heights (respectively) in the order the
- * items were added.
- *
- * @param sizes the new sizes for each of the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-void setItemSizes (Point [] sizes) {
- if (sizes == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- if (sizes.length != count) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<count; i++) {
- RECT rect = new RECT ();
- OS.SendMessage (handle, OS.RB_GETBANDBORDERS, i, rect);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_SIZE | OS.RBBIM_IDEALSIZE;
- int width = sizes [i].x, height = sizes [i].y;
- rbBand.cx = width;
- rbBand.cxIdeal = width - rect.left - rect.right;
- rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = height;
- OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand);
- }
-}
-
-/**
- * Sets the row that each of the receiver's items will be
- * displayed in to the given array of ints which describe
- * the zero-relative row number of the row for each item.
- * If indices is null, the items will be placed on one line.
- *
- * @param indices the new wrap indices
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWrapIndices (int [] indices) {
- checkWidget ();
- if (indices == null) indices = new int [0];
- int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
- for (int i=0; i<indices.length; i++) {
- if (indices [i] < 0 || indices [i] >= count) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_STYLE;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- rbBand.fStyle &= ~OS.RBBS_BREAK;
- OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand);
- }
- for (int i=0; i<indices.length; i++) {
- OS.SendMessage (handle, OS.RB_GETBANDINFO, indices [i], rbBand);
- rbBand.fStyle |= OS.RBBS_BREAK;
- OS.SendMessage (handle, OS.RB_SETBANDINFO, indices [i], rbBand);
- }
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.CCS_NODIVIDER | OS.CCS_NORESIZE;
- bits |= OS.RBS_VARHEIGHT | OS.RBS_BANDBORDERS;
- return bits;
-}
-
-TCHAR windowClass () {
- return ReBarClass;
-}
-
-int windowProc () {
- return ReBarProc;
-}
-
-LRESULT WM_COMMAND (int wParam, int lParam) {
- /*
- * Feature in Windows. When the coolbar window
- * proc processes WM_COMMAND, it forwards this
- * message to the parent. This is done so that
- * children of the coolbar that send WM_COMMAND
- * messages to their parents will notify not only
- * the coolbar but also the parent of the coolbar,
- * which is typically the application window and
- * the window that is looking for this message.
- * If the coolbar did not do this, applications
- * would have to subclass the coolbar window to
- * see WM_COMMAND messages. Because the coolbar
- * window is subclassed, the WM_COMMAND message
- * is delivered twice. The fix is to avoid
- * calling the coolbar window proc.
- */
- LRESULT result = super.WM_COMMAND (wParam, lParam);
- if (result != null) return result;
- return LRESULT.ZERO;
-}
-
-LRESULT WM_ERASEBKGND (int wParam, int lParam) {
- /*
- * Feature in Windows. For some reason, Windows
- * does not fully erase the area that the cool bar
- * occupies when the size of the cool bar grows.
- * The fix is to erase the cool bar background.
- */
- drawBackground (wParam);
- return null;
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- switch (hdr.code) {
- case OS.RBN_HEIGHTCHANGE:
- Point size = getSize ();
- int border = getBorderWidth ();
- int height = OS.SendMessage (handle, OS.RB_GETBARHEIGHT, 0, 0);
- setSize (size.x, height + (border * 2));
- break;
- }
- return super.wmNotifyChild (wParam, lParam);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
deleted file mode 100755
index 2317d0f482..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
+++ /dev/null
@@ -1,381 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent the dynamically positionable
- * areas of a <code>CoolBar</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class CoolItem extends Item {
- CoolBar parent;
- Control control;
- int id;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolItem (CoolBar parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public CoolItem (CoolBar parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns the preferred size of the receiver.
- * <p>
- * The <em>prefered size</em> of a <code>CoolItem</code> is the size that
- * it would best be displayed at. The width hint and height hint arguments
- * allow the caller to ask the instance questions such as "Given a particular
- * width, how high does it need to be to show all of the contents?"
- * To indicate that the caller does not wish to constrain a particular
- * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
- * </p>
- *
- * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
- * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
- * @return the preferred size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Layout
- */
-public Point computeSize (int wHint, int hHint) {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return new Point (0, 0);
- int width = wHint, height = hHint;
- if (wHint == SWT.DEFAULT) width = 32;
- if (hHint == SWT.DEFAULT) height = 32;
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, rect);
- width += rect.left + rect.right;
- return new Point (width, height);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return new Rectangle (0, 0, 0, 0);
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETRECT, index, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-/*
-* Not currently used.
-*/
-Rectangle getClientArea () {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return new Rectangle (0, 0, 0, 0);
- int hwnd = parent.handle;
- RECT insetRect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, insetRect);
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETRECT, index, rect);
- int x = rect.left + insetRect.left;
- int y = rect.top + insetRect.top;
- int width = rect.right - rect.left - (insetRect.left + insetRect.right);
- int height = rect.bottom - rect.top - (insetRect.top + insetRect.bottom);
- if (index == 0) {
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_HEADERSIZE;
- OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand);
- width = width - rbBand.cxHeader + 1;
- }
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Gets the control which is associated with the receiver.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget ();
- return control;
-}
-
-public Display getDisplay () {
- CoolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>CoolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public CoolBar getParent () {
- checkWidget ();
- return parent;
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- control = null;
- parent = null;
-}
-
-/**
- * Sets the control which is associated with the receiver
- * to the argument.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget ();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- int index = parent.indexOf (this);
- if (index == -1) return;
- Control newControl = control;
- Control oldControl = this.control;
- int hwnd = parent.handle;
- int hwndChild = 0;
- if (newControl != null) hwndChild = control.handle;
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILD;
- rbBand.hwndChild = hwndChild;
- this.control = newControl;
-
- /*
- * Feature in Windows. When Windows sets the rebar band child,
- * it makes the new child visible and hides the old child. The
- * fix is to save and restore the visibility of the controls.
- */
- boolean hideNew = newControl != null && !newControl.getVisible ();
- boolean showOld = oldControl != null && oldControl.getVisible ();
- OS.SendMessage (hwnd, OS.RB_SETBANDINFO, index, rbBand);
- if (hideNew) newControl.setVisible (false);
- if (showOld) oldControl.setVisible (true);
-}
-
-public Point getPreferredSize () {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return new Point (0, 0);
- int hwnd = parent.handle;
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_IDEALSIZE;
- OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand);
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, rect);
- int width = rbBand.cxIdeal + rect.left + rect.right;
- return new Point (width, rbBand.cyMinChild);
-}
-
-public void setPreferredSize (int width, int height) {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, rect);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_IDEALSIZE;
- rbBand.cxIdeal = width - rect.left - rect.right;
- rbBand.cyMinChild = rbBand.cyMaxChild = height;
- OS.SendMessage (hwnd, OS.RB_SETBANDINFO, index, rbBand);
-}
-
-public void setPreferredSize (Point size) {
- checkWidget ();
- if (size == null) error(SWT.ERROR_NULL_ARGUMENT);
- setPreferredSize (size.x, size.y);
-}
-
-public Point getSize() {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) new Point (0, 0);
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETRECT, index, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Point (width, height);
-}
-
-public void setSize (int width, int height) {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, rect);
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_SIZE | OS.RBBIM_IDEALSIZE;
- rbBand.cx = width;
- rbBand.cxIdeal = width - rect.left - rect.right;
- rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = height;
- OS.SendMessage (hwnd, OS.RB_SETBANDINFO, index, rbBand);
-}
-
-public void setSize (Point size) {
- if (size == null) error(SWT.ERROR_NULL_ARGUMENT);
- setSize (size.x, size.y);
-}
-
-boolean getWrap() {
- int index = parent.indexOf (this);
- int hwnd = parent.handle;
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_STYLE;
- OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand);
- return (rbBand.fStyle & OS.RBBS_BREAK) != 0;
-}
-
-void setWrap(boolean wrap) {
- int index = parent.indexOf (this);
- int hwnd = parent.handle;
- REBARBANDINFO rbBand = new REBARBANDINFO ();
- rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_STYLE;
- if (wrap) {
- rbBand.fStyle = OS.RBBS_VARIABLEHEIGHT | OS.RBBS_GRIPPERALWAYS | OS.RBBS_BREAK;
- } else {
- rbBand.fStyle = OS.RBBS_VARIABLEHEIGHT | OS.RBBS_GRIPPERALWAYS;
- }
- OS.SendMessage (hwnd, OS.RB_SETBANDINFO, index, rbBand);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
deleted file mode 100755
index fef3a30ab9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
+++ /dev/null
@@ -1,1320 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide the appearance and
- * behavior of <code>Shells</code>, but are not top
- * level shells or dialogs. Class <code>Shell</code>
- * shares a significant amount of code with this class,
- * and is a subclass.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations.
- * For example, some window managers only support resizable
- * windows and will always assume the RESIZE style, even if
- * it is not set.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- *
- * @see #getMinimized
- * @see #getMaximized
- * @see Shell
- * @see SWT
- */
-
-public class Decorations extends Canvas {
- Image image;
- Menu menuBar;
- Menu [] menus;
- MenuItem [] items;
- Control savedFocus;
- Button defaultButton, saveDefault;
- int swFlags, hAccel, nAccel;
- int hwndCB, hwndTB, hIcon;
-
- /*
- * The start value for WM_COMMAND id's.
- * Windows reserves the values 0..100.
- */
- static final int ID_START = 100;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Decorations () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Decorations (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-void add (Menu menu) {
- if (menus == null) menus = new Menu [4];
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == null) {
- menus [i] = menu;
- return;
- }
- }
- Menu [] newMenus = new Menu [menus.length + 4];
- newMenus [menus.length] = menu;
- System.arraycopy (menus, 0, newMenus, 0, menus.length);
- menus = newMenus;
-}
-
-void add (MenuItem item) {
- if (items == null) items = new MenuItem [12];
- for (int i=0; i<items.length; i++) {
- if (items [i] == null) {
- item.id = i + ID_START;
- items [i] = item;
- return;
- }
- }
- item.id = items.length + ID_START;
- MenuItem [] newItems = new MenuItem [items.length + 12];
- newItems [items.length] = item;
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
-}
-
-void bringToTop () {
- /*
- * This code is intentionally commented. On some platforms,
- * the ON_TOP style creates a shell that will stay on top
- * of every other shell on the desktop. Using SetWindowPos ()
- * with HWND_TOP caused problems on Windows so this code is
- * commented out until this functionality is specified and
- * the problems are fixed.
- */
-// if ((style & SWT.ON_TOP) != 0) {
-// int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
-// OS.SetWindowPos (handle, OS.HWND_TOP, 0, 0, 0, 0, flags);
-// } else {
- OS.BringWindowToTop (handle);
-// }
-}
-
-static int checkStyle (int style) {
- if (OS.IsWinCE) {
- /*
- * Feature in WinCE PPC. WS_MINIMIZEBOX or WS_MAXIMIZEBOX
- * are not supposed to be used. If they are, the result
- * is a button which does not repaint correctly. The fix
- * is to remove this style.
- */
- if ((style & SWT.MIN) != 0) style &= ~SWT.MIN;
- if ((style & SWT.MAX) != 0) style &= ~SWT.MAX;
- return style;
- }
-
- /*
- * If either WS_MINIMIZEBOX or WS_MAXIMIZEBOX are set,
- * we must also set WS_SYSMENU or the buttons will not
- * appear.
- */
- if ((style & (SWT.MIN | SWT.MAX)) != 0) style |= SWT.CLOSE;
-
- /*
- * Both WS_SYSMENU and WS_CAPTION must be set in order
- * to for the system menu to appear.
- */
- if ((style & SWT.CLOSE) != 0) style |= SWT.TITLE;
-
- /*
- * Bug in Windows. The WS_CAPTION style must be
- * set when the window is resizable or it does not
- * draw properly.
- */
- /*
- * This code is intentionally commented. It seems
- * that this problem originally in Windows 3.11,
- * has been fixed in later versions. Because the
- * exact nature of the drawing problem is unknown,
- * keep the commented code around in case it comes
- * back.
- */
-// if ((style & SWT.RESIZE) != 0) style |= SWT.TITLE;
-
- return style;
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-Control computeTabGroup () {
- return this;
-}
-
-Control computeTabRoot () {
- return this;
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget ();
-
- /* Get the size of the trimmings */
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- boolean hasMenu = OS.IsWinCE ? false : OS.GetMenu (handle) != 0;
- OS.AdjustWindowRectEx (rect, bits, hasMenu, OS.GetWindowLong (handle, OS.GWL_EXSTYLE));
-
- /* Get the size of the scroll bars */
- if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
-
- /* Get the height of the menu bar */
- if (hasMenu) {
- RECT testRect = new RECT ();
- OS.SetRect (testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top);
- OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);
- while ((testRect.bottom - testRect.top) < height) {
- rect.top -= OS.GetSystemMetrics (OS.SM_CYMENU) - OS.GetSystemMetrics (OS.SM_CYBORDER);
- OS.SetRect(testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top);
- OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);
- }
- }
- return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
-}
-
-void createAcceleratorTable () {
- hAccel = nAccel = 0;
- int maxAccel = 0;
- if (menuBar == null || items == null) {
- if (!OS.IsWinCE) return;
- maxAccel = 1;
- } else {
- maxAccel = OS.IsWinCE ? items.length + 1 : items.length;
- }
- int size = ACCEL.sizeof;
- ACCEL accel = new ACCEL ();
- byte [] buffer1 = new byte [size];
- byte [] buffer2 = new byte [maxAccel * size];
- if (menuBar != null && items != null) {
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (item != null && item.accelerator != 0) {
- Menu parent = item.parent;
- while (parent != null && parent != menuBar) {
- parent = parent.getParentMenu ();
- }
- if (parent == menuBar) {
- item.fillAccel (accel);
- OS.MoveMemory (buffer1, accel, size);
- System.arraycopy (buffer1, 0, buffer2, nAccel * size, size);
- nAccel++;
- }
- }
- }
- }
- if (OS.IsWinCE) {
- /*
- * Note on WinCE PPC. Close the shell when user taps CTRL-Q.
- * IDOK represents the "Done Button" which also closes the shell.
- */
- accel.fVirt = OS.FVIRTKEY | OS.FCONTROL;
- accel.key = 'Q';
- accel.cmd = OS.IDOK;
- OS.MoveMemory (buffer1, accel, size);
- System.arraycopy (buffer1, 0, buffer2, nAccel * size, size);
- nAccel++;
- }
- if (nAccel != 0) hAccel = OS.CreateAcceleratorTable (buffer2, nAccel);
-}
-
-void createHandle () {
- super.createHandle ();
- if (parent == null) return;
- setParent ();
- setSystemMenu ();
-}
-
-void createWidget () {
- super.createWidget ();
- swFlags = OS.IsWinCE ? OS.SW_SHOWMAXIMIZED : OS.SW_SHOWNOACTIVATE;
- hAccel = -1;
-}
-
-void destroyAcceleratorTable () {
- if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel);
- hAccel = -1;
-}
-
-Menu findMenu (int hMenu) {
- if (menus == null) return null;
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if ((menu != null) && (hMenu == menu.handle)) return menu;
- }
- return null;
-}
-
-MenuItem findMenuItem (int id) {
- if (items == null) return null;
- id = id - ID_START;
- if (0 <= id && id < items.length) return items [id];
- return null;
-}
-
-public Rectangle getBounds () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
- return new Rectangle (lpwndpl.left, lpwndpl.top, width, height);
- }
- }
- return super.getBounds ();
-}
-
-public Rectangle getClientArea () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- RECT rect = new RECT ();
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
- OS.SetRect (rect, 0, 0, width, height);
- OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect);
- return new Rectangle (0, 0, rect.right, rect.bottom);
- }
- }
- return super.getClientArea ();
-}
-
-/**
- * Returns the receiver's default button if one had
- * previously been set, otherwise returns null.
- *
- * @return the default button or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setDefaultButton
- */
-public Button getDefaultButton () {
- checkWidget ();
- return defaultButton;
-}
-
-/**
- * Returns the receiver's image if it had previously been
- * set using <code>setImage()</code>. The image is typically
- * displayed by the window manager when the instance is
- * marked as iconified, and may also be displayed somewhere
- * in the trim when the instance is in normal or maximized
- * states.
- * <p>
- * Note: This method will return null if called before
- * <code>setImage()</code> is called. It does not provide
- * access to a window manager provided, "default" image
- * even if one exists.
- * </p>
- *
- * @return the image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-public Point getLocation () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- return new Point (lpwndpl.left, lpwndpl.top);
- }
- }
- return super.getLocation ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is currently
- * maximized, and false otherwise.
- * <p>
- *
- * @return the maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public boolean getMaximized () {
- checkWidget ();
- if (OS.IsWinCE) return swFlags == OS.SW_SHOWMAXIMIZED;
- if (OS.IsWindowVisible (handle)) return OS.IsZoomed (handle);
- return swFlags == OS.SW_SHOWMAXIMIZED;
-}
-
-/**
- * Returns the receiver's menu bar if one had previously
- * been set, otherwise returns null.
- *
- * @return the menu bar or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenuBar () {
- checkWidget ();
- return menuBar;
-}
-
-/**
- * Returns <code>true</code> if the receiver is currently
- * minimized, and false otherwise.
- * <p>
- *
- * @return the minimized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public boolean getMinimized () {
- checkWidget ();
- if (OS.IsWinCE) return false;
- if (OS.IsWindowVisible (handle)) return OS.IsIconic (handle);
- return swFlags == OS.SW_SHOWMINNOACTIVE;
-}
-
-String getNameText () {
- return getText ();
-}
-
-public Point getSize () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
- return new Point (width, height);
- }
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Point (width, height);
-}
-
-/**
- * Returns the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>. If the text has not previously been set,
- * returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-boolean isTabGroup () {
- /*
- * Can't test WS_TAB bits because they are the same as WS_MAXIMIZEBOX.
- */
- return true;
-}
-
-boolean isTabItem () {
- /*
- * Can't test WS_TAB bits because they are the same as WS_MAXIMIZEBOX.
- */
- return false;
-}
-
-Decorations menuShell () {
- return this;
-}
-
-void releaseWidget () {
- if (menuBar != null) {
- menuBar.releaseWidget ();
- menuBar.releaseHandle ();
- }
- menuBar = null;
- if (menus != null) {
- for (int i=0; i<menus.length; i++) {
- Menu menu = menus [i];
- if (menu != null && !menu.isDisposed ()) {
- menu.dispose ();
- }
- }
- }
- menus = null;
- super.releaseWidget ();
- if (hIcon != 0) OS.DestroyIcon (hIcon);
- hIcon = 0;
- items = null;
- image = null;
- savedFocus = null;
- defaultButton = saveDefault = null;
- if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel);
- hAccel = -1;
- hwndCB = 0;
-}
-
-void remove (Menu menu) {
- if (menus == null) return;
- for (int i=0; i<menus.length; i++) {
- if (menus [i] == menu) {
- menus [i] = null;
- return;
- }
- }
-}
-
-void remove (MenuItem item) {
- if (items == null) return;
- items [item.id - ID_START] = null;
- item.id = -1;
-}
-
-boolean restoreFocus () {
- if (savedFocus != null && savedFocus.isDisposed ()) savedFocus = null;
- if (savedFocus == null) return false;
- return savedFocus.forceFocus ();
-}
-
-void saveFocus () {
- Control control = getDisplay ().getFocusControl ();
- if (control != null) setSavedFocus (control);
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- if (OS.IsWinCE) {
- super.setBounds (x, y, width, height, flags);
- }
- if (OS.IsIconic (handle) || OS.IsZoomed (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- lpwndpl.showCmd = OS.SW_SHOWNA;
- if (OS.IsIconic (handle)) {
- lpwndpl.showCmd = OS.SW_SHOWMINNOACTIVE;
- } else {
- if (OS.IsZoomed (handle)) {
- lpwndpl.showCmd = OS.SW_SHOWMAXIMIZED;
- }
- }
- if ((flags & OS.SWP_NOMOVE) == 0) {
- lpwndpl.left = x;
- lpwndpl.top = y;
- }
- if ((flags & OS.SWP_NOSIZE) == 0) {
- lpwndpl.right = x + width;
- lpwndpl.bottom = y + height;
- }
- OS.SetWindowPlacement (handle, lpwndpl);
- return;
- }
- super.setBounds (x, y, width, height, flags);
-}
-
-/**
- * If the argument is not null, sets the receiver's default
- * button to the argument, and if the argument is null, sets
- * the receiver's default button to the first button which
- * was set as the receiver's default button (called the
- * <em>saved default button</em>). If no default button had
- * previously been set, or the saved default button was
- * disposed, the receiver's default button will be set to
- * null.
- *
- * @param the new default button
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultButton (Button button) {
- checkWidget ();
- setDefaultButton (button, true);
-}
-
-void setDefaultButton (Button button, boolean save) {
- if (button == null) {
- if (defaultButton == saveDefault) return;
- } else {
- if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((button.style & SWT.PUSH) == 0) return;
- if (button == defaultButton) return;
- }
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (false);
- }
- if ((defaultButton = button) == null) defaultButton = saveDefault;
- if (defaultButton != null) {
- if (!defaultButton.isDisposed ()) defaultButton.setDefault (true);
- }
- if (save || saveDefault == null) saveDefault = defaultButton;
- if (saveDefault != null && saveDefault.isDisposed ()) saveDefault = null;
-}
-
-public boolean setFocus () {
- checkWidget ();
- if (this instanceof Shell) return super.setFocus ();
- /*
- * Bug in Windows. Setting the focus to a child of the
- * receiver interferes with moving and resizing of the
- * parent shell. The fix (for now) is to always set the
- * focus to the shell.
- */
- int hwndFocus = OS.SetFocus (getShell ().handle);
- return hwndFocus == OS.GetFocus ();
-}
-/**
- * Sets the receiver's image to the argument, which may
- * be null. The image is typically displayed by the window
- * manager when the instance is marked as iconified, and
- * may also be displayed somewhere in the trim when the
- * instance is in normal or maximized states.
- *
- * @param image the new image (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- /*
- * Feature in WinCE. WM_SETICON and WM_GETICON set the icon
- * for the window class, not the window instance. This means
- * that it is possible to set an icon into a window and then
- * later free the icon, thus freeing the icon for every window.
- * The fix is to avoid the API.
- *
- * On WinCE PPC, icons in windows are not displayed anyways.
- */
- if (OS.IsWinCE) {
- this.image = image;
- return;
- }
- int hImage = 0;
- if (image != null) {
- if (hIcon != 0) OS.DestroyIcon (hIcon);
- hIcon = 0;
- switch (image.type) {
- case SWT.BITMAP:
- /* Copy the bitmap in case it's a DIB */
- int hBitmap = image.handle;
- BITMAP bm = new BITMAP ();
- OS.GetObject (hBitmap, BITMAP.sizeof, bm);
- byte [] lpvBits = new byte [(bm.bmWidth + 15) / 16 * 2 * bm.bmHeight];
- int hMask = OS.CreateBitmap (bm.bmWidth, bm.bmHeight, 1, 1, lpvBits);
- int hDC = OS.GetDC (handle);
- int hdcMem = OS.CreateCompatibleDC (hDC);
- int hColor = OS.CreateCompatibleBitmap (hDC, bm.bmWidth, bm.bmHeight);
- OS.SelectObject (hdcMem, hColor);
- int hdcBmp = OS.CreateCompatibleDC (hDC);
- OS.SelectObject (hdcBmp, hBitmap);
- OS.BitBlt (hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcBmp, 0, 0, OS.SRCCOPY);
- ICONINFO info = new ICONINFO ();
- info.fIcon = true;
- info.hbmMask = hMask;
- info.hbmColor = hColor;
- hImage = hIcon = OS.CreateIconIndirect (info);
- OS.DeleteObject (hMask);
- OS.DeleteObject(hColor);
- OS.DeleteDC (hdcBmp);
- OS.DeleteDC (hdcMem);
- OS.ReleaseDC (handle, hDC);
- break;
- case SWT.ICON:
- hImage = image.handle;
- break;
- default:
- return;
- }
- }
- this.image = image;
- OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_BIG, hImage);
-
- /*
- * Bug in Windows. When WM_SETICON is used to remove an
- * icon from the window trimmings for a window with the
- * extended style bits WS_EX_DLGMODALFRAME, the window
- * trimmings do not redraw to hide the previous icon.
- * The fix is to force a redraw.
- */
- if (!OS.IsWinCE) {
- if (hIcon == 0 && (style & SWT.BORDER) != 0) {
- int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, null, 0, flags);
- }
- }
-}
-
-/**
- * Sets the maximized state of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the maximized state, and if the argument is
- * <code>false</code> and the receiver was previously maximized,
- * causes the receiver to switch back to either the minimized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMinimized
- */
-public void setMaximized (boolean maximized) {
- checkWidget ();
- swFlags = maximized ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE;
- if (OS.IsWinCE) {
- /*
- * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The
- * workaround is to resize the window to fit the parent client area.
- * PocketPC windows typically don't have a caption when they are
- * maximized. They usually have one when they are not occupying all the
- * space. We implement this behavior by default - it can be overriden by
- * setting SWT.TITLE or SWT.NO_TRIM.
- */
- if (maximized) {
- if ((style & SWT.TITLE) == 0) {
- /* remove caption when maximized */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits &= ~OS.WS_CAPTION;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- }
- int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- int width = rect.right - rect.left, height = rect.bottom - rect.top;
- /* leave space for menubar */
- if (menuBar != null) {
- RECT rectCB = new RECT ();
- OS.GetWindowRect (hwndCB, rectCB);
- height -= rectCB.bottom - rectCB.top;
- }
- OS.SetWindowPos (handle, 0, rect.left, rect.top, width, height, flags);
- } else {
- if ((style & SWT.NO_TRIM) == 0) {
- /* insert caption when no longer maximized */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits |= OS.WS_CAPTION;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- int flags = OS.SWP_NOMOVE | OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME;
- OS.SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
- }
- }
- } else {
- if (!OS.IsWindowVisible (handle)) return;
- if (maximized == OS.IsZoomed (handle)) return;
- OS.ShowWindow (handle, swFlags);
- OS.UpdateWindow (handle);
- }
-}
-
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-/**
- * Sets the receiver's menu bar to the argument, which
- * may be null.
- *
- * @param menu the new menu bar
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenuBar (Menu menu) {
- checkWidget ();
- if (menuBar == menu) return;
- if (menu != null) {
- if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
- if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
- }
- if (OS.IsWinCE) {
- /*
- * Note in WinCE PPC. MenuBar is a separate popup window. If
- * the Shell is full screen, resize its window to leave
- * space for the MenuBar.
- */
- boolean resize = (getMaximized() && menuBar != menu);
- if (menuBar != null) {
- OS.CommandBar_Destroy (hwndCB);
- hwndCB = 0;
- hwndTB = 0;
- }
- menuBar = menu;
- if (menuBar != null) {
- SHMENUBARINFO mbi = new SHMENUBARINFO ();
- mbi.cbSize = mbi.sizeof;
- mbi.hwndParent = handle;
- mbi.dwFlags = 0;
- mbi.nToolBarId = 100; /* as defined in .rc file */
- mbi.hInstRes = OS.GetLibraryHandle ();
- boolean res = OS.SHCreateMenuBar (mbi);
- hwndCB = mbi.hwndMB;
-
- /* Get ToolBar */
- if (hwndCB != 0) hwndTB = OS.GetWindow (hwndCB, OS.GW_CHILD);
-
- if (hwndTB == 0) {
- /* we can't use the menubar */
- if (hwndCB != 0) OS.CommandBar_Destroy (hwndCB);
- return;
- }
- /* remove the menu item coming from the resource file */
- OS.SendMessage (hwndTB, OS.TB_DELETEBUTTON, 0, 0);
-
- /* populate tool bar mapping menu items to tool items */
- if (menuBar.getItemCount () > 0) {
- MenuItem[] items = menuBar.getItems ();
- TBBUTTON lpButton = new TBBUTTON ();
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_TEXT;
- for (int i = 0; i < items.length; i++) {
- MenuItem item = items[i];
- /* insert item */
- lpButton.idCommand = item.id;
- lpButton.fsStyle = (byte) (OS.TBSTYLE_DROPDOWN | OS.TBSTYLE_AUTOSIZE | 0x80);
- lpButton.fsState = (byte) OS.TBSTATE_ENABLED;
- lpButton.iBitmap = OS.I_IMAGENONE;
- if ((item.style & SWT.SEPARATOR) != 0) {
- lpButton.fsStyle = (byte) OS.BTNS_SEP;
- }
- OS.SendMessage (hwndTB, OS.TB_INSERTBUTTON, i, lpButton);
-
- if ((item.style & SWT.SEPARATOR) == 0) {
- /* set text */
- String string = item.getText();
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (0, string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- info.pszText = pszText;
- OS.SendMessage (hwndTB, OS.TB_SETBUTTONINFO, item.id, info);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
-
- /* set state */
- if (!item.isEnabled()) {
- int fsState = 0;
- OS.SendMessage (hwndTB, OS.TB_SETSTATE, item.id, fsState);
- }
-
- /* set menu */
- Menu menu2 = item.menu;
- if (menu2 != null) {
- OS.SendMessage (hwndCB, OS.SHCMBM_SETSUBMENU, item.id, menu2.handle);
- }
- }
- }
- }
- }
- if (resize) setMaximized (true);
- } else {
- menuBar = menu;
- int hMenu = 0;
- if (menuBar != null) hMenu = menuBar.handle;
- OS.SetMenu (handle, hMenu);
- }
- destroyAcceleratorTable ();
-}
-
-/**
- * Sets the minimized stated of the receiver.
- * If the argument is <code>true</code> causes the receiver
- * to switch to the minimized state, and if the argument is
- * <code>false</code> and the receiver was previously minimized,
- * causes the receiver to switch back to either the maximized
- * or normal states.
- * <p>
- * Note: The result of intermixing calls to<code>setMaximized(true)</code>
- * and <code>setMinimized(true)</code> will vary by platform. Typically,
- * the behavior will match the platform user's expectations, but not
- * always. This should be avoided if possible.
- * </p>
- *
- * @param the new maximized state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setMaximized
- */
-public void setMinimized (boolean minimized) {
- checkWidget ();
- if (OS.IsWinCE) return;
- swFlags = OS.SW_RESTORE;
- if (minimized) swFlags = OS.SW_SHOWMINNOACTIVE;
- if (!OS.IsWindowVisible (handle)) return;
- if (minimized == OS.IsIconic (handle)) return;
- OS.ShowWindow (handle, swFlags);
- OS.UpdateWindow (handle);
-}
-
-void setParent () {
- /*
- * In order for an MDI child window to support
- * a menu bar, setParent () is needed to reset
- * the parent. Otherwise, the MDI child window
- * will appear as a separate shell. This is an
- * undocumented and possibly dangerous Windows
- * feature.
- */
- Display display = getDisplay ();
- int hwndParent = parent.handle;
- display.lockActiveWindow = true;
- OS.SetParent (handle, hwndParent);
- if (!OS.IsWindowVisible (hwndParent)) {
- OS.ShowWindow (handle, OS.SW_SHOWNA);
- }
- display.lockActiveWindow = false;
-}
-
-void setSavedFocus (Control control) {
- if (this == control) {
- savedFocus = null;
- return;
- }
- if (this != control.menuShell ()) return;
- savedFocus = control;
-}
-
-void setSystemMenu () {
- if (OS.IsWinCE) return;
- int hMenu = OS.GetSystemMenu (handle, false);
- if (hMenu == 0) return;
- int oldCount = OS.GetMenuItemCount (hMenu);
- if ((style & SWT.RESIZE) == 0) {
- OS.DeleteMenu (hMenu, OS.SC_SIZE, OS.MF_BYCOMMAND);
- }
- if ((style & SWT.MIN) == 0) {
- OS.DeleteMenu (hMenu, OS.SC_MINIMIZE, OS.MF_BYCOMMAND);
- }
- if ((style & SWT.MAX) == 0) {
- OS.DeleteMenu (hMenu, OS.SC_MAXIMIZE, OS.MF_BYCOMMAND);
- }
- if ((style & (SWT.MIN | SWT.MAX)) == 0) {
- OS.DeleteMenu (hMenu, OS.SC_RESTORE, OS.MF_BYCOMMAND);
- }
- int newCount = OS.GetMenuItemCount (hMenu);
- if ((style & SWT.CLOSE) == 0 || newCount != oldCount) {
- OS.DeleteMenu (hMenu, OS.SC_TASKLIST, OS.MF_BYCOMMAND);
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_ID;
- int index = 0;
- while (index < newCount) {
- if (OS.GetMenuItemInfo (hMenu, index, true, info)) {
- if (info.wID == OS.SC_CLOSE) break;
- }
- index++;
- }
- if (index != newCount) {
- OS.DeleteMenu (hMenu, index - 1, OS.MF_BYPOSITION);
- if ((style & SWT.CLOSE) == 0) {
- OS.DeleteMenu (hMenu, OS.SC_CLOSE, OS.MF_BYCOMMAND);
- }
- }
- }
-}
-
-/**
- * Sets the receiver's text, which is the string that the
- * window manager will typically display as the receiver's
- * <em>title</em>, to the argument, which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, string, true);
- OS.SetWindowText (handle, buffer);
-}
-
-public void setVisible (boolean visible) {
- checkWidget ();
- if (visible == OS.IsWindowVisible (handle)) return;
- if (visible) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the show
- * event. If this happens, just return.
- */
- sendEvent (SWT.Show);
- if (isDisposed ()) return;
- if (OS.IsWinCE) {
- OS.ShowWindow (handle, OS.SW_SHOW);
- } else {
- OS.DrawMenuBar (handle);
- OS.ShowWindow (handle, swFlags);
- }
- OS.UpdateWindow (handle);
- } else {
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- swFlags = OS.SW_SHOWMINNOACTIVE;
- } else {
- if (OS.IsZoomed (handle)) {
- swFlags = OS.SW_SHOWMAXIMIZED;
- } else {
- if (handle == OS.GetActiveWindow ()) {
- swFlags = OS.SW_RESTORE;
- } else {
- swFlags = OS.SW_SHOWNOACTIVATE;
- }
- }
- }
- }
- OS.ShowWindow (handle, OS.SW_HIDE);
- sendEvent (SWT.Hide);
- }
-}
-
-boolean translateAccelerator (MSG msg) {
- if (!isEnabled ()) return false;
- if (hAccel == -1) createAcceleratorTable ();
- if (hAccel == 0) return false;
- return OS.TranslateAccelerator (handle, hAccel, msg) != 0;
-}
-
-boolean traverseItem (boolean next) {
- return false;
-}
-
-int widgetExtStyle () {
- int bits = 0;
- if ((style & SWT.NO_TRIM) != 0) return bits;
- if (OS.IsWinCE) {
- if ((style & SWT.CLOSE) != 0) bits |= OS.WS_EX_CAPTIONOKBTN;
- }
- if ((style & SWT.TOOL) != 0) bits |= OS.WS_EX_TOOLWINDOW;
- if ((style & SWT.RESIZE) != 0) return bits;
- if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_DLGMODALFRAME;
- return bits;
-}
-
-int widgetStyle () {
- /*
- * Set WS_POPUP and clear WS_VISIBLE and WS_TABSTOP.
- * NOTE: WS_TABSTOP is the same as WS_MAXIMIZEBOX so
- * it cannot be used to do tabbing with decorations.
- */
- int bits = super.widgetStyle () | OS.WS_POPUP;
- bits &= ~(OS.WS_VISIBLE | OS.WS_TABSTOP);
-
- /* Set the title bits and no-trim bits */
- bits &= ~OS.WS_BORDER;
- if ((style & SWT.NO_TRIM) != 0) return bits;
- if ((style & SWT.TITLE) != 0) bits |= OS.WS_CAPTION;
-
- /* Set the min and max button bits */
- if ((style & SWT.MIN) != 0) bits |= OS.WS_MINIMIZEBOX;
- if ((style & SWT.MAX) != 0) bits |= OS.WS_MAXIMIZEBOX;
-
- /* Set the resize, dialog border or border bits */
- if ((style & SWT.RESIZE) != 0) {
- bits |= OS.WS_THICKFRAME;
- } else {
- if ((style & SWT.BORDER) == 0) bits |= OS.WS_BORDER;
- }
-
- /* Set the system menu and close box bits */
- if (!OS.IsWinCE) {
- if ((style & SWT.CLOSE) != 0) bits |= OS.WS_SYSMENU;
- }
-
- return bits;
-}
-
-int windowProc (int msg, int wParam, int lParam) {
- switch (msg) {
- case OS.WM_APP:
- case OS.WM_APP+1:
- if (hAccel == -1) createAcceleratorTable ();
- return msg == OS.WM_APP ? nAccel : hAccel;
- }
- return super.windowProc (msg, wParam, lParam);
-}
-
-LRESULT WM_ACTIVATE (int wParam, int lParam) {
- LRESULT result = super.WM_ACTIVATE (wParam, lParam);
- if (result != null) return result;
- if ((wParam & 0xFFFF) == 0) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the deactivate
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- Shell shell = getShell ();
- shell.setActiveControl (null);
- if (isDisposed ()) return LRESULT.ZERO;
- sendEvent (SWT.Deactivate);
- if (isDisposed ()) return LRESULT.ZERO;
- saveFocus ();
- } else {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the activate
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Activate);
- if (isDisposed ()) return LRESULT.ZERO;
- if (restoreFocus ()) return LRESULT.ZERO;
- }
- return result;
-}
-
-LRESULT WM_CLOSE (int wParam, int lParam) {
- LRESULT result = super.WM_CLOSE (wParam, lParam);
- if (result != null) return result;
- Event event = new Event ();
- sendEvent (SWT.Close, event);
- // the widget could be disposed at this point
- if (event.doit && !isDisposed ()) dispose ();
- return LRESULT.ZERO;
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_KILLFOCUS (wParam, lParam);
- saveFocus ();
- return result;
-}
-
-LRESULT WM_NCACTIVATE (int wParam, int lParam) {
- LRESULT result = super.WM_NCACTIVATE (wParam, lParam);
- if (result != null) return result;
- if (wParam == 0) {
- Display display = getDisplay ();
- if (display.lockActiveWindow) return LRESULT.ZERO;
- }
- return result;
-}
-
-LRESULT WM_QUERYOPEN (int wParam, int lParam) {
- LRESULT result = super.WM_QUERYOPEN (wParam, lParam);
- if (result != null) return result;
- sendEvent (SWT.Deiconify);
- // widget could be disposed at this point
- return result;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- restoreFocus ();
- return result;
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning the result of the
- * WM_SIZE message.
- */
- if (isDisposed ()) return result;
- if (wParam == OS.SIZE_MINIMIZED) {
- sendEvent (SWT.Iconify);
- // widget could be disposed at this point
- }
- return result;
-}
-
-LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
- LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam);
- if (result != null) return result;
- Display display = getDisplay ();
- if (display.lockActiveWindow) {
- WINDOWPOS lpwp = new WINDOWPOS ();
- OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
- lpwp.flags |= OS.SWP_NOZORDER;
- OS.MoveMemory (lParam, lpwp, WINDOWPOS.sizeof);
- }
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java
deleted file mode 100755
index ae85be6b07..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select a directory.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class DirectoryDialog extends Dialog {
- String message = "", filterPath = "";
- String directoryPath;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public DirectoryDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-int BrowseCallbackProc (int hwnd, int uMsg, int lParam, int lpData) {
- switch (uMsg) {
- case OS.BFFM_INITIALIZED:
- if (filterPath != null && filterPath.length () != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, filterPath, true);
- OS.SendMessage (hwnd, OS.BFFM_SETSELECTION, 1, buffer);
- }
- if (title != null && title.length () != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, title, true);
- OS.SetWindowText (hwnd, buffer);
- }
- break;
- case OS.BFFM_VALIDATEFAILEDA:
- case OS.BFFM_VALIDATEFAILEDW:
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, 256);
- int byteCount = buffer.length () * TCHAR.sizeof;
- OS.MoveMemory (buffer, lParam, byteCount);
- directoryPath = buffer.toString (0, buffer.strlen ());
- break;
- }
- return 0;
-}
-
-/**
- * Returns the path which the dialog will use to filter
- * the directories it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the selected directory,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- if (OS.IsWinCE) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
-
- /* Initialize OLE */
- OS.OleInitialize (0);
-
- int hHeap = OS.GetProcessHeap ();
-
- /* Get the owner HWND for the dialog */
- int hwndOwner = 0;
- if (parent != null) hwndOwner = parent.handle;
-
- /* Copy the message to OS memory */
- int lpszTitle = 0;
- if (message != null && message.length () != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, message, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- lpszTitle = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpszTitle, buffer, byteCount);
- }
-
- /* Create the BrowseCallbackProc */
- Callback callback = new Callback (this, "BrowseCallbackProc", 4);
- int address = callback.getAddress ();
-
- /* Open the dialog */
- directoryPath = null;
- BROWSEINFO lpbi = new BROWSEINFO ();
- lpbi.hwndOwner = hwndOwner;
- lpbi.lpszTitle = lpszTitle;
- lpbi.ulFlags = OS.BIF_RETURNONLYFSDIRS | OS.BIF_EDITBOX | OS.BIF_VALIDATE;
- lpbi.lpfn = address;
- int lpItemIdList = OS.SHBrowseForFolder (lpbi);
- if (lpItemIdList != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, 256);
- if (OS.SHGetPathFromIDList (lpItemIdList, buffer)) {
- directoryPath = buffer.toString (0, buffer.strlen ());
- }
- }
-
- /* Free the BrowseCallbackProc */
- callback.dispose ();
-
- /* Free the OS memory */
- if (lpszTitle != 0) OS.HeapFree (hHeap, 0, lpszTitle);
-
- /* Free the pointer to the ITEMIDLIST */
- int [] ppMalloc = new int [1];
- if (OS.SHGetMalloc (ppMalloc) == OS.S_OK) {
- /* void Free (struct IMalloc *this, void *pv); */
- OS.VtblCall (5, ppMalloc [0], lpItemIdList);
- }
-
- /* Uninitialize OLE */
- OS.OleUninitialize ();
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (hwndOwner != 0) OS.UpdateWindow (hwndOwner);
-
- /* Return the directory path */
- return directoryPath;
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the directories it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
deleted file mode 100755
index 5e0c1272e9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ /dev/null
@@ -1,1848 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class are responsible for managing the
- * connection between SWT and the underlying operating
- * system. Their most important function is to implement
- * the SWT event loop in terms of the platform event model.
- * They also provide various methods for accessing information
- * about the operating system, and have overall control over
- * the operating system resources which SWT allocates.
- * <p>
- * Applications which are built with SWT will <em>almost always</em>
- * require only a single display. In particular, some platforms
- * which SWT supports will not allow more than one <em>active</em>
- * display. In other words, some platforms do not support
- * creating a new display if one already exists that has not been
- * sent the <code>dispose()</code> message.
- * <p>
- * In SWT, the thread which creates a <code>Display</code>
- * instance is distinguished as the <em>user-interface thread</em>
- * for that display.
- * </p>
- * The user-interface thread for a particular display has the
- * following special attributes:
- * <ul>
- * <li>
- * The event loop for that display must be run from the thread.
- * </li>
- * <li>
- * Some SWT API methods (notably, most of the public methods in
- * <code>Widget</code> and its subclasses), may only be called
- * from the thread. (To support multi-threaded user-interface
- * applications, class <code>Display</code> provides inter-thread
- * communication methods which allow threads other than the
- * user-interface thread to request that it perform operations
- * on their behalf.)
- * </li>
- * <li>
- * The thread is not allowed to construct other
- * <code>Display</code>s until that display has been disposed.
- * (Note that, this is in addition to the restriction mentioned
- * above concerning platform support for multiple displays. Thus,
- * the only way to have multiple simultaneously active displays,
- * even on platforms which support it, is to have multiple threads.)
- * </li>
- * </ul>
- * Enforcing these attributes allows SWT to be implemented directly
- * on the underlying operating system's event model. This has
- * numerous benefits including smaller footprint, better use of
- * resources, safer memory management, clearer program logic,
- * better performance, and fewer overall operating system threads
- * required. The down side however, is that care must be taken
- * (only) when constructing multi-threaded applications to use the
- * inter-thread communication mechanisms which this class provides
- * when required.
- * </p><p>
- * All SWT API methods which may only be called from the user-interface
- * thread are distinguished in their documentation by indicating that
- * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
- * SWT exception.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- *
- * @see #syncExec
- * @see #asyncExec
- * @see #wake
- * @see #readAndDispatch
- * @see #sleep
- * @see #dispose
- */
-
-public class Display extends Device {
-
- /**
- * the handle to the OS message queue
- * (Warning: This field is platform dependent)
- */
- public MSG msg = new MSG ();
-
- /* Windows, Events and Callback */
- Event [] eventQueue;
- Callback windowCallback;
- int windowProc, threadId, processId;
- TCHAR windowClass;
- static int windowClassCount = 0;
- static final String WindowName = "SWT_Window";
-
- /* Sync/Async Widget Communication */
- Synchronizer synchronizer = new Synchronizer (this);
- Thread thread;
-
- /* Display Shutdown */
- Runnable [] disposeList;
-
- /* Timers */
- int timerCount;
- int [] timerIds;
- Runnable [] timerList;
-
- /* Keyboard and Mouse State */
- boolean lastVirtual;
- boolean lockActiveWindow;
- int lastKey, lastAscii, lastMouse;
- byte [] keyboard = new byte [256];
- boolean accelKeyHit, mnemonicKeyHit;
-
- /* System Fonts */
- int hwndShell;
- int [] systemFonts;
-
- /* Image list cache */
- ImageList[] imageList, toolImageList, toolHotImageList, toolDisabledImageList;
-
- /* Key Mappings */
- static final int [] [] KeyTable = {
-
- /* Keyboard and Mouse Masks */
- {OS.VK_MENU, SWT.ALT},
- {OS.VK_SHIFT, SWT.SHIFT},
- {OS.VK_CONTROL, SWT.CONTROL},
-
- /* NOT CURRENTLY USED */
-// {OS.VK_LBUTTON, SWT.BUTTON1},
-// {OS.VK_MBUTTON, SWT.BUTTON3},
-// {OS.VK_RBUTTON, SWT.BUTTON2},
-
- /* Non-Numeric Keypad Constants */
- {OS.VK_UP, SWT.ARROW_UP},
- {OS.VK_DOWN, SWT.ARROW_DOWN},
- {OS.VK_LEFT, SWT.ARROW_LEFT},
- {OS.VK_RIGHT, SWT.ARROW_RIGHT},
- {OS.VK_PRIOR, SWT.PAGE_UP},
- {OS.VK_NEXT, SWT.PAGE_DOWN},
- {OS.VK_HOME, SWT.HOME},
- {OS.VK_END, SWT.END},
- {OS.VK_INSERT, SWT.INSERT},
-
- /* NOT CURRENTLY USED */
-// {OS.VK_DELETE, SWT.DELETE},
-
- /* Functions Keys */
- {OS.VK_F1, SWT.F1},
- {OS.VK_F2, SWT.F2},
- {OS.VK_F3, SWT.F3},
- {OS.VK_F4, SWT.F4},
- {OS.VK_F5, SWT.F5},
- {OS.VK_F6, SWT.F6},
- {OS.VK_F7, SWT.F7},
- {OS.VK_F8, SWT.F8},
- {OS.VK_F9, SWT.F9},
- {OS.VK_F10, SWT.F10},
- {OS.VK_F11, SWT.F11},
- {OS.VK_F12, SWT.F12},
-
- /* Numeric Keypad Constants */
- /* NOT CURRENTLY USED */
-// {OS.VK_ADD, SWT.KP_PLUS},
-// {OS.VK_SUBTRACT, SWT.KP_MINUS},
-// {OS.VK_MULTIPLY, SWT.KP_TIMES},
-// {OS.VK_DIVIDE, SWT.KP_DIVIDE},
-// {OS.VK_DECIMAL, SWT.KP_PERIOD},
-// {OS.VK_RETURN, SWT.KP_ENTER},
-// {OS.VK_NUMPAD0, SWT.KP_0},
-// {OS.VK_NUMPAD1, SWT.KP_1},
-// {OS.VK_NUMPAD2, SWT.KP_2},
-// {OS.VK_NUMPAD3, SWT.KP_3},
-// {OS.VK_NUMPAD4, SWT.KP_4},
-// {OS.VK_NUMPAD5, SWT.KP_5},
-// {OS.VK_NUMPAD6, SWT.KP_6},
-// {OS.VK_NUMPAD7, SWT.KP_7},
-// {OS.VK_NUMPAD8, SWT.KP_8},
-// {OS.VK_NUMPAD9, SWT.KP_9},
-
- };
-
- /* Multiple Displays */
- static Display Default;
- static Display [] Displays = new Display [4];
-
- /* Modality */
- Shell [] ModalWidgets;
- static boolean TrimEnabled = false;
-
- /* Package Name */
- static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets.";
- /*
- * This code is intentionally commented. In order
- * to support CLDC, .class cannot be used because
- * it does not compile on some Java compilers when
- * they are targeted for CLDC.
- */
-// static {
-// String name = Display.class.getName ();
-// int index = name.lastIndexOf ('.');
-// PACKAGE_PREFIX = name.substring (0, index + 1);
-// }
-
- /* Display Data */
- Object data;
- String [] keys;
- Object [] values;
-
- /*
- * TEMPORARY CODE. Install the runnable that
- * gets the current display. This code will
- * be removed in the future.
- */
- static {
- DeviceFinder = new Runnable () {
- public void run () {
- Device device = getCurrent ();
- if (device == null) {
- device = getDefault ();
- }
- setDevice (device);
- }
- };
- }
-
-/*
-* TEMPORARY CODE.
-*/
-static void setDevice (Device device) {
- CurrentDevice = device;
-}
-
-/**
- * Constructs a new instance of this class.
- * <p>
- * Note: The resulting display is marked as the <em>current</em>
- * display. If this is the first display which has been
- * constructed since the application started, it is also
- * marked as the <em>default</em> display.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see #getCurrent
- * @see #getDefault
- * @see Widget#checkSubclass
- * @see Shell
- */
-public Display () {
- this (null);
-}
-
-public Display (DeviceData data) {
- super (data);
-}
-
-int asciiKey (int key) {
- if (OS.IsWinCE) return 0;
-
- /* Get the current keyboard. */
- for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
- if (!OS.GetKeyboardState (keyboard)) return 0;
-
- /* Translate the key to ASCII or UNICODE using the virtual keyboard */
- if (OS.IsUnicode) {
- char [] result = new char [1];
- if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
- } else {
- short [] result = new short [1];
- if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0];
- }
- return 0;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The caller of this method continues
- * to run in parallel, and is not notified when the
- * runnable has completed.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @see #syncExec
- */
-public void asyncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.asyncExec (runnable);
-}
-
-/**
- * Causes the system hardware to emit a short sound
- * (if it supports this capability).
- */
-public void beep () {
- checkDevice ();
- OS.MessageBeep (OS.MB_OK);
-}
-
-/**
- * Checks that this class can be subclassed.
- * <p>
- * IMPORTANT: See the comment in <code>Widget.checkSubclass()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see Widget#checkSubclass
- */
-protected void checkSubclass () {
- if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-protected void checkDevice () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-}
-
-static synchronized void checkDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] != null && Displays [i].thread == thread) {
- SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- }
-}
-
-void clearModal (Shell shell) {
- if (ModalWidgets == null) return;
- int index = 0, length = ModalWidgets.length;
- while (index < length) {
- if (ModalWidgets [index] == shell) break;
- if (ModalWidgets [index] == null) return;
- index++;
- }
- if (index == length) return;
- System.arraycopy (ModalWidgets, index + 1, ModalWidgets, index, --length - index);
- ModalWidgets [length] = null;
- if (index == 0 && ModalWidgets [0] == null) ModalWidgets = null;
- if (!TrimEnabled) return;
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) shells [i].updateModal ();
-}
-
-int controlKey (int key) {
- int upper = OS.CharUpper ((short) key);
- if (64 <= upper && upper <= 95) return upper & 0xBF;
- return key;
-}
-
-/**
- * Creates the device in the operating system. If the device
- * does not have a handle, this method may do nothing depending
- * on the device.
- * <p>
- * This method is called before <code>init</code>.
- * </p>
- *
- * @param data the DeviceData which describes the receiver
- *
- * @see #init
- */
-protected void create (DeviceData data) {
- checkSubclass ();
- checkDisplay (thread = Thread.currentThread ());
- createDisplay (data);
- register (this);
- if (Default == null) Default = this;
-}
-
-void createDisplay (DeviceData data) {
-}
-
-static synchronized void deregister (Display display) {
- for (int i=0; i<Displays.length; i++) {
- if (display == Displays [i]) Displays [i] = null;
- }
-}
-
-/**
- * Destroys the device in the operating system and releases
- * the device's handle. If the device does not have a handle,
- * this method may do nothing depending on the device.
- * <p>
- * This method is called after <code>release</code>.
- * </p>
- * @see #dispose
- * @see #release
- */
-protected void destroy () {
- if (this == Default) Default = null;
- deregister (this);
- destroyDisplay ();
-}
-
-void destroyDisplay () {
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread just before the
- * receiver is disposed.
- *
- * @param runnable code to run at dispose time.
- */
-public void disposeExec (Runnable runnable) {
- checkDevice ();
- if (disposeList == null) disposeList = new Runnable [4];
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] == null) {
- disposeList [i] = runnable;
- return;
- }
- }
- Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
- System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
- newDisposeList [disposeList.length] = runnable;
- disposeList = newDisposeList;
-}
-
-/**
- * Does whatever display specific cleanup is required, and then
- * uses the code in <code>SWTError.error</code> to handle the error.
- *
- * @param code the descriptive error code
- *
- * @see SWTError#error
- */
-void error (int code) {
- SWT.error (code);
-}
-
-boolean filterMessage (MSG msg) {
- int message = msg.message;
- if (msg.hwnd == hwndShell) {
- switch (message) {
- case OS.WM_TIMER:
- if (timerList != null && timerIds != null) {
- for (int i=0; i<timerIds.length; i++) {
- if (timerIds [i] == msg.wParam) {
- OS.KillTimer (hwndShell, timerIds [i]);
- timerIds [i] = 0;
- Runnable runnable = timerList [i];
- timerList [i] = null;
- if (runnable != null) runnable.run ();
- }
- }
- }
- break;
- }
- return false;
- }
- if (OS.WM_KEYFIRST <= message && message <= OS.WM_KEYLAST) {
- Control control = findControl (msg.hwnd);
- if (control != null) {
- if (translateAccelerator (msg, control)) return true;
- if (translateMnemonic (msg, control)) return true;
- if (translateTraversal (msg, control)) return true;
- }
- }
- return false;
-}
-
-/**
- * Given the operating system handle for a widget, returns
- * the instance of the <code>Widget</code> subclass which
- * represents it in the currently running application, if
- * such exists, or null if no matching widget can be found.
- *
- * @param handle the handle for the widget
- * @return the SWT widget that the handle represents
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Widget findWidget (int handle) {
- checkDevice ();
- return WidgetTable.get (handle);
-}
-
-Control findControl(int handle) {
- if (handle == 0) return null;
- /*
- * This code is intentionally commented. It is possible
- * find the SWT control that is associated with a handle
- * that belongs to another process when the handle was
- * created by an in-proc OLE client. In this case, the
- * handle comes from another process, but it is a child
- * of an SWT control. For now, it is necessary to look
- * at handles that do not belong to the SWT process.
- */
-// int [] hwndProcessId = new int [1];
-// OS.GetWindowThreadProcessId (handle, hwndProcessId);
-// if (hwndProcessId [0] != processId) return null;
- do {
- Control control = WidgetTable.get (handle);
- if (control != null && control.handle == handle) {
- return control;
- }
- } while ((handle = OS.GetParent (handle)) != 0);
- return null;
-}
-
-
-/**
- * Returns the display which the given thread is the
- * user-interface thread for, or null if the given thread
- * is not a user-interface thread for any display.
- *
- * @param thread the user-interface thread
- * @return the display for the given thread
- */
-public static synchronized Display findDisplay (Thread thread) {
- for (int i=0; i<Displays.length; i++) {
- Display display = Displays [i];
- if (display != null && display.thread == thread) {
- return display;
- }
- }
- return null;
-}
-
-/**
- * Returns the currently active <code>Shell</code>, or null
- * if no shell belonging to the currently running application
- * is active.
- *
- * @return the active shell or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell getActiveShell () {
- checkDevice ();
- Control control = findControl (OS.GetActiveWindow ());
- if (control instanceof Shell) return (Shell) control;
- return null;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location.
- *
- * @return the bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkDevice ();
- int width = OS.GetSystemMetrics (OS.SM_CXSCREEN);
- int height = OS.GetSystemMetrics (OS.SM_CYSCREEN);
- return new Rectangle (0, 0, width, height);
-}
-
-/**
- * Returns the display which the currently running thread is
- * the user-interface thread for, or null if the currently
- * running thread is not a user-interface thread for any display.
- *
- * @return the current display
- */
-public static synchronized Display getCurrent () {
- return findDisplay (Thread.currentThread ());
-}
-
-public Rectangle getClientArea () {
- checkDevice ();
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-/**
- * Returns the control which the on-screen pointer is currently
- * over top of, or null if it is not currently over one of the
- * controls built by the currently running application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getCursorControl () {
- checkDevice ();
- POINT pt = new POINT ();
- if (!OS.GetCursorPos (pt)) return null;
- return findControl (OS.WindowFromPoint (pt));
-}
-
-/**
- * Returns the location of the on-screen pointer relative
- * to the top left corner of the screen.
- *
- * @return the cursor location
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCursorLocation () {
- checkDevice ();
- POINT pt = new POINT ();
- OS.GetCursorPos (pt);
- return new Point (pt.x, pt.y);
-}
-
-/**
- * Returns the default display. One is created (making the
- * thread that invokes this method its user-interface thread)
- * if it did not already exist.
- *
- * @return the default display
- */
-public static synchronized Display getDefault () {
- if (Default == null) Default = new Display ();
- return Default;
-}
-
-static boolean isValidClass (Class clazz) {
- String name = clazz.getName ();
- int index = name.lastIndexOf ('.');
- return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData (String key) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the application defined, display specific data
- * associated with the receiver, or null if it has not been
- * set. The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @return the display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public Object getData () {
- checkDevice ();
- return data;
-}
-
-/**
- * Returns the longest duration, in milliseconds, between
- * two mouse button clicks that will be considered a
- * <em>double click</em> by the underlying operating system.
- *
- * @return the double click time
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getDoubleClickTime () {
- checkDevice ();
- return OS.GetDoubleClickTime ();
-}
-
-/**
- * Returns the control which currently has keyboard focus,
- * or null if keyboard events are not currently going to
- * any of the controls built by the currently running
- * application.
- *
- * @return the control under the cursor
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getFocusControl () {
- checkDevice ();
- return findControl (OS.GetFocus ());
-}
-
-/**
- * Returns the maximum allowed depth of icons on this display.
- * On some platforms, this may be different than the actual
- * depth of the display.
- *
- * @return the maximum icon depth
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIconDepth () {
- checkDevice ();
-
- /* Use the character encoding for the default locale */
- TCHAR buffer1 = new TCHAR (0, "Control Panel\\Desktop\\WindowMetrics", true);
-
- int [] phkResult = new int [1];
- int result = OS.RegOpenKeyEx (OS.HKEY_CURRENT_USER, buffer1, 0, OS.KEY_READ, phkResult);
- if (result != 0) return 4;
- int depth = 4;
- int [] lpcbData = {128};
-
- /* Use the character encoding for the default locale */
- TCHAR lpData = new TCHAR (0, lpcbData [0]);
- TCHAR buffer2 = new TCHAR (0, "Shell Icon BPP", true);
-
- result = OS.RegQueryValueEx (phkResult [0], buffer2, 0, null, lpData, lpcbData);
- if (result == 0) {
- try {
- depth = Integer.parseInt (lpData.toString (0, lpData.strlen ()));
- } catch (NumberFormatException e) {};
- }
- OS.RegCloseKey (phkResult [0]);
- return depth;
-}
-
-ImageList getImageList (Point size) {
- if (imageList == null) imageList = new ImageList [4];
-
- int i = 0;
- int length = imageList.length;
- while (i < length) {
- ImageList list = imageList [i];
- if (list == null) break;
- if (list.getImageSize().equals(size)) {
- list.addRef();
- return list;
- }
- i++;
- }
-
- if (i == length) {
- ImageList [] newList = new ImageList [length + 4];
- System.arraycopy (imageList, 0, newList, 0, length);
- imageList = newList;
- }
-
- ImageList list = new ImageList();
- imageList [i] = list;
- list.addRef();
- return list;
-}
-
-ImageList getToolImageList (Point size) {
- if (toolImageList == null) toolImageList = new ImageList [4];
-
- int i = 0;
- int length = toolImageList.length;
- while (i < length) {
- ImageList list = toolImageList [i];
- if (list == null) break;
- if (list.getImageSize().equals(size)) {
- list.addRef();
- return list;
- }
- i++;
- }
-
- if (i == length) {
- ImageList [] newList = new ImageList [length + 4];
- System.arraycopy (toolImageList, 0, newList, 0, length);
- toolImageList = newList;
- }
-
- ImageList list = new ImageList();
- toolImageList [i] = list;
- list.addRef();
- return list;
-}
-
-ImageList getToolHotImageList (Point size) {
- if (toolHotImageList == null) toolHotImageList = new ImageList [4];
-
- int i = 0;
- int length = toolHotImageList.length;
- while (i < length) {
- ImageList list = toolHotImageList [i];
- if (list == null) break;
- if (list.getImageSize().equals(size)) {
- list.addRef();
- return list;
- }
- i++;
- }
-
- if (i == length) {
- ImageList [] newList = new ImageList [length + 4];
- System.arraycopy (toolHotImageList, 0, newList, 0, length);
- toolHotImageList = newList;
- }
-
- ImageList list = new ImageList();
- toolHotImageList [i] = list;
- list.addRef();
- return list;
-}
-
-ImageList getToolDisabledImageList (Point size) {
- if (toolDisabledImageList == null) toolDisabledImageList = new ImageList [4];
-
- int i = 0;
- int length = toolDisabledImageList.length;
- while (i < length) {
- ImageList list = toolDisabledImageList [i];
- if (list == null) break;
- if (list.getImageSize().equals(size)) {
- list.addRef();
- return list;
- }
- i++;
- }
-
- if (i == length) {
- ImageList [] newList = new ImageList [length + 4];
- System.arraycopy (toolDisabledImageList, 0, newList, 0, length);
- toolDisabledImageList = newList;
- }
-
- ImageList list = new ImageList();
- toolDisabledImageList [i] = list;
- list.addRef();
- return list;
-}
-
-Shell getModalShell () {
- if (ModalWidgets == null) return null;
- int index = ModalWidgets.length;
- while (--index >= 0) {
- Shell shell = ModalWidgets [index];
- if (shell != null) return shell;
- }
- return null;
-}
-
-/**
- * Returns an array containing all shells which have not been
- * disposed and have the receiver as their display.
- *
- * @return the receiver's shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkDevice ();
- /*
- * NOTE: Need to check that the shells that belong
- * to another display have not been disposed by the
- * other display's thread as the shells list is being
- * processed.
- */
- int count = 0;
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- count++;
- }
- }
- if (count == shells.length) return shells;
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- result [index++] = shell;
- }
- }
- return result;
-}
-
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or null if no such runnable is currently being invoked by
- * the user-interface thread.
- * <p>
- * Note: If a runnable invoked by asyncExec is currently
- * running, this method will return null.
- * </p>
- *
- * @return the receiver's sync-interface thread
- */
-public Thread getSyncThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return synchronizer.syncThread;
-}
-
-/**
- * Returns the matching standard color for the given
- * constant, which should be one of the color constants
- * specified in class <code>SWT</code>. Any value other
- * than one of the SWT color constants which is passed
- * in will result in the color black. This color should
- * not be free'd because it was allocated by the system,
- * not the application.
- *
- * @param id the color constant
- * @return the matching color
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public Color getSystemColor (int id) {
- checkDevice ();
- int pixel = 0x02000000;
- switch (id) {
- case SWT.COLOR_WIDGET_DARK_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DDKSHADOW); break;
- case SWT.COLOR_WIDGET_NORMAL_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DSHADOW); break;
- case SWT.COLOR_WIDGET_LIGHT_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DLIGHT); break;
- case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: pixel = OS.GetSysColor (OS.COLOR_3DHIGHLIGHT); break;
- case SWT.COLOR_WIDGET_BACKGROUND: pixel = OS.GetSysColor (OS.COLOR_3DFACE); break;
- case SWT.COLOR_WIDGET_BORDER: pixel = OS.GetSysColor (OS.COLOR_WINDOWFRAME); break;
- case SWT.COLOR_WIDGET_FOREGROUND:
- case SWT.COLOR_LIST_FOREGROUND: pixel = OS.GetSysColor (OS.COLOR_WINDOWTEXT); break;
- case SWT.COLOR_LIST_BACKGROUND: pixel = OS.GetSysColor (OS.COLOR_WINDOW); break;
- case SWT.COLOR_LIST_SELECTION: pixel = OS.GetSysColor (OS.COLOR_HIGHLIGHT); break;
- case SWT.COLOR_LIST_SELECTION_TEXT: pixel = OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT);break;
- case SWT.COLOR_INFO_FOREGROUND: pixel = OS.GetSysColor (OS.COLOR_INFOTEXT); break;
- case SWT.COLOR_INFO_BACKGROUND: pixel = OS.GetSysColor (OS.COLOR_INFOBK); break;
- case SWT.COLOR_TITLE_FOREGROUND: pixel = OS.GetSysColor (OS.COLOR_CAPTIONTEXT); break;
- case SWT.COLOR_TITLE_BACKGROUND: pixel = OS.GetSysColor (OS.COLOR_ACTIVECAPTION); break;
- case SWT.COLOR_TITLE_BACKGROUND_GRADIENT:
- pixel = OS.GetSysColor (OS.COLOR_GRADIENTACTIVECAPTION);
- if (pixel == 0) pixel = OS.GetSysColor (OS.COLOR_ACTIVECAPTION);
- break;
- case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: pixel = OS.GetSysColor (OS.COLOR_INACTIVECAPTIONTEXT); break;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: pixel = OS.GetSysColor (OS.COLOR_INACTIVECAPTION); break;
- case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT:
- pixel = OS.GetSysColor (OS.COLOR_GRADIENTINACTIVECAPTION);
- if (pixel == 0) pixel = OS.GetSysColor (OS.COLOR_INACTIVECAPTION);
- break;
- default:
- return super.getSystemColor (id);
- }
- return Color.win32_new (this, pixel);
-}
-
-/**
- * Returns a reasonable font for applications to use.
- * On some platforms, this will match the "default font"
- * or "system font" if such can be found. This font
- * should not be free'd because it was allocated by the
- * system, not the application.
- * <p>
- * Typically, applications which want the default look
- * should simply not set the font on the widgets they
- * create. Widgets are always created with the correct
- * default font for the class of user-interface component
- * they represent.
- * </p>
- *
- * @return a font
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Font getSystemFont () {
- checkDevice ();
- int hFont = systemFont ();
- return Font.win32_new (this, hFont);
-}
-
-/**
- * Returns the user-interface thread for the receiver.
- *
- * @return the receiver's user-interface thread
- */
-public Thread getThread () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- return thread;
-}
-
-/**
- * Invokes platform specific functionality to allocate a new GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param data the platform specific GC data
- * @return the platform specific GC handle
- *
- * @private
- */
-public int internal_new_GC (GCData data) {
- if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
- int hDC = OS.GetDC (0);
- if (hDC == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- if (data != null) {
- data.device = this;
- data.hFont = systemFont ();
- }
- return hDC;
-}
-
-/**
- * Initializes any internal resources needed by the
- * device.
- * <p>
- * This method is called after <code>create</code>.
- * </p>
- *
- * @see #create
- */
-protected void init () {
- super.init ();
-
- /* Create the callbacks */
- windowCallback = new Callback (this, "windowProc", 4);
- windowProc = windowCallback.getAddress ();
- if (windowProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- /* Remember the current procsss and thread */
- threadId = OS.GetCurrentThreadId ();
- processId = OS.GetCurrentProcessId ();
-
- /* Use the character encoding for the default locale */
- windowClass = new TCHAR (0, WindowName + windowClassCount++, true);
-
- /* Register the SWT window class */
- int hHeap = OS.GetProcessHeap ();
- int hInstance = OS.GetModuleHandle (null);
- WNDCLASS lpWndClass = new WNDCLASS ();
- if (OS.GetClassInfo (hInstance, windowClass, lpWndClass)) {
- OS.UnregisterClass (windowClass, hInstance);
- }
- lpWndClass.hInstance = hInstance;
- lpWndClass.lpfnWndProc = windowProc;
- lpWndClass.style = OS.CS_BYTEALIGNWINDOW | OS.CS_DBLCLKS;
- lpWndClass.hCursor = OS.LoadCursor (0, OS.IDC_ARROW);
- int byteCount = windowClass.length () * TCHAR.sizeof;
- int lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- lpWndClass.lpszClassName = lpszClassName;
- OS.MoveMemory (lpszClassName, windowClass, byteCount);
- OS.RegisterClass (lpWndClass);
-
- /* Initialize the system font */
- int systemFont = 0;
- if (!OS.IsWinCE) {
- NONCLIENTMETRICS info = new NONCLIENTMETRICS ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- systemFont = OS.CreateFontIndirect (info.lfMessageFont);
- }
- }
- if (systemFont == 0) systemFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT);
- if (systemFont == 0) systemFont = OS.GetStockObject (OS.SYSTEM_FONT);
- if (systemFont != 0) systemFonts = new int [] {systemFont};
-
- /* Create the message only HWND */
- hwndShell = OS.CreateWindowEx (0,
- windowClass,
- null,
- OS.WS_OVERLAPPED,
- 0, 0, 0, 0,
- 0,
- 0,
- hInstance,
- null);
-}
-
-/**
- * Invokes platform specific functionality to dispose a GC handle.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Display</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param handle the platform specific GC handle
- * @param data the platform specific GC data
- *
- * @private
- */
-public void internal_dispose_GC (int hDC, GCData data) {
- OS.ReleaseDC (0, hDC);
-}
-
-boolean isValidThread () {
- return thread == Thread.currentThread ();
-}
-
-boolean isVirtualKey (int key) {
- return (key == OS.VK_TAB) || (key == OS.VK_MENU) ||
- (key == OS.VK_RETURN) || (key == OS.VK_BACK) ||
- (key == OS.VK_SPACE) || (key == OS.VK_ESCAPE) ||
- (key == OS.VK_SHIFT) || (key == OS.VK_CONTROL);
-}
-
-void postEvent (Event event) {
- /*
- * Place the event at the end of the event queue.
- * This code is always called in the Display's
- * thread so it must be re-enterant but does not
- * need to be synchronized.
- */
- if (eventQueue == null) eventQueue = new Event [4];
- int index = 0;
- int length = eventQueue.length;
- while (index < length) {
- if (eventQueue [index] == null) break;
- index++;
- }
- if (index == length) {
- Event [] newQueue = new Event [length + 4];
- System.arraycopy (eventQueue, 0, newQueue, 0, length);
- eventQueue = newQueue;
- }
- eventQueue [index] = event;
-}
-
-/**
- * Reads an event from the operating system's event queue,
- * dispatches it appropriately, and returns <code>true</code>
- * if there is potentially more work to do, or <code>false</code>
- * if the caller can sleep until another event is placed on
- * the event queue.
- * <p>
- * In addition to checking the system event queue, this method also
- * checks if any inter-thread messages (created by <code>syncExec()</code>
- * or <code>asyncExec()</code>) are waiting to be processed, and if
- * so handles them before returning.
- * </p>
- *
- * @return <code>false</code> if the caller can sleep upon return from this method
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #sleep
- * @see #wake
- */
-public boolean readAndDispatch () {
- checkDevice ();
- if (OS.PeekMessage (msg, 0, 0, 0, OS.PM_REMOVE)) {
- if (!filterMessage (msg)) {
- OS.TranslateMessage (msg);
- OS.DispatchMessage (msg);
- }
- runDeferredEvents ();
- return true;
- }
- return runAsyncMessages ();
-}
-
-static synchronized void register (Display display) {
- for (int i=0; i<Displays.length; i++) {
- if (Displays [i] == null) {
- Displays [i] = display;
- return;
- }
- }
- Display [] newDisplays = new Display [Displays.length + 4];
- System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
- newDisplays [Displays.length] = display;
- Displays = newDisplays;
-}
-
-/**
- * Releases any internal resources back to the operating
- * system and clears all fields except the device handle.
- * <p>
- * Disposes all shells which are currently open on the display.
- * After this method has been invoked, all related related shells
- * will answer <code>true</code> when sent the message
- * <code>isDisposed()</code>.
- * </p><p>
- * When a device is destroyed, resources that were acquired
- * on behalf of the programmer need to be returned to the
- * operating system. For example, if the device allocated a
- * font to be used as the system font, this font would be
- * freed in <code>release</code>. Also,to assist the garbage
- * collector and minimize the amount of memory that is not
- * reclaimed when the programmer keeps a reference to a
- * disposed device, all fields except the handle are zero'd.
- * The handle is needed by <code>destroy</code>.
- * </p>
- * This method is called before <code>destroy</code>.
- *
- * @see #dispose
- * @see #destroy
- */
-protected void release () {
-
- /* Release shells */
- Shell [] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
- }
- }
- while (readAndDispatch ()) {};
-
- /* Run dispose list */
- if (disposeList != null) {
- for (int i=0; i<disposeList.length; i++) {
- if (disposeList [i] != null) disposeList [i].run ();
- }
- }
- disposeList = null;
-
- /* Release synchronizer */
- synchronizer.releaseSynchronizer ();
- synchronizer = null;
-
- releaseDisplay ();
-
- super.release ();
-}
-
-void releaseDisplay () {
- /* Destroy the message only HWND */
- if (hwndShell != 0) OS.DestroyWindow (hwndShell);
- hwndShell = 0;
-
- /* Unregister the SWT Window class */
- int hHeap = OS.GetProcessHeap ();
- int hInstance = OS.GetModuleHandle (null);
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, windowClass, lpWndClass);
- OS.UnregisterClass (windowClass, hInstance);
- OS.HeapFree (hHeap, 0, lpWndClass.lpszClassName);
-
- /* Release callbacks */
- windowClass = null;
- windowCallback.dispose ();
- windowCallback = null;
-
- /* Release the system fonts */
- if (systemFonts != null) {
- for (int i=0; i<systemFonts.length; i++) {
- if (systemFonts [i] != 0) OS.DeleteObject (systemFonts [i]);
- }
- }
- systemFonts = null;
-
- /* Release references */
- thread = null;
- msg = null;
- keyboard = null;
- ModalWidgets = null;
- data = null;
- keys = null;
- values = null;
-}
-
-void releaseImageList (ImageList list) {
- int i = 0;
- int length = imageList.length;
- while (i < length) {
- if (imageList [i] == list) {
- if (list.removeRef () > 0) return;
- list.dispose ();
- System.arraycopy (imageList, i + 1, imageList, i, --length - i);
- imageList [length] = null;
- for (int j=0; j<length; j++) {
- if (imageList [j] != null) return;
- }
- imageList = null;
- return;
- }
- i++;
- }
-}
-
-void releaseToolImageList (ImageList list) {
- int i = 0;
- int length = toolImageList.length;
- while (i < length) {
- if (toolImageList [i] == list) {
- if (list.removeRef () > 0) return;
- list.dispose ();
- System.arraycopy (toolImageList, i + 1, toolImageList, i, --length - i);
- toolImageList [length] = null;
- for (int j=0; j<length; j++) {
- if (toolImageList [j] != null) return;
- }
- toolImageList = null;
- return;
- }
- i++;
- }
-}
-
-void releaseToolHotImageList (ImageList list) {
- int i = 0;
- int length = toolHotImageList.length;
- while (i < length) {
- if (toolHotImageList [i] == list) {
- if (list.removeRef () > 0) return;
- list.dispose ();
- System.arraycopy (toolHotImageList, i + 1, toolHotImageList, i, --length - i);
- toolHotImageList [length] = null;
- for (int j=0; j<length; j++) {
- if (toolHotImageList [j] != null) return;
- }
- toolHotImageList = null;
- return;
- }
- i++;
- }
-}
-
-void releaseToolDisabledImageList (ImageList list) {
- int i = 0;
- int length = toolDisabledImageList.length;
- while (i < length) {
- if (toolDisabledImageList [i] == list) {
- if (list.removeRef () > 0) return;
- list.dispose ();
- System.arraycopy (toolDisabledImageList, i + 1, toolDisabledImageList, i, --length - i);
- toolDisabledImageList [length] = null;
- for (int j=0; j<length; j++) {
- if (toolDisabledImageList [j] != null) return;
- }
- toolDisabledImageList = null;
- return;
- }
- i++;
- }
-}
-
-boolean runAsyncMessages () {
- return synchronizer.runAsyncMessages ();
-}
-
-boolean runDeferredEvents () {
- /*
- * Run deferred events. This code is always
- * called in the Display's thread so it must
- * be re-enterant need not be synchronized.
- */
- while (eventQueue != null) {
-
- /* Take an event off the queue */
- Event event = eventQueue [0];
- if (event == null) break;
- int length = eventQueue.length;
- System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
- eventQueue [length] = null;
-
- /* Run the event */
- Widget widget = event.widget;
- if (widget != null && !widget.isDisposed ()) {
- Widget item = event.item;
- if (item == null || !item.isDisposed ()) {
- widget.notifyListeners (event.type, event);
- }
- }
-
- /*
- * At this point, the event queue could
- * be null due to a recursive invokation
- * when running the event.
- */
- }
-
- /* Clear the queue */
- eventQueue = null;
- return true;
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given argument.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the display is disposed
- * of, it is the application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- * @see #disposeExec
- */
-public void setData (String key, Object value) {
- checkDevice ();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Sets the application defined, display specific data
- * associated with the receiver, to the argument.
- * The <em>display specific data</em> is a single,
- * unnamed field that is stored with every display.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the display specific data needs to
- * be notified when the display is disposed of, it is the
- * application's responsibility provide a
- * <code>disposeExec()</code> handler which does so.
- * </p>
- *
- * @param data the new display specific data
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #getData
- * @see #disposeExec
- */
-public void setData (Object data) {
- checkDevice ();
- this.data = data;
-}
-
-/**
- * On platforms which support it, sets the application name
- * to be the argument. On Motif, for example, this can be used
- * to set the name used for resource lookup.
- *
- * @param name the new app name
- */
-public static void setAppName (String name) {
- /* Do nothing */
-}
-
-void setModal (Shell shell) {
- if (ModalWidgets == null) ModalWidgets = new Shell [4];
- int index = 0, length = ModalWidgets.length;
- while (index < length) {
- if (ModalWidgets [index] == shell) return;
- if (ModalWidgets [index] == null) break;
- index++;
- }
- if (index == length) {
- Shell [] newModalWidgets = new Shell [length + 4];
- System.arraycopy (ModalWidgets, 0, newModalWidgets, 0, length);
- ModalWidgets = newModalWidgets;
- }
- ModalWidgets [index] = shell;
- if (!TrimEnabled) return;
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) shells [i].updateModal ();
-}
-
-/**
- * Sets the synchronizer used by the display to be
- * the argument, which can not be null.
- *
- * @param synchronizer the new synchronizer for the display (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSynchronizer (Synchronizer synchronizer) {
- checkDevice ();
- if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (this.synchronizer != null) {
- this.synchronizer.runAsyncMessages();
- }
- this.synchronizer = synchronizer;
-}
-
-int shiftedKey (int key) {
- if (OS.IsWinCE) return 0;
-
- /* Clear the virtual keyboard and press the shift key */
- for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
- keyboard [OS.VK_SHIFT] |= 0x80;
-
- /* Translate the key to ASCII or UNICODE using the virtual keyboard */
- if (OS.IsUnicode) {
- char [] result = new char [1];
- if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
- } else {
- short [] result = new short [1];
- if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0];
- }
- return 0;
-}
-
-/**
- * Causes the user-interface thread to <em>sleep</em> (that is,
- * to be put in a state where it does not consume CPU cycles)
- * until an event is received or it is otherwise awakened.
- *
- * @return <code>true</code> if an event requiring dispatching was placed on the queue.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #wake
- */
-public boolean sleep () {
- checkDevice ();
- if (OS.IsWinCE) {
- OS.GetMessage (msg, 0, 0, 0);
- if (!filterMessage (msg)) {
- OS.TranslateMessage (msg);
- OS.DispatchMessage (msg);
- }
- runDeferredEvents ();
- return true;
- }
- return OS.WaitMessage ();
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread at the next
- * reasonable opportunity. The thread which calls this method
- * is suspended until the runnable completes.
- *
- * @param runnable code to run on the user-interface thread.
- *
- * @exception SWTException <ul>
- * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void syncExec (Runnable runnable) {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- synchronizer.syncExec (runnable);
-}
-
-int systemFont () {
- int hFont = 0;
- if (systemFonts != null) {
- int length = systemFonts.length;
- if (length != 0) hFont = systemFonts [length - 1];
- }
- if (hFont == 0) hFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT);
- if (hFont == 0) hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- return hFont;
-}
-
-/**
- * Causes the <code>run()</code> method of the runnable to
- * be invoked by the user-interface thread after the specified
- * number of milliseconds have elapsed.
- *
- * @param milliseconds the delay before running the runnable
- * @param runnable code to run on the user-interface thread
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #asyncExec
- */
-public void timerExec (int milliseconds, Runnable runnable) {
- checkDevice ();
- if (timerList == null) {
- timerList = new Runnable [4];
- timerIds = new int [4];
- }
- int index = 0;
- while (index < timerList.length) {
- if (timerList [index] == null) break;
- index++;
- }
- if (index == timerList.length) {
- Runnable [] newTimerList = new Runnable [timerList.length + 4];
- System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
- timerList = newTimerList;
- int [] newTimerIds = new int [timerIds.length + 4];
- System.arraycopy (timerIds, 0, newTimerIds, 0, timerIds.length);
- timerIds = newTimerIds;
- }
- timerCount++;
- int timerID = OS.SetTimer (hwndShell, timerCount, milliseconds, 0);
- if (timerID != 0) {
- timerList [index] = runnable;
- timerIds [index] = timerID;
- }
-}
-
-boolean translateAccelerator (MSG msg, Control control) {
- accelKeyHit = true;
- boolean result = control.translateAccelerator (msg);
- accelKeyHit = false;
- return result;
-}
-
-static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- }
- return 0;
-}
-
-boolean translateMnemonic (MSG msg, Control control) {
- switch (msg.message) {
- case OS.WM_CHAR:
- case OS.WM_SYSCHAR:
- return control.translateMnemonic (msg);
- }
- return false;
-}
-
-boolean translateTraversal (MSG msg, Control control) {
- if (msg.message == OS.WM_KEYDOWN) {
- switch (msg.wParam) {
- case OS.VK_RETURN:
- case OS.VK_ESCAPE:
- case OS.VK_TAB:
- case OS.VK_UP:
- case OS.VK_DOWN:
- case OS.VK_LEFT:
- case OS.VK_RIGHT:
- case OS.VK_PRIOR:
- case OS.VK_NEXT:
- return control.translateTraversal (msg);
- }
- }
- return false;
-}
-
-static int untranslateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [1] == key) return KeyTable [i] [0];
- }
- return 0;
-}
-
-public void update() {
- checkDevice ();
- Shell[] shells = WidgetTable.shells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
- shell.update ();
- }
- }
-}
-
-void updateFont () {
- if (OS.IsWinCE) return;
- Font oldFont = getSystemFont ();
- int systemFont = 0;
- NONCLIENTMETRICS info = new NONCLIENTMETRICS ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- systemFont = OS.CreateFontIndirect (info.lfMessageFont);
- }
- if (systemFont == 0) systemFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT);
- if (systemFont == 0) systemFont = OS.GetStockObject (OS.SYSTEM_FONT);
- if (systemFont == 0) return;
- int length = systemFonts == null ? 0 : systemFonts.length;
- int [] newFonts = new int [length + 1];
- if (systemFonts != null) {
- System.arraycopy (systemFonts, 0, newFonts, 0, length);
- }
- newFonts [length] = systemFont;
- systemFonts = newFonts;
- Font newFont = getSystemFont ();
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- shell.updateFont (oldFont, newFont);
- }
- }
-}
-
-/**
- * If the receiver's user-interface thread was <code>sleep</code>'ing,
- * causes it to be awakened and start running again. Note that this
- * method may be called from any thread.
- *
- * @see #sleep
- */
-public void wake () {
- if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
- OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
-}
-
-int windowProc (int hwnd, int msg, int wParam, int lParam) {
- if (hwnd == hwndShell && msg == OS.WM_SETTINGCHANGE) updateFont ();
- Control control = WidgetTable.get (hwnd);
- if (control != null) return control.windowProc (msg, wParam, lParam);
- return OS.DefWindowProc (hwnd, msg, wParam, lParam);
-}
-
-static String withCrLf (String string) {
-
- /* If the string is empty, return the string. */
- int length = string.length ();
- if (length == 0) return string;
-
- /*
- * Check for an LF or CR/LF and assume the rest of
- * the string is formated that way. This will not
- * work if the string contains mixed delimiters.
- */
- int i = string.indexOf ('\n', 0);
- if (i == -1) return string;
- if (i > 0 && string.charAt (i - 1) == '\r') {
- return string;
- }
-
- /*
- * The string is formatted with LF. Compute the
- * number of lines and the size of the buffer
- * needed to hold the result
- */
- i++;
- int count = 1;
- while (i < length) {
- if ((i = string.indexOf ('\n', i)) == -1) break;
- count++; i++;
- }
- count += length;
-
- /* Create a new string with the CR/LF line terminator. */
- i = 0;
- StringBuffer result = new StringBuffer (count);
- while (i < length) {
- int j = string.indexOf ('\n', i);
- if (j == -1) j = length;
- result.append (string.substring (i, j));
- if ((i = j) < length) {
- result.append ("\r\n");
- i++;
- }
- }
- return result.toString ();
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
deleted file mode 100755
index 665f7959e2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to navigate
- * the file system and select or enter a file name.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SAVE, OPEN, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FileDialog extends Dialog {
- String [] filterNames = new String [0];
- String [] filterExtensions = new String [0];
- String [] fileNames = new String [0];
- String filterPath = "", fileName = "";
- String fullPath = "";
- static final String FILTER = "*.*";
- static int BUFFER_SIZE = 1024 * 10;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FileDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns the path of the first file that was
- * selected in the dialog relative to the filter path,
- * or null if none is available.
- *
- * @return the relative path of the file
- */
-public String getFileName () {
- return fileName;
-}
-
-/**
- * Returns the paths of all files that were selected
- * in the dialog relative to the filter path, or null
- * if none are available.
- *
- * @return the relative paths of the files
- */
-public String [] getFileNames () {
- return fileNames;
-}
-
-/**
- * Returns the file extensions which the dialog will
- * use to filter the files it shows.
- *
- * @return the file extensions filter
- */
-public String [] getFilterExtensions () {
- return filterExtensions;
-}
-
-/**
- * Returns the file names which the dialog will
- * use to filter the files it shows.
- *
- * @return the file name filter
- */
-public String [] getFilterNames () {
- return filterNames;
-}
-
-/**
- * Returns the path which the dialog will use to filter
- * the files it shows.
- *
- * @return the filter path
- */
-public String getFilterPath () {
- return filterPath;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a string describing the absolute path of the first selected file,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public String open () {
- int hHeap = OS.GetProcessHeap ();
-
- /* Get the owner HWND for the dialog */
- int hwndOwner = 0;
- if (parent != null) hwndOwner = parent.handle;
-
- /* Convert the title and copy it into lpstrTitle */
- if (title == null) title = "";
- /* Use the character encoding for the default locale */
- TCHAR buffer3 = new TCHAR (0, title, true);
- int byteCount3 = buffer3.length () * TCHAR.sizeof;
- int lpstrTitle = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount3);
- OS.MoveMemory (lpstrTitle, buffer3, byteCount3);
-
- /* Compute filters and copy into lpstrFilter */
- String strFilter = "";
- if (filterNames == null) filterNames = new String [0];
- if (filterExtensions == null) filterExtensions = new String [0];
- for (int i=0; i<filterExtensions.length; i++) {
- String filterName = filterExtensions [i];
- if (i < filterNames.length) filterName = filterNames [i];
- strFilter = strFilter + filterName + '\0' + filterExtensions [i] + '\0';
- }
- if (filterExtensions.length == 0) {
- strFilter = strFilter + FILTER + '\0' + FILTER + '\0';
- }
- /* Use the character encoding for the default locale */
- TCHAR buffer4 = new TCHAR (0, strFilter, true);
- int byteCount4 = buffer4.length () * TCHAR.sizeof;
- int lpstrFilter = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount4);
- OS.MoveMemory (lpstrFilter, buffer4, byteCount4);
-
- /* Convert the fileName and filterName to C strings */
- if (fileName == null) fileName = "";
- /* Use the character encoding for the default locale */
- TCHAR name = new TCHAR (0, fileName, true);
-
- /*
- * Bug/Feature in Windows. Verify that the file name is valid.
- * If an invalid file name is passed to the standard dialog, it
- * does not open and returns an error code. The fix is to avoid
- * this behavior by verifying the file name before opening the
- * dialog. If the file name is not valid, use an empty string.
- */
- if (!OS.IsWinCE) {
- if (OS.GetFileTitle (name, null, (short) 0) < 0) {
- name = new TCHAR (0, "", true);
- }
- }
-
- /*
- * Copy the name into lpstrFile and ensure that the
- * last byte is NULL and the buffer does not overrun.
- * Note that the longest that a single path name can
- * be on Windows is 256.
- */
- int nMaxFile = 256;
- if ((style & SWT.MULTI) != 0) nMaxFile = Math.max (nMaxFile, BUFFER_SIZE);
- int byteCount = nMaxFile * TCHAR.sizeof;
- int lpstrFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- int byteCountFile = Math.min (name.length () * TCHAR.sizeof, byteCount - TCHAR.sizeof);
- OS.MoveMemory (lpstrFile, name, byteCountFile);
-
- /*
- * Copy the path into lpstrInitialDir and ensure that
- * the last byte is NULL and the buffer does not overrun.
- */
- if (filterPath == null) filterPath = "";
- /* Use the character encoding for the default locale */
- TCHAR path = new TCHAR (0, filterPath, true);
- int lpstrInitialDir = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- int byteCountDir = Math.min (path.length () * TCHAR.sizeof, byteCount - TCHAR.sizeof);
- OS.MoveMemory (lpstrInitialDir, path, byteCountDir);
-
- /* Create the file dialog struct */
- OPENFILENAME struct = new OPENFILENAME ();
- struct.lStructSize = OPENFILENAME.sizeof;
- struct.Flags = OS.OFN_HIDEREADONLY | OS.OFN_NOCHANGEDIR;
- if ((style & SWT.MULTI) != 0) {
- struct.Flags |= OS.OFN_ALLOWMULTISELECT | OS.OFN_EXPLORER;
- }
- struct.hwndOwner = hwndOwner;
- struct.lpstrTitle = lpstrTitle;
- struct.lpstrFile = lpstrFile;
- struct.nMaxFile = nMaxFile;
- struct.lpstrInitialDir = lpstrInitialDir;
- struct.lpstrFilter = lpstrFilter;
- struct.nFilterIndex = 0;
-
- /*
- * Feature in Windows. The focus window is not saved and
- * and restored automatically by the call to GetOpenFileName ().
- * The fix is to save and restore the focus window.
- */
- int hwndFocus = OS.GetFocus ();
-
- /*
- * Bug/Feature in Windows. When Windows opens the standard
- * file dialog, it changes the cursor to the hourglass and
- * does not put it back. The fix is to save the current
- * cursor and restore it when the dialog closes.
- */
- int hCursor = OS.GetCursor ();
-
- /*
- * Open the dialog. If the open fails due to an invalid
- * file name, use an empty file name and open it again.
- */
- boolean save = (style & SWT.SAVE) != 0;
- boolean success = (save) ? OS.GetSaveFileName (struct) : OS.GetOpenFileName (struct);
- if (OS.CommDlgExtendedError () == OS.FNERR_INVALIDFILENAME) {
- OS.MoveMemory (lpstrFile, new TCHAR (0, "", true), TCHAR.sizeof);
- success = (save) ? OS.GetSaveFileName (struct) : OS.GetOpenFileName (struct);
- }
-
- /* Set the new path, file name and filter */
- fullPath = null;
- if (success) {
-
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, struct.nMaxFile);
- int byteCount1 = buffer.length () * TCHAR.sizeof;
- OS.MoveMemory (buffer, lpstrFile, byteCount1);
-
- /* Use the character encoding for the default locale */
- TCHAR prefix = new TCHAR (0, struct.nFileOffset - 1);
- int byteCount2 = prefix.length () * TCHAR.sizeof;
- OS.MoveMemory (prefix, lpstrFile, byteCount2);
- filterPath = prefix.toString (0, prefix.length ());
-
- /*
- * Get each file from the buffer. Files are delimited
- * by a NULL character with 2 NULL characters at the end.
- */
- int count = 0;
- fileNames = new String [(style & SWT.MULTI) != 0 ? 4 : 1];
- int start = struct.nFileOffset;
- do {
- int end = start;
- while (end < buffer.length () && buffer.tcharAt (end) != 0) end++;
- String string = buffer.toString (start, end - start);
- start = end;
- if (count == fileNames.length) {
- String [] newFileNames = new String [fileNames.length + 4];
- System.arraycopy (fileNames, 0, newFileNames, 0, fileNames.length);
- fileNames = newFileNames;
- }
- fileNames [count++] = string;
- if ((style & SWT.MULTI) == 0) break;
- start++;
- } while (start < buffer.length () && buffer.tcharAt (start) != 0);
-
- if (fileNames.length > 0) fileName = fileNames [0];
- String separator = "";
- int length = filterPath.length ();
- if (length > 0 && filterPath.charAt (length - 1) != '\\') {
- separator = "\\";
- }
- fullPath = filterPath + separator + fileName;
- if (count < fileNames.length) {
- String [] newFileNames = new String [count];
- System.arraycopy (fileNames, 0, newFileNames, 0, count);
- fileNames = newFileNames;
- }
- }
-
- /* Free the memory that was allocated. */
- OS.HeapFree (hHeap, 0, lpstrFile);
- OS.HeapFree (hHeap, 0, lpstrFilter);
- OS.HeapFree (hHeap, 0, lpstrInitialDir);
- OS.HeapFree (hHeap, 0, lpstrTitle);
-
- /* Restore the old cursor */
- OS.SetCursor (hCursor);
-
- /* Restore the old focus */
- OS.SetFocus (hwndFocus);
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (hwndOwner != 0) OS.UpdateWindow (hwndOwner);
-
- /* Answer the full path or null */
- return fullPath;
-}
-
-/**
- * Set the initial filename which the dialog will
- * select by default when opened to the argument,
- * which may be null. The name will be prefixed with
- * the filter path when one is supplied.
- *
- * @param string the file name
- */
-public void setFileName (String string) {
- fileName = string;
-}
-
-/**
- * Set the file extensions which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param extensions the file extension filter
- */
-public void setFilterExtensions (String [] extensions) {
- filterExtensions = extensions;
-}
-
-/**
- * Sets the file names which the dialog will
- * use to filter the files it shows to the argument,
- * which may be null.
- *
- * @param names the file name filter
- */
-public void setFilterNames (String [] names) {
- filterNames = names;
-}
-
-/**
- * Sets the path which the dialog will use to filter
- * the files it shows to the argument, which may be
- * null.
- *
- * @param string the filter path
- */
-public void setFilterPath (String string) {
- filterPath = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java
deleted file mode 100755
index 31ae9eefe5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class allow the user to select a font
- * from all available fonts in the system.
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class FontDialog extends Dialog {
- FontData fontData;
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent) {
- this (parent, SWT.PRIMARY_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public FontDialog (Shell parent, int style) {
- super (parent, style);
- checkSubclass ();
-}
-
-/**
- * Returns a FontData object describing the font that was
- * selected in the dialog, or null if none is available.
- *
- * @return the FontData for the selected font, or null
- */
-public FontData getFontData() {
- return fontData;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return a FontData object describing the font that was selected,
- * or null if the dialog was cancelled or an error occurred
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public FontData open () {
- if (OS.IsWinCE) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
-
- /* Get the owner HWND for the dialog */
- int hwndOwner = 0;
- if (parent != null) hwndOwner = parent.handle;
-
- /* Open the dialog */
- int hHeap = OS.GetProcessHeap ();
- CHOOSEFONT lpcf = new CHOOSEFONT ();
- lpcf.lStructSize = CHOOSEFONT.sizeof;
- lpcf.hwndOwner = hwndOwner;
- lpcf.Flags = OS.CF_SCREENFONTS | OS.CF_EFFECTS;
- int lpLogFont = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, LOGFONT.sizeof);
- if (fontData != null && fontData.data != null) {
- lpcf.Flags |= OS.CF_INITTOLOGFONTSTRUCT;
- OS.MoveMemory (lpLogFont, fontData.data, LOGFONT.sizeof);
- }
- lpcf.lpLogFont = lpLogFont;
- fontData = null;
- if (OS.ChooseFont (lpcf)) {
- LOGFONT logFont = new LOGFONT ();
- OS.MoveMemory (logFont, lpLogFont, LOGFONT.sizeof);
-
- /*
- * This will not work on multiple screens or
- * for printing. Should use DC for the proper device.
- */
- int hDC = OS.GetDC(0);
- int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY);
- int pixels = 0;
- if (logFont.lfHeight > 0) {
- /*
- * Feature in Windows. If the lfHeight of the LOGFONT structure
- * is positive, the lfHeight measures the height of the entire
- * cell, including internal leading, in logical units. Since the
- * height of a font in points does not include the internal leading,
- * we must subtract the internal leading, which requires a TEXTMETRIC,
- * which in turn requires font creation.
- */
- int hFont = OS.CreateFontIndirect(logFont);
- int oldFont = OS.SelectObject(hDC, hFont);
- TEXTMETRIC lptm = new TEXTMETRIC();
- OS.GetTextMetrics(hDC, lptm);
- OS.SelectObject(hDC, oldFont);
- OS.DeleteObject(hFont);
- pixels = logFont.lfHeight - lptm.tmInternalLeading;
- } else {
- pixels = -logFont.lfHeight;
- }
- OS.ReleaseDC(0, hDC);
-
- int points = Compatibility.round(pixels * 72, logPixelsY);
- fontData = FontData.win32_new (logFont, points);
- }
-
- /* Free the OS memory */
- if (lpLogFont != 0) OS.HeapFree (hHeap, 0, lpLogFont);
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (hwndOwner != 0) OS.UpdateWindow (hwndOwner);
-
- return fontData;
-}
-
-/**
- * Sets a FontData object describing the font to be
- * selected by default in the dialog, or null to let
- * the platform choose one.
- *
- * @param fontData the FontData to use initially, or null
- */
-public void setFontData (FontData fontData) {
- this.fontData = fontData;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java
deleted file mode 100755
index 84a3e46e44..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java
+++ /dev/null
@@ -1,327 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class provide an etched border
- * with an optional title.
- * <p>
- * Shadow styles are hints and may not be honoured
- * by the platform. To create a group with the
- * default shadow style for the platform, do not
- * specify a shadow style.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Group extends Composite {
- static final int GroupProc;
- static final TCHAR GroupClass = new TCHAR (0, "BUTTON", true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, GroupClass, lpWndClass);
- GroupProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Group (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (GroupProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- style |= SWT.NO_FOCUS;
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- RECT rect = new RECT ();
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- int length = OS.GetWindowTextLength (handle);
- TCHAR buffer1 = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer1, length + 1);
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE;
- OS.DrawText (hDC, buffer1, length, rect, flags);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- width = size.x; height = size.y;
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- Rectangle trim = computeTrim (0, 0, width, height);
- width = Math.max (trim.width, rect.right - rect.left + 6);
- height = trim.height;
- return new Point (width, height);
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget ();
- Rectangle trim = super.computeTrim (x, y, width, height);
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- int inset = 3;
- trim.x -= inset; trim.y -= tm.tmHeight;
- trim.width += (inset * 2); trim.height += tm.tmHeight + inset;
- return trim;
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-}
-
-public Rectangle getClientArea () {
- checkWidget ();
- if (parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- int inset = 3, x = inset, y = tm.tmHeight;
- return new Rectangle (x, y, rect.right - (inset * 2), rect.bottom - y - inset);
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which is the string that the
- * is used as the <em>title</em>. If the text has not previously
- * been set, returns an empty string.
- *
- * @return the text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-boolean mnemonicHit (char key) {
- return setFocus ();
-}
-
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-
-/**
- * Sets the receiver's text, which is the string that will
- * be displayed as the receiver's <em>title</em>, to the argument,
- * which may not be null.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SetWindowText (handle, buffer);
-}
-
-int widgetStyle () {
- /*
- * Bug in Windows. When GetDCEx () is called with DCX_INTERSECTUPDATE,
- * the HDC that is returned does not include the current update region.
- * This was confirmed under DEBUG Windows when GetDCEx () complained about
- * invalid flags. Therefore, it is not easily possible to get an HDC from
- * outside of WM_PAINT that includes the current damage and clips children.
- * Because the receiver has children and draws a frame and label, it is
- * necessary that the receiver always draw clipped, in the current damaged
- * area. The fix is to force the receiver to be fully clipped by including
- * WS_CLIPCHILDREN and WS_CLIPSIBLINGS in the default style bits.
- */
- return super.widgetStyle () | OS.BS_GROUPBOX | OS.WS_CLIPCHILDREN | OS.WS_CLIPSIBLINGS;
-}
-
-TCHAR windowClass () {
- return GroupClass;
-}
-
-int windowProc () {
- return GroupProc;
-}
-
-LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. When the user clicks on the group
- * box label, the group box takes focus. This is unwanted.
- * The fix is to avoid calling the group box window proc.
- */
- /*
- * Bug in Windows. For some reason, if we allow the group
- * box to take focus, it will draw on top of pull down combo
- * box children. The fix is to avoid calling the window proc
- * to disallow the receiver from getting focus.
- */
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_LBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return LRESULT.ZERO;
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- /*
- * Feature in Windows. When the user clicks on the group
- * box label, the group box takes focus. This is unwanted.
- * The fix is to avoid calling the group box window proc.
- */
- /*
- * Bug in Windows. For some reason, if we allow the group
- * box to take focus, it will draw on top of pull down combo
- * box children. The fix is to avoid calling the window proc
- * to disallow the receiver from getting focus.
- */
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- if (hooks (SWT.DragDetect)) {
- POINT pt = new POINT ();
- pt.x = (short) (lParam & 0xFFFF);
- pt.y = (short) (lParam >> 16);
- if (!OS.IsWinCE) {
- /*
- * The DragDetect function captures the mouse and tracks its movement until the user releases
- * the left button, presses the ESC key, or moves the mouse outside the drag rectangle around
- * the specified point. If the user moves the mouse outside of the drag rectangle, DragDetect
- * returns true.
- */
- if (OS.DragDetect (handle, pt)) {
- sendEvent (SWT.DragDetect);
- // widget could be disposed at this point
- } else {
- /*
- * The Mouse up event and the ESC key event have been consumed by DragDetect so
- * detect the cases and send the events.
- */
- if (OS.GetKeyState (OS.VK_ESCAPE) == 0) {
- sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam);
- // widget could be disposed at this point
- }
- }
- }
- }
- return LRESULT.ZERO;
-}
-
-LRESULT WM_NCHITTEST (int wParam, int lParam) {
- LRESULT result = super.WM_NCHITTEST (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. The window proc for the group box
- * returns HTTRANSPARTENT indicating that mouse messages
- * should not be delivered to the receiver and any children.
- * Normally, group boxes in Windows do not have children and
- * this is the correct behavior for this case. Because we
- * allow children, answer HTCLIENT to allow mouse messages
- * to be delivered to the children.
- */
- return new LRESULT (OS.HTCLIENT);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java
deleted file mode 100755
index ca3f8b00f4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-class ImageList {
- int handle, refCount;
- Image [] images;
- static final int CREATE_FLAGS;
- static {
- if (OS.IsWinCE) {
- CREATE_FLAGS = OS.ILC_MASK | OS.ILC_COLOR;
- } else {
- int flags = OS.ILC_MASK;
- int hDC = OS.GetDC (0);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- OS.ReleaseDC (0, hDC);
- int depth = bits * planes;
- switch (depth) {
- case 4:
- flags |= OS.ILC_COLOR4;
- break;
- case 8:
- flags |= OS.ILC_COLOR8;
- break;
- case 16:
- flags |= OS.ILC_COLOR16;
- break;
- case 24:
- flags |= OS.ILC_COLOR24;
- break;
- case 32:
- flags |= OS.ILC_COLOR32;
- break;
- default:
- flags |= OS.ILC_COLOR;
- }
- CREATE_FLAGS = flags;
- }
- }
-
-public ImageList () {
- handle = OS.ImageList_Create (32, 32, CREATE_FLAGS, 16, 16);
- images = new Image [4];
-}
-
-public int add (Image image) {
- int count = OS.ImageList_GetImageCount (handle);
- int index = 0;
- while (index < count) {
- if (images [index] != null) {
- if (images [index].isDisposed ()) images [index] = null;
- }
- if (images [index] == null) break;
- index++;
- }
- int [] cx = new int [1], cy = new int [1];
- if (count == 0) {
- Rectangle rect = image.getBounds();
- cx [0] = rect.width;
- cy [0] = rect.height;
- OS.ImageList_SetIconSize (handle, cx [0], cy [0]);
- }
- int hImage = image.handle;
- OS.ImageList_GetIconSize (handle, cx, cy);
- switch (image.type) {
- case SWT.BITMAP: {
- int hBitmap = copyBitmap (hImage, cx [0], cy [0]);
- int background = -1;
- Color color = image.getBackground ();
- if (color != null) background = color.handle;
- if (index == count) {
- if (background != -1) {
- OS.ImageList_AddMasked (handle, hBitmap, background);
- } else {
- int hMask = createMask (hBitmap, cx [0], cy [0], background);
- OS.ImageList_Add (handle, hBitmap, hMask);
- OS.DeleteObject (hMask);
- }
- } else {
- int hMask = createMask (hBitmap, cx [0], cy [0], background);
- OS.ImageList_Replace (handle, index, hBitmap, hMask);
- OS.DeleteObject (hMask);
- }
- OS.DeleteObject (hBitmap);
- break;
- }
- case SWT.ICON: {
- int hIcon = copyIcon (hImage, cx [0], cy [0]);
- OS.ImageList_ReplaceIcon (handle, index == count ? -1 : index, hIcon);
- OS.DestroyIcon (hIcon);
- break;
- }
- }
- if (index == images.length) {
- Image [] newImages = new Image [images.length + 4];
- System.arraycopy (images, 0, newImages, 0, images.length);
- images = newImages;
- }
- images [index] = image;
- return index;
-}
-
-int addRef() {
- return ++refCount;
-}
-
-int copyBitmap (int hImage, int width, int height) {
- BITMAP bm = new BITMAP ();
- OS.GetObject (hImage, BITMAP.sizeof, bm);
- int hDC = OS.GetDC (0);
- int hdc1 = OS.CreateCompatibleDC (hDC);
- OS.SelectObject (hdc1, hImage);
- int hdc2 = OS.CreateCompatibleDC (hDC);
- int hBitmap = OS.CreateCompatibleBitmap (hDC, width, height);
- OS.SelectObject (hdc2, hBitmap);
- if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
- OS.StretchBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, OS.SRCCOPY);
- OS.DeleteDC (hdc1);
- OS.DeleteDC (hdc2);
- OS.ReleaseDC (0, hDC);
- return hBitmap;
-}
-
-int copyIcon (int hImage, int width, int height) {
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- int hIcon = OS.CopyImage (hImage, OS.IMAGE_ICON, width, height, OS.LR_DEFAULTCOLOR);
- return hIcon != 0 ? hIcon : hImage;
-}
-
-int createMask (int hBitmap, int width, int height, int background) {
- int hMask = OS.CreateBitmap (width, height, 1, 1, null);
- int hDC = OS.GetDC (0);
- int hdc1 = OS.CreateCompatibleDC (hDC);
- if (background != -1) {
- OS.SelectObject (hdc1, hBitmap);
- int hdc2 = OS.CreateCompatibleDC (hDC);
- OS.SelectObject (hdc2, hMask);
- OS.SetBkColor (hdc1, background);
- OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY);
- OS.DeleteDC (hdc2);
- } else {
- int hOldBitmap = OS.SelectObject (hdc1, hMask);
- OS.PatBlt (hdc1, 0, 0, width, height, OS.BLACKNESS);
- OS.SelectObject (hdc1, hOldBitmap);
- }
- OS.ReleaseDC (0, hDC);
- OS.DeleteDC (hdc1);
- return hMask;
-}
-
-public void dispose () {
- if (handle != 0) OS.ImageList_Destroy (handle);
- handle = 0;
- images = null;
-}
-
-public Image get (int index) {
- return images [index];
-}
-
-public int getHandle () {
- return handle;
-}
-
-public Point getImageSize() {
- int [] cx = new int [1], cy = new int [1];
- OS.ImageList_GetIconSize (handle, cx, cy);
- return new Point (cx [0], cy [0]);
-}
-
-public int indexOf (Image image) {
- int count = OS.ImageList_GetImageCount (handle);
- for (int i=0; i<count; i++) {
- if (images [i] != null) {
- if (images [i].isDisposed ()) images [i] = null;
- if (images [i] != null && images [i].equals (image)) return i;
- }
- }
- return -1;
-}
-
-public void put (int index, Image image) {
- int count = OS.ImageList_GetImageCount (handle);
- if (!(0 <= index && index < count)) return;
- if (image != null) {
- int [] cx = new int [1], cy = new int [1];
- OS.ImageList_GetIconSize (handle, cx, cy);
- int hImage = image.handle;
- switch (image.type) {
- case SWT.BITMAP:
- int background = -1;
- Color color = image.getBackground ();
- if (color != null) background = color.handle;
- int hBitmap = copyBitmap (hImage, cx [0], cy [0]);
- int hMask = createMask (hBitmap, cx [0], cy [0], background);
- OS.ImageList_Replace (handle, index, hBitmap, hMask);
- OS.DeleteObject (hBitmap);
- OS.DeleteObject (hMask);
- break;
- case SWT.ICON:
- int hIcon = copyIcon (hImage, cx [0], cy [0]);
- OS.ImageList_ReplaceIcon (handle, index, hIcon);
- OS.DestroyIcon (hIcon);
- break;
- }
- }
- images [index] = image;
-}
-
-public void remove (int index) {
- int count = OS.ImageList_GetImageCount (handle);
- if (!(0 <= index && index < count)) return;
- OS.ImageList_Remove (handle, index);
- System.arraycopy (images, index + 1, images, index, --count - index);
- images [index] = null;
-}
-
-int removeRef() {
- return --refCount;
-}
-
-public int size () {
- int result = 0;
- int count = OS.ImageList_GetImageCount (handle);
- for (int i=0; i<count; i++) {
- if (images [i] != null) {
- if (images [i].isDisposed ()) images [i] = null;
- if (images [i] == null) result++;
- }
- }
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
deleted file mode 100755
index 44f0d2f14f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
+++ /dev/null
@@ -1,531 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a non-selectable
- * user interface object that displays a string or image.
- * When SEPARATOR is specified, displays a single
- * vertical or horizontal line.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
- * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Label extends Control {
- Image image;
- int font;
- static final int LabelProc;
- static final TCHAR LabelClass = new TCHAR (0, "STATIC", true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, LabelClass, lpWndClass);
- LabelProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Label (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (LabelProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SEPARATOR) != 0) return style;
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- int border = getBorderWidth ();
- if ((style & SWT.SEPARATOR) != 0) {
- int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
- if ((style & SWT.HORIZONTAL) != 0) {
- width = DEFAULT_WIDTH; height = lineWidth * 2;
- } else {
- width = lineWidth * 2; height = DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- width += border * 2; height += border * 2;
- return new Point (width, height);
- }
- /*
- * NOTE: SS_BITMAP and SS_ICON are not single bit
- * masks so it is necessary to test for all of the
- * bits in these masks.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- boolean isBitmap = (bits & OS.SS_BITMAP) == OS.SS_BITMAP;
- boolean isIcon = (bits & OS.SS_ICON) == OS.SS_ICON;
- if (isBitmap || isIcon) {
- if (image != null) {
- Rectangle rect = image.getBounds();
- width = rect.width;
- height = rect.height;
- }
- } else {
- int hDC = OS.GetDC (handle);
- int newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- int oldFont = OS.SelectObject (hDC, newFont);
- RECT rect = new RECT ();
- int flags = OS.DT_CALCRECT;
- if ((style & SWT.WRAP) != 0 && wHint != SWT.DEFAULT) {
- flags |= OS.DT_WORDBREAK;
- rect.right = wHint;
- }
- int length = OS.GetWindowTextLength (handle);
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- OS.DrawText (hDC, buffer, length, rect, flags);
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
- if (height == 0) {
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- height = tm.tmHeight;
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- }
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- width += border * 2; height += border * 2;
- /*
- * Feature in WinCE PPC. Text labels have a trim
- * of one pixel wide on the right and left side.
- * The fix is to increase the size.
- */
- if (OS.IsWinCE) {
- if (!isBitmap && !isIcon) width += 2;
- }
- return new Point (width, height);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return 0;
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- *
- * @return the receiver's image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getImage () {
- checkWidget ();
- return image;
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return "";
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-/*
-* Not currently used.
-*/
-boolean getWrap () {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & (OS.SS_RIGHT | OS.SS_CENTER)) != 0) return true;
- if ((bits & OS.SS_LEFTNOWORDWRAP) != 0) return false;
- return true;
-}
-
-boolean mnemonicHit (char key) {
- Composite control = this.parent;
- while (control != null) {
- Control [] children = control._getChildren ();
- int index = 0;
- while (index < children.length) {
- if (children [index] == this) break;
- index++;
- }
- index++;
- if (index < children.length) {
- if (children [index].setFocus ()) return true;
- }
- control = control.parent;
- }
- return false;
-}
-
-boolean mnemonicMatch (char key) {
- char mnemonic = findMnemonic (getText ());
- if (mnemonic == '\0') return false;
- return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- image = null;
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return;
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- /*
- * Feature in Windows. The windows label does not align
- * the bitmap or icon. Any attempt to set alignment bits
- * such as SS_CENTER cause the label to display text. The
- * fix is to disallow alignment.
- *
- * NOTE: SS_BITMAP and SS_ICON are not single bit
- * masks so it is necessary to test for all of the
- * bits in these masks.
- */
- if ((bits & OS.SS_BITMAP) == OS.SS_BITMAP) return;
- if ((bits & OS.SS_ICON) == OS.SS_ICON) return;
- bits &= ~(OS.SS_LEFTNOWORDWRAP | OS.SS_CENTER | OS.SS_RIGHT);
- if ((style & SWT.LEFT) != 0 && (style & SWT.WRAP) == 0) {
- bits |= OS.SS_LEFTNOWORDWRAP;
- }
- if ((style & SWT.CENTER) != 0) bits |= OS.SS_CENTER;
- if ((style & SWT.RIGHT) != 0) bits |= OS.SS_RIGHT;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- OS.InvalidateRect (handle, null, true);
-}
-
-public boolean setFocus () {
- checkWidget();
- return false;
-}
-
-/**
- * Sets the receiver's image to the argument, which may be
- * null indicating that no image should be displayed.
- *
- * @param image the image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image image) {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return;
- int hImage = 0, imageBits = 0, fImageType = 0;
- if (image != null) {
- if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hImage = image.handle;
- switch (image.type) {
- case SWT.BITMAP:
- imageBits = OS.SS_BITMAP;
- fImageType = OS.IMAGE_BITMAP;
- break;
- case SWT.ICON:
- imageBits = OS.SS_ICON;
- fImageType = OS.IMAGE_ICON;
- break;
- default:
- return;
- }
- }
- this.image = image;
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int oldBits = newBits;
- newBits &= ~(OS.SS_BITMAP | OS.SS_ICON);
- newBits |= imageBits | OS.SS_REALSIZEIMAGE | OS.SS_CENTERIMAGE;
- if (newBits != oldBits) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- }
- OS.SendMessage (handle, OS.STM_SETIMAGE, fImageType, hImage);
- /*
- * Feature in Windows. When STM_SETIMAGE is used to set the
- * image for a static control, Windows either streches the image
- * to fit the control or shrinks the control to fit the image.
- * While not stricly wrong, neither of these is desirable.
- * The fix is to stop Windows from stretching the image by
- * using SS_REALSIZEIMAGE and SS_CENTERIMAGE, allow Windows
- * to shrink the control, and then restore the control to the
- * original size.
- */
- int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE | OS.SWP_NOMOVE;
- OS.SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
- OS.InvalidateRect (handle, null, true);
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE), oldBits = newBits;
- newBits &= ~(OS.SS_BITMAP | OS.SS_ICON | OS.SS_REALSIZEIMAGE | OS.SS_CENTERIMAGE);
- if ((style & SWT.LEFT) != 0 && (style & SWT.WRAP) == 0) newBits |= OS.SS_LEFTNOWORDWRAP;
- if ((style & SWT.CENTER) != 0) newBits |= OS.SS_CENTER;
- if ((style & SWT.RIGHT) != 0) newBits |= OS.SS_RIGHT;
- if (newBits != oldBits) {
- /*
- * Bug in Windows. When the style of a label is SS_BITMAP
- * or SS_ICON, the label does not remember the font that is
- * set in WM_SETFONT. The fix is to remember the font and
- * return the font in WM_GETFONT and to reset the font when
- * the style is changed from SS_BITMAP or SS_ICON to a style
- * that displays text.
- */
- int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- if (hFont != 0) OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
- }
- string = Display.withCrLf (string);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SetWindowText (handle, buffer);
-}
-
-/*
-* Not currently used.
-*/
-void setWrap (boolean wrap) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & (OS.SS_RIGHT | OS.SS_CENTER)) != 0) return;
- bits &= ~OS.SS_LEFTNOWORDWRAP;
- if (!wrap) bits |= OS.SS_LEFTNOWORDWRAP;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- OS.InvalidateRect (handle, null, true);
-}
-
-int widgetExtStyle () {
- if ((style & SWT.BORDER) != 0) return OS.WS_EX_STATICEDGE;
- return super.widgetExtStyle ();
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.SS_NOTIFY;
- if ((style & SWT.SEPARATOR) != 0) return bits | OS.SS_OWNERDRAW;
- if ((style & SWT.CENTER) != 0) return bits | OS.SS_CENTER;
- if ((style & SWT.RIGHT) != 0) return bits | OS.SS_RIGHT;
- if ((style & SWT.WRAP) != 0) return bits | OS.SS_LEFT;
- return bits | OS.SS_LEFTNOWORDWRAP;
-}
-
-TCHAR windowClass () {
- return LabelClass;
-}
-
-int windowProc () {
- return LabelProc;
-}
-
-LRESULT WM_ERASEBKGND (int wParam, int lParam) {
- LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.SEPARATOR) == 0) {
- /*
- * Bug in Windows. When a label has the SS_BITMAP
- * or SS_ICON style, the label does not draw the
- * background. The fix is to draw the background
- * when the label is showing a bitmap or icon.
- *
- * NOTE: SS_BITMAP and SS_ICON are not single bit
- * masks so it is necessary to test for all of the
- * bits in these masks.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.SS_BITMAP) != OS.SS_BITMAP &&
- (bits & OS.SS_ICON) != OS.SS_ICON) return result;
- }
- drawBackground (wParam);
- return LRESULT.ONE;
-}
-
-LRESULT WM_GETFONT (int wParam, int lParam) {
- LRESULT result = super.WM_GETFONT (wParam, lParam);
- if (result != null) return result;
- /*
- * Bug in Windows. When the style of a label is SS_BITMAP
- * or SS_ICON, the label does not remember the font that is
- * set in WM_SETFONT. The fix is to remember the font and
- * return the font in WM_GETFONT.
- */
- if (font == 0) font = defaultFont ();
- return new LRESULT (font);
-}
-
-LRESULT WM_SETFONT (int wParam, int lParam) {
- /*
- * Bug in Windows. When the style of a label is SS_BITMAP
- * or SS_ICON, the label does not remember the font that is
- * set in WM_SETFONT. The fix is to remember the font and
- * return the font in WM_GETFONT.
- */
- return super.WM_SETFONT (font = wParam, lParam);
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning the result of the
- * WM_SIZE message.
- */
- if (isDisposed ()) return result;
-
- /*
- * Bug in Windows. For some reason, a label with
- * style SS_LEFT, SS_CENTER or SS_RIGHT does not
- * redraw the text in the new position when resized.
- * Note that SS_LEFTNOWORDWRAP does no have the problem.
- * The fix is to force the redraw.
- */
- if ((style & SWT.SEPARATOR) == 0) {
- if ((style & (SWT.WRAP | SWT.CENTER | SWT.RIGHT)) != 0) {
- OS.InvalidateRect (handle, null, true);
- }
- }
- return result;
-}
-
-LRESULT wmDrawChild (int wParam, int lParam) {
- if ((style & SWT.SHADOW_NONE) != 0) return null;
- DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
- RECT rect = new RECT ();
- int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
- int flags = OS.EDGE_ETCHED;
- if ((style & SWT.SHADOW_IN) != 0) flags = OS.EDGE_SUNKEN;
- if ((style & SWT.HORIZONTAL) != 0) {
- int bottom = struct.top + Math.max (lineWidth * 2, (struct.bottom - struct.top) / 2);
- OS.SetRect (rect, struct.left, struct.top, struct.right, bottom);
- OS.DrawEdge (struct.hDC, rect, flags, OS.BF_BOTTOM);
- return null;
- }
- int right = struct.left + Math.max (lineWidth * 2, (struct.right - struct.left) / 2);
- OS.SetRect (rect, struct.left, struct.top, right, struct.bottom);
- OS.DrawEdge (struct.hDC, rect, flags, OS.BF_RIGHT);
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
deleted file mode 100755
index 0c43805266..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
+++ /dev/null
@@ -1,1515 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface
- * object that displays a list of strings and issues notificiation
- * when a string selected. A list may be single or multi select.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class List extends Scrollable {
- static final int ListProc;
- static final TCHAR ListClass = new TCHAR (0, "LISTBOX", true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ListClass, lpWndClass);
- ListProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public List (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer);
- if (result == OS.LB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (result == OS.LB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
- if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == -1) error (SWT.ERROR_INVALID_RANGE);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- int result = OS.SendMessage (handle, OS.LB_INSERTSTRING, index, buffer);
- if (result == OS.LB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
- if (result == OS.LB_ERR) {
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (0 <= index && index <= count) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
- if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the selection changes.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ListProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- int itemHeight = OS.SendMessage (handle, OS.LB_GETITEMHEIGHT, 0, 0);
- int width = 0, height = count * itemHeight;
- if ((style & SWT.H_SCROLL) != 0) {
- width = OS.SendMessage (handle, OS.LB_GETHORIZONTALEXTENT, 0, 0);
- } else {
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- RECT rect = new RECT ();
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- int cp = getCodePage ();
- TCHAR buffer = new TCHAR (cp, 64 + 1);
- for (int i=0; i<count; i++) {
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, i, 0);
- if (length != OS.LB_ERR) {
- if (length + 1 > buffer.length ()) {
- buffer = new TCHAR (cp, length + 1);
- }
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, i, buffer);
- if (result != OS.LB_ERR) {
- OS.DrawText (hDC, buffer, length, rect, flags);
- width = Math.max (width, rect.right - rect.left);
- }
- }
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- }
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2 + 3;
- height += border * 2;
- if ((style & SWT.V_SCROLL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- }
- if ((style & SWT.H_SCROLL) != 0) {
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- }
- return new Point (width, height);
-}
-
-ScrollBar createScrollBar (int type) {
- return new ScrollBar (this, type);
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_WINDOW);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (indices.length == 0) return;
- if ((style & SWT.SINGLE) != 0) {
- int oldIndex = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (oldIndex == OS.LB_ERR) return;
- for (int i=0; i<indices.length; i++) {
- if (oldIndex == indices [i]) {
- OS.SendMessage (handle, OS.LB_SETCURSEL, -1, 0);
- return;
- }
- }
- return;
- }
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (index != -1) {
- OS.SendMessage (handle, OS.LB_SETSEL, 0, index);
- }
- }
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- if (index == -1) return;
- if ((style & SWT.SINGLE) != 0) {
- int oldIndex = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (oldIndex == OS.LB_ERR) return;
- if (oldIndex == index) OS.SendMessage (handle, OS.LB_SETCURSEL, -1, 0);
- return;
- }
- OS.SendMessage (handle, OS.LB_SETSEL, 0, index);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget ();
- if (start > end) return;
- if ((style & SWT.SINGLE) != 0) {
- int oldIndex = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (oldIndex == OS.LB_ERR) return;
- if (start <= oldIndex && oldIndex <= end) {
- OS.SendMessage (handle, OS.LB_SETCURSEL, -1, 0);
- }
- return;
- }
- /*
- * Ensure that at least one item is contained in
- * the range from start to end. Note that when
- * start = end, LB_SELITEMRANGEEX deselects the
- * item.
- */
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (start < 0 && end < 0) return;
- if (start >= count && end >= count) return;
- start = Math.min (count - 1, Math.max (0, start));
- end = Math.min (count - 1, Math.max (0, end));
- OS.SendMessage (handle, OS.LB_SELITEMRANGEEX, end, start);
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- OS.SendMessage (handle, OS.LB_SETCURSEL, -1, 0);
- return;
- }
- OS.SendMessage (handle, OS.LB_SETSEL, 0, -1);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * has the focus in the receiver, or -1 if no item is has focus.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getFocusIndex () {
- checkWidget ();
- return OS.SendMessage (handle, OS.LB_GETCARETINDEX, 0, 0);
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget ();
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, index, 0);
- if (length != OS.LB_ERR) {
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, index, buffer);
- if (result != OS.LB_ERR) return buffer.toString (0, length);
- }
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (0 <= index && index < count) {
- error (SWT.ERROR_CANNOT_GET_ITEM);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (result == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_COUNT);
- return result;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.LB_GETITEMHEIGHT, 0, 0);
- if (result == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
- return result;
-}
-
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget ();
- int count = getItemCount ();
- String [] result = new String [count];
- for (int i=0; i<count; i++) result [i] = getItem (i);
- return result;
-}
-
-/**
- * Returns an array of <code>String</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public String [] getSelection () {
- checkWidget ();
- int [] indices = getSelectionIndices ();
- String [] result = new String [indices.length];
- for (int i=0; i<indices.length; i++) {
- result [i] = getItem (indices [i]);
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int result = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (result == OS.LB_ERR) return 0;
- return 1;
- }
- int result = OS.SendMessage (handle, OS.LB_GETSELCOUNT, 0, 0);
- if (result == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_COUNT);
- return result;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- return OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- }
- int count = OS.SendMessage (handle, OS.LB_GETSELCOUNT, 0, 0);
- if (count == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_SELECTION);
- if (count == 0) return -1;
- int index = OS.SendMessage (handle, OS.LB_GETCARETINDEX, 0, 0);
- int result = OS.SendMessage (handle, OS.LB_GETSEL, index, 0);
- if (result == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_SELECTION);
- if (result != 0) return index;
- int [] buffer = new int [1];
- result = OS.SendMessage (handle, OS.LB_GETSELITEMS, 1, buffer);
- if (result != 1) error (SWT.ERROR_CANNOT_GET_SELECTION);
- return buffer [0];
-}
-
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int result = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (result == OS.LB_ERR) return new int [0];
- return new int [] {result};
- }
- int length = OS.SendMessage (handle, OS.LB_GETSELCOUNT, 0, 0);
- if (length == OS.LB_ERR) error (SWT.ERROR_CANNOT_GET_SELECTION);
- int [] indices = new int [length];
- int result = OS.SendMessage (handle, OS.LB_GETSELITEMS, length, indices);
- if (result != length) error (SWT.ERROR_CANNOT_GET_SELECTION);
- return indices;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget ();
- return OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
-}
-
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- return indexOf (string, 0);
-}
-
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /*
- * Bug in Windows. For some reason, LB_FINDSTRINGEXACT
- * will not find empty strings even though it is legal
- * to insert an empty string into a list. The fix is
- * to search the list, an item at a time.
- */
- if (string.length () == 0) {
- int count = getItemCount ();
- for (int i=start; i<count; i++) {
- if (string.equals (getItem (i))) return i;
- }
- return -1;
- }
-
- /* Use LB_FINDSTRINGEXACT to search for the item */
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (!((0 <= start) && (start < count))) return -1;
- int index = start - 1, last;
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- do {
- index = OS.SendMessage (handle, OS.LB_FINDSTRINGEXACT, last = index, buffer);
- if (index == OS.LB_ERR || index <= last) return -1;
- } while (!string.equals (getItem (index)));
- return index;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.LB_GETSEL, index, 0);
- return (result != 0) && (result != OS.LB_ERR);
-}
-
-/**
- * Removes the items from the receiver at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- int topIndex = OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
- RECT rect = null;
- int hDC = 0, oldFont = 0, newFont = 0, newWidth = 0;
- if ((style & SWT.H_SCROLL) != 0) {
- rect = new RECT ();
- hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- }
- int cp = getCodePage ();
- int i = 0, topCount = 0, last = -1;
- while (i < newIndices.length) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- TCHAR buffer = null;
- if ((style & SWT.H_SCROLL) != 0) {
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, index, 0);
- if (length == OS.LB_ERR) break;
- buffer = new TCHAR (cp, length + 1);
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, index, buffer);
- if (result == OS.LB_ERR) break;
- }
- int result = OS.SendMessage (handle, OS.LB_DELETESTRING, index, 0);
- if (result == OS.LB_ERR) break;
- if ((style & SWT.H_SCROLL) != 0) {
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- OS.DrawText (hDC, buffer, -1, rect, flags);
- newWidth = Math.max (newWidth, rect.right - rect.left);
- }
- if (index < topIndex) topCount++;
- last = index;
- }
- i++;
- }
- if ((style & SWT.H_SCROLL) != 0) {
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- setScrollWidth (newWidth, false);
- }
- if (topCount > 0) {
- topIndex -= topCount;
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex, 0);
- }
- if (i < newIndices.length) {
- int index = newIndices [i];
- if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
- error (SWT.ERROR_INVALID_RANGE);
- }
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget ();
- TCHAR buffer = null;
- if ((style & SWT.H_SCROLL) != 0) {
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, index, 0);
- if (length == OS.LB_ERR) error (SWT.ERROR_ITEM_NOT_REMOVED);
- buffer = new TCHAR (getCodePage (), length + 1);
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, index, buffer);
- if (result == OS.LB_ERR) error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- int topIndex = OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
- int result = OS.SendMessage (handle, OS.LB_DELETESTRING, index, 0);
- if (result == OS.LB_ERR) {
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
- error (SWT.ERROR_INVALID_RANGE);
- }
- if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, false);
- if (index < topIndex) {
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex - 1, 0);
- }
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget ();
- if (start > end) return;
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- int topIndex = OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
- RECT rect = null;
- int hDC = 0, oldFont = 0, newFont = 0, newWidth = 0;
- if ((style & SWT.H_SCROLL) != 0) {
- rect = new RECT ();
- hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- }
- int cp = getCodePage ();
- int index = start;
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- while (index <= end) {
- TCHAR buffer = null;
- if ((style & SWT.H_SCROLL) != 0) {
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, start, 0);
- if (length == OS.LB_ERR) break;
- buffer = new TCHAR (cp, length + 1);
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, start, buffer);
- if (result == OS.LB_ERR) break;
- }
- int result = OS.SendMessage (handle, OS.LB_DELETESTRING, start, 0);
- if (result == OS.LB_ERR) break;
- if ((style & SWT.H_SCROLL) != 0) {
- OS.DrawText (hDC, buffer, -1, rect, flags);
- newWidth = Math.max (newWidth, rect.right - rect.left);
- }
- index++;
- }
- if ((style & SWT.H_SCROLL) != 0) {
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- setScrollWidth (newWidth, false);
- }
- if (end < topIndex) {
- topIndex -= end - start + 1;
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex, 0);
- }
- if (index <= end) {
- if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
- error (SWT.ERROR_INVALID_RANGE);
- }
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget ();
- int index = indexOf (string, 0);
- if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
- remove (index);
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- OS.SendMessage (handle, OS.LB_RESETCONTENT, 0, 0);
- if ((style & SWT.H_SCROLL) != 0) {
- OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, 0, 0);
- }
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SINGLE) != 0) {
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (0 <= index && index < count) {
- select (index);
- return;
- }
- }
- return;
- }
- int focusIndex = getFocusIndex ();
- for (int i=0; i<indices.length; i++) {
- int index = indices [i];
- if (index != -1) {
- OS.SendMessage (handle, OS.LB_SETSEL, 1, index);
- }
- }
- if (focusIndex != -1) setFocusIndex (focusIndex);
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget ();
- if (index == -1) return;
- int topIndex = OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
- RECT itemRect = new RECT (), selectedRect = null;
- OS.SendMessage (handle, OS.LB_GETITEMRECT, index, itemRect);
- boolean redraw = drawCount == 0 && OS.IsWindowVisible (handle);
- if (redraw) {
- OS.UpdateWindow (handle);
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- int focusIndex = -1;
- if ((style & SWT.SINGLE) != 0) {
- int oldIndex = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- if (oldIndex != -1) {
- selectedRect = new RECT ();
- OS.SendMessage (handle, OS.LB_GETITEMRECT, oldIndex, selectedRect);
- }
- OS.SendMessage (handle, OS.LB_SETCURSEL, index, 0);
- } else {
- focusIndex = OS.SendMessage (handle, OS.LB_GETCARETINDEX, 0, 0);
- OS.SendMessage (handle, OS.LB_SETSEL, 1, index);
- }
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex, 0);
- if (redraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- OS.ValidateRect (handle, null);
- OS.InvalidateRect (handle, itemRect, true);
- if (selectedRect != null) {
- OS.InvalidateRect (handle, selectedRect, true);
- }
- }
- if ((style & SWT.MULTI) != 0) {
- if (focusIndex != -1) {
- OS.SendMessage (handle, OS.LB_SETCARETINDEX, index, 0);
- }
- }
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget ();
- if (start > end) return;
- if ((style & SWT.SINGLE) != 0) {
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- int index = Math.min (count - 1, end);
- if (index >= start) select (index);
- return;
- }
- /*
- * Ensure that at least one item is contained in
- * the range from start to end. Note that when
- * start = end, LB_SELITEMRANGEEX deselects the
- * item.
- */
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (start < 0 && end < 0) return;
- if (start >= count && end >= count) return;
- start = Math.min (count - 1, Math.max (0, start));
- end = Math.min (count - 1, Math.max (0, end));
- if (start == end) {
- select (start);
- return;
- }
- OS.SendMessage (handle, OS.LB_SELITEMRANGEEX, start, end);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- OS.SendMessage (handle, OS.LB_SETSEL, 1, -1);
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- /*
- * Bug in Windows. If the receiver is scrolled horizontally
- * and is resized, the list does not redraw properly. The fix
- * is to redraw the receiver.
- */
- if ((parent.hdwp != 0) || ((flags & OS.SWP_NOSIZE) != 0)) {
- super.setBounds (x, y, width, height, flags);
- return;
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- super.setBounds (x, y, width, height, flags);
- if (((rect.right - rect.left) == width) || ((rect.bottom - rect.top) == height)) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS;
- if (!OS.GetScrollInfo (handle, OS.SB_HORZ, info)) return;
- if (info.nPos != 0) OS.InvalidateRect (handle, null, true);
-}
-
-void setFocusIndex (int index) {
- OS.SendMessage (handle, OS.LB_SETCARETINDEX, index, 0);
-}
-
-public void setFont (Font font) {
- checkWidget ();
- super.setFont (font);
- if ((style & SWT.H_SCROLL) != 0) setScrollWidth ();
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int topIndex = getTopIndex ();
- boolean isSelected = isSelected (index);
- remove (index);
- add (string, index);
- if (isSelected) select (index);
- setTopIndex (topIndex);
-}
-
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, ListProc);
- boolean redraw = drawCount == 0 && OS.IsWindowVisible (handle);
- if (redraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- RECT rect = null;
- boolean failed = false;
- int hDC = 0, oldFont = 0, newFont = 0, newWidth = 0;
- if ((style & SWT.H_SCROLL) != 0) {
- rect = new RECT ();
- hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, 0, 0);
- }
- int length = items.length;
- OS.SendMessage (handle, OS.LB_RESETCONTENT, 0, 0);
- OS.SendMessage (handle, OS.LB_INITSTORAGE, length, length * 32);
- int index = 0;
- int cp = getCodePage ();
- while (index < length) {
- String string = items [index];
- if (string == null) break;
- TCHAR buffer = new TCHAR (cp, string, true);
- int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer);
- if (result == OS.LB_ERR || result == OS.LB_ERRSPACE) break;
- if ((style & SWT.H_SCROLL) != 0) {
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- OS.DrawText (hDC, buffer, buffer.length (), rect, flags);
- newWidth = Math.max (newWidth, rect.right - rect.left);
- }
- index++;
- }
- if ((style & SWT.H_SCROLL) != 0) {
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, newWidth + 3, 0);
- }
- if (redraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- /*
- * This code is intentionally commented. The window proc
- * for the list box implements WM_SETREDRAW to invalidate
- * and erase the widget. This is undocumented behavior.
- * The commented code below shows what is actually happening
- * and reminds us that we are relying on this undocumented
- * behavior.
- */
-// int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
-// OS.RedrawWindow (handle, null, 0, flags);
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
- if (index < items.length) error (SWT.ERROR_ITEM_NOT_ADDED);
-}
-
-void setScrollWidth () {
- int newWidth = 0;
- RECT rect = new RECT ();
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- int cp = getCodePage ();
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- for (int i=0; i<count; i++) {
- int length = OS.SendMessage (handle, OS.LB_GETTEXTLEN, i, 0);
- if (length != OS.LB_ERR) {
- TCHAR buffer = new TCHAR (cp, length + 1);
- int result = OS.SendMessage (handle, OS.LB_GETTEXT, i, buffer);
- if (result != OS.LB_ERR) {
- OS.DrawText (hDC, buffer, -1, rect, flags);
- newWidth = Math.max (newWidth, rect.right - rect.left);
- }
- }
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, newWidth + 3, 0);
-}
-
-void setScrollWidth (TCHAR buffer, boolean grow) {
- RECT rect = new RECT ();
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- OS.DrawText (hDC, buffer, -1, rect, flags);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- setScrollWidth (rect.right - rect.left, grow);
-}
-
-void setScrollWidth (int newWidth, boolean grow) {
- int width = OS.SendMessage (handle, OS.LB_GETHORIZONTALEXTENT, 0, 0);
- if (grow) {
- if (newWidth <= width) return;
- OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, newWidth + 3, 0);
- } else {
- if (newWidth < width) return;
- setScrollWidth ();
- }
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selection is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int[])
- */
-public void setSelection(int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (indices);
- if ((style & SWT.MULTI) != 0) {
- if (indices.length != 0) {
- int focusIndex = indices [0];
- if (focusIndex != -1) setFocusIndex (focusIndex);
- }
- }
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (String [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.MULTI) != 0) deselectAll ();
- int focusIndex = -1;
- for (int i=items.length-1; i>=0; --i) {
- String string = items [i];
- int index = 0;
- if (string != null) {
- int localFocus = -1;
- while ((index = indexOf (string, index)) != -1) {
- if (localFocus == -1) localFocus = index;
- select (index);
- if ((style & SWT.SINGLE) != 0 && isSelected (index)) {
- /*
- * Return and rely on the fact that select ()
- * for single-select lists clears the previous
- * selection.
- */
- return;
- }
- index++;
- }
- if (localFocus != -1) focusIndex = localFocus;
- }
- }
- if ((style & SWT.SINGLE) != 0) deselectAll ();
- if ((style & SWT.MULTI) != 0) {
- if (focusIndex != -1) setFocusIndex (focusIndex);
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @see List#deselectAll()
- * @see List#select(int)
- */
-public void setSelection (int index) {
- checkWidget ();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (index);
- if ((style & SWT.MULTI) != 0) {
- if (index != -1) setFocusIndex (index);
- }
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- checkWidget ();
- if ((style & SWT.MULTI) != 0) deselectAll ();
- select (start, end);
- if ((style & SWT.MULTI) != 0) {
- if (start != -1) setFocusIndex (start);
- }
-}
-
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget ();
- int result = OS.SendMessage (handle, OS.LB_SETTOPINDEX, index, 0);
- if (result == OS.LB_ERR) {
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- index = Math.min (count - 1, Math.max (0, index));
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, index, 0);
- }
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget ();
- int index;
- if ((style & SWT.SINGLE) != 0) {
- index = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
- } else {
- int [] indices = new int [1];
- int result = OS.SendMessage (handle, OS.LB_GETSELITEMS, 1, indices);
- index = indices [0];
- if (result != 1) index = -1;
- }
- if (index == -1) return;
- int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
- if (count == 0) return;
- int height = OS.SendMessage (handle, OS.LB_GETITEMHEIGHT, 0, 0);
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- int topIndex = OS.SendMessage (handle, OS.LB_GETTOPINDEX, 0, 0);
- int visibleCount = Math.max (rect.bottom / height, 1);
- int bottomIndex = Math.min (topIndex + visibleCount + 1, count - 1);
- if ((topIndex <= index) && (index <= bottomIndex)) return;
- int newTop = Math.min (Math.max (index - (visibleCount / 2), 0), count - 1);
- OS.SendMessage (handle, OS.LB_SETTOPINDEX, newTop, 0);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.LBS_NOTIFY | OS.LBS_NOINTEGRALHEIGHT;
- if ((style & SWT.SINGLE) != 0) return bits;
- if ((style & SWT.MULTI) != 0) {
- if ((style & SWT.SIMPLE) != 0) return bits | OS.LBS_MULTIPLESEL;
- return bits | OS.LBS_EXTENDEDSEL;
- }
- return bits;
-}
-
-TCHAR windowClass () {
- return ListClass;
-}
-
-int windowProc () {
- return ListProc;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- int code = wParam >> 16;
- switch (code) {
- case OS.LBN_SELCHANGE:
- postEvent (SWT.Selection);
- break;
- case OS.LBN_DBLCLK:
- postEvent (SWT.DefaultSelection);
- break;
- }
- return super.wmCommandChild (wParam, lParam);
-}
-
-LRESULT wmScroll (int msg, int wParam, int lParam) {
- int code = callWindowProc (msg, wParam, lParam);
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
deleted file mode 100755
index 7a9ad03a3c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
+++ /dev/null
@@ -1,799 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are user interface objects that contain
- * menu items.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BAR, DROP_DOWN, POP_UP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Help, Hide, Show </dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Menu extends Widget {
- public int handle;
- int x, y;
- boolean hasLocation;
- MenuItem cascade;
- Decorations parent;
-
-public Menu (Control parent) {
- this (checkNull (parent).getShell (), SWT.POP_UP);
-}
-
-public Menu (Decorations parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget ();
-}
-
-public Menu (Menu parentMenu) {
- this (checkNull (parentMenu).parent, SWT.DROP_DOWN);
-}
-
-public Menu (MenuItem parentItem) {
- this (checkNull (parentItem).parent);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>MenuListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #removeMenuListener
- */
-public void addMenuListener (MenuListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Hide,typedListener);
- addListener (SWT.Show,typedListener);
-}
-
-static Control checkNull (Control control) {
- if (control == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return control;
-}
-
-static Menu checkNull (Menu menu) {
- if (menu == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return menu;
-}
-
-static MenuItem checkNull (MenuItem item) {
- if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
-}
-
-void createHandle () {
- if ((style & SWT.BAR) != 0) {
- /*
- * Note in WinCE PPC. CreateMenu cannot insert items of type
- * separator. The workaround is to always use CreatePopupMenu.
- */
- handle = OS.IsWinCE ? OS.CreatePopupMenu () : OS.CreateMenu();
- } else {
- handle = OS.CreatePopupMenu ();
- }
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
-}
-
-void createItem (MenuItem item, int index) {
- int count = GetMenuItemCount (handle);
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- parent.add (item);
- boolean success = false;
- if (OS.IsWinCE) {
- int uFlags = OS.MF_BYPOSITION;
- TCHAR lpNewItem = null;
- if ((item.style & SWT.SEPARATOR) != 0) {
- uFlags |= OS.MF_SEPARATOR;
- } else {
- lpNewItem = new TCHAR (0, "", true);
- }
- success = OS.InsertMenu (handle, index, uFlags, item.id, lpNewItem);
- if (success) {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- info.dwItemData = item.id;
- success = OS.SetMenuItemInfo (handle, index, true, info);
-
- /* if it is a top level menu item, display it on the toolbar */
- if (item.parent == parent.menuBar) {
- TBBUTTON lpButton = new TBBUTTON ();
- lpButton.idCommand = item.id;
- lpButton.fsStyle = (byte) (OS.TBSTYLE_DROPDOWN | OS.TBSTYLE_AUTOSIZE | 0x80);
- lpButton.fsState = (byte) OS.TBSTATE_ENABLED;
- lpButton.iBitmap = OS.I_IMAGENONE;
- if ((item.style & SWT.SEPARATOR) != 0) {
- lpButton.fsStyle = (byte) OS.BTNS_SEP;
- }
- success = OS.SendMessage (parent.hwndTB, OS.TB_INSERTBUTTON, index, lpButton) != 0;
- }
- }
- } else {
- /*
- * Bug in Windows. For some reason, when InsertMenuItem ()
- * is used to insert an item without text, it is not possible
- * to use SetMenuItemInfo () to set the text at a later time.
- * The fix is to insert the item with an empty string.
- */
- int hHeap = OS.GetProcessHeap ();
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA;
- info.wID = info.dwItemData = item.id;
- info.fType = item.widgetStyle ();
- info.dwTypeData = pszText;
- success = OS.InsertMenuItem (handle, index, true, info);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- }
- if (!success) {
- parent.remove (item);
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- redraw ();
-}
-
-void createWidget () {
- createHandle ();
- parent.add (this);
-}
-
-/*
-* Currently not used.
-*/
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_MENU);
-}
-
-/*
-* Currently not used.
-*/
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_MENUTEXT);
-}
-
-void destroyAcceleratorTable () {
- parent.destroyAcceleratorTable ();
-}
-
-void destroyItem (MenuItem item) {
- if (OS.IsWinCE) {
- int index = 0;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- while (OS.GetMenuItemInfo (handle, index, true, info)) {
- if (info.dwItemData == item.id) break;
- index++;
- }
- if (info.dwItemData != item.id) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- if (!OS.RemoveMenu (handle, index, OS.MF_BYPOSITION)) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- /*
- * if it is a top level menu item, remove the corresponding
- * tool item.
- */
- if (parent.menuBar == this) {
- OS.SendMessage (parent.hwndTB, OS.TB_DELETEBUTTON, index, 0);
- }
- } else {
- if (!OS.RemoveMenu (handle, item.id, OS.MF_BYCOMMAND)) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- }
- redraw ();
-}
-
-void destroyWidget () {
- int hMenu = handle;
- releaseHandle ();
- if (hMenu != 0) {
- OS.DestroyMenu (hMenu);
- }
-}
-
-/**
- * Returns the default menu item or null if none has
- * been previously set.
- *
- * @return the default menu item.
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getDefaultItem () {
- checkWidget ();
- if (OS.IsWinCE) return null;
- int id = OS.GetMenuDefaultItem (handle, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
- if (id == -1) return null;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_ID;
- if (OS.GetMenuItemInfo (handle, id, false, info)) {
- return parent.findMenuItem (info.wID);
- }
- return null;
-}
-
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- return (state & DISABLED) == 0;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getItem (int index) {
- checkWidget ();
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- if (!OS.GetMenuItemInfo (handle, index, true, info)) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- return parent.findMenuItem (info.dwItemData);
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
-// return OS.GetMenuItemCount (handle);
- return GetMenuItemCount (handle);
-}
-
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem [] getItems () {
- checkWidget ();
- int index = 0;
- int length = OS.IsWinCE ? 4 : OS.GetMenuItemCount (handle);
- MenuItem [] items = new MenuItem [length];
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- while (OS.GetMenuItemInfo (handle, index, true, info)) {
- if (index == items.length) {
- MenuItem [] newItems = new MenuItem [index + 4];
- System.arraycopy (items, 0, newItems, 0, index);
- items = newItems;
- }
- items [index++] = parent.findMenuItem (info.dwItemData);
- }
- if (index == items.length) return items;
- MenuItem [] result = new MenuItem [index];
- System.arraycopy (items, 0, result, 0, index);
- return result;
-}
-
-int GetMenuItemCount (int handle) {
- checkWidget ();
- if (OS.IsWinCE) {
- int count = 0;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- while (OS.GetMenuItemInfo (handle, count, true, info)) count++;
- return count;
- }
- return OS.GetMenuItemCount (handle);
-}
-
-String getNameText () {
- String result = "";
- MenuItem [] items = getItems ();
- int length = items.length;
- if (length > 0) {
- for (int i=0; i<length-1; i++) {
- result = result + items [i].getNameText() + ", ";
- }
- result = result + items [length-1].getNameText ();
- }
- return result;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Decorations getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public MenuItem getParentItem () {
- checkWidget ();
- return cascade;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParentMenu () {
- checkWidget ();
- if (cascade != null) return cascade.parent;
- return null;
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- *
- * @return the receiver's shell
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getParent
- */
-public Shell getShell () {
- checkWidget ();
- return parent.getShell ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget ();
- return true;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (MenuItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int index = 0;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- while (OS.GetMenuItemInfo (handle, index, true, info)) {
- if (info.dwItemData == item.id) return index;
- index++;
- }
- return -1;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget ();
- Menu parentMenu = getParentMenu ();
- if (parentMenu == null) return getEnabled ();
- return getEnabled () && parentMenu.isEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget ();
- return getVisible ();
-}
-
-void redraw () {
- if (OS.IsWinCE) return;
- if ((style & SWT.BAR) != 0) {
- OS.DrawMenuBar (parent.handle);
- return;
- }
- if ((OS.WIN32_MAJOR << 16 | OS.WIN32_MINOR) < (4 << 16 | 10)) {
- return;
- }
- boolean hasCheck = false, hasImage = false;
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (item.getImage () != null) {
- if ((hasImage = true) && hasCheck) break;
- }
- if ((item.getStyle () & (SWT.CHECK | SWT.RADIO)) != 0) {
- if ((hasCheck = true) && hasImage) break;
- }
- }
- MENUINFO lpcmi = new MENUINFO ();
- lpcmi.cbSize = MENUINFO.sizeof;
- lpcmi.fMask = OS.MIM_STYLE;
- OS.GetMenuInfo (handle, lpcmi);
- if (hasImage && !hasCheck) {
- lpcmi.dwStyle |= OS.MNS_CHECKORBMP;
- } else {
- lpcmi.dwStyle &= ~OS.MNS_CHECKORBMP;
- }
- OS.SetMenuInfo (handle, lpcmi);
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (cascade != null) cascade.setMenu (null);
- if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
- parent.setMenuBar (null);
- }
-}
-
-void releaseHandle () {
- handle = 0;
-}
-
-void releaseWidget () {
- MenuItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
- }
- super.releaseWidget ();
- if (parent != null) parent.remove (this);
- parent = null;
- cascade = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the menu events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see MenuListener
- * @see #addMenuListener
- */
-public void removeMenuListener (MenuListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Hide, listener);
- eventTable.unhook (SWT.Show, listener);
-}
-
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDefaultItem (MenuItem item) {
- checkWidget ();
- int command = -1;
- if (item != null) {
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- command = item.id;
- }
- if (OS.IsWinCE) return;
- OS.SetMenuDefaultItem (handle, command, OS.MF_BYCOMMAND);
- redraw ();
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget ();
- state &= ~DISABLED;
- if (!enabled) state |= DISABLED;
-}
-
-/**
- * Sets the receiver's location to the point specified by
- * the arguments which are relative to the display.
- * <p>
- * Note: This is different from most widgets where the
- * location of the widget is relative to the parent.
- * </p>
- *
- * @param x the new x coordinate for the receiver
- * @param y the new y coordinate for the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLocation (int x, int y) {
- checkWidget ();
- this.x = x; this.y = y;
- hasLocation = true;
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget ();
- if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
- int hwndParent = parent.handle;
- if (!visible) {
- OS.SendMessage (hwndParent, OS.WM_CANCELMODE, 0, 0);
- return;
- }
- int flags = OS.TPM_LEFTBUTTON | OS.TPM_RIGHTBUTTON | OS.TPM_LEFTALIGN;
- int nX = x, nY = y;
- if (!hasLocation) {
- int pos = OS.GetMessagePos ();
- nX = (short) (pos & 0xFFFF);
- nY = (short) (pos >> 16);
- }
- /*
- * Feature in Windows. It is legal use TrackPopupMenu ()
- * to display an empty menu as long as menu items are added
- * inside of WM_INITPOPUPMENU. If no items are added, then
- * TrackPopupMenu () fails and does not send an indication
- * that the menu has been closed. This is not strictly a
- * bug but leads to unwanted behavior when application code
- * assumes that every WM_INITPOPUPMENU will eventually result
- * in a WM_MENUSELECT, wParam=0xFFFF0000, lParam=0 to indicate
- * that the menu has been closed. The fix is to detect the
- * case when TrackPopupMenu fails and the number of items in
- * the menu is zero and issue a fake WM_MENUSELECT.
- */
- boolean success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null);
- if (!success && GetMenuItemCount (handle) == 0) {
- OS.SendMessage (hwndParent, OS.WM_MENUSELECT, 0xFFFF0000, 0);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
deleted file mode 100755
index 4267115bd1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ /dev/null
@@ -1,803 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that issues notification when pressed and released.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Arm, Help, Selection</dd>
- * </dl>
- *<p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class MenuItem extends Item {
- Menu parent, menu;
- int id, accelerator;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Menu</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public MenuItem (Menu parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the arm events are generated for the control, by sending
- * it one of the messages defined in the <code>ArmListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #removeArmListener
- */
-public void addArmListener (ArmListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Arm, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the help events are generated for the control, by sending
- * it one of the messages defined in the <code>HelpListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #removeHelpListener
- */
-public void addHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Help, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
-}
-
-void fillAccel (ACCEL accel) {
- accel.fVirt = 0;
- accel.cmd = accel.key = 0;
- if (accelerator == 0) return;
- int fVirt = OS.FVIRTKEY;
- int key = accelerator & ~(SWT.ALT | SWT.CTRL | SWT.SHIFT);
- int vKey = Display.untranslateKey (key);
- if (vKey != 0) {
- key = vKey;
- } else {
- switch (key) {
- /*
- * Bug in Windows. For some reason, VkKeyScan
- * fails to map ESC to VK_ESCAPE and DEL to
- * VK_DELETE. The fix is to map these keys
- * as a special case.
- */
- case 27: key = OS.VK_ESCAPE; break;
- case 127: key = OS.VK_DELETE; break;
- default: {
- key = wcsToMbcs ((char) key);
- if (key == 0) return;
- if (OS.IsWinCE) {
- key = OS.CharUpper ((short) key);
- } else {
- vKey = OS.VkKeyScan ((short) key) & 0xFF;
- if (vKey == -1) {
- fVirt = 0;
- } else {
- key = vKey;
- }
- }
- }
- }
- }
- accel.key = (short) key;
- accel.cmd = (short) id;
- accel.fVirt = (byte) fVirt;
- if ((accelerator & SWT.ALT) != 0) accel.fVirt |= OS.FALT;
- if ((accelerator & SWT.CTRL) != 0) accel.fVirt |= OS.FCONTROL;
- if ((accelerator & SWT.SHIFT) != 0) accel.fVirt |= OS.FSHIFT;
-}
-
-/**
- * Return the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @return the accelerator
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAccelerator () {
- checkWidget ();
- return accelerator;
-}
-
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget ();
- int hMenu = parent.handle;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) error (SWT.ERROR_CANNOT_GET_ENABLED);
- success = OS.GetMenuItemInfo (hMenu, index, true, info);
- } else {
- success = OS.GetMenuItemInfo (hMenu, id, false, info);
- }
- if (!success) error (SWT.ERROR_CANNOT_GET_ENABLED);
- return (info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) == 0;
-}
-/**
- * Returns the receiver's cascade menu if it has one or null
- * if it does not. Only <code>CASCADE</code> menu items can have
- * a pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @return the receiver's menu
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getMenu () {
- checkWidget ();
- return menu;
-}
-
-String getNameText () {
- if ((style & SWT.SEPARATOR) != 0) return "|";
- return super.getNameText ();
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Menu getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- int hMenu = parent.handle;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_GET_SELECTION);
- return (info.fState & OS.MFS_CHECKED) !=0;
-}
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- return getEnabled () && parent.isEnabled ();
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (menu != null) menu.dispose ();
- menu = null;
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- if (menu != null) {
- menu.releaseWidget ();
- menu.releaseHandle ();
- }
- menu = null;
- super.releaseWidget ();
- if (accelerator != 0) {
- parent.destroyAcceleratorTable ();
- }
- accelerator = 0;
- Decorations shell = parent.parent;
- shell.remove (this);
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the arm events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ArmListener
- * @see #addArmListener
- */
-public void removeArmListener (ArmListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Arm, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the help events are generated for the control.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see HelpListener
- * @see #addHelpListener
- */
-public void removeHelpListener (HelpListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Help, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- *
- * @param accelerator an integer that is the bit-wise OR of masks and a key
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAccelerator (int accelerator) {
- checkWidget ();
- this.accelerator = accelerator;
- parent.destroyAcceleratorTable ();
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget ();
- int hMenu = parent.handle;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- int uEnable = OS.MF_BYPOSITION | (enabled ? OS.MF_ENABLED : OS.MF_GRAYED);
- OS.EnableMenuItem (hMenu, index, uEnable);
- /* if it is a top level menu item, set the state in the corresponding tool item */
- Decorations shell = parent.parent;
- if (parent == shell.menuBar) {
- int fsState = OS.SendMessage (shell.hwndTB, OS.TB_GETSTATE, id, 0);
- fsState &= ~OS.TBSTATE_ENABLED;
- if (enabled) fsState |= OS.TBSTATE_ENABLED;
- OS.SendMessage (shell.hwndTB, OS.TB_SETSTATE, id, fsState);
- }
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_SET_ENABLED);
- info.fState &= ~(OS.MFS_DISABLED | OS.MFS_GRAYED);
- if (!enabled) info.fState |= (OS.MFS_DISABLED | OS.MFS_GRAYED);
- success = OS.SetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_SET_ENABLED);
- }
- parent.redraw ();
-}
-
-public void setImage (Image image) {
- checkWidget ();
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setImage (image);
- if (OS.IsWinCE) return;
- if ((OS.WIN32_MAJOR << 16 | OS.WIN32_MINOR) < (4 << 16 | 10)) {
- return;
- }
- int hMenu = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_BITMAP;
- if (image != null) info.hbmpItem = OS.HBMMENU_CALLBACK;
- boolean success = OS.SetMenuItemInfo (hMenu, id, false, info);
- /*
- * This code is intentionally commented.
- */
-// if (!success) error (SWT.ERROR_CANNOT_SET_TEXT);
- parent.redraw ();
-}
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMenu (Menu menu) {
- checkWidget ();
-
- /* Check to make sure the new menu is valid */
- if ((style & SWT.CASCADE) == 0) {
- error (SWT.ERROR_MENUITEM_NOT_CASCADE);
- }
- if (menu != null) {
- if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- if ((menu.style & SWT.DROP_DOWN) == 0) {
- error (SWT.ERROR_MENU_NOT_DROP_DOWN);
- }
- if (menu.parent != parent.parent) {
- error (SWT.ERROR_INVALID_PARENT);
- }
- }
-
- /* Assign the new menu */
- Menu oldMenu = this.menu;
- if (oldMenu == menu) return;
- if (oldMenu != null) oldMenu.cascade = null;
- this.menu = menu;
-
- /* Assign the new menu in the OS */
-
- /*
- * Feature in Windows. When SetMenuItemInfo () is used to
- * set a submenu and the menu item already has a submenu,
- * Windows destroys the previous menu. This is undocumented
- * and unexpected but not necessarily wrong. The fix is to
- * remove the item with RemoveMenu () which does not destroy
- * the submenu and then insert the item with InsertMenuItem ().
- */
- int hMenu = parent.handle;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- int index = 0;
- while (OS.GetMenuItemInfo (hMenu, index, true, info)) {
- if (info.dwItemData == id) break;
- index++;
- }
- if (info.dwItemData != id) return;
- int cch = 128;
- int hHeap = OS.GetProcessHeap ();
- int byteCount = cch * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- info.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA;
- info.dwTypeData = pszText;
- info.cch = cch;
- boolean success = OS.GetMenuItemInfo (hMenu, index, true, info);
- if (menu != null) {
- menu.cascade = this;
- info.fMask |= OS.MIIM_SUBMENU;
- info.hSubMenu = menu.handle;
- }
- OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION);
- if (OS.IsWinCE) {
- /*
- * On WinCE, InsertMenuItem is not available. SetMenuItemInfo
- * does not set the menu item state and submenu use InsertMenu
- * to set these fields and SetMenuItemInfo to set the menu item
- * data. NOTE: SetMenuItemInfo is also used to set the string
- * that was queried from the original menu item.
- */
- int uIDNewItem = id;
- int uFlags = OS.MF_BYPOSITION;
- if (menu != null) {
- uFlags |= OS.MF_POPUP;
- uIDNewItem = menu.handle;
- }
- TCHAR lpNewItem = new TCHAR (0, "", true);
- success = OS.InsertMenu (hMenu, index, uFlags, uIDNewItem, lpNewItem);
- if (success) {
- info.fMask = OS.MIIM_DATA | OS.MIIM_TYPE;
- success = OS.SetMenuItemInfo (hMenu, index, true, info);
- if ((info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) != 0) {
- OS.EnableMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_GRAYED);
- }
- if ((info.fState & OS.MFS_CHECKED) != 0) {
- OS.CheckMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_CHECKED);
- }
-
- if (success) {
- /* if it is a top level menu item, update the corresponding tool item */
- Decorations shell = parent.parent;
- if (parent == shell.menuBar) {
- OS.SendMessage (shell.hwndCB, OS.SHCMBM_SETSUBMENU, id, uIDNewItem);
- }
- }
- }
-
- } else {
- success = OS.InsertMenuItem (hMenu, index, true, info);
- }
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- if (!success) error (SWT.ERROR_CANNOT_SET_MENU);
- parent.destroyAcceleratorTable ();
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget ();
- if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- int hMenu = parent.handle;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- int uCheck = OS.MF_BYPOSITION | (selected ? OS.MF_CHECKED : OS.MF_UNCHECKED);
- OS.CheckMenuItem (hMenu, index, uCheck);
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_SET_SELECTION);
- info.fState &= ~OS.MFS_CHECKED;
- if (selected) info.fState |= OS.MFS_CHECKED;
- success = OS.SetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_SET_SELECTION);
- }
- parent.redraw ();
-}
-
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setText (string);
- int hMenu = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_TYPE;
- info.fType = widgetStyle ();
- info.dwTypeData = pszText;
- boolean success = OS.SetMenuItemInfo (hMenu, id, false, info);
- if (OS.IsWinCE) {
- Decorations shell = parent.parent;
- if (parent == shell.menuBar) {
- /* set text on corresponding tool item */
- TBBUTTONINFO info2 = new TBBUTTONINFO ();
- info2.cbSize = TBBUTTONINFO.sizeof;
- info2.dwMask = OS.TBIF_TEXT;
- info2.pszText = pszText;
- OS.SendMessage (shell.hwndTB, OS.TB_SETBUTTONINFO, id, info2);
- }
- }
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- if (!success) error (SWT.ERROR_CANNOT_SET_TEXT);
- parent.redraw ();
-}
-
-int widgetStyle () {
- if ((style & SWT.SEPARATOR) != 0) return OS.MFT_SEPARATOR;
- if ((style & SWT.RADIO) != 0) return OS.MFT_RADIOCHECK;
- return OS.MFT_STRING;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- setSelection (!getSelection ());
- }
- Event event = new Event ();
- if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
- if (OS.GetKeyState (OS.VK_SHIFT) < 0) event.stateMask |= SWT.SHIFT;
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) event.stateMask |= SWT.CONTROL;
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) event.stateMask |= SWT.BUTTON1;
- if (OS.GetKeyState (OS.VK_MBUTTON) < 0) event.stateMask |= SWT.BUTTON2;
- if (OS.GetKeyState (OS.VK_RBUTTON) < 0) event.stateMask |= SWT.BUTTON3;
- postEvent (SWT.Selection, event);
- return null;
-}
-
-LRESULT wmDrawChild (int wParam, int lParam) {
- DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
- if (image != null) {
- /*
- * This code intentionally commented.
- */
-// GC gc = GC.win32_new (struct.hDC, null);
-// gc.drawImage (image, struct.left, struct.top);
- int hImage = image.handle;
- switch (image.type) {
- case SWT.BITMAP:
- BITMAP bm = new BITMAP ();
- OS.GetObject (hImage, BITMAP.sizeof, bm);
- int hDC = OS.CreateCompatibleDC (struct.hDC);
- int oldBitmap = OS.SelectObject (hDC, hImage);
- OS.BitBlt (struct.hDC, struct.left, struct.top + 2, bm.bmWidth, bm.bmHeight, hDC, 0, 0, OS.SRCCOPY);
- OS.SelectObject (hDC, oldBitmap);
- OS.DeleteDC (hDC);
- break;
- case SWT.ICON:
- OS.DrawIconEx (struct.hDC, struct.left, struct.top + 2, hImage, 0, 0, 0, 0, OS.DI_NORMAL);
- break;
- }
- }
- return null;
-}
-
-LRESULT wmMeasureChild (int wParam, int lParam) {
- MEASUREITEMSTRUCT struct = new MEASUREITEMSTRUCT ();
- OS.MoveMemory (struct, lParam, MEASUREITEMSTRUCT.sizeof);
- if (image != null) {
- Rectangle rect = image.getBounds ();
- struct.itemWidth = rect.width + 4;
- struct.itemHeight = rect.height + 4;
- }
- OS.MoveMemory (lParam, struct, MEASUREITEMSTRUCT.sizeof);
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
deleted file mode 100755
index 0ae0aa3b4f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Instances of this class are used used to inform or warn the user.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
- * <dd>OK, OK | CANCEL</dd>
- * <dd>YES | NO, YES | NO | CANCEL</dd>
- * <dd>RETRY | CANCEL</dd>
- * <dd>ABORT | RETRY | IGNORE</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class MessageBox extends Dialog {
- String message = "";
-
-/**
- * Constructs a new instance of this class given only its
- * parent.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT dialog classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the dialog on the currently active
- * display if there is one. If there is no current display, the
- * dialog is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public MessageBox (Shell parent, int style) {
- super (parent, checkStyle (style));
- checkSubclass ();
-}
-
-static int checkStyle (int style) {
- if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) == 0) style |= SWT.APPLICATION_MODAL;
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
-
-/**
- * Returns the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @return the message
- */
-public String getMessage () {
- return message;
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
- * </ul>
- */
-public int open () {
-
- /* Compute the MessageBox style */
- int buttonBits = 0;
- if ((style & SWT.OK) == SWT.OK) buttonBits = OS.MB_OK;
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) buttonBits = OS.MB_OKCANCEL;
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) buttonBits = OS.MB_YESNO;
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) buttonBits = OS.MB_YESNOCANCEL;
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) buttonBits = OS.MB_RETRYCANCEL;
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) buttonBits = OS.MB_ABORTRETRYIGNORE;
- if (buttonBits == 0) buttonBits = OS.MB_OK;
-
- int iconBits = 0;
- if ((style & SWT.ICON_ERROR) != 0) iconBits = OS.MB_ICONERROR;
- if ((style & SWT.ICON_INFORMATION) != 0) iconBits = OS.MB_ICONINFORMATION;
- if ((style & SWT.ICON_QUESTION) != 0) iconBits = OS.MB_ICONQUESTION;
- if ((style & SWT.ICON_WARNING) != 0) iconBits = OS.MB_ICONWARNING;
- if ((style & SWT.ICON_WORKING) != 0) iconBits = OS.MB_ICONINFORMATION;
-
- int modalBits = 0;
- if ((style & SWT.PRIMARY_MODAL) != 0) modalBits = OS.MB_APPLMODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) modalBits = OS.MB_TASKMODAL;
- if ((style & SWT.SYSTEM_MODAL) != 0) modalBits = OS.MB_SYSTEMMODAL;
-
- int bits = buttonBits | iconBits | modalBits;
-
- /*
- * Feature in Windows. System modal is not supported
- * on Windows 95 and NT. The fix is to convert system
- * modal to task modal.
- */
- if ((bits & OS.MB_SYSTEMMODAL) != 0) {
- bits |= OS.MB_TASKMODAL;
- bits &= ~OS.MB_SYSTEMMODAL;
- }
-
- /*
- * Bug in Windows. In order for MB_TASKMODAL to work,
- * the parent HWND of the MessageBox () call must be NULL.
- * The fix is to force the parent to be NULL when this
- * style is set.
- */
- int hwndOwner = 0;
- if (parent != null && (bits & OS.MB_TASKMODAL) == 0) {
- hwndOwner = parent.handle;
- }
-
- /*
- * Feature in Windows. The focus window is not saved and
- * and restored automatically by the call to MessageBox().
- * The fix is to save and restore the focus window.
- */
- int hwndFocus = OS.GetFocus ();
-
- /* Open the message box */
- /* Use the character encoding for the default locale */
- TCHAR buffer1 = new TCHAR (0, message, true);
- TCHAR buffer2 = new TCHAR (0, title, true);
- int code = OS.MessageBox (hwndOwner, buffer1, buffer2, bits);
-
- /* Restore focus */
- OS.SetFocus (hwndFocus);
-
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// if (hwndOwner != 0) OS.UpdateWindow (hwndOwner);
-
- /* Compute and return the result */
- if (code != 0) {
- int type = bits & 0x0F;
- if (type == OS.MB_OK) return SWT.OK;
- if (type == OS.MB_OKCANCEL) {
- return (code == OS.IDOK) ? SWT.OK : SWT.CANCEL;
- }
- if (type == OS.MB_YESNO) {
- return (code == OS.IDYES) ? SWT.YES : SWT.NO;
- }
- if (type == OS.MB_YESNOCANCEL) {
- if (code == OS.IDYES) return SWT.YES;
- if (code == OS.IDNO) return SWT.NO;
- return SWT.CANCEL;
- }
- if (type == OS.MB_RETRYCANCEL) {
- return (code == OS.IDRETRY) ? SWT.RETRY : SWT.CANCEL;
- }
- if (type == OS.MB_ABORTRETRYIGNORE) {
- if (code == OS.IDRETRY) return SWT.RETRY;
- if (code == OS.IDABORT) return SWT.ABORT;
- return SWT.IGNORE;
- }
- }
- return SWT.CANCEL;
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- *
- * @param string the message
- */
-public void setMessage (String string) {
- message = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java
deleted file mode 100755
index 0d77f37c66..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of the receiver represent is an unselectable
- * user interface object that is used to display progress,
- * typically in the form of a bar.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class ProgressBar extends Control {
- static final int ProgressBarProc;
- static final TCHAR ProgressBarClass = new TCHAR (0, OS.PROGRESS_CLASS, true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ProgressBarClass, lpWndClass);
- ProgressBarProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ProgressBar (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ProgressBarProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXHSCROLL) * 10;
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- } else {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- height += OS.GetSystemMetrics (OS.SM_CYVSCROLL) * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- OS.SendMessage (handle, OS.TBM_SETRANGEMAX, 0, 100);
- OS.SendMessage (handle, OS.TBM_SETPAGESIZE, 0, 10);
- OS.SendMessage (handle, OS.TBM_SETTICFREQ, 10, 0);
-}
-
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_HIGHLIGHT);
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- return OS.SendMessage (handle, OS.PBM_GETRANGE, 0, 0);
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- return OS.SendMessage (handle, OS.PBM_GETRANGE, 1, 0);
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- return OS.SendMessage (handle, OS.PBM_GETPOS, 0, 0);
-}
-
-void setBackgroundPixel (int pixel) {
- if (background == pixel) return;
- background = pixel;
- /*
- * Feature in Windows. Setting the color to be
- * the current default is not correct because the
- * widget will not change colors when the colors
- * are changed from the control panel. There is
- * no fix at this time.
- */
- if (pixel == -1) pixel = defaultBackground ();
- OS.SendMessage (handle, OS.PBM_SETBKCOLOR, 0, pixel);
-}
-
-public boolean setFocus () {
- checkWidget();
- return false;
-}
-
-void setForegroundPixel (int pixel) {
- if (foreground == pixel) return;
- foreground = pixel;
- /*
- * Feature in Windows. Setting the color to be
- * the current default is not correct because the
- * widget will not change colors when the colors
- * are changed from the control panel. There is
- * no fix at this time.
- */
- if (pixel == -1) pixel = defaultForeground ();
- OS.SendMessage (handle, OS.PBM_SETBARCOLOR, 0, pixel);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- int minimum = OS.SendMessage (handle, OS.PBM_GETRANGE, 1, 0);
- if (0 <= minimum && minimum < value) {
- OS.SendMessage (handle, OS.PBM_SETRANGE32, minimum, value);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- int maximum = OS.SendMessage (handle, OS.PBM_GETRANGE, 0, 0);
- if (0 <= value && value < maximum) {
- OS.SendMessage (handle, OS.PBM_SETRANGE32, value, maximum);
- }
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- OS.SendMessage (handle, OS.PBM_SETPOS, value, 0);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle ();
- if ((style & SWT.SMOOTH) != 0) bits |= OS.PBS_SMOOTH;
- if ((style & SWT.VERTICAL) != 0) bits |= OS.PBS_VERTICAL;
- return bits;
-}
-
-TCHAR windowClass () {
- return ProgressBarClass;
-}
-
-int windowProc () {
- return ProgressBarProc;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. The progress bar does
- * not implement WM_GETDLGCODE. As a result,
- * a progress bar takes focus and takes part
- * in tab traversal. This behavior, while
- * unspecified, is unwanted. The fix is to
- * implement WM_GETDLGCODE to behave like a
- * STATIC control.
- */
- return new LRESULT (OS.DLGC_STATIC);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
deleted file mode 100755
index 6462db9150..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
+++ /dev/null
@@ -1,380 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user interface object
- * that allows the user to drag a rubber banded outline of the sash within
- * the parent control.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-public class Sash extends Control {
- boolean dragging;
- int startX, startY, lastX, lastY;
- final static int INCREMENT = 1;
- final static int PAGE_INCREMENT = 9;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Sash (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
- * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.DefWindowProc (handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += DEFAULT_WIDTH; height += 3;
- } else {
- width += 3; height += DEFAULT_HEIGHT;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-void drawBand (int x, int y, int width, int height) {
- int hwndTrack = parent.handle;
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- int stippleBitmap = OS.CreateBitmap (8, 8, 1, 1, bits);
- int stippleBrush = OS.CreatePatternBrush (stippleBitmap);
- int hDC = OS.GetDCEx (hwndTrack, 0, OS.DCX_CACHE);
- int oldBrush = OS.SelectObject (hDC, stippleBrush);
- OS.PatBlt (hDC, x, y, width, height, OS.PATINVERT);
- OS.SelectObject (hDC, oldBrush);
- OS.ReleaseDC (hwndTrack, hDC);
- OS.DeleteObject (stippleBrush);
- OS.DeleteObject (stippleBitmap);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-TCHAR windowClass () {
- return getDisplay ().windowClass;
-}
-
-int windowProc () {
- return getDisplay ().windowProc;
-}
-
-LRESULT WM_ERASEBKGND (int wParam, int lParam) {
- LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
- if (result != null) return result;
- drawBackground (wParam);
- return LRESULT.ONE;
-}
-
-LRESULT WM_KEYDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_KEYDOWN (wParam, lParam);
- if (result != null) return result;
- switch (wParam) {
- case OS.VK_LEFT:
- case OS.VK_RIGHT:
- case OS.VK_UP:
- case OS.VK_DOWN:
-
- /* Calculate the new x or y position */
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) return result;
- int step = OS.GetKeyState (OS.VK_CONTROL) < 0 ? INCREMENT : PAGE_INCREMENT;
- POINT pt = new POINT ();
- if ((style & SWT.VERTICAL) != 0) {
- if (wParam == OS.VK_UP || wParam == OS.VK_DOWN) break;
- pt.x = wParam == OS.VK_LEFT ? -step : step;
- } else {
- if (wParam == OS.VK_LEFT || wParam == OS.VK_RIGHT) break;
- pt.y = wParam == OS.VK_UP ? -step : step;
- }
- int hwndTrack = parent.handle;
- OS.MapWindowPoints (handle, hwndTrack, pt, 1);
- RECT rect = new RECT (), clientRect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- OS.GetClientRect (hwndTrack, clientRect);
- int clientWidth = clientRect.right - clientRect.left;
- int clientHeight = clientRect.bottom - clientRect.top;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- newX = Math.min (Math.max (0, pt.x - startX), clientWidth - width);
- } else {
- newY = Math.min (Math.max (0, pt.y - startY), clientHeight - height);
- }
- if (newX == lastX && newY == lastY) return result;
-
- /* The event must be sent because doit flag is used */
- Event event = new Event ();
- event.x = newX; event.y = newY;
- event.width = width; event.height = height;
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the selection
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Selection, event);
- if (isDisposed ()) return LRESULT.ZERO;
- return result;
- }
- return result;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- return new LRESULT (OS.DLGC_STATIC);
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
-
- /* Compute the banding rectangle */
- int hwndTrack = parent.handle;
- POINT pt = new POINT ();
- pt.x = (short) (lParam & 0xFFFF);
- pt.y = (short) (lParam >> 16);
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- OS.MapWindowPoints (handle, 0, pt, 1);
- startX = pt.x - rect.left;
- startY = pt.y - rect.top;
- OS.MapWindowPoints (0, hwndTrack, rect, 2);
- lastX = rect.left; lastY = rect.top;
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
-
- /* The event must be sent because doit flag is used */
- Event event = new Event ();
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- event.detail = SWT.DRAG;
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the selection
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Selection, event);
- if (isDisposed ()) return LRESULT.ZERO;
-
- /* Draw the banding rectangle */
- if (event.doit) {
- dragging = true;
- menuShell ().bringToTop ();
- if (OS.IsWinCE) {
- OS.UpdateWindow (hwndTrack);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (hwndTrack, null, 0, flags);
- }
- drawBand (lastX = event.x, lastY = event.y, width, height);
- }
- return result;
-}
-
-LRESULT WM_LBUTTONUP (int wParam, int lParam) {
- LRESULT result = super.WM_LBUTTONUP (wParam, lParam);
-
- /* Compute the banding rectangle */
- if (!dragging) return result;
- dragging = false;
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
-
- /* The event must be sent because doit flag is used */
- Event event = new Event ();
- event.x = lastX; event.y = lastY;
- event.width = width; event.height = height;
- drawBand (lastX, lastY, width, height);
- sendEvent (SWT.Selection, event);
- // widget could be disposed at this point
- return result;
-}
-
-LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
- LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
- if (result != null) return result;
- if (!dragging || ((wParam & OS.MK_LBUTTON) == 0)) return result;
-
- /* Compute the banding rectangle */
- POINT pt = new POINT ();
- pt.x = (short) (lParam & 0xFFFF);
- pt.y = (short) (lParam >> 16);
- int hwndTrack = parent.handle;
- OS.MapWindowPoints (handle, hwndTrack, pt, 1);
- RECT rect = new RECT (), clientRect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- OS.GetClientRect (hwndTrack, clientRect);
- int clientWidth = clientRect.right - clientRect.left;
- int clientHeight = clientRect.bottom - clientRect.top;
- int newX = lastX, newY = lastY;
- if ((style & SWT.VERTICAL) != 0) {
- newX = Math.min (Math.max (0, pt.x - startX), clientWidth - width);
- } else {
- newY = Math.min (Math.max (0, pt.y - startY), clientHeight - height);
- }
- if (newX == lastX && newY == lastY) return result;
- drawBand (lastX, lastY, width, height);
-
- /* The event must be sent because doit flag is used */
- Event event = new Event ();
- event.x = newX; event.y = newY;
- event.width = width; event.height = height;
- event.detail = SWT.DRAG;
-
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the selection
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Selection, event);
- if (isDisposed ()) return LRESULT.ZERO;
-
- /* Draw the banding rectangle */
- if (event.doit) {
- lastX = event.x; lastY = event.y;
- if (OS.IsWinCE) {
- OS.UpdateWindow (hwndTrack);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (hwndTrack, null, 0, flags);
- }
- drawBand (lastX, lastY, width, height);
- }
- return result;
-}
-
-LRESULT WM_SETCURSOR (int wParam, int lParam) {
- LRESULT result = super.WM_SETCURSOR (wParam, lParam);
- if (result != null) return result;
- int hitTest = lParam & 0xFFFF;
- if (hitTest == OS.HTCLIENT) {
- int hCursor;
- if ((style & SWT.HORIZONTAL) != 0) {
- hCursor = OS.LoadCursor (0, OS.IDC_SIZENS);
- } else {
- hCursor = OS.LoadCursor (0, OS.IDC_SIZEWE);
- }
- OS.SetCursor (hCursor);
- return LRESULT.ONE;
- }
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java
deleted file mode 100755
index 2fb65976a5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java
+++ /dev/null
@@ -1,396 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of the receiver represent a selectable user
- * interface object that present a range of continuous
- * numeric values.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd> HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public class Scale extends Control {
- static final int TrackBarProc;
- static final TCHAR TrackBarClass = new TCHAR (0, OS.TRACKBAR_CLASS, true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, TrackBarClass, lpWndClass);
- TrackBarProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scale (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (TrackBarProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- RECT rect = new RECT ();
- OS.SendMessage (handle, OS.TBM_GETTHUMBRECT, 0, rect);
- if ((style & SWT.HORIZONTAL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXHSCROLL) * 10;
- int scrollY = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- height += (rect.top * 2) + scrollY + (scrollY / 3);
- } else {
- int scrollX = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- width += (rect.left * 2) + scrollX + (scrollX / 3);
- height += OS.GetSystemMetrics (OS.SM_CYVSCROLL) * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- OS.SendMessage (handle, OS.TBM_SETRANGEMAX, 0, 100);
- OS.SendMessage (handle, OS.TBM_SETPAGESIZE, 0, 10);
- OS.SendMessage (handle, OS.TBM_SETTICFREQ, 10, 0);
-}
-
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_BTNFACE);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TBM_GETLINESIZE, 0, 0);
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TBM_GETPAGESIZE, 0, 0);
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's position.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TBM_GETPOS, 0, 0);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int increment) {
- checkWidget ();
- if (increment < 1) return;
- int minimum = OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);
- int maximum = OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);
- if (increment > maximum - minimum) return;
- OS.SendMessage (handle, OS.TBM_SETLINESIZE, 0, increment);
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- int minimum = OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);
- if (0 <= minimum && minimum < value) {
- OS.SendMessage (handle, OS.TBM_SETRANGEMAX, 1, value);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- int maximum = OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);
- if (0 <= value && value < maximum) {
- OS.SendMessage (handle, OS.TBM_SETRANGEMIN, 1, value);
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int pageIncrement) {
- checkWidget ();
- if (pageIncrement < 1) return;
- int minimum = OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);
- int maximum = OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);
- if (pageIncrement > maximum - minimum) return;
- OS.SendMessage (handle, OS.TBM_SETPAGESIZE, 0, pageIncrement);
- OS.SendMessage (handle, OS.TBM_SETTICFREQ, pageIncrement, 0);
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- OS.SendMessage (handle, OS.TBM_SETPOS, 1, value);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.WS_TABSTOP | OS.TBS_BOTH | OS.TBS_AUTOTICKS;
- if ((style & SWT.HORIZONTAL) != 0) return bits | OS.TBS_HORZ;
- return bits | OS.TBS_VERT;
-}
-
-TCHAR windowClass () {
- return TrackBarClass;
-}
-
-int windowProc () {
- return TrackBarProc;
-}
-
-LRESULT wmScrollChild (int wParam, int lParam) {
-
- /* Do nothing when scrolling is ending */
- int code = wParam & 0xFFFF;
- if (code == OS.TB_ENDTRACK) return null;
-
- /*
- * This code is intentionally commented. The event
- * detail field is not currently supported on all
- * platforms.
- */
- Event event = new Event ();
-// switch (code) {
-// /*
-// * This line is intentionally commented. Do not set the detail
-// * field to DRAG to indicate that the dragging has ended when the
-// * scroll bar is finally positioned in TB_THUMBPOSITION.
-// */
-//// case OS.TB_THUMBPOSITION: break;
-// case OS.TB_THUMBTRACK: event.detail = SWT.DRAG; break;
-// case OS.TB_TOP: event.detail = SWT.HOME; break;
-// case OS.TB_BOTTOM: event.detail = SWT.END; break;
-// case OS.TB_LINEDOWN: event.detail = SWT.ARROW_DOWN; break;
-// case OS.TB_LINEUP: event.detail = SWT.ARROW_UP; break;
-// case OS.TB_PAGEDOWN: event.detail = SWT.PAGE_DOWN; break;
-// case OS.TB_PAGEUP: event.detail = SWT.PAGE_UP; break;
-// }
-
- /*
- * Send the event because WM_HSCROLL and WM_VSCROLL
- * are sent from a modal message loop in windows that
- * is active when the user is scrolling.
- */
- sendEvent (SWT.Selection, event);
- // widget could be disposed at this point
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
deleted file mode 100755
index 9084e9228b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
+++ /dev/null
@@ -1,977 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given scroll bar will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the scroll bar represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, scroll bars will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, scroll bars are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the scroll bar's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the scroll bar will not change.
- * </p><p>
- * Scroll bars are created by specifying either <code>H_SCROLL</code>,
- * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
- * They are accessed from the <code>Scrollable</code> using
- * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
- * </p><p>
- * Note: Scroll bars are not Controls. On some platforms, scroll bars
- * that appear as part of some standard controls such as a text or list
- * have no operating system resources and are not children of the control.
- * For this reason, scroll bars are treated specially. To create a control
- * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see Slider
- * @see Scrollable
- * @see Scrollable#getHorizontalBar
- * @see Scrollable#getVerticalBar
- */
-
-public class ScrollBar extends Widget {
- Scrollable parent;
- int increment, pageIncrement;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-ScrollBar (Scrollable parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- createWidget ();
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-void createWidget () {
- increment = 1;
- pageIncrement = 10;
- /*
- * Do not set the intial values of the maximum
- * or the thumb. These values normally default
- * to 100 and 10 but may have been set already
- * by the widget that owns the scroll bar. For
- * example, a scroll bar that is created for a
- * list widget, setting these defaults would
- * override the initial values provided by the
- * list widget.
- */
-}
-
-void destroyWidget () {
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- if (OS.IsWinCE) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
- // error (SWT.ERROR_NOT_IMPLEMENTED);
- } else {
- OS.ShowScrollBar (hwnd, type, false);
- }
-}
-
-/*
-* Not currently used.
-*/
-Rectangle getBounds () {
- RECT rect = new RECT ();
- OS.GetClientRect (parent.handle, rect);
- int x = 0, y = 0, width, height;
- if ((style & SWT.HORIZONTAL) != 0) {
- y = rect.bottom - rect.top;
- width = rect.right - rect.left;
- height = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- } else {
- x = rect.right - rect.left;
- width = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- height = rect.bottom - rect.top;
- }
- return new Rectangle (x, y, width, height);
-}
-
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @return the enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- return (state & DISABLED) == 0;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget();
- return increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE;
- int hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- OS.GetScrollInfo (hwnd, type, info);
- return info.nMax;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE;
- int hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- OS.GetScrollInfo (hwnd, type, info);
- return info.nMin;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget();
- return pageIncrement;
-}
-
-/**
- * Returns the receiver's parent, which must be scrollable.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Scrollable getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS;
- int hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- OS.GetScrollInfo (hwnd, type, info);
- return info.nPos;
-}
-
-/**
- * For horizontal scroll bars, returns the height of the
- * instance, and for vertical scroll bars, returns the width
- * of the instance.
- *
- * @return the scroll bar size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSize () {
- checkWidget();
- RECT rect = new RECT ();
- OS.GetClientRect (parent.handle, rect);
- int width, height;
- if ((style & SWT.HORIZONTAL) != 0) {
- width = rect.right - rect.left;
- height = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- } else {
- width = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- height = rect.bottom - rect.top;
- }
- return new Point (width, height);
-}
-
-/**
- * Answers the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public int getThumb () {
- checkWidget();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_PAGE;
- int hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- OS.GetScrollInfo (hwnd, type, info);
- if (info.nPage != 0) --info.nPage;
- return info.nPage;
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getVisible () {
- checkWidget();
- return (state & HIDDEN) == 0;
-}
-
-int hwndScrollBar () {
- return parent.handle;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * <p>
- * Note: Because of the strong connection between a scroll bar
- * and the widget which contains it (its parent), a scroll bar
- * will not indicate that it is enabled if its parent is not.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isVisible () {
- checkWidget();
- return getVisible () && parent.isVisible ();
-}
-
-void releaseChild () {
- super.releaseChild ();
- if (parent.horizontalBar == this) parent.horizontalBar = null;
- if (parent.verticalBar == this) parent.verticalBar = null;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-int scrollBarType () {
- if ((style & SWT.VERTICAL) != 0) return OS.SB_VERT;
- /*
- * This line is intentionally commented. There should
- * only ever be HORIZONTAL and VERTICAL scroll bars.
- * The commented code reminds us that this is the case
- * and that the default style is HORIZONTAL.
- */
-// if ((style & SWT.HORIZONTAL) != 0) return OS.SB_HORZ;
- return OS.SB_HORZ;
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
- OS.EnableScrollBar (hwnd, type, flags);
- state &= ~DISABLED;
- if (!enabled) state |= DISABLED;
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- increment = value;
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget();
- if (value < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- info.fMask = OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (hwnd, type, info);
- if (value - info.nMin - info.nPage < 1) return;
- info.nMax = value;
- OS.SetScrollInfo (hwnd, type, info, (state & DISABLED) == 0);
-
- /*
- * Bug in Windows. For some reason, when the widget
- * is a standard scroll bar, and SetScrollInfo () is
- * called with SIF_RANGE or SIF_PAGE, the widget is
- * incorrectly made visible so that the next time the
- * widget is resized (or another scroll bar operation
- * is performed), the scroll bar draws. The fix is
- * to hide the scroll bar (again) when already hidden.
- */
- if ((state & HIDDEN) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.ShowScrollBar (hwnd, type, false);
- }
- }
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (hwnd, type, OS.ESB_DISABLE_BOTH);
- }
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget();
- if (value < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- info.fMask = OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (hwnd, type, info);
- if (info.nMax - value - info.nPage < 1) return;
- info.nMin = value;
- OS.SetScrollInfo (hwnd, type, info, true);
-
- /*
- * Bug in Windows. For some reason, when the widget
- * is a standard scroll bar, and SetScrollInfo () is
- * called with SIF_RANGE or SIF_PAGE, the widget is
- * incorrectly made visible so that the next time the
- * widget is resized (or another scroll bar operation
- * is performed), the scroll bar draws. The fix is
- * to hide the scroll bar (again) when already hidden.
- */
- if ((state & HIDDEN) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.ShowScrollBar (hwnd, type, false);
- }
- }
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (hwnd, type, OS.ESB_DISABLE_BOTH);
- }
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget();
- if (value < 1) return;
- pageIncrement = value;
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int selection) {
- checkWidget();
- if (selection < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- info.fMask = OS.SIF_POS;
- info.nPos = selection;
- OS.SetScrollInfo (hwnd, type, info, true);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget();
-
- /* Position the thumb */
- if (value < 1) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- info.fMask = OS.SIF_PAGE | OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (hwnd, type, info);
- if (info.nMax - info.nMin - value < 0) return;
- info.nPage = value;
- if (info.nPage != 0) info.nPage++;
- OS.SetScrollInfo (hwnd, type, info, true);
-
- /*
- * Bug in Windows. For some reason, when the widget
- * is a standard scroll bar, and SetScrollInfo () is
- * called with SIF_RANGE or SIF_PAGE, the widget is
- * incorrectly made visible so that the next time the
- * widget is resized (or another scroll bar operation
- * is performed), the scroll bar draws. The fix is
- * to hide the scroll bar (again) when already hidden.
- */
- if ((state & HIDDEN) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.ShowScrollBar (hwnd, type, false);
- }
- }
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (hwnd, type, OS.ESB_DISABLE_BOTH);
- }
- }
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- this.increment = increment;
- this.pageIncrement = pageIncrement;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS | OS.SIF_PAGE | OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- info.nPos = selection;
- info.nMin = minimum;
- info.nMax = maximum;
- info.nPage = thumb;
- if (info.nPage != 0) info.nPage++;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- OS.SetScrollInfo (hwnd, type, info, true);
-
- /*
- * Bug in Windows. For some reason, when the widget
- * is a standard scroll bar, and SetScrollInfo () is
- * called with SIF_RANGE or SIF_PAGE, the widget is
- * incorrectly made visible so that the next time the
- * widget is resized (or another scroll bar operation
- * is performed), the scroll bar draws. The fix is
- * to hide the scroll bar (again) when already hidden.
- */
- if ((state & HIDDEN) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.ShowScrollBar (hwnd, type, false);
- }
- }
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (hwnd, type, OS.ESB_DISABLE_BOTH);
- }
- }
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setVisible (boolean visible) {
- checkWidget();
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- /*
- * Set the state bits before calling ShowScrollBar ()
- * because hiding and showing the scroll bar can cause
- * WM_SIZE messages when the client area is resized.
- * Setting the state before the call means that code
- * that runs during WM_SIZE that queries the visibility
- * of the scroll bar will get the correct value.
- */
- state &= ~HIDDEN;
- if (!visible) state |= HIDDEN;
- int hwnd = hwndScrollBar (), type = scrollBarType ();
- if (OS.ShowScrollBar (hwnd, type, visible)) {
- /*
- * Bug in Windows. For some reason, when the widget
- * is a standard scroll bar, and SetScrollInfo () is
- * called with SIF_RANGE or SIF_PAGE while the widget
- * is not visible, the widget is incorrectly disabled
- * even though the values for SIF_RANGE and SIF_PAGE,
- * when set for a visible scroll bar would not disable
- * the scroll bar. The fix is to enable the scroll bar
- * when not disabled by the application and the current
- * scroll bar ranges would cause the scroll bar to be
- * enabled had they been set when the scroll bar was
- * visible.
- */
- if ((state & DISABLED) == 0) {
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
- OS.GetScrollInfo (hwnd, type, info);
- if (info.nMax - info.nMin - info.nPage >= 0) {
- OS.EnableScrollBar (hwnd, type, OS.ESB_ENABLE_BOTH);
- }
- }
- sendEvent (visible ? SWT.Show : SWT.Hide);
- // widget could be disposed at this point
- }
- }
-}
-
-LRESULT wmScrollChild (int wParam, int lParam) {
-
- /* Do nothing when scrolling is ending */
- int code = wParam & 0xFFFF;
- if (code == OS.SB_ENDSCROLL) return null;
-
- /*
- * Send the event because WM_HSCROLL and
- * WM_VSCROLL are sent from a modal message
- * loop in Windows that is active when the
- * user is scrolling.
- */
- Event event = new Event ();
- switch (code) {
- /*
- * This line is intentionally commented. Do not set the detail
- * field to DRAG to indicate that the dragging has ended when the
- * scroll bar is finally positioned in SB_THUMBPOSITION.
- */
-// case OS.SB_THUMBPOSITION: break;
- case OS.SB_THUMBTRACK: event.detail = SWT.DRAG; break;
- case OS.SB_TOP: event.detail = SWT.HOME; break;
- case OS.SB_BOTTOM: event.detail = SWT.END; break;
- case OS.SB_LINEDOWN: event.detail = SWT.ARROW_DOWN; break;
- case OS.SB_LINEUP: event.detail = SWT.ARROW_UP; break;
- case OS.SB_PAGEDOWN: event.detail = SWT.PAGE_DOWN; break;
- case OS.SB_PAGEUP: event.detail = SWT.PAGE_UP; break;
- }
- sendEvent (SWT.Selection, event);
- // the widget could be destroyed at this point
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
deleted file mode 100755
index 1245853849..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
+++ /dev/null
@@ -1,376 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * This class is the abstract superclass of all classes which
- * represent controls that have standard scroll bars.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>H_SCROLL, V_SCROLL</dd>
- * <dt><b>Events:</b>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
- * </p>
- */
-
-public abstract class Scrollable extends Control {
-
- ScrollBar horizontalBar, verticalBar;
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Scrollable () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Scrollable (Composite parent, int style) {
- super (parent, style);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.DefWindowProc (handle, msg, wParam, lParam);
-}
-
-/**
- * Given a desired <em>client area</em> for the receiver
- * (as described by the arguments), returns the bounding
- * rectangle which would be required to produce that client
- * area.
- * <p>
- * In other words, it returns a rectangle such that, if the
- * receiver's bounds were set to that rectangle, the area
- * of the receiver which is capable of displaying data
- * (that is, not covered by the "trimmings") would be the
- * rectangle described by the arguments (relative to the
- * receiver's parent).
- * </p>
- *
- * @return the required bounds to produce the given client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getClientArea
- */
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget ();
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- OS.AdjustWindowRectEx (rect, bits, false, OS.GetWindowLong (handle, OS.GWL_EXSTYLE));
- if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- int nWidth = rect.right - rect.left, nHeight = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, nWidth, nHeight);
-}
-
-ScrollBar createScrollBar (int type) {
- ScrollBar bar = new ScrollBar (this, type);
- bar.setMaximum (100);
- bar.setThumb (10);
- return bar;
-}
-
-void createWidget () {
- super.createWidget ();
- if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
- if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
-}
-
-/**
- * Returns a rectangle which describes the area of the
- * receiver which is capable of displaying data (that is,
- * not covered by the "trimmings").
- *
- * @return the client area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #computeTrim
- */
-public Rectangle getClientArea () {
- checkWidget ();
- if (parent != null && parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- return new Rectangle (0, 0, rect.right, rect.bottom);
-}
-
-/**
- * Returns the receiver's horizontal scroll bar if it has
- * one, and null if it does not.
- *
- * @return the horizontal scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getHorizontalBar () {
- checkWidget ();
- return horizontalBar;
-}
-
-/**
- * Returns the receiver's vertical scroll bar if it has
- * one, and null if it does not.
- *
- * @return the vertical scroll bar (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ScrollBar getVerticalBar () {
- checkWidget ();
- return verticalBar;
-}
-
-void releaseWidget () {
- if (horizontalBar != null) horizontalBar.releaseWidget ();
- if (verticalBar != null) verticalBar.releaseWidget ();
- horizontalBar = verticalBar = null;
- super.releaseWidget ();
-}
-
-int widgetExtStyle () {
- return super.widgetExtStyle ();
- /*
- * This code is intentionally commented. In future,
- * we may wish to support different standard Windows
- * edge styles. The issue here is that not all of
- * these styles are available on the other platforms
- * this would need to be a hint.
- */
-// if ((style & SWT.BORDER) != 0) return OS.WS_EX_CLIENTEDGE;
-// if ((style & SWT.SHADOW_IN) != 0) return OS.WS_EX_STATICEDGE;
-// return super.widgetExtStyle ();
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.WS_TABSTOP;
- if ((style & SWT.H_SCROLL) != 0) bits |= OS.WS_HSCROLL;
- if ((style & SWT.V_SCROLL) != 0) bits |= OS.WS_VSCROLL;
- return bits;
-}
-
-TCHAR windowClass () {
- return getDisplay ().windowClass;
-}
-
-int windowProc () {
- return getDisplay ().windowProc;
-}
-
-LRESULT WM_HSCROLL (int wParam, int lParam) {
- LRESULT result = super.WM_HSCROLL (wParam, lParam);
- if (result != null) return result;
-
- /*
- * Bug on WinCE. lParam should be NULL when the message is not sent
- * by a scroll bar control, but it contains the handle to the window.
- * When the message is sent by a scroll bar control, it correctly
- * contains the handle to the scroll bar. The fix is to check for
- * both.
- */
- if ((lParam == 0 || lParam == handle) && horizontalBar != null) {
- result = wmScroll (OS.WM_HSCROLL, wParam, lParam);
- horizontalBar.wmScrollChild (wParam, lParam);
- }
- return result;
-}
-
-LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
- LRESULT result = super.WM_MOUSEWHEEL (wParam, lParam);
- if (result != null) return result;
-
- /*
- * Translate WM_MOUSEWHEEL to WM_VSCROLL or WM_HSCROLL.
- */
- if ((state & CANVAS) != 0) {
- if ((wParam & (OS.MK_SHIFT | OS.MK_CONTROL)) != 0) return result;
- int delta = (short) (wParam >> 16);
- int code = delta < 0 ? OS.SB_LINEDOWN : OS.SB_LINEUP;
- delta = Math.abs (delta);
- if (delta < OS.WHEEL_DELTA) return result;
- if (verticalBar != null) {
- int [] value = new int [1];
- OS.SystemParametersInfo (OS.SPI_GETWHEELSCROLLLINES, 0, value, 0);
- int count = value [0] * delta / OS.WHEEL_DELTA;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.WM_VSCROLL, code, 0);
- }
- return LRESULT.ZERO;
- }
- if (horizontalBar != null) {
- int count = delta / OS.WHEEL_DELTA;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, OS.WM_HSCROLL, code, 0);
- }
- return LRESULT.ZERO;
- }
- return result;
- }
-
- /*
- * When the native widget scrolls inside WM_MOUSEWHEEL, it
- * may or may not send a WM_VSCROLL or WM_HSCROLL to do the
- * actual scrolling. This depends on the implementation of
- * each native widget. In order to ensure that application
- * code is notified when the scroll bar moves, compare the
- * scroll bar position before and after the WM_MOUSEWHEEL.
- * If the native control sends a WM_VSCROLL or WM_HSCROLL,
- * then the application has already been notified. If not
- * explicity send the event.
- */
- int vPosition = verticalBar == null ? 0 : verticalBar.getSelection ();
- int hPosition = horizontalBar == null ? 0 : horizontalBar.getSelection ();
- int code = callWindowProc (OS.WM_MOUSEWHEEL, wParam, lParam);
- if (verticalBar != null) {
- if (verticalBar.getSelection () != vPosition) {
- Event event = new Event ();
- event.detail = SWT.DRAG;
- verticalBar.sendEvent (SWT.Selection, event);
- }
- }
- if (horizontalBar != null) {
- if (horizontalBar.getSelection () != hPosition) {
- Event event = new Event ();
- event.detail = SWT.DRAG;
- horizontalBar.sendEvent (SWT.Selection, event);
- }
- }
- return new LRESULT (code);
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- int code = callWindowProc (OS.WM_SIZE, wParam, lParam);
- super.WM_SIZE (wParam, lParam);
- // widget may be disposed at this point
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-LRESULT WM_VSCROLL (int wParam, int lParam) {
- LRESULT result = super.WM_VSCROLL (wParam, lParam);
- if (result != null) return result;
-
- /*
- * Bug on WinCE. lParam should be NULL when the message is not sent
- * by a scroll bar control, but it contains the handle to the window.
- * When the message is sent by a scroll bar control, it correctly
- * contains the handle to the scroll bar. The fix is to check for
- * both.
- */
- if ((lParam == 0 || lParam == handle) && (verticalBar != null)) {
- result = wmScroll (OS.WM_VSCROLL, wParam, lParam);
- verticalBar.wmScrollChild (wParam, lParam);
- }
- return result;
-}
-
-LRESULT wmScroll (int msg, int wParam, int lParam) {
- int type = OS.SB_HORZ;
- ScrollBar bar = horizontalBar;
- if (msg == OS.WM_VSCROLL) {
- type = OS.SB_VERT;
- bar = verticalBar;
- }
- if (bar == null) return null;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_TRACKPOS | OS.SIF_POS | OS.SIF_RANGE;
- OS.GetScrollInfo (handle, type, info);
- info.fMask = OS.SIF_POS;
- int code = wParam & 0xFFFF;
- switch (code) {
- case OS.SB_ENDSCROLL: return null;
- case OS.SB_THUMBTRACK:
- case OS.SB_THUMBPOSITION:
- /*
- * Note: On WinCE, the value in SB_THUMBPOSITION is relative to nMin.
- * Same for SB_THUMBPOSITION 'except' for the very first thumb track
- * message which has the actual value of nMin. This is a problem when
- * nMin is not zero.
- */
- info.nPos = info.nTrackPos;
- break;
- case OS.SB_TOP:
- info.nPos = info.nMin;
- break;
- case OS.SB_BOTTOM:
- info.nPos = info.nMax;
- break;
- case OS.SB_LINEDOWN:
- info.nPos += bar.getIncrement ();
- break;
- case OS.SB_LINEUP:
- int increment = bar.getIncrement ();
- info.nPos = Math.max (info.nMin, info.nPos - increment);
- break;
- case OS.SB_PAGEDOWN:
- info.nPos += bar.getPageIncrement ();
- break;
- case OS.SB_PAGEUP:
- int pageIncrement = bar.getPageIncrement ();
- info.nPos = Math.max (info.nMin, info.nPos - pageIncrement);
- break;
- }
- OS.SetScrollInfo (handle, type, info, true);
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
deleted file mode 100755
index 46067ede78..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ /dev/null
@@ -1,1153 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent the "windows"
- * which the desktop or "window manager" is managing.
- * Instances that do not have a parent (that is, they
- * are built using the constructor, which takes a
- * <code>Display</code> as the argument) are described
- * as <em>top level</em> shells. Instances that do have
- * a parent are described as <em>secondary</em> or
- * <em>dialog</em> shells.
- * <p>
- * Instances are always displayed in one of the maximized,
- * minimized or normal states:
- * <ul>
- * <li>
- * When an instance is marked as <em>maximized</em>, the
- * window manager will typically resize it to fill the
- * entire visible area of the display, and the instance
- * is usually put in a state where it can not be resized
- * (even if it has style <code>RESIZE</code>) until it is
- * no longer maximized.
- * </li><li>
- * When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), its appearance is controlled by
- * the style constants which were specified when it was created
- * and the restrictions of the window manager (see below).
- * </li><li>
- * When an instance has been marked as <em>minimized</em>,
- * its contents (client area) will usually not be visible,
- * and depending on the window manager, it may be
- * "iconified" (that is, replaced on the desktop by a small
- * simplified representation of itself), relocated to a
- * distinguished area of the screen, or hidden. Combinations
- * of these changes are also possible.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Note: The styles supported by this class must be treated
- * as <em>HINT</em>s, since the window manager for the
- * desktop on which the instance is visible has ultimate
- * control over the appearance and behavior of decorations
- * and modality. For example, some window managers only
- * support resizable windows and will always assume the
- * RESIZE style, even if it is not set. In addition, if a
- * modality style is not supported, it is "upgraded" to a
- * more restrictive modality style that is supported. For
- * example, if <code>PRIMARY_MODAL</code> is not supported,
- * it would be upgraded to <code>APPLICATION_MODAL</code>.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
- * </dl>
- * Class <code>SWT</code> provides two "convenience constants"
- * for the most commonly required style combinations:
- * <dl>
- * <dt><code>SHELL_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application top level shell: (that
- * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
- * </dd>
- * <dt><code>DIALOG_TRIM</code></dt>
- * <dd>
- * the result of combining the constants which are required
- * to produce a typical application dialog shell: (that
- * is, <code>TITLE | CLOSE | BORDER</code>)
- * </dd>
- * </dl>
- * </p>
- * <p>
- * IMPORTANT: This class is not intended to be subclassed.
- * </p>
- *
- * @see Decorations
- * @see SWT
- */
-public class Shell extends Decorations {
- Display display;
- Menu activeMenu;
- int hIMC;
- int [] brushes;
- boolean showWithParent;
- int toolTipHandle, lpstrTip;
- Control lastActive;
-
-/**
- * Constructs a new instance of this class. This is equivalent
- * to calling <code>Shell((Display) null)</code>.
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell () {
- this ((Display) null);
-}
-
-/**
- * Constructs a new instance of this class given only the style
- * value describing its behavior and appearance. This is equivalent
- * to calling <code>Shell((Display) null, style)</code>.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (int style) {
- this ((Display) null, style);
-}
-
-/**
- * Constructs a new instance of this class given only the display
- * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display) {
- this (display, OS.IsWinCE ? SWT.NONE : SWT.SHELL_TRIM);
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the shell on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Display display, int style) {
- this (display, null, style, 0);
-}
-
-Shell (Display display, Shell parent, int style, int handle) {
- super ();
- checkSubclass ();
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.parent = parent;
- this.display = display;
- this.handle = handle;
- createWidget ();
-}
-
-/**
- * Constructs a new instance of this class given only its
- * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
- * <p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent) {
- this (parent, OS.IsWinCE ? SWT.NONE : SWT.DIALOG_TRIM);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the parent.
- * This has the effect of creating the shell on the currently active
- * display if there is one. If there is no current display, the
- * shell is created on a "default" display. <b>Passing in null as
- * the parent is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param parent a shell which will be the parent of the new instance
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Shell (Shell parent, int style) {
- this (parent != null ? parent.getDisplay () : null, parent, style, 0);
-}
-
-/**
- * Invokes platform specific functionality to allocate a new shell.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Shell</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- *
- * @param display the display for the shell
- * @param handle the handle for the shell
- *
- * @private
- */
-public static Shell win32_new (Display display, int handle) {
- return new Shell (display, null, SWT.NO_TRIM, handle);
-}
-
-static int checkStyle (int style) {
- style = Decorations.checkStyle (style);
- int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
- int bits = style & ~mask;
- if ((style & SWT.SYSTEM_MODAL) != 0) return bits | SWT.SYSTEM_MODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) return bits | SWT.APPLICATION_MODAL;
- if ((style & SWT.PRIMARY_MODAL) != 0) return bits | SWT.PRIMARY_MODAL;
- return bits;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when operations are performed on the receiver,
- * by sending the listener one of the messages defined in the
- * <code>ShellListener</code> interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #removeShellListener
- */
-public void addShellListener (ShellListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Close,typedListener);
- addListener (SWT.Iconify,typedListener);
- addListener (SWT.Deiconify,typedListener);
- addListener (SWT.Activate, typedListener);
- addListener (SWT.Deactivate, typedListener);
-}
-
-/**
- * Requests that the window manager close the receiver in
- * the same way it would be closed when the user clicks on
- * the "close box" or performs some other platform specific
- * key or mouse combination that indicates the window
- * should be removed.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget ();
- OS.PostMessage (handle, OS.WM_CLOSE, 0, 0);
-}
-
-void createHandle () {
- boolean embedded = handle != 0;
-
- /*
- * On Windows 98 and NT, setting a window to be the
- * top most window using HWND_TOPMOST can result in a
- * parent dialog shell being moved behind its parent
- * if the dialog has a sibling that is currently on top
- * This only occurs using SetWindowPos (), not when the
- * handle is created.
- */
- /*
- * The following code is intentionally commented.
- */
-// if ((style & SWT.ON_TOP) != 0) display.lockActiveWindow = true;
- super.createHandle ();
- /*
- * The following code is intentionally commented.
- */
-// if ((style & SWT.ON_TOP) != 0) display.lockActiveWindow = false;
-
- if (!embedded) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits &= ~(OS.WS_OVERLAPPED | OS.WS_CAPTION);
- bits |= OS.WS_POPUP;
- if ((style & SWT.TITLE) != 0) bits |= OS.WS_CAPTION;
- if ((style & SWT.NO_TRIM) == 0) {
- if ((style & (SWT.BORDER | SWT.RESIZE)) == 0) bits |= OS.WS_BORDER;
- }
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- if (OS.IsWinCE) setMaximized (true);
- }
- if (OS.IsDBLocale) {
- hIMC = OS.ImmCreateContext ();
- if (hIMC != 0) OS.ImmAssociateContext (handle, hIMC);
- }
-}
-
-void createWidget () {
- super.createWidget ();
- if (!display.TrimEnabled) return;
- if (!isActive ()) setItemEnabled (OS.SC_CLOSE, false);
-}
-
-public void dispose () {
- /*
- * This code is intentionally commented. On some
- * platforms, the owner window is repainted right
- * away when a dialog window exits. This behavior
- * is currently unspecified.
- */
-// /*
-// * Note: It is valid to attempt to dispose a widget
-// * more than once. If this happens, fail silently.
-// */
-// if (!isValidWidget ()) return;
-// if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
-// Display oldDisplay = display;
- super.dispose ();
- // widget is disposed at this point
-// if (oldDisplay != null) oldDisplay.update ();
-}
-
-int findBrush (int pixel) {
- if (pixel == OS.GetSysColor (OS.COLOR_BTNFACE)) {
- return OS.GetSysColorBrush (OS.COLOR_BTNFACE);
- }
- if (pixel == OS.GetSysColor (OS.COLOR_WINDOW)) {
- return OS.GetSysColorBrush (OS.COLOR_WINDOW);
- }
- if (brushes == null) brushes = new int [4];
- LOGBRUSH logBrush = new LOGBRUSH ();
- for (int i=0; i<brushes.length; i++) {
- int hBrush = brushes [i];
- if (hBrush == 0) break;
- OS.GetObject (hBrush, LOGBRUSH.sizeof, logBrush);
- if (logBrush.lbColor == pixel) return hBrush;
- }
- int length = brushes.length;
- int hBrush = brushes [--length];
- if (hBrush != 0) OS.DeleteObject (hBrush);
- System.arraycopy (brushes, 0, brushes, 1, length);
- brushes [0] = hBrush = OS.CreateSolidBrush (pixel);
- return hBrush;
-}
-
-int findCursor () {
- return hCursor;
-}
-
-public Rectangle getBounds () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) return super.getBounds ();
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-
-public boolean getEnabled () {
- checkWidget ();
- if (!display.TrimEnabled) return super.getEnabled ();
- return (state & DISABLED) == 0;
-}
-
-/**
- * Returns the receiver's input method editor mode. This
- * will be the result of bitwise OR'ing together one or
- * more of the following constants defined in class
- * <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @return the IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public int getImeInputMode () {
- checkWidget ();
- if (!OS.IsDBLocale) return 0;
- int hIMC = OS.ImmGetContext (handle);
- int [] lpfdwConversion = new int [1], lpfdwSentence = new int [1];
- boolean open = OS.ImmGetOpenStatus (hIMC);
- if (open) open = OS.ImmGetConversionStatus (hIMC, lpfdwConversion, lpfdwSentence);
- OS.ImmReleaseContext (handle, hIMC);
- if (!open) return SWT.NONE;
- int result = 0;
- if ((lpfdwConversion [0] & OS.IME_CMODE_ROMAN) != 0) result |= SWT.ROMAN;
- if ((lpfdwConversion [0] & OS.IME_CMODE_FULLSHAPE) != 0) result |= SWT.DBCS;
- if ((lpfdwConversion [0] & OS.IME_CMODE_KATAKANA) != 0) return result | SWT.PHONETIC;
- if ((lpfdwConversion [0] & OS.IME_CMODE_NATIVE) != 0) return result | SWT.NATIVE;
- return result | SWT.ALPHA;
-}
-
-public Point getLocation () {
- checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- return super.getLocation ();
- }
- }
- RECT rect = new RECT ();
- OS.GetWindowRect (handle, rect);
- return new Point (rect.left, rect.top);
-}
-
-public Shell getShell () {
- checkWidget ();
- return this;
-}
-
-/**
- * Returns an array containing all shells which are
- * descendents of the receiver.
- * <p>
- * @return the dialog shells
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Shell [] getShells () {
- checkWidget ();
- int count = 0;
- Shell [] shells = display.getShells ();
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) count++;
- }
- int index = 0;
- Shell [] result = new Shell [count];
- for (int i=0; i<shells.length; i++) {
- Control shell = shells [i];
- do {
- shell = shell.parent;
- } while (shell != null && shell != this);
- if (shell == this) {
- result [index++] = shells [i];
- }
- }
- return result;
-}
-
-public boolean isEnabled () {
- checkWidget ();
- return getEnabled ();
-}
-
-/**
- * Moves the receiver to the top of the drawing order for
- * the display on which it was created (so that all other
- * shells on that display, which are not the receiver's
- * children will be drawn behind it), marks it visible,
- * and sets focus to its default button (if it has one).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Control#setVisible
- * @see Decorations#setDefaultButton
-*/
-public void open () {
- checkWidget ();
- bringToTop ();
- if (OS.IsWinCE) {
- /*
- * Feature on WinCE PPC. A new application becomes the
- * foreground application only if it has at least one
- * visible window before the event loop is started.
- * The workaround is to explicitely force the shell to
- * be the foreground window.
- */
- OS.SetForegroundWindow (handle);
- }
- setVisible (true);
- if (!restoreFocus ()) {
- traverseGroup (true);
- }
-}
-
-void releaseShells () {
- Shell [] shells = getShells ();
- for (int i=0; i<shells.length; i++) {
- Shell shell = shells [i];
- if (!shell.isDisposed ()) {
- shell.releaseWidget ();
- shell.releaseHandle ();
- }
- }
-}
-
-void releaseWidget () {
- releaseShells ();
- super.releaseWidget ();
- activeMenu = null;
- display.clearModal (this);
- display = null;
- if (lpstrTip != 0) {
- int hHeap = OS.GetProcessHeap ();
- OS.HeapFree (hHeap, 0, lpstrTip);
- }
- lpstrTip = 0;
- toolTipHandle = 0;
- if (brushes != null) {
- for (int i=0; i<brushes.length; i++) {
- int hBrush = brushes [i];
- if (hBrush != 0) OS.DeleteObject (hBrush);
- }
- }
- brushes = null;
- if (OS.IsDBLocale) {
- if (hIMC != 0) OS.ImmDestroyContext (hIMC);
- }
- lastActive = null;
-}
-
-void remove (Menu menu) {
- super.remove (menu);
- if (menu == activeMenu) activeMenu = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when operations are performed on the receiver.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ShellListener
- * @see #addShellListener
- */
-public void removeShellListener (ShellListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Close, listener);
- eventTable.unhook (SWT.Iconify,listener);
- eventTable.unhook (SWT.Deiconify,listener);
- eventTable.unhook (SWT.Activate, listener);
- eventTable.unhook (SWT.Deactivate, listener);
-}
-
-LRESULT selectPalette (int hPalette) {
- int hDC = OS.GetDC (handle);
- int hOld = OS.SelectPalette (hDC, hPalette, false);
- int result = OS.RealizePalette (hDC);
- if (result > 0) {
- OS.InvalidateRect (handle, null, true);
- } else {
- OS.SelectPalette (hDC, hOld, true);
- OS.RealizePalette (hDC);
- }
- OS.ReleaseDC (handle, hDC);
- return (result > 0) ? LRESULT.ONE : LRESULT.ZERO;
-}
-
-void setActiveControl (Control control) {
- if (control != null && control.isDisposed ()) control = null;
- if (lastActive != null && lastActive.isDisposed ()) lastActive = null;
- if (lastActive == control) return;
-
- /*
- * Compute the list of controls to be activated and
- * deactivated by finding the first common parent
- * control.
- */
- Control [] activate = (control == null) ? new Control[0] : control.getPath ();
- Control [] deactivate = (lastActive == null) ? new Control[0] : lastActive.getPath ();
- lastActive = control;
- int index = 0, length = Math.min (activate.length, deactivate.length);
- while (index < length) {
- if (activate [index] != deactivate [index]) break;
- index++;
- }
-
- /*
- * It is possible (but unlikely), that application
- * code could have destroyed some of the widgets. If
- * this happens, keep processing those widgets that
- * are not disposed.
- */
- for (int i=deactivate.length-1; i>=index; --i) {
- if (!deactivate [i].isDisposed ()) {
- deactivate [i].sendEvent (SWT.Deactivate);
- }
- }
- for (int i=activate.length-1; i>=index; --i) {
- if (!activate [i].isDisposed ()) {
- activate [i].sendEvent (SWT.Activate);
- }
- }
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- if (OS.IsWinCE) {
- swFlags = OS.SW_RESTORE;
- if ((style & SWT.NO_TRIM) == 0) {
- /* insert caption when no longer maximized */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.WS_CAPTION) != OS.WS_CAPTION) {
- bits |= OS.WS_CAPTION;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
- }
- }
- } else {
- if (OS.IsIconic (handle) || OS.IsZoomed (handle)) {
- super.setBounds (x, y, width, height, flags);
- return;
- }
- }
- flags |= OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- OS.SetWindowPos (handle, 0, x, y, width, height, flags);
-}
-
-public void setEnabled (boolean enabled) {
- checkWidget ();
- if (!display.TrimEnabled) {
- super.setEnabled (enabled);
- } else {
- state &= ~DISABLED;
- if (!enabled) state |= DISABLED;
- if (isActive ()) setItemEnabled (OS.SC_CLOSE, enabled);
- }
-}
-
-/**
- * Sets the input method editor mode to the argument which
- * should be the result of bitwise OR'ing together one or more
- * of the following constants defined in class <code>SWT</code>:
- * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
- * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
- *
- * @param mode the new IME mode
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SWT
- */
-public void setImeInputMode (int mode) {
- checkWidget ();
- if (!OS.IsDBLocale) return;
- boolean imeOn = mode != SWT.NONE && mode != SWT.ROMAN;
- int hIMC = OS.ImmGetContext (handle);
- OS.ImmSetOpenStatus (hIMC, imeOn);
- if (imeOn) {
- int [] lpfdwConversion = new int [1], lpfdwSentence = new int [1];
- if (OS.ImmGetConversionStatus (hIMC, lpfdwConversion, lpfdwSentence)) {
- int newBits = 0;
- int oldBits = OS.IME_CMODE_NATIVE | OS.IME_CMODE_KATAKANA;
- if ((mode & SWT.PHONETIC) != 0) {
- newBits = OS.IME_CMODE_KATAKANA | OS.IME_CMODE_NATIVE;
- oldBits = 0;
- } else {
- if ((mode & SWT.NATIVE) != 0) {
- newBits = OS.IME_CMODE_NATIVE;
- oldBits = OS.IME_CMODE_KATAKANA;
- }
- }
- if ((mode & SWT.DBCS) != 0) {
- newBits |= OS.IME_CMODE_FULLSHAPE;
- } else {
- oldBits |= OS.IME_CMODE_FULLSHAPE;
- }
- if ((mode & SWT.ROMAN) != 0) {
- newBits |= OS.IME_CMODE_ROMAN;
- } else {
- oldBits |= OS.IME_CMODE_ROMAN;
- }
- lpfdwConversion [0] |= newBits; lpfdwConversion [0] &= ~oldBits;
- OS.ImmSetConversionStatus (hIMC, lpfdwConversion [0], lpfdwSentence [0]);
- }
- }
- OS.ImmReleaseContext (handle, hIMC);
-}
-
-void setItemEnabled (int cmd, boolean enabled) {
- int hMenu = OS.GetSystemMenu (handle, false);
- if (hMenu == 0) return;
- int flags = OS.MF_ENABLED;
- if (!enabled) flags = OS.MF_DISABLED | OS.MF_GRAYED;
- OS.EnableMenuItem (hMenu, cmd, OS.MF_BYCOMMAND | flags);
-}
-
-void setParent () {
- /* Do nothing. Not necessary for Shells */
-}
-
-void setToolTipText (int hwnd, String text) {
- if (OS.IsWinCE) return;
- if (toolTipHandle == 0) {
-
- /*
- * On Windows 98 and NT, setting a window to be the
- * top most window using HWND_TOPMOST can result in a
- * parent dialog shell being moved behind its parent
- * if the dialog has a sibling that is currently on top
- * This only occurs using SetWindowPos (), not when the
- * handle is created.
- */
- /*
- * The following code is intentionally commented.
- */
-// display.lockActiveWindow = true;
- toolTipHandle = OS.CreateWindowEx (
- OS.WS_EX_TOPMOST,
- new TCHAR (0, OS.TOOLTIPS_CLASS, true),
- null,
- OS.TTS_ALWAYSTIP,
- OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
- handle,
- 0,
- OS.GetModuleHandle (null),
- null);
- /*
- * The following code is intentionally commented.
- */
-// display.lockActiveWindow = false;
- if (toolTipHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- /*
- * Feature in Windows. Despite the fact that the
- * tool tip text contains \r\n, the tooltip will
- * not honour the new line unless TTM_SETMAXTIPWIDTH
- * is set. The fix is to set TTM_SETMAXTIPWIDTH to
- * a large value.
- */
- OS.SendMessage (toolTipHandle, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
- }
- TOOLINFO lpti = new TOOLINFO ();
- lpti.cbSize = TOOLINFO.sizeof;
- lpti.uId = hwnd;
- lpti.hwnd = handle;
- if (text == null) {
- OS.SendMessage (toolTipHandle, OS.TTM_DELTOOL, 0, lpti);
- } else {
- lpti.uFlags = OS.TTF_IDISHWND | OS.TTF_SUBCLASS;
- lpti.lpszText = OS.LPSTR_TEXTCALLBACK;
- OS.SendMessage (toolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
- }
- OS.SendMessage (toolTipHandle, OS.TTM_UPDATE, 0, 0);
-}
-
-void setToolTipText (NMTTDISPINFO lpnmtdi, TCHAR buffer) {
- /*
- * Ensure that the current position of the mouse
- * is inside the client area of the shell. This
- * prevents tool tips from popping up over the
- * shell trimmings.
- */
- if (!hasCursor ()) return;
- int hHeap = OS.GetProcessHeap ();
- if (lpstrTip != 0) OS.HeapFree (hHeap, 0, lpstrTip);
- int byteCount = buffer.length () * TCHAR.sizeof;
- lpstrTip = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpstrTip, buffer, byteCount);
- lpnmtdi.lpszText = lpstrTip;
-}
-
-void setToolTipText (NMTTDISPINFO lpnmtdi, char [] buffer) {
- /*
- * Ensure that the current position of the mouse
- * is inside the client area of the shell. This
- * prevents tool tips from popping up over the
- * shell trimmings.
- */
- if (!hasCursor ()) return;
- int hHeap = OS.GetProcessHeap ();
- if (lpstrTip != 0) OS.HeapFree (hHeap, 0, lpstrTip);
- int byteCount = buffer.length * 2;
- lpstrTip = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpstrTip, buffer, byteCount);
- lpnmtdi.lpszText = lpstrTip;
-}
-
-public void setVisible (boolean visible) {
- checkWidget ();
- super.setVisible (visible);
- if (showWithParent == visible) return;
- showWithParent = visible;
- if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, visible);
- int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
- if ((style & mask) != 0) {
- if (visible) {
- display.setModal (this);
- Control control = display.getFocusControl ();
- if (control != null && !control.isActive ()) bringToTop ();
- OS.ReleaseCapture ();
- } else {
- display.clearModal (this);
- }
- }
-}
-
-void updateModal () {
- if (!display.TrimEnabled) return;
- setItemEnabled (OS.SC_CLOSE, isActive ());
-}
-
-int widgetExtStyle () {
- int bits = super.widgetExtStyle ();
- if ((style & SWT.ON_TOP) != 0) bits |= OS.WS_EX_TOPMOST;
- return bits;
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () & ~OS.WS_POPUP;
- if (handle != 0) return bits | OS.WS_CHILD;
- bits &= ~OS.WS_CHILD;
- /*
- * Feature in WinCE. Calling CreateWindowEx () with WS_OVERLAPPED
- * and a parent window causes the new window to become a WS_CHILD of
- * the parent instead of a dialog child. The fix is to use WS_POPUP
- * instead.
- *
- * NOTE: WS_POPUP causes CreateWindowEx () to ignore CW_USEDEFAULT
- * and causes the default window location and size to be zero.
- */
- if (OS.IsWinCE) return bits | OS.WS_POPUP;
-
- /*
- * Use WS_OVERLAPPED for all windows, either dialog or top level
- * so that CreateWindowEx () will respect CW_USEDEFAULT and set
- * the default window location and size.
- *
- * NOTE: When a WS_OVERLAPPED window is created, Windows gives
- * the new window WS_CAPTION style bits. These two constants are
- * as follows:
- *
- * WS_OVERLAPPED = 0
- * WS_CAPTION = WS_BORDER | WS_DLGFRAME
- *
- */
- return bits | OS.WS_OVERLAPPED | OS.WS_CAPTION;
-}
-
-LRESULT WM_ACTIVATE (int wParam, int lParam) {
- if (OS.IsWinCE) {
- /*
- * Note: this does not work when we get WM_ACTIVATE prior
- * to adding a listener.
- */
- if (hooks (SWT.HardKeyDown) || hooks (SWT.HardKeyUp)) {
- int fActive = wParam & 0xFFFF;
- int hwnd = fActive != 0 ? handle : 0;
- for (int bVk=OS.VK_APP1; bVk<=OS.VK_APP6; bVk++) {
- OS.SHSetAppKeyWndAssoc ((byte) bVk, hwnd);
- }
- }
- }
- return super.WM_ACTIVATE (wParam, lParam);
-}
-
-LRESULT WM_CLOSE (int wParam, int lParam) {
- if ((display.TrimEnabled && !isEnabled ()) || !isActive ()) {
- return LRESULT.ZERO;
- }
- return super.WM_CLOSE (wParam, lParam);
-}
-
-LRESULT WM_COMMAND (int wParam, int lParam) {
- if (OS.IsWinCE) {
- /*
- * Note in WinCE PPC: close the Shell when the "Done Button" has
- * been pressed.
- */
- int loWord = wParam & 0xFFFF;
- if (loWord == OS.IDOK) {
- OS.PostMessage (handle, OS.WM_CLOSE, 0, 0);
- return LRESULT.ZERO;
- }
- /*
- * Note in WinCE PPC. menu events originate from the
- * command bar.
- */
- if (hwndCB != 0 && lParam == hwndCB) {
- return super.WM_COMMAND (wParam, 0);
- }
- }
- return super.WM_COMMAND (wParam, lParam);
-}
-
-LRESULT WM_DESTROY (int wParam, int lParam) {
- LRESULT result = super.WM_DESTROY (wParam, lParam);
- /*
- * When the shell is a WS_CHILD window of a non-SWT
- * window, the destroy code does not get called because
- * the non-SWT window does not call dispose (). Instead,
- * the destroy code is called here in WM_DESTROY.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.WS_CHILD) != 0) {
- releaseChild ();
- releaseWidget ();
- }
- return result;
-}
-
-LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
- LRESULT result = super.WM_MOUSEACTIVATE (wParam, lParam);
- if (result != null) return result;
- int hittest = lParam & 0xFFFF;
- if (hittest == OS.HTMENU) return null;
- /*
- * Get the current location of the cursor,
- * not the location of the cursor when the
- * WM_MOUSEACTIVATE was generated. This is
- * strictly incorrect but is necessary in
- * order to support Activate and Deactivate
- * events for embedded widgets that have
- * their own event loop. In that case, the
- * cursor location reported by GetMessagePos
- * is the one for our event loop, not the
- * embedded widget's event loop.
- */
- POINT pt = new POINT ();
- if (!OS.GetCursorPos (pt)) {
- int pos = OS.GetMessagePos ();
- pt.x = (short) (pos & 0xFFFF);
- pt.y = (short) (pos >> 16);
- }
- int hwnd = OS.WindowFromPoint (pt);
- if (hwnd == 0) return null;
- Control control = display.findControl (hwnd);
- setActiveControl (control);
- // widget could be disposed at this point
- if (isDisposed ()) return null;
- if (control == null || control.isDisposed ()) return null;
- Button button = null;
- boolean setDefault = false;
- if (OS.GetActiveWindow () == handle && this == control.getShell ()) {
- if ((hittest != OS.HTHSCROLL) && (hittest != OS.HTVSCROLL)) {
- int hwndChild = control.handle;
- int code = OS.SendMessage (hwndChild, OS.WM_GETDLGCODE, 0, 0);
- setDefault = (code & OS.DLGC_STATIC) == 0;
- if (setDefault && control instanceof Button) {
- if (((button = (Button) control).style & SWT.PUSH) == 0) {
- button = null;
- }
- }
- }
- }
- if (setDefault) setDefaultButton (button, false);
- /*
- * This code is intentionally commented. On some platforms,
- * shells that are created with SWT.NO_TRIM won't take focus
- * when the user clicks in the client area or on the border.
- * This behavior is usedful when emulating tool tip shells
- * Until this behavior is specified, this code will remain
- * commented.
- */
-// if ((style & SWT.NO_TRIM) != 0) {
-// if (hittest == OS.HTBORDER || hittest == OS.HTCLIENT) {
-// return new LRESULT (OS.MA_NOACTIVATE);
-// }
-// }
- return null;
-}
-
-LRESULT WM_NCHITTEST (int wParam, int lParam) {
- if (!isEnabled () || !isActive ()) {
- if (!display.TrimEnabled) return new LRESULT(OS.HTNOWHERE);
- int hittest = callWindowProc (OS.WM_NCHITTEST, wParam, lParam);
- if (hittest == OS.HTCLIENT || hittest == OS.HTMENU) hittest = OS.HTBORDER;
- return new LRESULT (hittest);
- }
- if (menuBar != null && !menuBar.getEnabled ()) {
- int hittest = callWindowProc (OS.WM_NCHITTEST, wParam, lParam);
- if (hittest == OS.HTMENU) hittest = OS.HTBORDER;
- return new LRESULT (hittest);
- }
- return null;
-}
-
-LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
- if (wParam != handle) {
- int hPalette = display.hPalette;
- if (hPalette != 0) return selectPalette (hPalette);
- }
- return super.WM_PALETTECHANGED (wParam, lParam);
-}
-
-LRESULT WM_QUERYNEWPALETTE (int wParam, int lParam) {
- int hPalette = display.hPalette;
- if (hPalette != 0) return selectPalette (hPalette);
- return super.WM_QUERYNEWPALETTE (wParam, lParam);
-}
-
-LRESULT WM_SETCURSOR (int wParam, int lParam) {
- /*
- * Feature in Windows. When the shell is disabled
- * by a Windows standard dialog (like a MessageBox
- * or FileDialog), clicking in the shell does not
- * bring the shell or the dialog to the front. The
- * fix is to detect this case and bring the shell
- * forward.
- */
- int msg = lParam >> 16;
- if (msg == OS.WM_LBUTTONDOWN) {
- if (!display.TrimEnabled) {
- Shell modalShell = display.getModalShell ();
- if (modalShell != null && !isActive ()) {
- OS.SetActiveWindow (modalShell.handle);
- }
- }
- if (!OS.IsWindowEnabled (handle)) {
- if (!OS.IsWinCE) {
- int hwndPopup = OS.GetLastActivePopup (handle);
- if (hwndPopup != 0 && hwndPopup != handle) {
- if (WidgetTable.get (hwndPopup) == null) {
- OS.SetActiveWindow (hwndPopup);
- }
- }
- }
- }
- }
- return super.WM_SETCURSOR (wParam, lParam);
-}
-
-LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
- LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
- if (result != null) return result;
- /*
- * Bug in Windows. If the shell is hidden while the parent
- * is iconic, Windows shows the shell when the parent is
- * deiconified. This does not happen if the shell is hidden
- * while the parent is not an icon. The fix is to track
- * visible state for the shell and refuse to show the shell
- * when the parent is shown.
- */
- if (lParam == OS.SW_PARENTOPENING) {
- Control control = this;
- while (control != null) {
- Shell shell = control.getShell ();
- if (!shell.showWithParent) return LRESULT.ZERO;
- control = control.parent;
- }
- }
- return result;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
deleted file mode 100755
index 0f8985a261..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
+++ /dev/null
@@ -1,796 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * <p>
- * At any given moment, a given slider will have a
- * single <em>selection</em> that is considered to be its
- * value, which is constrained to be within the range of
- * values the slider represents (that is, between its
- * <em>minimum</em> and <em>maximum</em> values).
- * </p><p>
- * Typically, sliders will be made up of five areas:
- * <ol>
- * <li>an arrow button for decrementing the value</li>
- * <li>a page decrement area for decrementing the value by a larger amount</li>
- * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
- * <li>a page increment area for incrementing the value by a larger amount</li>
- * <li>an arrow button for incrementing the value</li>
- * </ol>
- * Based on their style, sliders are either <code>HORIZONTAL</code>
- * (which have left and right facing buttons for incrementing and
- * decrementing the value) or <code>VERTICAL</code> (which have
- * up and down facing buttons for incrementing and decrementing
- * the value).
- * </p><p>
- * On some platforms, the size of the slider's thumb can be
- * varied relative to the magnitude of the range of values it
- * represents (that is, relative to the difference between its
- * maximum and minimum values). Typically, this is used to
- * indicate some proportional value such as the ratio of the
- * visible area of a document to the total amount of space that
- * it would take to display it. SWT supports setting the thumb
- * size even if the underlying platform does not, but in this
- * case the appearance of the slider will not change.
- * </p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * @see ScrollBar
- */
-public class Slider extends Control {
- int increment, pageIncrement;
- static final int ScrollBarProc;
- static final TCHAR ScrollBarClass = new TCHAR (0, "SCROLLBAR", true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ScrollBarClass, lpWndClass);
- ScrollBarProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Slider (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's value changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
- * <code>0</code> - for the end of a drag.
- * <code>SWT.DRAG</code>.
- * <code>SWT.HOME</code>.
- * <code>SWT.END</code>.
- * <code>SWT.ARROW_DOWN</code>.
- * <code>SWT.ARROW_UP</code>.
- * <code>SWT.PAGE_DOWN</code>.
- * <code>SWT.PAGE_UP</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (ScrollBarProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
- if ((style & SWT.HORIZONTAL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXHSCROLL) * 10;
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- } else {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- height += OS.GetSystemMetrics (OS.SM_CYVSCROLL) * 10;
- }
- if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
- if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
- return new Point (width, height);
-}
-
-void createWidget () {
- super.createWidget ();
- increment = 1;
- pageIncrement = 10;
- /*
- * Set the intial values of the maximum
- * to 100 and the thumb to 10. Note that
- * info.nPage needs to be 11 in order to
- * get a thumb that is 10.
- */
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_ALL;
- info.nMax = 100;
- info.nPage = 11;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_SCROLLBAR);
-}
-
-int defaultForeground () {
- return OS.GetSysColor (OS.COLOR_BTNFACE);
-}
-
-public boolean getEnabled () {
- checkWidget ();
- return (state & DISABLED) == 0;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed.
- *
- * @return the increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getIncrement () {
- checkWidget ();
- return increment;
-}
-
-/**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMaximum () {
- checkWidget ();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- return info.nMax;
-}
-
-/**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getMinimum () {
- checkWidget ();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- return info.nMin;
-}
-
-/**
- * Returns the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected.
- *
- * @return the page increment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getPageIncrement () {
- checkWidget ();
- return pageIncrement;
-}
-
-/**
- * Returns the single <em>selection</em> that is the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelection () {
- checkWidget ();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- return info.nPos;
-}
-
-/**
- * Returns the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values.
- *
- * @return the thumb value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getThumb () {
- checkWidget ();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_PAGE;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- if (info.nPage != 0) --info.nPage;
- return info.nPage;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's value changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-void setBounds (int x, int y, int width, int height, int flags) {
- super.setBounds (x, y, width, height, flags);
- /*
- * Bug in Windows. If the scroll bar is resized when it has focus,
- * the flashing cursor that is used to show that the scroll bar has
- * focus is not moved. The fix is to post a fake WM_SETFOCUS to
- * get the scroll bar to recompute the size of the flashing cursor.
- */
- if (OS.GetFocus () == handle) {
- OS.PostMessage (handle, OS.WM_SETFOCUS, 0, 0);
- }
-}
-
-public void setEnabled (boolean enabled) {
- checkWidget ();
- if (OS.IsWinCE) {
- super.setEnabled (enabled);
- } else {
- int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
- OS.EnableScrollBar (handle, OS.SB_CTL, flags);
- }
- state &= ~DISABLED;
- if (!enabled) state |= DISABLED;
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- *
- * @param value the new increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- increment = value;
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new maximum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMaximum (int value) {
- checkWidget ();
- if (value < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- if (value - info.nMin - info.nPage < 1) return;
- info.nMax = value;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, (state & DISABLED) == 0);
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- if (OS.IsWinCE) {
- OS.EnableWindow (handle, false);
- } else {
- OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
- }
- }
-
- /*
- * Bug in Windows. If the thumb is resized when it has focus,
- * the flashing cursor that is used to show that the scroll bar has
- * focus is not moved. The fix is to post a fake WM_SETFOCUS to
- * get the scroll bar to recompute the size of the flashing cursor.
- */
- if (OS.GetFocus () == handle) {
- OS.PostMessage (handle, OS.WM_SETFOCUS, 0, 0);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- *
- * @param value the new minimum (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setMinimum (int value) {
- checkWidget ();
- if (value < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- if (info.nMax - value - info.nPage < 1) return;
- info.nMin = value;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- if (OS.IsWinCE) {
- OS.EnableWindow (handle, false);
- } else {
- OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
- }
- }
-
- /*
- * Bug in Windows. If the thumb is resized when it has focus,
- * the flashing cursor that is used to show that the scroll bar has
- * focus is not moved. The fix is to post a fake WM_SETFOCUS to
- * get the scroll bar to recompute the size of the flashing cursor.
- */
- if (OS.GetFocus () == handle) {
- OS.PostMessage (handle, OS.WM_SETFOCUS, 0, 0);
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- *
- * @return the page increment (must be greater than zero)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setPageIncrement (int value) {
- checkWidget ();
- if (value < 1) return;
- pageIncrement = value;
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int value) {
- checkWidget ();
- if (value < 0) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS;
- info.nPos = value;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- *
- * @param value the new thumb value (must be at least one)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ScrollBar
- */
-public void setThumb (int value) {
- checkWidget ();
-
- /* Position the thumb */
- if (value < 1) return;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_PAGE | OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- if (info.nMax - info.nMin - value < 0) return;
- info.nPage = value;
- if (info.nPage != 0) info.nPage++;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- if (OS.IsWinCE) {
- OS.EnableWindow (handle, false);
- } else {
- OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
- }
- }
-
- /*
- * Bug in Windows. If the thumb is resized when it has focus,
- * the flashing cursor that is used to show that the scroll bar has
- * focus is not moved. The fix is to post a fake WM_SETFOCUS to
- * get the scroll bar to recompute the size of the flashing cursor.
- */
- if (OS.GetFocus () == handle) {
- OS.PostMessage (handle, OS.WM_SETFOCUS, 0, 0);
- }
-}
-
-/**
- * Sets the receiver's selection, minimum value, maximum
- * value, thumb, increment and page increment all at once.
- * <p>
- * Note: This is equivalent to setting the values individually
- * using the appropriate methods, but may be implemented in a
- * more efficient fashion on some platforms.
- * </p>
- *
- * @param selection the new selection value
- * @param minimum the new minimum value
- * @param maximum the new maximum value
- * @param thumb the new thumb value
- * @param increment the new increment value
- * @param pageIncrement the new pageIncrement value
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
- checkWidget ();
- if (selection < 0) return;
- if (minimum < 0) return;
- if (maximum < 0) return;
- if (thumb < 1) return;
- if (maximum - minimum - thumb < 0) return;
- if (increment < 1) return;
- if (pageIncrement < 1) return;
- this.increment = increment;
- this.pageIncrement = pageIncrement;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS | OS.SIF_PAGE | OS.SIF_RANGE | OS.SIF_DISABLENOSCROLL;
- info.nPos = selection;
- info.nMin = minimum;
- info.nMax = maximum;
- info.nPage = thumb;
- if (info.nPage != 0) info.nPage++;
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-
- /*
- * Feature in Windows. Using SIF_DISABLENOSCROLL,
- * SetScrollInfo () can change enabled and disabled
- * state of the scroll bar causing a scroll bar that
- * was disabled by the application to become enabled.
- * The fix is to disable the scroll bar (again) when
- * the application has disabled the scroll bar.
- */
- if ((state & DISABLED) != 0) {
- if (OS.IsWinCE) {
- OS.EnableWindow (handle, false);
- } else {
- OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
- }
- }
-
- /*
- * Bug in Windows. If the thumb is resized when it has focus,
- * the flashing cursor that is used to show that the scroll bar has
- * focus is not moved. The fix is to post a fake WM_SETFOCUS to
- * get the scroll bar to recompute the size of the flashing cursor.
- */
- if (OS.GetFocus () == handle) {
- OS.PostMessage (handle, OS.WM_SETFOCUS, 0, 0);
- }
-}
-
-int widgetExtStyle () {
- /*
- * Bug in Windows. If a scroll bar control is given a border,
- * dragging the scroll bar thumb eats away parts of the border
- * while the thumb is dragged. The fix is to clear WS_BORDER
- * for all scroll bars.
- */
- int bits = super.widgetExtStyle ();
- if ((style & SWT.BORDER) != 0) bits &= ~OS.WS_EX_CLIENTEDGE;
- return bits;
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.WS_TABSTOP;
- /*
- * Bug in Windows. If a scroll bar control is given a border,
- * dragging the scroll bar thumb eats away parts of the border
- * while the thumb is dragged. The fix is to clear WS_BORDER.
- */
- if ((style & SWT.BORDER) != 0) bits &= ~OS.WS_BORDER;
- if ((style & SWT.HORIZONTAL) != 0) return bits | OS.SBS_HORZ;
- return bits | OS.SBS_VERT;
-}
-
-TCHAR windowClass () {
- return ScrollBarClass;
-}
-
-int windowProc () {
- return ScrollBarProc;
-}
-
-LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
-
- /*
- * Feature in Windows. For some reason, capturing
- * the mouse after processing WM_LBUTTONDBLCLK for the
- * widget interferes with the normal mouse processing
- * for the widget. The fix is to avoid the automatic
- * mouse capture.
- */
-
- /*
- * Feature in Windows. Windows uses the WS_TABSTOP
- * style for the scroll bar to decide that focus
- * should be set during WM_LBUTTONDBLCLK. This is
- * not the desired behavior. The fix is to clear
- * and restore WS_TABSTOP so that Windows will not
- * assign focus.
- */
-
- int hwndCapture = OS.GetCapture ();
- int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int newBits = oldBits & ~OS.WS_TABSTOP;
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- LRESULT result = super.WM_LBUTTONDBLCLK (wParam, lParam);
- OS.SetWindowLong (handle, OS.GWL_STYLE, oldBits);
- if (OS.GetCapture () != hwndCapture) OS.SetCapture (hwndCapture);
- return result;
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
-
- /*
- * Feature in Windows. For some reason, capturing
- * the mouse after processing WM_LBUTTONDOWN for the
- * widget interferes with the normal mouse processing
- * for the widget. The fix is to avoid the automatic
- * mouse capture.
- */
-
- /*
- * Feature in Windows. Windows uses the WS_TABSTOP
- * style for the scroll bar to decide that focus
- * should be set during WM_LBUTTONDOWN. This is
- * not the desired behavior. The fix is to clear
- * and restore WS_TABSTOP so that Windows will not
- * assign focus.
- */
-
- int hwndCapture = OS.GetCapture ();
- int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int newBits = oldBits & ~OS.WS_TABSTOP;
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
- OS.SetWindowLong (handle, OS.GWL_STYLE, oldBits);
- if (OS.GetCapture () != hwndCapture) OS.SetCapture (hwndCapture);
- return result;
-}
-
-LRESULT wmScrollChild (int wParam, int lParam) {
-
- /* Do nothing when scrolling is ending */
- int code = wParam & 0xFFFF;
- if (code == OS.SB_ENDSCROLL) return null;
-
- /* Move the thumb */
- Event event = new Event ();
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_TRACKPOS | OS.SIF_POS | OS.SIF_RANGE;
- OS.GetScrollInfo (handle, OS.SB_CTL, info);
- info.fMask = OS.SIF_POS;
- switch (code) {
- case OS.SB_THUMBPOSITION:
- /*
- * Do not set the detail field to DRAG to
- * indicate that the dragging has ended.
- */
- info.nPos = info.nTrackPos;
- break;
- case OS.SB_THUMBTRACK:
- event.detail = SWT.DRAG;
- info.nPos = info.nTrackPos;
- break;
- case OS.SB_TOP:
- event.detail = SWT.HOME;
- info.nPos = info.nMin;
- break;
- case OS.SB_BOTTOM:
- event.detail = SWT.END;
- info.nPos = info.nMax;
- break;
- case OS.SB_LINEDOWN:
- event.detail = SWT.ARROW_DOWN;
- info.nPos += increment;
- break;
- case OS.SB_LINEUP:
- event.detail = SWT.ARROW_UP;
- info.nPos = Math.max (info.nMin, info.nPos - increment);
- break;
- case OS.SB_PAGEDOWN:
- event.detail = SWT.PAGE_DOWN;
- info.nPos += pageIncrement;
- break;
- case OS.SB_PAGEUP:
- event.detail = SWT.PAGE_UP;
- info.nPos = Math.max (info.nMin, info.nPos - pageIncrement);
- break;
- }
- OS.SetScrollInfo (handle, OS.SB_CTL, info, true);
-
- /*
- * Send the event because WM_HSCROLL and
- * WM_VSCROLL are sent from a modal message
- * loop in Windows that is active when the
- * user is scrolling.
- */
- sendEvent (SWT.Selection, event);
- // the widget could be destroyed at this point
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
deleted file mode 100755
index 4097b6811e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
+++ /dev/null
@@ -1,775 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>TabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TabFolder extends Composite {
- TabItem [] items;
- ImageList imageList;
- static final int TabFolderProc;
- static final TCHAR TabFolderClass = new TCHAR (0, "SWT_" + OS.WC_TABCONTROL, true);
- static {
-
- /*
- * Feature in Windows. The tab control window class
- * uses the CS_HREDRAW and CS_VREDRAW style bits to
- * force a full redraw of the control and all children
- * when resized. This causes flashing. The fix is to
- * register a new window class without these bits and
- * implement special code that damages only the exposed
- * area.
- */
- WNDCLASS lpWndClass = new WNDCLASS ();
- TCHAR WC_TABCONTROL = new TCHAR (0, OS.WC_TABCONTROL, true);
- OS.GetClassInfo (0, WC_TABCONTROL, lpWndClass);
- TabFolderProc = lpWndClass.lpfnWndProc;
- int hInstance = OS.GetModuleHandle (null);
- if (!OS.GetClassInfo (hInstance, TabFolderClass, lpWndClass)) {
- int hHeap = OS.GetProcessHeap ();
- lpWndClass.hInstance = hInstance;
- lpWndClass.style &= ~(OS.CS_HREDRAW | OS.CS_VREDRAW);
- int byteCount = TabFolderClass.length () * TCHAR.sizeof;
- int lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpszClassName, TabFolderClass, byteCount);
- lpWndClass.lpszClassName = lpszClassName;
- OS.RegisterClass (lpWndClass);
-// OS.HeapFree (hHeap, 0, lpszClassName);
- }
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabFolder (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (TabFolderProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- RECT insetRect = new RECT (), itemRect = new RECT ();
- OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, insetRect);
- int width = insetRect.left - insetRect.right, height = 0;
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- if (count != 0) {
- OS.SendMessage (handle, OS.TCM_GETITEMRECT, count - 1, itemRect);
- width = Math.max (width, itemRect.right - insetRect.right);
- }
- Point size;
- if (layout != null) {
- size = layout.computeSize (this, wHint, hHint, changed);
- } else {
- size = minimumSize ();
- }
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- width = Math.max (width, size.x);
- height = Math.max (height, size.y);
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget ();
- RECT rect = new RECT ();
- OS.SetRect (rect, x, y, x + width, y + height);
- OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 1, rect);
- int border = getBorderWidth ();
- rect.left -= border; rect.right += border;
- rect.top -= border; rect.bottom += border;
- int newWidth = rect.right - rect.left;
- int newHeight = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, newWidth, newHeight);
-}
-
-void createItem (TabItem item, int index) {
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- if (count == items.length) {
- TabItem [] newItems = new TabItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- TCITEM tcItem = new TCITEM ();
- if (OS.SendMessage (handle, OS.TCM_INSERTITEM, index, tcItem) == -1) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- System.arraycopy (items, index, items, index + 1, count - index);
- items [index] = item;
-
- /*
- * Send a selection event when the item that is added becomes
- * the new selection. This only happens when the first item
- * is added.
- */
- if (count == 0) {
- Event event = new Event ();
- event.item = items [0];
- sendEvent (SWT.Selection, event);
- // the widget could be destroyed at this point
- }
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-
- /*
- * Feature in Windows. Despite the fact that the
- * tool tip text contains \r\n, the tooltip will
- * not honour the new line unless TTM_SETMAXTIPWIDTH
- * is set. The fix is to set TTM_SETMAXTIPWIDTH to
- * a large value.
- */
- int hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
- OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
-
- /*
- * Feature in Windows. When the tool tip control is
- * created, the parent of the tool tip is the shell.
- * If SetParent () is used to reparent the tab folder
- * into a new shell, the tool tip is not reparented
- * and pops up underneath the new shell. The fix is
- * to make sure the tool tip is a topmost window.
- */
- /*
- * Bug in Windows 98 and NT. Setting the tool tip to be the
- * top most window using HWND_TOPMOST can result in a parent
- * dialog shell being moved behind its parent if the dialog
- * has a sibling that is currently on top. The fix is to lock
- * the z-order of the active window.
- */
- Display display = getDisplay ();
- int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOSIZE;
- display.lockActiveWindow = true;
- OS.SetWindowPos (hwndToolTip, OS.HWND_TOPMOST, 0, 0, 0, 0, flags);
- display.lockActiveWindow = false;
-}
-
-void createWidget () {
- super.createWidget ();
- items = new TabItem [4];
-}
-
-void destroyItem (TabItem item) {
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- int index = 0;
- while (index < count) {
- if (items [index] == item) break;
- index++;
- }
- if (index == count) return;
- int selectionIndex = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (OS.SendMessage (handle, OS.TCM_DELETEITEM, index, 0) == 0) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- System.arraycopy (items, index + 1, items, index, --count - index);
- items [count] = null;
- if (count == 0) {
- if (imageList != null) {
- OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- items = new TabItem [4];
- }
- if (count > 0 && index == selectionIndex) {
- setSelection (Math.max (0, selectionIndex - 1));
- selectionIndex = getSelectionIndex ();
- if (selectionIndex != -1) {
- Event event = new Event ();
- event.item = items [selectionIndex];
- sendEvent (SWT.Selection, event);
- // the widget could be destroyed at this point
- }
- }
-}
-
-public Rectangle getClientArea () {
- checkWidget ();
- if (parent.hdwp != 0) {
- int oldHdwp = parent.hdwp;
- parent.hdwp = 0;
- OS.EndDeferWindowPos (oldHdwp);
- int count = parent.getChildrenCount ();
- parent.hdwp = OS.BeginDeferWindowPos (count);
- }
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem getItem (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
-}
-
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getItems () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- TabItem [] result = new TabItem [count];
- System.arraycopy (items, 0, result, 0, count);
- return result;
-}
-
-/**
- * Returns an array of <code>TabItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabItem [] getSelection () {
- checkWidget ();
- int index = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (index == -1) return new TabItem [0];
- return new TabItem [] {items [index]};
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
-}
-
-int imageIndex (Image image) {
- if (image == null) return OS.I_IMAGENONE;
- if (imageList == null) {
- Rectangle bounds = image.getBounds ();
- imageList = getDisplay ().getImageList (new Point (bounds.width, bounds.height));
- int index = imageList.indexOf (image);
- if (index == -1) index = imageList.add (image);
- int hImageList = imageList.getHandle ();
- OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, hImageList);
- return index;
- }
- int index = imageList.indexOf (image);
- if (index != -1) return index;
- return imageList.add (image);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TabItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-boolean mnemonicHit (char key) {
- for (int i=0; i<items.length; i++) {
- TabItem item = items [i];
- if (item != null) {
- char ch = findMnemonic (item.getText ());
- if (Character.toUpperCase (key) == Character.toUpperCase (ch)) {
- if (setFocus ()) {
- setSelection (i, true);
- return true;
- }
- }
- }
- }
- return false;
-}
-
-boolean mnemonicMatch (char key) {
- for (int i=0; i<items.length; i++) {
- TabItem item = items [i];
- if (item != null) {
- char ch = findMnemonic (item.getText ());
- if (Character.toUpperCase (key) == Character.toUpperCase (ch)) {
- return true;
- }
- }
- }
- return false;
-}
-
-void releaseWidget () {
- int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- TabItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
- }
- items = null;
- if (imageList != null) {
- OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- super.releaseWidget ();
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (TabItem [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (items.length == 0) {
- setSelection (-1);
- return;
- }
- for (int i=items.length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) setSelection (index);
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int index) {
- checkWidget ();
- setSelection (index, false);
-}
-
-void setSelection (int index, boolean notify) {
- int oldIndex = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (oldIndex != -1) {
- TabItem item = items [oldIndex];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setVisible (false);
- }
- }
- OS.SendMessage (handle, OS.TCM_SETCURSEL, index, 0);
- int newIndex = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (newIndex != -1) {
- TabItem item = items [newIndex];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
- control.setVisible (true);
- }
- if (notify) {
- Event event = new Event ();
- event.item = item;
- sendEvent (SWT.Selection, event);
- }
- }
-}
-
-int toolTipHandle () {
- return OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
-}
-
-String toolTipText (NMTTDISPINFO hdr) {
- if ((hdr.uFlags & OS.TTF_IDISHWND) != 0) {
- return null;
- }
- int index = hdr.idFrom;
- int hwndToolTip = toolTipHandle ();
- if (hwndToolTip == hdr.hwndFrom) {
- if (0 <= index && index < items.length) {
- TabItem item = items [index];
- if (item != null) return item.toolTipText;
- }
- }
- return super.toolTipText (hdr);
-}
-
-boolean traversePage (boolean next) {
- int count = getItemCount ();
- if (count == 0) return false;
- int index = getSelectionIndex ();
- if (index == -1) {
- index = 0;
- } else {
- int offset = (next) ? 1 : -1;
- index = (index + offset + count) % count;
- }
- setSelection (index, true);
- return index == getSelectionIndex ();
-}
-
-int widgetStyle () {
- /*
- * Bug in Windows. Under certain circumstances,
- * when TCM_SETITEM is used to change the text
- * in a tab item, the tab folder draws on top
- * of the client area. The fix is ensure that
- * this cannot happen by setting WS_CLIPCHILDREN.
- */
- int bits = super.widgetStyle () | OS.WS_CLIPCHILDREN;
- if ((style & SWT.NO_FOCUS) != 0) bits |= OS.TCS_FOCUSNEVER;
- return bits | OS.TCS_TABS | OS.TCS_TOOLTIPS;
-}
-
-TCHAR windowClass () {
- return TabFolderClass;
-}
-
-int windowProc () {
- return TabFolderProc;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
- /*
- * Return DLGC_BUTTON so that mnemonics will be
- * processed without needing to press the ALT key
- * when the widget has focus.
- */
- if (result != null) return result;
- return new LRESULT (OS.DLGC_BUTTON);
-}
-
-LRESULT WM_NCHITTEST (int wParam, int lParam) {
- LRESULT result = super.WM_NCHITTEST (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. The tab control implements
- * WM_NCHITTEST to return HTCLIENT when the cursor
- * is inside the tab buttons. This causes mouse
- * events like WM_MOUSEMOVE to be delivered to the
- * parent. Also, tool tips for the tab control are
- * never invoked because tool tips rely on mouse
- * events to be delivered to the window that wants
- * to display the tool tip. The fix is to call the
- * default window proc that returns HTCLIENT when
- * the mouse is in the client area.
- */
- int hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
- return new LRESULT (hittest);
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning the result of the
- * WM_SIZE message.
- */
- if (isDisposed ()) return result;
- int index = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (index != -1) {
- TabItem item = items [index];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
- }
- }
- return result;
-}
-
-LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
- LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
- if (result != null) return result;
- if (!OS.IsWindowVisible (handle)) return result;
- WINDOWPOS lpwp = new WINDOWPOS ();
- OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
- if ((lpwp.flags & (OS.SWP_NOSIZE | OS.SWP_NOREDRAW)) != 0) {
- return result;
- }
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.TCS_MULTILINE) != 0) {
- OS.InvalidateRect (handle, null, true);
- return result;
- }
- RECT rect = new RECT ();
- OS.SetRect (rect, 0, 0, lpwp.cx, lpwp.cy);
- OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect);
- int newWidth = rect.right - rect.left;
- int newHeight = rect.bottom - rect.top;
- OS.GetClientRect (handle, rect);
- int oldWidth = rect.right - rect.left;
- int oldHeight = rect.bottom - rect.top;
- if ((newWidth == oldWidth) && (newHeight == oldHeight)) {
- return result;
- }
- RECT inset = new RECT ();
- OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, inset);
- int marginX = -inset.right, marginY = -inset.bottom;
- if (newWidth != oldWidth) {
- int left = oldWidth;
- if (newWidth < oldWidth) left = newWidth;
- OS.SetRect (rect, left - marginX, 0, newWidth, newHeight);
- OS.InvalidateRect (handle, rect, true);
- }
- if (newHeight != oldHeight) {
- int bottom = oldHeight;
- if (newHeight < oldHeight) bottom = newHeight;
- if (newWidth < oldWidth) oldWidth -= marginX;
- OS.SetRect (rect, 0, bottom - marginY, oldWidth, newHeight);
- OS.InvalidateRect (handle, rect, true);
- }
- return result;
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- int code = hdr.code;
- switch (code) {
- case OS.TCN_SELCHANGE:
- case OS.TCN_SELCHANGING:
- TabItem item = null;
- int index = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
- if (index != -1) item = items [index];
- if (item != null) {
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- if (code == OS.TCN_SELCHANGE) {
- control.setBounds (getClientArea ());
- }
- control.setVisible (code == OS.TCN_SELCHANGE);
- }
- }
- if (code == OS.TCN_SELCHANGE) {
- Event event = new Event ();
- event.item = item;
- postEvent (SWT.Selection, event);
- }
- }
- return super.wmNotifyChild (wParam, lParam);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
deleted file mode 100755
index 79ffad0792..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * corresponding to a tab for a page in a tab folder.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TabItem extends Item {
- TabFolder parent;
- Control control;
- String toolTipText;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>TabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TabItem (TabFolder parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns the control that is used to fill the client area of
- * the tab folder when the user selects the tab item. If no
- * control has been set, return <code>null</code>.
- * <p>
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-
-public Display getDisplay () {
- TabFolder parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-/**
- * Returns the receiver's parent, which must be a <code>TabFolder</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TabFolder getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-
-void releaseChild () {
- super.releaseChild ();
- int index = parent.indexOf (this);
- if (index == parent.getSelectionIndex ()) {
- if (control != null) control.setVisible (false);
- }
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- control = null;
- parent = null;
-}
-
-/**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- Control oldControl = this.control, newControl = control;
- this.control = control;
- int index = parent.indexOf (this);
- if (index != parent.getSelectionIndex ()) {
- if (newControl != null) newControl.setVisible (false);
- return;
- }
- if (newControl != null) {
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
- }
- if (oldControl != null) oldControl.setVisible (false);
-}
-
-public void setImage (Image image) {
- checkWidget();
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setImage (image);
- int hwnd = parent.handle;
- TCITEM tcItem = new TCITEM ();
- tcItem.mask = OS.TCIF_IMAGE;
- tcItem.iImage = parent.imageIndex (image);
- OS.SendMessage (hwnd, OS.TCM_SETITEM, index, tcItem);
-}
-
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setText (string);
- int hwnd = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- TCITEM tcItem = new TCITEM ();
- tcItem.mask = OS.TCIF_TEXT;
- tcItem.pszText = pszText;
- int result = OS.SendMessage (hwnd, OS.TCM_SETITEM, index, tcItem);
- OS.HeapFree (hHeap, 0, pszText);
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
deleted file mode 100755
index 4293f9a611..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ /dev/null
@@ -1,2371 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement a selectable user interface
- * object that displays a list of images and strings and issue
- * notificiation when selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TableItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Table extends Composite {
- TableItem [] items;
- TableColumn [] columns;
- ImageList imageList;
- boolean ignoreSelect, dragStarted, ignoreResize;
- static final int TableProc;
- static final TCHAR TableClass = new TCHAR (0, OS.WC_LISTVIEW, true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, TableClass, lpWndClass);
- TableProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Table (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * The item field of the event object is valid for default selection, but the detail field is not used.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (TableProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a table that does not have scroll bars. Therefore,
- * no matter what style bits are specified, set the
- * H_SCROLL and V_SCROLL bits so that the SWT style
- * will match the widget that Windows creates.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int bits = 0;
- if (wHint != SWT.DEFAULT) {
- bits |= wHint & 0xFFFF;
- } else {
- int width = 0;
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- width += OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, i, 0);
- }
- bits |= width & 0xFFFF;
- }
- if (hHint != SWT.DEFAULT) bits |= hHint << 16;
- int result = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, -1, bits);
- int width = result & 0xFFFF, height = result >> 16;
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2; height += border * 2;
- /*
- * Feature in Windows. For some reason, LVM_APPROXIMATEVIEWRECT
- * does not include the space for the vertical scroll bar but does
- * take into account the horizontal scroll bar when calculating the
- * space needed to show the items. The fix is to add in this space.
- */
- if ((style & SWT.V_SCROLL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- }
- if (((style & SWT.H_SCROLL) != 0) && (hHint != SWT.DEFAULT)) {
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- }
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-
- /*
- * This code is intentionally commented. According to
- * the documentation, setting the default item size is
- * supposed to improve performance. By experimentation,
- * this does not seem to have much of an effect.
- */
-// OS.SendMessage (handle, OS.LVM_SETITEMCOUNT, 1024 * 2, 0);
-
- /* Set the checkbox image list */
- if ((style & SWT.CHECK) != 0) setCheckboxImageList (true);
-
- /*
- * Feature in Windows. When the control is created,
- * it does not use the default system font. A new HFONT
- * is created and destroyed when the control is destroyed.
- * This means that a program that queries the font from
- * this control, uses the font in another control and then
- * destroys this control will have the font unexpectedly
- * destroyed in the other control. The fix is to assign
- * the font ourselves each time the control is created.
- * The control will not destroy a font that it did not
- * create.
- */
- int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
-
- /*
- * Bug in Windows. When the first column is inserted
- * without setting the header text, Windows will never
- * allow the header text for the first column to be set.
- * The fix is to set the text to an empty string when
- * the column is inserted.
- */
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_TEXT;
- int hHeap = OS.GetProcessHeap ();
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
- lvColumn.pszText = pszText;
- OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 0, lvColumn);
- OS.HeapFree (hHeap, 0, pszText);
-
- /* Set the extended style bits */
- int bits = OS.LVS_EX_SUBITEMIMAGES | OS.LVS_EX_LABELTIP;
- if ((style & SWT.FULL_SELECTION) != 0) bits |= OS.LVS_EX_FULLROWSELECT;
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
-}
-
-void createItem (TableColumn column, int index) {
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) count = 0;
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- if (count == columns.length) {
- TableColumn [] newColumns = new TableColumn [columns.length + 4];
- System.arraycopy (columns, 0, newColumns, 0, columns.length);
- columns = newColumns;
- }
- /*
- * Insert the column into the columns array before inserting
- * it into the widget so that the column will be present when
- * any callbacks are issued as a result of LVM_INSERTCOLUMN
- * or LVM_SETCOLUMN.
- */
- System.arraycopy (columns, index, columns, index + 1, count - index);
- columns [index] = column;
- if (index == 0) {
- if (count > 0) {
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_WIDTH;
- OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 1, lvColumn);
- OS.SendMessage (handle, OS.LVM_GETCOLUMN, 1, lvColumn);
- int width = lvColumn.cx;
- int cchTextMax = 1024;
- int hHeap = OS.GetProcessHeap ();
- int byteCount = cchTextMax * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_TEXT | OS.LVIF_IMAGE | OS.LVIF_STATE;
- int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<itemCount; i++) {
- lvItem.iItem = i;
- lvItem.iSubItem = 0;
- lvItem.pszText = pszText;
- lvItem.cchTextMax = cchTextMax;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- lvItem.iSubItem = 1;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- lvItem.iSubItem = 0;
- lvItem.pszText = lvItem.cchTextMax = 0;
- lvItem.iImage = OS.I_IMAGENONE;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- }
- lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_IMAGE | OS.LVCF_WIDTH | OS.LVCF_FMT;
- lvColumn.pszText = pszText;
- lvColumn.cchTextMax = cchTextMax;
- OS.SendMessage (handle, OS.LVM_GETCOLUMN, 0, lvColumn);
- OS.SendMessage (handle, OS.LVM_SETCOLUMN, 1, lvColumn);
- lvColumn.fmt = OS.LVCFMT_IMAGE;
- lvColumn.cx = width;
- lvColumn.iImage = OS.I_IMAGENONE;
- lvColumn.pszText = lvColumn.cchTextMax = 0;
- OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
- lvColumn.mask = OS.LVCF_FMT;
- lvColumn.fmt = OS.LVCFMT_LEFT;
- OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- }
- } else {
- int fmt = OS.LVCFMT_LEFT;
- if ((column.style & SWT.CENTER) == SWT.CENTER) fmt = OS.LVCFMT_CENTER;
- if ((column.style & SWT.RIGHT) == SWT.RIGHT) fmt = OS.LVCFMT_RIGHT;
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_WIDTH | OS.LVCF_FMT;
- lvColumn.fmt = fmt;
- OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, index, lvColumn);
- }
-}
-
-void createItem (TableItem item, int index) {
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- if (count == items.length) {
- TableItem [] newItems = new TableItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- LVITEM lvItem = new LVITEM ();
- lvItem.iItem = index;
-
- /*
- * Bug in Windows. Despite the fact that the image list
- * index has never been set for the item, Windows always
- * assumes that the image index for the item is valid.
- * When an item is inserted, the image index is zero.
- * Therefore, when the first image is inserted and is
- * assigned image index zero, every item draws with this
- * image. The fix is to set the image index to none when
- * the image is created.
- */
- lvItem.iImage = OS.I_IMAGENONE;
- lvItem.mask = OS.LVIF_IMAGE;
-
- /* Set the initial unchecked state */
- if ((style & SWT.CHECK) != 0) {
- lvItem.mask = lvItem.mask | OS.TVIF_STATE;
- lvItem.state = 1 << 12;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- }
-
- /* Insert the item */
- ignoreSelect = true;
- int result = OS.SendMessage (handle, OS.LVM_INSERTITEM, 0, lvItem);
- ignoreSelect = false;
- if (result == -1) error (SWT.ERROR_ITEM_NOT_ADDED);
- System.arraycopy (items, index, items, index + 1, count - index);
- items [index] = item;
-}
-
-ScrollBar createScrollBar (int type) {
- return new ScrollBar (this, type);
-}
-
-void createWidget () {
- super.createWidget ();
- items = new TableItem [4];
- columns = new TableColumn [4];
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_WINDOW);
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to deselect
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- for (int i=0; i<indices.length; i++) {
- lvItem.iItem = indices [i];
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
- }
-}
-
-/**
- * Deselects the item at the given zero-relative index in the receiver.
- * If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- lvItem.iItem = index;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
-}
-
-/**
- * Deselects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is selected, it is deselected. If the item at the index
- * was not selected, it remains deselected. The range of the
- * indices is inclusive. Indices that are out of range are ignored.
- *
- * @param start the start index of the items to deselect
- * @param end the end index of the items to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int start, int end) {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- for (int i=start; i<=end; i++) {
- lvItem.iItem = i;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
- }
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, lvItem);
-}
-
-void destroyItem (TableColumn column) {
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- int index = 0;
- while (index < count) {
- if (columns [index] == column) break;
- index++;
- }
- if (index == count) return;
- boolean first = false;
- if (index == 0) {
- first = true;
- if (count > 1) {
- index = 1;
- int cchTextMax = 1024;
- int hHeap = OS.GetProcessHeap ();
- int byteCount = cchTextMax * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_WIDTH;
- lvColumn.pszText = pszText;
- lvColumn.cchTextMax = cchTextMax;
- OS.SendMessage (handle, OS.LVM_GETCOLUMN, 1, lvColumn);
- lvColumn.mask |= OS.LVCF_FMT;
- lvColumn.fmt = OS.LVCFMT_LEFT;
- OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_TEXT | OS.LVIF_IMAGE | OS.LVIF_STATE;
- lvItem.pszText = pszText;
- lvItem.cchTextMax = cchTextMax;
- int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<itemCount; i++) {
- lvItem.iItem = i;
- lvItem.iSubItem = 1;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- lvItem.iSubItem = 0;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- }
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- } else {
- int hHeap = OS.GetProcessHeap ();
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_TEXT;
- lvColumn.pszText = pszText;
- OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, OS.LVSCW_AUTOSIZE);
- }
- }
- if (count > 1) {
- if (OS.SendMessage (handle, OS.LVM_DELETECOLUMN, index, 0) == 0) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- }
- if (first) index = 0;
- System.arraycopy (columns, index + 1, columns, index, --count - index);
- columns [count] = null;
-}
-
-void destroyItem (TableItem item) {
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- int index = 0;
- while (index < count) {
- if (items [index] == item) break;
- index++;
- }
- if (index == count) return;
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
- ignoreSelect = false;
- if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
- System.arraycopy (items, index + 1, items, index, --count - index);
- items [count] = null;
- if (count == 0) {
- if (imageList != null) {
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- items = new TableItem [4];
- }
-}
-
-int getBackgroundPixel () {
- return OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0);
-}
-
-/**
- * Returns the column at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this method will throw <code>ERROR_INVALID_RANGE</code> despite
- * the fact that a single column of data may be visible in the table.
- * This occurs when the programmer uses the table like a list, adding
- * items but never creating a column.
- *
- * @param index the index of the column to return
- * @return the column at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn getColumn (int index) {
- checkWidget ();
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) count = 0;
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- return columns [index];
-}
-
-/**
- * Returns the number of columns contained in the receiver.
- * If no <code>TableColumn</code>s were created by the programmer,
- * this value is zero, despite the fact that visually, one column
- * of items is may be visible. This occurs when the programmer uses
- * the table like a list, adding items but never creating a column.
- *
- * @return the number of columns
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public int getColumnCount () {
- checkWidget ();
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) count = 0;
- return count;
-}
-
-/**
- * Returns an array of <code>TableColumn</code>s which are the
- * columns in the receiver. If no <code>TableColumn</code>s were
- * created by the programmer, the array is empty, despite the fact
- * that visually, one column of items may be visible. This occurs
- * when the programmer uses the table like a list, adding items but
- * never creating a column.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableColumn [] getColumns () {
- checkWidget ();
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) count = 0;
- TableColumn [] result = new TableColumn [count];
- System.arraycopy (columns, 0, result, 0, count);
- return result;
-}
-
-int getFocusIndex () {
- return OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED);
-}
-
-int getForegroundPixel () {
- return OS.SendMessage (handle, OS.LVM_GETTEXTCOLOR, 0, 0);
-}
-
-/**
- * Returns the width in pixels of a grid line.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getGridLineWidth () {
- checkWidget ();
- return 1;
-}
-
-/**
- * Returns <code>true</code> if the receiver's header is visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the receiver's header's visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getHeaderVisible () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & OS.LVS_NOCOLUMNHEADER) == 0;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- return items [index];
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem getItem (Point point) {
- checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- LVHITTESTINFO pinfo = new LVHITTESTINFO ();
- pinfo.x = point.x; pinfo.y = point.y;
- OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- if (pinfo.iItem != -1) return items [pinfo.iItem];
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0);
- int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0);
- return (oneItem >> 16) - (empty >> 16);
-}
-
-/**
- * Returns an array of <code>TableItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getItems () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- TableItem [] result = new TableItem [count];
- System.arraycopy (items, 0, result, 0, count);
- return result;
-}
-
-/**
- * Returns <code>true</code> if the receiver's lines are visible,
- * and <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- *
- * @return the visibility state of the lines
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getLinesVisible () {
- checkWidget ();
- int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- return (bits & OS.LVS_EX_GRIDLINES) != 0;
-}
-
-/**
- * Returns an array of <code>TableItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TableItem [] getSelection () {
- checkWidget ();
- int i = -1, j = 0, count = OS.SendMessage (handle, OS.LVM_GETSELECTEDCOUNT, 0, 0);
- TableItem [] result = new TableItem [count];
- while ((i = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, i, OS.LVNI_SELECTED)) != -1) {
- result [j++] = items [i];
- }
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.LVM_GETSELECTEDCOUNT, 0, 0);
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- int focusIndex = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED);
- int selectedIndex = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_SELECTED);
- if (focusIndex == selectedIndex) return selectedIndex;
- int i = -1;
- while ((i = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, i, OS.LVNI_SELECTED)) != -1) {
- if (i == focusIndex) return i;
- }
- return selectedIndex;
-}
-
-/**
- * Returns the zero-relative indices of the items which are currently
- * selected in the receiver. The array is empty if no items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return the array of indices of the selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int [] getSelectionIndices () {
- checkWidget ();
- int i = -1, j = 0, count = OS.SendMessage (handle, OS.LVM_GETSELECTEDCOUNT, 0, 0);
- int [] result = new int [count];
- while ((i = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, i, OS.LVNI_SELECTED)) != -1) {
- result [j++] = i;
- }
- return result;
-}
-
-/**
- * Returns the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items are
- * scrolled or new items are added or removed.
- *
- * @return the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget ();
- return OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
-}
-
-int imageIndex (Image image) {
- if (image == null) return OS.I_IMAGENONE;
- if (imageList == null) {
- Rectangle bounds = image.getBounds ();
- imageList = getDisplay ().getImageList (new Point (bounds.width, bounds.height));
- int index = imageList.indexOf (image);
- if (index == -1) index = imageList.add (image);
- int hImageList = imageList.getHandle ();
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList);
- return index;
- }
- int index = imageList.indexOf (image);
- if (index != -1) return index;
- return imageList.add (image);
-}
-
-/**
- * Searches the receiver's list starting at the first column
- * (index 0) until a column is found that is equal to the
- * argument, and returns the index of that column. If no column
- * is found, returns -1.
- *
- * @param column the search column
- * @return the index of the column
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableColumn column) {
- checkWidget ();
- if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- if (columns [i] == column) return i;
- }
- return -1;
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (TableItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<count; i++) {
- if (items [i] == item) return i;
- }
- return -1;
-}
-
-/**
- * Returns <code>true</code> if the item is selected,
- * and <code>false</code> otherwise. Indices out of
- * range are ignored.
- *
- * @param index the index of the item
- * @return the visibility state of the item at the index
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isSelected (int index) {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- lvItem.iItem = index;
- int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- return (result != 0) && ((lvItem.state & OS.LVIS_SELECTED) != 0);
-}
-
-void releaseWidget () {
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (columnCount == 1 && columns [0] == null) columnCount = 0;
- for (int i=0; i<columnCount; i++) {
- TableColumn column = columns [i];
- if (!column.isDisposed ()) column.releaseWidget ();
- }
- columns = null;
- int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
-
- /*
- * Feature in Windows. When there are a large number
- * of items in a table (>1000), it is much faster to
- * delete each item with LVM_DELETEITEM rather than
- * using LVM_DELETEALLITEMS. The fix is to delete the
- * items, one by one.
- *
- * NOTE: LVM_DELETEALLITEMS is also sent by the table
- * when the table is destroyed.
- */
- /* Turn off redraw and leave it off */
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- for (int i=itemCount-1; i>=0; --i) {
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, i, 0);
- ignoreSelect = false;
- TableItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
- }
-
- /*
- * This code is intentionally commmented. This is
- * the correct code, assuming that the problem with
- * LVM_DELETEALLITEMS did not occur.
- */
-// for (int i=0; i<itemCount; i++) {
-// TableItem item = items [i];
-// if (!item.isDisposed ()) item.releaseWidget ();
-// }
-
- items = null;
- if (imageList != null) {
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- int hOldList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_STATE, 0);
- if (hOldList != 0) OS.ImageList_Destroy (hOldList);
- super.releaseWidget ();
-}
-
-/**
- * Removes the items from the receiver's list at the given
- * zero-relative indices.
- *
- * @param indices the array of indices of the items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int [] newIndices = new int [indices.length];
- System.arraycopy (indices, 0, newIndices, 0, indices.length);
- sort (newIndices);
- int last = -1;
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<newIndices.length; i++) {
- int index = newIndices [i];
- if (index != last || i == 0) {
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
- ignoreSelect = false;
- if (code == 0) {
- if (0 <= index && index < count) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
-
- // BUG - disposed callback could remove an item
- items [index].releaseWidget ();
- System.arraycopy (items, index + 1, items, index, --count - index);
- items [count] = null;
- last = index;
- }
- }
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
- ignoreSelect = false;
- if (code == 0) {
- if (0 <= index && index < count) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
- TableItem item = items [index];
- System.arraycopy (items, index + 1, items, index, --count - index);
- items [count] = null;
- item.releaseWidget ();
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- int index = start;
- while (index <= end) {
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, start, 0);
- ignoreSelect = false;
- if (code == 0) break;
-
- // BUG - disposed callback could remove an item
- items [index].releaseWidget ();
- index++;
- }
- System.arraycopy (items, index, items, start, count - index);
- for (int i=count-(index-start); i<count; i++) items [i] = null;
- if (index <= end) {
- if (0 <= index && index < count) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- } else {
- error (SWT.ERROR_INVALID_RANGE);
- }
- }
-}
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
-
- /*
- * Feature in Windows. When there are a large number
- * of items in a table (>1000), it is much faster to
- * delete each item with LVM_DELETEITEM rather than
- * using LVM_DELETEALLITEMS. The fix is to delete the
- * items, one by one.
- *
- * NOTE: LVM_DELETEALLITEMS is also sent by the table
- * when the table is destroyed.
- */
- boolean redraw = drawCount == 0 && OS.IsWindowVisible (handle);
- if (redraw) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- int index = count - 1;
- while (index >= 0) {
- ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
- ignoreSelect = false;
- if (code == 0) break;
-
- // BUG - disposed callback could remove an item
- items [index].releaseWidget ();
- --index;
- }
- if (redraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- /*
- * This code is intentionally commented. The window proc
- * for the table implements WM_SETREDRAW to invalidate
- * and erase the table so it is not necessary to do this
- * again.
- */
-// int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
-// OS.RedrawWindow (handle, null, 0, flags);
- }
- if (index != -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
-
- /*
- * This code is intentionally commmented. This is
- * the correct code, assuming that the problem with
- * LVM_DELETEALLITEMS did not occur.
- */
-// ignoreSelect = true;
-// int code = OS.SendMessage (handle, OS.LVM_DELETEALLITEMS, 0, 0);
-// ignoreSelect = false;
-// if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
-// for (int i=0; i<count; i++) {
-// TableItem item = items [i];
-// if (!item.isDisposed ()) item.releaseWidget ();
-// }
-
- if (imageList != null) {
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- items = new TableItem [4];
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- *
- * @param indices the array of indices for the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- int length = indices.length;
- if (length == 0) return;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_SELECTED;
- lvItem.stateMask = OS.LVIS_SELECTED;
- for (int i=indices.length-1; i>=0; --i) {
- lvItem.iItem = indices [i];
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_SELECTED;
- lvItem.stateMask = OS.LVIS_SELECTED;
- lvItem.iItem = index;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int start, int end) {
- checkWidget ();
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_SELECTED;
- lvItem.stateMask = OS.LVIS_SELECTED;
- for (int i=start; i<=end; i++) {
- lvItem.iItem = i;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
- }
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_SELECTED;
- lvItem.stateMask = OS.LVIS_SELECTED;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, lvItem);
- ignoreSelect = false;
-}
-
-LRESULT sendMouseDownEvent (int type, int button, int msg, int wParam, int lParam) {
- /*
- * Feature in Windows. Inside WM_LBUTTONDOWN and WM_RBUTTONDOWN,
- * the widget starts a modal loop to determine if the user wants
- * to begin a drag/drop operation or marque select. Unfortunately,
- * this modal loop eats the corresponding mouse up. The fix is to
- * detect the cases when the modal loop has eaten the mouse up and
- * issue a fake mouse up.
- *
- * By observation, when the mouse is clicked anywhere but the check
- * box, the widget eats the mouse up. When the mouse is dragged,
- * the widget does not eat the mouse up.
- */
- LVHITTESTINFO pinfo = new LVHITTESTINFO ();
- pinfo.x = (short) (lParam & 0xFFFF);
- pinfo.y = (short) (lParam >> 16);
- OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- sendMouseEvent (type, button, msg, wParam, lParam);
-
- /*
- * Force the table to have focus so that when the user
- * reselects the focus item, the LVIS_FOCUSED state bits
- * for the item will be set. These bits are used when
- * the table is multi-select to issue the selection
- * event. If the user did not click on an item, then
- * set focus to the table so that it will come to the
- * front and take focus in the work around below.
- */
- OS.SetFocus (handle);
-
- /*
- * Feature in Windows. When the user selects outside of
- * a table item, Windows deselects all the items, even
- * when the table is multi-select. While not strictly
- * wrong, this is unexpected. The fix is to detect the
- * case and avoid calling the window proc.
- */
- if (pinfo.iItem == -1) {
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return LRESULT.ZERO;
- }
-
- /*
- * Feature in Windows. In tables that have the style
- * LVS_SINGLESEL, when a table item is reselected, the
- * table does not issue a WM_NOTIFY because the item
- * state has not changed. This is inconsistent with
- * the list widget and other widgets in Windows. The
- * fix is to detect the case when an item is reselected
- * and issue the notification.
- */
- int oldState = 0;
- if ((style & SWT.SINGLE) != 0 && pinfo.iItem != -1) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- lvItem.iItem = pinfo.iItem;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- oldState = lvItem.state;
- }
- dragStarted = false;
- int code = callWindowProc (msg, wParam, lParam);
- if ((style & SWT.SINGLE) != 0 && pinfo.iItem != -1) {
- if ((oldState & OS.LVIS_SELECTED) != 0) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_SELECTED;
- lvItem.iItem = pinfo.iItem;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- int newState = lvItem.state;
- if ((newState & OS.LVIS_SELECTED) != 0) {
- Event event = new Event ();
- event.item = items [pinfo.iItem];
- postEvent (SWT.Selection, event);
- }
- }
- }
- if (dragStarted) {
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- } else {
- int flags = OS.LVHT_ONITEMLABEL | OS.LVHT_ONITEMICON;
- boolean fakeMouseUp = (pinfo.flags & flags) != 0;
- if (!fakeMouseUp && (style & SWT.MULTI) != 0) {
- fakeMouseUp = (pinfo.flags & OS.LVHT_ONITEMSTATEICON) == 0;
- }
- if (fakeMouseUp) {
- sendMouseEvent (SWT.MouseUp, button, msg, wParam, lParam);
- }
- }
- dragStarted = false;
- return new LRESULT (code);
-}
-
-void setBackgroundPixel (int pixel) {
- if (background == pixel) return;
- background = pixel;
-
- /*
- * Feature in Windows. Setting the color to be
- * the current default is not correct because the
- * widget will not change colors when the colors
- * are changed from the control panel. There is
- * no fix at this time.
- */
- if (pixel == -1) pixel = defaultBackground ();
- OS.SendMessage (handle, OS.LVM_SETBKCOLOR, 0, pixel);
- OS.SendMessage (handle, OS.LVM_SETTEXTBKCOLOR, 0, pixel);
- if ((style & SWT.CHECK) != 0) setCheckboxImageList (true);
-
- /*
- * Feature in Windows. When the background color is
- * changed, the table does not redraw until the next
- * WM_PAINT. The fix is to force a redraw.
- */
- OS.InvalidateRect (handle, null, true);
-}
-
-void setCheckboxImageList (boolean force) {
- if ((style & SWT.CHECK) == 0) return;
- int height = 0, width = 0;
- int hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
- if (hImageList != 0) {
- int [] cx = new int [1], cy = new int [1];
- OS.ImageList_GetIconSize (hImageList, cx, cy);
- height = width = cy [0];
- } else {
- int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0);
- int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0);
- height = width = (oneItem >> 16) - (empty >> 16);
- }
- int hOldStateList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0);
- if (!force && hOldStateList != 0) {
- int [] cx = new int [1], cy = new int [1];
- OS.ImageList_GetIconSize (hOldStateList, cx, cy);
- if (height == cx [0] && width == cy [0]) return;
- }
- int count = 4;
- int hStateList = OS.ImageList_Create (width, height, OS.ILC_COLOR, count, count);
- int hDC = OS.GetDC (handle);
- int memDC = OS.CreateCompatibleDC (hDC);
- int hBitmap = OS.CreateCompatibleBitmap (hDC, width * count, height);
- int hOldBitmap = OS.SelectObject (memDC, hBitmap);
- RECT rect = new RECT ();
- OS.SetRect (rect, 0, 0, width * count, height);
- int hBrush = OS.CreateSolidBrush (getBackgroundPixel ());
- OS.FillRect (memDC, rect, hBrush);
- OS.DeleteObject (hBrush);
- int oldFont = OS.SelectObject (hDC, defaultFont ());
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- OS.SelectObject (hDC, oldFont);
- int itemWidth = Math.min (tm.tmHeight, width);
- int itemHeight = Math.min (tm.tmHeight, height);
- int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1;
- OS.SetRect (rect, left, top, left + itemWidth, top + itemHeight);
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
- OS.SelectObject (memDC, hOldBitmap);
- OS.DeleteDC (memDC);
- OS.ReleaseDC (handle, hDC);
- OS.ImageList_AddMasked (hStateList, hBitmap, 0);
- OS.DeleteObject (hBitmap);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_STATE, hStateList);
- if (hOldStateList != 0) OS.ImageList_Destroy (hOldStateList);
-}
-
-void setFocusIndex (int index) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_FOCUSED;
- lvItem.stateMask = OS.LVIS_FOCUSED;
- lvItem.iItem = index;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
-}
-
-public void setFont (Font font) {
- checkWidget ();
- super.setFont (font);
- setScrollWidth ();
- int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- if ((bits & OS.LVS_EX_GRIDLINES) == 0) return;
- bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.LVS_NOCOLUMNHEADER) != 0) return;
- setRowHeight ();
-}
-
-void setForegroundPixel (int pixel) {
- if (foreground == pixel) return;
- foreground = pixel;
-
- /*
- * Feature in Windows. Setting the color to be
- * the current default is not correct because the
- * table will not change colors when the colors
- * are changed from the control panel. There is
- * no fix at this time.
- */
- if (pixel == -1) pixel = defaultForeground ();
- OS.SendMessage (handle, OS.LVM_SETTEXTCOLOR, 0, pixel);
-
- /*
- * Feature in Windows. When the foreground color is
- * changed, the table does not redraw until the next
- * WM_PAINT. The fix is to force a redraw.
- */
- OS.InvalidateRect (handle, null, true);
-}
-
-/**
- * Marks the receiver's header as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHeaderVisible (boolean show) {
- checkWidget ();
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- newBits &= ~OS.LVS_NOCOLUMNHEADER;
- if (!show) newBits |= OS.LVS_NOCOLUMNHEADER;
- /*
- * Feature in Windows. Setting or clearing LVS_NOCOLUMNHEADER
- * causes the table to scroll to the beginning. The fix is to
- * save and restore the top index.
- */
- int topIndex = getTopIndex ();
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- if (topIndex != 0) setTopIndex (topIndex);
- if (show) {
- int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- if ((bits & OS.LVS_EX_GRIDLINES) != 0) setRowHeight ();
- }
-}
-
-/**
- * Marks the receiver's lines as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- *
- * @param visible the new visibility state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLinesVisible (boolean show) {
- checkWidget ();
- int newBits = 0;
- if (show) {
- newBits = OS.LVS_EX_GRIDLINES;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.LVS_NOCOLUMNHEADER) == 0) setRowHeight ();
- }
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_GRIDLINES, newBits);
-}
-
-public void setRedraw (boolean redraw) {
- checkWidget ();
- if (redraw) {
- if (--drawCount == 0) {
- setScrollWidth ();
- /*
- * This code is intentionally commented. When many items
- * are added to a table, it is slightly faster to temporarily
- * unsubclass the window proc so that messages are dispatched
- * directly to the table. This is optimization is dangerous
- * because any operation can occur when redraw is turned off,
- * even operations where the table must be subclassed in order
- * to have the correct behavior or work around a Windows bug.
- * For now, don't attempt it.
- */
-// subclass ();
-
- /*
- * Bug in Windows. For some reason, when WM_SETREDRAW is used
- * to turn redraw back on this may result in a WM_SIZE. If the table column
- * widths are adjusted in the WM_SIZE callback, blank lines may be
- * inserted at the top of the widget. A call to LVM_GETTOPINDEX will
- * return a negative number (this is an impossible result). The fix is to
- * ignore any resize generated by WM_SETREDRAW and defer the work
- * until the WM_SETREDRAW has returned.
- */
- ignoreResize = true;
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- if (!ignoreResize) {
- int count = getChildrenCount ();
- if (count > 1 && hdwp == 0) {
- hdwp = OS.BeginDeferWindowPos (count);
- }
- if (layout != null) layout.layout (this, false);
- sendEvent (SWT.Resize);
- // widget may be disposed at this point
- if (isDisposed ()) return;
- int oldHdwp = hdwp;
- hdwp = 0;
- if (oldHdwp != 0) OS.EndDeferWindowPos (oldHdwp);
- }
- ignoreResize = false;
-
- /*
- * This code is intentionally commented. The window proc
- * for the table implements WM_SETREDRAW to invalidate
- * and erase the table and the header. This is undocumented
- * behavior. The commented code below shows what is actually
- * happening and reminds us that we are relying on this
- * undocumented behavior.
- */
-// int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
-// if (hwndHeader != 0) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 1, 0);
-// int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
-// OS.RedrawWindow (handle, null, 0, flags);
-// if (hwndHeader != 0) OS.RedrawWindow (hwndHeader, null, 0, flags);
- }
- } else {
- if (drawCount++ == 0) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- if (hwndHeader != 0) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 0, 0);
- /*
- * This code is intentionally commented. When many items
- * are added to a table, it is slightly faster to temporarily
- * unsubclass the window proc so that messages are dispatched
- * directly to the table. This is optimization is dangerous
- * because any operation can occur when redraw is turned off,
- * even operations where the table must be subclassed in order
- * to have the correct behavior or work around a Windows bug.
- * For now, don't attempt it.
- */
-// unsubclass ();
- }
- }
-}
-
-void setRowHeight () {
- /*
- * Bug in Windows. When both a header and grid lines are
- * displayed, the grid lines do not take into account the
- * height of the header and draw in the wrong place. The
- * fix is to set the height of the table items to be the
- * height of the header so that the lines draw in the right
- * place. The height of a table item is the maximum of the
- * height of the font or the height of image list.
- *
- * NOTE: In version 5.80 of COMCTL32.DLL, the bug is fixed.
- */
- if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) >= (5 << 16 | 80)) return;
- int hOldList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
- if (hOldList != 0) return;
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- RECT rect = new RECT ();
- OS.GetWindowRect (hwndHeader, rect);
- int height = rect.bottom - rect.top - 1;
- int hImageList = OS.ImageList_Create (1, height, 0, 0, 0);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0);
- OS.ImageList_Destroy (hImageList);
-}
-
-void setScrollWidth () {
- if (drawCount != 0) return;
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) {
- OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, OS.LVSCW_AUTOSIZE);
- }
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected is first cleared, then the new items are selected.
- *
- * @param indices the indices of the items to select
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int[])
- */
-public void setSelection (int [] indices) {
- checkWidget ();
- if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
- deselectAll ();
- select (indices);
- if (indices.length != 0) {
- int focusIndex = indices [0];
- if (focusIndex != -1) setFocusIndex (focusIndex);
- }
- showSelection ();
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (TableItem [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- deselectAll ();
- int length = items.length;
- if (length == 0) return;
- int focusIndex = -1;
- if ((style & SWT.SINGLE) != 0) length = 1;
- for (int i=length-1; i>=0; --i) {
- int index = indexOf (items [i]);
- if (index != -1) {
- select (focusIndex = index);
- }
- }
- if (focusIndex != -1) setFocusIndex (focusIndex);
- showSelection ();
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * The current selected is first cleared, then the new item is selected.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int)
- */
-public void setSelection (int index) {
- checkWidget ();
- deselectAll ();
- select (index);
- if (index != -1) setFocusIndex (index);
- showSelection ();
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- *
- * @param start the start index of the items to select
- * @param end the end index of the items to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#deselectAll()
- * @see Table#select(int,int)
- */
-public void setSelection (int start, int end) {
- checkWidget ();
- deselectAll ();
- select (start, end);
- /*
- * NOTE: This code relies on the select (int, int)
- * selecting the last item in the range for a single
- * selection table.
- */
- int focusIndex = (style & SWT.SINGLE) != 0 ? end : start;
- if (focusIndex != -1) setFocusIndex (focusIndex);
- showSelection ();
-}
-
-/**
- * Sets the zero-relative index of the item which is currently
- * at the top of the receiver. This index can change when items
- * are scrolled or new items are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget ();
- int topIndex = OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
- if (index == topIndex) return;
-
- /*
- * Bug in Windows. For some reason, LVM_SCROLL refuses to
- * scroll a table vertically when the width and height of
- * the table is smaller than a certain size. The values
- * that the author is seeing are width=68 and height=6
- * but there is no guarantee that these values are absolute.
- * They may depend on the font and any number of other
- * factors. In fact, the author has observed that setting
- * the font to anything but the default seems to sometimes
- * fix the problem. The fix is to use LVM_GETCOUNTPERPAGE
- * to detect the case when the number of visible items is
- * zero and use LVM_ENSUREVISIBLE to scroll the table to
- * make the index visible.
- */
-
- /*
- * Bug in Windows. When the table header is visible and
- * there is not enough space to show a single table item,
- * LVM_GETCOUNTPERPAGE can return a negative number instead
- * of zero. The fix is to test for negative or zero.
- */
- if (OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0) <= 0) {
-
- /*
- * Bug in Windows. For some reason, LVM_ENSUREVISIBLE can
- * scroll one item more or one item less when there is not
- * enough space to show a single table item. The fix is
- * to detect the case and call LVM_ENSUREVISIBLE again with
- * the same arguments. It seems that once LVM_ENSUREVISIBLE
- * has scrolled into the general area, it is able to scroll
- * to the exact item.
- */
- OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 1);
- if (index != OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0)) {
- OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 1);
- }
- return;
- }
-
- /* Use LVM_SCROLL to scroll the table */
- RECT rect = new RECT ();
- rect.left = OS.LVIR_BOUNDS;
- OS.SendMessage (handle, OS.LVM_GETITEMRECT, 0, rect);
- int dy = (index - topIndex) * (rect.bottom - rect.top);
- OS.SendMessage (handle, OS.LVM_SCROLL, 0, dy);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showSelection()
- */
-public void showItem (TableItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- /*
- * Bug in Windows. For some reason, when there is insufficient space
- * to show an item, LVM_ENSUREVISIBLE causes blank lines to be
- * inserted at the top of the widget. A call to LVM_GETTOPINDEX will
- * return a negative number (this is an impossible result). The fix is to
- * detect this case and fail to show the selection.
- */
- if (OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0) <= 0) return;
- int index = indexOf (item);
- if (index != -1) {
- OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
- }
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Table#showItem(TableItem)
- */
-public void showSelection () {
- checkWidget ();
- /*
- * Bug in Windows. For some reason, when there is insufficient space
- * to show an item, LVM_ENSUREVISIBLE causes blank lines to be
- * inserted at the top of the widget. A call to LVM_GETTOPINDEX will
- * return a negative number (this is an impossible result). The fix is to
- * detect this case and fail to show the selection.
- */
- if (OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0) <= 0) return;
- int index = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_SELECTED);
- if (index != -1) OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.LVS_SHAREIMAGELISTS | OS.WS_CLIPCHILDREN;
- if ((style & SWT.HIDE_SELECTION) == 0) bits |= OS.LVS_SHOWSELALWAYS;
- if ((style & SWT.SINGLE) != 0) bits |= OS.LVS_SINGLESEL;
- /*
- * This code is intentionally commented. In the future,
- * the FLAT bit may be used to make the header flat and
- * unresponsive to mouse clicks.
- */
-// if ((style & SWT.FLAT) != 0) bits |= OS.LVS_NOSORTHEADER;
- bits |= OS.LVS_REPORT | OS.LVS_NOCOLUMNHEADER;
- return bits;
-}
-
-TCHAR windowClass () {
- return TableClass;
-}
-
-int windowProc () {
- return TableProc;
-}
-
-LRESULT WM_KEYDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_KEYDOWN (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.CHECK) != 0 && wParam == OS.VK_SPACE) {
- int index = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED);
- if (index != -1) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- int state = lvItem.state >> 12;
- if ((state & 0x1) != 0) {
- state++;
- } else {
- --state;
- }
- lvItem.state = state << 12;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- }
- }
- return result;
-}
-
-LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. When the user selects outside of
- * a table item, Windows deselects all the items, even
- * when the table is multi-select. While not strictly
- * wrong, this is unexpected. The fix is to detect the
- * case and avoid calling the window proc.
- */
- LVHITTESTINFO pinfo = new LVHITTESTINFO ();
- pinfo.x = (short) (lParam & 0xFFFF);
- pinfo.y = (short) (lParam >> 16);
- OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_LBUTTONDBLCLK, wParam, lParam);
- if (pinfo.iItem != -1) callWindowProc (OS.WM_LBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return LRESULT.ZERO;
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- /*
- * Feature in Windows. For some reason, capturing
- * the mouse after processing the mouse event for the
- * widget interferes with the normal mouse processing
- * for the widget. The fix is to avoid the automatic
- * mouse capture.
- */
- LRESULT result = sendMouseDownEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
-
- /* Look for check/uncheck */
- if ((style & SWT.CHECK) != 0) {
- LVHITTESTINFO pinfo = new LVHITTESTINFO ();
- pinfo.x = (short) (lParam & 0xFFFF);
- pinfo.y = (short) (lParam >> 16);
- /*
- * Note that when the table has LVS_EX_FULLROWSELECT and the
- * user clicks anywhere on a row except on the check box, all
- * of the bits are set. The hit test flags are LVHT_ONITEM.
- * This means that a bit test for LVHT_ONITEMSTATEICON is not
- * the correct way to determine that the user has selected
- * the check box.
- */
- int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- if (index != -1 && pinfo.flags == OS.LVHT_ONITEMSTATEICON) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem);
- int state = lvItem.state >> 12;
- if ((state & 0x1) != 0) {
- state++;
- } else {
- --state;
- }
- lvItem.state = state << 12;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- }
- }
-
- return result;
-}
-
-LRESULT WM_MOUSEHOVER (int wParam, int lParam) {
- /*
- * Feature in Windows. Despite the fact that hot
- * tracking is not enabled, the hot tracking code
- * in WM_MOUSEHOVER is executed causing the item
- * under the cursor to be selected. The fix is to
- * avoid calling the window proc.
- */
- LRESULT result = super.WM_MOUSEHOVER (wParam, lParam);
- int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- int mask = OS.LVS_EX_ONECLICKACTIVATE | OS.LVS_EX_TRACKSELECT | OS.LVS_EX_TWOCLICKACTIVATE;
- if ((bits & mask) != 0) return result;
- return LRESULT.ZERO;
-}
-
-LRESULT WM_NOTIFY (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- if (hdr.hwndFrom == hwndHeader) {
- /*
- * Feature in Windows. On NT, the automatically created
- * header control is created as a UNICODE window, not an
- * ANSI window despite the fact that the parent is created
- * as an ANSI window. This means that it sends UNICODE
- * notification messages to the parent window on NT for
- * no good reason. The data and size in the NMHEADER and
- * HDITEM structs is identical between the platforms so no
- * different message is actually necessary. Despite this,
- * Windows sends different messages. The fix is to look
- * for both messages, despite the platform. This works
- * because only one will be sent on either platform, never
- * both.
- */
- switch (hdr.code) {
- case OS.HDN_BEGINTRACKW:
- case OS.HDN_BEGINTRACKA: {
- NMHEADER phdn = new NMHEADER ();
- OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
- HDITEM pitem = new HDITEM ();
- OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
- TableColumn column = columns [phdn.iItem];
- if (column != null && !column.getResizable ()) {
- return LRESULT.ONE;
- }
- break;
- }
- case OS.HDN_ITEMCHANGEDW:
- case OS.HDN_ITEMCHANGEDA: {
- NMHEADER phdn = new NMHEADER ();
- OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
- Event event = new Event ();
- if (phdn.pitem != 0) {
- HDITEM pitem = new HDITEM ();
- OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
- if ((pitem.mask & OS.HDI_WIDTH) != 0) {
- TableColumn column = columns [phdn.iItem];
- if (column != null) {
- column.sendEvent (SWT.Resize, event);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- if (isDisposed ()) return LRESULT.ZERO;
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count == 1 && columns [0] == null) count = 0;
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the column in the move
- * event. If this happens, process the move event
- * for those columns that have not been destroyed.
- */
- TableColumn [] newColumns = new TableColumn [count];
- System.arraycopy (columns, 0, newColumns, 0, count);
- for (int i=phdn.iItem+1; i<count; i++) {
- if (!newColumns [i].isDisposed ()) {
- newColumns [i].sendEvent (SWT.Move, event);
- }
- }
- }
- }
- }
- break;
- }
- }
- }
- return super.WM_NOTIFY (wParam, lParam);
-}
-
-LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Feature in Windows. When the user selects outside of
- * a table item, Windows deselects all the items, even
- * when the table is multi-select. While not strictly
- * wrong, this is unexpected. The fix is to detect the
- * case and avoid calling the window proc.
- */
- LVHITTESTINFO pinfo = new LVHITTESTINFO ();
- pinfo.x = (short) (lParam & 0xFFFF);
- pinfo.y = (short) (lParam >> 16);
- OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_RBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_RBUTTONDBLCLK, wParam, lParam);
- if (pinfo.iItem != -1) callWindowProc (OS.WM_RBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return LRESULT.ZERO;
-}
-
-LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- /*
- * Feature in Windows. For some reason, capturing
- * the mouse after processing the mouse event for the
- * widget interferes with the normal mouse processing
- * for the widget. The fix is to avoid the automatic
- * mouse capture.
- */
- return sendMouseDownEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- /*
- * Bug in Windows. For some reason, the table does
- * not set the default focus rectangle to be the first
- * item in the table when it gets focus and there is
- * no selected item. The fix to make the first item
- * be the focus item.
- */
- int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- if (count == 0) return result;
- int index = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED);
- if (index == -1) {
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.state = OS.LVIS_FOCUSED;
- lvItem.stateMask = OS.LVIS_FOCUSED;
- ignoreSelect = true;
- OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
- ignoreSelect = false;
- }
- return result;
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- if (ignoreResize) {
- ignoreResize = false;
- int code = callWindowProc (OS.WM_SIZE, wParam, lParam);
- return new LRESULT (code);
- }
- return super.WM_SIZE (wParam, lParam);
-}
-
-LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
- LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.CHECK) != 0) setCheckboxImageList (true);
- return result;
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- switch (hdr.code) {
- case OS.LVN_MARQUEEBEGIN: return LRESULT.ONE;
- case OS.LVN_BEGINDRAG:
- case OS.LVN_BEGINRDRAG:
- dragStarted = true;
- if (hdr.code == OS.LVN_BEGINDRAG) {
- sendEvent (SWT.DragDetect);
- // widget could be disposed at this point
- }
- break;
- case OS.LVN_COLUMNCLICK: {
- NMLISTVIEW pnmlv = new NMLISTVIEW ();
- OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof);
- TableColumn column = columns [pnmlv.iSubItem];
- if (column != null) {
- column.postEvent (SWT.Selection);
- }
- break;
- }
- case OS.LVN_ITEMACTIVATE: {
- NMLISTVIEW pnmlv = new NMLISTVIEW ();
- OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof);
- if (pnmlv.iItem != -1) {
- Event event = new Event ();
- event.item = items [pnmlv.iItem];
- postEvent (SWT.DefaultSelection, event);
- }
- break;
- }
- case OS.LVN_ITEMCHANGED: {
- if (!ignoreSelect) {
- NMLISTVIEW pnmlv = new NMLISTVIEW ();
- OS.MoveMemory (pnmlv, lParam, NMLISTVIEW.sizeof);
- if (pnmlv.iItem != -1 && (pnmlv.uChanged & OS.LVIF_STATE) != 0) {
- int oldBits = pnmlv.uOldState & OS.LVIS_STATEIMAGEMASK;
- int newBits = pnmlv.uNewState & OS.LVIS_STATEIMAGEMASK;
- if (oldBits != newBits) {
- Event event = new Event();
- event.item = items [pnmlv.iItem];
- event.detail = SWT.CHECK;
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, pnmlv.iItem, 0);
- postEvent (SWT.Selection, event);
- } else {
- boolean isFocus = (pnmlv.uNewState & OS.LVIS_FOCUSED) != 0;
- int index = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED);
- if ((style & SWT.MULTI) != 0) {
- if (!isFocus && index == pnmlv.iItem) {
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
- boolean isSelected = (pnmlv.uNewState & OS.LVIS_SELECTED) != 0;
- boolean wasSelected = (pnmlv.uOldState & OS.LVIS_SELECTED) != 0;
- isFocus = isSelected != wasSelected;
- }
- }
- }
- if (OS.GetKeyState (OS.VK_SPACE) < 0) isFocus = true;
- if (isFocus) {
- Event event = new Event();
- if (index != -1) {
- int itemState = OS.SendMessage (handle, OS.LVM_GETITEMSTATE, index, OS.LVIS_SELECTED);
- if ((itemState & OS.LVIS_SELECTED) != 0) event.item = items [index];
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
- }
- postEvent (SWT.Selection, event);
- }
- }
- }
- }
- break;
- }
- }
- return super.wmNotifyChild (wParam, lParam);
-}
-
-LRESULT wmScroll (int msg, int wParam, int lParam) {
- int code = callWindowProc (msg, wParam, lParam);
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
deleted file mode 100755
index 0a2f12ac1a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ /dev/null
@@ -1,472 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a column in a table widget.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>LEFT, RIGHT, CENTER</dd>
- * <dt><b>Events:</b></dt>
- * <dd> Move, Resize, Selection</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class TableColumn extends Item {
- Table parent;
- boolean resizable;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style) {
- super (parent, checkStyle (style));
- resizable = true;
- this.parent = parent;
- parent.createItem (this, parent.getColumnCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableColumn (Table parent, int style, int index) {
- super (parent, checkStyle (style));
- resizable = true;
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener(ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Resize,typedListener);
- addListener (SWT.Move,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the column header is selected.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
- *
- * @return the alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getAlignment () {
- checkWidget ();
- if ((style & SWT.LEFT) != 0) return SWT.LEFT;
- if ((style & SWT.CENTER) != 0) return SWT.CENTER;
- if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
- return SWT.LEFT;
-}
-
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-String getNameText () {
- return getText ();
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Gets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @return the resizable attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getResizable () {
- checkWidget ();
- return resizable;
-}
-
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return 0;
- int hwnd = parent.handle;
- return OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
-}
-
-/**
- * Causes the receiver to be resized to its preferred size.
- * For a composite, this involves computing the preferred size
- * from its layout, if there is one.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- */
-public void pack () {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- TCHAR buffer = new TCHAR (parent.getCodePage (), text, true);
- int headerWidth = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + 10;
- if (image != null) {
- int margin = 0;
- if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) >= (5 << 16 | 80)) {
- int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- margin = OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
- } else {
- margin = OS.GetSystemMetrics (OS.SM_CXEDGE) * 3;
- }
- Rectangle rect = image.getBounds ();
- headerWidth += rect.width + margin * 2;
- }
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE);
- int columnWidth = OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
- if (headerWidth > columnWidth) {
- if (image == null) {
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE_USEHEADER);
- } else {
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, headerWidth);
- }
- }
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
- eventTable.unhook (SWT.Resize, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>.
- *
- * @param alignment the new alignment
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setAlignment (int alignment) {
- checkWidget ();
- if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
- int index = parent.indexOf (this);
- if (index == -1 || index == 0) return;
- style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
- int fmt = 0;
- if ((style & SWT.LEFT) == SWT.LEFT) fmt = OS.LVCFMT_LEFT;
- if ((style & SWT.CENTER) == SWT.CENTER) fmt = OS.LVCFMT_CENTER;
- if ((style & SWT.RIGHT) == SWT.RIGHT) fmt = OS.LVCFMT_RIGHT;
- int hwnd = parent.handle;
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_FMT;
- lvColumn.fmt = fmt;
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
-}
-
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error (SWT.ERROR_INVALID_ARGUMENT);
- }
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setImage (image);
- int hwnd = parent.handle;
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE;
- lvColumn.fmt = OS.LVCFMT_IMAGE;
- lvColumn.iImage = parent.imageIndex (image);
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
- if (image == null) {
- lvColumn.mask = OS.LVCF_FMT;
- if ((style & SWT.LEFT) == SWT.LEFT) lvColumn.fmt = OS.LVCFMT_LEFT;
- if ((style & SWT.CENTER) == SWT.CENTER) lvColumn.fmt = OS.LVCFMT_CENTER;
- if ((style & SWT.RIGHT) == SWT.RIGHT) lvColumn.fmt = OS.LVCFMT_RIGHT;
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
- }
-}
-
-/**
- * Sets the resizable attribute. A column that is
- * not resizable cannot be dragged by the user but
- * may be resized by the programmer.
- *
- * @param resizable the resize attribute
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setResizable (boolean resizable) {
- checkWidget ();
- this.resizable = resizable;
-}
-
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setText (string);
-
- /*
- * Bug in Windows. For some reason, when the title
- * of a column is changed after the column has been
- * created, the alignment must also be reset or the
- * text does not draw. The fix is to query and then
- * set the alignment.
- */
- int hwnd = parent.handle;
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_FMT;
- OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn);
-
- /* Set the column title */
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- lvColumn.mask |= OS.LVCF_TEXT;
- lvColumn.pszText = pszText;
- int result = OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- if (result == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
-}
-
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- checkWidget ();
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, width);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
deleted file mode 100755
index 359e0e41c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ /dev/null
@@ -1,594 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents an item in a table.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TableItem extends Item {
- Table parent;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Table</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TableItem (Table parent, int style, int index) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent at a column in the table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding column rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds (int index) {
- checkWidget();
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) return new Rectangle (0, 0, 0, 0);
- int hwnd = parent.handle;
- int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index < count)) return new Rectangle (0, 0, 0, 0);
- int gridWidth = 0;
- if (parent.getLinesVisible ()) gridWidth = parent.getGridLineWidth ();
- RECT rect = new RECT ();
- rect.top = index;
- rect.left = OS.LVIR_LABEL;
- OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, itemIndex, rect);
- if (index == 0) {
- RECT iconRect = new RECT ();
- iconRect.left = OS.LVIR_ICON;
- OS.SendMessage (hwnd, OS.LVM_GETSUBITEMRECT, itemIndex, iconRect);
- rect.left = iconRect.left - gridWidth;
- }
- int width = rect.right - rect.left - gridWidth;
- int height = rect.bottom - rect.top - gridWidth;
- /*
- * Bug in Windows. In version 5.80 of COMCTL32.DLL, the top
- * of the rectangle returned by LVM_GETSUBITEMRECT is off by
- * one pixel. The fix is to move the top of the rectangle up
- * by one pixel.
- */
- if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) >= (5 << 16 | 80)) {
- --rect.top;
- }
- return new Rectangle (rect.left + gridWidth, rect.top + gridWidth, width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int index = parent.indexOf (this);
- if (index == -1) return false;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- int result = OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- return (result != 0) && (((lvItem.state >> 12) & 1) == 0);
-}
-
-public Display getDisplay () {
- Table parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed () {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int index = parent.indexOf (this);
- if (index == -1) return false;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- int result = OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- return (result != 0) && ((lvItem.state >> 12) > 2);
-}
-
-public Image getImage (int index) {
- checkWidget();
- if (index == 0) return super.getImage ();
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) return null;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_IMAGE;
- lvItem.iItem = itemIndex;
- lvItem.iSubItem = index;
- if (OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem) == 0) return null;
- if (lvItem.iImage >= 0) return parent.imageList.get (lvItem.iImage);
- return null;
-}
-
-/**
- * Returns a rectangle describing the size and location
- * relative to its parent of an image at a column in the
- * table.
- *
- * @param index the index that specifies the column
- * @return the receiver's bounding image rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getImageBounds (int index) {
- checkWidget();
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) return new Rectangle (0, 0, 0, 0);
- int hwnd = parent.handle;
- int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index < count)) return new Rectangle (0, 0, 0, 0);
- int gridWidth = 0;
- if (parent.getLinesVisible ()) gridWidth = parent.getGridLineWidth ();
- RECT rect = new RECT ();
- rect.top = index;
- rect.left = OS.LVIR_ICON;
- OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, itemIndex, rect);
- if (index == 0) {
- RECT iconRect = new RECT ();
- iconRect.left = OS.LVIR_ICON;
- OS.SendMessage (hwnd, OS.LVM_GETSUBITEMRECT, itemIndex, iconRect);
- rect.left = iconRect.left - gridWidth;
- }
- int width = rect.right - rect.left - gridWidth;
- int height = rect.bottom - rect.top - gridWidth;
- if (gridWidth == 0) --height;
- /*
- * Bug in Windows. In version 5.80 of COMCTL32.DLL, the top
- * of the rectangle returned by LVM_GETSUBITEMRECT is off by
- * one pixel. The fix is to move the top of the rectangle up
- * by one pixel.
- */
- if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) >= (5 << 16 | 80)) {
- --rect.top;
- }
- return new Rectangle (rect.left + gridWidth, rect.top + gridWidth, width, height);
-}
-
-/**
- * Gets the image indent.
- *
- * @return the indent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getImageIndent () {
- checkWidget();
- int index = parent.indexOf (this);
- if (index == -1) return 0;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_INDENT;
- lvItem.iItem = index;
- OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- return lvItem.iIndent;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Table</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Table getParent () {
- checkWidget();
- return parent;
-}
-
-public String getText (int index) {
- checkWidget();
- if (index == 0) return super.getText ();
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) error (SWT.ERROR_CANNOT_GET_TEXT);
- int cchTextMax = 1024;
- int hwnd = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- int byteCount = cchTextMax * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_TEXT;
- lvItem.iItem = itemIndex;
- lvItem.iSubItem = index;
- lvItem.pszText = pszText;
- lvItem.cchTextMax = cchTextMax;
- int result = OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- TCHAR buffer = new TCHAR (parent.getCodePage (), cchTextMax);
- OS.MoveMemory (buffer, pszText, byteCount);
- OS.HeapFree (hHeap, 0, pszText);
- if (result == 0) error (SWT.ERROR_CANNOT_GET_TEXT);
- return buffer.toString (0, buffer.strlen ());
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Sets the checked state of the receiver.
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return;
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- int state = lvItem.state >> 12;
- if (checked) {
- if ((state & 0x1) != 0) state++;
- } else {
- if ((state & 0x1) == 0) --state;
- }
- lvItem.state = state << 12;
- parent.ignoreSelect = true;
- OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem);
- parent.ignoreSelect = false;
-}
-
-/**
- * Sets the grayed state of the receiver.
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget();
- if ((parent.style & SWT.CHECK) == 0) return;
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_STATE;
- lvItem.stateMask = OS.LVIS_STATEIMAGEMASK;
- lvItem.iItem = index;
- OS.SendMessage (hwnd, OS.LVM_GETITEM, 0, lvItem);
- int state = lvItem.state >> 12;
- if (grayed) {
- if (state <= 2) state +=2;
- } else {
- if (state > 2) state -=2;
- }
- lvItem.state = state << 12;
- parent.ignoreSelect = true;
- OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem);
- parent.ignoreSelect = false;
-}
-
-/**
- * Sets the image for multiple columns in the Table.
- *
- * @param images the array of new images
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (Image [] images) {
- checkWidget();
- if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<images.length; i++) {
- setImage (i, images [i]);
- }
-}
-
-/**
- * Sets the receiver's image at a column.
- *
- * @param index the column index
- * @param image the new image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImage (int index, Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (index == 0) {
- setImage (image);
- return;
- }
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) return;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_IMAGE;
- lvItem.iItem = itemIndex;
- lvItem.iSubItem = index;
- lvItem.iImage = parent.imageIndex (image);
- if (OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem) != 0) {
- parent.setCheckboxImageList (false);
- }
-}
-
-public void setImage (Image image) {
- checkWidget();
- if (image != null && image.isDisposed ()) {
- error(SWT.ERROR_INVALID_ARGUMENT);
- }
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setImage (image);
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_IMAGE;
- lvItem.iItem = index;
- lvItem.iImage = parent.imageIndex (image);
- if (OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem) != 0) {
- parent.setScrollWidth ();
- parent.setCheckboxImageList (false);
- }
-}
-
-/**
- * Sets the image indent.
- *
- * @param indent the new indent
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setImageIndent (int indent) {
- checkWidget();
- if (indent < 0) return;
- int index = parent.indexOf (this);
- if (index == -1) return;
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_INDENT;
- lvItem.iItem = index;
- lvItem.iIndent = indent;
- OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem);
-}
-
-/**
- * Sets the text for multiple columns in the table.
- *
- * @param strings the array of new strings
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String [] strings) {
- checkWidget();
- if (strings == null) error (SWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i<strings.length; i++) {
- String string = strings [i];
- if (string != null) setText (i, string);
- }
-}
-
-/**
- * Sets the receiver's text at a column
- *
- * @param index the column index
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (int index, String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (index == 0) {
- setText (string);
- return;
- }
- int itemIndex = parent.indexOf (this);
- if (itemIndex == -1) return;
- int hwnd = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_TEXT;
- lvItem.iItem = itemIndex;
- lvItem.pszText = pszText;
- lvItem.iSubItem = index;
- OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem);
- OS.HeapFree (hHeap, 0, pszText);
-}
-
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int index = parent.indexOf (this);
- if (index == -1) return;
- super.setText (string);
- int hwnd = parent.handle;
- LVITEM lvItem = new LVITEM ();
- lvItem.mask = OS.LVIF_TEXT;
- lvItem.iItem = index;
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- lvItem.pszText = pszText;
- if (OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem) != 0) {
- parent.setScrollWidth ();
- }
- OS.HeapFree (hHeap, 0, pszText);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
deleted file mode 100755
index 97766931a8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
+++ /dev/null
@@ -1,1763 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class are selectable user interface
- * objects that allow the user to enter and modify text.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
- * <dt><b>Events:</b></dt>
- * <dd>DefaultSelection, Modify, Verify</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Text extends Scrollable {
- int tabs, oldStart, oldEnd;
- boolean doubleClick, ignoreVerify, ignoreCharacter;
-
- public static final int LIMIT;
- public static final String DELIMITER;
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- static {
- LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
- DELIMITER = "\r\n";
- }
-
- static final int EditProc;
- static final TCHAR EditClass = new TCHAR (0, "EDIT", true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, EditClass, lpWndClass);
- EditProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Text (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (EditProc, handle, msg, wParam, lParam);
-}
-
-void createHandle () {
- super.createHandle ();
- OS.SendMessage (handle, OS.EM_LIMITTEXT, 0, 0);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is not called for texts.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is verified, by sending
- * it one of the messages defined in the <code>VerifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #removeVerifyListener
- */
-public void addVerifyListener (VerifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Verify, typedListener);
-}
-
-/**
- * Appends a string.
- * <p>
- * The new text is appended to the text at
- * the end of the widget.
- * </p>
- *
- * @param string the string to be appended
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void append (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- string = Display.withCrLf (string);
- int length = OS.GetWindowTextLength (handle);
- if (hooks (SWT.Verify)) {
- string = verifyText (string, length, length);
- if (string == null) return;
- }
- OS.SendMessage (handle, OS.EM_SETSEL, length, length);
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
-}
-
-static int checkStyle (int style) {
- if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
- if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) return style | SWT.MULTI;
- return style | SWT.SINGLE;
-}
-
-/**
- * Clears the selection.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void clearSelection () {
- checkWidget ();
- if (OS.IsWinCE) {
- /*
- * Bug in WinCE. Calling EM_SETSEL with -1 and 0 is equivalent
- * to calling EM_SETSEL with 0 and -1. It causes the entire
- * text to be selected instead of clearing the selection. The
- * fix is to set the start of the selection to the end of the
- * current selection.
- */
- int [] end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, (int []) null, end);
- OS.SendMessage (handle, OS.EM_SETSEL, end [0], end [0]);
- } else {
- OS.SendMessage (handle, OS.EM_SETSEL, -1, 0);
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- int count = OS.SendMessage (handle, OS.EM_GETLINECOUNT, 0, 0);
- int height = count * tm.tmHeight, width = 0;
- RECT rect = new RECT ();
- int flags = OS.DT_CALCRECT | OS.DT_EDITCONTROL | OS.DT_NOPREFIX;
- if ((style & SWT.WRAP) != 0 && wHint != SWT.DEFAULT) {
- flags |= OS.DT_WORDBREAK;
- rect.right = wHint;
- }
- String text = getText ();
- TCHAR buffer = new TCHAR (getCodePage (), text, false);
- OS.DrawText (hDC, buffer, buffer.length (), rect, flags);
- width = rect.right - rect.left;
- if ((style & SWT.WRAP) != 0 && hHint == SWT.DEFAULT) {
- int newHeight = rect.bottom - rect.top;
- if (newHeight != 0) height = newHeight;
- }
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
-
- /* Calculate the margin width */
- int margins = OS.SendMessage(handle, OS.EM_GETMARGINS, 0, 0);
- int marginWidth = (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF);
- width += marginWidth;
-
- /*
- * Bug in Windows. For some reason, despite the fact
- * that there is a 1-pixel margin height on a simple
- * text widget with a border, EM_GETRECT returns 0.
- * The fix is to detect this case and make the margin
- * height 1.
- */
- RECT editRect = new RECT ();
- OS.SendMessage (handle, OS.EM_GETRECT, 0, rect);
- if ((style & SWT.BORDER) != 0 && editRect.top == 0) {
- editRect.top = 1;
- }
-
- /*
- * The preferred height of a single-line text widget
- * has been hand-crafted to be the same height as
- * the single-line text widget in an editable combo
- * box.
- */
- width += editRect.left * 2;
- height += editRect.top * 2;
- if ((style & SWT.V_SCROLL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- }
- if ((style & SWT.H_SCROLL) != 0) {
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- if ((style & SWT.BORDER) == 0) width++;
- }
- if ((style & SWT.BORDER) != 0) {
- int border = getBorderWidth ();
- width += (border * 2) + 3;
- height += (border * 2) + 1;
- }
- return new Point (width, height);
-}
-
-/**
- * Copies the selected text.
- * <p>
- * The current selection is copied to the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void copy () {
- checkWidget ();
- OS.SendMessage (handle, OS.WM_COPY, 0, 0);
-}
-
-ScrollBar createScrollBar (int type) {
- return new ScrollBar (this, type);
-}
-
-void createWidget () {
- super.createWidget ();
- doubleClick = true;
- setTabStops (tabs = 8);
-}
-
-/**
- * Cuts the selected text.
- * <p>
- * The current selection is first copied to the
- * clipboard and then deleted from the widget.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void cut () {
- checkWidget ();
- OS.SendMessage (handle, OS.WM_CUT, 0, 0);
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_WINDOW);
-}
-
-/**
- * Gets the line number of the caret.
- * <p>
- * The line number of the caret is returned.
- * </p>
- *
- * @return the line number
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretLineNumber () {
- checkWidget ();
- return OS.SendMessage (handle, OS.EM_LINEFROMCHAR, -1, 0);
-}
-
-/**
- * Gets the location the caret.
- * <p>
- * The location of the caret is returned.
- * </p>
- *
- * @return a point, the location of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getCaretLocation () {
- checkWidget ();
- /*
- * Bug in Windows. For some reason, Windows is unable
- * to return the pixel coordinates of the last character
- * in the widget. The fix is to temporarily insert a
- * space, query the coordinates and delete the space.
- * The selection is always an i-beam in this case because
- * this is the only time the start of the selection can
- * be equal to the last character position in the widget.
- * If EM_POSFROMCHAR fails for any other reason, return
- * pixel coordinates (0,0).
- */
- int [] start = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, (int []) null);
- int pos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, start [0], 0);
- if (pos == -1) {
- pos = 0;
- if (start [0] >= OS.GetWindowTextLength (handle)) {
- int cp = getCodePage ();
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, new TCHAR (cp, " ", true));
- pos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, start [0], 0);
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], start [0] + 1);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, new TCHAR (cp, "", true));
- }
- }
- return new Point ((short) (pos & 0xFFFF), (short) (pos >> 16));
-}
-
-/**
- * Gets the position of the caret.
- * <p>
- * The character position of the caret is returned.
- * </p>
- *
- * @return the position of the caret
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCaretPosition () {
- checkWidget ();
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- int startLine = OS.SendMessage (handle, OS.EM_LINEFROMCHAR, start [0], 0);
- int caretPos = OS.SendMessage (handle, OS.EM_LINEINDEX, -1, 0);
- int caretLine = OS.SendMessage (handle, OS.EM_LINEFROMCHAR, caretPos, 0);
- int caret = end [0];
- if (caretLine == startLine) caret = start [0];
- if (OS.IsDBLocale) caret = mbcsToWcsPos (caret);
- return caret;
-}
-
-/**
- * Gets the number of characters.
- *
- * @return number of characters in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getCharCount () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (OS.IsDBLocale) length = mbcsToWcsPos (length);
- return length;
-}
-
-String getClipboardText () {
- String string = "";
- if (OS.OpenClipboard (0)) {
- int hMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT);
- if (hMem != 0) {
- int byteCount = OS.GlobalSize (hMem);
- int ptr = OS.GlobalLock (hMem);
- if (ptr != 0) {
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, byteCount / TCHAR.sizeof);
- OS.MoveMemory (buffer, ptr, byteCount);
- string = buffer.toString (0, buffer.strlen ());
- OS.GlobalUnlock (hMem);
- }
- }
- OS.CloseClipboard ();
- }
- return string;
-}
-
-/**
- * Gets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getDoubleClickEnabled () {
- checkWidget ();
- return doubleClick;
-}
-
-/**
- * Gets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public char getEchoChar () {
- checkWidget ();
- char echo = (char) OS.SendMessage (handle, OS.EM_GETPASSWORDCHAR, 0, 0);
- if (echo != 0 && (echo = mbcsToWcs (echo, getCodePage ())) == 0) echo = '*';
- return echo;
-}
-
-/**
- * Gets the editable state.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEditable () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- return (bits & OS.ES_READONLY) == 0;
-}
-
-/**
- * Gets the number of lines.
- *
- * @return the number of lines in the widget
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.EM_GETLINECOUNT, 0, 0);
-}
-
-/**
- * Gets the line delimiter.
- *
- * @return a string that is the line delimiter
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getLineDelimiter () {
- checkWidget ();
- return DELIMITER;
-}
-
-/**
- * Gets the height of a line.
- *
- * @return the height of a row of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getLineHeight () {
- checkWidget ();
- int newFont, oldFont = 0;
- int hDC = OS.GetDC (handle);
- newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- return tm.tmHeight;
-}
-
-/**
- * Gets the position of the selected text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p>
- *
- * @return the start and end of the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start [0]);
- end [0] = mbcsToWcsPos (end [0]);
- }
- return new Point (start [0], end [0]);
-}
-
-/**
- * Gets the number of selected characters.
- *
- * @return the number of selected characters.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- Point selection = getSelection ();
- return selection.y - selection.x;
-}
-
-/**
- * Gets the selected text.
- *
- * @return the selected text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getSelectionText () {
- checkWidget ();
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- Point selection = getSelection ();
- return getText ().substring (selection.x, selection.y);
-}
-
-/**
- * Gets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @return the number of tab characters
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTabs () {
- checkWidget ();
- return tabs;
-}
-
-int getTabWidth (int tabs) {
- int oldFont = 0;
- RECT rect = new RECT ();
- int hDC = OS.GetDC (handle);
- int newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
- int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
- TCHAR SPACE = new TCHAR (getCodePage (), " ", true);
- OS.DrawText (hDC, SPACE, SPACE.length (), rect, flags);
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- return (rect.right - rect.left) * tabs;
-}
-
-/**
- * Gets the widget text.
- * <p>
- * The text for a text widget is the characters in the widget.
- * </p>
- *
- * @return the widget text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- int length = OS.GetWindowTextLength (handle);
- if (length == 0) return "";
- TCHAR buffer = new TCHAR (getCodePage (), length + 1);
- OS.GetWindowText (handle, buffer, length + 1);
- return buffer.toString (0, length);
-}
-
-/**
- * Gets a range of text.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N-1 where N is
- * the number of characters in the widget.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- * @return the range of text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText (int start, int end) {
- checkWidget ();
- /*
- * NOTE: The current implementation uses substring ()
- * which can reference a potentially large character
- * array.
- */
- return getText ().substring (start, end + 1);
-}
-
-/**
- * Returns the maximum number of characters that the receiver is capable of holding.
- * <p>
- * If this has not been changed by <code>setTextLimit()</code>,
- * it will be the constant <code>Text.LIMIT</code>.
- * </p>
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- return OS.SendMessage (handle, OS.EM_GETLIMITTEXT, 0, 0);
-}
-
-/**
- * Returns the zero-relative index of the line which is currently
- * at the top of the receiver.
- * <p>
- * This index can change when lines are scrolled or new lines are added or removed.
- * </p>
- *
- * @return the index of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopIndex () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) return 0;
- return OS.SendMessage (handle, OS.EM_GETFIRSTVISIBLELINE, 0, 0);
-}
-
-/**
- * Gets the top pixel.
- * <p>
- * The top pixel is the pixel position of the line
- * that is currently at the top of the widget. On
- * some platforms, a text widget can be scrolled by
- * pixels instead of lines so that a partial line
- * is displayed at the top of the widget.
- * </p><p>
- * The top pixel changes when the widget is scrolled.
- * The top pixel does not include the widget trimming.
- * </p>
- *
- * @return the pixel position of the top line
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTopPixel () {
- checkWidget ();
- /*
- * Note, EM_GETSCROLLPOS is implemented in Rich Edit 3.0
- * and greater. The plain text widget and previous versions
- * of Rich Edit return zero.
- */
- int [] buffer = new int [2];
- int code = OS.SendMessage (handle, OS.EM_GETSCROLLPOS, 0, buffer);
- if (code == 1) return buffer [1];
- return getTopIndex () * getLineHeight ();
-}
-
-/*
-* Currently not used.
-*/
-boolean getWrap () {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) return false;
- return (bits & (OS.WS_HSCROLL | OS.ES_AUTOHSCROLL)) == 0;
-}
-
-/**
- * Inserts a string.
- * <p>
- * The old selection is replaced with the new text.
- * </p>
- *
- * @param string the string
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void insert (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- string = Display.withCrLf (string);
- if (hooks (SWT.Verify)) {
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- string = verifyText (string, start [0], end [0]);
- if (string == null) return;
- }
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
-}
-
-int mbcsToWcsPos (int mbcsPos) {
- if (mbcsPos == 0) return 0;
- if (OS.IsUnicode) return mbcsPos;
- int cp = getCodePage ();
- int wcsTotal = 0, mbcsTotal = 0;
- byte [] buffer = new byte [128];
- String delimiter = getLineDelimiter();
- int delimiterSize = delimiter.length ();
- int count = OS.SendMessageA (handle, OS.EM_GETLINECOUNT, 0, 0);
- for (int line=0; line<count; line++) {
- int wcsSize = 0;
- int linePos = OS.SendMessageA (handle, OS.EM_LINEINDEX, line, 0);
- int mbcsSize = OS.SendMessageA (handle, OS.EM_LINELENGTH, linePos, 0);
- if (mbcsSize != 0) {
- if (mbcsSize + delimiterSize > buffer.length) {
- buffer = new byte [mbcsSize + delimiterSize];
- }
- buffer [0] = (byte) (mbcsSize & 0xFF);
- buffer [1] = (byte) (mbcsSize >> 8);
- mbcsSize = OS.SendMessageA (handle, OS.EM_GETLINE, line, buffer);
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, mbcsSize, null, 0);
- }
- if (line - 1 != count) {
- for (int i=0; i<delimiterSize; i++) {
- buffer [mbcsSize++] = (byte) delimiter.charAt (i);
- }
- wcsSize += delimiterSize;
- }
- if ((mbcsTotal + mbcsSize) >= mbcsPos) {
- int bufferSize = mbcsPos - mbcsTotal;
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, bufferSize, null, 0);
- return wcsTotal + wcsSize;
- }
- wcsTotal += wcsSize;
- mbcsTotal += mbcsSize;
- }
- return wcsTotal;
-}
-
-/**
- * Pastes text from clipboard.
- * <p>
- * The selected text is deleted from the widget
- * and new text inserted from the clipboard.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void paste () {
- checkWidget ();
- OS.SendMessage (handle, OS.WM_PASTE, 0, 0);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Modify, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is verified.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see VerifyListener
- * @see #addVerifyListener
- */
-public void removeVerifyListener (VerifyListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Verify, listener);
-}
-
-/**
- * Selects all the text in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- OS.SendMessage (handle, OS.EM_SETSEL, 0, -1);
-}
-
-boolean sendKeyEvent (int type, int msg, int wParam, int lParam, Event event) {
- if (!super.sendKeyEvent (type, msg, wParam, lParam, event)) {
- return false;
- }
- if (ignoreVerify) return true;
- if (type != SWT.KeyDown) return true;
- if (msg != OS.WM_CHAR && msg != OS.WM_KEYDOWN && msg != OS.WM_IME_CHAR) {
- return true;
- }
- if (event.character == 0) return true;
- if (!hooks (SWT.Verify)) return true;
- char key = event.character;
- int stateMask = event.stateMask;
-
- /* Disable all magic keys that could modify the text */
- switch (msg) {
- case OS.WM_CHAR:
- if (key != 0x08 && key != 0x7F && key != '\r' && key != '\t' && key != '\n') break;
- // FALL THROUGH
- case OS.WM_KEYDOWN:
- if ((stateMask & (SWT.CTRL | SWT.SHIFT | SWT.ALT)) != 0) return false;
- break;
- }
-
- /*
- * If the left button is down, the text widget
- * refuses the character.
- */
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) {
- return true;
- }
-
- /* Verify the character */
- String oldText = "";
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- switch (key) {
- case 0x08: /* Bs */
- if (start [0] == end [0]) {
- if (start [0] == 0) return true;
- int lineStart = OS.SendMessage (handle, OS.EM_LINEINDEX, -1, 0);
- if (start [0] == lineStart) {
- start [0] = start [0] - DELIMITER.length ();
- } else {
- start [0] = start [0] - 1;
- if (OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (handle, OS.EM_GETSEL, newStart, newEnd);
- if (start [0] != newStart [0]) start [0] = start [0] - 1;
- }
- }
- start [0] = Math.max (start [0], 0);
- }
- break;
- case 0x7F: /* Del */
- if (start [0] == end [0]) {
- int length = OS.GetWindowTextLength (handle);
- if (start [0] == length) return true;
- int line = OS.SendMessage (handle, OS.EM_LINEFROMCHAR, end [0], 0);
- int lineStart = OS.SendMessage (handle, OS.EM_LINEINDEX, line + 1, 0);
- if (end [0] == lineStart - DELIMITER.length ()) {
- end [0] = end [0] + DELIMITER.length ();
- } else {
- end [0] = end [0] + 1;
- if (OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (handle, OS.EM_GETSEL, newStart, newEnd);
- if (end [0] != newEnd [0]) end [0] = end [0] + 1;
- }
- }
- end [0] = Math.min (end [0], length);
- }
- break;
- case '\r': /* Return */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) return true;
- oldText = DELIMITER;
- break;
- default: /* Tab and other characters */
- if (key != '\t' && key < 0x20) return true;
- oldText = new String (new char [] {key});
- break;
- }
- String newText = verifyText (oldText, start [0], end [0], event);
- if (newText == null) return false;
- if (newText == oldText) return true;
- newText = Display.withCrLf (newText);
- TCHAR buffer = new TCHAR (getCodePage (), newText, true);
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- return false;
-}
-
-/**
- * Sets the double click enabled flag.
- * <p>
- * The double click flag enables or disables the
- * default action of the text widget when the user
- * double clicks.
- * </p>
- *
- * @param doubleClick the new double click flag
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDoubleClickEnabled (boolean doubleClick) {
- checkWidget ();
- this.doubleClick = doubleClick;
-}
-
-/**
- * Sets the echo character.
- * <p>
- * The echo character is the character that is
- * displayed when the user enters text or the
- * text is changed by the programmer.
- * </p>
- *
- * @param echo the new echo character
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEchoChar (char echo) {
- checkWidget ();
- if (echo != 0) {
- if ((echo = (char) wcsToMbcs (echo, getCodePage ())) == 0) echo = '*';
- }
- OS.SendMessage (handle, OS.EM_SETPASSWORDCHAR, echo, 0);
- /*
- * Bug in Windows. When the password character is changed,
- * Windows does not redraw to show the new password character.
- * The fix is to force a redraw when the character is set.
- */
- OS.InvalidateRect (handle, null, true);
-}
-
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- style &= ~SWT.READ_ONLY;
- if (!editable) style |= SWT.READ_ONLY;
- OS.SendMessage (handle, OS.EM_SETREADONLY, editable ? 0 : 1, 0);
-}
-
-public void setFont (Font font) {
- checkWidget ();
- super.setFont (font);
- setTabStops (tabs);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * regular array indexing rules.
- * </p>
- *
- * @param start new caret position
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start) {
- checkWidget ();
- if (OS.IsDBLocale) start = wcsToMbcsPos (start);
- OS.SendMessage (handle, OS.EM_SETSEL, start, start);
- OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (int start, int end) {
- checkWidget ();
- if (OS.IsDBLocale) {
- start = wcsToMbcsPos (start);
- end = wcsToMbcsPos (end);
- }
- OS.SendMessage (handle, OS.EM_SETSEL, start, end);
- OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
-}
-
-public void setRedraw (boolean redraw) {
- checkWidget ();
- super.setRedraw (redraw);
- /*
- * Feature in Windows. When WM_SETREDRAW is used to turn
- * redraw off, the text control is not scrolled to show the
- * i-beam. The fix is to detect that the i-beam has moved
- * while redraw is turned off and force it to be visible
- * when redraw is restored.
- */
- if (drawCount != 0) return;
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (!redraw) {
- oldStart = start [0]; oldEnd = end [0];
- return;
- }
- if (oldStart == start [0] && oldEnd == end [0]) return;
- OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
-}
-
-/**
- * Sets the selection.
- * <p>
- * Indexing is zero based. The range of
- * a selection is from 0..N where N is
- * the number of characters in the widget.
- * </p><p>
- * Text selections are specified in terms of
- * caret positions. In a text widget that
- * contains N characters, there are N+1 caret
- * positions, ranging from 0..N. This differs
- * from other functions that address character
- * position such as getText () that use the
- * usual array indexing rules.
- * </p>
- *
- * @param selection the point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget ();
- if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSelection (selection.x, selection.y);
-}
-
- /**
- * Sets the number of tabs.
- * <p>
- * Tab stop spacing is specified in terms of the
- * space (' ') character. The width of a single
- * tab stop is the pixel width of the spaces.
- * </p>
- *
- * @param tabs the number of tabs
- *
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
-*/
-public void setTabs (int tabs) {
- checkWidget ();
- if (tabs < 0) return;
- setTabStops (this.tabs = tabs);
-}
-
-void setTabStops (int tabs) {
- /*
- * Feature in Windows. Windows expects the tab spacing in
- * dialog units so we must convert from space widths. Due
- * to round off error, the tab spacing may not be the exact
- * number of space widths, depending on the font.
- */
- int width = (getTabWidth (tabs) * 4) / (OS.GetDialogBaseUnits () & 0xFFFF);
- OS.SendMessage (handle, OS.EM_SETTABSTOPS, 1, new int [] {width});
-}
-
-/**
- * Sets the contents of the receiver to the given string.
- *
- * @param text the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- string = Display.withCrLf (string);
- if (hooks (SWT.Verify)) {
- int length = OS.GetWindowTextLength (handle);
- string = verifyText (string, 0, length);
- if (string == null) return;
- }
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SetWindowText (handle, buffer);
- /*
- * Bug in Windows. When the widget is multi line
- * text widget, it does not send a WM_COMMAND with
- * control code EN_CHANGE from SetWindowText () to
- * notify the application that the text has changed.
- * The fix is to send the event.
- */
- if ((style & SWT.MULTI) != 0) {
- sendEvent (SWT.Modify);
- // widget could be disposed at this point
- }
-}
-
-/**
- * Sets the maximum number of characters that the receiver
- * is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget ();
- if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- OS.SendMessage (handle, OS.EM_SETLIMITTEXT, limit, 0);
-}
-
-/**
- * Sets the zero-relative index of the line which is currently
- * at the top of the receiver. This index can change when lines
- * are scrolled or new lines are added and removed.
- *
- * @param index the index of the top item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTopIndex (int index) {
- checkWidget ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) return;
- int count = OS.SendMessage (handle, OS.EM_GETLINECOUNT, 0, 0);
- index = Math.min (Math.max (index, 0), count - 1);
- int topIndex = OS.SendMessage (handle, OS.EM_GETFIRSTVISIBLELINE, 0, 0);
- OS.SendMessage (handle, OS.EM_LINESCROLL, 0, index - topIndex);
-}
-
-/*
-* Not currently used.
-*/
-void setWrap (boolean wrap) {
- if (wrap == getWrap ()) return;
- style &= ~SWT.WRAP;
- if (wrap) style |= SWT.WRAP;
-}
-
-/**
- * Shows the selection.
- * <p>
- * If the selection is already showing
- * in the receiver, this method simply returns. Otherwise,
- * lines are scrolled until the selection is visible.
- * </p>
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void showSelection () {
- checkWidget ();
- OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
-}
-
-String verifyText (String string, int start, int end) {
- return verifyText (string, start, end, null);
-}
-
-String verifyText (String string, int start, int end, Event keyEvent) {
- if (ignoreVerify) return string;
- Event event = new Event ();
- event.text = string;
- event.start = start;
- event.end = end;
- if (keyEvent != null) {
- event.character = keyEvent.character;
- event.keyCode = keyEvent.keyCode;
- event.stateMask = keyEvent.stateMask;
- }
- if (OS.IsDBLocale) {
- event.start = mbcsToWcsPos (start);
- event.end = mbcsToWcsPos (end);
- }
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the verify
- * event. If this happens, answer null to cancel
- * the operation.
- */
- sendEvent (SWT.Verify, event);
- if (!event.doit || isDisposed ()) return null;
- return event.text;
-}
-
-int wcsToMbcsPos (int wcsPos) {
- if (wcsPos == 0) return 0;
- if (OS.IsUnicode) return wcsPos;
- int cp = getCodePage ();
- int wcsTotal = 0, mbcsTotal = 0;
- byte [] buffer = new byte [128];
- String delimiter = getLineDelimiter ();
- int delimiterSize = delimiter.length ();
- int count = OS.SendMessageA (handle, OS.EM_GETLINECOUNT, 0, 0);
- for (int line=0; line<count; line++) {
- int wcsSize = 0;
- int linePos = OS.SendMessageA (handle, OS.EM_LINEINDEX, line, 0);
- int mbcsSize = OS.SendMessageA (handle, OS.EM_LINELENGTH, linePos, 0);
- if (mbcsSize != 0) {
- if (mbcsSize + delimiterSize > buffer.length) {
- buffer = new byte [mbcsSize + delimiterSize];
- }
- //ENDIAN
- buffer [0] = (byte) (mbcsSize & 0xFF);
- buffer [1] = (byte) (mbcsSize >> 8);
- mbcsSize = OS.SendMessageA (handle, OS.EM_GETLINE, line, buffer);
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, mbcsSize, null, 0);
- }
- if (line - 1 != count) {
- for (int i=0; i<delimiterSize; i++) {
- buffer [mbcsSize++] = (byte) delimiter.charAt (i);
- }
- wcsSize += delimiterSize;
- }
- if ((wcsTotal + wcsSize) >= wcsPos) {
- wcsSize = 0;
- int index = 0;
- while (index < mbcsSize) {
- if ((wcsTotal + wcsSize) == wcsPos) {
- return mbcsTotal + index;
- }
- if (OS.IsDBCSLeadByte (buffer [index++])) index++;
- wcsSize++;
- }
- return mbcsTotal + mbcsSize;
- }
- wcsTotal += wcsSize;
- mbcsTotal += mbcsSize;
- }
- return mbcsTotal;
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle ();
- if ((style & SWT.READ_ONLY) != 0) bits |= OS.ES_READONLY;
- if ((style & SWT.SINGLE) != 0) return bits | OS.ES_AUTOHSCROLL;
- bits |= OS.ES_MULTILINE | OS.ES_AUTOHSCROLL | OS.ES_NOHIDESEL;
- if ((style & SWT.WRAP) != 0) bits &= ~(OS.WS_HSCROLL | OS.ES_AUTOHSCROLL);
- return bits;
-}
-
-TCHAR windowClass () {
- return EditClass;
-}
-
-int windowProc () {
- return EditProc;
-}
-
-LRESULT WM_CHAR (int wParam, int lParam) {
- if (ignoreCharacter) return null;
- LRESULT result = super.WM_CHAR (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. For some reason, when the
- * widget is a single line text widget, when the
- * user presses tab, return or escape, Windows beeps.
- * The fix is to look for these keys and not call
- * the window proc.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) {
- switch (wParam) {
- case OS.VK_RETURN:
- postEvent (SWT.DefaultSelection);
- // FALL THROUGH
- case OS.VK_TAB:
- case OS.VK_ESCAPE: return LRESULT.ZERO;
- }
- }
- return result;
-}
-
-LRESULT WM_CLEAR (int wParam, int lParam) {
- LRESULT result = super.WM_CLEAR (wParam, lParam);
- if (result != null) return result;
- if (!hooks (SWT.Verify)) return result;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_READONLY) != 0) return result;
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (start [0] == end [0]) return result;
- String newText = verifyText ("", start [0], end [0]);
- if (newText == null) return LRESULT.ZERO;
- if (newText.length () != 0) {
- result = new LRESULT (callWindowProc (OS.WM_CLEAR, 0, 0));
- newText = Display.withCrLf (newText);
- TCHAR buffer = new TCHAR (getCodePage (), newText, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- }
- return result;
-}
-
-LRESULT WM_CUT (int wParam, int lParam) {
- LRESULT result = super.WM_CUT (wParam, lParam);
- if (result != null) return result;
- if (!hooks (SWT.Verify)) return result;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_READONLY) != 0) return result;
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (start [0] == end [0]) return result;
- String newText = verifyText ("", start [0], end [0]);
- if (newText == null) return LRESULT.ZERO;
- if (newText.length () != 0) {
- result = new LRESULT (callWindowProc (OS.WM_CUT, 0, 0));
- newText = Display.withCrLf (newText);
- TCHAR buffer = new TCHAR (getCodePage (), newText, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- }
- return result;
-}
-
-LRESULT WM_IME_CHAR (int wParam, int lParam) {
-
- /* Process a DBCS character */
- Display display = getDisplay ();
- display.lastKey = 0;
- display.lastAscii = wParam;
- display.lastVirtual = false;
- if (!sendKeyEvent (SWT.KeyDown, OS.WM_IME_CHAR, wParam, lParam)) {
- return LRESULT.ZERO;
- }
- sendKeyEvent (SWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam);
- display.lastKey = display.lastAscii = 0;
-
- /*
- * Feature in Windows. The Windows text widget uses
- * two 2 WM_CHAR's to process a DBCS key instead of
- * using WM_IME_CHAR. The fix is to allow the text
- * widget to get the WM_CHAR's but ignore sending
- * them to the application.
- */
- ignoreCharacter = true;
- int result = callWindowProc (OS.WM_IME_CHAR, wParam, lParam);
- MSG msg = new MSG ();
- while (OS.PeekMessage (msg, handle, OS.WM_CHAR, OS.WM_CHAR, OS.PM_REMOVE)) {
- OS.TranslateMessage (msg);
- OS.DispatchMessage (msg);
- }
- ignoreCharacter = false;
- return new LRESULT (result);
-}
-
-LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
- /*
- * Prevent Windows from processing WM_LBUTTONDBLCLK
- * when double clicking behavior is disabled by not
- * calling the window proc.
- */
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_LBUTTONDBLCLK, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- if (!doubleClick) return LRESULT.ZERO;
-
- /*
- * Bug in Windows. When the last line of text in the
- * widget is double clicked and the line is empty, Windows
- * hides the i-beam then moves it to the first line in
- * the widget but does not scroll to show the user.
- * If the user types without clicking the mouse, invalid
- * characters are displayed at the end of each line of
- * text in the widget. The fix is to detect this case
- * and avoid calling the window proc.
- */
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (start [0] == end [0]) {
- int length = OS.GetWindowTextLength (handle);
- if (length == start [0]) {
- int result = OS.SendMessage (handle, OS.EM_LINELENGTH, length, 0);
- if (result == 0) return LRESULT.ZERO;
- }
- }
- return null;
-}
-
-LRESULT WM_PASTE (int wParam, int lParam) {
- LRESULT result = super.WM_PASTE (wParam, lParam);
- if (result != null) return result;
- if (!hooks (SWT.Verify)) return result;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_READONLY) != 0) return result;
- String oldText = getClipboardText ();
- if (oldText == null) return result;
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- String newText = verifyText (oldText, start [0], end [0]);
- if (newText == null) return LRESULT.ZERO;
- if (newText != oldText) {
- newText = Display.withCrLf (newText);
- TCHAR buffer = new TCHAR (getCodePage (), newText, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- return LRESULT.ZERO;
- }
- return result;
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- // widget may be disposed at this point
- if (handle == 0) return result;
-
- /*
- * Feature in Windows. When the caret is moved,
- * the text widget scrolls to show the new location.
- * This means that the text widget may be scrolled
- * to the left in order to show the caret when the
- * widget is not large enough to show both the caret
- * location and all the text. Unfortunately, when
- * the text widget is resized such that all the text
- * and the caret could be visible, Windows does not
- * scroll the widget back. The fix is to save the
- * current selection, set the selection to the start
- * of the text and then restore the selection. This
- * will cause the text widget recompute the left
- * scroll position.
- *
- * NOTE: Currently, this work around is only applied
- * to single line text widgets that are not visible.
- * If the widget is resized when it is visible, this
- * is fine because the user has already seen that the
- * text is scrolled.
- */
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) != 0) return result;
- if (OS.IsWindowVisible (handle)) return result;
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (start [0] == 0 && end [0] == 0) return result;
- OS.SendMessage (handle, OS.EM_SETSEL, 0, 0);
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- return result;
-}
-
-LRESULT WM_UNDO (int wParam, int lParam) {
- LRESULT result = super.WM_UNDO (wParam, lParam);
- if (result != null) return result;
- if (!hooks (SWT.Verify)) return result;
-
- /* Undo and then Redo to get the Undo text */
- if (OS.SendMessage (handle, OS.EM_CANUNDO, 0, 0) == 0) {
- return result;
- }
- ignoreVerify = true;
- callWindowProc (OS.WM_UNDO, wParam, lParam);
- String oldText = getSelectionText ();
- callWindowProc (OS.WM_UNDO, wParam, lParam);
- ignoreVerify = false;
-
- /* Verify the Undo operation */
- int [] start = new int [1], end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- String newText = verifyText (oldText, start [0], end [0]);
- if (newText == null) return LRESULT.ZERO;
- if (newText != oldText) {
- newText = Display.withCrLf (newText);
- TCHAR buffer = new TCHAR (getCodePage (), newText, true);
- OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer);
- return LRESULT.ZERO;
- }
-
- /* Do the original Undo */
- ignoreVerify = true;
- callWindowProc (OS.WM_UNDO, wParam, lParam);
- ignoreVerify = false;
- return LRESULT.ONE;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- int code = wParam >> 16;
- switch (code) {
- case OS.EN_CHANGE:
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the modify
- * event. If this happens, end the processing of the
- * Windows message by returning zero as the result of
- * the window proc.
- */
- sendEvent (SWT.Modify);
- if (isDisposed ()) return LRESULT.ZERO;
- break;
- }
- return super.wmCommandChild (wParam, lParam);
-}
-
-LRESULT wmScroll (int msg, int wParam, int lParam) {
- int code = callWindowProc (msg, wParam, lParam);
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
deleted file mode 100755
index b50c39e93d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
+++ /dev/null
@@ -1,783 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class support the layout of selectable
- * tool bar items.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>ToolItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class ToolBar extends Composite {
- int lastFocusId;
- ToolItem [] items;
- ImageList imageList, disabledImageList, hotImageList;
- static final int ToolBarProc;
- static final TCHAR ToolBarClass = new TCHAR (0, OS.TOOLBARCLASSNAME, true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, ToolBarClass, lpWndClass);
- ToolBarProc = lpWndClass.lpfnWndProc;
- }
-
- /*
- * From the Windows SDK for TB_SETBUTTONSIZE:
- *
- * "If an application does not explicitly
- * set the button size, the size defaults
- * to 24 by 22 pixels".
- */
- static final int DEFAULT_WIDTH = 24;
- static final int DEFAULT_HEIGHT = 22;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolBar (Composite parent, int style) {
- super (parent, checkStyle (style));
- /*
- * Ensure that either of HORIZONTAL or VERTICAL is set.
- * NOTE: HORIZONTAL and VERTICAL have the same values
- * as H_SCROLL and V_SCROLL so it is necessary to first
- * clear these bits to avoid scroll bars and then reset
- * the bits using the original style supplied by the
- * programmer.
- */
- this.style = checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- /*
- * Bug in Windows. For some reason, during the processing
- * of WM_SYSCHAR, the tool bar window proc does not call the
- * default window proc causing mnemonics for the menu bar
- * to be ignored. The fix is to always call the default
- * window proc for WM_SYSCHAR.
- */
- if (msg == OS.WM_SYSCHAR) {
- return OS.DefWindowProc (handle, msg, wParam, lParam);
- }
- return OS.CallWindowProc (ToolBarProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- /*
- * On Windows, only flat tool bars can be traversed.
- */
- if ((style & SWT.FLAT) == 0) style |= SWT.NO_FOCUS;
-
- /*
- * A vertical tool bar cannot wrap because TB_SETROWS
- * fails when the toobar has TBSTYLE_WRAPABLE.
- */
- /*
- * This code is intentionally commented.
- */
- //if ((style & SWT.VERTICAL) != 0) style &= ~SWT.WRAP;
-
- /*
- * The TB_SETROWS calls are currently commented, so force
- * the wrap style if this bar is vertical.
- */
- if ((style & SWT.VERTICAL) != 0) style |= SWT.WRAP;
-
- /*
- * Even though it is legal to create this widget
- * with scroll bars, they serve no useful purpose
- * because they do not automatically scroll the
- * widget's client area. The fix is to clear
- * the SWT style.
- */
- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- if (layout != null) {
- return super.computeSize (wHint, hHint, changed);
- }
- int width = 0, height = 0;
- RECT oldRect = new RECT ();
- OS.GetWindowRect (handle, oldRect);
- int oldWidth = oldRect.right - oldRect.left;
- int oldHeight = oldRect.bottom - oldRect.top;
- int newWidth = wHint, newHeight = hHint;
- if (newWidth == SWT.DEFAULT) newWidth = 0x3FFF;
- if (newHeight == SWT.DEFAULT) newHeight = 0x3FFF;
- boolean redraw = drawCount == 0 && OS.IsWindowVisible (handle);
- if (redraw) {
- OS.UpdateWindow (handle);
- /*
- * This line is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
- }
- int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER;
- OS.SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags);
- int count = OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
- if (count != 0) {
- RECT rect = new RECT ();
- OS.SendMessage (handle, OS.TB_GETITEMRECT, count - 1, rect);
- width = Math.max (width, rect.right);
- height = Math.max (height, rect.bottom);
- }
- OS.SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags);
- if (redraw) {
- /*
- * This line is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, false);
- OS.UpdateWindow (handle);
- } else {
- int uFlags = OS.RDW_INVALIDATE | OS.RDW_UPDATENOW;
- OS.RedrawWindow (handle, null, 0, uFlags);
- }
- }
-
- /*
- * From the Windows SDK for TB_SETBUTTONSIZE:
- *
- * "If an application does not explicitly
- * set the button size, the size defaults
- * to 24 by 22 pixels".
- */
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- Rectangle trim = computeTrim (0, 0, width, height);
- width = trim.width; height = trim.height;
- return new Point (width, height);
-}
-
-
-public Rectangle computeTrim (int x, int y, int width, int height) {
- checkWidget ();
- Rectangle trim = super. computeTrim (x, y, width, height);
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.CCS_NODIVIDER) == 0) trim.height += 2;
- return trim;
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-
- /*
- * Feature in Windows. Despite the fact that the
- * tool tip text contains \r\n, the tooltip will
- * not honour the new line unless TTM_SETMAXTIPWIDTH
- * is set. The fix is to set TTM_SETMAXTIPWIDTH to
- * a large value.
- */
- int hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0);
- /*
- * This line is intentionally commented. The tool
- * bar currently sets this value to 300 so it is
- * not necessary to set TTM_SETMAXTIPWIDTH.
- */
-// OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
-
- /*
- * Feature in Windows. When the tool tip control is
- * created, the parent of the tool tip is the shell.
- * If SetParent () is used to reparent the tool bar
- * into a new shell, the tool tip is not reparented
- * and pops up underneath the new shell. The fix is
- * to make sure the tool tip is a topmost window.
- */
- /*
- * Bug in Windows 98 and NT. Setting the tool tip to be the
- * top most window using HWND_TOPMOST can result in a parent
- * dialog shell being moved behind its parent if the dialog
- * has a sibling that is currently on top. The fix is to lock
- * the z-order of the active window.
- */
- Display display = getDisplay ();
- int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOSIZE;
- display.lockActiveWindow = true;
- OS.SetWindowPos (hwndToolTip, OS.HWND_TOPMOST, 0, 0, 0, 0, flags);
- display.lockActiveWindow = false;
-
- /*
- * Feature in Windows. When the control is created,
- * it does not use the default system font. A new HFONT
- * is created and destroyed when the control is destroyed.
- * This means that a program that queries the font from
- * this control, uses the font in another control and then
- * destroys this control will have the font unexpectedly
- * destroyed in the other control. The fix is to assign
- * the font ourselves each time the control is created.
- * The control will not destroy a font that it did not
- * create.
- */
- int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
-
- /* Set the button struct, bitmap and button sizes */
- OS.SendMessage (handle, OS.TB_BUTTONSTRUCTSIZE, TBBUTTON.sizeof, 0);
- OS.SendMessage (handle, OS.TB_SETBITMAPSIZE, 0, 0);
- OS.SendMessage (handle, OS.TB_SETBUTTONSIZE, 0, 0);
-
- /* Set the extended style bits */
- int bits = OS.TBSTYLE_EX_DRAWDDARROWS;
- OS.SendMessage (handle, OS.TB_SETEXTENDEDSTYLE, 0, bits);
-}
-
-void createItem (ToolItem item, int index) {
- int count = OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
- if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
- int id = 0;
- while (id < items.length && items [id] != null) id++;
- if (id == items.length) {
- ToolItem [] newItems = new ToolItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- int bits = item.widgetStyle ();
- TBBUTTON lpButton = new TBBUTTON ();
- lpButton.idCommand = id;
- lpButton.fsStyle = (byte) bits;
- lpButton.fsState = (byte) OS.TBSTATE_ENABLED;
-
- /*
- * Bug in Windows. Despite the fact that the image list
- * index has never been set for the item, Windows always
- * assumes that the image index for the item is valid.
- * When an item is inserted, the image index is zero.
- * Therefore, when the first image is inserted and is
- * assigned image index zero, every item draws with this
- * image. The fix is to set the image index to none
- * when the item is created. This is not necessary in
- * the case when the item has the BTNS_SEP style because
- * separators cannot show images.
- */
- if ((bits & OS.BTNS_SEP) == 0) lpButton.iBitmap = OS.I_IMAGENONE;
- if (OS.SendMessage (handle, OS.TB_INSERTBUTTON, index, lpButton) == 0) {
- error (SWT.ERROR_ITEM_NOT_ADDED);
- }
- items [item.id = id] = item;
- /*
- * This code is intentionally commented.
- */
-// if ((style & SWT.VERTICAL) != 0) {
-// OS.SendMessage (handle, OS.TB_SETROWS, count+1, 0);
-// }
- layoutItems ();
-}
-
-void createWidget () {
- super.createWidget ();
- items = new ToolItem [4];
- lastFocusId = -1;
-}
-
-void destroyItem (ToolItem item) {
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_IMAGE | OS.TBIF_STYLE;
- int index = OS.SendMessage (handle, OS.TB_GETBUTTONINFO, item.id, info);
- /*
- * Feature in Windows. For some reason, a tool item that has
- * the style BTNS_SEP does not return I_IMAGENONE when queried
- * for an image index, despite the fact that no attempt has been
- * made to assign an image to the item. As a result, operations
- * on an image list that use the wrong index cause random results.
- * The fix is to ensure that the tool item is not a separator
- * before using the image index. Since separators cannot have
- * an image and one is never assigned, this is not a problem.
- */
- if ((info.fsStyle & OS.BTNS_SEP) == 0 && info.iImage != OS.I_IMAGENONE) {
- if (imageList != null) imageList.put (info.iImage, null);
- if (hotImageList != null) hotImageList.put (info.iImage, null);
- if (disabledImageList != null) disabledImageList.put (info.iImage, null);
- }
- int result = OS.SendMessage (handle, OS.TB_DELETEBUTTON, index, 0);
- if (item.id == lastFocusId) lastFocusId = -1;
- items [item.id] = null;
- item.id = -1;
- int count = OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
- if (count == 0) {
- Display display = getDisplay ();
- if (imageList != null) {
- OS.SendMessage (handle, OS.TB_SETIMAGELIST, 0, 0);
- display.releaseToolImageList (imageList);
- }
- if (hotImageList != null) {
- OS.SendMessage (handle, OS.TB_SETHOTIMAGELIST, 0, 0);
- display.releaseToolHotImageList (hotImageList);
- }
- if (disabledImageList != null) {
- OS.SendMessage (handle, OS.TB_SETDISABLEDIMAGELIST, 0, 0);
- display.releaseToolDisabledImageList (disabledImageList);
- }
- imageList = hotImageList = disabledImageList = null;
- items = new ToolItem [4];
- }
- /*
- * This code is intentionally commented.
- */
-// if ((style & SWT.VERTICAL) != 0) {
-// OS.SendMessage (handle, OS.TB_SETROWS, count-1, 0);
-// }
- layoutItems ();
-}
-
-ImageList getDisabledImageList () {
- return disabledImageList;
-}
-
-ImageList getHotImageList () {
- return hotImageList;
-}
-
-ImageList getImageList () {
- return imageList;
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (int index) {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
- if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
- TBBUTTON lpButton = new TBBUTTON ();
- int result = OS.SendMessage (handle, OS.TB_GETBUTTON, index, lpButton);
- if (result == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- return items [lpButton.idCommand];
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem getItem (Point point) {
- checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- ToolItem [] items = getItems ();
- for (int i=0; i<items.length; i++) {
- Rectangle rect = items [i].getBounds ();
- if (rect.contains (point)) return items [i];
- }
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
-}
-
-/**
- * Returns an array of <code>TabItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolItem [] getItems () {
- checkWidget ();
- int count = OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
- TBBUTTON lpButton = new TBBUTTON ();
- ToolItem [] result = new ToolItem [count];
- for (int i=0; i<count; i++) {
- int code = OS.SendMessage (handle, OS.TB_GETBUTTON, i, lpButton);
- result [i] = items [lpButton.idCommand];
- }
- return result;
-}
-
-/**
- * Returns the number of rows in the receiver. When
- * the receiver has the <code>WRAP</code> style, the
- * number of rows can be greater than one. Otherwise,
- * the number of rows is always one.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getRowCount () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TB_GETROWS, 0, 0);
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (ToolItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- return OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, item.id, 0);
-}
-
-void layoutItems () {
- for (int i=0; i<items.length; i++) {
- ToolItem item = items [i];
- if (item != null) {
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- Rectangle rect = item.getBounds ();
- control.setLocation (rect.x, rect.y);
- }
- }
- }
-}
-
-boolean mnemonicHit (char ch) {
- int key = wcsToMbcs (ch);
- int [] id = new int [1];
- if (OS.SendMessage (handle, OS.TB_MAPACCELERATOR, key, id) == 0) {
- return false;
- }
- if (!setTabGroupFocus ()) return false;
- int index = OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, id [0], 0);
- if (index == -1) return false;
- OS.SendMessage (handle, OS.TB_SETHOTITEM, index, 0);
- items [id [0]].click (false);
- return true;
-}
-
-boolean mnemonicMatch (char ch) {
- int key = wcsToMbcs (ch);
- int [] id = new int [1];
- return OS.SendMessage (handle, OS.TB_MAPACCELERATOR, key, id) != 0;
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- ToolItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseImages ();
- item.releaseWidget ();
- }
- }
- items = null;
- Display display = getDisplay ();
- if (imageList != null) {
- OS.SendMessage (handle, OS.TB_SETIMAGELIST, 0, 0);
- display.releaseToolImageList (imageList);
- }
- if (hotImageList != null) {
- OS.SendMessage (handle, OS.TB_SETHOTIMAGELIST, 0, 0);
- display.releaseToolHotImageList (hotImageList);
- }
- if (disabledImageList != null) {
- OS.SendMessage (handle, OS.TB_SETDISABLEDIMAGELIST, 0, 0);
- display.releaseToolDisabledImageList (disabledImageList);
- }
- imageList = hotImageList = disabledImageList = null;
- super.releaseWidget ();
-}
-
-void setDefaultFont () {
- super.setDefaultFont ();
- OS.SendMessage (handle, OS.TB_SETBITMAPSIZE, 0, 0);
- OS.SendMessage (handle, OS.TB_SETBUTTONSIZE, 0, 0);
-}
-
-void setDisabledImageList (ImageList imageList) {
- if (disabledImageList == imageList) return;
- int hImageList = 0;
- if ((disabledImageList = imageList) != null) {
- hImageList = disabledImageList.getHandle ();
- }
- OS.SendMessage (handle, OS.TB_SETDISABLEDIMAGELIST, 0, hImageList);
-}
-
-void setHotImageList (ImageList imageList) {
- if (hotImageList == imageList) return;
- int hImageList = 0;
- if ((hotImageList = imageList) != null) {
- hImageList = hotImageList.getHandle ();
- }
- OS.SendMessage (handle, OS.TB_SETHOTIMAGELIST, 0, hImageList);
-}
-
-void setImageList (ImageList imageList) {
- if (this.imageList == imageList) return;
- int hImageList = 0;
- if ((this.imageList = imageList) != null) {
- hImageList = imageList.getHandle ();
- }
- OS.SendMessage (handle, OS.TB_SETIMAGELIST, 0, hImageList);
-}
-
-int toolTipHandle () {
- return OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0);
-}
-
-String toolTipText (NMTTDISPINFO hdr) {
- if ((hdr.uFlags & OS.TTF_IDISHWND) != 0) {
- return null;
- }
- int index = hdr.idFrom;
- int hwndToolTip = toolTipHandle ();
- if (hwndToolTip == hdr.hwndFrom) {
- if ((0 <= index) && (index < items.length)) {
- ToolItem item = items [index];
- if (item != null) return item.toolTipText;
- }
- }
- return super.toolTipText (hdr);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.CCS_NODIVIDER | OS.CCS_NORESIZE | OS.TBSTYLE_TOOLTIPS;
- if ((style & SWT.WRAP) != 0) bits |= OS.TBSTYLE_WRAPABLE;
- if ((style & SWT.FLAT) != 0) bits |= OS.TBSTYLE_FLAT;
- if ((style & SWT.RIGHT) != 0) bits |= OS.TBSTYLE_LIST;
- return bits;
-}
-
-TCHAR windowClass () {
- return ToolBarClass;
-}
-
-int windowProc () {
- return ToolBarProc;
-}
-
-LRESULT WM_GETDLGCODE (int wParam, int lParam) {
- LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
- /*
- * Return DLGC_BUTTON so that mnemonics will be
- * processed without needing to press the ALT key
- * when the widget has focus.
- */
- if (result != null) return result;
- return new LRESULT (OS.DLGC_BUTTON);
-}
-
-LRESULT WM_COMMAND (int wParam, int lParam) {
- /*
- * Feature in Windows. When the toolbar window
- * proc processes WM_COMMAND, it forwards this
- * message to the parent. This is done so that
- * children of the toolbar that send WM_COMMAND
- * messages to their parents will notify not only
- * the toolbar but also the parent of the toolbar,
- * which is typically the application window and
- * the window that is looking for this message.
- * If the toolbar did not do this, applications
- * would have to subclass the toolbar window to
- * see WM_COMMAND messages. Because the toolbar
- * window is subclassed, the WM_COMMAND message
- * is delivered twice. The fix is to avoid
- * calling the toolbar window proc.
- */
- LRESULT result = super.WM_COMMAND (wParam, lParam);
- if (result != null) return result;
- return LRESULT.ZERO;
-}
-
-LRESULT WM_KEYDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_KEYDOWN (wParam, lParam);
- if (result != null) return result;
- switch (wParam) {
- case OS.VK_RETURN:
- case OS.VK_SPACE:
- int index = OS.SendMessage (handle, OS.TB_GETHOTITEM, 0, 0);
- if (index != -1) {
- TBBUTTON lpButton = new TBBUTTON ();
- int code = OS.SendMessage (handle, OS.TB_GETBUTTON, index, lpButton);
- if (code != 0) return LRESULT.ZERO;
- }
- }
- return result;
-}
-
-LRESULT WM_KEYUP (int wParam, int lParam) {
- LRESULT result = super.WM_KEYUP (wParam, lParam);
- if (result != null) return result;
- switch (wParam) {
- case OS.VK_RETURN:
- case OS.VK_SPACE:
- int index = OS.SendMessage (handle, OS.TB_GETHOTITEM, 0, 0);
- if (index != -1) {
- TBBUTTON lpButton = new TBBUTTON ();
- int code = OS.SendMessage (handle, OS.TB_GETBUTTON, index, lpButton);
- if (code != 0) {
- items [lpButton.idCommand].click (wParam == OS.VK_RETURN);
- return LRESULT.ZERO;
- }
- }
- }
- return result;
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- int index = OS.SendMessage (handle, OS.TB_GETHOTITEM, 0, 0);
- TBBUTTON lpButton = new TBBUTTON ();
- int code = OS.SendMessage (handle, OS.TB_GETBUTTON, index, lpButton);
- if (code != 0) lastFocusId = lpButton.idCommand;
- return super.WM_KILLFOCUS (wParam, lParam);
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- if (lastFocusId != -1 && handle == OS.GetFocus ()) {
- int index = OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, lastFocusId, 0);
- OS.SendMessage (handle, OS.TB_SETHOTITEM, index, 0);
- }
- return result;
-}
-
-LRESULT WM_SIZE (int wParam, int lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the resize
- * event. If this happens, end the processing of the
- * Windows message by returning the result of the
- * WM_SIZE message.
- */
- if (isDisposed ()) return result;
- layoutItems ();
- return result;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- ToolItem child = items [wParam & 0xFFFF];
- if (child == null) return null;
- return child.wmCommandChild (wParam, lParam);
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- switch (hdr.code) {
- case OS.TBN_DROPDOWN:
- NMTOOLBAR lpnmtb = new NMTOOLBAR ();
- OS.MoveMemory (lpnmtb, lParam, NMTOOLBAR.sizeof);
- ToolItem child = items [lpnmtb.iItem];
- if (child != null) {
- Event event = new Event ();
- event.detail = SWT.ARROW;
- child.postEvent (SWT.Selection, event);
- return null;
- }
- break;
- }
- return super.wmNotifyChild (wParam, lParam);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
deleted file mode 100755
index 3a28886e8d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
+++ /dev/null
@@ -1,752 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a button in a tool bar.
- * <p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * </dl>
- * </p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class ToolItem extends Item {
- ToolBar parent;
- Control control;
- String toolTipText;
- Image disabledImage, hotImage;
- Image disabledImage2;
- int id;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, parent.getItemCount ());
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>ToolBar</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public ToolItem (ToolBar parent, int style, int index) {
- super (parent, checkStyle (style));
- this.parent = parent;
- parent.createItem (this, index);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is selected, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
- * the event object detail field contains the value <code>SWT.ARROW</code>.
- * <code>widgetDefaultSelected</code> is not called.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-
-static int checkStyle (int style) {
- return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-void click (boolean dropDown) {
- /*
- * In order to emulate all the processing that
- * happens when a mnemonic key is pressed, fake
- * a mouse press and release. This will ensure
- * that radio and pull down items are handled
- * properly.
- */
- int hwnd = parent.handle;
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) return;
- int index = OS.SendMessage (hwnd, OS.TB_COMMANDTOINDEX, id, 0);
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.TB_GETITEMRECT, index, rect);
- int lParam = (dropDown ? rect.right - 1 : rect.left) | (rect.top << 16);
- int hotIndex = OS.SendMessage (hwnd, OS.TB_GETHOTITEM, 0, 0);
- OS.SendMessage (hwnd, OS.WM_LBUTTONDOWN, 0, lParam);
- OS.SendMessage (hwnd, OS.WM_LBUTTONUP, 0, lParam);
- if (hotIndex != -1) {
- OS.SendMessage (hwnd, OS.TB_SETHOTITEM, hotIndex, 0);
- }
-}
-
-Image createDisabledImage (Image image, Color color) {
- Display display = getDisplay ();
- if (OS.IsWinCE) {
- return new Image (display, image, SWT.IMAGE_DISABLE);
- }
- Rectangle rect = image.getBounds ();
- Image disabled = new Image (display, rect);
- GC gc = new GC (disabled);
- gc.setBackground (color);
- gc.fillRectangle (rect);
- int hDC = gc.handle;
- int hImage = image.handle;
- int fuFlags = OS.DSS_DISABLED;
- switch (image.type) {
- case SWT.BITMAP: fuFlags |= OS.DST_BITMAP; break;
- case SWT.ICON: fuFlags |= OS.DST_ICON; break;
- }
- OS.DrawState (hDC, 0, 0, hImage, 0, 0, 0, rect.width, rect.height, fuFlags);
- gc.dispose ();
- return disabled;
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget();
- int hwnd = parent.handle;
- int index = OS.SendMessage (hwnd, OS.TB_COMMANDTOINDEX, id, 0);
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.TB_GETITEMRECT, index, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-/**
- * Returns the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @return the control
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Control getControl () {
- checkWidget();
- return control;
-}
-
-/**
- * Returns the receiver's disabled image if it has one, or null
- * if it does not.
- * <p>
- * The disabled image is displayed when the receiver is disabled.
- * </p>
- *
- * @return the receiver's disabled image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getDisabledImage () {
- checkWidget();
- return disabledImage;
-}
-
-public Display getDisplay () {
- ToolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getEnabled () {
- checkWidget();
- int hwnd = parent.handle;
- int fsState = OS.SendMessage (hwnd, OS.TB_GETSTATE, id, 0);
- return (fsState & OS.TBSTATE_ENABLED) != 0;
-}
-
-/**
- * Returns the receiver's hot image if it has one, or null
- * if it does not.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @return the receiver's hot image
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Image getHotImage () {
- checkWidget();
- return hotImage;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>ToolBar</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public ToolBar getParent () {
- checkWidget();
- return parent;
-}
-
-/**
- * Returns <code>true</code> if the receiver is selected,
- * and false otherwise.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @return the selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getSelection () {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
- int hwnd = parent.handle;
- int fsState = OS.SendMessage (hwnd, OS.TB_GETSTATE, id, 0);
- return (fsState & OS.TBSTATE_CHECKED) != 0;
-}
-
-/**
- * Returns the receiver's tool tip text, or null if it has not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getToolTipText () {
- checkWidget();
- return toolTipText;
-}
-
-/**
- * Gets the width of the receiver.
- *
- * @return the width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getWidth () {
- checkWidget();
- int hwnd = parent.handle;
- int index = OS.SendMessage (hwnd, OS.TB_COMMANDTOINDEX, id, 0);
- RECT rect = new RECT ();
- OS.SendMessage (hwnd, OS.TB_GETITEMRECT, index, rect);
- return rect.right - rect.left;
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise.
- * <p>
- * A disabled control is typically not selectable from the
- * user interface and draws with an inactive or "grayed" look.
- * </p>
- *
- * @return the receiver's enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isEnabled () {
- checkWidget();
- return getEnabled () && parent.isEnabled ();
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
- control = null;
- toolTipText = null;
- disabledImage = hotImage = null;
- if (disabledImage2 != null) disabledImage2.dispose ();
- disabledImage2 = null;
-}
-
-void releaseImages () {
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_IMAGE | OS.TBIF_STYLE;
- int hwnd = parent.handle;
- OS.SendMessage (hwnd, OS.TB_GETBUTTONINFO, id, info);
- /*
- * Feature in Windows. For some reason, a tool item that has
- * the style BTNS_SEP does not return I_IMAGENONE when queried
- * for an image index, despite the fact that no attempt has been
- * made to assign an image to the item. As a result, operations
- * on an image list that use the wrong index cause random results.
- * The fix is to ensure that the tool item is not a separator
- * before using the image index. Since separators cannot have
- * an image and one is never assigned, this is not a problem.
- */
- if ((info.fsStyle & OS.BTNS_SEP) == 0 && info.iImage != OS.I_IMAGENONE) {
- ImageList imageList = parent.getImageList ();
- ImageList hotImageList = parent.getHotImageList ();
- ImageList disabledImageList = parent.getDisabledImageList();
- if (imageList != null) imageList.put (info.iImage, null);
- if (hotImageList != null) hotImageList.put (info.iImage, null);
- if (disabledImageList != null) disabledImageList.put (info.iImage, null);
- }
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is selected.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection,listener);
-}
-
-/**
- * Sets the control that is used to fill the bounds of
- * the item when the items is a <code>SEPARATOR</code>.
- *
- * @param control the new control
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setControl (Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
- }
- if ((style & SWT.SEPARATOR) == 0) return;
- this.control = control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getBounds ());
- }
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise.
- * <p>
- * A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- * </p>
- *
- * @param enabled the new enabled state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setEnabled (boolean enabled) {
- checkWidget();
- int hwnd = parent.handle;
- int fsState = OS.SendMessage (hwnd, OS.TB_GETSTATE, id, 0);
- fsState &= ~OS.TBSTATE_ENABLED;
- if (enabled) fsState |= OS.TBSTATE_ENABLED;
- OS.SendMessage (hwnd, OS.TB_SETSTATE, id, fsState);
- if (image != null) updateImages ();
-}
-
-/**
- * Sets the receiver's disabled image to the argument, which may be
- * null indicating that no disabled image should be displayed.
- * <p>
- * The disbled image is displayed when the receiver is disabled.
- * </p>
- *
- * @param image the disabled image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setDisabledImage (Image image) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- disabledImage = image;
- updateImages ();
-}
-
-/**
- * Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed.
- * <p>
- * The hot image is displayed when the mouse enters the receiver.
- * </p>
- *
- * @param image the hot image to display on the receiver (may be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setHotImage (Image image) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hotImage = image;
- updateImages ();
-}
-
-public void setImage (Image image) {
- checkWidget();
- if ((style & SWT.SEPARATOR) != 0) return;
- if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- super.setImage (image);
- updateImages ();
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
- * it is selected when it is pushed.
- * </p>
- *
- * @param selected the new selection state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (boolean selected) {
- checkWidget();
- if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
- int hwnd = parent.handle;
- int fsState = OS.SendMessage (hwnd, OS.TB_GETSTATE, id, 0);
- fsState &= ~OS.TBSTATE_CHECKED;
- if (selected) fsState |= OS.TBSTATE_CHECKED;
- OS.SendMessage (hwnd, OS.TB_SETSTATE, id, fsState);
-}
-
-public void setText (String string) {
- checkWidget();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if ((style & SWT.SEPARATOR) != 0) return;
- super.setText (string);
- int hwnd = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_TEXT | OS.TBIF_STYLE;
- info.pszText = pszText;
- info.fsStyle = (byte) (widgetStyle () | OS.BTNS_AUTOSIZE);
- OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, id, info);
- OS.HeapFree (hHeap, 0, pszText);
-
- /*
- * Bug in Windows. For some reason, when the font is set
- * before any tool item has text, the tool items resize to
- * a very small size. Also, a tool item will only show text
- * when text has already been set on one item and then a new
- * item is created. The fix is to use WM_SETFONT to force
- * the tool bar to redraw and layout. [1G0G7TV, 1G0FUJ5]
- */
- int hFont = OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0);
- OS.SendMessage (hwnd, OS.WM_SETFONT, hFont, 0);
-
- parent.layoutItems ();
-}
-
-/**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setToolTipText (String string) {
- checkWidget();
- toolTipText = string;
-}
-
-/**
- * Sets the width of the receiver.
- *
- * @param width the new width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setWidth (int width) {
- checkWidget();
- if ((style & SWT.SEPARATOR) == 0) return;
- if (width < 0) return;
- int hwnd = parent.handle;
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_SIZE;
- info.cx = (short) width;
- OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, id, info);
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getBounds ());
- }
- parent.layoutItems ();
-}
-
-void updateImages () {
- int hwnd = parent.handle;
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_IMAGE;
- OS.SendMessage (hwnd, OS.TB_GETBUTTONINFO, id, info);
- if (info.iImage == OS.I_IMAGENONE && image == null) return;
- ImageList imageList = parent.getImageList ();
- ImageList hotImageList = parent.getHotImageList ();
- ImageList disabledImageList = parent.getDisabledImageList();
- if (info.iImage == OS.I_IMAGENONE) {
- Display display = getDisplay ();
- Rectangle bounds = image.getBounds ();
- Point size = new Point (bounds.width, bounds.height);
- if (imageList == null) imageList = display.getToolImageList (size);
- info.iImage = imageList.add (image);
- parent.setImageList (imageList);
- if (disabledImageList == null) disabledImageList = display.getToolDisabledImageList (size);
- Image disabled = disabledImage;
- if (disabledImage == null) {
- disabled = image;
- if (!getEnabled ()) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
- }
- }
- disabledImageList.add (disabled);
- parent.setDisabledImageList (disabledImageList);
-// if ((parent.style & SWT.FLAT) != 0) {
- if (hotImageList == null) hotImageList = display.getToolHotImageList (size);
- hotImageList.add (hotImage != null ? hotImage : image);
- parent.setHotImageList (hotImageList);
-// }
- } else {
- if (imageList != null) imageList.put (info.iImage, image);
- if (disabledImageList != null) {
- Image disabled = null;
- if (image != null) {
- if (disabledImage2 != null) disabledImage2.dispose ();
- disabledImage2 = null;
- disabled = disabledImage;
- if (disabledImage == null) {
- disabled = image;
- if (!getEnabled ()) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
- }
- }
- }
- disabledImageList.put (info.iImage, disabled);
- }
- if (hotImageList != null) {
- Image hot = null;
- if (image != null) hot = hotImage != null ? hotImage : image;
- hotImageList.put (info.iImage, hot);
- }
- if (image == null) info.iImage = OS.I_IMAGENONE;
- }
- OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, id, info);
-
- parent.layoutItems ();
-}
-
-int widgetStyle () {
- if ((style & SWT.DROP_DOWN) != 0) return OS.BTNS_DROPDOWN;
- if ((style & SWT.PUSH) != 0) return OS.BTNS_BUTTON;
- if ((style & SWT.CHECK) != 0) return OS.BTNS_CHECK;
- if ((style & SWT.RADIO) != 0) return OS.BTNS_CHECKGROUP;
- if ((style & SWT.SEPARATOR) != 0) return OS.BTNS_SEP;
- return OS.BTNS_BUTTON;
-}
-
-LRESULT wmCommandChild (int wParam, int lParam) {
- Event event = new Event ();
- if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
- if (OS.GetKeyState (OS.VK_SHIFT) < 0) event.stateMask |= SWT.SHIFT;
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) event.stateMask |= SWT.CONTROL;
- if (OS.GetKeyState (OS.VK_LBUTTON) < 0) event.stateMask |= SWT.BUTTON1;
- if (OS.GetKeyState (OS.VK_MBUTTON) < 0) event.stateMask |= SWT.BUTTON2;
- if (OS.GetKeyState (OS.VK_RBUTTON) < 0) event.stateMask |= SWT.BUTTON3;
- postEvent (SWT.Selection, event);
- return null;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
deleted file mode 100755
index 1a17e7e576..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
+++ /dev/null
@@ -1,684 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class implement rubber banding rectangles.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Move</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class Tracker extends Widget {
- Control parent;
- Display display;
- boolean tracking, stippled;
- Rectangle [] rectangles, proportions;
- int resizeCursor, clientCursor, cursorOrientation = SWT.NONE;
- boolean inEvent = false;
-
- /*
- * The following values mirror step sizes on Windows
- */
- final static int STEPSIZE_SMALL = 1;
- final static int STEPSIZE_LARGE = 9;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tracker (Composite parent, int style) {
- super (parent, checkStyle (style));
- this.parent = parent;
- display = parent.getDisplay ();
-}
-
-/**
- * Constructs a new instance of this class given the display
- * to create it on and a style value describing its behavior
- * and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p><p>
- * Note: Currently, null can be passed in for the display argument.
- * This has the effect of creating the tracker on the currently active
- * display if there is one. If there is no current display, the
- * tracker is created on a "default" display. <b>Passing in null as
- * the display argument is not considered to be good coding style,
- * and may not be supported in a future release of SWT.</b>
- * </p>
- *
- * @param display the display to create the tracker on
- * @param style the style of control to construct
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public Tracker (Display display, int style) {
- if (display == null) display = Display.getCurrent ();
- if (display == null) display = Display.getDefault ();
- if (!display.isValidThread ()) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.style = checkStyle (style);
- this.display = display;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the control is moved or resized, by sending
- * it one of the messages defined in the <code>ControlListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #removeControlListener
- */
-public void addControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Move,typedListener);
-}
-
-Point adjustMoveCursor () {
- Rectangle bounds = computeBounds ();
- int newX = bounds.x + bounds.width / 2;
- int newY = bounds.y;
- POINT pt = new POINT ();
- pt.x = newX; pt.y = newY;
- /*
- * Convert to screen coordinates iff needed
- */
- if (parent != null) {
- OS.ClientToScreen (parent.handle, pt);
- }
- OS.SetCursorPos (pt.x, pt.y);
- return new Point (pt.x, pt.y);
-}
-
-Point adjustResizeCursor () {
- int newX, newY;
- Rectangle bounds = computeBounds ();
-
- if ((cursorOrientation & SWT.LEFT) != 0) {
- newX = bounds.x;
- } else if ((cursorOrientation & SWT.RIGHT) != 0) {
- newX = bounds.x + bounds.width;
- } else {
- newX = bounds.x + bounds.width / 2;
- }
-
- if ((cursorOrientation & SWT.UP) != 0) {
- newY = bounds.y;
- } else if ((cursorOrientation & SWT.DOWN) != 0) {
- newY = bounds.y + bounds.height;
- } else {
- newY = bounds.y + bounds.height / 2;
- }
-
- POINT pt = new POINT ();
- pt.x = newX; pt.y = newY;
- /*
- * Convert to screen coordinates iff needed
- */
- if (parent != null) {
- OS.ClientToScreen (parent.handle, pt);
- }
- OS.SetCursorPos (pt.x, pt.y);
-
- /*
- * If the client has not provided a custom cursor then determine
- * the appropriate resize cursor.
- */
- if (clientCursor == 0) {
- int newCursor = 0;
- switch (cursorOrientation) {
- case SWT.UP:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENS);
- break;
- case SWT.DOWN:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENS);
- break;
- case SWT.LEFT:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZEWE);
- break;
- case SWT.RIGHT:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZEWE);
- break;
- case SWT.LEFT | SWT.UP:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENWSE);
- break;
- case SWT.RIGHT | SWT.DOWN:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENWSE);
- break;
- case SWT.LEFT | SWT.DOWN:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENESW);
- break;
- case SWT.RIGHT | SWT.UP:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZENESW);
- break;
- default:
- newCursor = OS.LoadCursor (0, OS.IDC_SIZEALL);
- break;
- }
- OS.SetCursor (newCursor);
- if (resizeCursor != 0) {
- OS.DestroyCursor (resizeCursor);
- }
- resizeCursor = newCursor;
- }
-
- return new Point (pt.x, pt.y);
-}
-static int checkStyle (int style) {
- if ((style & (SWT.LEFT | SWT.RIGHT | SWT.UP | SWT.DOWN)) == 0) {
- style |= SWT.LEFT | SWT.RIGHT | SWT.UP | SWT.DOWN;
- }
- return style;
-}
-/**
- * Stop displaying the tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void close () {
- checkWidget ();
- tracking = false;
-}
-
-Rectangle computeBounds () {
- int xMin = rectangles [0].x;
- int yMin = rectangles [0].y;
- int xMax = rectangles [0].x + rectangles [0].width;
- int yMax = rectangles [0].y + rectangles [0].height;
-
- for (int i = 1; i < rectangles.length; i++) {
- if (rectangles [i].x < xMin) xMin = rectangles [i].x;
- if (rectangles [i].y < yMin) yMin = rectangles [i].y;
- int rectRight = rectangles [i].x + rectangles [i].width;
- if (rectRight > xMax) xMax = rectRight;
- int rectBottom = rectangles [i].y + rectangles [i].height;
- if (rectBottom > yMax) yMax = rectBottom;
- }
-
- return new Rectangle (xMin, yMin, xMax - xMin, yMax - yMin);
-}
-
-Rectangle [] computeProportions (Rectangle [] rects) {
- Rectangle [] result = new Rectangle [rects.length];
- Rectangle bounds = computeBounds ();
- for (int i = 0; i < rects.length; i++) {
- result[i] = new Rectangle (
- (rects[i].x - bounds.x) * 100 / bounds.width,
- (rects[i].y - bounds.y) * 100 / bounds.height,
- rects[i].width * 100 / bounds.width,
- rects[i].height * 100 / bounds.height);
- }
- return result;
-}
-/**
- * Draw the rectangles displayed by the tracker.
- */
-void drawRectangles (Rectangle [] rects) {
- if (parent != null) {
- if (parent.isDisposed ()) return;
- parent.getShell ().update ();
- } else {
- display.update ();
- }
- int bandWidth = 1;
- int hwndTrack = OS.GetDesktopWindow ();
- if (parent != null) hwndTrack = parent.handle;
- int hDC = OS.GetDCEx (hwndTrack, 0, OS.DCX_CACHE);
- int hBitmap = 0, hBrush = 0, oldBrush = 0;
- if (stippled) {
- bandWidth = 3;
- byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
- hBitmap = OS.CreateBitmap (8, 8, 1, 1, bits);
- hBrush = OS.CreatePatternBrush (hBitmap);
- oldBrush = OS.SelectObject (hDC, hBrush);
- }
- for (int i=0; i<rects.length; i++) {
- Rectangle rect = rects [i];
- OS.PatBlt (hDC, rect.x, rect.y, rect.width, bandWidth, OS.PATINVERT);
- OS.PatBlt (hDC, rect.x, rect.y + bandWidth, bandWidth, rect.height - (bandWidth * 2), OS.PATINVERT);
- OS.PatBlt (hDC, rect.x + rect.width - bandWidth, rect.y + bandWidth, bandWidth, rect.height - (bandWidth * 2), OS.PATINVERT);
- OS.PatBlt (hDC, rect.x, rect.y + rect.height - bandWidth, rect.width, bandWidth, OS.PATINVERT);
- }
- if (stippled) {
- OS.SelectObject (hDC, oldBrush);
- OS.DeleteObject (hBrush);
- OS.DeleteObject (hBitmap);
- }
- OS.ReleaseDC (hwndTrack, hDC);
-}
-
-public Display getDisplay () {
- return display;
-}
-
-/**
- * Returns the bounds of the Rectangles being drawn.
- *
- * @return the bounds of the Rectangles being drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle [] getRectangles () {
- checkWidget ();
- return rectangles;
-}
-
-/**
- * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
- *
- * @return the stippled effect of the rectangles
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getStippled () {
- checkWidget ();
- return stippled;
-}
-
-void moveRectangles (int xChange, int yChange) {
- if (xChange < 0 && ((style & SWT.LEFT) == 0)) return;
- if (xChange > 0 && ((style & SWT.RIGHT) == 0)) return;
- if (yChange < 0 && ((style & SWT.UP) == 0)) return;
- if (yChange > 0 && ((style & SWT.DOWN) == 0)) return;
- Rectangle bounds = computeBounds ();
- bounds.x += xChange; bounds.y += yChange;
- for (int i = 0; i < rectangles.length; i++) {
- rectangles [i].x += xChange;
- rectangles [i].y += yChange;
- }
-}
-
-/**
- * Start displaying the Tracker rectangles.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean open () {
- checkWidget ();
- if (rectangles == null) return false;
- boolean cancelled = false;
- tracking = true;
- Event event = new Event ();
- MSG msg = new MSG ();
- /*
- * If this tracker is being created without a mouse drag then
- * we need to create a transparent window that fills the screen
- * in order to get all mouse/keyboard events that occur
- * outside of our visible windows (ie.- over the desktop).
- */
- int hwndTransparent = 0;
- Callback newProc = null;
- boolean mouseDown = OS.GetKeyState(OS.VK_LBUTTON) < 0;
- if (!mouseDown) {
- int width = OS.GetSystemMetrics (OS.SM_CXSCREEN);
- int height = OS.GetSystemMetrics (OS.SM_CYSCREEN);
- hwndTransparent = OS.CreateWindowEx (
- OS.WS_EX_TRANSPARENT,
- display.windowClass,
- null,
- OS.WS_POPUP | OS.WS_VISIBLE,
- 0, 0,
- width, height,
- 0,
- 0,
- OS.GetModuleHandle (null),
- null);
- final int oldProc = OS.GetWindowLong (hwndTransparent, OS.GWL_WNDPROC);
- Object windowProc = new Object () {
- public int windowProc (int hwnd, int msg, int wParam, int lParam) {
- switch (msg) {
- /*
- * We typically do not want to answer that the transparent window is
- * transparent to hits since doing so negates the effect of having it
- * to grab events. However, clients of the tracker should not be aware
- * of this transparent window. Therefore if there is a hit query
- * performed as a result of client code then answer that the transparent
- * window is transparent to hits so that its existence will not impact
- * the client.
- */
- case OS.WM_NCHITTEST:
- if (inEvent) return OS.HTTRANSPARENT;
- break;
- case OS.WM_SETCURSOR:
- if (clientCursor != 0) {
- OS.SetCursor(clientCursor);
- return 1;
- }
- if (resizeCursor != 0) {
- OS.SetCursor(resizeCursor);
- return 1;
- }
- }
- return OS.CallWindowProc (oldProc, hwnd, msg, wParam, lParam);
- }
- };
- newProc = new Callback (windowProc, "windowProc", 4);
- OS.SetWindowLong (hwndTransparent, OS.GWL_WNDPROC, newProc.getAddress ());
- }
-
- drawRectangles (rectangles);
- Point cursorPos;
- if (mouseDown) {
- POINT pt = new POINT ();
- OS.GetCursorPos (pt);
- cursorPos = new Point (pt.x, pt.y);
- } else {
- if ((style & SWT.RESIZE) != 0) {
- cursorPos = adjustResizeCursor ();
- } else {
- cursorPos = adjustMoveCursor ();
- }
- }
-
- int oldX = cursorPos.x, oldY = cursorPos.y;
- /*
- * Tracker behaves like a Dialog with its own OS event loop.
- */
- while (tracking && !cancelled) {
- if (parent != null && parent.isDisposed ()) break;
- OS.GetMessage (msg, 0, 0, 0);
- int message = msg.message;
- switch (message) {
- case OS.WM_LBUTTONUP:
- case OS.WM_MOUSEMOVE:
- int newPos = OS.GetMessagePos ();
- int newX = (short) (newPos & 0xFFFF);
- int newY = (short) (newPos >> 16);
- if (newX != oldX || newY != oldY) {
- drawRectangles (rectangles);
- event.x = newX;
- event.y = newY;
- if ((style & SWT.RESIZE) != 0) {
- resizeRectangles (newX - oldX, newY - oldY);
- cursorPos = adjustResizeCursor ();
- newX = cursorPos.x; newY = cursorPos.y;
- inEvent = true;
- sendEvent (SWT.Resize, event);
- } else {
- moveRectangles (newX - oldX, newY - oldY);
- inEvent = true;
- sendEvent (SWT.Move, event);
- }
- inEvent = false;
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the move
- * event. If this happens, return false to indicate
- * that the tracking has failed.
- */
- if (isDisposed ()) return false;
- drawRectangles (rectangles);
- oldX = newX; oldY = newY;
- }
- tracking = msg.message != OS.WM_LBUTTONUP;
- break;
- case OS.WM_KEYDOWN:
- int stepSize = OS.GetKeyState (OS.VK_CONTROL) < 0 ? STEPSIZE_SMALL : STEPSIZE_LARGE;
- int xChange = 0, yChange = 0;
- switch (msg.wParam) {
- case OS.VK_ESCAPE:
- cancelled = true;
- tracking = false;
- break;
- case OS.VK_RETURN:
- tracking = false;
- break;
- case OS.VK_LEFT:
- xChange = -stepSize;
- break;
- case OS.VK_RIGHT:
- xChange = stepSize;
- break;
- case OS.VK_UP:
- yChange = -stepSize;
- break;
- case OS.VK_DOWN:
- yChange = stepSize;
- break;
- }
- if (xChange != 0 || yChange != 0) {
- drawRectangles (rectangles);
- newX = oldX + xChange;
- newY = oldY + yChange;
- event.x = newX;
- event.y = newY;
- if ((style & SWT.RESIZE) != 0) {
- resizeRectangles (xChange, yChange);
- cursorPos = adjustResizeCursor ();
- inEvent = true;
- sendEvent (SWT.Resize, event);
- } else {
- moveRectangles (xChange, yChange);
- cursorPos = adjustMoveCursor ();
- inEvent = true;
- sendEvent (SWT.Move, event);
- }
- inEvent = false;
- /*
- * It is possible (but unlikely) that application
- * code could have disposed the widget in the move
- * event. If this happens return false to indicate
- * that the tracking has failed.
- */
- if (isDisposed ()) return false;
- drawRectangles (rectangles);
- oldX = cursorPos.x; oldY = cursorPos.y;
- }
- break;
- }
- /*
- * Don't dispatch mouse and key events in general, EXCEPT once this
- * tracker has finished its work.
- */
- if (tracking && !cancelled) {
- if (OS.WM_KEYFIRST <= message && message <= OS.WM_KEYLAST) continue;
- if (OS.WM_MOUSEFIRST <= message && message <= OS.WM_MOUSELAST) continue;
- }
- OS.DispatchMessage (msg);
- }
- drawRectangles (rectangles);
- /*
- * Cleanup: If a transparent window was created in order to capture events then
- * destroy it and its callback object now.
- */
- if (hwndTransparent != 0) {
- OS.DestroyWindow (hwndTransparent);
- }
- if (newProc != null) {
- newProc.dispose();
- }
- /*
- * Cleanup: If this tracker was resizing then the last cursor that it created
- * needs to be destroyed.
- */
- if (resizeCursor != 0) {
- OS.DestroyCursor (resizeCursor);
- }
- tracking = false;
- return !cancelled;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the control is moved or resized.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ControlListener
- * @see #addControlListener
- */
-public void removeControlListener (ControlListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Move, listener);
-}
-
-void resizeRectangles (int xChange, int yChange) {
- /*
- * If the cursor orientation has not been set in the orientation of
- * this change then try to set it here.
- */
- if (xChange < 0 && ((style & SWT.LEFT) != 0) && ((cursorOrientation & SWT.RIGHT) == 0)) {
- cursorOrientation |= SWT.LEFT;
- } else if (xChange > 0 && ((style & SWT.RIGHT) != 0) && ((cursorOrientation & SWT.LEFT) == 0)) {
- cursorOrientation |= SWT.RIGHT;
- } else if (yChange < 0 && ((style & SWT.UP) != 0) && ((cursorOrientation & SWT.DOWN) == 0)) {
- cursorOrientation |= SWT.UP;
- } else if (yChange > 0 && ((style & SWT.DOWN) != 0) && ((cursorOrientation & SWT.UP) == 0)) {
- cursorOrientation |= SWT.DOWN;
- }
- Rectangle bounds = computeBounds ();
- if ((cursorOrientation & SWT.LEFT) != 0) {
- bounds.x += xChange;
- bounds.width -= xChange;
- } else if ((cursorOrientation & SWT.RIGHT) != 0) {
- bounds.width += xChange;
- }
- if ((cursorOrientation & SWT.UP) != 0) {
- bounds.y += yChange;
- bounds.height -= yChange;
- } else if ((cursorOrientation & SWT.DOWN) != 0) {
- bounds.height += yChange;
- }
- /*
- * The following are conditions under which the resize should not be applied
- */
- if (bounds.width < 0 || bounds.height < 0) return;
-
- Rectangle [] newRects = new Rectangle [rectangles.length];
- for (int i = 0; i < rectangles.length; i++) {
- Rectangle proportion = proportions[i];
- newRects[i] = new Rectangle (
- proportion.x * bounds.width / 100 + bounds.x,
- proportion.y * bounds.height / 100 + bounds.y,
- proportion.width * bounds.width / 100,
- proportion.height * bounds.height / 100);
- }
- rectangles = newRects;
-}
-
-public void setCursor(Cursor newCursor) {
- checkWidget();
- clientCursor = 0;
- if (newCursor != null) {
- clientCursor = newCursor.handle;
- if (inEvent) OS.SetCursor(clientCursor);
- }
-}
-/**
- * Specify the rectangles that should be drawn.
- *
- * @param rectangles the bounds of the rectangles to be drawn
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setRectangles (Rectangle [] rectangles) {
- checkWidget ();
- if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT);
- this.rectangles = rectangles;
- proportions = computeProportions (rectangles);
-}
-
-/**
- * Change the appearance of the line used to draw the rectangles.
- *
- * @param stippled <code>true</code> if rectangle should appear stippled
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setStippled (boolean stippled) {
- checkWidget ();
- this.stippled = stippled;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
deleted file mode 100755
index 26890dd122..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ /dev/null
@@ -1,1704 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * Instances of this class provide a selectable user interface object
- * that displays a hierarchy of items and issue notificiation when an
- * item in the hierarchy is selected.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>TreeItem</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add <code>Control</code> children to it,
- * or set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>SINGLE, MULTI, CHECK</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-public class Tree extends Composite {
- int hAnchor;
- TreeItem [] items;
- ImageList imageList;
- boolean dragStarted;
- boolean ignoreSelect, ignoreExpand, ignoreDeselect;
- static final int TreeProc;
- static final TCHAR TreeClass = new TCHAR (0, OS.WC_TREEVIEW, true);
- static {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, TreeClass, lpWndClass);
- TreeProc = lpWndClass.lpfnWndProc;
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public Tree (Composite parent, int style) {
- super (parent, checkStyle (style));
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid.
- * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
- * the event object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection, typedListener);
- addListener (SWT.DefaultSelection, typedListener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when an item in the receiver is expanded or collapsed
- * by sending it one of the messages defined in the <code>TreeListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #removeTreeListener
- */
-public void addTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Expand, typedListener);
- addListener (SWT.Collapse, typedListener);
-}
-
-int callWindowProc (int msg, int wParam, int lParam) {
- if (handle == 0) return 0;
- return OS.CallWindowProc (TreeProc, handle, msg, wParam, lParam);
-}
-
-static int checkStyle (int style) {
- /*
- * Feature in Windows. It is not possible to create
- * a tree that scrolls and does not have scroll bars.
- * The TVS_NOSCROLL style will remove the scroll bars
- * but the tree will never scroll. Therefore, no matter
- * what style bits are specified, set the H_SCROLL and
- * V_SCROLL bits so that the SWT style will match the
- * widget that Windows creates.
- */
- style |= SWT.H_SCROLL | SWT.V_SCROLL;
- return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
-}
-
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- RECT rect = new RECT ();
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- while (hItem != 0) {
- rect.left = hItem;
- if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect) != 0) {
- width = Math.max (width, rect.right - rect.left);
- height += rect.bottom - rect.top;
- }
- hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- }
- width = width * 2;
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2; height += border * 2;
- if ((style & SWT.V_SCROLL) != 0) {
- width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- }
- if ((style & SWT.H_SCROLL) != 0) {
- height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- }
- return new Point (width, height);
-}
-
-void createHandle () {
- super.createHandle ();
- state &= ~CANVAS;
-
- /* Set the checkbox image list */
- if ((style & SWT.CHECK) != 0) setCheckboxImageList ();
-
- /*
- * Feature in Windows. When the control is created,
- * it does not use the default system font. A new HFONT
- * is created and destroyed when the control is destroyed.
- * This means that a program that queries the font from
- * this control, uses the font in another control and then
- * destroys this control will have the font unexpectedly
- * destroyed in the other control. The fix is to assign
- * the font ourselves each time the control is created.
- * The control will not destroy a font that it did not
- * create.
- */
- int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
- OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
-}
-
-void createItem (TreeItem item, int hParent, int hInsertAfter) {
- int id = 0;
- while (id < items.length && items [id] != null) id++;
- if (id == items.length) {
- TreeItem [] newItems = new TreeItem [items.length + 4];
- System.arraycopy (items, 0, newItems, 0, items.length);
- items = newItems;
- }
- TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();
- tvInsert.hParent = hParent;
- tvInsert.hInsertAfter = hInsertAfter;
- tvInsert.lParam = id;
- tvInsert.iImage = OS.I_IMAGENONE;
- tvInsert.iSelectedImage = tvInsert.iImage;
- tvInsert.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE;
-
- /* Set the initial unchecked state */
- if ((style & SWT.CHECK) != 0) {
- tvInsert.mask = tvInsert.mask | OS.TVIF_STATE;
- tvInsert.state = 1 << 12;
- tvInsert.stateMask = OS.TVIS_STATEIMAGEMASK;
- }
-
- /* Insert the item */
- int hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert);
- if (hItem == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
- item.handle = hItem;
- items [id] = item;
-
- /*
- * This code is intentionally commented.
- */
-// if (hParent != 0) {
-// int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
-// bits |= OS.TVS_LINESATROOT;
-// OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
-// }
-
- /*
- * Bug in Windows. When a child item is added to a parent item
- * that has no children outside of WM_NOTIFY with control code
- * TVN_ITEMEXPANDED, the tree widget does not redraw the +/-
- * indicator. The fix is to detect this case and force a redraw.
- */
- if (!OS.IsWindowVisible (handle) || drawCount > 0) return;
- int hChild = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent);
- if (hChild == 0 || OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hChild) != 0) {
- return;
- }
- RECT rect = new RECT ();
- rect.left = hParent;
- if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) != 0) {
- OS.InvalidateRect (handle, rect, false);
- }
-}
-
-ScrollBar createScrollBar (int type) {
- return new ScrollBar (this, type);
-}
-
-void createWidget () {
- super.createWidget ();
- items = new TreeItem [4];
-}
-
-int defaultBackground () {
- return OS.GetSysColor (OS.COLOR_WINDOW);
-}
-
-/**
- * Deselects all selected items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselectAll () {
- checkWidget ();
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- if ((style & SWT.SINGLE) != 0) {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem != 0) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- return;
- }
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
-}
-
-void destroyItem (TreeItem item) {
- int hItem = item.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- releaseItems (new TreeItem [] {item}, tvItem);
- boolean fixRedraw = false;
- if (drawCount == 0 && OS.IsWindowVisible (handle)) {
- RECT rect = new RECT ();
- rect.left = hItem;
- fixRedraw = OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) == 0;
- }
- if (fixRedraw) {
- OS.UpdateWindow (handle);
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- int result = OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem);
- if (fixRedraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- OS.ValidateRect (handle, null);
- }
- int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
- if (count == 0) {
- if (imageList != null) {
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, 0, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- items = new TreeItem [4];
- }
-}
-
-int getBackgroundPixel () {
- if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOW);
- int pixel = OS.SendMessage (handle, OS.TVM_GETBKCOLOR, 0, 0);
- if (pixel == -1) return OS.GetSysColor (OS.COLOR_WINDOW);
- return pixel;
-}
-
-int getForegroundPixel () {
- if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOWTEXT);
- int pixel = OS.SendMessage (handle, OS.TVM_GETTEXTCOLOR, 0, 0);
- if (pixel == -1) return OS.GetSysColor (OS.COLOR_WINDOWTEXT);
- return pixel;
-}
-
-/**
- * Returns the item at the given point in the receiver
- * or null if no such item exists. The point is in the
- * coordinate system of the receiver.
- *
- * @param point the point used to locate the item
- * @return the item at the given point
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getItem (Point point) {
- checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- TVHITTESTINFO lpht = new TVHITTESTINFO ();
- lpht.x = point.x; lpht.y = point.y;
- OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
- if (lpht.hItem != 0 && (lpht.flags & OS.TVHT_ONITEM) != 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- tvItem.hItem = lpht.hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- return items [tvItem.lParam];
- }
- return null;
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. The
- * number that is returned is the number of roots in the
- * tree.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- int count = 0;
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- while (hItem != 0) {
- hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- return count;
-}
-
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the tree.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- return OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0);
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver. These
- * are the roots of the tree.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget ();
- int count = 0;
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- while (hItem != 0) {
- hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- int index = 0;
- TreeItem [] result = new TreeItem [count];
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- tvItem.hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- while (tvItem.hItem != 0) {
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- result [index++] = items [tvItem.lParam];
- tvItem.hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, tvItem.hItem);
- }
- return result;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget ();
- return null;
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s that are currently
- * selected in the receiver. An empty array indicates that no
- * items are selected.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its selection, so modifying the array will
- * not affect the receiver.
- * </p>
- * @return an array representing the selection
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getSelection () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem == 0) return new TreeItem [0];
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE;
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) == 0) return new TreeItem [0];
- return new TreeItem [] {items [tvItem.lParam]};
- }
- int count = 0;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE;
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) count++;
- }
- }
- TreeItem [] result = new TreeItem [count];
- if (count != 0) {
- int index = 0;
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- result [index++] = item;
- }
- }
- }
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
- return result;
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionCount () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem == 0) return 0;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) == 0) return 0;
- return 1;
- }
- int count = 0;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) count++;
- }
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
- return count;
-}
-
-int imageIndex (Image image) {
- if (image == null) return OS.I_IMAGENONE;
- if (imageList == null) {
- int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
- if (hOldList != 0) OS.ImageList_Destroy (hOldList);
- Rectangle bounds = image.getBounds ();
- imageList = getDisplay ().getImageList (new Point (bounds.width, bounds.height));
- int index = imageList.indexOf (image);
- if (index == -1) index = imageList.add (image);
- int hImageList = imageList.getHandle ();
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList);
- return index;
- }
- int index = imageList.indexOf (image);
- if (index != -1) return index;
- return imageList.add (image);
-}
-
-void releaseItems (TreeItem [] nodes, TVITEM tvItem) {
- for (int i=0; i<nodes.length; i++) {
- TreeItem item = nodes [i];
- TreeItem [] sons = item.getItems ();
- if (sons.length != 0) {
- releaseItems (sons, tvItem);
- }
- int hItem = item.handle;
- if (hItem == hAnchor) hAnchor = 0;
- if (!item.isDisposed ()) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- items [tvItem.lParam] = null;
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
-}
-
-void releaseWidget () {
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- items = null;
- if (imageList != null) {
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- } else {
- int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, 0);
- if (hOldList != 0) OS.ImageList_Destroy (hOldList);
- }
- imageList = null;
- int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, 0);
- if (hOldList != 0) OS.ImageList_Destroy (hOldList);
- super.releaseWidget ();
-}
-
-
-/**
- * Removes all of the items from the receiver.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget ();
- ignoreDeselect = ignoreSelect = true;
- int result = OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, OS.TVI_ROOT);
- ignoreDeselect = ignoreSelect = false;
- if (result == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && !item.isDisposed ()) {
- item.releaseWidget ();
- item.releaseHandle ();
- }
- }
- if (imageList != null) {
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, 0, 0);
- Display display = getDisplay ();
- display.releaseImageList (imageList);
- }
- imageList = null;
- items = new TreeItem [4];
- hAnchor = 0;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- eventTable.unhook (SWT.Selection, listener);
- eventTable.unhook (SWT.DefaultSelection, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when items in the receiver are expanded or collapsed..
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see TreeListener
- * @see #addTreeListener
- */
-public void removeTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Expand, listener);
- eventTable.unhook (SWT.Collapse, listener);
-}
-
-/**
- * Display a mark indicating the point at which an item will be inserted.
- * The drop insert item has a visual hint to show where a dragged item
- * will be inserted when dropped on the tree.
- *
- * @param item the insert item. Null will clear the insertion mark.
- * @param after true places the insert mark above 'item'. false places
- * the insert mark below 'item'.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setInsertMark (TreeItem item, boolean before) {
- checkWidget ();
- int hItem = 0;
- if (item != null) {
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hItem = item.handle;
- }
- OS.SendMessage (handle, OS.TVM_SETINSERTMARK, (before) ? 0 : 1, hItem);
-}
-
-/**
- * Selects all the items in the receiver.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void selectAll () {
- checkWidget ();
- if ((style & SWT.SINGLE) != 0) return;
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem == 0) {
- hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- if (hItem != 0) {
- ignoreSelect = true;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hItem);
- ignoreSelect = false;
- OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem);
- }
- }
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.state = OS.TVIS_SELECTED;
- tvItem.stateMask = OS.TVIS_SELECTED;
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
-}
-
-void setBackgroundPixel (int pixel) {
- if (background == pixel) return;
- background = pixel;
- /*
- * Bug in Windows. When TVM_GETBKCOLOR is used more
- * than once to set the background color of a tree,
- * the background color of the lines and the plus/minus
- * does not change to the new color. The fix is to set
- * the background color to the default before setting
- * the new color.
- */
- int oldPixel = OS.SendMessage (handle, OS.TVM_GETBKCOLOR, 0, 0);
- if (oldPixel != -1) OS.SendMessage (handle, OS.TVM_SETBKCOLOR, 0, -1);
- OS.SendMessage (handle, OS.TVM_SETBKCOLOR, 0, pixel);
- if ((style & SWT.CHECK) != 0) setCheckboxImageList ();
-}
-
-void setCheckboxImageList () {
- if ((style & SWT.CHECK) == 0) return;
- int count = 5;
- int height = OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0), width = height;
- int hImageList = OS.ImageList_Create (width, height, OS.ILC_COLOR, count, count);
- int hDC = OS.GetDC (handle);
- int memDC = OS.CreateCompatibleDC (hDC);
- int hBitmap = OS.CreateCompatibleBitmap (hDC, width * count, height);
- int hOldBitmap = OS.SelectObject (memDC, hBitmap);
- RECT rect = new RECT ();
- OS.SetRect (rect, 0, 0, width * count, height);
- int hBrush = OS.CreateSolidBrush (getBackgroundPixel ());
- OS.FillRect (memDC, rect, hBrush);
- OS.DeleteObject (hBrush);
- int oldFont = OS.SelectObject (hDC, defaultFont ());
- TEXTMETRIC tm = new TEXTMETRIC ();
- OS.GetTextMetrics (hDC, tm);
- OS.SelectObject (hDC, oldFont);
- int itemWidth = Math.min (tm.tmHeight, width);
- int itemHeight = Math.min (tm.tmHeight, height);
- int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1;
- OS.SetRect (rect, left + width, top, left + width + itemWidth, top + itemHeight);
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
- rect.left += width; rect.right += width;
- OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
- OS.SelectObject (memDC, hOldBitmap);
- OS.DeleteDC (memDC);
- OS.ReleaseDC (handle, hDC);
- OS.ImageList_AddMasked (hImageList, hBitmap, 0);
- OS.DeleteObject (hBitmap);
- int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
- OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, hImageList);
- if (hOldList != 0) OS.ImageList_Destroy (hOldList);
-}
-
-void setForegroundPixel (int pixel) {
- if (foreground == pixel) return;
- foreground = pixel;
- OS.SendMessage (handle, OS.TVM_SETTEXTCOLOR, 0, pixel);
-}
-
-public void setRedraw (boolean redraw) {
- checkWidget ();
- /*
- * Bug in Windows. For some reason, when WM_SETREDRAW
- * is used to turn redraw on for a tree and the tree
- * contains no items, the last item in the tree does
- * not redraw properly. If the tree has only one item,
- * that item is not drawn. If another window is dragged
- * on top of the item, parts of the item are redrawn
- * and erased at random. The fix is to ensure that this
- * case doesn't happen by inserting and deleting an item
- * when redraw is turned on and there are no items in
- * the tree.
- */
- int hItem = 0;
- if (redraw) {
- int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
- if (count == 0) {
- TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();
- tvInsert.hInsertAfter = OS.TVI_FIRST;
- hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert);
- }
- }
- super.setRedraw (redraw);
- if (hItem != 0) {
- OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem);
- }
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#deselectAll()
- */
-public void setSelection (TreeItem [] items) {
- checkWidget ();
- if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Select/deselect the first item */
- int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (items.length == 0) {
- if (hOldItem != 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- tvItem.hItem = hOldItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- } else {
- int hNewItem = 0;
- TreeItem item = items [0];
- if (item != null) {
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hNewItem = item.handle;
- }
- ignoreSelect = true;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem);
- ignoreSelect = false;
- /*
- * Feature in Windows. When the old and new focused item
- * are the same, Windows does not check to make sure that
- * the item is actually selected, not just focused. The
- * fix is to force the item to draw selected by setting
- * the state mask.
- */
- if (hOldItem == hNewItem) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.state = OS.TVIS_SELECTED;
- tvItem.stateMask = OS.TVIS_SELECTED;
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- if ((style & SWT.SINGLE) != 0) return;
-
- /* Select/deselect the rest of the items */
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<this.items.length; i++) {
- TreeItem item = this.items [i];
- if (item != null) {
- int index = 0;
- while (index < items.length) {
- if (items [index] == item) break;
- index++;
- }
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- if (index == items.length) {
- tvItem.state = 0;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- } else {
- if (index != items.length) {
- tvItem.state = OS.TVIS_SELECTED;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- }
- }
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
-}
-
-/**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled
- * and expanded until the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showSelection()
- */
-public void showItem (TreeItem item) {
- checkWidget ();
- if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, item.handle);
-}
-
-/**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Tree#showItem(TreeItem)
- */
-public void showSelection () {
- checkWidget ();
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem == 0) return;
- OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem);
-}
-
-int widgetStyle () {
- int bits = super.widgetStyle () | OS.TVS_SHOWSELALWAYS;
- bits |= OS.TVS_LINESATROOT | OS.TVS_HASLINES | OS.TVS_HASBUTTONS;
- /*
- * This code is intentionally commented. In future,
- * FULL_SELECTION may be implemented for trees and
- * automatic tool tips turned off.
- */
-// if ((style & SWT.FULL_SELECTION) != 0) {
-// bits |= OS.TVS_FULLROWSELECT;
-// } else {
-// bits |= OS.TVS_HASLINES | OS.TVS_HASBUTTONS;
-// }
-// bits |= OS.TVS_NOTOOLTIPS;
- return bits;
-}
-
-TCHAR windowClass () {
- return TreeClass;
-}
-
-int windowProc () {
- return TreeProc;
-}
-
-LRESULT WM_CHAR (int wParam, int lParam) {
- LRESULT result = super.WM_CHAR (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. The tree control beeps
- * in WM_CHAR when the search for the item that
- * matches the key stroke fails. This is the
- * standard tree behavior but is unexpected when
- * the key that was typed was CR or SPACE. The
- * fix is to avoid calling the tree window proc
- * in these cases.
- */
- switch (wParam) {
- case OS.VK_RETURN:
- case OS.VK_SPACE: return LRESULT.ZERO;
- }
- return result;
-}
-
-LRESULT WM_KEYDOWN (int wParam, int lParam) {
- LRESULT result = super.WM_KEYDOWN (wParam, lParam);
- if (result != null) return result;
- switch (wParam) {
- case OS.VK_SPACE: {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem != 0) {
- hAnchor = hItem;
- OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem);
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM;
- tvItem.hItem = hItem;
- if ((style & SWT.CHECK) != 0) {
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- int state = tvItem.state >> 12;
- if ((state & 0x1) != 0) {
- state++;
- } else {
- --state;
- }
- tvItem.state = state << 12;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- tvItem.stateMask = OS.TVIS_SELECTED;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((style & SWT.MULTI) != 0 && OS.GetKeyState (OS.VK_CONTROL) < 0) {
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- tvItem.state &= ~OS.TVIS_SELECTED;
- } else {
- tvItem.state |= OS.TVIS_SELECTED;
- }
- } else {
- tvItem.state |= OS.TVIS_SELECTED;
- }
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- TreeItem item = items [tvItem.lParam];
- Event event = new Event ();
- event.item = item;
- postEvent (SWT.Selection, event);
- if ((style & SWT.CHECK) != 0) {
- event = new Event ();
- event.item = item;
- event.detail = SWT.CHECK;
- postEvent (SWT.Selection, event);
- }
- return LRESULT.ZERO;
- }
- break;
- }
- case OS.VK_UP:
- case OS.VK_DOWN:
- case OS.VK_PRIOR:
- case OS.VK_NEXT:
- case OS.VK_HOME:
- case OS.VK_END: {
- if ((style & SWT.SINGLE) != 0) break;
- if (OS.GetKeyState (OS.VK_SHIFT) < 0) {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem != 0) {
- if (hAnchor == 0) hAnchor = hItem;
- boolean selected = false;
- ignoreSelect = ignoreDeselect = true;
- int code = callWindowProc (OS.WM_KEYDOWN, wParam, lParam);
- ignoreSelect = ignoreDeselect = false;
- int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- int hDeselectItem = hItem;
- RECT rect1 = new RECT ();
- rect1.left = hAnchor;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1);
- RECT rect2 = rect2 = new RECT ();
- rect2.left = hDeselectItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2);
- int flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE;
- while (hDeselectItem != hAnchor) {
- tvItem.hItem = hDeselectItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- hDeselectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hDeselectItem);
- }
- int hSelectItem = hAnchor;
- rect1.left = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1);
- rect2.left = hSelectItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2);
- tvItem.state = OS.TVIS_SELECTED;
- flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE;
- while (hSelectItem != hNewItem) {
- tvItem.hItem = hSelectItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- hSelectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hSelectItem);
- }
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM;
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- Event event = new Event ();
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- event.item = items [tvItem.lParam];
- }
- postEvent (SWT.Selection, event);
- return new LRESULT (code);
- }
- }
- if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem != 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- boolean oldSelected = (tvItem.state & OS.TVIS_SELECTED) != 0;
- int hNewItem = 0;
- switch (wParam) {
- case OS.VK_UP:
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUSVISIBLE, hItem);
- break;
- case OS.VK_DOWN:
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
- break;
- case OS.VK_HOME:
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- break;
- case OS.VK_PRIOR:
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
- if (hNewItem == hItem) {
- OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEUP, 0);
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
- }
- break;
- case OS.VK_NEXT:
- RECT rect = new RECT (), clientRect = new RECT ();
- OS.GetClientRect (handle, clientRect);
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
- do {
- int hVisible = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNewItem);
- if (hVisible == 0) break;
- rect.left = hVisible;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect);
- if (rect.bottom > clientRect.bottom) break;
- if ((hNewItem = hVisible) == hItem) {
- OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEDOWN, 0);
- }
- } while (hNewItem != 0);
- break;
- case OS.VK_END:
- hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
- break;
- }
- if (hNewItem != 0) {
- OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hNewItem);
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- boolean newSelected = (tvItem.state & OS.TVIS_SELECTED) != 0;
- if (!newSelected && drawCount == 0) {
- OS.UpdateWindow (handle);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- ignoreSelect = true;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem);
- ignoreSelect = false;
- if (oldSelected) {
- tvItem.state = OS.TVIS_SELECTED;
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- if (!newSelected) {
- tvItem.state = 0;
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- if (!newSelected && drawCount == 0) {
- RECT rect1 = new RECT (), rect2 = new RECT ();
- rect1.left = hItem; rect2.left = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1);
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2);
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, rect1, false);
- OS.InvalidateRect (handle, rect2, false);
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, rect1, 0, flags);
- OS.RedrawWindow (handle, rect2, 0, flags);
- }
- }
- return LRESULT.ZERO;
- }
- }
- }
- int code = callWindowProc (OS.WM_KEYDOWN, wParam, lParam);
- hAnchor = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- return new LRESULT (code);
- }
- }
- return result;
-}
-
-LRESULT WM_KILLFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_KILLFOCUS (wParam, lParam);
- if ((style & SWT.SINGLE) != 0) return result;
- /*
- * Feature in Windows. When multiple item have
- * the TVIS_SELECTED state, Windows redraws only
- * the focused item in the color used to show the
- * selection when the tree loses or gains focus.
- * The fix is to force Windows to redraw all the
- * visible items when focus is gained or lost.
- */
- OS.InvalidateRect (handle, null, false);
- return result;
-}
-
-LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
-
- /*
- * Feature in Windows. When a tree item is
- * reselected, Windows does not issue a WM_NOTIFY.
- * This is inconsistent with the list widget and
- * other widgets in Windows. The fix is to detect
- * the case when an item is reselected and issue
- * the notification. The first part of this work
- * around is to ensure that the user has selected
- * an item.
- */
- TVHITTESTINFO lpht = new TVHITTESTINFO ();
- lpht.x = (short) (lParam & 0xFFFF);
- lpht.y = (short) (lParam >> 16);
- OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
- if (lpht.hItem == 0 || (lpht.flags & OS.TVHT_ONITEM) == 0) {
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- int code = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (code);
- }
-
- /* Look for check/uncheck */
- if ((style & SWT.CHECK) != 0) {
- if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) != 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = lpht.hItem;
- tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- int state = tvItem.state >> 12;
- if ((state & 0x1) != 0) {
- state++;
- } else {
- --state;
- }
- tvItem.state = state << 12;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- Event event = new Event ();
- event.item = items [tvItem.lParam];
- event.detail = SWT.CHECK;
- postEvent (SWT.Selection, event);
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return LRESULT.ZERO;
- }
- }
-
- /* Get the selected state of the item under the mouse */
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_SELECTED;
- boolean hittestSelected = false;
- if ((style & SWT.MULTI) != 0) {
- tvItem.hItem = lpht.hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- hittestSelected = (tvItem.state & OS.TVIS_SELECTED) != 0;
- }
-
- /* Get the selected state of the last selected item */
- int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if ((style & SWT.MULTI) != 0) {
- tvItem.hItem = hOldItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
-
- /* Check for CONTROL or drag selection */
- if (hittestSelected || (wParam & OS.MK_CONTROL) != 0) {
- if (drawCount == 0) {
- OS.UpdateWindow (handle);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- } else {
- deselectAll ();
- }
- }
-
- /* Do the selection */
- sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
- dragStarted = false;
- ignoreDeselect = ignoreSelect = true;
- int code = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam);
- ignoreDeselect = ignoreSelect = false;
- if (dragStarted && OS.GetCapture () != handle) OS.SetCapture (handle);
- int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-
- /*
- * Feature in Windows. When the old and new focused item
- * are the same, Windows does not check to make sure that
- * the item is actually selected, not just focused. The
- * fix is to force the item to draw selected by setting
- * the state mask. This is only necessary when the tree
- * is single select.
- */
- if ((style & SWT.SINGLE) != 0) {
- if (hOldItem == hNewItem) {
- tvItem.mask = OS.TVIF_STATE;
- tvItem.state = OS.TVIS_SELECTED;
- tvItem.stateMask = OS.TVIS_SELECTED;
- tvItem.hItem = hNewItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
-
- /* Reselect the last item that was unselected */
- if ((style & SWT.MULTI) != 0) {
-
- /* Check for CONTROL and reselect the last item */
- if (hittestSelected || (wParam & OS.MK_CONTROL) != 0) {
- if (hOldItem == hNewItem && hOldItem == lpht.hItem) {
- if ((wParam & OS.MK_CONTROL) != 0) {
- tvItem.state ^= OS.TVIS_SELECTED;
- if (dragStarted) tvItem.state = OS.TVIS_SELECTED;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- } else {
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- tvItem.state = OS.TVIS_SELECTED;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- if ((wParam & OS.MK_CONTROL) != 0 && !dragStarted) {
- if (hittestSelected) {
- tvItem.state = 0;
- tvItem.hItem = lpht.hItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- }
- if (drawCount == 0) {
- RECT rect1 = new RECT (), rect2 = new RECT ();
- rect1.left = hOldItem; rect2.left = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1);
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2);
- /*
- * This code is intentionally commented.
- */
-// OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, rect1, false);
- OS.InvalidateRect (handle, rect2, false);
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, rect1, 0, flags);
- OS.RedrawWindow (handle, rect2, 0, flags);
- }
- }
- }
-
- /* Check for SHIFT or normal select and delect/reselect items */
- if ((wParam & OS.MK_CONTROL) == 0) {
- if (!hittestSelected || !dragStarted) {
- tvItem.state = 0;
- int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
- for (int i=0; i<items.length; i++) {
- TreeItem item = items [i];
- if (item != null && item.handle != hNewItem) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- }
- }
- tvItem.hItem = hNewItem;
- tvItem.state = OS.TVIS_SELECTED;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
- if ((wParam & OS.MK_SHIFT) != 0) {
- RECT rect1 = new RECT ();
- if (hAnchor == 0) hAnchor = hNewItem;
- rect1.left = hAnchor;
- if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1) != 0) {
- RECT rect2 = rect2 = new RECT ();
- rect2.left = hNewItem;
- OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2);
- int flags = rect1.top < rect2.top ? OS.TVGN_NEXTVISIBLE : OS.TVGN_PREVIOUSVISIBLE;
- tvItem.state = OS.TVIS_SELECTED;
- int hItem = tvItem.hItem = hAnchor;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- while (hItem != hNewItem) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hItem);
- }
- }
- }
- }
- }
- }
- if ((wParam & OS.MK_SHIFT) == 0) hAnchor = hNewItem;
-
- /* Issue notification */
- tvItem.hItem = hNewItem;
- tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- Event event = new Event ();
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- event.item = items [tvItem.lParam];
- }
- postEvent (SWT.Selection, event);
-
- /*
- * Feature in Windows. Inside WM_LBUTTONDOWN and WM_RBUTTONDOWN,
- * the widget starts a modal loop to determine if the user wants
- * to begin a drag/drop operation or marque select. Unfortunately,
- * this modal loop eats the corresponding mouse up. The fix is to
- * detect the cases when the modal loop has eaten the mouse up and
- * issue a fake mouse up.
- */
- if (dragStarted) {
- sendEvent (SWT.DragDetect);
- // widget could be disposed at this point
- } else {
- sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam);
- }
- dragStarted = false;
- return new LRESULT (code);
-}
-
-LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- /*
- * Feature in Windows. The receiver uses WM_RBUTTONDOWN
- * to initiate a drag/drop operation depending on how the
- * user moves the mouse. If the user clicks the right button,
- * without moving the mouse, the tree consumes the corresponding
- * WM_RBUTTONUP. The fix is to avoid calling the window proc for
- * the tree.
- */
- sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);
- /*
- * This code is intentionally commented.
- */
-// if (OS.GetCapture () != handle) OS.SetCapture (handle);
- setFocus ();
-
- /*
- * Feature in Windows. When the user selects a tree item
- * with the right mouse button, the item remains selected
- * only as long as the user does not release or move the
- * mouse. As soon as this happens, the selection snaps
- * back to the previous selection. This behavior can be
- * observed in the Explorer but is not instantly apparent
- * because the Explorer explicity sets the selection when
- * the user chooses a menu item. If the user cancels the
- * menu, the selection snaps back. The fix is to avoid
- * calling the window proc and do the selection ourselves.
- * This behavior is consistent with the table.
- */
- TVHITTESTINFO lpht = new TVHITTESTINFO ();
- lpht.x = (short) (lParam & 0xFFFF);
- lpht.y = (short) (lParam >> 16);
- OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
- if (lpht.hItem != 0 && (lpht.flags & (OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL)) != 0) {
- if ((wParam & (OS.MK_CONTROL | OS.MK_SHIFT)) == 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM;
- tvItem.stateMask = OS.TVIS_SELECTED;
- tvItem.hItem = lpht.hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- if ((tvItem.state & OS.TVIS_SELECTED) == 0) {
- ignoreSelect = true;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, 0);
- ignoreSelect = false;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, lpht.hItem);
- }
- }
- }
- return LRESULT.ZERO;
-}
-
-LRESULT WM_SETFOCUS (int wParam, int lParam) {
- LRESULT result = super.WM_SETFOCUS (wParam, lParam);
- if ((style & SWT.SINGLE) != 0) return result;
- /*
- * Feature in Windows. When multiple item have
- * the TVIS_SELECTED state, Windows redraws only
- * the focused item in the color used to show the
- * selection when the tree loses or gains focus.
- * The fix is to force Windows to redraw all the
- * visible items when focus is gained or lost.
- */
- OS.InvalidateRect (handle, null, false);
- return result;
-}
-
-LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
- LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.CHECK) != 0) setCheckboxImageList ();
- return result;
-}
-
-LRESULT wmNotifyChild (int wParam, int lParam) {
- NMHDR hdr = new NMHDR ();
- OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
- int code = hdr.code;
- switch (code) {
- case OS.NM_DBLCLK:
- int pos = OS.GetMessagePos ();
- TVHITTESTINFO lpht = new TVHITTESTINFO ();
- POINT pt = new POINT ();
- pt.x = (short) (pos & 0xFFFF);
- pt.y = (short) (pos >> 16);
- OS.ScreenToClient (handle, pt);
- lpht.x = pt.x; lpht.y = pt.y;
- OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
- if ((lpht.flags & OS.TVHT_ONITEM) == 0) break;
- // fall through
- case OS.NM_RETURN:
- case OS.TVN_SELCHANGEDA:
- case OS.TVN_SELCHANGEDW:
- if (!ignoreSelect) {
- TVITEM tvItem = null;
- if (code == OS.TVN_SELCHANGED) {
- tvItem = new TVITEM ();
- int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
- OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
- } else {
- int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hItem == 0) {
- tvItem = new TVITEM ();
- tvItem.hItem = hItem;
- tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- }
- }
- TreeItem item = null;
- if (tvItem != null) {
- /*
- * This code is intentionally commented.
- */
-// hAnchor = tvItem.hItem;
- if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
- item = items [tvItem.lParam];
- }
- }
- Event event = new Event ();
- event.item = item;
- if (code == OS.TVN_SELCHANGED) {
- postEvent (SWT.Selection, event);
- } else {
- postEvent (SWT.DefaultSelection, event);
- }
- }
- if (code == OS.NM_DBLCLK && hooks (SWT.DefaultSelection)) {
- return LRESULT.ONE;
- }
- break;
- case OS.TVN_SELCHANGINGA:
- case OS.TVN_SELCHANGINGW:
- if (!ignoreSelect && !ignoreDeselect) {
- hAnchor = 0;
- if ((style & SWT.MULTI) != 0) deselectAll ();
- }
- break;
- case OS.TVN_ITEMEXPANDINGA:
- case OS.TVN_ITEMEXPANDINGW:
- if (!ignoreExpand) {
- TVITEM tvItem = new TVITEM ();
- int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
- OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
- int [] action = new int [1];
- OS.MoveMemory (action, lParam + NMHDR.sizeof, 4);
- Event event = new Event ();
- event.item = items [tvItem.lParam];
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the expand
- * or collapse event. If this happens, end the
- * processing of the Windows message by returning
- * zero as the result of the window proc.
- */
- if (action [0] == OS.TVE_EXPAND) {
- sendEvent (SWT.Expand, event);
- if (isDisposed ()) return LRESULT.ZERO;
- }
- if (action [0] == OS.TVE_COLLAPSE) {
- sendEvent (SWT.Collapse, event);
- if (isDisposed ()) return LRESULT.ZERO;
- }
- }
- break;
- case OS.TVN_BEGINDRAGA:
- case OS.TVN_BEGINDRAGW:
- case OS.TVN_BEGINRDRAGA:
- case OS.TVN_BEGINRDRAGW:
- TVITEM tvItem = new TVITEM ();
- int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
- OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
- if (tvItem.hItem != 0 && (tvItem.state & OS.TVIS_SELECTED) == 0) {
- ignoreSelect = ignoreDeselect = true;
- OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, tvItem.hItem);
- ignoreSelect = ignoreDeselect = false;
- }
- dragStarted = true;
- break;
- }
- return super.wmNotifyChild (wParam, lParam);
-}
-
-LRESULT wmScroll (int msg, int wParam, int lParam) {
- int code = callWindowProc (msg, wParam, lParam);
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
deleted file mode 100755
index c76ba67962..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
+++ /dev/null
@@ -1,568 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Instances of this class represent a selectable user interface object
- * that represents a hierarchy of tree items in a tree widget.
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(none)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class TreeItem extends Item {
- public int handle;
- Tree parent;
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style) {
- super (parent, style);
- this.parent = parent;
- parent.createItem (this, 0, OS.TVI_LAST);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (Tree parent, int style, int index) {
- super (parent, style);
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- this.parent = parent;
- int hItem = OS.TVI_FIRST;
- if (index != 0) {
- int count = 1, hwnd = parent.handle;
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- while (hItem != 0 && count < index) {
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- if (hItem == 0) error (SWT.ERROR_INVALID_RANGE);
- };
- parent.createItem (this, 0, hItem);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
- * and a style value describing its behavior and appearance.
- * The item is added to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style) {
- super (checkNull (parentItem).parent, style);
- parent = parentItem.parent;
- int hItem = parentItem.handle;
- parent.createItem (this, hItem, OS.TVI_LAST);
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
- * a style value describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#checkSubclass
- * @see Widget#getStyle
- */
-public TreeItem (TreeItem parentItem, int style, int index) {
- super (checkNull (parentItem).parent, style);
- if (index < 0) error (SWT.ERROR_INVALID_RANGE);
- parent = parentItem.parent;
- int hItem = OS.TVI_FIRST;
- int hParent = parentItem.handle;
- if (index != 0) {
- int count = 1, hwnd = parent.handle;
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent);
- while (hItem != 0 && count < index) {
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- if (hItem == 0) error (SWT.ERROR_INVALID_RANGE);
- }
- parent.createItem (this, hParent, hItem);
-}
-
-static TreeItem checkNull (TreeItem item) {
- if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return item;
-}
-
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-void destroyWidget () {
- super.destroyWidget ();
- releaseHandle ();
-}
-
-/**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Rectangle getBounds () {
- checkWidget ();
- int hwnd = parent.handle;
- RECT rect = new RECT ();
- rect.left = handle;
- OS.SendMessage (hwnd, OS.TVM_GETITEMRECT, 1, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- return new Rectangle (rect.left, rect.top, width, height);
-}
-
-/**
- * Returns <code>true</code> if the receiver is checked,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getChecked () {
- checkWidget ();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- tvItem.hItem = handle;
- int result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- return (result != 0) && (((tvItem.state >> 12) & 1) == 0);
-}
-
-public Display getDisplay () {
- Tree parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
- * Returns <code>true</code> if the receiver is expanded,
- * and false otherwise.
- * <p>
- *
- * @return the expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getExpanded () {
- checkWidget ();
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = handle;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- return (tvItem.state & OS.TVIS_EXPANDED) != 0;
-}
-
-/**
- * Returns <code>true</code> if the receiver is grayed,
- * and false otherwise. When the parent does not have
- * the <code>CHECK style, return false.
- * <p>
- *
- * @return the grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean getGrayed () {
- checkWidget ();
- if ((parent.style & SWT.CHECK) == 0) return false;
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- tvItem.hItem = handle;
- int result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- return (result != 0) && ((tvItem.state >> 12) > 2);
-}
-
-/**
- * Returns the number of items contained in the receiver
- * that are direct item children of the receiver.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- int count = 0;
- int hwnd = parent.handle;
- int hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
- while (hItem != 0) {
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- return count;
-}
-
-/**
- * Returns an array of <code>TreeItem</code>s which are the
- * direct item children of the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the receiver's items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem [] getItems () {
- checkWidget ();
- int count = 0;
- int hwnd = parent.handle;
- int hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
- while (hItem != 0) {
- hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
- count++;
- }
- int index = 0;
- TreeItem [] result = new TreeItem [count];
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- tvItem.hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
- while (tvItem.hItem != 0) {
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- result [index++] = parent.items [tvItem.lParam];
- tvItem.hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, tvItem.hItem);
- }
- return result;
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Tree</code>.
- *
- * @return the receiver's parent
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Tree getParent () {
- checkWidget ();
- return parent;
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>TreeItem</code> or null when the receiver is a
- * root.
- *
- * @return the receiver's parent item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getParentItem () {
- checkWidget ();
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- tvItem.hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, handle);
- if (tvItem.hItem == 0) return null;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- return parent.items [tvItem.lParam];
-}
-
-void releaseChild () {
- super.releaseChild ();
- parent.destroyItem (this);
-}
-
-void releaseHandle () {
- handle = 0;
-}
-
-void releaseWidget () {
- super.releaseWidget ();
- parent = null;
-}
-
-/**
- * Sets the checked state of the receiver.
- * <p>
- *
- * @param checked the new checked state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setChecked (boolean checked) {
- checkWidget ();
- if ((parent.style & SWT.CHECK) == 0) return;
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- tvItem.hItem = handle;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- int state = tvItem.state >> 12;
- if (checked) {
- if ((state & 0x1) != 0) state++;
- } else {
- if ((state & 0x1) == 0) --state;
- }
- tvItem.state = state << 12;
- OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem);
-}
-
-/**
- * Sets the expanded state of the receiver.
- * <p>
- *
- * @param expanded the new expanded state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setExpanded (boolean expanded) {
- checkWidget ();
- int hwnd = parent.handle;
- /*
- * Feature in Windows. When the user collapses the root
- * of a subtree that has the focus item, Windows moves
- * the selection to the root of the subtree and issues
- * a TVN_SELCHANGED to inform the programmer that the
- * seletion has changed. When the programmer collapses
- * the same subtree using TVM_EXPAND, Windows does not
- * send the selection changed notification. This is not
- * stricly wrong but is inconsistent. The fix is to notice
- * that the selection has changed and issue the event.
- */
- int hOldItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- parent.ignoreExpand = true;
- OS.SendMessage (hwnd, OS.TVM_EXPAND, expanded ? OS.TVE_EXPAND : OS.TVE_COLLAPSE, handle);
- parent.ignoreExpand = false;
- int hNewItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
- if (hNewItem != hOldItem) {
- Event event = new Event ();
- if (hNewItem != 0) {
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
- tvItem.hItem = hNewItem;
- if (OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem) != 0) {
- event.item = parent.items [tvItem.lParam];
- }
- }
- parent.sendEvent (SWT.Selection, event);
- }
-}
-
-/**
- * Sets the grayed state of the receiver.
- * <p>
- *
- * @param checked the new grayed state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setGrayed (boolean grayed) {
- checkWidget ();
- if ((parent.style & SWT.CHECK) == 0) return;
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
- tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
- tvItem.hItem = handle;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- int state = tvItem.state >> 12;
- if (grayed) {
- if (state <= 2) state +=2;
- } else {
- if (state > 2) state -=2;
- }
- tvItem.state = state << 12;
- OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem);
-}
-
-public void setImage (Image image) {
- checkWidget ();
- super.setImage (image);
- int hwnd = parent.handle;
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE;
- tvItem.iImage = parent.imageIndex (image);
- tvItem.iSelectedImage = tvItem.iImage;
- tvItem.hItem = handle;
- int result = OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem);
-}
-
-/**
- * This label will be displayed to the right of the bitmap,
- * or, if the receiver doesn't have a bitmap to the right of
- * the horizontal hierarchy connector line.
- */
-public void setText (String string) {
- checkWidget ();
- if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- super.setText (string);
- int hwnd = parent.handle;
- int hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- TVITEM tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_TEXT;
- tvItem.hItem = handle;
- tvItem.pszText = pszText;
- int result = OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem);
- OS.HeapFree (hHeap, 0, pszText);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
deleted file mode 100755
index 2d5e2323e8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ /dev/null
@@ -1,986 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * This class is the abstract superclass of all user interface objects.
- * Widgets are created, disposed and issue notification to listeners
- * when events occur which affect them.
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>(none)</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Dispose</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation. However, it has not been marked
- * final to allow those outside of the SWT development team to implement
- * patched versions of the class in order to get around specific
- * limitations in advance of when those limitations can be addressed
- * by the team. Any class built using subclassing to access the internals
- * of this class will likely fail to compile or run between releases and
- * may be strongly platform specific. Subclassing should not be attempted
- * without an intimate and detailed understanding of the workings of the
- * hierarchy. No support is provided for user-written classes which are
- * implemented as subclasses of this class.
- * </p>
- *
- * @see #checkSubclass
- */
-
-public abstract class Widget {
-
- int style, state;
- EventTable eventTable;
- Object data;
- String [] keys;
- Object [] values;
-
- /* Global state flags */
-// static final int AUTOMATIC = 1<<0;
-// static final int ACTIVE = 1<<1;
-// static final int AUTOGRAB = 1<<2;
-// static final int MULTIEXPOSE = 1<<3;
-// static final int RESIZEREDRAW = 1<<4;
-// static final int WRAP = 1<<5;
- static final int DISABLED = 1<<6;
- static final int HIDDEN = 1<<7;
-// static final int FOREGROUND = 1<<8;
-// static final int BACKGROUND = 1<<9;
- static final int DISPOSED = 1<<10;
-// static final int HANDLE = 1<<11;
- static final int CANVAS = 1<<12;
-
- /* Default widths for widgets */
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
- static final char Mnemonic = '&';
-
- /* COMCTL32.DLL flags */
- static final int COMCTL32_MAJOR, COMCTL32_MINOR;
- static {
-
- /* Get the COMCTL32.DLL version */
- DLLVERSIONINFO dvi = new DLLVERSIONINFO ();
- dvi.cbSize = DLLVERSIONINFO.sizeof;
- dvi.dwMajorVersion = 4;
- dvi.dwMinorVersion = 0;
- TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true);
- int hModule = OS.LoadLibrary (lpLibFileName);
- if (hModule != 0) {
- String name = "DllGetVersion\0";
- byte [] lpProcName = new byte [name.length ()];
- for (int i=0; i<lpProcName.length; i++) {
- lpProcName [i] = (byte) name.charAt (i);
- }
- int DllGetVersion = OS.GetProcAddress (hModule, lpProcName);
- if (DllGetVersion != 0) OS.Call (DllGetVersion, dvi);
- OS.FreeLibrary (hModule);
- }
- COMCTL32_MAJOR = dvi.dwMajorVersion;
- COMCTL32_MINOR = dvi.dwMinorVersion;
- if (!OS.IsWinCE) {
- if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) < (4 << 16 | 71)) {
- System.out.println ("***WARNING: SWT requires comctl32.dll version 4.71 or greater");
- System.out.println ("***WARNING: Detected: " + COMCTL32_MAJOR + "." + COMCTL32_MINOR);
- }
- }
-
- /* Initialize the Common Controls DLL */
- OS.InitCommonControls ();
- }
-
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Widget () {
-}
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * for all SWT widget classes should include a comment which
- * describes the style constants which are applicable to the class.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT
- * @see #checkSubclass
- * @see #getStyle
- */
-public Widget (Widget parent, int style) {
- checkSubclass ();
- checkParent (parent);
- this.style = style;
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when an event of the given type occurs. When the
- * event does occur in the widget, the listener is notified by
- * sending it the <code>handleEvent()</code> message.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #removeListener
- */
-public void addListener (int eventType, Listener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) eventTable = new EventTable ();
- eventTable.hook (eventType, listener);
-}
-
-/**
- * Adds the listener to the collection of listeners who will
- * be notifed when the widget is disposed. When the widget is
- * disposed, the listener is notified by sending it the
- * <code>widgetDisposed()</code> message.
- *
- * @param listener the listener which should be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void addDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Dispose, typedListener);
-}
-
-/**
- * Returns a style with exactly one style bit set out of
- * the specified set of exclusive style bits. All other
- * possible bits are cleared when the first matching bit
- * is found. Bits that are not part of the possible set
- * are untouched.
- *
- * @param style the original style bits
- * @param int0 the 0th possible style bit
- * @param int1 the 1st possible style bit
- * @param int2 the 2nd possible style bit
- * @param int3 the 3rd possible style bit
- * @param int4 the 4th possible style bit
- * @param int5 the 5th possible style bit
- *
- * @return the new style bits
- */
-static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
- int mask = int0 | int1 | int2 | int3 | int4 | int5;
- if ((style & mask) == 0) style |= int0;
- if ((style & int0) != 0) style = (style & ~mask) | int0;
- if ((style & int1) != 0) style = (style & ~mask) | int1;
- if ((style & int2) != 0) style = (style & ~mask) | int2;
- if ((style & int3) != 0) style = (style & ~mask) | int3;
- if ((style & int4) != 0) style = (style & ~mask) | int4;
- if ((style & int5) != 0) style = (style & ~mask) | int5;
- return style;
-}
-
-/**
- * Throws an exception if the specified widget can not be
- * used as a parent for the receiver.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
-void checkParent (Widget parent) {
- if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (parent.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-}
-
-/**
- * Checks that this class can be subclassed.
- * <p>
- * The SWT class library is intended to be subclassed
- * only at specific, controlled points (most notably,
- * <code>Composite</code> and <code>Canvas</code> when
- * implementing new widgets). This method enforces this
- * rule unless it is overridden.
- * </p><p>
- * <em>IMPORTANT:</em> By providing an implementation of this
- * method that allows a subclass of a class which does not
- * normally allow subclassing to be created, the implementer
- * agrees to be fully responsible for the fact that any such
- * subclass will likely fail between SWT releases and will be
- * strongly platform specific. No support is provided for
- * user-written classes which are implemented in this fashion.
- * </p><p>
- * The ability to subclass outside of the allowed SWT classes,
- * is intended purely to enable those not on the SWT development
- * team to implement patches in order to get around specific
- * limitations in advance of when those limitations can be
- * addressed by the team. Subclassing should not be attempted
- * without an intimate and detailed understanding of the hierarchy.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-protected void checkSubclass () {
- if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
-}
-
-/**
- * Throws an <code>SWTException</code> if the receiver can not
- * be accessed by the caller. This may include both checks on
- * the state of the receiver and more generally on the entire
- * execution context. This method <em>should</em> be called by
- * widget implementors to enforce the standard SWT invariants.
- * <p>
- * Currently, it is an error to invoke any method (other than
- * <code>isDisposed()</code>) on a widget that has had its
- * <code>dispose()</code> method called. It is also an error
- * to call widget methods from any thread that is different
- * from the thread that created the widget.
- * </p><p>
- * In future releases of SWT, there may be more or fewer error
- * checks and exceptions may be thrown for different reasons.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_WIDGET_DISPOSED);
-}
-
-/**
- * Destroys the widget in the operating system and releases
- * the widget's handle. If the widget does not have a handle,
- * this method may hide the widget, mark the widget as destroyed
- * or do nothing, depending on the widget.
- * <p>
- * When a widget is destroyed in the operating system, its
- * descendents are also destroyed by the operating system.
- * This means that it is only necessary to call <code>destroyWidget</code>
- * on the root of the widget tree.
- * </p><p>
- * This method is called after <code>releaseWidget</code>.
- * </p>
- * @see #dispose
- * @see #releaseChild
- * @see #releaseWidget
- * @see #releaseHandle
- */
-void destroyWidget () {
-}
-
-/**
- * Disposes of the operating system resources associated with
- * the receiver and all its descendents. After this method has
- * been invoked, the receiver and all descendents will answer
- * <code>true</code> when sent the message <code>isDisposed()</code>.
- * Any internal connections between the widgets in the tree will
- * have been removed to facilitate garbage collection.
- * <p>
- * NOTE: This method is not called recursively on the descendents
- * of the receiver. This means that, widget implementers can not
- * detect when a widget is being disposed of by re-implementing
- * this method, but should instead listen for the <code>Dispose</code>
- * event.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #addDisposeListener
- * @see #removeDisposeListener
- * @see #checkWidget
- */
-public void dispose () {
- /*
- * Note: It is valid to attempt to dispose a widget
- * more than once. If this happens, fail silently.
- */
- if (isDisposed ()) return;
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- releaseChild ();
- releaseWidget ();
- destroyWidget ();
-}
-
-/**
- * Does whatever widget specific cleanup is required, and then
- * uses the code in <code>SWTError.error</code> to handle the error.
- *
- * @param code the descriptive error code
- *
- * @see SWTError#error
- */
-void error (int code) {
- SWT.error(code);
-}
-
-/**
- * Returns the application defined widget data associated
- * with the receiver, or null if it has not been set. The
- * <em>widget data</em> is a single, unnamed field that is
- * stored with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @return the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData () {
- checkWidget();
- return data;
-}
-
-/**
- * Returns the application defined property of the receiver
- * with the specified name, or null if it has not been set.
- * <p>
- * Applications may have associated arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @return the value of the property or null if it has not been set
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #setData
- */
-public Object getData (String key) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (keys == null) return null;
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) return values [i];
- }
- return null;
-}
-
-/**
- * Returns the <code>Display</code> that is associated with
- * the receiver.
- * <p>
- * A widget's display is either provided when it is created
- * (for example, top level <code>Shell</code>s) or is the
- * same as its parent's display.
- * </p>
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public abstract Display getDisplay ();
-
-/**
- * Returns the name of the widget. This is the name of
- * the class without the package name.
- *
- * @return the name of the widget
- */
-String getName () {
- String string = getClass ().getName ();
- int index = string.lastIndexOf ('.');
- if (index == -1) return string;
- return string.substring (index + 1, string.length ());
-}
-
-/*
- * Returns a short printable representation for the contents
- * of a widget. For example, a button may answer the label
- * text. This is used by <code>toString</code> to provide a
- * more meaningful description of the widget.
- *
- * @return the contents string for the widget
- *
- * @see toString
- */
-String getNameText () {
- return "";
-}
-
-/**
- * Returns the receiver's style information.
- * <p>
- * Note that the value which is returned by this method <em>may
- * not match</em> the value which was provided to the constructor
- * when the receiver was created. This can occur when the underlying
- * operating system does not support a particular combination of
- * requested styles. For example, if the platform widget used to
- * implement a particular SWT widget always has scroll bars, the
- * result of calling this method would always have the
- * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
- * </p>
- *
- * @return the style bits
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getStyle () {
- checkWidget();
- return style;
-}
-
-/*
- * Returns <code>true</code> if the specified eventType is
- * hooked, and <code>false</code> otherwise. Implementations
- * of SWT can avoid creating objects and sending events
- * when an event happens in the operating system but
- * there are no listeners hooked for the event.
- *
- * @param eventType the event to be checked
- *
- * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
- *
- * @see #isListening
- */
-boolean hooks (int eventType) {
- if (eventTable == null) return false;
- return eventTable.hooks (eventType);
-}
-
-/**
- * Returns <code>true</code> if the widget has been disposed,
- * and <code>false</code> otherwise.
- * <p>
- * This method gets the dispose state for the widget.
- * When a widget has been disposed, it is an error to
- * invoke any other method using the widget.
- * </p>
- *
- * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
- */
-public boolean isDisposed () {
- return (state & DISPOSED) != 0;
-}
-
-/**
- * Returns <code>true</code> if there are any listeners
- * for the specified event type associated with the receiver,
- * and <code>false</code> otherwise.
- *
- * @param eventType the type of event
- * @return true if the event is hooked
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-protected boolean isListening (int eventType) {
- checkWidget();
- return hooks (eventType);
-}
-
-/*
- * Returns <code>true</code> when subclassing is
- * allowed and <code>false</code> otherwise
- *
- * @return <code>true</code> when subclassing is allowed and <code>false</code> otherwise
- */
-boolean isValidSubclass () {
- return Display.isValidClass (getClass ());
-}
-
-/*
- * Returns <code>true</code> when the current thread is
- * the thread that created the widget and <code>false</code>
- * otherwise.
- *
- * @return <code>true</code> when the current thread is the thread that created the widget and <code>false</code> otherwise
- */
-boolean isValidThread () {
- return getDisplay ().isValidThread ();
-}
-
-/*
- * Returns a single character, converted from the default
- * multi-byte character set (MBCS) used by the operating
- * system widgets to a wide character set (WCS) used by Java.
- *
- * @param ch the MBCS character
- * @return the WCS character
- */
-char mbcsToWcs (int ch) {
- return mbcsToWcs (ch, 0);
-}
-
-/*
- * Returns a single character, converted from the specified
- * multi-byte character set (MBCS) used by the operating
- * system widgets to a wide character set (WCS) used by Java.
- *
- * @param ch the MBCS character
- * @param codePage the code page used to convert the character
- * @return the WCS character
- */
-char mbcsToWcs (int ch, int codePage) {
- if (OS.IsUnicode) return (char) ch;
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return (char) ch;
- byte [] buffer;
- if (key <= 0xFF) {
- buffer = new byte [1];
- buffer [0] = (byte) key;
- } else {
- buffer = new byte [2];
- buffer [0] = (byte) ((key >> 8) & 0xFF);
- buffer [1] = (byte) (key & 0xFF);
- }
- char [] unicode = new char [1];
- int cp = codePage != 0 ? codePage : OS.CP_ACP;
- int count = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, buffer.length, unicode, 1);
- if (count == 0) return 0;
- return unicode [0];
-}
-
-/**
- * Notifies all of the receiver's listeners for events
- * of the given type that one such event has occurred by
- * invoking their <code>handleEvent()</code> method.
- *
- * @param eventType the type of event which has occurred
- * @param event the event data
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- eventTable.sendEvent (event);
-}
-
-void postEvent (int eventType) {
- if (eventTable == null) return;
- postEvent (eventType, new Event ());
-}
-
-void postEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.type = eventType;
- event.widget = this;
- if (event.time == 0) {
- if (OS.IsWinCE) {
- event.time = OS.GetTickCount ();
- } else {
- event.time = OS.GetMessageTime ();
- }
- }
- Display display = getDisplay ();
- display.postEvent (event);
-}
-
-/*
- * Releases the receiver, a child in a widget hierarchy,
- * from its parent.
- * <p>
- * When a widget is destroyed, it may be necessary to remove
- * it from an internal data structure of the parent. When
- * a widget has no handle, it may also be necessary for the
- * parent to hide the widget or otherwise indicate that the
- * widget has been disposed. For example, disposing a menu
- * bar requires that the menu bar first be released from the
- * shell when the menu bar is active. This could not be done
- * in <code>destroyWidget</code> for the menu bar because the
- * parent shell as well as other fields have been null'd out
- * already by <code>releaseWidget</code>.
- * </p>
- * This method is called first when a widget is disposed.
- *
- * @see #dispose
- * @see #releaseChild
- * @see #releaseWidget
- * @see #releaseHandle
- */
-void releaseChild () {
-}
-
-/*
- * Releases the widget's handle by zero'ing it out.
- * Does not destroy or release any operating system
- * resources.
- * <p>
- * This method is called after <code>releaseWidget</code>
- * or from <code>destroyWidget</code> when a widget is being
- * destroyed to ensure that the widget is marked as destroyed
- * in case the act of destroying the widget in the operating
- * system causes application code to run in callback that
- * could access the widget.
- * </p>
- *
- * @see #dispose
- * @see #releaseChild
- * @see #releaseWidget
- * @see #releaseHandle
- */
-void releaseHandle () {
-}
-
-/*
- * Releases any internal resources back to the operating
- * system and clears all fields except the widget handle.
- * <p>
- * When a widget is destroyed, resources that were acquired
- * on behalf of the programmer need to be returned to the
- * operating system. For example, if the widget made a
- * copy of an icon, supplied by the programmer, this copy
- * would be freed in <code>releaseWidget</code>. Also,
- * to assist the garbage collector and minimize the amount
- * of memory that is not reclaimed when the programmer keeps
- * a reference to a disposed widget, all fields except the
- * handle are zero'd. The handle is needed by <code>destroyWidget</code>.
- * </p>
- * <p>
- * Typically, a widget with children will broadcast this
- * message to all children so that they too can release their
- * resources. The <code>releaseHandle</code> method is used
- * as part of this broadcast to zero the handle fields of the
- * children without calling <code>destroyWidget</code>. In
- * this scenario, the children are actually destroyed later,
- * when the operating system destroys the widget tree.
- * </p>
- * This method is called after <code>releaseChild</code>.
- *
- * @see #dispose
- * @see #releaseChild
- * @see #releaseWidget
- * @see #releaseHandle
- */
-void releaseWidget () {
- sendEvent (SWT.Dispose);
- state |= DISPOSED;
- eventTable = null;
- data = null;
- keys = null;
- values = null;
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-public void removeListener (int eventType, Listener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when an event of the given type occurs.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It should never be
- * referenced from application code.
- * </p>
- *
- * @param eventType the type of event to listen for
- * @param listener the listener which should no longer be notified when the event occurs
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see Listener
- * @see #addListener
- */
-protected void removeListener (int eventType, SWTEventListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, listener);
-}
-
-/**
- * Removes the listener from the collection of listeners who will
- * be notifed when the widget is disposed.
- *
- * @param listener the listener which should no longer be notified when the receiver is disposed
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see DisposeListener
- * @see #removeDisposeListener
- */
-public void removeDisposeListener (DisposeListener listener) {
- checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (SWT.Dispose, listener);
-}
-
-void sendEvent (int eventType) {
- if (eventTable == null) return;
- sendEvent (eventType, new Event ());
-}
-
-void sendEvent (int eventType, Event event) {
- if (eventTable == null) return;
- event.widget = this;
- event.type = eventType;
- if (event.time == 0) {
- if (OS.IsWinCE) {
- event.time = OS.GetTickCount ();
- } else {
- event.time = OS.GetMessageTime ();
- }
- }
- eventTable.sendEvent (event);
-}
-
-/**
- * Sets the application defined widget data associated
- * with the receiver to be the argument. The <em>widget
- * data</em> is a single, unnamed field that is stored
- * with every widget.
- * <p>
- * Applications may put arbitrary objects in this field. If
- * the object stored in the widget data needs to be notified
- * when the widget is disposed of, it is the application's
- * responsibility to hook the Dispose event on the widget and
- * do so.
- * </p>
- *
- * @param data the widget data
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
- * </ul>
- */
-public void setData (Object data) {
- checkWidget();
- this.data = data;
-}
-
-/**
- * Sets the application defined property of the receiver
- * with the specified name to the given value.
- * <p>
- * Applications may associate arbitrary objects with the
- * receiver in this fashion. If the objects stored in the
- * properties need to be notified when the widget is disposed
- * of, it is the application's responsibility to hook the
- * Dispose event on the widget and do so.
- * </p>
- *
- * @param key the name of the property
- * @param value the new value for the property
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #getData
- */
-public void setData (String key, Object value) {
- checkWidget();
- if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys [index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String [keys.length - 1];
- Object [] newValues = new Object [values.length - 1];
- System.arraycopy (keys, 0, newKeys, 0, index);
- System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy (values, 0, newValues, 0, index);
- System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String [] {key};
- values = new Object [] {value};
- return;
- }
- for (int i=0; i<keys.length; i++) {
- if (keys [i].equals (key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String [keys.length + 1];
- Object [] newValues = new Object [values.length + 1];
- System.arraycopy (keys, 0, newKeys, 0, keys.length);
- System.arraycopy (values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the receiver
- */
-public String toString () {
- String string = "*Disposed*";
- if (!isDisposed ()) {
- string = "*Wrong Thread*";
- if (isValidThread ()) string = getNameText ();
- }
- return getName () + " {" + string + "}";
-}
-
-/*
- * Returns a single character, converted from the wide
- * character set (WCS) used by Java to the specified
- * multi-byte character set used by the operating system
- * widgets.
- *
- * @param ch the WCS character
- * @param codePage the code page used to convert the character
- * @return the MBCS character
- */
-int wcsToMbcs (char ch, int codePage) {
- if (OS.IsUnicode) return ch;
- if (ch <= 0x7F) return ch;
- TCHAR buffer = new TCHAR (codePage, ch, false);
- return buffer.tcharAt (0);
-}
-
-/*
- * Returns a single character, converted from the wide
- * character set (WCS) used by Java to the default
- * multi-byte character set used by the operating system
- * widgets.
- *
- * @param ch the WCS character
- * @return the MBCS character
- */
-int wcsToMbcs (char ch) {
- return wcsToMbcs (ch, 0);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/WidgetTable.java
deleted file mode 100755
index 816b496751..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/WidgetTable.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.swt.widgets;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * This class contains static methods which provide a map from the
- * platform representation of a widget to the SWT control.
- */
-
-class WidgetTable {
- static int FreeSlot = 0;
- static int GrowSize = 1024;
- static int [] IndexTable = new int [GrowSize];
- static Control [] ControlTable = new Control [GrowSize];
- static {
- for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
- IndexTable [GrowSize - 1] = -1;
- }
-
-public static synchronized Control get (int handle) {
- if (handle == 0) return null;
- int index = OS.GetWindowLong (handle, OS.GWL_USERDATA) - 1;
- if (0 <= index && index < ControlTable.length) return ControlTable [index];
- return null;
-}
-
-public synchronized static void put (int handle, Control control) {
- if (handle == 0) return;
- if (FreeSlot == -1) {
- int length = (FreeSlot = IndexTable.length) + GrowSize;
- int [] newIndexTable = new int [length];
- Control [] newControlTable = new Control [length];
- System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
- System.arraycopy (ControlTable, 0, newControlTable, 0, FreeSlot);
- for (int i=FreeSlot; i<length-1; i++) newIndexTable [i] = i + 1;
- newIndexTable [length - 1] = -1;
- IndexTable = newIndexTable;
- ControlTable = newControlTable;
- }
- OS.SetWindowLong (handle, OS.GWL_USERDATA, FreeSlot + 1);
- int oldSlot = FreeSlot;
- FreeSlot = IndexTable [oldSlot];
- IndexTable [oldSlot] = -2;
- ControlTable [oldSlot] = control;
-}
-
-public static synchronized Control remove (int handle) {
- if (handle == 0) return null;
- Control control = null;
- int index = OS.GetWindowLong (handle, OS.GWL_USERDATA) - 1;
- if (0 <= index && index < ControlTable.length) {
- control = ControlTable [index];
- ControlTable [index] = null;
- IndexTable [index] = FreeSlot;
- FreeSlot = index;
- OS.SetWindowLong (handle, OS.GWL_USERDATA, 0);
- }
- return control;
-}
-
-public static synchronized Shell [] shells () {
- /*
- * This code is intentionally commented.
- * Bug in JVM 1.2. For some reason, when the following code
- * is inlined in this method, the JVM issues this error error:
- *
- * A nonfatal internal JIT (3.00.072b(x)) error 'GetRegisterA' has occurred in :
- * 'org/eclipse/swt/widgets/WidgetTable.shells ()[Lorg/eclipse/swt/widgets/Shell;': Interpreting method.
- * Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi
- *
- * The fix is to move the code that would be inlined into another method.
- */
-// int size = 0;
-// for (int i=0; i<WidgetTable.length; i++) {
-// Control control = WidgetTable [i];
-// if (control != null && control instanceof Shell) size++;
-// }
-
- int size = shellSize ();
- int index = 0;
- Shell [] result = new Shell [size];
- for (int i=0; i<ControlTable.length; i++) {
- Control control = ControlTable [i];
- if (control != null && control instanceof Shell) {
- result [index++] = (Shell) control;
- }
- }
- return result;
-}
-
-static int shellSize () {
- int length = 0;
- for (int i=0; i<ControlTable.length; i++) {
- Control control = ControlTable [i];
- if (control != null && control instanceof Shell) length++;
- }
- return length;
-}
-
-public static synchronized int size () {
- int length = 0;
- for (int i=0; i<ControlTable.length; i++) {
- if (ControlTable [i] != null) length++;
- }
- return length;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/about.html b/bundles/org.eclipse.swt/about.html
deleted file mode 100644
index 1b9fd2cf26..0000000000
--- a/bundles/org.eclipse.swt/about.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body lang="EN-US" link="blue" vlink="purple">
-<table border="0" cellspacing="5" cellpadding="2" width="100%" >
- <tr>
- <td align="LEFT" valign="TOP" colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>5th December, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in &quot;Content&quot;. Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Third Party Content</h3>
-
-<p>Sub-directories in this plug-in may contain portions distributed under different license agreements and/or notices. Details about these license agreements and notices are
-contained in &quot;about.html&quot; files &quot;Abouts&quot; located in sub-directories in this plug-in. Such Abouts govern your use of the associated software in that directory, not the
-Common Public License.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL &quot;Other License&quot;, any modifications, enhancements and/or
-other code and/or documentation &quot;Modifications&quot; uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/build.properties b/bundles/org.eclipse.swt/build.properties
deleted file mode 100644
index 869eca15b2..0000000000
--- a/bundles/org.eclipse.swt/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-custom = true
diff --git a/bundles/org.eclipse.swt/build.xml b/bundles/org.eclipse.swt/build.xml
deleted file mode 100644
index 6a96dd10c0..0000000000
--- a/bundles/org.eclipse.swt/build.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.swt" default="plugin.zip" basedir=".">
- <target name="initTemplate" unless="template">
- <initTemplate/>
- </target>
- <target name="init" depends="initTemplate">
- <property name="plugin" value="org.eclipse.swt"/>
- <property name="version" value="2.0.0"/>
- <property name="stamp" value=""/>
- <property name="emulatedswt" value="Eclipse SWT/emulated/org/eclipse/swt"/>
- </target>
-
- <target name="src.zip" depends="init">
- <property name="base" value="${basedir}/src.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="src">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.src.zip ."/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="plugin.zip" depends="bin.zip"/>
- <target name="bin.zip" depends="init">
- <property name="base" value="${basedir}/bin.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="jar">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <antcall target="bin">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.zip . -x *.bin.log "/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="log.zip" depends="init">
- <property name="base" value="${basedir}/log.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="log">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.log.zip ."/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="ws/gtk/swt-pi.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/"/>
- <property name="excludes" value="Eclipse SWT PI/gtk/library/"/>
- <property name="dest" value="${basedir}/ws/gtk/swt-pi.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/gtk/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
- <property name="includes" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
- <property name="excludes" value="Eclipse SWT/common/library/"/>
- <property name="dest" value="${basedir}/ws/gtk/swt.jar"/>
- <property name="compilePath" value="ws/gtk/swt-pi.jar"/>
- </ant>
- </target>
-
- <target name="ws/motif/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/motif/library/"/>
- <property name="dest" value="${basedir}/ws/motif/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/photon/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2se/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/photon/library/,${emulatedswt}/widgets/TabFolder.java,${emulatedswt}/widgets/TabItem.java"/>
- <property name="dest" value="${basedir}/ws/photon/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/win32/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2se/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/win32/library/"/>
- <property name="dest" value="${basedir}/ws/win32/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="jar" depends="init,ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar">
- </target>
-
- <target name="ws/gtk/swt-pisrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/,Eclipse SWT PI/gtk/"/>
- <property name="includes" value="Eclipse SWT PI/gtk/about.html,Eclipse SWT PI/gtk/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT PI/gtk/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/gtk/swt-pisrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/gtk/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/common/"/>
- <property name="includes" value="Eclipse SWT/gtk/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/gtk/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/gtk/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/gtk/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/CoolBar.java,Eclipse SWT/emulated/**/CoolItem.java,Eclipse SWT/emulated/**/BidiUtil.java,Eclipse SWT/common/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/gtk/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/motif/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/motif/"/>
- <property name="includes" value="Eclipse SWT/motif/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/motif/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/motif/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/motif/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/motif/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/motif/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/motif/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/photon/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/photon/"/>
- <property name="includes" value="Eclipse SWT/photon/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/photon/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/photon/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/photon/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/photon/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/photon/library/"/>
- <property name="excludes" value="${emulatedswt}/widgets/TabFolder.java,${emulatedswt}/widgets/TabItem.java"/>
- <property name="dest" value="${destroot}/ws/photon/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/win32/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/win32/"/>
- <property name="includes" value="Eclipse SWT/win32/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT AWT/win32/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/win32/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT OLE Win32/win32/**/*.java,Eclipse SWT Printing/win32/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/win32/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT PI/win32/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/win32/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/win32/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="src" depends="init,ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip">
- </target>
-
- <target name="bin" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="bin">
- <property name="includes" value="plugin.xml,about.html,plugin.properties,ws/,os/"/>
- <property name="excludes" value="Eclipse SWT Printing/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Program/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/photon/,Eclipse SWT Program/win32/,Eclipse SWT Program/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT/motif/,Eclipse SWT/photon/,Eclipse SWT/win32/,Eclipse SWT/gtk/,Eclipse SWT/common_j2se/,Eclipse SWT PI/common_j2se/,Eclipse SWT PI/motif/,Eclipse SWT PI/photon/,Eclipse SWT PI/win32/,Eclipse SWT PI/gtk/,Eclipse SWT Custom Widgets/common/,Eclipse SWT AWT/win32/,Eclipse SWT OLE Win32/win32/,Eclipse SWT/emulated/"/>
- <property name="dest" value="${destroot}"/>
- </ant>
- </target>
-
- <target name="log" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="log">
- <property name="dest" value="${destroot}"/>
- </ant>
- </target>
-
- <target name="clean" depends="init">
- <ant antfile="${template}" target="clean">
- <property name="jar" value="ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar"/>
- <property name="srczips" value="ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip"/>
- </ant>
- <delete>
- <fileset dir="." includes="**/*.pdetemp"/>
- </delete>
- <delete file="${plugin}_${version}.zip"/>
- <delete file="${plugin}_${version}.src.zip"/>
- <delete file="${plugin}_${version}.doc.zip"/>
- <delete file="${plugin}_${version}.log.zip"/>
- </target>
-</project>
diff --git a/bundles/org.eclipse.swt/build_j2me.xml b/bundles/org.eclipse.swt/build_j2me.xml
deleted file mode 100644
index c7701843e5..0000000000
--- a/bundles/org.eclipse.swt/build_j2me.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.swt" default="plugin.zip" basedir=".">
- <target name="initTemplate" unless="template">
- <initTemplate/>
- </target>
- <target name="init" depends="initTemplate">
- <property name="plugin" value="org.eclipse.swt"/>
- <property name="version" value="2.0.0"/>
- <property name="stamp" value=""/>
- <property name="emulatedswt" value="Eclipse SWT/emulated/org/eclipse/swt"/>
- </target>
-
- <target name="src.zip" depends="init">
- <property name="base" value="${basedir}/src.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="src">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.src.zip ."/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="plugin.zip" depends="bin.zip"/>
- <target name="bin.zip" depends="init">
- <property name="base" value="${basedir}/bin.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="jar">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <antcall target="bin">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.zip . -x *.bin.log "/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="log.zip" depends="init">
- <property name="base" value="${basedir}/log.zip.pdetemp"/>
- <delete dir="${base}"/>
- <mkdir dir="${base}"/>
- <antcall target="log">
- <param name ="destroot" value="${base}/plugins/${plugin}_${version}"/>
- </antcall>
- <exec dir="${base}" executable="zip">
- <arg line="-r ${basedir}/${plugin}_${version}.log.zip ."/>
- </exec>
- <delete dir="${base}"/>
- </target>
-
- <target name="ws/gtk/swt-pi.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2me/"/>
- <property name="includes" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2me/"/>
- <property name="excludes" value="Eclipse SWT PI/gtk/library/"/>
- <property name="dest" value="${basedir}/ws/gtk/swt-pi.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/gtk/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
- <property name="includes" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
- <property name="excludes" value="Eclipse SWT/common/library/"/>
- <property name="dest" value="${basedir}/ws/gtk/swt.jar"/>
- <property name="compilePath" value="ws/gtk/swt-pi.jar"/>
- </ant>
- </target>
-
- <target name="ws/motif/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2me/"/>
- <property name="includes" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2me/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/motif/library/"/>
- <property name="dest" value="${basedir}/ws/motif/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/photon/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2me/"/>
- <property name="includes" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2me/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/photon/library/,${emulatedswt}/widgets/TabFolder.java,${emulatedswt}/widgets/TabItem.java"/>
- <property name="dest" value="${basedir}/ws/photon/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="ws/win32/swt.jar" depends="init">
- <ant antfile="${template}" target="jar">
- <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2me/"/>
- <property name="includes" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2me/"/>
- <property name="excludes" value="Eclipse SWT/common/library/,Eclipse SWT PI/win32/library/"/>
- <property name="dest" value="${basedir}/ws/win32/swt.jar"/>
- <property name="compilePath" value=""/>
- </ant>
- </target>
-
- <target name="jar" depends="init,ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar">
- </target>
-
- <target name="ws/gtk/swt-pisrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2me/,Eclipse SWT PI/gtk/"/>
- <property name="includes" value="Eclipse SWT PI/gtk/**/*.java,Eclipse SWT PI/common_j2me/**/*.java,Eclipse SWT PI/gtk/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/gtk/swt-pisrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/gtk/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/common/"/>
- <property name="includes" value="Eclipse SWT/gtk/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2me/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/gtk/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/gtk/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/gtk/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/CoolBar.java,Eclipse SWT/emulated/**/CoolItem.java,Eclipse SWT/emulated/**/BidiUtil.java,Eclipse SWT/common/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/gtk/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/motif/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2me/,Eclipse SWT/common/,Eclipse SWT PI/motif/"/>
- <property name="includes" value="Eclipse SWT/motif/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2me/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/motif/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/motif/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/motif/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/motif/**/*.java,Eclipse SWT PI/common_j2me/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/motif/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/motif/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/photon/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2me/,Eclipse SWT/common/,Eclipse SWT PI/photon/"/>
- <property name="includes" value="Eclipse SWT/photon/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2me/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/photon/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/photon/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/photon/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/photon/**/*.java,Eclipse SWT PI/common_j2me/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/photon/library/"/>
- <property name="excludes" value="${emulatedswt}/widgets/TabFolder.java,${emulatedswt}/widgets/TabItem.java"/>
- <property name="dest" value="${destroot}/ws/photon/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="ws/win32/swtsrc.zip" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2me/,Eclipse SWT/common/,Eclipse SWT PI/win32/"/>
- <property name="includes" value="Eclipse SWT/win32/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2me/**/*.java,Eclipse SWT AWT/win32/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/win32/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT OLE Win32/win32/**/*.java,Eclipse SWT Printing/win32/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/win32/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT PI/win32/**/*.java,Eclipse SWT PI/common_j2me/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/win32/library/"/>
- <property name="excludes" value=""/>
- <property name="dest" value="${destroot}/ws/win32/swtsrc.zip"/>
- </ant>
- </target>
-
- <target name="src" depends="init,ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip">
- </target>
-
- <target name="bin" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="bin">
- <property name="includes" value="plugin.xml,about.html,plugin.properties,ws/,*.jar"/>
- <property name="excludes" value="Eclipse SWT Printing/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Program/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/photon/,Eclipse SWT Program/win32/,Eclipse SWT Program/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2me/,Eclipse SWT/motif/,Eclipse SWT/photon/,Eclipse SWT/win32/,Eclipse SWT/gtk/,Eclipse SWT/common_j2me/,Eclipse SWT PI/common_j2me/,Eclipse SWT PI/motif/,Eclipse SWT PI/photon/,Eclipse SWT PI/win32/,Eclipse SWT PI/gtk/,Eclipse SWT Custom Widgets/common/,Eclipse SWT AWT/win32/,Eclipse SWT OLE Win32/win32/,Eclipse SWT/emulated/"/>
- <property name="dest" value="${destroot}"/>
- </ant>
- </target>
-
- <target name="log" depends="init">
- <property name="destroot" value="${basedir}"/>
- <ant antfile="${template}" target="log">
- <property name="dest" value="${destroot}"/>
- </ant>
- </target>
-
- <target name="clean" depends="init">
- <ant antfile="${template}" target="clean">
- <property name="jar" value="ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar"/>
- <property name="srczips" value="ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip"/>
- </ant>
- <delete>
- <fileset dir="." includes="**/*.pdetemp"/>
- </delete>
- <delete file="${plugin}_${version}.zip"/>
- <delete file="${plugin}_${version}.src.zip"/>
- <delete file="${plugin}_${version}.doc.zip"/>
- <delete file="${plugin}_${version}.log.zip"/>
- </target>
-</project>
diff --git a/bundles/org.eclipse.swt/buildnotes_swt.html b/bundles/org.eclipse.swt/buildnotes_swt.html
deleted file mode 100755
index 5f6d625a4b..0000000000
--- a/bundles/org.eclipse.swt/buildnotes_swt.html
+++ /dev/null
@@ -1,584 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.7 [en] (WinNT; I) [Netscape]">
- <meta name="Author" content="IBM">
- <title>Eclipse Platform Build Notes - SWT</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 024 - Tuesday January 29, 2002
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4654: VAJ hangs when dragging from file manager to the desktop. (1GDQFZ6)
-<br>4720: Eclipse freezes during drag & drop operation (1GF7RRH)
-<br>4724: GP - Fatal app error - renaming resource on linux (1GF7TXO)
-<br>4736: Fix printing (1GFW2CW)
-<br>4817: Need JavaDoc comments for SWT Photon (1GJLEU0)
-<br>6835: Characters öäå and £ doesn't work in Java editor on Swedish
-<br>8255: Closing paint viewer causes internal error
-<br>8410: Black color become transparent in ToolBar images
-<br>8503: StyledText - cheese if resize in word wrap tries to keep partial top line
-<br>8547: Intellimouse scrolling does not work in eclipse
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 023a - Thursday January 24, 2002 (Eclipse Milestone 2)
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4700: NumLock and CapsLock disable accelerators (1GETDT9)
-<br>6180: Wake mechanism broken on Motif
-<br>6873: Decorations.setImage() throws NPE on WINCE
-<br>7805: A new ImageData(from an InputStream) throwing NPE
-<br>8133: When toolbar has focus, can't use mnemonics for File menus
-<br>8213: exception: widget is disposed
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 023 - Tuesday January 22, 2002
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4610: StyledText - DCR - Word wrap (1GABS6C)
-<br>4644: Mouse click on a link displayed in embedded IE5 ActiveX is not reliable (1GD7TT2)
-<br>5660: SWT default font's need to honor accesability settings
-<br>6324: SWT.CLOSE implies rendering of Minimize and Maximize buttons
-<br>6997: StyledText - mark new API
-<br>7123: Shell shows the maximize button enabled when SWT.TITLE | SWT.BORDER | SWT.CLOSE style passed
-<br>7361: Add getOffsetAtLine API
-<br>7632: Tree widget doesn't select item with focus on right-click
-<br>7849: Labels on WINCE don't use background color of parent when color isn't set
-<br>7867: DCR: Delete checkSubclass method from Dialog
-<br>7959: Potential problems when running on big endian machines
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 022 - Tuesday January 15, 2002
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4663: Fail to tab the views. (1GGYV8T)
-<br>4718: Tool tip is openning when on dragging. (1GF5Z7Z)
-<br>5866: Can't multiselect in Tree using keyboard
-<br>6592: Box for checkbox table items is too large when using large fonts
-<br>6770: Only the left mouse button should select in a Table.
-<br>6852: StyledText - verify event character invalid value
-<br>6940: MenuShortcuts only respond to Ctrl-N
-<br>7190: Ctrl-S does not work
-<br>7458: WinCE - top level Shells created through Display.asyncexec can have incorrect Z-order
-<br>7459: Caret leaving garbage
-<br>7486: Cannot use keyboard Shift Select in a Tree
-<br>7559: ScrollBar thumb is reset when ScrollBar is hidden, then shown
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 021 - Tuesday January 8, 2002
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4443: Layout: Exceptions when horizontalSpan > remaining columns (1FFC6XZ)
-<br>4462: ScrollBar - vbar.setMaximum does not work after hbar is hidden (and vice versa) (1FIG5CG)
-<br>4722: First editor tab missing close button (1GF7QIQ)
-<br>4755: Rebuilding launcher from another directory (1GGNRG0)
-<br>6315: Some perspective save confirmation messages cut off
-<br>6352: Editor doesn't get activated when revealing first match
-<br>6908: Menu handle leak in org.eclipse.swt.widgets.Menu.destroyItem(MenuItem)
-<br>6945: Child shells not displaying on WinCE
-<br>6982: CheckedTables have no check boxes
-<br>7005: Missing methods in SWT/GTK implementation
-<br>7018: Tree does not honor SWT.CHECK style
-<br>7068: ScrollBar.setVisible(true) does not work after changing values
-<br>7150: StyledText - bidi - partial styling of ligatures bug
-<br>7191: Dialogs not big enough for content
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 020 - Tuesday December 18, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4715: First help click on a chapter is ignored (1GF5TV9)
-<br>4784: MIF Files sometime fail (1GI7H7V)
-<br>4797: Table does not use System fonts (1GIV4PZ)
-<br>6635: WinCE: decorations.setMenuBar can be set only once
-<br>6685: StyledText - on setFont caret not being positioned correctly
-<br>6773: StyledText.computeSize uses display width to calculate number of visible lines
-<br>6790: Touching code assist scrollbar dumps javacore
-<br>6863: Remaining issues in emulated CoolBar and CoolItem
-<br>6933: Switching to help perspective crashes the workbench
-<br>7014: Tree not accepting children
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 019 - Tuesday December 11, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4461: SWTException should overwrite printStackTrace(..) (1GLDW6P)
-<br>4493: Check multilingual support on Windows 2000 (1FQFCBQ)
-<br>4611: StyledText - StringIndexOutOfBounds exception inserting text in line break (1GEID8B)
-<br>4620: Workbench does not close ActiveX control's file handle (1GB76AZ)
-<br>4660: Moving
-<br>4719: Background colour of views/editors (1GF6C8Y)
-<br>4739: DCR: Provide auto-scrolling and expansion by default in the tree during DND (1GFW7NQ)
-<br>4767: Tab Folders can not be toggled using keys. (1GHFCZU)
-<br>4780: YAM: Cannot read some JPEG files (1GI6ZEN)
-<br>4783: Can't scroll to the top of the navigator (1GI7GTG)
-<br>5071: Shift-TAB doesn't generate proper event
-<br>5677: Hierarchy outline has empty space
-<br>5857: Image.getImageData needs to support 15 bit color depth
-<br>6472: Table widget has empty entries
-<br>6572: Default background color of Lists and Combos not consistent with Win2K
-<br>6651: Text.setSelection() doesn't actually display the selection visually for SWT.SINGLE
-<br>6654: Text.getSelection() not returning correct info on WINCE
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 018 - Tuesday December 4, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4419: Widgets - Missing features and API on MOTIF (1FBPKCT)
-<br>4494: ColorDialog doesn't open in VA/Java with JDK 1.2 (1FQGM6H)
-<br>4833: Remove focus button from Table (1GK7MK4)
-<br>4860: StyledText - StyledTextBidi, BidiUtil need doc (1GL32C8)
-<br>6204: KeyListener on table does not work.
-<br>6438: StyledText - bidi - isBidi test not working on XP
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 017 - Tuesday November 27, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4714: Label draws wrong background when image is set (1GF0IC6)
-<br>5503: Tabbing broken
-<br>5986: BidiUtil handling of WM_INPUTLANGCHANGE needs to be fixed
-<br>5992: Changing Java Editor font in Preference Page makes Eclipse hang or crash
-<br>6171: NullPointerException in ImageLoader save method with SWT.IMAGE_JPEG
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 015 - Tuesday November 20, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4791: StyledText does not switch colour (1GILHIW)
-<br>4956: StyledText - change StyledTextBidi.toString to conform with standard SWT format
-<br>5599: StyledText - redrawRange does not check range
-<br>5722: Selecting font crashes eclipse with a javacore
-<br>5815: StyledText - setFont refresh problem
-<br>5846: Combo.select does not ignore an out of range index
-<br>5990: Printing single page prints entire document
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 014 - Thursday November 15, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4542: Menu accelerators CTRL+ / and CTRL + SHIFT + / don't work (1FYAF8V)
-<br>4754: Arrow keys not accepted as keyboard accelerators (1GGM4U3)
-<br>5815: StyledText - setFont refresh problem
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 013 - Tuesday November 13, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-4846: StyledText - bidi - partial styling of ligatures (1GL3AWT)
-<br>4859: StyledText - bidi - provide solution for bidi coloring hack (1GL2UNC)
-<br>5491: StyledText - getStyleRangeAtOffset allows offset == getCharCount
-<br>5497: StyledText - ExtendedModify event not sent on setText
-<br>5602: StyledText - page down causes IllegalArgumentException in invisible/small widget
-<br>5615: StyledText - window start does not always work
-<br>5622: StyledText - print causes NPE when invoked on empty widget
-<br>5626: StyledText - print does not check for null Printer argument
-<br>5633: StyledText - replaceTextRange and setText do not check for null argument
-<br>5664: StyledText - Single line should not accept tab
-<br>5673: StyledText - SINGLE line mode still allows some multi line cursor navigation
-<br>5722: Selecting font crashes eclipse with a javacore
-<br>5725: Please rename "Eclipse Launcher"
-<br>5802: EC: ControlExample does not run on Solaris
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 012 - Monday November 5, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-<blockquote>
-5470: User is lost when trying to move views around
-<br>5484: Tab no longer traverses between widgets!!!
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 011 - Thursday November 1, 2001
-<h2>
-<a NAME="API Changes"></a>API Changes</h2>
-<code>FontData.setLocale(Locale)</code> has been changed to <code>FontData.setLocale(String)</code>.
-<ul>
-<li>
-J2SE code can simply create a <code>Locale</code> and invoke <code>toString()</code> to pass it onto the new <code>setLocale</code>.
-<li>
-CLDC code will have to form a string matching the format specified in the J2SE javadoc of <code>java.util.Locale.toString()</code>.
-</ul>
-Example:
-<blockquote><code><pre>
-Locale[] locales = {
- Locale.US, new Locale("iw", "IL"), new Locale("ar", "SA"), new Locale("ru", "RU"),
- Locale.GERMAN, new Locale("ja", "JP"),
- null,
-};
-// old code: fd.setLocale(locales[i]);
-String locale = (locales[i] != null ? locales[i].toString() : null);
-fd.setLocale(locale);
-</pre></code></blockquote></p>
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-4664: StyledText does not compute correct text width (1GELJXD)
-<br>4832: German: Fonts cannot handle German characters (1GKMHHY)
-<br>4961: Preferences dialog disappears when you click on certain pages
-<br>5180: Open Motif for Linux shared libraries are duplicated in Eclipse
-<br>5304: StyledText - ArrayIndexOutOfBoundsException in StyledTextBidi.segmentedRangesFor
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 010 - Thursday October 25, 2001
-
-<h2>
-<a NAME="Behaviour change"></a>Behaviour change</h2>
-<p>
-1) The Drag Under effect of scrolling and expanding items as you drag over the <code>Tree</code> or <code>Table</code> has been added. To enable this drag under effect, in the <code>DragOver</code> event set the <code>event.feedback</code> to have a bitwise combination of <code>DND.FEEDBACK_SCROLL, DND.FEEDBACK_EXPAND</code> and (<code>DND.FEEDBACK_SELECT, DND.FEEDBACK_INSERT_BEFORE, DND.FEEDBACK_INSERT_AFTER</code>) - where the last three items are mutually exclusive.
-<blockquote><code><pre>
-target.addDropListener (new DropTargetAdapter() {
- public void dragOver(DropTargetEvent event){
- event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
-}
-</pre></code></blockquote></p>
-<p>
-2) On some operating systems it is preferred to move files in a drag and drop operation rather than for the drop target to make a copy of the file and the drag source to delete the original file. The operation of moving the file is preformed by the drop target. For these cases, the new drop type <code>DND.DROP_TARGET_MOVE</code> has been added. The Eclipse <code>DropTarget</code> does not support this behaviour but the Eclipse <code>DragSource</code> can recognize this scenario. If another application has chosen to move the file rather than copy/delete, the <code>DragFinished</code> event on the <code>DragSource</code> will have an <code>event.detail</code> value of <code>DND.DROP_TARGET_MOVE</code>.
-<blockquote><code><pre>
-source.addDragListener (new DragSourceAdapter () {
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_TARGET_MOVE) {
- // clean up presentation but do not delete underlying file
- }
- }
-}
-</pre></code></blockquote></p>
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1767: Display ASCII for values greater than 127 fails (1GLE8I5)
-<br>4725: FontData spec should disallow null name (1GL34H3)
-<br>4844: Tab appears narrower than space (1GL2WTY)
-<br>4852: German: Cannot start Eclipse in Linux 7.2 (1GKYY99)
-<br>4865: TableTreeEditor.getItem returns an item after setting it to null (1GLE0IQ)
-<br>4932: StyledTextBidi has equals but no hashCode method
-<br>4957: StyledText - implement StyledTextBidi.isLigated
-<br>5132: StyledText - remove hardcoded margin
-<br>5178: Change BidiUtil calls to handle true Unicode/Windows CE changes
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 009 - Thursday October 18, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-4444: EWT - incorrect selection feedback when the item's text is changed (1FFP3U2)
-<br>4446: DCR - GridBagLayout compatible LayoutManager (1FGCPO2)
-<br>4762: StyledText - default lineStyler remove line background color hack (1GHBMUV)
-<br>4819: StyledText - bidi - cursor navigation (1GJLKSN)
-<br>4820: StyledText with style SINGLE does not handle CR/LF well (1GJM2Z5)
-<br>4855: Severe: Check boxes are black (1GL0XSI)
-<br>4909: EC: Combo.setText doesn't work on Linux
-<br>4910: EC: Combo.select() fires a selected event on Linux only
-<br>5045: Control.moveAbove() throws NPE if argument is null
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 008 - Thursday October 11, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GLDQYB: SWT:WIN - Text widget with DND enabled, MouseDown but no MouseUp
-<br>1GLADBK: SWT:ALL - StyledText - getOffsetAtLocation should throw exception
-<br>1GL4ZVE: SWT:ALL - StyledText - getOffsetAtLocation(getLocationAtOffset(N)) != N
-<br>1GKO6NY: SWT:ALL - Backspacing in StyledText does not fire selection changed
-<br>1GKB1OC: ITPJUI:ALL - Error in JavaDoc hover help
-<br>1GK9API: SWT:ALL - StyledText - bidi - numbers,mixed LtoR/RtoL text and caret positioning
-<br>1GJLQ16: SWT:ALL - StyledText - bidi - backspace and delete behavior
-<br>1GIK7D4: SWT:ALL - StyledText - Selection cleared when deletion disallowed by verify listeners
-<br>1GDOMBI: SWT:WINNT - StyledText - redrawRange() doesn't checkWidget
-<br>1GDKK3R: SWT:WINNT - StyledText - setCaretOffset and line delimiters bug
-<br>1FMRQOT: SWT:ALL - No null argument checks in Dialog constructors
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 007 - Thursday October 4, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GKZH74: ITPJUI:WIN2000 - Disappearing Stop icon
-<br>1GKZ8CV: SWT:WINNT - setSelection triggers SelectionChanged event
-<br>1GKU4C5: SWT:ALL - StyledText - bidi - scrolling to show cursor should take cursor direction into account
-<br>1GKPYMK: SWT:WINNT - StyledText - bidi - caret moves when switching keyboard from Hebrew to Arabic
-<br>1GKOGQO: SWT:ALL - Javadoc: setSelection in Button and ToolItem
-<br>1GKM2O5: SWT:WINNT - StyledText - bidi - ArrayIndexOutOfBounds exception in StyledTextBidi.isRightToLeft
-<br>1GKM193: SWT:WINNT - StyledText - bidi autoscroll left does not always scroll all the way to the left
-<br>1GKKC0U: SWT:ALL - Tracker calls OS.DispatchMessage(msg) on windows but does not on Linux.
-<br>1GIVAXX: SWT:ALL - StyledText - Editors should support shift-backspace
-<br>1GELQ14: SWT:WINNT - StyledText - DefaultContent - handle weird line delimiter cases
-<br>1GE8LG0: SWT:Linux - Toolbar is not showing the separators.
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 006 - Thursday Sept 27, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GHWA19: SWT:WINNT - Problem with callbacks from CCombo
-<br>1GHFDPV: SWT:WIN2000 - Setting selection in Table does not update focus item
-<br>1GF644V: ITPUI:Linux - Unzoom is changing the active editor.
-<br>1GKM3XS: SWT:WINNT - StyledText - bidi autoscroll left: selection reset on mouse move
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 005 - Friday Sept 21, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GK09Z0: SWT:Linux - setEnabled(false) has no effect on aToolbar
-<br>1GJZZS6: SWT:Linux - File Dialog returns a directory
-<br>1GF7SMC: ITPUI:Linux - Wrong bg for close button on editor tab
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 004 - Thursday Sept 13, 2001
-
-<h2>
-<a NAME="API Behaviour change"></a>API Behaviour change</h2>
-The behaviour of dispose for GCs has been modified such that attempting to dispose of
-a GC on a control <em>after</em> the control has been disposed will generate an
-SWTException. This fixes an OS resource leak and potential GPF situation.
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GJUAKL: SWT:Neutrino - Control.internal_new_GC() needs !isValidWidget() check
-<br>1GJN52N: SWT:Linux - Text prints system error message for horizontal scrollbar
-<br>1GJBOAV: SWT:ALL - ScrolledComposite bugs
-<br>1GIXELI: SWT:ALL - Need Caret to allow bitmaps so bidi caret can be created
-<br>1GI5O1T: SWT:WINNT - Composite.setFocus takes focus when it should not
-<br>1GHOND7: SWT:WIN2000 - Selection problem with single-selection trees
-<br>1GHG990: SWT:ALL - Probable bug in Slider page increment setting
-<br>1GENJ60: SWT:ALL - ScrolledComposite should include example in its class comment
-<br>1GEA7K7: ITPUI:Linux - Default button not working
-</blockquote>
-
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 003 - Friday Sept 07, 2001
-
-<h2>
-<a NAME="New APIs"></a>New APIs</h2>
-
-<blockquote>
-FontData.setLocale(java.util.Locale) added
-<br>Caret.getImage() added
-<br>Caret.setImage(Image) added
-<br>GC.fillGradientRectangle(int, int, int, int, boolean) added
-</blockquote>
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GJM7KM: SWT:Linux - Table and Tree return a different size for every second call to computeSize
-<br>1GJLKHE: SWT:SPARC - GP on "Installed JREs" preference page
-<br>1GJLK63: SWT:ALL - StyledText - bidi - keyboard switching
-<br>1GJLE36: SWT:WINNT - Alpha data redrawing improperly after occlusion
-<br>1GJA2L7: SWT:WIN - Different behavior for GC.drawString() args on Win vs. Photon
-<br>1GIZ0P6: SWT:WINNT - GC.drawImage() problem with transparent pixels
-<br>1GIXELI: SWT:ALL - Need Caret to allow bitmaps so bidi caret can be created
-<br>1GI7FQF: SWT:ALL - Can't set focus to Tasks View by Keyboard
-<br>1GI7EBL: SWT:Linux - api typo: ToolItem>>getDisabledmage()
-<br>1GI3P86: SWT:ALL - Semantic differences between emulated Table and Tree codebase on Motif and Photon
-<br>1GI1WEA: SWT:Neutrino - Text selection code not working correctly
-<br>1GHWED2: SWT:WINNT - GC.stringExtent() not correct for Windows Arial font
-<br>1GHWB7G: SWT:Linux - Linux font dialog doesn't open with given values.
-<br>1GHVRFY: SWT:Neutrino - Text#ClearSelection changes the CaretPosition in a SINGLE-line widget
-<br>1GHVLV6: SWT:Neutrino - Text#SetTopIndex and getTopIndex inconsistent
-<br>1GHOJ6T: SWT:Neutrino - Text#setSelection inconsistent between SINGLE and MULTI
-<br>1GHBLRA: SWT:Neutrino - Display.getBounds() returns incorrect info
-<br>1GH48UQ: SWT:Neutrino - Enter key does not insert new line with Text.MULTI widget
-<br>1GGT0TM: SWT:Neutrino - GC#drawArc inconsistent between NT and NTO
-<br>1GG1DBT: SWT:SPARC - Solaris loses input characters
-<br>1GG07HW: SWT:Linux - Tree.getItem() modifies its argument on Motif
-<br>1GG0069: SWT:Linux - Weird layout issues seen in Control Example
-<br>1GFZZLK: SWT:Linux - ToolItems not disabled when containing ToolBar is disabled
-<br>1GFZU3X: SWT:ALL - ImageLoader.load(String) not closing file input stream
-<br>1GFZPDP: SWT:Linux - Combo box with SWT.SIMPLE style does not respect Disabled flag (visually)
-<br>1GFW85H: SWT:ALL - Printer.getPrinterData() has stale comment
-<br>1GFW6MQ: SWT:ALL - DCR: Program class needs .equals() and .hashCode()
-<br>1GFW4YN: SWT:ALL - Help KevinH add printing to Eclipse
-<br>1GFQKDT: SWT:ALL - Image.setBackground() / getBackground() asymmetry
-<br>1GFONVW: SWT:Linux - Empty Combo should not fire Selection event
-<br>1GFL0HP: SWT:Linux - Remaining items in SWT comments to fix
-<br>1GET90D: SWT:Linux - SWTExceptions bring down Eclipse
-<br>1GESQBK: ITPJUI:WINNT - How to get access to pop-up menus of the Java editor ?
-<br>1GELX4A: ITPUI:ALL - Hover help is not visible if pane is dragged out of workbench
-<br>1GEHWAF: ITPUI:WIN2000 - Can't enter text in a Swing TextField or TextArea
-<br>1GE5ECJ: ITPUI:WIN2000 - Hover help for title bar buttons appears behind detached view
-<br>1GDX7R8: ITPUI:ALL - SWT setText() does NOT have any way to avoid making mnemonics.
-<br>1GD5UHA: SWT:WIN2000 - Double-clicking on toolbar item gives double-click event on toolbar
-<br>1GBXIEO: SWT:ALL - DCR: Include cursor pos in Tracker move event
-<br>1G4IMQ3: SWT:WINNT - Table images incorrect after rapid removal and creation
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 002 - Wednesday July 18, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GGZ13T: SWT:Neutrino - invalid mouse state occuring in Photon
-<br>1GGRCCS: SWT:Neutrino - Label does not wrap in SWT0125
-<br>1GGAON2: SWT:ALL - Scaling image with alphas does not work correctly
-<br>1GFZQVQ: SWT:Linux - Vertical ProgressBar grows incorrectly
-<br>1GFQA18: SWT:Linux - Cheese with GC drawRoundedRectangle() on Motif
-<br>1GFPK6G: SWT:Linux - Motif fillPolygon() specifies improper hint
-</blockquote>
-
-<h1>
-Eclipse Platform Build Notes<br>
-SWT</h1>
-SWT Build 2.0 001 - Thursday July 12, 2001
-
-<h2>
-<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
-
-<blockquote>
-1GGET76: SWT:Neutrino - Canvas does not respond to setFocus()
-<br>1GGAS5P: SWT:Neutrino - Photon on QNX 6.1.x needs SWT native changes
-<br>1GG96RO: SWT:Neutrino - drawOval and fillOval not compatible
-<br>1GG8ZLV: SWT:WINNT - drawOval behaves differently on Windows vs. other platforms
-<br>1GFKYD9: SWT:Linux - -HANG- (Xserver) When perfoming display.wake() in a DND dragStart()
-<br>1GFKK37: SWT:Linux - FileViewer examples issues
-<br>1GFBHX6: SWT:ALL - CTabItem tool tip flashing
-<br>1GF9ZMT: SWT:SPARC - 8-bit Icons are losing colors
-<br>1GF9ZJG: SWT:SPARC - Icons are being masked incorrectly on Solaris
-<br>1GF9YHD: ITPUI:WIN2000 - SWTException: help view
-<br>1GF9Y32: SWT:SPARC - 24-bit MSB Icons are wrong color (greenish)
-<br>1GF0D05: SWT:Linux - GPFs when running JUnit TestRunner in J9 AWT
-<br>1GEUZZC: SWT:ALL - "Name" of plugin inconsistant with other plugins
-<br>1GETDP5: ITPUI:Linux - NPE while closing editor on linux
-<br>1GDVRT5: SWT:Neutrino - Alpha channel memory leak
-<br>1GDRXZR: ITPJUI:Linux - SWT: Context-Menus issue under Linux
-<br>1GD0OSK: SWT:ALL - API - package javadoc for SWT packages missing
-<br>1GCHS75: SWT:WINNT - workbench exits during expand collapse
-<br>1GCFUS0: SWT:ALL - CTabFolder "floating" X sticks sometimes
-<br>1GAR95O: SWT:ALL - Remove Smalltalk comments from SWT code
-<br>1GAQRND: SWT:ALL - DOC: Write good Javadoc comments for all of SWT
-<br>1G97I28: SWT:Linux - Tool bar buttons do not always work
-<br>1G84AZB: ITPDUI:ALL - Rename truncates name
-<br>1G845EZ: SWT:WIN2000 - Spec for Layout.computeSize() is truncated
-<br>1G7YXLB: SWT:WIN - StyledText - NLS Support
-<br>1G7NSHR: SWT:ALL - Widget.addListener(int, Listener) vs. adding typed listeners
-<br>1G4XDJO: SWT:Linux - Tree needs to display an insert marker
-<br>1G0Y8NZ: SWT:ALL - Combo box doesn't send key and mouse events
-<br>1FXAVLF: SWT:WINNT - Disabled toolbar icons don't adapt to appearance changes
-<br>1FV1S18: SWT:ALL - Need more WM_* messages passed to ActiveX Control
-<br>1FTWX55: SWT:ALL - Inconsistant commenting of which SWT objects need to be disposed.
-</blockquote>
-<a href="hglegal.htm"><img SRC="ngibmcpy.gif" BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/os/linux/x86/about.html b/bundles/org.eclipse.swt/os/linux/x86/about.html
deleted file mode 100644
index b5de537fb5..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/about.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body lang="EN-US" link="blue" vlink="purple">
-<table border="0" cellspacing="5" cellpadding="2" width="100%" >
- <tr>
- <td align="LEFT" valign="TOP" colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF">About This Plug-in Sub-directory</font></b></td>
- </tr>
- <tr>
- <td>
-<p>29th January, 2002</p>
-<h3>License</h3>
-<p>All content in this plug-in sub-directory &quot;Content&quot; is made available by Eclipse.org under the following terms and conditions:</p>
-
-<p>The following files shall be defined as the SWT:</p>
-<ul>
- <li>libswt-gtk-2024.so</li>
- <li>libswt-motif-2024.so</li>
- <li>libswt-kde-motif-2024.so</li>
- <li>libswt-gnome-motif-2024.so</li>
- <li>swt.jar</li>
-</ul>
-
-<p>The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> &quot;CPL&quot;.
-For the purposes of the CPL the term "Program" shall mean the SWT.</p>
-
-<h3>Third Party Content</h3>
-
-<p>All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ &quot;Library&quot;. GTK+ is made available
-by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
-<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> &quot;LGPL&quot;. Use of the GTK+ Binding on a standalone basis, is also governed
-by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
-
-<p>In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
-containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
-other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
-governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
-work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
-
-<h3>Contributions</h3>
-
-<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
-Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
-of the contribution for which you are the copyright holder).</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/os/linux/x86/cpl-v05.html b/bundles/org.eclipse.swt/os/linux/x86/cpl-v05.html
deleted file mode 100644
index 800c7797bd..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/cpl-v05.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
-<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
-<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
-<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
-<BODY bgColor=#ffffff>
-<DIV align=center>
-<P>
-<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
- <TBODY>
- <TR>
- <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
- size=3>
- <H1>Common Public License Version 0.5</H1><TT>
- <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
- PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
- USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
- ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
- </B></FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Contribution"
-means:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
- Contributor, the initial code and documentation distributed under this
- Agreement, and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) in the case of each
- subsequent Contributor:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
- and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) additions to the
- Program;</FONT></P>
- <P><FONT face="Courier New, Courier, mono">where such changes and/or
- additions to the Program originate from and are distributed by that
- particular Contributor. A Contribution 'originates' from a Contributor
- if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include
- additions to the Program which: (i) are separate modules of software
- distributed in conjunction with the Program under their own license
- agreement, and (ii) are not derivative works of the
- Program.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
- or entity that distributes the Program. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
- claims licensable by a Contributor which are necessarily infringed by the
- use or sale of its Contribution alone or when combined with the
- Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Program" means the
- Contributions distributed in accordance with this Agreement. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
- receives the Program under this Agreement, including all Contributors.
- </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
- RIGHTS</B></FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free copyright license to reproduce,
- prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any,
- and such derivative works, in source code and object code
- form.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
- this Agreement, each Contributor hereby grants Recipient a
- non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer
- the Contribution of such Contributor, if any, in source code and object
- code form. This patent license shall apply to the combination of the
- Contribution and the Program if, at the time the Contribution is added
- by the Contributor, such addition of the Contribution causes such
- combination to be covered by the Licensed Patents. The patent license
- shall not apply to any other combinations which include the
- Contribution. No hardware per se is licensed hereunder.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
- although each Contributor grants the licenses to its Contributions set
- forth herein, no assurances are provided by any Contributor that the
- Program does not infringe the patent or other intellectual property
- rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement
- of intellectual property rights or otherwise. As a condition to
- exercising the rights and licenses granted hereunder, each Recipient
- hereby assumes sole responsibility to secure any other intellectual
- property rights needed, if any. For example, if a third party patent
- license is required to allow Recipient to distribute the Program, it is
- Recipient's responsibility to acquire that license before distributing
- the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">d) Each Contributor
- represents that to its knowledge it has sufficient copyright rights in
- its Contribution, if any, to grant the copyright license set forth in
- this Agreement.</FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono"><STRONG>3.
- REQUIREMENTS</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
- distribute the Program in object code form under its own license
- agreement, provided that: </FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
- and conditions of this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) its license
- agreement:</FONT></P>
- <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
- behalf of all Contributors all warranties and conditions, express and
- implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of
- merchantability and fitness for a particular purpose; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
- behalf of all Contributors all liability for damages, including direct,
- indirect, special, incidental and consequential damages, such as lost
- profits; </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iii) states that any
- provisions which differ from this Agreement are offered by that
- Contributor alone and not by any other party; and </FONT></P>
- <P><FONT face="Courier New, Courier, mono">iv) states that source code
- for the Program is available from such Contributor, and informs
- licensees how to obtain it in a reasonable manner on or through a medium
- customarily used for software exchange. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">When the Program is made
- available in source code form:</FONT></P>
- <BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">a) it must be made available
- under this Agreement; and</FONT></P>
- <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
- must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
- <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
- alter any copyright notices contained within the Program.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
- itself as the originator of its Contribution, if any, in a manner that
- reasonably allows subsequent Recipients to identify the originator of the
- Contribution. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
- DISTRIBUTION</STRONG> </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Commercial distributors of
- software may accept certain responsibilities with respect to end users,
- business partners and the like. While this license is intended to
- facilitate the commercial use of the Program, the Contributor who includes
- the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors.
- Therefore, if a Contributor includes the Program in a commercial product
- offering, such Contributor ("Commercial Contributor") hereby agrees to
- defend and indemnify every other Contributor ("Indemnified Contributor")
- against any losses, damages and costs (collectively "Losses") arising from
- claims, lawsuits and other legal actions brought by a third party against
- the Indemnified Contributor to the extent caused by the acts or omissions
- of such Commercial Contributor in connection with its distribution of the
- Program in a commercial product offering. The obligations in this section
- do not apply to any claims or Losses relating to any actual or alleged
- intellectual property infringement. In order to qualify, an Indemnified
- Contributor must: a) promptly notify the Commercial Contributor in writing
- of such claim, and b) allow the Commercial Contributor to control, and
- cooperate with the Commercial Contributor in, the defense and any related
- settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">For example, a Contributor
- might include the Program in a commercial product offering, Product X.
- That Contributor is then a Commercial Contributor. If that Commercial
- Contributor then makes performance claims, or offers warranties related to
- Product X, those performance claims and warranties are such Commercial
- Contributor's responsibility alone. Under this section, the Commercial
- Contributor would have to defend claims against the other Contributors
- related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the
- Commercial Contributor must pay those damages. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
- WARRANTY</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
- WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- Each Recipient is solely responsible for determining the appropriateness
- of using and distributing the Program and assumes all risks associated
- with its exercise of rights under this Agreement, including but not
- limited to the risks and costs of program errors, compliance with
- applicable laws, damage to or loss of data, programs or equipment, and
- unavailability or interruption of operations. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
- LIABILITY </STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
- IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
- LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
- RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGES. </FONT></P>
- <P><FONT face="Courier New, Courier, mono"><STRONG>7.
- GENERAL</STRONG></FONT></P>
- <P><FONT face="Courier New, Courier, mono">If any provision of this
- Agreement is invalid or unenforceable under applicable law, it shall not
- affect the validity or enforceability of the remainder of the terms of
- this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
- litigation against a Contributor with respect to a patent applicable to
- software (including a cross-claim or counterclaim in a lawsuit), then any
- patent licenses granted by that Contributor to such Recipient under this
- Agreement shall terminate as of the date such litigation is filed. In
- addition, If Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the
- Program itself (excluding combinations of the Program with other software
- or hardware) infringes such Recipient's patent(s), then such Recipient's
- rights granted under Section 2(b) shall terminate as of the date such
- litigation is filed.</FONT></P>
- <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
- this Agreement shall terminate if it fails to comply with any of the
- material terms or conditions of this Agreement and does not cure such
- failure in a reasonable period of time after becoming aware of such
- noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this
- Agreement and any licenses granted by Recipient relating to the Program
- shall continue and survive. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
- and distribute copies of this Agreement, but in order to avoid
- inconsistency the Agreement is copyrighted and may only be modified in the
- following manner. The Agreement Steward reserves the right to publish new
- versions (including revisions) of this Agreement from time to time. No one
- other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to
- serve as the Agreement Steward to a suitable separate entity. Each new
- version of the Agreement will be given a distinguishing version number.
- The Program (including Contributions) may always be distributed subject to
- the version of the Agreement under which it was received. In addition,
- after a new version of the Agreement is published, Contributor may elect
- to distribute the Program (including its Contributions) under the new
- version. Except as expressly stated in Sections 2(a) and 2(b) above,
- Recipient receives no rights or licenses to the intellectual property of
- any Contributor under this Agreement, whether expressly, by implication,
- estoppel or otherwise. All rights in the Program not expressly granted
- under this Agreement are reserved. </FONT></P>
- <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
- the laws of the State of New York and the intellectual property laws of
- the United States of America. No party to this Agreement will bring a
- legal action under this Agreement more than one year after the cause of
- action arose. Each party waives its rights to a jury trial in any
- resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
-<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/os/linux/x86/lgpl-v21.txt b/bundles/org.eclipse.swt/os/linux/x86/lgpl-v21.txt
deleted file mode 100644
index 3f50d0454c..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/lgpl-v21.txt
+++ /dev/null
@@ -1,506 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-
-
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-gnome-motif-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-gnome-motif-2024.so
deleted file mode 100644
index a77a848ad7..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-gnome-motif-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-gtk-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-gtk-2024.so
deleted file mode 100644
index 371dd2a750..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-gtk-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-kde-motif-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-kde-motif-2024.so
deleted file mode 100644
index 3e7014651a..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-kde-motif-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-motif-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-motif-2024.so
deleted file mode 100644
index 2bb711899d..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-motif-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-pi-gtk-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-pi-gtk-2024.so
deleted file mode 100644
index a860f173fd..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-pi-gtk-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/linux/x86/libswt-pixbuf-gtk-2024.so b/bundles/org.eclipse.swt/os/linux/x86/libswt-pixbuf-gtk-2024.so
deleted file mode 100644
index 75b3658faa..0000000000
--- a/bundles/org.eclipse.swt/os/linux/x86/libswt-pixbuf-gtk-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/qnx/x86/libswt-photon-2024.so b/bundles/org.eclipse.swt/os/qnx/x86/libswt-photon-2024.so
deleted file mode 100644
index 09ac4679bb..0000000000
--- a/bundles/org.eclipse.swt/os/qnx/x86/libswt-photon-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/solaris/sparc/libswt-cde-motif-2024.so b/bundles/org.eclipse.swt/os/solaris/sparc/libswt-cde-motif-2024.so
deleted file mode 100644
index 847bae2663..0000000000
--- a/bundles/org.eclipse.swt/os/solaris/sparc/libswt-cde-motif-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/solaris/sparc/libswt-motif-2024.so b/bundles/org.eclipse.swt/os/solaris/sparc/libswt-motif-2024.so
deleted file mode 100644
index 690baaa5aa..0000000000
--- a/bundles/org.eclipse.swt/os/solaris/sparc/libswt-motif-2024.so
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/win32-ce/arm/swt-win32-2024.dll b/bundles/org.eclipse.swt/os/win32-ce/arm/swt-win32-2024.dll
deleted file mode 100644
index 1ed637d254..0000000000
--- a/bundles/org.eclipse.swt/os/win32-ce/arm/swt-win32-2024.dll
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/os/win32/x86/swt-win32-2024.dll b/bundles/org.eclipse.swt/os/win32/x86/swt-win32-2024.dll
deleted file mode 100644
index 84796233cc..0000000000
--- a/bundles/org.eclipse.swt/os/win32/x86/swt-win32-2024.dll
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.swt/plugin.properties b/bundles/org.eclipse.swt/plugin.properties
deleted file mode 100644
index c1cf580601..0000000000
--- a/bundles/org.eclipse.swt/plugin.properties
+++ /dev/null
@@ -1 +0,0 @@
-pluginName = Standard Widget Toolkit \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/plugin.xml b/bundles/org.eclipse.swt/plugin.xml
deleted file mode 100755
index 4fe8d115e0..0000000000
--- a/bundles/org.eclipse.swt/plugin.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt"
- name="%pluginName"
- version="2.0"
- provider-name="Object Technology International, Inc.">
-
-<!-- Runtime -->
-<runtime>
- <library name="$ws$/swt-pi.jar">
- <export name="*"/>
- </library>
- <library name="$ws$/swt.jar">
- <export name="*"/>
- </library>
-</runtime>
-</plugin>
diff --git a/bundles/org.eclipse.swt/readme_swt.html b/bundles/org.eclipse.swt/readme_swt.html
deleted file mode 100755
index 334b77954f..0000000000
--- a/bundles/org.eclipse.swt/readme_swt.html
+++ /dev/null
@@ -1,108 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.7 [en] (WinNT; I) [Netscape]">
- <title>Eclipse Project SDK R0.9 - SWT Release Notes</title>
-</head>
-<body>
-
-<table COLS=1 WIDTH="604" HEIGHT="45" >
-<tr>
-<td BACKGROUND="workbench.gif"><b>Eclipse Project SDK R0.9 - SWT Release
-Notes</b></td>
-</tr>
-</table>
-
-<h3>
-Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001, 2002. All Rights Reserved.
-<h3>
-Table Of Contents</h3>
-&nbsp;1. Known Issues
-<h3>
-99.1 Known Issues</h3>
-<h4>
-99.1.1 Available Colors on 8-bit Linux</h4>
-
-Typically, in Gnome Linux installs running with 8 bitplain visuals (i.e. 256 color mode), before the
-Eclipse application is started, you already do not have any free colors. This may mean that Eclipse
-is unable to allocate the default widget background color causing it to display a white background.
-The functionality, however, is not affected.
-
-<h4>
-99.1.2 XInitThreads and Linux</h4>
-
-SWT makes use of the XInitThreads system function to allow graphics routines to
-be invoked from non-user-interface threads. However, the implementation of XInitThreads
-on Linux has several issues, which cause the following SWT problems:
-
-<dl>
-<dt><b>Printing Support</b></dt>
-<dd>The X printing extension implementation on Linux currently does not work for applications
- which are XInitThreads enabled. This makes it impossible for us to provide printing
- support on Linux. Until this is rectified, <code>Printer.getPrinterList()</code> will
- always return an empty array on the Linux platform.</dd>
-<dt><b>Drag and Drop</b></dt>
-<dd>On Motif, SWT only supports dragging between windows running on the same system process.
- In particular, dragging a file between Eclipse and another application will cause the
- drop target application to hang. This is a result of a bug in the Motif libraries for
- applications that are running XInitThreads.</dd>
-<dt><b>IME Support</b></dt>
-<dd>The Japanese IME support provided by Linux is currently incompatible with applications
- which are XInitThreads enabled, and will cause them to hang.</dd>
-</dl>
-
-<h4>
-99.1.3 Disposing in a Focus Event</h4>
-
-Applications should not dispose widgets in focus changing events. Doing so on Motif may cause Eclipse to terminate,
-since Motif accesses the disposed widget within their internal focus change event handler.
-Similar but less serious issues exist on Windows such that occasionally an SWT exception can be thrown.
-
-<h4>
-99.1.4 List and ComboBox on Windows NT</h4>
-
-On Windows NT only, you should avoid creating items in a List or ComboBox with strings longer than 1000 characters.
-Doing so may result in a General Protection Fault. This has been fixed in more recent versions of Windows.
-
-<h4>
-99.1.5 BiDi Support</h4>
-
-The StyledText widget now provides bidirectional language support for Hebrew and Arabic locales.
-Currently, this support is available only on win32, and has several known problems. It should be
-considered to be a preliminary implementation only.
-
-<h4>
-99.1.6 Cursor constructor arguments</h4>
-
-In the constructor <code>Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY)</code>,
-when both a source and mask argument are specified (i.e. mask is not null), the meaning of the two arguments is
-reversed. That is, the "mask" argument should be the source image and the "source" argument should be the
-mask image. This problem was discovered too late in the development cycle to be fixed for R1.0. The intent is to
-fix this in a future release, potentially by introducing a new more general constructor.
-
-<h4>
-99.1.7 Use of the "&" character in TabFolder</h4>
-
-The "&" character is not currently supported in TabFolder labels. Doing so on win32, will cause the
-character which follows the "&" to be underlined as if it was a mnemonic, even though mnemonics are
-not available for TabFolders. On other platforms, the "&" character will be displayed correctly, but
-for portability reasons, it should be avoided.
-
-<h4>
-99.1.8 ToolBar on Windows</h4>
-
-On Windows, you must create all tool bars with the FLAT style bit set. If you do not do this,
-the "hot" (rollover) images of <em>all</em> toolbars may display incorrectly.
-This will be fixed in a future release.
-
-<h4>
-99.1.9 Non ASCII strings on Linux</h4>
-
-On Linux RedHat 6.2 only, you will not be able to display text that contains non
-ASCII characters. This limitation is not present on Linux RedHat 7.1 or higher.
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/.classpath b/examples/org.eclipse.swt.examples.controls/.classpath
deleted file mode 100755
index 469b912b2d..0000000000
--- a/examples/org.eclipse.swt.examples.controls/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui/workbenchsrc.zip"/>
- <classpathentry kind="src" path="/org.eclipse.swt.examples"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples.controls/.cvsignore b/examples/org.eclipse.swt.examples.controls/.cvsignore
deleted file mode 100755
index c5e82d7458..0000000000
--- a/examples/org.eclipse.swt.examples.controls/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.controls/.vcm_meta b/examples/org.eclipse.swt.examples.controls/.vcm_meta
deleted file mode 100755
index 9daf91e588..0000000000
--- a/examples/org.eclipse.swt.examples.controls/.vcm_meta
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <reference project-name="org.eclipse.swt.examples"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples.controls/about.html b/examples/org.eclipse.swt.examples.controls/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/examples/org.eclipse.swt.examples.controls/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.controls/build.properties b/examples/org.eclipse.swt.examples.controls/build.properties
deleted file mode 100755
index 411c6d997d..0000000000
--- a/examples/org.eclipse.swt.examples.controls/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-source.controls.jar = /org/,import.properties
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html b/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html
deleted file mode 100755
index 46c2349bf4..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Controls Example</title>
-</head>
-<body>
-
-<h2>Example - SWT Controls</h2>
-
-<h3>Introduction</h3>
-<p>This example is a simple demonstration of common Standard Widget Toolkit
-(SWT) UI controls.&nbsp; It consists of a shell and tab folder where each
-tab in the folder allows the user to interact with a control.
-</p>
-
-<h3>Running the example</h3>
-<p>To run the Controls Example, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named Controls.&nbsp; A view containing a number of tabbed pages
-will appear.
-</p>
-
-<h3>Details</h3>
-<p>Each page (tab) of the controls example allows the user to interact with
-a different SWT control.&nbsp; The name of the control being demonstrated
-on each page is on the tab.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif b/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif
deleted file mode 100755
index cbdee97066..0000000000
--- a/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/import.properties b/examples/org.eclipse.swt.examples.controls/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.controls/import.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-# Persist project settings for later import
-natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature
-builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder
-var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>>
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java
deleted file mode 100755
index 31e4e58cc2..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class ControlPlugin extends AbstractUIPlugin {
- /**
- * The constructor.
- */
- public ControlPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java
deleted file mode 100755
index 390b9cdf17..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.examples.controlexample.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.*;
-
-/**
- * <code>Controls</code> is a simple demonstration
- * of the controls defined by SWT. It consists of a workbench
- * view and tab folder where each tab in the folder allows the
- * user to interact with a control.
- *
- * @see ViewPart
- */
-public class ControlView extends ViewPart {
- ControlExample instance = null;
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- instance = new ControlExample(frame);
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- instance.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- instance.dispose();
- instance = null;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/plugin.properties b/examples/org.eclipse.swt.examples.controls/plugin.properties
deleted file mode 100755
index f0ce9c75e6..0000000000
--- a/examples/org.eclipse.swt.examples.controls/plugin.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-plugin.SWTControlsExample.name = SWT Controls Example Plugin
-category.SWTExamples.name = SWT Examples
-view.ControlsExample.name = SWT Controls
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.ControlsExample.name = Controls
-launchitem.ControlsExample.description = \
- This example is a simple demonstration of common Standard Widget Toolkit (SWT) UI controls.\n\n\
- The example consists of a shell and tab folder where each tab in the folder allows the user to interact with a control. \
- Each page (tab) of the controls example allows the user to interact with a different SWT control. \
- The name of the control being demonstrated on each page is on the tab.
diff --git a/examples/org.eclipse.swt.examples.controls/plugin.xml b/examples/org.eclipse.swt.examples.controls/plugin.xml
deleted file mode 100755
index 251d2e7552..0000000000
--- a/examples/org.eclipse.swt.examples.controls/plugin.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.controls"
- name="%plugin.SWTControlsExample.name"
- version="2.0"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.controls.ControlPlugin">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.swt.examples"/>
-</requires>
-
-<!-- Runtime -->
-<runtime>
- <library name="controls.jar"/>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.ControlsExample.name"
- icon="icons/controls_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.controls.ControlView"
- id="org.eclipse.swt.examples.controls.view">
- </view>
-</extension>
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.ControlsExample.name"
- icon="icons/controls_example.gif"
- description="%launchitem.ControlsExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.controls.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.controls.view">
- </view>
- <source
- zip="controlssrc.zip">
- </source>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java b/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java
deleted file mode 100755
index 31e4e58cc2..0000000000
--- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class ControlPlugin extends AbstractUIPlugin {
- /**
- * The constructor.
- */
- public ControlPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java b/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java
deleted file mode 100755
index 390b9cdf17..0000000000
--- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.examples.controlexample.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.*;
-
-/**
- * <code>Controls</code> is a simple demonstration
- * of the controls defined by SWT. It consists of a workbench
- * view and tab folder where each tab in the folder allows the
- * user to interact with a control.
- *
- * @see ViewPart
- */
-public class ControlView extends ViewPart {
- ControlExample instance = null;
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- instance = new ControlExample(frame);
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- instance.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- instance.dispose();
- instance = null;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/.classpath b/examples/org.eclipse.swt.examples.launcher/.classpath
deleted file mode 100755
index 9f7c9bf0a2..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.classpath
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.resources/resources.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.resources/resourcessrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui/workbenchsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.boot/boot.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.boot/bootsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.jdt.core/jdtcore.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.core/jdtcoresrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.jdt.launching/launching.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.launching/launchingsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.debug.core/dtcore.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.debug.core/dtcoresrc.zip"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples.launcher/.cvsignore b/examples/org.eclipse.swt.examples.launcher/.cvsignore
deleted file mode 100755
index c5e82d7458..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/.vcm_meta b/examples/org.eclipse.swt.examples.launcher/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples.launcher/about.html b/examples/org.eclipse.swt.examples.launcher/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/build.properties b/examples/org.eclipse.swt.examples.launcher/build.properties
deleted file mode 100755
index 571becbd0c..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.launcher.jar = /org/,import.properties
-
-bin.includes = doc/,\
- doc-html/,\
- icons/,\
- schema/,\
- plugin.properties,\
- plugin.xml,\
- *.jar \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html b/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
deleted file mode 100755
index 1b4b0e981f..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Example Launcher</title>
-</head>
-<body>
-
-<h2>Example Launcher</h2>
-
-<h3>Introduction</h3>
-<p>The Example Launcher is a tool for enumerating, running and browsing a variety of examples.
-While these operations may be performed manually (with some difficulty), the Example Launcher
-offers a convenient interface.&nbsp; For information on how to manipulate particular examples
-manually, please consult their related documentation.
-</p>
-
-<h3>Running the Example Launcher</h3>
-<p>To run the Example Launcher, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named SWT Example Launcher.&nbsp; A view containing a list of examples to
-choose will appear.
-</p>
-
-<h3>About the examples</h3>
-<p>The Example Launcher can launch two different types of examples: Workbench Views,
-and Standalone applications.&nbsp; Examples will generally be organized into categories to
-distinguish the one from the other.
-</p>
-<p>Workbench Views are GUI panels that sit inside a given perspective. When the Launcher
-starts a program that is written to interact with the Workbench as a view, it is opened and
-embedded into the currently active perspective.
-</p>
-<p>Standalone applications are programs that run independently of the current
-Eclipse Platform environment.&nbsp; First, a new Java VM and Eclipse Platform runtime
-is started, then the application's main() method is invoked.&nbsp; For this reason,
-these applications may take some time to load.
-</p>
-
-<h3>Details</h3>
-<p>The example launcher view contains a tree list, a text area, and 2 buttons.
-The tree list contains a list of all the SWT examples you can choose
-to run.&nbsp; When an example is selected from the tree, the text area
-shows a short description of each example.&nbsp; The selected example can
-be executed by clicking on the Run button, which can be found just below
-the tree list.&nbsp; For some of the examples, you can also import the example
-source code into a project in the Workspace.&nbsp; A project, with a name specified
-by the user, is created and all the java classes required to run that example
-will be added to that newly created project.
-</p><p>
-Depending on the example and on the configuration of your system, it may be
-necessary to alter Project build paths or to define classpath variables to compile
-or run examples that have been imported to the Workspace.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html b/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html
deleted file mode 100755
index 3ce1c33fd5..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HEAD>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</HEAD>
-<HTML>
-<BODY>
-<H1><CENTER>Launch Items</CENTER></H1>
-<H2>Identifier</H2>
-org.eclipse.swt.examples.launcher.launchItems<H2>Description</H2>
-This extension point is used to add 'standalone program' and 'Workbench view'
- launch items to the Launcher, optionally grouping them into
- categories so as to form a multi-tiered hierarchy.
- Standalone programs are executed in new run-time environments.
- Workbench views are created within the active Workbench Perspective.<H2>Markup</H2>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT extension (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST extension</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>point</b> - </li><li><b>id</b> - </li><li><b>name</b> - </li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT program (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST program</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mainClass&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pluginId&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>mainClass</b> - The fully-qualified name of the class whose main() method is to be launched.</li><li><b>pluginId</b> - The unique id of the Eclipse Platform plugin containing the program.</li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT view (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST view</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewId&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>viewId</b> - The unique id of the Workbench View to be activated when the item is launched.</li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT category (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST category</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;category&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>name</b> - The localized name of this category.</li><li><b>id</b> - The unique id of this category. Categories with duplicate id's will be discarded.</li><li><b>category</b> - The unique id of the parent category.</li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT item (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST item</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;category&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;icon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(true | false) "false""true"</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;description&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>name</b> - The localized name of this launch item.</li><li><b>id</b> - The unique id of this launch item. Launch items with duplicate id's will be discarded.</li><li><b>category</b> - The unique id of the category this launch item belongs to.</li><li><b>icon</b> - The declaring plugin relative path of an icon to display with this launch item in the Launcher.</li><li><b>enabled</b> - Set to "false" to disable this launch item, or to "true" to enable it (default).</li><li><b>description</b> - The localized plain-text description of this launch item.</li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT source (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST source</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zip&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>zip</b> - The declaring plugin relative path of a ZIP file containing source code associated with a launch item.</li></ul>
-<H2>Example</H2>
-<H2>API Information</H2>
-<H2>Supplied Implementation</H2>
-</BODY>
-</HTML>
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif b/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif
deleted file mode 100755
index 3ab4d32c05..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif b/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/import.properties b/examples/org.eclipse.swt.examples.launcher/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/import.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-# Persist project settings for later import
-natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature
-builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder
-var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>>
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java
deleted file mode 100755
index e5c51f400b..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.boot.*; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.*; import org.eclipse.jdt.launching.*; /** * ApplicationRunner provides an interface to run registered Eclipse Platform applications * standalone in their own VM. */
-public class ApplicationRunner {
- protected String appName;
- protected String[] appArgs;
- protected String appStatePath = null;
- protected URL[] appPluginsPath = null;
-
- /**
- * Constructs an ApplicationRunner
- *
- * @param applicationName the id of a registered <code>org.eclipse.core.runtime.applications</code>
- * extension point
- * @param args the arguments to pass to the application, or null if none
- */
- public ApplicationRunner(String applicationName, String[] args) {
- this.appName = applicationName;
- this.appArgs = args;
- }
-
- /**
- * Specify the location of the plugins directory used to launch the application and to locate
- * plugins while the application is running.
- * <p>
- * The default is to let the Eclipse Platform search for the plugins directory in the manner
- * specified by <code>org.eclipse.core.boot.BootLoader</code> when no -plugins argument is
- * supplied to startup(). Generally, this means it will look in the current working directory
- * for either a directory of plugins, or a file telling it where to find these directories.
- * </p><p> * Each entry either points to a specific plugin manifest file (e.g. plugin.xml) or * to a directory containing whose subdirectories contain plugin manifest files. * </p> *
- * @param pluginPath an array of fully-qualified URLs to the plugins directories,
- * or null for the default
- * @see #getCurrentPluginsPath
- */
- public void setPluginsPath(URL[] pluginsPath) {
- this.appPluginsPath = pluginsPath;
- }
-
- /**
- * Specify the location of the applicate saved state directory used to store information
- * about the application's state while it is running.
- * <p>
- * The default is to let the Eclipse Platform search for the state directory in the manner
- * specified by <core>org.eclipse.core.boot.BootLoader</code> when no -platform argument is
- * supplied to startup(). Generally, this means it will create its state in the current
- * working directory.
- * </p>
- *
- * @param statePath the absolute filesystem path to the application state directory,
- * or null for the default
- * @see #getCurrentStatePath
- */
- public void setStatePath(String statePath) {
- this.appStatePath = statePath;
- }
-
- /**
- * Returns the plugins directory path in the current Eclipse Platform instance. * <p> * Each entry either points to a specific plugin manifest file (e.g. plugin.xml) or * to a directory containing whose subdirectories contain plugin manifest files. * </p>
- *
- * @return the current plugins directory absolute filesystem paths array
- */
- public static URL[] getCurrentPluginsPath() { Set /* of URL */ paths = new HashSet(); // get the platform's public plugin registry IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); // retrieve plugin descriptors for all plugins // [array may contain multiple versions of a given plugin] IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(); for (int i = 0; i < pluginDescriptors.length; ++i) { final IPluginDescriptor pd = pluginDescriptors[i]; try { // getInstallUrl() returns the path of the directory with the plugin manifest file(s) // for a specific plugin final URL installUrl = Platform.resolve(pd.getInstallURL()); // Add the parent directory of the plugin's install location to our Set String path = installUrl.toString(); path = path.substring(0, path.lastIndexOf('/')); // eliminate terminal '/' on directory path = path.substring(0, 1 + path.lastIndexOf('/')); // locate parent directory URL url = new URL(path); paths.add(url); } catch (IOException e) { // Ignore invalid paths } }
- return (URL[]) paths.toArray(new URL[paths.size()]);
- }
-
- /**
- * Returns the state directory path in the current Eclipse Platform instance.
- *
- * @return the current state directory absolute filesystem path
- */
- public static String getCurrentStatePath() {
- return Platform.getLocation().toFile().getAbsolutePath();
- }
-
- /**
- * Run the application asynchronously in its own VM and Eclipse Platform instance.
- *
- * @return a VMRunnerResult with status and control information about the launch, may be null
- */
- public VMRunnerResult run() {
- int numArgs = (appArgs != null) ? appArgs.length : 0;
- numArgs += 4;
- if (appPluginsPath != null && appPluginsPath.length != 0) numArgs += 2;
- if (appStatePath != null) numArgs += 2;
-
- String[] launcherArgs = new String[numArgs];
-
- int arg = 0;
- launcherArgs[arg++] = "-dev"; // tell Eclipse to look in bin subdirectories
- launcherArgs[arg++] = "bin"; // under plugins directories as part of the classpath
- launcherArgs[arg++] = "-application"; // tell Eclipse to launch our application
- launcherArgs[arg++] = appName;
-
- if (appStatePath != null) {
- launcherArgs[arg++] = "-platform"; // tell Eclipse where its saved state should be placed
- launcherArgs[arg++] = appStatePath;
- }
- if (appPluginsPath != null && appPluginsPath.length != 0) {
- // Plugin path information must be stored on disk in a Properties file for some reason...
- Properties properties = new Properties();
- for (int i = 0; i < appPluginsPath.length; ++i) {
- properties.setProperty("pluginPathEntry" + i, appPluginsPath[i].toString());
- }
-
- try {
- File pathFile = File.createTempFile("tempPluginPaths", ".ini");
- pathFile.deleteOnExit();
-
- OutputStream os = new FileOutputStream(pathFile);
- properties.store(os, "");
- os.close();
-
- launcherArgs[arg++] = "-plugins"; // tell Eclipse where its plugins are stored
- launcherArgs[arg++] = pathFile.getAbsoluteFile().toURL().toString();
- } catch (IOException e) {
- return null;
- }
- }
- if (appArgs != null) System.arraycopy(appArgs, 0, launcherArgs, arg, appArgs.length);
-
- return runJavaClass(getPlatformClass(), getPlatformClassPath(),
- new String[0], launcherArgs);
- }
-
- /**
- * Determines if a VMRunnerResult indicates success or failure.
- * <p>
- * A return value of <code>true</code> should be taken on advisory only. There is at present
- * no general way of determining if the operation was completed successfully.
- * </p>
- * @param result the VMRunnerResult to check, null is permissible and causes a return value of false
- * @return true if the VM started correctly (not a guarantee that the application will run!)
- */
- public static boolean isResultOk(VMRunnerResult result) {
- if (result == null) return false;
-
- IProcess[] processes = result.getProcesses();
- return (processes != null && processes.length > 0);
- }
-
- protected static VMRunnerResult runJavaClass(String className, String[] classPath,
- String[] vmArgs, String[] programArgs) {
- IVMRunner vmRunner = getJavaVMRunner();
- if (vmRunner == null) return null;
-
- VMRunnerConfiguration vmRunConfig = new VMRunnerConfiguration(className, classPath);
- vmRunConfig.setVMArguments(vmArgs);
- vmRunConfig.setProgramArguments(programArgs); try {
- return vmRunner.run(vmRunConfig); } catch (CoreException ex) { // a null return value indicates failure to run the application return null; }
- }
-
- protected static String getPlatformClass() {
- return "org.eclipse.core.launcher.UIMain";
- }
-
- protected static String getPlatformPath() {
- return urlToLocalFile(BootLoader.getInstallURL()).getAbsolutePath();
- }
-
- protected static String[] getPlatformClassPath() {
- final String platformPath = getPlatformPath();
- return new String[] {
- new File(platformPath, "startup.jar").getAbsolutePath(),
- new File(new File(platformPath, "bin"), "startup.jar").getAbsolutePath()
- };
- }
-
- protected static IVMRunner getJavaVMRunner() {
- // get the current install
- IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
- if (vmInstall == null) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindDefaultVM"), null);
- return null;
- }
-
- // get a runner
- IVMRunner vmRunner = vmInstall.getVMRunner(ILaunchManager.RUN_MODE);
- if (vmRunner == null) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindVMRunner",
- new Object[] { vmInstall.getName() }), null);
- return null;
- }
- return vmRunner;
- } /** * Get a File representing a local path to the resources referenced by a URL. * Use this when you want to know the local path corresponding to aURL but do not * want to access it (yet). * <p> * Cannot resolve paths to non-local [not on filesystem] files or directories. * </p> * * @param url the URL to convert * @return a File representing the URL's location on the filesystem, or null if not accessible */ private static File urlToLocalFile(URL url) { try { url = Platform.resolve(url); } catch (IOException e) { } final String urlProtocol = url.getProtocol(); if (urlProtocol.equals("file")) { return new File(url.getFile()).getAbsoluteFile(); } return null; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java
deleted file mode 100755
index b69d15b681..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java
+++ /dev/null
@@ -1,290 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.core.boot.*; import org.eclipse.core.internal.events.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.launching.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.dialogs.*; import org.eclipse.ui.internal.*; import org.eclipse.ui.wizards.datatransfer.*; import java.io.*; import java.lang.reflect.*; import java.net.*; import java.util.*; import java.util.zip.*;
-/** * ImportProjectTask maintains information about a project import session and provides * all necessary user interface support. */
-public class ImportProjectTask { // Support for externalized project properties information private static final String IMPORTPROJECT_PROPERTIES = "import.properties"; private static final String PROPERTYKEY_BUILDERS = "builders"; private static final String PROPERTYKEY_NATURES = "natures"; private static final String PROPERTYKEY_VARIABLES_PREFIX = "var."; private static final String PROPERTYKEY_ARGS_PREFIX = "args."; private static final String PROPERTYKEY_VMARGS_PREFIX = "vmargs."; // Property substitution keywords private static final String SUBST_KEYWORD_INTRO = "<<"; private static final String SUBST_KEYWORD_EXTRO = ">>"; private static final String SUBST_ECLIPSE_PLUGINS = "<<ECLIPSE_PLUGINS>>"; // path to the primary Eclipse plugins root directory private static final String SUBST_SWT_LIBRARY_PATH = "<<SWT_LIBRARY_PATH>>"; // path to the Eclipse libraries (java.library.path) // Default project properties private static final Properties defaultProjectProperties; static { defaultProjectProperties = new Properties(); defaultProjectProperties.setProperty(PROPERTYKEY_NATURES, "org.eclipse.jdt.core.javanature"); defaultProjectProperties.setProperty(PROPERTYKEY_BUILDERS, "org.eclipse.jdt.core.javabuilder"); defaultProjectProperties.setProperty(PROPERTYKEY_VARIABLES_PREFIX + "ECLIPSE_PLUGINS", SUBST_ECLIPSE_PLUGINS); } // Internal data
- private Shell parentShell;
- private String defaultProjectName;
- private URL sourceUrl;
-
- /**
- * Creates an ImportProjectTask specifying information about an import operation
- * to be performed.
- *
- * @param parentShell the Shell instance to use in dialogs.
- * @param defaultProjectName the default name of the project to import into
- * @param sourceUrl the URL of the ZIP/JAR file which we will import
- */
- public ImportProjectTask(Shell parentShell, String defaultProjectName, URL sourceUrl) {
- this.parentShell = parentShell;
- this.defaultProjectName = defaultProjectName;
- this.sourceUrl = sourceUrl;
- }
-
- /**
- * Disposes of operating system and platform resources associated with this instance.
- */
- public void dispose() {
- sourceUrl = null;
- }
-
- /**
- * Perform the import.
- *
- * @return true iff the import succeeded
- */
- public boolean execute() {
- String projectName = getNewProjectName(parentShell, defaultProjectName);
- if (projectName == null) return false;
- return doImportZip(projectName);
- }
-
- /**
- * Returns a project name into which to import a new item.
- *
- * @param defaultProjectName the default name to give the project
- * @return the name a new project, null if the user aborted
- */
- private String getNewProjectName(Shell parentShell, final String defaultProjectName) {
- InputDialog inputDialog = new InputDialog(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportPathInput.title"),
- LauncherPlugin.getResourceString("dialog.ImportPathInput.message"),
- defaultProjectName,
- new IInputValidator() {
- public String isValid(String projectPath) {
- // verify that name is well-formed
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- projectPath = new Path(projectPath).makeAbsolute().toString();
- IStatus status = workspace.validatePath(projectPath,
- IResource.PROJECT | IResource.FOLDER);
- if (! status.isOK()) {
- return LauncherPlugin.getResourceString("dialog.InvalidTargetProjectPath.interactive");
- }
- // verify that project does not already exist
- IWorkspaceRoot workspaceRoot = workspace.getRoot();
- IProject project = workspaceRoot.getProject(projectPath);
- if (project.exists()) {
- return LauncherPlugin.getResourceString("dialog.ExistingProjectPath.interactive");
- }
- return null;
- }
- });
- inputDialog.setBlockOnOpen(true);
- inputDialog.open();
- String path = inputDialog.getValue();
- inputDialog.close();
-
- return (inputDialog.getReturnCode() == InputDialog.OK) ? path : null;
- }
-
- /**
- * Imports a new project from a Zip file.
- * Note that user feedback is provided when the result is false
- *
- * @param projectName the name to give the new project
- * @return true if the operation succeeds
- */
- private boolean doImportZip(String projectName) {
- final IPath projectPath = new Path(projectName).makeAbsolute();
-
- ZipFile zipFile = null;
- try {
- /* Open the Zip file and get a StructureProvider for it */ File file = urlToFile(sourceUrl); if (file == null) throw new Exception();
- zipFile = new ZipFile(file);
- ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
-
- return importExecute(projectPath, provider.getRoot(), provider);
- } catch (Exception e) {
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.ErrorAccessingZipFile.message",
- new Object[] { sourceUrl.getFile(), e.getMessage() }));
- return false;
- } finally {
- try {
- if (zipFile != null) zipFile.close();
- } catch (IOException e) { }
- }
- }
-
- /**
- * Performs an import operation
- * Note that user feedback is provided when the result is false
- *
- * @param projectPath the absolute path of the project to create
- * @param source the source node for the import
- * @param provider the structure provider ImportOperation will use to retrieve file contents
- * @return true if the operation succeeds
- */
- private boolean importExecute(IPath projectPath, Object source, IImportStructureProvider provider) {
- /* Validate the target path */
- if (! importValidateProjectPath(projectPath)) return false;
-
- /* Locate the Project we will import into, or create it anew */
- final IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- final IWorkspaceRoot workspaceRoot = workspace.getRoot();
- final String projectName = projectPath.toString();
- final IProject project = workspaceRoot.getProject(projectName);
-
- /* Create a progress monitor for the import process */
- ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(parentShell);
- progressDialog.setCancelable(true);
- progressDialog.open();
-
- /* Manipulate the ProjectDescription so that we can build the example */
- String exceptionMessage = null; Properties projectProperties = defaultProjectProperties;
- try {
- if (! project.exists()) {
- /* Create the project */
- exceptionMessage = "dialog.ErrorCreatingNewProject.message";
-
- IProjectDescription projectDesc = workspace.newProjectDescription(projectName);
- project.create(projectDesc, progressDialog.getProgressMonitor());
- }
- /* Open Project */
- project.open(progressDialog.getProgressMonitor());
- /* Import project properties from disk */ try { Object node = findStructuredChildElement(provider, source, IMPORTPROJECT_PROPERTIES); if (node != null) { InputStream is = provider.getContents(node); Properties properties = new Properties(); properties.load(is); projectProperties = properties; } } catch (Exception e) { }
- /* Set Project properties */
- exceptionMessage = "dialog.ErrorUpdatingProjectProperties.message";
-
- IProjectDescription projectDesc = project.getDescription();
- updateProjectDescription(projectDesc, projectProperties);
- project.setDescription(projectDesc, progressDialog.getProgressMonitor());
- } catch (Exception e) {
- if (progressDialog != null) progressDialog.close();
- if (exceptionMessage == null) exceptionMessage = "{0}";
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString(exceptionMessage, new Object[] { e.getMessage() }));
- return false;
- }
- /* Update the Classpath variables */ updateClasspathVariables(projectProperties, progressDialog.getProgressMonitor());
- /* Create the ImportOperation */
- ImportOperation importOperation = new ImportOperation(projectPath, source, provider,
- new IOverwriteQuery() {
- final String[] responses = new String[] {
- IOverwriteQuery.YES,
- IOverwriteQuery.NO,
- IOverwriteQuery.ALL,
- IOverwriteQuery.CANCEL};
- final String[] labels = new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL};
-
- /* called to query user if existing files should be overwritten */
- public String queryOverwrite(String pathString) {
- final MessageDialog dialog =
- new MessageDialog(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramOverwrite.title"),
- null, LauncherPlugin.getResourceString("dialog.FileAlreadyExists.message",
- new Object[] { pathString }),
- MessageDialog.QUESTION, labels, 0);
- // run in syncExec because callback is from an operation,
- // which is probably not running in the UI thread.
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode() < 0 ? CANCEL : responses[dialog.getReturnCode()];
- }
- });
- importOperation.setOverwriteResources(false); // ask user before overwriting...
-
- /* Execute the operation */
- try {
- progressDialog.run(true, true, importOperation);
- } catch (InterruptedException e) {
- // aborted
- return false;
- } catch (InvocationTargetException e) {
- // failed
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- e.getTargetException().getMessage());
- return false;
- }
-
- /* Verify that the operation succeeded */
- IStatus status = importOperation.getStatus();
- if (! status.isOK()) {
- ErrorDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.ImportFailed.message"),
- status);
- return false;
- } /* Get the IJavaProject for this project */ IJavaProject javaProject = JavaCore.create(project); if (javaProject == null) { MessageDialog.openError(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableToGetJavaProjectHandle.message")); return false; } /* Restore program and VM arguments */ updateProgramAndVMArguments(projectProperties, javaProject); return true;
- }
-
- /**
- * Updates a ProjectDescription prior to an import.
- *
- * @param projectDesc the IProjectDescription to fix * @param properties a Properties file containing entries of the form * natures = <string>[;<string>] * builders = <string>[;<string>] */
- private void updateProjectDescription(IProjectDescription projectDesc, Properties properties) { if (properties == null) return;
- /* Add natures */
- String[] natureIds = projectDesc.getNatureIds(); final String naturesList = properties.getProperty(PROPERTYKEY_NATURES); if (naturesList != null) { StringTokenizer entries = new StringTokenizer(naturesList, "; \t\n\r\f"); while (entries.hasMoreTokens()) { natureIds = addUniqueString(natureIds, entries.nextToken()); } projectDesc.setNatureIds(natureIds); }
-
- /* Add builders */
- ICommand[] buildSpecs = projectDesc.getBuildSpec();
- final String buildersList = properties.getProperty(PROPERTYKEY_BUILDERS); if (buildersList != null) { StringTokenizer entries = new StringTokenizer(buildersList, "; \t\n\r\f"); while (entries.hasMoreTokens()) { buildSpecs = addUniqueCommand(buildSpecs, entries.nextToken(), new HashMap()); } projectDesc.setBuildSpec(buildSpecs); } } /** * Updates the Classpath Variables. * * @param properties a Properties file containing entries of the form * var.<varname> = [<string>|<substitution string>] * @param progressMonitor an IProgressMonitor to use while setting things up */ private void updateClasspathVariables(Properties properties, IProgressMonitor progressMonitor) { Enumeration it = properties.propertyNames(); while (it.hasMoreElements()) { final String name = (String) it.nextElement(); if (name.startsWith(PROPERTYKEY_VARIABLES_PREFIX)) { final String varName = name.substring(PROPERTYKEY_VARIABLES_PREFIX.length()); final String path = properties.getProperty(name); if (path == null || path.length() == 0) continue; IPath oldValue = JavaCore.getClasspathVariable(varName); if (oldValue != null) continue; // silently ignore if set // Variable does not exist, set it. try { final IPath varPath = new Path(expandSubstitutionKeywords(path)); varPath.makeAbsolute(); JavaCore.setClasspathVariable(varName, varPath, progressMonitor); continue; } catch (Exception e) { } MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableToSetClasspathVariable.message", new Object[] { varName, path } )); } } } /** * Updates the Program and VM Arguments. * * @param properties a Properties file containing entries of the form * args.<resource path>%<class> = [<string>|<substitution string>] * vmargs.<resource path>%<class> = [<string>|<substitution string>] * @param javaProject the IJavaProject to work on */ private void updateProgramAndVMArguments(Properties properties, IJavaProject javaProject) { Enumeration it = properties.propertyNames(); while (it.hasMoreElements()) { final String name = (String) it.nextElement(); final String entry; final int argId; // 0 is program, 1 is VM // Get property key if (name.startsWith(PROPERTYKEY_ARGS_PREFIX)) { entry = name.substring(PROPERTYKEY_ARGS_PREFIX.length()); argId = 0; } else if (name.startsWith(PROPERTYKEY_VMARGS_PREFIX)) { entry = name.substring(PROPERTYKEY_VMARGS_PREFIX.length()); argId = 1; } else continue; // Parse entry int index = entry.indexOf('%'); if (index == -1) continue; // ignore invalid entry final String resource = entry.substring(0, index); final String className = entry.substring(index + 1); String value = properties.getProperty(name); if (value == null) continue; value = expandSubstitutionKeywords(value); try { IPath resourcePath = new Path(resource); IJavaElement javaElement = javaProject.findElement(resourcePath); if (javaElement != null && javaElement.getElementType() == IJavaElement.COMPILATION_UNIT && javaElement.exists()) { ICompilationUnit compilationUnit = (ICompilationUnit) javaElement; IType javaType = compilationUnit.getType(className); if (javaType != null && javaType.exists()) { ExecutionArguments oldArgs = ExecutionArguments.getArguments(javaType); String vmArgs; String programArgs; if (oldArgs == null) { vmArgs = ""; programArgs = ""; } else { vmArgs = oldArgs.getVMArguments(); programArgs = oldArgs.getProgramArguments(); } if (argId == 0) { programArgs = value; } else { vmArgs = value; } ExecutionArguments newArgs = new ExecutionArguments(vmArgs, programArgs); ExecutionArguments.setArguments(javaType, newArgs); continue; } } } catch (Exception e) { } MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString((argId == 0) ? "dialog.UnableToProgramArguments.message" : "dialog.UnableToVMArguments.message", new Object[] { resource, className, value } )); } } /** * Replaces any substitution keywords with their values. * * @param string the string to work on * @return the expanded string */ private String expandSubstitutionKeywords(String string) { int endIndex = 0; for (;;) { int index = string.indexOf(SUBST_KEYWORD_INTRO, endIndex); if (index == -1) return string; endIndex = string.indexOf(SUBST_KEYWORD_EXTRO, index); if (endIndex == -1) return string; endIndex += SUBST_KEYWORD_EXTRO.length(); final String keyword = string.substring(index, endIndex); String value = null; for (int i = 0; i < substitutionKeywords.length; ++i) { final SubstitutionKeyword subst = substitutionKeywords[i]; if (subst.isMatch(keyword)) { value = subst.getValue(); break; } } if (value == null) { MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableExpandSubstitutionKeyword.message", new Object[] { keyword, string } )); } else { string = string.substring(0, index) + value + string.substring(endIndex); } } } /** Data for subsitution keywords **/ static abstract class SubstitutionKeyword { public abstract boolean isMatch(String keyword); public abstract String getValue(); } static final SubstitutionKeyword[] substitutionKeywords = new SubstitutionKeyword[] { // <<ECLIPSE_PLUGINS>> new SubstitutionKeyword() { public boolean isMatch(String keyword) { return keyword.equalsIgnoreCase(SUBST_ECLIPSE_PLUGINS); } public String getValue() { try { // Guess at primary plugins directory location // get the platform's public plugin registry IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); // retrieve plugin descriptor for org.eclipse.core IPluginDescriptor pd = pluginRegistry.getPluginDescriptor("org.eclipse.core.runtime"); // getInstallUrl() returns the path of the directory with the plugin manifest file(s) // for a specific plugin, find the parent directory final URL installUrl = Platform.resolve(pd.getInstallURL()); if (installUrl.getProtocol().equals("file")) { String pluginPath = installUrl.getFile(); pluginPath = pluginPath.substring(0, pluginPath.lastIndexOf('/')); // eliminate terminal '/' on directory pluginPath = pluginPath.substring(0, 1 + pluginPath.lastIndexOf('/')); // locate parent directory return pluginPath; } } catch (Exception e) { } return null; } }, // <<SWT_LIBRARY_PATH>> new SubstitutionKeyword() { public boolean isMatch(String keyword) { return keyword.equalsIgnoreCase(SUBST_SWT_LIBRARY_PATH); } public String getValue() { try { IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); IPluginDescriptor pd = pluginRegistry.getPluginDescriptor("org.eclipse.swt"); final URL installUrl = pd.getInstallURL(); // not supported yet: final URL libraryUrl = new URL(installUrl, "$ws$"); final URL libraryUrl = new URL(installUrl, "ws/" + BootLoader.getWS()); final URL resolveUrl = Platform.resolve(libraryUrl); if (resolveUrl.getProtocol().equals("file")) { return resolveUrl.getFile(); } } catch (Exception e) { } return null; } } }; /**
- * Validates the target project path
- *
- * @param projectPath the project path to verify
- * @return true if the path is valid
- * Note that user feedback is provided when the result is false
- */
- private boolean importValidateProjectPath(IPath projectPath) {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IStatus status = workspace.validatePath(projectPath.toString(), IResource.PROJECT | IResource.FOLDER);
- if (! status.isOK()) {
- ErrorDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.InvalidTargetProjectPath.message",
- new Object[] { projectPath.toString() }),
- status);
- return false;
- }
- return true;
- }
-
- /**
- * Adds a unique String to a String[].
- *
- * @param array the old String array
- * @param string the new String
- * @return the new String array (may be same as old)
- */
- private String[] addUniqueString(String[] array, String string) {
- for (int i = 0; i < array.length; ++i) {
- if (array[i].equals(string)) return array;
- }
- String[] newArray = new String[array.length + 1];
- System.arraycopy(array, 0, newArray, 0, array.length);
- newArray[array.length] = string;
- return newArray;
- }
-
- /**
- * Adds a unique ICommand to a ICommand[].
- *
- * @param array the old ICommand array
- * @param builderName the new builder name
- * @param builderArgs the new arguments
- * @return the new ICommand array (may be same as old)
- */
- private ICommand[] addUniqueCommand(ICommand[] array, String builderName, Map builderArgs) {
- for (int i = 0; i < array.length; ++i) {
- final String name = array[i].getBuilderName();
- final Map args = array[i].getArguments();
-
- if ((name != null) && (name.equals(builderName))) return array;
- }
- ICommand[] newArray = new ICommand[array.length + 1];
- System.arraycopy(array, 0, newArray, 0, array.length);
- BuildCommand newCommand = new BuildCommand();
- newCommand.setBuilderName(builderName);
- newCommand.setArguments(builderArgs);
- newArray[array.length] = newCommand;
- return newArray;
- } /** * Finds a particular child of a container in an IImportStructureProvider. * */ private Object findStructuredChildElement(IImportStructureProvider provider, Object parent, String name) { if (! provider.isFolder(parent)) return null; java.util.List list = provider.getChildren(parent); if (list == null) return null; for (Iterator it = list.iterator(); it.hasNext(); ) { Object item = it.next(); if (provider.getLabel(item).equals(name)) return item; } return null; } /** * Get a File through which it is possible to access the contents of a URL. * Use this when you want to be able to access the contents of a URL immediately. * <p> * Will automatically cache contents from non-local files or Jars on the local filesystem. * Cannot resolve paths to non-local [not on filesystem] directories. * </p> * * @param url the URL to convert * @return a File where the URL's data can be accessed, or null if not accessible */ private static File urlToFile(URL url) { try { url = Platform.asLocalURL(url); } catch (IOException e) { try { url = Platform.resolve(url); // perhaps it is a directory on the local filesystem } catch (IOException e2) { } } final String urlProtocol = url.getProtocol(); if (urlProtocol.equals("file")) { return new File(url.getFile()).getAbsoluteFile(); } return null; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java
deleted file mode 100755
index 735291513b..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.net.*; import org.eclipse.swt.graphics.*;
- /** * ItemDescriptor collects information about a launch item. */
-class ItemDescriptor {
- private String id;
- private String name;
- private String description; private Image icon;
- private URL sourceCodePath;
- private LaunchDelegate launchDelegate;
-
- /**
- * Constructs an ItemDescriptor.
- *
- * @param id the id
- * @param name the name
- * @param description the description
- * @param launchDelegate a launch delegate for the program to be launched using this descriptor,
- * may be null if item is not launchable
- */
- public ItemDescriptor(String id, String name, String description, URL sourceCodePath,
- Image icon, LaunchDelegate launchDelegate) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.sourceCodePath = sourceCodePath; this.icon = icon;
- this.launchDelegate = launchDelegate;
- }
-
- /**
- * Returns the ID for this program.
- *
- * @return the user-specified ID for this program
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the translated name for the program.
- *
- * @return the name of the program
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns a short description for the program.
- *
- * @return a newline-delimited string describing the program, null if no description is available
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Returns source code path
- *
- * @return a URL specifying the name of a zip/jar or the base of a directory where the source
- * code is stored, null if no source is available
- */
- public URL getSourceCodePath() {
- return sourceCodePath;
- }
- /** * Returns an icon for this descriptor * * @returns an icon, null if the item is a folder */ public Image getIcon() { return icon; }
- /**
- * Returns launch delegate for the program.
- *
- * @return the launch delegate, null if the item is a folder
- */
- public LaunchDelegate getLaunchDelegate() {
- return launchDelegate;
- } /** * Determines if an item is a folder. * * @return true if the item is a folder */ public boolean isFolder() { return launchDelegate == null; }
-
- /**
- * Determines the equality of descriptors.
- *
- * @return true if this.getId().equalsIgnoreCase(other.getId())
- */
- public boolean equals(Object other) { if (other instanceof ItemDescriptor) {
- ItemDescriptor otherDescriptor = (ItemDescriptor) other;
- return getId().equalsIgnoreCase(otherDescriptor.getId());
- }
- return false;
- } /** * Produces a hashcode. * * @return the hashcode */ public int hashCode() { return id.toUpperCase().hashCode(); }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java
deleted file mode 100755
index bc1a5ac185..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Internal class used to store tree structures of ItemDescriptors
- */
-class ItemTreeNode {
- private ItemTreeNode nextSibling;
- private ItemTreeNode firstChild;
- private ItemDescriptor descriptor;
-
- /**
- * Constructs a leaf ItemTreeNode with a given descriptor.
- *
- * @param descriptor the descriptor
- */
- public ItemTreeNode(ItemDescriptor descriptor) {
- this.descriptor = descriptor;
- }
-
- /**
- * Adds a node to the Tree in sorted order by name.
- *
- * @param node the node to add. Note that node.nextSibling must be null
- */
- public void addSortedNode(ItemTreeNode node) {
- if (firstChild == null) {
- firstChild = node;
- } else if (firstChild.descriptor.getName().compareTo(node.descriptor.getName()) > 0) {
- node.nextSibling = firstChild;
- firstChild = node;
- } else {
- ItemTreeNode cursor;
- for (cursor = firstChild; cursor.nextSibling != null; cursor = cursor.nextSibling) {
- ItemTreeNode sibling = cursor.nextSibling;
- if (sibling.descriptor.getName().compareTo(node.descriptor.getName()) > 0) break;
- }
- node.nextSibling = cursor.nextSibling;
- cursor.nextSibling = node;
- }
- }
-
- /**
- * Returns the descriptor for this node.
- *
- * @return the descriptor
- */
- public ItemDescriptor getDescriptor() {
- return descriptor;
- }
-
- /**
- * Returns the next sibling of this node.
- *
- * @return the next sibling, or null if none
- */
- public ItemTreeNode getNextSibling() {
- return nextSibling;
- }
-
- /**
- * Returns the first child of this node.
- *
- * @return the first child, or null if none
- */
- public ItemTreeNode getFirstChild() {
- return firstChild;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java
deleted file mode 100755
index 24548a3539..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.core.runtime.*; import org.eclipse.ui.*; /** * LaunchDelegate provide a means of encapsulating a method for launching a * variety of programs of different types along with information about these * programs. */
-interface LaunchDelegate { /** * Launches the program described by this object. * * @param hostView the IViewPart for the launcher program. Use this to ensure that * child programs are visible on the same display / Eclipse perspective as * the launcher application * @return true if the launch was successful */
- public boolean launch(IViewPart hostView);
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java
deleted file mode 100755
index fce7ce9e58..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.lang.reflect.*; import java.util.*; import org.eclipse.core.boot.*; import org.eclipse.core.runtime.*; /** * LauncherApplication provides a mechanism for launching arbitrary executable programs * from within the Eclipse Platform. This class binds to the * <core>org.eclipse.core.runtime.applications</code> extension point. */
-public class LauncherApplication implements IPlatformRunnable {
- public static final String APPLICATION_ID = "org.eclipse.swt.examples.launcher.application";
- /** * Invokes the program specified in the arguments. * * @param argsVanilla a String[] containing the arguments, one token per array index. * <ul> * <li>-appclass &lt;class name&gt; the name of the class whose main() method is to be invoked * [note: do not add a .java or .class suffix] * <li>-appplugin &lt;pluginid&gt; the id of the plugin containing the specified class * <li>-appargs &lt;args&gt; all remaining tokens to the right of this switch are passed as * arguments to the main() method when the program is launched * </ul> * @return null */
- public Object run(Object argsVanilla) throws Exception {
- final String[] args = (String[]) argsVanilla;
- String programPluginId = null; // id of plugin containing the program
- String[] programArgs = null; // arguments for the program
- String programClass = null; // class with main() method
-
- try {
- for (int i = 0; i < args.length; ++i) {
- if (args[i].equalsIgnoreCase("-appplugin")) {
- programPluginId = args[++i];
- } else if (args[i].equalsIgnoreCase("-appclass")) {
- programClass = args[++i];
- } else if (args[i].equalsIgnoreCase("-appargs")) {
- ++i;
- programArgs = new String[args.length - i];
- System.arraycopy(args, i, programArgs, 0, programArgs.length);
- break;
- } else {
- // ignore unrecognized argument
- }
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException("run.error.MalformedArgumentList");
- }
-
- if (programPluginId == null) throw new IllegalArgumentException(
- "run.error.MissingAppPlugin");
- if (programClass == null) throw new IllegalArgumentException(
- "run.error.MissincAppClass");
- if (programArgs == null) programArgs = new String[0];
-
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve plugin descriptors for all plugins matching pluginId
- // [array may contain multiple versions of a given plugin]
- IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(programPluginId);
-
- if (pluginDescriptors == null || pluginDescriptors.length == 0) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindPlugin",
- new Object[] { programPluginId }), null);
- return null;
- }
-
- // sort list of plugins in decreasing order by version number
- Arrays.sort(pluginDescriptors, new Comparator() {
- public int compare(Object a, Object b) {
- final PluginVersionIdentifier versionA = ((IPluginDescriptor) a).getVersionIdentifier();
- final PluginVersionIdentifier versionB = ((IPluginDescriptor) b).getVersionIdentifier();
- return versionA.isGreaterThan(versionB) ? -1 :
- (versionA.equals(versionB) ? 0 : 1);
- }
- });
-
- // attempt to load and run a program in decreasing order by version until we find one
- // that works or we run out of them
- for (int i = 0; i < pluginDescriptors.length; ++i) {
- final IPluginDescriptor pd = pluginDescriptors[i];
- final ClassLoader loader = pd.getPluginClassLoader();
-
- try {
- Class programMainClass = Class.forName(programClass, true, loader);
-
- final Class[] parameterList = { String[].class };
- Method programMainMethod = programMainClass.getMethod("main", parameterList);
-
- final Object[] parameters = { new String[0] };
- programMainMethod.invoke(null, parameters); // SUCCESS! return null; } catch (InvocationTargetException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Execution"), e);
- break; // it ran so stop searching
- } catch (Throwable e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e);
- }
- }
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindMain"), null);
- return null;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java
deleted file mode 100755
index 1ee79c11e3..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java
+++ /dev/null
@@ -1,413 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.net.*; import java.text.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.graphics.*; import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class LauncherPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static LauncherPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- private static final String
- LAUNCH_ITEMS_POINT_ID = "org.eclipse.swt.examples.launcher.launchItems",
- LAUNCH_ITEMS_XML_CATEGORY = "category",
- LAUNCH_ITEMS_XML_ITEM = "item",
- LAUNCH_ITEMS_XML_ITEM_ICON = "icon",
- LAUNCH_ITEMS_XML_ITEM_DESCRIPTION = "description",
- LAUNCH_ITEMS_XML_PROGRAM = "program",
- LAUNCH_ITEMS_XML_PROGRAM_PLUGIN = "pluginId",
- LAUNCH_ITEMS_XML_PROGRAM_CLASS = "mainClass",
- LAUNCH_ITEMS_XML_VIEW = "view",
- LAUNCH_ITEMS_XML_VIEW_VIEWID = "viewId",
- LAUNCH_ITEMS_XML_SOURCE = "source",
- LAUNCH_ITEMS_XML_SOURCE_ZIP = "zip",
- LAUNCH_ITEMS_XML_ATTRIB_ID = "id",
- LAUNCH_ITEMS_XML_ATTRIB_NAME = "name",
- LAUNCH_ITEMS_XML_ATTRIB_ENABLED = "enabled",
- LAUNCH_ITEMS_XML_ATTRIB_CATEGORY = "category",
- LAUNCH_ITEMS_XML_VALUE_TRUE = "true",
- LAUNCH_ITEMS_XML_VALUE_FALSE = "false";
-
- static final int
- liClosedFolder = 0,
- liOpenFolder = 1,
- liGenericExample = 2;
- static final String[] imageLocations = {
- "icons/closedFolder.gif",
- "icons/openFolder.gif",
- "icons/generic_example.gif" };
- static Image images[];
-
- /**
- * Constructs the LauncherPlugin.
- */
- public LauncherPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static LauncherPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Loads the resources
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Constructs a list of available programs from registered extensions.
- *
- * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
- */
- public static ItemTreeNode getLaunchItemTree() {
- ItemTreeNode categoryTree =
- new ItemTreeNode(new ItemDescriptor("<<Root>>", "<<Root>>", null, null, null, null));
-
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve all configuration elements registered at our launchItems extension-point
- IConfigurationElement[] configurationElements =
- pluginRegistry.getConfigurationElementsFor(LAUNCH_ITEMS_POINT_ID);
-
- if (configurationElements == null || configurationElements.length == 0) {
- logError("Could not find registered extensions", null);
- return categoryTree;
- }
-
- /* Collect all launch categories -- coalesce those with same ID */
- HashMap idMap = new HashMap();
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final String attribName = getItemName(ce);
- ItemDescriptor theDescriptor = new ItemDescriptor(attribId, attribName,
- getItemDescription(ce), null, null, null);
- idMap.put(attribId, new ItemTreeNode(theDescriptor));
- }
- }
-
- /* Generate launch category hierarchy */
- Set tempIdSet = new HashSet(); // used to prevent duplicates from being entered into the tree
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (tempIdSet.contains(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final ItemTreeNode theNode = (ItemTreeNode) idMap.get(attribId);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- tempIdSet.add(attribId);
- }
- }
-
- /* Generate program tree */
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- // ignore
- } else if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_ITEM)) {
- final String enabled = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ENABLED,
- LAUNCH_ITEMS_XML_VALUE_TRUE);
- if (enabled.equalsIgnoreCase(LAUNCH_ITEMS_XML_VALUE_FALSE)) continue;
- ItemDescriptor theDescriptor = createItemDescriptor(ce, attribId);
-
- if (theDescriptor != null) {
- final ItemTreeNode theNode = new ItemTreeNode(theDescriptor);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- idMap.put(attribId, theNode);
- }
- }
- }
- return categoryTree;
- }
-
-
- /**
- * Adds an item to the category tree.
- */
- private static void addItemByCategory(IConfigurationElement ce, ItemTreeNode root,
- ItemTreeNode theNode, HashMap idMap) {
- final String attribCategory = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_CATEGORY, null);
-
- // locate the parent node
- ItemTreeNode parentNode = null;
- if (attribCategory != null) {
- parentNode = (ItemTreeNode) idMap.get(attribCategory);
- }
- if (parentNode == null) parentNode = root;
-
- // add the item
- parentNode.addSortedNode(theNode);
- }
-
- /**
- * Creates an ItemDescriptor from an XML definition.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribId the attribute id
- * @return a new ItemDescriptor, or null if an error occurs
- */
- private static ItemDescriptor createItemDescriptor(IConfigurationElement ce, String attribId) {
- final String attribName = getItemName(ce);
- final Image attribIcon = getItemIcon(ce);
- final String attribDescription = getItemDescription(ce);
- final URL attribSourceZip;
- final LaunchDelegate launchDelegate;
-
- IConfigurationElement sourceCE = getItemElement(ce, LAUNCH_ITEMS_XML_SOURCE);
- attribSourceZip = (sourceCE != null) ? getSourceCodePath(sourceCE) : null;
-
- IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
- if (viewCE != null) {
- final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);
- if (attribView == null) {
- logError(getResourceString("error.IncompleteViewLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ViewLaunchDelegate(attribView);
- } else {
- IConfigurationElement programCE = getItemElement(ce, LAUNCH_ITEMS_XML_PROGRAM);
- if (programCE != null) {
- final String attribPluginId = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_PLUGIN, null);
- final String attribClass = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_CLASS, null);
-
- if (attribClass == null || attribPluginId == null) {
- logError(getResourceString("error.IncompleteProgramLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ProgramLaunchDelegate(attribPluginId, attribClass);
- } else {
- logError(getResourceString("error.IncompleteLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- }
- return new ItemDescriptor(attribId, attribName, attribDescription, attribSourceZip,
- attribIcon, launchDelegate);
- }
-
- /**
- * Returns the first instance of a particular child XML element.
- *
- * @param ce the IConfigurationElement parent
- * @param element the name of the element to fetch
- * @return the element's IConfigurationElement, or null if not found
- */
- private static IConfigurationElement getItemElement(IConfigurationElement ce, String element) {
- IConfigurationElement[] elementCEs = ce.getChildren(element);
- return (elementCEs != null && elementCEs.length != 0) ? elementCEs[0] : null;
- }
-
- /**
- * Returns the value of an XML attribute for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribute the attribute to fetch
- * @param defaultValue the value to return if the attribute is not found
- * @return the attribute value
- */
- private static String getItemAttribute(IConfigurationElement ce, String attribute, String defaultValue) {
- String value = ce.getAttribute(attribute);
- return (value != null) ? value : defaultValue;
- }
-
- /**
- * Returns the description string given the IConfigurationElement for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a newline-delimited string that describes this item, or null if none
- */
- private static String getItemDescription(IConfigurationElement ce) {
- String description = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_DESCRIPTION, "");
- return (description.length() == 0) ? null : description;
- }
-
- /**
- * Returns the name of an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return the attribute value
- */
- private static String getItemName(IConfigurationElement ce) {
- return getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_NAME,
- getResourceString("launchitem.Missing.name"));
- }
-
-
- /**
- * Returns the icon for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return an icon
- */
- private static Image getItemIcon(IConfigurationElement ce) {
- String iconPath = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_ICON, "");
- if (iconPath.length() != 0) {
- Image icon = getImageFromPlugin(ce.getDeclaringExtension().getDeclaringPluginDescriptor(),
- iconPath);
- if (icon != null) {
- Image[] newImages = new Image[images.length + 1];
- System.arraycopy(images, 0, newImages, 0, images.length);
- newImages[images.length] = icon;
- images = newImages;
- return icon;
- }
- }
- return images[liGenericExample];
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-
- /**
- * Returns the path of the source code for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a URL containing the source code path, or null if none is available
- */
- private static URL getSourceCodePath(IConfigurationElement ce) {
- String sourcePath = getItemAttribute(ce, LAUNCH_ITEMS_XML_SOURCE_ZIP, "");
- if (sourcePath.length() != 0) {
- try {
- // Extract the URL
- IPluginDescriptor pd = ce.getDeclaringExtension().getDeclaringPluginDescriptor();
- URL sourceUrl = new URL(pd.getInstallURL(), sourcePath);
-
- // Test the URL to make sure there really is a resource here
- // (this helps to prevent the user from seeing "Add to Workspace" if no
- // source bundle is available but one has been specified)
- try {
- InputStream is = sourceUrl.openStream();
- is.close();
- } catch (IOException e) {
- return null;
- }
- return sourceUrl;
- } catch (MalformedURLException e) {
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java
deleted file mode 100755
index 740c663ab7..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.net.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Launcher uses <code>org.eclipse.swt</code> and <code>org.eclipse.core</code>
- * to launch the other registered examples.
- *
- * @see ViewPart
- */
-public class LauncherView extends ViewPart {
- private Shell workbenchShell;
-
- private Tree launchTree;
- private Text descriptionText;
- //private Button importButton;
- private Button runButton;
-
- /**
- * Constructs a LauncherView.
- */
- public LauncherView() {
- LauncherPlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- workbenchShell = getSite().getShell();
- parent.setLayout(new SplitLayout());
-
- Group launchGroup = new Group(parent, SWT.NULL);
- launchGroup.setText(LauncherPlugin.getResourceString("view.launchGroup.text"));
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- launchGroup.setLayout(gridLayout);
-
- launchTree = new Tree(launchGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 2;
- launchTree.setLayoutData(gridData);
- launchTree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- runItem(getSelectedItem());
- }
- });
- launchTree.addTreeListener(new TreeListener() {
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- }
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liOpenFolder]);
- }
- });
-
- runButton = new Button(launchGroup, SWT.PUSH);
- runButton.setText(LauncherPlugin.getResourceString("view.launchButton.text"));
- runButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- runItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- //importButton = new Button(launchGroup, SWT.PUSH);
- //importButton.setText(LauncherPlugin.getResourceString("view.importButton.text"));
- //importButton.addSelectionListener(new SelectionListener() {
- // public void widgetSelected(SelectionEvent event) {
- // importItem(getSelectedItem());
- // }
- // public void widgetDefaultSelected(SelectionEvent event) {
- // }
- //});
-
-
- Group descriptionGroup = new Group(parent, SWT.NULL);
- descriptionGroup.setText(LauncherPlugin.getResourceString("view.descriptionGroup.text"));
- descriptionGroup.setLayout(new FillLayout());
-
- descriptionText = new Text(descriptionGroup, SWT.MULTI | SWT.BORDER |
- SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
-
- setDescriptionByItem(null);
- setItemDescriptors(LauncherPlugin.getLaunchItemTree());
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- launchTree.setFocus();
- runButton.getShell().setDefaultButton(runButton);
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- workbenchShell = null;
- launchTree = null;
- descriptionText = null;
- //importButton = null;
- runButton = null;
- super.dispose();
- }
-
- /**
- * Installs a new launch list.
- *
- * @param newRoot the new tree of launch items for the UI
- */
- public void setItemDescriptors(final ItemTreeNode newRoot) {
- if (workbenchShell == null) return;
- workbenchShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if ((launchTree == null) || (launchTree.isDisposed())) return;
- launchTree.removeAll();
-
- for (ItemTreeNode node = newRoot.getFirstChild(); node != null;
- node = node.getNextSibling()) {
- doNode(node, new TreeItem(launchTree, SWT.NONE)); // top-level TreeItem
- }
- }
- private void addGroup(TreeItem parent, ItemTreeNode node) {
- for (;node != null; node = node.getNextSibling()) {
- doNode(node, new TreeItem(parent, SWT.NONE)); // TreeItem at depth > 0
- }
- }
- private void doNode(ItemTreeNode node, TreeItem treeItem) {
- final ItemDescriptor item = node.getDescriptor();
- treeItem.setText(item.getName());
- treeItem.setData(item);
- if (node.getDescriptor().isFolder()) {
- treeItem.setExpanded(false);
- treeItem.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- } else {
- treeItem.setImage(node.getDescriptor().getIcon());
- }
- addGroup(treeItem, node.getFirstChild());
- }
- });
- }
-
- /**
- * Runs the specified launch item.
- *
- * @param itemDescriptor the launch item to execute
- */
- private void runItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
- final LaunchDelegate launchDelegate = itemDescriptor.getLaunchDelegate();
- if (launchDelegate == null) return;
-
- boolean result = launchDelegate.launch(this);
- if (! result) {
- MessageDialog.openError(workbenchShell,
- LauncherPlugin.getResourceString("dialog.RunProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.RunProgramErrorCheckLog.message",
- new Object[] { itemDescriptor.getName() }));
- }
- }
-
- /**
- * Imports the specified launch item into the workspace.
- *
- * @param itemDescriptor the launch item to import.
- */
- private void importItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
-
- URL sourceUrl = itemDescriptor.getSourceCodePath();
- if (sourceUrl == null) return; // oops! can't do that!
-
- ImportProjectTask task = new ImportProjectTask(workbenchShell, itemDescriptor.getName(),
- sourceUrl);
- boolean success = task.execute();
- task.dispose();
- }
- /**
- * Obtains the selected launch item.
- *
- * @return the currently selected ItemDescriptor
- */
- private ItemDescriptor getSelectedItem() {
- final TreeItem[] selections = launchTree.getSelection();
- if (selections.length == 0) return null;
- final ItemDescriptor itemDescriptor = (ItemDescriptor) selections[0].getData();
- return itemDescriptor;
- }
-
- /**
- * Sets the currently visible description text to reflect that of a particular ItemDescriptor.
- *
- * @param itemDescriptor the launch item whose description is to be displayed, or null if none
- */
- private void setDescriptionByItem(ItemDescriptor itemDescriptor) {
- String description;
- if (itemDescriptor == null) {
- description = LauncherPlugin.getResourceString("launchitem.Null.description");
- if (runButton != null) runButton.setEnabled(false);
- //if (importButton != null) importButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
-
- if (runButton != null) runButton.setEnabled(itemDescriptor.getLaunchDelegate() != null);
- //if (importButton != null) importButton.setEnabled(itemDescriptor.getSourceCodePath() != null);
- }
- descriptionText.setText(description);
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java
deleted file mode 100755
index b1e2f2c123..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.*; import org.eclipse.jdt.launching.*; import org.eclipse.ui.*;
-
-/**
- * A launch delegate for running a standalone program embedded inside a plugin package.
- */
-class ProgramLaunchDelegate implements LaunchDelegate {
- private String mainClassName;
- private String pluginId;
-
- public ProgramLaunchDelegate(String pluginId, String mainClassName) {
- this.pluginId = pluginId;
- this.mainClassName = mainClassName;
- }
-
- public boolean launch(IViewPart hostView) {
- boolean result = launchHelper(hostView);
- return result;
- }
-
- public boolean launchHelper(IViewPart hostView) {
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve plugin descriptors for all plugins matching pluginId
- // [array may contain multiple versions of a given plugin]
- IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(pluginId);
-
- if (pluginDescriptors == null || pluginDescriptors.length == 0) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindPlugin",
- new Object[] { pluginId }), null);
- return false;
- }
-
- String[] appArgs = new String[] { "-appplugin", pluginId, "-appclass", mainClassName };
- ApplicationRunner runner = new ApplicationRunner(LauncherApplication.APPLICATION_ID, appArgs);
- runner.setPluginsPath(ApplicationRunner.getCurrentPluginsPath());
- runner.setStatePath(LauncherPlugin.getDefault().getStateLocation().toFile().getAbsolutePath());
- VMRunnerResult result = runner.run();
- if (! ApplicationRunner.isResultOk(result)) return false;
-
- initWatch(result);
- return true;
- }
-
- private void initWatch(VMRunnerResult result) {
- final IProcess[] processes = result.getProcesses();
- for (int i = 0; i < processes.length; ++i) {
- final IProcess process = processes[i];
- if (process == null) continue;
- final IStreamsProxy streamsProxy = process.getStreamsProxy();
- if (streamsProxy == null) continue;
-
- final IStreamMonitor outMonitor = streamsProxy.getOutputStreamMonitor();
- if (outMonitor != null) {
- outMonitor.addListener(new IStreamListener() {
- public void streamAppended(String text, IStreamMonitor monitor) {
- System.out.println(text);
- }
- });
- }
-
- final IStreamMonitor errMonitor = streamsProxy.getErrorStreamMonitor();
- if (errMonitor != null) {
- errMonitor.addListener(new IStreamListener() {
- public void streamAppended(String text, IStreamMonitor monitor) {
- System.err.println(text);
- }
- });
- }
- }
- }
-}
-
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java
deleted file mode 100755
index 01913074c4..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** * A Layout class that automatically switches from a horizontal split to a vertical * split layout to accomodate changing size conditions. * * Later on we might improve this class to take into account the "preferred" size of * the widgets. */
-public class SplitLayout extends Layout { private static final int splitHorizontally = 0, splitVertically = 1; private int splitDirection = splitHorizontally; public int spacing = 3; public int marginTop = 3;
- public int marginLeft = 3; public int marginRight = 3; public int marginBottom = 3; /**
- * Creates a new layout
- */
- public SplitLayout() { }
- /** * @see Layout#computeSize(Composite, int, int, boolean) */ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint == SWT.DEFAULT) { if (hHint == SWT.DEFAULT) { Point hSplitSize = computeHSplitSize(composite, wHint, hHint, flushCache); Point vSplitSize = computeVSplitSize(composite, wHint, hHint, false); int hSplitArea = hSplitSize.x * hSplitSize.y; int vSplitArea = vSplitSize.x * vSplitSize.y; // Choose direction consuming least area if (hSplitArea < vSplitArea) { splitDirection = splitHorizontally; return hSplitSize; } else { splitDirection = splitVertically; return vSplitSize; } } else { // Constrained in height: split vertically splitDirection = splitVertically; return computeVSplitSize(composite, wHint, hHint, flushCache); } } else { if (hHint == SWT.DEFAULT) { // Constrained in width: split horizontally splitDirection = splitHorizontally; return computeHSplitSize(composite, wHint, hHint, flushCache); } else { if (hHint < wHint) { splitDirection = splitVertically; return computeVSplitSize(composite, wHint, hHint, flushCache); } else { splitDirection = splitHorizontally; return computeHSplitSize(composite, wHint, hHint, flushCache); } } } }
- /**
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) { Rectangle clientArea = composite.getClientArea(); computeSize(composite, clientArea.width, clientArea.height, false); Control[] children = composite.getChildren(); clientArea.x += marginLeft; clientArea.y += marginTop; clientArea.width -= marginRight + marginLeft; clientArea.height -= marginBottom + marginTop; Point position = new Point(clientArea.x, clientArea.y); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; final Rectangle bounds; if (splitDirection == splitHorizontally) { int height = clientArea.height / children.length; bounds = new Rectangle(position.x, position.y, clientArea.width, height); position.y += height + spacing; } else { int width = clientArea.width / children.length; bounds = new Rectangle(position.x, position.y, width, clientArea.height); position.x += width + spacing; } bounds.width = Math.max(bounds.width, 0); bounds.height = Math.max(bounds.height, 0); child.setBounds(bounds); } }
- private Point computeHSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) { Point size = new Point(marginLeft + marginRight, marginTop + marginBottom); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; Point childSize = child.computeSize(wHint, hHint, flushCache); size.x = Math.max(size.x, childSize.x); size.y += childSize.y + spacing; } return size; } private Point computeVSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) { Point size = new Point(marginLeft + marginRight, marginTop + marginBottom); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; Point childSize = child.computeSize(wHint, hHint, flushCache); size.x += childSize.x + spacing; size.y = Math.max(size.y, childSize.y); } return size; } }
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java
deleted file mode 100755
index fd85c88b56..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.core.runtime.*; import org.eclipse.ui.*;
- /** * A launch delegate for starting an Eclipse view. */
-class ViewLaunchDelegate implements LaunchDelegate {
- private String pluginViewId;
-
- public ViewLaunchDelegate(String pluginViewId) {
- this.pluginViewId = pluginViewId;
- }
- public boolean launch(IViewPart hostView) { boolean result = launchHelper(hostView); return result; }
- public boolean launchHelper(IViewPart hostView) {
- final IWorkbenchPart workbenchPart = hostView;
- final IWorkbenchPartSite workbenchPartSite = workbenchPart.getSite();
- final IWorkbenchPage workbenchPage = workbenchPartSite.getPage();
-
- try {
- workbenchPage.showView(pluginViewId);
- return true; } catch (PartInitException e) { LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e); } return false; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.properties b/examples/org.eclipse.swt.examples.launcher/plugin.properties
deleted file mode 100755
index 90ba763c82..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.properties
+++ /dev/null
@@ -1,96 +0,0 @@
-plugin.SWTLauncherExample.name = SWT Launcher Example Plugin
-category.SWTExamples.name = SWT Examples
-view.LauncherExample.name = SWT Example Launcher
-
-extension-point.launchItems.name = Launch Items
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.LauncherExample.name = Launcher
-launchitem.LauncherExample.description = \
- Introduction\n\
- The Example Launcher is a tool for enumerating, running and browsing a variety of examples. \
- While these operations may be performed manually (with some difficulty), the Example Launcher \
- offers a convenient interface. For information on how to manipulate particular examples \
- manually, please consult their related documentation.\n\n\
- Running the Example Launcher\n\
- To run the Example Launcher, pull down the Perspective menu, select the \
- Show View menu item, then select Other from the submenu. A dialog \
- will come up with a list of views. Expand SWT Examples and select \
- the view named SWT Example Launcher. A view containing a list of examples to \
- choose will appear.\n\n\
- About the examples\n\
- The Example Launcher can launch two different types of examples: Workbench Views, \
- and Standalone applications. Examples will generally be organized into categories to \
- distinguish the one from the other.\n\n\
- Workbench Views are GUI panels that sit inside a given perspective. When the Launcher \
- starts a program that is written to interact with the Workbench as a view, it is opened and \
- embedded into the currently active perspective.\n\n\
- Standalone applications are programs that run independently of the current \
- Eclipse Platform environment. First, a new Java VM and Eclipse Platform runtime \
- is started, then the application's main() method is invoked. For this reason, \
- these applications may take some time to load.\n\n\
- Details\n\n\
- The example launcher view contains a tree list, a text area, and 2 buttons. \
- The tree list contains a list of all the SWT examples you can choose \
- to run. When an example is selected from the tree, the text area \
- shows a short description of each example. The selected example can \
- be executed by clicking on the Run button, which can be found just below \
- the tree list. For some of the examples, you can also import the example \
- source code into a project in the Workspace. A project, with a name specified \
- by the user, is created and all the java classes required to run that example \
- will be added to that newly created project.\n\n\
- Depending on the example and on the configuration of your system, it may be \
- necessary to alter Project build paths or to define classpath variables to compile \
- or run examples that have been imported to the Workspace.
-
-error.CouldNotLoadResources = Unable to load resources
-error.IncompleteProgramLaunchItem = Incomplete XML ProgramLaunchItem definition, id = {0}
-error.IncompleteViewLaunchItem = Incomplete XML ViewLaunchItem definition, id = {0}
-error.IncompleteLaunchItem = Incomplete or unrecognized XML LaunchItem definition, id = {0}
-
-dialog.RunProgramProblems.title = Run Program Problems
-dialog.RunProgramErrorCheckLog.message = Error while running program "{0}", check log for details.
-
-dialog.ImportPathInput.title = Add to Workbench
-dialog.ImportPathInput.message = Enter the name of the new project to create.
-dialog.InvalidTargetProjectPath.interactive = Not a valid project name.
-dialog.ExistingProjectPath.interactive = A project with that name already exists.
-
-dialog.ImportProgramProblems.title = Add to Workbench Problems
-dialog.InvalidTargetProjectPath.message = "{0}" is not a valid project name.
-dialog.ErrorAccessingZipFile.message = Error accessing Zip/Jar file "{0}" for import. {1}
-dialog.ErrorCreatingNewProject.message = Error creating new project. {0}
-dialog.ErrorUpdatingProjectProperties.message = Error updating project properties. {0}
-dialog.UnableToGetJavaProjectHandle.message = Could not retrieve Java Project handle.
-dialog.UnableToSetClasspathVariable.message = Could not set classpath variable "{0}" to "{1}".
-dialog.UnableExpandSubstitutionKeyword.message = Could not expand substitution variable "{0}" in "{1}" line of import.properties.
-dialog.UnableToProgramArguments.message = Could not set program arguments for type "{1}" in resource "{0}" to "{2}".
-dialog.UnableToVMArguments.message = Could not set VM arguments for type "{1}" resource "{0}" to "{2}".
-
-dialog.ImportProgramOverwrite.title = Add to Workbench
-dialog.FileAlreadyExists.message = {0} already exists. Would you like to overwrite it?
-
-launchitem.Null.description = <<no item selected>>
-
-launchitem.Missing.name = <<unnamed>>
-launchitem.Missing.description = <<no description available>>
-
-view.launchGroup.text = Examples
-view.launchButton.text = Run
-view.importButton.text = Add to Workspace
-view.descriptionGroup.text = Description
-
-run.error.Invocation = A fatal error occurred while launching the program.
-run.error.Execution = An uncaught exception occured while running the program.
-run.error.CouldNotFindPlugin = Could not find plugin: {0}
-run.error.CouldNotFindMain = Could not find a suitable main method to run.
-run.error.CouldNotFindDefaultVM = Could not find default VM. Please ensure that a default VM has been selected in the Java Properties editor.
-run.error.CouldNotFindVMRunner = The VM "{0}" does not support launching Java programs in ''Run'' mode. Please select a default VM that supports this mode in the Java Properties editor.
-run.error.CouldNotDetermineClasspath = Internal Error: Unable to determine classpath for plugin: {0}
-run.error.MalformedArgumentList = Malformed argument list
-run.error.MissingAppPlugin = Missing -appplugin argument. Must specify the plugin with the program to launch.
-run.error.MissingAppClass = Missing -appclass argument. Must specify the class with the main() method to invoke.
diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.xml b/examples/org.eclipse.swt.examples.launcher/plugin.xml
deleted file mode 100755
index 96e0f550f7..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.launcher"
- name="%plugin.SWTLauncherExample.name"
- version="2.0"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.launcher.LauncherPlugin">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.jdt.launching"/>
- <import plugin="org.eclipse.debug.core"/>
- <import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.jdt.core"/>
-</requires>
-
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
-<runtime>
- <library name="launcher.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<extension-point id="launchItems" name="%extension-point.launchItems.name" schema="schema/org.eclipse.swt.examples.launcher.launchItems.xsd"/>
-
-<!-- Extensions -->
-<extension
- id="application"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- name="%launchitem.LauncherApplication.name"
- class="org.eclipse.swt.examples.launcher.LauncherApplication">
- </run>
- </application>
-</extension>
-<extension
- point="org.eclipse.ui.views">
- <category
- name="%category.SWTExamples.name"
- id="org.eclipse.swt.examples.category">
- </category>
- <view
- name="%view.LauncherExample.name"
- icon="icons/launcher_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.launcher.LauncherView"
- id="org.eclipse.swt.examples.launcher.view">
- </view>
-</extension>
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- enabled="false"
- name="%launchitem.LauncherExample.name"
- icon="icons/launcher_example.gif"
- description="%launchitem.LauncherExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.launcher.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.launcher.view"/>
- <source
- zip="launchersrc.zip"/>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd b/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd
deleted file mode 100755
index 4dee880333..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.swt.examples.launcher">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.swt.examples.launcher" id="launchItems" name="Launch Items"/>
- </appInfo>
- <documentation>
- This extension point is used to add 'standalone program' and 'Workbench view'
- launch items to the Launcher, optionally grouping them into
- categories so as to form a multi-tiered hierarchy.
- Standalone programs are executed in new run-time environments.
- Workbench views are created within the active Workbench Perspective.
- </documentation>
-</annotation>
-
- <element name="extension">
- <complexType>
- <all>
- <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="item" minOccurs="0" maxOccurs="unbounded"/>
- </all>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="program">
- <annotation>
- <documentation>
- Specifies a "Standalone Program" for a launch item to run.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="mainClass" type="string" use="required">
- <annotation>
- <documentation>
- The fully-qualified name of the class whose main() method is to be launched.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="pluginId" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of the Eclipse Platform plugin containing the program.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="view">
- <annotation>
- <documentation>
- Specifies a "Workbench View" for a launch item to activate.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="viewId" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of the Workbench View to be activated when the item is launched.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="category">
- <annotation>
- <documentation>
- Specifies a launch item category heading.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The localized name of this category.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of this category. Categories with duplicate id's will be discarded.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The unique id of the parent category.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="item">
- <annotation>
- <documentation>
- Specifies a launch item.
- </documentation>
- </annotation>
- <complexType>
- <all>
- <choice>
- <element ref="program"/>
- <element ref="view"/>
- </choice>
- <element ref="source" minOccurs="0" maxOccurs="1"/>
- </all>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The localized name of this launch item.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of this launch item. Launch items with duplicate id's will be discarded.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The unique id of the category this launch item belongs to.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- The declaring plugin relative path of an icon to display with this launch item in the Launcher.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="enabled" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
- Set to "false" to disable this launch item, or to "true" to enable it (default).
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- The localized plain-text description of this launch item.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="source">
- <complexType>
- <attribute name="zip" type="string">
- <annotation>
- <documentation>
- The declaring plugin relative path of a ZIP file containing source code associated with a launch item.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java
deleted file mode 100755
index 735291513b..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.net.*; import org.eclipse.swt.graphics.*;
- /** * ItemDescriptor collects information about a launch item. */
-class ItemDescriptor {
- private String id;
- private String name;
- private String description; private Image icon;
- private URL sourceCodePath;
- private LaunchDelegate launchDelegate;
-
- /**
- * Constructs an ItemDescriptor.
- *
- * @param id the id
- * @param name the name
- * @param description the description
- * @param launchDelegate a launch delegate for the program to be launched using this descriptor,
- * may be null if item is not launchable
- */
- public ItemDescriptor(String id, String name, String description, URL sourceCodePath,
- Image icon, LaunchDelegate launchDelegate) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.sourceCodePath = sourceCodePath; this.icon = icon;
- this.launchDelegate = launchDelegate;
- }
-
- /**
- * Returns the ID for this program.
- *
- * @return the user-specified ID for this program
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the translated name for the program.
- *
- * @return the name of the program
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns a short description for the program.
- *
- * @return a newline-delimited string describing the program, null if no description is available
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Returns source code path
- *
- * @return a URL specifying the name of a zip/jar or the base of a directory where the source
- * code is stored, null if no source is available
- */
- public URL getSourceCodePath() {
- return sourceCodePath;
- }
- /** * Returns an icon for this descriptor * * @returns an icon, null if the item is a folder */ public Image getIcon() { return icon; }
- /**
- * Returns launch delegate for the program.
- *
- * @return the launch delegate, null if the item is a folder
- */
- public LaunchDelegate getLaunchDelegate() {
- return launchDelegate;
- } /** * Determines if an item is a folder. * * @return true if the item is a folder */ public boolean isFolder() { return launchDelegate == null; }
-
- /**
- * Determines the equality of descriptors.
- *
- * @return true if this.getId().equalsIgnoreCase(other.getId())
- */
- public boolean equals(Object other) { if (other instanceof ItemDescriptor) {
- ItemDescriptor otherDescriptor = (ItemDescriptor) other;
- return getId().equalsIgnoreCase(otherDescriptor.getId());
- }
- return false;
- } /** * Produces a hashcode. * * @return the hashcode */ public int hashCode() { return id.toUpperCase().hashCode(); }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java
deleted file mode 100755
index bc1a5ac185..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Internal class used to store tree structures of ItemDescriptors
- */
-class ItemTreeNode {
- private ItemTreeNode nextSibling;
- private ItemTreeNode firstChild;
- private ItemDescriptor descriptor;
-
- /**
- * Constructs a leaf ItemTreeNode with a given descriptor.
- *
- * @param descriptor the descriptor
- */
- public ItemTreeNode(ItemDescriptor descriptor) {
- this.descriptor = descriptor;
- }
-
- /**
- * Adds a node to the Tree in sorted order by name.
- *
- * @param node the node to add. Note that node.nextSibling must be null
- */
- public void addSortedNode(ItemTreeNode node) {
- if (firstChild == null) {
- firstChild = node;
- } else if (firstChild.descriptor.getName().compareTo(node.descriptor.getName()) > 0) {
- node.nextSibling = firstChild;
- firstChild = node;
- } else {
- ItemTreeNode cursor;
- for (cursor = firstChild; cursor.nextSibling != null; cursor = cursor.nextSibling) {
- ItemTreeNode sibling = cursor.nextSibling;
- if (sibling.descriptor.getName().compareTo(node.descriptor.getName()) > 0) break;
- }
- node.nextSibling = cursor.nextSibling;
- cursor.nextSibling = node;
- }
- }
-
- /**
- * Returns the descriptor for this node.
- *
- * @return the descriptor
- */
- public ItemDescriptor getDescriptor() {
- return descriptor;
- }
-
- /**
- * Returns the next sibling of this node.
- *
- * @return the next sibling, or null if none
- */
- public ItemTreeNode getNextSibling() {
- return nextSibling;
- }
-
- /**
- * Returns the first child of this node.
- *
- * @return the first child, or null if none
- */
- public ItemTreeNode getFirstChild() {
- return firstChild;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
deleted file mode 100755
index 1ee79c11e3..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
+++ /dev/null
@@ -1,413 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.net.*; import java.text.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.graphics.*; import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class LauncherPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static LauncherPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- private static final String
- LAUNCH_ITEMS_POINT_ID = "org.eclipse.swt.examples.launcher.launchItems",
- LAUNCH_ITEMS_XML_CATEGORY = "category",
- LAUNCH_ITEMS_XML_ITEM = "item",
- LAUNCH_ITEMS_XML_ITEM_ICON = "icon",
- LAUNCH_ITEMS_XML_ITEM_DESCRIPTION = "description",
- LAUNCH_ITEMS_XML_PROGRAM = "program",
- LAUNCH_ITEMS_XML_PROGRAM_PLUGIN = "pluginId",
- LAUNCH_ITEMS_XML_PROGRAM_CLASS = "mainClass",
- LAUNCH_ITEMS_XML_VIEW = "view",
- LAUNCH_ITEMS_XML_VIEW_VIEWID = "viewId",
- LAUNCH_ITEMS_XML_SOURCE = "source",
- LAUNCH_ITEMS_XML_SOURCE_ZIP = "zip",
- LAUNCH_ITEMS_XML_ATTRIB_ID = "id",
- LAUNCH_ITEMS_XML_ATTRIB_NAME = "name",
- LAUNCH_ITEMS_XML_ATTRIB_ENABLED = "enabled",
- LAUNCH_ITEMS_XML_ATTRIB_CATEGORY = "category",
- LAUNCH_ITEMS_XML_VALUE_TRUE = "true",
- LAUNCH_ITEMS_XML_VALUE_FALSE = "false";
-
- static final int
- liClosedFolder = 0,
- liOpenFolder = 1,
- liGenericExample = 2;
- static final String[] imageLocations = {
- "icons/closedFolder.gif",
- "icons/openFolder.gif",
- "icons/generic_example.gif" };
- static Image images[];
-
- /**
- * Constructs the LauncherPlugin.
- */
- public LauncherPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static LauncherPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Loads the resources
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Constructs a list of available programs from registered extensions.
- *
- * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
- */
- public static ItemTreeNode getLaunchItemTree() {
- ItemTreeNode categoryTree =
- new ItemTreeNode(new ItemDescriptor("<<Root>>", "<<Root>>", null, null, null, null));
-
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve all configuration elements registered at our launchItems extension-point
- IConfigurationElement[] configurationElements =
- pluginRegistry.getConfigurationElementsFor(LAUNCH_ITEMS_POINT_ID);
-
- if (configurationElements == null || configurationElements.length == 0) {
- logError("Could not find registered extensions", null);
- return categoryTree;
- }
-
- /* Collect all launch categories -- coalesce those with same ID */
- HashMap idMap = new HashMap();
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final String attribName = getItemName(ce);
- ItemDescriptor theDescriptor = new ItemDescriptor(attribId, attribName,
- getItemDescription(ce), null, null, null);
- idMap.put(attribId, new ItemTreeNode(theDescriptor));
- }
- }
-
- /* Generate launch category hierarchy */
- Set tempIdSet = new HashSet(); // used to prevent duplicates from being entered into the tree
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (tempIdSet.contains(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final ItemTreeNode theNode = (ItemTreeNode) idMap.get(attribId);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- tempIdSet.add(attribId);
- }
- }
-
- /* Generate program tree */
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- // ignore
- } else if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_ITEM)) {
- final String enabled = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ENABLED,
- LAUNCH_ITEMS_XML_VALUE_TRUE);
- if (enabled.equalsIgnoreCase(LAUNCH_ITEMS_XML_VALUE_FALSE)) continue;
- ItemDescriptor theDescriptor = createItemDescriptor(ce, attribId);
-
- if (theDescriptor != null) {
- final ItemTreeNode theNode = new ItemTreeNode(theDescriptor);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- idMap.put(attribId, theNode);
- }
- }
- }
- return categoryTree;
- }
-
-
- /**
- * Adds an item to the category tree.
- */
- private static void addItemByCategory(IConfigurationElement ce, ItemTreeNode root,
- ItemTreeNode theNode, HashMap idMap) {
- final String attribCategory = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_CATEGORY, null);
-
- // locate the parent node
- ItemTreeNode parentNode = null;
- if (attribCategory != null) {
- parentNode = (ItemTreeNode) idMap.get(attribCategory);
- }
- if (parentNode == null) parentNode = root;
-
- // add the item
- parentNode.addSortedNode(theNode);
- }
-
- /**
- * Creates an ItemDescriptor from an XML definition.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribId the attribute id
- * @return a new ItemDescriptor, or null if an error occurs
- */
- private static ItemDescriptor createItemDescriptor(IConfigurationElement ce, String attribId) {
- final String attribName = getItemName(ce);
- final Image attribIcon = getItemIcon(ce);
- final String attribDescription = getItemDescription(ce);
- final URL attribSourceZip;
- final LaunchDelegate launchDelegate;
-
- IConfigurationElement sourceCE = getItemElement(ce, LAUNCH_ITEMS_XML_SOURCE);
- attribSourceZip = (sourceCE != null) ? getSourceCodePath(sourceCE) : null;
-
- IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
- if (viewCE != null) {
- final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);
- if (attribView == null) {
- logError(getResourceString("error.IncompleteViewLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ViewLaunchDelegate(attribView);
- } else {
- IConfigurationElement programCE = getItemElement(ce, LAUNCH_ITEMS_XML_PROGRAM);
- if (programCE != null) {
- final String attribPluginId = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_PLUGIN, null);
- final String attribClass = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_CLASS, null);
-
- if (attribClass == null || attribPluginId == null) {
- logError(getResourceString("error.IncompleteProgramLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ProgramLaunchDelegate(attribPluginId, attribClass);
- } else {
- logError(getResourceString("error.IncompleteLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- }
- return new ItemDescriptor(attribId, attribName, attribDescription, attribSourceZip,
- attribIcon, launchDelegate);
- }
-
- /**
- * Returns the first instance of a particular child XML element.
- *
- * @param ce the IConfigurationElement parent
- * @param element the name of the element to fetch
- * @return the element's IConfigurationElement, or null if not found
- */
- private static IConfigurationElement getItemElement(IConfigurationElement ce, String element) {
- IConfigurationElement[] elementCEs = ce.getChildren(element);
- return (elementCEs != null && elementCEs.length != 0) ? elementCEs[0] : null;
- }
-
- /**
- * Returns the value of an XML attribute for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribute the attribute to fetch
- * @param defaultValue the value to return if the attribute is not found
- * @return the attribute value
- */
- private static String getItemAttribute(IConfigurationElement ce, String attribute, String defaultValue) {
- String value = ce.getAttribute(attribute);
- return (value != null) ? value : defaultValue;
- }
-
- /**
- * Returns the description string given the IConfigurationElement for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a newline-delimited string that describes this item, or null if none
- */
- private static String getItemDescription(IConfigurationElement ce) {
- String description = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_DESCRIPTION, "");
- return (description.length() == 0) ? null : description;
- }
-
- /**
- * Returns the name of an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return the attribute value
- */
- private static String getItemName(IConfigurationElement ce) {
- return getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_NAME,
- getResourceString("launchitem.Missing.name"));
- }
-
-
- /**
- * Returns the icon for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return an icon
- */
- private static Image getItemIcon(IConfigurationElement ce) {
- String iconPath = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_ICON, "");
- if (iconPath.length() != 0) {
- Image icon = getImageFromPlugin(ce.getDeclaringExtension().getDeclaringPluginDescriptor(),
- iconPath);
- if (icon != null) {
- Image[] newImages = new Image[images.length + 1];
- System.arraycopy(images, 0, newImages, 0, images.length);
- newImages[images.length] = icon;
- images = newImages;
- return icon;
- }
- }
- return images[liGenericExample];
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-
- /**
- * Returns the path of the source code for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a URL containing the source code path, or null if none is available
- */
- private static URL getSourceCodePath(IConfigurationElement ce) {
- String sourcePath = getItemAttribute(ce, LAUNCH_ITEMS_XML_SOURCE_ZIP, "");
- if (sourcePath.length() != 0) {
- try {
- // Extract the URL
- IPluginDescriptor pd = ce.getDeclaringExtension().getDeclaringPluginDescriptor();
- URL sourceUrl = new URL(pd.getInstallURL(), sourcePath);
-
- // Test the URL to make sure there really is a resource here
- // (this helps to prevent the user from seeing "Add to Workspace" if no
- // source bundle is available but one has been specified)
- try {
- InputStream is = sourceUrl.openStream();
- is.close();
- } catch (IOException e) {
- return null;
- }
- return sourceUrl;
- } catch (MalformedURLException e) {
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java
deleted file mode 100755
index 740c663ab7..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.net.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Launcher uses <code>org.eclipse.swt</code> and <code>org.eclipse.core</code>
- * to launch the other registered examples.
- *
- * @see ViewPart
- */
-public class LauncherView extends ViewPart {
- private Shell workbenchShell;
-
- private Tree launchTree;
- private Text descriptionText;
- //private Button importButton;
- private Button runButton;
-
- /**
- * Constructs a LauncherView.
- */
- public LauncherView() {
- LauncherPlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- workbenchShell = getSite().getShell();
- parent.setLayout(new SplitLayout());
-
- Group launchGroup = new Group(parent, SWT.NULL);
- launchGroup.setText(LauncherPlugin.getResourceString("view.launchGroup.text"));
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- launchGroup.setLayout(gridLayout);
-
- launchTree = new Tree(launchGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 2;
- launchTree.setLayoutData(gridData);
- launchTree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- runItem(getSelectedItem());
- }
- });
- launchTree.addTreeListener(new TreeListener() {
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- }
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liOpenFolder]);
- }
- });
-
- runButton = new Button(launchGroup, SWT.PUSH);
- runButton.setText(LauncherPlugin.getResourceString("view.launchButton.text"));
- runButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- runItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- //importButton = new Button(launchGroup, SWT.PUSH);
- //importButton.setText(LauncherPlugin.getResourceString("view.importButton.text"));
- //importButton.addSelectionListener(new SelectionListener() {
- // public void widgetSelected(SelectionEvent event) {
- // importItem(getSelectedItem());
- // }
- // public void widgetDefaultSelected(SelectionEvent event) {
- // }
- //});
-
-
- Group descriptionGroup = new Group(parent, SWT.NULL);
- descriptionGroup.setText(LauncherPlugin.getResourceString("view.descriptionGroup.text"));
- descriptionGroup.setLayout(new FillLayout());
-
- descriptionText = new Text(descriptionGroup, SWT.MULTI | SWT.BORDER |
- SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
-
- setDescriptionByItem(null);
- setItemDescriptors(LauncherPlugin.getLaunchItemTree());
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- launchTree.setFocus();
- runButton.getShell().setDefaultButton(runButton);
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- workbenchShell = null;
- launchTree = null;
- descriptionText = null;
- //importButton = null;
- runButton = null;
- super.dispose();
- }
-
- /**
- * Installs a new launch list.
- *
- * @param newRoot the new tree of launch items for the UI
- */
- public void setItemDescriptors(final ItemTreeNode newRoot) {
- if (workbenchShell == null) return;
- workbenchShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if ((launchTree == null) || (launchTree.isDisposed())) return;
- launchTree.removeAll();
-
- for (ItemTreeNode node = newRoot.getFirstChild(); node != null;
- node = node.getNextSibling()) {
- doNode(node, new TreeItem(launchTree, SWT.NONE)); // top-level TreeItem
- }
- }
- private void addGroup(TreeItem parent, ItemTreeNode node) {
- for (;node != null; node = node.getNextSibling()) {
- doNode(node, new TreeItem(parent, SWT.NONE)); // TreeItem at depth > 0
- }
- }
- private void doNode(ItemTreeNode node, TreeItem treeItem) {
- final ItemDescriptor item = node.getDescriptor();
- treeItem.setText(item.getName());
- treeItem.setData(item);
- if (node.getDescriptor().isFolder()) {
- treeItem.setExpanded(false);
- treeItem.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- } else {
- treeItem.setImage(node.getDescriptor().getIcon());
- }
- addGroup(treeItem, node.getFirstChild());
- }
- });
- }
-
- /**
- * Runs the specified launch item.
- *
- * @param itemDescriptor the launch item to execute
- */
- private void runItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
- final LaunchDelegate launchDelegate = itemDescriptor.getLaunchDelegate();
- if (launchDelegate == null) return;
-
- boolean result = launchDelegate.launch(this);
- if (! result) {
- MessageDialog.openError(workbenchShell,
- LauncherPlugin.getResourceString("dialog.RunProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.RunProgramErrorCheckLog.message",
- new Object[] { itemDescriptor.getName() }));
- }
- }
-
- /**
- * Imports the specified launch item into the workspace.
- *
- * @param itemDescriptor the launch item to import.
- */
- private void importItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
-
- URL sourceUrl = itemDescriptor.getSourceCodePath();
- if (sourceUrl == null) return; // oops! can't do that!
-
- ImportProjectTask task = new ImportProjectTask(workbenchShell, itemDescriptor.getName(),
- sourceUrl);
- boolean success = task.execute();
- task.dispose();
- }
- /**
- * Obtains the selected launch item.
- *
- * @return the currently selected ItemDescriptor
- */
- private ItemDescriptor getSelectedItem() {
- final TreeItem[] selections = launchTree.getSelection();
- if (selections.length == 0) return null;
- final ItemDescriptor itemDescriptor = (ItemDescriptor) selections[0].getData();
- return itemDescriptor;
- }
-
- /**
- * Sets the currently visible description text to reflect that of a particular ItemDescriptor.
- *
- * @param itemDescriptor the launch item whose description is to be displayed, or null if none
- */
- private void setDescriptionByItem(ItemDescriptor itemDescriptor) {
- String description;
- if (itemDescriptor == null) {
- description = LauncherPlugin.getResourceString("launchitem.Null.description");
- if (runButton != null) runButton.setEnabled(false);
- //if (importButton != null) importButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
-
- if (runButton != null) runButton.setEnabled(itemDescriptor.getLaunchDelegate() != null);
- //if (importButton != null) importButton.setEnabled(itemDescriptor.getSourceCodePath() != null);
- }
- descriptionText.setText(description);
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
deleted file mode 100755
index 01913074c4..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** * A Layout class that automatically switches from a horizontal split to a vertical * split layout to accomodate changing size conditions. * * Later on we might improve this class to take into account the "preferred" size of * the widgets. */
-public class SplitLayout extends Layout { private static final int splitHorizontally = 0, splitVertically = 1; private int splitDirection = splitHorizontally; public int spacing = 3; public int marginTop = 3;
- public int marginLeft = 3; public int marginRight = 3; public int marginBottom = 3; /**
- * Creates a new layout
- */
- public SplitLayout() { }
- /** * @see Layout#computeSize(Composite, int, int, boolean) */ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint == SWT.DEFAULT) { if (hHint == SWT.DEFAULT) { Point hSplitSize = computeHSplitSize(composite, wHint, hHint, flushCache); Point vSplitSize = computeVSplitSize(composite, wHint, hHint, false); int hSplitArea = hSplitSize.x * hSplitSize.y; int vSplitArea = vSplitSize.x * vSplitSize.y; // Choose direction consuming least area if (hSplitArea < vSplitArea) { splitDirection = splitHorizontally; return hSplitSize; } else { splitDirection = splitVertically; return vSplitSize; } } else { // Constrained in height: split vertically splitDirection = splitVertically; return computeVSplitSize(composite, wHint, hHint, flushCache); } } else { if (hHint == SWT.DEFAULT) { // Constrained in width: split horizontally splitDirection = splitHorizontally; return computeHSplitSize(composite, wHint, hHint, flushCache); } else { if (hHint < wHint) { splitDirection = splitVertically; return computeVSplitSize(composite, wHint, hHint, flushCache); } else { splitDirection = splitHorizontally; return computeHSplitSize(composite, wHint, hHint, flushCache); } } } }
- /**
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) { Rectangle clientArea = composite.getClientArea(); computeSize(composite, clientArea.width, clientArea.height, false); Control[] children = composite.getChildren(); clientArea.x += marginLeft; clientArea.y += marginTop; clientArea.width -= marginRight + marginLeft; clientArea.height -= marginBottom + marginTop; Point position = new Point(clientArea.x, clientArea.y); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; final Rectangle bounds; if (splitDirection == splitHorizontally) { int height = clientArea.height / children.length; bounds = new Rectangle(position.x, position.y, clientArea.width, height); position.y += height + spacing; } else { int width = clientArea.width / children.length; bounds = new Rectangle(position.x, position.y, width, clientArea.height); position.x += width + spacing; } bounds.width = Math.max(bounds.width, 0); bounds.height = Math.max(bounds.height, 0); child.setBounds(bounds); } }
- private Point computeHSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) { Point size = new Point(marginLeft + marginRight, marginTop + marginBottom); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; Point childSize = child.computeSize(wHint, hHint, flushCache); size.x = Math.max(size.x, childSize.x); size.y += childSize.y + spacing; } return size; } private Point computeVSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) { Point size = new Point(marginLeft + marginRight, marginTop + marginBottom); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; ++i) { final Control child = children[i]; Point childSize = child.computeSize(wHint, hHint, flushCache); size.x += childSize.x + spacing; size.y = Math.max(size.y, childSize.y); } return size; } }
diff --git a/examples/org.eclipse.swt.examples.ole.win32/.classpath b/examples/org.eclipse.swt.examples.ole.win32/.classpath
deleted file mode 100755
index 69fb28eb43..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui/workbenchsrc.zip"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/.cvsignore b/examples/org.eclipse.swt.examples.ole.win32/.cvsignore
deleted file mode 100755
index c5e82d7458..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.ole.win32/.vcm_meta b/examples/org.eclipse.swt.examples.ole.win32/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/about.html b/examples/org.eclipse.swt.examples.ole.win32/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.ole.win32/build.properties b/examples/org.eclipse.swt.examples.ole.win32/build.properties
deleted file mode 100755
index 6e65b9dc0e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-source.olewin32.jar = /org/,import.properties
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html b/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
deleted file mode 100755
index 882d680053..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - OLE Web Browser</title>
-</head>
-<body>
-
-<h2>Example - OLE Web Browser</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to embed Active X / OLE controls into an
-SWT application or an Eclipse view.&nbsp; When the view is activated, it
-will create an instance of a Windows "Shell.Explorer" control and provide
-a GUI interface to it via OLE Automation.&nbsp; To run this example, Internet
-Explorer must be installed.
-</p>
-
-<h3>Running the example</h3>
-<p>To run the OLE Web Browser Example, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named OLE Web Browser.&nbsp; A view containing an editor that
-appears similar to your default web browser will appear.
-</p>
-
-<h3>Details</h3>
-<p>The OLE Web Browser has Back and Forward buttons to take you to recently
-visited pages.&nbsp; The browser also contains a Home button to take you
-to the web browser's home page, a Stop button which stops the current transfer,
-a Search button which will search for text typed in the Address text field,
-and a Refresh button which re-draws the contents of the currently displayed
-page.&nbsp; There is also a Go button which, when clicked, will attempt
-to load the page specified in the Address field.&nbsp; One would expect
-each of these operations on every web browser.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif
deleted file mode 100755
index 5fcf41b783..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif
deleted file mode 100755
index 3b9b6af9b1..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif
deleted file mode 100755
index 77a2306ed2..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif
deleted file mode 100755
index e270e18bde..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif
deleted file mode 100755
index 73ac91bddb..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif
deleted file mode 100755
index 653d347b57..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif
deleted file mode 100755
index 895e22110d..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/import.properties b/examples/org.eclipse.swt.examples.ole.win32/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/import.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-# Persist project settings for later import
-natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature
-builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder
-var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
deleted file mode 100755
index 2d2c94fac2..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.ole.win32.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Ole uses <code>org.eclipse.swt</code> to demonstrate Win32 OLE / ActiveX
- * integration.
- *
- * @see ViewPart
- */
-public class OleBrowserView extends ViewPart {
-
- private Composite displayArea;
-
- private OleFrame webFrame;
- private OleWebBrowser webBrowser;
- private Text webUrl;
- private OleControlSite webControlSite;
- private ProgressBar webProgress;
- private Label webStatus;
- private Button webNavigateButton;
-
- private ToolItem webCommandBackward;
- private ToolItem webCommandForward;
- private ToolItem webCommandHome;
- private ToolItem webCommandStop;
- private ToolItem webCommandRefresh;
- private ToolItem webCommandSearch;
-
- private boolean activated = false;
-
- /**
- * Constructs the OLE browser view.
- */
- public OleBrowserView() {
- OlePlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- displayArea = new Composite(parent, SWT.NONE);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- displayArea.setLayout(gridLayout);
-
- createToolbar();
- createBrowserFrame();
- createStatusArea();
- createBrowserControl();
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (activated) {
- webControlSite.deactivateInPlaceClient();
- activated = false;
- }
- if (webBrowser != null) webBrowser.dispose();
- webBrowser = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- webUrl.setFocus();
- }
-
- /**
- * Creates the Web browser toolbar.
- */
- private void createToolbar() {
- // Add a toolbar
- ToolBar bar = new ToolBar(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
-
- // Add a button to navigate backwards through previously visited web sites
- webCommandBackward = new ToolItem(bar, SWT.NONE);
- webCommandBackward.setToolTipText(OlePlugin.getResourceString("browser.Back.tooltip"));
- webCommandBackward.setText(OlePlugin.getResourceString("browser.Back.text"));
- webCommandBackward.setImage(OlePlugin.images[OlePlugin.biBack]);
- webCommandBackward.setEnabled(false);
- webCommandBackward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoBack();
- }
- });
-
- // Add a button to navigate forward through previously visited web sites
- webCommandForward = new ToolItem(bar, SWT.NONE);
- webCommandForward.setToolTipText(OlePlugin.getResourceString("browser.Forward.tooltip"));
- webCommandForward.setText(OlePlugin.getResourceString("browser.Forward.text"));
- webCommandForward.setImage(OlePlugin.images[OlePlugin.biForward]);
- webCommandForward.setEnabled(false);
- webCommandForward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoForward();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to navigate to the Home page
- webCommandHome = new ToolItem(bar, SWT.NONE);
- webCommandHome.setToolTipText(OlePlugin.getResourceString("browser.Home.tooltip"));
- webCommandHome.setText(OlePlugin.getResourceString("browser.Home.text"));
- webCommandHome.setImage(OlePlugin.images[OlePlugin.biHome]);
- webCommandHome.setEnabled(false);
- webCommandHome.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoHome();
- }
- });
-
- // Add a button to abort web page loading
- webCommandStop = new ToolItem(bar, SWT.NONE);
- webCommandStop.setToolTipText(OlePlugin.getResourceString("browser.Stop.tooltip"));
- webCommandStop.setText(OlePlugin.getResourceString("browser.Stop.text"));
- webCommandStop.setImage(OlePlugin.images[OlePlugin.biStop]);
- webCommandStop.setEnabled(false);
- webCommandStop.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Stop();
- }
- });
-
- // Add a button to refresh the current web page
- webCommandRefresh = new ToolItem(bar, SWT.NONE);
- webCommandRefresh.setToolTipText(OlePlugin.getResourceString("browser.Refresh.tooltip"));
- webCommandRefresh.setText(OlePlugin.getResourceString("browser.Refresh.text"));
- webCommandRefresh.setImage(OlePlugin.images[OlePlugin.biRefresh]);
- webCommandRefresh.setEnabled(false);
- webCommandRefresh.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Refresh();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to search the web
- webCommandSearch = new ToolItem(bar, SWT.NONE);
- webCommandSearch.setToolTipText(OlePlugin.getResourceString("browser.Search.tooltip"));
- webCommandSearch.setText(OlePlugin.getResourceString("browser.Search.text"));
- webCommandSearch.setImage(OlePlugin.images[OlePlugin.biSearch]);
- webCommandSearch.setEnabled(false);
- webCommandSearch.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoSearch();
- }
- });
-
- // Add a text area for Users to enter a url
- Composite addressBar = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 3;
- addressBar.setLayoutData(gridData);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- addressBar.setLayout(gridLayout);
-
- Label addressLabel = new Label(addressBar, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- addressLabel.setLayoutData(gridData);
- addressLabel.setText(OlePlugin.getResourceString("browser.Address.label"));
- addressLabel.setFont(OlePlugin.browserFont);
-
- webUrl = new Text(addressBar, SWT.SINGLE | SWT.BORDER);
- webUrl.setFont(OlePlugin.browserFont);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- webUrl.setLayoutData(gridData);
- webUrl.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- webNavigateButton.getShell().setDefaultButton(webNavigateButton);
- }
- });
-
- // Add a button to navigate to the web site specified in the Text area defined above
- webNavigateButton = new Button(addressBar, SWT.PUSH);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- webNavigateButton.setLayoutData(gridData);
- webNavigateButton.setText(OlePlugin.getResourceString("browser.Go.text"));
- webNavigateButton.setFont(OlePlugin.browserFont);
- webNavigateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- webBrowser.Navigate(webUrl.getText());
- }
- });
- }
-
- /**
- * Creates the Web browser OleFrame.
- */
- private void createBrowserFrame() {
- // Every control must have an associated OleFrame:
- webFrame = new OleFrame(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- webFrame.setLayoutData(gridData);
- }
-
- /**
- * Creates the Web browser status area.
- */
- private void createStatusArea() {
- // Add a progress bar to display downloading progress information
- webProgress = new ProgressBar(displayArea, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.verticalAlignment = GridData.FILL;
- webProgress.setLayoutData(gridData);
-
- // Add a label for displaying status messages as they are received from the control
- webStatus = new Label(displayArea, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- webStatus.setLayoutData(gridData);
- webStatus.setFont(OlePlugin.browserFont);
- }
-
- /**
- * Creates Web browser control.
- */
- private void createBrowserControl() {
- try {
- // Create an Automation object for access to extended capabilities
- webControlSite = new OleControlSite(webFrame, SWT.NONE, "Shell.Explorer");
- OleAutomation oleAutomation = new OleAutomation(webControlSite);
- webBrowser = new OleWebBrowser(oleAutomation);
- } catch (SWTException ex) {
- // Creation may have failed because control is not installed on machine
- Label label = new Label(webFrame, SWT.BORDER);
- OlePlugin.logError(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"), ex);
- label.setText(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"));
- return;
- }
-
- // Respond to ProgressChange events by updating the Progress bar
- webControlSite.addEventListener(OleWebBrowser.ProgressChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant progress = event.arguments[0];
- Variant maxProgress = event.arguments[1];
- if (progress == null || maxProgress == null)
- return;
- webProgress.setMaximum(maxProgress.getInt());
- webProgress.setSelection(progress.getInt());
- }
- });
-
- // Respond to StatusTextChange events by updating the Status Text label
- webControlSite.addEventListener(OleWebBrowser.StatusTextChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant statusText = event.arguments[0];
- if (statusText == null) return;
- String text = statusText.getString();
- if (text != null)
- webStatus.setText(text);
- }
- });
-
- // Listen for changes to the ready state and print out the current state
- webControlSite.addPropertyListener(OleWebBrowser.DISPID_READYSTATE, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.detail == OLE.PROPERTY_CHANGING) return;
- int state = webBrowser.getReadyState();
- switch (state) {
- case OleWebBrowser.READYSTATE_UNINITIALIZED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Uninitialized.text"));
- webCommandBackward.setEnabled(false);
- webCommandForward.setEnabled(false);
- webCommandHome.setEnabled(false);
- webCommandRefresh.setEnabled(false);
- webCommandStop.setEnabled(false);
- webCommandSearch.setEnabled(false);
- break;
- case OleWebBrowser.READYSTATE_LOADING:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loading.text"));
- webCommandHome.setEnabled(true);
- webCommandRefresh.setEnabled(true);
- webCommandStop.setEnabled(true);
- webCommandSearch.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_LOADED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loaded.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_INTERACTIVE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Interactive.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_COMPLETE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Complete.text"));
- webCommandStop.setEnabled(false);
- break;
- }
- }
- });
-
- // Listen for changes to the active command states
- webControlSite.addEventListener(OleWebBrowser.CommandStateChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.type != OleWebBrowser.CommandStateChange) return;
- final int commandID =
- (event.arguments[0] != null) ? event.arguments[0].getInt() : 0;
- final boolean commandEnabled =
- (event.arguments[1] != null) ? event.arguments[1].getBoolean() : false;
-
- switch (commandID) {
- case OleWebBrowser.CSC_NAVIGATEBACK:
- webCommandBackward.setEnabled(commandEnabled);
- break;
- case OleWebBrowser.CSC_NAVIGATEFORWARD:
- webCommandForward.setEnabled(commandEnabled);
- break;
- }
- }
- });
-
- // in place activate the ActiveX control
- activated = (webControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE) == OLE.S_OK);
- if (activated) webBrowser.GoHome();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java
deleted file mode 100755
index 4fee12a0b9..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.net.*; import java.text.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class OlePlugin extends AbstractUIPlugin {
- //The shared instance.
- private static OlePlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- biBack = 0,
- biForward = 1,
- biHome = 2,
- biStop = 3,
- biRefresh = 4,
- biSearch = 5;
- static final String[] imageLocations = {
- "icons/backward_nav.gif",
- "icons/forward_nav.gif",
- "icons/home_nav.gif",
- "icons/stop_nav.gif",
- "icons/refresh_nav.gif",
- "icons/search_nav.gif" };
- static Image images[];
- static Font browserFont;
-
- /**
- * Constructs an OLE plugin.
- */
- public OlePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static OlePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Loads the resources.
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- if (browserFont == null) {
- try {
- browserFont = new Font (null, "MS Sans Serif", 8, SWT.NULL);
- } catch (Throwable ex) {
- }
- }
- if (images == null || browserFont == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- if (browserFont != null) browserFont.dispose ();
- browserFont = null;
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
deleted file mode 100755
index 555cfb935e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.ole.win32.*;
-
-/**
- * Wrapper for an OleAutomation object used to send commands
- * to a Win32 "Shell.Explorer" OLE control.
- *
- * Instances of this class manage the setup, typical use and teardown of
- * a simple web browser.
- */
-class OleWebBrowser {
- /* See the Windows Platform SDK documentation for more information about the
- * OLE control used here and its usage.
- */
- // Generated from typelib filename: shdocvw.dll
-
- // Constants for WebBrowser CommandStateChange
- public static final int CSC_UPDATECOMMANDS = -1;
- public static final int CSC_NAVIGATEFORWARD = 1;
- public static final int CSC_NAVIGATEBACK = 2;
-
- // COnstants for Web Browser ReadyState
- public static final int READYSTATE_UNINITIALIZED = 0;
- public static final int READYSTATE_LOADING = 1;
- public static final int READYSTATE_LOADED = 2;
- public static final int READYSTATE_INTERACTIVE = 3;
- public static final int READYSTATE_COMPLETE = 4;
-
- // Web Browser Control Events
- public static final int BeforeNavigate = 100; // Fired when a new hyperlink is being navigated to.
- public static final int NavigateComplete = 101; // Fired when the document being navigated to becomes visible and enters the navigation stack.
- public static final int StatusTextChange = 102; // Statusbar text changed.
- public static final int ProgressChange = 108; // Fired when download progress is updated.
- public static final int DownloadComplete = 104; // Download of page complete.
- public static final int CommandStateChange = 105; // The enabled state of a command changed
- public static final int DownloadBegin = 106; // Download of a page started.
- public static final int NewWindow = 107; // Fired when a new window should be created.
- public static final int TitleChange = 113; // Document title changed.
- public static final int FrameBeforeNavigate = 200; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNavigateComplete = 201; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNewWindow = 204; // Fired when a new window should be created.
- public static final int Quit = 103; // Fired when application is quiting.
- public static final int WindowMove = 109; // Fired when window has been moved.
- public static final int WindowResize = 110; // Fired when window has been sized.
- public static final int WindowActivate = 111; // Fired when window has been activated.
- public static final int PropertyChange = 112; // Fired when the PutProperty method has been called.
-
- // Web Browser properties
- public static final int DISPID_READYSTATE = -525;
-
- private OleAutomation oleAutomation;
-
- /**
- * Creates a Web browser control.
- * <p>
- * Typical use:<br>
- * <code>
- * OleControlSite oleControlSite = new OleControlSite(oleFrame, style, "Shell.Explorer");<br>
- * OleAutomation oleAutomation = new OleAutomation(oleControlSite);<br>
- * OleWebBrowser webBrowser = new OleWebBrowser(oleControlSite, oleAutomation);<br>
- * </code>
- *
- * @param oleAutomation the OleAutomation object for this control.
- * @param oleControlSite the OleControlSite object for this control.
- */
- public OleWebBrowser(OleAutomation oleAutomation) {
- this.oleAutomation = oleAutomation;
- }
-
-
- /**
- * Disposes of the Web browser control.
- */
- public void dispose() {
- if (oleAutomation != null) oleAutomation.dispose();
- oleAutomation = null;
- }
-
- /*
- * Interact with the Control via OLE Automation
- *
- * Note: You can hard code the DISPIDs if you know them beforehand
- * this is of course the fastest way, but you increase coupling
- * to the control.
- */
-
- /**
- * Returns the current web page title.
- *
- * @return the current web page title String
- */
- public String getLocationName() {
- // dispid=210, type=PROPGET, name="LocationName"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationName"});
- int dispIdMember = rgdispid[0];
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current URL.
- *
- * @return the current URL String
- */
- public String getLocationURL() {
- // dispid=211, type=PROPGET, name="LocationURL"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationURL"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current state of the control.
- *
- * @return the current state of the control, one of:
- * READYSTATE_UNINITIALIZED;
- * READYSTATE_LOADING;
- * READYSTATE_LOADED;
- * READYSTATE_INTERACTIVE;
- * READYSTATE_COMPLETE.
- */
- public int getReadyState() {
- // dispid=4294966771, type=PROPGET, name="ReadyState"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"ReadyState"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return -1;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoBack" method invocation
- */
- public int GoBack() {
-
- // dispid=100, type=METHOD, name="GoBack"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoBack"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoForward" method invocation
- */
- public int GoForward() {
-
- // dispid=101, type=METHOD, name="GoForward"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoForward"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to home page.
- *
- * @return the platform-defined result code for the "GoHome" method invocation
- */
- public int GoHome() {
- // dispid=102, type=METHOD, name="GoHome"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoHome"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to user-specified Web search gateway.
- *
- * @return the platform-defined result code for the "GoSearch" method invocation
- */
- public int GoSearch() {
- // dispid=103, type=METHOD, name="GoSearch"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoSearch"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to a particular URL.
- *
- * @return the platform-defined result code for the "Navigate" method invocation
- */
- public int Navigate(String url) {
- // dispid=104, type=METHOD, name="Navigate"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Navigate", "URL"});
- int dispIdMember = rgdispid[0];
-
- Variant[] rgvarg = new Variant[1];
- rgvarg[0] = new Variant(url);
- int[] rgdispidNamedArgs = new int[1];
- rgdispidNamedArgs[0] = rgdispid[1]; // identifier of argument
- Variant pVarResult = oleAutomation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
-
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Refreshes the currently viewed page.
- *
- * @return the platform-defined result code for the "Refresh" method invocation
- */
- public void Refresh(){
- // dispid= 4294966746, type=METHOD, name="Refresh"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Refresh"});
- int dispIdMember = rgdispid[0];
-
- oleAutomation.invokeNoReply(dispIdMember);
- }
-
- /**
- * Aborts loading of the currnet page.
- *
- * @return the platform-defined result code for the "Stop" method invocation
- */
- public void Stop() {
- // dispid=106, type=METHOD, name="Stop"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Stop"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties b/examples/org.eclipse.swt.examples.ole.win32/plugin.properties
deleted file mode 100755
index b28c799ff5..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-plugin.SWTOLEExample.name = SWT OLE Example Plugin (Win32)
-category.SWTExamples.name = SWT Examples
-view.OLEWebBrowserExample.name = OLE Web Browser (Win32)
-
-launchcategory.SWTWin32OnlyExamples.name = Win32 only
-launchcategory.SWTWin32OnlyExamples.description = \
- A collection of Standard Widget Toolkit examples for Windows systems only.
-
-launchitem.OLEWebBrowserExample.name = OLE Web Browser
-launchitem.OLEWebBrowserExample.description = \
- This example demonstrates how to embed Active X / OLE controls into an SWT \
- application or an Eclipse view.\n\n\
- When the view is activated, it will create an instance of a Windows "Shell.Explorer" \
- control and provide a GUI interface to it via OLE Automation. The OLE Web Browser has \
- Back and Forward buttons to take you to recently visited pages. The browser also contains \
- a Home button to take you to the web browser's home page, a Stop button which stops the \
- current transfer, a Search button which will search for text typed in the Address text field, and \
- a Refresh button which re-draws the contents of the currently displayed page. There is also a \
- Go button which, when clicked, will attempt to load the page specified in the Address field. \
- One would expect each of these operations on every web browser.\n\n\
- To run this example, Internet Explorer must be installed.
-
-browser.Back.text = Backward
-browser.Back.tooltip = Surf to previously viewed Web site
-
-browser.Forward.text = Forward
-browser.Forward.tooltip = Surf to next viewed Web site
-
-browser.Home.text = Home
-browser.Home.tooltip = Surf to home Web site
-
-browser.Stop.text = Stop
-browser.Stop.tooltip = Stop loading current Web site
-
-browser.Refresh.text = Refresh
-browser.Refresh.tooltip = Refresh current Web site
-
-browser.Search.text = Search
-browser.Search.tooltip = Search the Web
-
-browser.Address.label = Address :
-
-browser.Go.text = Go
-
-browser.State.Uninitialized.text = Not ready.
-browser.State.Loading.text = Loading Web site...
-browser.State.Loaded.text = Ready.
-browser.State.Interactive.text = Loading Web site...
-browser.State.Complete.text = Done.
-
-error.CouldNotLoadResources = Unable to load resources
-error.CouldNotCreateBrowserControl = Unable to create <<Browser Control>>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml b/examples/org.eclipse.swt.examples.ole.win32/plugin.xml
deleted file mode 100755
index b91876cadd..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.ole.win32"
- name="%plugin.SWTOLEExample.name"
- version="2.0"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.ole.win32.OlePlugin">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<!-- Runtime -->
-<runtime>
- <library name="olewin32.jar"/>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.OLEWebBrowserExample.name"
- icon="icons/webbrowser_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.ole.win32.OleBrowserView"
- id="org.eclipse.swt.examples.ole.win32.browserView">
- </view>
-</extension>
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTWin32OnlyExamples.name"
- description="%launchcategory.SWTWin32OnlyExamples.description"
- id="org.eclipse.swt.examples.launchWin32OnlyCategory">
- </category>
- <item
- name="%launchitem.OLEWebBrowserExample.name"
- icon="icons/webbrowser_example.gif"
- description="%launchitem.OLEWebBrowserExample.description"
- category="org.eclipse.swt.examples.launchWin32OnlyCategory"
- id="org.eclipse.swt.examples.ole.win32.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.ole.win32.browserView">
- </view>
- <source
- zip="olewin32src.zip">
- </source>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
deleted file mode 100755
index 2d2c94fac2..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.ole.win32.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Ole uses <code>org.eclipse.swt</code> to demonstrate Win32 OLE / ActiveX
- * integration.
- *
- * @see ViewPart
- */
-public class OleBrowserView extends ViewPart {
-
- private Composite displayArea;
-
- private OleFrame webFrame;
- private OleWebBrowser webBrowser;
- private Text webUrl;
- private OleControlSite webControlSite;
- private ProgressBar webProgress;
- private Label webStatus;
- private Button webNavigateButton;
-
- private ToolItem webCommandBackward;
- private ToolItem webCommandForward;
- private ToolItem webCommandHome;
- private ToolItem webCommandStop;
- private ToolItem webCommandRefresh;
- private ToolItem webCommandSearch;
-
- private boolean activated = false;
-
- /**
- * Constructs the OLE browser view.
- */
- public OleBrowserView() {
- OlePlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- displayArea = new Composite(parent, SWT.NONE);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- displayArea.setLayout(gridLayout);
-
- createToolbar();
- createBrowserFrame();
- createStatusArea();
- createBrowserControl();
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (activated) {
- webControlSite.deactivateInPlaceClient();
- activated = false;
- }
- if (webBrowser != null) webBrowser.dispose();
- webBrowser = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- webUrl.setFocus();
- }
-
- /**
- * Creates the Web browser toolbar.
- */
- private void createToolbar() {
- // Add a toolbar
- ToolBar bar = new ToolBar(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
-
- // Add a button to navigate backwards through previously visited web sites
- webCommandBackward = new ToolItem(bar, SWT.NONE);
- webCommandBackward.setToolTipText(OlePlugin.getResourceString("browser.Back.tooltip"));
- webCommandBackward.setText(OlePlugin.getResourceString("browser.Back.text"));
- webCommandBackward.setImage(OlePlugin.images[OlePlugin.biBack]);
- webCommandBackward.setEnabled(false);
- webCommandBackward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoBack();
- }
- });
-
- // Add a button to navigate forward through previously visited web sites
- webCommandForward = new ToolItem(bar, SWT.NONE);
- webCommandForward.setToolTipText(OlePlugin.getResourceString("browser.Forward.tooltip"));
- webCommandForward.setText(OlePlugin.getResourceString("browser.Forward.text"));
- webCommandForward.setImage(OlePlugin.images[OlePlugin.biForward]);
- webCommandForward.setEnabled(false);
- webCommandForward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoForward();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to navigate to the Home page
- webCommandHome = new ToolItem(bar, SWT.NONE);
- webCommandHome.setToolTipText(OlePlugin.getResourceString("browser.Home.tooltip"));
- webCommandHome.setText(OlePlugin.getResourceString("browser.Home.text"));
- webCommandHome.setImage(OlePlugin.images[OlePlugin.biHome]);
- webCommandHome.setEnabled(false);
- webCommandHome.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoHome();
- }
- });
-
- // Add a button to abort web page loading
- webCommandStop = new ToolItem(bar, SWT.NONE);
- webCommandStop.setToolTipText(OlePlugin.getResourceString("browser.Stop.tooltip"));
- webCommandStop.setText(OlePlugin.getResourceString("browser.Stop.text"));
- webCommandStop.setImage(OlePlugin.images[OlePlugin.biStop]);
- webCommandStop.setEnabled(false);
- webCommandStop.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Stop();
- }
- });
-
- // Add a button to refresh the current web page
- webCommandRefresh = new ToolItem(bar, SWT.NONE);
- webCommandRefresh.setToolTipText(OlePlugin.getResourceString("browser.Refresh.tooltip"));
- webCommandRefresh.setText(OlePlugin.getResourceString("browser.Refresh.text"));
- webCommandRefresh.setImage(OlePlugin.images[OlePlugin.biRefresh]);
- webCommandRefresh.setEnabled(false);
- webCommandRefresh.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Refresh();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to search the web
- webCommandSearch = new ToolItem(bar, SWT.NONE);
- webCommandSearch.setToolTipText(OlePlugin.getResourceString("browser.Search.tooltip"));
- webCommandSearch.setText(OlePlugin.getResourceString("browser.Search.text"));
- webCommandSearch.setImage(OlePlugin.images[OlePlugin.biSearch]);
- webCommandSearch.setEnabled(false);
- webCommandSearch.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoSearch();
- }
- });
-
- // Add a text area for Users to enter a url
- Composite addressBar = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 3;
- addressBar.setLayoutData(gridData);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- addressBar.setLayout(gridLayout);
-
- Label addressLabel = new Label(addressBar, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- addressLabel.setLayoutData(gridData);
- addressLabel.setText(OlePlugin.getResourceString("browser.Address.label"));
- addressLabel.setFont(OlePlugin.browserFont);
-
- webUrl = new Text(addressBar, SWT.SINGLE | SWT.BORDER);
- webUrl.setFont(OlePlugin.browserFont);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- webUrl.setLayoutData(gridData);
- webUrl.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- webNavigateButton.getShell().setDefaultButton(webNavigateButton);
- }
- });
-
- // Add a button to navigate to the web site specified in the Text area defined above
- webNavigateButton = new Button(addressBar, SWT.PUSH);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- webNavigateButton.setLayoutData(gridData);
- webNavigateButton.setText(OlePlugin.getResourceString("browser.Go.text"));
- webNavigateButton.setFont(OlePlugin.browserFont);
- webNavigateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- webBrowser.Navigate(webUrl.getText());
- }
- });
- }
-
- /**
- * Creates the Web browser OleFrame.
- */
- private void createBrowserFrame() {
- // Every control must have an associated OleFrame:
- webFrame = new OleFrame(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- webFrame.setLayoutData(gridData);
- }
-
- /**
- * Creates the Web browser status area.
- */
- private void createStatusArea() {
- // Add a progress bar to display downloading progress information
- webProgress = new ProgressBar(displayArea, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.verticalAlignment = GridData.FILL;
- webProgress.setLayoutData(gridData);
-
- // Add a label for displaying status messages as they are received from the control
- webStatus = new Label(displayArea, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- webStatus.setLayoutData(gridData);
- webStatus.setFont(OlePlugin.browserFont);
- }
-
- /**
- * Creates Web browser control.
- */
- private void createBrowserControl() {
- try {
- // Create an Automation object for access to extended capabilities
- webControlSite = new OleControlSite(webFrame, SWT.NONE, "Shell.Explorer");
- OleAutomation oleAutomation = new OleAutomation(webControlSite);
- webBrowser = new OleWebBrowser(oleAutomation);
- } catch (SWTException ex) {
- // Creation may have failed because control is not installed on machine
- Label label = new Label(webFrame, SWT.BORDER);
- OlePlugin.logError(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"), ex);
- label.setText(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"));
- return;
- }
-
- // Respond to ProgressChange events by updating the Progress bar
- webControlSite.addEventListener(OleWebBrowser.ProgressChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant progress = event.arguments[0];
- Variant maxProgress = event.arguments[1];
- if (progress == null || maxProgress == null)
- return;
- webProgress.setMaximum(maxProgress.getInt());
- webProgress.setSelection(progress.getInt());
- }
- });
-
- // Respond to StatusTextChange events by updating the Status Text label
- webControlSite.addEventListener(OleWebBrowser.StatusTextChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant statusText = event.arguments[0];
- if (statusText == null) return;
- String text = statusText.getString();
- if (text != null)
- webStatus.setText(text);
- }
- });
-
- // Listen for changes to the ready state and print out the current state
- webControlSite.addPropertyListener(OleWebBrowser.DISPID_READYSTATE, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.detail == OLE.PROPERTY_CHANGING) return;
- int state = webBrowser.getReadyState();
- switch (state) {
- case OleWebBrowser.READYSTATE_UNINITIALIZED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Uninitialized.text"));
- webCommandBackward.setEnabled(false);
- webCommandForward.setEnabled(false);
- webCommandHome.setEnabled(false);
- webCommandRefresh.setEnabled(false);
- webCommandStop.setEnabled(false);
- webCommandSearch.setEnabled(false);
- break;
- case OleWebBrowser.READYSTATE_LOADING:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loading.text"));
- webCommandHome.setEnabled(true);
- webCommandRefresh.setEnabled(true);
- webCommandStop.setEnabled(true);
- webCommandSearch.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_LOADED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loaded.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_INTERACTIVE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Interactive.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_COMPLETE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Complete.text"));
- webCommandStop.setEnabled(false);
- break;
- }
- }
- });
-
- // Listen for changes to the active command states
- webControlSite.addEventListener(OleWebBrowser.CommandStateChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.type != OleWebBrowser.CommandStateChange) return;
- final int commandID =
- (event.arguments[0] != null) ? event.arguments[0].getInt() : 0;
- final boolean commandEnabled =
- (event.arguments[1] != null) ? event.arguments[1].getBoolean() : false;
-
- switch (commandID) {
- case OleWebBrowser.CSC_NAVIGATEBACK:
- webCommandBackward.setEnabled(commandEnabled);
- break;
- case OleWebBrowser.CSC_NAVIGATEFORWARD:
- webCommandForward.setEnabled(commandEnabled);
- break;
- }
- }
- });
-
- // in place activate the ActiveX control
- activated = (webControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE) == OLE.S_OK);
- if (activated) webBrowser.GoHome();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
deleted file mode 100755
index 4fee12a0b9..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.net.*; import java.text.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class OlePlugin extends AbstractUIPlugin {
- //The shared instance.
- private static OlePlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- biBack = 0,
- biForward = 1,
- biHome = 2,
- biStop = 3,
- biRefresh = 4,
- biSearch = 5;
- static final String[] imageLocations = {
- "icons/backward_nav.gif",
- "icons/forward_nav.gif",
- "icons/home_nav.gif",
- "icons/stop_nav.gif",
- "icons/refresh_nav.gif",
- "icons/search_nav.gif" };
- static Image images[];
- static Font browserFont;
-
- /**
- * Constructs an OLE plugin.
- */
- public OlePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static OlePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Loads the resources.
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- if (browserFont == null) {
- try {
- browserFont = new Font (null, "MS Sans Serif", 8, SWT.NULL);
- } catch (Throwable ex) {
- }
- }
- if (images == null || browserFont == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- if (browserFont != null) browserFont.dispose ();
- browserFont = null;
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
deleted file mode 100755
index 555cfb935e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.ole.win32.*;
-
-/**
- * Wrapper for an OleAutomation object used to send commands
- * to a Win32 "Shell.Explorer" OLE control.
- *
- * Instances of this class manage the setup, typical use and teardown of
- * a simple web browser.
- */
-class OleWebBrowser {
- /* See the Windows Platform SDK documentation for more information about the
- * OLE control used here and its usage.
- */
- // Generated from typelib filename: shdocvw.dll
-
- // Constants for WebBrowser CommandStateChange
- public static final int CSC_UPDATECOMMANDS = -1;
- public static final int CSC_NAVIGATEFORWARD = 1;
- public static final int CSC_NAVIGATEBACK = 2;
-
- // COnstants for Web Browser ReadyState
- public static final int READYSTATE_UNINITIALIZED = 0;
- public static final int READYSTATE_LOADING = 1;
- public static final int READYSTATE_LOADED = 2;
- public static final int READYSTATE_INTERACTIVE = 3;
- public static final int READYSTATE_COMPLETE = 4;
-
- // Web Browser Control Events
- public static final int BeforeNavigate = 100; // Fired when a new hyperlink is being navigated to.
- public static final int NavigateComplete = 101; // Fired when the document being navigated to becomes visible and enters the navigation stack.
- public static final int StatusTextChange = 102; // Statusbar text changed.
- public static final int ProgressChange = 108; // Fired when download progress is updated.
- public static final int DownloadComplete = 104; // Download of page complete.
- public static final int CommandStateChange = 105; // The enabled state of a command changed
- public static final int DownloadBegin = 106; // Download of a page started.
- public static final int NewWindow = 107; // Fired when a new window should be created.
- public static final int TitleChange = 113; // Document title changed.
- public static final int FrameBeforeNavigate = 200; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNavigateComplete = 201; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNewWindow = 204; // Fired when a new window should be created.
- public static final int Quit = 103; // Fired when application is quiting.
- public static final int WindowMove = 109; // Fired when window has been moved.
- public static final int WindowResize = 110; // Fired when window has been sized.
- public static final int WindowActivate = 111; // Fired when window has been activated.
- public static final int PropertyChange = 112; // Fired when the PutProperty method has been called.
-
- // Web Browser properties
- public static final int DISPID_READYSTATE = -525;
-
- private OleAutomation oleAutomation;
-
- /**
- * Creates a Web browser control.
- * <p>
- * Typical use:<br>
- * <code>
- * OleControlSite oleControlSite = new OleControlSite(oleFrame, style, "Shell.Explorer");<br>
- * OleAutomation oleAutomation = new OleAutomation(oleControlSite);<br>
- * OleWebBrowser webBrowser = new OleWebBrowser(oleControlSite, oleAutomation);<br>
- * </code>
- *
- * @param oleAutomation the OleAutomation object for this control.
- * @param oleControlSite the OleControlSite object for this control.
- */
- public OleWebBrowser(OleAutomation oleAutomation) {
- this.oleAutomation = oleAutomation;
- }
-
-
- /**
- * Disposes of the Web browser control.
- */
- public void dispose() {
- if (oleAutomation != null) oleAutomation.dispose();
- oleAutomation = null;
- }
-
- /*
- * Interact with the Control via OLE Automation
- *
- * Note: You can hard code the DISPIDs if you know them beforehand
- * this is of course the fastest way, but you increase coupling
- * to the control.
- */
-
- /**
- * Returns the current web page title.
- *
- * @return the current web page title String
- */
- public String getLocationName() {
- // dispid=210, type=PROPGET, name="LocationName"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationName"});
- int dispIdMember = rgdispid[0];
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current URL.
- *
- * @return the current URL String
- */
- public String getLocationURL() {
- // dispid=211, type=PROPGET, name="LocationURL"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationURL"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current state of the control.
- *
- * @return the current state of the control, one of:
- * READYSTATE_UNINITIALIZED;
- * READYSTATE_LOADING;
- * READYSTATE_LOADED;
- * READYSTATE_INTERACTIVE;
- * READYSTATE_COMPLETE.
- */
- public int getReadyState() {
- // dispid=4294966771, type=PROPGET, name="ReadyState"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"ReadyState"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return -1;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoBack" method invocation
- */
- public int GoBack() {
-
- // dispid=100, type=METHOD, name="GoBack"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoBack"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoForward" method invocation
- */
- public int GoForward() {
-
- // dispid=101, type=METHOD, name="GoForward"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoForward"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to home page.
- *
- * @return the platform-defined result code for the "GoHome" method invocation
- */
- public int GoHome() {
- // dispid=102, type=METHOD, name="GoHome"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoHome"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to user-specified Web search gateway.
- *
- * @return the platform-defined result code for the "GoSearch" method invocation
- */
- public int GoSearch() {
- // dispid=103, type=METHOD, name="GoSearch"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoSearch"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to a particular URL.
- *
- * @return the platform-defined result code for the "Navigate" method invocation
- */
- public int Navigate(String url) {
- // dispid=104, type=METHOD, name="Navigate"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Navigate", "URL"});
- int dispIdMember = rgdispid[0];
-
- Variant[] rgvarg = new Variant[1];
- rgvarg[0] = new Variant(url);
- int[] rgdispidNamedArgs = new int[1];
- rgdispidNamedArgs[0] = rgdispid[1]; // identifier of argument
- Variant pVarResult = oleAutomation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
-
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Refreshes the currently viewed page.
- *
- * @return the platform-defined result code for the "Refresh" method invocation
- */
- public void Refresh(){
- // dispid= 4294966746, type=METHOD, name="Refresh"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Refresh"});
- int dispIdMember = rgdispid[0];
-
- oleAutomation.invokeNoReply(dispIdMember);
- }
-
- /**
- * Aborts loading of the currnet page.
- *
- * @return the platform-defined result code for the "Stop" method invocation
- */
- public void Stop() {
- // dispid=106, type=METHOD, name="Stop"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Stop"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/.classpath b/examples/org.eclipse.swt.examples.paint/.classpath
deleted file mode 100755
index 573ea74d8c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui/workbenchsrc.zip"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples.paint/.cvsignore b/examples/org.eclipse.swt.examples.paint/.cvsignore
deleted file mode 100755
index c5e82d7458..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.paint/.vcm_meta b/examples/org.eclipse.swt.examples.paint/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples.paint/about.html b/examples/org.eclipse.swt.examples.paint/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/examples/org.eclipse.swt.examples.paint/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.paint/build.properties b/examples/org.eclipse.swt.examples.paint/build.properties
deleted file mode 100755
index 9d0011a9b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-source.paint.jar = /org/,import.properties
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html b/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html
deleted file mode 100755
index 458c380093..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Paint Example</title>
-</head>
-<body>
-
-<h2>Example - Paint Example</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates the use of SWT graphics operations in the form
-of a rudimentary bitmap painting program.&nbsp; The Airbrush Tool implementation also
-demonstrates a mechanism for managing timed GUI operations in the background
-that are triggered by user input (see ContinuousPaintSession.java).
-</p>
-
-<h3>Running the example</h3>
-<p>To run the Paint Example, pull down the Perspective menu, select the Show
-View menu item, then select Other from the submenu.&nbsp; A dialog will
-come up with a list of views.&nbsp; Expand SWT Examples and select the
-view named Paint.&nbsp; A view containing a drawing area, various toolbar
-buttons, and a color selection palette will appear.
-</p>
-
-<h3>Details</h3>
-<p>Select a tool with which to draw in the drawing area.&nbsp; There are a
-number of tools to choose from on the toolbar.&nbsp; To change the color selection,
-click on a color in the palette below the drawing area:
-left-click for the foreground color, right-click for the background color.
-</p>
-<p>Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif
deleted file mode 100755
index d26dd584e7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif
deleted file mode 100755
index c6ccfee10e..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif
deleted file mode 100755
index cb34e64a30..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif
deleted file mode 100644
index fb57bb38b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif
deleted file mode 100644
index 322968c30b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif
deleted file mode 100644
index 4937ccb06d..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif
deleted file mode 100644
index 70a57ce2c4..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif b/examples/org.eclipse.swt.examples.paint/icons/options_font.gif
deleted file mode 100755
index 965fe08560..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif b/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif
deleted file mode 100755
index c48d9a9567..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif
deleted file mode 100755
index a310edddb2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif
deleted file mode 100755
index dc2142f8e2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif
deleted file mode 100755
index 2ff819f129..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif
deleted file mode 100755
index f16a234c13..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif
deleted file mode 100755
index aa384e9b30..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif
deleted file mode 100755
index d26dd584e7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif
deleted file mode 100755
index bf845d7602..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif
deleted file mode 100755
index 0d7457ffa3..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/import.properties b/examples/org.eclipse.swt.examples.paint/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/import.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-# Persist project settings for later import
-natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature
-builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder
-var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>>
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java
deleted file mode 100755
index 8eeabb9920..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * An airbrush tool.
- */
-public class AirbrushTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
- private Random random;
- private int cachedRadiusSquared;
- private int cachedNumPoints;
-
- /**
- * Constructs a Tool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public AirbrushTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- random = new Random();
- setRetriggerTimer(10);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- // compute things we need to know for drawing
- settings = toolSettings;
- cachedRadiusSquared = settings.airbrushRadius * settings.airbrushRadius;
- cachedNumPoints = 314 * settings.airbrushIntensity * cachedRadiusSquared / 250000;
- if (cachedNumPoints == 0 && settings.airbrushIntensity != 0)
- cachedNumPoints = 1;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Airbrush.label");
- }
-
- /*
- * Template method for drawing
- */
- protected void render(Point point) {
- // Draws a bunch (cachedNumPoints) of random pixels within a specified circle (cachedRadiusSquared).
- ContainerFigure cfig = new ContainerFigure();
-
- for (int i = 0; i < cachedNumPoints; ++i) {
- int randX, randY;
- do {
- randX = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- randY = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- } while (randX * randX + randY * randY > cachedRadiusSquared);
- cfig.add(new PointFigure(settings.commonForegroundColor, point.x + randX, point.y + randY));
- }
- getPaintSurface().drawFigure(cfig);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java
deleted file mode 100755
index 0af229175a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public abstract class BasicPaintSession implements PaintSession {
- /** * The paint surface */ private PaintSurface paintSurface; /** * Constructs a PaintSession. * * @param paintSurface the drawing surface to use */ protected BasicPaintSession(PaintSurface paintSurface) { this.paintSurface = paintSurface; } /**
- * Returns the paint surface associated with this paint session. * * @return the associated PaintSurface */ public PaintSurface getPaintSurface() { return paintSurface; } }
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java
deleted file mode 100755
index 0c2d64996a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Container for Figure objects with stacking preview mechanism.
- */
-public class ContainerFigure extends Figure {
- private static final int INITIAL_ARRAY_SIZE = 16;
-
- Figure[] objectStack = null;
- int nextIndex = 0;
-
- /**
- * Constructs an empty Container
- */
- public ContainerFigure() {
- }
- /**
- * Adds an object to the container for later drawing.
- *
- * @param object the object to add to the drawing list
- */
- public void add(Figure object) {
- if (objectStack == null) {
- objectStack = new Figure[INITIAL_ARRAY_SIZE];
- } else if (objectStack.length <= nextIndex) {
- Figure[] newObjectStack = new Figure[objectStack.length * 2];
- System.arraycopy(objectStack, 0, newObjectStack, 0, objectStack.length);
- objectStack = newObjectStack;
- }
- objectStack[nextIndex] = object;
- ++nextIndex;
- }
- /**
- * Determines if the container is empty.
- * @return true if the container is empty
- */
- public boolean isEmpty() {
- return nextIndex == 0;
- }
- /**
- * Adds an object to the container and draws its preview then updates the supplied preview state.
- *
- * @param object the object to add to the drawing list
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- * @param rememberedState the state returned by a previous drawPreview() or addAndPreview()
- * using this Container, may be null if there was no such previous call
- * @return object state that must be passed to erasePreview() later to erase this object
- */
-// public Object addAndPreview(Figure object, GC gc, Point offset, Object rememberedState) {
-// Object[] stateStack = (Object[]) rememberedState;
-// if (stateStack == null) {
-// stateStack = new Object[INITIAL_ARRAY_SIZE];
-// } else if (stateStack.length <= nextIndex) {
-// Object[] newStateStack = new Object[stateStack.length * 2];
-// System.arraycopy(stateStack, 0, newStateStack, 0, stateStack.length);
-// stateStack = newStateStack;
-// }
-// add(object);
-// stateStack[nextIndex - 1] = object.drawPreview(gc, offset);
-// return stateStack;
-// }
- /**
- * Clears the container.
- * <p>
- * Note that erasePreview() cannot be called after this point to erase any previous
- * drawPreview()'s.
- * </p>
- */
- public void clear() {
- while (--nextIndex > 0) objectStack[nextIndex] = null;
- nextIndex = 0;
- }
- public void draw(FigureDrawContext fdc) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(fdc);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].addDamagedRegion(fdc, region);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
deleted file mode 100755
index 22aa5eb1d9..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
-
-/**
- * The superclass for paint tools that draw continuously along the path
- * traced by the mouse's movement while the button is depressed
- */
-public abstract class ContinuousPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress.
- */
- private boolean dragInProgress = false;
-
- /**
- * A cached Point array for drawing.
- */
- private Point[] points = new Point[] { new Point(-1, -1), new Point(-1, -1) };
-
- /**
- * The time to wait between retriggers in milliseconds.
- */
- private int retriggerInterval = 0;
-
- /**
- * The currently valid RetriggerHandler
- */
- protected Runnable retriggerHandler = null;
-
- /**
- * Constructs a ContinuousPaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected ContinuousPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Sets the retrigger timer.
- * <p>
- * After the timer elapses, if the mouse is still hovering over the same point with the
- * drag button pressed, a new render order is issued and the timer is restarted.
- * </p>
- * @param interval the time in milliseconds to wait between retriggers, 0 to disable
- */
- public void setRetriggerTimer(int interval) {
- retriggerInterval = interval;
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.ContinuousPaint.message"));
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- abortRetrigger();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- abortRetrigger();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- points[0].x = event.x;
- points[0].y = event.y;
- render(points[0]);
- prepareRetrigger();
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseUp(MouseEvent event) {
- if (event.button != 1) return;
- if (! dragInProgress) return; // spurious event
- abortRetrigger();
- mouseSegmentFinished(event);
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- if (! dragInProgress) return;
- mouseSegmentFinished(event);
- prepareRetrigger();
- }
-
- /**
- * Handle a rendering segment
- *
- * @param event the mouse event detail information
- */
- private final void mouseSegmentFinished(MouseEvent event) {
- if (points[0].x == -1) return; // spurious event
- if (points[0].x != event.x || points[0].y != event.y) {
- // draw new segment
- points[1].x = event.x;
- points[1].y = event.y;
- renderContinuousSegment();
- }
- }
-
- /**
- * Draws a continuous segment from points[0] to points[1].
- * Assumes points[0] has been drawn already.
- *
- * @post points[0] will refer to the same point as points[1]
- */
- protected void renderContinuousSegment() {
- /* A lazy but effective line drawing algorithm */
- final int dX = points[1].x - points[0].x;
- final int dY = points[1].y - points[0].y;
- int absdX = Math.abs(dX);
- int absdY = Math.abs(dY);
-
- if ((dX == 0) && (dY == 0)) return;
-
- if (absdY > absdX) {
- final int incfpX = (dX << 16) / absdY;
- final int incY = (dY > 0) ? 1 : -1;
- int fpX = points[0].x << 16; // X in fixedpoint format
-
- while (--absdY >= 0) {
- points[0].y += incY;
- points[0].x = (fpX += incfpX) >> 16;
- render(points[0]);
- }
- if (points[0].x == points[1].x) return;
- points[0].x = points[1].x;
- } else {
- final int incfpY = (dY << 16) / absdX;
- final int incX = (dX > 0) ? 1 : -1;
- int fpY = points[0].y << 16; // Y in fixedpoint format
-
- while (--absdX >= 0) {
- points[0].x += incX;
- points[0].y = (fpY += incfpY) >> 16;
- render(points[0]);
- }
- if (points[0].y == points[1].y) return;
- points[0].y = points[1].y;
- }
- render(points[0]);
- }
-
- /**
- * Prepare the retrigger timer
- */
- private final void prepareRetrigger() {
- if (retriggerInterval > 0) {
- /*
- * timerExec() provides a lightweight mechanism for running code at intervals from within
- * the event loop when timing accuracy is not important.
- *
- * Since it is not possible to cancel a timerExec(), we remember the Runnable that is
- * active in order to distinguish the valid one from the stale ones. In practice,
- * if the interval is 1/100th of a second, then creating a few hundred new RetriggerHandlers
- * each second will not cause a significant performance hit.
- */
- Display display = getPaintSurface().getDisplay();
- retriggerHandler = new Runnable() {
- public void run() {
- if (retriggerHandler == this) {
- render(points[0]);
- prepareRetrigger();
- }
- }
- };
- display.timerExec(retriggerInterval, retriggerHandler);
- }
- }
-
- /**
- * Aborts the retrigger timer
- */
- private final void abortRetrigger() {
- retriggerHandler = null;
- }
-
- /**
- * Template method: Renders a point.
- * @param point, the point to render
- */
- protected abstract void render(Point point);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java
deleted file mode 100755
index 78b9fe6bd7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.graphics.*;
-
-/**
- * The superclass for paint tools that use click-drag-release motions to
- * draw objects.
- */
-public abstract class DragPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress
- */
- private boolean dragInProgress = false;
-
- /**
- * The position of the first click in a click-drag
- */
- private Point anchorPosition = new Point(-1, -1);
-
- /**
- * A temporary point
- */
- private Point tempPosition = new Point(-1, -1);
-
- /**
- * Constructs a PaintSession.
- *
- * @param getPaintSurface() the drawing surface to use
- */
- protected DragPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.DragInteractivePaint.message"));
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- anchorPosition.x = event.x;
- anchorPosition.y = event.y;
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- if (! dragInProgress) return; // spurious event
- dragInProgress = false;
- if (anchorPosition.x == -1) return; // spurious event
-
- getPaintSurface().commitRubberbandSelection();
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (! dragInProgress) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return;
- }
- ps.setStatusCoordRange(anchorPosition, ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- tempPosition.x = event.x;
- tempPosition.y = event.y;
- ps.addRubberbandSelection(createFigure(anchorPosition, tempPosition));
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param anchor the anchor point
- * @param cursor the point marking the current pointer location
- */
- protected abstract Figure createFigure(Point anchor, Point cursor);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
deleted file mode 100755
index 0fcd6ae284..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Ellipse object
- */
-public class EllipseFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs an Ellipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
deleted file mode 100755
index ced0b873b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class EllipseTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a EllipseTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public EllipseTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Ellipse.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java
deleted file mode 100755
index 9a57aa5aa8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Superinterface for all drawing objects.
- * All drawing objects know how to render themselved to the screen and can draw a
- * temporary version of themselves for previewing the general appearance of the
- * object onscreen before it gets committed.
- */
-public abstract class Figure {
- /**
- * Draws this object.
- *
- * @param fdc a parameter block specifying drawing-related information
- */
- public abstract void draw(FigureDrawContext fdc);
-
- /**
- * Computes the damaged screen region caused by drawing this object (imprecise), then
- * appends it to the supplied region.
- *
- * @param fdc a parameter block specifying drawing-related information
- * @param region a region to which additional damage areas will be added
- */
- public abstract void addDamagedRegion(FigureDrawContext fdc, Region region);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java
deleted file mode 100644
index eda60d25b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-public class FigureDrawContext {
- /*
- * <p>
- * The GC must be set up as follows
- * (it will be returned to this state upon completion of drawing operations)
- * <ul>
- * <li>setXORMode(false)
- * </ul>
- * </p>
- */
- public GC gc = null;
- public int xOffset = 0, yOffset = 0; // substract to get GC coords
- public int xScale = 1, yScale = 1;
-
- public Rectangle toClientRectangle(int x1, int y1, int x2, int y2) {
- return new Rectangle(
- Math.min(x1, x2) * xScale - xOffset,
- Math.min(y1, y2) * yScale - yOffset,
- (Math.abs(x2 - x1) + 1) * xScale,
- (Math.abs(y2 - y1) + 1) * yScale);
- }
- public Point toClientPoint(int x, int y) {
- return new Point(x * xScale - xOffset, y * yScale - yOffset);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
deleted file mode 100755
index de71910f76..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class LineFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Line
- * These objects are defined by their two end-points.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first end-point
- * @param y1 the virtual Y coordinate of the first end-point
- * @param x2 the virtual X coordinate of the second end-point
- * @param y2 the virtual Y coordinate of the second end-point
- */
- public LineFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Point p1 = fdc.toClientPoint(x1, y1);
- Point p2 = fdc.toClientPoint(x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawLine(p1.x, p1.y, p2.x, p2.y);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
deleted file mode 100755
index f969d24911..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A line drawing tool
- */
-public class LineTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a LineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public LineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Line.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- return new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java
deleted file mode 100755
index 6e17722f39..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class PaintPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static PaintPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- /**
- * Constructs the Paint plugin.
- */
- public PaintPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Returns the shared instance.
- */
- public static PaintPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java
deleted file mode 100755
index a688ed8d94..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * Manages an interactive paint session.
- * Note that the coordinates received via the listener interfaces are virtualized to zero-origin
- * relative to the painting surface.
- */
-public interface PaintSession extends MouseListener, MouseMoveListener {
- /**
- * Returns the paint surface associated with this paint session
- *
- * @return the associated PaintSurface
- */
- public PaintSurface getPaintSurface();
-
- /**
- * Activates the session.
- *
- * Note: When overriding this method, call super.beginSession() at method start.
- */
- public abstract void beginSession();
-
- /**
- * Deactivates the session.
- *
- * Note: When overriding this method, call super.endSession() at method exit.
- */
- public abstract void endSession();
-
- /**
- * Resets the session.
- * Aborts any operation in progress.
- *
- * Note: When overriding this method, call super.resetSession() at method exit.
- */
- public abstract void resetSession();
-
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName();
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java
deleted file mode 100755
index cc6e529e38..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
- /** * Manages a simple drawing surface. */
-public class PaintSurface { private Point currentPosition = new Point(0, 0);
- private Canvas paintCanvas; private PaintSession paintSession; private Image image; private Image paintImage; // buffer for refresh blits private int imageWidth, imageHeight; private int visibleWidth, visibleHeight; private FigureDrawContext displayFDC = new FigureDrawContext(); private FigureDrawContext imageFDC = new FigureDrawContext(); private FigureDrawContext paintFDC = new FigureDrawContext(); /* Rubberband */ private ContainerFigure rubberband = new ContainerFigure(); // the active rubberband selection private int rubberbandHiddenNestingCount = 0; // always >= 0, if > 0 rubberband has been hidden /* Status */ private Text statusText; private String statusActionInfo, statusMessageInfo, statusCoordInfo; /** * Constructs a PaintSurface. * <p> * paintCanvas must have SWT.NO_REDRAW_RESIZE and SWT.NO_BACKGROUND styles, * and may have SWT.V_SCROLL and/or SWT.H_SCROLL. * </p> * @param paintCanvas the Canvas object in which to render * @param paintStatus the PaintStatus object to use for providing user feedback * @param fillColor the color to fill the canvas with initially */
- public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) { this.paintCanvas = paintCanvas; this.statusText = statusText; clearStatus(); /* Set up the drawing surface */ Rectangle displayRect = paintCanvas.getDisplay().getClientArea(); imageWidth = displayRect.width; imageHeight = displayRect.height; image = new Image(paintCanvas.getDisplay(), imageWidth, imageHeight); imageFDC.gc = new GC(image); imageFDC.gc.setBackground(fillColor); imageFDC.gc.fillRectangle(0, 0, imageWidth, imageHeight); displayFDC.gc = new GC(paintCanvas); /* Initialize the session */ setPaintSession(null); /* Add our listeners */ paintCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { displayFDC.gc.dispose(); } }); paintCanvas.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDown(event); } public void mouseUp(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseUp(event); } public void mouseDoubleClick(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDoubleClick(event); } }); paintCanvas.addMouseMoveListener(new MouseMoveListener() { public void mouseMove(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseMove(event); } }); paintCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (rubberband.isEmpty()) { // Nothing to merge, so we just refresh event.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); } else { /* * Avoid flicker when merging overlayed objects by constructing the image on * a backbuffer first, then blitting it to the screen. */ // Check that the backbuffer is large enough if (paintImage != null) { Rectangle rect = paintImage.getBounds(); if ((event.width + event.x > rect.width) || (event.height + event.y > rect.height)) { paintFDC.gc.dispose(); paintImage.dispose(); paintImage = null; } } if (paintImage == null) { Display display = getDisplay(); Rectangle rect = display.getClientArea(); paintImage = new Image(display, Math.max(rect.width, event.width + event.x), Math.max(rect.height, event.height + event.y)); paintFDC.gc = new GC(paintImage); } // Setup clipping and the FDC Region clipRegion = new Region(); event.gc.getClipping(clipRegion); paintFDC.gc.setClipping(clipRegion); clipRegion.dispose(); paintFDC.xOffset = displayFDC.xOffset; paintFDC.yOffset = displayFDC.yOffset; paintFDC.xScale = displayFDC.xScale; paintFDC.yScale = displayFDC.yScale; // Merge the overlayed objects into the image, then blit paintFDC.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); rubberband.draw(paintFDC); event.gc.drawImage(paintImage, event.x, event.y, event.width, event.height, event.x, event.y, event.width, event.height); } } }); paintCanvas.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent event) { handleResize(); } }); /* Set up the paint canvas scroll bars */ ScrollBar horizontal = paintCanvas.getHorizontalBar(); horizontal.setVisible(true); horizontal.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollHorizontally((ScrollBar)event.widget); } }); ScrollBar vertical = paintCanvas.getVerticalBar(); vertical.setVisible(true); vertical.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollVertically((ScrollBar)event.widget); } }); handleResize(); } /** * Disposes of the PaintSurface's resources. */ public void dispose() { imageFDC.gc.dispose(); image.dispose(); if (paintImage != null) { paintImage.dispose(); paintFDC.gc.dispose(); } currentPosition = null; paintCanvas = null; paintSession = null; image = null; paintImage = null; displayFDC = null; imageFDC = null; paintFDC = null; rubberband = null; statusText = null; statusActionInfo = null; statusMessageInfo = null; statusCoordInfo = null; } /** * Called when we must grab focus. */ public void setFocus() { paintCanvas.setFocus(); } /** * Returns the Display on which the PaintSurface resides. * @return the Display */ public Display getDisplay() { return paintCanvas.getDisplay(); } /** * Returns the Shell in which the PaintSurface resides. * @return the Shell */ public Shell getShell() { return paintCanvas.getShell(); } /**
- * Sets the current paint session. * <p>
- * If oldPaintSession != paintSession calls oldPaintSession.end() * and paintSession.begin() * </p> *
- * @param paintSession the paint session to activate; null to disable all sessions
- */
- public void setPaintSession(PaintSession paintSession) {
- if (this.paintSession != null) { if (this.paintSession == paintSession) return;
- this.paintSession.endSession(); }
- this.paintSession = paintSession;
- clearStatus(); if (paintSession != null) { setStatusAction(paintSession.getDisplayName()); paintSession.beginSession(); } else { setStatusAction(PaintPlugin.getResourceString("tool.Null.label")); setStatusMessage(PaintPlugin.getResourceString("session.Null.message")); } }
-
- /**
- * Returns the current paint session.
- *
- * @return the current paint session, null if none is active
- */
- public PaintSession getPaintSession() {
- return paintSession;
- }
- /** * Returns the current paint tool. * * @return the current paint tool, null if none is active (though some other session * might be) */ public PaintTool getPaintTool() { return (paintSession != null && paintSession instanceof PaintTool) ? (PaintTool)paintSession : null; } /** * Returns the current position in an interactive operation. * * @return the last known position of the pointer */ public Point getCurrentPosition() { return currentPosition; } /** * Draws a Figure object to the screen and to the backing store permanently. * * @param object the object to draw onscreen */ public void drawFigure(Figure object) { object.draw(imageFDC); object.draw(displayFDC); } /** * Adds a Figure object to the active rubberband selection. * <p> * This object will be drawn to the screen as a preview and refreshed appropriately * until the selection is either cleared or committed. * </p> * * @param object the object to add to the selection */ public void addRubberbandSelection(Figure object) { rubberband.add(object); if (! isRubberbandHidden()) object.draw(displayFDC); } /** * Clears the active rubberband selection. * <p> * Erases any rubberband objects on the screen then clears the selection. * </p> */ public void clearRubberbandSelection() { if (! isRubberbandHidden()) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } rubberband.clear(); } /** * Commits the active rubberband selection. * <p> * Redraws any rubberband objects on the screen as permanent objects then clears the selection. * </p> */ public void commitRubberbandSelection() { rubberband.draw(imageFDC); if (isRubberbandHidden()) rubberband.draw(displayFDC); rubberband.clear(); } /** * Hides the rubberband (but does not eliminate it). * <p> * Increments by one the rubberband "hide" nesting count. The rubberband * is hidden from view (but remains active) if it wasn't already hidden. * </p> */ public void hideRubberband() { if (rubberbandHiddenNestingCount++ <= 0) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } } /** * Shows (un-hides) the rubberband. * <p> * Decrements by one the rubberband "hide" nesting count. The rubberband * is only made visible when showRubberband() has been called once for each * previous hideRubberband(). It is not permitted to call showRubberband() if * the rubber band is not presently hidden. * </p> */ public void showRubberband() { if (rubberbandHiddenNestingCount <= 0) throw new IllegalStateException("rubberbandHiddenNestingCount > 0"); if (--rubberbandHiddenNestingCount == 0) { rubberband.draw(displayFDC); } } /** * Determines if the rubberband is hidden. * * @return true iff the rubber is hidden */ public boolean isRubberbandHidden() { return rubberbandHiddenNestingCount > 0; } /** * Handles a horizontal scroll event * * @param scrollbar the horizontal scroll bar that posted this event */ public void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; if (imageWidth > visibleWidth) { final int oldOffset = displayFDC.xOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.xOffset = newOffset; paintCanvas.scroll(Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), 0, visibleWidth, visibleHeight, false); } } } /** * Handles a vertical scroll event * * @param scrollbar the vertical scroll bar that posted this event */ public void scrollVertically(ScrollBar scrollBar) { if (image == null) return; if (imageHeight > visibleHeight) { final int oldOffset = displayFDC.yOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.yOffset = newOffset; paintCanvas.scroll(0, Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), visibleWidth, visibleHeight, false); } } } /** * Handles resize events */ private void handleResize() { paintCanvas.update(); Rectangle visibleRect = paintCanvas.getClientArea(); visibleWidth = visibleRect.width; visibleHeight = visibleRect.height; ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { displayFDC.xOffset = Math.min(horizontal.getSelection(), imageWidth - visibleWidth); if (imageWidth <= visibleWidth) { horizontal.setEnabled(false); horizontal.setSelection(0); } else { final int max = imageWidth - visibleWidth; horizontal.setEnabled(true); horizontal.setValues(displayFDC.xOffset, 0, imageWidth, visibleWidth, 8, visibleWidth); } } ScrollBar vertical = paintCanvas.getVerticalBar(); if (vertical != null) { displayFDC.yOffset = Math.min(vertical.getSelection(), imageHeight - visibleHeight); if (imageHeight <= visibleHeight) { vertical.setEnabled(false); vertical.setSelection(0); } else { final int max = imageHeight - visibleHeight; vertical.setEnabled(true); vertical.setValues(displayFDC.yOffset, 0, imageHeight, visibleHeight, 8, visibleHeight); } } } /** * Virtualizes MouseEvent coordinates and stores the current position. */ private void processMouseEventCoordinates(MouseEvent event) { currentPosition.x = event.x = Math.min(Math.max(event.x, 0), visibleWidth - 1) + displayFDC.xOffset; currentPosition.y = event.y = Math.min(Math.max(event.y, 0), visibleHeight - 1) + displayFDC.yOffset; } /** * Clears the status bar. */ public void clearStatus() { statusActionInfo = ""; statusMessageInfo = ""; statusCoordInfo = ""; updateStatus(); } /** * Sets the status bar action text. * * @param action the action in progress, null to clear */ public void setStatusAction(String action) { statusActionInfo = (action != null) ? action : ""; updateStatus(); } /** * Sets the status bar message text. * * @param message the message to display, null to clear */ public void setStatusMessage(String message) { statusMessageInfo = (message != null) ? message : ""; updateStatus(); } /** * Sets the coordinates in the status bar. * * @param coord the coordinates to display, null to clear */ public void setStatusCoord(Point coord) { statusCoordInfo = (coord != null) ? PaintPlugin.getResourceString("status.Coord.format", new Object[] { new Integer(coord.x), new Integer(coord.y)}) : ""; updateStatus(); } /** * Sets the coordinate range in the status bar. * * @param a the "from" coordinate, must not be null * @param b the "to" coordinate, must not be null */ public void setStatusCoordRange(Point a, Point b) { statusCoordInfo = PaintPlugin.getResourceString("status.CoordRange.format", new Object[] { new Integer(a.x), new Integer(a.y), new Integer(b.x), new Integer(b.y)}); updateStatus(); } /** * Updates the display. */ private void updateStatus() { statusText.setText( PaintPlugin.getResourceString("status.Bar.format", new Object[] { statusActionInfo, statusMessageInfo, statusCoordInfo })); } }
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java
deleted file mode 100755
index f699b868b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- public interface PaintTool extends PaintSession {
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java
deleted file mode 100755
index e8d911cc1b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java
+++ /dev/null
@@ -1,494 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * The view for the paint application.
- * All rendering happens inside the area created by createPartControl().
- *
- * @see ViewPart
- */
-public class PaintView extends ViewPart {
- private Display workbenchDisplay;
-
- // current active settings
- private ToolSettings toolSettings;
-
- // paint surface for drawing
- private PaintSurface paintSurface;
-
- // map action ids to useful data
- private HashMap /* of String to PaintTool */ paintToolMap;
- private HashMap /* of String to Integer */ paintFillTypeMap;
- private HashMap /* of String to Integer */ paintLineStyleMap;
-
- /** UI data **/
- // handle of currently active tool IAction on the UI
- private IAction activeToolAction;
- // handle of currently active filltype IAction on the UI
- private IAction activeFillTypeAction;
- // handle of currently active linetype IAction on the UI
- private IAction activeLineStyleAction;
-
- // handle of active foreground color box Canvas widget
- private Canvas activeForegroundColorCanvas;
- // handle of active background color box Canvas widget
- private Canvas activeBackgroundColorCanvas;
-
- private static final int numPaletteRows = 3;
- private static final int numPaletteCols = 50;
-
- // shared data
- private Color paintColorBlack, paintColorWhite; // alias for paintColors[0] and [1]
- private Color[] paintColors;
- private Font paintDefaultFont; // do not free
-
- /**
- * Constructs a Paint view.
- */
- public PaintView() {
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (paintSurface != null) paintSurface.dispose();
- if (paintColors != null) {
- for (int i = 0; i < paintColors.length; ++i) {
- final Color color = paintColors[i];
- if (color != null) color.dispose();
- }
- }
- paintDefaultFont = null;
- paintColors = null;
- paintSurface = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- paintSurface.setFocus();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- /*** Initialize shared data ***/
- workbenchDisplay = parent.getDisplay();
-
- paintColorWhite = new Color(workbenchDisplay, 255, 255, 255);
- paintColorBlack = new Color(workbenchDisplay, 0, 0, 0);
-
- paintDefaultFont = workbenchDisplay.getSystemFont();
-
- paintColors = new Color[numPaletteCols * numPaletteRows];
- paintColors[0] = paintColorBlack;
- paintColors[1] = paintColorWhite;
- for (int i = 2; i < paintColors.length; i++) {
- paintColors[i] = new Color(workbenchDisplay,
- ((i*7)%255),((i*23)%255), ((i*51)%255));
- }
-
- toolSettings = new ToolSettings();
- toolSettings.commonForegroundColor = paintColorBlack;
- toolSettings.commonBackgroundColor = paintColorWhite;
- toolSettings.commonFont = paintDefaultFont;
-
- /*** Add toolbar contributions ***/
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
-
- toolbarManager.add(new GroupMarker("group.tools"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Pencil"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Airbrush"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Line"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.PolyLine"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Rectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.RoundedRectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Ellipse"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Text"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.fill"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.None"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Outline"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Solid"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.linestyle"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Solid"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dash"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dot"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.DashDot"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options"));
- toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font"));
- actionBars.updateActionBars();
-
- /*** Build GUI ***/
- createGUI(parent);
-
- /*** Set defaults ***/
- setPaintToolByID("tool.Pencil");
- setFillTypeByID("fill.None");
- setLineStyleByID("linestyle.Solid");
- setForegroundColor(paintColorBlack);
- setBackgroundColor(paintColorWhite);
- }
-
- /**
- * Creates the GUI.
- */
- private void createGUI(Composite parent) {
- GridLayout gridLayout;
- GridData gridData;
-
- /*** Create principal GUI layout elements ***/
- Composite displayArea = new Composite(parent, SWT.NONE);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- displayArea.setLayout(gridLayout);
-
- // Creating these elements here avoids the need to instantiate the GUI elements
- // in strict layout order. The natural layout ordering is an artifact of using
- // SWT layouts, but unfortunately it is not the same order as that required to
- // instantiate all of the non-GUI application elements to satisfy referential
- // dependencies. It is possible to reorder the initialization to some extent, but
- // this can be very tedious.
-
- // paint canvas
- final Canvas paintCanvas = new Canvas(displayArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL |
- SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- paintCanvas.setLayoutData(gridData);
- paintCanvas.setBackground(paintColorWhite);
-
- // color selector frame
- final Composite colorFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- colorFrame.setLayoutData(gridData);
-
- // tool settings frame
- final Composite toolSettingsFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- toolSettingsFrame.setLayoutData(gridData);
-
- // status text
- final Text statusText = new Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- statusText.setLayoutData(gridData);
-
- /*** Create the remaining application elements inside the principal GUI layout elements ***/
- // paintSurface
- paintSurface = new PaintSurface(paintCanvas, statusText, paintColorWhite);
-
- // paintToolMap
- paintToolMap = new HashMap();
- paintToolMap.put("tool.Pencil", new PencilTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Airbrush", new AirbrushTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Line", new LineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.PolyLine", new PolyLineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Rectangle", new RectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.RoundedRectangle", new RoundedRectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Ellipse", new EllipseTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Text", new TextTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Null", null);
-
- // paintFillTypeMap
- paintFillTypeMap = new HashMap();
- paintFillTypeMap.put("fill.None", new Integer(ToolSettings.ftNone));
- paintFillTypeMap.put("fill.Outline", new Integer(ToolSettings.ftOutline));
- paintFillTypeMap.put("fill.Solid", new Integer(ToolSettings.ftSolid));
-
- // paintLineStyleMap
- paintLineStyleMap = new HashMap();
- paintLineStyleMap.put("linestyle.Solid", new Integer(SWT.LINE_SOLID));
- paintLineStyleMap.put("linestyle.Dash", new Integer(SWT.LINE_DASH));
- paintLineStyleMap.put("linestyle.Dot", new Integer(SWT.LINE_DOT));
- paintLineStyleMap.put("linestyle.DashDot", new Integer(SWT.LINE_DASHDOT));
-
- // colorFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- colorFrame.setLayout(gridLayout);
-
- // activeForegroundColorCanvas, activeBackgroundColorCanvas
- activeForegroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeForegroundColorCanvas.setLayoutData(gridData);
-
- activeBackgroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeBackgroundColorCanvas.setLayoutData(gridData);
-
- // paletteCanvas
- final Canvas paletteCanvas = new Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 24;
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent(Event e) {
- Rectangle bounds = paletteCanvas.getClientArea();
- Color color = getColorAt(bounds, e.x, e.y);
-
- if (e.button == 1) setForegroundColor(color);
- else setBackgroundColor(color);
- }
- private Color getColorAt(Rectangle bounds, int x, int y) {
- if (bounds.height <= 1 && bounds.width <= 1) return paintColorWhite;
- final int row = (y - bounds.y) * numPaletteRows / bounds.height;
- final int col = (x - bounds.x) * numPaletteCols / bounds.width;
- return paintColors[Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)];
- }
- });
- Listener refreshListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.gc == null) return;
- Rectangle bounds = paletteCanvas.getClientArea();
- for (int row = 0; row < numPaletteRows; ++row) {
- for (int col = 0; col < numPaletteCols; ++col) {
- final int x = bounds.width * col / numPaletteCols;
- final int y = bounds.height * row / numPaletteRows;
- final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1);
- final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1);
- e.gc.setBackground(paintColors[row * numPaletteCols + col]);
- e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height);
- }
- }
- }
- };
- paletteCanvas.addListener(SWT.Resize, refreshListener);
- paletteCanvas.addListener(SWT.Paint, refreshListener);
- //paletteCanvas.redraw();
-
- // toolSettingsFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 4;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- toolSettingsFrame.setLayout(gridLayout);
-
- Label label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushRadius.text"));
-
- final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushRadiusScale.setMinimum(5);
- airbrushRadiusScale.setMaximum(50);
- airbrushRadiusScale.setSelection(toolSettings.airbrushRadius);
- airbrushRadiusScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushRadiusScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushRadius = airbrushRadiusScale.getSelection();
- updateToolSettings();
- }
- });
-
- label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushIntensity.text"));
-
- final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushIntensityScale.setMinimum(1);
- airbrushIntensityScale.setMaximum(100);
- airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity);
- airbrushIntensityScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushIntensityScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection();
- updateToolSettings();
- }
- });
- }
-
- /**
- * Notifies the tool that its settings have changed.
- */
- private void updateToolSettings() {
- final PaintTool activePaintTool = paintSurface.getPaintTool();
- if (activePaintTool == null) return;
-
- activePaintTool.endSession();
- activePaintTool.set(toolSettings);
- activePaintTool.beginSession();
- }
-
- /**
- * Sets the tool foreground color.
- *
- * @param color the new color to use
- */
- public void setForegroundColor(Color color) {
- if (activeForegroundColorCanvas != null)
- activeForegroundColorCanvas.setBackground(color);
- toolSettings.commonForegroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Set the tool background color.
- *
- * @param color the new color to use
- */
- public void setBackgroundColor(Color color) {
- if (activeBackgroundColorCanvas != null)
- activeBackgroundColorCanvas.setBackground(color);
- toolSettings.commonBackgroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Selects a tool given its ID.
- */
- public void setPaintToolByID(String id) {
- activeToolAction = handleRadioAction(activeToolAction, id);
-
- final PaintTool paintTool = (PaintTool) paintToolMap.get(id);
- paintSurface.setPaintSession(paintTool);
- updateToolSettings();
- }
-
- /**
- * Selects a filltype given its ID.
- */
- public void setFillTypeByID(String id) {
- activeFillTypeAction = handleRadioAction(activeFillTypeAction, id);
-
- final Integer fillType = (Integer) paintFillTypeMap.get(id);
- toolSettings.commonFillType = fillType.intValue();
- updateToolSettings();
- }
-
- /**
- * Selects line type given its ID.
- */
- public void setLineStyleByID(String id) {
- activeLineStyleAction = handleRadioAction(activeLineStyleAction, id);
-
- final Integer lineType = (Integer) paintLineStyleMap.get(id);
- toolSettings.commonLineStyle = lineType.intValue();
- updateToolSettings();
- }
-
- /**
- * Gets the IAction for an ID belonging to a set of mutually exclusive actions, and
- * toggles the old action off if necessary.
- */
- private IAction handleRadioAction(IAction oldAction, String id) {
- IAction action = getActionByID(id);
- if (action != null) {
- if (oldAction != null) oldAction.setChecked(false);
- if (! action.isChecked()) action.setChecked(true);
- return action;
- }
- return oldAction;
- }
-
- /**
- * Gets the IAction representing the UI toolbar button with the specified ID.
- */
- private IAction getActionByID(String id) {
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
- ActionContributionItem contributionItem = (ActionContributionItem) toolbarManager.find(id);
- if (contributionItem == null) return null;
- return contributionItem.getAction();
- }
-
- /**
- * Returns the Display.
- *
- * @return the display we're using
- */
- public Display getDisplay() {
- return workbenchDisplay;
- }
-
- /**
- * Action set glue.
- */
- abstract class PaintAction extends Action {
- public PaintAction(String id) {
- super();
- setId(id);
-
- try {
- final URL installUrl = PaintPlugin.getDefault().getDescriptor().getInstallURL();
- final URL imageUrl = new URL(installUrl, PaintPlugin.getResourceString(id + ".image"));
- setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));
- } catch (MalformedURLException e) {
- PaintPlugin.logError("", e);
- }
-
- setText(PaintPlugin.getResourceString(id + ".label"));
- setToolTipText(PaintPlugin.getResourceString(id + ".tooltip"));
- setDescription(PaintPlugin.getResourceString(id + ".description"));
- }
- }
- class SelectPaintToolAction extends PaintAction {
- public SelectPaintToolAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setPaintToolByID(getId()); }
-
- }
- class SelectFillTypeAction extends PaintAction {
- public SelectFillTypeAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setFillTypeByID(getId()); }
- }
- class SelectLineStyleAction extends PaintAction {
- public SelectLineStyleAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setLineStyleByID(getId()); }
- }
- class SelectFontAction extends PaintAction {
- public SelectFontAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_PUSH_BUTTON; }
- public void run() {
- FontDialog fontDialog = new FontDialog(paintSurface.getShell(), SWT.PRIMARY_MODAL);
- FontData[] fontDatum = toolSettings.commonFont.getFontData();
- if (fontDatum != null && fontDatum.length > 0) {
- fontDialog.setFontData(fontDatum[0]);
- }
- fontDialog.setText(PaintPlugin.getResourceString("options.Font.dialog.title"));
-
- paintSurface.hideRubberband();
- FontData fontData = fontDialog.open();
- paintSurface.showRubberband();
- if (fontData != null) {
- try {
- Font font = new Font(workbenchDisplay, fontData);
- toolSettings.commonFont = font;
- updateToolSettings();
- } catch (SWTException e) {
- }
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java
deleted file mode 100755
index 69f52d8612..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * A pencil tool.
- */
-public class PencilTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a pencil tool.
- *
- * @param toolSettings the new tool settings
- * @param getPaintSurface() the PaintSurface we will render on.
- */
- public PencilTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Pencil.label");
- }
-
- /*
- * Template method for drawing
- */
- public void render(final Point point) {
- final PaintSurface ps = getPaintSurface();
- ps.drawFigure(new PointFigure(settings.commonForegroundColor, point.x, point.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java
deleted file mode 100644
index a93da19f9c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Point object
- */
-public class PointFigure extends Figure {
- private Color color;
- private int x, y;
- /**
- * Constructs a Point
- *
- * @param color the color for this object
- * @param x the virtual X coordinate of the first end-point
- * @param y the virtual Y coordinate of the first end-point
- */
- public PointFigure(Color color, int x, int y) {
- this.color = color; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(p.x, p.y, 1, 1);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x, y, x, y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
deleted file mode 100755
index 973e152695..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A polyline drawing tool.
- */
-public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a PolyLineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public PolyLineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.PolyLine.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
- ContainerFigure container = new ContainerFigure();
- if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
- container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
- }
- if (! closed || settings.commonFillType != ToolSettings.ftSolid || numPoints < 3) {
- for (int i = 0; i < numPoints - 1; ++i) {
- final Point a = points[i];
- final Point b = points[i + 1];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- if (closed) {
- final Point a = points[points.length - 1];
- final Point b = points[0];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- }
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
deleted file mode 100755
index b6bf01462b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
deleted file mode 100755
index 555280150c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Rectangle.label");
- }
-
- /*
- * Template method for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- switch (settings.commonFillType) {
- default:
- case ToolSettings.ftNone:
- return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- case ToolSettings.ftSolid:
- return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftOutline: {
- ContainerFigure container = new ContainerFigure();
- container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
deleted file mode 100755
index ec561dd454..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RoundedRectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2, diameter;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
deleted file mode 100755
index e649b40005..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RoundedRectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RoundedRectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RoundedRectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.RoundedRectangle.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor,
- a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor,
- settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
deleted file mode 100755
index 5085ab1bf2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-import java.util.*;
-
-/**
- * The superclass for paint tools that contruct objects from individually
- * picked segments.
- */
-public abstract class SegmentedPaintSession extends BasicPaintSession {
- /**
- * The set of control points making up the segmented selection
- */
- private Vector /* of Point */ controlPoints = new Vector();
-
- /**
- * The previous figure (so that we can abort with right-button)
- */
- private Figure previousFigure = null;
-
- /**
- * The current figure (so that we can abort with right-button)
- */
- private Figure currentFigure = null;
-
- /**
- * Constructs a PaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected SegmentedPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.interactiveMode"));
- previousFigure = currentFigure;
-
- if (controlPoints.size() > 0) {
- final Point lastPoint = (Point) controlPoints.elementAt(controlPoints.size() - 1);
- if (lastPoint.x == event.x || lastPoint.y == event.y) return; // spurious event
- }
- controlPoints.add(new Point(event.x, event.y));
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- if (event.button != 1) return;
- if (controlPoints.size() >= 2) {
- getPaintSurface().clearRubberbandSelection();
- previousFigure = createFigure(
- (Point[]) controlPoints.toArray(new Point[controlPoints.size()]),
- controlPoints.size(), true);
- }
- resetSession();
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (controlPoints.size() == 0) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return; // spurious event
- } else {
- ps.setStatusCoordRange((Point) controlPoints.elementAt(controlPoints.size() - 1),
- ps.getCurrentPosition());
- }
-
- ps.clearRubberbandSelection();
- Point[] points = (Point[]) controlPoints.toArray(new Point[controlPoints.size() + 1]);
- points[controlPoints.size()] = ps.getCurrentPosition();
- currentFigure = createFigure(points, points.length, false);
- ps.addRubberbandSelection(currentFigure);
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param points the array of control points
- * @param numPoints the number of valid points in the array (n >= 2)
- * @param closed true if the user double-clicked on the final control point
- */
- protected abstract Figure createFigure(Point[] points, int numPoints, boolean closed);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
deleted file mode 100755
index 8f481eb474..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Solid Ellipse object
- */
-public class SolidEllipseFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidEllipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidEllipseFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillOval(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
deleted file mode 100755
index 22b06ca958..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class SolidPolygonFigure extends Figure {
- private Color color;
- private int[] points;
- /**
- * Constructs a SolidPolygon
- * These objects are defined by a sequence of vertices.
- *
- * @param color the color for this object
- * @param vertices the array of vertices making up the polygon
- * @param numPoint the number of valid points in the array (n >= 3)
- */
- public SolidPolygonFigure(Color color, Point[] vertices, int numPoints) {
- this.color = color;
- this.points = new int[numPoints * 2];
- for (int i = 0; i < numPoints; ++i) {
- points[i * 2] = vertices[i].x;
- points[i * 2 + 1] = vertices[i].y;
- }
- }
- public void draw(FigureDrawContext fdc) {
- int[] drawPoints = new int[points.length];
- for (int i = 0; i < points.length; i += 2) {
- drawPoints[i] = points[i] * fdc.xScale - fdc.xOffset;
- drawPoints[i + 1] = points[i + 1] * fdc.yScale - fdc.yOffset;
- }
- fdc.gc.setBackground(color);
- fdc.gc.fillPolygon(drawPoints);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- int xmin = Integer.MAX_VALUE, ymin = Integer.MAX_VALUE;
- int xmax = Integer.MIN_VALUE, ymax = Integer.MIN_VALUE;
-
- for (int i = 0; i < points.length; i += 2) {
- if (points[i] < xmin) xmin = points[i];
- if (points[i] > xmax) xmax = points[i];
- if (points[i+1] < ymin) ymin = points[i+1];
- if (points[i+1] > ymax) ymax = points[i+1];
- }
- region.add(fdc.toClientRectangle(xmin, ymin, xmax, ymax));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
deleted file mode 100755
index f1146a5736..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidRectangleFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
deleted file mode 100755
index bb57338e75..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRoundedRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2, diameter;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public SolidRoundedRectangleFigure(Color color, int x1, int y1, int x2, int y2, int diameter) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRoundRectangle(r.x, r.y, r.width, r.height, diameter, diameter);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java
deleted file mode 100755
index a8f1b077ff..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class TextFigure extends Figure {
- private Color color;
- private Font font;
- private String text;
- private int x, y;
- /**
- * Constructs a TextFigure
- *
- * @param color the color for this object
- * @param font the font for this object
- * @param text the text to draw, tab and new-line expansion is performed
- * @param x the virtual X coordinate of the top-left corner of the text bounding box
- * @param y the virtual Y coordinate of the top-left corner of the text bounding box
- */
- public TextFigure(Color color, Font font, String text, int x, int y) {
- this.color = color; this.font = font; this.text = text; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setFont(font);
- fdc.gc.setForeground(color);
- fdc.gc.drawText(text, p.x, p.y, true);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- Font oldFont = fdc.gc.getFont();
- fdc.gc.setFont(font);
- Point textExtent = fdc.gc.textExtent(text);
- fdc.gc.setFont(oldFont);
- region.add(fdc.toClientRectangle(x, y, x + textExtent.x, y + textExtent.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java
deleted file mode 100755
index 22831e81bf..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A text drawing tool.
- */
-public class TextTool extends BasicPaintSession implements PaintTool {
- private ToolSettings settings;
- private String drawText = PaintPlugin.getResourceString("tool.Text.settings.defaulttext");
-
- /**
- * Constructs a PaintTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public TextTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Text.label");
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.Text.message"));
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button == 1) {
- // draw with left mouse button
- getPaintSurface().commitRubberbandSelection();
- } else {
- // set text with right mouse button
- getPaintSurface().clearRubberbandSelection();
- InputDialog inputDialog = new InputDialog(getPaintSurface().getShell(),
- PaintPlugin.getResourceString("tool.Text.dialog.title"),
- PaintPlugin.getResourceString("tool.Text.dialog.message"),
- drawText, null);
- inputDialog.setBlockOnOpen(true);
- inputDialog.open();
- if (inputDialog.getReturnCode() == InputDialog.OK) drawText = inputDialog.getValue();
- inputDialog.close();
- }
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- ps.addRubberbandSelection(
- new TextFigure(settings.commonForegroundColor, settings.commonFont,
- drawText, event.x, event.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java
deleted file mode 100755
index 6d41a27dd8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.*; import org.eclipse.swt.graphics.*;
- /** * Tool Settings objects group tool-related configuration information. */
-public class ToolSettings {
- public static final int ftNone = 0, ftOutline = 1, ftSolid = 2; /**
- * commonForegroundColor: current tool foreground colour
- */
- public Color commonForegroundColor;
-
- /**
- * commonBackgroundColor: current tool background colour
- */
- public Color commonBackgroundColor;
- /** * commonFont: current font */ public Font commonFont; /** * commonFillType: current fill type * <p>One of ftNone, ftOutline, ftSolid.</p> */ public int commonFillType = ftNone; /** * commonLineStyle: current line type */ public int commonLineStyle = SWT.LINE_SOLID;
- /**
- * airbrushRadius: coverage radius in pixels
- */
- public int airbrushRadius = 10;
-
- /**
- * airbrushIntensity: average surface area coverage in region defined by radius per "jot"
- */
- public int airbrushIntensity = 30; /** * roundedRectangleCornerDiameter: the diameter of curvature of corners in a rounded rectangle */ public int roundedRectangleCornerDiameter = 16; }
diff --git a/examples/org.eclipse.swt.examples.paint/plugin.properties b/examples/org.eclipse.swt.examples.paint/plugin.properties
deleted file mode 100755
index 230cd503ea..0000000000
--- a/examples/org.eclipse.swt.examples.paint/plugin.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-plugin.SWTPaintExample.name = SWT Paint Example Plugin
-category.SWTExamples.name = SWT Examples
-view.PaintExample.name = Paint
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.PaintExample.name = Paint
-launchitem.PaintExample.description = \
- This example demonstrates the use of SWT graphics operations in the form of a \
- rudimentary bitmap painting program. The Airbrush Tool implementation also
- demonstrates a mechanism for managing timed GUI operations in the background
- that are triggered by user input (see ContinuousPaintSession.java).\n\n\
- Select a tool with which to draw in the drawing area. There are a number of tools \
- to choose from on the toolbar. To change the color selection, click on a color in the \
- palette below the drawing area: left-click for the foreground color, right-click for the \
- background color.\n\n\
- Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support.
-
-menu.Tools.label = Tools
-menu.Options.label = Options
-
-tool.Pencil.label = Pencil
-tool.Pencil.tooltip = Pencil tool
-tool.Pencil.image = icons/tool_pencil.gif
-tool.Pencil.description = Selects the Pencil tool.
-
-tool.Airbrush.label = Airbrush
-tool.Airbrush.tooltip = Airbrush tool
-tool.Airbrush.image = icons/tool_airbrush.gif
-tool.Airbrush.description = Selects the Airbrush tool.
-
-tool.Line.label = Line
-tool.Line.tooltip = Line tool
-tool.Line.image = icons/tool_line.gif
-tool.Line.description = Selects the Line tool.
-
-tool.PolyLine.label = Polygon
-tool.PolyLine.tooltip = Polygon tool
-tool.PolyLine.image = icons/tool_polyline.gif
-tool.PolyLine.description = Selects the PolyLine tool.
-
-tool.Rectangle.label = Rectangle
-tool.Rectangle.tooltip = Rectangle tool
-tool.Rectangle.image = icons/tool_rectangle.gif
-tool.Rectangle.description = Selects the Rectangle tool.
-
-tool.Ellipse.label = Ellipse
-tool.Ellipse.tooltip = Ellipse tool
-tool.Ellipse.image = icons/tool_ellipse.gif
-tool.Ellipse.description = Selects the Ellipse tool.
-
-tool.RoundedRectangle.label = Rounded Rectangle
-tool.RoundedRectangle.tooltip = Rounded Rectangle
-tool.RoundedRectangle.image = icons/tool_roundedrectangle.gif
-tool.RoundedRectangle.description = Selects the Rounded Rectangle tool.
-
-tool.Text.label = Text
-tool.Text.tooltip = Text tool
-tool.Text.image = icons/tool_text.gif
-tool.Text.description = Selects the Text tool.
-tool.Text.settings.defaulttext = Hello!
-tool.Text.dialog.title = Text Tool Settings
-tool.Text.dialog.message = Please enter the new text string to be painted.
-
-tool.Null.label = <none>
-
-fill.None.label = No Fill
-fill.None.tooltip = No fill mode
-fill.None.image = icons/fill_none.gif
-fill.None.description = Selects No Fill mode.
-
-fill.Outline.label = Outline Fill
-fill.Outline.tooltip = Outline fill mode
-fill.Outline.image = icons/fill_outline.gif
-fill.Outline.description = Selects Outline Fill mode.
-
-fill.Solid.label = Solid Fill
-fill.Solid.tooltip = Solid fill mode
-fill.Solid.image = icons/fill_solid.gif
-fill.Solid.description = Selects Solid Fill mode.
-
-linestyle.Solid.label = Solid Line
-linestyle.Solid.tooltip = Solid line style
-linestyle.Solid.image = icons/linestyle_solid.gif
-linestyle.Solid.description = Select Solid Line style.
-
-linestyle.Dot.label = Dotted Line
-linestyle.Dot.tooltip = Dotted line style
-linestyle.Dot.image = icons/linestyle_dot.gif
-linestyle.Dot.description = Select Dotted Line style.
-
-linestyle.Dash.label = Dashed Line
-linestyle.Dash.tooltip = Dashed line style
-linestyle.Dash.image = icons/linestyle_dash.gif
-linestyle.Dash.description = Select Dashed Line style.
-
-linestyle.DashDot.label = Dash-Dot Line
-linestyle.DashDot.tooltip = Dash-Dot line style
-linestyle.DashDot.image = icons/linestyle_dashdot.gif
-linestyle.DashDot.description = Select Dash-Dot Line style.
-
-options.Font.label = Text Tool Font
-options.Font.tooltip = Select Text Tool font
-options.Font.image = icons/options_font.gif
-options.Font.description = Selects Text Tool font.
-options.Font.dialog.title = Text Tool Font
-
-settings.AirbrushRadius.text = Airbrush Radius
-settings.AirbrushIntensity.text = Airbrush Intensity
-
-session.Null.message = Select a tool...
-session.ContinuousPaint.message = Click and drag to draw...
-session.DragInteractivePaint.message = Click and drag to preview, release to draw, right-click to cancel...
-session.SegmentedInteractivePaint.message.anchorMode = Click to set anchor...
-session.SegmentedInteractivePaint.message.interactiveMode = Click to draw, double-click to close figure, right-click to cancel...
-session.Text.message = Click to draw text, right-click to edit text...
-
-status.Coord.format = ({0}, {1})
-status.CoordRange.format = ({0}, {1}) - ({2}, {3})
-status.Bar.format = {0} : {1} {2}
diff --git a/examples/org.eclipse.swt.examples.paint/plugin.xml b/examples/org.eclipse.swt.examples.paint/plugin.xml
deleted file mode 100755
index 5547648dd7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/plugin.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.paint"
- name="%plugin.SWTPaintExample.name"
- version="2.0"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.paint.PaintPlugin">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<!-- Runtime -->
-<runtime>
- <library name="paint.jar"/>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.PaintExample.name"
- icon="icons/paint_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.paint.PaintView"
- id="org.eclipse.swt.examples.paint.view">
- </view>
-</extension>
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.PaintExample.name"
- icon="icons/paint_example.gif"
- description="%launchitem.PaintExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.paint.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.paint.view">
- </view>
- <source
- zip="paintsrc.zip">
- </source>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java
deleted file mode 100755
index 8eeabb9920..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * An airbrush tool.
- */
-public class AirbrushTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
- private Random random;
- private int cachedRadiusSquared;
- private int cachedNumPoints;
-
- /**
- * Constructs a Tool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public AirbrushTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- random = new Random();
- setRetriggerTimer(10);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- // compute things we need to know for drawing
- settings = toolSettings;
- cachedRadiusSquared = settings.airbrushRadius * settings.airbrushRadius;
- cachedNumPoints = 314 * settings.airbrushIntensity * cachedRadiusSquared / 250000;
- if (cachedNumPoints == 0 && settings.airbrushIntensity != 0)
- cachedNumPoints = 1;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Airbrush.label");
- }
-
- /*
- * Template method for drawing
- */
- protected void render(Point point) {
- // Draws a bunch (cachedNumPoints) of random pixels within a specified circle (cachedRadiusSquared).
- ContainerFigure cfig = new ContainerFigure();
-
- for (int i = 0; i < cachedNumPoints; ++i) {
- int randX, randY;
- do {
- randX = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- randY = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- } while (randX * randX + randY * randY > cachedRadiusSquared);
- cfig.add(new PointFigure(settings.commonForegroundColor, point.x + randX, point.y + randY));
- }
- getPaintSurface().drawFigure(cfig);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java
deleted file mode 100755
index 0af229175a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public abstract class BasicPaintSession implements PaintSession {
- /** * The paint surface */ private PaintSurface paintSurface; /** * Constructs a PaintSession. * * @param paintSurface the drawing surface to use */ protected BasicPaintSession(PaintSurface paintSurface) { this.paintSurface = paintSurface; } /**
- * Returns the paint surface associated with this paint session. * * @return the associated PaintSurface */ public PaintSurface getPaintSurface() { return paintSurface; } }
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java
deleted file mode 100755
index 0c2d64996a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Container for Figure objects with stacking preview mechanism.
- */
-public class ContainerFigure extends Figure {
- private static final int INITIAL_ARRAY_SIZE = 16;
-
- Figure[] objectStack = null;
- int nextIndex = 0;
-
- /**
- * Constructs an empty Container
- */
- public ContainerFigure() {
- }
- /**
- * Adds an object to the container for later drawing.
- *
- * @param object the object to add to the drawing list
- */
- public void add(Figure object) {
- if (objectStack == null) {
- objectStack = new Figure[INITIAL_ARRAY_SIZE];
- } else if (objectStack.length <= nextIndex) {
- Figure[] newObjectStack = new Figure[objectStack.length * 2];
- System.arraycopy(objectStack, 0, newObjectStack, 0, objectStack.length);
- objectStack = newObjectStack;
- }
- objectStack[nextIndex] = object;
- ++nextIndex;
- }
- /**
- * Determines if the container is empty.
- * @return true if the container is empty
- */
- public boolean isEmpty() {
- return nextIndex == 0;
- }
- /**
- * Adds an object to the container and draws its preview then updates the supplied preview state.
- *
- * @param object the object to add to the drawing list
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- * @param rememberedState the state returned by a previous drawPreview() or addAndPreview()
- * using this Container, may be null if there was no such previous call
- * @return object state that must be passed to erasePreview() later to erase this object
- */
-// public Object addAndPreview(Figure object, GC gc, Point offset, Object rememberedState) {
-// Object[] stateStack = (Object[]) rememberedState;
-// if (stateStack == null) {
-// stateStack = new Object[INITIAL_ARRAY_SIZE];
-// } else if (stateStack.length <= nextIndex) {
-// Object[] newStateStack = new Object[stateStack.length * 2];
-// System.arraycopy(stateStack, 0, newStateStack, 0, stateStack.length);
-// stateStack = newStateStack;
-// }
-// add(object);
-// stateStack[nextIndex - 1] = object.drawPreview(gc, offset);
-// return stateStack;
-// }
- /**
- * Clears the container.
- * <p>
- * Note that erasePreview() cannot be called after this point to erase any previous
- * drawPreview()'s.
- * </p>
- */
- public void clear() {
- while (--nextIndex > 0) objectStack[nextIndex] = null;
- nextIndex = 0;
- }
- public void draw(FigureDrawContext fdc) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(fdc);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].addDamagedRegion(fdc, region);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
deleted file mode 100755
index 22aa5eb1d9..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
-
-/**
- * The superclass for paint tools that draw continuously along the path
- * traced by the mouse's movement while the button is depressed
- */
-public abstract class ContinuousPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress.
- */
- private boolean dragInProgress = false;
-
- /**
- * A cached Point array for drawing.
- */
- private Point[] points = new Point[] { new Point(-1, -1), new Point(-1, -1) };
-
- /**
- * The time to wait between retriggers in milliseconds.
- */
- private int retriggerInterval = 0;
-
- /**
- * The currently valid RetriggerHandler
- */
- protected Runnable retriggerHandler = null;
-
- /**
- * Constructs a ContinuousPaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected ContinuousPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Sets the retrigger timer.
- * <p>
- * After the timer elapses, if the mouse is still hovering over the same point with the
- * drag button pressed, a new render order is issued and the timer is restarted.
- * </p>
- * @param interval the time in milliseconds to wait between retriggers, 0 to disable
- */
- public void setRetriggerTimer(int interval) {
- retriggerInterval = interval;
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.ContinuousPaint.message"));
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- abortRetrigger();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- abortRetrigger();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- points[0].x = event.x;
- points[0].y = event.y;
- render(points[0]);
- prepareRetrigger();
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseUp(MouseEvent event) {
- if (event.button != 1) return;
- if (! dragInProgress) return; // spurious event
- abortRetrigger();
- mouseSegmentFinished(event);
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- if (! dragInProgress) return;
- mouseSegmentFinished(event);
- prepareRetrigger();
- }
-
- /**
- * Handle a rendering segment
- *
- * @param event the mouse event detail information
- */
- private final void mouseSegmentFinished(MouseEvent event) {
- if (points[0].x == -1) return; // spurious event
- if (points[0].x != event.x || points[0].y != event.y) {
- // draw new segment
- points[1].x = event.x;
- points[1].y = event.y;
- renderContinuousSegment();
- }
- }
-
- /**
- * Draws a continuous segment from points[0] to points[1].
- * Assumes points[0] has been drawn already.
- *
- * @post points[0] will refer to the same point as points[1]
- */
- protected void renderContinuousSegment() {
- /* A lazy but effective line drawing algorithm */
- final int dX = points[1].x - points[0].x;
- final int dY = points[1].y - points[0].y;
- int absdX = Math.abs(dX);
- int absdY = Math.abs(dY);
-
- if ((dX == 0) && (dY == 0)) return;
-
- if (absdY > absdX) {
- final int incfpX = (dX << 16) / absdY;
- final int incY = (dY > 0) ? 1 : -1;
- int fpX = points[0].x << 16; // X in fixedpoint format
-
- while (--absdY >= 0) {
- points[0].y += incY;
- points[0].x = (fpX += incfpX) >> 16;
- render(points[0]);
- }
- if (points[0].x == points[1].x) return;
- points[0].x = points[1].x;
- } else {
- final int incfpY = (dY << 16) / absdX;
- final int incX = (dX > 0) ? 1 : -1;
- int fpY = points[0].y << 16; // Y in fixedpoint format
-
- while (--absdX >= 0) {
- points[0].x += incX;
- points[0].y = (fpY += incfpY) >> 16;
- render(points[0]);
- }
- if (points[0].y == points[1].y) return;
- points[0].y = points[1].y;
- }
- render(points[0]);
- }
-
- /**
- * Prepare the retrigger timer
- */
- private final void prepareRetrigger() {
- if (retriggerInterval > 0) {
- /*
- * timerExec() provides a lightweight mechanism for running code at intervals from within
- * the event loop when timing accuracy is not important.
- *
- * Since it is not possible to cancel a timerExec(), we remember the Runnable that is
- * active in order to distinguish the valid one from the stale ones. In practice,
- * if the interval is 1/100th of a second, then creating a few hundred new RetriggerHandlers
- * each second will not cause a significant performance hit.
- */
- Display display = getPaintSurface().getDisplay();
- retriggerHandler = new Runnable() {
- public void run() {
- if (retriggerHandler == this) {
- render(points[0]);
- prepareRetrigger();
- }
- }
- };
- display.timerExec(retriggerInterval, retriggerHandler);
- }
- }
-
- /**
- * Aborts the retrigger timer
- */
- private final void abortRetrigger() {
- retriggerHandler = null;
- }
-
- /**
- * Template method: Renders a point.
- * @param point, the point to render
- */
- protected abstract void render(Point point);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java
deleted file mode 100755
index 78b9fe6bd7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.graphics.*;
-
-/**
- * The superclass for paint tools that use click-drag-release motions to
- * draw objects.
- */
-public abstract class DragPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress
- */
- private boolean dragInProgress = false;
-
- /**
- * The position of the first click in a click-drag
- */
- private Point anchorPosition = new Point(-1, -1);
-
- /**
- * A temporary point
- */
- private Point tempPosition = new Point(-1, -1);
-
- /**
- * Constructs a PaintSession.
- *
- * @param getPaintSurface() the drawing surface to use
- */
- protected DragPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.DragInteractivePaint.message"));
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- anchorPosition.x = event.x;
- anchorPosition.y = event.y;
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- if (! dragInProgress) return; // spurious event
- dragInProgress = false;
- if (anchorPosition.x == -1) return; // spurious event
-
- getPaintSurface().commitRubberbandSelection();
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (! dragInProgress) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return;
- }
- ps.setStatusCoordRange(anchorPosition, ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- tempPosition.x = event.x;
- tempPosition.y = event.y;
- ps.addRubberbandSelection(createFigure(anchorPosition, tempPosition));
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param anchor the anchor point
- * @param cursor the point marking the current pointer location
- */
- protected abstract Figure createFigure(Point anchor, Point cursor);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
deleted file mode 100755
index 0fcd6ae284..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Ellipse object
- */
-public class EllipseFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs an Ellipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
deleted file mode 100755
index ced0b873b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class EllipseTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a EllipseTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public EllipseTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Ellipse.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java
deleted file mode 100755
index 9a57aa5aa8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Superinterface for all drawing objects.
- * All drawing objects know how to render themselved to the screen and can draw a
- * temporary version of themselves for previewing the general appearance of the
- * object onscreen before it gets committed.
- */
-public abstract class Figure {
- /**
- * Draws this object.
- *
- * @param fdc a parameter block specifying drawing-related information
- */
- public abstract void draw(FigureDrawContext fdc);
-
- /**
- * Computes the damaged screen region caused by drawing this object (imprecise), then
- * appends it to the supplied region.
- *
- * @param fdc a parameter block specifying drawing-related information
- * @param region a region to which additional damage areas will be added
- */
- public abstract void addDamagedRegion(FigureDrawContext fdc, Region region);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java
deleted file mode 100644
index eda60d25b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-public class FigureDrawContext {
- /*
- * <p>
- * The GC must be set up as follows
- * (it will be returned to this state upon completion of drawing operations)
- * <ul>
- * <li>setXORMode(false)
- * </ul>
- * </p>
- */
- public GC gc = null;
- public int xOffset = 0, yOffset = 0; // substract to get GC coords
- public int xScale = 1, yScale = 1;
-
- public Rectangle toClientRectangle(int x1, int y1, int x2, int y2) {
- return new Rectangle(
- Math.min(x1, x2) * xScale - xOffset,
- Math.min(y1, y2) * yScale - yOffset,
- (Math.abs(x2 - x1) + 1) * xScale,
- (Math.abs(y2 - y1) + 1) * yScale);
- }
- public Point toClientPoint(int x, int y) {
- return new Point(x * xScale - xOffset, y * yScale - yOffset);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
deleted file mode 100755
index de71910f76..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class LineFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Line
- * These objects are defined by their two end-points.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first end-point
- * @param y1 the virtual Y coordinate of the first end-point
- * @param x2 the virtual X coordinate of the second end-point
- * @param y2 the virtual Y coordinate of the second end-point
- */
- public LineFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Point p1 = fdc.toClientPoint(x1, y1);
- Point p2 = fdc.toClientPoint(x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawLine(p1.x, p1.y, p2.x, p2.y);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
deleted file mode 100755
index f969d24911..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A line drawing tool
- */
-public class LineTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a LineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public LineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Line.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- return new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java
deleted file mode 100755
index 6e17722f39..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class PaintPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static PaintPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- /**
- * Constructs the Paint plugin.
- */
- public PaintPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Returns the shared instance.
- */
- public static PaintPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java
deleted file mode 100755
index a688ed8d94..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * Manages an interactive paint session.
- * Note that the coordinates received via the listener interfaces are virtualized to zero-origin
- * relative to the painting surface.
- */
-public interface PaintSession extends MouseListener, MouseMoveListener {
- /**
- * Returns the paint surface associated with this paint session
- *
- * @return the associated PaintSurface
- */
- public PaintSurface getPaintSurface();
-
- /**
- * Activates the session.
- *
- * Note: When overriding this method, call super.beginSession() at method start.
- */
- public abstract void beginSession();
-
- /**
- * Deactivates the session.
- *
- * Note: When overriding this method, call super.endSession() at method exit.
- */
- public abstract void endSession();
-
- /**
- * Resets the session.
- * Aborts any operation in progress.
- *
- * Note: When overriding this method, call super.resetSession() at method exit.
- */
- public abstract void resetSession();
-
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName();
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java
deleted file mode 100755
index cc6e529e38..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
- /** * Manages a simple drawing surface. */
-public class PaintSurface { private Point currentPosition = new Point(0, 0);
- private Canvas paintCanvas; private PaintSession paintSession; private Image image; private Image paintImage; // buffer for refresh blits private int imageWidth, imageHeight; private int visibleWidth, visibleHeight; private FigureDrawContext displayFDC = new FigureDrawContext(); private FigureDrawContext imageFDC = new FigureDrawContext(); private FigureDrawContext paintFDC = new FigureDrawContext(); /* Rubberband */ private ContainerFigure rubberband = new ContainerFigure(); // the active rubberband selection private int rubberbandHiddenNestingCount = 0; // always >= 0, if > 0 rubberband has been hidden /* Status */ private Text statusText; private String statusActionInfo, statusMessageInfo, statusCoordInfo; /** * Constructs a PaintSurface. * <p> * paintCanvas must have SWT.NO_REDRAW_RESIZE and SWT.NO_BACKGROUND styles, * and may have SWT.V_SCROLL and/or SWT.H_SCROLL. * </p> * @param paintCanvas the Canvas object in which to render * @param paintStatus the PaintStatus object to use for providing user feedback * @param fillColor the color to fill the canvas with initially */
- public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) { this.paintCanvas = paintCanvas; this.statusText = statusText; clearStatus(); /* Set up the drawing surface */ Rectangle displayRect = paintCanvas.getDisplay().getClientArea(); imageWidth = displayRect.width; imageHeight = displayRect.height; image = new Image(paintCanvas.getDisplay(), imageWidth, imageHeight); imageFDC.gc = new GC(image); imageFDC.gc.setBackground(fillColor); imageFDC.gc.fillRectangle(0, 0, imageWidth, imageHeight); displayFDC.gc = new GC(paintCanvas); /* Initialize the session */ setPaintSession(null); /* Add our listeners */ paintCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { displayFDC.gc.dispose(); } }); paintCanvas.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDown(event); } public void mouseUp(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseUp(event); } public void mouseDoubleClick(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDoubleClick(event); } }); paintCanvas.addMouseMoveListener(new MouseMoveListener() { public void mouseMove(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseMove(event); } }); paintCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (rubberband.isEmpty()) { // Nothing to merge, so we just refresh event.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); } else { /* * Avoid flicker when merging overlayed objects by constructing the image on * a backbuffer first, then blitting it to the screen. */ // Check that the backbuffer is large enough if (paintImage != null) { Rectangle rect = paintImage.getBounds(); if ((event.width + event.x > rect.width) || (event.height + event.y > rect.height)) { paintFDC.gc.dispose(); paintImage.dispose(); paintImage = null; } } if (paintImage == null) { Display display = getDisplay(); Rectangle rect = display.getClientArea(); paintImage = new Image(display, Math.max(rect.width, event.width + event.x), Math.max(rect.height, event.height + event.y)); paintFDC.gc = new GC(paintImage); } // Setup clipping and the FDC Region clipRegion = new Region(); event.gc.getClipping(clipRegion); paintFDC.gc.setClipping(clipRegion); clipRegion.dispose(); paintFDC.xOffset = displayFDC.xOffset; paintFDC.yOffset = displayFDC.yOffset; paintFDC.xScale = displayFDC.xScale; paintFDC.yScale = displayFDC.yScale; // Merge the overlayed objects into the image, then blit paintFDC.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); rubberband.draw(paintFDC); event.gc.drawImage(paintImage, event.x, event.y, event.width, event.height, event.x, event.y, event.width, event.height); } } }); paintCanvas.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent event) { handleResize(); } }); /* Set up the paint canvas scroll bars */ ScrollBar horizontal = paintCanvas.getHorizontalBar(); horizontal.setVisible(true); horizontal.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollHorizontally((ScrollBar)event.widget); } }); ScrollBar vertical = paintCanvas.getVerticalBar(); vertical.setVisible(true); vertical.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollVertically((ScrollBar)event.widget); } }); handleResize(); } /** * Disposes of the PaintSurface's resources. */ public void dispose() { imageFDC.gc.dispose(); image.dispose(); if (paintImage != null) { paintImage.dispose(); paintFDC.gc.dispose(); } currentPosition = null; paintCanvas = null; paintSession = null; image = null; paintImage = null; displayFDC = null; imageFDC = null; paintFDC = null; rubberband = null; statusText = null; statusActionInfo = null; statusMessageInfo = null; statusCoordInfo = null; } /** * Called when we must grab focus. */ public void setFocus() { paintCanvas.setFocus(); } /** * Returns the Display on which the PaintSurface resides. * @return the Display */ public Display getDisplay() { return paintCanvas.getDisplay(); } /** * Returns the Shell in which the PaintSurface resides. * @return the Shell */ public Shell getShell() { return paintCanvas.getShell(); } /**
- * Sets the current paint session. * <p>
- * If oldPaintSession != paintSession calls oldPaintSession.end() * and paintSession.begin() * </p> *
- * @param paintSession the paint session to activate; null to disable all sessions
- */
- public void setPaintSession(PaintSession paintSession) {
- if (this.paintSession != null) { if (this.paintSession == paintSession) return;
- this.paintSession.endSession(); }
- this.paintSession = paintSession;
- clearStatus(); if (paintSession != null) { setStatusAction(paintSession.getDisplayName()); paintSession.beginSession(); } else { setStatusAction(PaintPlugin.getResourceString("tool.Null.label")); setStatusMessage(PaintPlugin.getResourceString("session.Null.message")); } }
-
- /**
- * Returns the current paint session.
- *
- * @return the current paint session, null if none is active
- */
- public PaintSession getPaintSession() {
- return paintSession;
- }
- /** * Returns the current paint tool. * * @return the current paint tool, null if none is active (though some other session * might be) */ public PaintTool getPaintTool() { return (paintSession != null && paintSession instanceof PaintTool) ? (PaintTool)paintSession : null; } /** * Returns the current position in an interactive operation. * * @return the last known position of the pointer */ public Point getCurrentPosition() { return currentPosition; } /** * Draws a Figure object to the screen and to the backing store permanently. * * @param object the object to draw onscreen */ public void drawFigure(Figure object) { object.draw(imageFDC); object.draw(displayFDC); } /** * Adds a Figure object to the active rubberband selection. * <p> * This object will be drawn to the screen as a preview and refreshed appropriately * until the selection is either cleared or committed. * </p> * * @param object the object to add to the selection */ public void addRubberbandSelection(Figure object) { rubberband.add(object); if (! isRubberbandHidden()) object.draw(displayFDC); } /** * Clears the active rubberband selection. * <p> * Erases any rubberband objects on the screen then clears the selection. * </p> */ public void clearRubberbandSelection() { if (! isRubberbandHidden()) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } rubberband.clear(); } /** * Commits the active rubberband selection. * <p> * Redraws any rubberband objects on the screen as permanent objects then clears the selection. * </p> */ public void commitRubberbandSelection() { rubberband.draw(imageFDC); if (isRubberbandHidden()) rubberband.draw(displayFDC); rubberband.clear(); } /** * Hides the rubberband (but does not eliminate it). * <p> * Increments by one the rubberband "hide" nesting count. The rubberband * is hidden from view (but remains active) if it wasn't already hidden. * </p> */ public void hideRubberband() { if (rubberbandHiddenNestingCount++ <= 0) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } } /** * Shows (un-hides) the rubberband. * <p> * Decrements by one the rubberband "hide" nesting count. The rubberband * is only made visible when showRubberband() has been called once for each * previous hideRubberband(). It is not permitted to call showRubberband() if * the rubber band is not presently hidden. * </p> */ public void showRubberband() { if (rubberbandHiddenNestingCount <= 0) throw new IllegalStateException("rubberbandHiddenNestingCount > 0"); if (--rubberbandHiddenNestingCount == 0) { rubberband.draw(displayFDC); } } /** * Determines if the rubberband is hidden. * * @return true iff the rubber is hidden */ public boolean isRubberbandHidden() { return rubberbandHiddenNestingCount > 0; } /** * Handles a horizontal scroll event * * @param scrollbar the horizontal scroll bar that posted this event */ public void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; if (imageWidth > visibleWidth) { final int oldOffset = displayFDC.xOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.xOffset = newOffset; paintCanvas.scroll(Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), 0, visibleWidth, visibleHeight, false); } } } /** * Handles a vertical scroll event * * @param scrollbar the vertical scroll bar that posted this event */ public void scrollVertically(ScrollBar scrollBar) { if (image == null) return; if (imageHeight > visibleHeight) { final int oldOffset = displayFDC.yOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.yOffset = newOffset; paintCanvas.scroll(0, Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), visibleWidth, visibleHeight, false); } } } /** * Handles resize events */ private void handleResize() { paintCanvas.update(); Rectangle visibleRect = paintCanvas.getClientArea(); visibleWidth = visibleRect.width; visibleHeight = visibleRect.height; ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { displayFDC.xOffset = Math.min(horizontal.getSelection(), imageWidth - visibleWidth); if (imageWidth <= visibleWidth) { horizontal.setEnabled(false); horizontal.setSelection(0); } else { final int max = imageWidth - visibleWidth; horizontal.setEnabled(true); horizontal.setValues(displayFDC.xOffset, 0, imageWidth, visibleWidth, 8, visibleWidth); } } ScrollBar vertical = paintCanvas.getVerticalBar(); if (vertical != null) { displayFDC.yOffset = Math.min(vertical.getSelection(), imageHeight - visibleHeight); if (imageHeight <= visibleHeight) { vertical.setEnabled(false); vertical.setSelection(0); } else { final int max = imageHeight - visibleHeight; vertical.setEnabled(true); vertical.setValues(displayFDC.yOffset, 0, imageHeight, visibleHeight, 8, visibleHeight); } } } /** * Virtualizes MouseEvent coordinates and stores the current position. */ private void processMouseEventCoordinates(MouseEvent event) { currentPosition.x = event.x = Math.min(Math.max(event.x, 0), visibleWidth - 1) + displayFDC.xOffset; currentPosition.y = event.y = Math.min(Math.max(event.y, 0), visibleHeight - 1) + displayFDC.yOffset; } /** * Clears the status bar. */ public void clearStatus() { statusActionInfo = ""; statusMessageInfo = ""; statusCoordInfo = ""; updateStatus(); } /** * Sets the status bar action text. * * @param action the action in progress, null to clear */ public void setStatusAction(String action) { statusActionInfo = (action != null) ? action : ""; updateStatus(); } /** * Sets the status bar message text. * * @param message the message to display, null to clear */ public void setStatusMessage(String message) { statusMessageInfo = (message != null) ? message : ""; updateStatus(); } /** * Sets the coordinates in the status bar. * * @param coord the coordinates to display, null to clear */ public void setStatusCoord(Point coord) { statusCoordInfo = (coord != null) ? PaintPlugin.getResourceString("status.Coord.format", new Object[] { new Integer(coord.x), new Integer(coord.y)}) : ""; updateStatus(); } /** * Sets the coordinate range in the status bar. * * @param a the "from" coordinate, must not be null * @param b the "to" coordinate, must not be null */ public void setStatusCoordRange(Point a, Point b) { statusCoordInfo = PaintPlugin.getResourceString("status.CoordRange.format", new Object[] { new Integer(a.x), new Integer(a.y), new Integer(b.x), new Integer(b.y)}); updateStatus(); } /** * Updates the display. */ private void updateStatus() { statusText.setText( PaintPlugin.getResourceString("status.Bar.format", new Object[] { statusActionInfo, statusMessageInfo, statusCoordInfo })); } }
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java
deleted file mode 100755
index f699b868b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- public interface PaintTool extends PaintSession {
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java
deleted file mode 100755
index e8d911cc1b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java
+++ /dev/null
@@ -1,494 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * The view for the paint application.
- * All rendering happens inside the area created by createPartControl().
- *
- * @see ViewPart
- */
-public class PaintView extends ViewPart {
- private Display workbenchDisplay;
-
- // current active settings
- private ToolSettings toolSettings;
-
- // paint surface for drawing
- private PaintSurface paintSurface;
-
- // map action ids to useful data
- private HashMap /* of String to PaintTool */ paintToolMap;
- private HashMap /* of String to Integer */ paintFillTypeMap;
- private HashMap /* of String to Integer */ paintLineStyleMap;
-
- /** UI data **/
- // handle of currently active tool IAction on the UI
- private IAction activeToolAction;
- // handle of currently active filltype IAction on the UI
- private IAction activeFillTypeAction;
- // handle of currently active linetype IAction on the UI
- private IAction activeLineStyleAction;
-
- // handle of active foreground color box Canvas widget
- private Canvas activeForegroundColorCanvas;
- // handle of active background color box Canvas widget
- private Canvas activeBackgroundColorCanvas;
-
- private static final int numPaletteRows = 3;
- private static final int numPaletteCols = 50;
-
- // shared data
- private Color paintColorBlack, paintColorWhite; // alias for paintColors[0] and [1]
- private Color[] paintColors;
- private Font paintDefaultFont; // do not free
-
- /**
- * Constructs a Paint view.
- */
- public PaintView() {
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (paintSurface != null) paintSurface.dispose();
- if (paintColors != null) {
- for (int i = 0; i < paintColors.length; ++i) {
- final Color color = paintColors[i];
- if (color != null) color.dispose();
- }
- }
- paintDefaultFont = null;
- paintColors = null;
- paintSurface = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- paintSurface.setFocus();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- /*** Initialize shared data ***/
- workbenchDisplay = parent.getDisplay();
-
- paintColorWhite = new Color(workbenchDisplay, 255, 255, 255);
- paintColorBlack = new Color(workbenchDisplay, 0, 0, 0);
-
- paintDefaultFont = workbenchDisplay.getSystemFont();
-
- paintColors = new Color[numPaletteCols * numPaletteRows];
- paintColors[0] = paintColorBlack;
- paintColors[1] = paintColorWhite;
- for (int i = 2; i < paintColors.length; i++) {
- paintColors[i] = new Color(workbenchDisplay,
- ((i*7)%255),((i*23)%255), ((i*51)%255));
- }
-
- toolSettings = new ToolSettings();
- toolSettings.commonForegroundColor = paintColorBlack;
- toolSettings.commonBackgroundColor = paintColorWhite;
- toolSettings.commonFont = paintDefaultFont;
-
- /*** Add toolbar contributions ***/
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
-
- toolbarManager.add(new GroupMarker("group.tools"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Pencil"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Airbrush"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Line"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.PolyLine"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Rectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.RoundedRectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Ellipse"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Text"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.fill"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.None"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Outline"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Solid"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.linestyle"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Solid"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dash"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dot"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.DashDot"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options"));
- toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font"));
- actionBars.updateActionBars();
-
- /*** Build GUI ***/
- createGUI(parent);
-
- /*** Set defaults ***/
- setPaintToolByID("tool.Pencil");
- setFillTypeByID("fill.None");
- setLineStyleByID("linestyle.Solid");
- setForegroundColor(paintColorBlack);
- setBackgroundColor(paintColorWhite);
- }
-
- /**
- * Creates the GUI.
- */
- private void createGUI(Composite parent) {
- GridLayout gridLayout;
- GridData gridData;
-
- /*** Create principal GUI layout elements ***/
- Composite displayArea = new Composite(parent, SWT.NONE);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- displayArea.setLayout(gridLayout);
-
- // Creating these elements here avoids the need to instantiate the GUI elements
- // in strict layout order. The natural layout ordering is an artifact of using
- // SWT layouts, but unfortunately it is not the same order as that required to
- // instantiate all of the non-GUI application elements to satisfy referential
- // dependencies. It is possible to reorder the initialization to some extent, but
- // this can be very tedious.
-
- // paint canvas
- final Canvas paintCanvas = new Canvas(displayArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL |
- SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- paintCanvas.setLayoutData(gridData);
- paintCanvas.setBackground(paintColorWhite);
-
- // color selector frame
- final Composite colorFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- colorFrame.setLayoutData(gridData);
-
- // tool settings frame
- final Composite toolSettingsFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- toolSettingsFrame.setLayoutData(gridData);
-
- // status text
- final Text statusText = new Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- statusText.setLayoutData(gridData);
-
- /*** Create the remaining application elements inside the principal GUI layout elements ***/
- // paintSurface
- paintSurface = new PaintSurface(paintCanvas, statusText, paintColorWhite);
-
- // paintToolMap
- paintToolMap = new HashMap();
- paintToolMap.put("tool.Pencil", new PencilTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Airbrush", new AirbrushTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Line", new LineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.PolyLine", new PolyLineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Rectangle", new RectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.RoundedRectangle", new RoundedRectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Ellipse", new EllipseTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Text", new TextTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Null", null);
-
- // paintFillTypeMap
- paintFillTypeMap = new HashMap();
- paintFillTypeMap.put("fill.None", new Integer(ToolSettings.ftNone));
- paintFillTypeMap.put("fill.Outline", new Integer(ToolSettings.ftOutline));
- paintFillTypeMap.put("fill.Solid", new Integer(ToolSettings.ftSolid));
-
- // paintLineStyleMap
- paintLineStyleMap = new HashMap();
- paintLineStyleMap.put("linestyle.Solid", new Integer(SWT.LINE_SOLID));
- paintLineStyleMap.put("linestyle.Dash", new Integer(SWT.LINE_DASH));
- paintLineStyleMap.put("linestyle.Dot", new Integer(SWT.LINE_DOT));
- paintLineStyleMap.put("linestyle.DashDot", new Integer(SWT.LINE_DASHDOT));
-
- // colorFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- colorFrame.setLayout(gridLayout);
-
- // activeForegroundColorCanvas, activeBackgroundColorCanvas
- activeForegroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeForegroundColorCanvas.setLayoutData(gridData);
-
- activeBackgroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeBackgroundColorCanvas.setLayoutData(gridData);
-
- // paletteCanvas
- final Canvas paletteCanvas = new Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 24;
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent(Event e) {
- Rectangle bounds = paletteCanvas.getClientArea();
- Color color = getColorAt(bounds, e.x, e.y);
-
- if (e.button == 1) setForegroundColor(color);
- else setBackgroundColor(color);
- }
- private Color getColorAt(Rectangle bounds, int x, int y) {
- if (bounds.height <= 1 && bounds.width <= 1) return paintColorWhite;
- final int row = (y - bounds.y) * numPaletteRows / bounds.height;
- final int col = (x - bounds.x) * numPaletteCols / bounds.width;
- return paintColors[Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)];
- }
- });
- Listener refreshListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.gc == null) return;
- Rectangle bounds = paletteCanvas.getClientArea();
- for (int row = 0; row < numPaletteRows; ++row) {
- for (int col = 0; col < numPaletteCols; ++col) {
- final int x = bounds.width * col / numPaletteCols;
- final int y = bounds.height * row / numPaletteRows;
- final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1);
- final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1);
- e.gc.setBackground(paintColors[row * numPaletteCols + col]);
- e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height);
- }
- }
- }
- };
- paletteCanvas.addListener(SWT.Resize, refreshListener);
- paletteCanvas.addListener(SWT.Paint, refreshListener);
- //paletteCanvas.redraw();
-
- // toolSettingsFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 4;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- toolSettingsFrame.setLayout(gridLayout);
-
- Label label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushRadius.text"));
-
- final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushRadiusScale.setMinimum(5);
- airbrushRadiusScale.setMaximum(50);
- airbrushRadiusScale.setSelection(toolSettings.airbrushRadius);
- airbrushRadiusScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushRadiusScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushRadius = airbrushRadiusScale.getSelection();
- updateToolSettings();
- }
- });
-
- label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushIntensity.text"));
-
- final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushIntensityScale.setMinimum(1);
- airbrushIntensityScale.setMaximum(100);
- airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity);
- airbrushIntensityScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushIntensityScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection();
- updateToolSettings();
- }
- });
- }
-
- /**
- * Notifies the tool that its settings have changed.
- */
- private void updateToolSettings() {
- final PaintTool activePaintTool = paintSurface.getPaintTool();
- if (activePaintTool == null) return;
-
- activePaintTool.endSession();
- activePaintTool.set(toolSettings);
- activePaintTool.beginSession();
- }
-
- /**
- * Sets the tool foreground color.
- *
- * @param color the new color to use
- */
- public void setForegroundColor(Color color) {
- if (activeForegroundColorCanvas != null)
- activeForegroundColorCanvas.setBackground(color);
- toolSettings.commonForegroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Set the tool background color.
- *
- * @param color the new color to use
- */
- public void setBackgroundColor(Color color) {
- if (activeBackgroundColorCanvas != null)
- activeBackgroundColorCanvas.setBackground(color);
- toolSettings.commonBackgroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Selects a tool given its ID.
- */
- public void setPaintToolByID(String id) {
- activeToolAction = handleRadioAction(activeToolAction, id);
-
- final PaintTool paintTool = (PaintTool) paintToolMap.get(id);
- paintSurface.setPaintSession(paintTool);
- updateToolSettings();
- }
-
- /**
- * Selects a filltype given its ID.
- */
- public void setFillTypeByID(String id) {
- activeFillTypeAction = handleRadioAction(activeFillTypeAction, id);
-
- final Integer fillType = (Integer) paintFillTypeMap.get(id);
- toolSettings.commonFillType = fillType.intValue();
- updateToolSettings();
- }
-
- /**
- * Selects line type given its ID.
- */
- public void setLineStyleByID(String id) {
- activeLineStyleAction = handleRadioAction(activeLineStyleAction, id);
-
- final Integer lineType = (Integer) paintLineStyleMap.get(id);
- toolSettings.commonLineStyle = lineType.intValue();
- updateToolSettings();
- }
-
- /**
- * Gets the IAction for an ID belonging to a set of mutually exclusive actions, and
- * toggles the old action off if necessary.
- */
- private IAction handleRadioAction(IAction oldAction, String id) {
- IAction action = getActionByID(id);
- if (action != null) {
- if (oldAction != null) oldAction.setChecked(false);
- if (! action.isChecked()) action.setChecked(true);
- return action;
- }
- return oldAction;
- }
-
- /**
- * Gets the IAction representing the UI toolbar button with the specified ID.
- */
- private IAction getActionByID(String id) {
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
- ActionContributionItem contributionItem = (ActionContributionItem) toolbarManager.find(id);
- if (contributionItem == null) return null;
- return contributionItem.getAction();
- }
-
- /**
- * Returns the Display.
- *
- * @return the display we're using
- */
- public Display getDisplay() {
- return workbenchDisplay;
- }
-
- /**
- * Action set glue.
- */
- abstract class PaintAction extends Action {
- public PaintAction(String id) {
- super();
- setId(id);
-
- try {
- final URL installUrl = PaintPlugin.getDefault().getDescriptor().getInstallURL();
- final URL imageUrl = new URL(installUrl, PaintPlugin.getResourceString(id + ".image"));
- setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));
- } catch (MalformedURLException e) {
- PaintPlugin.logError("", e);
- }
-
- setText(PaintPlugin.getResourceString(id + ".label"));
- setToolTipText(PaintPlugin.getResourceString(id + ".tooltip"));
- setDescription(PaintPlugin.getResourceString(id + ".description"));
- }
- }
- class SelectPaintToolAction extends PaintAction {
- public SelectPaintToolAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setPaintToolByID(getId()); }
-
- }
- class SelectFillTypeAction extends PaintAction {
- public SelectFillTypeAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setFillTypeByID(getId()); }
- }
- class SelectLineStyleAction extends PaintAction {
- public SelectLineStyleAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setLineStyleByID(getId()); }
- }
- class SelectFontAction extends PaintAction {
- public SelectFontAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_PUSH_BUTTON; }
- public void run() {
- FontDialog fontDialog = new FontDialog(paintSurface.getShell(), SWT.PRIMARY_MODAL);
- FontData[] fontDatum = toolSettings.commonFont.getFontData();
- if (fontDatum != null && fontDatum.length > 0) {
- fontDialog.setFontData(fontDatum[0]);
- }
- fontDialog.setText(PaintPlugin.getResourceString("options.Font.dialog.title"));
-
- paintSurface.hideRubberband();
- FontData fontData = fontDialog.open();
- paintSurface.showRubberband();
- if (fontData != null) {
- try {
- Font font = new Font(workbenchDisplay, fontData);
- toolSettings.commonFont = font;
- updateToolSettings();
- } catch (SWTException e) {
- }
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java
deleted file mode 100755
index 69f52d8612..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * A pencil tool.
- */
-public class PencilTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a pencil tool.
- *
- * @param toolSettings the new tool settings
- * @param getPaintSurface() the PaintSurface we will render on.
- */
- public PencilTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Pencil.label");
- }
-
- /*
- * Template method for drawing
- */
- public void render(final Point point) {
- final PaintSurface ps = getPaintSurface();
- ps.drawFigure(new PointFigure(settings.commonForegroundColor, point.x, point.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java
deleted file mode 100644
index a93da19f9c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Point object
- */
-public class PointFigure extends Figure {
- private Color color;
- private int x, y;
- /**
- * Constructs a Point
- *
- * @param color the color for this object
- * @param x the virtual X coordinate of the first end-point
- * @param y the virtual Y coordinate of the first end-point
- */
- public PointFigure(Color color, int x, int y) {
- this.color = color; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(p.x, p.y, 1, 1);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x, y, x, y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
deleted file mode 100755
index 973e152695..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A polyline drawing tool.
- */
-public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a PolyLineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public PolyLineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.PolyLine.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
- ContainerFigure container = new ContainerFigure();
- if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
- container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
- }
- if (! closed || settings.commonFillType != ToolSettings.ftSolid || numPoints < 3) {
- for (int i = 0; i < numPoints - 1; ++i) {
- final Point a = points[i];
- final Point b = points[i + 1];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- if (closed) {
- final Point a = points[points.length - 1];
- final Point b = points[0];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- }
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
deleted file mode 100755
index b6bf01462b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
deleted file mode 100755
index 555280150c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Rectangle.label");
- }
-
- /*
- * Template method for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- switch (settings.commonFillType) {
- default:
- case ToolSettings.ftNone:
- return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- case ToolSettings.ftSolid:
- return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftOutline: {
- ContainerFigure container = new ContainerFigure();
- container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
deleted file mode 100755
index ec561dd454..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RoundedRectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2, diameter;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
deleted file mode 100755
index e649b40005..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RoundedRectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RoundedRectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RoundedRectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.RoundedRectangle.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor,
- a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor,
- settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
deleted file mode 100755
index 5085ab1bf2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-import java.util.*;
-
-/**
- * The superclass for paint tools that contruct objects from individually
- * picked segments.
- */
-public abstract class SegmentedPaintSession extends BasicPaintSession {
- /**
- * The set of control points making up the segmented selection
- */
- private Vector /* of Point */ controlPoints = new Vector();
-
- /**
- * The previous figure (so that we can abort with right-button)
- */
- private Figure previousFigure = null;
-
- /**
- * The current figure (so that we can abort with right-button)
- */
- private Figure currentFigure = null;
-
- /**
- * Constructs a PaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected SegmentedPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.interactiveMode"));
- previousFigure = currentFigure;
-
- if (controlPoints.size() > 0) {
- final Point lastPoint = (Point) controlPoints.elementAt(controlPoints.size() - 1);
- if (lastPoint.x == event.x || lastPoint.y == event.y) return; // spurious event
- }
- controlPoints.add(new Point(event.x, event.y));
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- if (event.button != 1) return;
- if (controlPoints.size() >= 2) {
- getPaintSurface().clearRubberbandSelection();
- previousFigure = createFigure(
- (Point[]) controlPoints.toArray(new Point[controlPoints.size()]),
- controlPoints.size(), true);
- }
- resetSession();
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (controlPoints.size() == 0) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return; // spurious event
- } else {
- ps.setStatusCoordRange((Point) controlPoints.elementAt(controlPoints.size() - 1),
- ps.getCurrentPosition());
- }
-
- ps.clearRubberbandSelection();
- Point[] points = (Point[]) controlPoints.toArray(new Point[controlPoints.size() + 1]);
- points[controlPoints.size()] = ps.getCurrentPosition();
- currentFigure = createFigure(points, points.length, false);
- ps.addRubberbandSelection(currentFigure);
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param points the array of control points
- * @param numPoints the number of valid points in the array (n >= 2)
- * @param closed true if the user double-clicked on the final control point
- */
- protected abstract Figure createFigure(Point[] points, int numPoints, boolean closed);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
deleted file mode 100755
index 8f481eb474..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Solid Ellipse object
- */
-public class SolidEllipseFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidEllipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidEllipseFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillOval(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
deleted file mode 100755
index 22b06ca958..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class SolidPolygonFigure extends Figure {
- private Color color;
- private int[] points;
- /**
- * Constructs a SolidPolygon
- * These objects are defined by a sequence of vertices.
- *
- * @param color the color for this object
- * @param vertices the array of vertices making up the polygon
- * @param numPoint the number of valid points in the array (n >= 3)
- */
- public SolidPolygonFigure(Color color, Point[] vertices, int numPoints) {
- this.color = color;
- this.points = new int[numPoints * 2];
- for (int i = 0; i < numPoints; ++i) {
- points[i * 2] = vertices[i].x;
- points[i * 2 + 1] = vertices[i].y;
- }
- }
- public void draw(FigureDrawContext fdc) {
- int[] drawPoints = new int[points.length];
- for (int i = 0; i < points.length; i += 2) {
- drawPoints[i] = points[i] * fdc.xScale - fdc.xOffset;
- drawPoints[i + 1] = points[i + 1] * fdc.yScale - fdc.yOffset;
- }
- fdc.gc.setBackground(color);
- fdc.gc.fillPolygon(drawPoints);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- int xmin = Integer.MAX_VALUE, ymin = Integer.MAX_VALUE;
- int xmax = Integer.MIN_VALUE, ymax = Integer.MIN_VALUE;
-
- for (int i = 0; i < points.length; i += 2) {
- if (points[i] < xmin) xmin = points[i];
- if (points[i] > xmax) xmax = points[i];
- if (points[i+1] < ymin) ymin = points[i+1];
- if (points[i+1] > ymax) ymax = points[i+1];
- }
- region.add(fdc.toClientRectangle(xmin, ymin, xmax, ymax));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
deleted file mode 100755
index f1146a5736..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidRectangleFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
deleted file mode 100755
index bb57338e75..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRoundedRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2, diameter;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public SolidRoundedRectangleFigure(Color color, int x1, int y1, int x2, int y2, int diameter) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRoundRectangle(r.x, r.y, r.width, r.height, diameter, diameter);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
deleted file mode 100755
index a8f1b077ff..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class TextFigure extends Figure {
- private Color color;
- private Font font;
- private String text;
- private int x, y;
- /**
- * Constructs a TextFigure
- *
- * @param color the color for this object
- * @param font the font for this object
- * @param text the text to draw, tab and new-line expansion is performed
- * @param x the virtual X coordinate of the top-left corner of the text bounding box
- * @param y the virtual Y coordinate of the top-left corner of the text bounding box
- */
- public TextFigure(Color color, Font font, String text, int x, int y) {
- this.color = color; this.font = font; this.text = text; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setFont(font);
- fdc.gc.setForeground(color);
- fdc.gc.drawText(text, p.x, p.y, true);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- Font oldFont = fdc.gc.getFont();
- fdc.gc.setFont(font);
- Point textExtent = fdc.gc.textExtent(text);
- fdc.gc.setFont(oldFont);
- region.add(fdc.toClientRectangle(x, y, x + textExtent.x, y + textExtent.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java
deleted file mode 100755
index 22831e81bf..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A text drawing tool.
- */
-public class TextTool extends BasicPaintSession implements PaintTool {
- private ToolSettings settings;
- private String drawText = PaintPlugin.getResourceString("tool.Text.settings.defaulttext");
-
- /**
- * Constructs a PaintTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public TextTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Text.label");
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.Text.message"));
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button == 1) {
- // draw with left mouse button
- getPaintSurface().commitRubberbandSelection();
- } else {
- // set text with right mouse button
- getPaintSurface().clearRubberbandSelection();
- InputDialog inputDialog = new InputDialog(getPaintSurface().getShell(),
- PaintPlugin.getResourceString("tool.Text.dialog.title"),
- PaintPlugin.getResourceString("tool.Text.dialog.message"),
- drawText, null);
- inputDialog.setBlockOnOpen(true);
- inputDialog.open();
- if (inputDialog.getReturnCode() == InputDialog.OK) drawText = inputDialog.getValue();
- inputDialog.close();
- }
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- ps.addRubberbandSelection(
- new TextFigure(settings.commonForegroundColor, settings.commonFont,
- drawText, event.x, event.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java
deleted file mode 100755
index 6d41a27dd8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.*; import org.eclipse.swt.graphics.*;
- /** * Tool Settings objects group tool-related configuration information. */
-public class ToolSettings {
- public static final int ftNone = 0, ftOutline = 1, ftSolid = 2; /**
- * commonForegroundColor: current tool foreground colour
- */
- public Color commonForegroundColor;
-
- /**
- * commonBackgroundColor: current tool background colour
- */
- public Color commonBackgroundColor;
- /** * commonFont: current font */ public Font commonFont; /** * commonFillType: current fill type * <p>One of ftNone, ftOutline, ftSolid.</p> */ public int commonFillType = ftNone; /** * commonLineStyle: current line type */ public int commonLineStyle = SWT.LINE_SOLID;
- /**
- * airbrushRadius: coverage radius in pixels
- */
- public int airbrushRadius = 10;
-
- /**
- * airbrushIntensity: average surface area coverage in region defined by radius per "jot"
- */
- public int airbrushIntensity = 30; /** * roundedRectangleCornerDiameter: the diameter of curvature of corners in a rounded rectangle */ public int roundedRectangleCornerDiameter = 16; }
diff --git a/examples/org.eclipse.swt.examples/.classpath b/examples/org.eclipse.swt.examples/.classpath
deleted file mode 100755
index fcdab9873a..0000000000
--- a/examples/org.eclipse.swt.examples/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples/.cvsignore b/examples/org.eclipse.swt.examples/.cvsignore
deleted file mode 100755
index c5e82d7458..0000000000
--- a/examples/org.eclipse.swt.examples/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/.vcm_meta b/examples/org.eclipse.swt.examples/.vcm_meta
deleted file mode 100755
index e9dbb98bc0..0000000000
--- a/examples/org.eclipse.swt.examples/.vcm_meta
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples/about.html b/examples/org.eclipse.swt.examples/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/examples/org.eclipse.swt.examples/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/build.properties b/examples/org.eclipse.swt.examples/build.properties
deleted file mode 100755
index 70c4a0b177..0000000000
--- a/examples/org.eclipse.swt.examples/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-bin.includes = doc-html/,\
- plugin.properties,\
- plugin.xml,\
- swtexamples.jar
-
-source.swtexamples.jar = /org/,\
- examples_addressbook.properties,\
- import.properties,\
- examples_control.properties,\
- examples_fileviewer.properties,\
- examples_helloworld.properties,\
- examples_hoverhelp.properties,\
- examples_images.properties,\
- examples_javaviewer.properties,\
- examples_texteditor.properties
diff --git a/examples/org.eclipse.swt.examples/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html
deleted file mode 100755
index c73a47cc44..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Address Book Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Address Book</h2>
-
-<h3>Introduction</h3>
-<p>
-The AddressBook example shows how the org.eclipse.swt.Table class can be
-used to present tabular information.
-</p>
-
-<h3>Running the example</h3>
-<p>
-If the Example Launcher is installed, select the Address Book item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.addressbook.AddressBook</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-The application can save and load address books, sort the entries, search for strings within the fields and
-perform other operations that would typically be found in this kind of application.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_control_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_control_ex.html
deleted file mode 100755
index 2d3da944b3..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_control_ex.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Controls Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Controls</h2>
-
-<h3>Introduction</h3>
-<p>This example is a simple demonstration of common Standard Widget Toolkit
-(SWT) UI controls.&nbsp; It consists of a shell and tab folder where each
-tab in the folder allows the user to interact with a control.
-</p><p>
-This is a standalone version of the <a href="../../org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html">Controls
-Example.</a>
-</p>
-
-<h3>Running the example</h3>
-<p>Install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.controlexample.ControlExample</code>.
-</p>
-
-<h3>Details</h3>
-<p>Each page (tab) of the controls example allows the user to interact with
-a different SWT control.&nbsp; The name of the control being demonstrated
-is on the page tab.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html
deleted file mode 100755
index 55d1502232..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - File Viewer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - File Viewer</h2>
-
-<h3>Introduction</h3>
-<p>The File Viewer example shows how a simple application can be implemented
-using SWT.&nbsp; This application provides the ability to browse files
-and folders.&nbsp; It includes the use of alternate threads for long actions
-and demonstrates the use of the Tree, Table, Toolbar and Program.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the File Viewer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.fileviewer.FileViewer</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html
deleted file mode 100755
index 8e970b20d2..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Hello World Examples</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Hello World</h2>
-
-<h3>Introduction</h3>
-<p>The Hello World examples shows how to create a shell, use listeners, process
-events, and use SWT controls.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Hello World [1-5] item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable classes are
-<code>org.eclipse.swt.examples.helloworld.HelloWorld[1-5]</code>.
-</p>
-
-<h3>Details</h3>
-
-<h4>Hello World 1</h4>
-<p>This example demonstrates the minimum amount of code required to open an
-SWT Shell and process the events.
-</p>
-
-<h4>Hello World 2</h4>
-<p>This example builds on HelloWorld1 and demonstrates the minimum amount
-of code required to open an SWT Shell with a Label and process the events.
-</p>
-
-<h4>Hello World 3</h4>
-<p>This example builds on HelloWorld2 and demonstrates how to resize the Label
-when the Shell resizes using a Listener mechanism.
-</p>
-
-<h4>Hello World 4</h4>
-<p>This example builds on HelloWorld2 and demonstrates how to resize the Label
-when the Shell resizes using a Layout.
-</p>
-
-<h4>Hello World 5</h4>
-<p>This example builds on HelloWorld1 and demonstrates how to draw directly
-on an SWT Control.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html
deleted file mode 100755
index 467a18d371..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Explorer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Hover Help</h2>
-
-<h3>Introduction</h3>
-<p>The Hover Help example shows how to implement custom tooltips and
-hover help support on a number of different SWT controls including
-Buttons, TableItems, ToolItems and TreeItems.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Hover Help item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.hoverhelp.HoverHelp</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example implements its own tooltip and hover help support.&nbsp; To see
-the custom tooltips in action, hover over an item or button in the UI.&nbsp;
-Notice that images appear in the left-hand corner of the tooltip, unlike
-standard SWT tooltips created using setToolTip() on those widgets
-that natively support them.&nbsp; To see the custom hover help in action,
-hover over an item or button in the UI as before until the tooltip
-is displayed.&nbsp; Without moving the pointer, hit F1.&nbsp; A new Shell will
-pop up with the extended hover help information for the UI element
-in question.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html
deleted file mode 100755
index b1e9af0da4..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Image Analyzer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Image Analyzer</h2>
-
-<h3>Introduction</h3>
-<p>The ImageAnalyzer opens image files and displays the visual contents of
-the file along with a summary of the data in the image file.&nbsp; The
-user can make adjustments to various elements of the image such as scaling
-and Alpha blending and can save these changes to a file.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Image Analyzer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG.&nbsp;
-To open a file, use the File->Open... menu item, and select the image file in the FileDialog.
-</p><p>
-If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected,
-then the ImageAnalyzer displays the image increments as they are being loaded.
-</p><p>
-If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled,
-and they can be used to cycle through the images in the file, or animate them.&nbsp; If a GIF defines a background color,
-as many animated GIFs do, selecting Background will use the GIF's background color.
-</p><p>
-If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency
-mask to the right of the image.&nbsp; You can change the background color of the ImageAnalyzer to see the transparency work.&nbsp;
-To turn off the transparency, deselect Display Transparency.
-</p><p>
-After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos,
-and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.
-</p><p>
-File->Save As... can be used to save the currently loaded image to another type of image file.&nbsp; If the image has transparency,
-File->Save Mask As... saves the image's transparency mask.
-</p><p>
-When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created.&nbsp; (In the case of an ICO file or
-multi-image GIF, an array of ImageData instances is created).&nbsp; The ImageAnalyzer displays all of the data stored in the ImageData
-instance(s) for the currently loaded image file, including the pixel data.&nbsp; Hovering over a pixel in the image display will show the RGB
-color data for that pixel.&nbsp; For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader
-instance used to load the image.&nbsp; The ImageAnalyzer displays this data as well.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html
deleted file mode 100755
index fdad5c3b07..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Java Syntax Viewer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Java Syntax Viewer</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to implement a user-defined line styler for
-the StyledText widget.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Java Viewer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.javaviewer.JavaViewer</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example provides a typical editor interface.&nbsp; To see the effect of the line
-styler, open a *.java file.&nbsp; When the contents of the file are displayed in the
-editor area, notice that the keywords have been highlighted.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html b/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
deleted file mode 100755
index cb6b54720e..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT Standalone Examples Manual Setup</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) - Standalone Examples Manual Setup</h2>
-
-<h3>Setup</h3>
-<p>There are several steps required to run the SWT standalone examples manually.
-</p>
-
-<ul>
-<li><p>
-Create a Java Project to contain the examples.&nbsp; Call it <b>SWT Examples</b>.
-</p>
-
-<li><p>
-Make sure the <b>swt.jar</b> file is on the java classpath, by doing the following:<br>
-Select the SWT Examples Project and bring up the Properties dialog.<br>
-On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swt.jar</b>.<br>
-Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtsrc.zip</b>.<br>
-The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/
-</ul>
-Click OK to save the Project properties.<br>
-</p>
-
-<li><p>
-Make sure the <b>swtexamples.jar</b> is on the java classpath, by doing the following:<br>
-Select the SWT Examples Project and bring up the Properties dialog.<br>
-On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swtexamples.jar</b>.<br>
-Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtexamplessrc.zip</b>.<br>
-The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt.examples\
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt.examples/
-</ul>
-Click OK to save the Project properties.<br>
-</p>
-
-<li><p>
-Make sure that referenced libraries are visible in the Packages view, by doing the following:<br>
-In the Packages view of the Java Perspective, drop down the View menu.<br>
-Ensure that <b>Show Referenced Libraries</b> is checked.
-</p>
-
-<li><p>
-Make sure the <b>SWT runtime library</b> is in the library search path, by doing the following:<br>
-In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.<br>
-You will see all of the packages and other resource files present in the jar file, including the executable class for each example.<br>
-Select the executable class (the one containing the main() method) for the particular example that you wish to run and bring up the Properties dialog.<br>
-On the Execution Arguments page, select the VM arguments field and enter <b>-Djava.library.path=&lt;runtime-library-path&gt;</b>.<br>
-The runtime library path is the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\ws\win32
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/ws/motif
-</ul>
-Click OK to save the Java Resource properties.<br>
-</p>
-
-</ul>
-
-<h3><a NAME="Run"></a>Running the Examples</h3>
-<p>In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.&nbsp;
-You will see all of the packages and other resource files present in the jar file,
-including the executable class for each example.
-</p>
-<p>All of the standalone SWT examples are intended to be run as Java
-Applications.&nbsp; No parameters need be passed to any of these examples,
-other than any required VM arguments.&nbsp; To run an example, simply
-select the executable class for the particular example, then click the Run button on the toolbar.
-</p>
-
-<h3><a NAME="Package"></a>Examples Manifest</h3>
-<p>Consult the documentation of each individual example for the names of
-its executable class(es) and additional details.
-</p>
-<p>
-<code>swtexamples.jar</code> contains the following examples:
-<ul>
-<li><a href="swt_addressbook_ex.html">Address Book</a>
-<li><a href="swt_fileviewer_ex.html">File Viewer</a>
-<li><a href="swt_helloworld_ex.html">Hello World [1-5]</a>
-<li><a href="swt_hoverhelp_ex.html">Hover Help</a>
-<li><a href="swt_imageanalyzer_ex.html">Image Analyzer</a>
-<li><a href="swt_javaviewer_ex.html">Java Viewer</a>
-<li><a href="swt_texteditor_ex.html">Text Editor</a>
-</ul>
-</p>
-
-<p><br><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html
deleted file mode 100755
index fba54b490b..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Text Editor Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Text Editor</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to use the StyledText widget to implement
-a text editor with formatting support.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Text Editor item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.texteditor.TextEditor</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example has a typical text editor interface.&nbsp; The File menu contains Cut, Copy, Paste and Set Font
-items and the toolbar provides a bold text toggle, three colour tools that operate on the current selection,
-and a reset to defaults button that also operates on the current selection.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/examples_addressbook.properties b/examples/org.eclipse.swt.examples/examples_addressbook.properties
deleted file mode 100755
index b416bed826..0000000000
--- a/examples/org.eclipse.swt.examples/examples_addressbook.properties
+++ /dev/null
@@ -1,59 +0,0 @@
-Last_name = Last Name
-First_name = First Name
-Business_phone = Business Phone
-Home_phone = Home Phone
-Email = Email
-Fax = Fax
-Close_save = The address book contents have changed.\nDo you want to save the changes?
-New_title = Untitled
-Column = Column:
-Book_extension = .adr
-Book_filter_name = Address Books
-All_filter_name = All Files
-File = File
-Does_not_exist = does not exist.
-File_not_found = File not found:
-IO_error_read = IO error reading text file:
-IO_error_write = IO error writing text file:
-IO_error_close = IO error closing text file:
-Title_bar = Address Book -
-Save_as_title = Save As
-Query_overwrite = already exists.\nDo you want to replace it?
-File_menu_title = &File
-New_contact = &New Contact\tCtrl+N
-Edit_contact = &Edit Contact\tCtrl+E
-New_address_book = New Address &Book\tCtrl+B
-Open_address_book = &Open Address Book\tCtrl+O
-Save_address_book = &Save Address Book\tCtrl+S
-Save_book_as = Save &Address Book As
-Exit = E&xit
-Edit_menu_title = &Edit
-Edit = &Edit\tCtrl+E
-Copy = &Copy\tCtrl+C
-Paste = &Paste\tCtrl+V
-Delete = De&lete\tDel
-Sort = &Sort
-Search_menu_title = &Search
-Find = &Find...\tCtrl+F
-Find_next = Find &Next...\tF3
-Pop_up_new = &New
-Pop_up_edit = &Edit
-Pop_up_copy = &Copy
-Pop_up_paste = &Paste
-Pop_up_delete = &Delete
-Pop_up_find = &Find...
-Help_menu_title = &Help
-About = &About Address Book...
-About_1 = About
-About_2 = \nversion 1.0
-OK = OK
-Cancel = Cancel
-Search_dialog_title = Find
-Dialog_find_what = Fi&nd what:
-Dialog_match_case = Match &case
-Dialog_match_word = Match &whole word
-Dialog_direction = Direction
-Dialog_dir_up = &Up
-Dialog_dir_down = &Down
-Dialog_find = &Find
-Cannot_find = Cannot find \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_control.properties b/examples/org.eclipse.swt.examples/examples_control.properties
deleted file mode 100755
index 973bae141d..0000000000
--- a/examples/org.eclipse.swt.examples/examples_control.properties
+++ /dev/null
@@ -1,181 +0,0 @@
-error.CouldNotLoadResources = Unable to load resources
-window.title = SWT Controls
-
-Text_Buttons = Text Buttons
-Size = Size
-Alignment = Alignment
-Left = Left
-Right = Right
-Up = Up
-Down = Down
-Center = Center
-One = One
-Two = Two
-Three = Three
-Image_Buttons = Image Buttons
-Control_Example = Control Example
-Parameters = Parameters
-State = State
-Enabled = Enabled
-Visible = Visible
-Preferred = Preferred
-Styles = Styles
-Text_Labels = Text Labels
-Image_Labels = Image Labels
-One_Two_Three = One Two Three
-Text_ToolBar = Text ToolBar
-Image_ToolBar = Image ToolBar
-Maximum = Maximum
-Minimum = Minimum
-Selection = Selection
-Increment = Increment
-Page_Increment = Page Increment
-Thumb = Thumb
-Tree_With_Images = Tree With Images
-Dialog_Type = Dialog Type
-Create_Dialog = Create Dialog
-Button_Styles = Button Styles
-Icon_Styles = Icon Styles
-Modal_Styles = Modal Styles
-File_Dialog_Styles = File Dialog Styles
-Dialog_Result = Dialog Result
-ColorDialog = ColorDialog
-DirectoryDialog = DirectoryDialog
-FileDialog = FileDialog
-FontDialog = FontDialog
-MessageBox = MessageBox
-Multi_line = A multi line text widget.
-Example_string = The quick brown fox jumps over the lazy dog.
-Header_Visible = Header Visible
-Lines_Visible = Lines Visible
-Node_1 = Node 1
-Node_2 = Node 2
-Node_3 = Node 3
-Node_4 = Node 4
-Node_1_1 = Node 1.1
-Node_2_1 = Node 2.1
-Node_3_1 = Node 3.1
-Node_2_2 = Node 2.2
-Node_2_2_1 = Node 2.2.1
-Parent = Parent
-No_Parent = No Parent
-Decoration_Styles = Decoration Styles
-Create_Shell = Create Shell
-Close_All_Shells = Close All Shells
-Push = Push
-Radio = Radio
-Check = Check
-Drop_Down = Drop Down
-Images_failed = Warning: Failed to load images
-readme_txt = readme.txt
-Index = Index:
-Title = Title:
-Result = Result:
-FilterName_0 = Text Files
-FilterName_1 = Batch Files
-FilterName_2 = Doc Files
-TableTitle_0 = Name
-TableTitle_1 = Type
-TableTitle_2 = Size
-TableTitle_3 = Modified
-TableLine0_0 = <empty>
-TableLine0_1 = classes
-TableLine0_2 = 0
-TableLine0_3 = today
-TableLine1_0 = <empty>
-TableLine1_1 = databases
-TableLine1_2 = 2556
-TableLine1_3 = <empty>
-TableLine2_0 = <empty>
-TableLine2_1 = images
-TableLine2_2 = 91571
-TableLine2_3 = yesterday
-ListData0_0 = Line 1
-ListData0_1 = Line 2
-ListData0_2 = Line 3
-ListData0_3 = Line 4
-ListData0_4 = Line 5
-ListData0_5 = Line 6
-ListData0_6 = Line 7
-ListData0_7 = Line 8
-ListData0_8 = Longest Line In List
-ListData1_0 = Apples
-ListData1_1 = Oranges
-ListData1_2 = Bananas
-ListData1_3 = Grapefruit
-ListData1_4 = Peaches
-ListData1_5 = Kiwi
-ListData1_6 = Apricots
-ListData1_7 = Strawberries
-ListData1_8 = The Longest String
-DropDownData_0 = Apples
-DropDownData_1 = Oranges
-DropDownData_2 =
-DropDownData_3 = Grapefruit
-DropDownData_4 = Peaches
-DropDownData_5 = Kiwi
-DropDownData_6 =
-DropDownData_7 = Strawberries
-DropDownData_8 = The Longest String
-Button = Button
-Combo = Combo
-Dialog = Dialog
-Label = Label
-List = List
-ProgressBar = ProgressBar
-Sash = Sash
-Shell = Shell
-Slider_and_Scale = Slider and Scale
-Table = Table
-Text = Text
-ToolBar = ToolBar
-Tree = Tree
-StyledText = StyledText
-Slider = Slider
-Scale = Scale
-SWT_PUSH = SWT.PUSH
-SWT_CHECK = SWT.CHECK
-SWT_RADIO = SWT.RADIO
-SWT_TOGGLE = SWT.TOGGLE
-SWT_ARROW = SWT.ARROW
-SWT_BORDER = SWT.BORDER
-SWT_DROP_DOWN = SWT.DROP_DOWN
-SWT_READ_ONLY = SWT.READ_ONLY
-SWT_SIMPLE = SWT.SIMPLE
-SWT_SEPARATOR = SWT.SEPARATOR
-SWT_HORIZONTAL = SWT.HORIZONTAL
-SWT_VERTICAL = SWT.VERTICAL
-SWT_SHADOW_IN = SWT.SHADOW_IN
-SWT_SHADOW_OUT = SWT.SHADOW_OUT
-SWT_SINGLE = SWT.SINGLE
-SWT_MULTI = SWT.MULTI
-SWT_H_SCROLL = SWT.H_SCROLL
-SWT_V_SCROLL = SWT.V_SCROLL
-SWT_FLAT = SWT.FLAT
-SWT_WRAP = SWT.WRAP
-SWT_SAVE = SWT.SAVE
-SWT_OPEN = SWT.OPEN
-SWT_PRIMARY_MODAL = SWT.PRIMARY_MODAL
-SWT_APPLICATION_MODAL = SWT.APPLICATION_MODAL
-SWT_SYSTEM_MODAL = SWT.SYSTEM_MODAL
-SWT_MODELESS = SWT.MODELESS
-SWT_ICON_ERROR = SWT.ICON_ERROR
-SWT_ICON_INFORMATION = SWT.ICON_INFORMATION
-SWT_ICON_QUESTION = SWT.ICON_QUESTION
-SWT_ICON_WARNING = SWT.ICON_WARNING
-SWT_ICON_WORKING = SWT.ICON_WORKING
-SWT_OK = SWT.OK
-SWT_CANCEL = SWT.CANCEL
-SWT_YES = SWT.YES
-SWT_NO = SWT.NO
-SWT_RETRY = SWT.RETRY
-SWT_ABORT = SWT.ABORT
-SWT_IGNORE = SWT.IGNORE
-SWT_NO_TRIM = SWT.NO_TRIM
-SWT_CLOSE = SWT.CLOSE
-SWT_TITLE = SWT.TITLE
-SWT_MIN = SWT.MIN
-SWT_MAX = SWT.MAX
-SWT_RESIZE = SWT.RESIZE
-SWT_FULL_SELECTION = SWT.FULL_SELECTION
-SWT_SMOOTH = SWT.SMOOTH \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_fileviewer.properties b/examples/org.eclipse.swt.examples/examples_fileviewer.properties
deleted file mode 100755
index 3fc373efdf..0000000000
--- a/examples/org.eclipse.swt.examples/examples_fileviewer.properties
+++ /dev/null
@@ -1,59 +0,0 @@
-Title = SWT FileViewer - {0}
-
-menu.File.text = &File
-menu.File.Close.text = &Close
-menu.File.SimulateOnly.text = Simulate File Operations
-menu.Help.text = &Help
-menu.Help.About.text = &About
-
-tool.Cut.tiptext = Cut
-tool.Copy.tiptext = Copy
-tool.Delete.tiptext = Delete
-tool.Parent.tiptext = Parent
-tool.Paste.tiptext = Paste
-tool.Print.tiptext = Print
-tool.Refresh.tiptext = Refresh
-tool.Rename.tiptext = Rename
-tool.Search.tiptext = Search
-
-details.AllFolders.text = All Folders
-details.ContentsOf.text = Contents of ''{0}''
-details.FileSize.text = {0} bytes
-details.DirNumberOfObjects.text = {0} object(s)
-details.NumberOfSelectedFiles.text = {0} object(s) selected
-
-table.Name.title = Name
-table.Size.title = Size
-table.Type.title = Type
-table.Modified.title = Modified
-
-filetype.Unknown = {0} File
-filetype.None = File
-filetype.Folder = Folder
-filesize.KB = {0} kb
-
-dialog.About.title = About SWT FileViewer
-dialog.About.description = SWT FileViewer\n\nVersion: 0.9\n\nRunning on: {0}
-
-dialog.NotImplemented.title = Not Implemented
-dialog.ActionNotImplemented.description = Sorry! The action you selected has not been implemented.
-
-dialog.FailedCopy.title = Copy Files Error
-dialog.FailedCopy.description = An error occured while trying to copy "{0}" to "{1}".
-
-dialog.FailedDelete.title = Delete Files Error
-dialog.FailedDelete.description = An error occured while trying to delete "{0}".
-
-progressDialog.cancelButton.text = Cancel
-progressDialog.Copy.title = Copy Files
-progressDialog.Copy.description = Copying files.
-progressDialog.Copy.operation = Copying... {0}
-progressDialog.Move.title = Move Files
-progressDialog.Move.description = Moving files.
-progressDialog.Delete.operation = Deleting... {0}
-
-simulate.CopyFromTo.text = Simulated copy from "{0}" to "{1}".
-simulate.DirectoriesCreated.text = Simulated directories created for "{0}".
-simulate.Delete.text = Simulated delete of "{0}".
-
-error.FailedLaunch.message = Could not launch "{0}"
diff --git a/examples/org.eclipse.swt.examples/examples_helloworld.properties b/examples/org.eclipse.swt.examples/examples_helloworld.properties
deleted file mode 100755
index 2db6671c37..0000000000
--- a/examples/org.eclipse.swt.examples/examples_helloworld.properties
+++ /dev/null
@@ -1 +0,0 @@
-Hello_world = Hello World \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_hoverhelp.properties b/examples/org.eclipse.swt.examples/examples_hoverhelp.properties
deleted file mode 100755
index b1e118e3fa..0000000000
--- a/examples/org.eclipse.swt.examples/examples_hoverhelp.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-error.CouldNotLoadResources = Unable to load resources : {0}
-
-ToolItem.text = ToolItem {0}
-ToolItem.tooltip = Tooltip for {0}. Try F1 on me.
-ToolItem.help = Help text for {0}.
-
-TableItem.text = TableItem {0}
-TableItem.tooltip = Tooltip for {0}. Try F1 on me.
-TableItem.help = Help text for {0}.
-
-TreeItem.text = TreeItem {0}
-TreeItem.tooltip = Tooltip for {0}. Try F1 on me.
-TreeItem.help = Help text for {0}.
-
-Hello.text = Hello
-Hello.tooltip = Greetings!
diff --git a/examples/org.eclipse.swt.examples/examples_images.properties b/examples/org.eclipse.swt.examples/examples_images.properties
deleted file mode 100755
index 3f1d7b7384..0000000000
--- a/examples/org.eclipse.swt.examples/examples_images.properties
+++ /dev/null
@@ -1,101 +0,0 @@
-Image_analyzer = Image Analyzer
-None = None
-White = White
-Black = Black
-Red = Red
-Green = Green
-Blue = Blue
-X_scale = X Scale
-Y_scale = Y Scale
-Alpha_K = Alpha-K
-Display = Display
-Incremental = Incremental
-Transparent = Transparent
-Transparent_lc = transparent
-Mask = Mask
-Background = Background
-Animation = Animation
-Previous = < &Previous
-Next = &Next >
-Animate = &Animate
-Type_initial = Type:
-Type_string = Type: {0}
-Type_index = Type: {0} [{1,number,integer} of {2,number,integer}]
-Size_initial = Size:
-Size_value = Size: {0,number,integer} x {1,number,integer}
-Depth_initial = Depth:
-Depth_value = Depth: {0}
-Transparent_pixel_initial = Transparent pixel:
-Transparent_pixel_value = Transparent pixel: {0}
-Time_to_load_initial = Time to load:
-Time_to_load_value = Time to load: {0} ms
-Animation_size_initial = Animation size:
-Animation_size_value = Animation size: {0,number,integer} x {1,number,integer}
-Background_pixel_initial = Background pixel:
-Background_pixel_value = Background pixel: {0}
-Image_location_initial = Image location:
-Image_location_value = Image location: ({0,number,integer}, {1,number,integer})
-Disposal_initial = Disposal:
-Disposal_value = Disposal: {0,number,integer} ({1})
-Delay_initial = Delay:
-Delay_value = Delay: {0,number,integer} ms (using {1,number,integer} ms)
-Delay_used = Delay: {0,number,integer} ms
-Repeats_initial = Repeats:
-Repeats_value = Repeats: {0,number,integer}
-Repeats_forever = Repeats: {0,number,integer} (forever)
-Palette_initial = Palette:
-Palette_direct = Palette: Direct
-Palette_value = Palette size: {0,number,integer}
-Pixel_data_initial = Pixel data:
-Pixel_data_value = Pixel data: Bytes per line: {0,number,integer} \
- Scanline pad: {1,number,integer} {2}
-File = &File
-OpenFile = &Open File...\tCtrl+O
-OpenURL = Open &URL...\tCtrl+U
-Reopen = &Reopen
-Save = &Save\tCtrl+S
-Save_as = Save &As...
-Save_mask_as = Save &Mask As...
-Print = &Print\tCtrl+P
-Exit = E&xit
-Alpha = Alpha
-OpenURLDialog = Open URL
-EnterURL = Enter the URL for an image (bmp, gif, ico, jpg, jpeg, png):
-All_images = All Image Files
-Loading_lc = loading
-Saving_lc = saving
-Unknown_extension = Unknown file extension: {0}\nPlease use bmp, gif, ico, \
- jpg, jpeg, or png.
-Overwrite = Overwrite {0}?
-Analyzer_on = Image Analyzer on: {0}
-Reloading_lc = reloading
-Color_at = Image color at ({0,number,integer}, {1,number,integer}) \
- index {2,number,integer} (0x{3}) is {4}
-Color_at_trans = Image color at ({0,number,integer}, {1,number,integer}) \
- index {2,number,integer} (0x{3}) is {4} (transparent)
-Creating_image = Creating image # {0,number,integer} from
-OK = OK
-Cancel = Cancel
-Stop = &Stop
-Creating_from = Creating image read from
-Palette_direct = Palette: Direct
-Palette_size = Palette size: {0,number,integer}
-Bytes_per_line = Bytes per line:
-Scanline_pad = Scanline pad:
-Printing_error = Printing error:
-Error = Error {0} file\n{1}\n\n
-Pixels_per_byte = pixels per byte
-Byte_per_pixel = byte per pixel
-Bytes_per_pixel = bytes per pixel
-Unsupported_lc = unsupported
-None_lc = none
-Background_lc = background
-Previous_lc = previous
-Unspecified_lc = unspecified
-Unknown_ac = UNKNOWN
-Forever_lc = forever
-Depth_info = Depth: {0,number,integer} -- {1}
-One_byte = 1 byte per pixel
-Multi_bytes = {0,number,integer} bytes per pixel
-Multi_pixels = {0,number,integer} pixels per byte {1}
-Max_length_string = Transparent pixel: -1 (none) \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_javaviewer.properties b/examples/org.eclipse.swt.examples/examples_javaviewer.properties
deleted file mode 100755
index 8c589d1470..0000000000
--- a/examples/org.eclipse.swt.examples/examples_javaviewer.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-Open_menuitem=&Open
-Close_menuitem=&Close
-File_menuitem=&File
-Window_title=SWT Java Viewer
-Err_file_no_exist=File {0} does not exist.
-Err_file_io=IO error reading file:\n{0}
-Err_file_not_found=File not found:\n{0} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_texteditor.properties b/examples/org.eclipse.swt.examples/examples_texteditor.properties
deleted file mode 100755
index e53ce09e38..0000000000
--- a/examples/org.eclipse.swt.examples/examples_texteditor.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-Cut_menuitem=Cu&t\tCtrl+X
-Copy_menuitem=&Copy\tCtrl+C
-Paste_menuitem=&Paste\tCtrl+V
-Window_title=SWT Text Editor
-Font_menuitem=Set &Font...
-Edit_menuitem=&Edit \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/import.properties b/examples/org.eclipse.swt.examples/import.properties
deleted file mode 100755
index 53f7dd67c7..0000000000
--- a/examples/org.eclipse.swt.examples/import.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# Persist project settings for later import
-natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature
-builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder
-var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>>
-vmargs.org/eclipse/swt/examples/addressbook/AddressBook.java%AddressBook = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/controlexample/ControlExample.java%ControlExample = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/fileviewer/FileViewer.java%FileViewer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/helloworld/HelloWorld1.java%HelloWorld1 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/helloworld/HelloWorld2.java%HelloWorld2 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/helloworld/HelloWorld3.java%HelloWorld3 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/helloworld/HelloWorld4.java%HelloWorld4 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/helloworld/HelloWorld5.java%HelloWorld5 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/hoverhelp/HoverHelp.java%HoverHelp = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java%ImageAnalyzer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/javaviewer/JavaViewer.java%JavaViewer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
-vmargs.org/eclipse/swt/examples/texteditor/TextEditor.java%TextEditor = "-Djava.library.path=<<SWT_LIBRARY_PATH>>"
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
deleted file mode 100755
index 5ca6ad0fce..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ /dev/null
@@ -1,909 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.zip.*;
-import java.util.ResourceBundle;
-
-/**
- * AddressBookExample is an example that uses <code>org.eclipse.swt</code>
- * libraries to implement a simple address book. This application has
- * save, load, sorting, and searching functions common
- * to basic address books.
- */
-public class AddressBook {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- private Shell shell;
- private Table table;
- private SearchDialog searchDialog;
-
- private File file;
- private boolean isModified;
-
- private String[] copyBuffer;
-
- private static final String DELIMITER = ",";
- private static final String[] columnNames = {resAddressBook.getString("Last_name"),
- resAddressBook.getString("First_name"),
- resAddressBook.getString("Business_phone"),
- resAddressBook.getString("Home_phone"),
- resAddressBook.getString("Email"),
- resAddressBook.getString("Fax")};
-
-public static void main(String[] args) {
- AddressBook application = new AddressBook();
- application.open();
- application.run();
-}
-private boolean closeAddressBook() {
- if(isModified) {
- //ask user if they want to save current address book
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Close_save"));
-
- int choice = box.open();
- if(choice == SWT.CANCEL) {
- return false;
- } else if(choice == SWT.YES) {
- if (!save()) return false;
- }
- }
-
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i ++) {
- items[i].dispose();
- }
-
- return true;
-}
-/**
- * Creates the menu at the top of the shell where most
- * of the programs functionality is accessed.
- *
- * @return The <code>Menu</code> widget that was created
- */
-private Menu createMenuBar() {
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
-
- //create each header and subMenu for the menuBar
- createFileMenu(menuBar);
- createEditMenu(menuBar);
- createSearchMenu(menuBar);
- createHelpMenu(menuBar);
-
- return menuBar;
-}
-
-/**
- * Converts an encoded <code>String</code> to a String array representing a table entry.
- */
-private String[] decodeLine(String line) {
- if(line == null) return null;
-
- String[] parsedLine = new String[table.getColumnCount()];
- for(int i = 0; i < parsedLine.length - 1; i++) {
- String newString = "";
- int index = line.indexOf(DELIMITER);
- if (index > -1) {
- parsedLine[i] = line.substring(0, index);
- line = line.substring(index + DELIMITER.length(), line.length());
- } else {
- return null;
- }
- }
-
- if (line.indexOf(DELIMITER) != -1) return null;
-
- parsedLine[parsedLine.length - 1] = line;
-
- return parsedLine;
-}
-private void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-private void editEntry(TableItem item) {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] values = new String[table.getColumnCount()];
- for (int i = 0; i < values.length; i++) {
- values[i] = item.getText(i);
- }
- dialog.setValues(values);
- values = dialog.open();
- if (values != null) {
- item.setText(values);
- isModified = true;
- }
-}
-private String encodeLine(String[] tableItems) {
- String line = "";
- for (int i = 0; i < tableItems.length - 1; i++) {
- line += tableItems[i] + DELIMITER;
- }
- line += tableItems[tableItems.length - 1] + "\n";
-
- return line;
-}
-private boolean findEntry() {
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- boolean matchCase = searchDialog.getMatchCase();
- boolean matchWord = searchDialog.getMatchWord();
- String searchString = searchDialog.getSearchString();
- int column = searchDialog.getSelectedSearchArea();
-
- searchString = matchCase ? searchString : searchString.toLowerCase();
-
- boolean found = false;
- if (searchDialog.getSearchDown()) {
- for(int i = table.getSelectionIndex() + 1; i < table.getItemCount(); i++) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- } else {
- for(int i = table.getSelectionIndex() - 1; i > -1; i--) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- }
-
- shell.setCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
-
- return found;
-}
-private boolean findMatch(String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {
-
- String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
- if (matchWord) {
- if (tableText != null && tableText.equals(searchString)) {
- return true;
- }
-
- } else {
- if(tableText!= null && tableText.indexOf(searchString) != -1) {
- return true;
- }
- }
- return false;
-}
-/**
- * Merges two arrays (assumed to be individually sorted) of string arrays into
- * one sorted array by the value stored at the columnIndex parameter. This method
- * is used in <code>mergeSort(String[][] tableItems, int columnIndex)</code>.
- *
- * @param firstHalf String[][]
- * The first array of Strings to be merged.
- * @param secondHalf String[][]
- * The second array of Strings to be merged.
- * @param columnIndex int
- * The column by which the String arrays will be compared.
- * @return String[][]
- * An array of array of String that is the merged (and sorted) combination
- * of the two parameter arrays.
- */
-private String[][] merge(String[][] firstHalf, String[][] secondHalf, int column) {
- int x = firstHalf.length + secondHalf.length;
- int y = Math.max(firstHalf[0].length, secondHalf[0].length);
- String[][] sorted = new String[x][y];
-
- int firstHalfIndex = 0;
- int secondHalfIndex = 0;
- int sortedIndex = 0;
-
- //merge
- while(firstHalfIndex < firstHalf.length && secondHalfIndex < secondHalf.length) {
- if(firstHalf[firstHalfIndex][column].compareToIgnoreCase(secondHalf[secondHalfIndex][column]) <= 0 ) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- } else {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
- }
-
- //copy remaining items into sorted.
- while(firstHalfIndex < firstHalf.length) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- }
-
- while(secondHalfIndex < secondHalf.length) {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
-
- return sorted;
-}
-/**
- * Takes an array of array of Strings and sorts them into ascending order according to the
- * data in the column specified. Note that this sort is recursive.
- *
- * @param tableItems String[][]
- * The array of Strings that will be sorted.
- * @param columnIndex int
- * The column in the String arrays by which the arrays will be compared.
- * @return String[][]
- * The resultant sorted version of the tableItems parameter.
- * @see #merge(String[][] firstHalf, String[][] secondHalf, int columnIndex)
- */
-private String[][] mergeSort(String[][] items, int column) {
- int numItems = items.length;
-
- if(numItems <= 1) return items;
-
- int split = numItems / 2;
- String[][] firstHalf = new String[split][items[0].length];
- String[][] secondHalf = new String[numItems - split][items[0].length];
- for(int i = 0; i < firstHalf.length; i++) {
- firstHalf[i] = items[i];
- }
- for(int i = 0; i < secondHalf.length; i++) {
- secondHalf[i] = items[split + i];
- }
-
- String[][] firstHalfSorted = mergeSort(firstHalf, column);
- String[][] secondHalfSorted = mergeSort(secondHalf, column);
- String[][] sortedItems = merge(firstHalfSorted, secondHalfSorted, column);
-
- return sortedItems;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- file = null;
- isModified = false;
-}
-private void newEntry() {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] data = dialog.open();
- if (data != null) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(data);
- isModified = true;
- }
-}
-private void open() {
- Display display = new Display();
- shell = new Shell(display);
- shell.setLayout(new FillLayout());
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- e.doit = closeAddressBook();
- }
- });
-
- createMenuBar();
-
- searchDialog = new SearchDialog(shell);
- searchDialog.setSearchAreaNames(columnNames);
- searchDialog.setSearchAreaLabel(resAddressBook.getString("Column"));
- searchDialog.addFindListener(new FindListener () {
- public boolean find() {
- return findEntry();
- }
- });
-
- table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setMenu(createPopUpMenu());
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetDoubleSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length > 0) editEntry(items[0]);
- }
- });
- for(int i = 0; i < columnNames.length; i++) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(columnNames[i]);
- column.setWidth(150);
- final int columnIndex = i;
- column.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
- }
-
- newAddressBook();
-
- shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
- shell.open();
-}
-private void openAddressBook() {
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- fileDialog.setFilterNames(new String[] {resAddressBook.getString("Book_filter_name") + " (*.adr)",
- resAddressBook.getString("All_filter_name") + " (*.*)"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if(name == null) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- displayError(resAddressBook.getString("File")+file.getName()+" "+resAddressBook.getString("Does_not_exist"));
- return;
- }
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- FileReader fileReader = null;
- BufferedReader bufferedReader = null;
- String[] data = new String[0];
- try {
- fileReader = new FileReader(file.getAbsolutePath());
- bufferedReader = new BufferedReader(fileReader);
- String nextLine = bufferedReader.readLine();
- while (nextLine != null){
- String[] newData = new String[data.length + 1];
- System.arraycopy(data, 0, newData, 0, data.length);
- newData[data.length] = nextLine;
- data = newData;
- nextLine = bufferedReader.readLine();
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return;
- } catch (IOException e ) {
- displayError(resAddressBook.getString("IO_error_read") + "\n" + file.getName());
- return;
- } finally {
-
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileReader != null) {
- try {
- fileReader.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return;
- }
- }
- }
-
- String[][] tableInfo = new String[data.length][table.getColumnCount()];
- for (int i = 0; i < data.length; i++) {
- tableInfo[i] = decodeLine(data[i]);
- }
- tableInfo = mergeSort(tableInfo, 0);
- for (int i = 0; i < tableInfo.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(tableInfo[i]);
- }
- shell.setText(resAddressBook.getString("Title_bar")+fileDialog.getFileName());
- isModified = false;
- this.file = file;
-}
-private void run() {
- //read and dispatch until termination
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-}
-private boolean save() {
- if(file == null) return saveAs();
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- TableItem[] items = table.getItems();
- String[] lines = new String[items.length];
- for(int i = 0; i < items.length; i++) {
- String[] itemText = new String[table.getColumnCount()];
- for (int j = 0; j < itemText.length; j++) {
- itemText[j] = items[i].getText(j);
- }
- lines[i] = encodeLine(itemText);
- }
-
- FileWriter fileWriter = null;
- try {
- fileWriter = new FileWriter(file.getAbsolutePath(), false);
- for (int i = 0; i < lines.length; i++) {
- fileWriter.write(lines[i]);
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return false;
- } catch(IOException e ) {
- displayError(resAddressBook.getString("IO_error_write") + "\n" + file.getName());
- return false;
- } finally {
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileWriter != null) {
- try {
- fileWriter.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return false;
- }
- }
- }
-
- shell.setText(resAddressBook.getString("Title_bar")+file.getName());
- isModified = false;
- return true;
-}
-private boolean saveAs() {
-
- FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
- saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "});
-
- saveDialog.open();
- String name = saveDialog.getFileName();
-
- if(name.equals("")) return false;
-
- if(name.indexOf(".adr") != name.length() - 4) {
- name += ".adr";
- }
-
- File file = new File(saveDialog.getFilterPath(), name);
- if(file.exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
- box.setText(resAddressBook.getString("Save_as_title"));
- box.setMessage(resAddressBook.getString("File") + file.getName()+" "+resAddressBook.getString("Query_overwrite"));
- if(box.open() != SWT.YES) {
- return false;
- }
- }
- this.file = file;
- return save();
-}
-private void sort(int column) {
- if(table.getItemCount() <= 1) return;
-
- TableItem[] items = table.getItems();
- String[][] data = new String[items.length][table.getColumnCount()];
- for(int i = 0; i < items.length; i++) {
- for(int j = 0; j < table.getColumnCount(); j++) {
- data[i][j] = items[i].getText(j);
- }
- }
-
- data = mergeSort(data, column);
-
- for (int i = 0; i < data.length; i++) {
- items[i].setText(data[i]);
- }
-
-}
-/**
- * Creates all the items located in the File submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the File submenu.
- */
-private void createFileMenu(Menu menuBar) {
- //File menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("File_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- items[1].setEnabled(table.getSelectionCount() != 0); // edit contact
- items[5].setEnabled((file != null) && isModified); // save
- items[6].setEnabled(table.getItemCount() != 0); // save as
- }
- });
-
-
- //File -> New Contact
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_contact"));
- subItem.setAccelerator(SWT.CTRL + 'N');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Edit_contact"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> New Address Book
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'B');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- newAddressBook();
- }
- });
-
- //File -> Open
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Open_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'O');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- openAddressBook();
- }
- });
-
- //File -> Save.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'S');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- save();
- }
- });
-
- //File -> Save As.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_book_as"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- saveAs();
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> Exit.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Exit"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-}
-
-/**
- * Creates all the items located in the Edit submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Edit submenu.
- *
- * @see #createSortMenu()
- */
-private MenuItem createEditMenu(Menu menuBar) {
- //Edit menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Edit_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- /**
- * Add a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[0].setEnabled(count != 0); // edit
- items[1].setEnabled(count != 0); // copy
- items[2].setEnabled(copyBuffer != null); // paste
- items[3].setEnabled(count != 0); // delete
- items[5].setEnabled(table.getItemCount() != 0); // sort
- }
- });
-
- //Edit -> Edit
- MenuItem subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Edit"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Edit -> Copy
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Copy"));
- subItem.setAccelerator(SWT.CTRL + 'C');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Edit -> Paste
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Paste"));
- subItem.setAccelerator(SWT.CTRL + 'V');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Edit -> Delete
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Delete"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true; }
- });
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //Edit -> Sort(Cascade)
- subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Sort"));
- Menu submenu = createSortMenu();
- subItem.setMenu(submenu);
-
- return item;
-
-}
-
-/**
- * Creates all the items located in the Sort cascading submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @return Menu
- * The cascading menu with all the sort menu items on it.
- */
-private Menu createSortMenu() {
- Menu submenu = new Menu(shell, SWT.DROP_DOWN);
- MenuItem subitem;
- for(int i = 0; i < columnNames.length; i++) {
- subitem = new MenuItem (submenu, SWT.NULL);
- subitem.setText(columnNames [i]);
- final int column = i;
- subitem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(column);
- }
- });
-
- }
-
- return submenu;
-}
-
-/**
- * Creates all the items located in the Search submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Search submenu.
- */
-private void createSearchMenu(Menu menuBar) {
- //Search menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Search_menu_title"));
- Menu searchMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(searchMenu);
-
- //Search -> Find...
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find"));
- item.setAccelerator(SWT.CTRL + 'F');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.setMatchCase(false);
- searchDialog.setMatchWord(false);
- searchDialog.setSearchDown(true);
- searchDialog.setSearchString("");
- searchDialog.setSelectedSearchArea(0);
- searchDialog.open();
- }
- });
-
- //Search -> Find Next
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find_next"));
- item.setAccelerator(SWT.F3);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-}
-
-/**
- * Creates all items located in the popup menu and associates
- * all the menu items with their appropriate functions.
- *
- * @return Menu
- * The created popup menu.
- */
-private Menu createPopUpMenu() {
- Menu popUpMenu = new Menu(shell, SWT.POP_UP);
-
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- popUpMenu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[2].setEnabled(count != 0); // edit
- items[3].setEnabled(count != 0); // copy
- items[4].setEnabled(copyBuffer != null); // paste
- items[5].setEnabled(count != 0); // delete
- items[7].setEnabled(table.getItemCount() != 0); // find
- }
- });
-
- //New
- MenuItem item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_new"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Edit
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_edit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Copy
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_copy"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Paste
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_paste"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Delete
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_delete"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true;
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Find...
- item = new MenuItem(popUpMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Pop_up_find"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-
- return popUpMenu;
-}
-
-/**
- * Creates all the items located in the Help submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Help submenu.
- */
-private void createHelpMenu(Menu menuBar) {
-
- //Help Menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Help_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- //Help -> About Text Editor
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("About"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.NONE);
- box.setText(resAddressBook.getString("About_1") + shell.getText());
- box.setMessage(shell.getText() + resAddressBook.getString("About_2"));
- box.open();
- }
- });
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
deleted file mode 100755
index 35e0425bff..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
- * DataEntryDialog class uses <code>org.eclipse.swt</code>
- * libraries to implement a dialog that accepts basic personal information that
- * is added to a <code>Table</code> widget or edits a <code>TableItem</code> entry
- * to represent the entered data.
- */
-public class DataEntryDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- String[] values;
- String[] labels;
-
-public DataEntryDialog(Shell parent) {
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
- shell.setLayout(new GridLayout());
-}
-
-private void addTextListener(final Text text) {
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e){
- Integer index = (Integer)(text.getData("index"));
- values[index.intValue()] = text.getText();
- }
- });
-}
-private void createControlButtons() {
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Button okButton = new Button(composite, SWT.PUSH);
- okButton.setText(resAddressBook.getString("OK"));
- okButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- values = null;
- shell.close();
- }
- });
-
- shell.setDefaultButton(okButton);
-}
-
-private void createTextWidgets() {
- if (labels == null) return;
-
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout= new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- if (values == null)
- values = new String[labels.length];
-
- for (int i = 0; i < labels.length; i++) {
- Label label = new Label(composite, SWT.RIGHT);
- label.setText(labels[i]);
- Text text = new Text(composite, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.widthHint = 400;
- text.setLayoutData(gridData);
- if (values[i] != null) {
- text.setText(values[i]);
- }
- text.setData("index", new Integer(i));
- addTextListener(text);
- }
-}
-
-public String[] getLabels() {
- return labels;
-}
-public String getTitle() {
- return shell.getText();
-}
-/**
- * Returns the contents of the <code>Text</code> widgets in the dialog in a
- * <code>String</code> array.
- *
- * @return String[]
- * The contents of the text widgets of the dialog.
- * May return null if all text widgets are empty.
- */
-public String[] getValues() {
- return values;
-}
-/**
- * Opens the dialog in the given state. Sets <code>Text</code> widget contents
- * and dialog behaviour accordingly.
- *
- * @param dialogState int
- * The state the dialog should be opened in.
- */
-public String[] open() {
- createTextWidgets();
- createControlButtons();
- shell.pack();
- shell.open();
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-
- return getValues();
-}
-public void setLabels(String[] labels) {
- this.labels = labels;
-}
-public void setTitle(String title) {
- shell.setText(title);
-}
-/**
- * Sets the values of the <code>Text</code> widgets of the dialog to
- * the values supplied in the parameter array.
- *
- * @param itemInfo String[]
- * The values to which the dialog contents will be set.
- */
-public void setValues(String[] itemInfo) {
- if (labels == null) return;
-
- if (values == null)
- values = new String[labels.length];
-
- int numItems = Math.min(values.length, itemInfo.length);
- for(int i = 0; i < numItems; i++) {
- values[i] = itemInfo[i];
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java
deleted file mode 100755
index 88d70e4791..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public interface FindListener {
-
-public boolean find();
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
deleted file mode 100755
index 6a7d620401..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * SearchDialog is a simple class that uses <code>org.eclipse.swt</code>
- * libraries to implement a basic search dialog.
- */
-public class SearchDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- Text searchText;
- Combo searchArea;
- Label searchAreaLabel;
- Button matchCase;
- Button matchWord;
- Button findButton;
- Button down;
- FindListener findHandler;
-
-/**
- * Class constructor that sets the parent shell and the table widget that
- * the dialog will search.
- *
- * @param parent Shell
- * The shell that is the parent of the dialog.
- */
-public SearchDialog(Shell parent) {
- shell = new Shell(parent, SWT.CLOSE | SWT.BORDER | SWT.TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- shell.setLayout(layout);
- shell.setText(resAddressBook.getString("Search_dialog_title"));
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- // don't dispose of the shell, just hide it for later use
- e.doit = false;
- shell.setVisible(false);
- }
- });
-
- Label label = new Label(shell, SWT.LEFT);
- label.setText(resAddressBook.getString("Dialog_find_what"));
- searchText = new Text(shell, SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchText.setLayoutData(gridData);
- searchText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- boolean enableFind = (searchText.getCharCount() != 0);
- findButton.setEnabled(enableFind);
- }
- });
-
- searchAreaLabel = new Label(shell, SWT.LEFT);
- searchArea = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchArea.setLayoutData(gridData);
-
- matchCase = new Button(shell, SWT.CHECK);
- matchCase.setText(resAddressBook.getString("Dialog_match_case"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchCase.setLayoutData(gridData);
-
- matchWord = new Button(shell, SWT.CHECK);
- matchWord.setText(resAddressBook.getString("Dialog_match_word"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchWord.setLayoutData(gridData);
-
- Group direction = new Group(shell, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- direction.setLayoutData(gridData);
- direction.setLayout (new FillLayout ());
- direction.setText(resAddressBook.getString("Dialog_direction"));
-
- Button up = new Button(direction, SWT.RADIO);
- up.setText(resAddressBook.getString("Dialog_dir_up"));
- up.setSelection(false);
-
- down = new Button(direction, SWT.RADIO);
- down.setText(resAddressBook.getString("Dialog_dir_down"));
- down.setSelection(true);
-
- Composite composite = new Composite(shell, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- composite.setLayoutData(gridData);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
-
- findButton = new Button(composite, SWT.PUSH);
- findButton.setText(resAddressBook.getString("Dialog_find"));
- findButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- findButton.setEnabled(false);
- findButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (!findHandler.find()){
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.PRIMARY_MODAL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Cannot_find") + "\"" + searchText.getText() + "\"");
- box.open();
- }
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.setVisible(false);
- }
- });
-
- shell.pack();
-}
-public String getSearchAreaLabel(String label) {
- return searchAreaLabel.getText();
-}
-
-public String[] getsearchAreaNames() {
- return searchArea.getItems();
-}
-public boolean getMatchCase() {
- return matchCase.getSelection();
-}
-public boolean getMatchWord() {
- return matchWord.getSelection();
-}
-public String getSearchString() {
- return searchText.getText();
-}
-public boolean getSearchDown(){
- return down.getSelection();
-}
-public int getSelectedSearchArea() {
- return searchArea.getSelectionIndex();
-}
-public void open() {
- if (shell.isVisible()) {
- shell.setFocus();
- } else {
- shell.open();
- }
- searchText.setFocus();
-}
-public void setSearchAreaNames(String[] names) {
- for (int i = 0; i < names.length; i++) {
- searchArea.add(names[i]);
- }
- searchArea.select(0);
-}
-public void setSearchAreaLabel(String label) {
- searchAreaLabel.setText(label);
-}
-public void setMatchCase(boolean match) {
- matchCase.setSelection(match);
-}
-public void setMatchWord(boolean match) {
- matchWord.setSelection(match);
-}
-public void setSearchDown(boolean searchDown){
- down.setSelection(searchDown);
-}
-public void setSearchString(String searchString) {
- searchText.setText(searchString);
-}
-
-public void setSelectedSearchArea(int index) {
- searchArea.select(index);
-}
-public void addFindListener(FindListener listener) {
- this.findHandler = listener;
-}
-public void removeFindListener(FindListener listener) {
- this.findHandler = null;
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java
deleted file mode 100755
index bfd1c60de2..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>AlignableTab</code> is the abstract
- * superclass of example controls that can be
- * aligned.
- */
-abstract class AlignableTab extends Tab {
-
- /* Allignment Controls */
- Button leftButton, rightButton, centerButton;
-
- /* Alignment Group */
- Group allignmentGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- AlignableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the group */
- allignmentGroup = new Group (controlGroup, SWT.NULL);
- allignmentGroup.setLayout (new GridLayout ());
- allignmentGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_FILL));
- allignmentGroup.setText (ControlExample.getResourceString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (ControlExample.getResourceString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(ControlExample.getResourceString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (ControlExample.getResourceString("Right"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetAlignment ();
- };
- };
- leftButton.addSelectionListener (selectionListener);
- centerButton.addSelectionListener (selectionListener);
- rightButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- abstract void setExampleWidgetAlignment ();
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0) {
- leftButton.setSelection ((controls [0].getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection ((controls [0].getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection ((controls [0].getStyle () & SWT.RIGHT) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java
deleted file mode 100755
index 76bd2434ea..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>ButtonTab</code> is the class that
- * demonstrates SWT buttons.
- */
-class ButtonTab extends AlignableTab {
-
- /* Example widgets and groups that contain them */
- Button button1, button2, button3, button4, button5, button6;
- Group textButtonGroup, imageButtonGroup;
-
- /* Allignment widgets added to the "Control" group */
- Button upButton, downButton;
-
- /* Style widgets added to the "Style" group */
- Button pushButton, checkButton, radioButton, toggleButton, arrowButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ButtonTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (ControlExample.getResourceString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (ControlExample.getResourceString("Down"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection()) return;
- setExampleWidgetAlignment ();
- };
- };
- upButton.addSelectionListener(selectionListener);
- downButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for text buttons */
- textButtonGroup = new Group(exampleGroup, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- textButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- textButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textButtonGroup.setText (ControlExample.getResourceString("Text_Buttons"));
-
- /* Create a group for the image buttons */
- imageButtonGroup = new Group(exampleGroup, SWT.NONE);
- gridLayout = new GridLayout();
- imageButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- imageButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageButtonGroup.setText (ControlExample.getResourceString("Image_Buttons"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (pushButton.getSelection()) style |= SWT.PUSH;
- if (checkButton.getSelection()) style |= SWT.CHECK;
- if (radioButton.getSelection()) style |= SWT.RADIO;
- if (toggleButton.getSelection()) style |= SWT.TOGGLE;
- if (arrowButton.getSelection()) style |= SWT.ARROW;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(ControlExample.getResourceString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(ControlExample.getResourceString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(ControlExample.getResourceString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(instance.images[ControlExample.ciClosedFolder]);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(instance.images[ControlExample.ciOpenFolder]);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText(ControlExample.getResourceString("SWT_PUSH"));
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText (ControlExample.getResourceString("SWT_CHECK"));
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText (ControlExample.getResourceString("SWT_RADIO"));
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText (ControlExample.getResourceString("SWT_TOGGLE"));
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText (ControlExample.getResourceString("SWT_ARROW"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {button1, button2, button3, button4, button5, button6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Button");
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- if (upButton.getSelection ()) allignment = SWT.UP;
- if (downButton.getSelection ()) allignment = SWT.DOWN;
- button1.setAlignment (allignment);
- button2.setAlignment (allignment);
- button3.setAlignment (allignment);
- button4.setAlignment (allignment);
- button5.setAlignment (allignment);
- button6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- if (arrowButton.getSelection ()) {
- upButton.setEnabled (true);
- centerButton.setEnabled (false);
- downButton.setEnabled (true);
- } else {
- upButton.setEnabled (false);
- centerButton.setEnabled (true);
- downButton.setEnabled (false);
- }
- upButton.setSelection ((button1.getStyle () & SWT.UP) != 0);
- downButton.setSelection ((button1.getStyle () & SWT.DOWN) != 0);
- pushButton.setSelection ((button1.getStyle () & SWT.PUSH) != 0);
- checkButton.setSelection ((button1.getStyle () & SWT.CHECK) != 0);
- radioButton.setSelection ((button1.getStyle () & SWT.RADIO) != 0);
- toggleButton.setSelection ((button1.getStyle () & SWT.TOGGLE) != 0);
- arrowButton.setSelection ((button1.getStyle () & SWT.ARROW) != 0);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java
deleted file mode 100755
index 88ed7db221..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ComboTab extends Tab {
-
- /* Example widgets and groups that contain them */
- Combo combo1;
- Group comboGroup;
-
- /* Style widgets added to the "Style" group */
- Button dropDownButton, readOnlyButton, simpleButton;
-
- static String [] ListData = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ComboTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the combo box */
- comboGroup = new Group (exampleGroup, SWT.NULL);
- comboGroup.setLayout (new GridLayout ());
- comboGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- comboGroup.setText (ControlExample.getResourceString("Combo"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (simpleButton.getSelection ()) style |= SWT.SIMPLE;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- combo1 = new Combo (comboGroup, style);
- combo1.setItems (ListData);
- if (ListData.length >= 3) {
- combo1.setText(ListData [2]);
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- dropDownButton = new Button (styleGroup, SWT.RADIO);
- dropDownButton.setText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText(ControlExample.getResourceString("SWT_SIMPLE"));
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlExample.getResourceString("SWT_READ_ONLY"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {combo1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Combo");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- dropDownButton.setSelection ((combo1.getStyle () & SWT.DROP_DOWN) != 0);
- simpleButton.setSelection ((combo1.getStyle () & SWT.SIMPLE) != 0);
- readOnlyButton.setSelection ((combo1.getStyle () & SWT.READ_ONLY) != 0);
- borderButton.setSelection ((combo1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java
deleted file mode 100755
index 191efd6c32..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import java.text.*;
-import java.util.*;
-
-public class ControlExample {
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle("examples_control");
- private ShellTab shellTab;
- private TabFolder tabFolder;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- Image images[];
-
- /**
- * Creates an instance of a ControlExample embedded inside
- * the supplied parent Composite.
- *
- * @param parent the container of the example
- */
- public ControlExample(Composite parent) {
- initResources();
- tabFolder = new TabFolder (parent, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (this),
- new ComboTab (this),
- new CoolBarTab (this),
- new DialogTab (this),
- new LabelTab (this),
- new ListTab (this),
- new ProgressBarTab (this),
- new SashTab (this),
- shellTab = new ShellTab(this),
- new SliderTab (this),
- new TableTab (this),
- new TextTab (this),
- new ToolBarTab (this),
- new TreeTab (this),
- };
- for (int i=0; i<tabs.length; i++) {
- TabItem item = new TabItem (tabFolder, SWT.NULL);
- item.setText (tabs [i].getTabText ());
- item.setControl (tabs [i].createTabFolderPage (tabFolder));
- }
- }
-
- /**
- * Grabs input focus.
- */
- public void setFocus() {
- tabFolder.setFocus();
- }
-
- /**
- * Disposes of all resources associated with a particular
- * instance of the ControlExample.
- */
- public void dispose() {
- /*
- * Destroy any shells that may have been created
- * by the Shells tab. When a shell is disposed,
- * all child shells are also disposed. Therefore
- * it is necessary to check for disposed shells
- * in the shells list to avoid disposing a shell
- * twice.
- */
- if (shellTab != null) shellTab.closeAllShells ();
- shellTab = null;
- tabFolder = null;
- freeResources();
- }
-
- /**
- * Invokes as a standalone program.
- */
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
- ControlExample instance = new ControlExample(shell);
- shell.setText(getResourceString("window.title"));
- shell.open();
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- instance.dispose();
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Loads the resources
- */
- private void initResources() {
- final Class clazz = ControlExample.class;
- if (resourceBundle != null) {
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- ImageData source = new ImageData(clazz.getResourceAsStream(
- imageLocations[i]));
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(null, source, mask);
- }
- }
- return;
- } catch (Throwable t) {
- }
- }
- String error = (resourceBundle != null) ?
- getResourceString("error.CouldNotLoadResources") :
- "Unable to load resources";
- freeResources();
- throw new RuntimeException(error);
- }
-
- /**
- * Frees the resources
- */
- private void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-}
-
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/CoolBarTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/CoolBarTab.java
deleted file mode 100644
index 5843469802..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/CoolBarTab.java
+++ /dev/null
@@ -1,269 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class CoolBarTab extends Tab {
- /* Example widgets and group that contains them */
- CoolBar coolBar;
- CoolItem pushItem, dropDownItem, radioItem, checkItem;
- Group coolBarGroup;
-
- Point[] sizes;
- int[] wrapIndices;
- int[] order;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- CoolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
- coolBarGroup = new Group (exampleGroup, SWT.NULL);
- coolBarGroup.setLayout (new GridLayout ());
- coolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- coolBarGroup.setText (ControlExample.getResourceString("CoolBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- int style = 0;
-
- /* Compute the widget style */
- int toolBarStyle = SWT.FLAT;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /*
- * Create the example widgets.
- */
- coolBar = new CoolBar (coolBarGroup, style);
-
- /* create the push button toolbar */
- ToolBar toolBar = new ToolBar (coolBar, toolBarStyle);
- ToolItem item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.SEPARATOR);
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- pushItem = new CoolItem (coolBar, SWT.NULL);
- pushItem.setControl (toolBar);
- Point pushSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- pushSize = pushItem.computeSize(pushSize.x, pushSize.y);
- pushItem.setSize(pushSize);
-
- /* create the dropdown toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener (new DropDownSelectionListener());
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener (new DropDownSelectionListener());
- dropDownItem = new CoolItem (coolBar, SWT.NULL);
- dropDownItem.setControl (toolBar);
- Point dropSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- dropSize = dropDownItem.computeSize(dropSize.x, dropSize.y);
- dropDownItem.setSize(dropSize);
-
- /* create the radio button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- radioItem = new CoolItem (coolBar, SWT.NULL);
- radioItem.setControl (toolBar);
- Point radioSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- radioSize = radioItem.computeSize(radioSize.x, radioSize.y);
- radioItem.setSize(radioSize);
-
- /* create the check button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- checkItem = new CoolItem (coolBar, SWT.NULL);
- checkItem.setControl (toolBar);
- Point checkSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- checkSize = checkItem.computeSize(checkSize.x, checkSize.y);
- checkItem.setSize(checkSize);
-
- /* if we have saved state, restore it */
- if (order != null) {
- coolBar.setItemLayout(order, wrapIndices, sizes);
- /*
- * special case: because setItemLayout will restore the items
- * to the sizes the user left them at, the preferred size may not
- * be the same as the actual size. Thus we must explicitly set
- * the preferred sizes.
- */
- pushItem.setPreferredSize(pushSize);
- dropDownItem.setPreferredSize(dropSize);
- radioItem.setPreferredSize(radioSize);
- checkItem.setPreferredSize(checkSize);
- }
- else {
- coolBar.setWrapIndices(new int[] {1, 3});
- }
-
- /* add a listener to resize the group box to match the coolbar */
- coolBar.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- exampleGroup.layout();
- }
- });
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widget */
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- /* store the state of the toolbar if applicable */
- if (coolBar != null) {
- sizes = coolBar.getItemSizes();
- wrapIndices = coolBar.getWrapIndices();
- order = coolBar.getItemOrder();
- }
- super.disposeExampleWidgets();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {coolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("CoolBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- borderButton.setSelection ((coolBar.getStyle () & SWT.BORDER) != 0);
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java
deleted file mode 100755
index ea5f8f5db8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java
+++ /dev/null
@@ -1,431 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class DialogTab extends Tab {
- /* Example widgets and groups that contain them */
- Group dialogStyleGroup, resultGroup;
- Text textWidget;
-
- /* Style widgets added to the "Style" group */
- Combo dialogCombo;
- Button okButton, cancelButton;
- Button yesButton, noButton;
- Button retryButton;
- Button abortButton, ignoreButton;
- Button iconErrorButton, iconInformationButton, iconQuestionButton;
- Button iconWarningButton, iconWorkingButton;
- Button modelessButton, primaryModalButton, applicationModalButton, systemModalButton;
- Button saveButton, openButton;
-
- static String [] FilterExtensions = {".txt.", ".bat", ".doc"};
- static String [] FilterNames = {ControlExample.getResourceString("FilterName_0"),
- ControlExample.getResourceString("FilterName_1"),
- ControlExample.getResourceString("FilterName_2")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- DialogTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Handle a button style selection event.
- *
- * @param event the selection event
- */
- void buttonStyleSelected(SelectionEvent event) {
- /*
- * Only certain combinations of button styles are
- * supported for various dialogs. Make sure the
- * control widget reflects only valid combinations.
- */
- okButton.setEnabled (
- !(yesButton.getSelection () || noButton.getSelection () ||
- retryButton.getSelection () || abortButton.getSelection () ||
- ignoreButton.getSelection ()));
- cancelButton.setEnabled (
- !(abortButton.getSelection () || ignoreButton.getSelection ()));
- yesButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- noButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- retryButton.setEnabled (
- !(okButton.getSelection() || yesButton.getSelection() || noButton.getSelection ()));
- abortButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () ||
- yesButton.getSelection () || noButton.getSelection ()));
- ignoreButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () |
- yesButton.getSelection () || noButton.getSelection ()));
- }
-
- /**
- * Handle the create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- void createButtonSelected(SelectionEvent event) {
-
- /* Compute the appropriate dialog style */
- int style = SWT.NULL;
- if (okButton.getEnabled () && okButton.getSelection ()) style |= SWT.OK;
- if (cancelButton.getEnabled () && cancelButton.getSelection ()) style |= SWT.CANCEL;
- if (yesButton.getEnabled () && yesButton.getSelection ()) style |= SWT.YES;
- if (noButton.getEnabled () && noButton.getSelection ()) style |= SWT.NO;
- if (retryButton.getEnabled () && retryButton.getSelection ()) style |= SWT.RETRY;
- if (abortButton.getEnabled () && abortButton.getSelection ()) style |= SWT.ABORT;
- if (ignoreButton.getEnabled () && ignoreButton.getSelection ()) style |= SWT.IGNORE;
- if (iconErrorButton.getEnabled () && iconErrorButton.getSelection ()) style |= SWT.ICON_ERROR;
- if (iconInformationButton.getEnabled () && iconInformationButton.getSelection ()) style |= SWT.ICON_INFORMATION;
- if (iconQuestionButton.getEnabled () && iconQuestionButton.getSelection ()) style |= SWT.ICON_QUESTION;
- if (iconWarningButton.getEnabled () && iconWarningButton.getSelection ()) style |= SWT.ICON_WARNING;
- if (iconWorkingButton.getEnabled () && iconWorkingButton.getSelection ()) style |= SWT.ICON_WORKING;
- if (primaryModalButton.getEnabled () && primaryModalButton.getSelection ()) style |= SWT.PRIMARY_MODAL;
- if (applicationModalButton.getEnabled () && applicationModalButton.getSelection ()) style |= SWT.APPLICATION_MODAL;
- if (systemModalButton.getEnabled () && systemModalButton.getSelection ()) style |= SWT.SYSTEM_MODAL;
- if (saveButton.getEnabled () && saveButton.getSelection ()) style |= SWT.SAVE;
- if (openButton.getEnabled () && openButton.getSelection ()) style |= SWT.OPEN;
-
- /* Open the appropriate dialog type */
- String name = dialogCombo.getText ();
- Shell shell = tabFolderPage.getShell ();
-
- if (name.equals (instance.getResourceString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (instance.getResourceString("Title"));
- RGB result = dialog.open ();
- textWidget.append (instance.getResourceString("ColorDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open ();
- textWidget.append (instance.getResourceString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (instance.getResourceString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open();
- textWidget.append (instance.getResourceString("FileDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (instance.getResourceString("Title"));
- FontData result = dialog.open ();
- textWidget.append (instance.getResourceString("FontDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(instance.getResourceString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- int result = dialog.open ();
- textWidget.append (instance.getResourceString("MessageBox") + Text.DELIMITER);
- /*
- * The resulting integer depends on the original
- * dialog style. Decode the result and display it.
- */
- switch (result) {
- case SWT.OK:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_OK"));
- break;
- case SWT.YES:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_YES"));
- break;
- case SWT.NO:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_NO"));
- break;
- case SWT.CANCEL:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_CANCEL"));
- break;
- case SWT.ABORT:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_ABORT"));
- break;
- case SWT.RETRY:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_RETRY"));
- break;
- case SWT.IGNORE:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_IGNORE"));
- break;
- default:
- textWidget.append(instance.getResourceString("Result") + result);
- break;
- }
- textWidget.append (Text.DELIMITER + Text.DELIMITER);
- }
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout(gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (instance.getResourceString("Parameters"));
-
- /*
- * Create a group to hold the dialog style combo box and
- * create dialog button.
- */
- dialogStyleGroup = new Group (controlGroup, SWT.NULL);
- dialogStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- dialogStyleGroup.setLayoutData (gridData);
- dialogStyleGroup.setText (instance.getResourceString("Dialog_Type"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- instance.getResourceString("ColorDialog"),
- instance.getResourceString("DirectoryDialog"),
- instance.getResourceString("FileDialog"),
- instance.getResourceString("FontDialog"),
- instance.getResourceString("MessageBox"),
- };
- dialogCombo = new Combo (dialogStyleGroup, SWT.READ_ONLY);
- dialogCombo.setItems (strings);
- dialogCombo.setText (strings [0]);
-
- /* Create the create dialog button */
- Button createButton = new Button(dialogStyleGroup, SWT.NULL);
- createButton.setText (instance.getResourceString("Create_Dialog"));
- createButton.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* Create a group for the various dialog button style controls */
- Group buttonStyleGroup = new Group (controlGroup, SWT.NULL);
- buttonStyleGroup.setLayout (new GridLayout ());
- buttonStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- buttonStyleGroup.setText (instance.getResourceString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText (instance.getResourceString("SWT_OK"));
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText (instance.getResourceString("SWT_CANCEL"));
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText (instance.getResourceString("SWT_YES"));
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText (instance.getResourceString("SWT_NO"));
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText (instance.getResourceString("SWT_RETRY"));
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText (instance.getResourceString("SWT_ABORT"));
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText (instance.getResourceString("SWT_IGNORE"));
-
- /* Create a group for the icon style controls */
- Group iconStyleGroup = new Group (controlGroup, SWT.NULL);
- iconStyleGroup.setLayout (new GridLayout ());
- iconStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- iconStyleGroup.setText (instance.getResourceString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText (instance.getResourceString("SWT_ICON_ERROR"));
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText (instance.getResourceString("SWT_ICON_INFORMATION"));
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText (instance.getResourceString("SWT_ICON_QUESTION"));
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText (instance.getResourceString("SWT_ICON_WARNING"));
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText (instance.getResourceString("SWT_ICON_WORKING"));
-
- /* Create a group for the modal style controls */
- Group modalStyleGroup = new Group (controlGroup, SWT.NULL);
- modalStyleGroup.setLayout (new GridLayout ());
- modalStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- modalStyleGroup.setText (instance.getResourceString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText (instance.getResourceString("SWT_MODELESS"));
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText (instance.getResourceString("SWT_PRIMARY_MODAL"));
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText (instance.getResourceString("SWT_APPLICATION_MODAL"));
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText (instance.getResourceString("SWT_SYSTEM_MODAL"));
-
- /* Create a group for the file dialog style controls */
- Group fileDialogStyleGroup = new Group (controlGroup, SWT.NULL);
- fileDialogStyleGroup.setLayout (new GridLayout ());
- fileDialogStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- fileDialogStyleGroup.setText (instance.getResourceString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText (instance.getResourceString("SWT_SAVE"));
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText(instance.getResourceString("SWT_OPEN"));
-
- /* Add the listeners */
- dialogCombo.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dialogSelected (event);
- };
- });
- createButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- createButtonSelected (event);
- };
- });
- SelectionListener buttonStyleListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- buttonStyleSelected (event);
- };
- };
- okButton.addSelectionListener (buttonStyleListener);
- cancelButton.addSelectionListener (buttonStyleListener);
- yesButton.addSelectionListener (buttonStyleListener);
- noButton.addSelectionListener (buttonStyleListener);
- retryButton.addSelectionListener (buttonStyleListener);
- abortButton.addSelectionListener (buttonStyleListener);
- ignoreButton.addSelectionListener (buttonStyleListener);
-
- /* Set default values for style buttons */
- okButton.setEnabled (false);
- cancelButton.setEnabled (false);
- yesButton.setEnabled (false);
- noButton.setEnabled (false);
- retryButton.setEnabled (false);
- abortButton.setEnabled (false);
- ignoreButton.setEnabled (false);
- iconErrorButton.setEnabled (false);
- iconInformationButton.setEnabled (false);
- iconQuestionButton.setEnabled (false);
- iconWarningButton.setEnabled (false);
- iconWorkingButton.setEnabled (false);
- saveButton.setEnabled (false);
- openButton.setEnabled (false);
- openButton.setSelection (true);
- iconInformationButton.setSelection (true);
- modelessButton.setSelection (true);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /*
- * Create a group for the text widget to display
- * the results returned by the example dialogs.
- */
- resultGroup = new Group (exampleGroup, SWT.NULL);
- resultGroup.setLayout (new GridLayout ());
- resultGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- resultGroup.setText (instance.getResourceString("Dialog_Result"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /*
- * Create a multi lined, scrolled text widget for output.
- */
- textWidget = new Text(resultGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData gridData = new GridData ();
- gridData.widthHint = 300;
- gridData.heightHint = 400;
- textWidget.setLayoutData (gridData);
- }
-
- /**
- * Handle a dialog type combo selection event.
- *
- * @param event the selection event
- */
- void dialogSelected (SelectionEvent event) {
-
- /* Enable/Disable the buttons */
- String name = dialogCombo.getText ();
- boolean isMessageBox = name.equals (instance.getResourceString("MessageBox"));
- boolean isFileDialog = name.equals (instance.getResourceString("FileDialog"));
- okButton.setEnabled (isMessageBox);
- cancelButton.setEnabled (isMessageBox);
- yesButton.setEnabled (isMessageBox);
- noButton.setEnabled (isMessageBox);
- retryButton.setEnabled (isMessageBox);
- abortButton.setEnabled (isMessageBox);
- ignoreButton.setEnabled (isMessageBox);
- iconErrorButton.setEnabled (isMessageBox);
- iconInformationButton.setEnabled (isMessageBox);
- iconQuestionButton.setEnabled (isMessageBox);
- iconWarningButton.setEnabled (isMessageBox);
- iconWorkingButton.setEnabled (isMessageBox);
- saveButton.setEnabled (isFileDialog);
- openButton.setEnabled (isFileDialog);
-
- /* Unselect the buttons */
- if (!isMessageBox) {
- okButton.setSelection (false);
- cancelButton.setSelection (false);
- yesButton.setSelection (false);
- noButton.setSelection (false);
- retryButton.setSelection (false);
- abortButton.setSelection (false);
- ignoreButton.setSelection (false);
- }
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return instance.getResourceString("Dialog");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
deleted file mode 100755
index 64363bd151..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class LabelTab extends AlignableTab {
- /* Example widgets and groups that contain them */
- Label label1, label2, label3, label4, label5, label6;
- Group textLabelGroup, imageLabelGroup;
-
- /* Style widgets added to the "Style" group */
- Button separatorButton, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- LabelTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text labels */
- textLabelGroup = new Group(exampleGroup, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- textLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- textLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textLabelGroup.setText (ControlExample.getResourceString("Text_Labels"));
-
- /* Create a group for the image labels */
- imageLabelGroup = new Group (exampleGroup, SWT.SHADOW_NONE);
- gridLayout = new GridLayout ();
- imageLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- imageLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageLabelGroup.setText (ControlExample.getResourceString("Image_Labels"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
- if (shadowOutButton.getSelection ()) style |= SWT.SHADOW_OUT;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- label1 = new Label (textLabelGroup, style);
- label1.setText(ControlExample.getResourceString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(ControlExample.getResourceString("Two"));
- label3 = new Label (textLabelGroup, style);
- label3.setText (ControlExample.getResourceString("Three"));
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (instance.images[ControlExample.ciClosedFolder]);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (instance.images[ControlExample.ciOpenFolder]);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText (ControlExample.getResourceString("SWT_SEPARATOR"));
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (ControlExample.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlExample.getResourceString("SWT_VERTICAL"));
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText (ControlExample.getResourceString("SWT_SHADOW_IN"));
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText (ControlExample.getResourceString("SWT_SHADOW_OUT"));
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText(ControlExample.getResourceString("SWT_BORDER"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if ((event.widget.getStyle() & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- shadowInButton.addSelectionListener (selectionListener);
- shadowOutButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {label1, label2, label3, label4, label5, label6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Label");
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- label1.setAlignment (allignment);
- label2.setAlignment (allignment);
- label3.setAlignment (allignment);
- label4.setAlignment (allignment);
- label5.setAlignment (allignment);
- label6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- boolean isSeparator = (label1.getStyle () & SWT.SEPARATOR) != 0;
- leftButton.setSelection (!isSeparator && (label1.getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection (!isSeparator && (label1.getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection (!isSeparator && (label1.getStyle () & SWT.RIGHT) != 0);
- shadowInButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_IN) != 0);
- shadowOutButton.setSelection (!shadowInButton.getSelection ());
- leftButton.setEnabled (!isSeparator);
- centerButton.setEnabled (!isSeparator);
- rightButton.setEnabled (!isSeparator);
- shadowInButton.setEnabled (isSeparator);
- shadowOutButton.setEnabled (isSeparator);
- horizontalButton.setEnabled (isSeparator);
- verticalButton.setEnabled (isSeparator);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java
deleted file mode 100755
index ebd89e75c4..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ListTab extends ScrollableTab {
-
- /* Example widgets and groups that contain them */
- List list1;
- Group listGroup;
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ListTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the list */
- listGroup = new Group (exampleGroup, SWT.NULL);
- listGroup.setLayout (new GridLayout ());
- listGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- listGroup.setText (ControlExample.getResourceString("List"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- list1 = new List (listGroup, style);
- list1.setItems (ListData1);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {list1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("List");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
deleted file mode 100755
index 397ff26896..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ProgressBarTab extends RangeTab {
- /* Example widgets and groups that contain them */
- ProgressBar progressBar1;
- Group progressBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button smoothButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ProgressBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup() {
- super.createExampleGroup ();
-
- /* Create a group for the progress bar */
- progressBarGroup = new Group (exampleGroup, SWT.NULL);
- progressBarGroup.setLayout (new GridLayout ());
- progressBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- progressBarGroup.setText (ControlExample.getResourceString("ProgressBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (smoothButton.getSelection ()) style |= SWT.SMOOTH;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- progressBar1 = new ProgressBar (progressBarGroup, style);
- progressBar1.setMaximum (100);
- progressBar1.setSelection (50);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- smoothButton = new Button (styleGroup, SWT.CHECK);
- smoothButton.setText (ControlExample.getResourceString("SWT_SMOOTH"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("ProgressBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- maximumScale.setMaximum (progressBar1.getMaximum ());
- smoothButton.setSelection ((progressBar1.getStyle () & SWT.SMOOTH) != 0);
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- void setWidgetMaximum () {
- progressBar1.setMaximum (maximumScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java
deleted file mode 100755
index a257410f66..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-abstract class RangeTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button horizontalButton, verticalButton;
-
- /* Scale widgets added to the "Control" group */
- Scale minimumScale, selectionScale, maximumScale;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- RangeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Leave an empty cell */
- new Composite (controlGroup, SWT.NULL);
-
- /* Create controls specific to this example */
- createMinimumGroup ();
- createMaximumGroup ();
- createSelectionGroup ();
- }
-
- /**
- * Create a group of widgets to control the maximum
- * attribute of the example widget.
- */
- void createMaximumGroup() {
-
- /* Create the group */
- Group maximumGroup = new Group (controlGroup, SWT.NULL);
- maximumGroup.setLayout (new GridLayout ());
- maximumGroup.setText (ControlExample.getResourceString("Maximum"));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- /* Add the listeners */
- maximumScale.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMaximum ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the minimum
- * attribute of the example widget.
- */
- void createMinimumGroup() {
-
- /* Create the group */
- Group minimumGroup = new Group (controlGroup, SWT.NULL);
- minimumGroup.setLayout (new GridLayout ());
- minimumGroup.setText (ControlExample.getResourceString("Minimum"));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- /* Add the listeners */
- minimumScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMinimum ();
- };
- });
-
- }
-
- /**
- * Create a group of widgets to control the selection
- * attribute of the example widget.
- */
- void createSelectionGroup() {
-
- /* Create the group */
- Group selectionGroup = new Group(controlGroup, SWT.NULL);
- selectionGroup.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(ControlExample.getResourceString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- /* Add the listeners */
- selectionScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setWidgetSelection ();
- };
- });
-
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (ControlExample.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlExample.getResourceString("SWT_VERTICAL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetMinimum ();
- setWidgetMaximum ();
- setWidgetSelection ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.HORIZONTAL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.VERTICAL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- abstract void setWidgetMaximum ();
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- abstract void setWidgetMinimum ();
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- abstract void setWidgetSelection ();
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java
deleted file mode 100755
index 518017d168..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SashTab extends Tab {
- /* Example widgets and groups that contain them */
- Sash hSash, vSash;
- List list1, list2, list3;
- Text text;
-
- static String [] ListData0 = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SashTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the tab folder page.
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create the page. This example does not use layouts.
- */
- tabFolderPage = new Composite(tabFolder, SWT.BORDER);
-
- /* Create the list and text widgets */
- list1 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list1.setItems (ListData0);
- list2 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list2.setItems (ListData1);
- text = new Text (tabFolderPage, SWT.MULTI | SWT.BORDER);
- text.setText (ControlExample.getResourceString("Multi_line"));
-
- /* Create the sashes */
- vSash = new Sash (tabFolderPage, SWT.VERTICAL);
- hSash = new Sash (tabFolderPage, SWT.HORIZONTAL);
-
- /* Add the listeners */
- hSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- hSash.setBounds (event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- vSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- vSash.setBounds(event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- tabFolderPage.addControlListener (new ControlAdapter () {
- public void controlResized (ControlEvent event) {
- shellResized ();
- }
- });
-
- /*
- * Do not set the bounds of the lists, text and sashes here
- * because this method is run before the widget is opened
- * so we do not know how big the tabComposite is going to be.
- * When the widget is opened a resize event will occur
- * and the contained widgets can be sized accordingly.
- */
- return tabFolderPage;
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Sash");
- }
-
- /**
- * Layout the list and text widgets according to the new
- * positions of the sashes..events.SelectionEvent
- */
- void layout () {
-
- Rectangle tabCompositeBounds = tabFolderPage.getClientArea ();
- Rectangle hSashBounds = hSash.getBounds ();
- Rectangle vSashBounds = vSash.getBounds ();
-
- list1.setBounds (0, 0, vSashBounds.x, hSashBounds.y);
- list2.setBounds (vSashBounds.x + vSashBounds.width, 0, tabCompositeBounds.width - (vSashBounds.x + vSashBounds.width), hSashBounds.y);
- text.setBounds (0, hSashBounds.y + hSashBounds.height, tabCompositeBounds.width, tabCompositeBounds.height - (hSashBounds.y + hSashBounds.height));
-
- /**
- * If the horizontal sash has been moved then the vertical
- * sash is either too long or too short and its size must
- * be adjusted.
- */
- vSashBounds.height = hSashBounds.y;
- vSash.setBounds (vSashBounds);
- }
-
- /**
- * Handle the shell resized event.
- */
- void shellResized () {
-
- /* Get the client area for the shell */
- Rectangle tabFolderPageBounds = tabFolderPage.getClientArea ();
-
- /*
- * Make list 1 half the width and half the height of the tab leaving room for the sash.
- * Place list 1 in the top left quadrant of the tab.
- */
- Rectangle list1Bounds = new Rectangle (0, 0, (tabFolderPageBounds.width - SASH_WIDTH) / 2, (tabFolderPageBounds.height - SASH_WIDTH) / 2);
- list1.setBounds (list1Bounds);
-
- /*
- * Make list 2 half the width and half the height of the tab leaving room for the sash.
- * Place list 2 in the top right quadrant of the tab.
- */
- list2.setBounds (list1Bounds.width + SASH_WIDTH, 0, tabFolderPageBounds.width - (list1Bounds.width + SASH_WIDTH), list1Bounds.height);
-
- /*
- * Make the text area the full width and half the height of the tab leaving room for the sash.
- * Place the text area in the bottom half of the tab.
- */
- text.setBounds (0, list1Bounds.height + SASH_WIDTH, tabFolderPageBounds.width, tabFolderPageBounds.height - (list1Bounds.height + SASH_WIDTH));
-
- /* Position the sashes */
- vSash.setBounds (list1Bounds.width, 0, SASH_WIDTH, list1Bounds.height);
- hSash.setBounds (0, list1Bounds.height, tabFolderPageBounds.width, SASH_WIDTH);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java
deleted file mode 100755
index 5c24c9e04c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-abstract class ScrollableTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button singleButton, multiButton, horizontalButton, verticalButton, borderButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ScrollableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText (ControlExample.getResourceString("SWT_SINGLE"));
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText (ControlExample.getResourceString("SWT_MULTI"));
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText (ControlExample.getResourceString("SWT_H_SCROLL"));
- horizontalButton.setSelection(true);
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText (ControlExample.getResourceString("SWT_V_SCROLL"));
- verticalButton.setSelection(true);
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- singleButton.setSelection ((controls [0].getStyle () & SWT.SINGLE) != 0);
- multiButton.setSelection ((controls [0].getStyle () & SWT.MULTI) != 0);
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.H_SCROLL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.V_SCROLL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java
deleted file mode 100755
index 28c370c089..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ShellTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button noParentButton, parentButton;
- Button noTrimButton, closeButton, titleButton, minButton, maxButton, borderButton, resizeButton;
- Button createButton, closeAllButton;
- Group parentStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ShellTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Close all the example shells.
- */
- void closeAllShells() {
- for (int i = 0; i<shellCount; i++) {
- if (shells[i] != null & !shells [i].isDisposed ()) {
- shells [i].dispose();
- }
- }
- shellCount = 0;
- }
-
- /**
- * Handle the Create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void createButtonSelected(SelectionEvent event) {
-
- /*
- * Remember the example shells so they
- * can be disposed by the user.
- */
- if (shellCount >= shells.length) {
- Shell [] newShells = new Shell [shells.length + 4];
- System.arraycopy (shells, 0, newShells, 0, shells.length);
- shells = newShells;
- }
-
- /* Compute the shell style */
- int style = SWT.NONE;
- if (noTrimButton.getSelection()) style |= SWT.NO_TRIM;
- if (closeButton.getSelection()) style |= SWT.CLOSE;
- if (titleButton.getSelection()) style |= SWT.TITLE;
- if (minButton.getSelection()) style |= SWT.MIN;
- if (maxButton.getSelection()) style |= SWT.MAX;
- if (borderButton.getSelection()) style |= SWT.BORDER;
- if (resizeButton.getSelection()) style |= SWT.RESIZE;
-
- /* Create the shell with or without a parent */
- if (noParentButton.getSelection ()) {
- shells [shellCount] = new Shell (style);
- } else {
- Shell shell = tabFolderPage.getShell ();
- shells [shellCount] = new Shell (shell, style);
- }
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (ControlExample.getResourceString("Title") + shellCount);
- shells [shellCount++].open ();
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 1;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
-
- /* Create a group for the parent sytle controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (ControlExample.getResourceString("Parent"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (ControlExample.getResourceString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (ControlExample.getResourceString("Parent"));
-
- /* Create a group for the decoration style controls */
- Group decorationStyleGroup = new Group(styleGroup, SWT.NULL);
- decorationStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (ControlExample.getResourceString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText (ControlExample.getResourceString("SWT_NO_TRIM"));
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText (ControlExample.getResourceString("SWT_CLOSE"));
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText (ControlExample.getResourceString("SWT_TITLE"));
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText (ControlExample.getResourceString("SWT_MIN"));
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText (ControlExample.getResourceString("SWT_MAX"));
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText (ControlExample.getResourceString("SWT_RESIZE"));
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- createButton.setLayoutData (gridData);
- createButton.setText (ControlExample.getResourceString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- closeAllButton.setText (ControlExample.getResourceString("Close_All_Shells"));
- closeAllButton.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* Add the listeners */
- createButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createButtonSelected(e);
- };
- });
- closeAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAllShells ();
- };
- });
- SelectionListener decorationButtonListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- decorationButtonSelected(event);
- };
- };
- noTrimButton.addSelectionListener (decorationButtonListener);
- closeButton.addSelectionListener (decorationButtonListener);
- titleButton.addSelectionListener (decorationButtonListener);
- minButton.addSelectionListener (decorationButtonListener);
- maxButton.addSelectionListener (decorationButtonListener);
- borderButton.addSelectionListener (decorationButtonListener);
- resizeButton.addSelectionListener (decorationButtonListener);
-
- /* Set the default state */
- noParentButton.setSelection (true);
- }
-
- /**
- * Handle a decoration button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void decorationButtonSelected(SelectionEvent event) {
-
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- Button widget = (Button) event.widget;
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- closeButton.setSelection (false);
- titleButton.setSelection (false);
- minButton.setSelection (false);
- maxButton.setSelection (false);
- borderButton.setSelection (false);
- resizeButton.setSelection (false);
- return;
- }
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Shell");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
deleted file mode 100755
index 33de3df0c8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SliderTab extends RangeTab {
- /* Example widgets and groups that contain them */
- Scale scale1;
- Slider slider1;
- Group sliderGroup, scaleGroup;
-
- /* Scale widgets added to the "Control" group */
- Scale incrementScale, pageIncrementScale, thumbScale;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SliderTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
- super.createControlWidgets ();
- createThumbGroup ();
- createIncrementGroup ();
- createPageIncrementGroup ();
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the slider */
- sliderGroup = new Group (exampleGroup, SWT.NULL);
- sliderGroup.setLayout (new GridLayout ());
- sliderGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sliderGroup.setText (ControlExample.getResourceString("Slider"));
-
- /* Create a group for the scale */
- scaleGroup = new Group (exampleGroup, SWT.NULL);
- scaleGroup.setLayout (new GridLayout ());
- scaleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- scaleGroup.setText (ControlExample.getResourceString("Scale"));
-
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- scale1 = new Scale (scaleGroup, style);
- scale1.setMaximum (100);
- scale1.setSelection (50);
- scale1.setIncrement (5);
- scale1.setPageIncrement (10);
- slider1 = new Slider(sliderGroup, style);
- slider1.setMaximum (100);
- slider1.setSelection (50);
- slider1.setIncrement(5);
- slider1.setPageIncrement (10);
- slider1.setThumb (10);
- }
-
- /**
- * Create a group of widgets to control the increment
- * attribute of the example widget.
- */
- void createIncrementGroup() {
-
- /* Create the group */
- Group incrementGroup = new Group (controlGroup, SWT.NULL);
- incrementGroup.setLayout (new GridLayout ());
- incrementGroup.setText (ControlExample.getResourceString("Increment"));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- /* Add the listeners */
- incrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- setWidgetIncrement ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the page increment
- * attribute of the example widget.
- */
- void createPageIncrementGroup() {
-
- /* Create the group */
- Group pageIncrementGroup = new Group (controlGroup, SWT.NULL);
- pageIncrementGroup.setLayout (new GridLayout ());
- pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetPageIncrement ();
- }
- });
- }
-
- /**
- * Create a group of widgets to control the thumb
- * attribute of the example widget.
- */
- void createThumbGroup() {
-
- /* Create the group */
- Group thumbGroup = new Group (controlGroup, SWT.NULL);
- thumbGroup.setLayout (new GridLayout ());
- thumbGroup.setText (ControlExample.getResourceString("Thumb"));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- /* Add the listeners */
- thumbScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetThumb ();
- };
- });
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {scale1, slider1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Slider_and_Scale");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetIncrement ();
- setWidgetPageIncrement ();
- setWidgetThumb ();
- }
-
- /**
- * Sets the increment of the "Example" widgets.
- */
- void setWidgetIncrement () {
- slider1.setIncrement (incrementScale.getSelection ());
- scale1.setIncrement (incrementScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMaximum () {
- slider1.setMaximum (maximumScale.getSelection ());
- scale1.setMaximum (maximumScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- slider1.setMinimum (minimumScale.getSelection ());
- scale1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the page increment of the "Example" widgets.
- */
- void setWidgetPageIncrement () {
- slider1.setPageIncrement (pageIncrementScale.getSelection ());
- scale1.setPageIncrement (pageIncrementScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- slider1.setSelection (selectionScale.getSelection ());
- scale1.setSelection (selectionScale.getSelection ());
- }
-
- /**
- * Sets the thumb of the "Example" widgets.
- */
- void setWidgetThumb () {
- slider1.setThumb (thumbScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java
deleted file mode 100755
index 7fe4ec26b7..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * <code>Tab</code> is the abstract superclass of every page
- * in the example's tab folder. Each page in the tab folder
- * describes a control.
- *
- * A Tab itself is not a control but instead provides a
- * hierarchy with which to share code that is common to
- * every page in the folder.
- *
- * A typical page in a Tab contains a two column composite.
- * The left column contains the "Example" group. The right
- * column contains "Control" group. The "Control" group
- * contains controls that allow the user to interact with
- * the example control. The "Control" group typically
- * contains a "Style", "Display" and "Size" group. Subclasses
- * can override these defaults to augment a group or stop
- * a group from being created.
- */
-abstract class Tab {
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup;
-
- /* Controlling instance */
- final ControlExample instance;
-
- /* Sizing constants for the "Size" group */
- static final int TOO_SMALL_SIZE = 10;
- static final int SMALL_SIZE = 50;
- static final int LARGE_SIZE = 100;
-
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- Tab(ControlExample instance) {
- this.instance = instance;
- }
-
- /**
- * Creates the "Control" group. The "Control" group
- * is typically the right hand column in the tab.
- */
- void createControlGroup () {
-
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
-
- /*
- * For each Button child in the style group, add a selection
- * listener that will recreate the example controls. If the
- * style group button is a RADIO button, ensure that the radio
- * button is selected before recreating the example controls.
- * When the user selects a RADIO button, the curreont RADIO
- * button in the group is deselected and the new RADIO button
- * is selected automatically. The listeners are notified for
- * both these operations but typically only do work when a RADIO
- * button is selected.
- */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if ((event.widget.getStyle () & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- Control [] children = styleGroup.getChildren ();
- for (int i=0; i<children.length; i++) {
- if (children [i] instanceof Button) {
- Button button = (Button) children [i];
- button.addSelectionListener (selectionListener);
- }
- }
- }
-
- /**
- * Creates the "Control" widget children.
- * Subclasses override this method to augment
- * the standard controls created in the "Style",
- * "Display" and "Size" groups.
- */
- void createControlWidgets () {
- }
-
- /**
- * Creates the "Display" group. This is typically
- * a child of the "Control" group.
- */
- void createDisplayGroup () {
- /* Create the group */
- displayGroup = new Group (controlGroup, SWT.NONE);
- displayGroup.setLayout (new GridLayout ());
- displayGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- displayGroup.setText (ControlExample.getResourceString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(ControlExample.getResourceString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(ControlExample.getResourceString("Visible"));
-
- /* Add the listeners */
- enabledButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetEnabled ();
- }
- });
- visibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetVisibility ();
- }
- });
-
- /* Set the default state */
- enabledButton.setSelection(true);
- visibleButton.setSelection(true);
- }
-
- /**
- * Creates the "Example" group. The "Example" group
- * is typically the left hand column in the tab.
- */
- void createExampleGroup () {
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- }
-
- /**
- * Creates the "Example" widget children of the "Example" group.
- * Subclasses override this method to create the particular
- * example control.
- */
- void createExampleWidgets () {
- /* Do nothing */
- }
-
- /**
- * Creates the "Size" group. The "Size" group contains
- * controls that allow the user to change the size of
- * the example widgets.
- */
- void createSizeGroup () {
- /* Create the group */
- sizeGroup = new Group (controlGroup, SWT.NONE);
- sizeGroup.setLayout (new GridLayout());
- sizeGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sizeGroup.setText (ControlExample.getResourceString("Size"));
-
- /* Create the controls */
-
- /*
- * The preferred size of a widget is the size returned
- * by widget.computeSize (SWT.DEFAULT, SWT.DEFAULT).
- * This size is defined on a widget by widget basis.
- * Many widgets will attempt to display their contents.
- */
- preferredButton = new Button (sizeGroup, SWT.RADIO);
- preferredButton.setText (ControlExample.getResourceString("Preferred"));
- tooSmallButton = new Button (sizeGroup, SWT.RADIO);
- tooSmallButton.setText (TOO_SMALL_SIZE + " X " + TOO_SMALL_SIZE);
- smallButton = new Button(sizeGroup, SWT.RADIO);
- smallButton.setText (SMALL_SIZE + " X " + SMALL_SIZE);
- largeButton = new Button (sizeGroup, SWT.RADIO);
- largeButton.setText (LARGE_SIZE + " X " + LARGE_SIZE);
-
- /* Add the listeners */
- SelectionAdapter selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetSize ();
- };
- };
- preferredButton.addSelectionListener(selectionListener);
- tooSmallButton.addSelectionListener(selectionListener);
- smallButton.addSelectionListener(selectionListener);
- largeButton.addSelectionListener(selectionListener);
-
- /* Set the default state */
- preferredButton.setSelection (true);
- }
-
- /**
- * Creates the "Style" group. The "Style" group contains
- * controls that allow the user to change the style of
- * the example widgets. Changing a widget "Style" causes
- * the widget to be destroyed and recreated.
- */
- void createStyleGroup () {
- styleGroup = new Group (controlGroup, SWT.NONE);
- styleGroup.setLayout (new GridLayout ());
- styleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
- }
-
- /**
- * Creates the tab folder page.
- *
- * @param tabFolder org.eclipse.swt.widgets.TabFolder
- * @return the new page for the tab folder
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create a two column page.
- */
- tabFolderPage = new Composite (tabFolder, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- tabFolderPage.setLayout (gridLayout);
- gridLayout.numColumns = 2;
-
- /* Create the "Example" and "Control" columns */
- createExampleGroup ();
- createControlGroup ();
-
- /* Create the widgets in the two columns */
- createExampleWidgets ();
- createControlWidgets ();
- setExampleWidgetState ();
-
- return tabFolderPage;
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].dispose ();
- }
- }
-
- /**
- * Gets the "Example" widget children.
- *
- * @return an array of example widget children
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- *
- * @return the text for the tab item
- */
- String getTabText () {
- return "";
- }
-
- /**
- * Recreates the "Example" widgets.
- */
- void recreateExampleWidgets () {
- disposeExampleWidgets ();
- createExampleWidgets ();
- setExampleWidgetState ();
- }
-
- /**
- * Sets the enabled state of the "Example" widgets.
- */
- void setExampleWidgetEnabled () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setEnabled (enabledButton.getSelection ());
- }
- }
-
- /**
- * Sets the size of the "Example" widgets.
- */
- void setExampleWidgetSize () {
- int size = SWT.DEFAULT;
- if (preferredButton == null) return;
- if (preferredButton.getSelection()) size = SWT.DEFAULT;
- if (tooSmallButton.getSelection()) size = TOO_SMALL_SIZE;
- if (smallButton.getSelection()) size = SMALL_SIZE;
- if (largeButton.getSelection()) size = LARGE_SIZE;
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- GridData gridData = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes nay not have
- * changed.
- */
- int seenCount = 0;
- Composite [] seen = new Composite [4];
- for (int i=0; i<controls.length; i++) {
- Control control = controls [i];
- while (control != exampleGroup) {
- Composite parent = control.getParent ();
- int index = 0;
- while (index < seenCount) {
- if (seen [index] == parent) break;
- index++;
- }
- if (index == seenCount) parent.layout ();
- if (seenCount == seen.length) {
- Composite [] newSeen = new Composite [seen.length + 4];
- System.arraycopy (seen, 0, newSeen, 0, seen.length);
- seen = newSeen;
- }
- seen [seenCount++] = parent;
- control = control.getParent ();
- }
- }
- }
-
- /**
- * Sets the state of the "Example" widgets. Subclasses
- * reimplement this method to set "Example" widget state
- * that is specific to the widget.
- */
- void setExampleWidgetState () {
- setExampleWidgetEnabled ();
- setExampleWidgetVisibility ();
- setExampleWidgetSize ();
- }
-
- /**
- * Sets the visibility of the "Example" widgets.
- */
- void setExampleWidgetVisibility () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setVisible (visibleButton.getSelection ());
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
deleted file mode 100755
index a07f1bd69c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TableTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Table table1;
- Group tableGroup;
-
- /* Style widgets added to the "Style" group */
- Button fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- static String [] columnTitles = {ControlExample.getResourceString("TableTitle_0"),
- ControlExample.getResourceString("TableTitle_1"),
- ControlExample.getResourceString("TableTitle_2"),
- ControlExample.getResourceString("TableTitle_3")};
-
- static String [] stringLine0 = {ControlExample.getResourceString("TableLine0_0"),
- ControlExample.getResourceString("TableLine0_1"),
- ControlExample.getResourceString("TableLine0_2"),
- ControlExample.getResourceString("TableLine0_3")};
-
- static String [] stringLine1 = {ControlExample.getResourceString("TableLine1_0"),
- ControlExample.getResourceString("TableLine1_1"),
- ControlExample.getResourceString("TableLine1_2"),
- ControlExample.getResourceString("TableLine1_3")};
-
- static String [] stringLine2 = {ControlExample.getResourceString("TableLine2_0"),
- ControlExample.getResourceString("TableLine2_1"),
- ControlExample.getResourceString("TableLine2_2"),
- ControlExample.getResourceString("TableLine2_3")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Display" group.
- */
- void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible"));
-
- /* Add the listeners */
- headerVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetHeaderVisible ();
- }
- });
- linesVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetLinesVisible ();
- };
- });
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the table */
- tableGroup = new Group (exampleGroup, SWT.NULL);
- tableGroup.setLayout (new GridLayout ());
- tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText (ControlExample.getResourceString("Table"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (fullSelectionButton.getSelection ()) style |= SWT.FULL_SELECTION;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the table widget */
- table1 = new Table (tableGroup, style);
-
- /* Fill the table with data */
- int[] columnWidths = {150, 60, 75, 150};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (instance.images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText (ControlExample.getResourceString("SWT_FULL_SELECTION"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {table1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Table");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- fullSelectionButton.setSelection ((table1.getStyle () & SWT.FULL_SELECTION) != 0);
- }
-
- /**
- * Sets the header visible state of the "Example" widgets.
- */
- void setWidgetHeaderVisible () {
- table1.setHeaderVisible (headerVisibleButton.getSelection ());
- }
-
- /**
- * Sets the lines visible state of the "Example" widgets.
- */
- void setWidgetLinesVisible () {
- table1.setLinesVisible (linesVisibleButton.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java
deleted file mode 100755
index 9f4dcfadb8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.custom.*;
-
-class TextTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Text text;
- StyledText styledText;
- Group textGroup, styledTextGroup;
-
- /* Style widgets added to the "Style" group */
- Button readOnlyButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TextTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text widget */
- textGroup = new Group (exampleGroup, SWT.NULL);
- textGroup.setLayout (new GridLayout ());
- textGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textGroup.setText (ControlExample.getResourceString("Text"));
-
- /* Create a group for the styled text widget */
- styledTextGroup = new Group (exampleGroup, SWT.NULL);
- styledTextGroup.setLayout (new GridLayout ());
- styledTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styledTextGroup.setText (ControlExample.getResourceString("StyledText"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (ControlExample.getResourceString("Example_string"));
- text.append (text.DELIMITER);
- text.append (ControlExample.getResourceString("One_Two_Three"));
- styledText = new StyledText (styledTextGroup, style);
- styledText.setText (ControlExample.getResourceString("Example_string"));
- styledText.append ("\n");
- styledText.append (ControlExample.getResourceString("One_Two_Three"));
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlExample.getResourceString("SWT_READ_ONLY"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {text, styledText};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Text");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- readOnlyButton.setSelection ((text.getStyle () & SWT.READ_ONLY) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java
deleted file mode 100755
index d93d605552..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ToolBarTab extends Tab {
- /* Example widgets and groups that contain them */
- ToolBar imageToolBar, textToolBar;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ToolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the image tool bar */
- imageToolBarGroup = new Group (exampleGroup, SWT.NULL);
- imageToolBarGroup.setLayout (new GridLayout ());
- imageToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageToolBarGroup.setText (ControlExample.getResourceString("Image_ToolBar"));
-
- /* Create a group for the text tool bar */
- textToolBarGroup = new Group (exampleGroup, SWT.NULL);
- textToolBarGroup.setLayout (new GridLayout ());
- textToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textToolBarGroup.setText (ControlExample.getResourceString("Text_ToolBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (flatButton.getSelection()) style |= SWT.FLAT;
- if (wrapButton.getSelection()) style |= SWT.WRAP;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /*
- * Create the example widgets.
- *
- * A tool bar must consist of all image tool
- * items or all text tool items but not both.
- */
-
- /* Create the image tool bar */
- imageToolBar = new ToolBar (imageToolBarGroup, style);
- ToolItem item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlExample.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener(new DropDownSelectionListener());
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (ControlExample.getResourceString("Check"));
- item.setToolTipText(ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlExample.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (ControlExample.getResourceString("Drop_Down"));
- item.setToolTipText(ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener(new DropDownSelectionListener());
-
- /*
- * Do not add the selection event for this drop down
- * tool item. Without hooking the event, the drop down
- * widget does nothing special when the drop down area
- * is selected.
- */
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- flatButton = new Button (styleGroup, SWT.CHECK);
- flatButton.setText (ControlExample.getResourceString("SWT_FLAT"));
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText (ControlExample.getResourceString("SWT_WRAP"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("ToolBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- flatButton.setSelection ((imageToolBar.getStyle () & SWT.FLAT) != 0);
- wrapButton.setSelection ((imageToolBar.getStyle () & SWT.WRAP) != 0);
- borderButton.setSelection ((imageToolBar.getStyle () & SWT.BORDER) != 0);
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java
deleted file mode 100755
index 20fde39d95..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TreeTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Tree tree1, tree2;
- Group treeGroup, imageTreeGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TreeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text tree */
- treeGroup = new Group (exampleGroup, SWT.NULL);
- treeGroup.setLayout (new GridLayout ());
- treeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- treeGroup.setText (ControlExample.getResourceString("Tree"));
-
- /* Create a group for the image tree */
- imageTreeGroup = new Group (exampleGroup, SWT.NULL);
- imageTreeGroup.setLayout (new GridLayout ());
- imageTreeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageTreeGroup.setText (ControlExample.getResourceString("Tree_With_Images"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection()) style |= SWT.SINGLE;
- if (multiButton.getSelection()) style |= SWT.MULTI;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- node1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- node2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- node3.setImage (instance.images[ControlExample.ciClosedFolder]);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- node4.setImage (instance.images[ControlExample.ciClosedFolder]);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- node1_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- node2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- node3_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- node2_2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
- node2_2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Tree");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/closedFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/closedFolder.gif
deleted file mode 100644
index 6660d0b11a..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/closedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/openFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/openFolder.gif
deleted file mode 100644
index fc9943f111..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/openFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/target.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/target.gif
deleted file mode 100644
index 9807ae648d..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/target.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
deleted file mode 100755
index 5494a3e186..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ /dev/null
@@ -1,1728 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
- /**
- * File Viewer example
- */
-public class FileViewer {
- private static ResourceBundle resourceBundle;
- private final static String DRIVE_A = "a:" + File.separator;
- private final static String DRIVE_B = "b:" + File.separator;
-
- /* UI elements */
- private Display display;
- private Shell shell;
- private ToolBar toolBar;
-
- private Label numObjectsLabel;
- private Label diskSpaceLabel;
-
- private File currentDirectory = null;
- private boolean initial = true;
-
- /* Drag and drop optimizations */
- private boolean isDragging = false; // if this app is dragging
- private boolean isDropping = false; // if this app is dropping
-
- private File[] processedDropFiles = null; // so Drag only deletes what it needs to
- private File[] deferredRefreshFiles = null; // to defer notifyRefreshFiles while we do DND
- private boolean deferredRefreshRequested = false; // to defer notifyRefreshFiles while we do DND
- private ProgressDialog progressDialog = null; // progress dialog for locally-initiated operations
-
- /* Combo view */
- private static final String COMBODATA_ROOTS = "Combo.roots";
- // File[]: Array of files whose paths are currently displayed in the combo
- private static final String COMBODATA_LASTTEXT = "Combo.lastText";
- // String: Previous selection text string
-
- private Combo combo;
-
- /* Tree view */
- private static final String TREEITEMDATA_FILE = "TreeItem.file";
- // File: File associated with tree item
- private static final String TREEITEMDATA_IMAGEEXPANDED = "TreeItem.imageExpanded";
- // Image: shown when item is expanded
- private static final String TREEITEMDATA_IMAGECOLLAPSED = "TreeItem.imageCollapsed";
- // Image: shown when item is collapsed
- private static final String TREEITEMDATA_STUB = "TreeItem.stub";
- // Object: if not present or null then the item has not been populated
-
- private Tree tree;
- private Label treeScopeLabel;
-
- /* Table view */
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(
- DateFormat.MEDIUM, DateFormat.MEDIUM);
- private static final String TABLEITEMDATA_FILE = "TableItem.file";
- // File: File associated with table row
- private static final String TABLEDATA_DIR = "Table.dir";
- // File: Currently visible directory
- private static final int[] tableWidths = new int[] {150, 60, 75, 150};
- private final String[] tableTitles = new String [] {
- FileViewer.getResourceString("table.Name.title"),
- FileViewer.getResourceString("table.Size.title"),
- FileViewer.getResourceString("table.Type.title"),
- FileViewer.getResourceString("table.Modified.title")
- };
- private Table table;
- private Label tableContentsOfLabel;
-
- /* Table update worker */
- // Control data
- private final Object workerLock = new Object();
- // Lock for all worker control data and state
- private volatile Thread workerThread = null;
- // The worker's thread
- private volatile boolean workerStopped = false;
- // True if the worker must exit on completion of the current cycle
- private volatile boolean workerCancelled = false;
- // True if the worker must cancel its operations prematurely perhaps due to a state update
-
- // Worker state information -- this is what gets synchronized by an update
- private volatile File workerStateDir = null;
-
- // State information to use for the next cycle
- private volatile File workerNextDir = null;
-
- /* Simulate only flag */
- // when true, disables actual filesystem manipulations and outputs results to standard out
- private boolean simulateOnly = true;
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
- new FileViewer().open();
- }
-
- /**
- * Opens the main program.
- */
- void open() {
- // Create the window
- display = new Display();
- IconCache.initResources(display);
- shell = new Shell();
- createShellContents();
- notifyRefreshFiles(null);
- shell.open();
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- // Cleanup
- workerStop();
- IconCache.freeResources();
- display.dispose();
- }
- /**
- * Closes the main program.
- */
- void close() {
- workerStop(); // be polite
- shell.close();
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Construct the UI
- *
- * @param container the ShellContainer managing the Shell we are rendering inside
- */
- private void createShellContents() {
- shell.setText(getResourceString("Title", new Object[] { "" }));
- shell.setImage(IconCache.stockImages[IconCache.shellIcon]);
- Menu bar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(bar);
- createFileMenu(bar);
- createHelpMenu(bar);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = gridLayout.marginWidth = 0;
- shell.setLayout(gridLayout);
-
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.widthHint = 185;
- createComboView(shell, gridData);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- createToolBar(shell, gridData);
-
- SashForm sashForm = new SashForm(shell, SWT.NONE);
- sashForm.setOrientation(SWT.HORIZONTAL);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- sashForm.setLayoutData(gridData);
- createTreeView(sashForm);
- createTableView(sashForm);
- sashForm.setWeights(new int[] { 2, 5 });
-
- numObjectsLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.widthHint = 185;
- numObjectsLabel.setLayoutData(gridData);
-
- diskSpaceLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- diskSpaceLabel.setLayoutData(gridData);
- }
-
- /**
- * Creates the File Menu.
- *
- * @param parent the parent menu
- */
- private void createFileMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.File.text"));
- header.setMenu(menu);
-
- final MenuItem simulateItem = new MenuItem(menu, SWT.CHECK);
- simulateItem.setText(getResourceString("menu.File.SimulateOnly.text"));
- simulateItem.setSelection(simulateOnly);
- simulateItem.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- simulateOnly = simulateItem.getSelection();
- }
- });
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.File.Close.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- close();
- }
- });
- }
-
- /**
- * Creates the Help Menu.
- *
- * @param parent the parent menu
- */
- private void createHelpMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.Help.text"));
- header.setMenu(menu);
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.Help.About.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.About.title"));
- box.setMessage(getResourceString("dialog.About.description",
- new Object[] { System.getProperty("os.name") }));
- box.open();
- }
- });
- }
-
- /**
- * Creates the toolbar
- *
- * @param shell the shell on which to attach the toolbar
- * @param layoutData the layout data
- */
- private void createToolBar(final Shell shell, Object layoutData) {
- toolBar = new ToolBar(shell, SWT.NULL);
- toolBar.setLayoutData(layoutData);
- ToolItem item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdParent]);
- item.setToolTipText(getResourceString("tool.Parent.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doParent();
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdRefresh]);
- item.setToolTipText(getResourceString("tool.Refresh.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doRefresh();
- }
- });
- SelectionAdapter unimplementedListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.NotImplemented.title"));
- box.setMessage(getResourceString("dialog.ActionNotImplemented.description"));
- box.open();
- }
- };
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdCut]);
- item.setToolTipText(getResourceString("tool.Cut.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdCopy]);
- item.setToolTipText(getResourceString("tool.Copy.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdPaste]);
- item.setToolTipText(getResourceString("tool.Paste.tiptext")); item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdDelete]);
- item.setToolTipText(getResourceString("tool.Delete.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdRename]);
- item.setToolTipText(getResourceString("tool.Rename.tiptext"));
- item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdSearch]);
- item.setToolTipText(getResourceString("tool.Search.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdPrint]);
- item.setToolTipText(getResourceString("tool.Print.tiptext"));
- item.addSelectionListener(unimplementedListener);
- }
-
- /**
- * Creates the combo box view.
- *
- * @param parent the parent control
- */
- private void createComboView(Composite parent, Object layoutData) {
- combo = new Combo(parent, SWT.NONE);
- combo.setLayoutData(layoutData);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- final File[] roots = (File[]) combo.getData(COMBODATA_ROOTS);
- if (roots == null) return;
- int selection = combo.getSelectionIndex();
- if (selection >= 0 && selection < roots.length) {
- notifySelectedDirectory(roots[selection]);
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- final String lastText = (String) combo.getData(COMBODATA_LASTTEXT);
- String text = combo.getText();
- if (text == null) return;
- if (lastText != null && lastText.equals(text)) return;
- combo.setData(COMBODATA_LASTTEXT, text);
- notifySelectedDirectory(new File(text));
- }
- });
- }
-
- /**
- * Creates the file tree view.
- *
- * @param parent the parent control
- */
- private void createTreeView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
-
- treeScopeLabel = new Label(composite, SWT.BORDER);
- treeScopeLabel.setText(FileViewer.getResourceString("details.AllFolders.text"));
- treeScopeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- tree = new Tree(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- tree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- File file = (File) item.getData(TREEITEMDATA_FILE);
-
- notifySelectedDirectory(file);
- }
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- item.setExpanded(true);
- treeExpandItem(item);
- }
- }
- });
- tree.addTreeListener(new TreeAdapter() {
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGEEXPANDED);
- if (image != null) item.setImage(image);
- treeExpandItem(item);
- }
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGECOLLAPSED);
- if (image != null) item.setImage(image);
- }
- });
- createTreeDragSource(tree);
- createTreeDropTarget(tree);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the tree.
- *
- * @return the DragSource for the tree
- */
- private DragSource createTreeDragSource(final Tree tree){
- DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TreeItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = tree.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- processedDropFiles = null;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- processedDropFiles = null;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TREEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the tree.
- *
- * @return the DropTarget for the tree
- */
- private DropTarget createTreeDropTarget(final Tree tree) {
- DropTarget dropTarget = new DropTarget(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item != null) {
- // We are over a particular item in the tree, use the item's file
- targetFile = (File) item.getData(TREEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Handles expand events on a tree item.
- *
- * @param item the TreeItem to fill in
- */
- private void treeExpandItem(TreeItem item) {
- shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]);
- final Object stub = item.getData(TREEITEMDATA_STUB);
- if (stub == null) treeRefreshItem(item, true);
- shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]);
- }
-
- /**
- * Traverse the entire tree and update only what has changed.
- *
- * @param roots the root directory listing
- */
- private void treeRefresh(File[] masterFiles) {
- TreeItem[] items = tree.getItems();
- int masterIndex = 0;
- int itemIndex = 0;
- for (int i = 0; i < items.length; ++i) {
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterIndex == masterFiles.length)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- final File masterFile = masterFiles[masterIndex];
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- ++itemIndex;
- ++masterIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(tree, SWT.NULL, itemIndex);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- ++itemIndex;
- ++masterIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- for (;masterIndex < masterFiles.length; ++masterIndex) {
- final File masterFile = masterFiles[masterIndex];
- TreeItem newItem = new TreeItem(tree, SWT.NULL);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- }
- }
-
- /**
- * Traverse an item in the tree and update only what has changed.
- *
- * @param dirItem the tree item of the directory
- * @param forcePopulate true iff we should populate non-expanded items as well
- */
- private void treeRefreshItem(TreeItem dirItem, boolean forcePopulate) {
- final File dir = (File) dirItem.getData(TREEITEMDATA_FILE);
-
- if (! forcePopulate && ! dirItem.getExpanded()) {
- // Refresh non-expanded item
- if (dirItem.getData(TREEITEMDATA_STUB) != null) {
- treeItemRemoveAll(dirItem);
- new TreeItem(dirItem, SWT.NULL); // placeholder child item to get "expand" button
- dirItem.setData(TREEITEMDATA_STUB, null);
- }
- return;
- }
- // Refresh expanded item
- dirItem.setData(TREEITEMDATA_STUB, this); // clear stub flag
-
- /* Get directory listing */
- File[] subFiles = (dir != null) ? FileViewer.getDirectoryList(dir) : null;
- if (subFiles == null || subFiles.length == 0) {
- /* Error or no contents */
- treeItemRemoveAll(dirItem);
- dirItem.setExpanded(false);
- return;
- }
-
- /* Refresh sub-items */
- TreeItem[] items = dirItem.getItems();
- final File[] masterFiles = subFiles;
- int masterIndex = 0;
- int itemIndex = 0;
- File masterFile = null;
- for (int i = 0; i < items.length; ++i) {
- while ((masterFile == null) && (masterIndex < masterFiles.length)) {
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
-
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterFile == null)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- masterFile = null;
- ++itemIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL, itemIndex);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- masterFile = null;
- ++itemIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- while ((masterFile != null) || (masterIndex < masterFiles.length)) {
- if (masterFile != null) {
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- if (masterIndex == masterFiles.length) break;
- }
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
- }
-
- /**
- * Foreign method: removes all children of a TreeItem.
- * @param treeItem the TreeItem
- */
- private static void treeItemRemoveAll(TreeItem treeItem) {
- final TreeItem[] children = treeItem.getItems();
- for (int i = 0; i < children.length; ++i) {
- children[i].dispose();
- }
- }
-
- /**
- * Initializes a folder item.
- *
- * @param item the TreeItem to initialize
- * @param folder the File associated with this TreeItem
- */
- private void treeInitFolder(TreeItem item, File folder) {
- item.setText(folder.getName());
- item.setImage(IconCache.stockImages[IconCache.iconClosedFolder]);
- item.setData(TREEITEMDATA_FILE, folder);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, IconCache.stockImages[IconCache.iconOpenFolder]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, IconCache.stockImages[IconCache.iconClosedFolder]);
- }
-
- /**
- * Initializes a volume item.
- *
- * @param item the TreeItem to initialize
- * @param volume the File associated with this TreeItem
- */
- private void treeInitVolume(TreeItem item, File volume) {
- item.setText(volume.getPath());
- item.setImage(IconCache.stockImages[IconCache.iconClosedDrive]);
- item.setData(TREEITEMDATA_FILE, volume);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, IconCache.stockImages[IconCache.iconOpenDrive]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, IconCache.stockImages[IconCache.iconClosedDrive]);
- }
-
- /**
- * Creates the file details table.
- *
- * @param parent the parent control
- */
- private void createTableView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
- tableContentsOfLabel = new Label(composite, SWT.BORDER);
- tableContentsOfLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- for (int i = 0; i < tableTitles.length; ++i) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(tableTitles[i]);
- column.setWidth(tableWidths[i]);
- }
- table.setHeaderVisible(true);
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- notifySelectedFiles(getSelectedFiles());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- doDefaultFileAction(getSelectedFiles());
- }
- private File[] getSelectedFiles() {
- final TableItem[] items = table.getSelection();
- final File[] files = new File[items.length];
-
- for (int i = 0; i < items.length; ++i) {
- files[i] = (File) items[i].getData(TABLEITEMDATA_FILE);
- }
- return files;
- }
- });
-
- createTableDragSource(table);
- createTableDropTarget(table);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the table.
- *
- * @return the DragSource for the table
- */
- private DragSource createTableDragSource(final Table table) {
- DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TableItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = table.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TABLEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the table.
- *
- * @return the DropTarget for the table
- */
- private DropTarget createTableDropTarget(final Table table){
- DropTarget dropTarget = new DropTarget(table, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item == null) {
- // We are over an unoccupied area of the table.
- // If it is a COPY, we can use the table's root file.
- if (event.detail == DND.DROP_COPY) {
- targetFile = (File) table.getData(TABLEDATA_DIR);
- }
- } else {
- // We are over a particular item in the table, use the item's file
- targetFile = (File) item.getData(TABLEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Notifies the application components that a new current directory has been selected
- *
- * @param dir the directory that was selected, null is ignored
- */
- void notifySelectedDirectory(File dir) {
- if (dir == null) return;
- if (currentDirectory != null && dir.equals(currentDirectory)) return;
- currentDirectory = dir;
- notifySelectedFiles(null);
-
- /* Shell:
- * Sets the title to indicate the selected directory
- */
- shell.setText(getResourceString("Title", new Object[] { currentDirectory.getPath() }));
- /* Table view:
- * Displays the contents of the selected directory.
- */
- workerUpdate(dir, false);
-
- /* Combo view:
- * Sets the combo box to point to the selected directory.
- */
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
- int comboEntry = -1;
- if (comboRoots != null) {
- for (int i = 0; i < comboRoots.length; ++i) {
- if (dir.equals(comboRoots[i])) {
- comboEntry = i;
- break;
- }
- }
- }
- if (comboEntry == -1) combo.setText(dir.getPath());
- else combo.select(comboEntry);
-
- /* Tree view:
- * If not already expanded, recursively expands the parents of the specified
- * directory until it is visible.
- */
- Vector /* of File */ path = new Vector();
- // Build a stack of paths from the root of the tree
- while (dir != null) {
- path.add(dir);
- dir = dir.getParentFile();
- }
- // Recursively expand the tree to get to the specified directory
- TreeItem[] items = tree.getItems();
- TreeItem lastItem = null;
- for (int i = path.size() - 1; i >= 0; --i) {
- final File pathElement = (File) path.elementAt(i);
-
- // Search for a particular File in the array of tree items
- // No guarantee that the items are sorted in any recognizable fashion, so we'll
- // just sequential scan. There shouldn't be more than a few thousand entries.
- TreeItem item = null;
- for (int k = 0; k < items.length; ++k) {
- item = items[k];
- if (item.isDisposed()) continue;
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if (itemFile != null && itemFile.equals(pathElement)) break;
- }
- if (item == null) break;
- lastItem = item;
- if (i != 0 && !item.getExpanded()) {
- treeExpandItem(item);
- item.setExpanded(true);
- }
- items = item.getItems();
- }
- tree.setSelection((lastItem != null) ? new TreeItem[] { lastItem } : new TreeItem[0]);
- }
-
- /**
- * Notifies the application components that files have been selected
- *
- * @param files the files that were selected, null or empty array indicates no active selection
- */
- void notifySelectedFiles(File[] files) {
- /* Details:
- * Update the details that are visible on screen.
- */
- if ((files != null) && (files.length != 0)) {
- numObjectsLabel.setText(getResourceString("details.NumberOfSelectedFiles.text",
- new Object[] { new Integer(files.length) }));
- long fileSize = 0L;
- for (int i = 0; i < files.length; ++i) {
- fileSize += files[i].length();
- }
- diskSpaceLabel.setText(getResourceString("details.FileSize.text",
- new Object[] { new Long(fileSize) }));
- } else {
- // No files selected
- diskSpaceLabel.setText("");
- if (currentDirectory != null) {
- int numObjects = getDirectoryList(currentDirectory).length;
- numObjectsLabel.setText(getResourceString("details.DirNumberOfObjects.text",
- new Object[] { new Integer(numObjects) }));
- } else {
- numObjectsLabel.setText("");
- }
- }
- }
-
- /**
- * Notifies the application components that files must be refreshed
- *
- * @param files the files that need refreshing, empty array is a no-op, null refreshes all
- */
- void notifyRefreshFiles(File[] files) {
- if (files != null && files.length == 0) return;
-
- if ((deferredRefreshRequested) && (deferredRefreshFiles != null) && (files != null)) {
- // merge requests
- File[] newRequest = new File[deferredRefreshFiles.length + files.length];
- System.arraycopy(deferredRefreshFiles, 0, newRequest, 0, deferredRefreshFiles.length);
- System.arraycopy(files, 0, newRequest, deferredRefreshFiles.length, files.length);
- deferredRefreshFiles = newRequest;
- } else {
- deferredRefreshFiles = files;
- deferredRefreshRequested = true;
- }
- handleDeferredRefresh();
- }
-
- /**
- * Handles deferred Refresh notifications (due to Drag & Drop)
- */
- void handleDeferredRefresh() {
- if (isDragging || isDropping || ! deferredRefreshRequested) return;
- if (progressDialog != null) {
- progressDialog.close();
- progressDialog = null;
- }
-
- deferredRefreshRequested = false;
- File[] files = deferredRefreshFiles;
- deferredRefreshFiles = null;
-
- shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]);
-
- /* Table view:
- * Refreshes information about any files in the list and their children.
- */
- boolean refreshTable = false;
- if (files != null) {
- for (int i = 0; i < files.length; ++i) {
- final File file = files[i];
- if (file.equals(currentDirectory)) {
- refreshTable = true;
- break;
- }
- File parentFile = file.getParentFile();
- if ((parentFile != null) && (parentFile.equals(currentDirectory))) {
- refreshTable = true;
- break;
- }
- }
- } else refreshTable = true;
- if (refreshTable) workerUpdate(currentDirectory, true);
-
- /* Combo view:
- * Refreshes the list of roots
- */
- final File[] roots = getRoots();
-
- if (files == null) {
- boolean refreshCombo = false;
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
-
- if ((comboRoots != null) && (comboRoots.length == roots.length)) {
- for (int i = 0; i < roots.length; ++i) {
- if (! roots[i].equals(comboRoots[i])) {
- refreshCombo = true;
- break;
- }
- }
- } else refreshCombo = true;
-
- if (refreshCombo) {
- combo.removeAll();
- combo.setData(COMBODATA_ROOTS, roots);
- for (int i = 0; i < roots.length; ++i) {
- final File file = roots[i];
- combo.add(file.getPath());
- }
- }
- }
-
- /* Tree view:
- * Refreshes information about any files in the list and their children.
- */
- treeRefresh(roots);
-
- // Remind everyone where we are in the filesystem
- final File dir = currentDirectory;
- currentDirectory = null;
- notifySelectedDirectory(dir);
-
- shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]);
- }
-
- /**
- * Performs the default action on a set of files.
- *
- * @param files the array of files to process
- */
- void doDefaultFileAction(File[] files) {
- // only uses the 1st file (for now)
- if (files.length == 0) return;
- final File file = files[0];
-
- if (file.isDirectory()) {
- notifySelectedDirectory(file);
- } else {
- final String fileName = file.getAbsolutePath();
- if (! Program.launch(fileName)) {
- MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
- dialog.setMessage(getResourceString("error.FailedLaunch.message", new Object[] { fileName }));
- dialog.setText(shell.getText ());
- dialog.open();
- }
- }
- }
-
- /**
- * Navigates to the parent directory
- */
- void doParent() {
- if (currentDirectory == null) return;
- File parentDirectory = currentDirectory.getParentFile();
- notifySelectedDirectory(parentDirectory);
- }
-
- /**
- * Performs a refresh
- */
- void doRefresh() {
- notifyRefreshFiles(null);
- }
-
- /**
- * Validates a drop target as a candidate for a drop operation.
- * <p>
- * Used in dragOver() and dropAccept().<br>
- * Note event.detail is set to DND.DROP_NONE by this method if the target is not valid.
- * </p>
- * @param event the DropTargetEvent to validate
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private boolean dropTargetValidate(DropTargetEvent event, File targetFile) {
- if (targetFile != null && targetFile.isDirectory()) {
- if (event.detail != DND.DROP_COPY && event.detail != DND.DROP_MOVE) {
- event.detail = DND.DROP_MOVE;
- }
- } else {
- event.detail = DND.DROP_NONE;
- }
- return event.detail != DND.DROP_NONE;
- }
-
- /**
- * Handles a drop on a dropTarget.
- * <p>
- * Used in drop().<br>
- * Note event.detail is modified by this method.
- * </p>
- * @param event the DropTargetEvent passed as parameter to the drop() method
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private void dropTargetHandleDrop(DropTargetEvent event, File targetFile) {
- // Get dropped data (an array of filenames)
- if (! dropTargetValidate(event, targetFile)) return;
- final String[] sourceNames = (String[]) event.data;
- if (sourceNames == null) event.detail = DND.DROP_NONE;
- if (event.detail == DND.DROP_NONE) return;
-
- // Open progress dialog
- progressDialog = new ProgressDialog(shell,
- (event.detail == DND.DROP_MOVE) ? ProgressDialog.MOVE : ProgressDialog.COPY);
- progressDialog.setTotalWorkUnits(sourceNames.length);
- progressDialog.open();
-
- // Copy each file
- Vector /* of File */ processedFiles = new Vector();
- for (int i = 0; (i < sourceNames.length) && (! progressDialog.isCancelled()); i++){
- final File source = new File(sourceNames[i]);
- final File dest = new File(targetFile, source.getName());
- if (source.equals(dest)) continue; // ignore if in same location
-
- progressDialog.setDetailFile(source, ProgressDialog.COPY);
- while (! progressDialog.isCancelled()) {
- if (copyFileStructure(source, dest)) {
- processedFiles.add(source);
- break;
- } else if (! progressDialog.isCancelled()) {
- if (event.detail == DND.DROP_MOVE && (!isDragging)) {
- // It is not possible to notify an external drag source that a drop
- // operation was only partially successful. This is particularly a
- // problem for DROP_MOVE operations since unless the source gets
- // DROP_NONE, it will delete the original data including bits that
- // may not have been transferred successfully.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.RETRY | SWT.CANCEL);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.CANCEL) {
- i = sourceNames.length;
- event.detail = DND.DROP_NONE;
- break;
- }
- } else {
- // We can recover gracefully from errors if the drag source belongs
- // to this application since it will look at processedDropFiles.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button != SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- }
- if (isDragging) {
- // Remember exactly which files we processed
- processedDropFiles = ((File[]) processedFiles.toArray(new File[processedFiles.size()]));
- } else {
- progressDialog.close();
- progressDialog = null;
- }
- notifyRefreshFiles(new File[] { targetFile });
- }
-
- /**
- * Handles the completion of a drag on a dragSource.
- * <p>
- * Used in dragFinished().<br>
- * </p>
- * @param event the DragSourceEvent passed as parameter to the dragFinished() method
- * @param sourceNames the names of the files that were dragged (event.data is invalid)
- */
- private void dragSourceHandleDragFinished(DragSourceEvent event, String[] sourceNames) {
- if (sourceNames == null) return;
- if (event.detail != DND.DROP_MOVE) return;
-
- // Get array of files that were actually transferred
- final File[] sourceFiles;
- if (processedDropFiles != null) {
- sourceFiles = processedDropFiles;
- } else {
- sourceFiles = new File[sourceNames.length];
- for (int i = 0; i < sourceNames.length; ++i)
- sourceFiles[i] = new File(sourceNames[i]);
- }
- if (progressDialog == null)
- progressDialog = new ProgressDialog(shell, ProgressDialog.MOVE);
- progressDialog.setTotalWorkUnits(sourceFiles.length);
- progressDialog.setProgress(0);
- progressDialog.open();
-
- // Delete each file
- for (int i = 0; (i < sourceFiles.length) && (! progressDialog.isCancelled()); i++){
- final File source = sourceFiles[i];
- progressDialog.setDetailFile(source, ProgressDialog.DELETE);
- while (! progressDialog.isCancelled()) {
- if (deleteFileStructure(source)) {
- break;
- } else if (! progressDialog.isCancelled()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedDelete.title"));
- box.setMessage(getResourceString("dialog.FailedDelete.description",
- new Object[] { source }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button == SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- notifyRefreshFiles(sourceFiles);
- progressDialog.close();
- progressDialog = null;
- }
-
- /**
- * Gets filesystem root entries
- *
- * @return an array of Files corresponding to the root directories on the platform,
- * may be empty but not null
- */
- File[] getRoots() {
- /*
- * On JDK 1.22 only...
- */
- // return File.listRoots();
-
- /*
- * On JDK 1.1.7 and beyond...
- * -- PORTABILITY ISSUES HERE --
- */
- if (System.getProperty ("os.name").indexOf ("Windows") != -1) {
- Vector /* of File */ list = new Vector();
- list.add(new File(DRIVE_A));
- list.add(new File(DRIVE_B));
- for (char i = 'c'; i <= 'z'; ++i) {
- File drive = new File(i + ":" + File.separator);
- if (drive.isDirectory() && drive.exists()) {
- list.add(drive);
- if (initial && i == 'c') {
- currentDirectory = drive;
- initial = false;
- }
- }
- }
- File[] roots = (File[]) list.toArray(new File[list.size()]);
- sortFiles(roots);
- return roots;
- } else {
- File root = new File(File.separator);
- if (initial) {
- currentDirectory = root;
- }
- return new File[] { root };
- }
- }
-
- /**
- * Gets a directory listing
- *
- * @param file the directory to be listed
- * @return an array of files this directory contains, may be empty but not null
- */
- static File[] getDirectoryList(File file) {
- File[] list = file.listFiles();
- if (list == null) return new File[0];
- sortFiles(list);
- return list;
- }
-
- /**
- * Copies a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @param newFile the location of the new file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean copyFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
-
- // ensure that newFile is not a child of oldFile or a dupe
- File searchFile = newFile;
- do {
- if (oldFile.equals(searchFile)) return false;
- searchFile = searchFile.getParentFile();
- } while (searchFile != null);
-
- if (oldFile.isDirectory()) {
- /*
- * Copy a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.COPY);
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.DirectoriesCreated.text",
- // new Object[] { newFile.getPath() }));
- } else {
- if (! newFile.mkdirs()) return false;
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- File newSubFile = new File(newFile, oldSubFile.getName());
- if (! copyFileStructure(oldSubFile, newSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- } else {
- /*
- * Copy a file
- */
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.CopyFromTo.text",
- // new Object[] { oldFile.getPath(), newFile.getPath() }));
- } else {
- FileReader in = null;
- FileWriter out = null;
- try {
- in = new FileReader(oldFile);
- out = new FileWriter(newFile);
-
- int count;
- while ((count = in.read()) != -1) out.write(count);
- } catch (FileNotFoundException e) {
- return false;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- if (in != null) in.close();
- if (out != null) out.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Deletes a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean deleteFileStructure(File oldFile) {
- if (oldFile == null) return false;
- if (oldFile.isDirectory()) {
- /*
- * Delete a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.DELETE);
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- if (! deleteFileStructure(oldSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.Delete.text",
- // new Object[] { oldFile.getPath(), oldFile.getPath() }));
- return true;
- } else {
- return oldFile.delete();
- }
- }
-
- /**
- * Sorts files lexicographically by name.
- *
- * @param files the array of Files to be sorted
- */
- static void sortFiles(File[] files) {
- /* Very lazy merge sort algorithm */
- sortBlock(files, 0, files.length - 1, new File[files.length]);
- }
- private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) {
- final int length = end - start + 1;
- if (length < 8) {
- for (int i = end; i > start; --i) {
- for (int j = end; j > start; --j) {
- if (compareFiles(files[j - 1], files[j]) > 0) {
- final File temp = files[j];
- files[j] = files[j-1];
- files[j-1] = temp;
- }
- }
- }
- return;
- }
- final int mid = (start + end) / 2;
- sortBlock(files, start, mid, mergeTemp);
- sortBlock(files, mid + 1, end, mergeTemp);
- int x = start;
- int y = mid + 1;
- for (int i = 0; i < length; ++i) {
- if ((x > mid) || ((y <= end) && compareFiles(files[x], files[y]) > 0)) {
- mergeTemp[i] = files[y++];
- } else {
- mergeTemp[i] = files[x++];
- }
- }
- for (int i = 0; i < length; ++i) files[i + start] = mergeTemp[i];
- }
- private static int compareFiles(File a, File b) {
-// boolean aIsDir = a.isDirectory();
-// boolean bIsDir = b.isDirectory();
-// if (aIsDir && ! bIsDir) return -1;
-// if (bIsDir && ! aIsDir) return 1;
-
- // sort case-sensitive files in a case-insensitive manner
- int compare = a.getName().compareToIgnoreCase(b.getName());
- if (compare == 0) compare = a.getName().compareTo(b.getName());
- return compare;
- }
-
- /*
- * This worker updates the table with file information in the background.
- * <p>
- * Implementation notes:
- * <ul>
- * <li> It is designed such that it can be interrupted cleanly.
- * <li> It uses asyncExec() in some places to ensure that SWT Widgets are manipulated in the
- * right thread. Exclusive use of syncExec() would be inappropriate as it would require a pair
- * of context switches between each table update operation.
- * </ul>
- * </p>
- */
-
- /**
- * Stops the worker and waits for it to terminate.
- */
- void workerStop() {
- if (workerThread == null) return;
- synchronized(workerLock) {
- workerCancelled = true;
- workerStopped = true;
- workerLock.notifyAll();
- }
- while (workerThread != null) {
- if (! display.readAndDispatch()) display.sleep();
- }
- }
-
- /**
- * Notifies the worker that it should update itself with new data.
- * Cancels any previous operation and begins a new one.
- *
- * @param dir the new base directory for the table, null is ignored
- * @param force if true causes a refresh even if the data is the same
- */
- void workerUpdate(File dir, boolean force) {
- if (dir == null) return;
- if ((!force) && (workerNextDir != null) && (workerNextDir.equals(dir))) return;
-
- synchronized(workerLock) {
- workerNextDir = dir;
- workerStopped = false;
- workerCancelled = true;
- workerLock.notifyAll();
- }
- if (workerThread == null) {
- workerThread = new Thread(workerRunnable);
- workerThread.start();
- }
- }
-
- /**
- * Manages the worker's thread
- */
- private final Runnable workerRunnable = new Runnable() {
- public void run() {
- while (! workerStopped) {
- synchronized(workerLock) {
- workerCancelled = false;
- workerStateDir = workerNextDir;
- }
- workerExecute();
- synchronized(workerLock) {
- try {
- if ((!workerCancelled) && (workerStateDir == workerNextDir)) workerLock.wait();
- } catch (InterruptedException e) {
- }
- }
- }
- workerThread = null;
- // wake up UI thread in case it is in a modal loop awaiting thread termination
- // (see workerStop())
- display.wake();
- }
- };
-
- /**
- * Updates the table's contents
- */
- private void workerExecute() {
- File[] dirList;
-
- // Clear existing information
- display.syncExec(new Runnable() {
- public void run() {
- tableContentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text",
- new Object[] { workerStateDir.getPath() }));
- table.removeAll();
- table.setRedraw(false);
- table.setData(TABLEDATA_DIR, workerStateDir);
- }
- });
- dirList = getDirectoryList(workerStateDir);
-
- for (int i = 0; (! workerCancelled) && (i < dirList.length); i++) {
- final File theFile = dirList[i];
- workerAddFileDetails(dirList[i]);
-
- final boolean doIncrementalRefresh = ((i & 127) == 127);
- if (doIncrementalRefresh) display.syncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- table.setRedraw(false);
- }
- });
- }
-
- // Allow the table to refresh itself
- display.asyncExec(new Runnable() {
- public void run() {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- }
- });
- }
-
- /**
- * Adds a file's detail information to the directory list
- */
- private void workerAddFileDetails(final File file) {
- final String nameString = file.getName();
- final String dateString = dateFormat.format(new Date(file.lastModified()));
- final String sizeString;
- final String typeString;
- final Image iconImage;
-
- if (file.isDirectory()) {
- typeString = getResourceString("filetype.Folder");
- sizeString = "";
- iconImage = IconCache.stockImages[IconCache.iconClosedFolder];
- } else {
- sizeString = getResourceString("filesize.KB",
- new Object[] { new Long((file.length() + 512) / 1024) });
-
- int dot = nameString.lastIndexOf('.');
- if (dot != -1) {
- String extension = nameString.substring(dot);
- Program program = Program.findProgram(extension);
- if (program != null) {
- typeString = program.getName();
- iconImage = IconCache.getIconFromProgram(program);
- } else {
- typeString = getResourceString("filetype.Unknown", new Object[] { extension.toUpperCase() });
- iconImage = IconCache.stockImages[IconCache.iconFile];
- }
- } else {
- typeString = getResourceString("filetype.None");
- iconImage = IconCache.stockImages[IconCache.iconFile];
- }
- }
- final String[] strings = new String[] { nameString, sizeString, typeString, dateString };
-
- display.asyncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- TableItem tableItem = new TableItem(table, 0);
- tableItem.setText(strings);
- tableItem.setImage(iconImage);
- tableItem.setData(TABLEITEMDATA_FILE, file);
- }
- });
- }
-
- /**
- * Instances of this class manage a progress dialog for file operations.
- */
- class ProgressDialog {
- public final static int COPY = 0;
- public final static int DELETE = 1;
- public final static int MOVE = 2;
-
- Shell shell;
- Label messageLabel, detailLabel;
- ProgressBar progressBar;
- Button cancelButton;
- boolean isCancelled = false;
-
- final String operationKeyName[] = {
- "Copy",
- "Delete",
- "Move"
- };
-
- /**
- * Creates a progress dialog but does not open it immediately.
- *
- * @param parent the parent Shell
- * @param style one of COPY, MOVE
- */
- public ProgressDialog(Shell parent, int style) {
- shell = new Shell(parent, SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- shell.setText(getResourceString("progressDialog." + operationKeyName[style] + ".title"));
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- isCancelled = true;
- }
- });
-
- messageLabel = new Label(shell, SWT.HORIZONTAL);
- messageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- messageLabel.setText(getResourceString("progressDialog." + operationKeyName[style] + ".description"));
-
- progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.WRAP);
- progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- progressBar.setMinimum(0);
- progressBar.setMaximum(0);
-
- detailLabel = new Label(shell, SWT.HORIZONTAL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.widthHint = 400;
- detailLabel.setLayoutData(gridData);
-
- cancelButton = new Button(shell, SWT.PUSH);
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL));
- cancelButton.setText(getResourceString("progressDialog.cancelButton.text"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- isCancelled = true;
- cancelButton.setEnabled(false);
- }
- });
- }
- /**
- * Sets the detail text to show the filename along with a string
- * representing the operation being performed on that file.
- *
- * @param file the file to be detailed
- * @param operation one of COPY, DELETE
- */
- public void setDetailFile(File file, int operation) {
- String filename = file.getName();
- detailLabel.setText(getResourceString("progressDialog." + operationKeyName[operation] + ".operation",
- new Object[] { file }));
- }
- /**
- * Returns true if the Cancel button was been clicked.
- *
- * @return true if the Cancel button was clicked.
- */
- public boolean isCancelled() {
- return isCancelled;
- }
- /**
- * Sets the total number of work units to be performed.
- *
- * @param work the total number of work units
- */
- public void setTotalWorkUnits(int work) {
- progressBar.setMaximum(work);
- }
- /**
- * Adds to the total number of work units to be performed.
- *
- * @param work the number of work units to add
- */
- public void addWorkUnits(int work) {
- setTotalWorkUnits(progressBar.getMaximum() + work);
- }
- /**
- * Sets the progress of completion of the total work units.
- *
- * @param work the total number of work units completed
- */
- public void setProgress(int work) {
- progressBar.setSelection(work);
- while (display.readAndDispatch()); // enable event processing
- }
- /**
- * Adds to the progress of completion of the total work units.
- *
- * @param work the number of work units completed to add
- */
- public void addProgress(int work) {
- setProgress(progressBar.getSelection() + work);
- }
- /**
- * Opens the dialog.
- */
- public void open() {
- shell.pack();
- final Shell parentShell = (Shell) shell.getParent();
- Rectangle rect = parentShell.getBounds();
- Rectangle bounds = shell.getBounds();
- bounds.x = rect.x + (rect.width - bounds.width) / 2;
- bounds.y = rect.y + (rect.height - bounds.height) / 2;
- shell.setBounds(bounds);
- shell.open();
- }
- /**
- * Closes the dialog and disposes its resources.
- */
- public void close() {
- shell.close();
- shell.dispose();
- shell = null;
- messageLabel = null;
- detailLabel = null;
- progressBar = null;
- cancelButton = null;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java
deleted file mode 100755
index 239c0c615a..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Manages icons for the application.
- * This is necessary as we could easily end up creating thousands of icons
- * bearing the same image.
- */
-class IconCache {
- // Stock images
- public static final int
- shellIcon = 0,
- iconClosedDrive = 1,
- iconClosedFolder = 2,
- iconFile = 3,
- iconOpenDrive = 4,
- iconOpenFolder = 5,
- cmdCopy = 6,
- cmdCut = 7,
- cmdDelete = 8,
- cmdParent = 9,
- cmdPaste = 10,
- cmdPrint = 11,
- cmdRefresh = 12,
- cmdRename = 13,
- cmdSearch = 14;
- public static final String[] stockImageLocations = {
- "generic_example.gif",
- "icon_ClosedDrive.gif",
- "icon_ClosedFolder.gif",
- "icon_File.gif",
- "icon_OpenDrive.gif",
- "icon_OpenFolder.gif",
- "cmd_Copy.gif",
- "cmd_Cut.gif",
- "cmd_Delete.gif",
- "cmd_Parent.gif",
- "cmd_Paste.gif",
- "cmd_Print.gif",
- "cmd_Refresh.gif",
- "cmd_Rename.gif",
- "cmd_Search.gif"
- };
- public static Image stockImages[];
-
- // Stock cursors
- public static final int
- cursorDefault = 0,
- cursorWait = 1;
- public static Cursor stockCursors[];
- // Cached icons
- private static Hashtable iconCache; /* map Program to Image */
- /**
- * Loads the resources
- *
- * @param display the display
- */
- public static void initResources(Display display) {
- if (stockImages == null) {
- stockImages = new Image[stockImageLocations.length];
-
- for (int i = 0; i < stockImageLocations.length; ++i) {
- Image image = createStockImage(display, stockImageLocations[i]);
- if (image == null) {
- freeResources();
- throw new IllegalStateException(
- FileViewer.getResourceString("error.CouldNotLoadResources"));
- }
- stockImages[i] = image;
- }
- }
- if (stockCursors == null) {
- stockCursors = new Cursor[] {
- null,
- new Cursor(display, SWT.CURSOR_WAIT)
- };
- }
- iconCache = new Hashtable();
- }
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (stockImages != null) {
- for (int i = 0; i < stockImages.length; ++i) {
- final Image image = stockImages[i];
- if (image != null) image.dispose();
- }
- stockImages = null;
- }
- if (iconCache != null) {
- for (Enumeration it = iconCache.elements(); it.hasMoreElements(); ) {
- Image image = (Image) it.nextElement();
- image.dispose();
- }
- }
- }
- /**
- * Creates a stock image
- *
- * @param display the display
- * @param path the relative path to the icon
- */
- private static Image createStockImage(Display display, String path) {
- try {
- InputStream stream = IconCache.class.getResourceAsStream(path);
- if (stream != null) {
- ImageData imageData = new ImageData(stream);
- if (imageData != null) {
- ImageData mask = imageData.getTransparencyMask();
- return new Image(display, imageData, mask);
- }
- }
- } catch (Exception e) {
- }
- return null;
- }
- /**
- * Gets an image for a file associated with a given program
- *
- * @param program the Program
- */
- public static Image getIconFromProgram(Program program) {
- Image image = (Image) iconCache.get(program);
- if (image == null) {
- ImageData imageData = program.getImageData();
- if (imageData != null) {
- image = new Image(null, imageData, imageData.getTransparencyMask());
- iconCache.put(program, image);
- } else {
- image = stockImages[iconFile];
- }
- }
- return image;
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
deleted file mode 100755
index 4274b070ac..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
deleted file mode 100755
index eb948b94b0..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
deleted file mode 100755
index 6f647666d3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
deleted file mode 100755
index 9b278e6fa8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
deleted file mode 100755
index 75e0ab2352..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
deleted file mode 100755
index 4dfa8cd3fa..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
deleted file mode 100755
index a063c230ac..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
deleted file mode 100755
index 25b1325e52..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
deleted file mode 100755
index 6dc3ebefc9..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
deleted file mode 100755
index 04e530e37c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif
deleted file mode 100755
index 6b86d07978..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
deleted file mode 100755
index 7b2b6334ca..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java
deleted file mode 100755
index 9126eaa3be..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.widgets.*;
-
-/*
-* This example demonstrates the minimum amount of code required to open an SWT Shell
-* and process the events.
-*/
-public class HelloWorld1 {
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java
deleted file mode 100755
index 6dfe3d07f4..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld1 and demonstrates the minimum amount
-* of code required to open an SWT Shell with a Label and process the events.
-*/
-
-public class HelloWorld2 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.setBounds (shell.getClientArea ());
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java
deleted file mode 100755
index acfa7c1f13..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld2 and demonstrates how to resize the
-* Label when the Shell resizes using a Listener mechanism.
-*/
-
-public class HelloWorld3 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- final Shell shell = new Shell (display);
- final Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.pack();
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- label.setBounds (shell.getClientArea ());
- }
- });
- shell.pack();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
deleted file mode 100755
index 7c1b36d385..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld2 and demonstrates how to resize the
-* Label when the Shell resizes using a Layout.
-*/
-
-public class HelloWorld4 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- shell.setLayout(new FillLayout());
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- shell.pack ();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java
deleted file mode 100755
index 056054c772..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld1 and demonstrates how to draw directly
-* on an SWT Control.
-*/
-
-public class HelloWorld5 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- final Color red = new Color(display, 0xFF, 0, 0);
- final Shell shell = new Shell (display);
- shell.addPaintListener(new PaintListener () {
- public void paintControl(PaintEvent event){
- GC gc = event.gc;
- gc.setForeground(red);
- Rectangle rect = shell.getClientArea();
- gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);
- gc.drawString(resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);
- }
- });
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- red.dispose();
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
deleted file mode 100755
index 82af776ea6..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.swt.examples.hoverhelp;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.text.*; import java.util.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
-/**
- * This example demonstrates how to implement hover help feedback
- * using the MouseTrackListener.
- */
-public class HoverHelp {
- private static ResourceBundle resourceBundle;
- static final int
- hhiInformation = 0,
- hhiWarning = 1;
- static final String[] imageLocations = {
- "information.gif",
- "warning.gif"
- };
- Image images[];
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- resourceBundle = ResourceBundle.getBundle("examples_hoverhelp");
- new HoverHelp().open();
- }
-
- /**
- * Opens the main program.
- */
- public void open() {
- // Create the display
- Display display = new Display();
-
- // Load the images
- Class clazz = HoverHelp.class;
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- InputStream stream = clazz.getResourceAsStream(imageLocations[i]);
- ImageData source = new ImageData(stream);
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(display, source, mask);
- }
- }
- } catch (Throwable ex) {
- System.err.println(getResourceString("error.CouldNotLoadResources",
- new Object[] { ex.getMessage() }));
- display.dispose();
- return;
- }
-
- // Create the window
- Shell shell = new Shell();
- createPartControl(shell);
- shell.pack();
- shell.open();
-
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
-
- // Cleanup
- display.dispose();
-
- /* Free resources */
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Creates the example
- */
- public void createPartControl(Composite frame) {
- final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- frame.setLayout(layout);
-
- ToolBar bar = new ToolBar (frame, SWT.BORDER);
- for (int i=0; i<5; i++) {
- ToolItem item = new ToolItem (bar, SWT.PUSH);
- item.setText (getResourceString("ToolItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("ToolItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("ToolItem.help", new Object[] { item.getText() });
- }
- });
- }
- GridData gridData = new GridData();
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
- tooltip.activateHoverHelp(bar);
-
- Table table = new Table (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TableItem item = new TableItem (table, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiInformation]);
- item.setText (getResourceString("TableItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TableItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TableItem.help", new Object[] { item.getText() });
- }
- });
- }
- table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(table);
-
- Tree tree = new Tree (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TreeItem item = new TreeItem (tree, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiWarning]);
- item.setText (getResourceString("TreeItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TreeItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TreeItem.help", new Object[] { item.getText() });
- }
- });
- }
- tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(tree);
-
- Button button = new Button (frame, SWT.PUSH);
- button.setText (getResourceString("Hello.text"));
- button.setData ("TIP_TEXT", getResourceString("Hello.tooltip"));
- tooltip.activateHoverHelp(button);
- }
-
- /**
- * Emulated tooltip handler
- * Notice that we could display anything in a tooltip besides text and images.
- * For instance, it might make sense to embed large tables of data or buttons linking
- * data under inspection to material elsewhere, or perform dynamic lookup for creating
- * tooltip text on the fly.
- */
- protected static class ToolTipHandler {
- private Shell parentShell;
- private Shell tipShell;
- private Label tipLabelImage, tipLabelText;
- private Widget tipWidget; // widget this tooltip is hovering over
- private Point tipPosition; // the position being hovered over
-
- /**
- * Creates a new tooltip handler
- *
- * @param parent the parent Shell
- */
- public ToolTipHandler(Shell parent) {
- final Display display = parent.getDisplay();
- this.parentShell = parent;
-
- tipShell = new Shell(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginWidth = 2;
- gridLayout.marginHeight = 2;
- tipShell.setLayout(gridLayout);
-
- tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- tipLabelImage = new Label(tipShell, SWT.NONE);
- tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelImage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
-
- tipLabelText = new Label(tipShell, SWT.NONE);
- tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
- }
-
- /**
- * Enables customized hover help for a specified control
- *
- * @control the control on which to enable hoverhelp
- */
- public void activateHoverHelp(final Control control) {
- /*
- * Get out of the way if we attempt to activate the control underneath the tooltip
- */
- control.addMouseListener(new MouseAdapter () {
- public void mouseDown (MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- }
- });
-
- /*
- * Trap hover events to pop-up tooltip
- */
- control.addMouseTrackListener(new MouseTrackAdapter () {
- public void mouseExit(MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- tipWidget = null;
- }
- public void mouseHover (MouseEvent event) {
- Point pt = new Point (event.x, event.y);
- Widget widget = event.widget;
- if (widget instanceof ToolBar) {
- ToolBar w = (ToolBar) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Table) {
- Table w = (Table) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Tree) {
- Tree w = (Tree) widget;
- widget = w.getItem (pt);
- }
- if (widget == null) {
- tipShell.setVisible(false);
- tipWidget = null;
- return;
- }
- if (widget == tipWidget) return;
- tipWidget = widget;
- tipPosition = control.toDisplay(pt);
- String text = (String) widget.getData("TIP_TEXT");
- Image image = (Image) widget.getData("TIP_IMAGE");
- tipLabelText.setText(text != null ? text : "");
- tipLabelImage.setImage(image); // accepts null
- tipShell.pack();
- setHoverLocation(tipShell, tipPosition);
- tipShell.setVisible(true);
- }
- });
-
- /*
- * Trap F1 Help to pop up a custom help box
- */
- control.addHelpListener(new HelpListener () {
- public void helpRequested(HelpEvent event) {
- if (tipWidget == null) return;
- ToolTipHelpTextHandler handler = (ToolTipHelpTextHandler)
- tipWidget.getData("TIP_HELPTEXTHANDLER");
- if (handler == null) return;
- String text = handler.getHelpText(tipWidget);
- if (text == null) return;
-
- if (tipShell.isVisible()) {
- tipShell.setVisible(false);
- Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM);
- helpShell.setLayout(new FillLayout());
- Label label = new Label(helpShell, SWT.NONE);
- label.setText(text);
- helpShell.pack();
- setHoverLocation(helpShell, tipPosition);
- helpShell.open();
- }
- }
- });
- }
-
- /**
- * Sets the location for a hovering shell
- * @param shell the object that is to hover
- * @param position the position of a widget to hover over
- * @return the top-left location for a hovering box
- */
- private void setHoverLocation(Shell shell, Point position) {
- Rectangle displayBounds = shell.getDisplay().getBounds();
- Rectangle shellBounds = shell.getBounds();
- shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
- shellBounds.y = Math.max(Math.min(position.y + 16, displayBounds.height - shellBounds.height), 0);
- shell.setBounds(shellBounds);
- }
- }
-
- /**
- * ToolTip help handler
- */
- protected interface ToolTipHelpTextHandler {
- /**
- * Get help text
- * @param widget the widget that is under help
- * @return a help text string
- */
- public String getHelpText(Widget widget);
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif
deleted file mode 100755
index 26c7477336..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif
deleted file mode 100755
index cf4fdf93c7..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
deleted file mode 100755
index ec2069d809..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ /dev/null
@@ -1,2019 +0,0 @@
-package org.eclipse.swt.examples.imageanalyzer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.printing.*;
-import java.util.*;
-import java.net.*;
-import java.io.*;
-import java.text.MessageFormat;
-
-public class ImageAnalyzer {
- static ResourceBundle bundle = ResourceBundle.getBundle("examples_images");
-
- Display display;
- Shell shell;
- Canvas imageCanvas, paletteCanvas;
- Label typeLabel, sizeLabel, depthLabel, transparentPixelLabel,
- timeToLoadLabel, screenSizeLabel, backgroundPixelLabel,
- locationLabel, disposalMethodLabel, delayTimeLabel,
- repeatCountLabel, paletteLabel, dataLabel, statusLabel;
- Combo backgroundCombo, scaleXCombo, scaleYCombo, alphaCombo;
- Button incrementalCheck, transparentCheck, maskCheck, backgroundCheck;
- Button previousButton, nextButton, animateButton;
- Text dataText;
- Sash sash;
- Color whiteColor, blackColor, redColor, greenColor, blueColor, canvasBackground;
- Font fixedWidthFont;
- Cursor crossCursor;
- GC imageCanvasGC;
-
- int paletteWidth = 140; // recalculated and used as a width hint
- int ix = 0, iy = 0, py = 0; // used to scroll the image and palette
- float xscale = 1, yscale = 1; // used to scale the image
- int alpha = 255; // used to modify the alpha value of the image
- boolean incremental = false; // used to incrementally display an image
- boolean transparent = true; // used to display an image with transparency
- boolean showMask = false; // used to display an icon mask or transparent image mask
- boolean showBackground = false; // used to display the background of an animated image
- boolean animate = false; // used to animate a multi-image file
- Thread animateThread; // draws animated images
- Thread incrementalThread; // draws incremental images
- String lastPath; // used to seed the file dialog
- String currentName; // the current image file or URL name
- String fileName; // the current image file
- ImageLoader loader; // the loader for the current image file
- ImageData[] imageDataArray; // all image data read from the current file
- int imageDataIndex; // the index of the current image data
- ImageData imageData; // the currently-displayed image data
- Image image; // the currently-displayed image
- Vector incrementalEvents; // incremental image events
- long loadTime = 0; // the time it took to load the current image
-
- static final int ALPHA_CONSTANT = 0;
- static final int ALPHA_X = 1;
- static final int ALPHA_Y = 2;
-
- class TextPrompter extends Dialog {
- String message = "";
- String result = null;
- Shell dialog;
- Text text;
- public TextPrompter (Shell parent, int style) {
- super (parent, style);
- }
- public TextPrompter (Shell parent) {
- this (parent, SWT.APPLICATION_MODAL);
- }
- public String getMessage () {
- return message;
- }
- public void setMessage (String string) {
- message = string;
- }
- public String open () {
- dialog = new Shell(getParent(), getStyle());
- dialog.setText(getText());
- dialog.setLayout(new GridLayout());
- Label label = new Label(dialog, SWT.NULL);
- label.setText(message);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text = new Text(dialog, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- text.setLayoutData(data);
- Composite buttons = new Composite(dialog, SWT.NONE);
- GridLayout grid = new GridLayout();
- grid.numColumns = 2;
- buttons.setLayout(grid);
- buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Button ok = new Button(buttons, SWT.PUSH);
- ok.setText(bundle.getString("OK"));
- data = new GridData();
- data.widthHint = 75;
- ok.setLayoutData(data);
- ok.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- result = text.getText();
- dialog.dispose();
- }
- });
- Button cancel = new Button(buttons, SWT.PUSH);
- cancel.setText(bundle.getString("Cancel"));
- data = new GridData();
- data.widthHint = 75;
- cancel.setLayoutData(data);
- cancel.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- dialog.dispose();
- }
- });
- dialog.setDefaultButton(ok);
- dialog.pack();
- dialog.open();
- while (!dialog.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- return result;
- }
- }
- public static void main(String [] args) {
- ImageAnalyzer imageAnalyzer = new ImageAnalyzer();
- imageAnalyzer.open();
- }
- void open() {
- // Create a window and set its title.
- shell = new Shell();
- shell.setText(bundle.getString("Image_analyzer"));
-
- // Hook resize and dispose listeners.
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent event) {
- resizeShell(event);
- }
- });
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent event) {
- if (animate && animateThread != null) {
- // Stop the animation and wait for the
- // thread to die before disposing the shell.
- animate = false;
- while (animateThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- }
- });
- // Create colors and fonts.
- display = shell.getDisplay();
- whiteColor = new Color(display, 255, 255, 255);
- blackColor = new Color(display, 0, 0, 0);
- redColor = new Color(display, 255, 0, 0);
- greenColor = new Color(display, 0, 255, 0);
- blueColor = new Color(display, 0, 0, 255);
- fixedWidthFont = new Font(display, "courier", 10, 0);
- crossCursor = new Cursor(display, SWT.CURSOR_CROSS);
-
- // Add a menu bar and widgets.
- Menu menuBar = createMenuBar();
- createWidgets();
- shell.pack();
-
- // Create a GC for drawing, and hook the listener to dispose it.
- imageCanvasGC = new GC(imageCanvas);
- imageCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- imageCanvasGC.dispose();
- }
- });
-
- // Open the window, and run an event loop until the window is closed.
- shell.open();
- while (!shell.isDisposed())
- if (!display.readAndDispatch()) display.sleep();
- // Clean up.
- if (image != null)
- image.dispose();
- whiteColor.dispose();
- blackColor.dispose();
- redColor.dispose();
- greenColor.dispose();
- blueColor.dispose();
- fixedWidthFont.dispose();
- crossCursor.dispose();
- }
- void createWidgets() {
- // Add the widgets to the shell in a grid layout.
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.numColumns = 2;
- shell.setLayout(layout);
- // Separate the menu bar from the rest of the widgets.
- Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(gridData);
-
- // Add a composite to contain some control widgets across the top.
- Composite controls = new Composite(shell, SWT.NULL);
- RowLayout rowLayout = new RowLayout();
- rowLayout.marginTop = 0;
- rowLayout.marginBottom = 5;
- rowLayout.spacing = 8;
- controls.setLayout(rowLayout);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- controls.setLayoutData(gridData);
-
- // Combo to change the background.
- Group group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Background"));
- backgroundCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- backgroundCombo.setItems(new String[] {
- bundle.getString("None"),
- bundle.getString("White"),
- bundle.getString("Black"),
- bundle.getString("Red"),
- bundle.getString("Green"),
- bundle.getString("Blue")});
- backgroundCombo.select(backgroundCombo.indexOf(bundle.getString("White")));
- backgroundCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- changeBackground();
- }
- });
-
- // Combo to change the x scale.
- String[] values = {
- "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1",
- "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2",
- "3", "4", "5", "6", "7", "8", "9", "10",};
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("X_scale"));
- scaleXCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleXCombo.add(values[i]);
- }
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleXCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleX();
- }
- });
-
- // Combo to change the y scale.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Y_scale"));
- scaleYCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleYCombo.add(values[i]);
- }
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- scaleYCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleY();
- }
- });
-
- // Combo to change the alpha value.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Alpha_K"));
- alphaCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- for (int i = 0; i <= 255; i += 5) {
- alphaCombo.add(String.valueOf(i));
- }
- alphaCombo.select(alphaCombo.indexOf("255"));
- alphaCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- alpha();
- }
- });
-
- // Check box to request incremental display.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Display"));
- incrementalCheck = new Button(group, SWT.CHECK);
- incrementalCheck.setText(bundle.getString("Incremental"));
- incrementalCheck.setSelection(incremental);
- incrementalCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- incremental = ((Button)event.widget).getSelection();
- }
- });
- // Check box to request transparent display.
- transparentCheck = new Button(group, SWT.CHECK);
- transparentCheck.setText(bundle.getString("Transparent"));
- transparentCheck.setSelection(transparent);
- transparentCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- transparent = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
- // Check box to request mask display.
- maskCheck = new Button(group, SWT.CHECK);
- maskCheck.setText(bundle.getString("Mask"));
- maskCheck.setSelection(showMask);
- maskCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showMask = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
- // Check box to request background display.
- backgroundCheck = new Button(group, SWT.CHECK);
- backgroundCheck.setText(bundle.getString("Background"));
- backgroundCheck.setSelection(showBackground);
- backgroundCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showBackground = ((Button)event.widget).getSelection();
- }
- });
- // Group the animation buttons.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Animation"));
- // Push button to display the previous image in a multi-image file.
- previousButton = new Button(group, SWT.PUSH);
- previousButton.setText(bundle.getString("Previous"));
- previousButton.setEnabled(false);
- previousButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- previous();
- }
- });
- // Push button to display the next image in a multi-image file.
- nextButton = new Button(group, SWT.PUSH);
- nextButton.setText(bundle.getString("Next"));
- nextButton.setEnabled(false);
- nextButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- next();
- }
- });
- // Push button to toggle animation of a multi-image file.
- animateButton = new Button(group, SWT.PUSH);
- animateButton.setText(bundle.getString("Animate"));
- animateButton.setEnabled(false);
- animateButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate();
- }
- });
- // Label to show the image file type.
- typeLabel = new Label(shell, SWT.NULL);
- typeLabel.setText(bundle.getString("Type_initial"));
- typeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Canvas to show the image.
- imageCanvas = new Canvas(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE);
- imageCanvas.setBackground(whiteColor);
- imageCanvas.setCursor(crossCursor);
- gridData = new GridData();
- gridData.verticalSpan = 15;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- imageCanvas.setLayoutData(gridData);
- imageCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintImage(event);
- }
- });
- imageCanvas.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent event) {
- if (image != null) {
- showColorAt(event.x, event.y);
- }
- }
- });
- // Set up the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- horizontal.setVisible(true);
- horizontal.setMinimum(0);
- horizontal.setEnabled(false);
- horizontal.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollHorizontally((ScrollBar)event.widget);
- }
- });
- ScrollBar vertical = imageCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollVertically((ScrollBar)event.widget);
- }
- });
- // Label to show the image size.
- sizeLabel = new Label(shell, SWT.NULL);
- sizeLabel.setText(bundle.getString("Size_initial"));
- sizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image depth.
- depthLabel = new Label(shell, SWT.NULL);
- depthLabel.setText(bundle.getString("Depth_initial"));
- depthLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the transparent pixel.
- transparentPixelLabel = new Label(shell, SWT.NULL);
- transparentPixelLabel.setText(bundle.getString("Transparent_pixel_initial"));
- transparentPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the time to load.
- timeToLoadLabel = new Label(shell, SWT.NULL);
- timeToLoadLabel.setText(bundle.getString("Time_to_load_initial"));
- timeToLoadLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the rest of the fields.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the logical screen size for animation.
- screenSizeLabel = new Label(shell, SWT.NULL);
- screenSizeLabel.setText(bundle.getString("Animation_size_initial"));
- screenSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the background pixel.
- backgroundPixelLabel = new Label(shell, SWT.NULL);
- backgroundPixelLabel.setText(bundle.getString("Background_pixel_initial"));
- backgroundPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image location (x, y).
- locationLabel = new Label(shell, SWT.NULL);
- locationLabel.setText(bundle.getString("Image_location_initial"));
- locationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image disposal method.
- disposalMethodLabel = new Label(shell, SWT.NULL);
- disposalMethodLabel.setText(bundle.getString("Disposal_initial"));
- disposalMethodLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image delay time.
- delayTimeLabel = new Label(shell, SWT.NULL);
- delayTimeLabel.setText(bundle.getString("Delay_initial"));
- delayTimeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the background pixel.
- repeatCountLabel = new Label(shell, SWT.NULL);
- repeatCountLabel.setText(bundle.getString("Repeats_initial"));
- repeatCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the palette.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show if the image has a direct or indexed palette.
- paletteLabel = new Label(shell, SWT.NULL);
- paletteLabel.setText(bundle.getString("Palette_initial"));
- paletteLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Canvas to show the image's palette.
- paletteCanvas = new Canvas(shell, SWT.BORDER | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
- paletteCanvas.setFont(fixedWidthFont);
- paletteCanvas.getVerticalBar().setVisible(true);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- GC gc = new GC(paletteLabel);
- paletteWidth = gc.stringExtent(bundle.getString("Max_length_string")).x;
- gc.dispose();
- gridData.widthHint = paletteWidth;
- gridData.heightHint = 16 * 11; // show at least 16 colors
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintPalette(event);
- }
- });
- // Set up the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setIncrement(10);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollPalette((ScrollBar)event.widget);
- }
- });
- // Sash to see more of image or image data.
- sash = new Sash(shell, SWT.HORIZONTAL);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- sash.setLayoutData(gridData);
- sash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- ((GridData)paletteCanvas.getLayoutData()).heightHint = SWT.DEFAULT;
- Rectangle paletteCanvasBounds = paletteCanvas.getBounds();
- int minY = paletteCanvasBounds.y + 20;
- Rectangle dataLabelBounds = dataLabel.getBounds();
- int maxY = statusLabel.getBounds().y - dataLabelBounds.height - 20;
- if (event.y > minY && event.y < maxY) {
- Rectangle oldSash = sash.getBounds();
- sash.setBounds(event.x, event.y, event.width, event.height);
- int diff = event.y - oldSash.y;
- Rectangle bounds = imageCanvas.getBounds();
- imageCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = paletteCanvasBounds;
- paletteCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = dataLabelBounds;
- dataLabel.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height);
- bounds = dataText.getBounds();
- dataText.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height - diff);
- //shell.layout(true);
- }
- }
- }
- });
-
- // Label to show data-specific fields.
- dataLabel = new Label(shell, SWT.NULL);
- dataLabel.setText(bundle.getString("Pixel_data_initial"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- dataLabel.setLayoutData(gridData);
-
- // Text to show a dump of the data.
- dataText = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
- dataText.setFont(fixedWidthFont);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.heightHint = 128;
- gridData.grabExcessVerticalSpace = true;
- dataText.setLayoutData(gridData);
- dataText.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
- if (image != null && event.button == 1) {
- showColorForData();
- }
- }
- });
- dataText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (image != null) {
- showColorForData();
- }
- }
- });
-
- // Label to show status and cursor location in image.
- statusLabel = new Label(shell, SWT.NULL);
- statusLabel.setText("");
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- statusLabel.setLayoutData(gridData);
- }
-
- Menu createMenuBar() {
- // Menu bar.
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
- createFileMenu(menuBar);
- createAlphaMenu(menuBar);
- return menuBar;
- }
-
- void createFileMenu(Menu menuBar) {
- // File menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("File"));
- Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(fileMenu);
- // File -> Open File...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenFile"));
- item.setAccelerator(SWT.CTRL + 'O');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenFile();
- }
- });
-
- // File -> Open URL...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenURL"));
- item.setAccelerator(SWT.CTRL + 'U');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenURL();
- }
- });
-
- // File -> Reopen
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Reopen"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuReopen();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Save
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save"));
- item.setAccelerator(SWT.CTRL + 'S');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSave();
- }
- });
-
- // File -> Save As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveAs();
- }
- });
-
- // File -> Save Mask As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_mask_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveMaskAs();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Print
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Print"));
- item.setAccelerator(SWT.CTRL + 'P');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuPrint();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
- // File -> Exit
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Exit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate = false; // stop any animation in progress
- shell.close();
- }
- });
-
- }
-
- void createAlphaMenu(Menu menuBar) {
- // Alpha menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("Alpha"));
- Menu alphaMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(alphaMenu);
-
- // Alpha -> K
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("K");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_CONSTANT);
- }
- });
- // Alpha -> (K + x) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + x) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_X);
- }
- });
-
- // Alpha -> (K + y) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + y) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_Y);
- }
- });
- }
- void menuComposeAlpha(int alpha_op) {
- if (image == null) return;
- animate = false; // stop any animation in progress
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- if (alpha_op == ALPHA_CONSTANT) {
- imageData.alpha = alpha;
- } else {
- imageData.alpha = -1;
- switch (alpha_op) {
- case ALPHA_X:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (x + alpha) % 256);
- }
- }
- break;
- case ALPHA_Y:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (y + alpha) % 256);
- }
- }
- break;
- default: break;
- }
- }
- displayImage(imageData);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
- void menuOpenFile() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image file.
- FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
- if (lastPath != null)
- fileChooser.setFilterPath(lastPath);
- fileChooser.setFilterExtensions(new String[] { "*.bmp; *.gif; *.ico; *.jpg; *.pcx; *.png; *.tif", "*.bmp", "*.gif", "*.ico", "*.jpg", "*.pcx", "*.png", "*.tif" });
- fileChooser.setFilterNames(new String[] { bundle.getString("All_images") + " (bmp, gif, ico, jpg, pcx, png, tif)",
- "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PCX (*.pcx)", "PNG (*.png)", "TIFF (*.tif)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(filename);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) { // Cache the filename.
- currentName = filename;
- fileName = filename;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Loading_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuOpenURL() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image URL.
- TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- textPrompter.setText(bundle.getString("OpenURLDialog"));
- textPrompter.setMessage(bundle.getString("EnterURL"));
- String urlname = textPrompter.open();
- if (urlname == null) return;
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- URL url = new URL(urlname);
- InputStream stream = url.openStream();
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(stream);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) {
- currentName = urlname;
- fileName = null;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Loading_lc"), urlname, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- /*
- * Called to start a thread that draws incremental images
- * as they are loaded.
- */
- void incrementalThreadStart() {
- incrementalEvents = new Vector();
- incrementalThread = new Thread("Incremental") {
- public void run() {
- // Draw the first ImageData increment.
- while (incrementalEvents != null) {
- // Synchronize so we don't try to remove when the vector is null.
- synchronized (ImageAnalyzer.this) {
- if (incrementalEvents != null) {
- if (incrementalEvents.size() > 0) {
- ImageLoaderEvent event = (ImageLoaderEvent) incrementalEvents.remove(0);
- if (image != null) image.dispose();
- image = new Image(display, event.imageData);
- imageData = event.imageData;
- imageCanvasGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } else {
- yield();
- }
- }
- }
- }
- display.wake();
- }
- };
- incrementalThread.setDaemon(true);
- incrementalThread.start();
- }
-
- /*
- * Called when incremental image data has been loaded,
- * for example, for interlaced GIF/PNG or progressive JPEG.
- */
- void incrementalDataLoaded(ImageLoaderEvent event) {
- // Synchronize so that we do not try to add while
- // the incremental drawing thread is removing.
- synchronized (this) {
- incrementalEvents.addElement(event);
- }
- }
-
- void menuSave() {
- if (image == null) return;
- animate = false; // stop any animation in progress
- // If the image file type is unknown, we can't 'Save',
- // so we have to use 'Save As...'.
- if (imageData.type == SWT.IMAGE_UNDEFINED || fileName == null) {
- menuSaveAs();
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the current file.
- loader.data = new ImageData[] {imageData};
- loader.save(fileName, imageData.type);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), fileName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveAs() {
- if (image == null) return;
- animate = false; // stop any animation in progress
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the specified file.
- loader.data = new ImageData[] {imageData};
- loader.save(filename, filetype);
-
- // Update the shell title and file type label,
- // and use the new file.
- fileName = filename;
- shell.setText(createMsg(bundle.getString("Analyzer_on"), filename));
- typeLabel.setText(createMsg(bundle.getString("Type_string"), fileTypeString(filetype)));
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveMaskAs() {
- if (image == null || !showMask) return;
- if (imageData.getTransparencyType() == SWT.TRANSPARENCY_NONE) return;
- animate = false; // stop any animation in progress
-
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the mask of the current image to the specified file.
- ImageData maskImageData = imageData.getTransparencyMask();
- loader.data = new ImageData[] {maskImageData};
- loader.save(filename, filetype);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuPrint() {
- if (image == null) return;
-
- try {
- // Ask the user to specify the printer.
- PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
- PrinterData printerData = dialog.open();
- if (printerData == null) return;
-
- Printer printer = new Printer(printerData);
-
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob(currentName)) {
- GC gc = new GC(printer);
- if (printer.startPage()) {
- gc.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * imageData.width,
- scaleFactor * imageData.height);
- printer.endPage();
- }
- printer.endJob();
- }
- printer.dispose();
- } catch (SWTError e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(bundle.getString("Printing_error") + e.getMessage());
- box.open();
- }
- }
-
- void menuReopen() {
- if (currentName == null) return;
- animate = false; // stop any animation in progress
- resetScrollBars();
- resetScaleCombos();
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- long startTime = System.currentTimeMillis();
- ImageData[] newImageData;
- if (fileName == null) {
- URL url = new URL(currentName);
- InputStream stream = url.openStream();
- newImageData = loader.load(stream);
- } else {
- newImageData = loader.load(fileName);
- }
- loadTime = System.currentTimeMillis() - startTime;
- imageDataIndex = 0;
- displayImage(newImageData[imageDataIndex]);
-
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Reloading_lc"), currentName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void changeBackground() {
- String background = backgroundCombo.getText();
- if (background.equals(bundle.getString("White"))) {
- imageCanvas.setBackground(whiteColor);
- } else if (background.equals(bundle.getString("Black"))) {
- imageCanvas.setBackground(blackColor);
- } else if (background.equals(bundle.getString("Red"))) {
- imageCanvas.setBackground(redColor);
- } else if (background.equals(bundle.getString("Green"))) {
- imageCanvas.setBackground(greenColor);
- } else if (background.equals(bundle.getString("Blue"))) {
- imageCanvas.setBackground(blueColor);
- } else {
- imageCanvas.setBackground(null);
- }
- // Fill the image canvas with the background color.
- Rectangle clientArea = imageCanvas.getClientArea();
- imageCanvasGC.fillRectangle(
- clientArea.x,
- clientArea.y,
- clientArea.width,
- clientArea.height);
- if (image != null) {
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the ScaleX combo selection changes.
- */
- void scaleX() {
- try {
- xscale = Float.parseFloat(scaleXCombo.getText());
- } catch (NumberFormatException e) {
- xscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the ScaleY combo selection changes.
- */
- void scaleY() {
- try {
- yscale = Float.parseFloat(scaleYCombo.getText());
- } catch (NumberFormatException e) {
- yscale = 1;
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the Alpha combo selection changes.
- */
- void alpha() {
- try {
- alpha = Integer.parseInt(alphaCombo.getText());
- } catch (NumberFormatException e) {
- alphaCombo.select(alphaCombo.indexOf("255"));
- alpha = 255;
- }
- }
-
- /*
- * Called when the mouse moves in the image canvas.
- * Show the color of the image at the point under the mouse.
- */
- void showColorAt(int mx, int my) {
- int x = mx - imageData.x - ix;
- int y = my - imageData.y - iy;
- showColorForPixel(x, y);
- }
-
- /*
- * Called when a mouse down or key press is detected
- * in the data text. Show the color of the pixel at
- * the caret position in the data text.
- */
- void showColorForData() {
- int delimiterLength = dataText.getLineDelimiter().length();
- int charactersPerLine = 6 + 3 * imageData.bytesPerLine + delimiterLength;
- int position = dataText.getCaretPosition();
- int y = position / charactersPerLine;
- if ((position - y * charactersPerLine) < 6 || ((y + 1) * charactersPerLine - position) <= delimiterLength) {
- statusLabel.setText("");
- return;
- }
- int dataPosition = position - 6 * (y + 1) - delimiterLength * y;
- int byteNumber = dataPosition / 3;
- int where = dataPosition - byteNumber * 3;
- int xByte = byteNumber % imageData.bytesPerLine;
- int x = -1;
- int depth = imageData.depth;
- if (depth == 1) { // 8 pixels per byte (can only show 3 of 8)
- if (where == 0) x = xByte * 8;
- if (where == 1) x = xByte * 8 + 3;
- if (where == 2) x = xByte * 8 + 7;
- }
- if (depth == 2) { // 4 pixels per byte (can only show 3 of 4)
- if (where == 0) x = xByte * 4;
- if (where == 1) x = xByte * 4 + 1;
- if (where == 2) x = xByte * 4 + 3;
- }
- if (depth == 4) { // 2 pixels per byte
- if (where == 0) x = xByte * 2;
- if (where == 1) x = xByte * 2;
- if (where == 2) x = xByte * 2 + 1;
- }
- if (depth == 8) { // 1 byte per pixel
- x = xByte;
- }
- if (depth == 16) { // 2 bytes per pixel
- x = xByte / 2;
- }
- if (depth == 24) { // 3 bytes per pixel
- x = xByte / 3;
- }
- if (depth == 32) { // 4 bytes per pixel
- x = xByte / 4;
- }
- if (x != -1) {
- showColorForPixel(x, y);
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Set the status label to show color information
- * for the specified pixel in the image.
- */
- void showColorForPixel(int x, int y) {
- if (x >= 0 && x < imageData.width && y >= 0 && y < imageData.height) {
- int pixel = imageData.getPixel(x, y);
- RGB rgb = imageData.palette.getRGB(pixel);
-
- Object[] args = {new Integer(x),
- new Integer(y),
- new Integer(pixel),
- Integer.toHexString(pixel),
- rgb};
- if (pixel == imageData.transparentPixel) {
- statusLabel.setText(createMsg(bundle.getString("Color_at_trans"), args));
- } else {
- statusLabel.setText(createMsg(bundle.getString("Color_at"), args));
- }
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Called when the Animate button is pressed.
- */
- void animate() {
- animate = !animate;
- if (animate && image != null && imageDataArray.length > 1) {
- animateThread = new Thread(bundle.getString("Animation")) {
- public void run() {
- // Pre-animation widget setup.
- preAnimation();
-
- // Animate.
- try {
- animateLoop();
- } catch (final SWTException e) {
- display.syncExec(new Runnable() {
- public void run() {
- showErrorDialog(createMsg(bundle.getString("Creating_image"),
- new Integer(imageDataIndex+1)),
- currentName, e);
- }
- });
- }
-
- // Post animation widget reset.
- postAnimation();
- }
- };
- animateThread.setDaemon(true);
- animateThread.start();
- }
- }
-
- /*
- * Loop through all of the images in a multi-image file
- * and display them one after another.
- */
- void animateLoop() {
- // Create an off-screen image to draw on, and a GC to draw with.
- // Both are disposed after the animation.
- Image offScreenImage = new Image(display, loader.logicalScreenWidth, loader.logicalScreenHeight);
- GC offScreenImageGC = new GC(offScreenImage);
-
- try {
- // Use syncExec to get the background color of the imageCanvas.
- display.syncExec(new Runnable() {
- public void run() {
- canvasBackground = imageCanvas.getBackground();
- }
- });
-
- // Fill the off-screen image with the background color of the canvas.
- offScreenImageGC.setBackground(canvasBackground);
- offScreenImageGC.fillRectangle(
- 0,
- 0,
- loader.logicalScreenWidth,
- loader.logicalScreenHeight);
-
- // Draw the current image onto the off-screen image.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- int repeatCount = loader.repeatCount;
- while (animate && (loader.repeatCount == 0 || repeatCount > 0)) {
- if (imageData.disposalMethod == SWT.DM_FILL_BACKGROUND) {
- // Fill with the background color before drawing.
- Color bgColor = null;
- int backgroundPixel = loader.backgroundPixel;
- if (showBackground && backgroundPixel != -1) {
- // Fill with the background color.
- RGB backgroundRGB = imageData.palette.getRGB(backgroundPixel);
- bgColor = new Color(null, backgroundRGB);
- }
- try {
- offScreenImageGC.setBackground(bgColor != null ? bgColor : canvasBackground);
- offScreenImageGC.fillRectangle(
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } finally {
- if (bgColor != null) bgColor.dispose();
- }
- } else if (imageData.disposalMethod == SWT.DM_FILL_PREVIOUS) {
- // Restore the previous image before drawing.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- }
-
- // Get the next image data.
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- imageData = imageDataArray[imageDataIndex];
- image.dispose();
- image = new Image(display, imageData);
-
- // Draw the new image data.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- // Draw the off-screen image to the screen.
- imageCanvasGC.drawImage(offScreenImage, 0, 0);
-
- // Sleep for the specified delay time before drawing again.
- try {
- Thread.sleep(visibleDelay(imageData.delayTime * 10));
- } catch (InterruptedException e) {
- }
-
- // If we have just drawn the last image in the set,
- // then decrement the repeat count.
- if (imageDataIndex == imageDataArray.length - 1) repeatCount--;
- }
- } finally {
- offScreenImage.dispose();
- offScreenImageGC.dispose();
- }
- }
- /*
- * Pre animation setup.
- */
- void preAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Change the label of the Animate button to 'Stop'.
- animateButton.setText(bundle.getString("Stop"));
-
- // Disable anything we don't want the user
- // to select during the animation.
- previousButton.setEnabled(false);
- nextButton.setEnabled(false);
- backgroundCombo.setEnabled(false);
- scaleXCombo.setEnabled(false);
- scaleYCombo.setEnabled(false);
- alphaCombo.setEnabled(false);
- incrementalCheck.setEnabled(false);
- transparentCheck.setEnabled(false);
- maskCheck.setEnabled(false);
- // leave backgroundCheck enabled
-
- // Reset the scale combos and scrollbars.
- resetScaleCombos();
- resetScrollBars();
- }
- });
- }
-
- /*
- * Post animation reset.
- */
- void postAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Enable anything we disabled before the animation.
- previousButton.setEnabled(true);
- nextButton.setEnabled(true);
- backgroundCombo.setEnabled(true);
- scaleXCombo.setEnabled(true);
- scaleYCombo.setEnabled(true);
- alphaCombo.setEnabled(true);
- incrementalCheck.setEnabled(true);
- transparentCheck.setEnabled(true);
- maskCheck.setEnabled(true);
-
- // Reset the label of the Animate button.
- animateButton.setText(bundle.getString("Animate"));
-
- if (animate) {
- // If animate is still true, we finished the
- // full number of repeats. Leave the image as-is.
- animate = false;
- } else {
- // Redisplay the current image and its palette.
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
- });
- }
-
- /*
- * Called when the Previous button is pressed.
- * Display the previous image in a multi-image file.
- */
- void previous() {
- if (image != null && imageDataArray.length > 1) {
- if (imageDataIndex == 0) {
- imageDataIndex = imageDataArray.length;
- }
- imageDataIndex = imageDataIndex - 1;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
- /*
- * Called when the Next button is pressed.
- * Display the next image in a multi-image file.
- */
- void next() {
- if (image != null && imageDataArray.length > 1) {
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
-
- void displayImage(ImageData newImageData) {
- if (incremental && incrementalThread != null) {
- // Tell the incremental thread to stop drawing.
- synchronized (this) {
- incrementalEvents = null;
- }
-
- // Wait until the incremental thread is done.
- while (incrementalThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
-
- // Dispose of the old image, if there was one.
- if (image != null) image.dispose();
-
- try {
- // Cache the new image and imageData.
- image = new Image(display, newImageData);
- imageData = newImageData;
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Creating_from") + " ", currentName, e);
- image = null;
- return;
- }
-
- // Update the widgets with the new image info.
- String string = createMsg(bundle.getString("Analyzer_on"), currentName);
- shell.setText(string);
-
- if (imageDataArray.length > 1) {
- string = createMsg(bundle.getString("Type_index"),
- new Object[] {fileTypeString(imageData.type),
- new Integer(imageDataIndex + 1),
- new Integer(imageDataArray.length)});
- } else {
- string = createMsg(bundle.getString("Type_string"), fileTypeString(imageData.type));
- }
- typeLabel.setText(string);
-
- string = createMsg(bundle.getString("Size_value"),
- new Object[] {new Integer(imageData.width),
- new Integer(imageData.height)});
- sizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Depth_value"), new Integer(imageData.depth));
- depthLabel.setText(string);
-
- string = createMsg(bundle.getString("Transparent_pixel_value"), pixelInfo(imageData.transparentPixel));
- transparentPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Time_to_load_value"), new Long(loadTime));
- timeToLoadLabel.setText(string);
-
- string = createMsg(bundle.getString("Animation_size_value"),
- new Object[] {new Integer(loader.logicalScreenWidth),
- new Integer(loader.logicalScreenHeight)});
- screenSizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Background_pixel_value"), pixelInfo(loader.backgroundPixel));
- backgroundPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Image_location_value"),
- new Object[] {new Integer(imageData.x), new Integer(imageData.y)});
- locationLabel.setText(string);
-
- string = createMsg(bundle.getString("Disposal_value"),
- new Object[] {new Integer(imageData.disposalMethod),
- disposalString(imageData.disposalMethod)});
- disposalMethodLabel.setText(string);
-
- int delay = imageData.delayTime * 10;
- int delayUsed = visibleDelay(delay);
- if (delay != delayUsed) {
- string = createMsg(bundle.getString("Delay_value"),
- new Object[] {new Integer(delay), new Integer(delayUsed)});
- } else {
- string = createMsg(bundle.getString("Delay_used"), new Integer(delay));
- }
- delayTimeLabel.setText(string);
-
- if (loader.repeatCount == 0) {
- string = createMsg( bundle.getString("Repeats_forever"), new Integer(loader.repeatCount));
- } else {
- string = createMsg(bundle.getString("Repeats_value"), new Integer(loader.repeatCount));
- }
- repeatCountLabel.setText(string);
-
- if (imageData.palette.isDirect) {
- string = bundle.getString("Palette_direct");
- } else {
- string = createMsg(bundle.getString("Palette_value"), new Integer(imageData.palette.getRGBs().length));
- }
- paletteLabel.setText(string);
-
- string = createMsg(bundle.getString("Pixel_data_value"),
- new Object[] {new Integer(imageData.bytesPerLine),
- new Integer(imageData.scanlinePad),
- depthInfo(imageData.depth)});
- dataLabel.setText(string);
-
- dataText.setText(dataHexDump(dataText.getLineDelimiter()));
- statusLabel.setText("");
-
- // Redraw both canvases.
- paletteCanvas.redraw();
- imageCanvas.redraw();
- }
-
- void paintImage(PaintEvent event) {
- Image paintImage = image;
- int transparentPixel = imageData.transparentPixel;
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = -1;
- paintImage = new Image(display, imageData);
- }
- int w = Math.round(imageData.width * xscale);
- int h = Math.round(imageData.height * yscale);
- event.gc.drawImage(
- paintImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- if (showMask && (imageData.getTransparencyType() != SWT.TRANSPARENCY_NONE)) {
- ImageData maskImageData = imageData.getTransparencyMask();
- Image maskImage = new Image(display, maskImageData);
- event.gc.drawImage(
- maskImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- w + 10 + ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- maskImage.dispose();
- }
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = transparentPixel;
- paintImage.dispose();
- }
- }
-
- void paintPalette(PaintEvent event) {
- GC gc = event.gc;
- gc.fillRectangle(paletteCanvas.getClientArea());
- if (imageData.palette.isDirect) {
- // For a direct palette, display the masks.
- int y = py + 10;
- int xTab = 50;
- gc.drawString("rMsk", 10, y, true);
- gc.drawString(toHex4ByteString(imageData.palette.redMask), xTab, y, true);
- gc.drawString("gMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.greenMask), xTab, y, true);
- gc.drawString("bMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.blueMask), xTab, y, true);
- gc.drawString("rShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.redShift), xTab, y, true);
- gc.drawString("gShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.greenShift), xTab, y, true);
- gc.drawString("bShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.blueShift), xTab, y, true);
- } else {
- // For an indexed palette, display the palette colors and indices.
- RGB[] rgbs = imageData.palette.getRGBs();
- if (rgbs != null) {
- int xTab1 = 40, xTab2 = 100;
- for (int i = 0; i < rgbs.length; i++) {
- int y = (i+1) * 10 + py;
- gc.drawString(String.valueOf(i), 10, y, true);
- gc.drawString(toHexByteString(rgbs[i].red) + toHexByteString(rgbs[i].green) + toHexByteString(rgbs[i].blue), xTab1, y, true);
- Color color = new Color(display, rgbs[i]);
- gc.setBackground(color);
- gc.fillRectangle(xTab2, y+2, 10, 10);
- color.dispose();
- }
- }
- }
- }
-
- void resizeShell(ControlEvent event) {
- if (image == null || shell.isDisposed())
- return;
- resizeScrollBars();
- }
-
- // Reset the scale combos to 1.
- void resetScaleCombos() {
- xscale = 1; yscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
-
- // Reset the scroll bars to 0.
- void resetScrollBars() {
- if (image == null) return;
- ix = 0; iy = 0; py = 0;
- resizeScrollBars();
- imageCanvas.getHorizontalBar().setSelection(0);
- imageCanvas.getVerticalBar().setSelection(0);
- paletteCanvas.getVerticalBar().setSelection(0);
- }
-
- void resizeScrollBars() {
- // Set the max and thumb for the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- ScrollBar vertical = imageCanvas.getVerticalBar();
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- if (width > canvasBounds.width) {
- // The image is wider than the canvas.
- horizontal.setEnabled(true);
- horizontal.setMaximum(width);
- horizontal.setThumb(canvasBounds.width);
- horizontal.setPageIncrement(canvasBounds.width);
- } else {
- // The canvas is wider than the image.
- horizontal.setEnabled(false);
- if (ix != 0) {
- // Make sure the image is completely visible.
- ix = 0;
- imageCanvas.redraw();
- }
- }
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // The image is taller than the canvas.
- vertical.setEnabled(true);
- vertical.setMaximum(height);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- } else {
- // The canvas is taller than the image.
- vertical.setEnabled(false);
- if (iy != 0) {
- // Make sure the image is completely visible.
- iy = 0;
- imageCanvas.redraw();
- }
- }
-
- // Set the max and thumb for the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- if (imageData.palette.isDirect) {
- vertical.setEnabled(false);
- } else { // indexed palette
- canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20; // 10 pixels each index + 20 for margins.
- vertical.setEnabled(true);
- vertical.setMaximum(paletteHeight);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- }
- }
-
- /*
- * Called when the image canvas' horizontal scrollbar is selected.
- */
- void scrollHorizontally(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (width > canvasBounds.width) {
- // Only scroll if the image is bigger than the canvas.
- int x = -scrollBar.getSelection();
- if (x + width < canvasBounds.width) {
- // Don't scroll past the end of the image.
- x = canvasBounds.width - width;
- }
- imageCanvas.scroll(x, iy, ix, iy, width, height, false);
- ix = x;
- }
- }
-
- /*
- * Called when the image canvas' vertical scrollbar is selected.
- */
- void scrollVertically(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // Only scroll if the image is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + height < canvasBounds.height) {
- // Don't scroll past the end of the image.
- y = canvasBounds.height - height;
- }
- imageCanvas.scroll(ix, y, ix, iy, width, height, false);
- iy = y;
- }
- }
- /*
- * Called when the palette canvas' vertical scrollbar is selected.
- */
- void scrollPalette(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20;
- if (paletteHeight > canvasBounds.height) {
- // Only scroll if the palette is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + paletteHeight < canvasBounds.height) {
- // Don't scroll past the end of the palette.
- y = canvasBounds.height - paletteHeight;
- }
- paletteCanvas.scroll(0, y, 0, py, paletteWidth, paletteHeight, false);
- py = y;
- }
- }
-
- /*
- * Return a String containing a line-by-line dump of
- * the data in the current imageData. The lineDelimiter
- * parameter must be a string of length 1 or 2.
- */
- String dataHexDump(String lineDelimiter) {
- if (image == null) return "";
- char[] dump = new char[imageData.height * (6 + 3 * imageData.bytesPerLine + lineDelimiter.length())];
- int index = 0;
- for (int i = 0; i < imageData.data.length; i++) {
- if (i % imageData.bytesPerLine == 0) {
- int line = i / imageData.bytesPerLine;
- dump[index++] = Character.forDigit(line / 1000 % 10, 10);
- dump[index++] = Character.forDigit(line / 100 % 10, 10);
- dump[index++] = Character.forDigit(line / 10 % 10, 10);
- dump[index++] = Character.forDigit(line % 10, 10);
- dump[index++] = ':';
- dump[index++] = ' ';
- }
- byte b = imageData.data[i];
- dump[index++] = Character.forDigit((b & 0xF0) >> 4, 16);
- dump[index++] = Character.forDigit(b & 0x0F, 16);
- dump[index++] = ' ';
- if ((i + 1) % imageData.bytesPerLine == 0) {
- dump[index++] = lineDelimiter.charAt(0);
- if (lineDelimiter.length() > 1)
- dump[index++] = lineDelimiter.charAt(1);
- }
- }
- return new String(dump);
- }
-
- /*
- * Open an error dialog displaying the specified information.
- */
- void showErrorDialog(String operation, String filename, Exception e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
- String errorMessage = "";
- if (e != null) {
- if (e instanceof SWTException) {
- SWTException swte = (SWTException) e;
- errorMessage = swte.getMessage();
- if (swte.throwable != null) {
- errorMessage += ":\n" + swte.throwable.toString();
- }
- } else {
- errorMessage = e.toString();
- }
- }
- box.setMessage(message + errorMessage);
- box.open();
- }
-
- /*
- * Return a String describing how to analyze the bytes
- * in the hex dump.
- */
- static String depthInfo(int depth) {
- Object[] args = {new Integer(depth), ""};
- switch (depth) {
- case 1:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(8), " [01234567]"});
- break;
- case 2:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(4), "[00112233]"});
- break;
- case 4:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(2), "[00001111]"});
- break;
- case 8:
- args[1] = bundle.getString("One_byte");
- break;
- case 16:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(2));
- break;
- case 24:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(3));
- break;
- case 32:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(4));
- break;
- default:
- args[1] = bundle.getString("Unsupported_lc");
- }
- return createMsg(bundle.getString("Depth_info"), args);
- }
-
- /*
- * Return the specified number of milliseconds.
- * If the specified number of milliseconds is too small
- * to see a visual change, then return a higher number.
- */
- static int visibleDelay(int ms) {
- if (ms < 20) return ms + 30;
- if (ms < 30) return ms + 10;
- return ms;
- }
-
- /*
- * Return the specified byte value as a hex string,
- * preserving leading 0's.
- */
- static String toHexByteString(int i) {
- if (i <= 0x0f)
- return "0" + Integer.toHexString(i);
- return Integer.toHexString(i & 0xff);
- }
- /*
- * Return the specified 4-byte value as a hex string,
- * preserving leading 0's.
- * (a bit 'brute force'... should probably use a loop...)
- */
- static String toHex4ByteString(int i) {
- String hex = Integer.toHexString(i);
- if (hex.length() == 1)
- return "0000000" + hex;
- if (hex.length() == 2)
- return "000000" + hex;
- if (hex.length() == 3)
- return "00000" + hex;
- if (hex.length() == 4)
- return "0000" + hex;
- if (hex.length() == 5)
- return "000" + hex;
- if (hex.length() == 6)
- return "00" + hex;
- if (hex.length() == 7)
- return "0" + hex;
- return hex;
- }
-
- /*
- * Return a String describing the specified
- * transparent or background pixel.
- */
- static String pixelInfo(int pixel) {
- if (pixel == -1)
- return pixel + " (" + bundle.getString("None_lc") + ")";
- else
- return pixel + " (0x" + Integer.toHexString(pixel) + ")";
- }
-
- /*
- * Return a String describing the specified disposal method.
- */
- static String disposalString(int disposalMethod) {
- switch (disposalMethod) {
- case SWT.DM_FILL_NONE: return bundle.getString("None_lc");
- case SWT.DM_FILL_BACKGROUND: return bundle.getString("Background_lc");
- case SWT.DM_FILL_PREVIOUS: return bundle.getString("Previous_lc");
- }
- return bundle.getString("Unspecified_lc");
- }
-
- /*
- * Return a String describing the specified image file type.
- */
- static String fileTypeString(int filetype) {
- if (filetype == SWT.IMAGE_BMP)
- return "BMP";
- if (filetype == SWT.IMAGE_GIF)
- return "GIF";
- if (filetype == SWT.IMAGE_ICO)
- return "ICO";
- if (filetype == SWT.IMAGE_JPEG)
- return "JPEG";
- if (filetype == SWT.IMAGE_PNG)
- return "PNG";
- return bundle.getString("Unknown_ac");
- }
-
- /*
- * Return the specified file's image type, based on its extension.
- * Note that this is not a very robust way to determine image type,
- * and it is only to be used in the absence of any better method.
- */
- static int determineFileType(String filename) {
- String ext = filename.substring(filename.lastIndexOf('.') + 1);
- if (ext.equalsIgnoreCase("bmp"))
- return SWT.IMAGE_BMP;
- if (ext.equalsIgnoreCase("gif"))
- return SWT.IMAGE_GIF;
- if (ext.equalsIgnoreCase("ico"))
- return SWT.IMAGE_ICO;
- if (ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg"))
- return SWT.IMAGE_JPEG;
- if (ext.equalsIgnoreCase("png"))
- return SWT.IMAGE_PNG;
- return SWT.IMAGE_UNDEFINED;
- }
-
- static String createMsg(String msg, Object[] args) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(args);
- }
-
- static String createMsg(String msg, Object arg) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(new Object[]{arg});
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
deleted file mode 100755
index 4e55c2bdbb..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-class JavaLineStyler implements LineStyleListener {
- JavaScanner scanner = new JavaScanner();
- int[] tokenColors;
- Color[] colors;
- Vector blockComments = new Vector();
-
- public static final int EOF= -1;
- public static final int EOL= 10;
-
- public static final int WORD= 0;
- public static final int WHITE= 1;
- public static final int KEY= 2;
- public static final int COMMENT= 3;
- public static final int STRING= 5;
- public static final int OTHER= 6;
- public static final int NUMBER= 7;
-
- public static final int MAXIMUM_TOKEN= 8;
-
-public JavaLineStyler() {
- initializeColors();
- scanner = new JavaScanner();
-}
-
-Color getColor(int type) {
- if (type < 0 || type >= tokenColors.length) {
- return null;
- }
- return colors[tokenColors[type]];
-}
-
-boolean inBlockComment(int start, int end) {
- for (int i=0; i<blockComments.size(); i++) {
- int[] offsets = (int[])blockComments.elementAt(i);
- // start of comment in the line
- if ((offsets[0] >= start) && (offsets[0] <= end)) return true;
- // end of comment in the line
- if ((offsets[1] >= start) && (offsets[1] <= end)) return true;
- if ((offsets[0] <= start) && (offsets[1] >= end)) return true;
- }
- return false;
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- colors= new Color[] {
- new Color(display, new RGB(0, 0, 0)), // black
- new Color(display, new RGB(255, 0, 0)), // red
- new Color(display, new RGB(0, 255, 0)), // green
- new Color(display, new RGB(0, 0, 255)) // blue
- };
- tokenColors= new int[MAXIMUM_TOKEN];
- tokenColors[WORD]= 0;
- tokenColors[WHITE]= 0;
- tokenColors[KEY]= 3;
- tokenColors[COMMENT]= 1;
- tokenColors[STRING]= 2;
- tokenColors[OTHER]= 0;
- tokenColors[NUMBER]= 0;
-}
-
-void disposeColors() {
- for (int i=0;i<colors.length;i++) {
- colors[i].dispose();
- }
-}
-
-/**
- * Event.detail line start offset (input)
- * Event.text line text (input)
- * LineStyleEvent.styles Enumeration of StyleRanges, need to be in order. (output)
- * LineStyleEvent.background line background color (output)
- */
-public void lineGetStyle(LineStyleEvent event) {
- Vector styles = new Vector();
- int token;
- StyleRange lastStyle;
- // If the line is part of a block comment, create one style for the entire line.
- if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
- styles.addElement(new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null));
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
- return;
- }
- Color defaultFgColor = ((Control)event.widget).getForeground();
- scanner.setRange(event.lineText);
- token = scanner.nextToken();
- while (token != EOF) {
- if (token == OTHER) {
- // do nothing for non-colored tokens
- } else if (token != WHITE) {
- Color color = getColor(token);
- // Only create a style if the token color is different than the
- // widget's default foreground color and the token's style is not
- // bold. Keywords are bolded.
- if ((!color.equals(defaultFgColor)) || (token == KEY)) {
- StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
- if (token == KEY) {
- style.fontStyle = SWT.BOLD;
- }
- if (styles.isEmpty()) {
- styles.addElement(style);
- } else {
- // Merge similar styles. Doing so will improve performance.
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- } else if ((!styles.isEmpty()) && ((lastStyle=(StyleRange)styles.lastElement()).fontStyle == SWT.BOLD)) {
- int start = scanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange)styles.lastElement();
- // A font style of SWT.BOLD implies that the last style
- // represents a java keyword.
- if (lastStyle.start + lastStyle.length == start) {
- // Have the white space take on the style before it to
- // minimize the number of style ranges created and the
- // number of font style changes during rendering.
- lastStyle.length += scanner.getLength();
- }
- }
- token= scanner.nextToken();
- }
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
-}
-public void parseBlockComments(String text) {
- blockComments = new Vector();
- StringReader buffer = new StringReader(text);
- int ch;
- boolean blkComment = false;
- int cnt = 0;
- int[] offsets = new int[2];
- boolean done = false;
-
- try {
- while (!done) {
- switch (ch = buffer.read()) {
- case -1 : {
- if (blkComment) {
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- done = true;
- break;
- }
- case '/' : {
- ch = buffer.read();
- if ((ch == '*') && (!blkComment)) {
- offsets = new int[2];
- offsets[0] = cnt;
- blkComment = true;
- cnt++;
- } else {
- cnt++;
- }
- cnt++;
- break;
- }
- case '*' : {
- if (blkComment) {
- ch = buffer.read();
- cnt++;
- if (ch == '/') {
- blkComment = false;
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- }
- cnt++;
- break;
- }
- default : {
- cnt++;
- break;
- }
- }
- }
- } catch(IOException e) {
- // ignore errors
- }
-}
-
-/**
- * A simple fuzzy scanner for Java
- */
-public class JavaScanner {
-
- protected Hashtable fgKeys= null;
- protected StringBuffer fBuffer= new StringBuffer();
- protected String fDoc;
- protected int fPos;
- protected int fEnd;
- protected int fStartToken;
- protected boolean fEofSeen= false;
-
- private String[] fgKeywords= {
- "abstract",
- "boolean", "break", "byte",
- "case", "catch", "char", "class", "continue",
- "default", "do", "double",
- "else", "extends",
- "false", "final", "finally", "float", "for",
- "if", "implements", "import", "instanceof", "int", "interface",
- "long",
- "native", "new", "null",
- "package", "private", "protected", "public",
- "return",
- "short", "static", "super", "switch", "synchronized",
- "this", "throw", "throws", "transient", "true", "try",
- "void", "volatile",
- "while"
- };
-
- public JavaScanner() {
- initialize();
- }
-
- /**
- * Returns the ending location of the current token in the document.
- */
- public final int getLength() {
- return fPos - fStartToken;
- }
-
- /**
- * Initialize the lookup table.
- */
- void initialize() {
- fgKeys= new Hashtable();
- Integer k= new Integer(KEY);
- for (int i= 0; i < fgKeywords.length; i++)
- fgKeys.put(fgKeywords[i], k);
- }
-
- /**
- * Returns the starting location of the current token in the document.
- */
- public final int getStartOffset() {
- return fStartToken;
- }
-
- /**
- * Returns the next lexical token in the document.
- */
- public int nextToken() {
- int c;
- fStartToken= fPos;
- while (true) {
- switch (c= read()) {
- case EOF:
- return EOF;
- case '/': // comment
- c= read();
- if (c == '/') {
- while (true) {
- c= read();
- if ((c == EOF) || (c == EOL)) {
- unread(c);
- return COMMENT;
- }
- }
- } else {
- unread(c);
- }
- return OTHER;
- case '\'': // char const
- character: for(;;) {
- c= read();
- switch (c) {
- case '\'':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '"': // string
- string: for (;;) {
- c= read();
- switch (c) {
- case '"':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- c= read();
- } while(Character.isDigit((char)c));
- unread(c);
- return NUMBER;
- default:
- if (Character.isWhitespace((char)c)) {
- do {
- c= read();
- } while(Character.isWhitespace((char)c));
- unread(c);
- return WHITE;
- }
- if (Character.isJavaIdentifierStart((char)c)) {
- fBuffer.setLength(0);
- do {
- fBuffer.append((char)c);
- c= read();
- } while(Character.isJavaIdentifierPart((char)c));
- unread(c);
- Integer i= (Integer) fgKeys.get(fBuffer.toString());
- if (i != null)
- return i.intValue();
- return WORD;
- }
- return OTHER;
- }
- }
- }
-
- /**
- * Returns next character.
- */
- protected int read() {
- if (fPos <= fEnd) {
- return fDoc.charAt(fPos++);
- }
- return EOF;
- }
-
- public void setRange(String text) {
- fDoc= text;
- fPos= 0;
- fEnd= fDoc.length() -1;
- }
-
- protected void unread(int c) {
- if (c != EOF)
- fPos--;
- }
-}
-
-
-
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java
deleted file mode 100755
index 80e2776b51..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-import java.text.*;
-
-/**
-*/
-public class JavaViewer implements DisposeListener {
- Shell shell;
- StyledText text;
- JavaLineStyler lineStyler = new JavaLineStyler();
- static ResourceBundle resources = ResourceBundle.getBundle("examples_javaviewer");
-
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- lineStyler.disposeColors();
-}
-public void widgetDisposed (DisposeEvent event) {
- text.removeLineStyleListener(lineStyler);
- text.removeDisposeListener(this);
-}
-
-Menu createFileMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
- MenuItem item;
-
- // Open
- item = new MenuItem (menu, SWT.CASCADE);
- item.setText (resources.getString("Open_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- openFile();
- }
- });
-
- // Close
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Close_menuitem"));
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- menuFileExit ();
- }
- });
- return menu;
-}
-
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
- fileItem.setText (resources.getString("File_menuitem"));
- fileItem.setMenu (createFileMenu ());
-
-}
-
-void createShell () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 400);
- shell.setLayout(layout);
-}
-void createStyledText() {
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- text.addLineStyleListener(lineStyler);
- text.addDisposeListener(this);
- text.setEditable(false);
- Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
- text.setBackground(bg);
-}
-
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-
-public static void main (String [] args) {
- JavaViewer example = new JavaViewer ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void openFile() {
- final String textString;
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.java", "*.*"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if ((name == null) || (name.length() == 0)) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- String message = MessageFormat.format(resources.getString("Err_file_no_exist"), new String[] {file.getName()});
- displayError(message);
- return;
- }
-
- try {
- FileInputStream stream= new FileInputStream(file.getPath());
- try {
- Reader in = new BufferedReader(new InputStreamReader(stream));
- char[] readBuffer= new char[2048];
- StringBuffer buffer= new StringBuffer((int) file.length());
- int n;
- while ((n = in.read(readBuffer)) > 0) {
- buffer.append(readBuffer, 0, n);
- }
- textString = buffer.toString();
- stream.close();
- }
- catch (IOException e) {
- // Err_file_io
- String message = MessageFormat.format(resources.getString("Err_file_io"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- }
- catch (FileNotFoundException e) {
- String message = MessageFormat.format(resources.getString("Err_not_found"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- // Guard against superfluous mouse move events -- defer action until later
- Display display = text.getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- text.setText(textString);
- }
- });
-
- // parse the block comments up front since block comments can go across
- // lines - inefficient way of doing this
- lineStyler.parseBlockComments(textString);
-}
-
-void menuFileExit () {
- shell.close ();
-}
-
-public void open () {
- createShell ();
- createMenuBar ();
- createStyledText ();
- shell.open ();
-}
-
-public void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java
deleted file mode 100755
index a57ad25b53..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class Images {
-
- // Bitmap Images
- public static Image Bold;
- public static Image Red;
- public static Image Green;
- public static Image Blue;
- public static Image Erase;
-
- static Image [] AllBitmaps;
-
-public static void freeAll () {
- for (int i=0; i<AllBitmaps.length; i++) AllBitmaps [i].dispose ();
- AllBitmaps = null;
-}
-
-static Image createBitmapImage(Display display, String fileName) {
- ImageData source = new ImageData(Images.class.getResourceAsStream(fileName+".bmp"));
- ImageData mask = new ImageData(Images.class.getResourceAsStream(fileName+"_mask"+".bmp"));
- return new Image (display, source, mask);
-}
-public static void loadAll (Display display) {
-
- // Bitmap Images
- Bold = createBitmapImage (display, "bold");
- Red = createBitmapImage (display, "red");
- Green = createBitmapImage (display, "green");
- Blue = createBitmapImage (display, "blue");
- Erase = createBitmapImage (display, "erase");
-
- AllBitmaps = new Image [] {
- Bold,
- Red,
- Green,
- Blue,
- Erase,
- };
-
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java
deleted file mode 100755
index 2bdbaadd94..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-/**
-*/
-public class TextEditor {
- Shell shell;
- ToolBar toolBar;
- StyledText text;
-
- Vector cachedStyles = new Vector();
- Color RED = null;
- Color BLUE = null;
- Color GREEN = null;
- Font font = null;
-
- boolean isBold = false;
-
- ExtendedModifyListener extendedModifyListener;
- VerifyKeyListener verifyKeyListener;
- static ResourceBundle resources = ResourceBundle.getBundle("examples_texteditor");
-
-/*
- * Free the allocated resources.
- */
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- if (font != null) font.dispose();
- Images.freeAll ();
- RED.dispose();
- GREEN.dispose();
- BLUE.dispose();
-}
-
-Menu createEditMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
-
- MenuItem item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Cut_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.cut();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Copy_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.copy();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Paste_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.paste();
- }
- });
-
- new MenuItem (menu, SWT.SEPARATOR);
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Font_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
- return menu;
-}
-
-
-/*
- * Set the text state to bold.
- */
-void bold(boolean bold) {
- isBold = bold;
-}
-/*
- * Clear all style data for the selected text.
- */
-void clear() {
- Point sel = text.getSelectionRange();
- if ((sel != null) && (sel.y != 0)) {
- StyleRange style;
- style = new StyleRange(sel.x, sel.y, null, null, SWT.NORMAL);
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-/*
- * Set the foreground color for the selected text.
- */
-void fgColor(int color) {
- Point sel = text.getSelectionRange();
- if ((sel == null) || (sel.y == 0)) return;
- Color fg;
- if (color == SWT.COLOR_RED) {
- fg = RED;
- } else if (color == SWT.COLOR_GREEN) {
- fg = GREEN;
- } else if (color == SWT.COLOR_BLUE) {
- fg = BLUE;
- } else {
- fg = null;
- }
- StyleRange style;
- for (int i = sel.x; i<sel.x+sel.y; i++) {
- StyleRange range = text.getStyleRangeAtOffset(i);
- if (range == null) {style = new StyleRange(i, 1, fg, null, SWT.NORMAL);}
- else {style = new StyleRange(i, 1, fg, null, range.fontStyle);};
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem editItem = new MenuItem (bar, SWT.CASCADE);
- editItem.setText (resources.getString("Edit_menuitem"));
- editItem.setMenu (createEditMenu ());
-}
-
-void createShell () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- Images.loadAll (shell.getDisplay ());
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
-}
-void createStyledText() {
- initializeColors();
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- extendedModifyListener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent e) {
- handleExtendedModify(e);
- }
- };
- text.addExtendedModifyListener(extendedModifyListener);
- verifyKeyListener = new VerifyKeyListener() {
- public void verifyKey(VerifyEvent e) {
- handleVerifyKey(e);
- }
- };
- text.addVerifyKeyListener(verifyKeyListener);
-}
-
-void createToolBar() {
- toolBar = new ToolBar(shell, SWT.NULL);
-
- ToolItem item = new ToolItem(toolBar, SWT.CHECK);
- item.setImage(Images.Bold);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- bold(((ToolItem)event.widget).getSelection());
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Red);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_RED);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Green);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_GREEN);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Blue);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_BLUE);
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Erase);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- clear();
- }
- });
-}
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-/*
- * Cache the style information for text that has been cut or copied.
- */
-void handleCutCopy() {
- // Save the cut/copied style info so that during paste we will maintain
- // the style information. Cut/copied text is put in the clipboard in
- // RTF format, but is not pasted in RTF format. The other way to
- // handle the pasting of styles would be to access the Clipboard directly and
- // parse the RTF text.
- cachedStyles = new Vector();
- Point sel = text.getSelectionRange();
- int startX = sel.x;
- for (int i=sel.x; i<=sel.x+sel.y-1; i++) {
- StyleRange style = text.getStyleRangeAtOffset(i);
- if (style != null) {
- style.start = style.start - startX;
- if (!cachedStyles.isEmpty()) {
- StyleRange lastStyle = (StyleRange)cachedStyles.lastElement();
- if (lastStyle.similarTo(style)) {
- lastStyle.length++;
- } else {
- cachedStyles.addElement(style);
- }
- } else {
- cachedStyles.addElement(style);
- }
- }
- }
-}
-void handleExtendedModify(ExtendedModifyEvent event) {
- if (event.length == 0) return;
- StyleRange style;
- if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) {
- // Have the new text take on the style of the text to its right (during
- // typing) if no style information is active.
- int caretOffset = text.getCaretOffset();
- style = null;
- if (caretOffset < text.getCharCount()) style = text.getStyleRangeAtOffset(caretOffset);
- if (style != null) {
- style.start = event.start;
- style.length = event.length;
- int fontStyle = SWT.NORMAL;
- if (isBold) fontStyle = SWT.BOLD;
- style.fontStyle = fontStyle;
- text.setStyleRange(style);
- } else if (isBold) {
- StyleRange newStyle = new StyleRange(event.start, event.length, null, null, SWT.BOLD);
- text.setStyleRange(newStyle);
- }
- } else {
- // paste occurring
- for (int i=0; i<cachedStyles.size(); i++) {
- style = (StyleRange)cachedStyles.elementAt(i);
- StyleRange newStyle = (StyleRange)style.clone();
- newStyle.start = style.start + event.start;
- text.setStyleRange(newStyle);
- }
- }
-}
-/*
- * Intercept the cut and copy keys so that during paste we can maintain
- * style information.
- */
-void handleVerifyKey(VerifyEvent event) {
- int input;
- if (event.keyCode != 0) input = event.keyCode | event.stateMask;
- else input = event.character | event.stateMask;
- if (isCut(input) || isCopy(input)) {
- handleCutCopy();
- }
-}
-
-public static void main (String [] args) {
- TextEditor example = new TextEditor ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void open () {
- createShell ();
- createMenuBar ();
- createToolBar ();
- createStyledText ();
- shell.open ();
-}
-
-void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-void setFont() {
- FontDialog fontDialog = new FontDialog(shell);
- fontDialog.setFontData((text.getFont()).getFontData()[0]);
- FontData fontData = fontDialog.open();
- if(fontData != null) {
- if(font != null)
- font.dispose();
- font = new Font(shell.getDisplay(), fontData);
- text.setFont(font);
- }
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- RED = new Color (display, new RGB(255,0,0));
- BLUE = new Color (display, new RGB(0,0,255));
- GREEN = new Color (display, new RGB(0,255,0));
-}
-boolean isCopy(int input) {
-
- if (input == (SWT.INSERT | SWT.CTRL)) return true;
-
- if (input == ('\u0003' | SWT.CTRL)) return true;
-
- return false;
-
-}
-boolean isCut(int input) {
-
- if (input == (SWT.DEL | SWT.SHIFT)) return true;
-
- if (input == ('\u0018' | SWT.CTRL)) return true;
-
- return false;
-
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp
deleted file mode 100755
index 84c7ac9a46..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp
deleted file mode 100755
index a3184bb26c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp
deleted file mode 100755
index 382751efa3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp
deleted file mode 100755
index 1d2ace7ee3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp
deleted file mode 100755
index f6ab21e471..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp
deleted file mode 100755
index cca023fd57..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp
deleted file mode 100755
index 88c63be336..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/plugin.properties b/examples/org.eclipse.swt.examples/plugin.properties
deleted file mode 100755
index c1c22b6776..0000000000
--- a/examples/org.eclipse.swt.examples/plugin.properties
+++ /dev/null
@@ -1,101 +0,0 @@
-plugin.SWTStandaloneExampleSet.name = SWT Standalone Examples Plugin
-
-launchcategory.SWTStandaloneExamples.name = Standalone
-launchcategory.SWTStandaloneExamples.description = \
- A collection of Standard Widget Toolkit examples that run independant \
- of the Eclipse Platform.\n\n\
- These examples may take a moment to start while a new runtime environment \
- is created in the background.
-
-launchitem.AddressBook.name = Address Book
-launchitem.AddressBook.description = \
- The AddressBook example shows how the org.eclipse.swt.Table class can be used to \
- present tabular information.\n\n\
- The application can save and load address books, sort the entries, search for strings within \
- the fields and perform other operations that would typically be found in this kind of application.
-
-launchitem.FileViewer.name = File Viewer
-launchitem.FileViewer.description = \
- The File Viewer example shows how a simple application can be implemented using SWT.\n\n\
- This application provides the ability to browse files and folders and manipulate via Drag & Drop. \
- It includes the use of alternate threads for long actions and demonstrates the use of the Tree, \
- Table, Toolbar and Program.
-
-launchitem.HoverHelp.name = Hover Help
-launchitem.HoverHelp.description = \
- The Hover Help example shows how to implement custom tooltips and hover help support \
- on a number of different SWT controls including Buttons, TableItems, ToolItems and TreeItems.\n\n\
- The example implements its own tooltip and hover help support. \
- To see the custom tooltips in action, hover over an item or button in the UI. \
- Notice that images appear in the left-hand corner of the tooltip, unlike standard SWT tooltips \
- created using setToolTip() on those widgets that natively support them.\n\n\
- To see the custom hover help in action, hover over an item or button in the UI as before until \
- the tooltip is displayed. Without moving the pointer, hit F1. A new Shell will pop up with the \
- extended hover help information for the UI element in question.
-
-launchitem.HelloWorld1.name = Hello World (1)
-launchitem.HelloWorld1.description = \
- This example demonstrates the minimum amount of code required to open an SWT Shell and \
- process the events.
-
-launchitem.HelloWorld2.name = Hello World (2)
-launchitem.HelloWorld2.description = \
- This example builds on HelloWorld1 and demonstrates the minimum amount of code required to \
- open an SWT Shell with a Label and process the events.
-
-launchitem.HelloWorld3.name = Hello World (3)
-launchitem.HelloWorld3.description = \
- This example builds on HelloWorld2 and demonstrates how to resize the Label when the Shell \
- resizes using a Listener mechanism.
-
-launchitem.HelloWorld4.name = Hello World (4)
-launchitem.HelloWorld4.description = \
- This example builds on HelloWorld2 and demonstrates how to resize the Label when the Shell \
- resizes using a Layout.
-
-launchitem.HelloWorld5.name = Hello World (5)
-launchitem.HelloWorld5.description = \
- This example builds on HelloWorld1 and demonstrates how to draw directly on an SWT Control.
-
-launchitem.ImageAnalyzer.name = Image Analyzer
-launchitem.ImageAnalyzer.description = \
- The ImageAnalyzer opens image files and displays the visual contents of the file along with a \
- summary of the data in the image file.\n\n\
- The user can make adjustments to various elements of the image such as scaling and Alpha \
- blending and can save these changes to a file.\n\n\
- The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG. \
- To open a file, use the File->Open... menu item, and select the image file in the FileDialog.\n\n\
- If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected, \
- then the ImageAnalyzer displays the image increments as they are being loaded.\n\n\
- If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled, \
- and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color, \
- as many animated GIFs do, selecting Background will use the GIF's background color.\n\n\
- If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency \
- mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work. \
- To turn off the transparency, deselect Display Transparency.\n\n\
- After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos, \
- and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.\n\n\
- File->Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency, \
- File->Save Mask As... saves the image's transparency mask.\n\n\
- When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created. (In the case of an ICO file or \
- multi-image GIF, an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData \
- instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB \
- color data for that pixel. For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader \
- instance used to load the image. The ImageAnalyzer displays this data as well.
-
-launchitem.JavaViewer.name = Java Syntax Viewer
-launchitem.JavaViewer.description = \
- This example demonstrates how to implement a user-defined line styler for the StyledText widget.\n\n\
- The example provides a typical editor interface. \
- To see the effect of the line styler, open a *.java file. \
- When the contents of the file are displayed in the editor area, notice that the keywords have been highlighted.
-
-launchitem.TextEditor.name = Text Editor
-launchitem.TextEditor.description = \
- This example demonstrates how to use the StyledText widget to implement \
- a text editor with formatting support.\n\n\
- The example has a typical text editor interface. \
- The File menu contains Cut, Copy, Paste and Set Font items and the toolbar \
- provides a bold text toggle, three colour tools that operate on the current \
- selection, and a reset to defaults button that also operates on the current selection.
- \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/plugin.xml b/examples/org.eclipse.swt.examples/plugin.xml
deleted file mode 100755
index f91d9dd352..0000000000
--- a/examples/org.eclipse.swt.examples/plugin.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples"
- name="%plugin.SWTStandaloneExampleSet.name"
- version="2.0"
- provider-name="Object Technology International, Inc."
- class="">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<runtime>
- <library name="swtexamples.jar">
- <export name="*"/>
- </library>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTStandaloneExamples.name"
- description="%launchcategory.SWTStandaloneExamples.description"
- id="org.eclipse.swt.examples.launchStandaloneCategory">
- </category>
- <item
- name="%launchitem.AddressBook.name"
- description="%launchitem.AddressBook.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.addressbook.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.addressbook.AddressBook">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.FileViewer.name"
- description="%launchitem.FileViewer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.fileviewer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.fileviewer.FileViewer">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HoverHelp.name"
- description="%launchitem.HoverHelp.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.hoverhelp.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.hoverhelp.HoverHelp">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HelloWorld1.name"
- description="%launchitem.HelloWorld1.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld1.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld1">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HelloWorld2.name"
- description="%launchitem.HelloWorld2.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld2.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld2">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HelloWorld3.name"
- description="%launchitem.HelloWorld3.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld3.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld3">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HelloWorld4.name"
- description="%launchitem.HelloWorld4.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld4.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld4">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.HelloWorld5.name"
- description="%launchitem.HelloWorld5.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld5.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld5">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.ImageAnalyzer.name"
- description="%launchitem.ImageAnalyzer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.imageanalyzer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.JavaViewer.name"
- description="%launchitem.JavaViewer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.javaviewer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.javaviewer.JavaViewer">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
- <item
- name="%launchitem.TextEditor.name"
- description="%launchitem.TextEditor.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.texteditor.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.texteditor.TextEditor">
- </program>
- <source
- zip="swtexamplessrc.zip">
- </source>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
deleted file mode 100755
index 5ca6ad0fce..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ /dev/null
@@ -1,909 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.zip.*;
-import java.util.ResourceBundle;
-
-/**
- * AddressBookExample is an example that uses <code>org.eclipse.swt</code>
- * libraries to implement a simple address book. This application has
- * save, load, sorting, and searching functions common
- * to basic address books.
- */
-public class AddressBook {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- private Shell shell;
- private Table table;
- private SearchDialog searchDialog;
-
- private File file;
- private boolean isModified;
-
- private String[] copyBuffer;
-
- private static final String DELIMITER = ",";
- private static final String[] columnNames = {resAddressBook.getString("Last_name"),
- resAddressBook.getString("First_name"),
- resAddressBook.getString("Business_phone"),
- resAddressBook.getString("Home_phone"),
- resAddressBook.getString("Email"),
- resAddressBook.getString("Fax")};
-
-public static void main(String[] args) {
- AddressBook application = new AddressBook();
- application.open();
- application.run();
-}
-private boolean closeAddressBook() {
- if(isModified) {
- //ask user if they want to save current address book
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Close_save"));
-
- int choice = box.open();
- if(choice == SWT.CANCEL) {
- return false;
- } else if(choice == SWT.YES) {
- if (!save()) return false;
- }
- }
-
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i ++) {
- items[i].dispose();
- }
-
- return true;
-}
-/**
- * Creates the menu at the top of the shell where most
- * of the programs functionality is accessed.
- *
- * @return The <code>Menu</code> widget that was created
- */
-private Menu createMenuBar() {
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
-
- //create each header and subMenu for the menuBar
- createFileMenu(menuBar);
- createEditMenu(menuBar);
- createSearchMenu(menuBar);
- createHelpMenu(menuBar);
-
- return menuBar;
-}
-
-/**
- * Converts an encoded <code>String</code> to a String array representing a table entry.
- */
-private String[] decodeLine(String line) {
- if(line == null) return null;
-
- String[] parsedLine = new String[table.getColumnCount()];
- for(int i = 0; i < parsedLine.length - 1; i++) {
- String newString = "";
- int index = line.indexOf(DELIMITER);
- if (index > -1) {
- parsedLine[i] = line.substring(0, index);
- line = line.substring(index + DELIMITER.length(), line.length());
- } else {
- return null;
- }
- }
-
- if (line.indexOf(DELIMITER) != -1) return null;
-
- parsedLine[parsedLine.length - 1] = line;
-
- return parsedLine;
-}
-private void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-private void editEntry(TableItem item) {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] values = new String[table.getColumnCount()];
- for (int i = 0; i < values.length; i++) {
- values[i] = item.getText(i);
- }
- dialog.setValues(values);
- values = dialog.open();
- if (values != null) {
- item.setText(values);
- isModified = true;
- }
-}
-private String encodeLine(String[] tableItems) {
- String line = "";
- for (int i = 0; i < tableItems.length - 1; i++) {
- line += tableItems[i] + DELIMITER;
- }
- line += tableItems[tableItems.length - 1] + "\n";
-
- return line;
-}
-private boolean findEntry() {
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- boolean matchCase = searchDialog.getMatchCase();
- boolean matchWord = searchDialog.getMatchWord();
- String searchString = searchDialog.getSearchString();
- int column = searchDialog.getSelectedSearchArea();
-
- searchString = matchCase ? searchString : searchString.toLowerCase();
-
- boolean found = false;
- if (searchDialog.getSearchDown()) {
- for(int i = table.getSelectionIndex() + 1; i < table.getItemCount(); i++) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- } else {
- for(int i = table.getSelectionIndex() - 1; i > -1; i--) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- }
-
- shell.setCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
-
- return found;
-}
-private boolean findMatch(String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {
-
- String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
- if (matchWord) {
- if (tableText != null && tableText.equals(searchString)) {
- return true;
- }
-
- } else {
- if(tableText!= null && tableText.indexOf(searchString) != -1) {
- return true;
- }
- }
- return false;
-}
-/**
- * Merges two arrays (assumed to be individually sorted) of string arrays into
- * one sorted array by the value stored at the columnIndex parameter. This method
- * is used in <code>mergeSort(String[][] tableItems, int columnIndex)</code>.
- *
- * @param firstHalf String[][]
- * The first array of Strings to be merged.
- * @param secondHalf String[][]
- * The second array of Strings to be merged.
- * @param columnIndex int
- * The column by which the String arrays will be compared.
- * @return String[][]
- * An array of array of String that is the merged (and sorted) combination
- * of the two parameter arrays.
- */
-private String[][] merge(String[][] firstHalf, String[][] secondHalf, int column) {
- int x = firstHalf.length + secondHalf.length;
- int y = Math.max(firstHalf[0].length, secondHalf[0].length);
- String[][] sorted = new String[x][y];
-
- int firstHalfIndex = 0;
- int secondHalfIndex = 0;
- int sortedIndex = 0;
-
- //merge
- while(firstHalfIndex < firstHalf.length && secondHalfIndex < secondHalf.length) {
- if(firstHalf[firstHalfIndex][column].compareToIgnoreCase(secondHalf[secondHalfIndex][column]) <= 0 ) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- } else {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
- }
-
- //copy remaining items into sorted.
- while(firstHalfIndex < firstHalf.length) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- }
-
- while(secondHalfIndex < secondHalf.length) {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
-
- return sorted;
-}
-/**
- * Takes an array of array of Strings and sorts them into ascending order according to the
- * data in the column specified. Note that this sort is recursive.
- *
- * @param tableItems String[][]
- * The array of Strings that will be sorted.
- * @param columnIndex int
- * The column in the String arrays by which the arrays will be compared.
- * @return String[][]
- * The resultant sorted version of the tableItems parameter.
- * @see #merge(String[][] firstHalf, String[][] secondHalf, int columnIndex)
- */
-private String[][] mergeSort(String[][] items, int column) {
- int numItems = items.length;
-
- if(numItems <= 1) return items;
-
- int split = numItems / 2;
- String[][] firstHalf = new String[split][items[0].length];
- String[][] secondHalf = new String[numItems - split][items[0].length];
- for(int i = 0; i < firstHalf.length; i++) {
- firstHalf[i] = items[i];
- }
- for(int i = 0; i < secondHalf.length; i++) {
- secondHalf[i] = items[split + i];
- }
-
- String[][] firstHalfSorted = mergeSort(firstHalf, column);
- String[][] secondHalfSorted = mergeSort(secondHalf, column);
- String[][] sortedItems = merge(firstHalfSorted, secondHalfSorted, column);
-
- return sortedItems;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- file = null;
- isModified = false;
-}
-private void newEntry() {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] data = dialog.open();
- if (data != null) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(data);
- isModified = true;
- }
-}
-private void open() {
- Display display = new Display();
- shell = new Shell(display);
- shell.setLayout(new FillLayout());
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- e.doit = closeAddressBook();
- }
- });
-
- createMenuBar();
-
- searchDialog = new SearchDialog(shell);
- searchDialog.setSearchAreaNames(columnNames);
- searchDialog.setSearchAreaLabel(resAddressBook.getString("Column"));
- searchDialog.addFindListener(new FindListener () {
- public boolean find() {
- return findEntry();
- }
- });
-
- table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setMenu(createPopUpMenu());
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetDoubleSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length > 0) editEntry(items[0]);
- }
- });
- for(int i = 0; i < columnNames.length; i++) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(columnNames[i]);
- column.setWidth(150);
- final int columnIndex = i;
- column.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
- }
-
- newAddressBook();
-
- shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
- shell.open();
-}
-private void openAddressBook() {
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- fileDialog.setFilterNames(new String[] {resAddressBook.getString("Book_filter_name") + " (*.adr)",
- resAddressBook.getString("All_filter_name") + " (*.*)"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if(name == null) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- displayError(resAddressBook.getString("File")+file.getName()+" "+resAddressBook.getString("Does_not_exist"));
- return;
- }
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- FileReader fileReader = null;
- BufferedReader bufferedReader = null;
- String[] data = new String[0];
- try {
- fileReader = new FileReader(file.getAbsolutePath());
- bufferedReader = new BufferedReader(fileReader);
- String nextLine = bufferedReader.readLine();
- while (nextLine != null){
- String[] newData = new String[data.length + 1];
- System.arraycopy(data, 0, newData, 0, data.length);
- newData[data.length] = nextLine;
- data = newData;
- nextLine = bufferedReader.readLine();
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return;
- } catch (IOException e ) {
- displayError(resAddressBook.getString("IO_error_read") + "\n" + file.getName());
- return;
- } finally {
-
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileReader != null) {
- try {
- fileReader.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return;
- }
- }
- }
-
- String[][] tableInfo = new String[data.length][table.getColumnCount()];
- for (int i = 0; i < data.length; i++) {
- tableInfo[i] = decodeLine(data[i]);
- }
- tableInfo = mergeSort(tableInfo, 0);
- for (int i = 0; i < tableInfo.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(tableInfo[i]);
- }
- shell.setText(resAddressBook.getString("Title_bar")+fileDialog.getFileName());
- isModified = false;
- this.file = file;
-}
-private void run() {
- //read and dispatch until termination
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-}
-private boolean save() {
- if(file == null) return saveAs();
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- TableItem[] items = table.getItems();
- String[] lines = new String[items.length];
- for(int i = 0; i < items.length; i++) {
- String[] itemText = new String[table.getColumnCount()];
- for (int j = 0; j < itemText.length; j++) {
- itemText[j] = items[i].getText(j);
- }
- lines[i] = encodeLine(itemText);
- }
-
- FileWriter fileWriter = null;
- try {
- fileWriter = new FileWriter(file.getAbsolutePath(), false);
- for (int i = 0; i < lines.length; i++) {
- fileWriter.write(lines[i]);
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return false;
- } catch(IOException e ) {
- displayError(resAddressBook.getString("IO_error_write") + "\n" + file.getName());
- return false;
- } finally {
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileWriter != null) {
- try {
- fileWriter.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return false;
- }
- }
- }
-
- shell.setText(resAddressBook.getString("Title_bar")+file.getName());
- isModified = false;
- return true;
-}
-private boolean saveAs() {
-
- FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
- saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "});
-
- saveDialog.open();
- String name = saveDialog.getFileName();
-
- if(name.equals("")) return false;
-
- if(name.indexOf(".adr") != name.length() - 4) {
- name += ".adr";
- }
-
- File file = new File(saveDialog.getFilterPath(), name);
- if(file.exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
- box.setText(resAddressBook.getString("Save_as_title"));
- box.setMessage(resAddressBook.getString("File") + file.getName()+" "+resAddressBook.getString("Query_overwrite"));
- if(box.open() != SWT.YES) {
- return false;
- }
- }
- this.file = file;
- return save();
-}
-private void sort(int column) {
- if(table.getItemCount() <= 1) return;
-
- TableItem[] items = table.getItems();
- String[][] data = new String[items.length][table.getColumnCount()];
- for(int i = 0; i < items.length; i++) {
- for(int j = 0; j < table.getColumnCount(); j++) {
- data[i][j] = items[i].getText(j);
- }
- }
-
- data = mergeSort(data, column);
-
- for (int i = 0; i < data.length; i++) {
- items[i].setText(data[i]);
- }
-
-}
-/**
- * Creates all the items located in the File submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the File submenu.
- */
-private void createFileMenu(Menu menuBar) {
- //File menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("File_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- items[1].setEnabled(table.getSelectionCount() != 0); // edit contact
- items[5].setEnabled((file != null) && isModified); // save
- items[6].setEnabled(table.getItemCount() != 0); // save as
- }
- });
-
-
- //File -> New Contact
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_contact"));
- subItem.setAccelerator(SWT.CTRL + 'N');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Edit_contact"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> New Address Book
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'B');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- newAddressBook();
- }
- });
-
- //File -> Open
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Open_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'O');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- openAddressBook();
- }
- });
-
- //File -> Save.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'S');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- save();
- }
- });
-
- //File -> Save As.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_book_as"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- saveAs();
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> Exit.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Exit"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-}
-
-/**
- * Creates all the items located in the Edit submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Edit submenu.
- *
- * @see #createSortMenu()
- */
-private MenuItem createEditMenu(Menu menuBar) {
- //Edit menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Edit_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- /**
- * Add a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[0].setEnabled(count != 0); // edit
- items[1].setEnabled(count != 0); // copy
- items[2].setEnabled(copyBuffer != null); // paste
- items[3].setEnabled(count != 0); // delete
- items[5].setEnabled(table.getItemCount() != 0); // sort
- }
- });
-
- //Edit -> Edit
- MenuItem subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Edit"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Edit -> Copy
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Copy"));
- subItem.setAccelerator(SWT.CTRL + 'C');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Edit -> Paste
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Paste"));
- subItem.setAccelerator(SWT.CTRL + 'V');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Edit -> Delete
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Delete"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true; }
- });
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //Edit -> Sort(Cascade)
- subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Sort"));
- Menu submenu = createSortMenu();
- subItem.setMenu(submenu);
-
- return item;
-
-}
-
-/**
- * Creates all the items located in the Sort cascading submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @return Menu
- * The cascading menu with all the sort menu items on it.
- */
-private Menu createSortMenu() {
- Menu submenu = new Menu(shell, SWT.DROP_DOWN);
- MenuItem subitem;
- for(int i = 0; i < columnNames.length; i++) {
- subitem = new MenuItem (submenu, SWT.NULL);
- subitem.setText(columnNames [i]);
- final int column = i;
- subitem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(column);
- }
- });
-
- }
-
- return submenu;
-}
-
-/**
- * Creates all the items located in the Search submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Search submenu.
- */
-private void createSearchMenu(Menu menuBar) {
- //Search menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Search_menu_title"));
- Menu searchMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(searchMenu);
-
- //Search -> Find...
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find"));
- item.setAccelerator(SWT.CTRL + 'F');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.setMatchCase(false);
- searchDialog.setMatchWord(false);
- searchDialog.setSearchDown(true);
- searchDialog.setSearchString("");
- searchDialog.setSelectedSearchArea(0);
- searchDialog.open();
- }
- });
-
- //Search -> Find Next
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find_next"));
- item.setAccelerator(SWT.F3);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-}
-
-/**
- * Creates all items located in the popup menu and associates
- * all the menu items with their appropriate functions.
- *
- * @return Menu
- * The created popup menu.
- */
-private Menu createPopUpMenu() {
- Menu popUpMenu = new Menu(shell, SWT.POP_UP);
-
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- popUpMenu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[2].setEnabled(count != 0); // edit
- items[3].setEnabled(count != 0); // copy
- items[4].setEnabled(copyBuffer != null); // paste
- items[5].setEnabled(count != 0); // delete
- items[7].setEnabled(table.getItemCount() != 0); // find
- }
- });
-
- //New
- MenuItem item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_new"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Edit
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_edit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Copy
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_copy"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Paste
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_paste"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Delete
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_delete"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true;
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Find...
- item = new MenuItem(popUpMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Pop_up_find"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-
- return popUpMenu;
-}
-
-/**
- * Creates all the items located in the Help submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Help submenu.
- */
-private void createHelpMenu(Menu menuBar) {
-
- //Help Menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Help_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- //Help -> About Text Editor
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("About"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.NONE);
- box.setText(resAddressBook.getString("About_1") + shell.getText());
- box.setMessage(shell.getText() + resAddressBook.getString("About_2"));
- box.open();
- }
- });
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
deleted file mode 100755
index 35e0425bff..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
- * DataEntryDialog class uses <code>org.eclipse.swt</code>
- * libraries to implement a dialog that accepts basic personal information that
- * is added to a <code>Table</code> widget or edits a <code>TableItem</code> entry
- * to represent the entered data.
- */
-public class DataEntryDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- String[] values;
- String[] labels;
-
-public DataEntryDialog(Shell parent) {
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
- shell.setLayout(new GridLayout());
-}
-
-private void addTextListener(final Text text) {
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e){
- Integer index = (Integer)(text.getData("index"));
- values[index.intValue()] = text.getText();
- }
- });
-}
-private void createControlButtons() {
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Button okButton = new Button(composite, SWT.PUSH);
- okButton.setText(resAddressBook.getString("OK"));
- okButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- values = null;
- shell.close();
- }
- });
-
- shell.setDefaultButton(okButton);
-}
-
-private void createTextWidgets() {
- if (labels == null) return;
-
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout= new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- if (values == null)
- values = new String[labels.length];
-
- for (int i = 0; i < labels.length; i++) {
- Label label = new Label(composite, SWT.RIGHT);
- label.setText(labels[i]);
- Text text = new Text(composite, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.widthHint = 400;
- text.setLayoutData(gridData);
- if (values[i] != null) {
- text.setText(values[i]);
- }
- text.setData("index", new Integer(i));
- addTextListener(text);
- }
-}
-
-public String[] getLabels() {
- return labels;
-}
-public String getTitle() {
- return shell.getText();
-}
-/**
- * Returns the contents of the <code>Text</code> widgets in the dialog in a
- * <code>String</code> array.
- *
- * @return String[]
- * The contents of the text widgets of the dialog.
- * May return null if all text widgets are empty.
- */
-public String[] getValues() {
- return values;
-}
-/**
- * Opens the dialog in the given state. Sets <code>Text</code> widget contents
- * and dialog behaviour accordingly.
- *
- * @param dialogState int
- * The state the dialog should be opened in.
- */
-public String[] open() {
- createTextWidgets();
- createControlButtons();
- shell.pack();
- shell.open();
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-
- return getValues();
-}
-public void setLabels(String[] labels) {
- this.labels = labels;
-}
-public void setTitle(String title) {
- shell.setText(title);
-}
-/**
- * Sets the values of the <code>Text</code> widgets of the dialog to
- * the values supplied in the parameter array.
- *
- * @param itemInfo String[]
- * The values to which the dialog contents will be set.
- */
-public void setValues(String[] itemInfo) {
- if (labels == null) return;
-
- if (values == null)
- values = new String[labels.length];
-
- int numItems = Math.min(values.length, itemInfo.length);
- for(int i = 0; i < numItems; i++) {
- values[i] = itemInfo[i];
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
deleted file mode 100755
index 88d70e4791..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public interface FindListener {
-
-public boolean find();
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
deleted file mode 100755
index 6a7d620401..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * SearchDialog is a simple class that uses <code>org.eclipse.swt</code>
- * libraries to implement a basic search dialog.
- */
-public class SearchDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- Text searchText;
- Combo searchArea;
- Label searchAreaLabel;
- Button matchCase;
- Button matchWord;
- Button findButton;
- Button down;
- FindListener findHandler;
-
-/**
- * Class constructor that sets the parent shell and the table widget that
- * the dialog will search.
- *
- * @param parent Shell
- * The shell that is the parent of the dialog.
- */
-public SearchDialog(Shell parent) {
- shell = new Shell(parent, SWT.CLOSE | SWT.BORDER | SWT.TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- shell.setLayout(layout);
- shell.setText(resAddressBook.getString("Search_dialog_title"));
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- // don't dispose of the shell, just hide it for later use
- e.doit = false;
- shell.setVisible(false);
- }
- });
-
- Label label = new Label(shell, SWT.LEFT);
- label.setText(resAddressBook.getString("Dialog_find_what"));
- searchText = new Text(shell, SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchText.setLayoutData(gridData);
- searchText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- boolean enableFind = (searchText.getCharCount() != 0);
- findButton.setEnabled(enableFind);
- }
- });
-
- searchAreaLabel = new Label(shell, SWT.LEFT);
- searchArea = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchArea.setLayoutData(gridData);
-
- matchCase = new Button(shell, SWT.CHECK);
- matchCase.setText(resAddressBook.getString("Dialog_match_case"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchCase.setLayoutData(gridData);
-
- matchWord = new Button(shell, SWT.CHECK);
- matchWord.setText(resAddressBook.getString("Dialog_match_word"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchWord.setLayoutData(gridData);
-
- Group direction = new Group(shell, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- direction.setLayoutData(gridData);
- direction.setLayout (new FillLayout ());
- direction.setText(resAddressBook.getString("Dialog_direction"));
-
- Button up = new Button(direction, SWT.RADIO);
- up.setText(resAddressBook.getString("Dialog_dir_up"));
- up.setSelection(false);
-
- down = new Button(direction, SWT.RADIO);
- down.setText(resAddressBook.getString("Dialog_dir_down"));
- down.setSelection(true);
-
- Composite composite = new Composite(shell, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- composite.setLayoutData(gridData);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
-
- findButton = new Button(composite, SWT.PUSH);
- findButton.setText(resAddressBook.getString("Dialog_find"));
- findButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- findButton.setEnabled(false);
- findButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (!findHandler.find()){
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.PRIMARY_MODAL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Cannot_find") + "\"" + searchText.getText() + "\"");
- box.open();
- }
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.setVisible(false);
- }
- });
-
- shell.pack();
-}
-public String getSearchAreaLabel(String label) {
- return searchAreaLabel.getText();
-}
-
-public String[] getsearchAreaNames() {
- return searchArea.getItems();
-}
-public boolean getMatchCase() {
- return matchCase.getSelection();
-}
-public boolean getMatchWord() {
- return matchWord.getSelection();
-}
-public String getSearchString() {
- return searchText.getText();
-}
-public boolean getSearchDown(){
- return down.getSelection();
-}
-public int getSelectedSearchArea() {
- return searchArea.getSelectionIndex();
-}
-public void open() {
- if (shell.isVisible()) {
- shell.setFocus();
- } else {
- shell.open();
- }
- searchText.setFocus();
-}
-public void setSearchAreaNames(String[] names) {
- for (int i = 0; i < names.length; i++) {
- searchArea.add(names[i]);
- }
- searchArea.select(0);
-}
-public void setSearchAreaLabel(String label) {
- searchAreaLabel.setText(label);
-}
-public void setMatchCase(boolean match) {
- matchCase.setSelection(match);
-}
-public void setMatchWord(boolean match) {
- matchWord.setSelection(match);
-}
-public void setSearchDown(boolean searchDown){
- down.setSelection(searchDown);
-}
-public void setSearchString(String searchString) {
- searchText.setText(searchString);
-}
-
-public void setSelectedSearchArea(int index) {
- searchArea.select(index);
-}
-public void addFindListener(FindListener listener) {
- this.findHandler = listener;
-}
-public void removeFindListener(FindListener listener) {
- this.findHandler = null;
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
deleted file mode 100755
index bfd1c60de2..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>AlignableTab</code> is the abstract
- * superclass of example controls that can be
- * aligned.
- */
-abstract class AlignableTab extends Tab {
-
- /* Allignment Controls */
- Button leftButton, rightButton, centerButton;
-
- /* Alignment Group */
- Group allignmentGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- AlignableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the group */
- allignmentGroup = new Group (controlGroup, SWT.NULL);
- allignmentGroup.setLayout (new GridLayout ());
- allignmentGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_FILL));
- allignmentGroup.setText (ControlExample.getResourceString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (ControlExample.getResourceString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(ControlExample.getResourceString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (ControlExample.getResourceString("Right"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetAlignment ();
- };
- };
- leftButton.addSelectionListener (selectionListener);
- centerButton.addSelectionListener (selectionListener);
- rightButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- abstract void setExampleWidgetAlignment ();
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0) {
- leftButton.setSelection ((controls [0].getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection ((controls [0].getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection ((controls [0].getStyle () & SWT.RIGHT) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
deleted file mode 100755
index 76bd2434ea..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>ButtonTab</code> is the class that
- * demonstrates SWT buttons.
- */
-class ButtonTab extends AlignableTab {
-
- /* Example widgets and groups that contain them */
- Button button1, button2, button3, button4, button5, button6;
- Group textButtonGroup, imageButtonGroup;
-
- /* Allignment widgets added to the "Control" group */
- Button upButton, downButton;
-
- /* Style widgets added to the "Style" group */
- Button pushButton, checkButton, radioButton, toggleButton, arrowButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ButtonTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (ControlExample.getResourceString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (ControlExample.getResourceString("Down"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection()) return;
- setExampleWidgetAlignment ();
- };
- };
- upButton.addSelectionListener(selectionListener);
- downButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for text buttons */
- textButtonGroup = new Group(exampleGroup, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- textButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- textButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textButtonGroup.setText (ControlExample.getResourceString("Text_Buttons"));
-
- /* Create a group for the image buttons */
- imageButtonGroup = new Group(exampleGroup, SWT.NONE);
- gridLayout = new GridLayout();
- imageButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- imageButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageButtonGroup.setText (ControlExample.getResourceString("Image_Buttons"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (pushButton.getSelection()) style |= SWT.PUSH;
- if (checkButton.getSelection()) style |= SWT.CHECK;
- if (radioButton.getSelection()) style |= SWT.RADIO;
- if (toggleButton.getSelection()) style |= SWT.TOGGLE;
- if (arrowButton.getSelection()) style |= SWT.ARROW;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(ControlExample.getResourceString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(ControlExample.getResourceString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(ControlExample.getResourceString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(instance.images[ControlExample.ciClosedFolder]);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(instance.images[ControlExample.ciOpenFolder]);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText(ControlExample.getResourceString("SWT_PUSH"));
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText (ControlExample.getResourceString("SWT_CHECK"));
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText (ControlExample.getResourceString("SWT_RADIO"));
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText (ControlExample.getResourceString("SWT_TOGGLE"));
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText (ControlExample.getResourceString("SWT_ARROW"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {button1, button2, button3, button4, button5, button6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Button");
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- if (upButton.getSelection ()) allignment = SWT.UP;
- if (downButton.getSelection ()) allignment = SWT.DOWN;
- button1.setAlignment (allignment);
- button2.setAlignment (allignment);
- button3.setAlignment (allignment);
- button4.setAlignment (allignment);
- button5.setAlignment (allignment);
- button6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- if (arrowButton.getSelection ()) {
- upButton.setEnabled (true);
- centerButton.setEnabled (false);
- downButton.setEnabled (true);
- } else {
- upButton.setEnabled (false);
- centerButton.setEnabled (true);
- downButton.setEnabled (false);
- }
- upButton.setSelection ((button1.getStyle () & SWT.UP) != 0);
- downButton.setSelection ((button1.getStyle () & SWT.DOWN) != 0);
- pushButton.setSelection ((button1.getStyle () & SWT.PUSH) != 0);
- checkButton.setSelection ((button1.getStyle () & SWT.CHECK) != 0);
- radioButton.setSelection ((button1.getStyle () & SWT.RADIO) != 0);
- toggleButton.setSelection ((button1.getStyle () & SWT.TOGGLE) != 0);
- arrowButton.setSelection ((button1.getStyle () & SWT.ARROW) != 0);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
deleted file mode 100755
index 88ed7db221..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ComboTab extends Tab {
-
- /* Example widgets and groups that contain them */
- Combo combo1;
- Group comboGroup;
-
- /* Style widgets added to the "Style" group */
- Button dropDownButton, readOnlyButton, simpleButton;
-
- static String [] ListData = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ComboTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the combo box */
- comboGroup = new Group (exampleGroup, SWT.NULL);
- comboGroup.setLayout (new GridLayout ());
- comboGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- comboGroup.setText (ControlExample.getResourceString("Combo"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (simpleButton.getSelection ()) style |= SWT.SIMPLE;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- combo1 = new Combo (comboGroup, style);
- combo1.setItems (ListData);
- if (ListData.length >= 3) {
- combo1.setText(ListData [2]);
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- dropDownButton = new Button (styleGroup, SWT.RADIO);
- dropDownButton.setText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText(ControlExample.getResourceString("SWT_SIMPLE"));
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlExample.getResourceString("SWT_READ_ONLY"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {combo1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Combo");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- dropDownButton.setSelection ((combo1.getStyle () & SWT.DROP_DOWN) != 0);
- simpleButton.setSelection ((combo1.getStyle () & SWT.SIMPLE) != 0);
- readOnlyButton.setSelection ((combo1.getStyle () & SWT.READ_ONLY) != 0);
- borderButton.setSelection ((combo1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
deleted file mode 100755
index 191efd6c32..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import java.text.*;
-import java.util.*;
-
-public class ControlExample {
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle("examples_control");
- private ShellTab shellTab;
- private TabFolder tabFolder;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- Image images[];
-
- /**
- * Creates an instance of a ControlExample embedded inside
- * the supplied parent Composite.
- *
- * @param parent the container of the example
- */
- public ControlExample(Composite parent) {
- initResources();
- tabFolder = new TabFolder (parent, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (this),
- new ComboTab (this),
- new CoolBarTab (this),
- new DialogTab (this),
- new LabelTab (this),
- new ListTab (this),
- new ProgressBarTab (this),
- new SashTab (this),
- shellTab = new ShellTab(this),
- new SliderTab (this),
- new TableTab (this),
- new TextTab (this),
- new ToolBarTab (this),
- new TreeTab (this),
- };
- for (int i=0; i<tabs.length; i++) {
- TabItem item = new TabItem (tabFolder, SWT.NULL);
- item.setText (tabs [i].getTabText ());
- item.setControl (tabs [i].createTabFolderPage (tabFolder));
- }
- }
-
- /**
- * Grabs input focus.
- */
- public void setFocus() {
- tabFolder.setFocus();
- }
-
- /**
- * Disposes of all resources associated with a particular
- * instance of the ControlExample.
- */
- public void dispose() {
- /*
- * Destroy any shells that may have been created
- * by the Shells tab. When a shell is disposed,
- * all child shells are also disposed. Therefore
- * it is necessary to check for disposed shells
- * in the shells list to avoid disposing a shell
- * twice.
- */
- if (shellTab != null) shellTab.closeAllShells ();
- shellTab = null;
- tabFolder = null;
- freeResources();
- }
-
- /**
- * Invokes as a standalone program.
- */
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
- ControlExample instance = new ControlExample(shell);
- shell.setText(getResourceString("window.title"));
- shell.open();
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- instance.dispose();
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Loads the resources
- */
- private void initResources() {
- final Class clazz = ControlExample.class;
- if (resourceBundle != null) {
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- ImageData source = new ImageData(clazz.getResourceAsStream(
- imageLocations[i]));
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(null, source, mask);
- }
- }
- return;
- } catch (Throwable t) {
- }
- }
- String error = (resourceBundle != null) ?
- getResourceString("error.CouldNotLoadResources") :
- "Unable to load resources";
- freeResources();
- throw new RuntimeException(error);
- }
-
- /**
- * Frees the resources
- */
- private void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-}
-
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
deleted file mode 100644
index 5843469802..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
+++ /dev/null
@@ -1,269 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class CoolBarTab extends Tab {
- /* Example widgets and group that contains them */
- CoolBar coolBar;
- CoolItem pushItem, dropDownItem, radioItem, checkItem;
- Group coolBarGroup;
-
- Point[] sizes;
- int[] wrapIndices;
- int[] order;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- CoolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
- coolBarGroup = new Group (exampleGroup, SWT.NULL);
- coolBarGroup.setLayout (new GridLayout ());
- coolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- coolBarGroup.setText (ControlExample.getResourceString("CoolBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- int style = 0;
-
- /* Compute the widget style */
- int toolBarStyle = SWT.FLAT;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /*
- * Create the example widgets.
- */
- coolBar = new CoolBar (coolBarGroup, style);
-
- /* create the push button toolbar */
- ToolBar toolBar = new ToolBar (coolBar, toolBarStyle);
- ToolItem item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.SEPARATOR);
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- pushItem = new CoolItem (coolBar, SWT.NULL);
- pushItem.setControl (toolBar);
- Point pushSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- pushSize = pushItem.computeSize(pushSize.x, pushSize.y);
- pushItem.setSize(pushSize);
-
- /* create the dropdown toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener (new DropDownSelectionListener());
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener (new DropDownSelectionListener());
- dropDownItem = new CoolItem (coolBar, SWT.NULL);
- dropDownItem.setControl (toolBar);
- Point dropSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- dropSize = dropDownItem.computeSize(dropSize.x, dropSize.y);
- dropDownItem.setSize(dropSize);
-
- /* create the radio button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- radioItem = new CoolItem (coolBar, SWT.NULL);
- radioItem.setControl (toolBar);
- Point radioSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- radioSize = radioItem.computeSize(radioSize.x, radioSize.y);
- radioItem.setSize(radioSize);
-
- /* create the check button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- checkItem = new CoolItem (coolBar, SWT.NULL);
- checkItem.setControl (toolBar);
- Point checkSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- checkSize = checkItem.computeSize(checkSize.x, checkSize.y);
- checkItem.setSize(checkSize);
-
- /* if we have saved state, restore it */
- if (order != null) {
- coolBar.setItemLayout(order, wrapIndices, sizes);
- /*
- * special case: because setItemLayout will restore the items
- * to the sizes the user left them at, the preferred size may not
- * be the same as the actual size. Thus we must explicitly set
- * the preferred sizes.
- */
- pushItem.setPreferredSize(pushSize);
- dropDownItem.setPreferredSize(dropSize);
- radioItem.setPreferredSize(radioSize);
- checkItem.setPreferredSize(checkSize);
- }
- else {
- coolBar.setWrapIndices(new int[] {1, 3});
- }
-
- /* add a listener to resize the group box to match the coolbar */
- coolBar.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- exampleGroup.layout();
- }
- });
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widget */
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- /* store the state of the toolbar if applicable */
- if (coolBar != null) {
- sizes = coolBar.getItemSizes();
- wrapIndices = coolBar.getWrapIndices();
- order = coolBar.getItemOrder();
- }
- super.disposeExampleWidgets();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {coolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("CoolBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- borderButton.setSelection ((coolBar.getStyle () & SWT.BORDER) != 0);
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java
deleted file mode 100755
index ea5f8f5db8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java
+++ /dev/null
@@ -1,431 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class DialogTab extends Tab {
- /* Example widgets and groups that contain them */
- Group dialogStyleGroup, resultGroup;
- Text textWidget;
-
- /* Style widgets added to the "Style" group */
- Combo dialogCombo;
- Button okButton, cancelButton;
- Button yesButton, noButton;
- Button retryButton;
- Button abortButton, ignoreButton;
- Button iconErrorButton, iconInformationButton, iconQuestionButton;
- Button iconWarningButton, iconWorkingButton;
- Button modelessButton, primaryModalButton, applicationModalButton, systemModalButton;
- Button saveButton, openButton;
-
- static String [] FilterExtensions = {".txt.", ".bat", ".doc"};
- static String [] FilterNames = {ControlExample.getResourceString("FilterName_0"),
- ControlExample.getResourceString("FilterName_1"),
- ControlExample.getResourceString("FilterName_2")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- DialogTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Handle a button style selection event.
- *
- * @param event the selection event
- */
- void buttonStyleSelected(SelectionEvent event) {
- /*
- * Only certain combinations of button styles are
- * supported for various dialogs. Make sure the
- * control widget reflects only valid combinations.
- */
- okButton.setEnabled (
- !(yesButton.getSelection () || noButton.getSelection () ||
- retryButton.getSelection () || abortButton.getSelection () ||
- ignoreButton.getSelection ()));
- cancelButton.setEnabled (
- !(abortButton.getSelection () || ignoreButton.getSelection ()));
- yesButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- noButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- retryButton.setEnabled (
- !(okButton.getSelection() || yesButton.getSelection() || noButton.getSelection ()));
- abortButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () ||
- yesButton.getSelection () || noButton.getSelection ()));
- ignoreButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () |
- yesButton.getSelection () || noButton.getSelection ()));
- }
-
- /**
- * Handle the create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- void createButtonSelected(SelectionEvent event) {
-
- /* Compute the appropriate dialog style */
- int style = SWT.NULL;
- if (okButton.getEnabled () && okButton.getSelection ()) style |= SWT.OK;
- if (cancelButton.getEnabled () && cancelButton.getSelection ()) style |= SWT.CANCEL;
- if (yesButton.getEnabled () && yesButton.getSelection ()) style |= SWT.YES;
- if (noButton.getEnabled () && noButton.getSelection ()) style |= SWT.NO;
- if (retryButton.getEnabled () && retryButton.getSelection ()) style |= SWT.RETRY;
- if (abortButton.getEnabled () && abortButton.getSelection ()) style |= SWT.ABORT;
- if (ignoreButton.getEnabled () && ignoreButton.getSelection ()) style |= SWT.IGNORE;
- if (iconErrorButton.getEnabled () && iconErrorButton.getSelection ()) style |= SWT.ICON_ERROR;
- if (iconInformationButton.getEnabled () && iconInformationButton.getSelection ()) style |= SWT.ICON_INFORMATION;
- if (iconQuestionButton.getEnabled () && iconQuestionButton.getSelection ()) style |= SWT.ICON_QUESTION;
- if (iconWarningButton.getEnabled () && iconWarningButton.getSelection ()) style |= SWT.ICON_WARNING;
- if (iconWorkingButton.getEnabled () && iconWorkingButton.getSelection ()) style |= SWT.ICON_WORKING;
- if (primaryModalButton.getEnabled () && primaryModalButton.getSelection ()) style |= SWT.PRIMARY_MODAL;
- if (applicationModalButton.getEnabled () && applicationModalButton.getSelection ()) style |= SWT.APPLICATION_MODAL;
- if (systemModalButton.getEnabled () && systemModalButton.getSelection ()) style |= SWT.SYSTEM_MODAL;
- if (saveButton.getEnabled () && saveButton.getSelection ()) style |= SWT.SAVE;
- if (openButton.getEnabled () && openButton.getSelection ()) style |= SWT.OPEN;
-
- /* Open the appropriate dialog type */
- String name = dialogCombo.getText ();
- Shell shell = tabFolderPage.getShell ();
-
- if (name.equals (instance.getResourceString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (instance.getResourceString("Title"));
- RGB result = dialog.open ();
- textWidget.append (instance.getResourceString("ColorDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open ();
- textWidget.append (instance.getResourceString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (instance.getResourceString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open();
- textWidget.append (instance.getResourceString("FileDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (instance.getResourceString("Title"));
- FontData result = dialog.open ();
- textWidget.append (instance.getResourceString("FontDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(instance.getResourceString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- int result = dialog.open ();
- textWidget.append (instance.getResourceString("MessageBox") + Text.DELIMITER);
- /*
- * The resulting integer depends on the original
- * dialog style. Decode the result and display it.
- */
- switch (result) {
- case SWT.OK:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_OK"));
- break;
- case SWT.YES:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_YES"));
- break;
- case SWT.NO:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_NO"));
- break;
- case SWT.CANCEL:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_CANCEL"));
- break;
- case SWT.ABORT:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_ABORT"));
- break;
- case SWT.RETRY:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_RETRY"));
- break;
- case SWT.IGNORE:
- textWidget.append (instance.getResourceString("Result") + instance.getResourceString("SWT_IGNORE"));
- break;
- default:
- textWidget.append(instance.getResourceString("Result") + result);
- break;
- }
- textWidget.append (Text.DELIMITER + Text.DELIMITER);
- }
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout(gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (instance.getResourceString("Parameters"));
-
- /*
- * Create a group to hold the dialog style combo box and
- * create dialog button.
- */
- dialogStyleGroup = new Group (controlGroup, SWT.NULL);
- dialogStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- dialogStyleGroup.setLayoutData (gridData);
- dialogStyleGroup.setText (instance.getResourceString("Dialog_Type"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- instance.getResourceString("ColorDialog"),
- instance.getResourceString("DirectoryDialog"),
- instance.getResourceString("FileDialog"),
- instance.getResourceString("FontDialog"),
- instance.getResourceString("MessageBox"),
- };
- dialogCombo = new Combo (dialogStyleGroup, SWT.READ_ONLY);
- dialogCombo.setItems (strings);
- dialogCombo.setText (strings [0]);
-
- /* Create the create dialog button */
- Button createButton = new Button(dialogStyleGroup, SWT.NULL);
- createButton.setText (instance.getResourceString("Create_Dialog"));
- createButton.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* Create a group for the various dialog button style controls */
- Group buttonStyleGroup = new Group (controlGroup, SWT.NULL);
- buttonStyleGroup.setLayout (new GridLayout ());
- buttonStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- buttonStyleGroup.setText (instance.getResourceString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText (instance.getResourceString("SWT_OK"));
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText (instance.getResourceString("SWT_CANCEL"));
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText (instance.getResourceString("SWT_YES"));
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText (instance.getResourceString("SWT_NO"));
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText (instance.getResourceString("SWT_RETRY"));
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText (instance.getResourceString("SWT_ABORT"));
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText (instance.getResourceString("SWT_IGNORE"));
-
- /* Create a group for the icon style controls */
- Group iconStyleGroup = new Group (controlGroup, SWT.NULL);
- iconStyleGroup.setLayout (new GridLayout ());
- iconStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- iconStyleGroup.setText (instance.getResourceString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText (instance.getResourceString("SWT_ICON_ERROR"));
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText (instance.getResourceString("SWT_ICON_INFORMATION"));
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText (instance.getResourceString("SWT_ICON_QUESTION"));
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText (instance.getResourceString("SWT_ICON_WARNING"));
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText (instance.getResourceString("SWT_ICON_WORKING"));
-
- /* Create a group for the modal style controls */
- Group modalStyleGroup = new Group (controlGroup, SWT.NULL);
- modalStyleGroup.setLayout (new GridLayout ());
- modalStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- modalStyleGroup.setText (instance.getResourceString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText (instance.getResourceString("SWT_MODELESS"));
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText (instance.getResourceString("SWT_PRIMARY_MODAL"));
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText (instance.getResourceString("SWT_APPLICATION_MODAL"));
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText (instance.getResourceString("SWT_SYSTEM_MODAL"));
-
- /* Create a group for the file dialog style controls */
- Group fileDialogStyleGroup = new Group (controlGroup, SWT.NULL);
- fileDialogStyleGroup.setLayout (new GridLayout ());
- fileDialogStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- fileDialogStyleGroup.setText (instance.getResourceString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText (instance.getResourceString("SWT_SAVE"));
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText(instance.getResourceString("SWT_OPEN"));
-
- /* Add the listeners */
- dialogCombo.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dialogSelected (event);
- };
- });
- createButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- createButtonSelected (event);
- };
- });
- SelectionListener buttonStyleListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- buttonStyleSelected (event);
- };
- };
- okButton.addSelectionListener (buttonStyleListener);
- cancelButton.addSelectionListener (buttonStyleListener);
- yesButton.addSelectionListener (buttonStyleListener);
- noButton.addSelectionListener (buttonStyleListener);
- retryButton.addSelectionListener (buttonStyleListener);
- abortButton.addSelectionListener (buttonStyleListener);
- ignoreButton.addSelectionListener (buttonStyleListener);
-
- /* Set default values for style buttons */
- okButton.setEnabled (false);
- cancelButton.setEnabled (false);
- yesButton.setEnabled (false);
- noButton.setEnabled (false);
- retryButton.setEnabled (false);
- abortButton.setEnabled (false);
- ignoreButton.setEnabled (false);
- iconErrorButton.setEnabled (false);
- iconInformationButton.setEnabled (false);
- iconQuestionButton.setEnabled (false);
- iconWarningButton.setEnabled (false);
- iconWorkingButton.setEnabled (false);
- saveButton.setEnabled (false);
- openButton.setEnabled (false);
- openButton.setSelection (true);
- iconInformationButton.setSelection (true);
- modelessButton.setSelection (true);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /*
- * Create a group for the text widget to display
- * the results returned by the example dialogs.
- */
- resultGroup = new Group (exampleGroup, SWT.NULL);
- resultGroup.setLayout (new GridLayout ());
- resultGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- resultGroup.setText (instance.getResourceString("Dialog_Result"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /*
- * Create a multi lined, scrolled text widget for output.
- */
- textWidget = new Text(resultGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData gridData = new GridData ();
- gridData.widthHint = 300;
- gridData.heightHint = 400;
- textWidget.setLayoutData (gridData);
- }
-
- /**
- * Handle a dialog type combo selection event.
- *
- * @param event the selection event
- */
- void dialogSelected (SelectionEvent event) {
-
- /* Enable/Disable the buttons */
- String name = dialogCombo.getText ();
- boolean isMessageBox = name.equals (instance.getResourceString("MessageBox"));
- boolean isFileDialog = name.equals (instance.getResourceString("FileDialog"));
- okButton.setEnabled (isMessageBox);
- cancelButton.setEnabled (isMessageBox);
- yesButton.setEnabled (isMessageBox);
- noButton.setEnabled (isMessageBox);
- retryButton.setEnabled (isMessageBox);
- abortButton.setEnabled (isMessageBox);
- ignoreButton.setEnabled (isMessageBox);
- iconErrorButton.setEnabled (isMessageBox);
- iconInformationButton.setEnabled (isMessageBox);
- iconQuestionButton.setEnabled (isMessageBox);
- iconWarningButton.setEnabled (isMessageBox);
- iconWorkingButton.setEnabled (isMessageBox);
- saveButton.setEnabled (isFileDialog);
- openButton.setEnabled (isFileDialog);
-
- /* Unselect the buttons */
- if (!isMessageBox) {
- okButton.setSelection (false);
- cancelButton.setSelection (false);
- yesButton.setSelection (false);
- noButton.setSelection (false);
- retryButton.setSelection (false);
- abortButton.setSelection (false);
- ignoreButton.setSelection (false);
- }
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return instance.getResourceString("Dialog");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
deleted file mode 100755
index 64363bd151..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class LabelTab extends AlignableTab {
- /* Example widgets and groups that contain them */
- Label label1, label2, label3, label4, label5, label6;
- Group textLabelGroup, imageLabelGroup;
-
- /* Style widgets added to the "Style" group */
- Button separatorButton, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- LabelTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text labels */
- textLabelGroup = new Group(exampleGroup, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- textLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- textLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textLabelGroup.setText (ControlExample.getResourceString("Text_Labels"));
-
- /* Create a group for the image labels */
- imageLabelGroup = new Group (exampleGroup, SWT.SHADOW_NONE);
- gridLayout = new GridLayout ();
- imageLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- imageLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageLabelGroup.setText (ControlExample.getResourceString("Image_Labels"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
- if (shadowOutButton.getSelection ()) style |= SWT.SHADOW_OUT;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- label1 = new Label (textLabelGroup, style);
- label1.setText(ControlExample.getResourceString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(ControlExample.getResourceString("Two"));
- label3 = new Label (textLabelGroup, style);
- label3.setText (ControlExample.getResourceString("Three"));
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (instance.images[ControlExample.ciClosedFolder]);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (instance.images[ControlExample.ciOpenFolder]);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText (ControlExample.getResourceString("SWT_SEPARATOR"));
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (ControlExample.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlExample.getResourceString("SWT_VERTICAL"));
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText (ControlExample.getResourceString("SWT_SHADOW_IN"));
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText (ControlExample.getResourceString("SWT_SHADOW_OUT"));
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText(ControlExample.getResourceString("SWT_BORDER"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if ((event.widget.getStyle() & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- shadowInButton.addSelectionListener (selectionListener);
- shadowOutButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {label1, label2, label3, label4, label5, label6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Label");
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- label1.setAlignment (allignment);
- label2.setAlignment (allignment);
- label3.setAlignment (allignment);
- label4.setAlignment (allignment);
- label5.setAlignment (allignment);
- label6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- boolean isSeparator = (label1.getStyle () & SWT.SEPARATOR) != 0;
- leftButton.setSelection (!isSeparator && (label1.getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection (!isSeparator && (label1.getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection (!isSeparator && (label1.getStyle () & SWT.RIGHT) != 0);
- shadowInButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_IN) != 0);
- shadowOutButton.setSelection (!shadowInButton.getSelection ());
- leftButton.setEnabled (!isSeparator);
- centerButton.setEnabled (!isSeparator);
- rightButton.setEnabled (!isSeparator);
- shadowInButton.setEnabled (isSeparator);
- shadowOutButton.setEnabled (isSeparator);
- horizontalButton.setEnabled (isSeparator);
- verticalButton.setEnabled (isSeparator);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java
deleted file mode 100755
index ebd89e75c4..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ListTab extends ScrollableTab {
-
- /* Example widgets and groups that contain them */
- List list1;
- Group listGroup;
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ListTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the list */
- listGroup = new Group (exampleGroup, SWT.NULL);
- listGroup.setLayout (new GridLayout ());
- listGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- listGroup.setText (ControlExample.getResourceString("List"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- list1 = new List (listGroup, style);
- list1.setItems (ListData1);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {list1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("List");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
deleted file mode 100755
index 397ff26896..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ProgressBarTab extends RangeTab {
- /* Example widgets and groups that contain them */
- ProgressBar progressBar1;
- Group progressBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button smoothButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ProgressBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup() {
- super.createExampleGroup ();
-
- /* Create a group for the progress bar */
- progressBarGroup = new Group (exampleGroup, SWT.NULL);
- progressBarGroup.setLayout (new GridLayout ());
- progressBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- progressBarGroup.setText (ControlExample.getResourceString("ProgressBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (smoothButton.getSelection ()) style |= SWT.SMOOTH;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- progressBar1 = new ProgressBar (progressBarGroup, style);
- progressBar1.setMaximum (100);
- progressBar1.setSelection (50);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- smoothButton = new Button (styleGroup, SWT.CHECK);
- smoothButton.setText (ControlExample.getResourceString("SWT_SMOOTH"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("ProgressBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- maximumScale.setMaximum (progressBar1.getMaximum ());
- smoothButton.setSelection ((progressBar1.getStyle () & SWT.SMOOTH) != 0);
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- void setWidgetMaximum () {
- progressBar1.setMaximum (maximumScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java
deleted file mode 100755
index a257410f66..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-abstract class RangeTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button horizontalButton, verticalButton;
-
- /* Scale widgets added to the "Control" group */
- Scale minimumScale, selectionScale, maximumScale;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- RangeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Leave an empty cell */
- new Composite (controlGroup, SWT.NULL);
-
- /* Create controls specific to this example */
- createMinimumGroup ();
- createMaximumGroup ();
- createSelectionGroup ();
- }
-
- /**
- * Create a group of widgets to control the maximum
- * attribute of the example widget.
- */
- void createMaximumGroup() {
-
- /* Create the group */
- Group maximumGroup = new Group (controlGroup, SWT.NULL);
- maximumGroup.setLayout (new GridLayout ());
- maximumGroup.setText (ControlExample.getResourceString("Maximum"));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- /* Add the listeners */
- maximumScale.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMaximum ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the minimum
- * attribute of the example widget.
- */
- void createMinimumGroup() {
-
- /* Create the group */
- Group minimumGroup = new Group (controlGroup, SWT.NULL);
- minimumGroup.setLayout (new GridLayout ());
- minimumGroup.setText (ControlExample.getResourceString("Minimum"));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- /* Add the listeners */
- minimumScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMinimum ();
- };
- });
-
- }
-
- /**
- * Create a group of widgets to control the selection
- * attribute of the example widget.
- */
- void createSelectionGroup() {
-
- /* Create the group */
- Group selectionGroup = new Group(controlGroup, SWT.NULL);
- selectionGroup.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(ControlExample.getResourceString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- /* Add the listeners */
- selectionScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setWidgetSelection ();
- };
- });
-
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (ControlExample.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlExample.getResourceString("SWT_VERTICAL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetMinimum ();
- setWidgetMaximum ();
- setWidgetSelection ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.HORIZONTAL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.VERTICAL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- abstract void setWidgetMaximum ();
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- abstract void setWidgetMinimum ();
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- abstract void setWidgetSelection ();
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java
deleted file mode 100755
index 518017d168..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SashTab extends Tab {
- /* Example widgets and groups that contain them */
- Sash hSash, vSash;
- List list1, list2, list3;
- Text text;
-
- static String [] ListData0 = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SashTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the tab folder page.
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create the page. This example does not use layouts.
- */
- tabFolderPage = new Composite(tabFolder, SWT.BORDER);
-
- /* Create the list and text widgets */
- list1 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list1.setItems (ListData0);
- list2 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list2.setItems (ListData1);
- text = new Text (tabFolderPage, SWT.MULTI | SWT.BORDER);
- text.setText (ControlExample.getResourceString("Multi_line"));
-
- /* Create the sashes */
- vSash = new Sash (tabFolderPage, SWT.VERTICAL);
- hSash = new Sash (tabFolderPage, SWT.HORIZONTAL);
-
- /* Add the listeners */
- hSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- hSash.setBounds (event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- vSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- vSash.setBounds(event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- tabFolderPage.addControlListener (new ControlAdapter () {
- public void controlResized (ControlEvent event) {
- shellResized ();
- }
- });
-
- /*
- * Do not set the bounds of the lists, text and sashes here
- * because this method is run before the widget is opened
- * so we do not know how big the tabComposite is going to be.
- * When the widget is opened a resize event will occur
- * and the contained widgets can be sized accordingly.
- */
- return tabFolderPage;
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Sash");
- }
-
- /**
- * Layout the list and text widgets according to the new
- * positions of the sashes..events.SelectionEvent
- */
- void layout () {
-
- Rectangle tabCompositeBounds = tabFolderPage.getClientArea ();
- Rectangle hSashBounds = hSash.getBounds ();
- Rectangle vSashBounds = vSash.getBounds ();
-
- list1.setBounds (0, 0, vSashBounds.x, hSashBounds.y);
- list2.setBounds (vSashBounds.x + vSashBounds.width, 0, tabCompositeBounds.width - (vSashBounds.x + vSashBounds.width), hSashBounds.y);
- text.setBounds (0, hSashBounds.y + hSashBounds.height, tabCompositeBounds.width, tabCompositeBounds.height - (hSashBounds.y + hSashBounds.height));
-
- /**
- * If the horizontal sash has been moved then the vertical
- * sash is either too long or too short and its size must
- * be adjusted.
- */
- vSashBounds.height = hSashBounds.y;
- vSash.setBounds (vSashBounds);
- }
-
- /**
- * Handle the shell resized event.
- */
- void shellResized () {
-
- /* Get the client area for the shell */
- Rectangle tabFolderPageBounds = tabFolderPage.getClientArea ();
-
- /*
- * Make list 1 half the width and half the height of the tab leaving room for the sash.
- * Place list 1 in the top left quadrant of the tab.
- */
- Rectangle list1Bounds = new Rectangle (0, 0, (tabFolderPageBounds.width - SASH_WIDTH) / 2, (tabFolderPageBounds.height - SASH_WIDTH) / 2);
- list1.setBounds (list1Bounds);
-
- /*
- * Make list 2 half the width and half the height of the tab leaving room for the sash.
- * Place list 2 in the top right quadrant of the tab.
- */
- list2.setBounds (list1Bounds.width + SASH_WIDTH, 0, tabFolderPageBounds.width - (list1Bounds.width + SASH_WIDTH), list1Bounds.height);
-
- /*
- * Make the text area the full width and half the height of the tab leaving room for the sash.
- * Place the text area in the bottom half of the tab.
- */
- text.setBounds (0, list1Bounds.height + SASH_WIDTH, tabFolderPageBounds.width, tabFolderPageBounds.height - (list1Bounds.height + SASH_WIDTH));
-
- /* Position the sashes */
- vSash.setBounds (list1Bounds.width, 0, SASH_WIDTH, list1Bounds.height);
- hSash.setBounds (0, list1Bounds.height, tabFolderPageBounds.width, SASH_WIDTH);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java
deleted file mode 100755
index 5c24c9e04c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-abstract class ScrollableTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button singleButton, multiButton, horizontalButton, verticalButton, borderButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ScrollableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText (ControlExample.getResourceString("SWT_SINGLE"));
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText (ControlExample.getResourceString("SWT_MULTI"));
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText (ControlExample.getResourceString("SWT_H_SCROLL"));
- horizontalButton.setSelection(true);
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText (ControlExample.getResourceString("SWT_V_SCROLL"));
- verticalButton.setSelection(true);
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- singleButton.setSelection ((controls [0].getStyle () & SWT.SINGLE) != 0);
- multiButton.setSelection ((controls [0].getStyle () & SWT.MULTI) != 0);
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.H_SCROLL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.V_SCROLL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java
deleted file mode 100755
index 28c370c089..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ShellTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button noParentButton, parentButton;
- Button noTrimButton, closeButton, titleButton, minButton, maxButton, borderButton, resizeButton;
- Button createButton, closeAllButton;
- Group parentStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ShellTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Close all the example shells.
- */
- void closeAllShells() {
- for (int i = 0; i<shellCount; i++) {
- if (shells[i] != null & !shells [i].isDisposed ()) {
- shells [i].dispose();
- }
- }
- shellCount = 0;
- }
-
- /**
- * Handle the Create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void createButtonSelected(SelectionEvent event) {
-
- /*
- * Remember the example shells so they
- * can be disposed by the user.
- */
- if (shellCount >= shells.length) {
- Shell [] newShells = new Shell [shells.length + 4];
- System.arraycopy (shells, 0, newShells, 0, shells.length);
- shells = newShells;
- }
-
- /* Compute the shell style */
- int style = SWT.NONE;
- if (noTrimButton.getSelection()) style |= SWT.NO_TRIM;
- if (closeButton.getSelection()) style |= SWT.CLOSE;
- if (titleButton.getSelection()) style |= SWT.TITLE;
- if (minButton.getSelection()) style |= SWT.MIN;
- if (maxButton.getSelection()) style |= SWT.MAX;
- if (borderButton.getSelection()) style |= SWT.BORDER;
- if (resizeButton.getSelection()) style |= SWT.RESIZE;
-
- /* Create the shell with or without a parent */
- if (noParentButton.getSelection ()) {
- shells [shellCount] = new Shell (style);
- } else {
- Shell shell = tabFolderPage.getShell ();
- shells [shellCount] = new Shell (shell, style);
- }
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (ControlExample.getResourceString("Title") + shellCount);
- shells [shellCount++].open ();
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 1;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
-
- /* Create a group for the parent sytle controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (ControlExample.getResourceString("Parent"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (ControlExample.getResourceString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (ControlExample.getResourceString("Parent"));
-
- /* Create a group for the decoration style controls */
- Group decorationStyleGroup = new Group(styleGroup, SWT.NULL);
- decorationStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (ControlExample.getResourceString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText (ControlExample.getResourceString("SWT_NO_TRIM"));
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText (ControlExample.getResourceString("SWT_CLOSE"));
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText (ControlExample.getResourceString("SWT_TITLE"));
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText (ControlExample.getResourceString("SWT_MIN"));
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText (ControlExample.getResourceString("SWT_MAX"));
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText (ControlExample.getResourceString("SWT_RESIZE"));
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- createButton.setLayoutData (gridData);
- createButton.setText (ControlExample.getResourceString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- closeAllButton.setText (ControlExample.getResourceString("Close_All_Shells"));
- closeAllButton.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* Add the listeners */
- createButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createButtonSelected(e);
- };
- });
- closeAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAllShells ();
- };
- });
- SelectionListener decorationButtonListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- decorationButtonSelected(event);
- };
- };
- noTrimButton.addSelectionListener (decorationButtonListener);
- closeButton.addSelectionListener (decorationButtonListener);
- titleButton.addSelectionListener (decorationButtonListener);
- minButton.addSelectionListener (decorationButtonListener);
- maxButton.addSelectionListener (decorationButtonListener);
- borderButton.addSelectionListener (decorationButtonListener);
- resizeButton.addSelectionListener (decorationButtonListener);
-
- /* Set the default state */
- noParentButton.setSelection (true);
- }
-
- /**
- * Handle a decoration button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void decorationButtonSelected(SelectionEvent event) {
-
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- Button widget = (Button) event.widget;
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- closeButton.setSelection (false);
- titleButton.setSelection (false);
- minButton.setSelection (false);
- maxButton.setSelection (false);
- borderButton.setSelection (false);
- resizeButton.setSelection (false);
- return;
- }
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Shell");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
deleted file mode 100755
index 33de3df0c8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SliderTab extends RangeTab {
- /* Example widgets and groups that contain them */
- Scale scale1;
- Slider slider1;
- Group sliderGroup, scaleGroup;
-
- /* Scale widgets added to the "Control" group */
- Scale incrementScale, pageIncrementScale, thumbScale;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SliderTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
- super.createControlWidgets ();
- createThumbGroup ();
- createIncrementGroup ();
- createPageIncrementGroup ();
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the slider */
- sliderGroup = new Group (exampleGroup, SWT.NULL);
- sliderGroup.setLayout (new GridLayout ());
- sliderGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sliderGroup.setText (ControlExample.getResourceString("Slider"));
-
- /* Create a group for the scale */
- scaleGroup = new Group (exampleGroup, SWT.NULL);
- scaleGroup.setLayout (new GridLayout ());
- scaleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- scaleGroup.setText (ControlExample.getResourceString("Scale"));
-
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- scale1 = new Scale (scaleGroup, style);
- scale1.setMaximum (100);
- scale1.setSelection (50);
- scale1.setIncrement (5);
- scale1.setPageIncrement (10);
- slider1 = new Slider(sliderGroup, style);
- slider1.setMaximum (100);
- slider1.setSelection (50);
- slider1.setIncrement(5);
- slider1.setPageIncrement (10);
- slider1.setThumb (10);
- }
-
- /**
- * Create a group of widgets to control the increment
- * attribute of the example widget.
- */
- void createIncrementGroup() {
-
- /* Create the group */
- Group incrementGroup = new Group (controlGroup, SWT.NULL);
- incrementGroup.setLayout (new GridLayout ());
- incrementGroup.setText (ControlExample.getResourceString("Increment"));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- /* Add the listeners */
- incrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- setWidgetIncrement ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the page increment
- * attribute of the example widget.
- */
- void createPageIncrementGroup() {
-
- /* Create the group */
- Group pageIncrementGroup = new Group (controlGroup, SWT.NULL);
- pageIncrementGroup.setLayout (new GridLayout ());
- pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetPageIncrement ();
- }
- });
- }
-
- /**
- * Create a group of widgets to control the thumb
- * attribute of the example widget.
- */
- void createThumbGroup() {
-
- /* Create the group */
- Group thumbGroup = new Group (controlGroup, SWT.NULL);
- thumbGroup.setLayout (new GridLayout ());
- thumbGroup.setText (ControlExample.getResourceString("Thumb"));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- /* Add the listeners */
- thumbScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetThumb ();
- };
- });
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {scale1, slider1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Slider_and_Scale");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetIncrement ();
- setWidgetPageIncrement ();
- setWidgetThumb ();
- }
-
- /**
- * Sets the increment of the "Example" widgets.
- */
- void setWidgetIncrement () {
- slider1.setIncrement (incrementScale.getSelection ());
- scale1.setIncrement (incrementScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMaximum () {
- slider1.setMaximum (maximumScale.getSelection ());
- scale1.setMaximum (maximumScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- slider1.setMinimum (minimumScale.getSelection ());
- scale1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the page increment of the "Example" widgets.
- */
- void setWidgetPageIncrement () {
- slider1.setPageIncrement (pageIncrementScale.getSelection ());
- scale1.setPageIncrement (pageIncrementScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- slider1.setSelection (selectionScale.getSelection ());
- scale1.setSelection (selectionScale.getSelection ());
- }
-
- /**
- * Sets the thumb of the "Example" widgets.
- */
- void setWidgetThumb () {
- slider1.setThumb (thumbScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
deleted file mode 100755
index 7fe4ec26b7..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * <code>Tab</code> is the abstract superclass of every page
- * in the example's tab folder. Each page in the tab folder
- * describes a control.
- *
- * A Tab itself is not a control but instead provides a
- * hierarchy with which to share code that is common to
- * every page in the folder.
- *
- * A typical page in a Tab contains a two column composite.
- * The left column contains the "Example" group. The right
- * column contains "Control" group. The "Control" group
- * contains controls that allow the user to interact with
- * the example control. The "Control" group typically
- * contains a "Style", "Display" and "Size" group. Subclasses
- * can override these defaults to augment a group or stop
- * a group from being created.
- */
-abstract class Tab {
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup;
-
- /* Controlling instance */
- final ControlExample instance;
-
- /* Sizing constants for the "Size" group */
- static final int TOO_SMALL_SIZE = 10;
- static final int SMALL_SIZE = 50;
- static final int LARGE_SIZE = 100;
-
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- Tab(ControlExample instance) {
- this.instance = instance;
- }
-
- /**
- * Creates the "Control" group. The "Control" group
- * is typically the right hand column in the tab.
- */
- void createControlGroup () {
-
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
-
- /*
- * For each Button child in the style group, add a selection
- * listener that will recreate the example controls. If the
- * style group button is a RADIO button, ensure that the radio
- * button is selected before recreating the example controls.
- * When the user selects a RADIO button, the curreont RADIO
- * button in the group is deselected and the new RADIO button
- * is selected automatically. The listeners are notified for
- * both these operations but typically only do work when a RADIO
- * button is selected.
- */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if ((event.widget.getStyle () & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- Control [] children = styleGroup.getChildren ();
- for (int i=0; i<children.length; i++) {
- if (children [i] instanceof Button) {
- Button button = (Button) children [i];
- button.addSelectionListener (selectionListener);
- }
- }
- }
-
- /**
- * Creates the "Control" widget children.
- * Subclasses override this method to augment
- * the standard controls created in the "Style",
- * "Display" and "Size" groups.
- */
- void createControlWidgets () {
- }
-
- /**
- * Creates the "Display" group. This is typically
- * a child of the "Control" group.
- */
- void createDisplayGroup () {
- /* Create the group */
- displayGroup = new Group (controlGroup, SWT.NONE);
- displayGroup.setLayout (new GridLayout ());
- displayGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- displayGroup.setText (ControlExample.getResourceString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(ControlExample.getResourceString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(ControlExample.getResourceString("Visible"));
-
- /* Add the listeners */
- enabledButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetEnabled ();
- }
- });
- visibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetVisibility ();
- }
- });
-
- /* Set the default state */
- enabledButton.setSelection(true);
- visibleButton.setSelection(true);
- }
-
- /**
- * Creates the "Example" group. The "Example" group
- * is typically the left hand column in the tab.
- */
- void createExampleGroup () {
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- }
-
- /**
- * Creates the "Example" widget children of the "Example" group.
- * Subclasses override this method to create the particular
- * example control.
- */
- void createExampleWidgets () {
- /* Do nothing */
- }
-
- /**
- * Creates the "Size" group. The "Size" group contains
- * controls that allow the user to change the size of
- * the example widgets.
- */
- void createSizeGroup () {
- /* Create the group */
- sizeGroup = new Group (controlGroup, SWT.NONE);
- sizeGroup.setLayout (new GridLayout());
- sizeGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sizeGroup.setText (ControlExample.getResourceString("Size"));
-
- /* Create the controls */
-
- /*
- * The preferred size of a widget is the size returned
- * by widget.computeSize (SWT.DEFAULT, SWT.DEFAULT).
- * This size is defined on a widget by widget basis.
- * Many widgets will attempt to display their contents.
- */
- preferredButton = new Button (sizeGroup, SWT.RADIO);
- preferredButton.setText (ControlExample.getResourceString("Preferred"));
- tooSmallButton = new Button (sizeGroup, SWT.RADIO);
- tooSmallButton.setText (TOO_SMALL_SIZE + " X " + TOO_SMALL_SIZE);
- smallButton = new Button(sizeGroup, SWT.RADIO);
- smallButton.setText (SMALL_SIZE + " X " + SMALL_SIZE);
- largeButton = new Button (sizeGroup, SWT.RADIO);
- largeButton.setText (LARGE_SIZE + " X " + LARGE_SIZE);
-
- /* Add the listeners */
- SelectionAdapter selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetSize ();
- };
- };
- preferredButton.addSelectionListener(selectionListener);
- tooSmallButton.addSelectionListener(selectionListener);
- smallButton.addSelectionListener(selectionListener);
- largeButton.addSelectionListener(selectionListener);
-
- /* Set the default state */
- preferredButton.setSelection (true);
- }
-
- /**
- * Creates the "Style" group. The "Style" group contains
- * controls that allow the user to change the style of
- * the example widgets. Changing a widget "Style" causes
- * the widget to be destroyed and recreated.
- */
- void createStyleGroup () {
- styleGroup = new Group (controlGroup, SWT.NONE);
- styleGroup.setLayout (new GridLayout ());
- styleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
- }
-
- /**
- * Creates the tab folder page.
- *
- * @param tabFolder org.eclipse.swt.widgets.TabFolder
- * @return the new page for the tab folder
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create a two column page.
- */
- tabFolderPage = new Composite (tabFolder, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- tabFolderPage.setLayout (gridLayout);
- gridLayout.numColumns = 2;
-
- /* Create the "Example" and "Control" columns */
- createExampleGroup ();
- createControlGroup ();
-
- /* Create the widgets in the two columns */
- createExampleWidgets ();
- createControlWidgets ();
- setExampleWidgetState ();
-
- return tabFolderPage;
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].dispose ();
- }
- }
-
- /**
- * Gets the "Example" widget children.
- *
- * @return an array of example widget children
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- *
- * @return the text for the tab item
- */
- String getTabText () {
- return "";
- }
-
- /**
- * Recreates the "Example" widgets.
- */
- void recreateExampleWidgets () {
- disposeExampleWidgets ();
- createExampleWidgets ();
- setExampleWidgetState ();
- }
-
- /**
- * Sets the enabled state of the "Example" widgets.
- */
- void setExampleWidgetEnabled () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setEnabled (enabledButton.getSelection ());
- }
- }
-
- /**
- * Sets the size of the "Example" widgets.
- */
- void setExampleWidgetSize () {
- int size = SWT.DEFAULT;
- if (preferredButton == null) return;
- if (preferredButton.getSelection()) size = SWT.DEFAULT;
- if (tooSmallButton.getSelection()) size = TOO_SMALL_SIZE;
- if (smallButton.getSelection()) size = SMALL_SIZE;
- if (largeButton.getSelection()) size = LARGE_SIZE;
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- GridData gridData = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes nay not have
- * changed.
- */
- int seenCount = 0;
- Composite [] seen = new Composite [4];
- for (int i=0; i<controls.length; i++) {
- Control control = controls [i];
- while (control != exampleGroup) {
- Composite parent = control.getParent ();
- int index = 0;
- while (index < seenCount) {
- if (seen [index] == parent) break;
- index++;
- }
- if (index == seenCount) parent.layout ();
- if (seenCount == seen.length) {
- Composite [] newSeen = new Composite [seen.length + 4];
- System.arraycopy (seen, 0, newSeen, 0, seen.length);
- seen = newSeen;
- }
- seen [seenCount++] = parent;
- control = control.getParent ();
- }
- }
- }
-
- /**
- * Sets the state of the "Example" widgets. Subclasses
- * reimplement this method to set "Example" widget state
- * that is specific to the widget.
- */
- void setExampleWidgetState () {
- setExampleWidgetEnabled ();
- setExampleWidgetVisibility ();
- setExampleWidgetSize ();
- }
-
- /**
- * Sets the visibility of the "Example" widgets.
- */
- void setExampleWidgetVisibility () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setVisible (visibleButton.getSelection ());
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
deleted file mode 100755
index a07f1bd69c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TableTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Table table1;
- Group tableGroup;
-
- /* Style widgets added to the "Style" group */
- Button fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- static String [] columnTitles = {ControlExample.getResourceString("TableTitle_0"),
- ControlExample.getResourceString("TableTitle_1"),
- ControlExample.getResourceString("TableTitle_2"),
- ControlExample.getResourceString("TableTitle_3")};
-
- static String [] stringLine0 = {ControlExample.getResourceString("TableLine0_0"),
- ControlExample.getResourceString("TableLine0_1"),
- ControlExample.getResourceString("TableLine0_2"),
- ControlExample.getResourceString("TableLine0_3")};
-
- static String [] stringLine1 = {ControlExample.getResourceString("TableLine1_0"),
- ControlExample.getResourceString("TableLine1_1"),
- ControlExample.getResourceString("TableLine1_2"),
- ControlExample.getResourceString("TableLine1_3")};
-
- static String [] stringLine2 = {ControlExample.getResourceString("TableLine2_0"),
- ControlExample.getResourceString("TableLine2_1"),
- ControlExample.getResourceString("TableLine2_2"),
- ControlExample.getResourceString("TableLine2_3")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Display" group.
- */
- void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible"));
-
- /* Add the listeners */
- headerVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetHeaderVisible ();
- }
- });
- linesVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetLinesVisible ();
- };
- });
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the table */
- tableGroup = new Group (exampleGroup, SWT.NULL);
- tableGroup.setLayout (new GridLayout ());
- tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText (ControlExample.getResourceString("Table"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (fullSelectionButton.getSelection ()) style |= SWT.FULL_SELECTION;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the table widget */
- table1 = new Table (tableGroup, style);
-
- /* Fill the table with data */
- int[] columnWidths = {150, 60, 75, 150};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (instance.images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText (ControlExample.getResourceString("SWT_FULL_SELECTION"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {table1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Table");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- fullSelectionButton.setSelection ((table1.getStyle () & SWT.FULL_SELECTION) != 0);
- }
-
- /**
- * Sets the header visible state of the "Example" widgets.
- */
- void setWidgetHeaderVisible () {
- table1.setHeaderVisible (headerVisibleButton.getSelection ());
- }
-
- /**
- * Sets the lines visible state of the "Example" widgets.
- */
- void setWidgetLinesVisible () {
- table1.setLinesVisible (linesVisibleButton.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java
deleted file mode 100755
index 9f4dcfadb8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.custom.*;
-
-class TextTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Text text;
- StyledText styledText;
- Group textGroup, styledTextGroup;
-
- /* Style widgets added to the "Style" group */
- Button readOnlyButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TextTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text widget */
- textGroup = new Group (exampleGroup, SWT.NULL);
- textGroup.setLayout (new GridLayout ());
- textGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textGroup.setText (ControlExample.getResourceString("Text"));
-
- /* Create a group for the styled text widget */
- styledTextGroup = new Group (exampleGroup, SWT.NULL);
- styledTextGroup.setLayout (new GridLayout ());
- styledTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styledTextGroup.setText (ControlExample.getResourceString("StyledText"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (ControlExample.getResourceString("Example_string"));
- text.append (text.DELIMITER);
- text.append (ControlExample.getResourceString("One_Two_Three"));
- styledText = new StyledText (styledTextGroup, style);
- styledText.setText (ControlExample.getResourceString("Example_string"));
- styledText.append ("\n");
- styledText.append (ControlExample.getResourceString("One_Two_Three"));
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlExample.getResourceString("SWT_READ_ONLY"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {text, styledText};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Text");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- readOnlyButton.setSelection ((text.getStyle () & SWT.READ_ONLY) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
deleted file mode 100755
index d93d605552..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ToolBarTab extends Tab {
- /* Example widgets and groups that contain them */
- ToolBar imageToolBar, textToolBar;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ToolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the image tool bar */
- imageToolBarGroup = new Group (exampleGroup, SWT.NULL);
- imageToolBarGroup.setLayout (new GridLayout ());
- imageToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageToolBarGroup.setText (ControlExample.getResourceString("Image_ToolBar"));
-
- /* Create a group for the text tool bar */
- textToolBarGroup = new Group (exampleGroup, SWT.NULL);
- textToolBarGroup.setLayout (new GridLayout ());
- textToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textToolBarGroup.setText (ControlExample.getResourceString("Text_ToolBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (flatButton.getSelection()) style |= SWT.FLAT;
- if (wrapButton.getSelection()) style |= SWT.WRAP;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /*
- * Create the example widgets.
- *
- * A tool bar must consist of all image tool
- * items or all text tool items but not both.
- */
-
- /* Create the image tool bar */
- imageToolBar = new ToolBar (imageToolBarGroup, style);
- ToolItem item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText (ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlExample.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText (ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener(new DropDownSelectionListener());
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText(ControlExample.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (ControlExample.getResourceString("Check"));
- item.setToolTipText(ControlExample.getResourceString("SWT_CHECK"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText(ControlExample.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlExample.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (ControlExample.getResourceString("Drop_Down"));
- item.setToolTipText(ControlExample.getResourceString("SWT_DROP_DOWN"));
- item.addSelectionListener(new DropDownSelectionListener());
-
- /*
- * Do not add the selection event for this drop down
- * tool item. Without hooking the event, the drop down
- * widget does nothing special when the drop down area
- * is selected.
- */
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- flatButton = new Button (styleGroup, SWT.CHECK);
- flatButton.setText (ControlExample.getResourceString("SWT_FLAT"));
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText (ControlExample.getResourceString("SWT_WRAP"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlExample.getResourceString("SWT_BORDER"));
- }
-
- void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("ToolBar");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- flatButton.setSelection ((imageToolBar.getStyle () & SWT.FLAT) != 0);
- wrapButton.setSelection ((imageToolBar.getStyle () & SWT.WRAP) != 0);
- borderButton.setSelection ((imageToolBar.getStyle () & SWT.BORDER) != 0);
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
deleted file mode 100755
index 20fde39d95..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TreeTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Tree tree1, tree2;
- Group treeGroup, imageTreeGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TreeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text tree */
- treeGroup = new Group (exampleGroup, SWT.NULL);
- treeGroup.setLayout (new GridLayout ());
- treeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- treeGroup.setText (ControlExample.getResourceString("Tree"));
-
- /* Create a group for the image tree */
- imageTreeGroup = new Group (exampleGroup, SWT.NULL);
- imageTreeGroup.setLayout (new GridLayout ());
- imageTreeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageTreeGroup.setText (ControlExample.getResourceString("Tree_With_Images"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection()) style |= SWT.SINGLE;
- if (multiButton.getSelection()) style |= SWT.MULTI;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- node1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- node2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- node3.setImage (instance.images[ControlExample.ciClosedFolder]);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- node4.setImage (instance.images[ControlExample.ciClosedFolder]);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- node1_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- node2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- node3_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- node2_2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
- node2_2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Tree");
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif
deleted file mode 100644
index 6660d0b11a..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif
deleted file mode 100644
index fc9943f111..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif
deleted file mode 100644
index 9807ae648d..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
deleted file mode 100755
index 5494a3e186..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ /dev/null
@@ -1,1728 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
- /**
- * File Viewer example
- */
-public class FileViewer {
- private static ResourceBundle resourceBundle;
- private final static String DRIVE_A = "a:" + File.separator;
- private final static String DRIVE_B = "b:" + File.separator;
-
- /* UI elements */
- private Display display;
- private Shell shell;
- private ToolBar toolBar;
-
- private Label numObjectsLabel;
- private Label diskSpaceLabel;
-
- private File currentDirectory = null;
- private boolean initial = true;
-
- /* Drag and drop optimizations */
- private boolean isDragging = false; // if this app is dragging
- private boolean isDropping = false; // if this app is dropping
-
- private File[] processedDropFiles = null; // so Drag only deletes what it needs to
- private File[] deferredRefreshFiles = null; // to defer notifyRefreshFiles while we do DND
- private boolean deferredRefreshRequested = false; // to defer notifyRefreshFiles while we do DND
- private ProgressDialog progressDialog = null; // progress dialog for locally-initiated operations
-
- /* Combo view */
- private static final String COMBODATA_ROOTS = "Combo.roots";
- // File[]: Array of files whose paths are currently displayed in the combo
- private static final String COMBODATA_LASTTEXT = "Combo.lastText";
- // String: Previous selection text string
-
- private Combo combo;
-
- /* Tree view */
- private static final String TREEITEMDATA_FILE = "TreeItem.file";
- // File: File associated with tree item
- private static final String TREEITEMDATA_IMAGEEXPANDED = "TreeItem.imageExpanded";
- // Image: shown when item is expanded
- private static final String TREEITEMDATA_IMAGECOLLAPSED = "TreeItem.imageCollapsed";
- // Image: shown when item is collapsed
- private static final String TREEITEMDATA_STUB = "TreeItem.stub";
- // Object: if not present or null then the item has not been populated
-
- private Tree tree;
- private Label treeScopeLabel;
-
- /* Table view */
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(
- DateFormat.MEDIUM, DateFormat.MEDIUM);
- private static final String TABLEITEMDATA_FILE = "TableItem.file";
- // File: File associated with table row
- private static final String TABLEDATA_DIR = "Table.dir";
- // File: Currently visible directory
- private static final int[] tableWidths = new int[] {150, 60, 75, 150};
- private final String[] tableTitles = new String [] {
- FileViewer.getResourceString("table.Name.title"),
- FileViewer.getResourceString("table.Size.title"),
- FileViewer.getResourceString("table.Type.title"),
- FileViewer.getResourceString("table.Modified.title")
- };
- private Table table;
- private Label tableContentsOfLabel;
-
- /* Table update worker */
- // Control data
- private final Object workerLock = new Object();
- // Lock for all worker control data and state
- private volatile Thread workerThread = null;
- // The worker's thread
- private volatile boolean workerStopped = false;
- // True if the worker must exit on completion of the current cycle
- private volatile boolean workerCancelled = false;
- // True if the worker must cancel its operations prematurely perhaps due to a state update
-
- // Worker state information -- this is what gets synchronized by an update
- private volatile File workerStateDir = null;
-
- // State information to use for the next cycle
- private volatile File workerNextDir = null;
-
- /* Simulate only flag */
- // when true, disables actual filesystem manipulations and outputs results to standard out
- private boolean simulateOnly = true;
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
- new FileViewer().open();
- }
-
- /**
- * Opens the main program.
- */
- void open() {
- // Create the window
- display = new Display();
- IconCache.initResources(display);
- shell = new Shell();
- createShellContents();
- notifyRefreshFiles(null);
- shell.open();
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- // Cleanup
- workerStop();
- IconCache.freeResources();
- display.dispose();
- }
- /**
- * Closes the main program.
- */
- void close() {
- workerStop(); // be polite
- shell.close();
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Construct the UI
- *
- * @param container the ShellContainer managing the Shell we are rendering inside
- */
- private void createShellContents() {
- shell.setText(getResourceString("Title", new Object[] { "" }));
- shell.setImage(IconCache.stockImages[IconCache.shellIcon]);
- Menu bar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(bar);
- createFileMenu(bar);
- createHelpMenu(bar);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = gridLayout.marginWidth = 0;
- shell.setLayout(gridLayout);
-
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.widthHint = 185;
- createComboView(shell, gridData);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- createToolBar(shell, gridData);
-
- SashForm sashForm = new SashForm(shell, SWT.NONE);
- sashForm.setOrientation(SWT.HORIZONTAL);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- sashForm.setLayoutData(gridData);
- createTreeView(sashForm);
- createTableView(sashForm);
- sashForm.setWeights(new int[] { 2, 5 });
-
- numObjectsLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.widthHint = 185;
- numObjectsLabel.setLayoutData(gridData);
-
- diskSpaceLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- diskSpaceLabel.setLayoutData(gridData);
- }
-
- /**
- * Creates the File Menu.
- *
- * @param parent the parent menu
- */
- private void createFileMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.File.text"));
- header.setMenu(menu);
-
- final MenuItem simulateItem = new MenuItem(menu, SWT.CHECK);
- simulateItem.setText(getResourceString("menu.File.SimulateOnly.text"));
- simulateItem.setSelection(simulateOnly);
- simulateItem.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- simulateOnly = simulateItem.getSelection();
- }
- });
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.File.Close.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- close();
- }
- });
- }
-
- /**
- * Creates the Help Menu.
- *
- * @param parent the parent menu
- */
- private void createHelpMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.Help.text"));
- header.setMenu(menu);
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.Help.About.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.About.title"));
- box.setMessage(getResourceString("dialog.About.description",
- new Object[] { System.getProperty("os.name") }));
- box.open();
- }
- });
- }
-
- /**
- * Creates the toolbar
- *
- * @param shell the shell on which to attach the toolbar
- * @param layoutData the layout data
- */
- private void createToolBar(final Shell shell, Object layoutData) {
- toolBar = new ToolBar(shell, SWT.NULL);
- toolBar.setLayoutData(layoutData);
- ToolItem item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdParent]);
- item.setToolTipText(getResourceString("tool.Parent.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doParent();
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdRefresh]);
- item.setToolTipText(getResourceString("tool.Refresh.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doRefresh();
- }
- });
- SelectionAdapter unimplementedListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.NotImplemented.title"));
- box.setMessage(getResourceString("dialog.ActionNotImplemented.description"));
- box.open();
- }
- };
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdCut]);
- item.setToolTipText(getResourceString("tool.Cut.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdCopy]);
- item.setToolTipText(getResourceString("tool.Copy.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdPaste]);
- item.setToolTipText(getResourceString("tool.Paste.tiptext")); item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdDelete]);
- item.setToolTipText(getResourceString("tool.Delete.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdRename]);
- item.setToolTipText(getResourceString("tool.Rename.tiptext"));
- item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdSearch]);
- item.setToolTipText(getResourceString("tool.Search.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(IconCache.stockImages[IconCache.cmdPrint]);
- item.setToolTipText(getResourceString("tool.Print.tiptext"));
- item.addSelectionListener(unimplementedListener);
- }
-
- /**
- * Creates the combo box view.
- *
- * @param parent the parent control
- */
- private void createComboView(Composite parent, Object layoutData) {
- combo = new Combo(parent, SWT.NONE);
- combo.setLayoutData(layoutData);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- final File[] roots = (File[]) combo.getData(COMBODATA_ROOTS);
- if (roots == null) return;
- int selection = combo.getSelectionIndex();
- if (selection >= 0 && selection < roots.length) {
- notifySelectedDirectory(roots[selection]);
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- final String lastText = (String) combo.getData(COMBODATA_LASTTEXT);
- String text = combo.getText();
- if (text == null) return;
- if (lastText != null && lastText.equals(text)) return;
- combo.setData(COMBODATA_LASTTEXT, text);
- notifySelectedDirectory(new File(text));
- }
- });
- }
-
- /**
- * Creates the file tree view.
- *
- * @param parent the parent control
- */
- private void createTreeView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
-
- treeScopeLabel = new Label(composite, SWT.BORDER);
- treeScopeLabel.setText(FileViewer.getResourceString("details.AllFolders.text"));
- treeScopeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- tree = new Tree(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- tree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- File file = (File) item.getData(TREEITEMDATA_FILE);
-
- notifySelectedDirectory(file);
- }
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- item.setExpanded(true);
- treeExpandItem(item);
- }
- }
- });
- tree.addTreeListener(new TreeAdapter() {
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGEEXPANDED);
- if (image != null) item.setImage(image);
- treeExpandItem(item);
- }
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGECOLLAPSED);
- if (image != null) item.setImage(image);
- }
- });
- createTreeDragSource(tree);
- createTreeDropTarget(tree);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the tree.
- *
- * @return the DragSource for the tree
- */
- private DragSource createTreeDragSource(final Tree tree){
- DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TreeItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = tree.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- processedDropFiles = null;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- processedDropFiles = null;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TREEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the tree.
- *
- * @return the DropTarget for the tree
- */
- private DropTarget createTreeDropTarget(final Tree tree) {
- DropTarget dropTarget = new DropTarget(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item != null) {
- // We are over a particular item in the tree, use the item's file
- targetFile = (File) item.getData(TREEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Handles expand events on a tree item.
- *
- * @param item the TreeItem to fill in
- */
- private void treeExpandItem(TreeItem item) {
- shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]);
- final Object stub = item.getData(TREEITEMDATA_STUB);
- if (stub == null) treeRefreshItem(item, true);
- shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]);
- }
-
- /**
- * Traverse the entire tree and update only what has changed.
- *
- * @param roots the root directory listing
- */
- private void treeRefresh(File[] masterFiles) {
- TreeItem[] items = tree.getItems();
- int masterIndex = 0;
- int itemIndex = 0;
- for (int i = 0; i < items.length; ++i) {
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterIndex == masterFiles.length)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- final File masterFile = masterFiles[masterIndex];
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- ++itemIndex;
- ++masterIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(tree, SWT.NULL, itemIndex);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- ++itemIndex;
- ++masterIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- for (;masterIndex < masterFiles.length; ++masterIndex) {
- final File masterFile = masterFiles[masterIndex];
- TreeItem newItem = new TreeItem(tree, SWT.NULL);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- }
- }
-
- /**
- * Traverse an item in the tree and update only what has changed.
- *
- * @param dirItem the tree item of the directory
- * @param forcePopulate true iff we should populate non-expanded items as well
- */
- private void treeRefreshItem(TreeItem dirItem, boolean forcePopulate) {
- final File dir = (File) dirItem.getData(TREEITEMDATA_FILE);
-
- if (! forcePopulate && ! dirItem.getExpanded()) {
- // Refresh non-expanded item
- if (dirItem.getData(TREEITEMDATA_STUB) != null) {
- treeItemRemoveAll(dirItem);
- new TreeItem(dirItem, SWT.NULL); // placeholder child item to get "expand" button
- dirItem.setData(TREEITEMDATA_STUB, null);
- }
- return;
- }
- // Refresh expanded item
- dirItem.setData(TREEITEMDATA_STUB, this); // clear stub flag
-
- /* Get directory listing */
- File[] subFiles = (dir != null) ? FileViewer.getDirectoryList(dir) : null;
- if (subFiles == null || subFiles.length == 0) {
- /* Error or no contents */
- treeItemRemoveAll(dirItem);
- dirItem.setExpanded(false);
- return;
- }
-
- /* Refresh sub-items */
- TreeItem[] items = dirItem.getItems();
- final File[] masterFiles = subFiles;
- int masterIndex = 0;
- int itemIndex = 0;
- File masterFile = null;
- for (int i = 0; i < items.length; ++i) {
- while ((masterFile == null) && (masterIndex < masterFiles.length)) {
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
-
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterFile == null)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- masterFile = null;
- ++itemIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL, itemIndex);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- masterFile = null;
- ++itemIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- while ((masterFile != null) || (masterIndex < masterFiles.length)) {
- if (masterFile != null) {
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- if (masterIndex == masterFiles.length) break;
- }
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
- }
-
- /**
- * Foreign method: removes all children of a TreeItem.
- * @param treeItem the TreeItem
- */
- private static void treeItemRemoveAll(TreeItem treeItem) {
- final TreeItem[] children = treeItem.getItems();
- for (int i = 0; i < children.length; ++i) {
- children[i].dispose();
- }
- }
-
- /**
- * Initializes a folder item.
- *
- * @param item the TreeItem to initialize
- * @param folder the File associated with this TreeItem
- */
- private void treeInitFolder(TreeItem item, File folder) {
- item.setText(folder.getName());
- item.setImage(IconCache.stockImages[IconCache.iconClosedFolder]);
- item.setData(TREEITEMDATA_FILE, folder);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, IconCache.stockImages[IconCache.iconOpenFolder]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, IconCache.stockImages[IconCache.iconClosedFolder]);
- }
-
- /**
- * Initializes a volume item.
- *
- * @param item the TreeItem to initialize
- * @param volume the File associated with this TreeItem
- */
- private void treeInitVolume(TreeItem item, File volume) {
- item.setText(volume.getPath());
- item.setImage(IconCache.stockImages[IconCache.iconClosedDrive]);
- item.setData(TREEITEMDATA_FILE, volume);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, IconCache.stockImages[IconCache.iconOpenDrive]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, IconCache.stockImages[IconCache.iconClosedDrive]);
- }
-
- /**
- * Creates the file details table.
- *
- * @param parent the parent control
- */
- private void createTableView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
- tableContentsOfLabel = new Label(composite, SWT.BORDER);
- tableContentsOfLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- for (int i = 0; i < tableTitles.length; ++i) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(tableTitles[i]);
- column.setWidth(tableWidths[i]);
- }
- table.setHeaderVisible(true);
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- notifySelectedFiles(getSelectedFiles());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- doDefaultFileAction(getSelectedFiles());
- }
- private File[] getSelectedFiles() {
- final TableItem[] items = table.getSelection();
- final File[] files = new File[items.length];
-
- for (int i = 0; i < items.length; ++i) {
- files[i] = (File) items[i].getData(TABLEITEMDATA_FILE);
- }
- return files;
- }
- });
-
- createTableDragSource(table);
- createTableDropTarget(table);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the table.
- *
- * @return the DragSource for the table
- */
- private DragSource createTableDragSource(final Table table) {
- DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TableItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = table.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TABLEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the table.
- *
- * @return the DropTarget for the table
- */
- private DropTarget createTableDropTarget(final Table table){
- DropTarget dropTarget = new DropTarget(table, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item == null) {
- // We are over an unoccupied area of the table.
- // If it is a COPY, we can use the table's root file.
- if (event.detail == DND.DROP_COPY) {
- targetFile = (File) table.getData(TABLEDATA_DIR);
- }
- } else {
- // We are over a particular item in the table, use the item's file
- targetFile = (File) item.getData(TABLEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Notifies the application components that a new current directory has been selected
- *
- * @param dir the directory that was selected, null is ignored
- */
- void notifySelectedDirectory(File dir) {
- if (dir == null) return;
- if (currentDirectory != null && dir.equals(currentDirectory)) return;
- currentDirectory = dir;
- notifySelectedFiles(null);
-
- /* Shell:
- * Sets the title to indicate the selected directory
- */
- shell.setText(getResourceString("Title", new Object[] { currentDirectory.getPath() }));
- /* Table view:
- * Displays the contents of the selected directory.
- */
- workerUpdate(dir, false);
-
- /* Combo view:
- * Sets the combo box to point to the selected directory.
- */
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
- int comboEntry = -1;
- if (comboRoots != null) {
- for (int i = 0; i < comboRoots.length; ++i) {
- if (dir.equals(comboRoots[i])) {
- comboEntry = i;
- break;
- }
- }
- }
- if (comboEntry == -1) combo.setText(dir.getPath());
- else combo.select(comboEntry);
-
- /* Tree view:
- * If not already expanded, recursively expands the parents of the specified
- * directory until it is visible.
- */
- Vector /* of File */ path = new Vector();
- // Build a stack of paths from the root of the tree
- while (dir != null) {
- path.add(dir);
- dir = dir.getParentFile();
- }
- // Recursively expand the tree to get to the specified directory
- TreeItem[] items = tree.getItems();
- TreeItem lastItem = null;
- for (int i = path.size() - 1; i >= 0; --i) {
- final File pathElement = (File) path.elementAt(i);
-
- // Search for a particular File in the array of tree items
- // No guarantee that the items are sorted in any recognizable fashion, so we'll
- // just sequential scan. There shouldn't be more than a few thousand entries.
- TreeItem item = null;
- for (int k = 0; k < items.length; ++k) {
- item = items[k];
- if (item.isDisposed()) continue;
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if (itemFile != null && itemFile.equals(pathElement)) break;
- }
- if (item == null) break;
- lastItem = item;
- if (i != 0 && !item.getExpanded()) {
- treeExpandItem(item);
- item.setExpanded(true);
- }
- items = item.getItems();
- }
- tree.setSelection((lastItem != null) ? new TreeItem[] { lastItem } : new TreeItem[0]);
- }
-
- /**
- * Notifies the application components that files have been selected
- *
- * @param files the files that were selected, null or empty array indicates no active selection
- */
- void notifySelectedFiles(File[] files) {
- /* Details:
- * Update the details that are visible on screen.
- */
- if ((files != null) && (files.length != 0)) {
- numObjectsLabel.setText(getResourceString("details.NumberOfSelectedFiles.text",
- new Object[] { new Integer(files.length) }));
- long fileSize = 0L;
- for (int i = 0; i < files.length; ++i) {
- fileSize += files[i].length();
- }
- diskSpaceLabel.setText(getResourceString("details.FileSize.text",
- new Object[] { new Long(fileSize) }));
- } else {
- // No files selected
- diskSpaceLabel.setText("");
- if (currentDirectory != null) {
- int numObjects = getDirectoryList(currentDirectory).length;
- numObjectsLabel.setText(getResourceString("details.DirNumberOfObjects.text",
- new Object[] { new Integer(numObjects) }));
- } else {
- numObjectsLabel.setText("");
- }
- }
- }
-
- /**
- * Notifies the application components that files must be refreshed
- *
- * @param files the files that need refreshing, empty array is a no-op, null refreshes all
- */
- void notifyRefreshFiles(File[] files) {
- if (files != null && files.length == 0) return;
-
- if ((deferredRefreshRequested) && (deferredRefreshFiles != null) && (files != null)) {
- // merge requests
- File[] newRequest = new File[deferredRefreshFiles.length + files.length];
- System.arraycopy(deferredRefreshFiles, 0, newRequest, 0, deferredRefreshFiles.length);
- System.arraycopy(files, 0, newRequest, deferredRefreshFiles.length, files.length);
- deferredRefreshFiles = newRequest;
- } else {
- deferredRefreshFiles = files;
- deferredRefreshRequested = true;
- }
- handleDeferredRefresh();
- }
-
- /**
- * Handles deferred Refresh notifications (due to Drag & Drop)
- */
- void handleDeferredRefresh() {
- if (isDragging || isDropping || ! deferredRefreshRequested) return;
- if (progressDialog != null) {
- progressDialog.close();
- progressDialog = null;
- }
-
- deferredRefreshRequested = false;
- File[] files = deferredRefreshFiles;
- deferredRefreshFiles = null;
-
- shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]);
-
- /* Table view:
- * Refreshes information about any files in the list and their children.
- */
- boolean refreshTable = false;
- if (files != null) {
- for (int i = 0; i < files.length; ++i) {
- final File file = files[i];
- if (file.equals(currentDirectory)) {
- refreshTable = true;
- break;
- }
- File parentFile = file.getParentFile();
- if ((parentFile != null) && (parentFile.equals(currentDirectory))) {
- refreshTable = true;
- break;
- }
- }
- } else refreshTable = true;
- if (refreshTable) workerUpdate(currentDirectory, true);
-
- /* Combo view:
- * Refreshes the list of roots
- */
- final File[] roots = getRoots();
-
- if (files == null) {
- boolean refreshCombo = false;
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
-
- if ((comboRoots != null) && (comboRoots.length == roots.length)) {
- for (int i = 0; i < roots.length; ++i) {
- if (! roots[i].equals(comboRoots[i])) {
- refreshCombo = true;
- break;
- }
- }
- } else refreshCombo = true;
-
- if (refreshCombo) {
- combo.removeAll();
- combo.setData(COMBODATA_ROOTS, roots);
- for (int i = 0; i < roots.length; ++i) {
- final File file = roots[i];
- combo.add(file.getPath());
- }
- }
- }
-
- /* Tree view:
- * Refreshes information about any files in the list and their children.
- */
- treeRefresh(roots);
-
- // Remind everyone where we are in the filesystem
- final File dir = currentDirectory;
- currentDirectory = null;
- notifySelectedDirectory(dir);
-
- shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]);
- }
-
- /**
- * Performs the default action on a set of files.
- *
- * @param files the array of files to process
- */
- void doDefaultFileAction(File[] files) {
- // only uses the 1st file (for now)
- if (files.length == 0) return;
- final File file = files[0];
-
- if (file.isDirectory()) {
- notifySelectedDirectory(file);
- } else {
- final String fileName = file.getAbsolutePath();
- if (! Program.launch(fileName)) {
- MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
- dialog.setMessage(getResourceString("error.FailedLaunch.message", new Object[] { fileName }));
- dialog.setText(shell.getText ());
- dialog.open();
- }
- }
- }
-
- /**
- * Navigates to the parent directory
- */
- void doParent() {
- if (currentDirectory == null) return;
- File parentDirectory = currentDirectory.getParentFile();
- notifySelectedDirectory(parentDirectory);
- }
-
- /**
- * Performs a refresh
- */
- void doRefresh() {
- notifyRefreshFiles(null);
- }
-
- /**
- * Validates a drop target as a candidate for a drop operation.
- * <p>
- * Used in dragOver() and dropAccept().<br>
- * Note event.detail is set to DND.DROP_NONE by this method if the target is not valid.
- * </p>
- * @param event the DropTargetEvent to validate
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private boolean dropTargetValidate(DropTargetEvent event, File targetFile) {
- if (targetFile != null && targetFile.isDirectory()) {
- if (event.detail != DND.DROP_COPY && event.detail != DND.DROP_MOVE) {
- event.detail = DND.DROP_MOVE;
- }
- } else {
- event.detail = DND.DROP_NONE;
- }
- return event.detail != DND.DROP_NONE;
- }
-
- /**
- * Handles a drop on a dropTarget.
- * <p>
- * Used in drop().<br>
- * Note event.detail is modified by this method.
- * </p>
- * @param event the DropTargetEvent passed as parameter to the drop() method
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private void dropTargetHandleDrop(DropTargetEvent event, File targetFile) {
- // Get dropped data (an array of filenames)
- if (! dropTargetValidate(event, targetFile)) return;
- final String[] sourceNames = (String[]) event.data;
- if (sourceNames == null) event.detail = DND.DROP_NONE;
- if (event.detail == DND.DROP_NONE) return;
-
- // Open progress dialog
- progressDialog = new ProgressDialog(shell,
- (event.detail == DND.DROP_MOVE) ? ProgressDialog.MOVE : ProgressDialog.COPY);
- progressDialog.setTotalWorkUnits(sourceNames.length);
- progressDialog.open();
-
- // Copy each file
- Vector /* of File */ processedFiles = new Vector();
- for (int i = 0; (i < sourceNames.length) && (! progressDialog.isCancelled()); i++){
- final File source = new File(sourceNames[i]);
- final File dest = new File(targetFile, source.getName());
- if (source.equals(dest)) continue; // ignore if in same location
-
- progressDialog.setDetailFile(source, ProgressDialog.COPY);
- while (! progressDialog.isCancelled()) {
- if (copyFileStructure(source, dest)) {
- processedFiles.add(source);
- break;
- } else if (! progressDialog.isCancelled()) {
- if (event.detail == DND.DROP_MOVE && (!isDragging)) {
- // It is not possible to notify an external drag source that a drop
- // operation was only partially successful. This is particularly a
- // problem for DROP_MOVE operations since unless the source gets
- // DROP_NONE, it will delete the original data including bits that
- // may not have been transferred successfully.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.RETRY | SWT.CANCEL);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.CANCEL) {
- i = sourceNames.length;
- event.detail = DND.DROP_NONE;
- break;
- }
- } else {
- // We can recover gracefully from errors if the drag source belongs
- // to this application since it will look at processedDropFiles.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button != SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- }
- if (isDragging) {
- // Remember exactly which files we processed
- processedDropFiles = ((File[]) processedFiles.toArray(new File[processedFiles.size()]));
- } else {
- progressDialog.close();
- progressDialog = null;
- }
- notifyRefreshFiles(new File[] { targetFile });
- }
-
- /**
- * Handles the completion of a drag on a dragSource.
- * <p>
- * Used in dragFinished().<br>
- * </p>
- * @param event the DragSourceEvent passed as parameter to the dragFinished() method
- * @param sourceNames the names of the files that were dragged (event.data is invalid)
- */
- private void dragSourceHandleDragFinished(DragSourceEvent event, String[] sourceNames) {
- if (sourceNames == null) return;
- if (event.detail != DND.DROP_MOVE) return;
-
- // Get array of files that were actually transferred
- final File[] sourceFiles;
- if (processedDropFiles != null) {
- sourceFiles = processedDropFiles;
- } else {
- sourceFiles = new File[sourceNames.length];
- for (int i = 0; i < sourceNames.length; ++i)
- sourceFiles[i] = new File(sourceNames[i]);
- }
- if (progressDialog == null)
- progressDialog = new ProgressDialog(shell, ProgressDialog.MOVE);
- progressDialog.setTotalWorkUnits(sourceFiles.length);
- progressDialog.setProgress(0);
- progressDialog.open();
-
- // Delete each file
- for (int i = 0; (i < sourceFiles.length) && (! progressDialog.isCancelled()); i++){
- final File source = sourceFiles[i];
- progressDialog.setDetailFile(source, ProgressDialog.DELETE);
- while (! progressDialog.isCancelled()) {
- if (deleteFileStructure(source)) {
- break;
- } else if (! progressDialog.isCancelled()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedDelete.title"));
- box.setMessage(getResourceString("dialog.FailedDelete.description",
- new Object[] { source }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button == SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- notifyRefreshFiles(sourceFiles);
- progressDialog.close();
- progressDialog = null;
- }
-
- /**
- * Gets filesystem root entries
- *
- * @return an array of Files corresponding to the root directories on the platform,
- * may be empty but not null
- */
- File[] getRoots() {
- /*
- * On JDK 1.22 only...
- */
- // return File.listRoots();
-
- /*
- * On JDK 1.1.7 and beyond...
- * -- PORTABILITY ISSUES HERE --
- */
- if (System.getProperty ("os.name").indexOf ("Windows") != -1) {
- Vector /* of File */ list = new Vector();
- list.add(new File(DRIVE_A));
- list.add(new File(DRIVE_B));
- for (char i = 'c'; i <= 'z'; ++i) {
- File drive = new File(i + ":" + File.separator);
- if (drive.isDirectory() && drive.exists()) {
- list.add(drive);
- if (initial && i == 'c') {
- currentDirectory = drive;
- initial = false;
- }
- }
- }
- File[] roots = (File[]) list.toArray(new File[list.size()]);
- sortFiles(roots);
- return roots;
- } else {
- File root = new File(File.separator);
- if (initial) {
- currentDirectory = root;
- }
- return new File[] { root };
- }
- }
-
- /**
- * Gets a directory listing
- *
- * @param file the directory to be listed
- * @return an array of files this directory contains, may be empty but not null
- */
- static File[] getDirectoryList(File file) {
- File[] list = file.listFiles();
- if (list == null) return new File[0];
- sortFiles(list);
- return list;
- }
-
- /**
- * Copies a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @param newFile the location of the new file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean copyFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
-
- // ensure that newFile is not a child of oldFile or a dupe
- File searchFile = newFile;
- do {
- if (oldFile.equals(searchFile)) return false;
- searchFile = searchFile.getParentFile();
- } while (searchFile != null);
-
- if (oldFile.isDirectory()) {
- /*
- * Copy a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.COPY);
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.DirectoriesCreated.text",
- // new Object[] { newFile.getPath() }));
- } else {
- if (! newFile.mkdirs()) return false;
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- File newSubFile = new File(newFile, oldSubFile.getName());
- if (! copyFileStructure(oldSubFile, newSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- } else {
- /*
- * Copy a file
- */
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.CopyFromTo.text",
- // new Object[] { oldFile.getPath(), newFile.getPath() }));
- } else {
- FileReader in = null;
- FileWriter out = null;
- try {
- in = new FileReader(oldFile);
- out = new FileWriter(newFile);
-
- int count;
- while ((count = in.read()) != -1) out.write(count);
- } catch (FileNotFoundException e) {
- return false;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- if (in != null) in.close();
- if (out != null) out.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Deletes a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean deleteFileStructure(File oldFile) {
- if (oldFile == null) return false;
- if (oldFile.isDirectory()) {
- /*
- * Delete a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.DELETE);
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- if (! deleteFileStructure(oldSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.Delete.text",
- // new Object[] { oldFile.getPath(), oldFile.getPath() }));
- return true;
- } else {
- return oldFile.delete();
- }
- }
-
- /**
- * Sorts files lexicographically by name.
- *
- * @param files the array of Files to be sorted
- */
- static void sortFiles(File[] files) {
- /* Very lazy merge sort algorithm */
- sortBlock(files, 0, files.length - 1, new File[files.length]);
- }
- private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) {
- final int length = end - start + 1;
- if (length < 8) {
- for (int i = end; i > start; --i) {
- for (int j = end; j > start; --j) {
- if (compareFiles(files[j - 1], files[j]) > 0) {
- final File temp = files[j];
- files[j] = files[j-1];
- files[j-1] = temp;
- }
- }
- }
- return;
- }
- final int mid = (start + end) / 2;
- sortBlock(files, start, mid, mergeTemp);
- sortBlock(files, mid + 1, end, mergeTemp);
- int x = start;
- int y = mid + 1;
- for (int i = 0; i < length; ++i) {
- if ((x > mid) || ((y <= end) && compareFiles(files[x], files[y]) > 0)) {
- mergeTemp[i] = files[y++];
- } else {
- mergeTemp[i] = files[x++];
- }
- }
- for (int i = 0; i < length; ++i) files[i + start] = mergeTemp[i];
- }
- private static int compareFiles(File a, File b) {
-// boolean aIsDir = a.isDirectory();
-// boolean bIsDir = b.isDirectory();
-// if (aIsDir && ! bIsDir) return -1;
-// if (bIsDir && ! aIsDir) return 1;
-
- // sort case-sensitive files in a case-insensitive manner
- int compare = a.getName().compareToIgnoreCase(b.getName());
- if (compare == 0) compare = a.getName().compareTo(b.getName());
- return compare;
- }
-
- /*
- * This worker updates the table with file information in the background.
- * <p>
- * Implementation notes:
- * <ul>
- * <li> It is designed such that it can be interrupted cleanly.
- * <li> It uses asyncExec() in some places to ensure that SWT Widgets are manipulated in the
- * right thread. Exclusive use of syncExec() would be inappropriate as it would require a pair
- * of context switches between each table update operation.
- * </ul>
- * </p>
- */
-
- /**
- * Stops the worker and waits for it to terminate.
- */
- void workerStop() {
- if (workerThread == null) return;
- synchronized(workerLock) {
- workerCancelled = true;
- workerStopped = true;
- workerLock.notifyAll();
- }
- while (workerThread != null) {
- if (! display.readAndDispatch()) display.sleep();
- }
- }
-
- /**
- * Notifies the worker that it should update itself with new data.
- * Cancels any previous operation and begins a new one.
- *
- * @param dir the new base directory for the table, null is ignored
- * @param force if true causes a refresh even if the data is the same
- */
- void workerUpdate(File dir, boolean force) {
- if (dir == null) return;
- if ((!force) && (workerNextDir != null) && (workerNextDir.equals(dir))) return;
-
- synchronized(workerLock) {
- workerNextDir = dir;
- workerStopped = false;
- workerCancelled = true;
- workerLock.notifyAll();
- }
- if (workerThread == null) {
- workerThread = new Thread(workerRunnable);
- workerThread.start();
- }
- }
-
- /**
- * Manages the worker's thread
- */
- private final Runnable workerRunnable = new Runnable() {
- public void run() {
- while (! workerStopped) {
- synchronized(workerLock) {
- workerCancelled = false;
- workerStateDir = workerNextDir;
- }
- workerExecute();
- synchronized(workerLock) {
- try {
- if ((!workerCancelled) && (workerStateDir == workerNextDir)) workerLock.wait();
- } catch (InterruptedException e) {
- }
- }
- }
- workerThread = null;
- // wake up UI thread in case it is in a modal loop awaiting thread termination
- // (see workerStop())
- display.wake();
- }
- };
-
- /**
- * Updates the table's contents
- */
- private void workerExecute() {
- File[] dirList;
-
- // Clear existing information
- display.syncExec(new Runnable() {
- public void run() {
- tableContentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text",
- new Object[] { workerStateDir.getPath() }));
- table.removeAll();
- table.setRedraw(false);
- table.setData(TABLEDATA_DIR, workerStateDir);
- }
- });
- dirList = getDirectoryList(workerStateDir);
-
- for (int i = 0; (! workerCancelled) && (i < dirList.length); i++) {
- final File theFile = dirList[i];
- workerAddFileDetails(dirList[i]);
-
- final boolean doIncrementalRefresh = ((i & 127) == 127);
- if (doIncrementalRefresh) display.syncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- table.setRedraw(false);
- }
- });
- }
-
- // Allow the table to refresh itself
- display.asyncExec(new Runnable() {
- public void run() {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- }
- });
- }
-
- /**
- * Adds a file's detail information to the directory list
- */
- private void workerAddFileDetails(final File file) {
- final String nameString = file.getName();
- final String dateString = dateFormat.format(new Date(file.lastModified()));
- final String sizeString;
- final String typeString;
- final Image iconImage;
-
- if (file.isDirectory()) {
- typeString = getResourceString("filetype.Folder");
- sizeString = "";
- iconImage = IconCache.stockImages[IconCache.iconClosedFolder];
- } else {
- sizeString = getResourceString("filesize.KB",
- new Object[] { new Long((file.length() + 512) / 1024) });
-
- int dot = nameString.lastIndexOf('.');
- if (dot != -1) {
- String extension = nameString.substring(dot);
- Program program = Program.findProgram(extension);
- if (program != null) {
- typeString = program.getName();
- iconImage = IconCache.getIconFromProgram(program);
- } else {
- typeString = getResourceString("filetype.Unknown", new Object[] { extension.toUpperCase() });
- iconImage = IconCache.stockImages[IconCache.iconFile];
- }
- } else {
- typeString = getResourceString("filetype.None");
- iconImage = IconCache.stockImages[IconCache.iconFile];
- }
- }
- final String[] strings = new String[] { nameString, sizeString, typeString, dateString };
-
- display.asyncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- TableItem tableItem = new TableItem(table, 0);
- tableItem.setText(strings);
- tableItem.setImage(iconImage);
- tableItem.setData(TABLEITEMDATA_FILE, file);
- }
- });
- }
-
- /**
- * Instances of this class manage a progress dialog for file operations.
- */
- class ProgressDialog {
- public final static int COPY = 0;
- public final static int DELETE = 1;
- public final static int MOVE = 2;
-
- Shell shell;
- Label messageLabel, detailLabel;
- ProgressBar progressBar;
- Button cancelButton;
- boolean isCancelled = false;
-
- final String operationKeyName[] = {
- "Copy",
- "Delete",
- "Move"
- };
-
- /**
- * Creates a progress dialog but does not open it immediately.
- *
- * @param parent the parent Shell
- * @param style one of COPY, MOVE
- */
- public ProgressDialog(Shell parent, int style) {
- shell = new Shell(parent, SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- shell.setText(getResourceString("progressDialog." + operationKeyName[style] + ".title"));
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- isCancelled = true;
- }
- });
-
- messageLabel = new Label(shell, SWT.HORIZONTAL);
- messageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- messageLabel.setText(getResourceString("progressDialog." + operationKeyName[style] + ".description"));
-
- progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.WRAP);
- progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- progressBar.setMinimum(0);
- progressBar.setMaximum(0);
-
- detailLabel = new Label(shell, SWT.HORIZONTAL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.widthHint = 400;
- detailLabel.setLayoutData(gridData);
-
- cancelButton = new Button(shell, SWT.PUSH);
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL));
- cancelButton.setText(getResourceString("progressDialog.cancelButton.text"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- isCancelled = true;
- cancelButton.setEnabled(false);
- }
- });
- }
- /**
- * Sets the detail text to show the filename along with a string
- * representing the operation being performed on that file.
- *
- * @param file the file to be detailed
- * @param operation one of COPY, DELETE
- */
- public void setDetailFile(File file, int operation) {
- String filename = file.getName();
- detailLabel.setText(getResourceString("progressDialog." + operationKeyName[operation] + ".operation",
- new Object[] { file }));
- }
- /**
- * Returns true if the Cancel button was been clicked.
- *
- * @return true if the Cancel button was clicked.
- */
- public boolean isCancelled() {
- return isCancelled;
- }
- /**
- * Sets the total number of work units to be performed.
- *
- * @param work the total number of work units
- */
- public void setTotalWorkUnits(int work) {
- progressBar.setMaximum(work);
- }
- /**
- * Adds to the total number of work units to be performed.
- *
- * @param work the number of work units to add
- */
- public void addWorkUnits(int work) {
- setTotalWorkUnits(progressBar.getMaximum() + work);
- }
- /**
- * Sets the progress of completion of the total work units.
- *
- * @param work the total number of work units completed
- */
- public void setProgress(int work) {
- progressBar.setSelection(work);
- while (display.readAndDispatch()); // enable event processing
- }
- /**
- * Adds to the progress of completion of the total work units.
- *
- * @param work the number of work units completed to add
- */
- public void addProgress(int work) {
- setProgress(progressBar.getSelection() + work);
- }
- /**
- * Opens the dialog.
- */
- public void open() {
- shell.pack();
- final Shell parentShell = (Shell) shell.getParent();
- Rectangle rect = parentShell.getBounds();
- Rectangle bounds = shell.getBounds();
- bounds.x = rect.x + (rect.width - bounds.width) / 2;
- bounds.y = rect.y + (rect.height - bounds.height) / 2;
- shell.setBounds(bounds);
- shell.open();
- }
- /**
- * Closes the dialog and disposes its resources.
- */
- public void close() {
- shell.close();
- shell.dispose();
- shell = null;
- messageLabel = null;
- detailLabel = null;
- progressBar = null;
- cancelButton = null;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java
deleted file mode 100755
index 239c0c615a..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Manages icons for the application.
- * This is necessary as we could easily end up creating thousands of icons
- * bearing the same image.
- */
-class IconCache {
- // Stock images
- public static final int
- shellIcon = 0,
- iconClosedDrive = 1,
- iconClosedFolder = 2,
- iconFile = 3,
- iconOpenDrive = 4,
- iconOpenFolder = 5,
- cmdCopy = 6,
- cmdCut = 7,
- cmdDelete = 8,
- cmdParent = 9,
- cmdPaste = 10,
- cmdPrint = 11,
- cmdRefresh = 12,
- cmdRename = 13,
- cmdSearch = 14;
- public static final String[] stockImageLocations = {
- "generic_example.gif",
- "icon_ClosedDrive.gif",
- "icon_ClosedFolder.gif",
- "icon_File.gif",
- "icon_OpenDrive.gif",
- "icon_OpenFolder.gif",
- "cmd_Copy.gif",
- "cmd_Cut.gif",
- "cmd_Delete.gif",
- "cmd_Parent.gif",
- "cmd_Paste.gif",
- "cmd_Print.gif",
- "cmd_Refresh.gif",
- "cmd_Rename.gif",
- "cmd_Search.gif"
- };
- public static Image stockImages[];
-
- // Stock cursors
- public static final int
- cursorDefault = 0,
- cursorWait = 1;
- public static Cursor stockCursors[];
- // Cached icons
- private static Hashtable iconCache; /* map Program to Image */
- /**
- * Loads the resources
- *
- * @param display the display
- */
- public static void initResources(Display display) {
- if (stockImages == null) {
- stockImages = new Image[stockImageLocations.length];
-
- for (int i = 0; i < stockImageLocations.length; ++i) {
- Image image = createStockImage(display, stockImageLocations[i]);
- if (image == null) {
- freeResources();
- throw new IllegalStateException(
- FileViewer.getResourceString("error.CouldNotLoadResources"));
- }
- stockImages[i] = image;
- }
- }
- if (stockCursors == null) {
- stockCursors = new Cursor[] {
- null,
- new Cursor(display, SWT.CURSOR_WAIT)
- };
- }
- iconCache = new Hashtable();
- }
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (stockImages != null) {
- for (int i = 0; i < stockImages.length; ++i) {
- final Image image = stockImages[i];
- if (image != null) image.dispose();
- }
- stockImages = null;
- }
- if (iconCache != null) {
- for (Enumeration it = iconCache.elements(); it.hasMoreElements(); ) {
- Image image = (Image) it.nextElement();
- image.dispose();
- }
- }
- }
- /**
- * Creates a stock image
- *
- * @param display the display
- * @param path the relative path to the icon
- */
- private static Image createStockImage(Display display, String path) {
- try {
- InputStream stream = IconCache.class.getResourceAsStream(path);
- if (stream != null) {
- ImageData imageData = new ImageData(stream);
- if (imageData != null) {
- ImageData mask = imageData.getTransparencyMask();
- return new Image(display, imageData, mask);
- }
- }
- } catch (Exception e) {
- }
- return null;
- }
- /**
- * Gets an image for a file associated with a given program
- *
- * @param program the Program
- */
- public static Image getIconFromProgram(Program program) {
- Image image = (Image) iconCache.get(program);
- if (image == null) {
- ImageData imageData = program.getImageData();
- if (imageData != null) {
- image = new Image(null, imageData, imageData.getTransparencyMask());
- iconCache.put(program, image);
- } else {
- image = stockImages[iconFile];
- }
- }
- return image;
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
deleted file mode 100755
index 4274b070ac..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
deleted file mode 100755
index eb948b94b0..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
deleted file mode 100755
index 6f647666d3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
deleted file mode 100755
index 9b278e6fa8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
deleted file mode 100755
index 75e0ab2352..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
deleted file mode 100755
index 4dfa8cd3fa..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
deleted file mode 100755
index a063c230ac..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
deleted file mode 100755
index 25b1325e52..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
deleted file mode 100755
index 6dc3ebefc9..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
deleted file mode 100755
index 04e530e37c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif
deleted file mode 100755
index 6b86d07978..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
deleted file mode 100755
index 7b2b6334ca..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java
deleted file mode 100755
index 9126eaa3be..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.widgets.*;
-
-/*
-* This example demonstrates the minimum amount of code required to open an SWT Shell
-* and process the events.
-*/
-public class HelloWorld1 {
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java
deleted file mode 100755
index 6dfe3d07f4..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld1 and demonstrates the minimum amount
-* of code required to open an SWT Shell with a Label and process the events.
-*/
-
-public class HelloWorld2 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.setBounds (shell.getClientArea ());
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java
deleted file mode 100755
index acfa7c1f13..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld2 and demonstrates how to resize the
-* Label when the Shell resizes using a Listener mechanism.
-*/
-
-public class HelloWorld3 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- final Shell shell = new Shell (display);
- final Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.pack();
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- label.setBounds (shell.getClientArea ());
- }
- });
- shell.pack();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java
deleted file mode 100755
index 7c1b36d385..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld2 and demonstrates how to resize the
-* Label when the Shell resizes using a Layout.
-*/
-
-public class HelloWorld4 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
- shell.setLayout(new FillLayout());
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- shell.pack ();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
deleted file mode 100755
index 056054c772..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ResourceBundle;
-
-/*
-* This example builds on HelloWorld1 and demonstrates how to draw directly
-* on an SWT Control.
-*/
-
-public class HelloWorld5 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- final Color red = new Color(display, 0xFF, 0, 0);
- final Shell shell = new Shell (display);
- shell.addPaintListener(new PaintListener () {
- public void paintControl(PaintEvent event){
- GC gc = event.gc;
- gc.setForeground(red);
- Rectangle rect = shell.getClientArea();
- gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);
- gc.drawString(resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);
- }
- });
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- red.dispose();
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
deleted file mode 100755
index 82af776ea6..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.swt.examples.hoverhelp;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*; import java.text.*; import java.util.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
-/**
- * This example demonstrates how to implement hover help feedback
- * using the MouseTrackListener.
- */
-public class HoverHelp {
- private static ResourceBundle resourceBundle;
- static final int
- hhiInformation = 0,
- hhiWarning = 1;
- static final String[] imageLocations = {
- "information.gif",
- "warning.gif"
- };
- Image images[];
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- resourceBundle = ResourceBundle.getBundle("examples_hoverhelp");
- new HoverHelp().open();
- }
-
- /**
- * Opens the main program.
- */
- public void open() {
- // Create the display
- Display display = new Display();
-
- // Load the images
- Class clazz = HoverHelp.class;
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- InputStream stream = clazz.getResourceAsStream(imageLocations[i]);
- ImageData source = new ImageData(stream);
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(display, source, mask);
- }
- }
- } catch (Throwable ex) {
- System.err.println(getResourceString("error.CouldNotLoadResources",
- new Object[] { ex.getMessage() }));
- display.dispose();
- return;
- }
-
- // Create the window
- Shell shell = new Shell();
- createPartControl(shell);
- shell.pack();
- shell.open();
-
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
-
- // Cleanup
- display.dispose();
-
- /* Free resources */
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Creates the example
- */
- public void createPartControl(Composite frame) {
- final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- frame.setLayout(layout);
-
- ToolBar bar = new ToolBar (frame, SWT.BORDER);
- for (int i=0; i<5; i++) {
- ToolItem item = new ToolItem (bar, SWT.PUSH);
- item.setText (getResourceString("ToolItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("ToolItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("ToolItem.help", new Object[] { item.getText() });
- }
- });
- }
- GridData gridData = new GridData();
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
- tooltip.activateHoverHelp(bar);
-
- Table table = new Table (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TableItem item = new TableItem (table, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiInformation]);
- item.setText (getResourceString("TableItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TableItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TableItem.help", new Object[] { item.getText() });
- }
- });
- }
- table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(table);
-
- Tree tree = new Tree (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TreeItem item = new TreeItem (tree, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiWarning]);
- item.setText (getResourceString("TreeItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TreeItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TreeItem.help", new Object[] { item.getText() });
- }
- });
- }
- tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(tree);
-
- Button button = new Button (frame, SWT.PUSH);
- button.setText (getResourceString("Hello.text"));
- button.setData ("TIP_TEXT", getResourceString("Hello.tooltip"));
- tooltip.activateHoverHelp(button);
- }
-
- /**
- * Emulated tooltip handler
- * Notice that we could display anything in a tooltip besides text and images.
- * For instance, it might make sense to embed large tables of data or buttons linking
- * data under inspection to material elsewhere, or perform dynamic lookup for creating
- * tooltip text on the fly.
- */
- protected static class ToolTipHandler {
- private Shell parentShell;
- private Shell tipShell;
- private Label tipLabelImage, tipLabelText;
- private Widget tipWidget; // widget this tooltip is hovering over
- private Point tipPosition; // the position being hovered over
-
- /**
- * Creates a new tooltip handler
- *
- * @param parent the parent Shell
- */
- public ToolTipHandler(Shell parent) {
- final Display display = parent.getDisplay();
- this.parentShell = parent;
-
- tipShell = new Shell(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginWidth = 2;
- gridLayout.marginHeight = 2;
- tipShell.setLayout(gridLayout);
-
- tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- tipLabelImage = new Label(tipShell, SWT.NONE);
- tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelImage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
-
- tipLabelText = new Label(tipShell, SWT.NONE);
- tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
- }
-
- /**
- * Enables customized hover help for a specified control
- *
- * @control the control on which to enable hoverhelp
- */
- public void activateHoverHelp(final Control control) {
- /*
- * Get out of the way if we attempt to activate the control underneath the tooltip
- */
- control.addMouseListener(new MouseAdapter () {
- public void mouseDown (MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- }
- });
-
- /*
- * Trap hover events to pop-up tooltip
- */
- control.addMouseTrackListener(new MouseTrackAdapter () {
- public void mouseExit(MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- tipWidget = null;
- }
- public void mouseHover (MouseEvent event) {
- Point pt = new Point (event.x, event.y);
- Widget widget = event.widget;
- if (widget instanceof ToolBar) {
- ToolBar w = (ToolBar) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Table) {
- Table w = (Table) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Tree) {
- Tree w = (Tree) widget;
- widget = w.getItem (pt);
- }
- if (widget == null) {
- tipShell.setVisible(false);
- tipWidget = null;
- return;
- }
- if (widget == tipWidget) return;
- tipWidget = widget;
- tipPosition = control.toDisplay(pt);
- String text = (String) widget.getData("TIP_TEXT");
- Image image = (Image) widget.getData("TIP_IMAGE");
- tipLabelText.setText(text != null ? text : "");
- tipLabelImage.setImage(image); // accepts null
- tipShell.pack();
- setHoverLocation(tipShell, tipPosition);
- tipShell.setVisible(true);
- }
- });
-
- /*
- * Trap F1 Help to pop up a custom help box
- */
- control.addHelpListener(new HelpListener () {
- public void helpRequested(HelpEvent event) {
- if (tipWidget == null) return;
- ToolTipHelpTextHandler handler = (ToolTipHelpTextHandler)
- tipWidget.getData("TIP_HELPTEXTHANDLER");
- if (handler == null) return;
- String text = handler.getHelpText(tipWidget);
- if (text == null) return;
-
- if (tipShell.isVisible()) {
- tipShell.setVisible(false);
- Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM);
- helpShell.setLayout(new FillLayout());
- Label label = new Label(helpShell, SWT.NONE);
- label.setText(text);
- helpShell.pack();
- setHoverLocation(helpShell, tipPosition);
- helpShell.open();
- }
- }
- });
- }
-
- /**
- * Sets the location for a hovering shell
- * @param shell the object that is to hover
- * @param position the position of a widget to hover over
- * @return the top-left location for a hovering box
- */
- private void setHoverLocation(Shell shell, Point position) {
- Rectangle displayBounds = shell.getDisplay().getBounds();
- Rectangle shellBounds = shell.getBounds();
- shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
- shellBounds.y = Math.max(Math.min(position.y + 16, displayBounds.height - shellBounds.height), 0);
- shell.setBounds(shellBounds);
- }
- }
-
- /**
- * ToolTip help handler
- */
- protected interface ToolTipHelpTextHandler {
- /**
- * Get help text
- * @param widget the widget that is under help
- * @return a help text string
- */
- public String getHelpText(Widget widget);
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif
deleted file mode 100755
index 26c7477336..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif
deleted file mode 100755
index cf4fdf93c7..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
deleted file mode 100755
index ec2069d809..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ /dev/null
@@ -1,2019 +0,0 @@
-package org.eclipse.swt.examples.imageanalyzer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.printing.*;
-import java.util.*;
-import java.net.*;
-import java.io.*;
-import java.text.MessageFormat;
-
-public class ImageAnalyzer {
- static ResourceBundle bundle = ResourceBundle.getBundle("examples_images");
-
- Display display;
- Shell shell;
- Canvas imageCanvas, paletteCanvas;
- Label typeLabel, sizeLabel, depthLabel, transparentPixelLabel,
- timeToLoadLabel, screenSizeLabel, backgroundPixelLabel,
- locationLabel, disposalMethodLabel, delayTimeLabel,
- repeatCountLabel, paletteLabel, dataLabel, statusLabel;
- Combo backgroundCombo, scaleXCombo, scaleYCombo, alphaCombo;
- Button incrementalCheck, transparentCheck, maskCheck, backgroundCheck;
- Button previousButton, nextButton, animateButton;
- Text dataText;
- Sash sash;
- Color whiteColor, blackColor, redColor, greenColor, blueColor, canvasBackground;
- Font fixedWidthFont;
- Cursor crossCursor;
- GC imageCanvasGC;
-
- int paletteWidth = 140; // recalculated and used as a width hint
- int ix = 0, iy = 0, py = 0; // used to scroll the image and palette
- float xscale = 1, yscale = 1; // used to scale the image
- int alpha = 255; // used to modify the alpha value of the image
- boolean incremental = false; // used to incrementally display an image
- boolean transparent = true; // used to display an image with transparency
- boolean showMask = false; // used to display an icon mask or transparent image mask
- boolean showBackground = false; // used to display the background of an animated image
- boolean animate = false; // used to animate a multi-image file
- Thread animateThread; // draws animated images
- Thread incrementalThread; // draws incremental images
- String lastPath; // used to seed the file dialog
- String currentName; // the current image file or URL name
- String fileName; // the current image file
- ImageLoader loader; // the loader for the current image file
- ImageData[] imageDataArray; // all image data read from the current file
- int imageDataIndex; // the index of the current image data
- ImageData imageData; // the currently-displayed image data
- Image image; // the currently-displayed image
- Vector incrementalEvents; // incremental image events
- long loadTime = 0; // the time it took to load the current image
-
- static final int ALPHA_CONSTANT = 0;
- static final int ALPHA_X = 1;
- static final int ALPHA_Y = 2;
-
- class TextPrompter extends Dialog {
- String message = "";
- String result = null;
- Shell dialog;
- Text text;
- public TextPrompter (Shell parent, int style) {
- super (parent, style);
- }
- public TextPrompter (Shell parent) {
- this (parent, SWT.APPLICATION_MODAL);
- }
- public String getMessage () {
- return message;
- }
- public void setMessage (String string) {
- message = string;
- }
- public String open () {
- dialog = new Shell(getParent(), getStyle());
- dialog.setText(getText());
- dialog.setLayout(new GridLayout());
- Label label = new Label(dialog, SWT.NULL);
- label.setText(message);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text = new Text(dialog, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- text.setLayoutData(data);
- Composite buttons = new Composite(dialog, SWT.NONE);
- GridLayout grid = new GridLayout();
- grid.numColumns = 2;
- buttons.setLayout(grid);
- buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Button ok = new Button(buttons, SWT.PUSH);
- ok.setText(bundle.getString("OK"));
- data = new GridData();
- data.widthHint = 75;
- ok.setLayoutData(data);
- ok.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- result = text.getText();
- dialog.dispose();
- }
- });
- Button cancel = new Button(buttons, SWT.PUSH);
- cancel.setText(bundle.getString("Cancel"));
- data = new GridData();
- data.widthHint = 75;
- cancel.setLayoutData(data);
- cancel.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- dialog.dispose();
- }
- });
- dialog.setDefaultButton(ok);
- dialog.pack();
- dialog.open();
- while (!dialog.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- return result;
- }
- }
- public static void main(String [] args) {
- ImageAnalyzer imageAnalyzer = new ImageAnalyzer();
- imageAnalyzer.open();
- }
- void open() {
- // Create a window and set its title.
- shell = new Shell();
- shell.setText(bundle.getString("Image_analyzer"));
-
- // Hook resize and dispose listeners.
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent event) {
- resizeShell(event);
- }
- });
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent event) {
- if (animate && animateThread != null) {
- // Stop the animation and wait for the
- // thread to die before disposing the shell.
- animate = false;
- while (animateThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- }
- });
- // Create colors and fonts.
- display = shell.getDisplay();
- whiteColor = new Color(display, 255, 255, 255);
- blackColor = new Color(display, 0, 0, 0);
- redColor = new Color(display, 255, 0, 0);
- greenColor = new Color(display, 0, 255, 0);
- blueColor = new Color(display, 0, 0, 255);
- fixedWidthFont = new Font(display, "courier", 10, 0);
- crossCursor = new Cursor(display, SWT.CURSOR_CROSS);
-
- // Add a menu bar and widgets.
- Menu menuBar = createMenuBar();
- createWidgets();
- shell.pack();
-
- // Create a GC for drawing, and hook the listener to dispose it.
- imageCanvasGC = new GC(imageCanvas);
- imageCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- imageCanvasGC.dispose();
- }
- });
-
- // Open the window, and run an event loop until the window is closed.
- shell.open();
- while (!shell.isDisposed())
- if (!display.readAndDispatch()) display.sleep();
- // Clean up.
- if (image != null)
- image.dispose();
- whiteColor.dispose();
- blackColor.dispose();
- redColor.dispose();
- greenColor.dispose();
- blueColor.dispose();
- fixedWidthFont.dispose();
- crossCursor.dispose();
- }
- void createWidgets() {
- // Add the widgets to the shell in a grid layout.
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.numColumns = 2;
- shell.setLayout(layout);
- // Separate the menu bar from the rest of the widgets.
- Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(gridData);
-
- // Add a composite to contain some control widgets across the top.
- Composite controls = new Composite(shell, SWT.NULL);
- RowLayout rowLayout = new RowLayout();
- rowLayout.marginTop = 0;
- rowLayout.marginBottom = 5;
- rowLayout.spacing = 8;
- controls.setLayout(rowLayout);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- controls.setLayoutData(gridData);
-
- // Combo to change the background.
- Group group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Background"));
- backgroundCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- backgroundCombo.setItems(new String[] {
- bundle.getString("None"),
- bundle.getString("White"),
- bundle.getString("Black"),
- bundle.getString("Red"),
- bundle.getString("Green"),
- bundle.getString("Blue")});
- backgroundCombo.select(backgroundCombo.indexOf(bundle.getString("White")));
- backgroundCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- changeBackground();
- }
- });
-
- // Combo to change the x scale.
- String[] values = {
- "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1",
- "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2",
- "3", "4", "5", "6", "7", "8", "9", "10",};
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("X_scale"));
- scaleXCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleXCombo.add(values[i]);
- }
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleXCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleX();
- }
- });
-
- // Combo to change the y scale.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Y_scale"));
- scaleYCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleYCombo.add(values[i]);
- }
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- scaleYCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleY();
- }
- });
-
- // Combo to change the alpha value.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Alpha_K"));
- alphaCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- for (int i = 0; i <= 255; i += 5) {
- alphaCombo.add(String.valueOf(i));
- }
- alphaCombo.select(alphaCombo.indexOf("255"));
- alphaCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- alpha();
- }
- });
-
- // Check box to request incremental display.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Display"));
- incrementalCheck = new Button(group, SWT.CHECK);
- incrementalCheck.setText(bundle.getString("Incremental"));
- incrementalCheck.setSelection(incremental);
- incrementalCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- incremental = ((Button)event.widget).getSelection();
- }
- });
- // Check box to request transparent display.
- transparentCheck = new Button(group, SWT.CHECK);
- transparentCheck.setText(bundle.getString("Transparent"));
- transparentCheck.setSelection(transparent);
- transparentCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- transparent = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
- // Check box to request mask display.
- maskCheck = new Button(group, SWT.CHECK);
- maskCheck.setText(bundle.getString("Mask"));
- maskCheck.setSelection(showMask);
- maskCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showMask = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
- // Check box to request background display.
- backgroundCheck = new Button(group, SWT.CHECK);
- backgroundCheck.setText(bundle.getString("Background"));
- backgroundCheck.setSelection(showBackground);
- backgroundCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showBackground = ((Button)event.widget).getSelection();
- }
- });
- // Group the animation buttons.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Animation"));
- // Push button to display the previous image in a multi-image file.
- previousButton = new Button(group, SWT.PUSH);
- previousButton.setText(bundle.getString("Previous"));
- previousButton.setEnabled(false);
- previousButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- previous();
- }
- });
- // Push button to display the next image in a multi-image file.
- nextButton = new Button(group, SWT.PUSH);
- nextButton.setText(bundle.getString("Next"));
- nextButton.setEnabled(false);
- nextButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- next();
- }
- });
- // Push button to toggle animation of a multi-image file.
- animateButton = new Button(group, SWT.PUSH);
- animateButton.setText(bundle.getString("Animate"));
- animateButton.setEnabled(false);
- animateButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate();
- }
- });
- // Label to show the image file type.
- typeLabel = new Label(shell, SWT.NULL);
- typeLabel.setText(bundle.getString("Type_initial"));
- typeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Canvas to show the image.
- imageCanvas = new Canvas(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE);
- imageCanvas.setBackground(whiteColor);
- imageCanvas.setCursor(crossCursor);
- gridData = new GridData();
- gridData.verticalSpan = 15;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- imageCanvas.setLayoutData(gridData);
- imageCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintImage(event);
- }
- });
- imageCanvas.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent event) {
- if (image != null) {
- showColorAt(event.x, event.y);
- }
- }
- });
- // Set up the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- horizontal.setVisible(true);
- horizontal.setMinimum(0);
- horizontal.setEnabled(false);
- horizontal.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollHorizontally((ScrollBar)event.widget);
- }
- });
- ScrollBar vertical = imageCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollVertically((ScrollBar)event.widget);
- }
- });
- // Label to show the image size.
- sizeLabel = new Label(shell, SWT.NULL);
- sizeLabel.setText(bundle.getString("Size_initial"));
- sizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image depth.
- depthLabel = new Label(shell, SWT.NULL);
- depthLabel.setText(bundle.getString("Depth_initial"));
- depthLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the transparent pixel.
- transparentPixelLabel = new Label(shell, SWT.NULL);
- transparentPixelLabel.setText(bundle.getString("Transparent_pixel_initial"));
- transparentPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the time to load.
- timeToLoadLabel = new Label(shell, SWT.NULL);
- timeToLoadLabel.setText(bundle.getString("Time_to_load_initial"));
- timeToLoadLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the rest of the fields.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the logical screen size for animation.
- screenSizeLabel = new Label(shell, SWT.NULL);
- screenSizeLabel.setText(bundle.getString("Animation_size_initial"));
- screenSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the background pixel.
- backgroundPixelLabel = new Label(shell, SWT.NULL);
- backgroundPixelLabel.setText(bundle.getString("Background_pixel_initial"));
- backgroundPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image location (x, y).
- locationLabel = new Label(shell, SWT.NULL);
- locationLabel.setText(bundle.getString("Image_location_initial"));
- locationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image disposal method.
- disposalMethodLabel = new Label(shell, SWT.NULL);
- disposalMethodLabel.setText(bundle.getString("Disposal_initial"));
- disposalMethodLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the image delay time.
- delayTimeLabel = new Label(shell, SWT.NULL);
- delayTimeLabel.setText(bundle.getString("Delay_initial"));
- delayTimeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show the background pixel.
- repeatCountLabel = new Label(shell, SWT.NULL);
- repeatCountLabel.setText(bundle.getString("Repeats_initial"));
- repeatCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the palette.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Label to show if the image has a direct or indexed palette.
- paletteLabel = new Label(shell, SWT.NULL);
- paletteLabel.setText(bundle.getString("Palette_initial"));
- paletteLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- // Canvas to show the image's palette.
- paletteCanvas = new Canvas(shell, SWT.BORDER | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
- paletteCanvas.setFont(fixedWidthFont);
- paletteCanvas.getVerticalBar().setVisible(true);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- GC gc = new GC(paletteLabel);
- paletteWidth = gc.stringExtent(bundle.getString("Max_length_string")).x;
- gc.dispose();
- gridData.widthHint = paletteWidth;
- gridData.heightHint = 16 * 11; // show at least 16 colors
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintPalette(event);
- }
- });
- // Set up the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setIncrement(10);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollPalette((ScrollBar)event.widget);
- }
- });
- // Sash to see more of image or image data.
- sash = new Sash(shell, SWT.HORIZONTAL);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- sash.setLayoutData(gridData);
- sash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- ((GridData)paletteCanvas.getLayoutData()).heightHint = SWT.DEFAULT;
- Rectangle paletteCanvasBounds = paletteCanvas.getBounds();
- int minY = paletteCanvasBounds.y + 20;
- Rectangle dataLabelBounds = dataLabel.getBounds();
- int maxY = statusLabel.getBounds().y - dataLabelBounds.height - 20;
- if (event.y > minY && event.y < maxY) {
- Rectangle oldSash = sash.getBounds();
- sash.setBounds(event.x, event.y, event.width, event.height);
- int diff = event.y - oldSash.y;
- Rectangle bounds = imageCanvas.getBounds();
- imageCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = paletteCanvasBounds;
- paletteCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = dataLabelBounds;
- dataLabel.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height);
- bounds = dataText.getBounds();
- dataText.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height - diff);
- //shell.layout(true);
- }
- }
- }
- });
-
- // Label to show data-specific fields.
- dataLabel = new Label(shell, SWT.NULL);
- dataLabel.setText(bundle.getString("Pixel_data_initial"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- dataLabel.setLayoutData(gridData);
-
- // Text to show a dump of the data.
- dataText = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
- dataText.setFont(fixedWidthFont);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.heightHint = 128;
- gridData.grabExcessVerticalSpace = true;
- dataText.setLayoutData(gridData);
- dataText.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
- if (image != null && event.button == 1) {
- showColorForData();
- }
- }
- });
- dataText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (image != null) {
- showColorForData();
- }
- }
- });
-
- // Label to show status and cursor location in image.
- statusLabel = new Label(shell, SWT.NULL);
- statusLabel.setText("");
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- statusLabel.setLayoutData(gridData);
- }
-
- Menu createMenuBar() {
- // Menu bar.
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
- createFileMenu(menuBar);
- createAlphaMenu(menuBar);
- return menuBar;
- }
-
- void createFileMenu(Menu menuBar) {
- // File menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("File"));
- Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(fileMenu);
- // File -> Open File...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenFile"));
- item.setAccelerator(SWT.CTRL + 'O');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenFile();
- }
- });
-
- // File -> Open URL...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenURL"));
- item.setAccelerator(SWT.CTRL + 'U');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenURL();
- }
- });
-
- // File -> Reopen
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Reopen"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuReopen();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Save
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save"));
- item.setAccelerator(SWT.CTRL + 'S');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSave();
- }
- });
-
- // File -> Save As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveAs();
- }
- });
-
- // File -> Save Mask As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_mask_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveMaskAs();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Print
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Print"));
- item.setAccelerator(SWT.CTRL + 'P');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuPrint();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
- // File -> Exit
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Exit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate = false; // stop any animation in progress
- shell.close();
- }
- });
-
- }
-
- void createAlphaMenu(Menu menuBar) {
- // Alpha menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("Alpha"));
- Menu alphaMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(alphaMenu);
-
- // Alpha -> K
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("K");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_CONSTANT);
- }
- });
- // Alpha -> (K + x) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + x) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_X);
- }
- });
-
- // Alpha -> (K + y) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + y) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_Y);
- }
- });
- }
- void menuComposeAlpha(int alpha_op) {
- if (image == null) return;
- animate = false; // stop any animation in progress
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- if (alpha_op == ALPHA_CONSTANT) {
- imageData.alpha = alpha;
- } else {
- imageData.alpha = -1;
- switch (alpha_op) {
- case ALPHA_X:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (x + alpha) % 256);
- }
- }
- break;
- case ALPHA_Y:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (y + alpha) % 256);
- }
- }
- break;
- default: break;
- }
- }
- displayImage(imageData);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
- void menuOpenFile() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image file.
- FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
- if (lastPath != null)
- fileChooser.setFilterPath(lastPath);
- fileChooser.setFilterExtensions(new String[] { "*.bmp; *.gif; *.ico; *.jpg; *.pcx; *.png; *.tif", "*.bmp", "*.gif", "*.ico", "*.jpg", "*.pcx", "*.png", "*.tif" });
- fileChooser.setFilterNames(new String[] { bundle.getString("All_images") + " (bmp, gif, ico, jpg, pcx, png, tif)",
- "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PCX (*.pcx)", "PNG (*.png)", "TIFF (*.tif)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(filename);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) { // Cache the filename.
- currentName = filename;
- fileName = filename;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Loading_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuOpenURL() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image URL.
- TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- textPrompter.setText(bundle.getString("OpenURLDialog"));
- textPrompter.setMessage(bundle.getString("EnterURL"));
- String urlname = textPrompter.open();
- if (urlname == null) return;
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- URL url = new URL(urlname);
- InputStream stream = url.openStream();
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(stream);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) {
- currentName = urlname;
- fileName = null;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Loading_lc"), urlname, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- /*
- * Called to start a thread that draws incremental images
- * as they are loaded.
- */
- void incrementalThreadStart() {
- incrementalEvents = new Vector();
- incrementalThread = new Thread("Incremental") {
- public void run() {
- // Draw the first ImageData increment.
- while (incrementalEvents != null) {
- // Synchronize so we don't try to remove when the vector is null.
- synchronized (ImageAnalyzer.this) {
- if (incrementalEvents != null) {
- if (incrementalEvents.size() > 0) {
- ImageLoaderEvent event = (ImageLoaderEvent) incrementalEvents.remove(0);
- if (image != null) image.dispose();
- image = new Image(display, event.imageData);
- imageData = event.imageData;
- imageCanvasGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } else {
- yield();
- }
- }
- }
- }
- display.wake();
- }
- };
- incrementalThread.setDaemon(true);
- incrementalThread.start();
- }
-
- /*
- * Called when incremental image data has been loaded,
- * for example, for interlaced GIF/PNG or progressive JPEG.
- */
- void incrementalDataLoaded(ImageLoaderEvent event) {
- // Synchronize so that we do not try to add while
- // the incremental drawing thread is removing.
- synchronized (this) {
- incrementalEvents.addElement(event);
- }
- }
-
- void menuSave() {
- if (image == null) return;
- animate = false; // stop any animation in progress
- // If the image file type is unknown, we can't 'Save',
- // so we have to use 'Save As...'.
- if (imageData.type == SWT.IMAGE_UNDEFINED || fileName == null) {
- menuSaveAs();
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the current file.
- loader.data = new ImageData[] {imageData};
- loader.save(fileName, imageData.type);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), fileName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveAs() {
- if (image == null) return;
- animate = false; // stop any animation in progress
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the specified file.
- loader.data = new ImageData[] {imageData};
- loader.save(filename, filetype);
-
- // Update the shell title and file type label,
- // and use the new file.
- fileName = filename;
- shell.setText(createMsg(bundle.getString("Analyzer_on"), filename));
- typeLabel.setText(createMsg(bundle.getString("Type_string"), fileTypeString(filetype)));
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveMaskAs() {
- if (image == null || !showMask) return;
- if (imageData.getTransparencyType() == SWT.TRANSPARENCY_NONE) return;
- animate = false; // stop any animation in progress
-
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the mask of the current image to the specified file.
- ImageData maskImageData = imageData.getTransparencyMask();
- loader.data = new ImageData[] {maskImageData};
- loader.save(filename, filetype);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuPrint() {
- if (image == null) return;
-
- try {
- // Ask the user to specify the printer.
- PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
- PrinterData printerData = dialog.open();
- if (printerData == null) return;
-
- Printer printer = new Printer(printerData);
-
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob(currentName)) {
- GC gc = new GC(printer);
- if (printer.startPage()) {
- gc.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * imageData.width,
- scaleFactor * imageData.height);
- printer.endPage();
- }
- printer.endJob();
- }
- printer.dispose();
- } catch (SWTError e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(bundle.getString("Printing_error") + e.getMessage());
- box.open();
- }
- }
-
- void menuReopen() {
- if (currentName == null) return;
- animate = false; // stop any animation in progress
- resetScrollBars();
- resetScaleCombos();
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- long startTime = System.currentTimeMillis();
- ImageData[] newImageData;
- if (fileName == null) {
- URL url = new URL(currentName);
- InputStream stream = url.openStream();
- newImageData = loader.load(stream);
- } else {
- newImageData = loader.load(fileName);
- }
- loadTime = System.currentTimeMillis() - startTime;
- imageDataIndex = 0;
- displayImage(newImageData[imageDataIndex]);
-
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Reloading_lc"), currentName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void changeBackground() {
- String background = backgroundCombo.getText();
- if (background.equals(bundle.getString("White"))) {
- imageCanvas.setBackground(whiteColor);
- } else if (background.equals(bundle.getString("Black"))) {
- imageCanvas.setBackground(blackColor);
- } else if (background.equals(bundle.getString("Red"))) {
- imageCanvas.setBackground(redColor);
- } else if (background.equals(bundle.getString("Green"))) {
- imageCanvas.setBackground(greenColor);
- } else if (background.equals(bundle.getString("Blue"))) {
- imageCanvas.setBackground(blueColor);
- } else {
- imageCanvas.setBackground(null);
- }
- // Fill the image canvas with the background color.
- Rectangle clientArea = imageCanvas.getClientArea();
- imageCanvasGC.fillRectangle(
- clientArea.x,
- clientArea.y,
- clientArea.width,
- clientArea.height);
- if (image != null) {
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the ScaleX combo selection changes.
- */
- void scaleX() {
- try {
- xscale = Float.parseFloat(scaleXCombo.getText());
- } catch (NumberFormatException e) {
- xscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the ScaleY combo selection changes.
- */
- void scaleY() {
- try {
- yscale = Float.parseFloat(scaleYCombo.getText());
- } catch (NumberFormatException e) {
- yscale = 1;
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the Alpha combo selection changes.
- */
- void alpha() {
- try {
- alpha = Integer.parseInt(alphaCombo.getText());
- } catch (NumberFormatException e) {
- alphaCombo.select(alphaCombo.indexOf("255"));
- alpha = 255;
- }
- }
-
- /*
- * Called when the mouse moves in the image canvas.
- * Show the color of the image at the point under the mouse.
- */
- void showColorAt(int mx, int my) {
- int x = mx - imageData.x - ix;
- int y = my - imageData.y - iy;
- showColorForPixel(x, y);
- }
-
- /*
- * Called when a mouse down or key press is detected
- * in the data text. Show the color of the pixel at
- * the caret position in the data text.
- */
- void showColorForData() {
- int delimiterLength = dataText.getLineDelimiter().length();
- int charactersPerLine = 6 + 3 * imageData.bytesPerLine + delimiterLength;
- int position = dataText.getCaretPosition();
- int y = position / charactersPerLine;
- if ((position - y * charactersPerLine) < 6 || ((y + 1) * charactersPerLine - position) <= delimiterLength) {
- statusLabel.setText("");
- return;
- }
- int dataPosition = position - 6 * (y + 1) - delimiterLength * y;
- int byteNumber = dataPosition / 3;
- int where = dataPosition - byteNumber * 3;
- int xByte = byteNumber % imageData.bytesPerLine;
- int x = -1;
- int depth = imageData.depth;
- if (depth == 1) { // 8 pixels per byte (can only show 3 of 8)
- if (where == 0) x = xByte * 8;
- if (where == 1) x = xByte * 8 + 3;
- if (where == 2) x = xByte * 8 + 7;
- }
- if (depth == 2) { // 4 pixels per byte (can only show 3 of 4)
- if (where == 0) x = xByte * 4;
- if (where == 1) x = xByte * 4 + 1;
- if (where == 2) x = xByte * 4 + 3;
- }
- if (depth == 4) { // 2 pixels per byte
- if (where == 0) x = xByte * 2;
- if (where == 1) x = xByte * 2;
- if (where == 2) x = xByte * 2 + 1;
- }
- if (depth == 8) { // 1 byte per pixel
- x = xByte;
- }
- if (depth == 16) { // 2 bytes per pixel
- x = xByte / 2;
- }
- if (depth == 24) { // 3 bytes per pixel
- x = xByte / 3;
- }
- if (depth == 32) { // 4 bytes per pixel
- x = xByte / 4;
- }
- if (x != -1) {
- showColorForPixel(x, y);
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Set the status label to show color information
- * for the specified pixel in the image.
- */
- void showColorForPixel(int x, int y) {
- if (x >= 0 && x < imageData.width && y >= 0 && y < imageData.height) {
- int pixel = imageData.getPixel(x, y);
- RGB rgb = imageData.palette.getRGB(pixel);
-
- Object[] args = {new Integer(x),
- new Integer(y),
- new Integer(pixel),
- Integer.toHexString(pixel),
- rgb};
- if (pixel == imageData.transparentPixel) {
- statusLabel.setText(createMsg(bundle.getString("Color_at_trans"), args));
- } else {
- statusLabel.setText(createMsg(bundle.getString("Color_at"), args));
- }
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Called when the Animate button is pressed.
- */
- void animate() {
- animate = !animate;
- if (animate && image != null && imageDataArray.length > 1) {
- animateThread = new Thread(bundle.getString("Animation")) {
- public void run() {
- // Pre-animation widget setup.
- preAnimation();
-
- // Animate.
- try {
- animateLoop();
- } catch (final SWTException e) {
- display.syncExec(new Runnable() {
- public void run() {
- showErrorDialog(createMsg(bundle.getString("Creating_image"),
- new Integer(imageDataIndex+1)),
- currentName, e);
- }
- });
- }
-
- // Post animation widget reset.
- postAnimation();
- }
- };
- animateThread.setDaemon(true);
- animateThread.start();
- }
- }
-
- /*
- * Loop through all of the images in a multi-image file
- * and display them one after another.
- */
- void animateLoop() {
- // Create an off-screen image to draw on, and a GC to draw with.
- // Both are disposed after the animation.
- Image offScreenImage = new Image(display, loader.logicalScreenWidth, loader.logicalScreenHeight);
- GC offScreenImageGC = new GC(offScreenImage);
-
- try {
- // Use syncExec to get the background color of the imageCanvas.
- display.syncExec(new Runnable() {
- public void run() {
- canvasBackground = imageCanvas.getBackground();
- }
- });
-
- // Fill the off-screen image with the background color of the canvas.
- offScreenImageGC.setBackground(canvasBackground);
- offScreenImageGC.fillRectangle(
- 0,
- 0,
- loader.logicalScreenWidth,
- loader.logicalScreenHeight);
-
- // Draw the current image onto the off-screen image.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- int repeatCount = loader.repeatCount;
- while (animate && (loader.repeatCount == 0 || repeatCount > 0)) {
- if (imageData.disposalMethod == SWT.DM_FILL_BACKGROUND) {
- // Fill with the background color before drawing.
- Color bgColor = null;
- int backgroundPixel = loader.backgroundPixel;
- if (showBackground && backgroundPixel != -1) {
- // Fill with the background color.
- RGB backgroundRGB = imageData.palette.getRGB(backgroundPixel);
- bgColor = new Color(null, backgroundRGB);
- }
- try {
- offScreenImageGC.setBackground(bgColor != null ? bgColor : canvasBackground);
- offScreenImageGC.fillRectangle(
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } finally {
- if (bgColor != null) bgColor.dispose();
- }
- } else if (imageData.disposalMethod == SWT.DM_FILL_PREVIOUS) {
- // Restore the previous image before drawing.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- }
-
- // Get the next image data.
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- imageData = imageDataArray[imageDataIndex];
- image.dispose();
- image = new Image(display, imageData);
-
- // Draw the new image data.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- // Draw the off-screen image to the screen.
- imageCanvasGC.drawImage(offScreenImage, 0, 0);
-
- // Sleep for the specified delay time before drawing again.
- try {
- Thread.sleep(visibleDelay(imageData.delayTime * 10));
- } catch (InterruptedException e) {
- }
-
- // If we have just drawn the last image in the set,
- // then decrement the repeat count.
- if (imageDataIndex == imageDataArray.length - 1) repeatCount--;
- }
- } finally {
- offScreenImage.dispose();
- offScreenImageGC.dispose();
- }
- }
- /*
- * Pre animation setup.
- */
- void preAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Change the label of the Animate button to 'Stop'.
- animateButton.setText(bundle.getString("Stop"));
-
- // Disable anything we don't want the user
- // to select during the animation.
- previousButton.setEnabled(false);
- nextButton.setEnabled(false);
- backgroundCombo.setEnabled(false);
- scaleXCombo.setEnabled(false);
- scaleYCombo.setEnabled(false);
- alphaCombo.setEnabled(false);
- incrementalCheck.setEnabled(false);
- transparentCheck.setEnabled(false);
- maskCheck.setEnabled(false);
- // leave backgroundCheck enabled
-
- // Reset the scale combos and scrollbars.
- resetScaleCombos();
- resetScrollBars();
- }
- });
- }
-
- /*
- * Post animation reset.
- */
- void postAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Enable anything we disabled before the animation.
- previousButton.setEnabled(true);
- nextButton.setEnabled(true);
- backgroundCombo.setEnabled(true);
- scaleXCombo.setEnabled(true);
- scaleYCombo.setEnabled(true);
- alphaCombo.setEnabled(true);
- incrementalCheck.setEnabled(true);
- transparentCheck.setEnabled(true);
- maskCheck.setEnabled(true);
-
- // Reset the label of the Animate button.
- animateButton.setText(bundle.getString("Animate"));
-
- if (animate) {
- // If animate is still true, we finished the
- // full number of repeats. Leave the image as-is.
- animate = false;
- } else {
- // Redisplay the current image and its palette.
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
- });
- }
-
- /*
- * Called when the Previous button is pressed.
- * Display the previous image in a multi-image file.
- */
- void previous() {
- if (image != null && imageDataArray.length > 1) {
- if (imageDataIndex == 0) {
- imageDataIndex = imageDataArray.length;
- }
- imageDataIndex = imageDataIndex - 1;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
- /*
- * Called when the Next button is pressed.
- * Display the next image in a multi-image file.
- */
- void next() {
- if (image != null && imageDataArray.length > 1) {
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
-
- void displayImage(ImageData newImageData) {
- if (incremental && incrementalThread != null) {
- // Tell the incremental thread to stop drawing.
- synchronized (this) {
- incrementalEvents = null;
- }
-
- // Wait until the incremental thread is done.
- while (incrementalThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
-
- // Dispose of the old image, if there was one.
- if (image != null) image.dispose();
-
- try {
- // Cache the new image and imageData.
- image = new Image(display, newImageData);
- imageData = newImageData;
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Creating_from") + " ", currentName, e);
- image = null;
- return;
- }
-
- // Update the widgets with the new image info.
- String string = createMsg(bundle.getString("Analyzer_on"), currentName);
- shell.setText(string);
-
- if (imageDataArray.length > 1) {
- string = createMsg(bundle.getString("Type_index"),
- new Object[] {fileTypeString(imageData.type),
- new Integer(imageDataIndex + 1),
- new Integer(imageDataArray.length)});
- } else {
- string = createMsg(bundle.getString("Type_string"), fileTypeString(imageData.type));
- }
- typeLabel.setText(string);
-
- string = createMsg(bundle.getString("Size_value"),
- new Object[] {new Integer(imageData.width),
- new Integer(imageData.height)});
- sizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Depth_value"), new Integer(imageData.depth));
- depthLabel.setText(string);
-
- string = createMsg(bundle.getString("Transparent_pixel_value"), pixelInfo(imageData.transparentPixel));
- transparentPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Time_to_load_value"), new Long(loadTime));
- timeToLoadLabel.setText(string);
-
- string = createMsg(bundle.getString("Animation_size_value"),
- new Object[] {new Integer(loader.logicalScreenWidth),
- new Integer(loader.logicalScreenHeight)});
- screenSizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Background_pixel_value"), pixelInfo(loader.backgroundPixel));
- backgroundPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Image_location_value"),
- new Object[] {new Integer(imageData.x), new Integer(imageData.y)});
- locationLabel.setText(string);
-
- string = createMsg(bundle.getString("Disposal_value"),
- new Object[] {new Integer(imageData.disposalMethod),
- disposalString(imageData.disposalMethod)});
- disposalMethodLabel.setText(string);
-
- int delay = imageData.delayTime * 10;
- int delayUsed = visibleDelay(delay);
- if (delay != delayUsed) {
- string = createMsg(bundle.getString("Delay_value"),
- new Object[] {new Integer(delay), new Integer(delayUsed)});
- } else {
- string = createMsg(bundle.getString("Delay_used"), new Integer(delay));
- }
- delayTimeLabel.setText(string);
-
- if (loader.repeatCount == 0) {
- string = createMsg( bundle.getString("Repeats_forever"), new Integer(loader.repeatCount));
- } else {
- string = createMsg(bundle.getString("Repeats_value"), new Integer(loader.repeatCount));
- }
- repeatCountLabel.setText(string);
-
- if (imageData.palette.isDirect) {
- string = bundle.getString("Palette_direct");
- } else {
- string = createMsg(bundle.getString("Palette_value"), new Integer(imageData.palette.getRGBs().length));
- }
- paletteLabel.setText(string);
-
- string = createMsg(bundle.getString("Pixel_data_value"),
- new Object[] {new Integer(imageData.bytesPerLine),
- new Integer(imageData.scanlinePad),
- depthInfo(imageData.depth)});
- dataLabel.setText(string);
-
- dataText.setText(dataHexDump(dataText.getLineDelimiter()));
- statusLabel.setText("");
-
- // Redraw both canvases.
- paletteCanvas.redraw();
- imageCanvas.redraw();
- }
-
- void paintImage(PaintEvent event) {
- Image paintImage = image;
- int transparentPixel = imageData.transparentPixel;
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = -1;
- paintImage = new Image(display, imageData);
- }
- int w = Math.round(imageData.width * xscale);
- int h = Math.round(imageData.height * yscale);
- event.gc.drawImage(
- paintImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- if (showMask && (imageData.getTransparencyType() != SWT.TRANSPARENCY_NONE)) {
- ImageData maskImageData = imageData.getTransparencyMask();
- Image maskImage = new Image(display, maskImageData);
- event.gc.drawImage(
- maskImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- w + 10 + ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- maskImage.dispose();
- }
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = transparentPixel;
- paintImage.dispose();
- }
- }
-
- void paintPalette(PaintEvent event) {
- GC gc = event.gc;
- gc.fillRectangle(paletteCanvas.getClientArea());
- if (imageData.palette.isDirect) {
- // For a direct palette, display the masks.
- int y = py + 10;
- int xTab = 50;
- gc.drawString("rMsk", 10, y, true);
- gc.drawString(toHex4ByteString(imageData.palette.redMask), xTab, y, true);
- gc.drawString("gMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.greenMask), xTab, y, true);
- gc.drawString("bMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.blueMask), xTab, y, true);
- gc.drawString("rShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.redShift), xTab, y, true);
- gc.drawString("gShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.greenShift), xTab, y, true);
- gc.drawString("bShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.blueShift), xTab, y, true);
- } else {
- // For an indexed palette, display the palette colors and indices.
- RGB[] rgbs = imageData.palette.getRGBs();
- if (rgbs != null) {
- int xTab1 = 40, xTab2 = 100;
- for (int i = 0; i < rgbs.length; i++) {
- int y = (i+1) * 10 + py;
- gc.drawString(String.valueOf(i), 10, y, true);
- gc.drawString(toHexByteString(rgbs[i].red) + toHexByteString(rgbs[i].green) + toHexByteString(rgbs[i].blue), xTab1, y, true);
- Color color = new Color(display, rgbs[i]);
- gc.setBackground(color);
- gc.fillRectangle(xTab2, y+2, 10, 10);
- color.dispose();
- }
- }
- }
- }
-
- void resizeShell(ControlEvent event) {
- if (image == null || shell.isDisposed())
- return;
- resizeScrollBars();
- }
-
- // Reset the scale combos to 1.
- void resetScaleCombos() {
- xscale = 1; yscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
-
- // Reset the scroll bars to 0.
- void resetScrollBars() {
- if (image == null) return;
- ix = 0; iy = 0; py = 0;
- resizeScrollBars();
- imageCanvas.getHorizontalBar().setSelection(0);
- imageCanvas.getVerticalBar().setSelection(0);
- paletteCanvas.getVerticalBar().setSelection(0);
- }
-
- void resizeScrollBars() {
- // Set the max and thumb for the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- ScrollBar vertical = imageCanvas.getVerticalBar();
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- if (width > canvasBounds.width) {
- // The image is wider than the canvas.
- horizontal.setEnabled(true);
- horizontal.setMaximum(width);
- horizontal.setThumb(canvasBounds.width);
- horizontal.setPageIncrement(canvasBounds.width);
- } else {
- // The canvas is wider than the image.
- horizontal.setEnabled(false);
- if (ix != 0) {
- // Make sure the image is completely visible.
- ix = 0;
- imageCanvas.redraw();
- }
- }
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // The image is taller than the canvas.
- vertical.setEnabled(true);
- vertical.setMaximum(height);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- } else {
- // The canvas is taller than the image.
- vertical.setEnabled(false);
- if (iy != 0) {
- // Make sure the image is completely visible.
- iy = 0;
- imageCanvas.redraw();
- }
- }
-
- // Set the max and thumb for the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- if (imageData.palette.isDirect) {
- vertical.setEnabled(false);
- } else { // indexed palette
- canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20; // 10 pixels each index + 20 for margins.
- vertical.setEnabled(true);
- vertical.setMaximum(paletteHeight);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- }
- }
-
- /*
- * Called when the image canvas' horizontal scrollbar is selected.
- */
- void scrollHorizontally(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (width > canvasBounds.width) {
- // Only scroll if the image is bigger than the canvas.
- int x = -scrollBar.getSelection();
- if (x + width < canvasBounds.width) {
- // Don't scroll past the end of the image.
- x = canvasBounds.width - width;
- }
- imageCanvas.scroll(x, iy, ix, iy, width, height, false);
- ix = x;
- }
- }
-
- /*
- * Called when the image canvas' vertical scrollbar is selected.
- */
- void scrollVertically(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // Only scroll if the image is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + height < canvasBounds.height) {
- // Don't scroll past the end of the image.
- y = canvasBounds.height - height;
- }
- imageCanvas.scroll(ix, y, ix, iy, width, height, false);
- iy = y;
- }
- }
- /*
- * Called when the palette canvas' vertical scrollbar is selected.
- */
- void scrollPalette(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20;
- if (paletteHeight > canvasBounds.height) {
- // Only scroll if the palette is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + paletteHeight < canvasBounds.height) {
- // Don't scroll past the end of the palette.
- y = canvasBounds.height - paletteHeight;
- }
- paletteCanvas.scroll(0, y, 0, py, paletteWidth, paletteHeight, false);
- py = y;
- }
- }
-
- /*
- * Return a String containing a line-by-line dump of
- * the data in the current imageData. The lineDelimiter
- * parameter must be a string of length 1 or 2.
- */
- String dataHexDump(String lineDelimiter) {
- if (image == null) return "";
- char[] dump = new char[imageData.height * (6 + 3 * imageData.bytesPerLine + lineDelimiter.length())];
- int index = 0;
- for (int i = 0; i < imageData.data.length; i++) {
- if (i % imageData.bytesPerLine == 0) {
- int line = i / imageData.bytesPerLine;
- dump[index++] = Character.forDigit(line / 1000 % 10, 10);
- dump[index++] = Character.forDigit(line / 100 % 10, 10);
- dump[index++] = Character.forDigit(line / 10 % 10, 10);
- dump[index++] = Character.forDigit(line % 10, 10);
- dump[index++] = ':';
- dump[index++] = ' ';
- }
- byte b = imageData.data[i];
- dump[index++] = Character.forDigit((b & 0xF0) >> 4, 16);
- dump[index++] = Character.forDigit(b & 0x0F, 16);
- dump[index++] = ' ';
- if ((i + 1) % imageData.bytesPerLine == 0) {
- dump[index++] = lineDelimiter.charAt(0);
- if (lineDelimiter.length() > 1)
- dump[index++] = lineDelimiter.charAt(1);
- }
- }
- return new String(dump);
- }
-
- /*
- * Open an error dialog displaying the specified information.
- */
- void showErrorDialog(String operation, String filename, Exception e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
- String errorMessage = "";
- if (e != null) {
- if (e instanceof SWTException) {
- SWTException swte = (SWTException) e;
- errorMessage = swte.getMessage();
- if (swte.throwable != null) {
- errorMessage += ":\n" + swte.throwable.toString();
- }
- } else {
- errorMessage = e.toString();
- }
- }
- box.setMessage(message + errorMessage);
- box.open();
- }
-
- /*
- * Return a String describing how to analyze the bytes
- * in the hex dump.
- */
- static String depthInfo(int depth) {
- Object[] args = {new Integer(depth), ""};
- switch (depth) {
- case 1:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(8), " [01234567]"});
- break;
- case 2:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(4), "[00112233]"});
- break;
- case 4:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(2), "[00001111]"});
- break;
- case 8:
- args[1] = bundle.getString("One_byte");
- break;
- case 16:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(2));
- break;
- case 24:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(3));
- break;
- case 32:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(4));
- break;
- default:
- args[1] = bundle.getString("Unsupported_lc");
- }
- return createMsg(bundle.getString("Depth_info"), args);
- }
-
- /*
- * Return the specified number of milliseconds.
- * If the specified number of milliseconds is too small
- * to see a visual change, then return a higher number.
- */
- static int visibleDelay(int ms) {
- if (ms < 20) return ms + 30;
- if (ms < 30) return ms + 10;
- return ms;
- }
-
- /*
- * Return the specified byte value as a hex string,
- * preserving leading 0's.
- */
- static String toHexByteString(int i) {
- if (i <= 0x0f)
- return "0" + Integer.toHexString(i);
- return Integer.toHexString(i & 0xff);
- }
- /*
- * Return the specified 4-byte value as a hex string,
- * preserving leading 0's.
- * (a bit 'brute force'... should probably use a loop...)
- */
- static String toHex4ByteString(int i) {
- String hex = Integer.toHexString(i);
- if (hex.length() == 1)
- return "0000000" + hex;
- if (hex.length() == 2)
- return "000000" + hex;
- if (hex.length() == 3)
- return "00000" + hex;
- if (hex.length() == 4)
- return "0000" + hex;
- if (hex.length() == 5)
- return "000" + hex;
- if (hex.length() == 6)
- return "00" + hex;
- if (hex.length() == 7)
- return "0" + hex;
- return hex;
- }
-
- /*
- * Return a String describing the specified
- * transparent or background pixel.
- */
- static String pixelInfo(int pixel) {
- if (pixel == -1)
- return pixel + " (" + bundle.getString("None_lc") + ")";
- else
- return pixel + " (0x" + Integer.toHexString(pixel) + ")";
- }
-
- /*
- * Return a String describing the specified disposal method.
- */
- static String disposalString(int disposalMethod) {
- switch (disposalMethod) {
- case SWT.DM_FILL_NONE: return bundle.getString("None_lc");
- case SWT.DM_FILL_BACKGROUND: return bundle.getString("Background_lc");
- case SWT.DM_FILL_PREVIOUS: return bundle.getString("Previous_lc");
- }
- return bundle.getString("Unspecified_lc");
- }
-
- /*
- * Return a String describing the specified image file type.
- */
- static String fileTypeString(int filetype) {
- if (filetype == SWT.IMAGE_BMP)
- return "BMP";
- if (filetype == SWT.IMAGE_GIF)
- return "GIF";
- if (filetype == SWT.IMAGE_ICO)
- return "ICO";
- if (filetype == SWT.IMAGE_JPEG)
- return "JPEG";
- if (filetype == SWT.IMAGE_PNG)
- return "PNG";
- return bundle.getString("Unknown_ac");
- }
-
- /*
- * Return the specified file's image type, based on its extension.
- * Note that this is not a very robust way to determine image type,
- * and it is only to be used in the absence of any better method.
- */
- static int determineFileType(String filename) {
- String ext = filename.substring(filename.lastIndexOf('.') + 1);
- if (ext.equalsIgnoreCase("bmp"))
- return SWT.IMAGE_BMP;
- if (ext.equalsIgnoreCase("gif"))
- return SWT.IMAGE_GIF;
- if (ext.equalsIgnoreCase("ico"))
- return SWT.IMAGE_ICO;
- if (ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg"))
- return SWT.IMAGE_JPEG;
- if (ext.equalsIgnoreCase("png"))
- return SWT.IMAGE_PNG;
- return SWT.IMAGE_UNDEFINED;
- }
-
- static String createMsg(String msg, Object[] args) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(args);
- }
-
- static String createMsg(String msg, Object arg) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(new Object[]{arg});
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
deleted file mode 100755
index 4e55c2bdbb..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-class JavaLineStyler implements LineStyleListener {
- JavaScanner scanner = new JavaScanner();
- int[] tokenColors;
- Color[] colors;
- Vector blockComments = new Vector();
-
- public static final int EOF= -1;
- public static final int EOL= 10;
-
- public static final int WORD= 0;
- public static final int WHITE= 1;
- public static final int KEY= 2;
- public static final int COMMENT= 3;
- public static final int STRING= 5;
- public static final int OTHER= 6;
- public static final int NUMBER= 7;
-
- public static final int MAXIMUM_TOKEN= 8;
-
-public JavaLineStyler() {
- initializeColors();
- scanner = new JavaScanner();
-}
-
-Color getColor(int type) {
- if (type < 0 || type >= tokenColors.length) {
- return null;
- }
- return colors[tokenColors[type]];
-}
-
-boolean inBlockComment(int start, int end) {
- for (int i=0; i<blockComments.size(); i++) {
- int[] offsets = (int[])blockComments.elementAt(i);
- // start of comment in the line
- if ((offsets[0] >= start) && (offsets[0] <= end)) return true;
- // end of comment in the line
- if ((offsets[1] >= start) && (offsets[1] <= end)) return true;
- if ((offsets[0] <= start) && (offsets[1] >= end)) return true;
- }
- return false;
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- colors= new Color[] {
- new Color(display, new RGB(0, 0, 0)), // black
- new Color(display, new RGB(255, 0, 0)), // red
- new Color(display, new RGB(0, 255, 0)), // green
- new Color(display, new RGB(0, 0, 255)) // blue
- };
- tokenColors= new int[MAXIMUM_TOKEN];
- tokenColors[WORD]= 0;
- tokenColors[WHITE]= 0;
- tokenColors[KEY]= 3;
- tokenColors[COMMENT]= 1;
- tokenColors[STRING]= 2;
- tokenColors[OTHER]= 0;
- tokenColors[NUMBER]= 0;
-}
-
-void disposeColors() {
- for (int i=0;i<colors.length;i++) {
- colors[i].dispose();
- }
-}
-
-/**
- * Event.detail line start offset (input)
- * Event.text line text (input)
- * LineStyleEvent.styles Enumeration of StyleRanges, need to be in order. (output)
- * LineStyleEvent.background line background color (output)
- */
-public void lineGetStyle(LineStyleEvent event) {
- Vector styles = new Vector();
- int token;
- StyleRange lastStyle;
- // If the line is part of a block comment, create one style for the entire line.
- if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
- styles.addElement(new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null));
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
- return;
- }
- Color defaultFgColor = ((Control)event.widget).getForeground();
- scanner.setRange(event.lineText);
- token = scanner.nextToken();
- while (token != EOF) {
- if (token == OTHER) {
- // do nothing for non-colored tokens
- } else if (token != WHITE) {
- Color color = getColor(token);
- // Only create a style if the token color is different than the
- // widget's default foreground color and the token's style is not
- // bold. Keywords are bolded.
- if ((!color.equals(defaultFgColor)) || (token == KEY)) {
- StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
- if (token == KEY) {
- style.fontStyle = SWT.BOLD;
- }
- if (styles.isEmpty()) {
- styles.addElement(style);
- } else {
- // Merge similar styles. Doing so will improve performance.
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- } else if ((!styles.isEmpty()) && ((lastStyle=(StyleRange)styles.lastElement()).fontStyle == SWT.BOLD)) {
- int start = scanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange)styles.lastElement();
- // A font style of SWT.BOLD implies that the last style
- // represents a java keyword.
- if (lastStyle.start + lastStyle.length == start) {
- // Have the white space take on the style before it to
- // minimize the number of style ranges created and the
- // number of font style changes during rendering.
- lastStyle.length += scanner.getLength();
- }
- }
- token= scanner.nextToken();
- }
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
-}
-public void parseBlockComments(String text) {
- blockComments = new Vector();
- StringReader buffer = new StringReader(text);
- int ch;
- boolean blkComment = false;
- int cnt = 0;
- int[] offsets = new int[2];
- boolean done = false;
-
- try {
- while (!done) {
- switch (ch = buffer.read()) {
- case -1 : {
- if (blkComment) {
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- done = true;
- break;
- }
- case '/' : {
- ch = buffer.read();
- if ((ch == '*') && (!blkComment)) {
- offsets = new int[2];
- offsets[0] = cnt;
- blkComment = true;
- cnt++;
- } else {
- cnt++;
- }
- cnt++;
- break;
- }
- case '*' : {
- if (blkComment) {
- ch = buffer.read();
- cnt++;
- if (ch == '/') {
- blkComment = false;
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- }
- cnt++;
- break;
- }
- default : {
- cnt++;
- break;
- }
- }
- }
- } catch(IOException e) {
- // ignore errors
- }
-}
-
-/**
- * A simple fuzzy scanner for Java
- */
-public class JavaScanner {
-
- protected Hashtable fgKeys= null;
- protected StringBuffer fBuffer= new StringBuffer();
- protected String fDoc;
- protected int fPos;
- protected int fEnd;
- protected int fStartToken;
- protected boolean fEofSeen= false;
-
- private String[] fgKeywords= {
- "abstract",
- "boolean", "break", "byte",
- "case", "catch", "char", "class", "continue",
- "default", "do", "double",
- "else", "extends",
- "false", "final", "finally", "float", "for",
- "if", "implements", "import", "instanceof", "int", "interface",
- "long",
- "native", "new", "null",
- "package", "private", "protected", "public",
- "return",
- "short", "static", "super", "switch", "synchronized",
- "this", "throw", "throws", "transient", "true", "try",
- "void", "volatile",
- "while"
- };
-
- public JavaScanner() {
- initialize();
- }
-
- /**
- * Returns the ending location of the current token in the document.
- */
- public final int getLength() {
- return fPos - fStartToken;
- }
-
- /**
- * Initialize the lookup table.
- */
- void initialize() {
- fgKeys= new Hashtable();
- Integer k= new Integer(KEY);
- for (int i= 0; i < fgKeywords.length; i++)
- fgKeys.put(fgKeywords[i], k);
- }
-
- /**
- * Returns the starting location of the current token in the document.
- */
- public final int getStartOffset() {
- return fStartToken;
- }
-
- /**
- * Returns the next lexical token in the document.
- */
- public int nextToken() {
- int c;
- fStartToken= fPos;
- while (true) {
- switch (c= read()) {
- case EOF:
- return EOF;
- case '/': // comment
- c= read();
- if (c == '/') {
- while (true) {
- c= read();
- if ((c == EOF) || (c == EOL)) {
- unread(c);
- return COMMENT;
- }
- }
- } else {
- unread(c);
- }
- return OTHER;
- case '\'': // char const
- character: for(;;) {
- c= read();
- switch (c) {
- case '\'':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '"': // string
- string: for (;;) {
- c= read();
- switch (c) {
- case '"':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- c= read();
- } while(Character.isDigit((char)c));
- unread(c);
- return NUMBER;
- default:
- if (Character.isWhitespace((char)c)) {
- do {
- c= read();
- } while(Character.isWhitespace((char)c));
- unread(c);
- return WHITE;
- }
- if (Character.isJavaIdentifierStart((char)c)) {
- fBuffer.setLength(0);
- do {
- fBuffer.append((char)c);
- c= read();
- } while(Character.isJavaIdentifierPart((char)c));
- unread(c);
- Integer i= (Integer) fgKeys.get(fBuffer.toString());
- if (i != null)
- return i.intValue();
- return WORD;
- }
- return OTHER;
- }
- }
- }
-
- /**
- * Returns next character.
- */
- protected int read() {
- if (fPos <= fEnd) {
- return fDoc.charAt(fPos++);
- }
- return EOF;
- }
-
- public void setRange(String text) {
- fDoc= text;
- fPos= 0;
- fEnd= fDoc.length() -1;
- }
-
- protected void unread(int c) {
- if (c != EOF)
- fPos--;
- }
-}
-
-
-
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
deleted file mode 100755
index 80e2776b51..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-import java.text.*;
-
-/**
-*/
-public class JavaViewer implements DisposeListener {
- Shell shell;
- StyledText text;
- JavaLineStyler lineStyler = new JavaLineStyler();
- static ResourceBundle resources = ResourceBundle.getBundle("examples_javaviewer");
-
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- lineStyler.disposeColors();
-}
-public void widgetDisposed (DisposeEvent event) {
- text.removeLineStyleListener(lineStyler);
- text.removeDisposeListener(this);
-}
-
-Menu createFileMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
- MenuItem item;
-
- // Open
- item = new MenuItem (menu, SWT.CASCADE);
- item.setText (resources.getString("Open_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- openFile();
- }
- });
-
- // Close
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Close_menuitem"));
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- menuFileExit ();
- }
- });
- return menu;
-}
-
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
- fileItem.setText (resources.getString("File_menuitem"));
- fileItem.setMenu (createFileMenu ());
-
-}
-
-void createShell () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 400);
- shell.setLayout(layout);
-}
-void createStyledText() {
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- text.addLineStyleListener(lineStyler);
- text.addDisposeListener(this);
- text.setEditable(false);
- Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
- text.setBackground(bg);
-}
-
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-
-public static void main (String [] args) {
- JavaViewer example = new JavaViewer ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void openFile() {
- final String textString;
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.java", "*.*"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if ((name == null) || (name.length() == 0)) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- String message = MessageFormat.format(resources.getString("Err_file_no_exist"), new String[] {file.getName()});
- displayError(message);
- return;
- }
-
- try {
- FileInputStream stream= new FileInputStream(file.getPath());
- try {
- Reader in = new BufferedReader(new InputStreamReader(stream));
- char[] readBuffer= new char[2048];
- StringBuffer buffer= new StringBuffer((int) file.length());
- int n;
- while ((n = in.read(readBuffer)) > 0) {
- buffer.append(readBuffer, 0, n);
- }
- textString = buffer.toString();
- stream.close();
- }
- catch (IOException e) {
- // Err_file_io
- String message = MessageFormat.format(resources.getString("Err_file_io"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- }
- catch (FileNotFoundException e) {
- String message = MessageFormat.format(resources.getString("Err_not_found"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- // Guard against superfluous mouse move events -- defer action until later
- Display display = text.getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- text.setText(textString);
- }
- });
-
- // parse the block comments up front since block comments can go across
- // lines - inefficient way of doing this
- lineStyler.parseBlockComments(textString);
-}
-
-void menuFileExit () {
- shell.close ();
-}
-
-public void open () {
- createShell ();
- createMenuBar ();
- createStyledText ();
- shell.open ();
-}
-
-public void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java
deleted file mode 100755
index a57ad25b53..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class Images {
-
- // Bitmap Images
- public static Image Bold;
- public static Image Red;
- public static Image Green;
- public static Image Blue;
- public static Image Erase;
-
- static Image [] AllBitmaps;
-
-public static void freeAll () {
- for (int i=0; i<AllBitmaps.length; i++) AllBitmaps [i].dispose ();
- AllBitmaps = null;
-}
-
-static Image createBitmapImage(Display display, String fileName) {
- ImageData source = new ImageData(Images.class.getResourceAsStream(fileName+".bmp"));
- ImageData mask = new ImageData(Images.class.getResourceAsStream(fileName+"_mask"+".bmp"));
- return new Image (display, source, mask);
-}
-public static void loadAll (Display display) {
-
- // Bitmap Images
- Bold = createBitmapImage (display, "bold");
- Red = createBitmapImage (display, "red");
- Green = createBitmapImage (display, "green");
- Blue = createBitmapImage (display, "blue");
- Erase = createBitmapImage (display, "erase");
-
- AllBitmaps = new Image [] {
- Bold,
- Red,
- Green,
- Blue,
- Erase,
- };
-
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
deleted file mode 100755
index 2bdbaadd94..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-/**
-*/
-public class TextEditor {
- Shell shell;
- ToolBar toolBar;
- StyledText text;
-
- Vector cachedStyles = new Vector();
- Color RED = null;
- Color BLUE = null;
- Color GREEN = null;
- Font font = null;
-
- boolean isBold = false;
-
- ExtendedModifyListener extendedModifyListener;
- VerifyKeyListener verifyKeyListener;
- static ResourceBundle resources = ResourceBundle.getBundle("examples_texteditor");
-
-/*
- * Free the allocated resources.
- */
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- if (font != null) font.dispose();
- Images.freeAll ();
- RED.dispose();
- GREEN.dispose();
- BLUE.dispose();
-}
-
-Menu createEditMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
-
- MenuItem item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Cut_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.cut();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Copy_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.copy();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Paste_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.paste();
- }
- });
-
- new MenuItem (menu, SWT.SEPARATOR);
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Font_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
- return menu;
-}
-
-
-/*
- * Set the text state to bold.
- */
-void bold(boolean bold) {
- isBold = bold;
-}
-/*
- * Clear all style data for the selected text.
- */
-void clear() {
- Point sel = text.getSelectionRange();
- if ((sel != null) && (sel.y != 0)) {
- StyleRange style;
- style = new StyleRange(sel.x, sel.y, null, null, SWT.NORMAL);
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-/*
- * Set the foreground color for the selected text.
- */
-void fgColor(int color) {
- Point sel = text.getSelectionRange();
- if ((sel == null) || (sel.y == 0)) return;
- Color fg;
- if (color == SWT.COLOR_RED) {
- fg = RED;
- } else if (color == SWT.COLOR_GREEN) {
- fg = GREEN;
- } else if (color == SWT.COLOR_BLUE) {
- fg = BLUE;
- } else {
- fg = null;
- }
- StyleRange style;
- for (int i = sel.x; i<sel.x+sel.y; i++) {
- StyleRange range = text.getStyleRangeAtOffset(i);
- if (range == null) {style = new StyleRange(i, 1, fg, null, SWT.NORMAL);}
- else {style = new StyleRange(i, 1, fg, null, range.fontStyle);};
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem editItem = new MenuItem (bar, SWT.CASCADE);
- editItem.setText (resources.getString("Edit_menuitem"));
- editItem.setMenu (createEditMenu ());
-}
-
-void createShell () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- Images.loadAll (shell.getDisplay ());
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
-}
-void createStyledText() {
- initializeColors();
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- extendedModifyListener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent e) {
- handleExtendedModify(e);
- }
- };
- text.addExtendedModifyListener(extendedModifyListener);
- verifyKeyListener = new VerifyKeyListener() {
- public void verifyKey(VerifyEvent e) {
- handleVerifyKey(e);
- }
- };
- text.addVerifyKeyListener(verifyKeyListener);
-}
-
-void createToolBar() {
- toolBar = new ToolBar(shell, SWT.NULL);
-
- ToolItem item = new ToolItem(toolBar, SWT.CHECK);
- item.setImage(Images.Bold);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- bold(((ToolItem)event.widget).getSelection());
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Red);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_RED);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Green);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_GREEN);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Blue);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_BLUE);
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(Images.Erase);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- clear();
- }
- });
-}
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-/*
- * Cache the style information for text that has been cut or copied.
- */
-void handleCutCopy() {
- // Save the cut/copied style info so that during paste we will maintain
- // the style information. Cut/copied text is put in the clipboard in
- // RTF format, but is not pasted in RTF format. The other way to
- // handle the pasting of styles would be to access the Clipboard directly and
- // parse the RTF text.
- cachedStyles = new Vector();
- Point sel = text.getSelectionRange();
- int startX = sel.x;
- for (int i=sel.x; i<=sel.x+sel.y-1; i++) {
- StyleRange style = text.getStyleRangeAtOffset(i);
- if (style != null) {
- style.start = style.start - startX;
- if (!cachedStyles.isEmpty()) {
- StyleRange lastStyle = (StyleRange)cachedStyles.lastElement();
- if (lastStyle.similarTo(style)) {
- lastStyle.length++;
- } else {
- cachedStyles.addElement(style);
- }
- } else {
- cachedStyles.addElement(style);
- }
- }
- }
-}
-void handleExtendedModify(ExtendedModifyEvent event) {
- if (event.length == 0) return;
- StyleRange style;
- if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) {
- // Have the new text take on the style of the text to its right (during
- // typing) if no style information is active.
- int caretOffset = text.getCaretOffset();
- style = null;
- if (caretOffset < text.getCharCount()) style = text.getStyleRangeAtOffset(caretOffset);
- if (style != null) {
- style.start = event.start;
- style.length = event.length;
- int fontStyle = SWT.NORMAL;
- if (isBold) fontStyle = SWT.BOLD;
- style.fontStyle = fontStyle;
- text.setStyleRange(style);
- } else if (isBold) {
- StyleRange newStyle = new StyleRange(event.start, event.length, null, null, SWT.BOLD);
- text.setStyleRange(newStyle);
- }
- } else {
- // paste occurring
- for (int i=0; i<cachedStyles.size(); i++) {
- style = (StyleRange)cachedStyles.elementAt(i);
- StyleRange newStyle = (StyleRange)style.clone();
- newStyle.start = style.start + event.start;
- text.setStyleRange(newStyle);
- }
- }
-}
-/*
- * Intercept the cut and copy keys so that during paste we can maintain
- * style information.
- */
-void handleVerifyKey(VerifyEvent event) {
- int input;
- if (event.keyCode != 0) input = event.keyCode | event.stateMask;
- else input = event.character | event.stateMask;
- if (isCut(input) || isCopy(input)) {
- handleCutCopy();
- }
-}
-
-public static void main (String [] args) {
- TextEditor example = new TextEditor ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void open () {
- createShell ();
- createMenuBar ();
- createToolBar ();
- createStyledText ();
- shell.open ();
-}
-
-void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-void setFont() {
- FontDialog fontDialog = new FontDialog(shell);
- fontDialog.setFontData((text.getFont()).getFontData()[0]);
- FontData fontData = fontDialog.open();
- if(fontData != null) {
- if(font != null)
- font.dispose();
- font = new Font(shell.getDisplay(), fontData);
- text.setFont(font);
- }
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- RED = new Color (display, new RGB(255,0,0));
- BLUE = new Color (display, new RGB(0,0,255));
- GREEN = new Color (display, new RGB(0,255,0));
-}
-boolean isCopy(int input) {
-
- if (input == (SWT.INSERT | SWT.CTRL)) return true;
-
- if (input == ('\u0003' | SWT.CTRL)) return true;
-
- return false;
-
-}
-boolean isCut(int input) {
-
- if (input == (SWT.DEL | SWT.SHIFT)) return true;
-
- if (input == ('\u0018' | SWT.CTRL)) return true;
-
- return false;
-
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp
deleted file mode 100755
index 84c7ac9a46..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp
deleted file mode 100755
index a3184bb26c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp
deleted file mode 100755
index 382751efa3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp
deleted file mode 100755
index 1d2ace7ee3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp
deleted file mode 100755
index f6ab21e471..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp
deleted file mode 100755
index cca023fd57..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp
deleted file mode 100755
index 88c63be336..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/.classpath b/tests/org.eclipse.swt.tests/.classpath
deleted file mode 100644
index b34ba4694a..0000000000
--- a/tests/org.eclipse.swt.tests/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="var"
- path="ECLIPSE_HOME/plugins/org.junit/junit.jar" sourcepath="ECLIPSE_HOME/plugins/org.junit/src.jar"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="JUnit Tests"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.swt.tests/.cvsignore b/tests/org.eclipse.swt.tests/.cvsignore
deleted file mode 100644
index c5e82d7458..0000000000
--- a/tests/org.eclipse.swt.tests/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/tests/org.eclipse.swt.tests/.vcm_meta b/tests/org.eclipse.swt.tests/.vcm_meta
deleted file mode 100644
index 3e55d313af..0000000000
--- a/tests/org.eclipse.swt.tests/.vcm_meta
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
-</project-description>
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java
deleted file mode 100644
index 6fba883454..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing all of the graphics test cases.
- */
-public class AllGraphicsTests {
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_graphics_Color.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Cursor.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_DeviceData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Font.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_FontData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_GC.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_GCData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Image.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_ImageData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_PaletteData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Point.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Rectangle.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Region.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_RGB.suite());
-
-
- suite.addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java
deleted file mode 100644
index cdb8710364..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.eclipse.swt.tests.junit;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.*;
-import junit.textui.*;
- /**
- * Suite for running all SWT test cases.
- */
-public class AllTests extends TestSuite {
- public static int unimplementedMethods;
-
-public static void main(String[] args) {
- unimplementedMethods = 0;
- TestRunner.run(suite());
- if (unimplementedMethods > 0) {
- System.out.println("\nCalls to warnUnimpl: " + unimplementedMethods);
- }
-}
-public static Test suite() {
- return new AllTests();
-}
-
-public AllTests() {
- super();
- /* The logical order to run the tests in is:
- * - SWT, SWTError, SWTException
- * - Display
- * - graphics classes
- * - items and Caret, etc
- * - widgets
- * - dialogs
- * - layout
- * - custom widgets
- * - printing and program
- * - events
- * - drag & drop
- */
- addTest(Test_org_eclipse_swt_SWT.suite());
- addTest(Test_org_eclipse_swt_SWTException.suite());
- addTest(Test_org_eclipse_swt_SWTError.suite());
-
- addTest(Test_org_eclipse_swt_widgets_Display.suite());
-
- addTest(Test_org_eclipse_swt_graphics_Image.suite());
- addTest(Test_org_eclipse_swt_graphics_Cursor.suite());
- addTest(Test_org_eclipse_swt_graphics_DeviceData.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite());
- addTest(Test_org_eclipse_swt_graphics_RGB.suite());
- addTest(Test_org_eclipse_swt_graphics_Font.suite());
- addTest(Test_org_eclipse_swt_graphics_Rectangle.suite());
- addTest(Test_org_eclipse_swt_graphics_FontData.suite());
- addTest(Test_org_eclipse_swt_graphics_GC.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageData.suite());
- addTest(Test_org_eclipse_swt_graphics_Region.suite());
- addTest(Test_org_eclipse_swt_graphics_GCData.suite());
- addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite());
- addTest(Test_org_eclipse_swt_graphics_Color.suite());
- addTest(Test_org_eclipse_swt_graphics_Point.suite());
- addTest(Test_org_eclipse_swt_graphics_PaletteData.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite());
-
- addTest(Test_org_eclipse_swt_widgets_MenuItem.suite());
- addTest(Test_org_eclipse_swt_widgets_ToolItem.suite());
- //addTest(Test_org_eclipse_swt_widgets_CoolItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
- addTest(Test_org_eclipse_swt_widgets_Caret.suite());
- addTest(Test_org_eclipse_swt_widgets_Event.suite());
- addTest(Test_org_eclipse_swt_widgets_TypedListener.suite());
- addTest(Test_org_eclipse_swt_widgets_Menu.suite());
- //addTest(Test_org_eclipse_swt_widgets_Tracker.suite());
- addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite());
-
- addTest(Test_org_eclipse_swt_widgets_Shell.suite());
- //addTest(Test_org_eclipse_swt_widgets_Decorations.suite());
- addTest(Test_org_eclipse_swt_widgets_Label.suite());
- addTest(Test_org_eclipse_swt_widgets_Button.suite());
- addTest(Test_org_eclipse_swt_widgets_List.suite());
- addTest(Test_org_eclipse_swt_widgets_Text.suite());
- addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Sash.suite());
- addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- addTest(Test_org_eclipse_swt_widgets_Combo.suite());
- addTest(Test_org_eclipse_swt_widgets_Group.suite());
- addTest(Test_org_eclipse_swt_widgets_ToolBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Table.suite());
- addTest(Test_org_eclipse_swt_widgets_Canvas.suite());
- addTest(Test_org_eclipse_swt_widgets_Scale.suite());
- addTest(Test_org_eclipse_swt_widgets_Slider.suite());
- addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Composite.suite());
- //addTest(Test_org_eclipse_swt_widgets_CoolBar.suite());
-
- addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_FileDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_MessageBox.suite());
-
- addTest(Test_org_eclipse_swt_layout_GridData.suite());
- addTest(Test_org_eclipse_swt_layout_RowData.suite());
- addTest(Test_org_eclipse_swt_layout_GridLayout.suite());
- addTest(Test_org_eclipse_swt_layout_FillLayout.suite());
- addTest(Test_org_eclipse_swt_layout_RowLayout.suite());
-
- addTest(Test_org_eclipse_swt_custom_TableTree.suite());
- addTest(Test_org_eclipse_swt_custom_BidiSegmentEvent.suite());
- addTest(Test_org_eclipse_swt_custom_LineBackgroundEvent.suite());
- addTest(Test_org_eclipse_swt_custom_LineStyleEvent.suite());
- addTest(Test_org_eclipse_swt_custom_SashForm.suite());
- addTest(Test_org_eclipse_swt_custom_TableEditor.suite());
- addTest(Test_org_eclipse_swt_custom_AnimatedProgress.suite());
- addTest(Test_org_eclipse_swt_custom_StyleRange.suite());
- addTest(Test_org_eclipse_swt_custom_TextChangedEvent.suite());
- addTest(Test_org_eclipse_swt_custom_StackLayout.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolderEvent.suite());
- addTest(Test_org_eclipse_swt_custom_ExtendedModifyEvent.suite());
- addTest(Test_org_eclipse_swt_custom_CCombo.suite());
- addTest(Test_org_eclipse_swt_custom_TableTreeItem.suite());
- addTest(Test_org_eclipse_swt_custom_ViewForm.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolderAdapter.suite());
- addTest(Test_org_eclipse_swt_custom_CLabel.suite());
- addTest(Test_org_eclipse_swt_custom_TableTreeEditor.suite());
- addTest(Test_org_eclipse_swt_custom_TextChangingEvent.suite());
- addTest(Test_org_eclipse_swt_custom_ScrolledComposite.suite());
- addTest(Test_org_eclipse_swt_custom_TreeEditor.suite());
- addTest(Test_org_eclipse_swt_custom_PopupList.suite());
- addTest(Test_org_eclipse_swt_custom_CTabItem.suite());
- addTest(Test_org_eclipse_swt_custom_BusyIndicator.suite());
- //addTest(Test_org_eclipse_swt_custom_StyledText.suite());
- addTest(Test_org_eclipse_swt_custom_ControlEditor.suite());
- addTest(Test_org_eclipse_swt_custom_ST.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolder.suite());
-
- addTest(Test_org_eclipse_swt_events_ControlEvent.suite());
- addTest(Test_org_eclipse_swt_events_ModifyEvent.suite());
- addTest(Test_org_eclipse_swt_events_ArmEvent.suite());
- addTest(Test_org_eclipse_swt_events_ShellEvent.suite());
- addTest(Test_org_eclipse_swt_events_TypedEvent.suite());
- addTest(Test_org_eclipse_swt_events_PaintEvent.suite());
- addTest(Test_org_eclipse_swt_events_VerifyEvent.suite());
- addTest(Test_org_eclipse_swt_events_KeyEvent.suite());
- addTest(Test_org_eclipse_swt_events_TraverseEvent.suite());
- addTest(Test_org_eclipse_swt_events_MouseTrackAdapter.suite());
- addTest(Test_org_eclipse_swt_events_DisposeEvent.suite());
- addTest(Test_org_eclipse_swt_events_SelectionEvent.suite());
- addTest(Test_org_eclipse_swt_events_HelpEvent.suite());
- addTest(Test_org_eclipse_swt_events_FocusEvent.suite());
- addTest(Test_org_eclipse_swt_events_MouseEvent.suite());
- addTest(Test_org_eclipse_swt_events_MenuEvent.suite());
- addTest(Test_org_eclipse_swt_events_TreeEvent.suite());
-
- addTest(Test_org_eclipse_swt_printing_PrintDialog.suite());
- addTest(Test_org_eclipse_swt_printing_PrinterData.suite());
- addTest(Test_org_eclipse_swt_printing_Printer.suite());
-
- addTest(Test_org_eclipse_swt_program_Program.suite());
-
-// addTest(Test_org_eclipse_swt_dnd_FileTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSourceAdapter.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTargetAdapter.suite());
-// addTest(Test_org_eclipse_swt_dnd_TextTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSourceEvent.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSource.suite());
-// addTest(Test_org_eclipse_swt_dnd_DND.suite());
-// addTest(Test_org_eclipse_swt_dnd_TransferData.suite());
-// addTest(Test_org_eclipse_swt_dnd_RTFTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_Clipboard.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTargetEvent.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTarget.suite());
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java
deleted file mode 100644
index 7c5b773d39..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.tests.junit;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing all of the widget test cases.
- */
-public class AllWidgetTests {
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_widgets_MenuItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ToolItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_CoolItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Caret.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Event.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TypedListener.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Menu.suite());
- //suite.addTest(Test_org_eclipse_swt_widgets_Tracker.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite());
-
- suite.addTest(Test_org_eclipse_swt_widgets_Shell.suite());
- //suite.addTest(Test_org_eclipse_swt_widgets_Decorations.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Label.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Button.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_List.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Text.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Sash.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Combo.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Group.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ToolBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Table.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Canvas.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Scale.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Slider.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Composite.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_CoolBar.suite());
-
- suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FileDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_MessageBox.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java
deleted file mode 100644
index f8d53a6e7c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.tests.junit;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing widgets that have been emulated on Motif.
- */
-public class EmulatedWidgetsTests {
-
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Table.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java
deleted file mode 100644
index a5862fbb3b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java
+++ /dev/null
@@ -1,1021 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Use this test class to validate an implementation of the StyledTextContent
- * interface. To perform the validation, copy this class to the package where
- * your StyledTextContent implementation lives. Then specify the fully qualified
- * name of your StyledTextContent class as an argument to the main method of this
- * class.
- *
- * NOTE: This test class assumes that your StyledTextContent implementation
- * handles the following delimiters:
- *
- * /r
- * /n
- * /r/n
- */
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import java.io.*;
-import java.lang.reflect.*;
-public class StyledTextContentSpec implements TextChangeListener {
- static String contentClassName;
- static int failCount = 0;
- static int errorCount = 0;
- Class contentClass = null;
- StyledTextContent contentInstance = null;
- int verify = 0;
- Method currentMethod = null;
- boolean failed = false;
- StyledText widget = null;
- Shell shell = null;
-
-public StyledTextContentSpec() {
-}
-public void assert(String message, boolean condition) {
- System.out.print("\t" + currentMethod.getName() + " " + message);
- if (!condition)
- fail(message);
- else
- System.out.println(" passed");
-}
-public void fail(String message) {
- failed = true;
- System.out.println(" FAILED");
- failCount++;
-}
-public StyledTextContent getContentInstance() {
- contentInstance.setText("");
- widget.setContent(contentInstance);
- return contentInstance;
-}
-public static String getTestText() {
- return
- "This is the first line.\r\n" +
- "This is the second line.\r\n" +
- "This is the third line.\r\n" +
- "This is the fourth line.\r\n" +
- "This is the fifth line.\r\n" +
- "\r\n" +
- "This is the first line again.\r\n" +
- "This is the second line again.\r\n" +
- "This is the third line again.\r\n" +
- "This is the fourth line again.\r\n" +
- "This is the fifth line again.\r\n" +
- "\r\n" +
- "This is the first line once again.\r\n" +
- "This is the second line once again.\r\n" +
- "This is the third line once again.\r\n" +
- "This is the fourth line once again.\r\n" +
- "This is the fifth line once again.";
-}
-public static void main(String[] args) {
- StyledTextContentSpec spec = new StyledTextContentSpec();
- if (args.length > 0) {
- contentClassName = args[0];
- } else {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$
- box.open();
- return;
- }
- spec.run();
- System.out.println();
- System.out.println(failCount + " TEST FAILURES.");
- System.out.println(errorCount + " UNEXPECTED ERRORS.");
-}
-public void run() {
- if (contentClassName.equals("")) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$
- box.open();
- return;
- }
- if (contentClass == null) {
- try {
- contentClass = Class.forName(contentClassName);
- } catch (ClassNotFoundException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class:\n" + contentClassName + "\nnot found"); //$NON-NLS-1$
- box.open();
- return;
- }
- }
- try {
- contentInstance = (StyledTextContent)contentClass.newInstance();
- } catch (IllegalAccessException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Unable to access content class:\n" + contentClassName); //$NON-NLS-1$
- box.open();
- return;
- } catch (InstantiationException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Unable to instantiate content class:\n" + contentClassName); //$NON-NLS-1$
- box.open();
- return;
- }
- Class clazz;
- clazz = this.getClass();
- Method[] methods = clazz.getDeclaredMethods();
- for (int i=0; i<methods.length; i++) {
- setUp();
- currentMethod = methods[i];
- failed = false;
- try {
- if (currentMethod.getName().startsWith("test_")) {
- System.out.println();
- System.out.println(currentMethod.getName() + "...");
- currentMethod.invoke(this, new Object[0]);
- if (!failed) {
- System.out.println("PASSED.");
- } else {
- System.out.println("FAILED");
- }
- }
- } catch (InvocationTargetException ex) {
- System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.getTargetException().toString());
- System.out.println("FAILED");
- errorCount++;
- } catch (Exception ex) {
- System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.toString());
- System.out.println("FAILED");
- errorCount++;
- }
- if (verify != 0) {
- verify = 0;
- contentInstance.removeTextChangeListener(this);
- }
- tearDown();
- }
-}
-public void textSet(TextChangedEvent event) {
-}
-public void textChanged(TextChangedEvent event) {
-}
-public void textChanging(TextChangingEvent event) {
- switch (verify) {
- case 1 : {
- assert(":1a:", event.replaceLineCount == 0);
- assert(":1b:", event.newLineCount == 1);
- break;
- }
- case 2 : {
- assert(":2a:", event.replaceLineCount == 2);
- assert(":2b:", event.newLineCount == 0);
- break;
- }
- case 3 : {
- assert(":3a:", event.replaceLineCount == 0);
- assert(":3b:", event.newLineCount == 2);
- break;
- }
- case 4: {
- assert(":4:", false);
- break;
- }
- case 5 : {
- assert(":5a:", event.replaceLineCount == 0);
- assert(":5b:", event.newLineCount == 1);
- break;
- }
- case 6 : {
- assert(":6a:", event.replaceLineCount == 1);
- assert(":6b:", event.newLineCount == 0);
- break;
- }
- case 8 : {
- assert(":8a:", event.replaceLineCount == 1);
- assert(":8b:", event.newLineCount == 0);
- break;
- }
- case 9 : {
- assert(":9a:", event.replaceLineCount == 1);
- assert(":9b:", event.newLineCount == 0);
- break;
- }
- case 10:{
- assert(":10:", false);
- break;
- }
- case 11: {
- assert(":11:", false);
- break;
- }
- case 12: {
- assert(":12a:", event.replaceLineCount == 0);
- assert(":12b:", event.newLineCount == 1);
- break;
- }
- case 13: {
- assert(":13a:", event.replaceLineCount == 0);
- assert(":13b:", event.newLineCount == 1);
- break;
- }
- case 14: {
- assert(":14:", false);
- break;
- }
- case 15: {
- assert(":15a:", event.replaceLineCount == 1);
- assert(":15b:", event.newLineCount == 2);
- break;
- }
- case 16:{
- assert(":16:", false);
- break;
- }
- case 17: {
- assert(":17:", false);
- break;
- }
- case 18: {
- assert(":18a:", event.replaceLineCount == 0);
- assert(":18b:", event.newLineCount == 2);
- break;
- }
- case 19: {
- assert(":19a:", event.replaceLineCount == 0);
- assert(":19b:", event.newLineCount == 3);
- break;
- }
- case 20: {
- assert(":20:", false);
- break;
- }
- }
-}
-public void test_Insert() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(0, 0, "test\n ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("test\n This\nis a test\r"));
- assert(":1b:", content.getLineCount() == 4);
- assert(":1c:", content.getLine(0).equals("test"));
- assert(":1d:", content.getLine(1).equals(" This"));
- assert(":1e:", content.getLine(2).equals("is a test"));
- assert(":1f:", content.getLine(3).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 0, "*** ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\n*** is a test\r"));
- assert(":2b:", content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals("*** is a test"));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("Line 1\r\nLine 2");
- content.replaceTextRange(0, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("\rLine 1\r\nLine 2"));
- assert(":3b:", content.getLineCount() == 3);
- assert(":3c:", content.getLine(0).equals(""));
- assert(":3d:", content.getLine(1).equals("Line 1"));
- assert(":3e:", content.getLine(2).equals("Line 2"));
- content.replaceTextRange(9, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3f:", newText.equals("\rLine 1\r\n\rLine 2"));
- assert(":3g:", content.getLineCount() == 4);
- assert(":3h:", content.getLine(0).equals(""));
- assert(":3i:", content.getLine(1).equals("Line 1"));
- assert(":3j:", content.getLine(2).equals(""));
- assert(":3k:", content.getLine(3).equals("Line 2"));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("\nThis\nis a test\r"));
- assert(":4b:", content.getLineCount() == 4);
- assert(":4c:", content.getLine(0).equals(""));
- assert(":4d:", content.getLine(1).equals("This"));
- assert(":4e:", content.getLine(2).equals("is a test"));
- assert(":4f:", content.getLine(3).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(7, 0, "\r\nnewLine");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("This\nis\r\nnewLine a test\r"));
- assert(":5b:", content.getLineCount() == 4);
- assert(":5c:", content.getLine(0).equals("This"));
- assert(":5d:", content.getLine(1).equals("is"));
- assert(":5e:", content.getLine(2).equals("newLine a test"));
- assert(":5f:", content.getLine(3).equals(""));
-
- content.setText("");
- content.replaceTextRange(0, 0, "This\nis\r\nnewLine a test\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("This\nis\r\nnewLine a test\r"));
- assert(":6b:", content.getLineCount() == 4);
- assert(":6c:", content.getLine(0).equals("This"));
- assert(":6d:", content.getLine(1).equals("is"));
- assert(":6e:", content.getLine(2).equals("newLine a test"));
- assert(":6f:", content.getLine(3).equals(""));
-
- // insert at end
- content.setText("This");
- content.replaceTextRange(4, 0, "\n ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", newText.equals("This\n "));
- assert(":7b:", content.getLineCount() == 2);
- assert(":7c:", content.getLine(0).equals("This"));
- assert(":7d:", content.getLine(1).equals(" "));
- content.setText("This\n");
- content.replaceTextRange(5, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7e:", newText.equals("This\n\n"));
- assert(":7f:", content.getLineCount() == 3);
- assert(":7g:", content.getLine(0).equals("This"));
- assert(":7h:", content.getLine(1).equals(""));
- assert(":7i:", content.getLine(2).equals(""));
-
- // insert at beginning
- content.setText("This");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("\nThis"));
- assert(":8b:", content.getLineCount() == 2);
- assert(":8c:", content.getLine(0).equals(""));
- assert(":8d:", content.getLine(1).equals("This"));
-
- // insert text
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 0, "*** ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":9a:", newText.equals("This\n*** is a test\r"));
- assert(":9b:", content.getLineCount() == 3);
- assert(":9c:", content.getLine(0).equals("This"));
- assert(":9d:", content.getLine(1).equals("*** is a test"));
- assert(":9e:", content.getLine(2).equals(""));
-
- content.setText("This\n");
- content.replaceTextRange(5, 0, "line");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":10a:", newText.equals("This\nline"));
- assert(":10b:", content.getLineCount() == 2);
- assert(":10c:", content.getLine(0).equals("This"));
- assert(":10d:", content.getLine(1).equals("line"));
- assert(":10e:", content.getLineAtOffset(8) == 1);
- assert(":10f:", content.getLineAtOffset(9) == 1);
-
- // insert at beginning
- content.setText("This\n");
- content.replaceTextRange(0, 0, "line\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":11a:", newText.equals("line\nThis\n"));
- assert(":11b:", content.getLineCount() == 3);
- assert(":11c:", content.getLine(0).equals("line"));
- assert(":11d:", content.getLine(1).equals("This"));
- assert(":11e:", content.getLineAtOffset(5) == 1);
-
- content.setText("Line 1\r\nLine 2\r\nLine 3");
- content.replaceTextRange(0, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":12a:", newText.equals("\rLine 1\r\nLine 2\r\nLine 3"));
- assert(":12b:", content.getLineCount() == 4);
- assert(":12c:", content.getLine(0).equals(""));
- assert(":12d:", content.getLine(1).equals("Line 1"));
- assert(":12e:", content.getLine(2).equals("Line 2"));
- assert(":12f:", content.getLine(3).equals("Line 3"));
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(7, 0, "Line1a\nLine1b\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":13a:", newText.equals("Line 1\nLine1a\nLine1b\nLine 2\nLine 3"));
- assert(":13b:", content.getLineCount() == 5);
- assert(":13c:", content.getLine(0).equals("Line 1"));
- assert(":13d:", content.getLine(1).equals("Line1a"));
- assert(":13e:", content.getLine(2).equals("Line1b"));
- assert(":13f:", content.getLine(3).equals("Line 2"));
- assert(":13g:", content.getLine(4).equals("Line 3"));
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(11, 0, "l1a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":14a:", newText.equals("Line 1\nLinel1a 2\nLine 3"));
- assert(":14b:", content.getLineCount() == 3);
- assert(":14c:", content.getLine(0).equals("Line 1"));
- assert(":14d:", content.getLine(1).equals("Linel1a 2"));
- assert(":14e:", content.getLine(2).equals("Line 3"));
-
- content.setText("Line 1\nLine 2 is a very long line that spans many words\nLine 3");
- content.replaceTextRange(19, 0, "very, very, ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":15a:", newText.equals("Line 1\nLine 2 is a very, very, very long line that spans many words\nLine 3"));
- assert(":15b:", content.getLineCount() == 3);
- assert(":15c:", content.getLine(0).equals("Line 1"));
- assert(":15d:", content.getLine(1).equals("Line 2 is a very, very, very long line that spans many words"));
- assert(":15e:", content.getLine(2).equals("Line 3"));
-}
-
-public void test_Empty() {
- StyledTextContent content = getContentInstance();
- assert(":1a:", content.getLineCount() == 1);
- assert(":1b:", content.getLine(0).equals(""));
-
- content.setText("test");
- content.replaceTextRange(0,4,"");
- assert(":2a:", content.getLineCount() == 1);
- assert(":2b:", content.getLine(0).equals(""));
-}
-public void test_Line_Conversion() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getLineCount() == 5);
- assert(":1b:", content.getLine(0).equals("This"));
- assert(":1c:", content.getOffsetAtLine(0) == 0);
- assert(":1d:", content.getLine(1).equals("is a test"));
- assert(":1e:", content.getLineAtOffset(4) == 0);
- assert(":1f:", content.getOffsetAtLine(1) == 5);
- assert(":1g:", content.getLine(2).equals("repeat"));
- assert(":1h:", content.getOffsetAtLine(2) == 15);
- assert(":1i:", content.getLine(3).equals("end"));
- assert(":1j:", content.getOffsetAtLine(3) == 22);
- assert(":1k:", content.getLine(4).equals(""));
- assert(":1l:", content.getOffsetAtLine(4) == 26);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getLineCount() == 2);
- assert(":2b:", content.getLine(1).equals("is a test"));
- assert(":2c:", content.getLineAtOffset(4) == 0);
- assert(":2d:", content.getLineAtOffset(5) == 0);
-
- content.setText("This\r\nis a test\r");
- assert(":3a:", content.getLineCount() == 3);
- assert(":3b:", content.getLine(1).equals("is a test"));
- assert(":3c:", content.getLineAtOffset(15) == 1);
-
- content.setText("\r\n");
- assert(":4a:", content.getLineCount() == 2);
- assert(":4b:", content.getLine(0).equals(""));
- assert(":4c:", content.getLine(1).equals(""));
- assert(":4d:", content.getLineAtOffset(0) == 0);
- assert(":4e:", content.getLineAtOffset(1) == 0);
- assert(":4f:", content.getLineAtOffset(2) == 1);
-
- content.setText("\r\n\n\r\r\n");
- assert(":5a:", content.getLineCount() == 5);
- assert(":5b:", content.getLine(0).equals(""));
- assert(":5c:", content.getOffsetAtLine(0) == 0);
- assert(":5d:", content.getLine(1).equals(""));
- assert(":5e:", content.getOffsetAtLine(1) == 2);
- assert(":5f:", content.getLine(2).equals(""));
- assert(":5g:", content.getOffsetAtLine(2) == 3);
- assert(":5h:", content.getLine(3).equals(""));
- assert(":5i:", content.getOffsetAtLine(3) == 4);
- assert(":5j:", content.getLine(4).equals(""));
- assert(":5k:", content.getOffsetAtLine(4) == 6);
-
- content.setText("test\r\rtest2\r\r");
- assert(":6a:", content.getLineCount() == 5);
- assert(":6b:", content.getLine(0).equals("test"));
- assert(":6c:", content.getOffsetAtLine(0) == 0);
- assert(":6d:", content.getLine(1).equals(""));
- assert(":6e:", content.getOffsetAtLine(1) == 5);
- assert(":6f:", content.getLine(2).equals("test2"));
- assert(":6g:", content.getOffsetAtLine(2) == 6);
- assert(":6h:", content.getLine(3).equals(""));
- assert(":6i:", content.getOffsetAtLine(3) == 12);
- assert(":6j:", content.getLine(4).equals(""));
- assert(":6k:", content.getOffsetAtLine(4) == 13);
-}
-public void test_Offset_To_Line() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getLineAtOffset(0) == 0);
- assert(":1b:", content.getLineAtOffset(3) == 0);
- assert(":1c:", content.getLineAtOffset(4) == 0);
- assert(":1d:", content.getLineAtOffset(25) == 3);
- assert(":1e:", content.getLineAtOffset(26) == 4);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getLineAtOffset(5) == 0);
- assert(":2b:", content.getLineAtOffset(6) == 1);
- assert(":2c:", content.getLineAtOffset(10) == 1);
-
- content.setText("\r\n");
- assert(":3a:", content.getLineAtOffset(0) == 0);
- assert(":3b:", content.getLineAtOffset(1) == 0);
- assert(":3c:", content.getLineAtOffset(2) == 1);
-
- content.setText("\r\n\n\r\r\n");
- assert(":4a:", content.getLineAtOffset(0) == 0);
- assert(":4b:", content.getLineAtOffset(1) == 0);
- assert(":4c:", content.getLineAtOffset(2) == 1);
- assert(":4d:", content.getLineAtOffset(3) == 2);
- assert(":4e:", content.getLineAtOffset(4) == 3);
- assert(":4f:", content.getLineAtOffset(5) == 3);
- assert(":4g:", content.getLineAtOffset(6) == 4);
-
- content.setText("\r\n\r\n");
- assert(":5a:", content.getLineAtOffset(0) == 0);
- assert(":5b:", content.getLineAtOffset(1) == 0);
- assert(":5c:", content.getLineAtOffset(2) == 1);
- assert(":5d:", content.getLineAtOffset(3) == 1);
- assert(":5e:", content.getLineAtOffset(4) == 2);
-
- content.setText("\r\r\r\n\r\n");
- assert(":6a:", content.getLineAtOffset(0) == 0);
- assert(":6b:", content.getLineAtOffset(1) == 1);
- assert(":6c:", content.getLineAtOffset(2) == 2);
- assert(":6d:", content.getLineAtOffset(4) == 3);
-
- content.setText("");
- assert(":7a:", content.getLineAtOffset(0) == 0);
-
- content = getContentInstance();
- assert(":8a:", content.getLineAtOffset(0) == 0);
-}
-
-public void test_Line_To_Offset() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getOffsetAtLine(0) == 0);
- assert(":1b:", content.getOffsetAtLine(1) == 5);
- assert(":1c:", content.getOffsetAtLine(2) == 15);
- assert(":1d:", content.getOffsetAtLine(3) == 22);
- assert(":1e:", content.getOffsetAtLine(4) == 26);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getOffsetAtLine(0) == 0);
- assert(":2b:", content.getOffsetAtLine(1) == 6);
-
- content.setText("\r\n");
- assert(":3a:", content.getOffsetAtLine(0) == 0);
- assert(":3b:", content.getOffsetAtLine(1) == 2);
-
- content.setText("\r\n\n\r\r\n");
- assert(":4a:", content.getOffsetAtLine(0) == 0);
- assert(":4b:", content.getOffsetAtLine(1) == 2);
- assert(":4c:", content.getOffsetAtLine(2) == 3);
- assert(":4d:", content.getOffsetAtLine(3) == 4);
- assert(":4e:", content.getOffsetAtLine(4) == 6);
-
- content.setText("\r\ntest\r\n");
- assert(":5a:", content.getOffsetAtLine(0) == 0);
- assert(":5b:", content.getOffsetAtLine(1) == 2);
- assert(":5c:", content.getOffsetAtLine(2) == 8);
-}
-
-public void test_Delete() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(6, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("This\nia test\r"));
- assert(":1b:", content.getLine(0).equals("This"));
- assert(":1c:", content.getLine(1).equals("ia test"));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\n\r"));
- assert(":2b:",content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals(""));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(21, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("This\nis a test\nline 3"));
- assert(":3b:", content.getLineCount() == 3);
- assert(":3c:", content.getLine(0).equals("This"));
- assert(":3d:", content.getLine(1).equals("is a test"));
- assert(":3e:", content.getLine(2).equals("line 3"));
-
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(0, 5, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("is a test\nline 3\nline 4"));
- assert(":4b:", content.getLineCount() == 3);
- assert(":4c:", content.getLine(0).equals("is a test"));
- assert(":4d:", content.getLine(1).equals("line 3"));
- assert(":4e:", content.getLine(2).equals("line 4"));
- content.replaceTextRange(16, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4f:", newText.equals("is a test\nline 3"));
- assert(":4g:", content.getLine(0).equals("is a test"));
- assert(":4h:", content.getLine(1).equals("line 3"));
- content.replaceTextRange(9, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4i:", newText.equals("is a test"));
- assert(":4j:", content.getLine(0).equals("is a test"));
- content.replaceTextRange(1, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4k:", newText.equals("i"));
- assert(":4l:", content.getLine(0).equals("i"));
- content.replaceTextRange(0, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4m:", newText.equals(""));
- assert(":4n:", content.getLine(0).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("This\n\r"));
- assert(":5b:",content.getLineCount() == 3);
- assert(":5c:", content.getLine(0).equals("This"));
- assert(":5d:", content.getLine(1).equals(""));
- assert(":5e:", content.getLine(2).equals(""));
-
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- content.replaceTextRange(4, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("L1\r\nL4\r\n"));
- assert(":6b:",content.getLineCount() == 3);
- assert(":6c:", content.getLine(0).equals("L1"));
- assert(":6d:", content.getLine(1).equals("L4"));
- assert(":6e:", content.getLine(2).equals(""));
-
- content.setText("\nL1\r\nL2");
- content.replaceTextRange(0, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", newText.equals("L1\r\nL2"));
- assert(":7b:",content.getLineCount() == 2);
- assert(":7c:", content.getLine(0).equals("L1"));
- assert(":7d:", content.getLine(1).equals("L2"));
-
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("\nL1\r\nL2"));
- assert(":8b:",content.getLineCount() == 3);
- assert(":8c:", content.getLine(0).equals(""));
- assert(":8d:", content.getLine(1).equals("L1"));
- assert(":8e:", content.getLine(2).equals("L2"));
-
- content.setText("\nLine 1\nLine 2\n");
- content.replaceTextRange(0, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":9a:", newText.equals("\nLine 2\n"));
- assert(":9b:", content.getLineCount() == 3);
- assert(":9c:", content.getLine(0).equals(""));
- assert(":9d:", content.getLine(1).equals("Line 2"));
- assert(":9e:", content.getLine(2).equals(""));
-
- content.setText("Line 1\nLine 2\n");
- content.replaceTextRange(6, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":10a:", newText.equals("Line 1"));
- assert(":10b:", content.getLineCount() == 1);
- assert(":10c:", content.getLine(0).equals("Line 1"));
-
- content.setText("Line one is short\r\nLine 2 is a longer line\r\nLine 3\n");
- content.replaceTextRange(12, 17, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":11a:", newText.equals("Line one is a longer line\r\nLine 3\n"));
- assert(":11b:", content.getLineCount() == 3);
- assert(":11c:", content.getLine(0).equals("Line one is a longer line"));
- assert(":11d:", content.getLine(1).equals("Line 3"));
- assert(":11e:", content.getLine(2).equals(""));
-
-}
-public void test_Replace() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 4, "a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("This\na test\r"));
- assert(":1b:",content.getLineCount() == 3);
- assert(":1c:", content.getLine(0).equals("This"));
- assert(":1d:", content.getLine(1).equals("a test"));
- assert(":1e:", content.getLine(2).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 2, "was");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\nwas a test\r"));
- assert(":2b:",content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals("was a test"));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("This is a test\r");
- content.replaceTextRange(5, 2, "was");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("This was a test\r"));
- assert(":3b:",content.getLineCount() == 2);
- assert(":3c:", content.getLine(0).equals("This was a test"));
- assert(":3d:", content.getLineAtOffset(15) == 0);
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(0, 7, "La\nLb\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("La\nLb\nLine 2\nLine 3"));
- assert(":4b:", content.getLine(0).equals("La"));
- assert(":4c:", content.getLine(1).equals("Lb"));
- assert(":4d:", content.getLine(2).equals("Line 2"));
- assert(":4e:", content.getLine(3).equals("Line 3"));
-
- content.setText(getTestText());
- newText = content.getTextRange(0, content.getCharCount());
- int start = content.getOffsetAtLine(6);
- int end = content.getOffsetAtLine(11);
- content.replaceTextRange(start, end - start, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", content.getLineCount() == 12);
- assert(":5a:", content.getLine(5).equals(""));
- assert(":5a:", content.getLine(6).equals(""));
- start = content.getOffsetAtLine(7);
- content.replaceTextRange(start, content.getCharCount() - start, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", content.getLineCount() == 8);
- assert(":5a:", content.getLine(5).equals(""));
- assert(":5a:", content.getLine(6).equals(""));
- assert(":5a:", content.getLine(7).equals(""));
-
-}
-public void test_Special_Cases() {
- String newText;
- StyledTextContent content = getContentInstance();
- assert(":0a:", content.getLineCount() == 1);
- assert(":0b:", content.getOffsetAtLine(0) == 0);
-
- content.setText("This is the input/output text component.");
- content.replaceTextRange(0, 0, "\n");
- assert(":1a:", content.getLine(0).equals(""));
- content.replaceTextRange(1, 0, "\n");
- assert(":1b:",content.getLine(0).equals(""));
- content.replaceTextRange(2, 0, "\n");
- assert(":1c:",content.getLine(0).equals(""));
- content.replaceTextRange(3, 0, "\n");
- assert(":1d:",content.getLine(0).equals(""));
- content.replaceTextRange(4, 0, "\n");
- assert(":1e:",content.getLine(0).equals(""));
- content.replaceTextRange(5, 0, "\n");
- assert(":1f:",content.getLine(0).equals(""));
- content.replaceTextRange(6, 0, "\n");
- assert(":1g:",content.getLine(0).equals(""));
- content.replaceTextRange(7, 0, "\n");
- assert(":1h:",content.getLine(0).equals(""));
-
- content.setText("This is the input/output text component.");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("\nThis is the input/output text component."));
- assert(":2b:", content.getLine(0).equals(""));
- assert(":2c:", content.getLine(1).equals("This is the input/output text component."));
- content.replaceTextRange(1, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2d:", newText.equals("\n\nThis is the input/output text component."));
- assert(":2e:", content.getLine(0).equals(""));
- assert(":2f:", content.getLine(1).equals(""));
- assert(":2g:", content.getLine(2).equals("This is the input/output text component."));
-
- content.replaceTextRange(2, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("\n\n\nThis is the input/output text component."));
- assert(":3b:", content.getLine(0).equals(""));
- assert(":3c:", content.getLine(1).equals(""));
- assert(":3d:", content.getLine(2).equals(""));
- assert(":3e:", content.getLine(3).equals("This is the input/output text component."));
- content.replaceTextRange(3, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3f:", newText.equals("\n\n\n\nThis is the input/output text component."));
- assert(":3g:", content.getLine(0).equals(""));
- assert(":3h:", content.getLine(1).equals(""));
- assert(":3i:", content.getLine(2).equals(""));
- assert(":3j:", content.getLine(3).equals(""));
- assert(":3k:", content.getLine(4).equals("This is the input/output text component."));
-
- content.replaceTextRange(3, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("\n\n\nThis is the input/output text component."));
- assert(":4b:", content.getLine(0).equals(""));
- assert(":4c:", content.getLine(1).equals(""));
- assert(":4d:", content.getLine(2).equals(""));
- assert(":4e:", content.getLine(3).equals("This is the input/output text component."));
- content.replaceTextRange(2, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4f:", newText.equals("\n\nThis is the input/output text component."));
- assert(":4g:", content.getLine(0).equals(""));
- assert(":4h:", content.getLine(1).equals(""));
- assert(":4i:", content.getLine(2).equals("This is the input/output text component."));
-
- content.replaceTextRange(2, 0, "a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("\n\naThis is the input/output text component."));
- assert(":5b:", content.getLine(0).equals(""));
- assert(":5c:", content.getLine(1).equals(""));
- assert(":5d:", content.getLine(2).equals("aThis is the input/output text component."));
-
- content.setText("abc\r\ndef");
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("ac\r\ndef"));
- assert(":6b:", content.getLineCount() == 2);
- assert(":6c:", content.getLine(0).equals("ac"));
- assert(":6d:", content.getLine(1).equals("def"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6e:", newText.equals("a\r\ndef"));
- assert(":6f:", content.getLineCount() == 2);
- assert(":6g:", content.getLine(0).equals("a"));
- assert(":6h:", content.getLine(1).equals("def"));
- content.replaceTextRange(1, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6i:", newText.equals("adef"));
- assert(":6j:", content.getLineCount() == 1);
- assert(":6k:", content.getLine(0).equals("adef"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6l:", newText.equals("aef"));
- assert(":6m:", content.getLineCount() == 1);
- assert(":6n:", content.getLine(0).equals("aef"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6o:", newText.equals("af"));
- assert(":6p:", content.getLineCount() == 1);
- assert(":6q:", content.getLine(0).equals("af"));
-
- content.setText("abc");
- content.replaceTextRange(0, 1, "1");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", content.getLineCount() == 1);
- assert(":7b:", newText.equals("1bc"));
- assert(":7c:", content.getLine(0).equals("1bc"));
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7d:", newText.equals("\n1bc"));
- assert(":7e:", content.getLineCount() == 2);
- assert(":7f:", content.getLine(0).equals(""));
- assert(":7g:", content.getLine(1).equals("1bc"));
-
- content = getContentInstance();
- content.replaceTextRange(0,0,"a");
-
- content.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}");
- content.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}"));
- assert(":8b:", content.getLineCount() == 6);
- assert(":8c:", content.getLine(0).equals("package test;"));
- assert(":8d:", content.getLine(1).equals("\t/*Line 1"));
- assert(":8e:", content.getLine(2).equals("\t * Line 2"));
- assert(":8f:", content.getLine(3).equals("\t */"));
- assert(":8g:", content.getLine(4).equals("public class SimpleClass {"));
- assert(":8h:", content.getLine(5).equals("}"));
-}
-public void test_Text_Changed_Event() {
- StyledTextContent content = getContentInstance();
- content.addTextChangeListener(this);
- verify = 1;
- content.setText("testing");
- content.replaceTextRange(0, 0, "\n");
-
- verify = 2;
- content.setText("\n\n");
- content.replaceTextRange(0, 2, "a");
-
- verify = 3;
- content.setText("a");
- content.replaceTextRange(0, 1, "\n\n");
-
- verify = 4;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {assert(":4:", true);}
-
- verify = 5;
- content.setText("Line 1\r\nLine 2");
- content.replaceTextRange(0, 0, "\r");
-
- verify = 6;
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(21, 7, "");
-
- verify = 7;
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
-
- verify = 8;
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
-
- verify = 9;
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test");
-
- verify = 10;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 1, "");}
- catch (IllegalArgumentException ex) {assert(":10:", true);}
-
- verify = 11;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(1, 2, "");}
- catch (IllegalArgumentException ex) {assert(":11:", true);}
-
- verify = 12;
- content.setText("L1\r");
- content.replaceTextRange(3, 0, "\n");
-
- verify = 13;
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "\r");
-
- verify = 14;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 0, "test");}
- catch (IllegalArgumentException ex) {assert(":14:", true);}
-
- verify = 15;
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test\n\n");
-
- verify = 16;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 1, "test\r\n");}
- catch (IllegalArgumentException ex) {assert(":16:", true);}
-
- verify = 17;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(1, 2, "test\n\n");}
- catch (IllegalArgumentException ex) {assert(":17:", true);}
-
- verify = 18;
- content.setText("L1\r");
- content.replaceTextRange(3, 0, "\ntest\r\n");
-
- verify = 19;
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "test\r\r\r");
- verify = 20;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {assert(":20:", true);}
-
-
- verify = 0;
- content.removeTextChangeListener(this);
-}
-public void test_Delimiter_Special_Cases() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1:", newText.equals("\nL1\r\nL2"));
-
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test\n\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2:", newText.equals("L1test\n\n"));
-
-// content.setText("L1\r\n");
-// content.replaceTextRange(3, 1, "test\r\n");
-// newText = content.getTextRange(0, content.getCharCount());
-// assert(":3:", newText.equals("L1\rtest\r\n"));
-
-// content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
-// content.replaceTextRange(1, 2, "test\n\n");
-// newText = content.getTextRange(0, content.getCharCount());
-// assert(":4:", newText.equals("Ltest\n\n\nL2\r\nL3\r\nL4\r\n"));
-
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "test\r\r\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3:", newText.equals("L1test\r\r\r\n"));
-}
-protected void setUp() {
- // create shell
- shell = new Shell ();
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
- // create widget
- widget = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- widget.setLayoutData(spec);
- shell.open ();
-}
-protected void tearDown() {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- shell = null;
-
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java
deleted file mode 100644
index ddc5532aa1..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * Platform-specific constants used in SWT test cases.
- */ public class SwtJunit {
-
- public static final String testFontName;
- public final static boolean isLinux = System.getProperty("os.name").equals("Linux");
- public final static boolean isAIX = System.getProperty("os.name").equals("AIX");
- public final static boolean isMotif = isLinux || isAIX;
- public final static boolean isWindows = !isMotif;
-
- static {
- if (isMotif) {
- testFontName = "misc-fixed";
- }
- else {
- testFontName = "Helvetica";
- }
- }
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java
deleted file mode 100644
index 9e9b1d1533..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.swt.tests.junit;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.lang.reflect.*;
-import junit.framework.*;
- public class SwtTestCase extends TestCase {
- /**
- * The following flags are used to mark test cases that
- * are not handled correctly by SWT at this time, or test
- * cases that maybe themselves dubious (eg. when the correct
- * behaviour may not be clear). Most of these flagged test
- * cases involve handling error conditions.
- *
- * Setting these flags to true will run those tests. As api
- * is implemented this gives us a convenient way to include
- * it in the junit tests.
- */
-
- // call should result in an 'Argument cannot be null' SWT error
- public static boolean fCheckSwtNullExceptions = false;
-
- // an out of range value is not handled gracefully according to our SWT policy
- public static boolean fCheckOutOfRangeBehaviour = false;
-
- // run test cases that may themselves be dubious
- // these should be eventually checked to see if
- // there is a valid failure or the test is bogus
- public static boolean fCheckBogusTestCases = false;
-
- // check multi select tree api
- public static boolean fCheckMultiSelectTree = false;
-
- // check visibility api (eg in menu)
- public static boolean fCheckVisibility = false;
-
- // run test cases that check SWT policy not covered by the flags above
- public static boolean fCheckSWTPolicy = false;
-
- // make dialog open calls, operator must then close them
- public static boolean fTestDialogOpen = false;
-
-public SwtTestCase(String name) {
- super(name);
-}
-
-static public void assertEquals(String message, Object expected[], Object actual[]) {
- if (expected == null && actual == null)
- return;
- boolean equal = false;
- if (expected != null && actual != null && expected.length == actual.length) {
- if (expected.length == 0)
- return;
- equal = true;
- for (int i = 0; i < expected.length; i++) {
- if (!expected[i].equals(actual[i])) {
- equal = false;
- }
- }
- }
- if (!equal) {
- failNotEquals(message, expected, actual);
- }
-}
-static public void assertEquals(Object expected[], Object actual[]) {
- assertEquals(null, expected, actual);
-}
-static public void assertEquals(String message, int expected[], int actual[]) {
- if (expected == null && actual == null)
- return;
- boolean equal = false;
- if (expected != null && actual != null && expected.length == actual.length) {
- if (expected.length == 0)
- return;
- equal = true;
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] != actual[i]) {
- equal = false;
- }
- }
- }
- if (!equal) {
- failNotEquals(message, expected, actual);
- }
-}
-static public void assertEquals(int expected[], int actual[]) {
- assertEquals(null, expected, actual);
-}
-// copied exactly from junit.framework.TestCase so that it can be called from here even though private
-static private void failNotEquals(String message, Object expected, Object actual) {
- String formatted= "";
- if (message != null)
- formatted= message+" ";
- fail(formatted+"expected:<"+expected+"> but was:<"+actual+">");
-}
-
-protected void warnUnimpl(String message) {
- //System.out.println(this.getClass() + ": " + message);
- AllTests.unimplementedMethods++;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java
deleted file mode 100644
index 4cde60cef4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.SWT
- *
- * @see org.eclipse.swt.SWT
- */
-public class Test_org_eclipse_swt_SWT extends SwtTestCase {
-
-public Test_org_eclipse_swt_SWT(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- // Do nothing. Class SWT is not intended to be subclassed.
-}
-
-public void test_getMessageLjava_lang_String() {
- boolean passed = false;
- try {
- passed = false;
- SWT.getMessage(null);
- } catch (IllegalArgumentException ex) {
- passed = true;
- }
- assertTrue ("did not correctly throw exception with null argument", passed);
- try {
- SWT.getMessage("SWT_Yes");
- } catch (Throwable t) {
- fail ("exception " + t + " generated for SWT_Yes");
- }
- assertTrue (
- "invalid key did not return as itself",
- "_NOT_FOUND_IN_PROPERTIES_".equals(SWT.getMessage("_NOT_FOUND_IN_PROPERTIES_")));
-
-}
-
-public void test_getPlatform() {
- // Can't test the list of platforms, since this may change,
- // so just test to see it returns something.
- assertTrue ("returned null platform name", SWT.getPlatform() != null);
-}
-
-public void test_getVersion() {
- // Test that the version number which is returned is reasonable.
- int ver = SWT.getVersion();
- assertTrue ("unreasonable value returned", ver > 0 && ver < 1000000);
-}
-
-public void test_errorI() {
- // Test that we throw the expected kinds of errors for the given error types.
- boolean passed = false;
- try {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- } catch (IllegalArgumentException ex) {
- passed = true;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for ERROR_NULL_ARGUMENT", passed);
- passed = false;
- try {
- SWT.error(SWT.ERROR_FAILED_EXEC);
- } catch (SWTException ex) {
- passed = true;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for ERROR_FAILED_EXEC", passed);
- passed = false;
- try {
- SWT.error(SWT.ERROR_NO_HANDLES);
- } catch (SWTError ex) {
- passed = true;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for ERROR_NO_HANDLES", passed);
- passed = false;
- try {
- SWT.error(-1);
- } catch (SWTError ex) {
- passed = true;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for error(-1)", passed);
-}
-
-public void test_errorILjava_lang_Throwable() {
- // Test that the causing throwable is filled in.
- Throwable cause = new RuntimeException("Just for testing");
- boolean passed = false;
- try {
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT, cause);
- } catch (SWTException ex) {
- passed = ex.throwable == cause;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for ERROR_UNSUPPORTED_FORMAT", passed);
- passed = false;
- try {
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED, cause);
- } catch (SWTError ex) {
- passed = ex.throwable == cause;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for ERROR_NOT_IMPLEMENTED", passed);
- passed = false;
- try {
- SWT.error(-1, cause);
- } catch (SWTError ex) {
- passed = ex.throwable == cause;
- } catch (Throwable t) { }
- assertTrue ("did not correctly throw exception for error(-1)", passed);
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_SWT((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_getMessageLjava_lang_String");
- methodNames.addElement("test_getPlatform");
- methodNames.addElement("test_getVersion");
- methodNames.addElement("test_errorI");
- methodNames.addElement("test_errorILjava_lang_Throwable");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_getMessageLjava_lang_String")) test_getMessageLjava_lang_String();
- else if (getName().equals("test_getPlatform")) test_getPlatform();
- else if (getName().equals("test_getVersion")) test_getVersion();
- else if (getName().equals("test_errorI")) test_errorI();
- else if (getName().equals("test_errorILjava_lang_Throwable")) test_errorILjava_lang_Throwable();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java
deleted file mode 100644
index 0859c66ff3..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.SWTError
- *
- * @see org.eclipse.swt.SWTError
- */
-public class Test_org_eclipse_swt_SWTError extends SwtTestCase {
-
-public Test_org_eclipse_swt_SWTError(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- assertTrue (
- "did not fill in code properly",
- new SWTError().code == SWT.ERROR_UNSPECIFIED);
-}
-
-public void test_ConstructorLjava_lang_String() {
- assertTrue (
- "did not fill in code properly",
- new SWTError("An uninteresting message").code == SWT.ERROR_UNSPECIFIED);
-}
-
-public void test_ConstructorI() {
- assertTrue (
- "did not fill in code properly",
- new SWTError(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO);
-}
-
-public void test_ConstructorILjava_lang_String() {
- assertTrue (
- "did not fill in code properly",
- new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code
- == SWT.ERROR_CANNOT_BE_ZERO);
-}
-
-public void test_getMessage() {
- assertTrue (
- "did not include creation string in result",
- new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage()
- .indexOf("An interesting message") >= 0);
-}
-
-public void test_printStackTraceLjava_io_PrintStream() {
- // Should not test. Result varies by VM.
-}
-
-public void test_printStackTraceLjava_io_PrintWriter() {
- // Should not test. Result varies by VM.
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_SWTError((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLjava_lang_String");
- methodNames.addElement("test_ConstructorI");
- methodNames.addElement("test_ConstructorILjava_lang_String");
- methodNames.addElement("test_getMessage");
- methodNames.addElement("test_printStackTraceLjava_io_PrintStream");
- methodNames.addElement("test_printStackTraceLjava_io_PrintWriter");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String();
- else if (getName().equals("test_ConstructorI")) test_ConstructorI();
- else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String();
- else if (getName().equals("test_getMessage")) test_getMessage();
- else if (getName().equals("test_printStackTraceLjava_io_PrintStream")) test_printStackTraceLjava_io_PrintStream();
- else if (getName().equals("test_printStackTraceLjava_io_PrintWriter")) test_printStackTraceLjava_io_PrintWriter();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java
deleted file mode 100644
index 7c00990023..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.SWTException
- *
- * @see org.eclipse.swt.SWTException
- */
-public class Test_org_eclipse_swt_SWTException extends SwtTestCase {
-
-public Test_org_eclipse_swt_SWTException(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- assertTrue (
- "did not fill in code properly",
- new SWTException().code == SWT.ERROR_UNSPECIFIED);
-}
-
-public void test_ConstructorLjava_lang_String() {
- assertTrue (
- "did not fill in code properly",
- new SWTException("An uninteresting message").code == SWT.ERROR_UNSPECIFIED);
-}
-
-public void test_ConstructorI() {
- assertTrue (
- "did not fill in code properly",
- new SWTException(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO);
-}
-
-public void test_ConstructorILjava_lang_String() {
- assertTrue (
- "did not fill in code properly",
- new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code
- == SWT.ERROR_CANNOT_BE_ZERO);
-}
-
-public void test_getMessage() {
- assertTrue (
- "did not include creation string in result",
- new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage()
- .indexOf("An interesting message") >= 0);
-}
-
-public void test_printStackTraceLjava_io_PrintStream() {
- // Should not test. Result varies by VM.
-}
-
-public void test_printStackTraceLjava_io_PrintWriter() {
- // Should not test. Result varies by VM.
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_SWTException((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLjava_lang_String");
- methodNames.addElement("test_ConstructorI");
- methodNames.addElement("test_ConstructorILjava_lang_String");
- methodNames.addElement("test_getMessage");
- methodNames.addElement("test_printStackTraceLjava_io_PrintStream");
- methodNames.addElement("test_printStackTraceLjava_io_PrintWriter");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String();
- else if (getName().equals("test_ConstructorI")) test_ConstructorI();
- else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String();
- else if (getName().equals("test_getMessage")) test_getMessage();
- else if (getName().equals("test_printStackTraceLjava_io_PrintStream")) test_printStackTraceLjava_io_PrintStream();
- else if (getName().equals("test_printStackTraceLjava_io_PrintWriter")) test_printStackTraceLjava_io_PrintWriter();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java
deleted file mode 100644
index 329c1d9b17..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.AnimatedProgress
- *
- * @see org.eclipse.swt.custom.AnimatedProgress
- */
-public class Test_org_eclipse_swt_custom_AnimatedProgress extends Test_org_eclipse_swt_widgets_Canvas {
-
-public Test_org_eclipse_swt_custom_AnimatedProgress(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_clear() {
- warnUnimpl("Test test_clear not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_start() {
- warnUnimpl("Test test_start not written");
-}
-
-public void test_stop() {
- warnUnimpl("Test test_stop not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_AnimatedProgress((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_clear");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_start");
- methodNames.addElement("test_stop");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_clear")) test_clear();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_start")) test_start();
- else if (getName().equals("test_stop")) test_stop();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java
deleted file mode 100644
index 8181e4cb6e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentEvent
- *
- * @see org.eclipse.swt.custom.BidiSegmentEvent
- */
-public class Test_org_eclipse_swt_custom_BidiSegmentEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_BidiSegmentEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java
deleted file mode 100644
index bd67bfe26a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BidiSegmentEvent;
-import org.eclipse.swt.custom.BidiSegmentListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.internal.BidiUtil;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentListener
- *
- * @see org.eclipse.swt.custom.BidiSegmentListener
- */
-public class Test_org_eclipse_swt_custom_BidiSegmentListener extends SwtTestCase {
- Shell shell;
- StyledText text;
- boolean listenerCalled;
- String line = "Line1";
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-public Test_org_eclipse_swt_custom_BidiSegmentListener(String name) {
- super(name);
-}
-
-private boolean isBidi() {
- return BidiUtil.isBidiPlatform();
-}
-protected void setUp() {
- shell = new Shell();
- text = new StyledText(shell, SWT.NULL);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentListener((String)e.nextElement()));
- }
- return suite;
-}
-protected void tearDown() {
- shell.dispose();
-}
-private void testListener(final String message, final int[] segments, boolean exceptionExpected) {
- boolean exceptionThrown = false;
- BidiSegmentListener listener = new BidiSegmentListener() {
- public void lineGetSegments(BidiSegmentEvent event) {
- assertEquals(message + " incorrect BidiSegmentEvent", 0, event.lineOffset);
- assertEquals(message + " incorrect BidiSegmentEvent", line, event.lineText);
-
- event.segments = segments;
- listenerCalled = true;
- }
- };
-
- listenerCalled = false;
- try {
- text.addBidiSegmentListener(listener);
- text.getLocationAtOffset(0);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- finally {
- text.removeBidiSegmentListener(listener);
- }
- if (exceptionExpected) {
- assertTrue(message + " expected exception not thrown", exceptionThrown);
- }
- else {
- assertTrue(message + " unexpected exception thrown", exceptionThrown == false);
- }
- if (isBidi()) {
- assertTrue(message + " listener not called", listenerCalled);
- }
- else {
- assertTrue(message + " listener called when it shouldn't be", listenerCalled == false);
- }
-}
-private void testStyleRangeSegmenting(final int[] segments, int[] boldRanges) {
- boolean exceptionThrown = false;
- BidiSegmentListener listener = new BidiSegmentListener() {
- public void lineGetSegments(BidiSegmentEvent event) {
- assertEquals(" incorrect BidiSegmentEvent", 0, event.lineOffset);
- assertEquals(" incorrect BidiSegmentEvent", line, event.lineText);
-
- event.segments = segments;
- listenerCalled = true;
- }
- };
-
- listenerCalled = false;
- try {
- text.addBidiSegmentListener(listener);
- text.setStyleRange(null);
- for (int i=0; i<boldRanges.length; i+=2) {
- StyleRange styleRange = new StyleRange(boldRanges[i], boldRanges[i+1], null, null, SWT.BOLD);
- text.setStyleRange(styleRange);
- };
- text.getLocationAtOffset(0);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- finally {
- text.removeBidiSegmentListener(listener);
- }
- assertTrue(" unexpected exception thrown", exceptionThrown == false);
- if (isBidi()) {
- assertTrue(" listener not called", listenerCalled);
- }
- else {
- assertTrue(" listener called when it shouldn't be", listenerCalled == false);
- }
-}
-
-public void test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent() {
- int lineLength = line.length();
-
- text.setText(line);
- // should not cause an exception
- testListener(":a:", null, false);
- testListener(":b:", new int[] {0, lineLength / 2, lineLength}, false);
- testListener(":c:", new int[] {0, lineLength / 2}, false);
-
- // should all cause an exception on a bidi platform
- if (isBidi()) {
- testListener(":d:", new int[] {lineLength / 2}, true);
- testListener(":e:", new int[] {0, 1, 1, lineLength / 2}, true);
- testListener(":f:", new int[] {0, 1, 2, lineLength + 1}, true);
- testListener(":g:", new int[] {0, 1, lineLength + 1, lineLength + 1}, true);
- testListener(":h:", new int[] {0, 2, 1}, true);
- testListener(":i:", new int[] {0, -1, 2}, true);
- testListener(":j:", new int[] {0, -1, 2}, true);
- }
-
- // test bold segmenting
- line = "this is a line with 50 chars - **** **** **** ****";
- text.setText(line);
- // should segment as int[] {0,5,5,2,12,3,20,5}
- testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,5,5,2,12,3,20,5});
- // should segment as int[] {0,5,5,1,7,3,10,3,15,5,20,5}
- testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,6,7,6,15,10});
- // should segment as int[] {0,5,5,5,10,5}
- testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {0,15});
- // should segment as int[] {0,5}
- testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,5});
- // should segment as int[] {2,3}
- testStyleRangeSegmenting(new int[] {0,5}, new int[] {2,3});
- // should segment as int[] {0,2}
- testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,2});
- // should segment as int[] {10,5}
- testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {10,5});
- // should segment as int[] {12,3}
- testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {12,3});
- // should segment as int[] {3,2,5,5,10,3,21,4,25,3}
- testStyleRangeSegmenting(new int[] {0,5,10,15,20,25,30}, new int[] {3,10,21,7});
- // should segment as int[] {10,2}
- line = "test1test2/r/n";
- text.setText(line);
- testStyleRangeSegmenting(new int[] {0,5}, new int[] {10,2});
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent")) test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java
deleted file mode 100644
index 39a8b5d883..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.BusyIndicator
- *
- * @see org.eclipse.swt.custom.BusyIndicator
- */
-public class Test_org_eclipse_swt_custom_BusyIndicator extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_BusyIndicator(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable() {
- warnUnimpl("Test test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_BusyIndicator((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable")) test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
deleted file mode 100644
index 7bb672a5d5..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CCombo
- *
- * @see org.eclipse.swt.custom.CCombo
- */
-public class Test_org_eclipse_swt_custom_CCombo extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_CCombo(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_addLjava_lang_String() {
- warnUnimpl("Test test_addLjava_lang_String not written");
-}
-
-public void test_addLjava_lang_StringI() {
- warnUnimpl("Test test_addLjava_lang_StringI not written");
-}
-
-public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_clearSelection() {
- warnUnimpl("Test test_clearSelection not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_deselectI() {
- warnUnimpl("Test test_deselectI not written");
-}
-
-public void test_deselectAll() {
- warnUnimpl("Test test_deselectAll not written");
-}
-
-public void test_getChildren() {
- warnUnimpl("Test test_getChildren not written");
-}
-
-public void test_getItemI() {
- warnUnimpl("Test test_getItemI not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItemHeight() {
- warnUnimpl("Test test_getItemHeight not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionIndex() {
- warnUnimpl("Test test_getSelectionIndex not written");
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_getTextHeight() {
- warnUnimpl("Test test_getTextHeight not written");
-}
-
-public void test_getTextLimit() {
- warnUnimpl("Test test_getTextLimit not written");
-}
-
-public void test_indexOfLjava_lang_String() {
- warnUnimpl("Test test_indexOfLjava_lang_String not written");
-}
-
-public void test_indexOfLjava_lang_StringI() {
- warnUnimpl("Test test_indexOfLjava_lang_StringI not written");
-}
-
-public void test_isFocusControl() {
- warnUnimpl("Test test_isFocusControl not written");
-}
-
-public void test_redrawIIIIZ() {
- warnUnimpl("Test test_redrawIIIIZ not written");
-}
-
-public void test_removeI() {
- warnUnimpl("Test test_removeI not written");
-}
-
-public void test_removeII() {
- warnUnimpl("Test test_removeII not written");
-}
-
-public void test_removeLjava_lang_String() {
- warnUnimpl("Test test_removeLjava_lang_String not written");
-}
-
-public void test_removeAll() {
- warnUnimpl("Test test_removeAll not written");
-}
-
-public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_selectI() {
- warnUnimpl("Test test_selectI not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setFocus() {
- warnUnimpl("Test test_setFocus not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setItemILjava_lang_String() {
- warnUnimpl("Test test_setItemILjava_lang_String not written");
-}
-
-public void test_setItems$Ljava_lang_String() {
- warnUnimpl("Test test_setItems$Ljava_lang_String not written");
-}
-
-public void test_setSelectionLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_setSelectionLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public void test_setTextLimitI() {
- warnUnimpl("Test test_setTextLimitI not written");
-}
-
-public void test_setVisibleZ() {
- warnUnimpl("Test test_setVisibleZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CCombo((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addLjava_lang_String");
- methodNames.addElement("test_addLjava_lang_StringI");
- methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_clearSelection");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_deselectI");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getChildren");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getTextHeight");
- methodNames.addElement("test_getTextLimit");
- methodNames.addElement("test_indexOfLjava_lang_String");
- methodNames.addElement("test_indexOfLjava_lang_StringI");
- methodNames.addElement("test_isFocusControl");
- methodNames.addElement("test_redrawIIIIZ");
- methodNames.addElement("test_removeI");
- methodNames.addElement("test_removeII");
- methodNames.addElement("test_removeLjava_lang_String");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_selectI");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setFocus");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setItemILjava_lang_String");
- methodNames.addElement("test_setItems$Ljava_lang_String");
- methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setTextLimitI");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String();
- else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI();
- else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_clearSelection")) test_clearSelection();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_deselectI")) test_deselectI();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getChildren")) test_getChildren();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getTextHeight")) test_getTextHeight();
- else if (getName().equals("test_getTextLimit")) test_getTextLimit();
- else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String();
- else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI();
- else if (getName().equals("test_isFocusControl")) test_isFocusControl();
- else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ();
- else if (getName().equals("test_removeI")) test_removeI();
- else if (getName().equals("test_removeII")) test_removeII();
- else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_selectI")) test_selectI();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String();
- else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String();
- else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setTextLimitI")) test_setTextLimitI();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java
deleted file mode 100644
index 4a7b0aff04..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CLabel
- *
- * @see org.eclipse.swt.custom.CLabel
- */
-public class Test_org_eclipse_swt_custom_CLabel extends Test_org_eclipse_swt_widgets_Canvas {
-
-public Test_org_eclipse_swt_custom_CLabel(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getAlignment() {
- warnUnimpl("Test test_getAlignment not written");
-}
-
-public void test_getImage() {
- warnUnimpl("Test test_getImage not written");
-}
-
-public void test_setToolTipTextLjava_lang_String() {
- warnUnimpl("Test test_setToolTipTextLjava_lang_String not written");
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_getToolTipText() {
- warnUnimpl("Test test_getToolTipText not written");
-}
-
-public void test_setAlignmentI() {
- warnUnimpl("Test test_setAlignmentI not written");
-}
-
-public void test_setBackground$Lorg_eclipse_swt_graphics_Color$I() {
- warnUnimpl("Test test_setBackground$Lorg_eclipse_swt_graphics_Color$I not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public void test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI() {
- warnUnimpl("Test test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CLabel((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getAlignment");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getToolTipText");
- methodNames.addElement("test_setAlignmentI");
- methodNames.addElement("test_setBackground$Lorg_eclipse_swt_graphics_Color$I");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getAlignment")) test_getAlignment();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getToolTipText")) test_getToolTipText();
- else if (getName().equals("test_setAlignmentI")) test_setAlignmentI();
- else if (getName().equals("test_setBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setBackground$Lorg_eclipse_swt_graphics_Color$I();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Image")) test_setBackgroundLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI")) test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
deleted file mode 100644
index 9c20b42337..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CTabFolder
- *
- * @see org.eclipse.swt.custom.CTabFolder
- */
-public class Test_org_eclipse_swt_custom_CTabFolder extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_CTabFolder(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() {
- warnUnimpl("Test test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_onFocusLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_onFocusLorg_eclipse_swt_widgets_Event not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getTabHeight() {
- warnUnimpl("Test test_getTabHeight not written");
-}
-
-public void test_getItemI() {
- warnUnimpl("Test test_getItemI not written");
-}
-
-public void test_getItemLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionIndex() {
- warnUnimpl("Test test_getSelectionIndex not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_custom_CTabItem() {
- warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_CTabItem not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() {
- warnUnimpl("Test test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I() {
- warnUnimpl("Test test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I not written");
-}
-
-public void test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setBorderVisibleZ() {
- warnUnimpl("Test test_setBorderVisibleZ not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setSelectionForegroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setSelectionForegroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ() {
- warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ not written");
-}
-
-public void test_setInsertMarkIZ() {
- warnUnimpl("Test test_setInsertMarkIZ not written");
-}
-
-public void test_setSelectionI() {
- warnUnimpl("Test test_setSelectionI not written");
-}
-
-public void test_setSelectionLorg_eclipse_swt_custom_CTabItem() {
- warnUnimpl("Test test_setSelectionLorg_eclipse_swt_custom_CTabItem not written");
-}
-
-public void test_setTabHeightI() {
- warnUnimpl("Test test_setTabHeightI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CTabFolder((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_onFocusLorg_eclipse_swt_widgets_Event");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getTabHeight");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_CTabItem");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I");
- methodNames.addElement("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setBorderVisibleZ");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ");
- methodNames.addElement("test_setInsertMarkIZ");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionLorg_eclipse_swt_custom_CTabItem");
- methodNames.addElement("test_setTabHeightI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_onFocusLorg_eclipse_swt_widgets_Event")) test_onFocusLorg_eclipse_swt_widgets_Event();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getTabHeight")) test_getTabHeight();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_CTabItem")) test_indexOfLorg_eclipse_swt_custom_CTabItem();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I();
- else if (getName().equals("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image")) test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color")) test_setSelectionForegroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ")) test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ();
- else if (getName().equals("test_setInsertMarkIZ")) test_setInsertMarkIZ();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionLorg_eclipse_swt_custom_CTabItem")) test_setSelectionLorg_eclipse_swt_custom_CTabItem();
- else if (getName().equals("test_setTabHeightI")) test_setTabHeightI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java
deleted file mode 100644
index 6d66c88714..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderAdapter
- *
- * @see org.eclipse.swt.custom.CTabFolderAdapter
- */
-public class Test_org_eclipse_swt_custom_CTabFolderAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_CTabFolderAdapter(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() {
- warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderAdapter((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java
deleted file mode 100644
index bebee02f7d..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderEvent
- *
- * @see org.eclipse.swt.custom.CTabFolderEvent
- */
-public class Test_org_eclipse_swt_custom_CTabFolderEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_CTabFolderEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java
deleted file mode 100644
index adab373b9f..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderListener
- *
- * @see org.eclipse.swt.custom.CTabFolderListener
- */
-public class Test_org_eclipse_swt_custom_CTabFolderListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_CTabFolderListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() {
- warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java
deleted file mode 100644
index 3200942e87..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.CTabItem
- *
- * @see org.eclipse.swt.custom.CTabItem
- */
-public class Test_org_eclipse_swt_custom_CTabItem extends Test_org_eclipse_swt_widgets_Item {
-
- CTabFolder cTabFolder;
- CTabItem cTabItem;
-
-public Test_org_eclipse_swt_custom_CTabItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- cTabFolder = new CTabFolder(shell, SWT.NONE);
- cTabItem = new CTabItem(cTabFolder, SWT.NONE);
- setWidget(cTabItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderI not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderII not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getControl() {
- warnUnimpl("Test test_getControl not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getDisabledImage() {
- warnUnimpl("Test test_getDisabledImage not written");
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getToolTipText() {
- warnUnimpl("Test test_getToolTipText not written");
-}
-
-public void test_setControlLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public void test_setToolTipTextLjava_lang_String() {
- warnUnimpl("Test test_setToolTipTextLjava_lang_String not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_CTabItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getDisabledImage");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getToolTipText");
- methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderII();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getDisabledImage")) test_getDisabledImage();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getToolTipText")) test_getToolTipText();
- else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java
deleted file mode 100644
index 4b1d933442..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ControlEditor
- *
- * @see org.eclipse.swt.custom.ControlEditor
- */
-public class Test_org_eclipse_swt_custom_ControlEditor extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_ControlEditor(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Composite() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Composite not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getEditor() {
- warnUnimpl("Test test_getEditor not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ControlEditor((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Composite");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getEditor");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Composite")) test_ConstructorLorg_eclipse_swt_widgets_Composite();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getEditor")) test_getEditor();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java
deleted file mode 100644
index d8ea7d14d5..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyEvent
- *
- * @see org.eclipse.swt.custom.ExtendedModifyEvent
- */
-public class Test_org_eclipse_swt_custom_ExtendedModifyEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_ExtendedModifyEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() {
- // this method tested by other test classes
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java
deleted file mode 100644
index e7742013ce..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java
+++ /dev/null
@@ -1,315 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyListener
- *
- * @see org.eclipse.swt.custom.ExtendedModifyListener
- */
-public class Test_org_eclipse_swt_custom_ExtendedModifyListener extends SwtTestCase {
- Shell shell;
- StyledText styledText;
- int verify = -1;
-
-public Test_org_eclipse_swt_custom_ExtendedModifyListener(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-protected void setUp() {
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
- shell.open();
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyListener((String)e.nextElement()));
- }
- return suite;
-}
-public void test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent() {
- ExtendedModifyListener listener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent event) {
- switch(verify) {
- case 1 : {
- assertTrue(":1a:", event.start == 0);
- assertTrue(":1b:", event.length == 1);
- assertTrue(":1c:", event.replacedText.equals(""));
- break;
- }
- case 2 : {
- assertTrue(":2a:", event.start == 0);
- assertTrue(":2b:", event.length == 1);
- assertTrue(":2c:", event.replacedText.equals("\n\n"));
- break;
- }
- case 3 : {
- assertTrue(":3a:", event.start == 0);
- assertTrue(":3b:", event.length == 2);
- assertTrue(":3c:", event.replacedText.equals("a"));
- break;
- }
- case 4: {
- assertTrue(":4:", false);
- break;
- }
- case 5 : {
- assertTrue(":5a:", event.start == 0);
- assertTrue(":5b:", event.length == 1);
- assertTrue(":5c:", event.replacedText.equals(""));
- break;
- }
- case 6 : {
- assertTrue(":6a:", event.start == 21);
- assertTrue(":6b:", event.length == 0);
- assertTrue(":6c:", event.replacedText.equals("\nline 4"));
- break;
- }
- case 7 : {
- assertTrue(":7a:", event.start == 5);
- assertTrue(":7b:", event.length == 0);
- assertTrue(":7c:", event.replacedText.equals("is a test"));
- break;
- }
- case 8 : {
- assertTrue(":8a:", event.start == 7);
- assertTrue(":8b:", event.length == 0);
- assertTrue(":8c:", event.replacedText.equals("\r\n"));
- break;
- }
- case 9 : {
- assertTrue(":9a:", event.start == 2);
- assertTrue(":9b:", event.length == 4);
- assertTrue(":9c:", event.replacedText.equals("\r\n"));
- break;
- }
- case 10:{
- assertTrue(":10:", false);
- break;
- }
- case 11: {
- assertTrue(":11:", false);
- break;
- }
- case 12: {
- assertTrue(":12a:", event.start == 3);
- assertTrue(":12b:", event.length == 1);
- assertTrue(":12c:", event.replacedText.equals(""));
- break;
- }
- case 13: {
- assertTrue(":13a:", event.start == 2);
- assertTrue(":13b:", event.length == 1);
- assertTrue(":13c:", event.replacedText.equals(""));
- break;
- }
- case 14: {
- assertTrue(":14:", false);
- break;
- }
- case 15: {
- assertTrue(":15a:", event.start == 2);
- assertTrue(":15b:", event.length == 6);
- assertTrue(":15c:", event.replacedText.equals("\r\n"));
- break;
- }
- case 16:{
- assertTrue(":16:", false);
- break;
- }
- case 17: {
- assertTrue(":17:", false);
- break;
- }
- case 18: {
- assertTrue(":18a:", event.start == 3);
- assertTrue(":18b:", event.length == 7);
- assertTrue(":18c:", event.replacedText.equals(""));
- break;
- }
- case 19: {
- assertTrue(":19a:", event.start == 2);
- assertTrue(":19b:", event.length == 7);
- assertTrue(":19c:", event.replacedText.equals(""));
- break;
- }
- case 20: {
- assertTrue(":20:", false);
- break;
- }
- case 21: {
- assertTrue(":21a:", event.start == 0);
- assertTrue(":21b:", event.length == 16);
- assertTrue(":21c:", event.replacedText.equals("L1\r\nL2\r\nL3\r\nL4\r\n"));
- break;
- }
- }
- }
- };
- styledText.addExtendedModifyListener(listener);
-
- boolean exceptionHandled = false;
- verify = 0;
- styledText.setText("testing");
- verify = 1;
- styledText.replaceTextRange(0, 0, "\n");
-
- verify = 0;
- styledText.setText("\n\n");
- verify = 2;
- styledText.replaceTextRange(0, 2, "a");
-
- verify = 0;
- styledText.setText("a");
- verify = 3;
- styledText.replaceTextRange(0, 1, "\n\n");
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 4;
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":4: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("Line 1\r\nLine 2");
- verify = 5;
- styledText.replaceTextRange(0, 0, "\r");
-
- verify = 0;
- styledText.setText("This\nis a test\nline 3\nline 4");
- verify = 6;
- styledText.replaceTextRange(21, 7, "");
-
- verify = 0;
- styledText.setText("This\nis a test\r");
- verify = 7;
- styledText.replaceTextRange(5, 9, "");
-
- verify = 0;
- styledText.setText("\nL1\r\nL2\r\n");
- verify = 8;
- styledText.replaceTextRange(7, 2, "");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 9;
- styledText.replaceTextRange(2, 2, "test");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 10;
- try {styledText.replaceTextRange(3, 1, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":10: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 11;
- try {styledText.replaceTextRange(1, 2, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":11: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r");
- verify = 12;
- styledText.replaceTextRange(3, 0, "\n");
-
- verify = 0;
- styledText.setText("L1\n");
- verify = 13;
- styledText.replaceTextRange(2, 0, "\r");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 14;
- try {styledText.replaceTextRange(3, 0, "test");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":14: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 15;
- styledText.replaceTextRange(2, 2, "test\n\n");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 16;
- try {styledText.replaceTextRange(3, 1, "test\r\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":16: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 17;
- try {styledText.replaceTextRange(1, 2, "test\n\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":17: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r");
- verify = 18;
- styledText.replaceTextRange(3, 0, "\ntest\r\n");
-
- verify = 0;
- styledText.setText("L1\n");
- verify = 19;
- styledText.replaceTextRange(2, 0, "test\r\r\r");
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 20;
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":20: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 21;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- styledText.removeExtendedModifyListener(listener);
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent")) test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java
deleted file mode 100644
index b469a568aa..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundEvent
- *
- * @see org.eclipse.swt.custom.LineBackgroundEvent
- */
-public class Test_org_eclipse_swt_custom_LineBackgroundEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_LineBackgroundEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() {
- // this method tested by other test classes
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java
deleted file mode 100644
index bc2bff2e10..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundListener
- *
- * @see org.eclipse.swt.custom.LineBackgroundListener
- */
-public class Test_org_eclipse_swt_custom_LineBackgroundListener extends SwtTestCase {
- Shell shell;
- StyledText styledText;
-
-public Test_org_eclipse_swt_custom_LineBackgroundListener(String name) {
- super(name);
-}
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-protected void setUp() {
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
- shell.open();
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundListener((String)e.nextElement()));
- }
- return suite;
-}
-protected void tearDown() {
-}
-
-public void test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent() {
- LineBackgroundListener listener = new LineBackgroundListener() {
- public void lineGetBackground(LineBackgroundEvent event) {
- assertTrue(":1:", event.lineOffset==0);
- assertTrue(":2:",event.lineText.equals("0123456789"));
- }
- };
- styledText.addLineBackgroundListener(listener);
- styledText.setText("0123456789");
- // force get line bg callback
- styledText.selectAll();
- styledText.copy();
- styledText.removeLineBackgroundListener(listener);
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent")) test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java
deleted file mode 100644
index 61f68d439e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.LineStyleEvent
- *
- * @see org.eclipse.swt.custom.LineStyleEvent
- */
-public class Test_org_eclipse_swt_custom_LineStyleEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_LineStyleEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() {
- // this method tested by other test classes
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_LineStyleEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java
deleted file mode 100644
index 79bb718658..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.LineStyleListener
- *
- * @see org.eclipse.swt.custom.LineStyleListener
- */
-public class Test_org_eclipse_swt_custom_LineStyleListener extends SwtTestCase {
- Shell shell;
- StyledText styledText;
-
-public Test_org_eclipse_swt_custom_LineStyleListener(String name) {
- super(name);
-}
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-protected void setUp() {
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
- shell.open();
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_LineStyleListener((String)e.nextElement()));
- }
- return suite;
-}
-protected void tearDown() {
-}
-
-public void test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent() {
- LineStyleListener listener = new LineStyleListener() {
- public void lineGetStyle(LineStyleEvent event) {
- assertTrue(":1:", event.lineOffset==0);
- assertTrue(":2:",event.lineText.equals("0123456789"));
- }
- };
- styledText.addLineStyleListener(listener);
- styledText.setText("0123456789");
- // force get line styles callback
- styledText.getLocationAtOffset(5);
- styledText.removeLineStyleListener(listener);
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent")) test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java
deleted file mode 100644
index 8886ae131c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.PopupList
- *
- * @see org.eclipse.swt.custom.PopupList
- */
-public class Test_org_eclipse_swt_custom_PopupList extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_PopupList(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written");
-}
-
-public void test_getFont() {
- warnUnimpl("Test test_getFont not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getMinimumWidth() {
- warnUnimpl("Test test_getMinimumWidth not written");
-}
-
-public void test_openLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_openLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_selectLjava_lang_String() {
- warnUnimpl("Test test_selectLjava_lang_String not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setItems$Ljava_lang_String() {
- warnUnimpl("Test test_setItems$Ljava_lang_String not written");
-}
-
-public void test_setMinimumWidthI() {
- warnUnimpl("Test test_setMinimumWidthI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_PopupList((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_getFont");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getMinimumWidth");
- methodNames.addElement("test_openLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_selectLjava_lang_String");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setItems$Ljava_lang_String");
- methodNames.addElement("test_setMinimumWidthI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_getFont")) test_getFont();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getMinimumWidth")) test_getMinimumWidth();
- else if (getName().equals("test_openLorg_eclipse_swt_graphics_Rectangle")) test_openLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_selectLjava_lang_String")) test_selectLjava_lang_String();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String();
- else if (getName().equals("test_setMinimumWidthI")) test_setMinimumWidthI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java
deleted file mode 100644
index 506813cf0e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ST
- *
- * @see org.eclipse.swt.custom.ST
- */
-public class Test_org_eclipse_swt_custom_ST extends SwtTestCase {
-
-public Test_org_eclipse_swt_custom_ST(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- // doesn't make sense to test this, ST is constants class
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ST((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java
deleted file mode 100644
index 7a212624d7..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.SashForm
- *
- * @see org.eclipse.swt.custom.SashForm
- */
-public class Test_org_eclipse_swt_custom_SashForm extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_SashForm(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getOrientation() {
- warnUnimpl("Test test_getOrientation not written");
-}
-
-public void test_getMaximizedControl() {
- warnUnimpl("Test test_getMaximizedControl not written");
-}
-
-public void test_getWeights() {
- warnUnimpl("Test test_getWeights not written");
-}
-
-public void test_layoutZ() {
- warnUnimpl("Test test_layoutZ not written");
-}
-
-public void test_setOrientationI() {
- warnUnimpl("Test test_setOrientationI not written");
-}
-
-public void test_setLayoutLorg_eclipse_swt_widgets_Layout() {
- warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written");
-}
-
-public void test_setMaximizedControlLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setMaximizedControlLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setWeights$I() {
- warnUnimpl("Test test_setWeights$I not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_SashForm((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getOrientation");
- methodNames.addElement("test_getMaximizedControl");
- methodNames.addElement("test_getWeights");
- methodNames.addElement("test_layoutZ");
- methodNames.addElement("test_setOrientationI");
- methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout");
- methodNames.addElement("test_setMaximizedControlLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setWeights$I");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getOrientation")) test_getOrientation();
- else if (getName().equals("test_getMaximizedControl")) test_getMaximizedControl();
- else if (getName().equals("test_getWeights")) test_getWeights();
- else if (getName().equals("test_layoutZ")) test_layoutZ();
- else if (getName().equals("test_setOrientationI")) test_setOrientationI();
- else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout();
- else if (getName().equals("test_setMaximizedControlLorg_eclipse_swt_widgets_Control")) test_setMaximizedControlLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setWeights$I")) test_setWeights$I();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java
deleted file mode 100644
index cebf531ff6..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ScrolledComposite
- *
- * @see org.eclipse.swt.custom.ScrolledComposite
- */
-public class Test_org_eclipse_swt_custom_ScrolledComposite extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_ScrolledComposite(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_getAlwaysShowScrollBars() {
- warnUnimpl("Test test_getAlwaysShowScrollBars not written");
-}
-
-public void test_getContent() {
- warnUnimpl("Test test_getContent not written");
-}
-
-public void test_layoutZ() {
- warnUnimpl("Test test_layoutZ not written");
-}
-
-public void test_setAlwaysShowScrollBarsZ() {
- warnUnimpl("Test test_setAlwaysShowScrollBarsZ not written");
-}
-
-public void test_setContentLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setExpandHorizontalZ() {
- warnUnimpl("Test test_setExpandHorizontalZ not written");
-}
-
-public void test_setExpandVerticalZ() {
- warnUnimpl("Test test_setExpandVerticalZ not written");
-}
-
-public void test_setLayoutLorg_eclipse_swt_widgets_Layout() {
- warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written");
-}
-
-public void test_setMinHeightI() {
- warnUnimpl("Test test_setMinHeightI not written");
-}
-
-public void test_setMinSizeLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_setMinSizeLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_setMinSizeII() {
- warnUnimpl("Test test_setMinSizeII not written");
-}
-
-public void test_setMinWidthI() {
- warnUnimpl("Test test_setMinWidthI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ScrolledComposite((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_getAlwaysShowScrollBars");
- methodNames.addElement("test_getContent");
- methodNames.addElement("test_layoutZ");
- methodNames.addElement("test_setAlwaysShowScrollBarsZ");
- methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setExpandHorizontalZ");
- methodNames.addElement("test_setExpandVerticalZ");
- methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout");
- methodNames.addElement("test_setMinHeightI");
- methodNames.addElement("test_setMinSizeLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setMinSizeII");
- methodNames.addElement("test_setMinWidthI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_getAlwaysShowScrollBars")) test_getAlwaysShowScrollBars();
- else if (getName().equals("test_getContent")) test_getContent();
- else if (getName().equals("test_layoutZ")) test_layoutZ();
- else if (getName().equals("test_setAlwaysShowScrollBarsZ")) test_setAlwaysShowScrollBarsZ();
- else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setExpandHorizontalZ")) test_setExpandHorizontalZ();
- else if (getName().equals("test_setExpandVerticalZ")) test_setExpandVerticalZ();
- else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout();
- else if (getName().equals("test_setMinHeightI")) test_setMinHeightI();
- else if (getName().equals("test_setMinSizeLorg_eclipse_swt_graphics_Point")) test_setMinSizeLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setMinSizeII")) test_setMinSizeII();
- else if (getName().equals("test_setMinWidthI")) test_setMinWidthI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java
deleted file mode 100644
index 2e3b719fb1..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.StackLayout
- *
- * @see org.eclipse.swt.custom.StackLayout
- */
-public class Test_org_eclipse_swt_custom_StackLayout extends Test_org_eclipse_swt_widgets_Layout {
-
-public Test_org_eclipse_swt_custom_StackLayout(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() {
- warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written");
-}
-
-public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() {
- warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_StackLayout((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ");
- methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ();
- else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
deleted file mode 100644
index ab6647fb1b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-import java.util.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.StyleRange
- *
- * @see org.eclipse.swt.custom.StyleRange
- */
-public class Test_org_eclipse_swt_custom_StyleRange extends SwtTestCase {
- final static RGB RED = new RGB(255,0,0);
- final static RGB BLUE = new RGB(0,0,255);
- final static RGB GREEN = new RGB(0,255,0);
- Hashtable colors = new Hashtable();
-public Test_org_eclipse_swt_custom_StyleRange(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-private Color getColor(RGB rgb) {
- return (Color)colors.get(rgb);
-}
-protected void initializeColors() {
- Display display = Display.getDefault();
- colors.put(RED, new Color (display, RED));
- colors.put(GREEN, new Color (display, GREEN));
- colors.put(BLUE, new Color (display, BLUE));
-}
-
-protected void setUp() {
- initializeColors();
-}
-
-protected void tearDown() {
- Enumeration enum = colors.keys();
- while (enum.hasMoreElements()) {
- Color color = (Color)colors.get((RGB)enum.nextElement());
- color.dispose();
- }
-}
-
-public void test_Constructor() {
- StyleRange styleRange = new StyleRange();
- assertTrue(":a:", styleRange.start == 0);
- assertTrue(":a:", styleRange.length == 0);
- assertTrue(":a:", styleRange.foreground == null);
- assertTrue(":a:", styleRange.background == null);
- assertTrue(":a:", styleRange.fontStyle == SWT.NORMAL);
-}
-
-public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color() {
- StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE));
- assertTrue(":b:", styleRange.start == 5);
- assertTrue(":b:", styleRange.length == 10);
- assertTrue(":b:", styleRange.foreground == getColor(RED));
- assertTrue(":b:", styleRange.background == getColor(BLUE));
- assertTrue(":b:", styleRange.fontStyle == SWT.NORMAL);
-}
-
-public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI() {
- StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
- assertTrue(":c:", styleRange.start == 5);
- assertTrue(":c:", styleRange.length == 10);
- assertTrue(":c:", styleRange.foreground == getColor(RED));
- assertTrue(":c:", styleRange.background == getColor(BLUE));
- assertTrue(":c:", styleRange.fontStyle == SWT.BOLD);
-}
-
-public void test_equalsLjava_lang_Object() {
- StyleRange styleRangeA = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
- StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
- StyleRange styleRangeC = new StyleRange(5, 10, getColor(BLUE), getColor(BLUE), SWT.BOLD);
- StyleRange styleRangeD = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
- StyleRange styleRangeE = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.BOLD);
- StyleRange styleRangeF = new StyleRange(5, 11, getColor(RED), getColor(RED), SWT.BOLD);
- StyleRange styleRangeG = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.NORMAL);
- assertTrue(":d:", styleRangeA.equals(styleRangeB));
- assertTrue(":d:",!styleRangeA.equals(styleRangeC));
- assertTrue(":d:",!styleRangeA.equals(styleRangeD));
- assertTrue(":d:",!styleRangeA.equals(styleRangeE));
- assertTrue(":d:",!styleRangeA.equals(styleRangeF));
- assertTrue(":d:",!styleRangeA.equals(styleRangeG));
-}
-
-public void test_hashCode() {
- // does not make sense to test
-}
-
-public void test_isUnstyled() {
- StyleRange styleRangeA = new StyleRange(5, 10, null, null, SWT.NORMAL);
- StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), null, SWT.NORMAL);
- StyleRange styleRangeC = new StyleRange(5, 10, null, null, SWT.BOLD);
- StyleRange styleRangeD = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeE = new StyleRange(5, 10, null, null);
- assertTrue(":e:", styleRangeA.isUnstyled());
- assertTrue(":e:",!styleRangeB.isUnstyled());
- assertTrue(":e:",!styleRangeC.isUnstyled());
- assertTrue(":e:",!styleRangeD.isUnstyled());
- assertTrue(":e:", styleRangeE.isUnstyled());
-}
-
-public void test_similarToLorg_eclipse_swt_custom_StyleRange() {
- StyleRange styleRangeA = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeB = new StyleRange(5, 5, getColor(RED), getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeC = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeD = new StyleRange(6, 10, getColor(BLUE), getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeE = new StyleRange(6, 10, getColor(RED), getColor(RED), SWT.NORMAL);
- StyleRange styleRangeF = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
- assertTrue(":f:", styleRangeA.similarTo(styleRangeB));
- assertTrue(":f:", styleRangeA.similarTo(styleRangeC));
- assertTrue(":f:", !styleRangeA.similarTo(styleRangeD));
- assertTrue(":f:", !styleRangeA.similarTo(styleRangeE));
- assertTrue(":f:", !styleRangeA.similarTo(styleRangeF));
-}
-
-public void test_clone() {
- StyleRange styleRangeA = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL);
- StyleRange styleRangeB = (StyleRange)styleRangeA.clone();
- assertTrue(":g:", styleRangeA.equals(styleRangeB));
-}
-
-public void test_toString() {
- StyleRange styleRange = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL);
- styleRange.toString();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_StyleRange((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_isUnstyled");
- methodNames.addElement("test_similarToLorg_eclipse_swt_custom_StyleRange");
- methodNames.addElement("test_clone");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_isUnstyled")) test_isUnstyled();
- else if (getName().equals("test_similarToLorg_eclipse_swt_custom_StyleRange")) test_similarToLorg_eclipse_swt_custom_StyleRange();
- else if (getName().equals("test_clone")) test_clone();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
deleted file mode 100644
index f75c3b5f84..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
+++ /dev/null
@@ -1,3652 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.*;
-
-import junit.framework.*;
-import junit.textui.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.printing.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.BidiUtil;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.StyledText
- *
- * @see org.eclipse.swt.custom.StyledText
- */
-public class Test_org_eclipse_swt_custom_StyledText extends Test_org_eclipse_swt_widgets_Canvas {
-
-StyledText text;
-final static RGB RED = new RGB(255,0,0);
-final static RGB BLUE = new RGB(0,0,255);
-final static RGB GREEN = new RGB(0,255,0);
-final static RGB YELLOW = new RGB(255,255,0);
-final static RGB CYAN = new RGB(0,255,255);
-final static RGB PURPLE = new RGB(255,0,255);
-Hashtable colors = new Hashtable();
-private boolean listenerCalled;
-private boolean listener2Called;
-
-public Test_org_eclipse_swt_custom_StyledText(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- initializeColors();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-}
-
-protected void tearDown() {
- Enumeration enum = colors.keys();
- while (enum.hasMoreElements()) {
- Color color = (Color)colors.get((RGB)enum.nextElement());
- color.dispose();
- }
- super.tearDown();
-
-}
-
-// this method must not be public so that the auto-gen tool keeps it
-private StyleRange[] defaultStyles() {
- return new StyleRange[] {
- getStyle(0,48,RED,YELLOW),
- getStyle(58,10,BLUE,CYAN),
- getStyle(68,10,GREEN,PURPLE)};
-}
-// this method must not be public so that the auto-gen tool keeps it
-protected void getLineBackgrounds() {
- for (int i=0; i<text.getLineCount(); i++) {
- text.getLineBackground(i);
- }
-}
-// this method must not be public so that the auto-gen tool keeps it
-private String textString() {
- return "This is the text component in testing\nNew Line1\nNew Line2\nNew Line3\nNew Line4.";
-}
-private boolean isBidi() {
- return BidiUtil.isBidiPlatform();
-}
-// this method must not be public so that the auto-gen tool keeps it
-private StyleRange getStyle(int start, int length, RGB fg, RGB bg) {
- StyleRange style = new StyleRange();
- style.start = start;
- style.length = length;
- if (fg != null) style.foreground = getColor(fg);
- else style.foreground = null;
- if (bg != null) style.background = getColor(bg);
- else style.background = null;
- return style;
-}
-// this method must not be public so that the auto-gen tool keeps it
-private Color getColor(RGB rgb) {
- return (Color)colors.get(rgb);
-}
-// this method must not be public so that the auto-gen tool keeps it
-protected void initializeColors() {
- Display display = Display.getDefault();
- colors.put(RED, new Color (display, RED));
- colors.put(BLUE, new Color (display, BLUE));
- colors.put(GREEN, new Color (display, GREEN));
- colors.put(YELLOW, new Color (display, YELLOW));
- colors.put(CYAN, new Color (display, CYAN));
- colors.put(PURPLE, new Color (display, PURPLE));
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- StyledText text = new StyledText(shell, SWT.READ_ONLY);
-
- assertTrue(":a:", text.getEditable() == false);
- text.dispose();
-
- text = new StyledText(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE);
- assertTrue(":b:", text.getVerticalBar() == null);
- assertTrue(":c:", text.getHorizontalBar() == null);
- text.dispose();
-}
-
-public void test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() {
- final String line = "Line1";
- boolean exceptionThrown = false;
- ExtendedModifyListener listener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent event) {
- listenerCalled = true;
- assertEquals("ExtendedModify event data invalid", 0, event.start);
- assertEquals("ExtendedModify event data invalid", line.length(), event.length);
- assertEquals("ExtendedModify event data invalid", "", event.replacedText);
- }
- };
-
- try {
- text.addExtendedModifyListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- // test whether all content modifying API methods send an ExtendedModify event
- text.addExtendedModifyListener(listener);
-
- listenerCalled = false;
- text.append(line);
- assertTrue("append does not send event", listenerCalled);
-
- listenerCalled = false;
- text.insert(line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
-
- listenerCalled = false;
- text.removeExtendedModifyListener(listener);
- listener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent event) {
- listenerCalled = true;
- assertEquals("ExtendedModify event data invalid", 0, event.start);
- assertEquals("ExtendedModify event data invalid", line.length(), event.length);
- assertEquals("ExtendedModify event data invalid", line.substring(0, 1), event.replacedText);
- }
- };
- text.addExtendedModifyListener(listener);
- text.replaceTextRange(0, 1, line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
-
- listenerCalled = false;
- text.removeExtendedModifyListener(listener);
- listener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent event) {
- listenerCalled = true;
- assertEquals("ExtendedModify event data invalid", 0, event.start);
- assertEquals("ExtendedModify event data invalid", line.length(), event.length);
- assertEquals("ExtendedModify event data invalid", line + line.substring(1, line.length()) + line, event.replacedText);
- }
- };
- text.addExtendedModifyListener(listener);
- text.setText(line);
- assertTrue("setText does not send event", listenerCalled);
-
- listenerCalled = false;
- text.removeExtendedModifyListener(listener);
- // cause StyledText to call the listener.
- text.setText(line);
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_setKeyBindingII(){
- text.setKeyBinding(SWT.DEL, SWT.NULL);
- assertTrue(":a:", text.getKeyBinding(SWT.DEL) == SWT.NULL);
- text.setKeyBinding(SWT.DEL, ST.LINE_UP);
- assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP);
- text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.SELECT_PAGE_UP);
- assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.SELECT_PAGE_UP);
- text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.PAGE_UP);
- assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.PAGE_UP);
- text.setKeyBinding(-1, ST.PAGE_UP);
- text.setKeyBinding(-1, -1);
-}
-
-public void test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- BidiSegmentListener listener = new BidiSegmentListener() {
- public void lineGetSegments(BidiSegmentEvent event) {
- listenerCalled = true;
- }
- };
-
- try {
- text.addBidiSegmentListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- listenerCalled = false;
- text.setText(line);
- text.addBidiSegmentListener(listener);
- // cause StyledText to call the BidiSegmentListener.
- text.getLocationAtOffset(0);
- if (isBidi()) {
- assertTrue("Listener not called", listenerCalled);
- }
- else {
- assertTrue("Listener called when it shouldn't be", listenerCalled == false);
- }
- listenerCalled = false;
- text.removeBidiSegmentListener(listener);
- // cause StyledText to call the BidiSegmentListener.
- text.getLocationAtOffset(0);
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- LineBackgroundListener listener = new LineBackgroundListener() {
- public void lineGetBackground(LineBackgroundEvent event) {
- listenerCalled = true;
- }
- };
-
- try {
- text.addLineBackgroundListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- listenerCalled = false;
- text.setText(line);
- text.addLineBackgroundListener(listener);
- // cause StyledText to call the listener.
- text.setSelection(0, text.getCharCount());
- text.copy();
- assertTrue("Listener not called", listenerCalled);
-
- listenerCalled = false;
- text.removeLineBackgroundListener(listener);
- // cause StyledText to call the listener.
- text.setText(line);
- text.setSelection(0, text.getCharCount());
- text.copy();
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- LineStyleListener listener = new LineStyleListener() {
- public void lineGetStyle(LineStyleEvent event) {
- listenerCalled = true;
- }
- };
-
- try {
- text.addLineStyleListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- listenerCalled = false;
- text.setText(line);
- text.addLineStyleListener(listener);
- // cause StyledText to call the listener.
- text.setSelection(0, text.getCharCount());
- text.copy();
- assertTrue("Listener not called", listenerCalled);
-
- listenerCalled = false;
- text.removeLineStyleListener(listener);
- // cause StyledText to call the listener.
- text.setText(line);
- text.setSelection(0, text.getCharCount());
- text.copy();
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- ModifyListener listener = new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- listenerCalled = true;
- }
- };
-
- try {
- text.addModifyListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- // test whether all content modifying API methods send a Modify event
- text.addModifyListener(listener);
-
- listenerCalled = false;
- text.append(line);
- assertTrue("append does not send event", listenerCalled);
-
- listenerCalled = false;
- text.insert(line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
-
- listenerCalled = false;
- text.replaceTextRange(0, 1, line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
-
- listenerCalled = false;
- text.setText(line);
- assertTrue("setText does not send event", listenerCalled);
-
- listenerCalled = false;
- text.removeModifyListener(listener);
- // cause StyledText to call the listener.
- text.setText(line);
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- SelectionListener listener = new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- listenerCalled = true;
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- listener2Called = true;
- }
- };
-
- try {
- text.addSelectionListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- text.setText(line);
- listenerCalled = false;
- listener2Called = false;
- text.addSelectionListener(listener);
- // cause StyledText to call the listener.
- text.invokeAction(ST.SELECT_LINE_END);
- assertTrue("Listener not called", listenerCalled);
- assertTrue("Listener called unexpectedly", listener2Called == false);
-
- listenerCalled = false;
- listener2Called = false;
- text.removeSelectionListener(listener);
- // cause StyledText to call the listener.
- text.invokeAction(ST.SELECT_LINE_END);
- assertTrue("Listener not removed", listenerCalled == false);
- assertTrue("Listener called unexpectedly", listener2Called == false);
-}
-
-public void test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() {
- String line = "Line1";
- boolean exceptionThrown = false;
- VerifyKeyListener listener = new VerifyKeyListener() {
- public void verifyKey(VerifyEvent event) {
- }
- };
-
- try {
- text.addVerifyKeyListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- // only test whether listener can be added and removed.
- // can't test listener because VerifyKey is user driven.
- text.addVerifyKeyListener(listener);
- text.removeVerifyKeyListener(listener);
-}
-
-public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() {
- final String line = "Line1";
- final String newLine = "NewLine1";
- final int textLength;
- boolean exceptionThrown = false;
- VerifyListener listener = new VerifyListener() {
- public void verifyText(VerifyEvent event) {
- listenerCalled = true;
- assertEquals("Verify event data invalid", 0, event.start);
- assertEquals("Verify event data invalid", 0, event.end);
- assertEquals("Verify event data invalid", line, event.text);
- event.start = 2;
- event.end = 5;
- event.text = newLine;
- }
- };
-
- try {
- text.addVerifyListener(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("Expected exception not thrown", exceptionThrown);
-
- // test whether all content modifying API sends a Verify event
- text.addVerifyListener(listener);
-
- listenerCalled = false;
- text.append(line);
- assertTrue("append does not send event", listenerCalled);
- assertEquals("Listener failed", newLine, text.getText());
-
- listenerCalled = false;
- text.insert(line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
- assertEquals("Listener failed", newLine + newLine, text.getText());
-
- listenerCalled = false;
- text.removeVerifyListener(listener);
- listener = new VerifyListener() {
- public void verifyText(VerifyEvent event) {
- listenerCalled = true;
- assertEquals("Verify event data invalid", 0, event.start);
- assertEquals("Verify event data invalid", 1, event.end);
- assertEquals("Verify event data invalid", line, event.text);
- event.start = 2;
- event.end = 5;
- event.text = newLine;
- }
- };
- text.addVerifyListener(listener);
- textLength = text.getCharCount() - 1 + newLine.length();
- text.replaceTextRange(0, 1, line);
- assertTrue("replaceTextRange does not send event", listenerCalled);
- assertEquals("Listener failed", newLine + newLine.substring(1, newLine.length()) + newLine, text.getText());
-
- listenerCalled = false;
- text.removeVerifyListener(listener);
- listener = new VerifyListener() {
- public void verifyText(VerifyEvent event) {
- listenerCalled = true;
- assertEquals("Verify event data invalid", 0, event.start);
- assertEquals("Verify event data invalid", textLength, event.end);
- assertEquals("Verify event data invalid", line, event.text);
- event.start = 2;
- event.end = 5;
- event.text = newLine;
- }
- };
- text.addVerifyListener(listener);
- text.setText(line);
- assertTrue("setText does not send event", listenerCalled);
- assertEquals("Listener failed", newLine, text.getText());
-
- text.removeVerifyListener(listener);
-
- listenerCalled = false;
- listener = new VerifyListener() {
- public void verifyText(VerifyEvent event) {
- listenerCalled = true;
- assertEquals("Verify event data invalid", 2, event.start);
- assertEquals("Verify event data invalid", newLine.length(), event.end);
- assertEquals("Verify event data invalid", line, event.text);
- event.doit = false;
- }
- };
- text.addVerifyListener(listener);
- // cause StyledText to call the listener.
- text.replaceTextRange(2, text.getCharCount() - 2, line);
- assertTrue("Listener not called", listenerCalled);
- assertEquals("Listener failed", newLine, text.getText());
-
- listenerCalled = false;
- text.removeVerifyListener(listener);
- // cause StyledText to call the listener.
- text.setText(line);
- assertTrue("Listener not removed", listenerCalled == false);
-}
-
-public void test_appendLjava_lang_String() {
- boolean exceptionThrown;
- String line = "Line1";
-
- text.append(line);
- assertEquals("append to empty text", line, text.getText());
-
- exceptionThrown = false;
- try {
- text.append(null);
- }
- catch (IllegalArgumentException exception) {
- exceptionThrown = true;
- }
- assertTrue("append null string", exceptionThrown);
-
- text.append("");
- assertEquals("append empty string", line, text.getText());
-
- text.append(line);
- assertEquals("append non-empty string", line + line, text.getText());
-
- text.setText("");
- String text2 = "line\r";
- text.append(text2);
- assertEquals("append string ending with line delimiter", text2, text.getText());
-
- String text3 = "line\r\nline3";
- text.append(text3);
- assertEquals("append multi line string", text2 + text3, text.getText());
-}
-
-public void test_computeSizeIIZ() {
- // inherited test is sufficient
-}
-
-public void test_copy() {
- Clipboard clipboard = new Clipboard(text.getDisplay());
- TextTransfer transfer = TextTransfer.getInstance();
- String clipboardText;
- String convertedText;
-
- clipboard.setContents(new String[]{""}, new Transfer[]{transfer});
-
- text.setSelectionRange(0, 0);
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":a:", clipboardText != null && clipboardText.length() == 0);
-
- text.setText("0123456789");
- text.setSelectionRange(0, 0);
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":c:", clipboardText != null && clipboardText.length() == 0);
-
-
- text.setSelectionRange(0, 1);
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":d:", clipboardText != null && clipboardText.equals("0"));
-
- text.setSelectionRange(1, 2);
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":e:", clipboardText != null && clipboardText.equals("12"));
-
- // test line delimiter conversion
- text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n");
- text.setSelectionRange(0, text.getCharCount());
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- if (SwtJunit.isLinux) {
- convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n";
- }
- else {
- convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n";
- }
- assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText));
-
- // test line delimiter conversion
- text.setText("Line1\r\nLine2");
- text.setSelectionRange(0, text.getCharCount());
- text.copy();
- clipboardText = (String) clipboard.getContents(transfer);
- if (SwtJunit.isLinux) {
- convertedText = "Line1\nLine2";
- }
- else {
- convertedText = "Line1\r\nLine2";
- }
- assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText));
-
- clipboard.dispose();
-}
-
-public void test_cut() {
- Clipboard clipboard = new Clipboard(text.getDisplay());
- TextTransfer transfer = TextTransfer.getInstance();
- String clipboardText;
- String convertedText;
-
- clipboard.setContents(new String[]{""}, new Transfer[]{transfer});
-
- text.setSelectionRange(0, 0);
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":a:", clipboardText != null && clipboardText.length() == 0);
-
- text.setText("0123456789");
- text.setSelectionRange(0, 0);
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":c:", clipboardText != null && clipboardText.length() == 0);
-
- text.setSelectionRange(0, 1);
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":d:", clipboardText != null && clipboardText.equals("0"));
-
- text.setSelectionRange(1, 2);
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- assertTrue(":e:", clipboardText != null && clipboardText.equals("23"));
-
- // test line delimiter conversion
- text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n");
- text.setSelectionRange(0, text.getCharCount());
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- if (SwtJunit.isLinux) {
- convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n";
- }
- else {
- convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n";
- }
- assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText));
-
- // test line delimiter conversion
- text.setText("Line1\r\nLine2");
- text.setSelectionRange(0, text.getCharCount());
- text.cut();
- clipboardText = (String) clipboard.getContents(transfer);
- if (SwtJunit.isLinux) {
- convertedText = "Line1\nLine2";
- }
- else {
- convertedText = "Line1\r\nLine2";
- }
- assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText));
-
- clipboard.dispose();
-}
-
-public void test_getBidiColoring() {
- /// getBidiColoring is deprecated and will be removed.
- warnUnimpl("Test test_getBidiColoring not written");
-}
-
-public void test_getCaretOffset() {
- assertTrue(":a:", text.getCaretOffset() == 0);
- text.setText("Line0\r\n");
- assertTrue(":b:", text.getCaretOffset() == 0);
- text.setTopIndex(1);
- assertTrue(":c:", text.getCaretOffset() == 0);
-
- text.replaceTextRange(text.getCharCount(), 0, "Line1");
- assertTrue(":d:", text.getCaretOffset() == 0);
- String newText = "Line-1\r\n";
- text.replaceTextRange(0, 0, newText);
- assertTrue(":e:", text.getCaretOffset() == 0);
-
- text.setCaretOffset(1);
- assertTrue(":f:", text.getCaretOffset() == 1);
- text.replaceTextRange(2, 0, newText);
- assertTrue(":g:", text.getCaretOffset() == 1);
- text.replaceTextRange(0, 0, newText);
- assertTrue(":h:", text.getCaretOffset() == newText.length() + 1);
-}
-
-public void test_getContent() {
- StyledTextContent content = text.getContent();
-
- assertTrue(content != null);
- content = new StyledTextContent() {
- public void addTextChangeListener(TextChangeListener listener) {
- }
- public int getCharCount() {
- return 0;
- }
- public String getLine(int lineIndex) {
- return "";
- }
- public int getLineAtOffset(int offset) {
- return 0;
- }
- public int getLineCount() {
- return 0;
- }
- public String getLineDelimiter() {
- return "";
- }
- public int getOffsetAtLine(int lineIndex) {
- return 0;
- }
- public String getTextRange(int start, int length) {
- return "";
- }
- public void removeTextChangeListener(TextChangeListener listener) {
- }
- public void replaceTextRange(int start, int replaceLength, String text) {
- }
- public void setText(String text) {
- }
- };
- text.setContent(content);
- assertEquals(content, text.getContent());
-}
-
-public void test_getDoubleClickEnabled() {
- assertTrue(":a:", text.getDoubleClickEnabled() == true);
- text.setDoubleClickEnabled(true);
- assertTrue(":b:", text.getDoubleClickEnabled() == true);
- text.setDoubleClickEnabled(false);
- assertTrue(":c:", text.getDoubleClickEnabled() == false);
- text.setDoubleClickEnabled(false);
- assertTrue(":d:", text.getDoubleClickEnabled() == false);
- text.setDoubleClickEnabled(true);
- assertTrue(":e:", text.getDoubleClickEnabled() == true);
-}
-
-public void test_getEditable() {
- assertTrue(":a:", text.getEditable() == true);
- text.setEditable(true);
- assertTrue(":b:", text.getEditable() == true);
- text.setEditable(false);
- assertTrue(":c:", text.getEditable() == false);
- text.setEditable(false);
- assertTrue(":d:", text.getEditable() == false);
- text.setEditable(true);
- assertTrue(":e:", text.getEditable() == true);
-}
-
-public void test_getHorizontalIndex() {
- assertTrue(":a:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(-1);
- assertTrue(":b:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":c:", text.getHorizontalIndex() == 0);
-
- text.setText("Line0");
- assertTrue(":d:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(-1);
- assertTrue(":e:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":f:", text.getHorizontalIndex() == 1);
- text.setHorizontalIndex(500);
- assertTrue(":g:", text.getHorizontalIndex() > 0);
- text.setHorizontalIndex(-1);
- assertTrue(":h:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":i:", text.getHorizontalIndex() == 1);
- // make sure the widget can be scrolled
- shell.open();
- text.setSize(10, 50);
- text.setText("Line0");
- text.setHorizontalIndex(1);
- assertTrue(":j:", text.getHorizontalIndex() == 1);
-}
-
-public void test_getHorizontalPixel() {
- assertTrue(":a:", text.getHorizontalPixel() == 0);
- text.setHorizontalIndex(-1);
- assertTrue(":b:", text.getHorizontalPixel() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":c:", text.getHorizontalPixel() == 0);
-
- text.setText("Line0");
- assertTrue(":d:", text.getHorizontalPixel() == 0);
- text.setHorizontalIndex(-1);
- assertTrue(":e:", text.getHorizontalPixel() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":f:", text.getHorizontalPixel() > 0);
- text.setHorizontalIndex(-1);
- assertTrue(":g:", text.getHorizontalPixel() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":h:", text.getHorizontalPixel() > 0);
- // make sure the widget can be scrolled
- shell.open();
- text.setSize(10, 50);
- text.setText("Line0");
- text.setHorizontalIndex(1);
- assertTrue(":i:", text.getHorizontalPixel() > 0);
-}
-
-public void test_getKeyBindingI() {
- assertTrue(":a:", text.getKeyBinding(SWT.DEL) == ST.DELETE_NEXT);
- text.setKeyBinding(SWT.DEL, ST.LINE_UP);
- assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP);
- text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.SELECT_PAGE_UP);
- assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.SELECT_PAGE_UP);
- text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.PAGE_UP);
- assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.PAGE_UP);
- assertTrue(":e:", text.getKeyBinding(-1) == SWT.NULL);
- assertTrue(":f:", text.getKeyBinding(SWT.F2) == SWT.NULL);
-}
-
-public void test_getCharCount() {
- assertTrue(":a:", text.getCharCount() == 0);
- text.setText("Line0");
- assertTrue(":b:", text.getCharCount() == 5);
- text.setText("");
- assertTrue(":c:", text.getCharCount() == 0);
- text.setText("Line0\n");
- assertTrue(":d:", text.getCharCount() == 6);
-}
-
-public void test_getLineBackgroundI() {
- StyleRange[] styles;
-
- String textString = "L1\nL2\nL3\nL4";
- text.setText(textString);
- assertTrue(":1:", text.getLineBackground(0) == null);
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- assertTrue(":1:", text.getLineBackground(1) == getColor(YELLOW));
- assertTrue(":1:", text.getLineBackground(2) == getColor(BLUE));
-}
-
-public void test_getLineCount() {
- String delimiterString = "\r\n";
- assertTrue(":a:", text.getLineCount()==1);
- text.append("dddasd" + delimiterString);
- assertTrue(":b:", text.getLineCount()==2);
- text.append("ddasdasdasdasd" + delimiterString);
- assertTrue(":c:", text.getLineCount()==3);
-
-
- text.setText("01234567890");
- text.setSelection(4);
- assertTrue(":a:", text.getLineCount()==1);
- text.insert(delimiterString);
- assertTrue(":b:", text.getLineCount()==2);
-}
-
-public void test_getLineAtOffsetI() {
- boolean exceptionThrown = false;
-
- assertTrue(":a:", text.getLineAtOffset(0) == 0);
- try {
- text.getLineAtOffset(-1);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":b:", exceptionThrown == true);
- exceptionThrown = false;
-
- try {
- text.getLineAtOffset(100);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":c:", exceptionThrown == true);
- exceptionThrown = false;
-
- text.setText("Line0\r\n");
- assertTrue(":d:", text.getLineAtOffset(4) == 0);
- assertTrue(":e:", text.getLineAtOffset(5) == 0);
- assertTrue(":f:", text.getLineAtOffset(6) == 0);
- assertTrue(":g:", text.getLineAtOffset(7) == 1);
- try {
- text.getLineAtOffset(8);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":h:", exceptionThrown == true);
- exceptionThrown = false;
-}
-
-public void test_getLineDelimiter() {
- final String lineDelimiter = "\n";
- StyledTextContent content = text.getContent();
-
- assertEquals(content.getLineDelimiter(), text.getLineDelimiter());
-
- content = new StyledTextContent() {
- public void addTextChangeListener(TextChangeListener listener) {
- }
- public int getCharCount() {
- return 0;
- }
- public String getLine(int lineIndex) {
- return "";
- }
- public int getLineAtOffset(int offset) {
- return 0;
- }
- public int getLineCount() {
- return 0;
- }
- public String getLineDelimiter() {
- return lineDelimiter;
- }
- public int getOffsetAtLine(int lineIndex) {
- return 0;
- }
- public String getTextRange(int start, int length) {
- return "";
- }
- public void removeTextChangeListener(TextChangeListener listener) {
- }
- public void replaceTextRange(int start, int replaceLength, String text) {
- }
- public void setText(String text) {
- }
- };
- text.setContent(content);
- assertEquals(lineDelimiter, text.getLineDelimiter());
-}
-
-public void test_getLineHeight() {
- assertTrue(":a:", text.getLineHeight() > 0);
-}
-
-public void test_getLocationAtOffsetI(){
- // copy from StyledText, has to match value used by StyledText
- final int XINSET;
- if (isBidi()) XINSET = 3;
- else XINSET = 0;
-
- assertTrue(":a:", text.getLocationAtOffset(0).equals(new Point(0, 0)));
- try {
- text.getLocationAtOffset(-1);
- fail("No exception thrown for offset == -1");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- text.getLocationAtOffset(100);
- fail("No exception thrown for illegal offset argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("Line0\r\nLine1");
- assertTrue(":d:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y == 0);
- assertTrue(":e:", text.getLocationAtOffset(6).x > 0 && text.getLocationAtOffset(6).y == 0);
- // x location will == StyledText x inset on bidi platforms
- assertTrue(":f:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y > 0);
- try {
- text.getLocationAtOffset(13);
- fail("No exception thrown for illegal offset argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setTopIndex(1);
- assertTrue(":h:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y < 0);
- // x location will == StyledText x inset on bidi platforms
- assertTrue(":i:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y == 0);
-
- text.setHorizontalIndex(1);
- assertTrue(":j:", text.getLocationAtOffset(0).x < 0 && text.getLocationAtOffset(0).y < 0);
- assertTrue(":k:", text.getLocationAtOffset(7).x < 0 && text.getLocationAtOffset(7).y == 0);
-}
-public void test_getOffsetAtLineI() {
- boolean exceptionThrown = false;
-
- assertEquals(":a:", 0, text.getOffsetAtLine(0));
- try {
- text.getOffsetAtLine(-1);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":b:", exceptionThrown);
- exceptionThrown = false;
-
- try {
- text.getOffsetAtLine(100);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":c:", exceptionThrown);
- exceptionThrown = false;
-
- text.setText("Line0\r\n");
- assertEquals(":d:", 0, text.getOffsetAtLine(0));
- assertEquals(":e:", 7, text.getOffsetAtLine(1));
-
- try {
- text.getOffsetAtLine(2);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":f:", exceptionThrown);
- exceptionThrown = false;
-
- text.setText("");
- assertEquals(":g:", 0, text.getOffsetAtLine(0));
-}
-public void test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point() {
- boolean exceptionThrown = false;
- Point location;
-
- assertTrue(":a:", text.getOffsetAtLocation(new Point(0, 0)) == 0);
- try {
- text.getOffsetAtLocation(new Point(-1, 0));
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":b:", exceptionThrown == true);
- exceptionThrown = false;
-
- try {
- text.getOffsetAtLocation(new Point(0, -1));
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":c:", exceptionThrown == true);
- exceptionThrown = false;
-
- text.setText("Line0\r\nLine1");
- location = text.getLocationAtOffset(5);
- assertTrue(":d:", text.getOffsetAtLocation(new Point(10, 0)) > 0);
- assertTrue(":e:", text.getOffsetAtLocation(new Point(location.x - 1, 0)) == 4);
- location = text.getLocationAtOffset(7);
- assertTrue(":f:", text.getOffsetAtLocation(location) == 7);
- try {
- text.getOffsetAtLocation(new Point(100, 0));
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":g:", exceptionThrown == true);
- exceptionThrown = false;
-
- try {
- text.getOffsetAtLocation(new Point(0, 50));
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":h:", exceptionThrown == true);
- exceptionThrown = false;
-
- text.setTopIndex(1);
- assertTrue(":i:", text.getOffsetAtLocation(new Point(0, -5)) == 0);
- assertTrue(":j:", text.getOffsetAtLocation(new Point(0, 0)) == 7);
-
- text.setHorizontalIndex(1);
- assertTrue(":k:", text.getOffsetAtLocation(new Point(-5, -5)) == 0);
- assertTrue(":l:", text.getOffsetAtLocation(new Point(-5, 0)) == 7);
-
- // 1GL4ZVE
- assertTrue(":m:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2);
- text.setHorizontalIndex(0);
- assertTrue(":n:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2);
-}
-
-public void test_getSelection(){
- text.setText("01234567890");
- text.setSelection(new Point(2, 2));
- assertTrue(":b:", text.getSelection().equals(new Point(2, 2)));
- text.setSelection(new Point(2, 3));
- assertTrue(":c:", text.getSelection().equals(new Point(2, 3)));
- text.setSelection(new Point(3, 11));
- assertTrue(":d:", text.getSelection().equals(new Point(3, 11)));
- text.setText("01234567890");
- text.setSelection(4);
- assertTrue(":a:", text.getSelection().equals(new Point(4, 4)));
- text.setSelection(11);
- assertTrue(":b:", text.getSelection().equals(new Point(11, 11)));
-}
-
-public void test_getSelectionRange() {
- String testText = "Line1\r\nLine2";
- int invalidRanges [][] = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {12, 1}, {11, 2}};
- int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}};
- int textLength;
- boolean exceptionThrown;
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int length = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.setSelectionRange(start, length);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
-
- text.setSelectionRange(0, 0);
- assertTrue(":b:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0);
- text.setText(testText);
- textLength = text.getCharCount();
- for (int i = 0; i < selectionRanges.length; i++) {
- int start = selectionRanges[i][0];
- int length = selectionRanges[i][1];
- text.setSelectionRange(start, length);
- assertTrue(":c:" + i, text.getSelectionRange().x == start && text.getSelectionRange().y == length);
- }
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int length = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.setSelectionRange(start, length);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
-}
-
-public void test_getSelectionCount(){
- text.setText("01234567890");
- assertTrue(":a:", text.getSelectionCount()==0);
- text.setSelection(2, 4);
- assertTrue(":b:", text.getSelectionCount()==2);
- text.setSelection(2, 11);
- assertTrue(":c:", text.getSelectionCount()==9);
- text.setText("0123\n4567890");
- assertTrue(":d:", text.getSelectionCount()==0);
- text.setSelection(2, 4);
- assertTrue(":e:", text.getSelectionCount()==2);
- text.setSelection(2, 12);
- assertTrue(":f:", text.getSelectionCount()==10);
-}
-
-public void test_getSelectionText() {
- String testText = "Line1\r\nLine2";
- int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}};
- int textLength;
-
- text.setSelectionRange(0, 0);
- assertEquals(":b:", "", text.getSelectionText());
- text.setText(testText);
- textLength = text.getCharCount();
- for (int i = 0; i < selectionRanges.length; i++) {
- int start = selectionRanges[i][0];
- int length = selectionRanges[i][1];
- text.setSelectionRange(start, length);
- assertEquals(":c:" + i, testText.substring(start, start + length), text.getSelectionText());
- }
-}
-
-public void test_getStyleRangeAtOffsetI() {
- String line = "Line1\r\nLine2";
- int styleStart = 0;
- int styleLength = 5;
- int i;
- boolean exceptionThrown = false;
- StyleRange style = new StyleRange(styleStart, styleLength, getColor(BLUE), getColor(RED), SWT.BOLD);
-
- try {
- text.getStyleRangeAtOffset(0);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("offset out of range no text", exceptionThrown);
-
- text.setText(line);
- exceptionThrown = false;
- try {
- text.getStyleRangeAtOffset(-1);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("offset out of range negative", exceptionThrown);
-
- exceptionThrown = false;
- try {
- text.getStyleRangeAtOffset(line.length());
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue("offset out of range positive", exceptionThrown);
-
- text.setStyleRange(style);
- style.length = 1;
- for (i = styleStart; i < styleStart + styleLength; i++) {
- style.start = i;
- assertEquals(style, text.getStyleRangeAtOffset(i));
- }
- assertEquals(null, text.getStyleRangeAtOffset(i));
-
- // test offset at line delimiter
- style = new StyleRange(5, 2, null, getColor(BLUE), SWT.NORMAL);
- text.setStyleRange(style);
- style.length = 1;
- assertEquals(style, text.getStyleRangeAtOffset(5));
- style.start = 6;
- assertEquals(style, text.getStyleRangeAtOffset(6));
- assertEquals(null, text.getStyleRangeAtOffset(10));
-}
-
-public void test_getStyleRanges() {
- text.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}");
- text.setStyleRange(getStyle(0,7,BLUE,null));
- text.setStyleRange(getStyle(14,23,RED,null));
- text.setStyleRange(getStyle(38,6,BLUE,null));
- text.setStyleRange(getStyle(45,5,BLUE,null));
- text.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */");
- String newText = text.getTextRange(0, text.getCharCount());
- assertTrue(":1:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}"));
- StyleRange[] styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 3);
- assertTrue(":1:", styles[0].equals(getStyle(0,7,BLUE,null)));
- assertTrue(":1:", styles[1].equals(getStyle(40,6,BLUE,null)));
- assertTrue(":1:", styles[2].equals(getStyle(47,5,BLUE,null)));
-}
-
-public void test_getTabs() {
- text.setTabs(1);
- assertTrue(":a:", text.getTabs() == 1);
- text.setTabs(8);
- assertTrue(":b:", text.getTabs() == 8);
- text.setText("Line\t1\r\n");
- assertTrue(":c:", text.getTabs() == 8);
- text.setTabs(7);
- assertTrue(":d:", text.getTabs() == 7);
-}
-
-public void test_getText() {
- String testText = "Line1\r\nLine2";
-
- assertTrue(":a:", text.getText().length() == 0);
- text.setText(testText);
- assertTrue(":b:", text.getText().equals(testText));
- text.setText("");
- assertTrue(":c:", text.getText().length() == 0);
-
- text.setText(testText);
- assertTrue(":a:", text.getText().equals(testText));
- text.setText(testText + "\r\n");
- assertTrue(":b:", text.getText().equals(testText + "\r\n"));
- text.setText("");
- assertTrue(":c:", text.getText().length() == 0);
-}
-
-public void test_getTextII() {
- boolean exceptionThrown;
- String testText = "Line1\r\nLine2";
- int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {2, testText.length()}, {5, 2}};
- int ranges[][] = {{0, 1}, {0, 0}, {2, 5}, {7, 11}};
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int end = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.getText(start, end);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
- text.setText(testText);
- for (int i = 0; i < ranges.length; i++) {
- int start = ranges[i][0];
- int end = ranges[i][1];
- assertEquals(":b:" + i, testText.substring(start, end + 1), text.getText(start, end));
- }
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int end = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.getText(start, end);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
- text.setText("testing");
- assertTrue(":d:", text.getText(0,0).equals("t"));
- assertTrue(":d:", text.getText(0,1).equals("te"));
- assertTrue(":d:", text.getText(1,5).equals("estin"));
-}
-
-public void test_getTextRangeII() {
- boolean exceptionThrown;
- String testText = "Line1\r\nLine2";
- int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {1, testText.length()}, {5, -1}};
- int ranges[][] = {{0, 1}, {0, 0}, {5, 1}, {7, 5}, {12, 0}};
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int length = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.getTextRange(start, length);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
- text.setText(testText);
- for (int i = 0; i < ranges.length; i++) {
- int start = ranges[i][0];
- int length = ranges[i][1];
- assertEquals(":b:" + i, testText.substring(start, start + length), text.getTextRange(start, length));
- }
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int length = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.getTextRange(start, length);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":a:", exceptionThrown);
- }
- text.setText("testing");
- assertTrue(":d:", text.getTextRange(0,0).equals(""));
- assertTrue(":d:", text.getTextRange(0,1).equals("t"));
- assertTrue(":d:", text.getTextRange(0,2).equals("te"));
- assertTrue(":d:", text.getTextRange(1,5).equals("estin"));
-}
-
-public void test_getTextLimit() {
- assertTrue(":a:", text.getTextLimit() < 0);
- text.setTextLimit(10);
- assertTrue(":b:", text.getTextLimit() == 10);
-}
-
-public void test_getTopIndex() {
- text.setText("Line0\r\n");
-
- assertTrue(":a:", text.getTopIndex() == 0);
- text.setTopIndex(-2);
- assertTrue(":b:", text.getTopIndex() == 0);
- text.setTopIndex(-1);
- assertTrue(":c:", text.getTopIndex() == 0);
- text.setTopIndex(1);
- assertTrue(":d:", text.getTopIndex() == 1);
- text.setTopIndex(2);
- assertTrue(":e:", text.getTopIndex() == 2);
- text.setTopIndex(0);
- assertTrue(":f:", text.getTopIndex() == 0);
- text.setTopIndex(3);
- assertTrue(":g:", text.getTopIndex() == 2);
- text.replaceTextRange(text.getCharCount(), 0, "Line1");
- assertTrue(":h:", text.getTopIndex() == 2);
- text.setText("");
- assertTrue(":i:", text.getTopIndex() == 0);
-}
-
-public void test_getTopPixel() {
- text.setText("Line0\r\n");
-
- assertTrue(":a:", text.getTopPixel() == 0);
- text.setTopIndex(-2);
- assertTrue(":b:", text.getTopPixel() == 0);
- text.setTopIndex(-1);
- assertTrue(":c:", text.getTopPixel() == 0);
- text.setTopIndex(1);
- assertTrue(":d:", text.getTopPixel() == text.getLineHeight());
- text.setTopIndex(2);
- assertTrue(":e:", text.getTopPixel() == text.getLineHeight() * 2);
- text.setTopIndex(0);
- assertTrue(":f:", text.getTopPixel() == 0);
- text.setTopIndex(3);
- assertTrue(":g:", text.getTopPixel() == text.getLineHeight() * 2);
- text.replaceTextRange(text.getCharCount(), 0, "Line1");
- assertTrue(":h:", text.getTopPixel() == text.getLineHeight() * 2);
- text.setText("");
- assertTrue(":i:", text.getTopPixel() == 0);
-}
-public void test_getWordWrap() {
- assertTrue(":a:", text.getWordWrap() == false);
- text.setWordWrap(true);
- assertTrue(":b:", text.getWordWrap());
- text.setWordWrap(false);
- assertTrue(":c:", text.getWordWrap() == false);
- text.setWordWrap(false);
- assertTrue(":d:", text.getWordWrap() == false);
- text.setWordWrap(true);
- assertTrue(":e:", text.getWordWrap());
-}
-public void test_insertLjava_lang_String(){
- String delimiterString = "\n";
- try {
- text.insert(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertTrue(":a:", text.getText().equals(""));
- text.insert("");
- assertTrue(":b:", text.getText().equals(""));
- text.insert("fred");
- assertTrue(":c:", text.getText().equals("fred"));
- text.setSelection(2);
- text.insert("helmut");
- assertTrue(":d:", text.getText().equals("frhelmuted"));
- text.setText("01234567890");
- text.setSelection(4);
- assertTrue(":e:", text.getLineCount()==1);
- text.insert(delimiterString);
- assertTrue(":f:", text.getLineCount()==2);
-}
-
-public void test_invokeActionI() {
- // invoking actions on an empty text should not crash
- text.invokeAction(ST.LINE_DOWN);
- text.invokeAction(ST.LINE_UP);
- text.invokeAction(ST.LINE_END);
- text.invokeAction(ST.LINE_START);
- text.invokeAction(ST.COLUMN_NEXT);
- text.invokeAction(ST.PAGE_DOWN);
- text.invokeAction(ST.PAGE_UP);
- text.invokeAction(ST.WORD_NEXT);
- text.invokeAction(ST.WORD_PREVIOUS);
- text.invokeAction(ST.TEXT_END);
- text.invokeAction(ST.TEXT_START);
- text.invokeAction(ST.WINDOW_END);
- text.invokeAction(ST.WINDOW_START);
- text.invokeAction(ST.SELECT_LINE_DOWN);
- text.invokeAction(ST.SELECT_LINE_UP);
- text.invokeAction(ST.SELECT_LINE_START);
- text.invokeAction(ST.SELECT_LINE_END);
- text.invokeAction(ST.SELECT_COLUMN_PREVIOUS);
- text.invokeAction(ST.SELECT_COLUMN_NEXT);
- text.invokeAction(ST.SELECT_PAGE_UP);
- text.invokeAction(ST.SELECT_PAGE_DOWN);
- text.invokeAction(ST.SELECT_WORD_PREVIOUS);
- text.invokeAction(ST.SELECT_WORD_NEXT);
- text.invokeAction(ST.SELECT_TEXT_END);
- text.invokeAction(ST.SELECT_TEXT_START);
- text.invokeAction(ST.SELECT_WINDOW_START);
- text.invokeAction(ST.SELECT_WINDOW_END);
- text.invokeAction(ST.CUT);
- text.invokeAction(ST.COPY);
- text.invokeAction(ST.PASTE);
- text.invokeAction(ST.DELETE_PREVIOUS);
- text.invokeAction(ST.DELETE_NEXT);
- text.invokeAction(ST.TOGGLE_OVERWRITE);
-
- text.setText("Line1\r\nLine2");
- text.invokeAction(ST.LINE_DOWN);
- assertEquals(7, text.getCaretOffset());
-
- text.invokeAction(ST.LINE_UP);
- assertEquals(0, text.getCaretOffset());
-
- text.invokeAction(ST.LINE_END);
- assertEquals(5, text.getCaretOffset());
-
- text.invokeAction(ST.LINE_START);
- assertEquals(0, text.getCaretOffset());
-
- text.invokeAction(ST.COLUMN_NEXT);
- assertEquals(1, text.getCaretOffset());
-
- text.invokeAction(ST.PAGE_DOWN);
- assertEquals(8, text.getCaretOffset());
-
- text.invokeAction(ST.PAGE_UP);
- assertEquals(1, text.getCaretOffset());
-
- text.invokeAction(ST.TEXT_START);
- text.invokeAction(ST.WORD_NEXT);
- text.invokeAction(ST.WORD_NEXT);
- assertEquals(7, text.getCaretOffset());
-
- text.invokeAction(ST.WORD_PREVIOUS);
- assertEquals(5, text.getCaretOffset());
-
- text.invokeAction(ST.TEXT_END);
- assertEquals(text.getCharCount(), text.getCaretOffset());
-
- text.invokeAction(ST.TEXT_START);
- assertEquals(0, text.getCaretOffset());
-
- text.invokeAction(ST.WINDOW_END);
- assertEquals(5, text.getCaretOffset());
-
- text.invokeAction(ST.WINDOW_START);
- assertEquals(0, text.getCaretOffset());
-
- text.invokeAction(ST.SELECT_LINE_DOWN);
- assertEquals("Line1\r\n", text.getSelectionText());
-
- text.invokeAction(ST.LINE_END);
- text.invokeAction(ST.SELECT_LINE_UP);
- assertEquals("\r\nLine2", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_LINE_START);
- assertEquals("Line1\r\nLine2", text.getSelectionText());
-
- text.invokeAction(ST.LINE_START);
- text.invokeAction(ST.SELECT_LINE_END);
- assertEquals("Line1", text.getSelectionText());
-
- text.invokeAction(ST.LINE_END);
- text.invokeAction(ST.SELECT_COLUMN_PREVIOUS);
- assertEquals("1", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_COLUMN_NEXT);
- assertEquals("", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_PAGE_UP);
- assertEquals("", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_PAGE_DOWN);
- assertEquals("\r\nLine2", text.getSelectionText());
-
- text.invokeAction(ST.LINE_END);
- text.invokeAction(ST.SELECT_WORD_PREVIOUS);
- assertEquals("Line2", text.getSelectionText());
-
- text.invokeAction(ST.LINE_START);
- text.invokeAction(ST.SELECT_WORD_NEXT);
- assertEquals("Line2", text.getSelectionText());
-
- text.invokeAction(ST.LINE_START);
- text.invokeAction(ST.SELECT_TEXT_END);
- assertEquals("Line2", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_TEXT_START);
- assertEquals("Line1\r\n", text.getSelectionText());
-
- text.invokeAction(ST.LINE_START);
- text.invokeAction(ST.SELECT_WINDOW_START);
- assertEquals("", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_WINDOW_END);
- assertEquals("Line1", text.getSelectionText());
-
- text.invokeAction(ST.SELECT_LINE_END);
- text.invokeAction(ST.CUT);
- assertEquals("\r\nLine2", text.getText());
-
- text.invokeAction(ST.SELECT_LINE_DOWN);
- text.invokeAction(ST.COPY);
- assertEquals("\r\nLine2", text.getText());
-
- text.invokeAction(ST.LINE_END);
- text.invokeAction(ST.PASTE);
- assertEquals("\r\nLine2\r\n", text.getText());
-
- text.invokeAction(ST.DELETE_PREVIOUS);
- assertEquals("\r\nLine2", text.getText());
-
- text.invokeAction(ST.TEXT_START);
- text.invokeAction(ST.DELETE_NEXT);
- assertEquals("Line2", text.getText());
-
- text.invokeAction(ST.TOGGLE_OVERWRITE);
-}
-
-public void test_paste(){
- Clipboard clipboard = new Clipboard(text.getDisplay());
- TextTransfer transfer = TextTransfer.getInstance();
- String convertedText;
-
- clipboard.setContents(new String[]{""}, new Transfer[]{transfer});
-
- text.copy();
- text.paste();
- assertTrue(":a:", text.getCharCount() == 0);
-
- text.setSelectionRange(0, 0);
- text.copy();
- text.paste();
- assertTrue(":b:", text.getCharCount() == 0);
-
- text.setText("0123456789");
- text.setSelectionRange(0, 1);
- text.copy();
- text.setCaretOffset(0);
- text.paste();
- assertTrue(":c:", text.getText().equals("00123456789"));
- text.setSelectionRange(1, 2);
- text.copy();
- text.setText("");
- text.paste();
- assertTrue(":d:", text.getText().equals("01"));
- text.setText("");
-
- // test line delimiter conversion
- clipboard.setContents(new String[]{"\rLine1\nLine2\r\nLine3\n\rLine4\n"}, new Transfer[]{transfer});
- text.paste();
- if (SwtJunit.isLinux) {
- convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n";
- }
- else {
- convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n";
- }
- assertTrue(":f:", text.getText() != null && text.getText().equals(convertedText));
- text.setText("");
-
- // test line delimiter conversion
- clipboard.setContents(new String[]{"Line1\r\nLine2"}, new Transfer[]{transfer});
- text.paste();
- if (SwtJunit.isLinux) {
- convertedText = "Line1\nLine2";
- }
- else {
- convertedText = "Line1\r\nLine2";
- }
- assertTrue(":g:", text.getText() != null && text.getText().equals(convertedText));
- text.setText("");
-
- // test line delimiter conversion
- clipboard.setContents(new String[]{"Line1\rLine2"}, new Transfer[]{transfer});
- text.paste();
- if (SwtJunit.isLinux) {
- convertedText = "Line1\nLine2";
- }
- else {
- convertedText = "Line1\r\nLine2";
- }
- assertTrue(":h:", text.getText() != null && text.getText().equals(convertedText));
- text.setText("");
-
-
- // test line delimiter conversion
- clipboard.setContents(new String[]{"Line1\nLine2"}, new Transfer[]{transfer});
- text.paste();
- if (SwtJunit.isLinux) {
- convertedText = "Line1\nLine2";
- }
- else {
- convertedText = "Line1\r\nLine2";
- }
- assertTrue(":i:", text.getText() != null && text.getText().equals(convertedText));
- text.setText("");
-
-
- clipboard.dispose();
-}
-
-public void test_print() {
- Printer printer = new Printer();
-
- text.print();
- printer.cancelJob();
- text.setText("Line1");
- text.print();
- printer.cancelJob();
- printer.dispose();
-}
-
-public void test_printLorg_eclipse_swt_printing_Printer() {
- Printer printer = new Printer();
- boolean exceptionThrown = false;
-
- try {
- text.print(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- text.print(printer);
- printer.cancelJob();
- text.setText("Line1");
- text.print(printer);
- printer.cancelJob();
-
- printer.dispose();
-}
-
-public void test_redraw() {
- // inherited test is sufficient
-}
-
-public void test_redrawIIIIZ() {
- // inherited test is sufficient
-}
-
-public void test_redrawRangeIIZ() {
- boolean exceptionThrown = false;
-
- text.redrawRange(0, 0, true);
- text.redrawRange(0, 0, false);
-
- try {
- text.redrawRange(0, 1, true);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-
- exceptionThrown = false;
- try {
- text.redrawRange(0, 1, false);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-
- exceptionThrown = false;
- try {
- text.redrawRange(-1, 2, true);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-
- exceptionThrown = false;
- try {
- text.redrawRange(-1, 2, false);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-
- text.setText("0123456789");
- text.redrawRange(0, 0, true);
- text.redrawRange(0, 0, false);
- text.redrawRange(0, 1, true);
- text.redrawRange(0, 1, false);
- text.redrawRange(8, 2, true);
- text.redrawRange(8, 2, false);
- text.redrawRange(10, 0, true);
- text.redrawRange(10, 0, false);
-
- exceptionThrown = false;
- try {
- text.redrawRange(10, 1, true);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-
- exceptionThrown = false;
- try {
- text.redrawRange(10, 1, false);
- }
- catch (IllegalArgumentException e) {
- if (e.getMessage().equals("Index out of bounds")) {
- exceptionThrown = true;
- }
- }
- assertTrue(exceptionThrown);
-}
-
-public void test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() {
- // tested in test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener
-}
-
-public void test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() {
- // tested in test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener
-}
-
-public void test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() {
- // tested in test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener
-}
-
-public void test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() {
- // tested in test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener
-}
-
-public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- // tested in test_addModifyListenerLorg_eclipse_swt_events_ModifyListener
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- // tested in test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener
-}
-
-public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() {
- // tested in test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener
-}
-
-public void test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() {
- // tested in test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener
-}
-
-public void test_replaceTextRangeIILjava_lang_String(){
- String defaultText = "line0\n\rline1\n\rline2\n\r";
- int defaultTextLength = defaultText.length();
- int selectionStart = 7;
- int selectionLength = 7;
- int replaceStart = selectionStart + selectionLength + 1;
- int replaceLength = 5;
- boolean exceptionThrown = false;
- String newText = "newline0\n\rnewline1";
- int newTextLength = newText.length();
-
- // insert text
- // within range
- // after selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(replaceStart, 0, newText);
- assertTrue(":a:", text.getCharCount() == defaultTextLength + newTextLength);
- assertTrue(":b:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength);
-
- // before selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(0, 0, newText);
- assertTrue(":c:", text.getCharCount() == defaultTextLength + newTextLength);
- assertTrue(":d:", text.getSelectionRange().x == selectionStart + newTextLength && text.getSelectionRange().y == selectionLength);
-
-
- // intersecting selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(selectionStart + 1, 0, newText);
- assertTrue(":e:", text.getCharCount() == defaultTextLength + newTextLength);
- assertTrue(":f:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0);
-
- // out of range
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- try {
- text.replaceTextRange(-1, 0, newText);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":g:", exceptionThrown);
- exceptionThrown = false;
- try {
- text.replaceTextRange(text.getCharCount() + 1, 0, newText);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
-
- exceptionThrown = false;
- try {
- text.replaceTextRange(0, 0, null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- assertTrue(":h:", exceptionThrown);
- assertTrue(":i:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength);
- exceptionThrown = false;
-
- // append text
- // append in empty widget
- text.setText("");
- text.replaceTextRange(text.getCharCount(), 0, newText);
- assertTrue(":j:", text.getCharCount() == newTextLength);
- assertTrue(":k:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0);
-
- // append in non-empty widget (selection should always be preserved)
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(text.getCharCount(), 0, newText);
- assertTrue(":l:", text.getCharCount() == defaultTextLength + newTextLength);
- assertTrue(":m:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength);
-
- // place caret at end of text
- text.setText(defaultText);
- text.setSelectionRange(text.getCharCount(), 0);
- text.replaceTextRange(text.getCharCount(), 0, newText);
- assertTrue(":n:", text.getCharCount() == defaultTextLength + newTextLength);
- assertTrue(":o:", text.getSelectionRange().x == text.getCharCount() - newTextLength && text.getSelectionRange().y == 0);
-
- // replace text
- // within range
- // after selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(replaceStart, replaceLength, newText);
- assertTrue(":p:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength);
- assertTrue(":q:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength);
-
- // before selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(0, replaceLength, newText);
- assertTrue(":r:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength);
- assertTrue(":s:", text.getSelectionRange().x == selectionStart + newTextLength - replaceLength && text.getSelectionRange().y == selectionLength);
-
- // intersecting selection
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- text.replaceTextRange(selectionStart + 1, replaceLength, newText);
- assertTrue(":t:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength);
- assertTrue(":u:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0);
-
- // out of range
- text.setText(defaultText);
- // select 2nd line including line break
- text.setSelectionRange(selectionStart, selectionLength);
- try {
- text.replaceTextRange(-1, replaceLength, newText);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":v:", exceptionThrown);
- exceptionThrown = false;
- try {
- text.replaceTextRange(text.getCharCount() + 1, replaceLength, newText);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":w:", exceptionThrown);
- assertTrue(":x:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength);
-}
-
-public void test_selectAll() {
- String line = "Line1\rLine2";
-
- text.selectAll();
- assertEquals("", text.getSelectionText());
-
- text.setText(line);
- text.selectAll();
- assertEquals(line, text.getSelectionText());
-
- text.setText("");
- text.selectAll();
- assertEquals("", text.getSelectionText());
-}
-
-public void test_setCaretLorg_eclipse_swt_widgets_Caret() {
- Caret caret = new Caret(text, SWT.NONE);
- final int XINSET;
-
- if (isBidi()) {
- XINSET = 3;
- }
- else {
- XINSET = 0;
- }
-
- text.setCaret(caret);
- assertEquals(XINSET, text.getCaret().getLocation().x);
- assertEquals(0, text.getCaret().getLocation().y);
-
- text.setCaret(null);
- text.setText("\rLine2");
- text.setSelection(2);
-
- text.setTopIndex(0);
- text.setCaret(caret);
- assertTrue(text.getCaret().getLocation().x > 0);
- assertEquals(text.getLineHeight(), text.getCaret().getLocation().y);
-}
-
-public void test_setBidiColoringZ() {
- /// setBidiColoring is deprecated and will be removed.
- warnUnimpl("Test test_setBidiColoringZ not written");
-}
-
-public void test_setCaretOffsetI(){
- text.setCaretOffset(-2);
- assertTrue(":a:", text.getCaretOffset() == 0);
- text.setCaretOffset(1);
- assertTrue(":b:", text.getCaretOffset() == 0);
- text.setCaretOffset(0);
- assertTrue(":c:", text.getCaretOffset() == 0);
-
- text.setText("Line0\r\n");
- text.setCaretOffset(-2);
- assertTrue(":d:", text.getCaretOffset() == 0);
- text.setCaretOffset(1);
- assertTrue(":e:", text.getCaretOffset() == 1);
- text.setCaretOffset(0);
- assertTrue(":f:", text.getCaretOffset() == 0);
-
- text.setCaretOffset(text.getCharCount());
- assertTrue(":g:", text.getCaretOffset() == text.getCharCount());
- text.setCaretOffset(text.getCharCount() + 1);
- assertTrue(":h:", text.getCaretOffset() == text.getCharCount());
- text.setCaretOffset(5);
- assertTrue(":i:", text.getCaretOffset() == 5);
-
- text.setText("");
- text.setCaretOffset(-2);
- assertTrue(":j:", text.getCaretOffset() == 0);
- text.setCaretOffset(1);
- assertTrue(":k:", text.getCaretOffset() == 0);
- text.setCaretOffset(0);
- assertTrue(":l:", text.getCaretOffset() == 0);
-}
-
-public void test_setContentLorg_eclipse_swt_custom_StyledTextContent() {
- boolean exceptionThrown;
- StyledTextContent content = new StyledTextContent() {
- public void addTextChangeListener(TextChangeListener listener) {
- }
- public int getCharCount() {
- return 0;
- }
- public String getLine(int lineIndex) {
- return "";
- }
- public int getLineAtOffset(int offset) {
- return 0;
- }
- public int getLineCount() {
- return 0;
- }
- public String getLineDelimiter() {
- return "";
- }
- public int getOffsetAtLine(int lineIndex) {
- return 0;
- }
- public String getTextRange(int start, int length) {
- return "";
- }
- public void removeTextChangeListener(TextChangeListener listener) {
- }
- public void replaceTextRange(int start, int replaceLength, String text) {
- }
- public void setText(String text) {
- }
- };
- text.setContent(content);
- assertEquals(content, text.getContent());
-
- exceptionThrown = false;
- try {
- text.setContent(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-}
-
-public void test_setDoubleClickEnabledZ(){
- text.setDoubleClickEnabled(true);
- assertTrue(":a:", text.getDoubleClickEnabled() == true);
- text.setDoubleClickEnabled(false);
- assertTrue(":b:", text.getDoubleClickEnabled() == false);
- text.setDoubleClickEnabled(false);
- assertTrue(":c:", text.getDoubleClickEnabled() == false);
- text.setDoubleClickEnabled(true);
- assertTrue(":d:", text.getDoubleClickEnabled() == true);
-}
-
-public void test_setEditableZ(){
- text.setEditable(true);
- assertTrue(":a:", text.getEditable() == true);
- text.setEditable(false);
- assertTrue(":b:", text.getEditable() == false);
- text.setEditable(false);
- assertTrue(":c:", text.getEditable() == false);
- text.setEditable(true);
- assertTrue(":d:", text.getEditable() == true);
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font(){
- FontData fontData = text.getFont().getFontData()[0];
- int lineHeight;
- Font font;
-
- font = new Font(text.getDisplay(), fontData.getName(), 8, fontData.getStyle());
- text.setFont(font);
- font.dispose();
- lineHeight = text.getLineHeight();
- font = new Font(text.getDisplay(), fontData.getName(), 12, fontData.getStyle());
- text.setFont(font);
- assertTrue(":a:", text.getLineHeight() > lineHeight && font.equals(text.getFont()));
- font.dispose();
-}
-
-public void test_setHorizontalIndexI(){
- text.setHorizontalIndex(-1);
- assertTrue(":a:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":b:", text.getHorizontalIndex() == 0);
-
- text.setText("Line0");
- text.setHorizontalIndex(-1);
- assertTrue(":c:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":d:", text.getHorizontalIndex() == 1);
- text.setHorizontalIndex(500);
- assertTrue(":e:", text.getHorizontalIndex() > 0);
- text.setHorizontalIndex(-1);
- assertTrue(":f:", text.getHorizontalIndex() == 0);
- text.setHorizontalIndex(1);
- assertTrue(":g:", text.getHorizontalIndex() == 1);
-
- text.setText("");
- text.setHorizontalIndex(2);
- assertTrue(":h:", text.getHorizontalIndex() == 0);
-
- // make sure the widget can be scrolled
- shell.open();
- text.setSize(10, 50);
- text.setText("Line0");
- text.setHorizontalIndex(1);
- assertTrue(":i:", text.getHorizontalIndex() == 1);
-}
-
-public void test_setHorizontalPixelI(){
- text.setHorizontalPixel(-1);
- assertTrue(":a:", text.getHorizontalPixel() == 0);
- text.setHorizontalPixel(1);
- assertTrue(":b:", text.getHorizontalPixel() == 0);
-
- text.setText("Line0");
- text.setHorizontalPixel(-1);
- assertTrue(":c:", text.getHorizontalPixel() == 0);
- text.setHorizontalPixel(1);
- assertTrue(":d:", text.getHorizontalPixel() == 1);
- text.setHorizontalPixel(500);
- assertTrue(":e:", text.getHorizontalPixel() > 0);
- text.setHorizontalPixel(-1);
- assertTrue(":f:", text.getHorizontalPixel() == 0);
- text.setHorizontalPixel(25);
- assertTrue(":g:", text.getHorizontalPixel() == 25);
-
- text.setText("");
- text.setHorizontalPixel(2);
- assertTrue(":h:", text.getHorizontalPixel() == 0);
-
- // make sure the widget can be scrolled
- shell.open();
- text.setSize(10, 50);
- text.setText("Line0");
- text.setHorizontalPixel(5);
- assertTrue(":i:", text.getHorizontalPixel() == 5);
-}
-
-public void test_setLineBackgroundIILorg_eclipse_swt_graphics_Color(){
- StyleRange[] styles;
- String textString = "";
-
- textString = "L1\nL2\nL3\nL4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(1,5,"");
- assertTrue(":0a:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":0a:", text.getLineBackground(1) == getColor(GREEN));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(0,4,"");
- assertTrue(":0b:", text.getLineBackground(0) == getColor(YELLOW));
- assertTrue(":0b:", text.getLineBackground(1) == getColor(BLUE));
- assertTrue(":0b:", text.getLineBackground(2) == getColor(GREEN));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(1,1,"");
- assertTrue(":0c:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":0c:", text.getLineBackground(1) == getColor(YELLOW));
- assertTrue(":0c:", text.getLineBackground(2) == getColor(BLUE));
- assertTrue(":0c:", text.getLineBackground(3) == getColor(GREEN));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(0,6,"");
- assertTrue(":0d:", text.getLineBackground(0) == getColor(BLUE));
- assertTrue(":0d:", text.getLineBackground(1) == getColor(GREEN));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(1,3,"");
- assertTrue(":0e:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":0e:", text.getLineBackground(1) == getColor(BLUE));
- assertTrue(":0e:", text.getLineBackground(2) == getColor(GREEN));
-
- textString = "L1\nL2";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(1,4,"");
- assertTrue(":0a1:", text.getLineBackground(0) == getColor(RED));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(0,4,"");
- assertTrue(":0b1:", text.getLineBackground(0) == getColor(YELLOW));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(1,1,"");
- assertTrue(":0c1:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":0c1:", text.getLineBackground(1) == getColor(YELLOW));
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(0,5,"");
- assertTrue(":0d1:", text.getLineBackground(0) == null);
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(1,3,"");
- assertTrue(":0e1:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":0e1:", text.getLineBackground(1) == getColor(YELLOW));
- textString = "L1\nL2";
- text.setText(textString);
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(1,4,"");
- assertTrue(":0f1:", text.getLineBackground(0) == null);
- text.setText(textString+"\n");
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.replaceTextRange(0,6,"");
- assertTrue(":0g1:", text.getLineBackground(0) == null);
-
- text.setText(textString);
- text.setLineBackground(0,0,getColor(RED));
- assertTrue(":1:", text.getLineBackground(0) == null);
- text.setLineBackground(0,1,getColor(RED));
- assertTrue(":1:", text.getLineBackground(0) == getColor(RED));
-
- textString = "New Line1\nNew Line2\nNew Line3\nNew Line4";
- text.setText(textString);
- text.setLineBackground(0,2,getColor(RED));
- text.setLineBackground(2,2,getColor(YELLOW));
- text.replaceTextRange(0,0,"\n");
- assertTrue(":2:", text.getLineBackground(0) == null);
- assertTrue(":2:", text.getLineBackground(1) == getColor(RED));
- assertTrue(":2:", text.getLineBackground(2) == getColor(RED));
- assertTrue(":2:", text.getLineBackground(3) == getColor(YELLOW));
- assertTrue(":2:", text.getLineBackground(4) == getColor(YELLOW));
-
- textString = "New Line1\nNew Line2\nNew Line3\nNew Line4";
- text.setText(textString);
- text.setLineBackground(0,2,getColor(RED));
- text.setLineBackground(2,2,getColor(YELLOW));
- text.replaceTextRange(0,20,"");
- assertTrue(":3:", text.getLineBackground(0) == getColor(YELLOW));
- assertTrue(":3:", text.getLineBackground(1) == getColor(YELLOW));
-
- textString = "Line1\nLine2\nLine3\nLine4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(2,1,getColor(YELLOW));
- text.replaceTextRange(0,18,"");
- assertTrue(":4:", text.getLineBackground(0) == null);
-
- textString = "Line1\nLine2\nLine3\nLine4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(2,1,getColor(YELLOW));
- text.replaceTextRange(0,18,"L1\nL2\nL3\n");
- assertTrue(":5:", text.getLineBackground(0) == null);
- assertTrue(":5:", text.getLineBackground(1) == null);
- assertTrue(":5:", text.getLineBackground(2) == null);
- assertTrue(":5:", text.getLineBackground(3) == null);
-
- textString = "Line1\nLine2\nLine3\nLine4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(3,9,"L1\nL2\n");
- assertTrue(":6a:", text.getLineBackground(0) == getColor(RED));
- assertTrue(":6a:", text.getLineBackground(1) == null);
- textString = "Line1\nLine2\nLine3\nLine4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(11,11,"L3\nL4");
- assertTrue(":6b:", text.getLineBackground(2) == null);
- assertTrue(":6b:", text.getLineBackground(3) == getColor(GREEN));
-
- textString = "Line1\nLine2\nLine3\nLine4";
- text.setText(textString);
- text.setLineBackground(0,1,getColor(RED));
- text.setLineBackground(1,1,getColor(YELLOW));
- text.setLineBackground(2,1,getColor(BLUE));
- text.setLineBackground(3,1,getColor(GREEN));
- text.replaceTextRange(0,18,"L1\n");
- assertTrue(":7:", text.getLineBackground(0) == null);
- assertTrue(":7:", text.getLineBackground(1) == getColor(GREEN));
-}
-
-public void test_setSelectionI() {
- int[] invalid = {-1, 100, 12};
- boolean exceptionThrown;
-
- for (int i = 0; i < invalid.length; i++) {
- exceptionThrown = false;
- try {
- text.setSelection(invalid[i]);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
- text.setText("01234567890");
- assertEquals(0, text.getCaretOffset());
- text.setSelection(1);
- assertEquals(1, text.getCaretOffset());
- text.setSelection(11);
- assertEquals(11, text.getCaretOffset());
-
- for (int i = 0; i < invalid.length; i++) {
- exceptionThrown = false;
- try {
- text.setSelection(invalid[i]);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
-}
-
-public void test_setSelectionLorg_eclipse_swt_graphics_Point() {
- Point[] invalidRanges = {new Point(-1, 0), new Point(-1, -1), new Point(100, 1),
- new Point(100, -1), new Point(11, 12), new Point(10, 12)};
- boolean exceptionThrown;
-
- for (int i = 0; i < invalidRanges.length; i++) {
- exceptionThrown = false;
- try {
- text.setSelection(invalidRanges[i]);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.setSelection(3, 7);
- assertEquals("3456", text.getSelectionText());
-
- for (int i = 0; i < invalidRanges.length; i++) {
- exceptionThrown = false;
- try {
- text.setSelection(invalidRanges[i]);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
-}
-
-public void test_setSelectionII(){
- int[][] invalidRanges = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {11, 12}, {10, 12}};
- boolean exceptionThrown;
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int end = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.setSelection(start, end);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.setSelection(3, 7);
- assertEquals("3456", text.getSelectionText());
-
- for (int i = 0; i < invalidRanges.length; i++) {
- int start = invalidRanges[i][0];
- int end = invalidRanges[i][1];
-
- exceptionThrown = false;
- try {
- text.setSelection(start, end);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- }
-}
-
-public void test_setSelectionRangeII(){
- // setSelectionRange already tested in test_getSelectionRange
-}
-
-public void test_setStyleRangeLorg_eclipse_swt_custom_StyleRange(){
- StyleRange[] styles;
- String textString = textString();
-
- /*
- defaultStyles
-
- (0,48,RED,YELLOW),
- (58,10,BLUE,CYAN),
- (68,10,GREEN,PURPLE)
- */
-
-
- text.setText(textString);
-
- // No overlap with existing styles
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(48,5,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 4);
- assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(48,5,YELLOW,RED)));
- assertTrue(":1:", styles[2].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE)));
-
- // Overlap middle of one style - partial
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(10,10,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 5);
- assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW)));
- assertTrue(":2:", styles[1].equals(getStyle(10,10,YELLOW,RED)));
- assertTrue(":2:", styles[2].equals(getStyle(20,28,RED,YELLOW)));
- assertTrue(":2:", styles[3].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":2:", styles[4].equals(getStyle(68,10,GREEN,PURPLE)));
- text.setStyleRange(null);
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 0);
-
- // Overlap middle of one style - full
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(58,10,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 3);
- assertTrue(":3:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":3:", styles[1].equals(getStyle(58,10,YELLOW,RED)));
- assertTrue(":3:", styles[2].equals(getStyle(68,10,GREEN,PURPLE)));
-
- // Overlap end of one style
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(38,15,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 4);
- assertTrue(":4:", styles[0].equals(getStyle(0,38,RED,YELLOW)));
- assertTrue(":4:", styles[1].equals(getStyle(38,15,YELLOW,RED)));
- assertTrue(":4:", styles[2].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":4:", styles[3].equals(getStyle(68,10,GREEN,PURPLE)));
-
- // Overlap beginning of one style
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(50,10,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":5:", styles.length == 4);
- assertTrue(":5:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":5:", styles[1].equals(getStyle(50,10,YELLOW,RED)));
- assertTrue(":5:", styles[2].equals(getStyle(60,8,BLUE,CYAN)));
- assertTrue(":5:", styles[3].equals(getStyle(68,10,GREEN,PURPLE)));
-
- // Overlap complete style
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(48,20,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":6:", styles.length == 3);
- assertTrue(":6:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":6:", styles[1].equals(getStyle(48,20,YELLOW,RED)));
- assertTrue(":6:", styles[2].equals(getStyle(68,10,GREEN,PURPLE)));
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,48,RED,YELLOW));
- text.setStyleRange(getStyle(48,20,BLUE,CYAN));
- text.setStyleRange(getStyle(68,10,GREEN,PURPLE));
- // should be merged with style before it
- text.setStyleRange(getStyle(48,10,RED,YELLOW));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 3);
- assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE)));
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(15,10,BLUE,CYAN));
- text.setStyleRange(getStyle(25,10,GREEN,PURPLE));
- // should be merged with style after it
- text.setStyleRange(getStyle(11,4,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 3);
- assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW)));
- assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN)));
- assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE)));
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(15,10,BLUE,CYAN));
- text.setStyleRange(getStyle(25,10,GREEN,PURPLE));
- // should be merged with style after it
- text.setStyleRange(getStyle(5,15,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 3);
- assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN)));
- assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE)));
-
- text.setText("01234567890123456789");
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(10,10,BLUE,CYAN));
- text.setStyleRange(getStyle(5,3,RED,YELLOW));
- text.setStyleRange(getStyle(12,5,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 2);
- assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW)));
- assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN)));
-
- text.setText("0123456789012345");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(5,5,BLUE,CYAN));
- text.setStyleRange(getStyle(10,5,GREEN,PURPLE));
- // no merging since styles are completely overlapping existing
- // styles
- text.setStyleRange(getStyle(5,5,RED,YELLOW));
- text.setStyleRange(getStyle(10,5,RED,YELLOW));
- styles = text.getStyleRanges();
- assertTrue(":5:", styles.length == 3);
- assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW)));
- assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW)));
-
- text.setText("012345678901234");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(10,5,BLUE,CYAN));
- // should be merged
- text.setStyleRange(getStyle(5,7,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":6:", styles.length == 2);
- assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN)));
-
- text.setText("123 456 789");
- text.setStyleRange(getStyle(4,3,BLUE,null));
- text.setStyleRange(getStyle(8,3,RED,null));
- text.setStyleRange(getStyle(5,2,BLUE,null));
- styles = text.getStyleRanges();
- assertTrue(":7:", styles.length == 2);
- assertTrue(":7:", styles[0].equals(getStyle(4,3,BLUE,null)));
- assertTrue(":7:", styles[1].equals(getStyle(8,3,RED,null)));
-
- text.setText("123 456 789");
- text.setStyleRange(getStyle(4,3,BLUE,null));
- text.setStyleRange(getStyle(8,3,RED,null));
- text.setStyleRange(getStyle(7,4,BLUE,null));
- styles = text.getStyleRanges();
- assertTrue(":8:", styles.length == 2);
- assertTrue(":8:", styles[0].equals(getStyle(4,3,BLUE,null)));
- assertTrue(":8:", styles[1].equals(getStyle(7,4,BLUE,null)));
-
- text.setText("123 456 789 ABC DEF");
- text.setStyleRange(getStyle(0,4,BLUE,null));
- text.setStyleRange(getStyle(4,4,RED,null));
- text.setStyleRange(getStyle(8,4,BLUE,null));
- text.setStyleRange(getStyle(12,4,RED,null));
- text.setStyleRange(getStyle(16,3,BLUE,null));
- text.setStyleRange(getStyle(5,14,RED,null));
- styles = text.getStyleRanges();
- assertTrue(":9:", styles.length == 2);
- assertTrue(":9:", styles[0].equals(getStyle(0,4,BLUE,null)));
- assertTrue(":9:", styles[1].equals(getStyle(4,15,RED,null)));
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,48,RED,YELLOW));
- text.setStyleRange(getStyle(48,20,BLUE,CYAN));
- text.setStyleRange(getStyle(68,10,GREEN,PURPLE));
- text.setStyleRange(getStyle(38,20,null,null));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 3);
- assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE)));
-
- text.setText(textString);
- int length = textString.length();
- text.setStyleRange(getStyle(0,48,RED,YELLOW));
- text.setStyleRange(getStyle(48,20,BLUE,CYAN));
- text.setStyleRange(getStyle(68,10,GREEN,PURPLE));
- text.setStyleRange(getStyle(0,length,null,null));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 0);
-
- text.setText("01234567890123456789");
- text.setStyleRange(getStyle(0,3,RED,YELLOW));
- text.setStyleRange(getStyle(5,3,BLUE,CYAN));
- text.setStyleRange(getStyle(9,8,GREEN,PURPLE));
- text.setStyleRange(getStyle(0,10,GREEN,PURPLE));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 2);
- assertTrue(":3:", styles[0].equals(getStyle(0,10,GREEN,PURPLE)));
- assertTrue(":3:", styles[1].equals(getStyle(10,7,GREEN,PURPLE)));
-
- text.setText("0123456789012345");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(5,5,BLUE,CYAN));
- text.setStyleRange(getStyle(10,5,GREEN,PURPLE));
- text.setStyleRange(getStyle(7,9,RED,YELLOW));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 3);
- assertTrue(":4:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":4:", styles[1].equals(getStyle(5,2,BLUE,CYAN)));
- assertTrue(":4:", styles[2].equals(getStyle(7,9,RED,YELLOW)));
-
- text.setText("012345678901234");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(10,5,BLUE,CYAN));
- text.setStyleRange(getStyle(3,10,GREEN,PURPLE));
- styles = text.getStyleRanges();
- assertTrue(":5:", styles.length == 3);
- assertTrue(":5:", styles[0].equals(getStyle(0,3,RED,YELLOW)));
- assertTrue(":5:", styles[1].equals(getStyle(3,10,GREEN,PURPLE)));
- assertTrue(":5:", styles[2].equals(getStyle(13,2,BLUE,CYAN)));
-
- text.setText("redgreenblueyellowcyanpurple");
- text.setStyleRange(getStyle(0,3,RED,null));
- text.setStyleRange(getStyle(3,5,GREEN,null));
- text.setStyleRange(getStyle(8,4,BLUE,null));
- text.setStyleRange(getStyle(12,6,YELLOW,null));
- text.setStyleRange(getStyle(18,4,CYAN,null));
- text.setStyleRange(getStyle(22,6,PURPLE,null));
- text.setStyleRange(getStyle(8,14,null,RED));
- styles = text.getStyleRanges();
- assertTrue(":6:", styles.length == 4);
- assertTrue(":6:", styles[0].equals(getStyle(0,3,RED,null)));
- assertTrue(":6:", styles[1].equals(getStyle(3,5,GREEN,null)));
- assertTrue(":6:", styles[2].equals(getStyle(8,14,null,RED)));
- assertTrue(":6:", styles[3].equals(getStyle(22,6,PURPLE,null)));
-
-
- text.setText("redgreenblueyellowcyanpurple");
- text.setStyleRange(getStyle(0,3,RED,null));
- text.setStyleRange(getStyle(3,5,GREEN,null));
- text.setStyleRange(getStyle(8,4,BLUE,null));
- text.setStyleRange(getStyle(12,6,YELLOW,null));
- text.setStyleRange(getStyle(18,4,CYAN,null));
- text.setStyleRange(getStyle(22,6,PURPLE,null));
- text.setStyleRange(getStyle(0,28,null,null));
- styles = text.getStyleRanges();
- assertTrue(":7:", styles.length == 0);
-
-
-/*
- text.setText("This\r\na\tAnother line.");
- text.setStyleRange(getStyle(3,3,BLUE,null));
- text.setStyleRange(getStyle(7,8,BLUE,null));
- text.setStyleRange(getStyle(6,1,BLUE,null));
- StyledTextEvent event = new StyledTextEvent();
- event.detail = 6;
- event.text = "a\tAnother line.";
- text.notifyListener(ST.LineGetStyle, event);
- assertTrue(":8:", event.styles[0].equals(getStyle(3,4,BLUE,null)));
-*/
-
-
- text.setText("123 456 789");
- text.setStyleRange(getStyle(4,3,BLUE,null));
- text.setStyleRange(getStyle(8,3,RED,null));
- text.setStyleRange(getStyle(5,5,BLUE,null));
- styles = text.getStyleRanges();
- assertTrue(":9:", styles.length == 2);
- assertTrue(":9:", styles[0].equals(getStyle(4,6,BLUE,null)));
- assertTrue(":9:", styles[1].equals(getStyle(10,1,RED,null)));
-
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- textString = textString();
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,48,RED,YELLOW));
- text.setStyleRange(getStyle(48,20,BLUE,CYAN));
- text.setStyleRange(getStyle(68,10,GREEN,PURPLE));
- // should be merged with style before it
- text.setStyleRange(getStyle(48,10,RED,YELLOW));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 3);
- assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN)));
- assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE)));
-
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(15,10,BLUE,CYAN));
- text.setStyleRange(getStyle(25,10,GREEN,PURPLE));
- // should be merged with style after it
- text.setStyleRange(getStyle(11,4,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 3);
- assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW)));
- assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN)));
- assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE)));
-
- text.setText(textString);
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(15,10,BLUE,CYAN));
- text.setStyleRange(getStyle(25,10,GREEN,PURPLE));
- // should be merged with style after it
- text.setStyleRange(getStyle(5,15,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 3);
- assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN)));
- assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE)));
-
-
-
- text.setText("01234567890123456789");
- text.setStyleRange(getStyle(0,10,RED,YELLOW));
- text.setStyleRange(getStyle(10,10,BLUE,CYAN));
- text.setStyleRange(getStyle(5,3,RED,YELLOW));
- text.setStyleRange(getStyle(12,5,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 2);
- assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW)));
- assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN)));
-
- text.setText("0123456789012345");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(5,5,BLUE,CYAN));
- text.setStyleRange(getStyle(10,5,GREEN,PURPLE));
- // no merging since styles are completely overlapping existing
- // styles
- text.setStyleRange(getStyle(5,5,RED,YELLOW));
- text.setStyleRange(getStyle(10,5,RED,YELLOW));
- styles = text.getStyleRanges();
- assertTrue(":5:", styles.length == 3);
- assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW)));
- assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW)));
-
- text.setText("012345678901234");
- text.setStyleRange(getStyle(0,5,RED,YELLOW));
- text.setStyleRange(getStyle(10,5,BLUE,CYAN));
- // should be merged
- text.setStyleRange(getStyle(5,7,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":6:", styles.length == 2);
- assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW)));
- assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN)));
-
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- textString = textString();
-
-
- /*
- defaultStyles
-
- (0,48,RED,YELLOW),
- (58,10,BLUE,CYAN),
- (68,10,GREEN,PURPLE)
- */
-
-
- text.setText(textString);
-
- // End/Beginning overlap
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(38,25,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 4);
- assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(38,25,YELLOW,RED)));
- assertTrue(":1:", styles[2].equals(getStyle(63,5,BLUE,CYAN)));
- assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE)));
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(63,10,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 4);
- assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":1:", styles[1].equals(getStyle(58,5,BLUE,CYAN)));
- assertTrue(":1:", styles[2].equals(getStyle(63,10,YELLOW,RED)));
- assertTrue(":1:", styles[3].equals(getStyle(73,5,GREEN,PURPLE)));
-
-
- // Complete overlap
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(0,78,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 1);
- assertTrue(":2:", styles[0].equals(getStyle(0,78,YELLOW,RED)));
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(0,68,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 2);
- assertTrue(":2:", styles[0].equals(getStyle(0,68,YELLOW,RED)));
- assertTrue(":2:", styles[1].equals(getStyle(68,10,GREEN,PURPLE)));
- text.setStyleRanges(defaultStyles());
- text.setStyleRange(getStyle(58,20,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 2);
- assertTrue(":2:", styles[0].equals(getStyle(0,48,RED,YELLOW)));
- assertTrue(":2:", styles[1].equals(getStyle(58,20,YELLOW,RED)));
-
-
- // 1-N complete, beginning
- text.setText("012345678901234567890123456789");
- text.setStyleRanges(
- new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW),
- getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE),
- getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)}
- );
- text.setStyleRange(getStyle(5,23,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 3);
- assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED)));
- assertTrue(":3:", styles[1].equals(getStyle(5,23,YELLOW,RED)));
- assertTrue(":3:", styles[2].equals(getStyle(28,2,PURPLE,PURPLE)));
-
- // end, 1-N complete, beginning
- text.setStyleRanges(
- new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW),
- getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE),
- getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)}
- );
- text.setStyleRange(getStyle(13,12,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 5);
- assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED)));
- assertTrue(":3:", styles[1].equals(getStyle(5,5,YELLOW,YELLOW)));
- assertTrue(":3:", styles[2].equals(getStyle(10,3,CYAN,CYAN)));
- assertTrue(":3:", styles[3].equals(getStyle(13,12,YELLOW,RED)));
- assertTrue(":3:", styles[4].equals(getStyle(25,5,PURPLE,PURPLE)));
-
-
- text.setText("x/");
- text.setStyleRange(getStyle(0,2,YELLOW,null));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 1);
- assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null)));
- text.replaceTextRange(2,0,"/");
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 1);
- assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null)));
- text.setStyleRange(getStyle(0,1,YELLOW,null));
- assertTrue(":4:", styles.length == 1);
- assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null)));
- text.setStyleRange(getStyle(1,2,RED,null));
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 2);
- assertTrue(":4:", styles[0].equals(getStyle(0,1,YELLOW,null)));
- assertTrue(":4:", styles[1].equals(getStyle(1,2,RED,null)));
-
-
- text.setText("xxx/");
- text.setStyleRange(getStyle(0,2,RED,null));
- text.setStyleRange(getStyle(2,2,YELLOW,null));
- styles = text.getStyleRanges();
- assertTrue(":4a:", styles.length == 2);
- assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null)));
- assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null)));
- text.replaceTextRange(4,0,"/");
- styles = text.getStyleRanges();
- assertTrue(":4a:", styles.length == 2);
- assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null)));
- assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null)));
- text.setStyleRange(getStyle(2,1,YELLOW,null));
- assertTrue(":4a:", styles.length == 2);
- assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null)));
- assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null)));
- text.setStyleRange(getStyle(3,2,RED,null));
- styles = text.getStyleRanges();
- assertTrue(":4a:", styles.length == 3);
- assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null)));
- assertTrue(":4a:", styles[1].equals(getStyle(2,1,YELLOW,null)));
- assertTrue(":4a:", styles[2].equals(getStyle(3,2,RED,null)));
-
-
- text.setText("xxx/");
- text.setStyleRange(getStyle(0,2,RED,null));
- text.setStyleRange(getStyle(2,2,YELLOW,null));
- text.replaceTextRange(4,0,"/");
- styles = text.getStyleRanges();
- text.setStyleRange(getStyle(2,1,YELLOW,null));
- text.setStyleRange(getStyle(2,3,RED,null));
- styles = text.getStyleRanges();
- assertTrue(":4b:", styles.length == 2);
- assertTrue(":4b:", styles[0].equals(getStyle(0,2,RED,null)));
- assertTrue(":4b:", styles[1].equals(getStyle(2,3,RED,null)));
-
-
- text.setText("xxx/");
- text.setStyleRange(getStyle(0,2,RED,null));
- text.setStyleRange(getStyle(2,2,YELLOW,null));
- text.replaceTextRange(4,0,"/");
- styles = text.getStyleRanges();
- text.setStyleRange(getStyle(2,1,YELLOW,null));
- text.setStyleRange(getStyle(1,4,YELLOW,null));
- styles = text.getStyleRanges();
- assertTrue(":4c:", styles.length == 2);
- assertTrue(":4c:", styles[0].equals(getStyle(0,1,RED,null)));
- assertTrue(":4c:", styles[1].equals(getStyle(1,4,YELLOW,null)));
-
-
- text.setText("New\r\n");
- StyleRange style = getStyle(0,5,null,null);
- style.fontStyle = SWT.BOLD;
- text.setStyleRange(style);
- // styles (0,5,BOLD)
- text.replaceTextRange(3,0,"a"); // "Newa\r\n"
- // styles (0,3,BOLD), (4,2,BOLD)
- style = text.getStyleRangeAtOffset(4);
- style.start = 3;
- style.length = 1;
- text.setStyleRange(style);
- // styles (0,6,BOLD)
- text.replaceTextRange(0,0,"a"); // "aNewa\r\n"
- // styles (1,6,BOLD)
- style = text.getStyleRangeAtOffset(1);
- style.start = 0;
- style.length = 1;
- text.setStyleRange(style);
- // styles (0,7,BOLD)
- text.replaceTextRange(0,1,""); // "Newa\r\n"
- // styles (0,6,BOLD)
- for (int i=0; i<6; i++) {
- style = text.getStyleRangeAtOffset(i);
- assertTrue(":5:", style.fontStyle == SWT.BOLD);
- }
-
-
- text.setText("New L 1\r\nNew L 2\r\n");
- style = getStyle(0,9,null,null);
- style.fontStyle = SWT.BOLD;
- text.setStyleRange(style);
- // styles (0,9,BOLD)
- text.replaceTextRange(7,0,"a");
- // styles (0,7,BOLD), (8,2,BOLD)
- style = text.getStyleRangeAtOffset(8);
- if (style != null) {
- style.start = 7;
- style.length = 1;
- text.setStyleRange(style);
- }
- // styles (0,10,BOLD)
- text.replaceTextRange(4,0,"a");
- // styles (0,4,BOLD), (5,6,BOLD)
- style = text.getStyleRangeAtOffset(5);
- if (style != null) {
- style.start = 4;
- style.length = 1;
- text.setStyleRange(style);
- }
- // styles (0,11,BOLD)
- text.replaceTextRange(2,3,"");
- // styles (0,8,BOLD)
- for (int i=0; i<8; i++) {
- style = text.getStyleRangeAtOffset(i);
- assertTrue(":5a:", style.fontStyle == SWT.BOLD);
- }
-
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
-
- // "01234567890123"
- textString = "1234 1234 1234";
-
-
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(5,2,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":1a:", styles.length == 1);
- assertTrue(":1a:", styles[0].equals(getStyle(5,4,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(7,2,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":2a:", styles.length == 1);
- assertTrue(":2a:", styles[0].equals(getStyle(5,4,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(6,2,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":3a:", styles.length == 1);
- assertTrue(":3a:", styles[0].equals(getStyle(5,4,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(3,4,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":4a:", styles.length == 1);
- assertTrue(":4a:", styles[0].equals(getStyle(3,6,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(7,4,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":5a:", styles.length == 1);
- assertTrue(":5a:", styles[0].equals(getStyle(5,6,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":6a:", styles.length == 1);
- assertTrue(":6a:", styles[0].equals(getStyle(5,4,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(3,10,YELLOW,RED));
- styles = text.getStyleRanges();
- assertTrue(":7a:", styles.length == 1);
- assertTrue(":7a:", styles[0].equals(getStyle(3,10,YELLOW,RED)));
-
-
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(5,2,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":1b:", styles.length == 2);
- assertTrue(":1b:", styles[0].equals(getStyle(5,2,BLUE,CYAN)));
- assertTrue(":1b:", styles[1].equals(getStyle(7,2,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(7,2,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":2b:", styles.length == 2);
- assertTrue(":2b:", styles[0].equals(getStyle(5,2,YELLOW,RED)));
- assertTrue(":2b:", styles[1].equals(getStyle(7,2,BLUE,CYAN)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(6,2,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":3b:", styles.length == 3);
- assertTrue(":3b:", styles[0].equals(getStyle(5,1,YELLOW,RED)));
- assertTrue(":3b:", styles[1].equals(getStyle(6,2,BLUE,CYAN)));
- assertTrue(":3b:", styles[2].equals(getStyle(8,1,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(3,4,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":4b:", styles.length == 2);
- assertTrue(":4b:", styles[0].equals(getStyle(3,4,BLUE,CYAN)));
- assertTrue(":4b:", styles[1].equals(getStyle(7,2,YELLOW,RED)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(7,4,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":5b:", styles.length == 2);
- assertTrue(":5b:", styles[0].equals(getStyle(5,2,YELLOW,RED)));
- assertTrue(":5b:", styles[1].equals(getStyle(7,4,BLUE,CYAN)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":6b:", styles.length == 1);
- assertTrue(":6b:", styles[0].equals(getStyle(5,4,BLUE,CYAN)));
- text.setText("1234 1234 1234");
- text.setStyleRange(getStyle(5,4,YELLOW,RED));
- text.setStyleRange(getStyle(3,10,BLUE,CYAN));
- styles = text.getStyleRanges();
- assertTrue(":7b:", styles.length == 1);
- assertTrue(":7b:", styles[0].equals(getStyle(3,10,BLUE,CYAN)));
-
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- // "012345678901234567890123"
- String testString= "1234 1234 1234 1234 1234";
-
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(12,2,"");
- styles = text.getStyleRanges();
- assertTrue(":1:", styles.length == 1);
- assertTrue(":1:", styles[0].equals(getStyle(10,2,YELLOW,RED)));
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(10,2,"");
- styles = text.getStyleRanges();
- assertTrue(":2:", styles.length == 1);
- assertTrue(":2:", styles[0].equals(getStyle(10,2,YELLOW,RED)));
-
-
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(12,4,"");
- styles = text.getStyleRanges();
- assertTrue(":3:", styles.length == 1);
- assertTrue(":3:", styles[0].equals(getStyle(10,2,YELLOW,RED)));
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(8,4,"");
- styles = text.getStyleRanges();
- assertTrue(":4:", styles.length == 1);
- assertTrue(":4:", styles[0].equals(getStyle(8,2,YELLOW,RED)));
-
-
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(8,6,"");
- styles = text.getStyleRanges();
- assertTrue(":5:", styles.length == 0);
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(10,6,"");
- styles = text.getStyleRanges();
- assertTrue(":6:", styles.length == 0);
- text.setText(testString);
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(8,12,"");
- styles = text.getStyleRanges();
- assertTrue(":7:", styles.length == 0);
-
- // "012345678901234567890123"
- // String testString= "1234 1234 1234 1234 1234";
-
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(5,7,"");
- styles = text.getStyleRanges();
- assertTrue(":8:", styles.length == 1);
- assertTrue(":8:", styles[0].equals(getStyle(5,2,YELLOW,RED)));
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(7,7,"");
- styles = text.getStyleRanges();
- assertTrue(":9:", styles.length == 1);
- assertTrue(":9:", styles[0].equals(getStyle(5,2,BLUE,CYAN)));
-
-
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(2,10,"");
- styles = text.getStyleRanges();
- assertTrue(":10:", styles.length == 1);
- assertTrue(":10:", styles[0].equals(getStyle(2,2,YELLOW,RED)));
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(7,9,"");
- styles = text.getStyleRanges();
- assertTrue(":11:", styles.length == 1);
- assertTrue(":11:", styles[0].equals(getStyle(5,2,BLUE,CYAN)));
-
-
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(5,9,"");
- styles = text.getStyleRanges();
- assertTrue(":12:", styles.length == 0);
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.replaceTextRange(3,13,"");
- styles = text.getStyleRanges();
- assertTrue(":11:", styles.length == 0);
-
-
- // "012345678901234567890123"
- // String testString= "1234 1234 1234 1234 1234";
-
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.setStyleRange(getStyle(15,4,GREEN,PURPLE));
- text.replaceTextRange(7,12,"");
- styles = text.getStyleRanges();
- assertTrue(":14:", styles.length == 1);
- assertTrue(":14:", styles[0].equals(getStyle(5,2,BLUE,CYAN)));
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.setStyleRange(getStyle(15,4,GREEN,PURPLE));
- text.replaceTextRange(5,12,"");
- styles = text.getStyleRanges();
- assertTrue(":15:", styles.length == 1);
- assertTrue(":15:", styles[0].equals(getStyle(5,2,GREEN,PURPLE)));
-
-
- text.setText(testString);
- text.setStyleRange(getStyle(5,4,BLUE,CYAN));
- text.setStyleRange(getStyle(10,4,YELLOW,RED));
- text.setStyleRange(getStyle(15,4,GREEN,PURPLE));
- text.replaceTextRange(9,10,"");
- styles = text.getStyleRanges();
- assertTrue(":16:", styles.length == 1);
- assertTrue(":16:", styles[0].equals(getStyle(5,4,BLUE,CYAN)));
-
-
- // reset the environment
- text.dispose();
- text = new StyledText(shell, SWT.NULL);
- setWidget(text);
-
- StyleRange style1 = getStyle(0,0,null,null);
-
-
- StyleRange style2 = getStyle(0,0,RED,YELLOW);
-
-
- assertTrue(":1:", !style1.equals(style2));
- assertTrue(":1:", !style1.similarTo(style2));
-
-
- assertTrue(":1:", !style2.equals(style1));
-
-
- assertTrue(":1:", !style2.similarTo(style1));
-
-
-
- style1 = getStyle(0,10,RED,YELLOW);
- style2 = getStyle(11,5,RED,YELLOW);
-
-
- assertTrue(":2:", !style1.equals(style2));
-
-
- assertTrue(":2:", !style2.equals(style1));
- assertTrue(":2:", style1.similarTo(style2));
-
-
- assertTrue(":2:", style2.similarTo(style1));
-
-
-}
-
-public void test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange() {
- boolean exceptionThrown = false;
- StyleRange[] ranges = new StyleRange[] {
- new StyleRange(0, 1, getColor(RED), null),
- new StyleRange(2, 1, getColor(RED), null)};
-
- text.setText("Line0\r\n");
- try {
- text.setStyleRanges(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- text.setStyleRanges(ranges);
- StyleRange[] currentRanges = text.getStyleRanges();
- assertEquals(ranges.length, currentRanges.length);
- for (int i = 0; i < currentRanges.length; i++) {
- assertEquals(ranges[i], currentRanges[i]);
- }
- text.setStyleRanges(new StyleRange[] {});
- assertEquals(0, text.getStyleRanges().length);
-}
-
-public void test_setTabsI(){
- text.setTabs(1);
- assertTrue(":a:", text.getTabs() == 1);
-
- text.setTabs(8);
- assertTrue(":b:", text.getTabs() == 8);
- text.setText("Line\t1\r\n");
- text.setTabs(7);
- assertTrue(":c:", text.getTabs() == 7);
-}
-
-public void test_setTextLjava_lang_String(){
- boolean exceptionThrown = false;
-
- text.setText("");
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
-
- try {
- text.setText(null);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- assertEquals("01234567890", text.getText());
- text.setText("");
- assertEquals("", text.getText());
-}
-
-public void test_setTextLimitI(){
- boolean exceptionThrown = false;
-
- text.setTextLimit(10);
- assertTrue(":a:", text.getTextLimit() == 10);
-
- text.setTextLimit(-1);
- assertTrue(":b:", text.getTextLimit() == -1);
-
- try {
- text.setTextLimit(0);
- }
- catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- assertTrue(":c:", exceptionThrown == true);
- exceptionThrown = false;
-}
-
-public void test_setTopIndexI(){
- text.setTopIndex(-1);
- assertTrue(":a:", text.getTopIndex() == 0);
- text.setTopIndex(1);
- assertTrue(":b:", text.getTopIndex() == 0);
-
- text.setText("Line0\r\n");
-
- text.setTopIndex(-2);
- assertTrue(":c:", text.getTopIndex() == 0);
- text.setTopIndex(-1);
- assertTrue(":d:", text.getTopIndex() == 0);
- text.setTopIndex(1);
- assertTrue(":e:", text.getTopIndex() == 1);
- text.setTopIndex(2);
- assertTrue(":f:", text.getTopIndex() == 2);
- text.setTopIndex(0);
- assertTrue(":g:", text.getTopIndex() == 0);
- text.setTopIndex(3);
- assertTrue(":h:", text.getTopIndex() == 2);
-
- text.setText("");
- text.setTopIndex(2);
- assertTrue(":i:", text.getTopIndex() == 0);
-}
-public void test_setTopPixelI(){
- int lineHeight = text.getLineHeight();
-
- text.setTopPixel(-1);
- assertTrue(":a:", text.getTopPixel() == 0);
- text.setTopPixel(1);
- assertTrue(":b:", text.getTopPixel() == 0);
-
- text.setText("Line0\r\n");
-
- text.setTopPixel(-2);
- assertTrue(":c:", text.getTopPixel() == 0);
- text.setTopPixel(-1);
- assertTrue(":d:", text.getTopPixel() == 0);
- text.setTopPixel(1);
- assertTrue(":e:", text.getTopPixel() == 1);
- text.setTopPixel(2 * lineHeight);
- assertTrue(":f:", text.getTopPixel() == 2 * lineHeight);
- text.setTopPixel(0);
- assertTrue(":g:", text.getTopPixel() == 0);
- text.setTopPixel(3 * lineHeight);
- assertTrue(":h:", text.getTopPixel() == 2 * lineHeight);
-
- text.setText("");
- text.setTopPixel(2 * lineHeight);
- assertTrue(":i:", text.getTopPixel() == 0);
-}
-public void test_setWordWrapZ(){
- String testString = "Line1\nLine2";
-
- text.setWordWrap(true);
- assertTrue(":a:", text.getWordWrap());
- text.setWordWrap(false);
- assertTrue(":b:", text.getWordWrap() == false);
- text.setWordWrap(false);
- assertTrue(":c:", text.getWordWrap() == false);
- text.setWordWrap(true);
- assertTrue(":d:", text.getWordWrap());
-
- text.setText(testString);
- assertEquals(":e:", testString, text.getText());
- assertEquals(":f:", 2, text.getLineCount());
-}
-
-public void test_showSelection() {
- text.showSelection();
- text.setSelectionRange(0, 0);
- text.showSelection();
- text.setText("Line0\r\n");
- text.showSelection();
- text.setSelectionRange(5, 2);
- text.showSelection();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_StyledText((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener");
- methodNames.addElement("test_setKeyBindingII");
- methodNames.addElement("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener");
- methodNames.addElement("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener");
- methodNames.addElement("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener");
- methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener");
- methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener");
- methodNames.addElement("test_appendLjava_lang_String");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_copy");
- methodNames.addElement("test_cut");
- methodNames.addElement("test_getBidiColoring");
- methodNames.addElement("test_getCaretOffset");
- methodNames.addElement("test_getContent");
- methodNames.addElement("test_getDoubleClickEnabled");
- methodNames.addElement("test_getEditable");
- methodNames.addElement("test_getHorizontalIndex");
- methodNames.addElement("test_getHorizontalPixel");
- methodNames.addElement("test_getKeyBindingI");
- methodNames.addElement("test_getCharCount");
- methodNames.addElement("test_getLineBackgroundI");
- methodNames.addElement("test_getLineCount");
- methodNames.addElement("test_getLineAtOffsetI");
- methodNames.addElement("test_getLineDelimiter");
- methodNames.addElement("test_getLineHeight");
- methodNames.addElement("test_getLocationAtOffsetI");
- methodNames.addElement("test_getOffsetAtLineI");
- methodNames.addElement("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionRange");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_getSelectionText");
- methodNames.addElement("test_getStyleRangeAtOffsetI");
- methodNames.addElement("test_getStyleRanges");
- methodNames.addElement("test_getTabs");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getTextII");
- methodNames.addElement("test_getTextRangeII");
- methodNames.addElement("test_getTextLimit");
- methodNames.addElement("test_getTopIndex");
- methodNames.addElement("test_getTopPixel");
- methodNames.addElement("test_getWordWrap");
- methodNames.addElement("test_insertLjava_lang_String");
- methodNames.addElement("test_invokeActionI");
- methodNames.addElement("test_paste");
- methodNames.addElement("test_print");
- methodNames.addElement("test_printLorg_eclipse_swt_printing_Printer");
- methodNames.addElement("test_redraw");
- methodNames.addElement("test_redrawIIIIZ");
- methodNames.addElement("test_redrawRangeIIZ");
- methodNames.addElement("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener");
- methodNames.addElement("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener");
- methodNames.addElement("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener");
- methodNames.addElement("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener");
- methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener");
- methodNames.addElement("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener");
- methodNames.addElement("test_replaceTextRangeIILjava_lang_String");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret");
- methodNames.addElement("test_setBidiColoringZ");
- methodNames.addElement("test_setCaretOffsetI");
- methodNames.addElement("test_setContentLorg_eclipse_swt_custom_StyledTextContent");
- methodNames.addElement("test_setDoubleClickEnabledZ");
- methodNames.addElement("test_setEditableZ");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setHorizontalIndexI");
- methodNames.addElement("test_setHorizontalPixelI");
- methodNames.addElement("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setSelectionII");
- methodNames.addElement("test_setSelectionRangeII");
- methodNames.addElement("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange");
- methodNames.addElement("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange");
- methodNames.addElement("test_setTabsI");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setTextLimitI");
- methodNames.addElement("test_setTopIndexI");
- methodNames.addElement("test_setTopPixelI");
- methodNames.addElement("test_setWordWrapZ");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener();
- else if (getName().equals("test_setKeyBindingII")) test_setKeyBindingII();
- else if (getName().equals("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener();
- else if (getName().equals("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener();
- else if (getName().equals("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener();
- else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener();
- else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener();
- else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_copy")) test_copy();
- else if (getName().equals("test_cut")) test_cut();
- else if (getName().equals("test_getBidiColoring")) test_getBidiColoring();
- else if (getName().equals("test_getCaretOffset")) test_getCaretOffset();
- else if (getName().equals("test_getContent")) test_getContent();
- else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled();
- else if (getName().equals("test_getEditable")) test_getEditable();
- else if (getName().equals("test_getHorizontalIndex")) test_getHorizontalIndex();
- else if (getName().equals("test_getHorizontalPixel")) test_getHorizontalPixel();
- else if (getName().equals("test_getKeyBindingI")) test_getKeyBindingI();
- else if (getName().equals("test_getCharCount")) test_getCharCount();
- else if (getName().equals("test_getLineBackgroundI")) test_getLineBackgroundI();
- else if (getName().equals("test_getLineCount")) test_getLineCount();
- else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI();
- else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter();
- else if (getName().equals("test_getLineHeight")) test_getLineHeight();
- else if (getName().equals("test_getLocationAtOffsetI")) test_getLocationAtOffsetI();
- else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI();
- else if (getName().equals("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point")) test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionRange")) test_getSelectionRange();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_getSelectionText")) test_getSelectionText();
- else if (getName().equals("test_getStyleRangeAtOffsetI")) test_getStyleRangeAtOffsetI();
- else if (getName().equals("test_getStyleRanges")) test_getStyleRanges();
- else if (getName().equals("test_getTabs")) test_getTabs();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getTextII")) test_getTextII();
- else if (getName().equals("test_getTextRangeII")) test_getTextRangeII();
- else if (getName().equals("test_getTextLimit")) test_getTextLimit();
- else if (getName().equals("test_getTopIndex")) test_getTopIndex();
- else if (getName().equals("test_getTopPixel")) test_getTopPixel();
- else if (getName().equals("test_getWordWrap")) test_getWordWrap();
- else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String();
- else if (getName().equals("test_invokeActionI")) test_invokeActionI();
- else if (getName().equals("test_paste")) test_paste();
- else if (getName().equals("test_print")) test_print();
- else if (getName().equals("test_printLorg_eclipse_swt_printing_Printer")) test_printLorg_eclipse_swt_printing_Printer();
- else if (getName().equals("test_redraw")) test_redraw();
- else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ();
- else if (getName().equals("test_redrawRangeIIZ")) test_redrawRangeIIZ();
- else if (getName().equals("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener();
- else if (getName().equals("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener();
- else if (getName().equals("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener();
- else if (getName().equals("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener();
- else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener();
- else if (getName().equals("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener();
- else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret();
- else if (getName().equals("test_setBidiColoringZ")) test_setBidiColoringZ();
- else if (getName().equals("test_setCaretOffsetI")) test_setCaretOffsetI();
- else if (getName().equals("test_setContentLorg_eclipse_swt_custom_StyledTextContent")) test_setContentLorg_eclipse_swt_custom_StyledTextContent();
- else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ();
- else if (getName().equals("test_setEditableZ")) test_setEditableZ();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setHorizontalIndexI")) test_setHorizontalIndexI();
- else if (getName().equals("test_setHorizontalPixelI")) test_setHorizontalPixelI();
- else if (getName().equals("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color")) test_setLineBackgroundIILorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setSelectionII")) test_setSelectionII();
- else if (getName().equals("test_setSelectionRangeII")) test_setSelectionRangeII();
- else if (getName().equals("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange")) test_setStyleRangeLorg_eclipse_swt_custom_StyleRange();
- else if (getName().equals("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange")) test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange();
- else if (getName().equals("test_setTabsI")) test_setTabsI();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setTextLimitI")) test_setTextLimitI();
- else if (getName().equals("test_setTopIndexI")) test_setTopIndexI();
- else if (getName().equals("test_setTopPixelI")) test_setTopPixelI();
- else if (getName().equals("test_setWordWrapZ")) test_setWordWrapZ();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java
deleted file mode 100644
index b3ae798438..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import junit.framework.*;
-import junit.textui.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.internal.BidiUtil;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.StyledTextContent
- *
- * @see org.eclipse.swt.custom.StyledTextContent
- */
-public class Test_org_eclipse_swt_custom_StyledTextContent extends SwtTestCase {
- int XINSET = 0;
-
- class ContentImplementation implements StyledTextContent {
- String textContent = "";
-
- public void addTextChangeListener(TextChangeListener listener){
- }
- public int getCharCount() {
- return 0;
- }
- public String getLine(int lineIndex) {
- return "getLine";
- }
- public int getLineAtOffset(int offset) {
- return 0;
- }
- public int getLineCount() {
- return 0;
- }
- public String getLineDelimiter() {
- return "getLineDelimiter";
- }
- public int getOffsetAtLine(int lineIndex) {
- return 0;
- }
- public String getTextRange(int start, int length) {
- return textContent;
- }
- public void removeTextChangeListener(TextChangeListener listener) {
- }
- public void replaceTextRange(int start, int replaceLength, String text) {
- textContent = text;
- }
- public void setText(String text) {
- textContent = text;
- }
- }
- StyledTextContent content = new ContentImplementation();
- Shell shell;
- StyledText styledText;
-
-public Test_org_eclipse_swt_custom_StyledTextContent(String name) {
- super(name);
-}
-private boolean isBidi() {
- return BidiUtil.isBidiPlatform();
-}
-protected void setUp() {
- if (isBidi()) XINSET = 3;
- else XINSET = 0;
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
- styledText.setContent(content);
-}
-
-protected void tearDown() {
-}
-
-public void test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() {
- // does not make sense to test, not called by StyledText
-}
-
-public void test_getCharCount() {
- assertTrue(":a:", styledText.getCharCount() == 0);
-}
-
-public void test_getLineI() {
- // will indirectly cause getLine to be called
- assertTrue(":b:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0)));
-}
-
-public void test_getLineAtOffsetI() {
- assertTrue(":c:", styledText.getLineAtOffset(0) == 0);
-}
-
-public void test_getLineCount() {
- assertTrue(":d:", styledText.getLineCount() == 1);
-}
-
-public void test_getLineDelimiter() {
- assertTrue(":e:", styledText.getLineDelimiter().equals("getLineDelimiter"));
-}
-
-public void test_getOffsetAtLineI() {
- // will indirectly cause getOffsetAtLine to be called
- assertTrue(":f:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0)));
-}
-
-public void test_getTextRangeII() {
- assertTrue(":g:", styledText.getTextRange(0,0).equals(""));
-}
-
-public void test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() {
- // does not make sense to test, not called by StyledText
-}
-
-public void test_replaceTextRangeIILjava_lang_String() {
- styledText.replaceTextRange(0,0,"test1");
- assertTrue(":h:", styledText.getText().equals("test1"));
-}
-
-public void test_setTextLjava_lang_String() {
- styledText.replaceTextRange(0,0,"test2");
- assertTrue(":i:", styledText.getText().equals("test2"));
-}
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener");
- methodNames.addElement("test_getCharCount");
- methodNames.addElement("test_getLineI");
- methodNames.addElement("test_getLineAtOffsetI");
- methodNames.addElement("test_getLineCount");
- methodNames.addElement("test_getLineDelimiter");
- methodNames.addElement("test_getOffsetAtLineI");
- methodNames.addElement("test_getTextRangeII");
- methodNames.addElement("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener");
- methodNames.addElement("test_replaceTextRangeIILjava_lang_String");
- methodNames.addElement("test_setTextLjava_lang_String");
- return methodNames;
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_StyledTextContent((String)e.nextElement()));
- }
- return suite;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener();
- else if (getName().equals("test_getCharCount")) test_getCharCount();
- else if (getName().equals("test_getLineI")) test_getLineI();
- else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI();
- else if (getName().equals("test_getLineCount")) test_getLineCount();
- else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter();
- else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI();
- else if (getName().equals("test_getTextRangeII")) test_getTextRangeII();
- else if (getName().equals("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener();
- else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java
deleted file mode 100644
index 1257eea636..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TableEditor
- *
- * @see org.eclipse.swt.custom.TableEditor
- */
-public class Test_org_eclipse_swt_custom_TableEditor extends Test_org_eclipse_swt_custom_ControlEditor {
-
-public Test_org_eclipse_swt_custom_TableEditor(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Table() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Table not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getColumn() {
- warnUnimpl("Test test_getColumn not written");
-}
-
-public void test_setColumnI() {
- warnUnimpl("Test test_setColumnI not written");
-}
-
-public void test_getItem() {
- warnUnimpl("Test test_getItem not written");
-}
-
-public void test_setItemLorg_eclipse_swt_widgets_TableItem() {
- warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TableItem not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TableEditor((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Table");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getColumn");
- methodNames.addElement("test_setColumnI");
- methodNames.addElement("test_getItem");
- methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TableItem");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI");
- methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Table")) test_ConstructorLorg_eclipse_swt_widgets_Table();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getColumn")) test_getColumn();
- else if (getName().equals("test_setColumnI")) test_setColumnI();
- else if (getName().equals("test_getItem")) test_getItem();
- else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TableItem")) test_setItemLorg_eclipse_swt_widgets_TableItem();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
deleted file mode 100644
index ffe9174b3c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TableTree
- *
- * @see org.eclipse.swt.custom.TableTree
- */
-public class Test_org_eclipse_swt_custom_TableTree extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_TableTree(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() {
- warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written");
-}
-
-public void test_computeSizeII() {
- warnUnimpl("Test test_computeSizeII not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_deselectAll() {
- warnUnimpl("Test test_deselectAll not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItemHeight() {
- warnUnimpl("Test test_getItemHeight not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionCount() {
- warnUnimpl("Test test_getSelectionCount not written");
-}
-
-public void test_getTable() {
- warnUnimpl("Test test_getTable not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() {
- warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written");
-}
-
-public void test_getItemLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_removeAll() {
- warnUnimpl("Test test_removeAll not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() {
- warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written");
-}
-
-public void test_selectAll() {
- warnUnimpl("Test test_selectAll not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setMenuLorg_eclipse_swt_widgets_Menu() {
- warnUnimpl("Test test_setMenuLorg_eclipse_swt_widgets_Menu not written");
-}
-
-public void test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem() {
- warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem not written");
-}
-
-public void test_setToolTipTextLjava_lang_String() {
- warnUnimpl("Test test_setToolTipTextLjava_lang_String not written");
-}
-
-public void test_showItemLorg_eclipse_swt_custom_TableTreeItem() {
- warnUnimpl("Test test_showItemLorg_eclipse_swt_custom_TableTreeItem not written");
-}
-
-public void test_showSelection() {
- warnUnimpl("Test test_showSelection not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TableTree((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener");
- methodNames.addElement("test_computeSizeII");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_getTable");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem");
- methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu");
- methodNames.addElement("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addElement("test_showItemLorg_eclipse_swt_custom_TableTreeItem");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener();
- else if (getName().equals("test_computeSizeII")) test_computeSizeII();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_getTable")) test_getTable();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem();
- else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu();
- else if (getName().equals("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem")) test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else if (getName().equals("test_showItemLorg_eclipse_swt_custom_TableTreeItem")) test_showItemLorg_eclipse_swt_custom_TableTreeItem();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java
deleted file mode 100644
index a39daecb92..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TableTreeEditor
- *
- * @see org.eclipse.swt.custom.TableTreeEditor
- */
-public class Test_org_eclipse_swt_custom_TableTreeEditor extends Test_org_eclipse_swt_custom_ControlEditor {
-
-public Test_org_eclipse_swt_custom_TableTreeEditor(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_TableTree() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTree not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getColumn() {
- warnUnimpl("Test test_getColumn not written");
-}
-
-public void test_setColumnI() {
- warnUnimpl("Test test_setColumnI not written");
-}
-
-public void test_getItem() {
- warnUnimpl("Test test_getItem not written");
-}
-
-public void test_setItemLorg_eclipse_swt_custom_TableTreeItem() {
- warnUnimpl("Test test_setItemLorg_eclipse_swt_custom_TableTreeItem not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TableTreeEditor((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTree");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getColumn");
- methodNames.addElement("test_setColumnI");
- methodNames.addElement("test_getItem");
- methodNames.addElement("test_setItemLorg_eclipse_swt_custom_TableTreeItem");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI");
- methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTree")) test_ConstructorLorg_eclipse_swt_custom_TableTree();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getColumn")) test_getColumn();
- else if (getName().equals("test_setColumnI")) test_setColumnI();
- else if (getName().equals("test_getItem")) test_getItem();
- else if (getName().equals("test_setItemLorg_eclipse_swt_custom_TableTreeItem")) test_setItemLorg_eclipse_swt_custom_TableTreeItem();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java
deleted file mode 100644
index ca0e0d0c40..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TableTreeItem
- *
- * @see org.eclipse.swt.custom.TableTreeItem
- */
-public class Test_org_eclipse_swt_custom_TableTreeItem extends Test_org_eclipse_swt_widgets_Item {
-
- TableTree tableTree;
- TableTreeItem tableTreeItem;
-
-public Test_org_eclipse_swt_custom_TableTreeItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- tableTree = new TableTree(shell, 0);
- tableTreeItem = new TableTreeItem(tableTree, 0);
- setWidget(tableTreeItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_TableTreeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeI not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_TableTreeII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeII not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII not written");
-}
-
-public void test_getBoundsI() {
- warnUnimpl("Test test_getBoundsI not written");
-}
-
-public void test_getChecked() {
- warnUnimpl("Test test_getChecked not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getExpanded() {
- warnUnimpl("Test test_getExpanded not written");
-}
-
-public void test_getImage() {
- warnUnimpl("Test test_getImage not written");
-}
-
-public void test_getImageI() {
- warnUnimpl("Test test_getImageI not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getParentItem() {
- warnUnimpl("Test test_getParentItem not written");
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_getTextI() {
- warnUnimpl("Test test_getTextI not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() {
- warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_setCheckedZ() {
- warnUnimpl("Test test_setCheckedZ not written");
-}
-
-public void test_setExpandedZ() {
- warnUnimpl("Test test_setExpandedZ not written");
-}
-
-public void test_setImageILorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setTextILjava_lang_String() {
- warnUnimpl("Test test_setTextILjava_lang_String not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TableTreeItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeII");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII");
- methodNames.addElement("test_getBoundsI");
- methodNames.addElement("test_getChecked");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getExpanded");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getImageI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getParentItem");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getTextI");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_setCheckedZ");
- methodNames.addElement("test_setExpandedZ");
- methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextILjava_lang_String");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeII();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII();
- else if (getName().equals("test_getBoundsI")) test_getBoundsI();
- else if (getName().equals("test_getChecked")) test_getChecked();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getExpanded")) test_getExpanded();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getImageI")) test_getImageI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getParentItem")) test_getParentItem();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getTextI")) test_getTextI();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_setCheckedZ")) test_setCheckedZ();
- else if (getName().equals("test_setExpandedZ")) test_setExpandedZ();
- else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java
deleted file mode 100644
index f346b9715a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java
+++ /dev/null
@@ -1,558 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TextChangeListener
- *
- * @see org.eclipse.swt.custom.TextChangeListener
- */
-public class Test_org_eclipse_swt_custom_TextChangeListener extends SwtTestCase {
- Shell shell;
- StyledText styledText;
- int verify = -1;
-
-public Test_org_eclipse_swt_custom_TextChangeListener(String name) {
- super(name);
-}
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-protected void setUp() {
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TextChangeListener((String)e.nextElement()));
- }
- return suite;
-}
-protected void tearDown() {
-}
-public void test_textChangingLorg_eclipse_swt_custom_TextChangingEvent() {
- StyledTextContent content = styledText.getContent();
- TextChangeListener listener = new TextChangeListener() {
- public void textChanging(TextChangingEvent event) {
- switch(verify) {
- case 1 : {
- assertTrue(":1a:", event.replaceLineCount == 0);
- assertTrue(":1b:", event.newLineCount == 1);
- break;
- }
- case 2 : {
- assertTrue(":2a:", event.replaceLineCount == 2);
- assertTrue(":2b:", event.newLineCount == 0);
- break;
- }
- case 3 : {
- assertTrue(":3a:", event.replaceLineCount == 0);
- assertTrue(":3b:", event.newLineCount == 2);
- break;
- }
- case 4: {
- assertTrue(":4:", false);
- break;
- }
- case 5 : {
- assertTrue(":5a:", event.replaceLineCount == 0);
- assertTrue(":5b:", event.newLineCount == 1);
- break;
- }
- case 6 : {
- assertTrue(":6a:", event.replaceLineCount == 1);
- assertTrue(":6b:", event.newLineCount == 0);
- break;
- }
- case 7 : {
- assertTrue(":7a:", event.replaceLineCount == 0);
- assertTrue(":7b:", event.newLineCount == 0);
- break;
- }
- case 8 : {
- assertTrue(":8a:", event.replaceLineCount == 1);
- assertTrue(":8b:", event.newLineCount == 0);
- break;
- }
- case 9 : {
- assertTrue(":9a:", event.replaceLineCount == 1);
- assertTrue(":9b:", event.newLineCount == 0);
- break;
- }
- case 10:{
- assertTrue(":10:", false);
- break;
- }
- case 11: {
- assertTrue(":11:", false);
- break;
- }
- case 12: {
- assertTrue(":12a:", event.replaceLineCount == 0);
- assertTrue(":12b:", event.newLineCount == 1);
- break;
- }
- case 13: {
- assertTrue(":13a:", event.replaceLineCount == 0);
- assertTrue(":13b:", event.newLineCount == 1);
- break;
- }
- case 14: {
- assertTrue(":14:", false);
- break;
- }
- case 15: {
- assertTrue(":15a:", event.replaceLineCount == 1);
- assertTrue(":15b:", event.newLineCount == 2);
- break;
- }
- case 16:{
- assertTrue(":16:", false);
- break;
- }
- case 17: {
- assertTrue(":17:", false);
- break;
- }
- case 18: {
- assertTrue(":18a:", event.replaceLineCount == 0);
- assertTrue(":18b:", event.newLineCount == 2);
- break;
- }
- case 19: {
- assertTrue(":19a:", event.replaceLineCount == 0);
- assertTrue(":19b:", event.newLineCount == 3);
- break;
- }
- case 20: {
- assertTrue(":20:", false);
- break;
- }
- }
- }
- public void textChanged(TextChangedEvent event) {
- }
- public void textSet(TextChangedEvent event) {
- }
- };
- content.addTextChangeListener(listener);
-
- boolean exceptionHandled = false;
- verify = 1;
- styledText.setText("testing");
- styledText.replaceTextRange(0, 0, "\n");
-
- verify = 2;
- styledText.setText("\n\n");
- styledText.replaceTextRange(0, 2, "a");
-
- verify = 3;
- styledText.setText("a");
- styledText.replaceTextRange(0, 1, "\n\n");
-
- verify = 4;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":4: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 5;
- styledText.setText("Line 1\r\nLine 2");
- styledText.replaceTextRange(0, 0, "\r");
-
- verify = 6;
- styledText.setText("This\nis a test\nline 3\nline 4");
- styledText.replaceTextRange(21, 7, "");
-
- verify = 7;
- styledText.setText("This\nis a test\r");
- styledText.replaceTextRange(5, 9, "");
-
- verify = 8;
- styledText.setText("\nL1\r\nL2\r\n");
- styledText.replaceTextRange(7, 2, "");
-
- verify = 9;
- styledText.setText("L1\r\n");
- styledText.replaceTextRange(2, 2, "test");
-
- verify = 10;
- styledText.setText("L1\r\n");
- try {styledText.replaceTextRange(3, 1, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":10: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 11;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {styledText.replaceTextRange(1, 2, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":11: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 12;
- styledText.setText("L1\r");
- styledText.replaceTextRange(3, 0, "\n");
-
- verify = 13;
- styledText.setText("L1\n");
- styledText.replaceTextRange(2, 0, "\r");
-
- verify = 14;
- styledText.setText("L1\r\n");
- try {styledText.replaceTextRange(3, 0, "test");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":14: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 15;
- styledText.setText("L1\r\n");
- styledText.replaceTextRange(2, 2, "test\n\n");
-
- verify = 16;
- styledText.setText("L1\r\n");
- try {styledText.replaceTextRange(3, 1, "test\r\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":16: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 17;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {styledText.replaceTextRange(1, 2, "test\n\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":17: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 18;
- styledText.setText("L1\r");
- styledText.replaceTextRange(3, 0, "\ntest\r\n");
-
- verify = 19;
- styledText.setText("L1\n");
- styledText.replaceTextRange(2, 0, "test\r\r\r");
- verify = 20;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":20: exception not thrown", exceptionHandled);
- exceptionHandled = false;
- content.removeTextChangeListener(listener);
-}
-
-public void test_textSetLorg_eclipse_swt_custom_TextChangedEvent() {
- StyledTextContent content = styledText.getContent();
- TextChangeListener listener = new TextChangeListener() {
- public void textChanging(TextChangingEvent event) {
- }
- public void textChanged(TextChangedEvent event) {
- }
- public void textSet(TextChangedEvent event) {
- switch (verify) {
- case 1 : {
- assertTrue(":1:", styledText.getText().equals("testing"));
- break;
- }
- case 2 : {
- assertTrue(":2:", styledText.getText().equals("\n\n"));
- break;
- }
- case 3 : {
- assertTrue(":3:", styledText.getText().equals("a"));
- break;
- }
- case 4 : {
- assertTrue(":4:", styledText.getText().equals(""));
- break;
- }
- }
- }
- };
- content.addTextChangeListener(listener);
-
- verify = 1;
- styledText.setText("testing");
-
- verify = 2;
- styledText.setText("\n\n");
-
- verify = 3;
- styledText.setText("a");
-
- verify = 4;
- try {styledText.setText(null);}
- catch (IllegalArgumentException ex) {assertTrue(":4:", true);}
- content.removeTextChangeListener(listener);
-}
-
-public void test_textChangedLorg_eclipse_swt_custom_TextChangedEvent() {
- StyledTextContent content = styledText.getContent();
- TextChangeListener listener = new TextChangeListener() {
- public void textChanged(TextChangedEvent event) {
- switch (verify) {
- case 1 : {
- assertTrue(":1:", styledText.getText().equals("\ntesting"));
- break;
- }
- case 2 : {
- assertTrue(":2:", styledText.getText().equals("a"));
- break;
- }
- case 3 : {
- assertTrue(":3:", styledText.getText().equals("\n\n"));
- break;
- }
- case 4: {
- assertTrue(":4:", false);
- break;
- }
- case 5 : {
- assertTrue(":5:", styledText.getText().equals("\rLine 1\r\nLine 2"));
- break;
- }
- case 6 : {
- assertTrue(":6:", styledText.getText().equals("This\nis a test\nline 3"));
- break;
- }
- case 7 : {
- assertTrue(":7:", styledText.getText().equals("This\n\r"));
- break;
- }
- case 8 : {
- assertTrue(":8:", styledText.getText().equals("\nL1\r\nL2"));
- break;
- }
- case 9 : {
- assertTrue(":9:", styledText.getText().equals("L1test"));
- break;
- }
- case 10:{
- assertTrue(":10:", false);
- break;
- }
- case 11: {
- assertTrue(":11:", false);
- break;
- }
- case 12: {
- assertTrue(":12:", styledText.getText().equals("L1\r\n"));
- break;
- }
- case 13: {
- assertTrue(":13:", styledText.getText().equals("L1\r\n"));
- break;
- }
- case 14: {
- assertTrue(":14:", false);
- break;
- }
- case 15: {
- assertTrue(":15:", styledText.getText().equals("L1test\n\n"));
- break;
- }
- case 16:{
- assertTrue(":16:", false);
- break;
- }
- case 17: {
- assertTrue(":17:", false);
- break;
- }
- case 18: {
- assertTrue(":18:", styledText.getText().equals("L1\r\ntest\r\n"));
- break;
- }
- case 19: {
- assertTrue(":19:", styledText.getText().equals("L1test\r\r\r\n"));
- break;
- }
- case 20: {
- assertTrue(":20:", false);
- break;
- }
- }
- }
- public void textChanging(TextChangingEvent event) {
- }
- public void textSet(TextChangedEvent event) {
- }
- };
- content.addTextChangeListener(listener);
-
- boolean exceptionHandled = false;
- verify = 0;
- styledText.setText("testing");
- verify = 1;
- styledText.replaceTextRange(0, 0, "\n");
-
- verify = 0;
- styledText.setText("\n\n");
- verify = 2;
- styledText.replaceTextRange(0, 2, "a");
-
- verify = 0;
- styledText.setText("a");
- verify = 3;
- styledText.replaceTextRange(0, 1, "\n\n");
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 4;
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":4: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("Line 1\r\nLine 2");
- verify = 5;
- styledText.replaceTextRange(0, 0, "\r");
-
- verify = 0;
- styledText.setText("This\nis a test\nline 3\nline 4");
- verify = 6;
- styledText.replaceTextRange(21, 7, "");
-
- verify = 0;
- styledText.setText("This\nis a test\r");
- verify = 7;
- styledText.replaceTextRange(5, 9, "");
-
- verify = 0;
- styledText.setText("\nL1\r\nL2\r\n");
- verify = 8;
- styledText.replaceTextRange(7, 2, "");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 9;
- styledText.replaceTextRange(2, 2, "test");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 10;
- try {styledText.replaceTextRange(3, 1, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":10: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 11;
- try {styledText.replaceTextRange(1, 2, "");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":11: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r");
- verify = 12;
- styledText.replaceTextRange(3, 0, "\n");
-
- verify = 0;
- styledText.setText("L1\n");
- verify = 13;
- styledText.replaceTextRange(2, 0, "\r");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 14;
- try {styledText.replaceTextRange(3, 0, "test");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":14: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 15;
- styledText.replaceTextRange(2, 2, "test\n\n");
-
- verify = 0;
- styledText.setText("L1\r\n");
- verify = 16;
- try {styledText.replaceTextRange(3, 1, "test\r\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":16: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 17;
- try {styledText.replaceTextRange(1, 2, "test\n\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":17: exception not thrown", exceptionHandled);
- exceptionHandled = false;
-
- verify = 0;
- styledText.setText("L1\r");
- verify = 18;
- styledText.replaceTextRange(3, 0, "\ntest\r\n");
-
- verify = 0;
- styledText.setText("L1\n");
- verify = 19;
- styledText.replaceTextRange(2, 0, "test\r\r\r");
-
- verify = 0;
- styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- verify = 20;
- try {styledText.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {
- exceptionHandled = true;
- }
- assertTrue(":20: exception not thrown", exceptionHandled);
- exceptionHandled = false;
- content.removeTextChangeListener(listener);
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent");
- methodNames.addElement("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent");
- methodNames.addElement("test_textSetLorg_eclipse_swt_custom_TextChangedEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent")) test_textChangingLorg_eclipse_swt_custom_TextChangingEvent();
- else if (getName().equals("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent")) test_textChangedLorg_eclipse_swt_custom_TextChangedEvent();
- else if (getName().equals("test_textSetLorg_eclipse_swt_custom_TextChangedEvent")) test_textSetLorg_eclipse_swt_custom_TextChangedEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java
deleted file mode 100644
index 4e48aee295..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TextChangedEvent
- *
- * @see org.eclipse.swt.custom.TextChangedEvent
- */
-public class Test_org_eclipse_swt_custom_TextChangedEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_TextChangedEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() {
- // this method tested by other test classes
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TextChangedEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java
deleted file mode 100644
index 212a57bee3..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TextChangingEvent
- *
- * @see org.eclipse.swt.custom.TextChangingEvent
- */
-public class Test_org_eclipse_swt_custom_TextChangingEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_custom_TextChangingEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() {
- // this method tested by other test classes
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TextChangingEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java
deleted file mode 100644
index cb9200a15d..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.TreeEditor
- *
- * @see org.eclipse.swt.custom.TreeEditor
- */
-public class Test_org_eclipse_swt_custom_TreeEditor extends Test_org_eclipse_swt_custom_ControlEditor {
-
-public Test_org_eclipse_swt_custom_TreeEditor(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Tree() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Tree not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getItem() {
- warnUnimpl("Test test_getItem not written");
-}
-
-public void test_setItemLorg_eclipse_swt_widgets_TreeItem() {
- warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TreeItem not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem not written");
-}
-
-public void test_setEditorLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_TreeEditor((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Tree");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getItem");
- methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TreeItem");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem");
- methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control");
- methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Tree")) test_ConstructorLorg_eclipse_swt_widgets_Tree();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getItem")) test_getItem();
- else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TreeItem")) test_setItemLorg_eclipse_swt_widgets_TreeItem();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem();
- else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java
deleted file mode 100644
index 57e2e994d4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.VerifyKeyListener
- *
- * @see org.eclipse.swt.custom.VerifyKeyListener
- */
-public class Test_org_eclipse_swt_custom_VerifyKeyListener extends SwtTestCase {
- Shell shell;
- StyledText styledText;
- int verify = -1;
-
-public Test_org_eclipse_swt_custom_VerifyKeyListener(String name) {
- super(name);
-}
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-protected void setUp() {
- shell = new Shell();
- styledText = new StyledText(shell, SWT.NULL);
- shell.open();
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_VerifyKeyListener((String)e.nextElement()));
- }
- return suite;
-}
-protected void tearDown() {
-}
-
-public void test_verifyKeyLorg_eclipse_swt_events_VerifyEvent() {
- VerifyKeyListener listener = new VerifyKeyListener() {
- public void verifyKey(VerifyEvent event) {
- if (verify != 1) {event.doit = false;}
- }
- };
- styledText.addVerifyKeyListener(listener);
- verify = 1;
- Event e = new Event();
- e.character = 'a';
- styledText.notifyListeners(SWT.KeyDown, e);
- assertTrue(":1:", styledText.getText().equals("a"));
-
- verify = 2;
- styledText.setText("");
- e = new Event();
- e.character = 'a';
- styledText.notifyListeners(SWT.KeyDown, e);
- assertTrue(":2:", styledText.getText().equals(""));
- styledText.removeVerifyKeyListener(listener);
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent")) test_verifyKeyLorg_eclipse_swt_events_VerifyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java
deleted file mode 100644
index 5cdefb8d38..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.custom.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.custom.ViewForm
- *
- * @see org.eclipse.swt.custom.ViewForm
- */
-public class Test_org_eclipse_swt_custom_ViewForm extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_custom_ViewForm(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getContent() {
- warnUnimpl("Test test_getContent not written");
-}
-
-public void test_getTopCenter() {
- warnUnimpl("Test test_getTopCenter not written");
-}
-
-public void test_getTopLeft() {
- warnUnimpl("Test test_getTopLeft not written");
-}
-
-public void test_getTopRight() {
- warnUnimpl("Test test_getTopRight not written");
-}
-
-public void test_layoutZ() {
- warnUnimpl("Test test_layoutZ not written");
-}
-
-public void test_setContentLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setLayoutLorg_eclipse_swt_widgets_Layout() {
- warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written");
-}
-
-public void test_setTopCenterLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setTopCenterLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setTopLeftLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setTopLeftLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setTopRightLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setTopRightLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setBorderVisibleZ() {
- warnUnimpl("Test test_setBorderVisibleZ not written");
-}
-
-public void test_setTopCenterSeparateZ() {
- warnUnimpl("Test test_setTopCenterSeparateZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_custom_ViewForm((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getContent");
- methodNames.addElement("test_getTopCenter");
- methodNames.addElement("test_getTopLeft");
- methodNames.addElement("test_getTopRight");
- methodNames.addElement("test_layoutZ");
- methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout");
- methodNames.addElement("test_setTopCenterLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setTopLeftLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setTopRightLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setBorderVisibleZ");
- methodNames.addElement("test_setTopCenterSeparateZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getContent")) test_getContent();
- else if (getName().equals("test_getTopCenter")) test_getTopCenter();
- else if (getName().equals("test_getTopLeft")) test_getTopLeft();
- else if (getName().equals("test_getTopRight")) test_getTopRight();
- else if (getName().equals("test_layoutZ")) test_layoutZ();
- else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout();
- else if (getName().equals("test_setTopCenterLorg_eclipse_swt_widgets_Control")) test_setTopCenterLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setTopLeftLorg_eclipse_swt_widgets_Control")) test_setTopLeftLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setTopRightLorg_eclipse_swt_widgets_Control")) test_setTopRightLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ();
- else if (getName().equals("test_setTopCenterSeparateZ")) test_setTopCenterSeparateZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java
deleted file mode 100644
index 70be934696..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.ByteArrayTransfer
- *
- * @see org.eclipse.swt.dnd.ByteArrayTransfer
- */
-public class Test_org_eclipse_swt_dnd_ByteArrayTransfer extends Test_org_eclipse_swt_dnd_Transfer {
-
-public Test_org_eclipse_swt_dnd_ByteArrayTransfer(String name) {
- super(name);
-}
-
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_getSupportedTypes() {
- warnUnimpl("Test test_getSupportedTypes not written");
-}
-
-public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_getSupportedTypes");
- methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData");
- methodNames.addAll(Test_org_eclipse_swt_dnd_Transfer.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes();
- else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java
deleted file mode 100644
index 4574e046a4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.Clipboard
- *
- * @see org.eclipse.swt.dnd.Clipboard
- */
-public class Test_org_eclipse_swt_dnd_Clipboard extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_Clipboard(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Display() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getContentsLorg_eclipse_swt_dnd_Transfer() {
- warnUnimpl("Test test_getContentsLorg_eclipse_swt_dnd_Transfer not written");
-}
-
-public void test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer() {
- warnUnimpl("Test test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer not written");
-}
-
-public void test_getAvailableTypeNames() {
- warnUnimpl("Test test_getAvailableTypeNames not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_Clipboard((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getContentsLorg_eclipse_swt_dnd_Transfer");
- methodNames.addElement("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer");
- methodNames.addElement("test_getAvailableTypeNames");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getContentsLorg_eclipse_swt_dnd_Transfer")) test_getContentsLorg_eclipse_swt_dnd_Transfer();
- else if (getName().equals("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer")) test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer();
- else if (getName().equals("test_getAvailableTypeNames")) test_getAvailableTypeNames();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java
deleted file mode 100644
index 5f5eb704ef..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DND
- *
- * @see org.eclipse.swt.dnd.DND
- */
-public class Test_org_eclipse_swt_dnd_DND extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_DND(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_errorI() {
- warnUnimpl("Test test_errorI not written");
-}
-
-public void test_errorII() {
- warnUnimpl("Test test_errorII not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DND((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_errorI");
- methodNames.addElement("test_errorII");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_errorI")) test_errorI();
- else if (getName().equals("test_errorII")) test_errorII();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java
deleted file mode 100644
index 80b967e5d2..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DragSource
- *
- * @see org.eclipse.swt.dnd.DragSource
- */
-public class Test_org_eclipse_swt_dnd_DragSource extends Test_org_eclipse_swt_widgets_Widget {
-
-public Test_org_eclipse_swt_dnd_DragSource(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written");
-}
-
-public void test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener() {
- warnUnimpl("Test test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written");
-}
-
-public void test_getControl() {
- warnUnimpl("Test test_getControl not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getTransfer() {
- warnUnimpl("Test test_getTransfer not written");
-}
-
-public void test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener() {
- warnUnimpl("Test test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written");
-}
-
-public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() {
- warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DragSource((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI");
- methodNames.addElement("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getTransfer");
- methodNames.addElement("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener");
- methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer");
- methodNames.addElement("test_checkSubclass");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI();
- else if (getName().equals("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getTransfer")) test_getTransfer();
- else if (getName().equals("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener();
- else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java
deleted file mode 100644
index a8d2e13955..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceAdapter
- *
- * @see org.eclipse.swt.dnd.DragSourceAdapter
- */
-public class Test_org_eclipse_swt_dnd_DragSourceAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_DragSourceAdapter(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceAdapter((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent");
- methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent");
- methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent();
- else if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent();
- else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java
deleted file mode 100644
index fbaf351773..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceEvent
- *
- * @see org.eclipse.swt.dnd.DragSourceEvent
- */
-public class Test_org_eclipse_swt_dnd_DragSourceEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_dnd_DragSourceEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java
deleted file mode 100644
index 697cbea387..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceListener
- *
- * @see org.eclipse.swt.dnd.DragSourceListener
- */
-public class Test_org_eclipse_swt_dnd_DragSourceListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_DragSourceListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() {
- warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent");
- methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent");
- methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent();
- else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent();
- else if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java
deleted file mode 100644
index 21edb1aa83..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DropTarget
- *
- * @see org.eclipse.swt.dnd.DropTarget
- */
-public class Test_org_eclipse_swt_dnd_DropTarget extends Test_org_eclipse_swt_widgets_Widget {
-
-public Test_org_eclipse_swt_dnd_DropTarget(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written");
-}
-
-public void test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener() {
- warnUnimpl("Test test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written");
-}
-
-public void test_getControl() {
- warnUnimpl("Test test_getControl not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getTransfer() {
- warnUnimpl("Test test_getTransfer not written");
-}
-
-public void test_notifyListenersILorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_notifyListenersILorg_eclipse_swt_widgets_Event not written");
-}
-
-public void test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener() {
- warnUnimpl("Test test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written");
-}
-
-public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() {
- warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DropTarget((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI");
- methodNames.addElement("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getTransfer");
- methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event");
- methodNames.addElement("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener");
- methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer");
- methodNames.addElement("test_checkSubclass");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI();
- else if (getName().equals("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getTransfer")) test_getTransfer();
- else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event();
- else if (getName().equals("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener();
- else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java
deleted file mode 100644
index 8fb278fe4b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetAdapter
- *
- * @see org.eclipse.swt.dnd.DropTargetAdapter
- */
-public class Test_org_eclipse_swt_dnd_DropTargetAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_DropTargetAdapter(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetAdapter((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java
deleted file mode 100644
index 02a1a9e027..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetEvent
- *
- * @see org.eclipse.swt.dnd.DropTargetEvent
- */
-public class Test_org_eclipse_swt_dnd_DropTargetEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_dnd_DropTargetEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java
deleted file mode 100644
index 73897bc59b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetListener
- *
- * @see org.eclipse.swt.dnd.DropTargetListener
- */
-public class Test_org_eclipse_swt_dnd_DropTargetListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_DropTargetListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() {
- warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent");
- methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent();
- else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java
deleted file mode 100644
index 58050f0cdd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.FileTransfer
- *
- * @see org.eclipse.swt.dnd.FileTransfer
- */
-public class Test_org_eclipse_swt_dnd_FileTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer {
-
-public Test_org_eclipse_swt_dnd_FileTransfer(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_getInstance() {
- warnUnimpl("Test test_getInstance not written");
-}
-
-public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_getTypeIds() {
- warnUnimpl("Test test_getTypeIds not written");
-}
-
-public void test_getTypeNames() {
- warnUnimpl("Test test_getTypeNames not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_FileTransfer((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_getInstance");
- methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_getTypeIds");
- methodNames.addElement("test_getTypeNames");
- methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_getInstance")) test_getInstance();
- else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_getTypeIds")) test_getTypeIds();
- else if (getName().equals("test_getTypeNames")) test_getTypeNames();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java
deleted file mode 100644
index b4a7a8969c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.RTFTransfer
- *
- * @see org.eclipse.swt.dnd.RTFTransfer
- */
-public class Test_org_eclipse_swt_dnd_RTFTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer {
-
-public Test_org_eclipse_swt_dnd_RTFTransfer(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_getInstance() {
- warnUnimpl("Test test_getInstance not written");
-}
-
-public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_getTypeIds() {
- warnUnimpl("Test test_getTypeIds not written");
-}
-
-public void test_getTypeNames() {
- warnUnimpl("Test test_getTypeNames not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_RTFTransfer((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_getInstance");
- methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_getTypeIds");
- methodNames.addElement("test_getTypeNames");
- methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_getInstance")) test_getInstance();
- else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_getTypeIds")) test_getTypeIds();
- else if (getName().equals("test_getTypeNames")) test_getTypeNames();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java
deleted file mode 100644
index 200a576a6a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.TextTransfer
- *
- * @see org.eclipse.swt.dnd.TextTransfer
- */
-public class Test_org_eclipse_swt_dnd_TextTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer {
-
-public Test_org_eclipse_swt_dnd_TextTransfer(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_getInstance() {
- warnUnimpl("Test test_getInstance not written");
-}
-
-public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_getTypeIds() {
- warnUnimpl("Test test_getTypeIds not written");
-}
-
-public void test_getTypeNames() {
- warnUnimpl("Test test_getTypeNames not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_TextTransfer((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_getInstance");
- methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_getTypeIds");
- methodNames.addElement("test_getTypeNames");
- methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_getInstance")) test_getInstance();
- else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_getTypeIds")) test_getTypeIds();
- else if (getName().equals("test_getTypeNames")) test_getTypeNames();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java
deleted file mode 100644
index 42847366f8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.Transfer
- *
- * @see org.eclipse.swt.dnd.Transfer
- */
-public class Test_org_eclipse_swt_dnd_Transfer extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_Transfer(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_getSupportedTypes() {
- warnUnimpl("Test test_getSupportedTypes not written");
-}
-
-public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_getTypeIds() {
- warnUnimpl("Test test_getTypeIds not written");
-}
-
-public void test_getTypeNames() {
- warnUnimpl("Test test_getTypeNames not written");
-}
-
-public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() {
- warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written");
-}
-
-public void test_registerTypeLjava_lang_String() {
- warnUnimpl("Test test_registerTypeLjava_lang_String not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_getSupportedTypes");
- methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_getTypeIds");
- methodNames.addElement("test_getTypeNames");
- methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData");
- methodNames.addElement("test_registerTypeLjava_lang_String");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes();
- else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_getTypeIds")) test_getTypeIds();
- else if (getName().equals("test_getTypeNames")) test_getTypeNames();
- else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData();
- else if (getName().equals("test_registerTypeLjava_lang_String")) test_registerTypeLjava_lang_String();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java
deleted file mode 100644
index 4d824ce5f8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.dnd.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.dnd.TransferData
- *
- * @see org.eclipse.swt.dnd.TransferData
- */
-public class Test_org_eclipse_swt_dnd_TransferData extends SwtTestCase {
-
-public Test_org_eclipse_swt_dnd_TransferData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_dnd_TransferData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java
deleted file mode 100644
index c7c02f2e04..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ArmEvent
- *
- * @see org.eclipse.swt.events.ArmEvent
- */
-public class Test_org_eclipse_swt_events_ArmEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_ArmEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_ArmEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java
deleted file mode 100644
index 55bacaafb5..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ArmListener
- *
- * @see org.eclipse.swt.events.ArmListener
- */
-public class Test_org_eclipse_swt_events_ArmListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ArmListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_widgetArmedLorg_eclipse_swt_events_ArmEvent() {
- warnUnimpl("Test test_widgetArmedLorg_eclipse_swt_events_ArmEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_widgetArmedLorg_eclipse_swt_events_ArmEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_widgetArmedLorg_eclipse_swt_events_ArmEvent")) test_widgetArmedLorg_eclipse_swt_events_ArmEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java
deleted file mode 100644
index 3688a6e70a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ControlAdapter
- *
- * @see org.eclipse.swt.events.ControlAdapter
- */
-public class Test_org_eclipse_swt_events_ControlAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ControlAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() {
- warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written");
-}
-
-public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() {
- warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent");
- methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent();
- else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java
deleted file mode 100644
index aaadbe2684..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ControlEvent
- *
- * @see org.eclipse.swt.events.ControlEvent
- */
-public class Test_org_eclipse_swt_events_ControlEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_ControlEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_ControlEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java
deleted file mode 100644
index 0052e44e61..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ControlListener
- *
- * @see org.eclipse.swt.events.ControlListener
- */
-public class Test_org_eclipse_swt_events_ControlListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ControlListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() {
- warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written");
-}
-
-public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() {
- warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent");
- methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent();
- else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java
deleted file mode 100644
index 6662bcdd9f..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.DisposeEvent
- *
- * @see org.eclipse.swt.events.DisposeEvent
- */
-public class Test_org_eclipse_swt_events_DisposeEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_DisposeEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_DisposeEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java
deleted file mode 100644
index 18352f60f1..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.DisposeListener
- *
- * @see org.eclipse.swt.events.DisposeListener
- */
-public class Test_org_eclipse_swt_events_DisposeListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_DisposeListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent() {
- warnUnimpl("Test test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent")) test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java
deleted file mode 100644
index bae70d6e09..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.FocusAdapter
- *
- * @see org.eclipse.swt.events.FocusAdapter
- */
-public class Test_org_eclipse_swt_events_FocusAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_FocusAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() {
- warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written");
-}
-
-public void test_focusLostLorg_eclipse_swt_events_FocusEvent() {
- warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent");
- methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent();
- else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java
deleted file mode 100644
index bf06714607..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.FocusEvent
- *
- * @see org.eclipse.swt.events.FocusEvent
- */
-public class Test_org_eclipse_swt_events_FocusEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_FocusEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_FocusEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java
deleted file mode 100644
index 8c7e32b46d..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.FocusListener
- *
- * @see org.eclipse.swt.events.FocusListener
- */
-public class Test_org_eclipse_swt_events_FocusListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_FocusListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() {
- warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written");
-}
-
-public void test_focusLostLorg_eclipse_swt_events_FocusEvent() {
- warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent");
- methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent();
- else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java
deleted file mode 100644
index 1854e146fa..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.HelpEvent
- *
- * @see org.eclipse.swt.events.HelpEvent
- */
-public class Test_org_eclipse_swt_events_HelpEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_HelpEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_HelpEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java
deleted file mode 100644
index 5dcc1e5e2a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.HelpListener
- *
- * @see org.eclipse.swt.events.HelpListener
- */
-public class Test_org_eclipse_swt_events_HelpListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_HelpListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_helpRequestedLorg_eclipse_swt_events_HelpEvent() {
- warnUnimpl("Test test_helpRequestedLorg_eclipse_swt_events_HelpEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_helpRequestedLorg_eclipse_swt_events_HelpEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_helpRequestedLorg_eclipse_swt_events_HelpEvent")) test_helpRequestedLorg_eclipse_swt_events_HelpEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java
deleted file mode 100644
index 8d8c295cf5..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.KeyAdapter
- *
- * @see org.eclipse.swt.events.KeyAdapter
- */
-public class Test_org_eclipse_swt_events_KeyAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_KeyAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() {
- warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written");
-}
-
-public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() {
- warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent");
- methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent();
- else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java
deleted file mode 100644
index 08a75c93cd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.KeyEvent
- *
- * @see org.eclipse.swt.events.KeyEvent
- */
-public class Test_org_eclipse_swt_events_KeyEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_KeyEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_KeyEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java
deleted file mode 100644
index ae6afde2c0..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.KeyListener
- *
- * @see org.eclipse.swt.events.KeyListener
- */
-public class Test_org_eclipse_swt_events_KeyListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_KeyListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() {
- warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written");
-}
-
-public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() {
- warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent");
- methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent();
- else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java
deleted file mode 100644
index ad62105834..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MenuAdapter
- *
- * @see org.eclipse.swt.events.MenuAdapter
- */
-public class Test_org_eclipse_swt_events_MenuAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MenuAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() {
- warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written");
-}
-
-public void test_menuShownLorg_eclipse_swt_events_MenuEvent() {
- warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent");
- methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent();
- else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java
deleted file mode 100644
index 3be5465a07..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MenuEvent
- *
- * @see org.eclipse.swt.events.MenuEvent
- */
-public class Test_org_eclipse_swt_events_MenuEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_MenuEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_MenuEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java
deleted file mode 100644
index 42e6980494..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MenuListener
- *
- * @see org.eclipse.swt.events.MenuListener
- */
-public class Test_org_eclipse_swt_events_MenuListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MenuListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() {
- warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written");
-}
-
-public void test_menuShownLorg_eclipse_swt_events_MenuEvent() {
- warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent");
- methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent();
- else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java
deleted file mode 100644
index 4cb9b84ab6..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ModifyEvent
- *
- * @see org.eclipse.swt.events.ModifyEvent
- */
-public class Test_org_eclipse_swt_events_ModifyEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_ModifyEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_ModifyEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java
deleted file mode 100644
index 68f4ee1011..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ModifyListener
- *
- * @see org.eclipse.swt.events.ModifyListener
- */
-public class Test_org_eclipse_swt_events_ModifyListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ModifyListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_modifyTextLorg_eclipse_swt_events_ModifyEvent() {
- warnUnimpl("Test test_modifyTextLorg_eclipse_swt_events_ModifyEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_modifyTextLorg_eclipse_swt_events_ModifyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_modifyTextLorg_eclipse_swt_events_ModifyEvent")) test_modifyTextLorg_eclipse_swt_events_ModifyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java
deleted file mode 100644
index 8f76f16a00..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseAdapter
- *
- * @see org.eclipse.swt.events.MouseAdapter
- */
-public class Test_org_eclipse_swt_events_MouseAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MouseAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java
deleted file mode 100644
index 990fea8c41..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseEvent
- *
- * @see org.eclipse.swt.events.MouseEvent
- */
-public class Test_org_eclipse_swt_events_MouseEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_MouseEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_MouseEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java
deleted file mode 100644
index ddd3c64d0b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseListener
- *
- * @see org.eclipse.swt.events.MouseListener
- */
-public class Test_org_eclipse_swt_events_MouseListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MouseListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java
deleted file mode 100644
index 02ce4d0a91..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseMoveListener
- *
- * @see org.eclipse.swt.events.MouseMoveListener
- */
-public class Test_org_eclipse_swt_events_MouseMoveListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MouseMoveListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_mouseMoveLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseMoveLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_mouseMoveLorg_eclipse_swt_events_MouseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_mouseMoveLorg_eclipse_swt_events_MouseEvent")) test_mouseMoveLorg_eclipse_swt_events_MouseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java
deleted file mode 100644
index d3022a6ef8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseTrackAdapter
- *
- * @see org.eclipse.swt.events.MouseTrackAdapter
- */
-public class Test_org_eclipse_swt_events_MouseTrackAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MouseTrackAdapter(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_MouseTrackAdapter((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java
deleted file mode 100644
index 07abd33200..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.MouseTrackListener
- *
- * @see org.eclipse.swt.events.MouseTrackListener
- */
-public class Test_org_eclipse_swt_events_MouseTrackListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_MouseTrackListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() {
- warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent");
- methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent();
- else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java
deleted file mode 100644
index 465bc06519..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.PaintEvent
- *
- * @see org.eclipse.swt.events.PaintEvent
- */
-public class Test_org_eclipse_swt_events_PaintEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_PaintEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_PaintEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java
deleted file mode 100644
index bf576db158..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.PaintListener
- *
- * @see org.eclipse.swt.events.PaintListener
- */
-public class Test_org_eclipse_swt_events_PaintListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_PaintListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_paintControlLorg_eclipse_swt_events_PaintEvent() {
- warnUnimpl("Test test_paintControlLorg_eclipse_swt_events_PaintEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_paintControlLorg_eclipse_swt_events_PaintEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_paintControlLorg_eclipse_swt_events_PaintEvent")) test_paintControlLorg_eclipse_swt_events_PaintEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java
deleted file mode 100644
index 58687acd58..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.SelectionAdapter
- *
- * @see org.eclipse.swt.events.SelectionAdapter
- */
-public class Test_org_eclipse_swt_events_SelectionAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_SelectionAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() {
- warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written");
-}
-
-public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() {
- warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent");
- methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent();
- else if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java
deleted file mode 100644
index 66e5a3892d..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.SelectionEvent
- *
- * @see org.eclipse.swt.events.SelectionEvent
- */
-public class Test_org_eclipse_swt_events_SelectionEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_SelectionEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_SelectionEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java
deleted file mode 100644
index 9efed83541..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.SelectionListener
- *
- * @see org.eclipse.swt.events.SelectionListener
- */
-public class Test_org_eclipse_swt_events_SelectionListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_SelectionListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() {
- warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written");
-}
-
-public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() {
- warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent");
- methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent();
- else if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java
deleted file mode 100644
index 70449d59d8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ShellAdapter
- *
- * @see org.eclipse.swt.events.ShellAdapter
- */
-public class Test_org_eclipse_swt_events_ShellAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ShellAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java
deleted file mode 100644
index 21099cc76a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ShellEvent
- *
- * @see org.eclipse.swt.events.ShellEvent
- */
-public class Test_org_eclipse_swt_events_ShellEvent extends Test_org_eclipse_swt_events_TypedEvent {
-
-public Test_org_eclipse_swt_events_ShellEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_ShellEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java
deleted file mode 100644
index d2cd82257e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.ShellListener
- *
- * @see org.eclipse.swt.events.ShellListener
- */
-public class Test_org_eclipse_swt_events_ShellListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_ShellListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() {
- warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent");
- methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent();
- else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java
deleted file mode 100644
index 2afaf2c997..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TraverseEvent
- *
- * @see org.eclipse.swt.events.TraverseEvent
- */
-public class Test_org_eclipse_swt_events_TraverseEvent extends Test_org_eclipse_swt_events_KeyEvent {
-
-public Test_org_eclipse_swt_events_TraverseEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_TraverseEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java
deleted file mode 100644
index a2e7a3ffd7..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TraverseListener
- *
- * @see org.eclipse.swt.events.TraverseListener
- */
-public class Test_org_eclipse_swt_events_TraverseListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_TraverseListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_keyTraversedLorg_eclipse_swt_events_TraverseEvent() {
- warnUnimpl("Test test_keyTraversedLorg_eclipse_swt_events_TraverseEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent")) test_keyTraversedLorg_eclipse_swt_events_TraverseEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java
deleted file mode 100644
index 28d34329f8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TreeAdapter
- *
- * @see org.eclipse.swt.events.TreeAdapter
- */
-public class Test_org_eclipse_swt_events_TreeAdapter extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_TreeAdapter(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() {
- warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written");
-}
-
-public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() {
- warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent");
- methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent();
- else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java
deleted file mode 100644
index 6242f4fa52..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TreeEvent
- *
- * @see org.eclipse.swt.events.TreeEvent
- */
-public class Test_org_eclipse_swt_events_TreeEvent extends Test_org_eclipse_swt_events_SelectionEvent {
-
-public Test_org_eclipse_swt_events_TreeEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_TreeEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_SelectionEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java
deleted file mode 100644
index cd55ba5a8a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TreeListener
- *
- * @see org.eclipse.swt.events.TreeListener
- */
-public class Test_org_eclipse_swt_events_TreeListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_TreeListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() {
- warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written");
-}
-
-public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() {
- warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent");
- methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent();
- else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
deleted file mode 100644
index 5a54a1e404..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.TypedEvent
- *
- * @see org.eclipse.swt.events.TypedEvent
- */
-public class Test_org_eclipse_swt_events_TypedEvent extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_TypedEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLjava_lang_Object() {
- warnUnimpl("Test test_ConstructorLjava_lang_Object not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_TypedEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLjava_lang_Object");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java
deleted file mode 100644
index f95c148cd2..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.VerifyEvent
- *
- * @see org.eclipse.swt.events.VerifyEvent
- */
-public class Test_org_eclipse_swt_events_VerifyEvent extends Test_org_eclipse_swt_events_KeyEvent {
-
-public Test_org_eclipse_swt_events_VerifyEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_events_VerifyEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event");
- methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java
deleted file mode 100644
index e90ba4872a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.events.VerifyListener
- *
- * @see org.eclipse.swt.events.VerifyListener
- */
-public class Test_org_eclipse_swt_events_VerifyListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_events_VerifyListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_verifyTextLorg_eclipse_swt_events_VerifyEvent() {
- warnUnimpl("Test test_verifyTextLorg_eclipse_swt_events_VerifyEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_verifyTextLorg_eclipse_swt_events_VerifyEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_verifyTextLorg_eclipse_swt_events_VerifyEvent")) test_verifyTextLorg_eclipse_swt_events_VerifyEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java
deleted file mode 100644
index e1380dc17a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Color
- *
- * @see org.eclipse.swt.graphics.Color
- */
-public class Test_org_eclipse_swt_graphics_Color extends SwtTestCase {
-
-Display display;
-
-public Test_org_eclipse_swt_graphics_Color(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
-}
-
-protected void tearDown() {
- display.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceIII() {
- // Test new Color(Device device, int red, int green, int blue)
- // IllegalArgumentException if the red, green or blue argument is not between 0 and 255
-
- // valid color (black)
- Color color = new Color(display, 0, 0, 0);
- color.dispose();
-
- // valid color (white)
- color = new Color(display, 255, 255, 255);
- color.dispose();
-
- // valid color (random grey)
- color = new Color(display, 20, 20, 20);
- color.dispose();
-
- // valid color (random)
- color = new Color(display, 102, 255, 0);
- color.dispose();
-
- // device == null (valid)
- color = new Color(null, 0, 0, 0);
- color.dispose();
-
- // illegal argument, rgb < 0
- try {
- color = new Color(display, -10, -10, -10);
- color.dispose();
- fail("No exception thrown for rgb < 0");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, rgb > 255
- try {
- color = new Color(display, 1000, 2000, 3000);
- color.dispose();
- fail("No exception thrown for rgb > 255");
- } catch (IllegalArgumentException e) {
- }
- // illegal argument, blue > 255
- try {
- color = new Color(display, 10, 10, 256);
- color.dispose();
- fail("No exception thrown for blue > 255");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB() {
- // Test new Color(Device device, RGB rgb)
- // IllegalArgumentException if the red, green or blue argument is not between 0 and 255; or rgb is null
-
- // valid color (black)
- Color color = new Color(display, new RGB(0, 0, 0));
- color.dispose();
-
- // valid color (white)
- color = new Color(display, new RGB(255, 255, 255));
- color.dispose();
-
- // valid color (random grey)
- color = new Color(display, new RGB(10, 10, 10));
- color.dispose();
-
- // valid color (random)
- color = new Color(display, new RGB(102, 255, 0));
- color.dispose();
-
- // device == null (valid)
- color = new Color(null, new RGB(0, 0, 0));
- color.dispose();
-
- // illegal argument, rgb < 0
- try {
- color = new Color(display, new RGB(-10, -10, -10));
- color.dispose();
- fail("No exception thrown for rgb < 0");
- }
- catch (IllegalArgumentException e) {
- }
- // illegal argument, rgb > 255
- try {
- color = new Color(display, new RGB(1000, 2000, 3000));
- color.dispose();
- fail("No exception thrown for rgb > 255");
- }
- catch (IllegalArgumentException e) {
- }
- // illegal argument, blue > 255
- try {
- color = new Color(display, new RGB(10, 10, 256));
- color.dispose();
- fail("No exception thrown for blue > 255");
- }
- catch (IllegalArgumentException e) {
- }
-
- // illegal argument, rgb == null
- try {
- color = new Color(display, null);
- color.dispose();
- fail("No exception thrown for rgb == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_dispose() {
- // tested in test_isDisposed
-}
-
-public void test_equalsLjava_lang_Object() {
- Color color = new Color(display, 1, 2, 3);
- Color sameColor = new Color(display, 1, 2, 3);
- Color sameColor2 = new Color(display, new RGB(1, 2, 3));
- Color otherColor = new Color(display, 5, 6, 7);
- try {
- // Test Color.equals(Object)
- assertTrue("!color.equals((Object)null)", !color.equals((Object)null));
-
- // Test Color.equals(Color)
- assertTrue("!color.equals((Color)null)", !color.equals((Color)null));
- assertTrue("color.equals(color)", color.equals(color));
- assertTrue("color.equals(sameColor)", color.equals(sameColor));
- assertTrue("color.equals(sameColor2)", color.equals(sameColor2));
- assertTrue("!color.equals(otherColor)", !color.equals(otherColor));
- } finally {
- color.dispose();
- sameColor.dispose();
- sameColor2.dispose();
- otherColor.dispose();
- }
-}
-
-public void test_getBlue() {
- // Test Color.getBlue()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getBlue() == 4", color.getBlue(), 4);
- } finally {
- color.dispose();
- }
-
-}
-
-public void test_getGreen() {
- // Test Color.getGreen()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getGreen() == 2", color.getGreen(), 2);
- } finally {
- color.dispose();
- }
-}
-
-public void test_getRed() {
- // Test Color.getRed()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getRed() == 1", color.getRed(), 1);
- } finally {
- color.dispose();
- }
-}
-
-public void test_getRGB() {
- Color color = new Color(display, 12, 34, 56);
- assertNotNull(color.getRGB());
- assertEquals(new RGB(12, 34, 56), color.getRGB());
-}
-
-public void test_hashCode() {
- Color color = new Color(display, 12, 34, 56);
- Color otherColor = new Color(display, 12, 34, 56);
- if (color.equals(otherColor)) {
- assertEquals("Hash codes of equal objects should be equal", color.hashCode(), otherColor.hashCode());
- }
-}
-
-public void test_isDisposed() {
- // Test Color.isDisposed() false
- Color color = new Color(display, 34, 67, 98);
- try {
- assertTrue("Color should not be disposed", !color.isDisposed());
- } finally {
- // Test Color.isDisposed() true
- color.dispose();
- assertTrue("Color should be disposed", color.isDisposed());
- }
-}
-
-public void test_toString() {
- Color color = new Color(display, 12, 34, 56);
- assertNotNull(color.toString());
- assertTrue(color.toString().length() > 0);
- assertEquals("Color {12, 34, 56}", color.toString());
-}
-
-public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() {
- // do not test - Windows platform only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Color((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getBlue");
- methodNames.addElement("test_getGreen");
- methodNames.addElement("test_getRed");
- methodNames.addElement("test_getRGB");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceIII();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getBlue")) test_getBlue();
- else if (getName().equals("test_getGreen")) test_getGreen();
- else if (getName().equals("test_getRed")) test_getRed();
- else if (getName().equals("test_getRGB")) test_getRGB();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
deleted file mode 100644
index cd3ba3a686..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Cursor
- *
- * @see org.eclipse.swt.graphics.Cursor
- */
-public class Test_org_eclipse_swt_graphics_Cursor extends SwtTestCase {
-
-Display display;
-
-public Test_org_eclipse_swt_graphics_Cursor(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
-}
-
-protected void tearDown() {
- display.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceI() {
- // Test new Cursor(Device device, int style)
- // IllegalArgumentException when an unknown style is specified
-
- Cursor cursor = new Cursor(display, SWT.CURSOR_ARROW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_WAIT);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_CROSS);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_APPSTARTING);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_HELP);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEALL);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENESW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENS);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENWSE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEWE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEN);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZES);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZESE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZESW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_UPARROW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_IBEAM);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_NO);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_HAND);
- cursor.dispose();
-
- // device == null (valid)
- cursor = new Cursor(null, SWT.CURSOR_ARROW);
- cursor.dispose();
-
- // illegal argument, style > SWT.CURSOR_HAND (21)
- try {
- cursor = new Cursor(display, 100);
- cursor.dispose();
- fail("No exception thrown for style > SWT.CURSOR_HAND (21)");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, style < 0
- try {
- cursor = new Cursor(display, -100);
- cursor.dispose();
- fail("No exception thrown for style < 0");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII() {
- // Test new Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY)
- ImageLoader loader = new ImageLoader();
- ImageData source = loader.load(SwtTestCase.class.getResourceAsStream("dot.gif"))[0];
- ImageData mask = source.getTransparencyMask();
- Cursor cursor = new Cursor(display, source, mask, 0, 0);
- cursor.dispose();
-}
-public void test_dispose() {
- // tested in test_isDisposed
-}
-
-public void test_equalsLjava_lang_Object() {
- /* Note: Two cursors are only considered equal if their handles are equal.
- * So since Windows reuses cursor handles, and other platforms do not,
- * it does not make sense to test whether cursor.equals(sameCursor).
- */
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
- Cursor otherCursor = new Cursor(display, SWT.CURSOR_CROSS);
- try {
- // Test Cursor.equals(Object)
- assertTrue("!cursor.equals((Object)null)", !cursor.equals((Object)null));
-
- // Test Cursor.equals(Cursor)
- assertTrue("!cursor.equals((Cursor)null)", !cursor.equals((Cursor)null));
- assertTrue("cursor.equals(cursor)", cursor.equals(cursor));
- assertTrue("!cursor.equals(otherCursor)", !cursor.equals(otherCursor));
- } finally {
- cursor.dispose();
- otherCursor.dispose();
- }
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_isDisposed() {
- // Test Cursor.isDisposed() false
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
- try {
- assertTrue("Cursor should not be disposed", !cursor.isDisposed());
- } finally {
- // Test Cursor.isDisposed() true
- cursor.dispose();
- assertTrue("Cursor should be disposed", cursor.isDisposed());
- }
-}
-
-public void test_toString() {
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
- assertNotNull(cursor.toString());
- assertTrue(cursor.toString().length() > 0);
-}
-
-public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Cursor((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java
deleted file mode 100644
index d8264a3dfb..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Device
- *
- * @see org.eclipse.swt.graphics.Device
- */
-public class Test_org_eclipse_swt_graphics_Device extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_Device(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written");
-}
-
-public void test_checkDevice() {
- warnUnimpl("Test test_checkDevice not written");
-}
-
-public void test_createLorg_eclipse_swt_graphics_DeviceData() {
- warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written");
-}
-
-public void test_destroy() {
- warnUnimpl("Test test_destroy not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getDeviceData() {
- warnUnimpl("Test test_getDeviceData not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getDepth() {
- warnUnimpl("Test test_getDepth not written");
-}
-
-public void test_getDPI() {
- warnUnimpl("Test test_getDPI not written");
-}
-
-public void test_getFontListLjava_lang_StringZ() {
- warnUnimpl("Test test_getFontListLjava_lang_StringZ not written");
-}
-
-public void test_getSystemColorI() {
- warnUnimpl("Test test_getSystemColorI not written");
-}
-
-public void test_getSystemFont() {
- warnUnimpl("Test test_getSystemFont not written");
-}
-
-public void test_getWarnings() {
- warnUnimpl("Test test_getWarnings not written");
-}
-
-public void test_init() {
- warnUnimpl("Test test_init not written");
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_isDisposed() {
- warnUnimpl("Test test_isDisposed not written");
-}
-
-public void test_release() {
- warnUnimpl("Test test_release not written");
-}
-
-public void test_setWarningsZ() {
- warnUnimpl("Test test_setWarningsZ not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData");
- methodNames.addElement("test_checkDevice");
- methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData");
- methodNames.addElement("test_destroy");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getDeviceData");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getDepth");
- methodNames.addElement("test_getDPI");
- methodNames.addElement("test_getFontListLjava_lang_StringZ");
- methodNames.addElement("test_getSystemColorI");
- methodNames.addElement("test_getSystemFont");
- methodNames.addElement("test_getWarnings");
- methodNames.addElement("test_init");
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_release");
- methodNames.addElement("test_setWarningsZ");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData();
- else if (getName().equals("test_checkDevice")) test_checkDevice();
- else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData();
- else if (getName().equals("test_destroy")) test_destroy();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getDeviceData")) test_getDeviceData();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getDepth")) test_getDepth();
- else if (getName().equals("test_getDPI")) test_getDPI();
- else if (getName().equals("test_getFontListLjava_lang_StringZ")) test_getFontListLjava_lang_StringZ();
- else if (getName().equals("test_getSystemColorI")) test_getSystemColorI();
- else if (getName().equals("test_getSystemFont")) test_getSystemFont();
- else if (getName().equals("test_getWarnings")) test_getWarnings();
- else if (getName().equals("test_init")) test_init();
- else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_release")) test_release();
- else if (getName().equals("test_setWarningsZ")) test_setWarningsZ();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java
deleted file mode 100644
index 9c1ef4fca6..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.DeviceData
- *
- * @see org.eclipse.swt.graphics.DeviceData
- */
-public class Test_org_eclipse_swt_graphics_DeviceData extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_DeviceData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- DeviceData data = new DeviceData();
- data.debug = true;
- data.tracking = true;
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_DeviceData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java
deleted file mode 100644
index 72461e3dd4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Drawable
- *
- * @see org.eclipse.swt.graphics.Drawable
- */
-public class Test_org_eclipse_swt_graphics_Drawable extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_Drawable(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java
deleted file mode 100644
index 72c5470b21..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Font
- *
- * @see org.eclipse.swt.graphics.Font
- */
-public class Test_org_eclipse_swt_graphics_Font extends SwtTestCase {
-
-Display display;
-
-public Test_org_eclipse_swt_graphics_Font(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
-}
-
-protected void tearDown() {
- display.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData() {
- // Test new Font(Device device, FontData fd)
- // IllegalArgumentException if the fd argument is null
- // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given font data
-
- // valid font with no name (strange, but apparently valid)
- Font font = new Font(display, new FontData("", 10, SWT.NORMAL));
- font.dispose();
-
- // valid font with unknown name (strange, but apparently valid)
- font = new Font(display, new FontData("bad-font", 10, SWT.NORMAL));
- font.dispose();
-
- // valid font with 0 height (strange, but apparently valid)
- font = new Font(display, new FontData(SwtJunit.testFontName, 0, SWT.NORMAL));
- font.dispose();
-
- // valid normal 1000-point font (pretty big, but apparently valid)
- font = new Font(display, new FontData(SwtJunit.testFontName, 1000, SWT.NORMAL));
- font.dispose();
-
- // valid normal 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.NORMAL));
- font.dispose();
-
- // valid bold 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD));
- font.dispose();
-
- // valid italic 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.ITALIC));
- font.dispose();
-
- // valid bold italic 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC));
- font.dispose();
-
- // illegal argument, fontData == null
- try {
- font = new Font(display, null);
- font.dispose();
- fail("No exception thrown for fontData == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, name == null
- try {
- font = new Font(display, new FontData(null, 10, SWT.NORMAL));
- font.dispose();
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- font = new Font(display, new FontData(SwtJunit.testFontName, -10, SWT.NORMAL));
- font.dispose();
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII() {
- // Test new Font(Device device, String name, int height, int style)
- // IllegalArgumentException if the name argument is null or the height is negative
- // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given arguments
-
- // valid font with no name (strange, but apparently valid)
- Font font = new Font(display, "", 10, SWT.NORMAL);
- font.dispose();
-
- // valid font with unknown name (strange, but apparently valid)
- font = new Font(display, "bad-font", 10, SWT.NORMAL);
- font.dispose();
-
- // valid font with 0 height (strange, but apparently valid)
- font = new Font(display, SwtJunit.testFontName, 0, SWT.NORMAL);
- font.dispose();
-
- // valid normal 1000-point font (pretty big, but apparently valid)
- font = new Font(display, SwtJunit.testFontName, 1000, SWT.NORMAL);
- font.dispose();
-
- // valid normal 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- font.dispose();
-
- // valid bold 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD);
- font.dispose();
-
- // valid italic 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.ITALIC);
- font.dispose();
-
- // valid bold italic 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
- font.dispose();
-
- // device == null (valid)
- font = new Font(null, SwtJunit.testFontName, 10, SWT.NORMAL);
- font.dispose();
-
- // illegal argument, name == null
- try {
- font = new Font(display, null, 10, SWT.NORMAL);
- font.dispose();
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- font = new Font(display, SwtJunit.testFontName, -10, SWT.NORMAL);
- font.dispose();
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_equalsLjava_lang_Object() {
- // Fonts are only equal if their handles are the same (?!)
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- Font otherFont = new Font(display, SwtJunit.testFontName, 20, SWT.NORMAL);
- try {
- // Test Font.equals(Object)
- assertTrue("!font.equals((Object)null)", !font.equals((Object)null));
-
- // Test Font.equals(Font)
- assertTrue("!font.equals((Font)null)", !font.equals((Font)null));
- assertTrue("font.equals(font)", font.equals(font));
- assertTrue("!font.equals(otherFont)", !font.equals(otherFont));
- } finally {
- font.dispose();
- otherFont.dispose();
- }
-}
-
-public void test_getFontData() {
- // Test Font.getFontData()
- // valid normal 10-point font
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 10, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid bold 20-point font
- font = new Font(display, SwtJunit.testFontName, 20, SWT.BOLD);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 20, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.BOLD, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid italic 30-point font
- font = new Font(display, SwtJunit.testFontName, 30, SWT.ITALIC);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 30, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.ITALIC, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid bold italic 40-point font
- font = new Font(display, SwtJunit.testFontName, 40, SWT.BOLD | SWT.ITALIC);
- try {
- FontData fontData[] = font.getFontData();
- font.dispose();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 40, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.BOLD | SWT.ITALIC, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid 10-point font with unknown name
- font = new Font(display, "bad-font", 10, SWT.NORMAL);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", "bad-font", fontData[0].getName());
- assertEquals("Wrong font height", 10, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_isDisposed() {
- // Test Font.isDisposed() false
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- try {
- assertTrue("Font should not be disposed", !font.isDisposed());
- } finally {
- // Test Font.isDisposed() true
- font.dispose();
- assertTrue("Font should be disposed", font.isDisposed());
- }
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Font((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getFontData");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getFontData")) test_getFontData();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java
deleted file mode 100644
index a993547564..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.FontData
- *
- * @see org.eclipse.swt.graphics.FontData
- */
-public class Test_org_eclipse_swt_graphics_FontData extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_FontData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- // Test new FontData()
- FontData fd = new FontData();
-}
-
-public void test_ConstructorLjava_lang_String() {
- // Test new FontData(String string)
- FontData fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
- FontData reconstructedFontData = new FontData(fd.toString());
- assertEquals(fd, reconstructedFontData);
-}
-
-public void test_ConstructorLjava_lang_StringII() {
- // Test new FontData(String name, int height, int style)
- // valid font data with no name (strange, but apparently valid)
- FontData fd = new FontData("", 10, SWT.NORMAL);
-
- // valid font data with unknown name (strange, but apparently valid)
- fd = new FontData("bad-font", 10, SWT.NORMAL);
-
- // valid font data with 0 height (strange, but apparently valid)
- fd = new FontData(SwtJunit.testFontName, 0, SWT.NORMAL);
-
- // valid font data with 1000 height (pretty big, but apparently valid)
- fd = new FontData(SwtJunit.testFontName, 1000, SWT.NORMAL);
-
- // valid normal 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
-
- // valid bold 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD);
-
- // valid italic 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC);
-
- // valid bold italic 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
-
- // illegal argument, name == null
- try {
- fd = new FontData(null, 10, SWT.NORMAL);
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- fd = new FontData(SwtJunit.testFontName, -10, SWT.NORMAL);
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_equalsLjava_lang_Object() {
- warnUnimpl("Test test_equalsLjava_lang_Object not written");
-}
-
-public void test_getHeight() {
- // Font.getHeight() tested in test_setHeightI
-}
-
-public void test_getName() {
- // Font.getName() tested in test_setNameLjava_lang_String
-}
-
-public void test_getStyle() {
- // Font.getStyle() tested in test_setStyleI
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_setHeightI() {
- // Test Font.setHeight(int height)
- // valid normal font data for various heights
- FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid bold font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid italic font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid bold italic font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-}
-
-public void test_setLocaleLjava_lang_String() {
- warnUnimpl("Test test_setLocaleLjava_lang_String not written");
-}
-
-public void test_setNameLjava_lang_String() {
- // Test Font.setName(String name)
- // valid name
- FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
- assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName);
-
- // valid name (unknown name, but valid)
- fontData.setName("bad-font");
- assertEquals("Wrong name", fontData.getName(), "bad-font");
-
- // valid name (empty string, but valid)
- fontData.setName("");
- assertEquals("Wrong name", fontData.getName(), "");
-
- // valid name
- fontData.setName(SwtJunit.testFontName);
- assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName);
-
- // illegal argument, name == null
- try {
- fontData.setName(null);
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setStyleI() {
- // Test Font.setStyle(int style)
- for (int height = 0; height < 1000; height++) {
- // valid normal font data
- FontData fontData = new FontData(SwtJunit.testFontName, height, SWT.NORMAL);
- assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL);
-
- // valid bold font data
- fontData.setStyle(SWT.BOLD);
- assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD);
-
- // valid italic font data
- fontData.setStyle(SWT.ITALIC);
- assertEquals("Wrong style", fontData.getStyle(), SWT.ITALIC);
-
- // valid bold italic font data
- fontData.setStyle(SWT.ITALIC | SWT.BOLD);
- assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD | SWT.ITALIC);
-
- // valid normal font data
- fontData.setStyle(SWT.NORMAL);
- assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL);
- }
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public void test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_FontData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLjava_lang_String");
- methodNames.addElement("test_ConstructorLjava_lang_StringII");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getHeight");
- methodNames.addElement("test_getName");
- methodNames.addElement("test_getStyle");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_setHeightI");
- methodNames.addElement("test_setLocaleLjava_lang_String");
- methodNames.addElement("test_setNameLjava_lang_String");
- methodNames.addElement("test_setStyleI");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String();
- else if (getName().equals("test_ConstructorLjava_lang_StringII")) test_ConstructorLjava_lang_StringII();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getHeight")) test_getHeight();
- else if (getName().equals("test_getName")) test_getName();
- else if (getName().equals("test_getStyle")) test_getStyle();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_setHeightI")) test_setHeightI();
- else if (getName().equals("test_setLocaleLjava_lang_String")) test_setLocaleLjava_lang_String();
- else if (getName().equals("test_setNameLjava_lang_String")) test_setNameLjava_lang_String();
- else if (getName().equals("test_setStyleI")) test_setStyleI();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI")) test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java
deleted file mode 100644
index a2972e63f1..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.FontMetrics
- *
- * @see org.eclipse.swt.graphics.FontMetrics
- */
-public class Test_org_eclipse_swt_graphics_FontMetrics extends SwtTestCase {
-
- Display display;
- Shell shell;
- GC gc;
-
-public Test_org_eclipse_swt_graphics_FontMetrics(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
- shell = new Shell(display);
- gc = new GC(shell);
-}
-
-protected void tearDown() {
- gc.dispose();
- shell.dispose();
- display.dispose();
-}
-
-public void test_equalsLjava_lang_Object() {
- FontMetrics fm1 = gc.getFontMetrics();
- FontMetrics fm2 = gc.getFontMetrics();
- assertTrue(fm1.equals(fm2));
-}
-
-public void test_getAscent() {
- FontMetrics fm = gc.getFontMetrics();
- fm.getAscent();
-}
-
-public void test_getAverageCharWidth() {
- FontMetrics fm = gc.getFontMetrics();
- fm.getAverageCharWidth();
-}
-
-public void test_getDescent() {
- FontMetrics fm = gc.getFontMetrics();
- fm.getDescent();
-}
-
-public void test_getHeight() {
- FontMetrics fm = gc.getFontMetrics();
- fm.getHeight();
-}
-
-public void test_getLeading() {
- FontMetrics fm = gc.getFontMetrics();
- fm.getLeading();
-}
-
-public void test_hashCode() {
- FontMetrics fm1 = gc.getFontMetrics();
- FontMetrics fm2 = gc.getFontMetrics();
- if (fm1.equals(fm2)) {
- assertEquals(fm1.hashCode(), fm2.hashCode());
- }
-}
-
-public void test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_FontMetrics((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getAscent");
- methodNames.addElement("test_getAverageCharWidth");
- methodNames.addElement("test_getDescent");
- methodNames.addElement("test_getHeight");
- methodNames.addElement("test_getLeading");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getAscent")) test_getAscent();
- else if (getName().equals("test_getAverageCharWidth")) test_getAverageCharWidth();
- else if (getName().equals("test_getDescent")) test_getDescent();
- else if (getName().equals("test_getHeight")) test_getHeight();
- else if (getName().equals("test_getLeading")) test_getLeading();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC")) test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
deleted file mode 100644
index 8364effa14..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.GC
- *
- * @see org.eclipse.swt.graphics.GC
- */
-public class Test_org_eclipse_swt_graphics_GC extends SwtTestCase {
-
-Display display;
-
-public Test_org_eclipse_swt_graphics_GC(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
-}
-
-protected void tearDown() {
- display.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_Drawable() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Drawable not written");
-}
-
-public void test_copyAreaLorg_eclipse_swt_graphics_ImageII() {
- warnUnimpl("Test test_copyAreaLorg_eclipse_swt_graphics_ImageII not written");
-}
-
-public void test_copyAreaIIIIII() {
- warnUnimpl("Test test_copyAreaIIIIII not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_drawArcIIIIII() {
- warnUnimpl("Test test_drawArcIIIIII not written");
-}
-
-public void test_drawFocusIIII() {
- warnUnimpl("Test test_drawFocusIIII not written");
-}
-
-public void test_drawImageLorg_eclipse_swt_graphics_ImageII() {
- warnUnimpl("Test test_drawImageLorg_eclipse_swt_graphics_ImageII not written");
-}
-
-public void test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII() {
- warnUnimpl("Test test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII not written");
-}
-
-public void test_drawLineIIII() {
- warnUnimpl("Test test_drawLineIIII not written");
-}
-
-public void test_drawOvalIIII() {
- warnUnimpl("Test test_drawOvalIIII not written");
-}
-
-public void test_drawPolygon$I() {
- warnUnimpl("Test test_drawPolygon$I not written");
-}
-
-public void test_drawPolyline$I() {
- warnUnimpl("Test test_drawPolyline$I not written");
-}
-
-public void test_drawRectangleIIII() {
- warnUnimpl("Test test_drawRectangleIIII not written");
-}
-
-public void test_drawRectangleLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_drawRectangleLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_drawRoundRectangleIIIIII() {
- warnUnimpl("Test test_drawRoundRectangleIIIIII not written");
-}
-
-public void test_drawStringLjava_lang_StringII() {
- warnUnimpl("Test test_drawStringLjava_lang_StringII not written");
-}
-
-public void test_drawStringLjava_lang_StringIIZ() {
- warnUnimpl("Test test_drawStringLjava_lang_StringIIZ not written");
-}
-
-public void test_drawTextLjava_lang_StringII() {
- warnUnimpl("Test test_drawTextLjava_lang_StringII not written");
-}
-
-public void test_drawTextLjava_lang_StringIIZ() {
- warnUnimpl("Test test_drawTextLjava_lang_StringIIZ not written");
-}
-
-public void test_equalsLjava_lang_Object() {
- warnUnimpl("Test test_equalsLjava_lang_Object not written");
-}
-
-public void test_fillArcIIIIII() {
- warnUnimpl("Test test_fillArcIIIIII not written");
-}
-
-public void test_fillGradientRectangleIIIIZ() {
- warnUnimpl("Test test_fillGradientRectangleIIIIZ not written");
-}
-
-public void test_fillOvalIIII() {
- warnUnimpl("Test test_fillOvalIIII not written");
-}
-
-public void test_fillPolygon$I() {
- warnUnimpl("Test test_fillPolygon$I not written");
-}
-
-public void test_fillRectangleIIII() {
- warnUnimpl("Test test_fillRectangleIIII not written");
-}
-
-public void test_fillRectangleLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_fillRectangleLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_fillRoundRectangleIIIIII() {
- warnUnimpl("Test test_fillRoundRectangleIIIIII not written");
-}
-
-public void test_getAdvanceWidthC() {
- warnUnimpl("Test test_getAdvanceWidthC not written");
-}
-
-public void test_getBackground() {
- warnUnimpl("Test test_getBackground not written");
-}
-
-public void test_getCharWidthC() {
- warnUnimpl("Test test_getCharWidthC not written");
-}
-
-public void test_getClipping() {
- warnUnimpl("Test test_getClipping not written");
-}
-
-public void test_getClippingLorg_eclipse_swt_graphics_Region() {
- warnUnimpl("Test test_getClippingLorg_eclipse_swt_graphics_Region not written");
-}
-
-public void test_getFont() {
- warnUnimpl("Test test_getFont not written");
-}
-
-public void test_getFontMetrics() {
- warnUnimpl("Test test_getFontMetrics not written");
-}
-
-public void test_getForeground() {
- warnUnimpl("Test test_getForeground not written");
-}
-
-public void test_getLineStyle() {
- warnUnimpl("Test test_getLineStyle not written");
-}
-
-public void test_getLineWidth() {
- warnUnimpl("Test test_getLineWidth not written");
-}
-
-public void test_getXORMode() {
- warnUnimpl("Test test_getXORMode not written");
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_isClipped() {
- warnUnimpl("Test test_isClipped not written");
-}
-
-public void test_isDisposed() {
- warnUnimpl("Test test_isDisposed not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setClippingIIII() {
- warnUnimpl("Test test_setClippingIIII not written");
-}
-
-public void test_setClippingLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_setClippingLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_setClippingLorg_eclipse_swt_graphics_Region() {
- warnUnimpl("Test test_setClippingLorg_eclipse_swt_graphics_Region not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_setLineStyleI() {
- warnUnimpl("Test test_setLineStyleI not written");
-}
-
-public void test_setLineWidthI() {
- warnUnimpl("Test test_setLineWidthI not written");
-}
-
-public void test_setXORModeZ() {
- warnUnimpl("Test test_setXORModeZ not written");
-}
-
-public void test_stringExtentLjava_lang_String() {
- warnUnimpl("Test test_stringExtentLjava_lang_String not written");
-}
-
-public void test_textExtentLjava_lang_String() {
- warnUnimpl("Test test_textExtentLjava_lang_String not written");
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public void test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_GC((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Drawable");
- methodNames.addElement("test_copyAreaLorg_eclipse_swt_graphics_ImageII");
- methodNames.addElement("test_copyAreaIIIIII");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_drawArcIIIIII");
- methodNames.addElement("test_drawFocusIIII");
- methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageII");
- methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII");
- methodNames.addElement("test_drawLineIIII");
- methodNames.addElement("test_drawOvalIIII");
- methodNames.addElement("test_drawPolygon$I");
- methodNames.addElement("test_drawPolyline$I");
- methodNames.addElement("test_drawRectangleIIII");
- methodNames.addElement("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_drawRoundRectangleIIIIII");
- methodNames.addElement("test_drawStringLjava_lang_StringII");
- methodNames.addElement("test_drawStringLjava_lang_StringIIZ");
- methodNames.addElement("test_drawTextLjava_lang_StringII");
- methodNames.addElement("test_drawTextLjava_lang_StringIIZ");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_fillArcIIIIII");
- methodNames.addElement("test_fillGradientRectangleIIIIZ");
- methodNames.addElement("test_fillOvalIIII");
- methodNames.addElement("test_fillPolygon$I");
- methodNames.addElement("test_fillRectangleIIII");
- methodNames.addElement("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_fillRoundRectangleIIIIII");
- methodNames.addElement("test_getAdvanceWidthC");
- methodNames.addElement("test_getBackground");
- methodNames.addElement("test_getCharWidthC");
- methodNames.addElement("test_getClipping");
- methodNames.addElement("test_getClippingLorg_eclipse_swt_graphics_Region");
- methodNames.addElement("test_getFont");
- methodNames.addElement("test_getFontMetrics");
- methodNames.addElement("test_getForeground");
- methodNames.addElement("test_getLineStyle");
- methodNames.addElement("test_getLineWidth");
- methodNames.addElement("test_getXORMode");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_isClipped");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setClippingIIII");
- methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Region");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setLineStyleI");
- methodNames.addElement("test_setLineWidthI");
- methodNames.addElement("test_setXORModeZ");
- methodNames.addElement("test_stringExtentLjava_lang_String");
- methodNames.addElement("test_textExtentLjava_lang_String");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Drawable")) test_ConstructorLorg_eclipse_swt_graphics_Drawable();
- else if (getName().equals("test_copyAreaLorg_eclipse_swt_graphics_ImageII")) test_copyAreaLorg_eclipse_swt_graphics_ImageII();
- else if (getName().equals("test_copyAreaIIIIII")) test_copyAreaIIIIII();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_drawArcIIIIII")) test_drawArcIIIIII();
- else if (getName().equals("test_drawFocusIIII")) test_drawFocusIIII();
- else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageII")) test_drawImageLorg_eclipse_swt_graphics_ImageII();
- else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII")) test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII();
- else if (getName().equals("test_drawLineIIII")) test_drawLineIIII();
- else if (getName().equals("test_drawOvalIIII")) test_drawOvalIIII();
- else if (getName().equals("test_drawPolygon$I")) test_drawPolygon$I();
- else if (getName().equals("test_drawPolyline$I")) test_drawPolyline$I();
- else if (getName().equals("test_drawRectangleIIII")) test_drawRectangleIIII();
- else if (getName().equals("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle")) test_drawRectangleLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_drawRoundRectangleIIIIII")) test_drawRoundRectangleIIIIII();
- else if (getName().equals("test_drawStringLjava_lang_StringII")) test_drawStringLjava_lang_StringII();
- else if (getName().equals("test_drawStringLjava_lang_StringIIZ")) test_drawStringLjava_lang_StringIIZ();
- else if (getName().equals("test_drawTextLjava_lang_StringII")) test_drawTextLjava_lang_StringII();
- else if (getName().equals("test_drawTextLjava_lang_StringIIZ")) test_drawTextLjava_lang_StringIIZ();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_fillArcIIIIII")) test_fillArcIIIIII();
- else if (getName().equals("test_fillGradientRectangleIIIIZ")) test_fillGradientRectangleIIIIZ();
- else if (getName().equals("test_fillOvalIIII")) test_fillOvalIIII();
- else if (getName().equals("test_fillPolygon$I")) test_fillPolygon$I();
- else if (getName().equals("test_fillRectangleIIII")) test_fillRectangleIIII();
- else if (getName().equals("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle")) test_fillRectangleLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_fillRoundRectangleIIIIII")) test_fillRoundRectangleIIIIII();
- else if (getName().equals("test_getAdvanceWidthC")) test_getAdvanceWidthC();
- else if (getName().equals("test_getBackground")) test_getBackground();
- else if (getName().equals("test_getCharWidthC")) test_getCharWidthC();
- else if (getName().equals("test_getClipping")) test_getClipping();
- else if (getName().equals("test_getClippingLorg_eclipse_swt_graphics_Region")) test_getClippingLorg_eclipse_swt_graphics_Region();
- else if (getName().equals("test_getFont")) test_getFont();
- else if (getName().equals("test_getFontMetrics")) test_getFontMetrics();
- else if (getName().equals("test_getForeground")) test_getForeground();
- else if (getName().equals("test_getLineStyle")) test_getLineStyle();
- else if (getName().equals("test_getLineWidth")) test_getLineWidth();
- else if (getName().equals("test_getXORMode")) test_getXORMode();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_isClipped")) test_isClipped();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setClippingIIII")) test_setClippingIIII();
- else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Rectangle")) test_setClippingLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Region")) test_setClippingLorg_eclipse_swt_graphics_Region();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setLineStyleI")) test_setLineStyleI();
- else if (getName().equals("test_setLineWidthI")) test_setLineWidthI();
- else if (getName().equals("test_setXORModeZ")) test_setXORModeZ();
- else if (getName().equals("test_stringExtentLjava_lang_String")) test_stringExtentLjava_lang_String();
- else if (getName().equals("test_textExtentLjava_lang_String")) test_textExtentLjava_lang_String();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData")) test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java
deleted file mode 100644
index 05c45006f3..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.GCData
- *
- * @see org.eclipse.swt.graphics.GCData
- */
-public class Test_org_eclipse_swt_graphics_GCData extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_GCData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_GCData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
deleted file mode 100644
index 0413188870..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Image
- *
- * @see org.eclipse.swt.graphics.Image
- */
-public class Test_org_eclipse_swt_graphics_Image extends SwtTestCase {
-
-Display display;
-
-public Test_org_eclipse_swt_graphics_Image(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- display = new Display();
-}
-
-protected void tearDown() {
- display.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceII not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String not written");
-}
-
-public void test_dispose() {
- warnUnimpl("Test test_dispose not written");
-}
-
-public void test_equalsLjava_lang_Object() {
- warnUnimpl("Test test_equalsLjava_lang_Object not written");
-}
-
-public void test_getBackground() {
- warnUnimpl("Test test_getBackground not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getImageData() {
- ImageLoader loader = new ImageLoader();
- ImageData data1 = loader.load(SwtTestCase.class.getResourceAsStream("dot.gif"))[0];
-
- Image image = new Image(display, data1);
- ImageData data2 = image.getImageData();
-
- assertEquals("Image width should be the same", data1.width, data2.width);
- assertEquals("Image height should be the same", data1.height, data2.height);
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_isDisposed() {
- warnUnimpl("Test test_isDisposed not written");
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written");
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public void test_win32_newLorg_eclipse_swt_graphics_DeviceII() {
- // do not test - Windows only
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Image((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceII");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getBackground");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getImageData");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceII");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceII();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getBackground")) test_getBackground();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getImageData")) test_getImageData();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceII")) test_win32_newLorg_eclipse_swt_graphics_DeviceII();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
deleted file mode 100644
index bd70b8434c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.ImageData
- *
- * @see org.eclipse.swt.graphics.ImageData
- */
-public class Test_org_eclipse_swt_graphics_ImageData extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_ImageData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData() {
- warnUnimpl("Test test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData not written");
-}
-
-public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B() {
- warnUnimpl("Test test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B not written");
-}
-
-public void test_ConstructorLjava_io_InputStream() {
- warnUnimpl("Test test_ConstructorLjava_io_InputStream not written");
-}
-
-public void test_ConstructorLjava_lang_String() {
- warnUnimpl("Test test_ConstructorLjava_lang_String not written");
-}
-
-public void test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII() {
- warnUnimpl("Test test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII not written");
-}
-
-public void test_clone() {
- warnUnimpl("Test test_clone not written");
-}
-
-public void test_getAlphaII() {
- warnUnimpl("Test test_getAlphaII not written");
-}
-
-public void test_getAlphasIII$BI() {
- warnUnimpl("Test test_getAlphasIII$BI not written");
-}
-
-public void test_getPixelII() {
- warnUnimpl("Test test_getPixelII not written");
-}
-
-public void test_getPixelsIII$BI() {
- warnUnimpl("Test test_getPixelsIII$BI not written");
-}
-
-public void test_getPixelsIII$II() {
- warnUnimpl("Test test_getPixelsIII$II not written");
-}
-
-public void test_getRGBs() {
- warnUnimpl("Test test_getRGBs not written");
-}
-
-public void test_getTransparencyMask() {
- warnUnimpl("Test test_getTransparencyMask not written");
-}
-
-public void test_getTransparencyType() {
- warnUnimpl("Test test_getTransparencyType not written");
-}
-
-public void test_scaledToII() {
- warnUnimpl("Test test_scaledToII not written");
-}
-
-public void test_setAlphaIII() {
- warnUnimpl("Test test_setAlphaIII not written");
-}
-
-public void test_setAlphasIII$BI() {
- warnUnimpl("Test test_setAlphasIII$BI not written");
-}
-
-public void test_setPixelIII() {
- warnUnimpl("Test test_setPixelIII not written");
-}
-
-public void test_setPixelsIII$BI() {
- warnUnimpl("Test test_setPixelsIII$BI not written");
-}
-
-public void test_setPixelsIII$II() {
- warnUnimpl("Test test_setPixelsIII$II not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_ImageData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData");
- methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B");
- methodNames.addElement("test_ConstructorLjava_io_InputStream");
- methodNames.addElement("test_ConstructorLjava_lang_String");
- methodNames.addElement("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII");
- methodNames.addElement("test_clone");
- methodNames.addElement("test_getAlphaII");
- methodNames.addElement("test_getAlphasIII$BI");
- methodNames.addElement("test_getPixelII");
- methodNames.addElement("test_getPixelsIII$BI");
- methodNames.addElement("test_getPixelsIII$II");
- methodNames.addElement("test_getRGBs");
- methodNames.addElement("test_getTransparencyMask");
- methodNames.addElement("test_getTransparencyType");
- methodNames.addElement("test_scaledToII");
- methodNames.addElement("test_setAlphaIII");
- methodNames.addElement("test_setAlphasIII$BI");
- methodNames.addElement("test_setPixelIII");
- methodNames.addElement("test_setPixelsIII$BI");
- methodNames.addElement("test_setPixelsIII$II");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData();
- else if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B();
- else if (getName().equals("test_ConstructorLjava_io_InputStream")) test_ConstructorLjava_io_InputStream();
- else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String();
- else if (getName().equals("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII")) test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII();
- else if (getName().equals("test_clone")) test_clone();
- else if (getName().equals("test_getAlphaII")) test_getAlphaII();
- else if (getName().equals("test_getAlphasIII$BI")) test_getAlphasIII$BI();
- else if (getName().equals("test_getPixelII")) test_getPixelII();
- else if (getName().equals("test_getPixelsIII$BI")) test_getPixelsIII$BI();
- else if (getName().equals("test_getPixelsIII$II")) test_getPixelsIII$II();
- else if (getName().equals("test_getRGBs")) test_getRGBs();
- else if (getName().equals("test_getTransparencyMask")) test_getTransparencyMask();
- else if (getName().equals("test_getTransparencyType")) test_getTransparencyType();
- else if (getName().equals("test_scaledToII")) test_scaledToII();
- else if (getName().equals("test_setAlphaIII")) test_setAlphaIII();
- else if (getName().equals("test_setAlphasIII$BI")) test_setAlphasIII$BI();
- else if (getName().equals("test_setPixelIII")) test_setPixelIII();
- else if (getName().equals("test_setPixelsIII$BI")) test_setPixelsIII$BI();
- else if (getName().equals("test_setPixelsIII$II")) test_setPixelsIII$II();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java
deleted file mode 100644
index cd195ef701..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoader
- *
- * @see org.eclipse.swt.graphics.ImageLoader
- */
-public class Test_org_eclipse_swt_graphics_ImageLoader extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_ImageLoader(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_loadLjava_io_InputStream() {
- warnUnimpl("Test test_loadLjava_io_InputStream not written");
-}
-
-public void test_loadLjava_lang_String() {
- warnUnimpl("Test test_loadLjava_lang_String not written");
-}
-
-public void test_saveLjava_io_OutputStreamI() {
- warnUnimpl("Test test_saveLjava_io_OutputStreamI not written");
-}
-
-public void test_saveLjava_lang_StringI() {
- warnUnimpl("Test test_saveLjava_lang_StringI not written");
-}
-
-public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() {
- warnUnimpl("Test test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener not written");
-}
-
-public void test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() {
- warnUnimpl("Test test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener not written");
-}
-
-public void test_hasListeners() {
- warnUnimpl("Test test_hasListeners not written");
-}
-
-public void test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent() {
- warnUnimpl("Test test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoader((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_loadLjava_io_InputStream");
- methodNames.addElement("test_loadLjava_lang_String");
- methodNames.addElement("test_saveLjava_io_OutputStreamI");
- methodNames.addElement("test_saveLjava_lang_StringI");
- methodNames.addElement("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener");
- methodNames.addElement("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener");
- methodNames.addElement("test_hasListeners");
- methodNames.addElement("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_loadLjava_io_InputStream")) test_loadLjava_io_InputStream();
- else if (getName().equals("test_loadLjava_lang_String")) test_loadLjava_lang_String();
- else if (getName().equals("test_saveLjava_io_OutputStreamI")) test_saveLjava_io_OutputStreamI();
- else if (getName().equals("test_saveLjava_lang_StringI")) test_saveLjava_lang_StringI();
- else if (getName().equals("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener();
- else if (getName().equals("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener();
- else if (getName().equals("test_hasListeners")) test_hasListeners();
- else if (getName().equals("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java
deleted file mode 100644
index 0390fd46cd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderEvent
- *
- * @see org.eclipse.swt.graphics.ImageLoaderEvent
- */
-public class Test_org_eclipse_swt_graphics_ImageLoaderEvent extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_ImageLoaderEvent(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ not written");
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoaderEvent((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ")) test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java
deleted file mode 100644
index 2f779db42a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderListener
- *
- * @see org.eclipse.swt.graphics.ImageLoaderListener
- */
-public class Test_org_eclipse_swt_graphics_ImageLoaderListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_ImageLoaderListener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent() {
- warnUnimpl("Test test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java
deleted file mode 100644
index c55f5464cd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.PaletteData
- *
- * @see org.eclipse.swt.graphics.PaletteData
- */
-public class Test_org_eclipse_swt_graphics_PaletteData extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_PaletteData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor$Lorg_eclipse_swt_graphics_RGB() {
- warnUnimpl("Test test_Constructor$Lorg_eclipse_swt_graphics_RGB not written");
-}
-
-public void test_ConstructorIII() {
- warnUnimpl("Test test_ConstructorIII not written");
-}
-
-public void test_getPixelLorg_eclipse_swt_graphics_RGB() {
- warnUnimpl("Test test_getPixelLorg_eclipse_swt_graphics_RGB not written");
-}
-
-public void test_getRGBI() {
- warnUnimpl("Test test_getRGBI not written");
-}
-
-public void test_getRGBs() {
- warnUnimpl("Test test_getRGBs not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_PaletteData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor$Lorg_eclipse_swt_graphics_RGB");
- methodNames.addElement("test_ConstructorIII");
- methodNames.addElement("test_getPixelLorg_eclipse_swt_graphics_RGB");
- methodNames.addElement("test_getRGBI");
- methodNames.addElement("test_getRGBs");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor$Lorg_eclipse_swt_graphics_RGB")) test_Constructor$Lorg_eclipse_swt_graphics_RGB();
- else if (getName().equals("test_ConstructorIII")) test_ConstructorIII();
- else if (getName().equals("test_getPixelLorg_eclipse_swt_graphics_RGB")) test_getPixelLorg_eclipse_swt_graphics_RGB();
- else if (getName().equals("test_getRGBI")) test_getRGBI();
- else if (getName().equals("test_getRGBs")) test_getRGBs();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java
deleted file mode 100644
index 66a07624ee..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Point
- *
- * @see org.eclipse.swt.graphics.Point
- */
-public class Test_org_eclipse_swt_graphics_Point extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_Point(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorII(){
- // Test new Point (int x, int y)
- Point p = new Point(3, 4);
- assertEquals(3, p.x);
- assertEquals(4, p.y);
-
- p = new Point(-4, -3);
- assertEquals(-4, p.x);
- assertEquals(-3, p.y);
-
- p = new Point(500000, 700000);
- assertEquals(500000, p.x);
- assertEquals(700000, p.y);
-}
-
-public void test_equalsLjava_lang_Object(){
- Point p1 = new Point(5, 5);
- Point p2 = new Point(5, 5);
- assertTrue("Points should be equal", p1.equals(p2));
-
- p1 = new Point(-5, -5);
- p2 = new Point(-5, -5);
- assertTrue("Points should be equal", p1.equals(p2));
-
- p2 = new Point(3, 4);
- assertTrue("Points should not be equal", !p1.equals(p2));
-}
-
-public void test_hashCode(){
- Point p1 = new Point(5, 5);
- Point p2 = new Point(5, 5);
- assertTrue("Points should have the same hashCode", p1.hashCode() == p2.hashCode());
-}
-
-public void test_toString(){
- Point p = new Point(3, 4);
- assertNotNull(p.toString());
- assertTrue(p.toString().length() > 0);
- assertEquals("Point {3, 4}", p.toString());
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Point((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorII");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorII")) test_ConstructorII();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java
deleted file mode 100644
index 1eb074cc1c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.RGB
- *
- * @see org.eclipse.swt.graphics.RGB
- */
-public class Test_org_eclipse_swt_graphics_RGB extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_RGB(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorIII() {
- // Test RGB(int red, int green, int blue)
- RGB rgb = new RGB(20,100,200);
-
- rgb = new RGB(0,0,0);
-
- rgb = new RGB(255,255,255);
-
- try {
- rgb = new RGB(-1, 20, 50);
- fail("No exception thrown for red < 0");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- rgb = new RGB(256, 20, 50);
- fail("No exception thrown for red > 255");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- rgb = new RGB(20, -1, 50);
- fail("No exception thrown for green < 0");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- rgb = new RGB(20, 256, 50);
- fail("No exception thrown for green > 255");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- rgb = new RGB(20, 50, -1);
- fail("No exception thrown for blue < 0");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- rgb = new RGB(20, 50, 256);
- fail("No exception thrown for blue > 255");
- }
- catch (IllegalArgumentException e) {
- }
-
-}
-
-public void test_equalsLjava_lang_Object() {
- int r = 0, g = 127, b = 254;
- RGB rgb1 = new RGB(r, g, b);
- RGB rgb2;
-
- rgb2 = rgb1;
- if (!rgb1.equals(rgb2)) {
- fail("Two references to the same RGB instance not found equal");
- }
-
- rgb2 = new RGB(r, g, b);
- if (!rgb1.equals(rgb2)) {
- fail("References to two different RGB instances with same R G B parameters not found equal");
- }
-
- if (rgb1.equals(new RGB(r+1, g, b)) ||
- rgb1.equals(new RGB(r, g+1, b)) ||
- rgb1.equals(new RGB(r, g, b+1)) ||
- rgb1.equals(new RGB(r+1, g+1, b+1))) {
- fail("Comparing two RGB instances with different combination of R G B parameters found equal");
- }
-}
-
-public void test_hashCode() {
- int r = 255, g = 100, b = 0;
- RGB rgb1 = new RGB(r, g, b);
- RGB rgb2 = new RGB(r, g, b);
-
- int hash1 = rgb1.hashCode();
- int hash2 = rgb2.hashCode();
-
- if (hash1 != hash2) {
- fail("Two RGB instances with same R G B parameters returned different hash codes");
- }
-
- if (rgb1.hashCode() == new RGB(g, b, r).hashCode() ||
- rgb1.hashCode() == new RGB(b, r, g).hashCode()) {
- fail("Two RGB instances with different R G B parameters returned the same hash code");
- }
-}
-
-public void test_toString() {
- RGB rgb = new RGB(0, 100, 200);
-
- String s = rgb.toString();
-
- if (s == null || s.length() == 0) {
- fail("RGB.toString returns a null or empty String");
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_RGB((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorIII");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorIII")) test_ConstructorIII();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java
deleted file mode 100644
index c01f56046f..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java
+++ /dev/null
@@ -1,320 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Rectangle
- *
- * @see org.eclipse.swt.graphics.Rectangle
- */
-public class Test_org_eclipse_swt_graphics_Rectangle extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_Rectangle(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorIIII(){
- // Test new Rectangle (int x, int y, int width, int height)
- Rectangle r = new Rectangle(3, 4, 5, 6);
- assertEquals(3, r.x);
- assertEquals(4, r.y);
- assertEquals(5, r.width);
- assertEquals(6, r.height);
-
- r = new Rectangle(-4, -3, -2, -1);
- assertEquals(-4, r.x);
- assertEquals(-3, r.y);
- assertEquals(-2, r.width);
- assertEquals(-1, r.height);
-
- r = new Rectangle(500000, 700000, 200000, 100000);
- assertEquals(500000, r.x);
- assertEquals(700000, r.y);
- assertEquals(200000, r.width);
- assertEquals(100000, r.height);
-}
-
-/**
- * Destructively replaces the x, y, width and height values
- * in the receiver with ones which represent the union of the
- * rectangles specified by the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_addLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1);
-
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1);
-
- r1 = new Rectangle(1, 2, 3, 4);
- r2 = new Rectangle(3, 3, 0, 0);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 3, 4), r1);
-
- r1 = new Rectangle(1, 2, 3, 4);
- r2 = new Rectangle(6, 6, 0, 0);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 5, 4), r1);
-
- try {
- r1.add(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver.
- */
-public void test_containsII(){
- Rectangle r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle should contain point (1, 2)", r.contains(1, 2));
-
- assertTrue("Rectangle should contain point (3, 4)", r.contains(3, 4));
-
- assertTrue("Rectangle should contain point (3, 5)", r.contains(3, 5));
-
-// assertTrue("Rectangle should contain point (3, 6)", r.contains(3, 6));
-//
-// assertTrue("Rectangle should contain point (4, 5)", r.contains(4, 5));
-//
-// assertTrue("Rectangle should contain point (4, 6)", r.contains(4, 6));
-
- assertTrue("Rectangle should not contain point (9, 10)", !r.contains(9, 10));
-
- assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(-1, -1));
-}
-
-/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_containsLorg_eclipse_swt_graphics_Point(){
- Rectangle r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle should contain Point(1, 2)", r.contains(new Point(1, 2)));
-
- assertTrue("Rectangle should contain Point(3, 4)", r.contains(new Point(3, 4)));
-
- assertTrue("Rectangle should contain point (3, 5)", r.contains(new Point(3, 5)));
-
-// assertTrue("Rectangle should contain point (3, 6)", r.contains(new Point(3, 6)));
-//
-// assertTrue("Rectangle should contain point (4, 5)", r.contains(new Point(4, 5)));
-//
-// assertTrue("Rectangle should contain Point(4, 6)", r.contains(new Point(4, 6)));
-
- assertTrue("Rectangle should not contain Point(9, 10)", !r.contains(new Point(9, 10)));
-
- assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(new Point(-1, -1)));
-
- try {
- r.contains(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_equalsLjava_lang_Object(){
- Rectangle r1 = new Rectangle(5, 4, 3, 2);
- Rectangle r2 = new Rectangle(5, 4, 3, 2);
- assertTrue("Rectangles should be equal", r1.equals(r2));
-
- r2 = new Rectangle(3, 4, 5, 6);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(2, 3, 4, 5);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(5, 4, 2, 3);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(4, 5, 3, 2);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-}
-
-public void test_hashCode(){
- Rectangle r1 = new Rectangle(5, 4, 3, 2);
- Rectangle r2 = new Rectangle(5, 4, 3, 2);
- assertTrue("Rectangles should have the same hashCode", r1.hashCode() == r2.hashCode());
-}
-
-/**
- * Returns a new rectangle which represents the intersection
- * of the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_intersectionLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 1, 2), r1.intersection(r2));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 0, 0), r1.intersection(r2));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, -1, -1), r1.intersection(r2));
-
- try {
- r1.intersection(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-/**
- * Returns <code>true</code> if the given rectangle intersects
- * with the receiver and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_intersectsLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(2, 3, 7, 8);
- assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(2, 3, 7, 8)", r1.intersects(r2));
- assertTrue("Rectangle(2, 3, 7, 8) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1));
-
- r2 = new Rectangle(200, 300, 400, 500);
- assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(200, 300, 400, 500)", !r1.intersects(r2));
- assertTrue("Rectangle(200, 300, 400, 500) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(3, 3, 0, 0)", r1.intersects(r2));
- assertTrue("Rectangle(3, 3, 0, 0) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(3, 3, -1, -1)", !r1.intersects(r2));
- assertTrue("Rectangle(3, 3, -1, -1) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1));
-
- try {
- r1.intersects(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- * <p>
- * A rectangle is considered to <em>cover area</em> in the
- * (x, y) coordinate plane if both its width and height are
- * non-zero.
- * </p>
- */
-public void test_isEmpty(){
- Rectangle r = new Rectangle(1, 2, 0, 0);
- assertTrue("Rectangle is empty", r.isEmpty());
-
- r = new Rectangle(1, 2, -3, -4);
- assertTrue("Rectangle is empty", r.isEmpty());
-
- r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle is not empty", !r.isEmpty());
-}
-
-public void test_toString(){
- Rectangle r = new Rectangle(3, 4, 5, 6);
- assertNotNull(r.toString());
- assertTrue(r.toString().length() > 0);
- assertEquals("Rectangle {3, 4, 5, 6}", r.toString());
-}
-
-/**
- * Returns a new rectangle which represents the union of
- * the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_unionLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 4, 4), r1.union(r2));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2));
-
- try {
- r1.union(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Rectangle((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorIIII");
- methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_containsII");
- methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_intersectionLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_isEmpty");
- methodNames.addElement("test_toString");
- methodNames.addElement("test_unionLorg_eclipse_swt_graphics_Rectangle");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorIIII")) test_ConstructorIIII();
- else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_containsII")) test_containsII();
- else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_intersectionLorg_eclipse_swt_graphics_Rectangle")) test_intersectionLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_isEmpty")) test_isEmpty();
- else if (getName().equals("test_toString")) test_toString();
- else if (getName().equals("test_unionLorg_eclipse_swt_graphics_Rectangle")) test_unionLorg_eclipse_swt_graphics_Rectangle();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java
deleted file mode 100644
index b5fa68fedf..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java
+++ /dev/null
@@ -1,528 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.graphics.Region
- *
- * @see org.eclipse.swt.graphics.Region
- */
-public class Test_org_eclipse_swt_graphics_Region extends SwtTestCase {
-
-public Test_org_eclipse_swt_graphics_Region(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor(){
- // test Region()
- Region reg = new Region();
- if (reg.isDisposed()) {
- fail("Constructor for Region didn't initialize handle field");
- }
- reg.dispose();
-}
-
-public void test_addLorg_eclipse_swt_graphics_Rectangle(){
- Region reg = new Region();
- // add a rectangle
- reg.add(new Rectangle(0, 0, 100, 50));
- // add a second rectangle
- reg.add(new Rectangle(200, 200, 10,10));
-
- try {
- reg.add((Rectangle)null);
- fail("no exception thrown for adding a null rectangle");
- }
- catch (IllegalArgumentException e) {
- }
-
- reg.dispose();
-
- try {
- reg.add(new Rectangle(20,30,10,5));
- fail("no exception thrown for adding a rectangle after Region got disposed");
- }
- catch (SWTException e) {
- }
-}
-
-public void test_addLorg_eclipse_swt_graphics_Region(){
- Region reg1 = new Region();
- // make a second region and add it to the first one
- Region reg2 = new Region();
- reg2.add(new Rectangle(40, 50, 10, 20));
- reg1.add(reg2);
-
- try {
- reg1.add((Region)null);
- fail("no exception thrown for adding a null region");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- reg2 = new Region();
- reg2.add(new Rectangle(1,1,100,200));
- reg2.dispose();
- reg1.add(reg2);
- fail("no exception thrown for adding to a Region a Region which got disposed");
- }
- catch (IllegalArgumentException e) {
- }
-
- reg1.dispose();
-
- try {
- reg2 = new Region();
- reg2.add(new Rectangle(1,1,100,200));
- reg1.add(reg2);
- fail("no exception thrown for adding a Region to a Region which got disposed");
- }
- catch (SWTException e) {
- }
-}
-
-public void test_containsII(){
- Rectangle rect1 = new Rectangle(10,10,200,100);
- Point pointInRect1 = new Point(10,10);
- Rectangle rect2 = new Rectangle(50,50,1000,1000);
- Point pointInRect2 = new Point(1049,1009);
- Point pointNotInRect12 = new Point(49,110);
-
- Region reg = new Region();
- reg.dispose();
- try {
- boolean res = reg.contains(pointInRect1.x, pointInRect1.y);
- fail("no exception thrown on disposed region");
- }
- catch (Exception e) {
- }
-
- reg = new Region();
- if (reg.contains(pointInRect1.x, pointInRect1.y)) {
- reg.dispose();
- fail("Empty region should not contain point");
- }
- reg.add(rect1);
- if (!reg.contains(pointInRect1.x, pointInRect1.y)) {
- reg.dispose();
- fail("Region should contain point");
- }
- reg.add(rect2);
- if (!reg.contains(pointInRect1.x, pointInRect1.y) ||
- !reg.contains(pointInRect2.x, pointInRect2.y)) {
- reg.dispose();
- fail("Region should contain point");
- }
- if (reg.contains(pointNotInRect12.x, pointNotInRect12.y)) {
- reg.dispose();
- fail("Region should not contain point");
- }
- reg.dispose();
-}
-
-public void test_containsLorg_eclipse_swt_graphics_Point(){
- Rectangle rect1 = new Rectangle(10,10,200,100);
- Point pointInRect1 = new Point(10,10);
- Rectangle rect2 = new Rectangle(50,50,1000,1000);
- Point pointInRect2 = new Point(1049,1009);
- Point pointNotInRect12 = new Point(49,110);
-
- Region reg = new Region();
- reg.dispose();
- try {
- boolean res = reg.contains(pointInRect1);
- fail("no exception thrown on disposed region");
- }
- catch (Exception e) {
- }
-
- reg = new Region();
- if (reg.contains(pointInRect1)) {
- reg.dispose();
- fail("Empty region should not contain point");
- }
- reg.add(rect1);
- if (!reg.contains(pointInRect1)) {
- reg.dispose();
- fail("Region should contain point");
- }
- reg.add(rect2);
- if (!reg.contains(pointInRect1) ||
- !reg.contains(pointInRect2)) {
- reg.dispose();
- fail("Region should contain point");
- }
- if (reg.contains(pointNotInRect12)) {
- reg.dispose();
- fail("Region should not contain point");
- }
- reg.dispose();
-}
-
-public void test_dispose(){
- Region reg = new Region();
- reg.add(new Rectangle(1,1,50,100));
- if (reg.isDisposed()) {
- fail("Region should not be in the disposed state");
- }
-
- // dispose twice as this is allowed
- for (int i = 0; i < 2; i++) {
- reg.dispose();
- if (!reg.isDisposed()) {
- fail("Region should be in the disposed state");
- }
- }
-}
-
-public void test_equalsLjava_lang_Object(){
- Rectangle rect1 = new Rectangle(25, 100, 200, 780);
- Rectangle rect2 = new Rectangle(30, 105, 205, 785);
-
- Region reg1 = new Region();
- reg1.add(rect1);
-
- Region reg2 = reg1;
-
- if (!reg1.equals(reg2)) {
- reg1.dispose();
- reg2.dispose();
- fail("references to the same instance of Region should be considered equal");
- }
-
- reg2 = new Region();
- reg2.add(rect1);
-
-// Currently, Regions are only "equal" if they have the same handle.
-// This is so that identical objects are properly hashed.
-// We are considering adding a new method that will compare Regions for the same area.
-// if (!reg1.equals(reg2)) {
-// reg1.dispose();
-// reg2.dispose();
-// fail("two instances of Region representing the same area should be considered equal");
-// }
-
- reg2.dispose();
- reg2 = new Region();
- if (reg1.equals(reg2)) {
- reg1.dispose();
- reg2.dispose();
- fail("Non empty region considered equal to empty one");
- }
-
- reg2.add(rect2);
- if (reg1.equals(reg2)) {
- reg1.dispose();
- reg2.dispose();
- fail("two different regions considered equal");
- }
-
- reg1.dispose();
- reg2.dispose();
-}
-
-public void test_getBounds(){
- Region reg = new Region();
- reg.dispose();
-
- try {
- Rectangle rect = reg.getBounds();
- fail("Region disposed should throw Exception");
- }
- catch (Exception e) {
- }
-
- Rectangle rect1 = new Rectangle(10,10,50,30);
- Rectangle rect2 = new Rectangle(100,100,10,10);
- // the rectangle enclosing the two preceding rectangles
- Rectangle rect12Bounds = new Rectangle(10,10,100,100);
-
- reg = new Region();
- reg.add(rect1);
- Rectangle rect1Bis = reg.getBounds();
- if (rect1Bis.x != rect1.x || rect1Bis.y != rect1.y ||
- rect1Bis.height != rect1.height || rect1Bis.width != rect1.width) {
- reg.dispose();
- fail("getBounds doesn't return the borders of the rectangle area which was set up");
- }
-
- reg.add(rect2);
- Rectangle rect12 = reg.getBounds();
- if (rect12.x != rect12Bounds.x || rect12.y != rect12Bounds.y ||
- rect12.height != rect12Bounds.height || rect12.width != rect12Bounds.width) {
- reg.dispose();
- fail("getBounds doesn't return the borders of the resulting rectangle area which was set up");
- }
-
- reg.dispose();
-}
-
-public void test_hashCode(){
- Region reg1 = new Region();
- Region reg2 = new Region();
-
- Rectangle rect1 = new Rectangle(25, 100, 200, 780);
- Rectangle rect2 = new Rectangle(30, 105, 205, 785);
-
- reg1.add(rect1);
- reg2.add(rect2);
-
- if (reg1.hashCode() == reg2.hashCode()) {
- reg1.dispose();
- reg2.dispose();
- fail("two different regions should have different hashCode");
- }
- reg2.dispose();
-
- reg2 = new Region();
- reg2.add(rect1);
-
-
-// BUG: this should pass
-// if (reg1.hashCode() != reg2.hashCode()) {
-// reg1.dispose();
-// reg2.dispose();
-// fail("two regions representing same area should have same hashCode");
-// }
-
- reg1.dispose();
- reg2.dispose();
-}
-
-public void test_intersectsIIII(){
- Rectangle rect1 = new Rectangle(10,20,50,30);
- Rectangle rectInter1 = new Rectangle(59,49,10,20);
- Rectangle rectNotInter1 = new Rectangle(0,5,10,15);
-
- Rectangle rect2 = new Rectangle(30,40,10,100);
- Rectangle rectInter2 = new Rectangle(39,139,1,5);
- Rectangle rectNotInter12 = new Rectangle(40,50,5,15);
-
-
- Region reg = new Region();
- reg.dispose();
- try {
- boolean res = reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height);
- fail("no exception thrown on disposed region");
- }
- catch (Exception e) {
- }
-
- reg = new Region();
- if (reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) {
- reg.dispose();
- fail("intersects can't return true on empty region");
- }
- reg.add(rect1);
- if (!reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) {
- reg.dispose();
- fail("intersects didn't return true");
- }
- if (!reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height)) {
- reg.dispose();
- fail("intersects didn't return true ");
- }
- if (reg.intersects(rectNotInter1.x, rectNotInter1.y, rectNotInter1.width, rectNotInter1.height)) {
- reg.dispose();
- fail("intersects return true on rectangle not intersecting with region");
- }
-
- reg.add(rect2);
- if (!reg.intersects(rect2.x, rect2.y, rect2.width, rect2.height)) {
- reg.dispose();
- fail("intersects didn't return true");
- }
- if (!reg.intersects(rectInter2.x, rectInter2.y, rectInter2.width, rectInter2.height)) {
- reg.dispose();
- fail("intersects didn't return true ");
- }
- if (reg.intersects(rectNotInter12.x, rectNotInter12.y, rectNotInter12.width, rectNotInter12.height)) {
- reg.dispose();
- fail("intersects return true on rectangle not intersecting with region");
- }
- reg.dispose();
-}
-
-public void test_intersectsLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle rect1 = new Rectangle(10,20,50,30);
- Rectangle rectInter1 = new Rectangle(59,49,10,20);
- Rectangle rectNotInter1 = new Rectangle(0,5,10,15);
-
- Rectangle rect2 = new Rectangle(30,40,10,100);
- Rectangle rectInter2 = new Rectangle(39,139,1,5);
- Rectangle rectNotInter12 = new Rectangle(40,50,5,15);
-
-
- Region reg = new Region();
- reg.dispose();
- try {
- boolean res = reg.intersects(rectInter1);
- fail("no exception thrown on disposed region");
- }
- catch (Exception e) {
- }
-
- reg = new Region();
- if (reg.intersects(rect1)) {
- reg.dispose();
- fail("intersects can't return true on empty region");
- }
- reg.add(rect1);
- if (!reg.intersects(rect1)) {
- reg.dispose();
- fail("intersects didn't return true");
- }
- if (!reg.intersects(rectInter1)) {
- reg.dispose();
- fail("intersects didn't return true ");
- }
- if (reg.intersects(rectNotInter1)) {
- reg.dispose();
- fail("intersects return true on rectangle not intersecting with region");
- }
-
- reg.add(rect2);
- if (!reg.intersects(rect2)) {
- reg.dispose();
- fail("intersects didn't return true");
- }
- if (!reg.intersects(rectInter2)) {
- reg.dispose();
- fail("intersects didn't return true ");
- }
- if (reg.intersects(rectNotInter12)) {
- reg.dispose();
- fail("intersects return true on rectangle not intersecting with region");
- }
- reg.dispose();
-}
-
-public void test_isDisposed(){
- // test in dispose()
-}
-
-public void test_isEmpty(){
- Region reg = new Region();
- Rectangle emptyRect1 = new Rectangle(10,20,0,200);
- Rectangle emptyRect2 = new Rectangle(10,20,10,0);
- Rectangle rect = new Rectangle(10,20,50,100);
-
- if (!reg.isEmpty()) {
- reg.dispose();
- fail("isEmpty didn't return true on empty region");
- }
-
- reg.add(emptyRect1);
- if (!reg.isEmpty()) {
- reg.dispose();
- fail("isEmpty didn't return true on empty region");
- }
-
- reg.add(emptyRect2);
- if (!reg.isEmpty()) {
- reg.dispose();
- fail("isEmpty didn't return true on empty region");
- }
-
- reg.add(rect);
- if (reg.isEmpty()) {
- reg.dispose();
- fail("isEmpty returned true on non empty region");
- }
-
- reg.dispose();
-}
-
-public void test_win32_newI(){
- // not part of public api
-}
-
-public void test_toString(){
- Region reg = new Region();
-
- String s = reg.toString();
-
- if (s == null || s.length() == 0) {
- fail("toString returns null or empty string");
- }
-
- reg.add(new Rectangle(1,1,10,20));
- s = reg.toString();
-
- if (s == null || s.length() == 0) {
- fail("toString returns null or empty string");
- }
-
- reg.dispose();
- s = reg.toString();
-
- if (s == null || s.length() == 0) {
- fail("toString returns null or empty string");
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_graphics_Region((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_addLorg_eclipse_swt_graphics_Region");
- methodNames.addElement("test_containsII");
- methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_intersectsIIII");
- methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_isEmpty");
- methodNames.addElement("test_win32_newI");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_addLorg_eclipse_swt_graphics_Region")) test_addLorg_eclipse_swt_graphics_Region();
- else if (getName().equals("test_containsII")) test_containsII();
- else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_intersectsIIII")) test_intersectsIIII();
- else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_isEmpty")) test_isEmpty();
- else if (getName().equals("test_win32_newI")) test_win32_newI();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java
deleted file mode 100644
index f070c41955..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.layout.FillLayout
- *
- * @see org.eclipse.swt.layout.FillLayout
- */
-public class Test_org_eclipse_swt_layout_FillLayout extends Test_org_eclipse_swt_widgets_Layout {
-
-public Test_org_eclipse_swt_layout_FillLayout(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() {
- warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written");
-}
-
-public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() {
- warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_layout_FillLayout((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ");
- methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ();
- else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java
deleted file mode 100644
index 751e556011..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.layout.GridData
- *
- * @see org.eclipse.swt.layout.GridData
- */
-public class Test_org_eclipse_swt_layout_GridData extends SwtTestCase {
-
-public Test_org_eclipse_swt_layout_GridData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_ConstructorI() {
- warnUnimpl("Test test_ConstructorI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_layout_GridData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorI");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorI")) test_ConstructorI();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java
deleted file mode 100644
index 832c4a4255..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.layout.GridLayout
- *
- * @see org.eclipse.swt.layout.GridLayout
- */
-public class Test_org_eclipse_swt_layout_GridLayout extends Test_org_eclipse_swt_widgets_Layout {
-
-public Test_org_eclipse_swt_layout_GridLayout(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() {
- warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written");
-}
-
-public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() {
- warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_layout_GridLayout((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ");
- methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ();
- else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java
deleted file mode 100644
index 2f9c957c1a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.layout.RowData
- *
- * @see org.eclipse.swt.layout.RowData
- */
-public class Test_org_eclipse_swt_layout_RowData extends SwtTestCase {
-
-public Test_org_eclipse_swt_layout_RowData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_ConstructorII() {
- warnUnimpl("Test test_ConstructorII not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Point not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_layout_RowData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorII");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Point");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorII")) test_ConstructorII();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Point")) test_ConstructorLorg_eclipse_swt_graphics_Point();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java
deleted file mode 100644
index dd2891d14b..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.layout.RowLayout
- *
- * @see org.eclipse.swt.layout.RowLayout
- */
-public class Test_org_eclipse_swt_layout_RowLayout extends Test_org_eclipse_swt_widgets_Layout {
-
-public Test_org_eclipse_swt_layout_RowLayout(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() {
- warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written");
-}
-
-public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() {
- warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_layout_RowLayout((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ");
- methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ();
- else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java
deleted file mode 100644
index e8a092cabd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.printing.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.printing.PrintDialog
- *
- * @see org.eclipse.swt.printing.PrintDialog
- */
-public class Test_org_eclipse_swt_printing_PrintDialog extends Test_org_eclipse_swt_widgets_Dialog {
-
- PrintDialog printDialog;
-
-public Test_org_eclipse_swt_printing_PrintDialog(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- printDialog = new PrintDialog(shell, SWT.NONE);
- setDialog(printDialog);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- new PrintDialog(shell);
-
- try {
- new PrintDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- new PrintDialog(shell, SWT.NONE);
-
- try {
- new PrintDialog(null, SWT.NONE);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getScope() {
- warnUnimpl("Test test_getScope not written");
-}
-
-public void test_setScopeI() {
- warnUnimpl("Test test_setScopeI not written");
-}
-
-public void test_getStartPage() {
- warnUnimpl("Test test_getStartPage not written");
-}
-
-public void test_setStartPageI() {
- warnUnimpl("Test test_setStartPageI not written");
-}
-
-public void test_getEndPage() {
- warnUnimpl("Test test_getEndPage not written");
-}
-
-public void test_setEndPageI() {
- warnUnimpl("Test test_setEndPageI not written");
-}
-
-public void test_getPrintToFile() {
- warnUnimpl("Test test_getPrintToFile not written");
-}
-
-public void test_setPrintToFileZ() {
- warnUnimpl("Test test_setPrintToFileZ not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_open() {
- warnUnimpl("Test test_open not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_printing_PrintDialog((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getScope");
- methodNames.addElement("test_setScopeI");
- methodNames.addElement("test_getStartPage");
- methodNames.addElement("test_setStartPageI");
- methodNames.addElement("test_getEndPage");
- methodNames.addElement("test_setEndPageI");
- methodNames.addElement("test_getPrintToFile");
- methodNames.addElement("test_setPrintToFileZ");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_open");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getScope")) test_getScope();
- else if (getName().equals("test_setScopeI")) test_setScopeI();
- else if (getName().equals("test_getStartPage")) test_getStartPage();
- else if (getName().equals("test_setStartPageI")) test_setStartPageI();
- else if (getName().equals("test_getEndPage")) test_getEndPage();
- else if (getName().equals("test_setEndPageI")) test_setEndPageI();
- else if (getName().equals("test_getPrintToFile")) test_getPrintToFile();
- else if (getName().equals("test_setPrintToFileZ")) test_setPrintToFileZ();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_open")) test_open();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
deleted file mode 100644
index 9fc81d5707..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.printing.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.printing.Printer
- *
- * @see org.eclipse.swt.printing.Printer
- */
-public class Test_org_eclipse_swt_printing_Printer extends Test_org_eclipse_swt_graphics_Device {
-
-public Test_org_eclipse_swt_printing_Printer(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_getPrinterList() {
- warnUnimpl("Test test_getPrinterList not written");
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_printing_PrinterData() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_printing_PrinterData not written");
-}
-
-public void test_createLorg_eclipse_swt_graphics_DeviceData() {
- warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written");
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_startJobLjava_lang_String() {
- warnUnimpl("Test test_startJobLjava_lang_String not written");
-}
-
-public void test_endJob() {
- warnUnimpl("Test test_endJob not written");
-}
-
-public void test_cancelJob() {
- warnUnimpl("Test test_cancelJob not written");
-}
-
-public void test_startPage() {
- warnUnimpl("Test test_startPage not written");
-}
-
-public void test_endPage() {
- warnUnimpl("Test test_endPage not written");
-}
-
-public void test_getDPI() {
- warnUnimpl("Test test_getDPI not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_getPrinterData() {
- warnUnimpl("Test test_getPrinterData not written");
-}
-
-public void test_checkDevice() {
- warnUnimpl("Test test_checkDevice not written");
-}
-
-public void test_release() {
- warnUnimpl("Test test_release not written");
-}
-
-public void test_destroy() {
- warnUnimpl("Test test_destroy not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_printing_Printer((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_getPrinterList");
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_printing_PrinterData");
- methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData");
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_startJobLjava_lang_String");
- methodNames.addElement("test_endJob");
- methodNames.addElement("test_cancelJob");
- methodNames.addElement("test_startPage");
- methodNames.addElement("test_endPage");
- methodNames.addElement("test_getDPI");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getPrinterData");
- methodNames.addElement("test_checkDevice");
- methodNames.addElement("test_release");
- methodNames.addElement("test_destroy");
- methodNames.addAll(Test_org_eclipse_swt_graphics_Device.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_getPrinterList")) test_getPrinterList();
- else if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_printing_PrinterData")) test_ConstructorLorg_eclipse_swt_printing_PrinterData();
- else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData();
- else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_startJobLjava_lang_String")) test_startJobLjava_lang_String();
- else if (getName().equals("test_endJob")) test_endJob();
- else if (getName().equals("test_cancelJob")) test_cancelJob();
- else if (getName().equals("test_startPage")) test_startPage();
- else if (getName().equals("test_endPage")) test_endPage();
- else if (getName().equals("test_getDPI")) test_getDPI();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getPrinterData")) test_getPrinterData();
- else if (getName().equals("test_checkDevice")) test_checkDevice();
- else if (getName().equals("test_release")) test_release();
- else if (getName().equals("test_destroy")) test_destroy();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
deleted file mode 100644
index f10f9965e6..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.printing.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.printing.PrinterData
- *
- * @see org.eclipse.swt.printing.PrinterData
- */
-public class Test_org_eclipse_swt_printing_PrinterData extends Test_org_eclipse_swt_graphics_DeviceData {
-
-public Test_org_eclipse_swt_printing_PrinterData(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- PrinterData data = new PrinterData();
-}
-
-public void test_ConstructorLjava_lang_StringLjava_lang_String() {
- PrinterData data = new PrinterData("hello", "there");
-}
-
-public void test_toString() {
- PrinterData data = new PrinterData();
- assertNotNull(data.toString());
- assertTrue(data.toString().length() > 0);
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_printing_PrinterData((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLjava_lang_StringLjava_lang_String");
- methodNames.addElement("test_toString");
- methodNames.addAll(Test_org_eclipse_swt_graphics_DeviceData.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLjava_lang_StringLjava_lang_String")) test_ConstructorLjava_lang_StringLjava_lang_String();
- else if (getName().equals("test_toString")) test_toString();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java
deleted file mode 100644
index ecfcfc43da..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.program.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.program.Program
- *
- * @see org.eclipse.swt.program.Program
- */
-public class Test_org_eclipse_swt_program_Program extends SwtTestCase {
-
-public Test_org_eclipse_swt_program_Program(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_findProgramLjava_lang_String() {
- warnUnimpl("Test test_findProgramLjava_lang_String not written");
-}
-
-public void test_getExtensions() {
- warnUnimpl("Test test_getExtensions not written");
-}
-
-public void test_getPrograms() {
- warnUnimpl("Test test_getPrograms not written");
-}
-
-public void test_launchLjava_lang_String() {
- warnUnimpl("Test test_launchLjava_lang_String not written");
-}
-
-public void test_executeLjava_lang_String() {
- warnUnimpl("Test test_executeLjava_lang_String not written");
-}
-
-public void test_getImageData() {
- warnUnimpl("Test test_getImageData not written");
-}
-
-public void test_getName() {
- warnUnimpl("Test test_getName not written");
-}
-
-public void test_equalsLjava_lang_Object() {
- warnUnimpl("Test test_equalsLjava_lang_Object not written");
-}
-
-public void test_hashCode() {
- warnUnimpl("Test test_hashCode not written");
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_program_Program((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_findProgramLjava_lang_String");
- methodNames.addElement("test_getExtensions");
- methodNames.addElement("test_getPrograms");
- methodNames.addElement("test_launchLjava_lang_String");
- methodNames.addElement("test_executeLjava_lang_String");
- methodNames.addElement("test_getImageData");
- methodNames.addElement("test_getName");
- methodNames.addElement("test_equalsLjava_lang_Object");
- methodNames.addElement("test_hashCode");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_findProgramLjava_lang_String")) test_findProgramLjava_lang_String();
- else if (getName().equals("test_getExtensions")) test_getExtensions();
- else if (getName().equals("test_getPrograms")) test_getPrograms();
- else if (getName().equals("test_launchLjava_lang_String")) test_launchLjava_lang_String();
- else if (getName().equals("test_executeLjava_lang_String")) test_executeLjava_lang_String();
- else if (getName().equals("test_getImageData")) test_getImageData();
- else if (getName().equals("test_getName")) test_getName();
- else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
- else if (getName().equals("test_hashCode")) test_hashCode();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
deleted file mode 100644
index cc723f9cfc..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Button
- *
- * @see org.eclipse.swt.widgets.Button
- */
-public class Test_org_eclipse_swt_widgets_Button extends Test_org_eclipse_swt_widgets_Control {
-
-Button button;
-
-public Test_org_eclipse_swt_widgets_Button(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- button = new Button(shell, SWT.PUSH);
- setWidget(button);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- // Test Button(Composite parent, int style)
- Button button = new Button(shell, SWT.NULL);
-
- button = new Button(shell, SWT.PUSH);
-
- button = new Button(shell, SWT.CHECK);
-
- button = new Button(shell, SWT.TOGGLE);
-
- button = new Button(shell, SWT.ARROW);
-
- button = new Button(shell, SWT.PUSH | SWT.CHECK);
-
- try {
- button = new Button(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- button.computeSize(0, 0);
-
- button.computeSize(0, 0, false);
-
- button.computeSize(-10, -10);
-
- button.computeSize(-10, -10, false);
-
- button.computeSize(10, 10);
-
- button.computeSize(10, 10, false);
-
- button.computeSize(10000, 10000);
-
- button.computeSize(10000, 10000, false);
-}
-
-public void test_getAlignment() {
- warnUnimpl("Test test_getAlignment not written");
-}
-
-public void test_getImage() {
- // tested in test_setImageLorg_eclipse_swt_graphics_Image
-}
-
-public void test_getSelection() {
- // tested in test_setSelectionZ
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setAlignmentI() {
- button.setAlignment(SWT.LEFT);
- assertEquals(SWT.LEFT, button.getAlignment());
-
- button.setAlignment(SWT.RIGHT);
- assertEquals(SWT.RIGHT, button.getAlignment());
-
- button.setAlignment(SWT.CENTER);
- assertEquals(SWT.CENTER, button.getAlignment());
-
- button.setAlignment(SWT.UP); // bad value for push button
- assertTrue(SWT.UP != button.getAlignment());
-
- Button arrowButton = new Button(shell, SWT.ARROW);
- arrowButton.setAlignment(SWT.LEFT);
- assertEquals(SWT.LEFT, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.RIGHT);
- assertEquals(SWT.RIGHT, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.UP);
- assertEquals(SWT.UP, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.DOWN);
- assertEquals(SWT.DOWN, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.CENTER); // bad value for arrow button
- assertTrue(SWT.CENTER != arrowButton.getAlignment());
- arrowButton.dispose();
-
- int alignment = 55; // some bogus number
- button.setAlignment(alignment);
- assertTrue(alignment != button.getAlignment());
-}
-
-public void test_setFocus() {
- warnUnimpl("Test test_setFocus not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- Image image = button.getImage();
- button.setImage(image);
- assertEquals(image, button.getImage());
-
- button.setImage(null);
- assertNull(button.getImage());
-
- image = new Image(shell.getDisplay(), 10, 10);
- button.setImage(image);
- assertEquals(image, button.getImage());
-
- button.setImage(null);
- image.dispose();
- try {
- button.setImage(image);
- button.setImage(null);
- fail("No exception thrown for disposed image");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setSelectionZ() {
- // test setSelection for check box
- button = new Button(shell, SWT.CHECK);
- button.setSelection(true);
- assertTrue(button.getSelection());
- button.setSelection(false);
- assertTrue(!button.getSelection());
-
- // test setSelection for arrow button
- Button newButton = new Button(shell, SWT.ARROW);
- newButton.setSelection(true);
- assertTrue(!newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for push button
- newButton = new Button(shell, SWT.PUSH);
- newButton.setSelection(true);
- assertTrue(!newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for radio button
- newButton = new Button(shell, SWT.RADIO);
- newButton.setSelection(true);
- assertTrue(newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for toggle button
- newButton = new Button(shell, SWT.TOGGLE);
- newButton.setSelection(true);
- assertTrue(newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-}
-
-public void test_setTextLjava_lang_String() {
- String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct", "\n \n \b \t ", "\0"};
- int goodCases = 4;
- for (int i=0; i<goodCases; i++){
- button.setText(cases[i]);
- assertTrue("good case: " + String.valueOf(i), button.getText().equals(cases[i]));
- };
-
- try {
- button.setText(null);
- fail("No exception thrown for text == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- button.setText("");
-
- button.setText("some name ");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Button((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getAlignment");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setAlignmentI");
- methodNames.addElement("test_setFocus");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setSelectionZ");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getAlignment")) test_getAlignment();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setAlignmentI")) test_setAlignmentI();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setSelectionZ")) test_setSelectionZ();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java
deleted file mode 100644
index b4ec4c854d..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Canvas
- *
- * @see org.eclipse.swt.widgets.Canvas
- */
-public class Test_org_eclipse_swt_widgets_Canvas extends Test_org_eclipse_swt_widgets_Composite {
-
-Canvas canvas;
-
-public Test_org_eclipse_swt_widgets_Canvas(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, 0);
- super.setWidget(canvas);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-protected void setWidget(Widget w) {
- if (!canvas.isDisposed())
- canvas.dispose();
- canvas = (Canvas)w;
- super.setWidget(w);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- Canvas newCanvas;
- try {
- newCanvas = new Canvas(null, SWT.NONE);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getCaret() {
- // tested in test_setCaretLorg_eclipse_swt_widgets_Caret
-}
-
-public void test_scrollIIIIIIZ() {
- warnUnimpl("Test test_scrollIIIIIIZ not written");
-}
-
-public void test_setCaretLorg_eclipse_swt_widgets_Caret() {
- int number = 5;
- Caret[] carets = new Caret[number];
- for (int i = 0; i < number; i++) {
- carets[i] = new Caret(canvas, SWT.NONE);
- }
- for (int i = 0; i < number; i++) {
- canvas.setCaret(carets[i]);
- assertEquals("Caret # " + i + "not set properly", canvas.getCaret(), carets[i]);
- }
-
- canvas.setCaret(null);
- assertNull("Caret should be null" , canvas.getCaret());
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Canvas((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_getCaret");
- methodNames.addElement("test_scrollIIIIIIZ");
- methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_getCaret")) test_getCaret();
- else if (getName().equals("test_scrollIIIIIIZ")) test_scrollIIIIIIZ();
- else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java
deleted file mode 100644
index ef8cbc203c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Caret
- *
- * @see org.eclipse.swt.widgets.Caret
- */
-public class Test_org_eclipse_swt_widgets_Caret extends Test_org_eclipse_swt_widgets_Widget {
-
-Canvas canvas;
-Caret caret;
-
-public Test_org_eclipse_swt_widgets_Caret(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, SWT.NULL);
- caret = new Caret(canvas, SWT.NULL);
- setWidget(caret);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CanvasI() {
- Caret newCaret;
- try {
- newCaret = new Caret(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getBounds() {
- Rectangle rect = new Rectangle(0,0,30,30);
- caret.setBounds(rect);
- assertTrue(caret.getBounds().equals(rect));
-
- rect = new Rectangle(0,0,30,30);
- caret.setBounds(rect);
- assertTrue(!caret.getBounds().equals(new Rectangle (0,0,60,70)));
-}
-
-public void test_getFont() {
- // tested in test_setFontLorg_eclipse_swt_graphics_Font
-}
-
-public void test_getImage() {
- // tested in test_setImageLorg_eclipse_swt_graphics_Image
-}
-
-public void test_getParent() {
- assertEquals(canvas, caret.getParent());
-
- assertTrue(caret.getDisplay()==shell.getDisplay());
-}
-
-public void test_getVisible() {
- // tested in test_setVisibleZ
-}
-
-public void test_isVisible() {
- caret.setVisible(true);
- assertTrue(!caret.isVisible()); //because the shell is not visible
-
- caret.setVisible(false);
- assertTrue(!caret.isVisible());
-
- caret.setVisible(true);
- canvas.setVisible(true);
- shell.setVisible(true);
- assertTrue(caret.getVisible() == true);
- canvas.setVisible(false);
- if (fCheckVisibility) {
- assertTrue(!caret.getVisible());
- }
-
- shell.setVisible(false);
- canvas.setVisible(false);
- caret.setVisible(false);
- assertTrue(!caret.getVisible());
-}
-
-public void test_setBoundsIIII() {
- caret.setBounds(0, 0, 30, 30);
-}
-
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- caret.setBounds(new Rectangle(0,0,30,30));
-
- try {
- caret.setBounds(null);
- fail("No exception thrown for bounds == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- Font font = caret.getFont();
- caret.setFont(font);
- assertEquals(font, caret.getFont());
-
- font = new Font(caret.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL);
- caret.setFont(font);
- assertEquals(font, caret.getFont());
-
- caret.setFont(null);
- font.dispose();
- try {
- caret.setFont(font);
- caret.setFont(null);
- fail("No exception thrown for disposed font");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- Image image = caret.getImage();
- caret.setImage(image);
- assertEquals(image, caret.getImage());
-
- caret.setImage(null);
- assertNull(caret.getImage());
-
- image = new Image(shell.getDisplay(), 10, 10);
- caret.setImage(image);
- assertEquals(image, caret.getImage());
-
- caret.setImage(null);
- image.dispose();
- try {
- caret.setImage(image);
- caret.setImage(null);
- fail("No exception thrown for disposed image");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setVisibleZ() {
- caret.setVisible(true);
- assertTrue("Caret should be visible", caret.getVisible()==true);
-
- caret.setVisible(false);
- assertTrue("Caret should not be visible", caret.getVisible()==false);
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Caret((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CanvasI");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getFont");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getVisible");
- methodNames.addElement("test_isVisible");
- methodNames.addElement("test_setBoundsIIII");
- methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CanvasI")) test_ConstructorLorg_eclipse_swt_widgets_CanvasI();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getFont")) test_getFont();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getVisible")) test_getVisible();
- else if (getName().equals("test_isVisible")) test_isVisible();
- else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII();
- else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java
deleted file mode 100644
index 095187b219..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ColorDialog
- *
- * @see org.eclipse.swt.widgets.ColorDialog
- */
-public class Test_org_eclipse_swt_widgets_ColorDialog extends Test_org_eclipse_swt_widgets_Dialog {
-
-ColorDialog colorDialog;
-
-public Test_org_eclipse_swt_widgets_ColorDialog(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- colorDialog = new ColorDialog(shell, SWT.NULL);
- setDialog(colorDialog);
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- new ColorDialog(shell);
-
- try {
- new ColorDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- new ColorDialog(shell, SWT.NULL);
-
- try {
- new ColorDialog(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getRGB() {
- // tested in test_setRGBLorg_eclipse_swt_graphics_RGB
-}
-
-public void test_open() {
- warnUnimpl("Test test_open not written");
-}
-
-public void test_setRGBLorg_eclipse_swt_graphics_RGB() {
- RGB rgb = new RGB(0, 0, 0);
-
- assertTrue(":a:", colorDialog.getRGB() == null);
-
- colorDialog.setRGB(rgb);
- assertTrue(":b:", colorDialog.getRGB() == rgb);
-
- if (fCheckSwtNullExceptions) {
- try {
- colorDialog.setRGB(null);
- fail("No exception thrown for rgb == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
- assertTrue(":c:", colorDialog.getRGB() == rgb);
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ColorDialog((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getRGB");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setRGBLorg_eclipse_swt_graphics_RGB");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getRGB")) test_getRGB();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setRGBLorg_eclipse_swt_graphics_RGB")) test_setRGBLorg_eclipse_swt_graphics_RGB();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
deleted file mode 100644
index 5a0f6be0a0..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
+++ /dev/null
@@ -1,679 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Combo
- *
- * @see org.eclipse.swt.widgets.Combo
- */
-public class Test_org_eclipse_swt_widgets_Combo extends Test_org_eclipse_swt_widgets_Composite {
-
-Combo combo;
-
-public Test_org_eclipse_swt_widgets_Combo(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- combo = new Combo(shell, 0);
- setWidget(combo);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- combo = new Combo(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.DROP_DOWN, SWT.SIMPLE};
- for (int i = 0; i < cases.length; i++) {
- combo = new Combo(shell, cases[i]);
- assertTrue(":a:" + String.valueOf(i), combo.getStyle() == cases[i]);
- }
-}
-
-public void test_addLjava_lang_String() {
- try {
- combo.add(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.add("");
- assertEquals(":a:", new String[]{""}, combo.getItems());
- combo.add("");
- assertEquals(":b:", new String[]{"", ""}, combo.getItems());
- combo.add("fred");
- assertEquals(":c:", new String[]{"", "", "fred"}, combo.getItems());
-
-}
-
-public void test_addLjava_lang_StringI() {
- combo.add("fred", 0);
- assertEquals("fred", new String[]{"fred"}, combo.getItems());
- combo.add("fred", 0);
- assertEquals("fred fred", new String[]{"fred", "fred"}, combo.getItems());
- combo.add("fred");
- assertEquals("fred fred fred", new String[]{"fred", "fred", "fred"}, combo.getItems());
- combo.removeAll();
-
- int number = 3;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.add("fred", number);
- assertEquals("fred0 fred1 fred2 fred", new String[]{"fred0", "fred1", "fred2", "fred"}, combo.getItems());
-
- combo.removeAll();
- number = 3;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.add("fred", 1);
- assertEquals("fred0 fred fred1 fred2", new String[]{"fred0", "fred", "fred1", "fred2"}, combo.getItems());
- combo.add("fred", 0);
- assertEquals("fred fred0 fred fred1 fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred2"}, combo.getItems());
- combo.add("fred", 4);
- assertEquals("fred fred0 fred fred1 fred fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred", "fred2"}, combo.getItems());
-}
-
-public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_clearSelection() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.clearSelection();
- assertTrue(":a:", combo.getSelection().equals(new Point(0, 0)));
- combo.setSelection(new Point(0, 5));
- assertTrue(":b:", combo.getSelection().equals(new Point(0, 0))); //nothing is selected
- combo.setText("some text");
- combo.setSelection(new Point(0, 5));
- assertTrue(":c:", combo.getSelection().equals(new Point(0, 5)));
- combo.clearSelection();
- assertTrue(":d:", combo.getSelection().x==combo.getSelection().y);
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_deselectI() {
- combo.deselect(2);
-
- int number = 10;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++) {
- combo.select(i);
- assertTrue(":a:" + i, combo.getSelectionIndex()==i);
- combo.deselect(i);
- assertTrue(":b:" + i, combo.getSelectionIndex()==-1);
- }
-}
-
-public void test_deselectAll() {
- warnUnimpl("Test test_deselectAll not written");
-}
-
-public void test_getChildren() {
- // Combo cannot have children
-}
-
-public void test_getItemI() {
- try {
- combo.getItem(0);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 10;
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < number; i++)
- assertTrue(combo.getItem(i).equals("fred" + i));
-}
-
-public void test_getItemCount() {
- int number = 10;
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" + i, combo.getItemCount() == i);
- combo.add("fred" + i);
- }
- assertTrue(":aa:", combo.getItemCount() == number);
-
- for (int i = 0; i < number; i++) {
- assertTrue(":b:" + i, combo.getItemCount() == number-i);
- combo.remove(0);
- }
- combo.removeAll();
- assertTrue(":c:", combo.getItemCount() == 0);
-}
-
-public void test_getItemHeight() {
- combo.getItemHeight();
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionIndex() {
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- assertEquals(-1, combo.getSelectionIndex());
- for (int i = 0; i < number; i++) {
- combo.select(i);
- assertEquals(i, combo.getSelectionIndex());
- }
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- assertEquals(-1, combo.getSelectionIndex());
- for (int i = 0; i < number; i++) {
- combo.select(i);
- combo.deselect(i);
- assertEquals(-1, combo.getSelectionIndex());
- }
-}
-
-public void test_getText() {
- String[] cases = {"", "fred", "fredfred"};
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":a:" + String.valueOf(i), cases[i].equals(combo.getText()));
- }
-}
-
-public void test_getTextHeight() {
- combo.getTextHeight();
-}
-
-public void test_getTextLimit() {
- warnUnimpl("Test test_getTextLimit not written");
-}
-
-public void test_hasFocus() {
- warnUnimpl("Test test_hasFocus not written");
-}
-
-public void test_indexOfLjava_lang_String() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++)
- assertEquals(i, combo.indexOf("fred" + i));
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.removeAll();
- for (int i = 0; i < number; i++)
- assertEquals(-1, combo.indexOf("fred" + i));
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.remove("fred3");
- for (int i = 0; i < 3; i++)
- assertEquals(i, combo.indexOf("fred" + i));
- assertEquals(-1, combo.indexOf("fred3"));
- for (int i = 4; i < number; i++)
- assertEquals(i - 1, combo.indexOf("fred" + i));
-
- combo.removeAll();
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.remove(2);
- for (int i = 0; i < 2; i++)
- assertEquals(i, combo.indexOf("fred" + i));
- assertEquals(-1, combo.indexOf("fred2"));
- for (int i = 3; i < number; i++)
- assertEquals(i - 1, combo.indexOf("fred" + i));
-}
-
-public void test_indexOfLjava_lang_StringI() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++)
- assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i);
- for (int i = 0; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, i + 1) == -1);
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < 3; i++)
- assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i);
- for (int i = 3; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, 3) == i);
- for (int i = 0; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, i) == i);
-}
-
-public void test_removeI() {
- try {
- combo.remove(0);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.remove(3);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < number; i++) {
- assertEquals("Wrong number of items", number - i, combo.getItemCount());
- combo.remove(0);
- }
-
- for (int i = 0; i < number; i++) {
- combo.add("fred"); // all items the same
- }
- for (int i = 0; i < number; i++) {
- assertEquals("Wrong number of items", number - i, combo.getItemCount());
- combo.remove(0);
- }
-
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i); // different items
- }
- for (int i = 0; i < number; i++) {
- assertEquals("index " + i, number - i, combo.getItemCount());
- combo.select(0);
- assertEquals("index " + i, 0, combo.getSelectionIndex());
- combo.remove(0);
- if (SwtJunit.isWindows) {
- // The behavior on Windows when the selected item is removed
- // is to simply say that no items are selected.
- assertEquals("index " + i, -1, combo.getSelectionIndex());
- } else {
- // The behavior on other platforms when the selected item is removed
- // is to select the item that is now at the same index, and send a
- // selection event. If there is no item at the selected index, then
- // the platform says that no items are selected.
- if (i < number - 1) {
- assertEquals("index " + i, 0, combo.getSelectionIndex());
- } else {
- assertEquals("index " + i, -1, combo.getSelectionIndex());
- }
- }
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i); // different items
- for (int i = 0; i < number; i++) {
- assertEquals("index " + i, number - i, combo.getItemCount());
- combo.remove(number-i-1);
- }
-}
-
-public void test_removeII() {
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(0, 4);
- assertEquals(0, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(0, 2);
- assertEquals(2, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(2, 4);
- assertEquals(2, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(3, 2);
- assertEquals(number, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
-
- try {
- combo.remove(2, 100);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_removeLjava_lang_String() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++) {
- assertEquals(number - i, combo.getItemCount());
- combo.remove("fred" + i);
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred");
- for (int i = 0; i < number; i++) {
- assertEquals(number - i, combo.getItemCount());
- combo.remove("fred");
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred");
- try {
- combo.remove(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.removeAll();
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- try {
- combo.remove("fred");
- fail("No exception thrown for item not found");
- }
- catch (IllegalArgumentException e) {
- }
-
- assertEquals(number, combo.getItemCount());
-}
-
-public void test_removeAll() {
- warnUnimpl("Test test_removeAll not written");
-}
-
-public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_selectI() {
- warnUnimpl("Test test_selectI not written");
-}
-
-public void test_setBoundsIIII() {
- combo.setBounds(10, 20, 30, 40);
- // only check x, y, and width - you can't set the height of a combo
- assertTrue(combo.getBounds().x == 10);
- assertTrue(combo.getBounds().y == 20);
- assertTrue(combo.getBounds().width == 30);
-}
-
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- combo.setBounds(new Rectangle(10, 20, 30, 40));
- // only check x, y, and width - you can't set the height of a combo
- assertTrue(combo.getBounds().x == 10);
- assertTrue(combo.getBounds().y == 20);
- assertTrue(combo.getBounds().width == 30);
-}
-
-public void test_setItemILjava_lang_String() {
- try {
- combo.setItem(0, null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.setItem(3, null);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.setItem(0, "fred");
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
- combo.add("joe");
- combo.setItem(0, "fred");
- assertTrue("fred", combo.getItem(0).equals("fred"));
-
- try {
- combo.setItem(4, "fred");
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.removeAll();
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred");
- for (int i = 0; i < number; i++)
- combo.setItem(i, "fred" + i);
- assertEquals(":a:", new String[]{"fred0", "fred1", "fred2", "fred3", "fred4"}, combo.getItems());
-}
-
-public void test_setItems$Ljava_lang_String() {
- try {
- combo.setItems(null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- String[][] items = {{}, {""}, {"", ""}, {"fred"}, {"fred0", "fred0"}, {"fred", "fred"}};
-
- for (int i = 0 ; i< items.length; i++){
- combo.setItems(items[i]);
- assertEquals(":a:" + i, items[i], combo.getItems());}
-}
-
-public void test_setSelectionLorg_eclipse_swt_graphics_Point() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.setSelection(new Point(0, 5));
- assertTrue(":a:", combo.getSelection().equals(new Point(0, 0)));
- combo.setText("some text");
- combo.setSelection(new Point(0, 5));
- assertTrue(":b:", combo.getSelection().equals(new Point(0, 5)));
-}
-
-public void test_setSizeII() {
- combo.setSize(30, 40);
- // only check the width - you can't set the height of a combo
- assertTrue(combo.getSize().x == 30);
-
- combo.setSize(32, 43);
- // only check the width - you can't set the height of a combo
- assertTrue(combo.getSize().x == 32);
-}
-
-public void test_setSizeLorg_eclipse_swt_graphics_Point() {
- combo.setSize(new Point(30, 40));
- // only check the width - you can't set the height of a combo
- assertTrue(combo.getSize().x == 30);
-
- combo.setBounds(32, 43, 33, 44);
- // only check the width - you can't set the height of a combo
- assertTrue(combo.getSize().x == 33);
-
- combo.setBounds(32, 43, 30, 40);
- combo.setLocation(11, 22);
- combo.setSize(new Point(32, 43));
- // only check the width - you can't set the height of a combo
- assertTrue(combo.getSize().x == 32);
-}
-
-public void test_setTabGroupFocus() {
- warnUnimpl("Test test_setTabGroupFocus not written");
-}
-
-public void test_setTextLjava_lang_String() {
- String[] cases = {"", "fred", "fred0"};
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":a:" + i, combo.getText().equals(cases[i]));
- }
- for (int i = 0; i < 5; i++) {
- combo.add("fred");
- }
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":b:" + i, combo.getText().equals(cases[i]));
- }
- for (int i = 0; i < 5; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":c:" + i, combo.getText().equals(cases[i]));
- }
-}
-
-public void test_setTextLimitI() {
- warnUnimpl("Test test_setTextLimitI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Combo((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addLjava_lang_String");
- methodNames.addElement("test_addLjava_lang_StringI");
- methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_clearSelection");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_deselectI");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getTextHeight");
- methodNames.addElement("test_getTextLimit");
- methodNames.addElement("test_hasFocus");
- methodNames.addElement("test_indexOfLjava_lang_String");
- methodNames.addElement("test_indexOfLjava_lang_StringI");
- methodNames.addElement("test_removeI");
- methodNames.addElement("test_removeII");
- methodNames.addElement("test_removeLjava_lang_String");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_selectI");
- methodNames.addElement("test_setItemILjava_lang_String");
- methodNames.addElement("test_setItems$Ljava_lang_String");
- methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setTabGroupFocus");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setTextLimitI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String();
- else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI();
- else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_clearSelection")) test_clearSelection();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_deselectI")) test_deselectI();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getTextHeight")) test_getTextHeight();
- else if (getName().equals("test_getTextLimit")) test_getTextLimit();
- else if (getName().equals("test_hasFocus")) test_hasFocus();
- else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String();
- else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI();
- else if (getName().equals("test_removeI")) test_removeI();
- else if (getName().equals("test_removeII")) test_removeII();
- else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_selectI")) test_selectI();
- else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String();
- else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String();
- else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setTabGroupFocus")) test_setTabGroupFocus();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setTextLimitI")) test_setTextLimitI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
deleted file mode 100644
index 44b737a43a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Composite
- *
- * @see org.eclipse.swt.widgets.Composite
- */
-public class Test_org_eclipse_swt_widgets_Composite extends Test_org_eclipse_swt_widgets_Scrollable {
-
-Composite composite;
-
-public Test_org_eclipse_swt_widgets_Composite(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- composite = new Composite(shell, 0);
- super.setWidget(composite);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-protected void setWidget(Widget w) {
- if (composite != null)
- composite.dispose();
- composite = (Composite)w;
- super.setWidget(w);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- composite = new Composite(null, 0);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.H_SCROLL, SWT.V_SCROLL, SWT.H_SCROLL | SWT.V_SCROLL};
- for (int i = 0; i < cases.length; i++)
- composite = new Composite(shell, cases[i]);
-}
-
-public void test_getChildren() {
- assertEquals(":a:", new Control[]{}, composite.getChildren());
- Composite c1 = new Composite(composite, 0);
- assertEquals(":b:", new Control[]{c1}, composite.getChildren());
-
- List c2 = new List(composite, 0);
- assertEquals(":c:", new Control[]{c1, c2}, composite.getChildren());
-
- Scale c3 = new Scale(composite, 0);
- assertEquals(":c:", new Control[]{c1, c2, c3}, composite.getChildren());
-
- c2.dispose();
- assertEquals(":d:", new Control[]{c1, c3}, composite.getChildren());
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++)
- children[i].dispose();
-
- assertEquals(":e:", new Control[]{}, composite.getChildren());
-}
-
-public void test_getLayout() {
- // tested in test_setLayoutLorg_eclipse_swt_widgets_Layout
-}
-
-public void test_getTabList() {
- // tested in test_setTabList$Lorg_eclipse_swt_widgets_Control
-}
-
-public void test_layout() {
- // tested in test_layoutZ
-}
-
-public void test_layoutZ() {
- Layout[] layouts = {null, new FillLayout(), new RowLayout(), new GridLayout()};
- for (int i = 0; i < layouts.length; i++) {
- composite.setLayout(layouts[i]);
- composite.layout(false);
- composite.layout(true);
- composite.layout();
- }
-}
-
-public void test_setLayoutLorg_eclipse_swt_widgets_Layout() {
- Layout[] layouts = {null, new FillLayout(), new RowLayout(), new GridLayout()};
- for (int i = 0; i < layouts.length; i++) {
- composite.setLayout(layouts[i]);
- assertEquals(layouts[i], composite.getLayout());
- }
-}
-
-public void test_setTabList$Lorg_eclipse_swt_widgets_Control() {
- Button button1 = new Button(composite, SWT.PUSH);
- Button button2 = new Button(composite, SWT.PUSH);
- Control[] tablist = new Control[] {button1, button2};
- composite.setTabList(tablist);
- button1.dispose();
- button2.dispose();
-
- try {
- composite.setTabList(null);
- fail("No exception thrown for tabList == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Composite((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_getChildren");
- methodNames.addElement("test_getLayout");
- methodNames.addElement("test_getTabList");
- methodNames.addElement("test_layout");
- methodNames.addElement("test_layoutZ");
- methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout");
- methodNames.addElement("test_setTabList$Lorg_eclipse_swt_widgets_Control");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_getChildren")) test_getChildren();
- else if (getName().equals("test_getLayout")) test_getLayout();
- else if (getName().equals("test_getTabList")) test_getTabList();
- else if (getName().equals("test_layout")) test_layout();
- else if (getName().equals("test_layoutZ")) test_layoutZ();
- else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout();
- else if (getName().equals("test_setTabList$Lorg_eclipse_swt_widgets_Control")) test_setTabList$Lorg_eclipse_swt_widgets_Control();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
deleted file mode 100644
index 596bbd5667..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
+++ /dev/null
@@ -1,823 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Control
- *
- * @see org.eclipse.swt.widgets.Control
- */
-public class Test_org_eclipse_swt_widgets_Control extends Test_org_eclipse_swt_widgets_Widget {
-
- Control control;
- boolean eventOccurred;
-
-public Test_org_eclipse_swt_widgets_Control(String name) {
- super(name);
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-protected void setWidget(Widget w) {
- control = (Control)w;
- super.setWidget(w);
-}
-
-public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() {
- ControlListener listener = new ControlListener() {
- public void controlMoved(ControlEvent e) {
- eventOccurred = true;
- };
- public void controlResized(ControlEvent e) {
- eventOccurred = true;
- };
- };
- control.addControlListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.Move, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.Resize, new Event());
- assertTrue(eventOccurred);
- control.removeControlListener(listener);
-}
-
-public void test_addFocusListenerLorg_eclipse_swt_events_FocusListener() {
- FocusListener listener = new FocusListener() {
- public void focusGained(FocusEvent e) {
- eventOccurred = true;
- };
- public void focusLost(FocusEvent e) {
- eventOccurred = true;
- };
- };
- control.addFocusListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.FocusIn, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.FocusOut, new Event());
- assertTrue(eventOccurred);
- control.removeFocusListener(listener);
-}
-
-public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() {
- HelpListener listener = new HelpListener() {
- public void helpRequested(HelpEvent e) {
- eventOccurred = true;
- };
- };
- control.addHelpListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.Help, new Event());
- assertTrue(eventOccurred);
- control.removeHelpListener(listener);
-}
-
-public void test_addKeyListenerLorg_eclipse_swt_events_KeyListener() {
- KeyListener listener = new KeyListener() {
- public void keyPressed(KeyEvent e) {
- eventOccurred = true;
- };
- public void keyReleased(KeyEvent e) {
- eventOccurred = true;
- };
- };
- control.addKeyListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.KeyDown, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.KeyUp, new Event());
- assertTrue(eventOccurred);
- control.removeKeyListener(listener);
-}
-
-public void test_addMouseListenerLorg_eclipse_swt_events_MouseListener() {
- MouseListener listener = new MouseListener() {
- public void mouseDown(MouseEvent e) {
- eventOccurred = true;
- };
- public void mouseUp(MouseEvent e) {
- eventOccurred = true;
- };
- public void mouseDoubleClick(MouseEvent e) {
- eventOccurred = true;
- };
- };
- control.addMouseListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseDown, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseUp, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseDoubleClick, new Event());
- assertTrue(eventOccurred);
- control.removeMouseListener(listener);
-}
-
-public void test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() {
- MouseTrackListener listener = new MouseTrackListener() {
- public void mouseEnter(MouseEvent e) {
- eventOccurred = true;
- };
- public void mouseExit(MouseEvent e) {
- eventOccurred = true;
- };
- public void mouseHover(MouseEvent e) {
- eventOccurred = true;
- };
- };
- control.addMouseTrackListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseEnter, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseExit, new Event());
- assertTrue(eventOccurred);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseHover, new Event());
- assertTrue(eventOccurred);
- control.removeMouseTrackListener(listener);
-}
-
-public void test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() {
- MouseMoveListener listener = new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- eventOccurred = true;
- };
- };
- control.addMouseMoveListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.MouseMove, new Event());
- assertTrue(eventOccurred);
- control.removeMouseMoveListener(listener);
-}
-
-public void test_addPaintListenerLorg_eclipse_swt_events_PaintListener() {
- PaintListener listener = new PaintListener() {
- public void paintControl(PaintEvent e) {
- eventOccurred = true;
- };
- };
- control.addPaintListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.Paint, new Event());
- assertTrue(eventOccurred);
- control.removePaintListener(listener);
-}
-
-public void test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener() {
- TraverseListener listener = new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- eventOccurred = true;
- };
- };
- control.addTraverseListener(listener);
- eventOccurred = false;
- control.notifyListeners(SWT.Traverse, new Event());
- assertTrue(eventOccurred);
- control.removeTraverseListener(listener);
-}
-
-public void test_computeSizeII() {
- control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point size = control.getSize();
- control.computeSize(size.x, size.y);
- assertEquals(size.x, control.getSize().x);
- assertEquals(size.y, control.getSize().y);
-}
-
-public void test_computeSizeIIZ() {
- control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- Point size = control.getSize();
- control.computeSize(size.x, size.y, false);
- assertEquals(size.x, control.getSize().x);
- assertEquals(size.y, control.getSize().y);
-}
-
-public void test_forceFocus() {
- // this is difficult to test in Control.
- // subclasses that wish to test this should override.
-}
-
-public void test_getBackground() {
- // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color
-}
-
-public void test_getBorderWidth() {
- control.getBorderWidth();
-}
-
-public void test_getBounds() {
- // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle
-}
-
-public void test_getDisplay() {
- assertEquals(control.getDisplay(), control.getShell().getDisplay());
-}
-
-public void test_getEnabled() {
- // tested in test_setEnabledZ
-}
-
-public void test_getFont() {
- // tested in test_setFontLorg_eclipse_swt_graphics_Font
-}
-
-public void test_getForeground() {
- // tested in test_setForegroundLorg_eclipse_swt_graphics_Color
-}
-
-public void test_getLayoutData() {
- // tested in test_setLayoutDataLjava_lang_Object
-}
-
-public void test_getLocation() {
- control.setBounds(32, 43, 30, 40);
- assertTrue(control.getLocation().equals(new Point(32, 43)));
-}
-
-public void test_getMenu() {
- // tested in test_setMenuLorg_eclipse_swt_widgets_Menu
-}
-
-public void test_getParent() {
- assertEquals(shell, control.getParent());
-}
-
-public void test_getShell() {
- assertEquals(shell, control.getShell());
-}
-
-public void test_getSize() {
- // tested in test_setSizeII
-}
-
-public void test_getToolTipText() {
- // tested in test_setToolTipTextLjava_lang_String
-}
-
-public void test_getVisible() {
- // tested in test_setVisibleZ
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- GCData data = new GCData();
- int hDC = control.internal_new_GC(data);
- control.internal_dispose_GC(hDC, data);
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- // tested in test_internal_new_GCLorg_eclipse_swt_graphics_GCData
-}
-
-public void test_isDisposed() {
- assertTrue(!control.isDisposed());
-}
-
-public void test_isEnabled() {
- control.setEnabled(true);
- assertTrue(control.isEnabled());
-
- control.setEnabled(false);
- assertTrue(!control.isEnabled());
-}
-
-public void test_isFocusControl() {
- assertTrue(!control.isFocusControl());
-}
-
-public void test_isReparentable() {
- if (SwtJunit.isWindows) {
- assertTrue(control.isReparentable());
- } else {
- assertTrue(!control.isReparentable());
- }
-}
-
-public void test_isVisible() {
- control.setVisible(true);
- assertTrue(!control.isVisible()); //because the shell is not visible
-
- control.setVisible(false);
- assertTrue(!control.isVisible());
-
- if (!SwtJunit.isAIX) {
- control.setVisible(true);
- shell.setVisible(true);
- assertTrue("Window should be visible", control.isVisible());
- shell.setVisible(false);
- assertTrue("Window should not be visible", !control.isVisible());
- }
-}
-
-public void test_moveAboveLorg_eclipse_swt_widgets_Control() {
- control.moveAbove(null);
-
- control.moveAbove(control);
-
- Button b = new Button(shell, 0);
- control.moveAbove(b);
- b.dispose();
-}
-
-public void test_moveBelowLorg_eclipse_swt_widgets_Control() {
- control.moveBelow(null);
-
- control.moveBelow(control);
-
- Button b = new Button(shell, 0);
- control.moveBelow(b);
- b.dispose();
-}
-
-public void test_pack() {
- control.pack();
-}
-
-public void test_packZ() {
- control.pack(true);
- control.pack(false);
-}
-
-public void test_redraw() {
- control.redraw();
-}
-
-public void test_redrawIIIIZ() {
- control.redraw(0, 0, 0, 0, false);
-
- control.redraw(0, 0, 0, 0, true);
-
- control.redraw(-10, -10, -10, -10, true);
-
- control.redraw(10, 10, 10, 10, true);
-
- control.redraw(10, 10, 10, 10, false);
-
- control.redraw(10000, 10000, 10000, 10000, false);
-}
-
-public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() {
- // tested in test_addControlListenerLorg_eclipse_swt_events_ControlListener
-}
-
-public void test_removeFocusListenerLorg_eclipse_swt_events_FocusListener() {
- // tested in test_addFocusListenerLorg_eclipse_swt_events_FocusListener
-}
-
-public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() {
- // tested in test_addHelpListenerLorg_eclipse_swt_events_HelpListener
-}
-
-public void test_removeKeyListenerLorg_eclipse_swt_events_KeyListener() {
- // tested in test_addKeyListenerLorg_eclipse_swt_events_KeyListener
-}
-
-public void test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() {
- // tested in test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener
-}
-
-public void test_removeMouseListenerLorg_eclipse_swt_events_MouseListener() {
- // tested in test_addMouseListenerLorg_eclipse_swt_events_MouseListener
-}
-
-public void test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() {
- // tested in test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener
-}
-
-public void test_removePaintListenerLorg_eclipse_swt_events_PaintListener() {
- // tested in test_addPaintListenerLorg_eclipse_swt_events_PaintListener
-}
-
-public void test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener() {
- // tested in test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener
-}
-
-public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
- control.setBackground(color);
- assertEquals(color, control.getBackground());
- control.setBackground(null);
- assertTrue(!control.getBackground().equals(color));
- color.dispose();
-}
-
-public void test_setBoundsIIII() {
- control.setBounds(10, 20, 30, 40);
- assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds());
-
- control.setBounds(20, 30, 40, 50);
- assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40)));
-
- control.setBounds(10, 20, 30, 40);
-}
-
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- control.setBounds(new Rectangle(10, 20, 30, 40));
- assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds());
-
- control.setBounds(new Rectangle(20, 30, 40, 50));
- assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40)));
-
- try {
- control.setBounds(null);
- fail("No exception thrown for rectangle == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- control.setBounds(new Rectangle(10, 20, 30, 40));
-}
-
-public void test_setCaptureZ() {
- control.setCapture(true);
-
- control.setCapture(false);
-}
-
-public void test_setCursorLorg_eclipse_swt_graphics_Cursor() {
- control.setCursor(null);
-
- Cursor c = new Cursor(control.getDisplay(), 0);
- control.setCursor(c);
- c.dispose();
-}
-
-public void test_setEnabledZ() {
- control.setEnabled(true);
- assertTrue(control.getEnabled());
-
- control.setEnabled(false);
- assertTrue(!control.getEnabled());
-}
-
-public void test_setFocus() {
- control.setFocus();
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- Font font = control.getFont();
- control.setFont(font);
- assertEquals(font, control.getFont());
-
- font = new Font(control.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL);
- control.setFont(font);
- assertEquals(font, control.getFont());
-
- control.setFont(null);
- font.dispose();
- try {
- control.setFont(font);
- control.setFont(null);
- fail("No exception thrown for disposed font");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
- control.setForeground(color);
- assertEquals(color, control.getForeground());
- control.setForeground(null);
- assertTrue(!control.getForeground().equals(color));
- color.dispose();
-}
-
-public void test_setLayoutDataLjava_lang_Object() {
- control.setLayoutData(this);
- assertEquals(this, control.getLayoutData());
-
- control.setLayoutData("asldsahdahcaslcshdac");
- assertEquals("asldsahdahcaslcshdac", control.getLayoutData());
-
- control.setLayoutData(this.getClass());
- assertEquals(this.getClass(), control.getLayoutData());
-
- control.setLayoutData(null);
- assertNull(control.getLayoutData());
-}
-
-public void test_setLocationII() {
- control.setBounds(32, 43, 30, 40);
- control.setLocation(11, 22);
- control.setSize(32, 43);
- assertEquals(control.getLocation(), new Point(11, 22));
-
- control.setLocation(10, 10);
- assertEquals(control.getLocation(), new Point(10, 10));
-}
-
-public void test_setLocationLorg_eclipse_swt_graphics_Point() {
- try {
- control.setLocation(null);
- fail("No exception thrown for location == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- Point loc = new Point(30, 40);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(10, 10);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(10000, 10000);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(-10, -10);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-}
-
-public void test_setMenuLorg_eclipse_swt_widgets_Menu () {
- /* this is a valid thing to do, you can reset a menu to nothing */
- control.setMenu(null);
-
- Menu m = new Menu(control);
- control.setMenu(m);
- assertEquals(m, control.getMenu());
-}
-
-public void test_setRedrawZ() {
- control.setRedraw(false);
-
- control.setRedraw(true);
-}
-
-public void test_setSizeII() {
- control.setBounds(32, 43, 30, 40);
- assertEquals(new Point(30, 40), control.getSize());
-
- control.setBounds(32, 43, 30, 40);
- control.setLocation(11, 22);
- control.setSize(32, 43);
- assertEquals(new Point(32, 43), control.getSize());
-
- control.setSize(0, 0);
-
- control.setSize(10, 10);
-
- control.setSize(10000, 10000);
-
- control.setSize(-10, -10);
-}
-
-public void test_setSizeLorg_eclipse_swt_graphics_Point() {
- control.setSize(new Point(30, 40));
- assertEquals(new Point(30, 40), control.getSize());
-
- try {
- control.setSize(null);
- fail("No exception thrown for size == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- control.setSize(new Point(0, 0));
-
- control.setSize(new Point(10, 10));
-
- control.setSize(new Point(10000, 10000));
-
- control.setSize(new Point(-10, -10));
-}
-
-public void test_setToolTipTextLjava_lang_String() {
- control.setToolTipText("This is a tip");
- assertEquals("This is a tip", control.getToolTipText());
-
- control.setToolTipText(null);
- assertNull(control.getToolTipText());
-}
-
-public void test_setVisibleZ() {
- control.setVisible(true);
- assertTrue(control.getVisible());
-
- control.setVisible(false);
- assertTrue(!control.getVisible());
-}
-
-public void test_toControlLorg_eclipse_swt_graphics_Point() {
- Point controlCoords = control.toControl(new Point(0, 0));
- assertEquals(new Point(0, 0), control.toDisplay(controlCoords));
- try {
- control.toControl(null);
- fail("No exception thrown for size == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_toDisplayLorg_eclipse_swt_graphics_Point() {
- Point displayCoords = control.toDisplay(new Point(0, 0));
- assertEquals(new Point(0, 0), control.toControl(displayCoords));
- try {
- control.toDisplay(null);
- fail("No exception thrown for size == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_traverseI() {
- control.traverse(SWT.TRAVERSE_ESCAPE);
- control.traverse(SWT.TRAVERSE_RETURN);
- control.traverse(SWT.TRAVERSE_TAB_NEXT);
- control.traverse(SWT.TRAVERSE_TAB_PREVIOUS);
- control.traverse(SWT.TRAVERSE_ARROW_NEXT);
- control.traverse(SWT.TRAVERSE_ARROW_PREVIOUS);
-}
-
-public void test_update() {
- control.update();
-}
-
-public void test_setParentLorg_eclipse_swt_widgets_Composite() {
- if (control.isReparentable()) {
- Shell originalParent = new Shell();
- Shell newParent = new Shell();
- Button b = new Button(originalParent, SWT.PUSH);
- b.setParent(newParent);
- originalParent.dispose();
- assertTrue(!b.isDisposed());
- newParent.dispose();
- }
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_addFocusListenerLorg_eclipse_swt_events_FocusListener");
- methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_addKeyListenerLorg_eclipse_swt_events_KeyListener");
- methodNames.addElement("test_addMouseListenerLorg_eclipse_swt_events_MouseListener");
- methodNames.addElement("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener");
- methodNames.addElement("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener");
- methodNames.addElement("test_addPaintListenerLorg_eclipse_swt_events_PaintListener");
- methodNames.addElement("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener");
- methodNames.addElement("test_computeSizeII");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_forceFocus");
- methodNames.addElement("test_getBackground");
- methodNames.addElement("test_getBorderWidth");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getFont");
- methodNames.addElement("test_getForeground");
- methodNames.addElement("test_getLayoutData");
- methodNames.addElement("test_getLocation");
- methodNames.addElement("test_getMenu");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getShell");
- methodNames.addElement("test_getSize");
- methodNames.addElement("test_getToolTipText");
- methodNames.addElement("test_getVisible");
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_isFocusControl");
- methodNames.addElement("test_isReparentable");
- methodNames.addElement("test_isVisible");
- methodNames.addElement("test_moveAboveLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_moveBelowLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_pack");
- methodNames.addElement("test_packZ");
- methodNames.addElement("test_redraw");
- methodNames.addElement("test_redrawIIIIZ");
- methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener");
- methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener");
- methodNames.addElement("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener");
- methodNames.addElement("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener");
- methodNames.addElement("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener");
- methodNames.addElement("test_removePaintListenerLorg_eclipse_swt_events_PaintListener");
- methodNames.addElement("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener");
- methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setBoundsIIII");
- methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_setCaptureZ");
- methodNames.addElement("test_setCursorLorg_eclipse_swt_graphics_Cursor");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setFocus");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color");
- methodNames.addElement("test_setLayoutDataLjava_lang_Object");
- methodNames.addElement("test_setLocationII");
- methodNames.addElement("test_setLocationLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu");
- methodNames.addElement("test_setRedrawZ");
- methodNames.addElement("test_setSizeII");
- methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addElement("test_toControlLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_toDisplayLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_traverseI");
- methodNames.addElement("test_update");
- methodNames.addElement("test_setParentLorg_eclipse_swt_widgets_Composite");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_addFocusListenerLorg_eclipse_swt_events_FocusListener")) test_addFocusListenerLorg_eclipse_swt_events_FocusListener();
- else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_addKeyListenerLorg_eclipse_swt_events_KeyListener")) test_addKeyListenerLorg_eclipse_swt_events_KeyListener();
- else if (getName().equals("test_addMouseListenerLorg_eclipse_swt_events_MouseListener")) test_addMouseListenerLorg_eclipse_swt_events_MouseListener();
- else if (getName().equals("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener();
- else if (getName().equals("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener();
- else if (getName().equals("test_addPaintListenerLorg_eclipse_swt_events_PaintListener")) test_addPaintListenerLorg_eclipse_swt_events_PaintListener();
- else if (getName().equals("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener();
- else if (getName().equals("test_computeSizeII")) test_computeSizeII();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_forceFocus")) test_forceFocus();
- else if (getName().equals("test_getBackground")) test_getBackground();
- else if (getName().equals("test_getBorderWidth")) test_getBorderWidth();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getFont")) test_getFont();
- else if (getName().equals("test_getForeground")) test_getForeground();
- else if (getName().equals("test_getLayoutData")) test_getLayoutData();
- else if (getName().equals("test_getLocation")) test_getLocation();
- else if (getName().equals("test_getMenu")) test_getMenu();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getShell")) test_getShell();
- else if (getName().equals("test_getSize")) test_getSize();
- else if (getName().equals("test_getToolTipText")) test_getToolTipText();
- else if (getName().equals("test_getVisible")) test_getVisible();
- else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_isFocusControl")) test_isFocusControl();
- else if (getName().equals("test_isReparentable")) test_isReparentable();
- else if (getName().equals("test_isVisible")) test_isVisible();
- else if (getName().equals("test_moveAboveLorg_eclipse_swt_widgets_Control")) test_moveAboveLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_moveBelowLorg_eclipse_swt_widgets_Control")) test_moveBelowLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_pack")) test_pack();
- else if (getName().equals("test_packZ")) test_packZ();
- else if (getName().equals("test_redraw")) test_redraw();
- else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ();
- else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener")) test_removeFocusListenerLorg_eclipse_swt_events_FocusListener();
- else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener")) test_removeKeyListenerLorg_eclipse_swt_events_KeyListener();
- else if (getName().equals("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener();
- else if (getName().equals("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener")) test_removeMouseListenerLorg_eclipse_swt_events_MouseListener();
- else if (getName().equals("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener();
- else if (getName().equals("test_removePaintListenerLorg_eclipse_swt_events_PaintListener")) test_removePaintListenerLorg_eclipse_swt_events_PaintListener();
- else if (getName().equals("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener();
- else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII();
- else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_setCaptureZ")) test_setCaptureZ();
- else if (getName().equals("test_setCursorLorg_eclipse_swt_graphics_Cursor")) test_setCursorLorg_eclipse_swt_graphics_Cursor();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color();
- else if (getName().equals("test_setLayoutDataLjava_lang_Object")) test_setLayoutDataLjava_lang_Object();
- else if (getName().equals("test_setLocationII")) test_setLocationII();
- else if (getName().equals("test_setLocationLorg_eclipse_swt_graphics_Point")) test_setLocationLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu();
- else if (getName().equals("test_setRedrawZ")) test_setRedrawZ();
- else if (getName().equals("test_setSizeII")) test_setSizeII();
- else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else if (getName().equals("test_toControlLorg_eclipse_swt_graphics_Point")) test_toControlLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_toDisplayLorg_eclipse_swt_graphics_Point")) test_toDisplayLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_traverseI")) test_traverseI();
- else if (getName().equals("test_update")) test_update();
- else if (getName().equals("test_setParentLorg_eclipse_swt_widgets_Composite")) test_setParentLorg_eclipse_swt_widgets_Composite();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java
deleted file mode 100644
index a04fde5f85..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.CoolBar
- *
- * @see org.eclipse.swt.widgets.CoolBar
- */
-public class Test_org_eclipse_swt_widgets_CoolBar extends Test_org_eclipse_swt_widgets_Composite {
-
-public Test_org_eclipse_swt_widgets_CoolBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- CoolBar coolBar = new CoolBar(shell, 0);
- setWidget(coolBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeIIZ(){
- warnUnimpl( "Test test_computeSizeIIZ not written");
-}
-
-public void test_getItemI() {
- warnUnimpl("Test test_getItemI not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItems() {
- warnUnimpl("Test test_getItems not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_widgets_CoolItem() {
- warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_CoolItem not written");
-}
-
-public void test_getItemOrder() {
- warnUnimpl("Test test_getItemOrder not written");
-}
-
-public void test_getItemSizes() {
- warnUnimpl("Test test_getItemSizes not written");
-}
-
-public void test_getWrapIndices() {
- warnUnimpl("Test test_getWrapIndices not written");
-}
-
-public void test_setWrapIndices$I() {
- warnUnimpl("Test test_setWrapIndices$I not written");
-}
-
-public void test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_CoolBar((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_CoolItem");
- methodNames.addElement("test_getItemOrder");
- methodNames.addElement("test_getItemSizes");
- methodNames.addElement("test_getWrapIndices");
- methodNames.addElement("test_setWrapIndices$I");
- methodNames.addElement("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_CoolItem")) test_indexOfLorg_eclipse_swt_widgets_CoolItem();
- else if (getName().equals("test_getItemOrder")) test_getItemOrder();
- else if (getName().equals("test_getItemSizes")) test_getItemSizes();
- else if (getName().equals("test_getWrapIndices")) test_getWrapIndices();
- else if (getName().equals("test_setWrapIndices$I")) test_setWrapIndices$I();
- else if (getName().equals("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point")) test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java
deleted file mode 100644
index 965b56f3aa..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java
+++ /dev/null
@@ -1,334 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.CoolItem
- *
- * @see org.eclipse.swt.widgets.CoolItem
- */
-public class Test_org_eclipse_swt_widgets_CoolItem extends Test_org_eclipse_swt_widgets_Item {
-
-static final boolean MINIMAL_CONFORMANCE = false;
-
-public Test_org_eclipse_swt_widgets_CoolItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- setWidget(coolItem);
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarI() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
-
- try {
- coolItem = new CoolItem(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarII() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0, 0);
- try {
- coolItem = new CoolItem(coolBar, 0, -1);
- fail("No exception thrown for index == -1");
- }
- catch (IllegalArgumentException e){
- }
- try {
- coolItem = new CoolItem(coolBar, 0, 2);
- fail("No exception thrown for index == 2");
- }
- catch (IllegalArgumentException e){
- }
- assertEquals(1, coolBar.getItemCount());
- coolItem = new CoolItem(coolBar, 0, 1);
- assertEquals(2, coolBar.getItemCount());
- coolItem = new CoolItem(coolBar, 0, 0);
- assertEquals(3, coolBar.getItemCount());
- assertEquals(coolItem, coolBar.getItem(0));
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeII() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foo");
-
- Point size = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point size2 = coolItem.computeSize(0, 0);
- assertEquals(size, size2);
-
- coolItem.setControl(button);
- size2 = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- assertTrue(size2.x > size.x);
-
- size = coolItem.computeSize(50, 25);
- size2 = coolItem.computeSize(100, 25);
- assertEquals(size.x + 50, size2.x);
- assertEquals(size.y, size2.y);
-
- size = coolItem.computeSize(1,1);
- size2 = coolItem.computeSize(26, 26);
- assertEquals(25, size2.x - size.x);
-}
-
-public void test_getBounds() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foo");
- coolItem.setControl(button);
-
- Rectangle rect = coolItem.getBounds();
- Point size = coolItem.getSize();
- assertEquals(size.x, rect.width);
- assertEquals(size.y, rect.height);
-
- coolItem.setSize(25, 25);
- rect = coolItem.getBounds();
- coolItem.setSize(100, 25);
- Rectangle newRect = coolItem.getBounds();
- assertEquals(rect.width + 75, newRect.width);
- assertEquals(rect.x, newRect.x);
- assertEquals(rect.y, newRect.y);
-}
-
-public void test_getControl() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- assertNull(coolItem.getControl());
-
- Button button = new Button(coolBar, SWT.PUSH);
- coolItem.setControl(button);
- Control control = coolItem.getControl();
- assertEquals(button, control);
-
- button = new Button(coolBar, SWT.PUSH);
- coolItem.setControl(button);
- control = coolItem.getControl();
- assertEquals(button, control);
-}
-
-public void test_getDisplay() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- assertEquals(coolBar.getDisplay(), coolItem.getDisplay());
-
- coolBar.dispose();
- try {
- coolItem.getDisplay();
- fail("No exception thrown for getDisplay() when parent is disposed");
- }
- catch (SWTException e) {
- }
-}
-
-public void test_getParent() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- assertEquals(coolBar, coolItem.getParent());
-}
-
-public void test_setControlLorg_eclipse_swt_widgets_Control() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- coolItem.setControl(null);
-
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foobar");
-
- Point size = coolItem.getSize();
- coolItem.setControl(button);
- Point size2 = coolItem.getSize();
- assertTrue(size2.x > size.x);
-
- if (!MINIMAL_CONFORMANCE) {
- size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- size2 = coolItem.computeSize(size.x, size.y);
- assertEquals(size2, coolItem.getSize());
- }
-
- button = new Button(coolBar, SWT.PUSH);
- button.dispose();
- try {
- coolItem.setControl(button);
- fail("No exception when control.isDisposed()");
- }
- catch (IllegalArgumentException e) {
- }
-
- button = new Button(shell, SWT.PUSH);
- try {
- coolItem.setControl(button);
- fail("No exception thrown when control has wrong parent");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getPreferredSize() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foobar");
- coolItem.setControl(button);
-
- Point pref = coolItem.getPreferredSize();
- coolItem.setPreferredSize(pref);
- assertEquals(pref, coolItem.getPreferredSize());
-}
-
-public void test_setPreferredSizeII() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foobar");
- coolItem.setControl(button);
-
- Point size = coolItem.getSize();
- coolItem.setPreferredSize(size);
- assertEquals(size.x, coolItem.getSize().x);
- coolItem.setSize(coolItem.getPreferredSize());
- assertEquals(size, coolItem.getSize());
-}
-
-public void test_setPreferredSizeLorg_eclipse_swt_graphics_Point() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foobar");
- coolItem.setControl(button);
-
- Point size = new Point(50, 30);
- coolItem.setPreferredSize(size);
- Point size2 = coolItem.getPreferredSize();
- coolItem.setPreferredSize(50, 30);
- assertEquals(size2, coolItem.getPreferredSize());
-}
-
-public void test_getSize() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foo");
- coolItem.setControl(button);
-
- Point size = coolItem.getSize();
- Rectangle rect = coolItem.getBounds();
- assertEquals(rect.width, size.x);
- assertEquals(rect.height, size.y);
-}
-
-public void test_setSizeII() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foo");
- coolItem.setControl(button);
-
- coolItem.setSize(50, 50);
- assertEquals(new Point(50, 50), coolItem.getSize());
-
- coolItem.setSize(0, 0);
- Point smallest = coolItem.getSize();
- coolItem.setSize(1, 1);
- assertEquals(smallest, coolItem.getSize());
-
- Rectangle rect = coolItem.getBounds();
- Point size = coolItem.getSize();
- coolItem.setSize(rect.width, rect.height);
- assertEquals(size, coolItem.getSize());
-}
-
-public void test_setSizeLorg_eclipse_swt_graphics_Point() {
- CoolBar coolBar = new CoolBar(shell, 0);
- CoolItem coolItem = new CoolItem(coolBar, 0);
- Button button = new Button(coolBar, SWT.PUSH);
- button.setText("foo");
- coolItem.setControl(button);
-
- Point size = new Point(50, 50);
- coolItem.setSize(size);
- Point size2 = coolItem.getSize();
- coolItem.setSize(50, 50);
- assertEquals(size2, coolItem.getSize());
-}
-
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_CoolItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeII");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_getPreferredSize");
- methodNames.addElement("test_setPreferredSizeII");
- methodNames.addElement("test_setPreferredSizeLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getSize");
- methodNames.addElement("test_setSizeII");
- methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarII();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeII")) test_computeSizeII();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_getPreferredSize")) test_getPreferredSize();
- else if (getName().equals("test_setPreferredSizeII")) test_setPreferredSizeII();
- else if (getName().equals("test_setPreferredSizeLorg_eclipse_swt_graphics_Point")) test_setPreferredSizeLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getSize")) test_getSize();
- else if (getName().equals("test_setSizeII")) test_setSizeII();
- else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
deleted file mode 100644
index c5ce7af266..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Decorations
- *
- * @see org.eclipse.swt.widgets.Decorations
- */
-public class Test_org_eclipse_swt_widgets_Decorations extends Test_org_eclipse_swt_widgets_Canvas {
-
-Decorations decorations;
-Image[] images = new Image [3];
-
-public Test_org_eclipse_swt_widgets_Decorations(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- decorations = new Decorations(shell, SWT.NULL);
- super.setWidget(decorations);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-protected void setWidget(Widget w) {
- if (!decorations.isDisposed())
- decorations.dispose();
- decorations = (Decorations)w;
- super.setWidget(w);
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void loadImages() {
- images [0] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("folder.bmp"));
- images [1] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("folderOpen.bmp"));
- images [2] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("target.bmp"));
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void freeImages() {
- for (int i=0; i<images.length; i++) images[i].dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getDefaultButton() {
- warnUnimpl("Test test_getDefaultButton not written");
-}
-
-public void test_getImage() {
- warnUnimpl("Test test_getImage not written");
-}
-
-public void test_getLocation() {
- warnUnimpl("Test test_getLocation not written");
-}
-
-public void test_getMaximized() {
- warnUnimpl("Test test_getMaximized not written");
-}
-
-public void test_getMenuBar() {
- warnUnimpl("Test test_getMenuBar not written");
-}
-
-public void test_getMinimized() {
- warnUnimpl("Test test_getMinimized not written");
-}
-
-public void test_getSize() {
- warnUnimpl("Test test_getSize not written");
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_setDefaultButtonLorg_eclipse_swt_widgets_Button() {
- assertNull(decorations.getDefaultButton());
- Button button = new Button(decorations, SWT.NULL);
- decorations.setDefaultButton(button);
- assertTrue("button not default", decorations.getDefaultButton() == button);
- if (fCheckBogusTestCases) {
- decorations.setDefaultButton(null);
- assertNull(decorations.getDefaultButton());
- }
-}
-
-public void test_setFocus() {
- decorations.setFocus();
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- assertNull(":a:", decorations.getImage());
- loadImages();
- decorations.setImage(images[0]);
- assertTrue(":b:", images[0] == decorations.getImage());
- assertTrue(":c:", images[1] != decorations.getImage());
- decorations.setImage(null);
- assertNull(":d:", decorations.getImage());
- freeImages();
-}
-
-public void test_setMaximizedZ() {
- decorations.setMaximized(false);
- assertTrue(":1:", decorations.getMaximized() == false);
- decorations.setMaximized(true);
- assertTrue(":2:", decorations.getMaximized() == true);
- assertTrue(":3:", decorations.getMinimized() == false);
-}
-
-public void test_setMenuBarLorg_eclipse_swt_widgets_Menu() {
- assertNull(decorations.getMenu());
- Menu testMenu = new Menu(decorations);
- decorations.setMenu(testMenu);
- assertTrue("Incorrect menu", decorations.getMenu() == testMenu);
- decorations.setMenu(null);
- assertNull(decorations.getMenu());
-}
-
-public void test_setMinimizedZ() {
- decorations.setMinimized(false);
- assertTrue(":1:", decorations.getMinimized() == false);
- decorations.setMinimized(true);
- assertTrue(":2:", decorations.getMinimized() == true);
- assertTrue(":3:", decorations.getMaximized() == false);
-}
-
-public void test_setTextLjava_lang_String() {
- try {
- decorations.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- String testStr = "test string";
- decorations.setText(testStr);
- assertTrue("a", decorations.getText().equals(testStr));
- decorations.setText("");
- assertTrue("b", decorations.getText().equals(""));
- try {
- decorations.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setVisibleZ() {
- decorations.setVisible(false);
- assertTrue(!decorations.getVisible());
-
- decorations.setVisible(true);
- assertTrue(decorations.getVisible());
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Decorations((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getDefaultButton");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getLocation");
- methodNames.addElement("test_getMaximized");
- methodNames.addElement("test_getMenuBar");
- methodNames.addElement("test_getMinimized");
- methodNames.addElement("test_getSize");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_setDefaultButtonLorg_eclipse_swt_widgets_Button");
- methodNames.addElement("test_setFocus");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setMaximizedZ");
- methodNames.addElement("test_setMenuBarLorg_eclipse_swt_widgets_Menu");
- methodNames.addElement("test_setMinimizedZ");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getDefaultButton")) test_getDefaultButton();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getLocation")) test_getLocation();
- else if (getName().equals("test_getMaximized")) test_getMaximized();
- else if (getName().equals("test_getMenuBar")) test_getMenuBar();
- else if (getName().equals("test_getMinimized")) test_getMinimized();
- else if (getName().equals("test_getSize")) test_getSize();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_setDefaultButtonLorg_eclipse_swt_widgets_Button")) test_setDefaultButtonLorg_eclipse_swt_widgets_Button();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setMaximizedZ")) test_setMaximizedZ();
- else if (getName().equals("test_setMenuBarLorg_eclipse_swt_widgets_Menu")) test_setMenuBarLorg_eclipse_swt_widgets_Menu();
- else if (getName().equals("test_setMinimizedZ")) test_setMinimizedZ();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java
deleted file mode 100644
index f33855a534..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Dialog
- *
- * @see org.eclipse.swt.widgets.Dialog
- */
-public class Test_org_eclipse_swt_widgets_Dialog extends SwtTestCase {
-
-public Shell shell;
-private Dialog dialog;
-private int junitStyle;
-
-public Test_org_eclipse_swt_widgets_Dialog(String name) {
- super(name);
-}
-
-
-protected void setUp() {
- shell = new Shell();
-}
-
-protected void tearDown() {
- shell.dispose();
-}
-
-protected void setDialog(Dialog newDialog) {
- dialog = newDialog;
-}
-protected void setStyle(int style) {
- style = junitStyle;
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getParent() {
- assertTrue(":a:", dialog.getParent() == shell);
-}
-
-public void test_getStyle () {
- // we use this call in a Constructor test so that we can
- // check if the style is the one that was created
- dialog.getStyle();
-}
-
-public void test_getText() {
- warnUnimpl("Test test_getText not written");
-}
-
-public void test_setTextLjava_lang_String() {
- assertTrue(":1:", dialog.getText() == "");
- String testStr = "test string";
- dialog.setText(testStr);
- assertTrue(":2:", dialog.getText().equals(testStr));
- dialog.setText("");
- assertTrue(":3:", dialog.getText().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dialog.setText(null);
- fail("No exception thrown for string = null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getStyle");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_setTextLjava_lang_String");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getStyle")) test_getStyle();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java
deleted file mode 100644
index c7c4576eff..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.DirectoryDialog
- *
- * @see org.eclipse.swt.widgets.DirectoryDialog
- */
-public class Test_org_eclipse_swt_widgets_DirectoryDialog extends Test_org_eclipse_swt_widgets_Dialog {
-
-DirectoryDialog dirDialog;
-
-public Test_org_eclipse_swt_widgets_DirectoryDialog(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- dirDialog = new DirectoryDialog(shell, SWT.NULL);
- setDialog(dirDialog);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- if (fCheckSwtNullExceptions) {
- DirectoryDialog dd = new DirectoryDialog(shell);
- try {
- dd = new DirectoryDialog(null);
- fail("No exception thrown for null parent");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written");
-}
-
-public void test_getFilterPath() {
- // tested in test_setFilterPathLjava_lang_String
-}
-
-public void test_getMessage() {
- // tested in test_setMessageLjava_lang_String
-}
-
-public void test_open() {
- if (fTestDialogOpen)
- dirDialog.open();
-}
-
-public void test_setFilterPathLjava_lang_String() {
- assertTrue(":1:", dirDialog.getFilterPath() == "");
- String testStr = "./*";
- dirDialog.setFilterPath(testStr);
- assertTrue(":2:", dirDialog.getFilterPath().equals(testStr));
- dirDialog.setFilterPath("");
- assertTrue(":3:", dirDialog.getFilterPath().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dirDialog.setFilterPath(null);
- fail("No exception thrown for filterPath == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_setMessageLjava_lang_String() {
- assertTrue(":1:", dirDialog.getMessage() == "");
- String testStr = "test string";
- dirDialog.setMessage(testStr);
- assertTrue(":2:", dirDialog.getMessage().equals(testStr));
- dirDialog.setMessage("");
- assertTrue(":3:", dirDialog.getMessage().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dirDialog.setMessage(null);
- fail("No exception thrown for message == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_DirectoryDialog((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getFilterPath");
- methodNames.addElement("test_getMessage");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setFilterPathLjava_lang_String");
- methodNames.addElement("test_setMessageLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getFilterPath")) test_getFilterPath();
- else if (getName().equals("test_getMessage")) test_getMessage();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String();
- else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
deleted file mode 100644
index 679d5d1c09..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
+++ /dev/null
@@ -1,363 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Display
- *
- * @see org.eclipse.swt.widgets.Display
- */
-public class Test_org_eclipse_swt_widgets_Display extends Test_org_eclipse_swt_graphics_Device {
-
-boolean disposeExecRan;
-
-public Test_org_eclipse_swt_widgets_Display(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- // There can only be one Display object per thread.
- // If a second Display is created on the same thread, an
- // InvalidThreadAccessException is thrown.
- //
- // Each test will create its own Display and must dispose of it
- // before completing.
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- Display disp = new Display();
- disp.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written");
-}
-
-public void test_asyncExecLjava_lang_Runnable() {
- warnUnimpl("Test test_asyncExecLjava_lang_Runnable not written");
-}
-
-public void test_beep() {
- Display display = new Display();
- try {
- display.beep();
- } finally {
- display.dispose();
- }
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_checkDevice() {
- warnUnimpl("Test test_checkDevice not written");
-}
-
-public void test_createLorg_eclipse_swt_graphics_DeviceData() {
- warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written");
-}
-
-public void test_destroy() {
- warnUnimpl("Test test_destroy not written");
-}
-
-public void test_disposeExecLjava_lang_Runnable() {
- // Also tests dispose and isDisposed
- Display testDisplay = new Display();
- disposeExecRan = false;
- testDisplay.disposeExec(new Runnable() {
- public void run() {
- disposeExecRan = true;
- }
- });
- assertEquals("Display should not be disposed", false, testDisplay.isDisposed());
- testDisplay.dispose();
- assertTrue("Display should be disposed", testDisplay.isDisposed());
- assertTrue("DisposeExec Runnable did not run", disposeExecRan);
-}
-
-public void test_findWidgetI() {
- warnUnimpl("Test test_findWidgetI not written");
-}
-
-public void test_findDisplayLjava_lang_Thread() {
- warnUnimpl("Test test_findDisplayLjava_lang_Thread not written");
-}
-
-public void test_getActiveShell() {
- warnUnimpl("Test test_getActiveShell not written");
-}
-
-public void test_getBounds() {
- Display display = new Display();
- try {
- Rectangle rect = display.getBounds();
- assertNotNull(rect);
- } finally {
- display.dispose();
- }
-}
-
-public void test_getCurrent() {
- warnUnimpl("Test test_getCurrent not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getCursorControl() {
- Display display = new Display();
- try {
- display.getCursorControl();
- } finally {
- display.dispose();
- }
-}
-
-public void test_getCursorLocation() {
- warnUnimpl("Test test_getCursorLocation not written");
-}
-
-public void test_getDefault() {
- Display display = new Display();
- try {
- assertNotNull(display.getDefault());
- } finally {
- display.dispose();
- }
-}
-
-public void test_getDataLjava_lang_String() {
- warnUnimpl("Test test_getDataLjava_lang_String not written");
-}
-
-public void test_getData() {
- warnUnimpl("Test test_getData not written");
-}
-
-public void test_getDoubleClickTime() {
- warnUnimpl("Test test_getDoubleClickTime not written");
-}
-
-public void test_getFocusControl() {
- Display display = new Display();
- try {
- display.getFocusControl();
- } finally {
- display.dispose();
- }
-}
-
-public void test_getIconDepth() {
- warnUnimpl("Test test_getIconDepth not written");
-}
-
-public void test_getShells() {
- warnUnimpl("Test test_getShells not written");
-}
-
-public void test_getSyncThread() {
- warnUnimpl("Test test_getSyncThread not written");
-}
-
-public void test_getSystemColorI() {
- Display display = new Display();
- try {
- int [] colorIds = {
- SWT.COLOR_WIDGET_DARK_SHADOW, SWT.COLOR_WIDGET_NORMAL_SHADOW,
- SWT.COLOR_WIDGET_LIGHT_SHADOW, SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW,
- SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WIDGET_BORDER,
- SWT.COLOR_WIDGET_FOREGROUND, SWT.COLOR_LIST_FOREGROUND,
- SWT.COLOR_LIST_BACKGROUND, SWT.COLOR_LIST_SELECTION,
- SWT.COLOR_LIST_SELECTION_TEXT,
- };
- for (int i=0; i < colorIds.length; i++) {
- assertNotNull(display.getSystemColor(colorIds[i]));
- }
- } finally {
- display.dispose();
- }
-}
-
-public void test_getSystemFont() {
- warnUnimpl("Test test_getSystemFont not written");
-}
-
-public void test_getThread() {
- warnUnimpl("Test test_getThread not written");
-}
-
-public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_init() {
- warnUnimpl("Test test_init not written");
-}
-
-public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() {
- warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written");
-}
-
-public void test_readAndDispatch() {
- warnUnimpl("Test test_readAndDispatch not written");
-}
-
-public void test_release() {
- warnUnimpl("Test test_release not written");
-}
-
-public void test_setDataLjava_lang_StringLjava_lang_Object() {
- warnUnimpl("Test test_setDataLjava_lang_StringLjava_lang_Object not written");
-}
-
-public void test_setDataLjava_lang_Object() {
- warnUnimpl("Test test_setDataLjava_lang_Object not written");
-}
-
-public void test_setAppNameLjava_lang_String() {
- warnUnimpl("Test test_setAppNameLjava_lang_String not written");
-}
-
-public void test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer() {
- warnUnimpl("Test test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer not written");
-}
-
-public void test_sleep() {
- warnUnimpl("Test test_sleep not written");
-}
-
-public void test_syncExecLjava_lang_Runnable() {
- warnUnimpl("Test test_syncExecLjava_lang_Runnable not written");
-}
-
-public void test_timerExecILjava_lang_Runnable() {
- warnUnimpl("Test test_timerExecILjava_lang_Runnable not written");
-}
-
-public void test_update() {
- warnUnimpl("Test test_update not written");
-}
-
-public void test_wake() {
- warnUnimpl("Test test_wake not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Display((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData");
- methodNames.addElement("test_asyncExecLjava_lang_Runnable");
- methodNames.addElement("test_beep");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_checkDevice");
- methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData");
- methodNames.addElement("test_destroy");
- methodNames.addElement("test_disposeExecLjava_lang_Runnable");
- methodNames.addElement("test_findWidgetI");
- methodNames.addElement("test_findDisplayLjava_lang_Thread");
- methodNames.addElement("test_getActiveShell");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getCurrent");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getCursorControl");
- methodNames.addElement("test_getCursorLocation");
- methodNames.addElement("test_getDefault");
- methodNames.addElement("test_getDataLjava_lang_String");
- methodNames.addElement("test_getData");
- methodNames.addElement("test_getDoubleClickTime");
- methodNames.addElement("test_getFocusControl");
- methodNames.addElement("test_getIconDepth");
- methodNames.addElement("test_getShells");
- methodNames.addElement("test_getSyncThread");
- methodNames.addElement("test_getSystemColorI");
- methodNames.addElement("test_getSystemFont");
- methodNames.addElement("test_getThread");
- methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_init");
- methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData");
- methodNames.addElement("test_readAndDispatch");
- methodNames.addElement("test_release");
- methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object");
- methodNames.addElement("test_setDataLjava_lang_Object");
- methodNames.addElement("test_setAppNameLjava_lang_String");
- methodNames.addElement("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer");
- methodNames.addElement("test_sleep");
- methodNames.addElement("test_syncExecLjava_lang_Runnable");
- methodNames.addElement("test_timerExecILjava_lang_Runnable");
- methodNames.addElement("test_update");
- methodNames.addElement("test_wake");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData();
- else if (getName().equals("test_asyncExecLjava_lang_Runnable")) test_asyncExecLjava_lang_Runnable();
- else if (getName().equals("test_beep")) test_beep();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_checkDevice")) test_checkDevice();
- else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData();
- else if (getName().equals("test_destroy")) test_destroy();
- else if (getName().equals("test_disposeExecLjava_lang_Runnable")) test_disposeExecLjava_lang_Runnable();
- else if (getName().equals("test_findWidgetI")) test_findWidgetI();
- else if (getName().equals("test_findDisplayLjava_lang_Thread")) test_findDisplayLjava_lang_Thread();
- else if (getName().equals("test_getActiveShell")) test_getActiveShell();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getCurrent")) test_getCurrent();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getCursorControl")) test_getCursorControl();
- else if (getName().equals("test_getCursorLocation")) test_getCursorLocation();
- else if (getName().equals("test_getDefault")) test_getDefault();
- else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String();
- else if (getName().equals("test_getData")) test_getData();
- else if (getName().equals("test_getDoubleClickTime")) test_getDoubleClickTime();
- else if (getName().equals("test_getFocusControl")) test_getFocusControl();
- else if (getName().equals("test_getIconDepth")) test_getIconDepth();
- else if (getName().equals("test_getShells")) test_getShells();
- else if (getName().equals("test_getSyncThread")) test_getSyncThread();
- else if (getName().equals("test_getSystemColorI")) test_getSystemColorI();
- else if (getName().equals("test_getSystemFont")) test_getSystemFont();
- else if (getName().equals("test_getThread")) test_getThread();
- else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_init")) test_init();
- else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData();
- else if (getName().equals("test_readAndDispatch")) test_readAndDispatch();
- else if (getName().equals("test_release")) test_release();
- else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object();
- else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object();
- else if (getName().equals("test_setAppNameLjava_lang_String")) test_setAppNameLjava_lang_String();
- else if (getName().equals("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer")) test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer();
- else if (getName().equals("test_sleep")) test_sleep();
- else if (getName().equals("test_syncExecLjava_lang_Runnable")) test_syncExecLjava_lang_Runnable();
- else if (getName().equals("test_timerExecILjava_lang_Runnable")) test_timerExecILjava_lang_Runnable();
- else if (getName().equals("test_update")) test_update();
- else if (getName().equals("test_wake")) test_wake();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java
deleted file mode 100644
index 23c1738b36..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Event
- *
- * @see org.eclipse.swt.widgets.Event
- */
-public class Test_org_eclipse_swt_widgets_Event extends SwtTestCase {
-
-public Test_org_eclipse_swt_widgets_Event(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_setBoundsLorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_toString() {
- warnUnimpl("Test test_toString not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Event((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java
deleted file mode 100644
index 6ad0b02e1c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.FileDialog
- *
- * @see org.eclipse.swt.widgets.FileDialog
- */
-public class Test_org_eclipse_swt_widgets_FileDialog extends Test_org_eclipse_swt_widgets_Dialog {
-
-FileDialog fileDialog;
-
-public Test_org_eclipse_swt_widgets_FileDialog(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- fileDialog = new FileDialog(shell, SWT.NULL);
- setDialog(fileDialog);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- // Test FileDialog(Shell)
- if (fCheckSwtNullExceptions) {
- FileDialog fd = new FileDialog(shell);
- try {
- fd = new FileDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written");
-}
-
-public void test_getFileName() {
- warnUnimpl("Test test_getFileName not written");
-}
-
-public void test_getFileNames() {
- warnUnimpl("Test test_getFileNames not written");
-}
-
-public void test_getFilterExtensions() {
- warnUnimpl("Test test_getFilterExtensions not written");
-}
-
-public void test_getFilterNames() {
- warnUnimpl("Test test_getFilterNames not written");
-}
-
-public void test_getFilterPath() {
- // tested in test_setFilterPathLjava_lang_String
-}
-
-public void test_open() {
- if (fTestDialogOpen)
- fileDialog.open();
-}
-
-public void test_setFileNameLjava_lang_String() {
- warnUnimpl("Test test_setFileNameLjava_lang_String not written");
-}
-
-public void test_setFilterExtensions$Ljava_lang_String() {
- warnUnimpl("Test test_setFilterExtensions$Ljava_lang_String not written");
-}
-
-public void test_setFilterNames$Ljava_lang_String() {
- warnUnimpl("Test test_setFilterNames$Ljava_lang_String not written");
-}
-
-public void test_setFilterPathLjava_lang_String() {
- assertTrue(":1:", fileDialog.getFilterPath() == "");
- String testStr = "./*";
- fileDialog.setFilterPath(testStr);
- assertTrue(":2:", fileDialog.getFilterPath().equals(testStr));
- fileDialog.setFilterPath("");
- assertTrue(":3:", fileDialog.getFilterPath().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- fileDialog.setFilterPath(null);
- fail("No exception thrown for filterPath == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_FileDialog((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getFileName");
- methodNames.addElement("test_getFileNames");
- methodNames.addElement("test_getFilterExtensions");
- methodNames.addElement("test_getFilterNames");
- methodNames.addElement("test_getFilterPath");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setFileNameLjava_lang_String");
- methodNames.addElement("test_setFilterExtensions$Ljava_lang_String");
- methodNames.addElement("test_setFilterNames$Ljava_lang_String");
- methodNames.addElement("test_setFilterPathLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getFileName")) test_getFileName();
- else if (getName().equals("test_getFileNames")) test_getFileNames();
- else if (getName().equals("test_getFilterExtensions")) test_getFilterExtensions();
- else if (getName().equals("test_getFilterNames")) test_getFilterNames();
- else if (getName().equals("test_getFilterPath")) test_getFilterPath();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setFileNameLjava_lang_String")) test_setFileNameLjava_lang_String();
- else if (getName().equals("test_setFilterExtensions$Ljava_lang_String")) test_setFilterExtensions$Ljava_lang_String();
- else if (getName().equals("test_setFilterNames$Ljava_lang_String")) test_setFilterNames$Ljava_lang_String();
- else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java
deleted file mode 100644
index 6192f3bbae..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.FontDialog
- *
- * @see org.eclipse.swt.widgets.FontDialog
- */
-public class Test_org_eclipse_swt_widgets_FontDialog extends Test_org_eclipse_swt_widgets_Dialog {
-
-FontDialog fontDialog;
-
-public Test_org_eclipse_swt_widgets_FontDialog(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- fontDialog = new FontDialog(shell, SWT.NULL);
- setDialog(fontDialog);
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- FontDialog fd = new FontDialog(shell);
- try {
- new FontDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- try {
- new FontDialog(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getFontData() {
- // tested in test_setFontDataLorg_eclipse_swt_graphics_FontData
-}
-
-public void test_open() {
- warnUnimpl("Test test_open not written");
-}
-
-public void test_setFontDataLorg_eclipse_swt_graphics_FontData() {
- FontData fontData = new FontData();
-
- assertNull(fontDialog.getFontData());
-
- fontDialog.setFontData(fontData);
- assertEquals(fontDialog.getFontData(), fontData);
-
- fontDialog.setFontData(null);
- assertNull(fontDialog.getFontData());
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_FontDialog((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getFontData");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setFontDataLorg_eclipse_swt_graphics_FontData");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getFontData")) test_getFontData();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setFontDataLorg_eclipse_swt_graphics_FontData")) test_setFontDataLorg_eclipse_swt_graphics_FontData();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java
deleted file mode 100644
index 06e8e73898..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Group
- *
- * @see org.eclipse.swt.widgets.Group
- */
-public class Test_org_eclipse_swt_widgets_Group extends Test_org_eclipse_swt_widgets_Composite {
-
-Group group;
-
-public Test_org_eclipse_swt_widgets_Group(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- group = new Group(shell, 0);
- setWidget(group);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- group = new Group(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_ETCHED_IN, SWT.SHADOW_ETCHED_OUT};
- for (int i = 0; i < cases.length; i++)
- group = new Group(shell, cases[i]);
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getText() {
- // tested in test_setTextLjava_lang_String
-}
-
-public void test_setTextLjava_lang_String() {
- String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct"};
- for (int i = 0; i < cases.length; i++) {
- group.setText(cases[i]);
- assertTrue("case: " + String.valueOf(i), group.getText().equals(cases[i]));
- };
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Group((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java
deleted file mode 100644
index b68d3af6a9..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Item
- *
- * @see org.eclipse.swt.widgets.Item
- */
-public class Test_org_eclipse_swt_widgets_Item extends Test_org_eclipse_swt_widgets_Widget {
-
-Item item;
-protected Image[] images = new Image [3];
-
-public Test_org_eclipse_swt_widgets_Item(String name) {
- super(name);
-}
-
-protected void setUp() {
- super.setUp();
- loadImages();
-}
-
-protected void tearDown() {
- super.tearDown();
- freeImages();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void loadImages() {
- java.io.InputStream in1 = this.getClass().getResourceAsStream("folder.bmp");
- java.io.InputStream in2 = this.getClass().getResourceAsStream("folderOpen.bmp");
- java.io.InputStream in3 = this.getClass().getResourceAsStream("target.bmp");
- Display display = shell.getDisplay();
-
- images [0] = new Image (display, in1);
- images [1] = new Image (display, in2);
- images [2] = new Image (display, in3);
-
- try {
- in1.close();
- in2.close();
- in3.close();
- } catch (java.io.IOException e) {
- }
-}
-protected void setWidget(Widget widget) {
- item = (Item) widget;
- super.setWidget(widget);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void freeImages() {
- for (int i=0; i<images.length; i++) {
- if (images[i] != null)
- images[i].dispose();
- }
-}
-
-public void test_getImage() {
- // tested in test_setImageLorg_eclipse_swt_graphics_Image
-}
-
-public void test_getText() {
- // tested in test_setTextLjava_lang_String
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- assertNull(item.getImage());
- item.setImage(images[0]);
- assertEquals(images[0], item.getImage());
- assertTrue(item.getImage() != images[1]);
- item.setImage(null);
- assertNull(item.getImage());
-}
-
-public void test_setTextLjava_lang_String() {
- String testStr = "test string";
- item.setText(testStr);
- assertTrue("a", item.getText().equals(testStr));
- item.setText("");
- assertTrue("b", item.getText().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- item.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java
deleted file mode 100644
index c18de97e9a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Label
- *
- * @see org.eclipse.swt.widgets.Label
- */
-public class Test_org_eclipse_swt_widgets_Label extends Test_org_eclipse_swt_widgets_Control {
-
-Label label;
-
-public Test_org_eclipse_swt_widgets_Label(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- label = new Label(shell, 0);
- setWidget(label);
-}
-
-protected void tearDown() {
-// super.tearDown();
-
- if (label != null) {
- assertEquals(shell.isDisposed(), false);
- assertEquals(label.isDisposed(), false);
- }
-
- shell.dispose();
- if (label != null) {
- assertTrue(shell.isDisposed());
- assertTrue(label.isDisposed());
- }
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- label = new Label(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- label = new Label(shell, 0);
-
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER, SWT.SEPARATOR, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_IN, SWT.SHADOW_OUT};
- for (int i = 0; i < cases.length; i++)
- label = new Label(shell, cases[i]);
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- */
-public void test_getAlignment(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; i<cases.length; i++)
- {
- label = new Label(shell, cases[i]);
- assertEquals(label.getAlignment(), cases[i]);
- }
-}
-
-/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- */
-public void test_getImage(){
- Image[] cases = {null, new Image(null, 100, 100)};
- for(int i=0; i<cases.length; i++){
- label.setImage(cases[i]);
- assertEquals(label.getImage(), cases[i]);
- if (cases[i]!=null)
- cases[i].dispose();
- }
-}
-
-/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- */
-public void test_getText(){
- String[] cases = {"", "some name", "sdasdlkjshcdascecoewcwe"};
- for(int i=0; i<cases.length; i++){
- label.setText(cases[i]);
- assertEquals(label.getText(), cases[i]);
- }
-}
-
-/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- */
-public void test_setAlignmentI(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; i<cases.length; i++)
- {
- label.setAlignment(cases[i]);
- assertEquals(label.getAlignment(), cases[i]);
- }
-}
-
-public void test_setFocus() {
- warnUnimpl("Test test_setFocus not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- */
-public void test_setTextLjava_lang_String(){
- try {
- label.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Label((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getAlignment");
- methodNames.addElement("test_getImage");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_setAlignmentI");
- methodNames.addElement("test_setFocus");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getAlignment")) test_getAlignment();
- else if (getName().equals("test_getImage")) test_getImage();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_setAlignmentI")) test_setAlignmentI();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java
deleted file mode 100644
index 210625c3b5..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Layout
- *
- * @see org.eclipse.swt.widgets.Layout
- */
-public class Test_org_eclipse_swt_widgets_Layout extends SwtTestCase {
-
-public Test_org_eclipse_swt_widgets_Layout(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() {
- warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written");
-}
-
-public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() {
- warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ");
- methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ();
- else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java
deleted file mode 100644
index 5eaa41cbee..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java
+++ /dev/null
@@ -1,2143 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.List
- *
- * @see org.eclipse.swt.widgets.List
- */
-public class Test_org_eclipse_swt_widgets_List extends Test_org_eclipse_swt_widgets_Scrollable {
-
-List list;
-
-public Test_org_eclipse_swt_widgets_List(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- list = new List(shell, SWT.MULTI);
-
- setWidget(list);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Test if 'deselect(u, v)' is the same as 'for (i=u; i<=v; ++i) deselect(i);'
- */
-protected void deselectII_helper(
- String[] items,
- int start,
- int end,
- int[] expectedIndices) {
-
- list.setItems(items);
- list.setSelection(items);
-
- list.deselect(start, end);
- assertEquals(
- ":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.setSelection(items);
- if ( 0 != (list.getStyle() & SWT.MULTI) ) {
- assertEquals("setSelection(items):", items, list.getSelection());
- }
-
- for (int i = start; i <= end; ++i) {
- list.deselect(i);
- }
- assertEquals(
- ":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.deselectAll();
-}
-/**
- * Dispose of the main list and create a new, single-selection one.
- */
-protected List setSingleList() {
- list.dispose();
- list = new List(shell, SWT.SINGLE);
- setWidget(list);
- return list;
-}
-/**
- * Similar to deselectII_helper, checks if select(u, v) is the same as
- * for (i=u; i<=v; ++i) select(i)
- */
-protected void selectII_helper(
- String[] items,
- int start,
- int end,
- int[] expectedIndices) {
- list.setItems(items);
- list.select(start, end);
- assertEquals(
- ":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.deselectAll();
- assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {});
-
- for (int i = start; i <= end; i++) // <= on purpose
- list.select(i);
-
- assertEquals(":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.deselectAll();
-}
-/**
- * Similar to deselectII_helper, checks if select(int []arr) gives the same
- * result as several individual select(int) calls. The int[] used for selection
- * will be filled all integers from start to end inclusive, in order.
- */
-protected void select$I_helper(
- String[] items,
- int start,
- int end,
- int[] expectedIndices) {
- int[] selection = new int[end - start + 1];
- for (int i = 0; i < selection.length; ++i) {
- selection[i] = i + start;
- }
-
- list.select(selection);
-
- assertEquals(
- ":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.deselectAll();
- assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {});
-
- for (int i = start; i <= end; i++) // <= on purpose
- list.select(i);
-
- assertEquals(
- ":(" + start + ", " + end + "):",
- expectedIndices, list.getSelectionIndices());
-
- list.deselectAll();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- list = new List(null, 0);
- fail("No exception thrown"); //should never get here
- } catch (IllegalArgumentException e) {
- }
-
- int[] cases =
- {
- 0,
- SWT.SINGLE,
- SWT.MULTI,
- SWT.MULTI | SWT.V_SCROLL,
- SWT.MULTI | SWT.H_SCROLL,
- SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL };
- for (int i = 0; i < cases.length; i++)
- list = new List(shell, cases[i]);
-}
-
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- */
-public void test_addLjava_lang_String() {
- try {
- list.add(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- list.add("");
- list.add("some \n text");
- list.add("some text");
-
- // test single-selection list
-
- setSingleList();
-
- try {
- list.add(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- list.add("");
- list.add("some \n text");
- list.add("some text");
-}
-
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void test_addLjava_lang_StringI() {
- try {
- list.add("some text", 2);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(0, list.getItemCount());
-
- // test single-selection list
-
- setSingleList();
-
- try {
- list.add("some text", 2);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(0, list.getItemCount());
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_deselect$I() {
- String[] items = { "item0", "item1", "item2", "item3" };
- String[] empty = {
- };
- list.setItems(items);
- list.setSelection(items);
- assertEquals(":a:", list.getSelection(), items);
- try {
- list.deselect(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getSelection(), items);
- list.deselect(new int[] {
- });
- assertEquals(list.getSelection(), items);
- list.deselect(new int[] { 0 });
- assertEquals(list.isSelected(0), false);
- assertTrue(list.isSelected(1));
- list.deselect(new int[] { 2, 0, 0 });
- assertEquals(list.getSelectionIndices(), new int[] { 1, 3 });
- /* assert(":d:", !list.isSelected(0));
- assert(":dd:", !list.isSelected(2));
- assert(":ddd:", list.isSelected(1));
- assert(":ddd:", list.isSelected(1));*/
-
-
- setSingleList();
- list.setItems(items);
- list.setSelection(items);
- assertEquals(list.getSelection(), new String[] { "item3" });
- try {
- list.deselect(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(list.getSelection(), new String[] { "item3" });
- list.deselect(new int[] {
- });
- assertEquals(list.getSelection(), new String[] { "item3" });
- list.deselect(new int[] { 1 });
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
- list.deselect(new int[] { 0 });
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
- list.deselect(new int[] { 3 });
- assertEquals(list.getSelectionIndices(), new int[] {});
- list.deselect(new int[] { 2, 0, 0 });
- assertEquals(list.getSelectionIndices(), new int[] {});
-
-}
-
-public void test_deselectI() {
- int number = 5;
- String[] items = new String[number];
- for (int i = 0; i < number; i++)
- items[i] = "fred" + i;
- list.setItems(items);
-
- String[] items2 = { "item0", "item1", "item2", "item3" };
- String[] empty = {
- };
- list.setItems(items2);
- list.setSelection(items2);
- assertEquals(items2, list.getSelection());
- list.deselect(5);
- assertEquals(items2, list.getSelection());
- list.deselect(1);
- assertEquals(false, list.isSelected(1));
- list.deselect(1);
- assertEquals(false, list.isSelected(1));
-
-
- setSingleList();
- list.setItems(items2);
- list.setSelection(items2);
- assertEquals(new String[] { "item3" }, list.getSelection());
- list.deselect(5);
- assertEquals(new String[] { "item3" }, list.getSelection());
- list.deselect(2);
- assertEquals(false, list.isSelected(2));
- list.deselect(1);
- assertEquals(false, list.isSelected(1));
- list.deselect(1);
- assertEquals(false, list.isSelected(1));
- // assert(":e:", list.getSe);
-
-}
-
-public void test_deselectII() {
- int number = 5;
- String[] items = new String[number];
- for (int i = 0; i < number; i++)
- items[i] = "fred" + i;
- list.setItems(items);
- list.setSelection(items);
-
- // tests if deselect(i, j) is the same as for (i=0; i<=j; ++i) deselect(i);
- int[][] cases = { { 3, 1 }, {
- -3, -2 }, {
- -2, -1 }, {
- -1, -1 }, {
- 10, 1 }
- };
-
- for (int i = 0; i < cases.length; ++i) {
- deselectII_helper(items, cases[i][0], cases[i][1], new int[] { 0, 1, 2, 3, 4 });
- }
- if (fCheckSWTPolicy) {
- deselectII_helper(items, -1, 3, new int[] { 4 });
- deselectII_helper(items, -1, 30, new int[] {
- });
- }
- deselectII_helper(items, 1, 3, new int[] { 0, 4 });
- deselectII_helper(items, 1, 1, new int[] { 0, 2, 3, 4 });
- // done
-
- String[] items2 = { "item0", "item1", "item2", "item3" };
- String[] empty = {
- };
- list.setItems(items2);
- list.setSelection(items2);
- assertEquals(":a:", items2, list.getSelection());
- list.deselect(0, 0);
- assertEquals(":b:", list.getSelectionIndices(), new int[] { 1, 2, 3 });
- list.deselect(0, 0);
- assertEquals(":bbb:", list.getSelectionIndices(), new int[] { 1, 2, 3 });
- list.deselect(2, 3);
- assertEquals(":bb:", list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(items2);
- list.deselect(0, 2);
- assertEquals(":dddd:", list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(items2);
- list.deselect(2, 0);
- assertEquals(
- ":ddddd:",
- list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
-
- setSingleList();
- deselectII_helper(items, 3, 1, new int[]{4});
- deselectII_helper(items, -1, -1, new int[]{4});
- deselectII_helper(items, 1, 3, new int[]{4});
- deselectII_helper(items, -1, 3, new int[]{4});
- deselectII_helper(items, -1, 30, new int[]{});
- deselectII_helper(items, 1, 1, new int[]{4});
- deselectII_helper(items, 10, 1, new int[]{4});
-
-
-
- list.setItems(items2);
- list.deselectAll();
-
- list.select(0);
-
- list.deselect(-3, -2);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.deselect(-2, -1);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.deselect(-1, -1);
- assertEquals(":e:", list.getSelectionIndices(), new int[] { 0 });
-
-
- list.setSelection(items2);
- assertEquals(list.getSelection(), new String[] { "item3" });
-
- list.deselect(1, 1);
- assertEquals(list.getSelection(), new String[] { "item3" });
-
- list.deselect(0, 0);
- assertEquals(list.getSelection(), new String[] { "item3" });
-
- list.deselect(3, 3);
- assertEquals(list.getSelection(), new String[] {});
-
- list.setSelection(items2);
- list.deselect(1, 2);
- assertEquals(list.getSelection(), new String[] { "item3" });
-
- list.setSelection(items2);
- list.deselect(0, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(items2);
- list.deselect(1, 3);
- assertEquals(list.getSelectionIndices(), new int[] {});
-}
-
-public void test_deselectAll() {
- String[] items = { "item0", "item1", "item2", "item3" };
- String[] empty = {
- };
- list.setItems(items);
- list.setSelection(items);
- assertEquals(items, list.getSelection());
- list.deselectAll();
- assertEquals(empty, list.getSelection());
-
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- assertEquals(new String[] { "item3" }, list.getSelection());
- list.deselectAll();
- assertEquals(empty, list.getSelection());
-
-}
-
-public void test_getFocusIndex() {
- warnUnimpl("Test test_getFocusIndex not written");
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_getItemI() {
- String[] items = { "item0", "item1", "item2", "item3" };
- String[] empty = {
- };
- list.setItems(items);
- String item = null;
- try {
- item = list.getItem(5);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItem(3), "item3");
-
-
- setSingleList();
- list.setItems(items);
- try {
- item = list.getItem(5);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- //assert(":a:", list.getItem(5)==null);
- assertEquals("item3", list.getItem(3));
-
-}
-
-public void test_getItemCount() {
- String[] items = { "item0", "item1", "item2", "item3" };
-
- assertEquals(0, list.getItemCount());
- list.setItems(items);
- assertEquals(4, list.getItemCount());
- list.remove(2);
- assertEquals(3, list.getItemCount());
- list.removeAll();
- assertEquals(0, list.getItemCount());
-
-
- setSingleList();
- assertEquals(0, list.getItemCount());
- list.setItems(items);
- assertEquals(4, list.getItemCount());
- list.remove(2);
- assertEquals(3, list.getItemCount());
- list.removeAll();
- assertEquals(0, list.getItemCount());
-
-}
-
-public void test_getItemHeight() {
- warnUnimpl("Test test_getItemHeight not written");
-}
-
-public void test_getItems() {
- String[][] cases = { {
- }, {
- "" }, {
- "", "" }, {
- "text1", "text2" }
- };
- for (int i = 0; i < cases.length; i++) {
- list.setItems(cases[i]);
- assertEquals("case: " + i, cases[i], list.getItems());
- }
-}
-
-public void test_getSelection() {
- String[][] cases = { {
- }, {
- "" }, {
- "", "" }, {
- "text1", "text2" }
- };
- for (int i = 0; i < cases.length; i++) {
- // System.out.println("loop:" + i);
- list.setItems(cases[i]);
- list.setSelection(cases[i]);
- // System.out.println("list:" + list.getSelection());
- // System.out.println("case:" + i + cases[i]);
- assertEquals("case: " + i, cases[i], list.getSelection());
- }
-
- for (int i = 1; i < cases.length; i++) {
- list.setItems(cases[i]);
- list.setSelection(0);
- assertEquals(
- "case: " + String.valueOf(i),
- list.getSelection(), new String[] { cases[i][0] });
- }
-
- String[] items = { "text1", "text2", "text3" };
- list.setItems(items);
- int[] sel = { 0, 2 };
- list.setSelection(sel);
- assertEquals(list.getSelection().length, 2);
- assertEquals(list.getSelection()[0], items[0]);
- assertEquals(list.getSelection()[1], items[2]);
-
- list.setSelection(0, 1);
- assertEquals(list.getSelection().length, 2);
- assertEquals(list.getSelection()[0], items[0]);
- assertEquals(list.getSelection()[1], items[1]);
-
- list.setSelection(1, 1);
- assertEquals(list.getSelection().length, 1);
- assertEquals(list.getSelection()[0], items[1]);
-
- list.setSelection(1, 0);
- String[] empty = {
- };
- assertEquals(empty, list.getSelection());
-
- String[] bogus_items = { "bogus_text1", "bogus_text2", "bogus_text3" };
- list.setSelection(bogus_items);
- assertEquals(empty, list.getSelection());
-
- // test single-selection lists
-
- setSingleList();
-
- list.setItems(items);
- sel = new int[] { 0, 2 };
- list.setSelection(sel);
- assertEquals(1, list.getSelection().length);
- assertEquals(items[0], list.getSelection()[0]);
-
- list.setSelection(0, 1);
- assertEquals(1, list.getSelection().length);
- assertEquals(items[1], list.getSelection()[0]);
-}
-
-/**
- * Returns the number of selected items contained in the receiver.
- *
- * @return the number of selected items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_getSelectionCount() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(0, list.getSelectionCount());
-
- list.setSelection(items);
- assertEquals(3, list.getSelectionCount());
-
- list.deselectAll();
- try {
- list.setSelection((String[]) null);
- fail("No exception thrown for selection == null");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getSelectionCount(), 0);
-
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- assertEquals(1, list.getSelectionCount());
-}
-
-public void test_getSelectionIndex() {
- String[] items = { "text1", "text2", "text3" };
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- assertEquals(items.length - 1, list.getSelectionIndex());
-}
-
-public void test_getSelectionIndices() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
-
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(items);
- int[] sel = { 0, 1, 2 };
- assertEquals(sel, list.getSelectionIndices());
-
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- sel = new int[]{ items.length - 1 };
- assertEquals(sel, list.getSelectionIndices());
-
-
- list.setItems(items);
- assertEquals(new int[] {}, list.getSelectionIndices());
-
-}
-
-public void test_getTopIndex() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(0, list.getTopIndex());
-
-
- setSingleList();
-
- list.setItems(items);
- assertEquals(0, list.getTopIndex());
-
-}
-
-/**
- * Gets the index of an item.
- * <p>
- * The list is searched starting at 0 until an
- * item is found that is equal to the search item.
- * If no item is found, -1 is returned. Indexing
- * is zero based.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- */
-public void test_indexOfLjava_lang_String() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(list.indexOf("text3"), 2);
- assertEquals(list.indexOf("text4"), -1);
-
- int ind;
- try {
- ind = list.indexOf(null);
- fail("No exception thrown for item == null");
- } catch (IllegalArgumentException e) {
- }
-
- String[] items2 = { "text1", "text2", "text2" }; //two identical
-
- list.setItems(items2);
- assertEquals(list.indexOf("text2"), 1);
-
-
- setSingleList();
-
- list.setItems(items);
- assertEquals(-1, list.indexOf("text3", 4));
-
-
- assertEquals(2, list.indexOf("text3"));
-
-
- assertEquals(-1, list.indexOf("text4"));
-
-
- try {
- ind = list.indexOf(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
-
- assertEquals(1, list.indexOf("text2"));
-}
-
-public void test_indexOfLjava_lang_StringI() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(-1, list.indexOf("text3", 4));
- assertEquals(2, list.indexOf("text3", 2));
- assertEquals(1, list.indexOf("text2", 0));
- assertEquals(1, list.indexOf("text2", 1));
- assertEquals(-1, list.indexOf("text2", 2));
-
- String[] items2 = { "text1", "text2", "text2" }; //two identical
- list.setItems(items2);
- assertEquals(list.indexOf("text2", 2), 2);
-
-
- setSingleList();
-
- list.setItems(items2);
- // assert("list.indexOf(\"text2\", -1)==1", list.indexOf("text2", -1)==1);
- assertEquals(1, list.indexOf("text2", 0));
- assertEquals(1, list.indexOf("text2", 1));
- assertEquals(2, list.indexOf("text2", 2));
-}
-
-public void test_isSelectedI() {
- String[] items = { "text1", "text2", "text2" }; //two identical
-
- list.setItems(items);
- list.setSelection(items);
- assertTrue(list.isSelected(0));
- assertTrue(list.isSelected(1));
- assertTrue(list.isSelected(2));
- assertEquals(false, list.isSelected(3));
-
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- if (fCheckSWTPolicy) {
- assertEquals(false, list.isSelected(0));
- assertTrue(list.isSelected(1));
- assertEquals(false, list.isSelected(2));
- assertEquals(false, list.isSelected(3));
- }
-
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_remove$I() {
- String[] items = { "text0", "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- list.setItems(items);
- list.remove(new int[] { 1, 0, 1 });
- assertEquals(list.getItemCount(), 2);
-
- list.setItems(items);
-
- try {
- list.remove(new int[] { 3, 1, -1 });
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(":a:", list.getItems(), new String[] { "text0", "text2" });
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- try {
- list.remove(new int[] { -1, -1 });
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(":b:", list.getItems(), items);
-
- try {
- list.remove(new int[] { -2, -1 });
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(":c:", list.getItems(), items);
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- list.remove(new int[] { 1, 1, 1 });
- assertEquals(
- ":d:",
- list.getItems(), new String[] { "text0", "text2", "text3" });
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- list.remove(new int[] { 1, 3 });
- assertEquals(":e:", list.getItems(), new String[] { "text0", "text2" });
-
-
- setSingleList();
-
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- list.remove(new int[] { 1, 3 });
- assertEquals(":f:", list.getItems(), new String[] { "text0", "text2" });
-
-
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- list.remove(new int[] { 3, 1 });
- assertEquals(":g:", list.getItems(), new String[] { "text0", "text2" });
-
-
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- try {
- list.remove(new int[] { 3, 1, -1 });
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(":h:", list.getItems(), new String[] { "text0", "text2" });
-
-
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- try {
- list.remove(new int[] { -1, -1 });
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(":i:", items, list.getItems());
-
-
- assertEquals(4, list.getItemCount());
-
- list.remove(new int[] { 1, 1, 1 });
- assertEquals(":j:",
- new String[] { "text0", "text2", "text3" }, list.getItems());
-
-}
-
-/**
- * Removes the item from the receiver at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_removeI() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 3);
-
- try {
- list.remove(3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItemCount(), 3);
-
- try {
- list.remove(-1);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItemCount(), 3);
-
- list.remove(1);
- assertEquals(list.getItemCount(), 2);
- assertEquals(list.getItem(1), "text3");
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 3);
-
- try {
- list.remove(3, 4);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(list.getItemCount(), 3);
-
- try {
- list.remove(3, 3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(list.getItemCount(), 3);
-
- list.remove(1, 2);
- assertEquals(list.getItemCount(), 1);
- assertEquals(list.getItem(0), "text1");
-
-
- setSingleList();
- list.setItems(items);
- assertEquals(3, list.getItemCount());
- try {
- list.remove(3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(3, list.getItemCount());
- /////////////////////////////////////////////////
- try {
- list.remove(-1);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(3, list.getItemCount());
- ////////////////////////////////////////////////
- list.remove(1);
- assertEquals(2, list.getItemCount());
- //////////////////////////////////////////////////////
- assertTrue(list.getItem(1).equals("text3"));
-
-}
-
-/**
- * Removes the items from the receiver which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_removeII() {
- String[] items = { "text1", "text2", "text3" };
-
- list.setItems(items);
- assertEquals(3, list.getItemCount());
-
- try {
- list.remove(3, 4);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(3, list.getItemCount());
-
- try {
- list.remove(3, 3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(3, list.getItemCount());
-
- list.remove(0, 0);
- assertEquals(2, list.getItemCount());
- assertEquals("text3", list.getItem(1));
-
- list.setItems(items);
- assertEquals(3, list.getItemCount());
-
- try {
- list.remove(3, 4);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(3, list.getItemCount());
-
- list.remove(0, 2);
- assertEquals(0, list.getItemCount());
-
- list.setItems(items);
- assertEquals(3, list.getItemCount());
-
- try {
- list.remove(3, 3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(3, list.getItemCount());
-
- list.remove(2, 0);
- assertEquals(3, list.getItemCount());
-
-
- setSingleList();
-
- list.setItems(items);
- assertEquals(3, list.getItemCount());
- //////////////////////////////////////////////////////////////
- try {
- list.remove(3, 4);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(3, list.getItemCount());
- /////////////////////////////////////////////////////////
- try {
- list.remove(3, 3);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(3, list.getItemCount());
- //////////////////////////////////////////////////////////////
- list.remove(1, 2);
- assertEquals(1, list.getItemCount());
- assertEquals("text1", list.getItem(0));
-
-
- list.setItems(items);
- assertEquals(3, list.getItemCount());
-
- try {
- list.remove(2, 10);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(2, list.getItemCount());
- assertEquals("text2", list.getItem(1));
-
- list.remove(2, 0);
- assertEquals(2, list.getItemCount());
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_removeLjava_lang_String() {
- String[] items = { "text1", "text2", "text3", "test2" };
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- try {
- list.remove((String) null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItemCount(), 4);
-
- try {
- list.remove("items989");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItemCount(), 4);
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- list.remove("text3");
- assertEquals(list.getItemCount(), 3);
-
- list.remove("text2");
- assertEquals(list.getItemCount(), 2);
-
-
- setSingleList();
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- try {
- list.remove((String) null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(4, list.getItemCount());
- ////////////////////////////////////////
- try {
- list.remove("items989");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(4, list.getItemCount());
-
-
- assertEquals(4, list.getItemCount());
-
- list.remove("text3");
- assertEquals(3, list.getItemCount());
-
- list.remove("text2");
- assertEquals(2, list.getItemCount());
-
-}
-
-public void test_removeAll() {
- String[] items = { "text1", "text2", "text3", "test2" };
-
- list.setItems(items);
- assertEquals(list.getItemCount(), 4);
-
- list.removeAll();
- assertEquals(list.getItemCount(), 0);
- list.removeAll();
- assertEquals(list.getItemCount(), 0);
-
-
- setSingleList();
- list.setItems(items);
- assertEquals(4, list.getItemCount());
-
- list.removeAll();
- assertEquals(0, list.getItemCount());
-
-
- setSingleList();
- assertEquals(0, list.getItemCount());
- list.removeAll();
- assertEquals(0, list.getItemCount());
-
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the given zero-relative index in the receiver
- * is not selected, it is selected. If the item at the index
- * was selected, it remains selected. Indices that are out
- * of range and duplicate indices are ignored.
- */
-public void test_select$I() {
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
-
- list.select(new int[] { 0, 2 });
- assertEquals(list.getSelectionIndices(), new int[] { 0, 2 });
-
- list.select(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
- list.select(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
- list.select(new int[] { 1 });
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
- list.add("item4");
-
- int[] ind = { -1, 0, 1, 2, 3 };
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
- ind = new int[32];
- for (int i = 0; i < ind.length; i++)
- ind[i] = i;
-
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3, 4 });
-
- list.setSelection(new int[] {
- });
- list.select(new int[] { 1 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(new int[] {
- });
- list.select(new int[] { -1 });
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.deselectAll();
- items = list.getItems();
-
- select$I_helper(items, 0, 3, new int[] { 0, 1, 2, 3 });
- select$I_helper(items, -1, 3, new int[] { 0, 1, 2, 3 });
- select$I_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 });
-
-
- setSingleList();
- list.setItems(items);
-
- ind = new int[]{ -1, 0, 1, 2, 3 };
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- ind = new int[32];
- for (int i = 0; i < ind.length; i++)
- ind[i] = i;
-
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- ind = new int[]{ 1 };
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
- list.deselectAll();
-
-
- ind = new int[]{ -1 };
- list.select(ind);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
-
- setSingleList();
- list.setItems(items);
-
- list.select(new int[] { 0, 2 });
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.select(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.select(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.select(new int[] { 2, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
- list.select(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
-
- try {
- list.select((int[]) null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
-
- int[] selection = { 0, 1, 2, 3 };
- list.select(selection);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- selection = new int[]{ -1, 0, 1, 2, 3 };
- list.select(selection);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- selection = new int[32];
- for (int i = -1; i <= 30; i++)
- selection[i + 1] = i;
-
- list.select(selection);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- selection = new int[]{1};
- list.select(selection);
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- */
-public void test_selectI() {
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
-
- list.select(2);
- assertEquals("select(2):", list.getSelectionIndices(), new int[] { 2 });
-
- list.select(1);
- assertEquals("select(1):", list.getSelectionIndices(), new int[] { 1, 2 });
-
- list.select(3);
- assertEquals(
- "select(3):",
- list.getSelectionIndices(), new int[] { 1, 2, 3 });
-
- list.select(5);
- assertEquals(
- "select(5):",
- list.getSelectionIndices(), new int[] { 1, 2, 3 });
-
-
- setSingleList();
- list.setItems(items);
-
- list.select(2);
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.select(1);
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.select(3);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.select(5);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * If the item at the index was already selected, it remains
- * selected. The range of the indices is inclusive. Indices that are
- * out of range are ignored.
- */
-public void test_selectII() {
- int number = 5;
-
- String[] items = new String[number];
- int[] empty = {
- };
-
- for (int i = 0; i < number; i++)
- items[i] = "item" + i;
-
- selectII_helper(items, 10, 1, empty);
- selectII_helper(items, 3, 1, empty);
- selectII_helper(items, -1, -1, empty);
- selectII_helper(items, 2, 4, new int[] { 2, 3, 4 });
- selectII_helper(items, 0, 3, new int[] { 0, 1, 2, 3 });
- selectII_helper(items, 1, 1, new int[] { 1 });
-
- if (fCheckSWTPolicy == true) {
- selectII_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 });
- selectII_helper(items, -1, 3, new int[] { 0, 1, 2, 3 });
- }
-
- list.select(0);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.select(-10, -9);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
- list.deselectAll();
-
- list.select(1000, 2000);
- assertEquals(list.getSelectionCount(), 0);
-
- list.deselectAll();
- list.select(1, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2 });
-
- list.select(1, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3 });
-
- list.select(2, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3 });
-
- list.select(3, 5);
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3, 4 });
-
-
- setSingleList();
- list.setItems(items);
- list.select(0);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
- list.select(-10, -9);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- list.deselectAll();
- assertEquals(0, list.getSelectionCount());
-
- list.select(1000, 2000);
- if (fCheckOutOfRangeBehaviour) {
- assertEquals(0, list.getSelectionCount());
- }
-
-
- list.deselectAll();
- assertEquals(0, list.getSelectionCount());
-
- list.select(1, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.select(1, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.select(2, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.select(3, 5);
- assertEquals(list.getSelectionIndices(), new int[] { 4 });
-
- selectII_helper(items, 1, 1, new int[]{1});
- selectII_helper(items, -1, 30, new int[]{4});
- selectII_helper(items, 10, 1, new int[]{});
- selectII_helper(items, 3, 1, new int[]{});
- selectII_helper(items, -1, -1, new int[]{});
- selectII_helper(items, 2, 4, new int[]{4});
- selectII_helper(items, 0, 3, new int[]{3});
-}
-
-public void test_selectAll() {
- String[] items = { "text1", "text2", "text3", "test2" };
-
- list.setItems(items);
- assertEquals(list.getSelectionCount(), 0);
- list.selectAll();
- assertEquals(list.getSelectionCount(), 4);
-
-
- setSingleList();
-
- list.setItems(items);
- assertEquals(0, list.getSelectionCount());
- list.selectAll();
- assertEquals(0, list.getSelectionCount());
-
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
- * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_setItemILjava_lang_String() {
- assertEquals(list.getItemCount(), 0);
- int[] cases = { -10, 0, 10 };
- for (int i = 0; i < cases.length; i++) {
- try {
- list.setItem(cases[i], null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- }
- assertEquals(list.getItemCount(), 0);
-
- for (int i = 0; i < cases.length; i++) {
- try {
- list.setItem(cases[i], "");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- }
- assertEquals(list.getItemCount(), 0);
-
- int cases2[] = { 10, 15, 0 };
- for (int i = 0; i < cases2.length; i++) {
- try {
- list.setItem(cases2[i], "fred");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- assertEquals(list.getItemCount(), 0);
- }
-
-
- setSingleList();
- assertEquals(0, list.getItemCount());
- for (int i = 0; i < cases.length; i++) {
- try {
- list.setItem(cases[i], null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- }
-
-
- setSingleList();
- for (int i = 0; i < cases.length; i++) {
- try {
- list.setItem(cases[i], "");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
- }
-
- assertEquals(0, list.getItemCount());
-
-
- setSingleList();
- for (int i = 0; i < cases2.length; i++) {
- try {
- list.setItem(cases2[i], "fred");
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
- assertEquals(0, list.getItemCount());
- }
-
-}
-
-/**
- * Sets the receiver's items to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
- * </ul>
- */
-public void test_setItems$Ljava_lang_String() {
- try {
- list.setItems(null);
- fail("No exception thrown for items == null");
- } catch (IllegalArgumentException e) {
- }
-
- String[][] cases = { { null }, {
- "dsada", null, "dsdasdasd" }
- };
- for (int i = 0; i < cases.length; i++) {
- try {
- list.setItems(cases[i]);
- fail("No exception thrown for items not found");
- } catch (SWTError e) {
- }
- }
-
- String[][] itemArr = { {
- }, {
- "" }, {
- "sdasd" }, {
- "sdasd", "323434" }
- };
- for (int i = 0; i < itemArr.length; i++) {
- list.setItems(itemArr[i]);
- assertEquals(itemArr[i], list.getItems());
- }
-
- try {
- list.setItems(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-
-
- setSingleList();
- for (int i = 0; i < itemArr.length; i++) {
- list.setItems(itemArr[i]);
- assertEquals("case:" + i, itemArr[i], list.getItems());
- }
-
-
- try {
- list.setItems(null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setSelection$I() {
- int number = 5;
- for (int i = 0; i < number; i++)
- list.add("fred" + i);
-
- int[] ind = { 1 };
- list.setSelection(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- String[][] cases = { { "" }, {
- "", "" }, {
- "text1", "text2" }
- };
- int[] items = { 0 };
- for (int i = 0; i < cases.length; i++) {
- list.setItems(cases[i]);
- list.setSelection(items);
- assertEquals(
- "case: " + String.valueOf(i),
- list.getSelection(), new String[] { cases[i][0] });
- }
-
- String[] items2 = { "item0", "item1", "item2", "item3" };
- list.setItems(items2);
-
- list.setSelection(new int[] { 0, 2 });
- assertEquals("{0, 2}", list.getSelectionIndices(), new int[] { 0, 2 });
-
- list.setSelection(new int[] { 1, 3 });
- assertEquals("{1, 3}", list.getSelectionIndices(), new int[] { 1, 3 });
-
- list.setSelection(new int[] { 0, 1, 2, 3 });
- assertEquals(
- "{0, 1, 2, 3}",
- list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
- list.setSelection(new int[] { 1 });
- assertEquals("{1}", list.getSelectionIndices(), new int[] { 1 });
-
- ind = new int[] { -1, 0, 1, 2, 3 };
- list.setSelection(ind);
- assertEquals(
- "setSelection(" + ind + "):",
- list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
-
- setSingleList();
- for (int i = 0; i < number; i++)
- list.add("fred" + i);
-
- ind = new int[]{ -1, 0, 1, 2, 3 };
- list.setSelection(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- ind = new int[32];
- for (int i = 0; i < ind.length; i++)
- ind[i] = i;
-
- list.setSelection(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
-
- ind = new int[]{ 1 };
- list.setSelection(ind);
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
-
- list.deselectAll();
- assertEquals(0, list.getSelectionCount());
-
- ind = new int[]{ -1 };
- list.setSelection(ind);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
-
- list.setSelection(new int[] { 0, 2 });
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.setSelection(new int[] { 1, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(new int[] { 0, 1, 2, 3 });
- assertEquals(list.getSelectionIndices(), new int[] { 0 });
-
- list.setSelection(new int[] { 1 });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- try {
- list.setSelection((int[]) null);
- fail("No exception thrown");
- } catch (IllegalArgumentException e) {
- }
-}
-
-/**
- * Sets the receiver's selection to be the given array of items.
- * The current selected is first cleared, then the new items are
- * selected.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- */
-public void test_setSelection$Ljava_lang_String() {
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
-
- list.setSelection(new String[] {});
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(new String[] { "" });
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(new String[] { "item2" });
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.setSelection(new String[] { "item2", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2 });
-
- list.setSelection(new String[] { "item5", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(new String[] { "item1", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setItems(items);
- try {
- list.setSelection((int[]) null);
- fail("No exception thrown for selection == null");
- } catch (IllegalArgumentException e) {
- }
-
-
- setSingleList();
- list.setItems(items);
-
- list.setSelection(new String[] {});
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(new String[] { "" });
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(new String[] { "item2" });
- assertEquals(1, list.getSelectionCount());
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.setSelection(new String[] { "item2", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(new String[] { "item5", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
- list.setSelection(new String[] { "item1", "item1" });
- assertEquals(list.getSelectionIndices(), new int[] { 1 });
-
-
- try {
- list.setSelection((String[]) null);
- fail("No exception thrown for selection == null");
- } catch (IllegalArgumentException e) {
- }
-}
-
-/**
- * Selects the item at the given zero-relative index in the receiver.
- * If the item at the index was already selected, it remains selected.
- * The current selected is first cleared, then the new items are selected.
- * Indices that are out of range are ignored.
- */
-public void test_setSelectionI() {
- int number = 5;
- for (int i = 0; i < number; i++)
- list.add("fred" + i);
-
- int[] ind = new int[32];
- for (int i = 0, j = 0; i < ind.length; i++, j++)
- ind[j] = i;
-
- list.setSelection(ind);
- assertEquals(
- "setSelection(" + ind + "):",
- list.getSelectionIndices(), new int[] { 0, 1, 2, 3, 4 });
-
- list.deselectAll();
- int[] ind2 = { -1 };
- list.setSelection(ind2);
- assertEquals(
- "setSelection(" + ind2 + "):",
- list.getSelectionIndices(), new int[] {});
-
- list.deselectAll();
- list.setSelection(2);
- assertEquals("2", list.getSelectionIndices(), new int[] { 2 });
-
- list.setSelection(3);
- assertEquals("3", list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(5);
- assertEquals("5", list.getSelectionIndices(), new int[] {});
-
-
- setSingleList();
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
-
- list.setSelection(2);
- assertEquals("2", list.getSelectionIndices(), new int[] { 2 });
-
- list.setSelection(3);
- assertEquals("3", list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(4);
- assertEquals("4", list.getSelectionIndices(), new int[] { 3 });
-
-}
-
-/**
- * Selects the items at the given zero-relative indices in the receiver.
- * The current selected if first cleared, then the new items are selected.
- */
-public void test_setSelectionII() {
- int number = 5;
- String[] items = new String[number];
- for (int i = 0; i < number; i++)
- items[i] = "fred" + i;
-
- list.setItems(items);
-
- list.setSelection(1, 1);
- assertEquals(list.getSelectionIndices(), new int[] {1});
-
- list.setSelection(10, 1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(3, 1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(-1, -1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(1, 3);
- assertEquals(list.getSelectionIndices(), new int[] {1, 2, 3});
-
- if (fCheckSWTPolicy == true) {
- list.setSelection(-1, 3);
- assertEquals(list.getSelectionIndices(), new int[] {0, 1, 2, 3});
-
- list.setSelection(-1, 30);
- assertEquals(list.getSelectionIndices(), new int[] {0, 1, 2, 3, 4});
- }
-
- items = new String[] { "item0", "item1", "item2", "item3" };
- list.setItems(items);
- list.setSelection(1, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 1, 2 });
- list.setSelection(3, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
- list.setSelection(3, 2);
- assertEquals(list.getSelectionIndices(), new int[] {}); ///IS THAT THE CORRECT ANSWER ??
-
- list.setSelection(0, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
- list.setSelection(4, 4);
- assertEquals(list.getSelectionIndices(), new int[] {}); ///IS THAT THE CORRECT ANSWER ??
-
- list.setSelection(2, 5);
- assertEquals(list.getSelectionIndices(), new int[] { 2, 3 });
- list.setSelection(-2, 500);
- if (fCheckOutOfRangeBehaviour)
- assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 });
-
-
- setSingleList();
-
- list.setItems(items);
-
- list.setSelection(1, 2);
- assertEquals(list.getSelectionIndices(), new int[] {2});
-
- list.deselectAll();
- list.setSelection(10, 1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(3, 1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(-1, -1);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(1, 3);
- assertEquals(list.getSelectionIndices(), new int[] {3});
-
- list.setSelection(-1, 3);
- assertEquals(list.getSelectionIndices(), new int[] {3});
-
- list.setSelection(-1, 30);
- assertEquals(list.getSelectionIndices(), new int[] {3});
-
- list.setSelection(1, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 2 });
-
- list.setSelection(3, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(3, 2);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(0, 3);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.deselectAll();
- list.setSelection(4, 4);
- assertEquals(list.getSelectionIndices(), new int[] {});
-
- list.setSelection(2, 5);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-
- list.setSelection(-2, 500);
- assertEquals(list.getSelectionIndices(), new int[] { 3 });
-}
-
-public void test_setTopIndexI() {
- list.setTopIndex(3);
- assertEquals(list.getTopIndex(), 0);
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
- for (int i = 0; i < items.length; i++) {
- list.setTopIndex(i);
- assertEquals(list.getTopIndex(), i);
- }
-
-
- setSingleList();
- list.setTopIndex(3);
- assertEquals(0, list.getTopIndex());
-
- list.setItems(items);
- for (int i = 0; i < items.length; i++) {
- list.setTopIndex(i);
- assertEquals(i, list.getTopIndex());
- }
-
-}
-
-public void test_showSelection() {
- String[] items = { "item0", "item1", "item2", "item3" };
- list.setItems(items);
- list.setSelection(items);
- list.showSelection();
-
-
- setSingleList();
-
- list.setItems(items);
- list.setSelection(items);
- list.showSelection();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_List((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addLjava_lang_String");
- methodNames.addElement("test_addLjava_lang_StringI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_deselect$I");
- methodNames.addElement("test_deselectI");
- methodNames.addElement("test_deselectII");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getFocusIndex");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_getSelectionIndices");
- methodNames.addElement("test_getTopIndex");
- methodNames.addElement("test_indexOfLjava_lang_String");
- methodNames.addElement("test_indexOfLjava_lang_StringI");
- methodNames.addElement("test_isSelectedI");
- methodNames.addElement("test_remove$I");
- methodNames.addElement("test_removeI");
- methodNames.addElement("test_removeII");
- methodNames.addElement("test_removeLjava_lang_String");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_select$I");
- methodNames.addElement("test_selectI");
- methodNames.addElement("test_selectII");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setItemILjava_lang_String");
- methodNames.addElement("test_setItems$Ljava_lang_String");
- methodNames.addElement("test_setSelection$I");
- methodNames.addElement("test_setSelection$Ljava_lang_String");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionII");
- methodNames.addElement("test_setTopIndexI");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String();
- else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_deselect$I")) test_deselect$I();
- else if (getName().equals("test_deselectI")) test_deselectI();
- else if (getName().equals("test_deselectII")) test_deselectII();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getFocusIndex")) test_getFocusIndex();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices();
- else if (getName().equals("test_getTopIndex")) test_getTopIndex();
- else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String();
- else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI();
- else if (getName().equals("test_isSelectedI")) test_isSelectedI();
- else if (getName().equals("test_remove$I")) test_remove$I();
- else if (getName().equals("test_removeI")) test_removeI();
- else if (getName().equals("test_removeII")) test_removeII();
- else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_select$I")) test_select$I();
- else if (getName().equals("test_selectI")) test_selectI();
- else if (getName().equals("test_selectII")) test_selectII();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String();
- else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String();
- else if (getName().equals("test_setSelection$I")) test_setSelection$I();
- else if (getName().equals("test_setSelection$Ljava_lang_String")) test_setSelection$Ljava_lang_String();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionII")) test_setSelectionII();
- else if (getName().equals("test_setTopIndexI")) test_setTopIndexI();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java
deleted file mode 100644
index d4b1e49b1e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Listener
- *
- * @see org.eclipse.swt.widgets.Listener
- */
-public class Test_org_eclipse_swt_widgets_Listener extends SwtTestCase {
-
-public Test_org_eclipse_swt_widgets_Listener(String name) {
- super(name);
-}
-
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_handleEventLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java
deleted file mode 100644
index 4b3c439558..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java
+++ /dev/null
@@ -1,364 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Menu
- *
- * @see org.eclipse.swt.widgets.Menu
- */
-public class Test_org_eclipse_swt_widgets_Menu extends Test_org_eclipse_swt_widgets_Widget {
-
-Menu menu;
-
-public Test_org_eclipse_swt_widgets_Menu(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- menu = new Menu(shell);
- setWidget(menu);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/* tests Menu(Window) */
-public void test_ConstructorLorg_eclipse_swt_widgets_Control(){
- Composite comp = new Composite(shell, SWT.NULL);
- Menu testMenu = new Menu(comp);
- comp.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_DecorationsI(){
- Menu newMenu;
- MenuItem mItem = new MenuItem(menu, SWT.NULL);
- newMenu = new Menu(mItem);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Menu(){
- Menu newMenu;
- newMenu = new Menu(menu);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_MenuItem() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_MenuItem not written");
-}
-
-public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() {
- warnUnimpl("Test test_addHelpListenerLorg_eclipse_swt_events_HelpListener not written");
-}
-
-public void test_addMenuListenerLorg_eclipse_swt_events_MenuListener() {
- warnUnimpl("Test test_addMenuListenerLorg_eclipse_swt_events_MenuListener not written");
-}
-
-public void test_getDefaultItem() {
- warnUnimpl("Test test_getDefaultItem not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- */
-public void test_getItemI(){
- MenuItem mItem0 = new MenuItem(menu, SWT.NULL);
- MenuItem mItem1 = new MenuItem(menu, SWT.NULL);
- assertEquals(menu.getItem(0), mItem0);
- assertEquals(menu.getItem(1), mItem1);
-}
-
-/**
- * Returns the number of items contained in the receiver.
- */
-public void test_getItemCount(){
- int number = 10;
- MenuItem ti;
- for (int i = 0; i<number ; i++){
- assertEquals(menu.getItemCount(), i);
- ti = new MenuItem(menu, 0);
- }
-}
-
-/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- */
-public void test_getItems(){
- int number = 5;
- MenuItem[] items = new MenuItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new MenuItem(menu, 0);
- }
- assertEquals(":a:", items, menu.getItems());
-
- menu.getItems()[0].dispose();
- assertEquals(":b:", new MenuItem[]{items[1], items[2], items[3], items[4]}, menu.getItems());
-
- menu.getItems()[3].dispose();
- assertEquals(":c:", new MenuItem[]{items[1], items[2], items[3]}, menu.getItems());
-
- menu.getItems()[1].dispose();
- assertEquals(":d:", new MenuItem[]{items[1], items[3]}, menu.getItems());
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- */
-public void test_getParent(){
- assertEquals(menu.getParent(), shell);
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- */
-public void test_getParentItem(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentItem());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentItem(), mItem);
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- */
-public void test_getParentMenu(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentMenu());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentMenu(), menu);
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- */
-public void test_getShell(){
- assertEquals(menu.getShell(), shell);
-}
-
-public void test_getVisible() {
- warnUnimpl("Test test_getVisible not written");
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- */
-public void test_indexOfLorg_eclipse_swt_widgets_MenuItem(){
- int number = 10;
- MenuItem[] mis = new MenuItem[number];
- for (int i = 0; i<number ; i++){
- mis[i] = new MenuItem(menu, SWT.NULL);
- }
- for (int i = 0; i<number ; i++){
- assertEquals(menu.indexOf(mis[i]), i);
- if (i>1)
- assertTrue(menu.indexOf(mis[i-1]) != i);
- }
-}
-
-public void test_isEnabled() {
- warnUnimpl("Test test_isEnabled not written");
-}
-
-/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- */
-public void test_isVisible(){
- menu.setVisible(true);
- assertTrue(menu.isVisible());
-
- // api not implemented yet
- if (fCheckVisibility) {
- menu.setVisible(false);
- assertEquals(menu.isVisible(), false);
- }
-}
-
-public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() {
- warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written");
-}
-
-public void test_removeMenuListenerLorg_eclipse_swt_events_MenuListener() {
- warnUnimpl("Test test_removeMenuListenerLorg_eclipse_swt_events_MenuListener not written");
-}
-
-/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- */
-public void test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem(){
- MenuItem mItem0 = new MenuItem(menu, SWT.NULL);
- MenuItem mItem1 = new MenuItem(menu, SWT.NULL);
- menu.setDefaultItem(mItem0);
- assertEquals(menu.getDefaultItem(), mItem0);
- assertTrue("After setDefaultItem(mItem0):", menu.getDefaultItem() != mItem1);
- menu.setDefaultItem(mItem1);
- assertEquals(menu.getDefaultItem(), mItem1);
- assertTrue("After setDefaultItem(mItem1):", menu.getDefaultItem() != mItem0);
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-public void test_setLocationII() {
- warnUnimpl("Test test_setLocationII not written");
-}
-
-/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- */
-/* tests both getVisible and setVisble */
-public void test_setVisibleZ(){
- menu.setVisible(true);
- assertTrue(menu.getVisible());
- // API not implemented yet
- if (fCheckVisibility) {
- menu.setVisible(false);
- assertEquals(menu.getVisible(), false);
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Menu((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Menu");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuItem");
- methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_addMenuListenerLorg_eclipse_swt_events_MenuListener");
- methodNames.addElement("test_getDefaultItem");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getParentItem");
- methodNames.addElement("test_getParentMenu");
- methodNames.addElement("test_getShell");
- methodNames.addElement("test_getVisible");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_MenuItem");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_isVisible");
- methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener");
- methodNames.addElement("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setLocationII");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Control")) test_ConstructorLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI")) test_ConstructorLorg_eclipse_swt_widgets_DecorationsI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Menu")) test_ConstructorLorg_eclipse_swt_widgets_Menu();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuItem")) test_ConstructorLorg_eclipse_swt_widgets_MenuItem();
- else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_addMenuListenerLorg_eclipse_swt_events_MenuListener")) test_addMenuListenerLorg_eclipse_swt_events_MenuListener();
- else if (getName().equals("test_getDefaultItem")) test_getDefaultItem();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getParentItem")) test_getParentItem();
- else if (getName().equals("test_getParentMenu")) test_getParentMenu();
- else if (getName().equals("test_getShell")) test_getShell();
- else if (getName().equals("test_getVisible")) test_getVisible();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_MenuItem")) test_indexOfLorg_eclipse_swt_widgets_MenuItem();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_isVisible")) test_isVisible();
- else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener")) test_removeMenuListenerLorg_eclipse_swt_events_MenuListener();
- else if (getName().equals("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem")) test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setLocationII")) test_setLocationII();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java
deleted file mode 100644
index 9bf8431fca..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.MenuItem
- *
- * @see org.eclipse.swt.widgets.MenuItem
- */
-public class Test_org_eclipse_swt_widgets_MenuItem extends Test_org_eclipse_swt_widgets_Item {
-
-Menu menu;
-MenuItem menuItem;
-
-public Test_org_eclipse_swt_widgets_MenuItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- menu = new Menu(shell);
- menuItem = new MenuItem(menu, 0);
- setWidget(menuItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_MenuI(){
- MenuItem mItem = new MenuItem(menu, SWT.NULL);
- assertNotNull(mItem);
-
- if (fCheckSwtNullExceptions) {
- try {
- mItem = new MenuItem(null, SWT.NULL);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_MenuII(){
- MenuItem mItem = new MenuItem(menu, SWT.NULL, 0); //create a menu item at index 0
- assertNotNull(mItem);
-}
-
-public void test_addArmListenerLorg_eclipse_swt_events_ArmListener() {
- warnUnimpl("Test test_addArmListenerLorg_eclipse_swt_events_ArmListener not written");
-}
-
-public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() {
- warnUnimpl("Test test_addHelpListenerLorg_eclipse_swt_events_HelpListener not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getAccelerator() {
- warnUnimpl("Test test_getAccelerator not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-public void test_getMenu() {
- warnUnimpl("Test test_getMenu not written");
-}
-
-/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- */
- public void test_getParent(){
- assertEquals(menuItem.getParent(), menu);
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_isEnabled(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.isEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.isEnabled(), false);
-}
-
-public void test_removeArmListenerLorg_eclipse_swt_events_ArmListener() {
- warnUnimpl("Test test_removeArmListenerLorg_eclipse_swt_events_ArmListener not written");
-}
-
-public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() {
- warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- */
-public void test_setAcceleratorI(){
- menuItem.setAccelerator(SWT.CTRL + 'Z');
- assertEquals(menuItem.getAccelerator(), SWT.CTRL + 'Z');
-
-}
-
-/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_setEnabledZ(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.getEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.getEnabled(), false);
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- */
-public void test_setMenuLorg_eclipse_swt_widgets_Menu(){
- assertNull(menuItem.getMenu());
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- mItem.setMenu(newMenu);
- assertEquals(mItem.getMenu(), newMenu);
-}
-
-/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- */
-public void test_setSelectionZ(){
-
- int[] itemStyles = {SWT.CHECK, SWT.RADIO};
- for (int i=0; i<itemStyles.length; i++)
- {
- MenuItem mItem = new MenuItem(menu, itemStyles[i]);
- mItem.setSelection(false);
- assertEquals(mItem.getSelection(), false);
- mItem.setSelection(true);
- assertTrue(mItem.getSelection());
- mItem.dispose();
- }
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_MenuItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuII");
- methodNames.addElement("test_addArmListenerLorg_eclipse_swt_events_ArmListener");
- methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getAccelerator");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getMenu");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_removeArmListenerLorg_eclipse_swt_events_ArmListener");
- methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setAcceleratorI");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu");
- methodNames.addElement("test_setSelectionZ");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuI")) test_ConstructorLorg_eclipse_swt_widgets_MenuI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuII")) test_ConstructorLorg_eclipse_swt_widgets_MenuII();
- else if (getName().equals("test_addArmListenerLorg_eclipse_swt_events_ArmListener")) test_addArmListenerLorg_eclipse_swt_events_ArmListener();
- else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getAccelerator")) test_getAccelerator();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getMenu")) test_getMenu();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_removeArmListenerLorg_eclipse_swt_events_ArmListener")) test_removeArmListenerLorg_eclipse_swt_events_ArmListener();
- else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setAcceleratorI")) test_setAcceleratorI();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu();
- else if (getName().equals("test_setSelectionZ")) test_setSelectionZ();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
deleted file mode 100644
index d43109be40..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.MessageBox
- *
- * @see org.eclipse.swt.widgets.MessageBox
- */
-public class Test_org_eclipse_swt_widgets_MessageBox extends Test_org_eclipse_swt_widgets_Dialog {
-
-MessageBox messageBox;
-
-public Test_org_eclipse_swt_widgets_MessageBox(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- messageBox = new MessageBox(shell, SWT.NULL);
- setDialog(messageBox);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
- if (fCheckSwtNullExceptions) {
- MessageBox mb = new MessageBox(shell);
- try {
- mb = new MessageBox(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written");
-}
-
-public void test_getMessage() {
- warnUnimpl("Test test_getMessage not written");
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- */
-public void test_open(){
- if (fTestDialogOpen)
- messageBox.open();
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- */
-public void test_setMessageLjava_lang_String(){
- assertEquals(messageBox.getMessage(), "");
- String testStr = "test string";
- messageBox.setMessage(testStr);
- assertEquals(messageBox.getMessage(), testStr);
- messageBox.setMessage("");
- assertEquals(messageBox.getMessage(), "");
- if (fCheckSwtNullExceptions) {
- try {
- messageBox.setMessage(null);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_MessageBox((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getMessage");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setMessageLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getMessage")) test_getMessage();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java
deleted file mode 100644
index a662f5ff62..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java
+++ /dev/null
@@ -1,627 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ProgressBar
- *
- * @see org.eclipse.swt.widgets.ProgressBar
- */
-public class Test_org_eclipse_swt_widgets_ProgressBar extends Test_org_eclipse_swt_widgets_Control {
-
-ProgressBar progressBar;
-
-public Test_org_eclipse_swt_widgets_ProgressBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- progressBar = new ProgressBar(shell, 0);
- setWidget(progressBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (progressBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + progressBar.getMinimum());
- //if (progressBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + progressBar.getMaximum());
- //if (progressBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + progressBar.getSelection());
-
- check(minExpected, maxExpected, selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(progressBar.getMaximum(), maxExpected);
- assertEquals(progressBar.getMinimum(), minExpected);
- assertEquals(progressBar.getSelection(), selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- progressBar.setMaximum(100);
- progressBar.setMinimum(10);
- progressBar.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- progressBar = new ProgressBar(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- progressBar = new ProgressBar(shell, cases[i]);
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI(){
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ProgressBar((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java
deleted file mode 100644
index 689ebc23ff..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Sash
- *
- * @see org.eclipse.swt.widgets.Sash
- */
-public class Test_org_eclipse_swt_widgets_Sash extends Test_org_eclipse_swt_widgets_Control {
-
-Sash sash;
-
-public Test_org_eclipse_swt_widgets_Sash(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- sash = new Sash(shell, 0);
- setWidget(sash);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- sash = new Sash(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- sash = new Sash(shell, cases[i]);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- // overridden from Control because it does not make sense
- // to set the font of a Sash.
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Sash((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java
deleted file mode 100644
index cbfa170b06..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java
+++ /dev/null
@@ -1,669 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Scale
- *
- * @see org.eclipse.swt.widgets.Scale
- */
-public class Test_org_eclipse_swt_widgets_Scale extends Test_org_eclipse_swt_widgets_Control {
-
-Scale scale;
-
-public Test_org_eclipse_swt_widgets_Scale(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- scale = new Scale(shell, 0);
- setWidget(scale);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- //Uncomment these lines and comment out call to check() if you want the test to report all errors without
- //stopping.
-
- //if (trackBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + trackBar.getMinimum());
- //if (trackBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + trackBar.getMaximum());
- //if (trackBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + trackBar.getSelection());
- check(minExpected, maxExpected, selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(scale.getMaximum(), maxExpected);
- assertEquals(scale.getMinimum(), minExpected);
- assertEquals(scale.getSelection(), selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scale.setMaximum(100);
- scale.setMinimum(10);
- scale.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- scale = new Scale(null, 0);
- fail("No exception occurred"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- scale = new Scale(shell, cases[i]);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getIncrement() {
- warnUnimpl("Test test_getIncrement not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getPageIncrement() {
- warnUnimpl("Test test_getPageIncrement not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- // overridden from Control because it does not make sense
- // to set the font of a Scale.
-}
-
-public void test_setIncrementI() {
- warnUnimpl("Test test_setIncrementI not written");
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public void test_setPageIncrementI() {
- warnUnimpl("Test test_setPageIncrementI not written");
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI() {
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Scale((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getIncrement");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getPageIncrement");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setIncrementI");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setPageIncrementI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getIncrement")) test_getIncrement();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getPageIncrement")) test_getPageIncrement();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setIncrementI")) test_setIncrementI();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java
deleted file mode 100644
index 07501527a4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java
+++ /dev/null
@@ -1,890 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ScrollBar
- *
- * @see org.eclipse.swt.widgets.ScrollBar
- */
-public class Test_org_eclipse_swt_widgets_ScrollBar extends Test_org_eclipse_swt_widgets_Widget {
-
-ScrollBar scrollBar;
-Canvas canvas;
-
-public Test_org_eclipse_swt_widgets_ScrollBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, SWT.H_SCROLL | SWT.V_SCROLL);
- scrollBar = canvas.getHorizontalBar();
- setWidget(scrollBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (scrollBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + scrollBar.getMinimum());
- //if (scrollBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + scrollBar.getMaximum());
- //if (scrollBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + scrollBar.getSelection());
- //if (scrollBar.getThumb() != thumbExpected)
- //System.out.println(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + scrollBar.getThumb());
- check(minExpected, maxExpected, selectionExpected, thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- assertEquals(scrollBar.getMaximum(), maxExpected);
- assertEquals(scrollBar.getMinimum(), minExpected);
- assertEquals(scrollBar.getSelection(), selectionExpected);
- assertEquals(scrollBar.getThumb(), thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetThumbValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 1},
-{2, 10, 100, 50, 2},
-{3, 10, 100, 50, 3},
-{4, 10, 100, 50, 4},
-{5, 10, 100, 50, 5},
-{6, 10, 100, 50, 6},
-{7, 10, 100, 50, 7},
-{8, 10, 100, 50, 8},
-{9, 10, 100, 50, 9},
-{10, 10, 100, 50, 10},
-{11, 10, 100, 50, 11},
-{12, 10, 100, 50, 12},
-{13, 10, 100, 50, 13},
-{14, 10, 100, 50, 14},
-{15, 10, 100, 50, 15},
-{16, 10, 100, 50, 16},
-{17, 10, 100, 50, 17},
-{18, 10, 100, 50, 18},
-{19, 10, 100, 50, 19},
-{20, 10, 100, 50, 20},
-{21, 10, 100, 50, 21},
-{22, 10, 100, 50, 22},
-{23, 10, 100, 50, 23},
-{24, 10, 100, 50, 24},
-{25, 10, 100, 50, 25},
-{26, 10, 100, 50, 26},
-{27, 10, 100, 50, 27},
-{28, 10, 100, 50, 28},
-{29, 10, 100, 50, 29},
-{30, 10, 100, 50, 30},
-{31, 10, 100, 50, 31},
-{32, 10, 100, 50, 32},
-{33, 10, 100, 50, 33},
-{34, 10, 100, 50, 34},
-{35, 10, 100, 50, 35},
-{36, 10, 100, 50, 36},
-{37, 10, 100, 50, 37},
-{38, 10, 100, 50, 38},
-{39, 10, 100, 50, 39},
-{40, 10, 100, 50, 40},
-{41, 10, 100, 50, 41},
-{42, 10, 100, 50, 42},
-{43, 10, 100, 50, 43},
-{44, 10, 100, 50, 44},
-{45, 10, 100, 50, 45},
-{46, 10, 100, 50, 46},
-{47, 10, 100, 50, 47},
-{48, 10, 100, 50, 48},
-{49, 10, 100, 50, 49},
-{50, 10, 100, 50, 50},
-{51, 10, 100, 49, 51},
-{52, 10, 100, 48, 52},
-{53, 10, 100, 47, 53},
-{54, 10, 100, 46, 54},
-{55, 10, 100, 45, 55},
-{56, 10, 100, 44, 56},
-{57, 10, 100, 43, 57},
-{58, 10, 100, 42, 58},
-{59, 10, 100, 41, 59},
-{60, 10, 100, 40, 60},
-{61, 10, 100, 39, 61},
-{62, 10, 100, 38, 62},
-{63, 10, 100, 37, 63},
-{64, 10, 100, 36, 64},
-{65, 10, 100, 35, 65},
-{66, 10, 100, 34, 66},
-{67, 10, 100, 33, 67},
-{68, 10, 100, 32, 68},
-{69, 10, 100, 31, 69},
-{70, 10, 100, 30, 70},
-{71, 10, 100, 29, 71},
-{72, 10, 100, 28, 72},
-{73, 10, 100, 27, 73},
-{74, 10, 100, 26, 74},
-{75, 10, 100, 25, 75},
-{76, 10, 100, 24, 76},
-{77, 10, 100, 23, 77},
-{78, 10, 100, 22, 78},
-{79, 10, 100, 21, 79},
-{80, 10, 100, 20, 80},
-{81, 10, 100, 19, 81},
-{82, 10, 100, 18, 82},
-{83, 10, 100, 17, 83},
-{84, 10, 100, 16, 84},
-{85, 10, 100, 15, 85},
-{86, 10, 100, 14, 86},
-{87, 10, 100, 13, 87},
-{88, 10, 100, 12, 88},
-{89, 10, 100, 11, 89},
-{90, 10, 100, 10, 90},
-{91, 10, 100, 50, 10},
-{92, 10, 100, 50, 10},
-{93, 10, 100, 50, 10},
-{94, 10, 100, 50, 10},
-{95, 10, 100, 50, 10},
-{96, 10, 100, 50, 10},
-{97, 10, 100, 50, 10},
-{98, 10, 100, 50, 10},
-{99, 10, 100, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 0, 100, 50, 10},
-{1, 1, 100, 50, 10},
-{2, 2, 100, 50, 10},
-{3, 3, 100, 50, 10},
-{4, 4, 100, 50, 10},
-{5, 5, 100, 50, 10},
-{6, 6, 100, 50, 10},
-{7, 7, 100, 50, 10},
-{8, 8, 100, 50, 10},
-{9, 9, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 11, 100, 50, 10},
-{12, 12, 100, 50, 10},
-{13, 13, 100, 50, 10},
-{14, 14, 100, 50, 10},
-{15, 15, 100, 50, 10},
-{16, 16, 100, 50, 10},
-{17, 17, 100, 50, 10},
-{18, 18, 100, 50, 10},
-{19, 19, 100, 50, 10},
-{20, 20, 100, 50, 10},
-{21, 21, 100, 50, 10},
-{22, 22, 100, 50, 10},
-{23, 23, 100, 50, 10},
-{24, 24, 100, 50, 10},
-{25, 25, 100, 50, 10},
-{26, 26, 100, 50, 10},
-{27, 27, 100, 50, 10},
-{28, 28, 100, 50, 10},
-{29, 29, 100, 50, 10},
-{30, 30, 100, 50, 10},
-{31, 31, 100, 50, 10},
-{32, 32, 100, 50, 10},
-{33, 33, 100, 50, 10},
-{34, 34, 100, 50, 10},
-{35, 35, 100, 50, 10},
-{36, 36, 100, 50, 10},
-{37, 37, 100, 50, 10},
-{38, 38, 100, 50, 10},
-{39, 39, 100, 50, 10},
-{40, 40, 100, 50, 10},
-{41, 41, 100, 50, 10},
-{42, 42, 100, 50, 10},
-{43, 43, 100, 50, 10},
-{44, 44, 100, 50, 10},
-{45, 45, 100, 50, 10},
-{46, 46, 100, 50, 10},
-{47, 47, 100, 50, 10},
-{48, 48, 100, 50, 10},
-{49, 49, 100, 50, 10},
-{50, 50, 100, 50, 10},
-{51, 51, 100, 51, 10},
-{52, 52, 100, 52, 10},
-{53, 53, 100, 53, 10},
-{54, 54, 100, 54, 10},
-{55, 55, 100, 55, 10},
-{56, 56, 100, 56, 10},
-{57, 57, 100, 57, 10},
-{58, 58, 100, 58, 10},
-{59, 59, 100, 59, 10},
-{60, 60, 100, 60, 10},
-{61, 61, 100, 61, 10},
-{62, 62, 100, 62, 10},
-{63, 63, 100, 63, 10},
-{64, 64, 100, 64, 10},
-{65, 65, 100, 65, 10},
-{66, 66, 100, 66, 10},
-{67, 67, 100, 67, 10},
-{68, 68, 100, 68, 10},
-{69, 69, 100, 69, 10},
-{70, 70, 100, 70, 10},
-{71, 71, 100, 71, 10},
-{72, 72, 100, 72, 10},
-{73, 73, 100, 73, 10},
-{74, 74, 100, 74, 10},
-{75, 75, 100, 75, 10},
-{76, 76, 100, 76, 10},
-{77, 77, 100, 77, 10},
-{78, 78, 100, 78, 10},
-{79, 79, 100, 79, 10},
-{80, 80, 100, 80, 10},
-{81, 81, 100, 81, 10},
-{82, 82, 100, 82, 10},
-{83, 83, 100, 83, 10},
-{84, 84, 100, 84, 10},
-{85, 85, 100, 85, 10},
-{86, 86, 100, 86, 10},
-{87, 87, 100, 87, 10},
-{88, 88, 100, 88, 10},
-{89, 89, 100, 89, 10},
-{90, 90, 100, 90, 10},
-{91, 91, 100, 91, 9},
-{92, 92, 100, 92, 8},
-{93, 93, 100, 93, 7},
-{94, 94, 100, 94, 6},
-{95, 95, 100, 95, 5},
-{96, 96, 100, 96, 4},
-{97, 97, 100, 97, 3},
-{98, 98, 100, 98, 2},
-{99, 99, 100, 99, 1},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 10},
-{2, 10, 100, 50, 10},
-{3, 10, 100, 50, 10},
-{4, 10, 100, 50, 10},
-{5, 10, 100, 50, 10},
-{6, 10, 100, 50, 10},
-{7, 10, 100, 50, 10},
-{8, 10, 100, 50, 10},
-{9, 10, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 10, 11, 10, 1},
-{12, 10, 12, 10, 2},
-{13, 10, 13, 10, 3},
-{14, 10, 14, 10, 4},
-{15, 10, 15, 10, 5},
-{16, 10, 16, 10, 6},
-{17, 10, 17, 10, 7},
-{18, 10, 18, 10, 8},
-{19, 10, 19, 10, 9},
-{20, 10, 20, 10, 10},
-{21, 10, 21, 11, 10},
-{22, 10, 22, 12, 10},
-{23, 10, 23, 13, 10},
-{24, 10, 24, 14, 10},
-{25, 10, 25, 15, 10},
-{26, 10, 26, 16, 10},
-{27, 10, 27, 17, 10},
-{28, 10, 28, 18, 10},
-{29, 10, 29, 19, 10},
-{30, 10, 30, 20, 10},
-{31, 10, 31, 21, 10},
-{32, 10, 32, 22, 10},
-{33, 10, 33, 23, 10},
-{34, 10, 34, 24, 10},
-{35, 10, 35, 25, 10},
-{36, 10, 36, 26, 10},
-{37, 10, 37, 27, 10},
-{38, 10, 38, 28, 10},
-{39, 10, 39, 29, 10},
-{40, 10, 40, 30, 10},
-{41, 10, 41, 31, 10},
-{42, 10, 42, 32, 10},
-{43, 10, 43, 33, 10},
-{44, 10, 44, 34, 10},
-{45, 10, 45, 35, 10},
-{46, 10, 46, 36, 10},
-{47, 10, 47, 37, 10},
-{48, 10, 48, 38, 10},
-{49, 10, 49, 39, 10},
-{50, 10, 50, 40, 10},
-{51, 10, 51, 41, 10},
-{52, 10, 52, 42, 10},
-{53, 10, 53, 43, 10},
-{54, 10, 54, 44, 10},
-{55, 10, 55, 45, 10},
-{56, 10, 56, 46, 10},
-{57, 10, 57, 47, 10},
-{58, 10, 58, 48, 10},
-{59, 10, 59, 49, 10},
-{60, 10, 60, 50, 10},
-{61, 10, 61, 50, 10},
-{62, 10, 62, 50, 10},
-{63, 10, 63, 50, 10},
-{64, 10, 64, 50, 10},
-{65, 10, 65, 50, 10},
-{66, 10, 66, 50, 10},
-{67, 10, 67, 50, 10},
-{68, 10, 68, 50, 10},
-{69, 10, 69, 50, 10},
-{70, 10, 70, 50, 10},
-{71, 10, 71, 50, 10},
-{72, 10, 72, 50, 10},
-{73, 10, 73, 50, 10},
-{74, 10, 74, 50, 10},
-{75, 10, 75, 50, 10},
-{76, 10, 76, 50, 10},
-{77, 10, 77, 50, 10},
-{78, 10, 78, 50, 10},
-{79, 10, 79, 50, 10},
-{80, 10, 80, 50, 10},
-{81, 10, 81, 50, 10},
-{82, 10, 82, 50, 10},
-{83, 10, 83, 50, 10},
-{84, 10, 84, 50, 10},
-{85, 10, 85, 50, 10},
-{86, 10, 86, 50, 10},
-{87, 10, 87, 50, 10},
-{88, 10, 88, 50, 10},
-{89, 10, 89, 50, 10},
-{90, 10, 90, 50, 10},
-{91, 10, 91, 50, 10},
-{92, 10, 92, 50, 10},
-{93, 10, 93, 50, 10},
-{94, 10, 94, 50, 10},
-{95, 10, 95, 50, 10},
-{96, 10, 96, 50, 10},
-{97, 10, 97, 50, 10},
-{98, 10, 98, 50, 10},
-{99, 10, 99, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 101, 50, 10},
-{102, 10, 102, 50, 10},
-{103, 10, 103, 50, 10},
-{104, 10, 104, 50, 10},
-{105, 10, 105, 50, 10},
-{106, 10, 106, 50, 10},
-{107, 10, 107, 50, 10},
-{108, 10, 108, 50, 10},
-{109, 10, 109, 50, 10},
-{110, 10, 110, 50, 10},
-{111, 10, 111, 50, 10},
-{112, 10, 112, 50, 10},
-{113, 10, 113, 50, 10},
-{114, 10, 114, 50, 10},
-{115, 10, 115, 50, 10},
-{116, 10, 116, 50, 10},
-{117, 10, 117, 50, 10},
-{118, 10, 118, 50, 10},
-{119, 10, 119, 50, 10},
-{120, 10, 120, 50, 10},
-{121, 10, 121, 50, 10},
-{122, 10, 122, 50, 10},
-{123, 10, 123, 50, 10},
-{124, 10, 124, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scrollBar.setMaximum(100);
- scrollBar.setMinimum(10);
- scrollBar.setThumb(10);
- scrollBar.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 10, 10},
-{1, 10, 100, 10, 10},
-{2, 10, 100, 10, 10},
-{3, 10, 100, 10, 10},
-{4, 10, 100, 10, 10},
-{5, 10, 100, 10, 10},
-{6, 10, 100, 10, 10},
-{7, 10, 100, 10, 10},
-{8, 10, 100, 10, 10},
-{9, 10, 100, 10, 10},
-{10, 10, 100, 10, 10},
-{11, 10, 100, 11, 10},
-{12, 10, 100, 12, 10},
-{13, 10, 100, 13, 10},
-{14, 10, 100, 14, 10},
-{15, 10, 100, 15, 10},
-{16, 10, 100, 16, 10},
-{17, 10, 100, 17, 10},
-{18, 10, 100, 18, 10},
-{19, 10, 100, 19, 10},
-{20, 10, 100, 20, 10},
-{21, 10, 100, 21, 10},
-{22, 10, 100, 22, 10},
-{23, 10, 100, 23, 10},
-{24, 10, 100, 24, 10},
-{25, 10, 100, 25, 10},
-{26, 10, 100, 26, 10},
-{27, 10, 100, 27, 10},
-{28, 10, 100, 28, 10},
-{29, 10, 100, 29, 10},
-{30, 10, 100, 30, 10},
-{31, 10, 100, 31, 10},
-{32, 10, 100, 32, 10},
-{33, 10, 100, 33, 10},
-{34, 10, 100, 34, 10},
-{35, 10, 100, 35, 10},
-{36, 10, 100, 36, 10},
-{37, 10, 100, 37, 10},
-{38, 10, 100, 38, 10},
-{39, 10, 100, 39, 10},
-{40, 10, 100, 40, 10},
-{41, 10, 100, 41, 10},
-{42, 10, 100, 42, 10},
-{43, 10, 100, 43, 10},
-{44, 10, 100, 44, 10},
-{45, 10, 100, 45, 10},
-{46, 10, 100, 46, 10},
-{47, 10, 100, 47, 10},
-{48, 10, 100, 48, 10},
-{49, 10, 100, 49, 10},
-{50, 10, 100, 50, 10},
-{51, 10, 100, 51, 10},
-{52, 10, 100, 52, 10},
-{53, 10, 100, 53, 10},
-{54, 10, 100, 54, 10},
-{55, 10, 100, 55, 10},
-{56, 10, 100, 56, 10},
-{57, 10, 100, 57, 10},
-{58, 10, 100, 58, 10},
-{59, 10, 100, 59, 10},
-{60, 10, 100, 60, 10},
-{61, 10, 100, 61, 10},
-{62, 10, 100, 62, 10},
-{63, 10, 100, 63, 10},
-{64, 10, 100, 64, 10},
-{65, 10, 100, 65, 10},
-{66, 10, 100, 66, 10},
-{67, 10, 100, 67, 10},
-{68, 10, 100, 68, 10},
-{69, 10, 100, 69, 10},
-{70, 10, 100, 70, 10},
-{71, 10, 100, 71, 10},
-{72, 10, 100, 72, 10},
-{73, 10, 100, 73, 10},
-{74, 10, 100, 74, 10},
-{75, 10, 100, 75, 10},
-{76, 10, 100, 76, 10},
-{77, 10, 100, 77, 10},
-{78, 10, 100, 78, 10},
-{79, 10, 100, 79, 10},
-{80, 10, 100, 80, 10},
-{81, 10, 100, 81, 10},
-{82, 10, 100, 82, 10},
-{83, 10, 100, 83, 10},
-{84, 10, 100, 84, 10},
-{85, 10, 100, 85, 10},
-{86, 10, 100, 86, 10},
-{87, 10, 100, 87, 10},
-{88, 10, 100, 88, 10},
-{89, 10, 100, 89, 10},
-{90, 10, 100, 90, 10},
-{91, 10, 100, 90, 10},
-{92, 10, 100, 90, 10},
-{93, 10, 100, 90, 10},
-{94, 10, 100, 90, 10},
-{95, 10, 100, 90, 10},
-{96, 10, 100, 90, 10},
-{97, 10, 100, 90, 10},
-{98, 10, 100, 90, 10},
-{99, 10, 100, 90, 10},
-{100, 10, 100, 90, 10},
-{101, 10, 100, 90, 10},
-{102, 10, 100, 90, 10},
-{103, 10, 100, 90, 10},
-{104, 10, 100, 90, 10},
-{105, 10, 100, 90, 10},
-{106, 10, 100, 90, 10},
-{107, 10, 100, 90, 10},
-{108, 10, 100, 90, 10},
-{109, 10, 100, 90, 10},
-{110, 10, 100, 90, 10},
-{111, 10, 100, 90, 10},
-{112, 10, 100, 90, 10},
-{113, 10, 100, 90, 10},
-{114, 10, 100, 90, 10},
-{115, 10, 100, 90, 10},
-{116, 10, 100, 90, 10},
-{117, 10, 100, 90, 10},
-{118, 10, 100, 90, 10},
-{119, 10, 100, 90, 10},
-{120, 10, 100, 90, 10},
-{121, 10, 100, 90, 10},
-{122, 10, 100, 90, 10},
-{123, 10, 100, 90, 10},
-{124, 10, 100, 90, 10},
-};
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-public void test_getIncrement() {
- warnUnimpl("Test test_getIncrement not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getPageIncrement() {
- warnUnimpl("Test test_getPageIncrement not written");
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSize() {
- warnUnimpl("Test test_getSize not written");
-}
-
-public void test_getThumb() {
- warnUnimpl("Test test_getThumb not written");
-}
-
-public void test_getVisible() {
- warnUnimpl("Test test_getVisible not written");
-}
-
-public void test_isEnabled() {
- warnUnimpl("Test test_isEnabled not written");
-}
-
-public void test_isVisible() {
- warnUnimpl("Test test_isVisible not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- */
-public void test_setIncrementI() {
- int[] cases = {1, 10, 10000};
- for (int i=0; i < cases.length; i++)
- {
- scrollBar.setIncrement(cases[i]);
- assertEquals(cases[i], scrollBar.getIncrement());
- }
-
- scrollBar.setIncrement(25);
- scrollBar.setIncrement(0); // setting to 0 fails silently
- assertEquals(25, scrollBar.getIncrement());
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- */
-public void test_setPageIncrementI(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- scrollBar.setPageIncrement(cases[i]);
- assertEquals(scrollBar.getPageIncrement(), cases[i]);
- }
-
- scrollBar.setPageIncrement(25);
- scrollBar.setPageIncrement(0); // setting to 0 fails silently
- assertEquals(25, scrollBar.getPageIncrement());
-}
-
-/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI(){
- int [][] testValues = getSetSelectionValues();
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- */
-public void test_setThumbI(){
- int [][] testValues = getSetThumbValues();
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setThumb(intArray[0]);
- report("setThumb", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-public void test_setValuesIIIIII() {
- warnUnimpl("Test test_setValuesIIIIII not written");
-}
-
-public void test_setVisibleZ() {
- warnUnimpl("Test test_setVisibleZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ScrollBar((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getIncrement");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getPageIncrement");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSize");
- methodNames.addElement("test_getThumb");
- methodNames.addElement("test_getVisible");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_isVisible");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setIncrementI");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setPageIncrementI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setThumbI");
- methodNames.addElement("test_setValuesIIIIII");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getIncrement")) test_getIncrement();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getPageIncrement")) test_getPageIncrement();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSize")) test_getSize();
- else if (getName().equals("test_getThumb")) test_getThumb();
- else if (getName().equals("test_getVisible")) test_getVisible();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_isVisible")) test_isVisible();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setIncrementI")) test_setIncrementI();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setThumbI")) test_setThumbI();
- else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java
deleted file mode 100644
index f161aa3ab9..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Scrollable
- *
- * @see org.eclipse.swt.widgets.Scrollable
- */
-public class Test_org_eclipse_swt_widgets_Scrollable extends Test_org_eclipse_swt_widgets_Control {
-
- Scrollable scrollable;
-
-public Test_org_eclipse_swt_widgets_Scrollable(String name) {
- super(name);
-}
-
-protected void setUp() {
- super.setUp();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-protected void setWidget(Widget w) {
- scrollable = (Scrollable)w;
- super.setWidget(w);
-}
-
-public void test_computeTrimIIII() {
- scrollable.computeTrim(0, 0, 0, 0);
-}
-
-public void test_getClientArea() {
- scrollable.getClientArea();
-}
-
-public void test_getHorizontalBar() {
- ScrollBar hbar = scrollable.getHorizontalBar();
-}
-
-public void test_getVerticalBar() {
- ScrollBar vbar = scrollable.getVerticalBar();
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getHorizontalBar");
- methodNames.addElement("test_getVerticalBar");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getHorizontalBar")) test_getHorizontalBar();
- else if (getName().equals("test_getVerticalBar")) test_getVerticalBar();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java
deleted file mode 100644
index 6162ae133e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Shell
- *
- * @see org.eclipse.swt.widgets.Shell
- */
-public class Test_org_eclipse_swt_widgets_Shell extends Test_org_eclipse_swt_widgets_Decorations {
-
-Shell testShell;
-
-public Test_org_eclipse_swt_widgets_Shell(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- testShell = new Shell(shell, SWT.NULL);
- setWidget(shell);
- assertTrue(testShell.getParent() == shell);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_Constructor() {
- warnUnimpl("Test test_Constructor not written");
-}
-
-public void test_ConstructorI(){
- /* this should test various combinations of STYLE bits, for now just test individual bits */
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(cases[i]);
- assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay());
- newShell.dispose();
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Display(){
- Display display = shell.getDisplay();
- Shell newShell = new Shell(display);
- assertTrue("a: ", newShell.getDisplay() == display);
- newShell.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI(){
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- Display display = shell.getDisplay();
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(display, cases[i]);
- assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay());
- newShell.dispose();
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
- Shell newShell = new Shell(shell);
- assertTrue("a: ", newShell.getParent() == shell);
- newShell.dispose();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI(){
- /* this should test various combinations of STYLE bits, for now just test individual bits */
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(shell, cases[i]);
- assertTrue("a " +i, newShell.getParent() == shell);
- newShell.dispose();
- }
-}
-
-public void test_win32_newLorg_eclipse_swt_widgets_DisplayI() {
- // do not test - Windows only
-}
-
-public void test_addShellListenerLorg_eclipse_swt_events_ShellListener() {
- warnUnimpl("Test test_addShellListenerLorg_eclipse_swt_events_ShellListener not written");
-}
-
-public void test_close(){
-
- // bogus line that 'enabled' gpfs
- // Shell newShell = new Shell();
- testShell.setBounds(20,30,200, 200);
- testShell.open();
- testShell.close();
- shell.setBounds(20,30,200, 200);
- shell.open();
-}
-
-public void test_dispose(){
- Shell newShell = new Shell();
- newShell.dispose();
-}
-
-public void test_getBounds() {
- // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle
-}
-
-public void test_getDisplay(){
- assertTrue( shell.getDisplay() == testShell.getDisplay());
-}
-
-public void test_getEnabled(){
- assertTrue(":a0:", shell.getEnabled());
- shell.setEnabled(false);
- assertTrue(":a:", !shell.getEnabled());
- shell.setEnabled(true);
- assertTrue(":b:", shell.getEnabled());
-}
-
-public void test_getImeInputMode() {
- warnUnimpl("Test test_getImeInputMode not written");
-}
-
-public void test_getLocation() {
- warnUnimpl("Test test_getLocation not written");
-}
-
-public void test_getParent () {
- // overriding Control.test_getParent
- assertTrue(shell.getParent()==null);
- assertTrue(testShell.getParent() == shell);
-}
-
-public void test_getShell () {
- assertTrue(":a:", shell.getShell()==shell);
- Shell shell_1 = new Shell(shell);
- assertTrue(":b:", shell_1.getShell()== shell_1);
- shell_1.dispose();
-}
-
-public void test_getShells() {
- warnUnimpl("Test test_getShells not written");
-}
-
-public void test_getStyle() {
- // overriding Widget.test_getStyle
- assertTrue("testShell not modeless", (testShell.getStyle () & SWT.MODELESS) == SWT.MODELESS);
- int[] cases = {SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL};
- for (int i = 0; i < cases.length; i++) {
- Shell testShell2 = new Shell(shell, cases[i]);
- assertTrue("shell " + i, (testShell2.getStyle () & cases[i]) == cases[i]);
- testShell2.dispose();
- }
-}
-
-public void test_isEnabled(){
- assertTrue(":a:", shell.isEnabled());
- shell.setEnabled(false);
- assertTrue(":b:", !shell.isEnabled());
- if (fCheckBogusTestCases)
- assertTrue(":b1:", !testShell.isEnabled());
- shell.setEnabled(true);
- assertTrue(":c:", shell.isEnabled());
- assertTrue(":a:", testShell.isEnabled());
- testShell.setEnabled(false);
- assertTrue(":b:", !testShell.isEnabled());
- testShell.setEnabled(true);
- assertTrue(":c:", testShell.isEnabled());
-}
-
-public void test_isVisible() {
- // overriding Control.test_isVisible
- testShell.setVisible(true);
- assertTrue(testShell.isVisible());
- shell.setVisible(true);
- assertTrue(shell.isVisible());
-
- testShell.setVisible(true);
- shell.setVisible(true);
- assertTrue("shell.isVisible() a:", shell.isVisible());
- shell.setVisible(false);
- assertTrue("shell.isVisible() b:", !shell.isVisible());
- if (fCheckBogusTestCases)
- assertTrue("testShell.isVisible() c:", !testShell.isVisible());
-}
-
-public void test_open(){
- shell.open();
-}
-
-public void test_removeShellListenerLorg_eclipse_swt_events_ShellListener() {
- warnUnimpl("Test test_removeShellListenerLorg_eclipse_swt_events_ShellListener not written");
-}
-
-public void test_setBoundsIIII() {
- // overridden from Control because Shells have a minimum size
-}
-
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- // overridden from Control because Shells have a minimum size
-// /* windows */
-// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */
-// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */
-// if (SwtJunit.isWindows) {
-// Point p1 = new Point(112, 27);
-// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y);
-// Rectangle r2;
-// for (int i = 0; i < 11; i++) {
-// testShell.setBounds(r1);
-// r2 = testShell.getBounds();
-// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2));
-// r1.width += 100;
-// r1.height += 100;
-// }
-// r1 = new Rectangle(20, 30, p1.x, p1.y);
-// for (int i = 0; i < 11; i++) {
-// shell.setBounds(r1);
-// r2 = shell.getBounds();
-// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2));
-// r1.width += 100;
-// r1.height += 100;
-// }
-// }
-// /* motif */
-// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */
-// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */
-// if (SwtJunit.isMotif) {
-// Point p1 = new Point(15,35);
-// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y);
-// Rectangle r2;
-//
-// for (int i = 0; i < 15; i++) {
-// testShell.setBounds(r1);
-// r2 = testShell.getBounds();
-// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2));
-// r1.width += 100;
-// r1.height += 100;
-// }
-// r1 = new Rectangle(50, 50, p1.x, p1.y);
-// for (int i = 0; i < 11; i++) {
-// shell.setBounds(r1);
-// r2 = shell.getBounds();
-// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2));
-// r1.width += 100;
-// r1.height += 100;
-// }
-// }
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-public void test_setImeInputModeI() {
- warnUnimpl("Test test_setImeInputModeI not written");
-}
-
-public void test_setSizeII() {
- /* windows */
- /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */
- /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */
- if (SwtJunit.isWindows) {
- Point newSize = new Point(112, 27);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize.x, newSize.y);
- assertEquals(newSize, testShell.getSize());
- newSize.x += 100;
- newSize.y += 100;
- }
- newSize = new Point(1292, 1036);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize.x, newSize.y);
- assertEquals(newSize, testShell.getSize());
- newSize.x -= 100;
- newSize.y -= 100;
- }
- }
-
- /* motif */
- /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */
- /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */
- if (SwtJunit.isMotif) {
- Point newSize = new Point(2, 2);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize.x, newSize.y);
- assertEquals(newSize, testShell.getSize());
- newSize.x += 100;
- newSize.y += 100;
- }
- newSize = new Point(1600, 1600);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize.x, newSize.y);
- assertEquals(newSize, testShell.getSize());
- newSize.x -= 100;
- newSize.y -= 100;
- }
- }
-}
-
-public void test_setSizeLorg_eclipse_swt_graphics_Point() {
- /* windows */
- /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */
- /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */
- if (SwtJunit.isWindows) {
- Point newSize = new Point(112, 27);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize);
- assertEquals(newSize, testShell.getSize());
- newSize.x += 100;
- newSize.y += 100;
- }
- newSize = new Point(1292, 1036);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize);
- assertEquals(newSize, testShell.getSize());
- newSize.x -= 100;
- newSize.y -= 100;
- }
- }
-
- /* motif */
- /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */
- /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */
- if (SwtJunit.isMotif) {
- Point newSize = new Point(2, 2);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize);
- assertEquals(newSize, testShell.getSize());
- newSize.x += 100;
- newSize.y += 100;
- }
- newSize = new Point(1600, 1600);
- for (int i = 0; i < 10; i++) {
- testShell.setSize(newSize);
- assertEquals(newSize, testShell.getSize());
- newSize.x -= 100;
- newSize.y -= 100;
- }
- }
-}
-
-public void test_setVisibleZ() {
- warnUnimpl("Test test_setVisibleZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Shell((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_Constructor");
- methodNames.addElement("test_ConstructorI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_win32_newLorg_eclipse_swt_widgets_DisplayI");
- methodNames.addElement("test_addShellListenerLorg_eclipse_swt_events_ShellListener");
- methodNames.addElement("test_close");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getImeInputMode");
- methodNames.addElement("test_getLocation");
- methodNames.addElement("test_getShell");
- methodNames.addElement("test_getShells");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_open");
- methodNames.addElement("test_removeShellListenerLorg_eclipse_swt_events_ShellListener");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setImeInputModeI");
- methodNames.addElement("test_setVisibleZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Decorations.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_Constructor")) test_Constructor();
- else if (getName().equals("test_ConstructorI")) test_ConstructorI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_win32_newLorg_eclipse_swt_widgets_DisplayI")) test_win32_newLorg_eclipse_swt_widgets_DisplayI();
- else if (getName().equals("test_addShellListenerLorg_eclipse_swt_events_ShellListener")) test_addShellListenerLorg_eclipse_swt_events_ShellListener();
- else if (getName().equals("test_close")) test_close();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getImeInputMode")) test_getImeInputMode();
- else if (getName().equals("test_getLocation")) test_getLocation();
- else if (getName().equals("test_getShell")) test_getShell();
- else if (getName().equals("test_getShells")) test_getShells();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_removeShellListenerLorg_eclipse_swt_events_ShellListener")) test_removeShellListenerLorg_eclipse_swt_events_ShellListener();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setImeInputModeI")) test_setImeInputModeI();
- else if (getName().equals("test_setVisibleZ")) test_setVisibleZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java
deleted file mode 100644
index 85c5fc5e38..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java
+++ /dev/null
@@ -1,841 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Slider
- *
- * @see org.eclipse.swt.widgets.Slider
- */
-public class Test_org_eclipse_swt_widgets_Slider extends Test_org_eclipse_swt_widgets_Control {
-
-Slider slider;
-
-public Test_org_eclipse_swt_widgets_Slider(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- slider = new Slider(shell, 0);
- setWidget(slider);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (slider.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + slider.getMinimum());
- //if (slider.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + slider.getMaximum());
- //if (slider.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + slider.getSelection());
- //if (slider.getThumb() != thumbExpected)
- //System.out.println(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + slider.getThumb());
-
- check(call, set, minExpected, maxExpected, selectionExpected, thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- assertTrue(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + slider.getMaximum(), slider.getMaximum() == maxExpected);
- assertTrue(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + slider.getMinimum(), slider.getMinimum() == minExpected);
- assertTrue(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + slider.getSelection(), slider.getSelection() == selectionExpected);
- assertTrue(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + slider.getThumb(), slider.getThumb() == thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetThumbValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 1},
-{2, 10, 100, 50, 2},
-{3, 10, 100, 50, 3},
-{4, 10, 100, 50, 4},
-{5, 10, 100, 50, 5},
-{6, 10, 100, 50, 6},
-{7, 10, 100, 50, 7},
-{8, 10, 100, 50, 8},
-{9, 10, 100, 50, 9},
-{10, 10, 100, 50, 10},
-{11, 10, 100, 50, 11},
-{12, 10, 100, 50, 12},
-{13, 10, 100, 50, 13},
-{14, 10, 100, 50, 14},
-{15, 10, 100, 50, 15},
-{16, 10, 100, 50, 16},
-{17, 10, 100, 50, 17},
-{18, 10, 100, 50, 18},
-{19, 10, 100, 50, 19},
-{20, 10, 100, 50, 20},
-{21, 10, 100, 50, 21},
-{22, 10, 100, 50, 22},
-{23, 10, 100, 50, 23},
-{24, 10, 100, 50, 24},
-{25, 10, 100, 50, 25},
-{26, 10, 100, 50, 26},
-{27, 10, 100, 50, 27},
-{28, 10, 100, 50, 28},
-{29, 10, 100, 50, 29},
-{30, 10, 100, 50, 30},
-{31, 10, 100, 50, 31},
-{32, 10, 100, 50, 32},
-{33, 10, 100, 50, 33},
-{34, 10, 100, 50, 34},
-{35, 10, 100, 50, 35},
-{36, 10, 100, 50, 36},
-{37, 10, 100, 50, 37},
-{38, 10, 100, 50, 38},
-{39, 10, 100, 50, 39},
-{40, 10, 100, 50, 40},
-{41, 10, 100, 50, 41},
-{42, 10, 100, 50, 42},
-{43, 10, 100, 50, 43},
-{44, 10, 100, 50, 44},
-{45, 10, 100, 50, 45},
-{46, 10, 100, 50, 46},
-{47, 10, 100, 50, 47},
-{48, 10, 100, 50, 48},
-{49, 10, 100, 50, 49},
-{50, 10, 100, 50, 50},
-{51, 10, 100, 49, 51},
-{52, 10, 100, 48, 52},
-{53, 10, 100, 47, 53},
-{54, 10, 100, 46, 54},
-{55, 10, 100, 45, 55},
-{56, 10, 100, 44, 56},
-{57, 10, 100, 43, 57},
-{58, 10, 100, 42, 58},
-{59, 10, 100, 41, 59},
-{60, 10, 100, 40, 60},
-{61, 10, 100, 39, 61},
-{62, 10, 100, 38, 62},
-{63, 10, 100, 37, 63},
-{64, 10, 100, 36, 64},
-{65, 10, 100, 35, 65},
-{66, 10, 100, 34, 66},
-{67, 10, 100, 33, 67},
-{68, 10, 100, 32, 68},
-{69, 10, 100, 31, 69},
-{70, 10, 100, 30, 70},
-{71, 10, 100, 29, 71},
-{72, 10, 100, 28, 72},
-{73, 10, 100, 27, 73},
-{74, 10, 100, 26, 74},
-{75, 10, 100, 25, 75},
-{76, 10, 100, 24, 76},
-{77, 10, 100, 23, 77},
-{78, 10, 100, 22, 78},
-{79, 10, 100, 21, 79},
-{80, 10, 100, 20, 80},
-{81, 10, 100, 19, 81},
-{82, 10, 100, 18, 82},
-{83, 10, 100, 17, 83},
-{84, 10, 100, 16, 84},
-{85, 10, 100, 15, 85},
-{86, 10, 100, 14, 86},
-{87, 10, 100, 13, 87},
-{88, 10, 100, 12, 88},
-{89, 10, 100, 11, 89},
-{90, 10, 100, 10, 90},
-{91, 10, 100, 50, 10},
-{92, 10, 100, 50, 10},
-{93, 10, 100, 50, 10},
-{94, 10, 100, 50, 10},
-{95, 10, 100, 50, 10},
-{96, 10, 100, 50, 10},
-{97, 10, 100, 50, 10},
-{98, 10, 100, 50, 10},
-{99, 10, 100, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 0, 100, 50, 10},
-{1, 1, 100, 50, 10},
-{2, 2, 100, 50, 10},
-{3, 3, 100, 50, 10},
-{4, 4, 100, 50, 10},
-{5, 5, 100, 50, 10},
-{6, 6, 100, 50, 10},
-{7, 7, 100, 50, 10},
-{8, 8, 100, 50, 10},
-{9, 9, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 11, 100, 50, 10},
-{12, 12, 100, 50, 10},
-{13, 13, 100, 50, 10},
-{14, 14, 100, 50, 10},
-{15, 15, 100, 50, 10},
-{16, 16, 100, 50, 10},
-{17, 17, 100, 50, 10},
-{18, 18, 100, 50, 10},
-{19, 19, 100, 50, 10},
-{20, 20, 100, 50, 10},
-{21, 21, 100, 50, 10},
-{22, 22, 100, 50, 10},
-{23, 23, 100, 50, 10},
-{24, 24, 100, 50, 10},
-{25, 25, 100, 50, 10},
-{26, 26, 100, 50, 10},
-{27, 27, 100, 50, 10},
-{28, 28, 100, 50, 10},
-{29, 29, 100, 50, 10},
-{30, 30, 100, 50, 10},
-{31, 31, 100, 50, 10},
-{32, 32, 100, 50, 10},
-{33, 33, 100, 50, 10},
-{34, 34, 100, 50, 10},
-{35, 35, 100, 50, 10},
-{36, 36, 100, 50, 10},
-{37, 37, 100, 50, 10},
-{38, 38, 100, 50, 10},
-{39, 39, 100, 50, 10},
-{40, 40, 100, 50, 10},
-{41, 41, 100, 50, 10},
-{42, 42, 100, 50, 10},
-{43, 43, 100, 50, 10},
-{44, 44, 100, 50, 10},
-{45, 45, 100, 50, 10},
-{46, 46, 100, 50, 10},
-{47, 47, 100, 50, 10},
-{48, 48, 100, 50, 10},
-{49, 49, 100, 50, 10},
-{50, 50, 100, 50, 10},
-{51, 51, 100, 51, 10},
-{52, 52, 100, 52, 10},
-{53, 53, 100, 53, 10},
-{54, 54, 100, 54, 10},
-{55, 55, 100, 55, 10},
-{56, 56, 100, 56, 10},
-{57, 57, 100, 57, 10},
-{58, 58, 100, 58, 10},
-{59, 59, 100, 59, 10},
-{60, 60, 100, 60, 10},
-{61, 61, 100, 61, 10},
-{62, 62, 100, 62, 10},
-{63, 63, 100, 63, 10},
-{64, 64, 100, 64, 10},
-{65, 65, 100, 65, 10},
-{66, 66, 100, 66, 10},
-{67, 67, 100, 67, 10},
-{68, 68, 100, 68, 10},
-{69, 69, 100, 69, 10},
-{70, 70, 100, 70, 10},
-{71, 71, 100, 71, 10},
-{72, 72, 100, 72, 10},
-{73, 73, 100, 73, 10},
-{74, 74, 100, 74, 10},
-{75, 75, 100, 75, 10},
-{76, 76, 100, 76, 10},
-{77, 77, 100, 77, 10},
-{78, 78, 100, 78, 10},
-{79, 79, 100, 79, 10},
-{80, 80, 100, 80, 10},
-{81, 81, 100, 81, 10},
-{82, 82, 100, 82, 10},
-{83, 83, 100, 83, 10},
-{84, 84, 100, 84, 10},
-{85, 85, 100, 85, 10},
-{86, 86, 100, 86, 10},
-{87, 87, 100, 87, 10},
-{88, 88, 100, 88, 10},
-{89, 89, 100, 89, 10},
-{90, 90, 100, 90, 10},
-{91, 91, 100, 91, 9},
-{92, 92, 100, 92, 8},
-{93, 93, 100, 93, 7},
-{94, 94, 100, 94, 6},
-{95, 95, 100, 95, 5},
-{96, 96, 100, 96, 4},
-{97, 97, 100, 97, 3},
-{98, 98, 100, 98, 2},
-{99, 99, 100, 99, 1},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 10},
-{2, 10, 100, 50, 10},
-{3, 10, 100, 50, 10},
-{4, 10, 100, 50, 10},
-{5, 10, 100, 50, 10},
-{6, 10, 100, 50, 10},
-{7, 10, 100, 50, 10},
-{8, 10, 100, 50, 10},
-{9, 10, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 10, 11, 10, 1},
-{12, 10, 12, 10, 2},
-{13, 10, 13, 10, 3},
-{14, 10, 14, 10, 4},
-{15, 10, 15, 10, 5},
-{16, 10, 16, 10, 6},
-{17, 10, 17, 10, 7},
-{18, 10, 18, 10, 8},
-{19, 10, 19, 10, 9},
-{20, 10, 20, 10, 10},
-{21, 10, 21, 11, 10},
-{22, 10, 22, 12, 10},
-{23, 10, 23, 13, 10},
-{24, 10, 24, 14, 10},
-{25, 10, 25, 15, 10},
-{26, 10, 26, 16, 10},
-{27, 10, 27, 17, 10},
-{28, 10, 28, 18, 10},
-{29, 10, 29, 19, 10},
-{30, 10, 30, 20, 10},
-{31, 10, 31, 21, 10},
-{32, 10, 32, 22, 10},
-{33, 10, 33, 23, 10},
-{34, 10, 34, 24, 10},
-{35, 10, 35, 25, 10},
-{36, 10, 36, 26, 10},
-{37, 10, 37, 27, 10},
-{38, 10, 38, 28, 10},
-{39, 10, 39, 29, 10},
-{40, 10, 40, 30, 10},
-{41, 10, 41, 31, 10},
-{42, 10, 42, 32, 10},
-{43, 10, 43, 33, 10},
-{44, 10, 44, 34, 10},
-{45, 10, 45, 35, 10},
-{46, 10, 46, 36, 10},
-{47, 10, 47, 37, 10},
-{48, 10, 48, 38, 10},
-{49, 10, 49, 39, 10},
-{50, 10, 50, 40, 10},
-{51, 10, 51, 41, 10},
-{52, 10, 52, 42, 10},
-{53, 10, 53, 43, 10},
-{54, 10, 54, 44, 10},
-{55, 10, 55, 45, 10},
-{56, 10, 56, 46, 10},
-{57, 10, 57, 47, 10},
-{58, 10, 58, 48, 10},
-{59, 10, 59, 49, 10},
-{60, 10, 60, 50, 10},
-{61, 10, 61, 50, 10},
-{62, 10, 62, 50, 10},
-{63, 10, 63, 50, 10},
-{64, 10, 64, 50, 10},
-{65, 10, 65, 50, 10},
-{66, 10, 66, 50, 10},
-{67, 10, 67, 50, 10},
-{68, 10, 68, 50, 10},
-{69, 10, 69, 50, 10},
-{70, 10, 70, 50, 10},
-{71, 10, 71, 50, 10},
-{72, 10, 72, 50, 10},
-{73, 10, 73, 50, 10},
-{74, 10, 74, 50, 10},
-{75, 10, 75, 50, 10},
-{76, 10, 76, 50, 10},
-{77, 10, 77, 50, 10},
-{78, 10, 78, 50, 10},
-{79, 10, 79, 50, 10},
-{80, 10, 80, 50, 10},
-{81, 10, 81, 50, 10},
-{82, 10, 82, 50, 10},
-{83, 10, 83, 50, 10},
-{84, 10, 84, 50, 10},
-{85, 10, 85, 50, 10},
-{86, 10, 86, 50, 10},
-{87, 10, 87, 50, 10},
-{88, 10, 88, 50, 10},
-{89, 10, 89, 50, 10},
-{90, 10, 90, 50, 10},
-{91, 10, 91, 50, 10},
-{92, 10, 92, 50, 10},
-{93, 10, 93, 50, 10},
-{94, 10, 94, 50, 10},
-{95, 10, 95, 50, 10},
-{96, 10, 96, 50, 10},
-{97, 10, 97, 50, 10},
-{98, 10, 98, 50, 10},
-{99, 10, 99, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 101, 50, 10},
-{102, 10, 102, 50, 10},
-{103, 10, 103, 50, 10},
-{104, 10, 104, 50, 10},
-{105, 10, 105, 50, 10},
-{106, 10, 106, 50, 10},
-{107, 10, 107, 50, 10},
-{108, 10, 108, 50, 10},
-{109, 10, 109, 50, 10},
-{110, 10, 110, 50, 10},
-{111, 10, 111, 50, 10},
-{112, 10, 112, 50, 10},
-{113, 10, 113, 50, 10},
-{114, 10, 114, 50, 10},
-{115, 10, 115, 50, 10},
-{116, 10, 116, 50, 10},
-{117, 10, 117, 50, 10},
-{118, 10, 118, 50, 10},
-{119, 10, 119, 50, 10},
-{120, 10, 120, 50, 10},
-{121, 10, 121, 50, 10},
-{122, 10, 122, 50, 10},
-{123, 10, 123, 50, 10},
-{124, 10, 124, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
-
- slider.setMaximum(100);
- slider.setMinimum(10);
- slider.setThumb(10);
- slider.setSelection(50);
-
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 10, 10},
-{1, 10, 100, 10, 10},
-{2, 10, 100, 10, 10},
-{3, 10, 100, 10, 10},
-{4, 10, 100, 10, 10},
-{5, 10, 100, 10, 10},
-{6, 10, 100, 10, 10},
-{7, 10, 100, 10, 10},
-{8, 10, 100, 10, 10},
-{9, 10, 100, 10, 10},
-{10, 10, 100, 10, 10},
-{11, 10, 100, 11, 10},
-{12, 10, 100, 12, 10},
-{13, 10, 100, 13, 10},
-{14, 10, 100, 14, 10},
-{15, 10, 100, 15, 10},
-{16, 10, 100, 16, 10},
-{17, 10, 100, 17, 10},
-{18, 10, 100, 18, 10},
-{19, 10, 100, 19, 10},
-{20, 10, 100, 20, 10},
-{21, 10, 100, 21, 10},
-{22, 10, 100, 22, 10},
-{23, 10, 100, 23, 10},
-{24, 10, 100, 24, 10},
-{25, 10, 100, 25, 10},
-{26, 10, 100, 26, 10},
-{27, 10, 100, 27, 10},
-{28, 10, 100, 28, 10},
-{29, 10, 100, 29, 10},
-{30, 10, 100, 30, 10},
-{31, 10, 100, 31, 10},
-{32, 10, 100, 32, 10},
-{33, 10, 100, 33, 10},
-{34, 10, 100, 34, 10},
-{35, 10, 100, 35, 10},
-{36, 10, 100, 36, 10},
-{37, 10, 100, 37, 10},
-{38, 10, 100, 38, 10},
-{39, 10, 100, 39, 10},
-{40, 10, 100, 40, 10},
-{41, 10, 100, 41, 10},
-{42, 10, 100, 42, 10},
-{43, 10, 100, 43, 10},
-{44, 10, 100, 44, 10},
-{45, 10, 100, 45, 10},
-{46, 10, 100, 46, 10},
-{47, 10, 100, 47, 10},
-{48, 10, 100, 48, 10},
-{49, 10, 100, 49, 10},
-{50, 10, 100, 50, 10},
-{51, 10, 100, 51, 10},
-{52, 10, 100, 52, 10},
-{53, 10, 100, 53, 10},
-{54, 10, 100, 54, 10},
-{55, 10, 100, 55, 10},
-{56, 10, 100, 56, 10},
-{57, 10, 100, 57, 10},
-{58, 10, 100, 58, 10},
-{59, 10, 100, 59, 10},
-{60, 10, 100, 60, 10},
-{61, 10, 100, 61, 10},
-{62, 10, 100, 62, 10},
-{63, 10, 100, 63, 10},
-{64, 10, 100, 64, 10},
-{65, 10, 100, 65, 10},
-{66, 10, 100, 66, 10},
-{67, 10, 100, 67, 10},
-{68, 10, 100, 68, 10},
-{69, 10, 100, 69, 10},
-{70, 10, 100, 70, 10},
-{71, 10, 100, 71, 10},
-{72, 10, 100, 72, 10},
-{73, 10, 100, 73, 10},
-{74, 10, 100, 74, 10},
-{75, 10, 100, 75, 10},
-{76, 10, 100, 76, 10},
-{77, 10, 100, 77, 10},
-{78, 10, 100, 78, 10},
-{79, 10, 100, 79, 10},
-{80, 10, 100, 80, 10},
-{81, 10, 100, 81, 10},
-{82, 10, 100, 82, 10},
-{83, 10, 100, 83, 10},
-{84, 10, 100, 84, 10},
-{85, 10, 100, 85, 10},
-{86, 10, 100, 86, 10},
-{87, 10, 100, 87, 10},
-{88, 10, 100, 88, 10},
-{89, 10, 100, 89, 10},
-{90, 10, 100, 90, 10},
-{91, 10, 100, 90, 10},
-{92, 10, 100, 90, 10},
-{93, 10, 100, 90, 10},
-{94, 10, 100, 90, 10},
-{95, 10, 100, 90, 10},
-{96, 10, 100, 90, 10},
-{97, 10, 100, 90, 10},
-{98, 10, 100, 90, 10},
-{99, 10, 100, 90, 10},
-{100, 10, 100, 90, 10},
-{101, 10, 100, 90, 10},
-{102, 10, 100, 90, 10},
-{103, 10, 100, 90, 10},
-{104, 10, 100, 90, 10},
-{105, 10, 100, 90, 10},
-{106, 10, 100, 90, 10},
-{107, 10, 100, 90, 10},
-{108, 10, 100, 90, 10},
-{109, 10, 100, 90, 10},
-{110, 10, 100, 90, 10},
-{111, 10, 100, 90, 10},
-{112, 10, 100, 90, 10},
-{113, 10, 100, 90, 10},
-{114, 10, 100, 90, 10},
-{115, 10, 100, 90, 10},
-{116, 10, 100, 90, 10},
-{117, 10, 100, 90, 10},
-{118, 10, 100, 90, 10},
-{119, 10, 100, 90, 10},
-{120, 10, 100, 90, 10},
-{121, 10, 100, 90, 10},
-{122, 10, 100, 90, 10},
-{123, 10, 100, 90, 10},
-{124, 10, 100, 90, 10},
-};
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- slider = new Slider(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- slider = new Slider(shell, cases[i]);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-public void test_getIncrement(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- slider.setIncrement(cases[i]);
- assertTrue("case: " + String.valueOf(i), slider.getIncrement()==cases[i]);
- }
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getPageIncrement(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- slider.setPageIncrement(cases[i]);
- assertTrue("case: " + String.valueOf(i), slider.getPageIncrement()==cases[i]);
- }
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getThumb() {
- warnUnimpl("Test test_getThumb not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- // overridden from Control because it does not make sense
- // to set the font of a Slider.
-}
-
-public void test_setIncrementI() {
- warnUnimpl("Test test_setIncrementI not written");
-}
-
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-public void test_setMinimumI(){
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-public void test_setPageIncrementI() {
- warnUnimpl("Test test_setPageIncrementI not written");
-}
-
-public void test_setSelectionI(){
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-public void test_setThumbI(){
-
- int [][] testValues = getSetThumbValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setThumb(intArray[0]);
- report("setThumb", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-public void test_setValuesIIIIII() {
- warnUnimpl("Test test_setValuesIIIIII not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Slider((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getIncrement");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getPageIncrement");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getThumb");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setIncrementI");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setPageIncrementI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setThumbI");
- methodNames.addElement("test_setValuesIIIIII");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getIncrement")) test_getIncrement();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getPageIncrement")) test_getPageIncrement();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getThumb")) test_getThumb();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setIncrementI")) test_setIncrementI();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setThumbI")) test_setThumbI();
- else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java
deleted file mode 100644
index bd65cd4dbd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Synchronizer
- *
- * @see org.eclipse.swt.widgets.Synchronizer
- */
-public class Test_org_eclipse_swt_widgets_Synchronizer extends SwtTestCase {
-
-public Test_org_eclipse_swt_widgets_Synchronizer(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_Display() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written");
-}
-
-public void test_asyncExecLjava_lang_Runnable() {
- warnUnimpl("Test test_asyncExecLjava_lang_Runnable not written");
-}
-
-public void test_syncExecLjava_lang_Runnable() {
- warnUnimpl("Test test_syncExecLjava_lang_Runnable not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Synchronizer((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display");
- methodNames.addElement("test_asyncExecLjava_lang_Runnable");
- methodNames.addElement("test_syncExecLjava_lang_Runnable");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display();
- else if (getName().equals("test_asyncExecLjava_lang_Runnable")) test_asyncExecLjava_lang_Runnable();
- else if (getName().equals("test_syncExecLjava_lang_Runnable")) test_syncExecLjava_lang_Runnable();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java
deleted file mode 100644
index 3b0d15ca77..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java
+++ /dev/null
@@ -1,404 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TabFolder
- *
- * @see org.eclipse.swt.widgets.TabFolder
- */
-public class Test_org_eclipse_swt_widgets_TabFolder extends Test_org_eclipse_swt_widgets_Composite {
-
-protected TabFolder tabFolder;
-
-public Test_org_eclipse_swt_widgets_TabFolder(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- makeCleanEnvironment();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * (Re)initializes tabFolder. This is called from setUp before each test
- * method is invoked, but also inside the test methods themselves to
- * re-initialize the environment for a fresh test.
- *
- * Basically a shim for coalescing the old test methods (several test
- * methods testing the same target method) into a single test method for
- * every target method. This way the original tests should work with little
- * modification, as long as this method is called before each test.
- *
- * Caveat: the Widget TestCase defines the tearDown method, which asserts that
- * the main widget (defined by the last call to setWidget) has been disposed.
- * So using this inside test methods means that only the widget created by
- * the last call to this method will be tested for this.
- */
-private void makeCleanEnvironment() {
-// this method must be private or protected so the auto-gen tool keeps it
- tabFolder = new TabFolder(shell, 0);
- setWidget(tabFolder);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- TabFolder newTabFolder;
- try {
- newTabFolder = new TabFolder(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_getClientArea() {
- warnUnimpl("Test test_getClientArea not written");
-}
-
-public void test_getItemI(){
- int number = 15;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TabItem(tabFolder, 0);
- }
-
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" +String.valueOf(i), tabFolder.getItem(i).equals(items[i]));
- }
- try {
- tabFolder.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- tabFolder.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- tabFolder.getItem(-1);
- fail("No exception thrown for index == -1");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getItemCount() {
- int number = 10;
- TabItem ti;
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, tabFolder.getItemCount()==i);
- ti = new TabItem(tabFolder, 0);
- }
-}
-
-public void test_getItems() {
- int number = 5;
- TabItem[] items = new TabItem[number];
-
- assertEquals(0, tabFolder.getItems().length);
-
- for (int i = 0; i<number ; i++){
- items[i] = new TabItem(tabFolder, 0);
- }
- assertEquals(items, tabFolder.getItems());
-
- tabFolder.getItems()[0].dispose();
- assertEquals(new TabItem[]{items[1], items[2], items[3], items[4]}, tabFolder.getItems());
-
- tabFolder.getItems()[3].dispose();
- assertEquals(new TabItem[]{items[1], items[2], items[3]}, tabFolder.getItems());
-
- tabFolder.getItems()[1].dispose();
- assertEquals(new TabItem[]{items[1], items[3]}, tabFolder.getItems());
-}
-
-public void test_getSelection() {
- int number = 10;
- TabItem[] tis = new TabItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- assertTrue(":a:", tabFolder.getSelection()[0] == tis[0]);
- for (int i = 0; i<number ; i++){
- tabFolder.setSelection(i);
- assertTrue(":b:" + i, tabFolder.getSelection()[0]==tis[i]);
- }
-}
-
-public void test_getSelectionIndex() {
- int number = 15;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- assertTrue(":a:", tabFolder.getSelectionIndex()==0);
-
- tabFolder.setSelection(new TabItem[]{items[2], items[number-1], items[10]});
- assertTrue(":b:", tabFolder.getSelectionIndex()==2);
-
- tabFolder.setSelection(items);
- assertTrue(":c:", tabFolder.getSelectionIndex()==0);
-}
-
-public void test_indexOfLorg_eclipse_swt_widgets_TabItem(){
- int number = 10;
- TabItem[] tis = new TabItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, tabFolder.indexOf(tis[i])==i);
- }
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- try {
- tabFolder.indexOf(null);
- fail("No exception thrown for tabItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- //
- makeCleanEnvironment();
- number = 20;
- TabItem[] items = new TabItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TabItem(tabFolder, 0);
- items[i].setText(String.valueOf(i));
- }
-
- //another tabFolder
- TabFolder tabFolder_2 = new TabFolder(shell, 0);
- TabItem[] items_2 = new TabItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TabItem(tabFolder_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" + String.valueOf(i), tabFolder.indexOf(items_2[i])==-1);
- }
-
- //
- TabFolder tabFolder2 = new TabFolder(shell, SWT.NULL);
- TabItem tabItem = new TabItem(tabFolder2, SWT.NULL);
-
- assertTrue(":a:", tabFolder.indexOf(tabItem) == -1);
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setSelection$Lorg_eclipse_swt_widgets_TabItem() {
- warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_widgets_TabItem not written");
-}
-
-public void test_setSelectionI(){
- int number = 10;
- TabItem ti;
- for (int i = 0; i<number ; i++){
- ti = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- tabFolder.setSelection(i);
- assertEquals(i, tabFolder.getSelectionIndex());
- }
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i<number ; i++){
- ti = new TabItem(tabFolder, 0);
- assertEquals("i=" + i, 0, tabFolder.getSelectionIndex());
- }
-
- //
- makeCleanEnvironment();
-
- number = 5;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
- try {
- tabFolder.setSelection((TabItem[]) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
- }
-
- //
- makeCleanEnvironment();
-
- items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- tabFolder.setSelection(0);
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
-
- tabFolder.setSelection(4);
- assertEquals(new TabItem[]{items[4]}, tabFolder.getSelection());
-
- tabFolder.setSelection(2);
- assertEquals(new TabItem[]{items[2]}, tabFolder.getSelection());
-
- tabFolder.setSelection(1);
- assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection());
-
- tabFolder.setSelection(number + 1);
- assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection());
-
- tabFolder.setSelection(-1);
- assertEquals(0, tabFolder.getSelection().length);
-
- tabFolder.setSelection(3);
- assertEquals(new TabItem[]{items[3]}, tabFolder.getSelection());
-
- tabFolder.setSelection(-2);
- assertEquals(0, tabFolder.getSelection().length);
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- tabFolder.setSelection(new TabItem[]{});
- assertEquals(new TabItem[]{}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[0]});
- assertEquals(new TabItem[] {items[0]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[3]});
- assertEquals(new TabItem[] {items[3]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[4]});
- assertEquals(new TabItem[] {items[4]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[2]});
- assertEquals(new TabItem[] {items[2]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[1]});
- assertEquals(new TabItem[] {items[1]}, tabFolder.getSelection());
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
- try {
- tabFolder.setSelection( new TabItem[]{items[0], null});
- tabFolder.setSelection( new TabItem[]{null});
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
- }
-}
-
-public void test_setSelectionIZ() {
- warnUnimpl("Test test_setSelectionIZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TabFolder((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getClientArea");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TabItem");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TabItem");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionIZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getClientArea")) test_getClientArea();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TabItem")) test_indexOfLorg_eclipse_swt_widgets_TabItem();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TabItem")) test_setSelection$Lorg_eclipse_swt_widgets_TabItem();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionIZ")) test_setSelectionIZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java
deleted file mode 100644
index 75f27ae5e3..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TabItem
- *
- * @see org.eclipse.swt.widgets.TabItem
- */
-public class Test_org_eclipse_swt_widgets_TabItem extends Test_org_eclipse_swt_widgets_Item {
-
-TabFolder tabFolder;
-TabItem tabItem;
-
-public Test_org_eclipse_swt_widgets_TabItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- tabFolder = new TabFolder(shell, 0);
- tabItem = new TabItem(tabFolder, 0);
- setWidget(tabItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderI(){
- if (fCheckSwtNullExceptions) {
- try {
- TabItem tItem = new TabItem(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderII(){
- TabItem tItem = new TabItem(tabFolder, SWT.NULL, 0);
-
- assertTrue(":a:", tabFolder.getItems()[0] == tItem);
-
- tItem = new TabItem(tabFolder, SWT.NULL, 1);
- assertTrue(":b:", tabFolder.getItems()[1] == tItem);
-
- tItem = new TabItem(tabFolder, SWT.NULL, 1);
- assertTrue(":c:", tabFolder.getItems()[1] == tItem);
-
- if (fCheckOutOfRangeBehaviour) {
- try {
- new TabItem(tabFolder, SWT.NULL, -1);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertTrue(":d:", tabFolder.getItems()[1] == tItem);
- }
- }
- if (fCheckOutOfRangeBehaviour) {
- try {
- new TabItem(tabFolder, SWT.NULL, tabFolder.getItemCount() + 1);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertTrue(":e:", tabFolder.getItems()[1] == tItem);
- }
- }
- if (fCheckSwtNullExceptions) {
- try {
- new TabItem(null, SWT.NULL, 0);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getControl() {
- warnUnimpl("Test test_getControl not written");
-}
-
-public void test_getDisplay() {
- assertTrue(tabItem.getDisplay() == tabFolder.getDisplay());
-}
-
-public void test_getParent() {
- assertTrue(":a: ", tabItem.getParent() == tabFolder);
-}
-
-public void test_getToolTipText() {
- warnUnimpl("Test test_getToolTipText not written");
-}
-
-public void test_setControlLorg_eclipse_swt_widgets_Control(){
- Control control = new Table(tabFolder, SWT.NULL);
-
- assertTrue(":a: ", tabItem.getControl() == null);
-
- tabItem.setControl(control);
- assertTrue(":b: ", tabItem.getControl() == control);
-
- tabItem.setControl(null);
- assertTrue(":c: ", tabItem.getControl() == null);
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public void test_setToolTipTextLjava_lang_String(){
- tabItem.setToolTipText("fred");
- assertTrue(":a: ", tabItem.getToolTipText().equals("fred"));
- tabItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt");
- assertTrue(":b: ", tabItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"));
- tabItem.setToolTipText(null);
- assertTrue(":c: ", tabItem.getToolTipText() == null);
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TabItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getToolTipText");
- methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderII();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getToolTipText")) test_getToolTipText();
- else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
deleted file mode 100644
index 37c5f6a71c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
+++ /dev/null
@@ -1,1635 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Table
- *
- * @see org.eclipse.swt.widgets.Table
- */
-public class Test_org_eclipse_swt_widgets_Table extends Test_org_eclipse_swt_widgets_Composite {
-
-protected Table table;
-
-public Test_org_eclipse_swt_widgets_Table(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- makeCleanEnvironment(false); // by default, use multi-select table.
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * (Re)initializes table. This is called from setUp before each test
- * method is invoked, but also inside the test methods themselves to
- * re-initialize the environment for a fresh test.
- *
- * Basically a shim for coalescing the old test methods (several test
- * methods testing the same target method) into a single test method for
- * every target method. This way the original tests should work with little
- * modification, as long as this method is called before each test.
- *
- * Caveat: the Widget TestCase defines the tearDown method, will assert that
- * the main widget (defined by the last call to setWidget) has been disposed.
- * So using this inside test methods means that only the widget created by
- * the last call to this method will be tested for this.
- *
- * @param int Value to pass as the second parameter to the Table constructor
- */
-private void makeCleanEnvironment(boolean singleMode) {
-// this method must be private or protected so the auto-gen tool keeps it
- if ( singleMode == false )
- table = new Table(shell, SWT.MULTI);
- else
- table = new Table(shell, SWT.SINGLE);
- setWidget(table);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- if (fCheckSwtNullExceptions) {
- Table newTable;
- try {
- newTable = new Table(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_deselect$I(){ int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {0, 3});
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(new int[] {1, 2});
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(new int[] {1, 3, 5});
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(new int[] {9, 3, 0});
- assertEquals(0, table.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- try{
- table.deselect(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {});
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {-1, 100, -1000});
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {2, -1, 1, 100, 2});
- assertEquals(number-2, table.getSelectionCount());
-
- table.deselect(new int[] {2, -1, 1, 100, 2});
- assertEquals(number-2, table.getSelectionCount());
-
- table.deselect(new int[] {2, -1, 3, 100, 2});
- assertEquals(number-3, table.getSelectionCount());
-}
-
-public void test_deselectI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- }
- assertEquals(0, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(0, table.getSelectionCount());
-
- table.select(new int[] {0, 3, 6});
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(5);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(3);
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(100);
- assertEquals(1, table.getSelectionCount());
-}
-
-public void test_deselectII(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {0, 3, 6});
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(7, 10);
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(6, 10);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(1, 10);
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(0, 10);
- assertEquals(0, table.getSelectionCount());
-
- table.deselect(0, 100);
- assertEquals(0, table.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- table.deselect(-10, 2);
- assertEquals(number-3, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(-10, 2000);
- assertEquals(0, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(2000, -10);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(0, number-1);
- assertEquals(0, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(0, 0);
- assertEquals(number-1, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(number-1, number-1);
- assertEquals(number-1, table.getSelectionCount());
- table.selectAll();
- table.deselect(-1, -1);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(number, number);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-}
-
-public void test_deselectAll() {
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
- table.select(new int[] {2, 4, 5, 10});
-
- assertEquals(4, table.getSelectionCount());
-
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
-}
-
-public void test_getColumnI() {
- warnUnimpl("Test test_getColumnI not written");
-}
-
-public void test_getColumnCount() {
- warnUnimpl("Test test_getColumnCount not written");
-}
-
-public void test_getColumns() {
- warnUnimpl("Test test_getColumns not written");
-}
-
-public void test_getGridLineWidth() {
- table.getGridLineWidth();
-}
-
-public void test_getHeaderVisible() {
- warnUnimpl("Test test_getHeaderVisible not written");
-}
-
-public void test_getItemI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- for (int i = 0; i < number; i++)
- assertEquals("i=" + i, items[i], table.getItem(i));
- try {
- table.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, items[i], table.getItem(i));
- }
- try {
- table.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getItemLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_getItemCount(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j="+ j, cases[j], table.getItemCount());
- table.removeAll();
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j="+ j, cases[j], table.getItemCount());
- table.removeAll();
- }
-}
-
-public void test_getItemHeight() {
- assertTrue(":a: Item height <= 0", table.getItemHeight() > 0);
- new TableItem(table, 0);
- assertTrue(":b: Item height <= 0", table.getItemHeight() > 0);
-}
-
-public void test_getItems(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j=" + j, cases[j], table.getItems().length);
- table.removeAll();
- }
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- ti.setText(String.valueOf(i));
- }
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText());
- }
- table.removeAll();
- }
-
- // note SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j=" + j, cases[j], table.getItems().length);
- table.removeAll();
- }
-
- makeCleanEnvironment(true);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- ti.setText(String.valueOf(i));
- }
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText());
- }
- table.removeAll();
- }
-}
-
-public void test_getLinesVisible() {
- warnUnimpl("Test test_getLinesVisible not written");
-}
-
-public void test_getSelection(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new TableItem[] {}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new TableItem[] {items[2], items[10], items[number-1]}, table.getSelection());
-
- table.setSelection(items);
- assertEquals(items, table.getSelection());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new TableItem[] {}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[10], items[number-1], items[2]});
- assertEquals(new TableItem[] {items[10]}, table.getSelection());
-
- table.setSelection(items);
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-}
-
-public void test_getSelectionCount(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(3, table.getSelectionCount());
-
- table.setSelection(items);
- assertEquals(number, table.getSelectionCount());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(1, table.getSelectionCount());
-
- table.setSelection(items);
- assertEquals(1, table.getSelectionCount());
-}
-
-public void test_getSelectionIndex(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(-1, table.getSelectionIndex());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(2, table.getSelectionIndex());
-
- table.setSelection(items);
- assertEquals(0, table.getSelectionIndex());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(-1, table.getSelectionIndex());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(2, table.getSelectionIndex());
-
- table.setSelection(items);
- assertEquals(0, table.getSelectionIndex());
-}
-
-public void test_getSelectionIndices(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new int[]{2, 10, number-1}, table.getSelectionIndices()); // 10 < number
-
- int[] all = new int[number];
- for (int i = 0; i<number; i++)
- all[i]=i;
- table.setSelection(items);
- assertEquals(all, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(items);
- assertEquals(new int[]{0}, table.getSelectionIndices());
-}
-
-public void test_getTopIndex() {
- warnUnimpl("Test test_getTopIndex not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_widgets_TableColumn() {
- warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_TableColumn not written");
-}
-
-public void test_indexOfLorg_eclipse_swt_widgets_TableItem(){
- int number = 20;
- TableItem[] items = new TableItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals(i, table.indexOf(items[i]));
- }
-
- for (int i = 0; i < number; i++) {
- try {
- table.indexOf((TableItem)null);
- fail("No exception thrown for tableItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- // another table
- Table table_2 = new Table(shell, 0);
- TableItem[] items_2 = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TableItem(table_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, -1, table.indexOf(items_2[i]));
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- number = 20;
- items = new TableItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals(i, table.indexOf(items[i]));
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- try {
- table.indexOf((TableItem)null);
- fail("No exception thrown for tableItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- // another table
- table_2 = new Table(shell, 0);
- items_2 = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TableItem(table_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, -1, table.indexOf(items_2[i]));
- }
-}
-
-public void test_isSelectedI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++)
- assertTrue(":a:" + i, !table.isSelected(i));
- table.setSelection(new TableItem[] {items[2], items[number-1], items[10]});
- for (int i = 0; i < number; i++) {
- if (i == 2 || i == number-1 || i == 10)
- assertTrue(":b:" + i, table.isSelected(i));
- else
- assertTrue(":b:" + i, !table.isSelected(i));
- }
-
- table.setSelection(items);
- for (int i = 0; i < number; i++)
- assertTrue(":c:" + i, table.isSelected(i));
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++)
- assertTrue(":d:" + i, !table.isSelected(i));
- table.setSelection(new TableItem[] {items[10], items[number-1], items[2]});
- for (int i = 0; i < number; i++) {
- if (i == 10)
- assertTrue(":e:" + i, table.isSelected(i));
- else
- assertTrue(":e:" + i, !table.isSelected(i));
- }
-
- table.setSelection(items);
- for (int i = 0; i < number; i++){
- if (i == 0)
- assertTrue(":f:" + i, table.isSelected(i));
- else
- assertTrue(":f:" + i, !table.isSelected(i));
- }
-}
-
-public void test_remove$I(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.remove(null);
- fail("No exception thrown for tableItems == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.remove(new int[] {2, 1, 0, -100, 5, 5, 2, 1, 0, 0, 0});
- fail("No exception thrown for illegal index arguments");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.remove(new int[] {2, 1, 0, number, 5, 5, 2, 1, 0, 0, 0});
- fail("No exception thrown for illegal index arguments");
- }
- catch (IllegalArgumentException e) {
- }
-
- table.remove(new int[] {});
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertTrue(":a:", !items[2].isDisposed());
- table.remove(new int[] {2});
- assertTrue(":b:", items[2].isDisposed());
- assertEquals(number-1, table.getItemCount());
-
- assertTrue(":c:", !items[number-1].isDisposed());
- table.remove(new int[] {number-2});
- assertTrue(":d:", items[number-1].isDisposed());
- assertEquals(number-2, table.getItemCount());
-
- assertTrue(":e:", !items[3].isDisposed());
- table.remove(new int[] {2});
- assertTrue(":f:", items[3].isDisposed());
- assertEquals(number-3, table.getItemCount());
-
- assertTrue(":g:", !items[0].isDisposed());
- table.remove(new int[] {0});
- assertTrue(":h:", items[0].isDisposed());
- assertEquals(number-4, table.getItemCount());
-}
-
-public void test_removeI() {
- warnUnimpl("Test test_removeI not written");
-}
-
-public void test_removeII(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-number, number + 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, 3);
- assertEquals(new TableItem[]{items[0], items[1], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- //should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(2, 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(2, number);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, number-1);
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, 3);
- assertEquals(new TableItem[] {items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, number-1);
- assertEquals(new TableItem[] {}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.remove(new int[] {});
- assertEquals(number, table.getItemCount());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-20, -10);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(20, 40);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- table.remove(200, 40);
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, 2);
- assertEquals(new TableItem[]{items[0], items[1], items[3], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, 0);
- assertEquals(new TableItem[]{items[1], items[2], items[3], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(4, 4);
- assertEquals(new TableItem[]{items[0], items[1], items[2], items[3]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- assertEquals(number, table.getItemCount());
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-10, 2);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
- assertEquals(number, table.getItemCount());
- if (fCheckSWTPolicy) {
- table.remove(10, 2);
- assertEquals(number, table.getItemCount());
- }
- table.remove(0, 2);
- assertEquals(number - 3, table.getItemCount());
- assertEquals(new TableItem[] {items[3], items[4]}, table.getItems());
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(1, 200);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(1, table.getItemCount());
- assertEquals(new TableItem[] {items[3]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.remove(0, number-1);
- assertEquals(0, table.getItemCount());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(number, number);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(number, number + 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- number = 15;
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
-
- table.remove(new int[] {2, 1, 0, 5, 5});
- assertEquals(number-4, table.getItemCount());
-}
-
-public void test_removeAll(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.removeAll();
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.removeAll();
- table.removeAll();
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_select$I(){
- try {
- table.select(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- try {
- table.select(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_selectI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- table.select(7);
- assertEquals(new int[]{2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(0);
- assertEquals(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.select(new int[] {number - 1, 10, 2 });
- assertEquals(number - 1, table.getSelectionIndex());
- table.setSelection(new int[] {number - 1,10, 2});
- assertEquals(number - 1, table.getSelectionIndex()); // for SINGLE setSelection and select are the same
-
- table.select(7);
- assertEquals(new int[] {7}, table.getSelectionIndices());
- table.setSelection(7);
- assertEquals(new int[] {7}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same
-
- table.select(0);
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(0);
- assertEquals(new int[] {0}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same
-}
-
-public void test_selectII(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- table.select(7);
- assertEquals(new int[]{2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(0);
- assertEquals(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(4, 10);
- assertEquals(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 14}, table.getSelectionIndices());
-
- table.select(4, 14);
- assertEquals(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- table.select(0, 7);
- assertEquals(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- table.select(9, 5);
- assertEquals(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(-100, 1000);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(0, 1000);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
-
- table.select(0, number-1);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
-
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- table.deselectAll();
-
- table.select(number-1, number);
- assertEquals(1, table.getSelectionCount());
- table.deselectAll();
-
- table.select(number, number);
- assertEquals(0, table.getSelectionCount());
- table.deselectAll();
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- table.setSelection(0);
-
- if (fCheckSWTPolicy) {
- table.select(4, 10);
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(4, 10);
- assertEquals(new int[] {4}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(5, number - 1);
- assertEquals(new int[] {5}, table.getSelectionIndices());
- table.setSelection(5, number - 1);
- assertEquals(new int[] {5}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(0, 7);
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(0, 7);
- assertEquals(new int[] {0}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(9, 5);
- assertEquals(new int[] {7}, table.getSelectionIndices());
- table.setSelection(9, 5);
- assertEquals(new int[] {}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
- } // ?? in this case maybe the sel. should be cleared
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- if (fCheckSWTPolicy) {
- table.select(-100, 1000);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- }
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(0, 1000);
- assertEquals(1, table.getSelectionCount());
- if (fCheckSWTPolicy)
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(0, number - 1);
- assertEquals(1, table.getSelectionCount());
- if (fCheckSWTPolicy)
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number - 1, number);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number, number);
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.deselectAll();
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.select(-100, 1000);
- if (fCheckSWTPolicy) {
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- }
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(1000, 0);
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number - 1, 0);
- if (fCheckSWTPolicy)
- assertEquals(0, table.getSelectionCount());
- table.deselectAll();
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.deselectAll();
- table.select(-1, -1);
- if (fCheckSWTPolicy) {
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- }
- table.deselectAll();
- table.select(number, number);
- if (fCheckSWTPolicy) {
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- }
- table.deselectAll();
-}
-
-public void test_selectAll(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.selectAll();
- assertEquals(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.selectAll();
- assertEquals(new int[]{}, table.getSelectionIndices());
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setHeaderVisibleZ(){
- table.setHeaderVisible(true);
- assertTrue(table.getHeaderVisible());
-
- table.setHeaderVisible(false);
- assertTrue(!table.getHeaderVisible());
-}
-
-public void test_setLinesVisibleZ(){
- table.setLinesVisible(true);
- assertTrue(table.getLinesVisible());
-
- table.setLinesVisible(false);
- assertTrue(!table.getLinesVisible());
-}
-
-public void test_setRedrawZ() {
- warnUnimpl("Test test_setRedrawZ not written");
-}
-
-public void test_setSelection$I(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((int[]) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- table.setSelection(new int[]{});
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(new int[]{0, 3, 2});
- assertEquals(new int[]{0, 2, 3}, table.getSelectionIndices());
-
- table.setSelection(new int[]{3, 2, 1});
- assertEquals(new int[]{1, 2, 3}, table.getSelectionIndices());
-
- table.setSelection(new int[]{1, 4, 0});
- assertEquals(new int[]{0, 1, 4}, table.getSelectionIndices());
- table.setSelection(new int[]{0, 4, 0});
- assertEquals(new int[]{0, 4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{2, 3, 4});
- assertEquals(new int[]{2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{4, 4, 4, 4, 4, 4, 4});
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{4});
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((int[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.setSelection(new int[] {});
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.setSelection(new int[] {0, 3, 2});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {2}, table.getSelectionIndices());
- table.setSelection(new int[] {3, 2, 1});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {1}, table.getSelectionIndices());
- table.setSelection(new int[] {1, 4, 0});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(new int[] {0, 4, 1});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(new int[] {2, 3, 4});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(new int[] {4, 4, 4, 4, 4, 4, 4});
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(new int[] {4});
- assertEquals(new int[] {4}, table.getSelectionIndices());
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((TableItem[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(0, table.getSelectionCount());
- }
-}
-
-public void test_setSelection$Lorg_eclipse_swt_widgets_TableItem(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((TableItem[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(0, table.getSelectionCount());
- }
-
- table.setSelection(new TableItem[]{});
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[0], items[3], items[2]});
- assertEquals(new TableItem[]{items[0], items[2], items[3]}, table.getSelection());
- table.setSelection(new TableItem[]{items[3], items[2], items[1]});
- assertEquals(new TableItem[]{items[1], items[2], items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[1], items[4], items[0]});
- assertEquals(new TableItem[]{items[0], items[1], items[4]}, table.getSelection());
- table.setSelection(new TableItem[]{items[0], items[4], items[0]});
- assertEquals(new TableItem[]{items[0], items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[3], items[4]});
- assertEquals(new TableItem[]{items[2], items[3], items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
- table.setSelection(new TableItem[]{items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[] {items[0]});
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[3]});
- assertEquals(new TableItem[] {items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[4]});
- assertEquals(new TableItem[] {items[4]}, table.getSelection());
- table.setSelection(new TableItem[] {items[2]});
- assertEquals(new TableItem[] {items[2]}, table.getSelection());
- table.setSelection(new TableItem[] {items[1]});
- assertEquals(new TableItem[] {items[1]}, table.getSelection());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[]{});
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[0], items[3], items[2]});
- assertEquals(new TableItem[]{items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[3], items[2], items[1]});
- assertEquals(new TableItem[]{items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[1], items[4], items[0]});
- assertEquals(new TableItem[]{items[1]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[0], items[4], items[0]});
- assertEquals(new TableItem[]{items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[3], items[4]});
- assertEquals(new TableItem[]{items[2]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[] {items[0]});
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[3]});
- assertEquals(new TableItem[] {items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[4]});
- assertEquals(new TableItem[] {items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[2]});
- assertEquals(new TableItem[] {items[2]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[1]});
- assertEquals(new TableItem[] {items[1]}, table.getSelection());
-}
-
-public void test_setSelectionI(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0);
- assertEquals(new int[]{0}, table.getSelectionIndices());
- table.setSelection(3);
- assertEquals(new int[]{3}, table.getSelectionIndices());
- table.setSelection(4);
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1);
- assertEquals(new int[]{1}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0);
- assertEquals(new int[]{0}, table.getSelectionIndices());
-
- table.setSelection(3);
- assertEquals(new int[]{3}, table.getSelectionIndices());
-
- table.setSelection(4);
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1);
- assertEquals(new int[]{1}, table.getSelectionIndices());
-
-}
-
-public void test_setSelectionII(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0, 1);
- assertEquals(new int[]{0, 1}, table.getSelectionIndices());
-
- table.setSelection(2, 4);
- assertEquals(new int[]{2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(3, 4);
- assertEquals(new int[]{3, 4}, table.getSelectionIndices());
-
- table.setSelection(5, 4);
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(2, 2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1, 4);
- assertEquals(new int[]{1, 2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(0, 4);
- assertEquals(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.setSelection(0, 1);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {1}, table.getSelectionIndices());
- table.setSelection(2, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(5, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.setSelection(2, 2);
- assertEquals(new int[] {2}, table.getSelectionIndices());
- table.setSelection(1, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(0, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
-}
-
-public void test_setTopIndexI() {
- warnUnimpl("Test test_setTopIndexI not written");
-}
-
-public void test_showItemLorg_eclipse_swt_widgets_TableItem() {
- warnUnimpl("Test test_showItemLorg_eclipse_swt_widgets_TableItem not written");
-}
-
-public void test_showSelection() {
- table.showSelection();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Table((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_deselect$I");
- methodNames.addElement("test_deselectI");
- methodNames.addElement("test_deselectII");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getColumnI");
- methodNames.addElement("test_getColumnCount");
- methodNames.addElement("test_getColumns");
- methodNames.addElement("test_getGridLineWidth");
- methodNames.addElement("test_getHeaderVisible");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getLinesVisible");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_getSelectionIndex");
- methodNames.addElement("test_getSelectionIndices");
- methodNames.addElement("test_getTopIndex");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableColumn");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableItem");
- methodNames.addElement("test_isSelectedI");
- methodNames.addElement("test_remove$I");
- methodNames.addElement("test_removeI");
- methodNames.addElement("test_removeII");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_select$I");
- methodNames.addElement("test_selectI");
- methodNames.addElement("test_selectII");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setHeaderVisibleZ");
- methodNames.addElement("test_setLinesVisibleZ");
- methodNames.addElement("test_setRedrawZ");
- methodNames.addElement("test_setSelection$I");
- methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TableItem");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionII");
- methodNames.addElement("test_setTopIndexI");
- methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TableItem");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_deselect$I")) test_deselect$I();
- else if (getName().equals("test_deselectI")) test_deselectI();
- else if (getName().equals("test_deselectII")) test_deselectII();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getColumnI")) test_getColumnI();
- else if (getName().equals("test_getColumnCount")) test_getColumnCount();
- else if (getName().equals("test_getColumns")) test_getColumns();
- else if (getName().equals("test_getGridLineWidth")) test_getGridLineWidth();
- else if (getName().equals("test_getHeaderVisible")) test_getHeaderVisible();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getLinesVisible")) test_getLinesVisible();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex();
- else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices();
- else if (getName().equals("test_getTopIndex")) test_getTopIndex();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableColumn")) test_indexOfLorg_eclipse_swt_widgets_TableColumn();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableItem")) test_indexOfLorg_eclipse_swt_widgets_TableItem();
- else if (getName().equals("test_isSelectedI")) test_isSelectedI();
- else if (getName().equals("test_remove$I")) test_remove$I();
- else if (getName().equals("test_removeI")) test_removeI();
- else if (getName().equals("test_removeII")) test_removeII();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_select$I")) test_select$I();
- else if (getName().equals("test_selectI")) test_selectI();
- else if (getName().equals("test_selectII")) test_selectII();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setHeaderVisibleZ")) test_setHeaderVisibleZ();
- else if (getName().equals("test_setLinesVisibleZ")) test_setLinesVisibleZ();
- else if (getName().equals("test_setRedrawZ")) test_setRedrawZ();
- else if (getName().equals("test_setSelection$I")) test_setSelection$I();
- else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TableItem")) test_setSelection$Lorg_eclipse_swt_widgets_TableItem();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionII")) test_setSelectionII();
- else if (getName().equals("test_setTopIndexI")) test_setTopIndexI();
- else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TableItem")) test_showItemLorg_eclipse_swt_widgets_TableItem();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java
deleted file mode 100644
index 588dc89855..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TableColumn
- *
- * @see org.eclipse.swt.widgets.TableColumn
- */
-public class Test_org_eclipse_swt_widgets_TableColumn extends Test_org_eclipse_swt_widgets_Item {
-
-protected TableColumn tableColumn;
-protected Table table;
-
-public Test_org_eclipse_swt_widgets_TableColumn(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- table = new Table(shell, SWT.SINGLE);
- tableColumn = new TableColumn(table, SWT.NULL);
- setWidget(tableColumn);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TableI(){
- if (fCheckSwtNullExceptions) {
- try {
- new TableColumn(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TableII(){
- if (fCheckSwtNullExceptions) {
- try {
- new TableColumn(null, SWT.NULL, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- new TableColumn(table, SWT.NULL, -1);
- fail("No exception thrown for index == -1");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- new TableColumn(table, SWT.NULL, 2);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() {
- warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(){
- try {
- tableColumn.addSelectionListener(null);
- fail("No exception thrown for selectionListener == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getAlignment() {
- warnUnimpl("Test test_getAlignment not written");
-}
-
-public void test_getDisplay() {
- assertTrue(":a:", tableColumn.getDisplay() == table.getDisplay());
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getResizable() {
- warnUnimpl("Test test_getResizable not written");
-}
-
-public void test_getWidth(){
- final int DEFAULT_WIDTH = 10;
- int testWidth = 42;
-
- assertTrue(":a: width=" + tableColumn.getWidth() + " should be=" + DEFAULT_WIDTH, tableColumn.getWidth() == DEFAULT_WIDTH);
- // try {
-// tableColumn.setWidth(-1);
-// assertTrue("No exception thrown", false);
-// }
-// catch (IllegalArgumentException e) {
-// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid"));
-// }
-// catch (SWTException e) {
-// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid"));
-// }
-
- tableColumn.setWidth(0);
- assertTrue(":c: width=" + tableColumn.getWidth() + " should be=" + 0, tableColumn.getWidth() == 0);
-
- tableColumn.setWidth(testWidth);
- assertTrue(":d: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth);
-
- tableColumn.setWidth(testWidth);
- assertTrue(":e: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth);
-}
-
-public void test_pack() {
- warnUnimpl("Test test_pack not written");
-}
-
-public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() {
- warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(){
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {}};
-
- tableColumn.removeSelectionListener(listener);
- tableColumn.addSelectionListener(listener);
- tableColumn.removeSelectionListener(listener);
- try {
- tableColumn.removeSelectionListener(null);
- fail("No exception thrown for selectionListener == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setAlignmentI(){
- TableColumn column2;
-
- assertTrue(":a:", tableColumn.getAlignment() == SWT.LEFT);
-
- tableColumn.setAlignment(-1);
- assertTrue(":b:", tableColumn.getAlignment() == SWT.LEFT);
-
- tableColumn.setAlignment(SWT.RIGHT);
- assertTrue(
- ":c: Should not be allowed to set alignment of the first column",
- tableColumn.getAlignment() == SWT.LEFT);
-
- column2 = new TableColumn(table, SWT.NULL);
- column2.setAlignment(SWT.RIGHT);
- assertTrue(":d:", column2.getAlignment() == SWT.RIGHT);
-
- column2.setAlignment(SWT.CENTER);
- assertTrue(":e:", column2.getAlignment() == SWT.CENTER);
-
- column2.setAlignment(SWT.LEFT);
- assertTrue(":f:", column2.getAlignment() == SWT.LEFT);
-}
-
-public void test_setResizableZ(){
- assertTrue(":a:", tableColumn.getResizable() == true);
-
- tableColumn.setResizable(false);
- assertTrue(":b:", tableColumn.getResizable() == false);
-
- tableColumn.setResizable(false);
- assertTrue(":c:", tableColumn.getResizable() == false);
-
- tableColumn.setResizable(true);
- assertTrue(":d:", tableColumn.getResizable() == true);
-}
-
-public void test_setTextLjava_lang_String(){
- assertTrue(":a:", tableColumn.getText() == "");
-
- tableColumn.setText("text");
- assertTrue(":b:", tableColumn.getText() == "text");
-
- try {
- tableColumn.setText(null);
- fail("No exception thrown for column header == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setWidthI() {
- warnUnimpl("Test test_setWidthI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TableColumn((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII");
- methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getAlignment");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getResizable");
- methodNames.addElement("test_getWidth");
- methodNames.addElement("test_pack");
- methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setAlignmentI");
- methodNames.addElement("test_setResizableZ");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setWidthI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII();
- else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getAlignment")) test_getAlignment();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getResizable")) test_getResizable();
- else if (getName().equals("test_getWidth")) test_getWidth();
- else if (getName().equals("test_pack")) test_pack();
- else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setAlignmentI")) test_setAlignmentI();
- else if (getName().equals("test_setResizableZ")) test_setResizableZ();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setWidthI")) test_setWidthI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
deleted file mode 100644
index 2d16d31c01..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
+++ /dev/null
@@ -1,505 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TableItem
- *
- * @see org.eclipse.swt.widgets.TableItem
- */
-public class Test_org_eclipse_swt_widgets_TableItem extends Test_org_eclipse_swt_widgets_Item {
-
-Table table;
-TableItem tableItem;
-
-public Test_org_eclipse_swt_widgets_TableItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- makeCleanEnvironment();
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void makeCleanEnvironment() {
- if ( tableItem != null ) tableItem.dispose();
- if ( table != null ) table.dispose();
- table = new Table(shell, 0);
- tableItem = new TableItem(table, 0);
- setWidget(tableItem);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TableI(){
-
- if (fCheckSwtNullExceptions) {
- try {
- TableItem tItem = new TableItem(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TableII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_TableII not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getBoundsI(){
- int boundsX;
- Rectangle bounds;
- Table table2 = new Table(shell, SWT.CHECK);
- TableItem tableItem2 = new TableItem(table2, SWT.NULL);
-
- bounds = tableItem.getBounds(0);
- assertTrue(":a:", bounds.x > 0 && bounds.width > 0);
- boundsX = bounds.x;
-
- bounds = tableItem.getBounds(-1);
- assertTrue(":b:", bounds.equals(new Rectangle(0, 0, 0, 0)));
-
- bounds = tableItem.getBounds(1);
- assertTrue(":c:", bounds.equals(new Rectangle(0, 0, 0, 0)));
-
- //table2.setWidths(new int[] {30});
- TableColumn column = new TableColumn(table2, SWT.NONE, 0);
- column.setWidth(30);
- bounds = tableItem2.getBounds(0);
- assertTrue(":d:", bounds.x > boundsX && bounds.width > 0);
-
- bounds = tableItem2.getBounds(-1);
- assertEquals(new Rectangle(0, 0, 0, 0), bounds);
-
- bounds = tableItem2.getBounds(1);
- assertEquals(new Rectangle(0, 0, 0, 0), bounds);
-
-
- //
- makeCleanEnvironment();
-
- Image image = images[0];
- table2.dispose();
- table2 = new Table(shell, SWT.CHECK);
- tableItem2.dispose();
- tableItem2 = new TableItem(table2, SWT.NULL);
- column.dispose();
-
- new TableColumn(table, SWT.NULL);
- new TableColumn(table, SWT.NULL);
- tableItem.setImage(1, image);
- bounds = tableItem.getBounds(0);
- assertTrue(":a:", bounds.x > 0 && bounds.width > 0);
- boundsX = bounds.x;
-
- bounds = tableItem.getBounds(-1);
- assertEquals(new Rectangle(0, 0, 0, 0), bounds);
-
- bounds = tableItem.getBounds(1);
- //assert(":c:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns
- assertTrue(":c:", bounds.x > 0 && bounds.height > 0);
-
-
- column = new TableColumn(table2, SWT.NULL);
- column.setWidth(30);
- new TableColumn(table2, SWT.NULL);
- tableItem2.setImage(1, image);
- bounds = tableItem2.getBounds(0);
- assertTrue(":d:", bounds.x > boundsX && bounds.width > 0);
-
- bounds = tableItem2.getBounds(-1);
- assertEquals(new Rectangle(0, 0, 0, 0), bounds);
-
- bounds = tableItem2.getBounds(1);
- //assert(":f:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns
- assertTrue(":f:", bounds.x > 0 && bounds.height > 0);
-}
-
-public void test_getChecked() {
- warnUnimpl("Test test_getChecked not written");
-}
-
-public void test_getDisplay() {
- assertEquals(table.getDisplay(), tableItem.getDisplay());
-}
-
-public void test_getGrayed() {
- warnUnimpl("Test test_getGrayed not written");
-}
-
-public void test_getImageI() {
- warnUnimpl("Test test_getImageI not written");
-}
-
-/**
- * Test without item image
- */
-public void test_getImageBoundsI(){
- Rectangle bounds;
- Table table2 = new Table(shell, SWT.CHECK);
- TableItem tableItem2 = new TableItem(table2, SWT.NULL);
- int imageX;
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1));
-
- bounds = tableItem.getImageBounds(0);
- assertTrue(":b:", bounds.x > 0 && bounds.width == 0);
- imageX = bounds.x;
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1));
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1));
-
- bounds = tableItem2.getImageBounds(0);
- assertTrue(":e:", bounds.x > imageX && bounds.width == 0);
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1));
-
- //
- makeCleanEnvironment();
-
- Image image = images[0];
- int imageWidth = image.getBounds().width;
- int imageHeight;
-
- tableItem.setImage(0, image);
- imageHeight = table.getItemHeight() - table.getGridLineWidth();
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1));
-
- bounds = tableItem.getImageBounds(0);
- assertTrue(":b:", bounds.x > 0 && bounds.width == imageWidth && bounds.height == imageHeight);
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1));
-
-
- //
- makeCleanEnvironment();
-
- table2.dispose();
- table2 = new Table(shell, SWT.CHECK);
- tableItem2.dispose();
- tableItem2 = new TableItem(table2, SWT.NULL);
- Rectangle imageBounds = image.getBounds();
- imageWidth = imageBounds.width;
- tableItem2.setImage(0, image);
- imageHeight = table2.getItemHeight() - table2.getGridLineWidth();
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1));
-
- bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if they are wider than image
- assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight);
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1));
-
-
- //
- makeCleanEnvironment();
-
- table2.dispose();
- table2 = new Table(shell, SWT.CHECK);
- tableItem2.dispose();
- tableItem2 = new TableItem(table2, SWT.NULL);
- image = images[1];
- imageBounds = image.getBounds();
- imageWidth = imageBounds.width;
-
- tableItem2.setImage(0, image);
- imageHeight = table2.getItemHeight() - table2.getGridLineWidth();
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1));
-
- bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if check box is wider than image
- assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight);
-
- assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1));
-}
-
-public void test_getImageIndent() {
- warnUnimpl("Test test_getImageIndent not written");
-}
-
-public void test_getParent() {
- assertEquals(table, tableItem.getParent());
-}
-
-public void test_getTextI() {
- warnUnimpl("Test test_getTextI not written");
-}
-
-public void test_setCheckedZ(){
- assertEquals(false, tableItem.getChecked());
-
- tableItem.setChecked(true);
- assertEquals(false, tableItem.getChecked());
-
- Table t = new Table(shell, SWT.CHECK);
- TableItem ti = new TableItem(t, SWT.NULL);
- ti.setChecked(true);
- assertTrue(ti.getChecked());
-
- ti.setChecked(false);
- assertEquals(false, ti.getChecked());
- t.dispose();
-}
-
-public void test_setGrayedZ() {
- warnUnimpl("Test test_setGrayedZ not written");
-}
-
-public void test_setImage$Lorg_eclipse_swt_graphics_Image(){
- assertNull(tableItem.getImage(1));
-
- tableItem.setImage(-1, null);
- assertNull(tableItem.getImage(-1));
-
- tableItem.setImage(0, images[0]);
- assertEquals(images[0], tableItem.getImage(0));
-
- String texts[] = new String[images.length];
- for (int i = 0; i < texts.length; i++) {
- texts[i] = String.valueOf(i);
- }
-
- //table.setText(texts); // create enough columns for TableItem.setImage(Image[]) to work
- int columnCount = table.getColumnCount();
- if (columnCount < texts.length) {
- for (int i = columnCount; i < texts.length; i++){
- TableColumn column = new TableColumn(table, SWT.NONE);
- }
- }
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < texts.length; i++) {
- columns[i].setText(texts[i]);
- }
- tableItem.setImage(1, images[1]);
- assertEquals(images[1], tableItem.getImage(1));
-
- tableItem.setImage(images);
- for (int i = 0; i < images.length; i++) {
- assertEquals(images[i], tableItem.getImage(i));
- }
- try {
- tableItem.setImage((Image []) null);
- fail("No exception thrown for images == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_setImageILorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setImageIndentI(){
- assertEquals(0, tableItem.getImageIndent());
-
- tableItem.setImageIndent(1);
- assertEquals(1, tableItem.getImageIndent());
-
- tableItem.setImageIndent(-1);
- assertEquals(1, tableItem.getImageIndent());
-}
-
-public void test_setText$Ljava_lang_String(){
- final String TestString = "test";
- final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"};
-
- try {
- tableItem.setText((String []) null);
- fail("No exception thrown for strings == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- /*
- * Test the getText/setText API with a Table that has only
- * the default column.
- */
-
- assertEquals(0, tableItem.getText(1).length());
-
- tableItem.setText(TestStrings);
- assertEquals(TestStrings[0], tableItem.getText(0));
- for (int i = 1; i < TestStrings.length; i++) {
- assertEquals(0, tableItem.getText(i).length());
- }
-
-
- /*
- * Test the getText/setText API with a Table that enough
- * columns to fit all test item texts.
- */
-
- int columnCount = table.getColumnCount();
- if (columnCount < images.length) {
- for (int i = columnCount; i < images.length; i++){
- TableColumn column = new TableColumn(table, SWT.NONE);
- }
- }
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < TestStrings.length; i++) {
- columns[i].setText(TestStrings[i]);
- }
- assertEquals(0, tableItem.getText(1).length());
-
-}
-
-public void test_setTextILjava_lang_String(){
- final String TestString = "test";
- final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"};
-
- /*
- * Test the getText/setText API with a Table that has only
- * the default column.
- */
-
- assertEquals(0, tableItem.getText(1).length());
-
- tableItem.setText(1, TestString);
- assertEquals(0, tableItem.getText(1).length());
- assertEquals(0, tableItem.getText(0).length());
-
- tableItem.setText(0, TestString);
- assertEquals(TestString, tableItem.getText(0));
-
- tableItem.setText(-1, TestStrings[1]);
- assertEquals(0, tableItem.getText(-1).length());
-
- /*
- * Test the getText/setText API with a Table that enough
- * columns to fit all test item texts.
- */
-
- makeCleanEnvironment();
-
- //table.setText(TestStrings); // create anough columns for TableItem.setText(String[]) to work
- int columnCount = table.getColumnCount();
- if (columnCount < images.length) {
- for (int i = columnCount; i < images.length; i++){
- TableColumn column = new TableColumn(table, SWT.NONE);
- }
- }
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < TestStrings.length; i++) {
- columns[i].setText(TestStrings[i]);
- }
- assertEquals(0, tableItem.getText(1).length());
-
-
- tableItem.setText(1, TestString);
- assertEquals(TestString, tableItem.getText(1));
- assertEquals(0, tableItem.getText(0).length());
-
- tableItem.setText(0, TestString);
- assertEquals(TestString, tableItem.getText(0));
-
-
- tableItem.setText(-1, TestStrings[1]);
- assertEquals(0, tableItem.getText(-1).length());
-
-
- try {
- tableItem.setText(-1, null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- tableItem.setText(0, null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
-
-
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TableItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getBoundsI");
- methodNames.addElement("test_getChecked");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getGrayed");
- methodNames.addElement("test_getImageI");
- methodNames.addElement("test_getImageBoundsI");
- methodNames.addElement("test_getImageIndent");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getTextI");
- methodNames.addElement("test_setCheckedZ");
- methodNames.addElement("test_setGrayedZ");
- methodNames.addElement("test_setImage$Lorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setImageIndentI");
- methodNames.addElement("test_setText$Ljava_lang_String");
- methodNames.addElement("test_setTextILjava_lang_String");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getBoundsI")) test_getBoundsI();
- else if (getName().equals("test_getChecked")) test_getChecked();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getGrayed")) test_getGrayed();
- else if (getName().equals("test_getImageI")) test_getImageI();
- else if (getName().equals("test_getImageBoundsI")) test_getImageBoundsI();
- else if (getName().equals("test_getImageIndent")) test_getImageIndent();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getTextI")) test_getTextI();
- else if (getName().equals("test_setCheckedZ")) test_setCheckedZ();
- else if (getName().equals("test_setGrayedZ")) test_setGrayedZ();
- else if (getName().equals("test_setImage$Lorg_eclipse_swt_graphics_Image")) test_setImage$Lorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setImageIndentI")) test_setImageIndentI();
- else if (getName().equals("test_setText$Ljava_lang_String")) test_setText$Ljava_lang_String();
- else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java
deleted file mode 100644
index e4b8128d31..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java
+++ /dev/null
@@ -1,976 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Text
- *
- * @see org.eclipse.swt.widgets.Text
- */
-public class Test_org_eclipse_swt_widgets_Text extends Test_org_eclipse_swt_widgets_Scrollable {
-
-Text text;
-String delimiterString;
-
-public Test_org_eclipse_swt_widgets_Text(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- makeCleanEnvironment(false); // use multi-line by default
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Clean up the environment for a new test.
- *
- * @param single true if the new text widget should be single-line.
- */
-private void makeCleanEnvironment(boolean single) {
-// this method must be private or protected so the auto-gen tool keeps it
- if ( text != null ) text.dispose();
-
- if ( single == true )
- text = new Text(shell, SWT.SINGLE);
- else
- text = new Text(shell, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- setWidget(text);
- delimiterString = Text.DELIMITER;
-}
-protected void setWidget(Widget w) {
- text = (Text)w;
- super.setWidget(w);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- text = new Text(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.SINGLE, SWT.MULTI, SWT.MULTI | SWT.V_SCROLL, SWT.MULTI | SWT.H_SCROLL, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL,
- SWT.WRAP};
- for (int i = 0; i < cases.length; i++)
- text = new Text(shell, cases[i]);
-}
-
-public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() {
- warnUnimpl("Test test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener not written");
-}
-
-public void test_appendLjava_lang_String(){
- try {
- text.append(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("45");
- assertEquals("012345", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234567", text.getText());
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("4" + delimiterString+ "5");
- assertEquals("01234" + delimiterString +"5", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234" + delimiterString+"567", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.append(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("45");
- assertEquals("012345", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234567", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("4" + delimiterString+"5");
- assertEquals("01234" + delimiterString+"5", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234" + delimiterString+"567", text.getText());
-}
-
-public void test_clearSelection(){
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_copy(){
- text.copy();
-
- text.selectAll();
- text.copy();
- assertEquals("", text.getSelectionText());
-
- text.setText("00000");
- text.selectAll();
- text.copy();
- text.setSelection(2);
- assertEquals("", text.getSelectionText());
-
- text.setText("");
- text.paste();
- assertEquals("00000", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.copy();
-
- text.selectAll();
- text.copy();
- assertEquals("", text.getSelectionText());
-
- text.setText("00000");
- text.selectAll();
- text.copy();
- text.setSelection(2);
- assertEquals("", text.getSelectionText());
-
- text.setText("");
- text.paste();
- assertEquals("00000", text.getText());
-}
-
-public void test_cut(){
- text.cut();
- text.setText("01234567890");
- text.setSelection(2, 5);
- text.cut();
- assertEquals("01567890", text.getText());
-
- text.selectAll();
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.cut();
-
- text.setText("01234567890");
- text.setSelection(2, 5);
- text.cut();
- assertEquals("01567890", text.getText());
-
- text.selectAll();
- text.cut();
- assertEquals("", text.getText());
-}
-
-public void test_getCaretLineNumber() {
- warnUnimpl("Test test_getCaretLineNumber not written");
-}
-
-public void test_getCaretLocation() {
- warnUnimpl("Test test_getCaretLocation not written");
-}
-
-public void test_getCaretPosition() {
- warnUnimpl("Test test_getCaretPosition not written");
-}
-
-public void test_getCharCount(){
- assertEquals(0, text.getCharCount());
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
-
- text.setText("012345" + delimiterString+"67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
-
- text.setText("");
- assertEquals(0, text.getCharCount());
-
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
-
- //
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
-
- text.setText("012345" + delimiterString+"67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
-
- text.setText("");
- assertEquals(0, text.getCharCount());
-
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(0, text.getCharCount());
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
- if (fCheckBogusTestCases) {
- text.setText("012345"+ delimiterString + "67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
- }
- text.setText("");
- assertEquals(0, text.getCharCount());
- if (!SwtJunit.isAIX) {
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
- }
-}
-
-public void test_getDoubleClickEnabled(){
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-
- // this method tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-}
-
-public void test_getEchoChar(){
- text.setEchoChar('a');
- assertEquals('a', text.getEchoChar());
-}
-
-public void test_getEditable() {
- warnUnimpl("Test test_getEditable not written");
-}
-
-public void test_getLineCount(){
- assertEquals(1, text.getLineCount());
- text.append("dddasd" + delimiterString);
- assertEquals(2, text.getLineCount());
- text.append("ddasdasdasdasd" + delimiterString);
- assertEquals(3, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(1, text.getLineCount());
- text.append("dddasd" + delimiterString);
- assertEquals(1, text.getLineCount());
- text.append("ddasdasdasdasd" + delimiterString);
- assertEquals(1, text.getLineCount());
-}
-
-public void test_getLineDelimiter() {
- warnUnimpl("Test test_getLineDelimiter not written");
-}
-
-public void test_getLineHeight() {
- warnUnimpl("Test test_getLineHeight not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionCount() {
- warnUnimpl("Test test_getSelectionCount not written");
-}
-
-public void test_getSelectionText(){
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.setSelection(3, 7);
- assertEquals("3456", text.getSelectionText());
-
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
-}
-
-public void test_getTabs() {
- warnUnimpl("Test test_getTabs not written");
-}
-
-public void test_getText(){
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.setText("");
- assertEquals("", text.getText());
- String string = "012345" + delimiterString + "67890";
- text.setText(string);
- assertEquals(string, text.getText());
-}
-
-public void test_getTextII(){
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("345", text.getText(3, 5));
- // these tests should not cause a null pointer exception, checks not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- text.setText("");
- assertEquals("", text.getText(3, 5));
- text.setText("01234567890");
- assertEquals(":d:", text.getText(3, 100));
- text.setText("01234567890");
- assertEquals("34", text.getText(5, 3));
- }
-}
-
-public void test_getTextLimit() {
- warnUnimpl("Test test_getTextLimit not written");
-}
-
-public void test_getTopIndex(){
- assertEquals(0, text.getTopIndex());
- text.setText("01234567890");
- assertEquals(0, text.getTopIndex());
- text.append(delimiterString +"01234567890");
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(1);
- assertEquals(1, text.getTopIndex());
- text.setTopIndex(17);
- assertEquals(1, text.getTopIndex());
-}
-
-public void test_getTopPixel() {
- warnUnimpl("Test test_getTopPixel not written");
-}
-
-public void test_insertLjava_lang_String(){
- try {
- text.insert(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- assertEquals("", text.getText());
- text.insert("");
- assertEquals("", text.getText());
- text.insert("fred");
- assertEquals("fred", text.getText());
- text.setSelection(2);
- text.insert("helmut");
- assertEquals("frhelmuted", text.getText());
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(1, text.getLineCount());
- text.insert(delimiterString);
- assertEquals(2, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.insert(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.insert("");
- assertEquals("", text.getText());
- text.insert("fred");
- assertEquals("fred", text.getText());
- text.setSelection(2);
- text.insert("helmut");
- assertEquals("frhelmuted", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(1, text.getLineCount());
- text.insert(Text.DELIMITER);
- assertEquals(1, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.insert(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_paste(){
- text.setText("01234567890");
- text.setSelection(2, 4);
- assertEquals("01234567890", text.getText());
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("2301234567890", text.getText());
- text.copy();
- text.setSelection(3);
- text.paste();
- assertEquals("230231234567890", text.getText());
-
- text.setText("0" + delimiterString + "1");
- text.selectAll();
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(2, 4);
- assertEquals("01234567890", text.getText());
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("2301234567890", text.getText());
- text.copy();
- text.setSelection(3);
- text.paste();
- assertEquals("230231234567890", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("0" + delimiterString + "1");
- text.selectAll();
- text.copy();
- text.setSelection(0);
- text.paste();
-
- if (fCheckSWTPolicy)
- assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText());
-}
-
-public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() {
- warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() {
- warnUnimpl("Test test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener not written");
-}
-
-public void test_selectAll(){
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- text.setText("01234" + delimiterString+"567890");
- assertEquals("01234" + delimiterString+"567890", text.getText());
- text.selectAll();
- assertEquals("01234" + delimiterString+"567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- if (fCheckBogusTestCases) {
- text.setText("01234" + delimiterString+"567890");
- assertEquals("01234" + delimiterString+"567890", text.getText());
- text.selectAll();
- assertEquals("01234" + delimiterString+"567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
- }
-}
-
-public void test_setDoubleClickEnabledZ(){
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-}
-
-public void test_setEchoCharC(){
- for (int i=0; i<128; i++){
- text.setEchoChar((char) i);
- assertEquals((char)i, text.getEchoChar());
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setEchoChar('a');
- assertEquals('a', text.getEchoChar());
-
- text.setEchoChar((char) 0);
- assertEquals((char)0, text.getEchoChar());
-
- text.setEchoChar('\n');
- assertEquals('\n', text.getEchoChar());
-
- for (int i=0; i<128; i++){
- text.setEchoChar((char) i);
- assertEquals((char)i, text.getEchoChar());
- }
-}
-
-public void test_setEditableZ() {
- warnUnimpl("Test test_setEditableZ not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written");
-}
-
-public void test_setSelectionI() {
- warnUnimpl("Test test_setSelectionI not written");
-}
-
-public void test_setSelectionII(){
- text.setText("01234567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9, text.getSelectionCount());
-
- text.setText("0123" + delimiterString +"4567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9 + delimiterString.length(), text.getSelectionCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9, text.getSelectionCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("0123"+ delimiterString+"4567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- if (fCheckBogusTestCases) {
- text.setSelection(2, 100);
- assertEquals(9 +delimiterString.length(), text.getSelectionCount());
- }
-}
-
-public void test_setRedrawZ(){
- text.setRedraw(false);
- text.setRedraw(true);
-}
-
-public void test_setSelectionLorg_eclipse_swt_graphics_Point(){
- text.setText("dsdsdasdslaasdas");
- try {
- text.setSelection((Point) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("01234567890");
- text.setSelection(new Point(2, 2));
- assertEquals(new Point(2, 2), text.getSelection());
-
- text.setSelection(new Point(3, 2));
- assertEquals(new Point(2, 3), text.getSelection());
-
- text.setSelection(new Point(3, 100));
- assertEquals(new Point(3, 11), text.getSelection());
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(new Point(4, 4), text.getSelection());
-
- text.setSelection(100);
- assertEquals(new Point(11, 11), text.getSelection());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("dsdsdasdslaasdas");
- try {
- text.setSelection((Point) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
-
- text.setSelection(new Point(2, 2));
- assertEquals(new Point(2, 2), text.getSelection());
-
- text.setSelection(new Point(3, 2));
- assertEquals(new Point(2, 3), text.getSelection());
-
- text.setSelection(new Point(3, 100));
- assertEquals(new Point(3, 11), text.getSelection());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(new Point(4, 4), text.getSelection());
-
- text.setSelection(100);
- assertEquals(new Point(11, 11), text.getSelection());
-}
-
-public void test_setTabsI(){
- if (SwtJunit.isMotif) {
- for (int i = 0; i < 200; i++) {
- text.setTabs(i);
- assertEquals(8, text.getTabs());
- }
- } else {
- for (int i = 0; i < 200; i++) {
- text.setTabs(i);
- assertEquals(i, text.getTabs());
- }
- }
-}
-
-public void test_setTextLjava_lang_String(){
- try {
- text.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("");
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.setText("");
- assertEquals("", text.getText());
- if (fCheckBogusTestCases) {
- text.setText("012345" + delimiterString+ "67890");
- assertEquals("012345" + delimiterString +"67890", text.getText());
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("345", text.getText(3, 5));
- // these tests should not cause a null pointer exception, checks not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- text.setText("");
- assertEquals("", text.getText(3, 5));
- text.setText("01234567890");
- assertEquals("34567890", text.getText(3, 100));
- text.setText("01234567890");
- assertEquals("34", text.getText(5, 3));
- }
-}
-
-public void test_setTextLimitI() {
- warnUnimpl("Test test_setTextLimitI not written");
-}
-
-public void test_setTopIndexI(){
- int number = 100;
- for (int i = 0; i < number; i++) {
- text.append("01234\n");
- }
- for (int i = 1; i <= number; i++) {
- text.setTopIndex(i);
- assertEquals(i, text.getTopIndex());
- }
-
- text.setTopIndex(number+5);
- assertEquals(number, text.getTopIndex());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(0, text.getTopIndex());
- text.setText("01234567890");
- assertEquals(0, text.getTopIndex());
- text.append(Text.DELIMITER +"01234567890");
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(1);
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(17);
- assertEquals(0, text.getTopIndex());
-
- text.setText("");
- for (int i = 0; i < number; i++) {
- text.append("01234" + Text.DELIMITER);
- }
- for (int i = 0; i < number; i++) {
- text.setTopIndex(i);
- assertEquals(0, text.getTopIndex());
- }
-}
-
-public void test_showSelection(){
- text.showSelection();
-
- text.selectAll();
- text.showSelection();
-
- text.setText("00000");
- text.selectAll();
- text.showSelection();
- text.clearSelection();
- text.showSelection();
-
- // this method tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.showSelection();
-
- text.selectAll();
- text.showSelection();
-
-
- text.setText("00000");
- text.selectAll();
- text.showSelection();
-
- text.clearSelection();
- text.showSelection();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Text((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener");
- methodNames.addElement("test_appendLjava_lang_String");
- methodNames.addElement("test_clearSelection");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_copy");
- methodNames.addElement("test_cut");
- methodNames.addElement("test_getCaretLineNumber");
- methodNames.addElement("test_getCaretLocation");
- methodNames.addElement("test_getCaretPosition");
- methodNames.addElement("test_getCharCount");
- methodNames.addElement("test_getDoubleClickEnabled");
- methodNames.addElement("test_getEchoChar");
- methodNames.addElement("test_getEditable");
- methodNames.addElement("test_getLineCount");
- methodNames.addElement("test_getLineDelimiter");
- methodNames.addElement("test_getLineHeight");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_getSelectionText");
- methodNames.addElement("test_getTabs");
- methodNames.addElement("test_getText");
- methodNames.addElement("test_getTextII");
- methodNames.addElement("test_getTextLimit");
- methodNames.addElement("test_getTopIndex");
- methodNames.addElement("test_getTopPixel");
- methodNames.addElement("test_insertLjava_lang_String");
- methodNames.addElement("test_paste");
- methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setDoubleClickEnabledZ");
- methodNames.addElement("test_setEchoCharC");
- methodNames.addElement("test_setEditableZ");
- methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font");
- methodNames.addElement("test_setSelectionI");
- methodNames.addElement("test_setSelectionII");
- methodNames.addElement("test_setRedrawZ");
- methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_setTabsI");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setTextLimitI");
- methodNames.addElement("test_setTopIndexI");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener();
- else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String();
- else if (getName().equals("test_clearSelection")) test_clearSelection();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_copy")) test_copy();
- else if (getName().equals("test_cut")) test_cut();
- else if (getName().equals("test_getCaretLineNumber")) test_getCaretLineNumber();
- else if (getName().equals("test_getCaretLocation")) test_getCaretLocation();
- else if (getName().equals("test_getCaretPosition")) test_getCaretPosition();
- else if (getName().equals("test_getCharCount")) test_getCharCount();
- else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled();
- else if (getName().equals("test_getEchoChar")) test_getEchoChar();
- else if (getName().equals("test_getEditable")) test_getEditable();
- else if (getName().equals("test_getLineCount")) test_getLineCount();
- else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter();
- else if (getName().equals("test_getLineHeight")) test_getLineHeight();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_getSelectionText")) test_getSelectionText();
- else if (getName().equals("test_getTabs")) test_getTabs();
- else if (getName().equals("test_getText")) test_getText();
- else if (getName().equals("test_getTextII")) test_getTextII();
- else if (getName().equals("test_getTextLimit")) test_getTextLimit();
- else if (getName().equals("test_getTopIndex")) test_getTopIndex();
- else if (getName().equals("test_getTopPixel")) test_getTopPixel();
- else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String();
- else if (getName().equals("test_paste")) test_paste();
- else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ();
- else if (getName().equals("test_setEchoCharC")) test_setEchoCharC();
- else if (getName().equals("test_setEditableZ")) test_setEditableZ();
- else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else if (getName().equals("test_setSelectionII")) test_setSelectionII();
- else if (getName().equals("test_setRedrawZ")) test_setRedrawZ();
- else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_setTabsI")) test_setTabsI();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setTextLimitI")) test_setTextLimitI();
- else if (getName().equals("test_setTopIndexI")) test_setTopIndexI();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java
deleted file mode 100644
index 59d513273f..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ToolBar
- *
- * @see org.eclipse.swt.widgets.ToolBar
- */
-public class Test_org_eclipse_swt_widgets_ToolBar extends Test_org_eclipse_swt_widgets_Composite {
-
-protected ToolBar toolBar;
-
-public Test_org_eclipse_swt_widgets_ToolBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- toolBar = new ToolBar(shell, 0);
- setWidget(toolBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- if (fCheckSwtNullExceptions) {
- ToolBar newToolBar;
- try {
- newToolBar = new ToolBar(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_computeTrimIIII() {
- warnUnimpl("Test test_computeTrimIIII not written");
-}
-
-public void test_getItemI(){
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:", toolBar.getItem(i)==items[i]);
- }
-
- toolBar = new ToolBar(shell, 0);
- number = 5;
- items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- try {
- toolBar.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_getItemLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_getItemCount(){
- int number = 10;
- ToolItem ti;
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, toolBar.getItemCount()==i);
- ti = new ToolItem(toolBar, 0);
- }
-}
-
-public void test_getItems(){
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertEquals(items, toolBar.getItems());
-
- toolBar.getItems()[0].dispose();
- assertEquals(new ToolItem[]{items[1], items[2], items[3], items[4]}, toolBar.getItems());
-
- toolBar.getItems()[3].dispose();
- assertEquals(new ToolItem[]{items[1], items[2], items[3]}, toolBar.getItems());
-
- toolBar.getItems()[1].dispose();
- assertEquals(new ToolItem[]{items[1], items[3]}, toolBar.getItems());
-}
-
-public void test_getRowCount(){
- toolBar = new ToolBar(shell, SWT.WRAP);
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertTrue(":a:" + toolBar.getRowCount(), toolBar.getRowCount()==number); //???? because of Size(0, 0)
-
- toolBar = new ToolBar(shell, 0);
- number = 5;
- items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertTrue(":a:", toolBar.getRowCount()==1);
-}
-
-public void test_indexOfLorg_eclipse_swt_widgets_ToolItem(){
- int number = 10;
- ToolItem[] tis = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, toolBar.indexOf(tis[i])==i);
- }
-
- number = 10;
- tis = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- try {
- toolBar.indexOf(null);
- fail("No exception thrown for toolItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_setFocus() {
- warnUnimpl("Test test_setFocus not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ToolBar((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_computeTrimIIII");
- methodNames.addElement("test_getItemI");
- methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getRowCount");
- methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_ToolItem");
- methodNames.addElement("test_setFocus");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII();
- else if (getName().equals("test_getItemI")) test_getItemI();
- else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getRowCount")) test_getRowCount();
- else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_ToolItem")) test_indexOfLorg_eclipse_swt_widgets_ToolItem();
- else if (getName().equals("test_setFocus")) test_setFocus();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
deleted file mode 100644
index 9dd0cd1c84..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ToolItem
- *
- * @see org.eclipse.swt.widgets.ToolItem
- */
-public class Test_org_eclipse_swt_widgets_ToolItem extends Test_org_eclipse_swt_widgets_Item {
-
-ToolBar toolBar;
-ToolItem toolItem;
-
-public Test_org_eclipse_swt_widgets_ToolItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- toolBar = new ToolBar(shell, 0);
- toolItem = new ToolItem(toolBar, 0);
- setWidget(toolItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarI(){
- if (fCheckSwtNullExceptions) {
- try {
- ToolItem tItem = new ToolItem(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarII() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ToolBarII not written");
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getControl() {
- warnUnimpl("Test test_getControl not written");
-}
-
-public void test_getDisabledImage() {
- warnUnimpl("Test test_getDisabledImage not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-public void test_getHotImage() {
- warnUnimpl("Test test_getHotImage not written");
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getSelection(){
- // Test for method boolean org.eclipse.swt.widgets.ToolItem.getSelection()
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_5_getSelection not written");
-}
-
-public void test_getToolTipText(){
- toolItem.setToolTipText("fred");
- assertTrue(":a: ", toolItem.getToolTipText().equals("fred"));
- toolItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt");
- assertTrue(":a: ", toolItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"));
-}
-
-public void test_getWidth() {
- warnUnimpl("Test test_getWidth not written");
-}
-
-public void test_isEnabled(){
- // Test for method boolean org.eclipse.swt.widgets.ToolItem.isEnabled()
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_7_isEnabled not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setControlLorg_eclipse_swt_widgets_Control() {
- warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written");
-}
-
-public void test_setEnabledZ(){
- // Test for method void org.eclipse.swt.widgets.ToolItem.setEnabled(boolean)
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_8_setEnabled not written");
-}
-
-public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setHotImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setHotImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setSelectionZ() {
- warnUnimpl("Test test_setSelectionZ not written");
-}
-
-public void test_setTextLjava_lang_String() {
- warnUnimpl("Test test_setTextLjava_lang_String not written");
-}
-
-public void test_setToolTipTextLjava_lang_String() {
- warnUnimpl("Test test_setToolTipTextLjava_lang_String not written");
-}
-
-public void test_setWidthI() {
- warnUnimpl("Test test_setWidthI not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ToolItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getControl");
- methodNames.addElement("test_getDisabledImage");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getEnabled");
- methodNames.addElement("test_getHotImage");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getToolTipText");
- methodNames.addElement("test_getWidth");
- methodNames.addElement("test_isEnabled");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control");
- methodNames.addElement("test_setEnabledZ");
- methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setHotImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setSelectionZ");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addElement("test_setToolTipTextLjava_lang_String");
- methodNames.addElement("test_setWidthI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarII();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getControl")) test_getControl();
- else if (getName().equals("test_getDisabledImage")) test_getDisabledImage();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getEnabled")) test_getEnabled();
- else if (getName().equals("test_getHotImage")) test_getHotImage();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getToolTipText")) test_getToolTipText();
- else if (getName().equals("test_getWidth")) test_getWidth();
- else if (getName().equals("test_isEnabled")) test_isEnabled();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control();
- else if (getName().equals("test_setEnabledZ")) test_setEnabledZ();
- else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setHotImageLorg_eclipse_swt_graphics_Image")) test_setHotImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setSelectionZ")) test_setSelectionZ();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String();
- else if (getName().equals("test_setWidthI")) test_setWidthI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java
deleted file mode 100644
index 140fad7b1c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Tracker
- *
- * @see org.eclipse.swt.widgets.Tracker
- */
-public class Test_org_eclipse_swt_widgets_Tracker extends Test_org_eclipse_swt_widgets_Widget {
-
- Tracker tracker;
-
-public Test_org_eclipse_swt_widgets_Tracker(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- tracker = new Tracker(shell, 0);
- setWidget(tracker);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written");
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_DisplayI not written");
-}
-
-public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() {
- warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written");
-}
-
-public void test_close() {
- warnUnimpl("Test test_close not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getRectangles() {
- warnUnimpl("Test test_getRectangles not written");
-}
-
-public void test_getStippled() {
- warnUnimpl("Test test_getStippled not written");
-}
-
-public void test_open() {
- warnUnimpl("Test test_open not written");
-}
-
-public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() {
- warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written");
-}
-
-public void test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle() {
- warnUnimpl("Test test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle not written");
-}
-
-public void test_setStippledZ() {
- warnUnimpl("Test test_setStippledZ not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Tracker((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI");
- methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_close");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getRectangles");
- methodNames.addElement("test_getStippled");
- methodNames.addElement("test_open");
- methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener");
- methodNames.addElement("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle");
- methodNames.addElement("test_setStippledZ");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI();
- else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_close")) test_close();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getRectangles")) test_getRectangles();
- else if (getName().equals("test_getStippled")) test_getStippled();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener();
- else if (getName().equals("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle")) test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle();
- else if (getName().equals("test_setStippledZ")) test_setStippledZ();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
deleted file mode 100644
index a39087315e..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
+++ /dev/null
@@ -1,507 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Tree
- *
- * @see org.eclipse.swt.widgets.Tree
- */
-public class Test_org_eclipse_swt_widgets_Tree extends Test_org_eclipse_swt_widgets_Composite {
-
-public Tree tree;
-
-public Test_org_eclipse_swt_widgets_Tree(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- tree = new Tree(shell, SWT.MULTI);
- setWidget(tree);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Clean up the environment for a new test.
- *
- * @param single true if the new tree should be a single-selection one,
- * otherwise use multi-selection.
- */
-private void makeCleanEnvironment(boolean single) {
-// this method must be private or protected so the auto-gen tool keeps it
- tree.dispose();
- tree = new Tree(shell, single?SWT.SINGLE:SWT.MULTI);
- setWidget(tree);
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- tree = new Tree(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.BORDER};
- for (int i = 0; i < cases.length; i++)
- tree = new Tree(shell, cases[i]);
-
- cases = new int[]{0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- }
- assertEquals(cases[j], tree.getItemCount());
- tree.removeAll();
- }
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() {
- warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_deselectAll() {
- int number = 15;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.setSelection(new TreeItem[] {items[2], items[4], items[5], items[10]});
-
- assertEquals(4, tree.getSelectionCount());
-
- tree.deselectAll();
- assertEquals(0, tree.getSelectionCount());
-
- tree.selectAll();
- assertEquals(number, tree.getSelectionCount());
-
- tree.deselectAll();
- assertEquals(0, tree.getSelectionCount());
-}
-
-public void test_getItemLorg_eclipse_swt_graphics_Point() {
- warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
-}
-
-public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
-}
-
-public void test_getItemHeight() {
- assertTrue(":a: Item height is 0", tree.getItemHeight() > 0);
- new TreeItem(tree, 0);
- assertTrue(":b: Item height is 0", tree.getItemHeight() > 0);
-}
-
-public void test_getItems(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- }
- assertEquals(cases[j], tree.getItems().length);
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
- }
-
- makeCleanEnvironment(false);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- ti.setText(String.valueOf(i));
- }
- TreeItem[] items = tree.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals(String.valueOf(i), items[i].getText());
- }
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
- }
-}
-
-public void test_getParentItem() {
- assertNull(tree.getParentItem());
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSelectionCount(){
- makeCleanEnvironment(true); // use single-selection tree.
-
- int number = 15;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[2], items[number-1], items[10]});
- assertEquals(1, tree.getSelectionCount());
-
- tree.setSelection(items);
- assertEquals(1, tree.getSelectionCount());
-}
-
-public void test_removeAll() {
- tree.removeAll();
-
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() {
- warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written");
-}
-
-public void test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ() {
- warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ not written");
-}
-
-public void test_selectAll(){
- int number = 5;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.selectAll();
- assertEquals(number, tree.getSelectionCount());
-
- makeCleanEnvironment(true); // single-selection tree
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.selectAll();
- assertEquals(0, tree.getSelectionCount());
-}
-
-public void test_setRedrawZ() {
- warnUnimpl("Test test_setRedrawZ not written");
-}
-
-public void test_setSelection$Lorg_eclipse_swt_widgets_TreeItem(){
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- TreeItem[] itemsToBeSelected = {items[5], items[16], items[19]};
- tree.setSelection(itemsToBeSelected);
- TreeItem[] selItems = tree.getSelection();
- int selLength = selItems.length;
- if (fCheckMultiSelectTree) {
- assertTrue(":len:" + String.valueOf(selLength), selLength != itemsToBeSelected.length);
- for (int i = 0; i < selLength; i++)
- if (selItems[i] == itemsToBeSelected[i])
- fail();
- }
- tree.setSelection(tree.getItems());
- assertEquals(":b:", items, tree.getItems());
- tree.setSelection(new TreeItem[] {});
- if (fCheckMultiSelectTree)
- assertEquals(":c:", new TreeItem[] {}, tree.getItems());
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- tree.removeAll();
-
- makeCleanEnvironment(false);
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(0, tree.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[]{});
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[0], items[3], items[2]});
- assertEquals(":b:", new TreeItem[]{items[0], items[2], items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[3], items[2], items[1]});
- assertEquals(":c:", new TreeItem[]{items[1], items[2], items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[1], items[4], items[0]});
- assertEquals(":d:", new TreeItem[]{items[0], items[1], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[0], items[4], items[0]});
- assertEquals(":e:", new TreeItem[]{items[0], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[2], items[3], items[4]});
- assertEquals(":f:", new TreeItem[]{items[2], items[3], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4]});
- assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection());
-
- makeCleanEnvironment(false);
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[] {items[0]});
- assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[3]});
- assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[4]});
- assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[2]});
- assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[1]});
- assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection());
-
- makeCleanEnvironment(true); // single-selection tree
-
- number = 15;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(":a:", new TreeItem[] {}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[10], items[number-1], items[2]});
- assertEquals(":b:", new TreeItem[] {items[10]}, tree.getSelection());
-
- tree.setSelection(items);
- assertEquals(":c:", new TreeItem[] {items[0]}, tree.getSelection());
-
- makeCleanEnvironment(true); //single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(0, tree.getSelectionCount());
-
- makeCleanEnvironment(true); // single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[]{});
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[0], items[3], items[2]});
- assertEquals(":b:", new TreeItem[]{items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[3], items[2], items[1]});
- assertEquals(":c:", new TreeItem[]{items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[1], items[4], items[0]});
- assertEquals(":d:", new TreeItem[]{items[1]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[0], items[4], items[0]});
- assertEquals(":e:", new TreeItem[]{items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[2], items[3], items[4]});
- assertEquals(":f:", new TreeItem[]{items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4]});
- assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection());
-
- makeCleanEnvironment(true); //single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[] {items[0]});
- assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[3]});
- assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[4]});
- assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[2]});
- assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[1]});
- assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection());
-}
-
-public void test_showItemLorg_eclipse_swt_widgets_TreeItem(){
- try {
- tree.showItem(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- for(int i=0; i<number; i++)
- tree.showItem(items[i]);
-
- tree.removeAll();
-
- makeCleanEnvironment(false);
- //showing somebody else's items
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
-
- Tree tree2 = new Tree(shell, 0);
- TreeItem[] items2 = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items2[i] = new TreeItem(tree2, 0);
- };
-
- for(int i=0; i<number; i++)
- tree.showItem(items2[i]);
-
- tree.removeAll();
-}
-
-public void test_showSelection() {
- TreeItem item;
-
- tree.showSelection();
- item = new TreeItem(tree, 0);
- tree.setSelection(new TreeItem[]{item});
- tree.showSelection();
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Tree((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_deselectAll");
- methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItemHeight");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getParentItem");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_getSelectionCount");
- methodNames.addElement("test_removeAll");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener");
- methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ");
- methodNames.addElement("test_selectAll");
- methodNames.addElement("test_setRedrawZ");
- methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem");
- methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TreeItem");
- methodNames.addElement("test_showSelection");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_deselectAll")) test_deselectAll();
- else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItemHeight")) test_getItemHeight();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getParentItem")) test_getParentItem();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_getSelectionCount")) test_getSelectionCount();
- else if (getName().equals("test_removeAll")) test_removeAll();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener();
- else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ")) test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ();
- else if (getName().equals("test_selectAll")) test_selectAll();
- else if (getName().equals("test_setRedrawZ")) test_setRedrawZ();
- else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem")) test_setSelection$Lorg_eclipse_swt_widgets_TreeItem();
- else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TreeItem")) test_showItemLorg_eclipse_swt_widgets_TreeItem();
- else if (getName().equals("test_showSelection")) test_showSelection();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
deleted file mode 100644
index f40ff45a9a..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TreeItem
- *
- * @see org.eclipse.swt.widgets.TreeItem
- */
-public class Test_org_eclipse_swt_widgets_TreeItem extends Test_org_eclipse_swt_widgets_Item {
-
-TreeItem treeItem;
-Tree tree;
-
-public Test_org_eclipse_swt_widgets_TreeItem(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- tree = new Tree(shell, 0);
- treeItem = new TreeItem(tree, 0);
- setWidget(treeItem);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TreeI(){
- if (fCheckSwtNullExceptions) {
- try {
- TreeItem tItem = new TreeItem((TreeItem)null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- for (int i=0; i<10; i++) {
- new TreeItem(tree, 0);
- }
- assertEquals(11, tree.getItemCount());
- new TreeItem(tree, 0, 5);
- assertEquals(12, tree.getItemCount());
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TreeII(){
- try {
- new TreeItem(tree, 0, 5);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemI(){
- for (int i = 0; i < 10; i++) {
- new TreeItem(treeItem, 0);
- }
- assertEquals(10, treeItem.getItemCount());
- new TreeItem(treeItem, 0, 5);
- assertEquals(1, tree.getItemCount());
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemII(){
- if (fCheckOutOfRangeBehaviour) {
- try {
- new TreeItem(treeItem, 0, 5);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(1, tree.getItemCount());
- }
-}
-
-public void test_checkSubclass() {
- warnUnimpl("Test test_checkSubclass not written");
-}
-
-public void test_getBounds() {
- warnUnimpl("Test test_getBounds not written");
-}
-
-public void test_getChecked(){
- Tree newTree = new Tree(shell, SWT.CHECK);
- TreeItem tItem = new TreeItem(newTree,0);
- assertEquals(false, tItem.getChecked());
- tItem.setChecked(true);
- assertTrue(tItem.getChecked());
- tItem.setChecked(false);
- assertEquals(false, tItem.getChecked());
-}
-
-public void test_getDisplay() {
- assertEquals(tree.getDisplay(), treeItem.getDisplay());
-}
-
-public void test_getExpanded(){
- assertEquals(false, treeItem.getExpanded());
- // there must be at least one subitem before you can set the treeitem expanded
- new TreeItem(treeItem, 0);
- treeItem.setExpanded(true);
- assertTrue(treeItem.getExpanded());
- treeItem.setExpanded(false);
- assertEquals(false, treeItem.getExpanded());
-}
-
-public void test_getGrayed() {
- warnUnimpl("Test test_getGrayed not written");
-}
-
-public void test_getItemCount(){
- for (int i = 0; i < 10; i++) {
- assertEquals(i, treeItem.getItemCount());
- new TreeItem(treeItem, 0);
- }
- assertTrue("b: ", treeItem.getItemCount() == 10);
-}
-
-public void test_getItems(){
- if (fCheckBogusTestCases) {
- int[] cases = {2, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- }
- assertEquals(cases[j], tree.getItems().length);
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
- }
- }
-}
-
-public void test_getParent(){
- assertEquals(tree, treeItem.getParent());
-}
-
-public void test_getParentItem(){
- TreeItem tItem = new TreeItem(treeItem, SWT.NULL);
- assertEquals(treeItem, tItem.getParentItem());
-}
-
-public void test_setCheckedZ(){
- assertEquals(false, treeItem.getChecked());
-
- treeItem.setChecked(true);
- assertEquals(false, treeItem.getChecked());
-
- Tree t = new Tree(shell, SWT.CHECK);
- TreeItem ti = new TreeItem(t, SWT.NULL);
- ti.setChecked(true);
- assertTrue(ti.getChecked());
-
- ti.setChecked(false);
- assertEquals(false, ti.getChecked());
- t.dispose();
-}
-
-public void test_setExpandedZ(){
- assertEquals(false, treeItem.getExpanded());
-
- // there must be at least one subitem before you can set the treeitem expanded
- treeItem.setExpanded(true);
- assertEquals(false, treeItem.getExpanded());
-
-
- new TreeItem(treeItem, SWT.NULL);
- treeItem.setExpanded(true);
- assertTrue(treeItem.getExpanded());
- treeItem.setExpanded(false);
- assertEquals(false, treeItem.getExpanded());
-
- TreeItem ti = new TreeItem(treeItem, SWT.NULL);
- ti.setExpanded(true);
- treeItem.setExpanded(false);
- assertEquals(false, ti.getExpanded());
-}
-
-public void test_setGrayedZ() {
- warnUnimpl("Test test_setGrayedZ not written");
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-public void test_setTextLjava_lang_String(){
- try {
- treeItem.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TreeItem((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeII");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII");
- methodNames.addElement("test_checkSubclass");
- methodNames.addElement("test_getBounds");
- methodNames.addElement("test_getChecked");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getExpanded");
- methodNames.addElement("test_getGrayed");
- methodNames.addElement("test_getItemCount");
- methodNames.addElement("test_getItems");
- methodNames.addElement("test_getParent");
- methodNames.addElement("test_getParentItem");
- methodNames.addElement("test_setCheckedZ");
- methodNames.addElement("test_setExpandedZ");
- methodNames.addElement("test_setGrayedZ");
- methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image");
- methodNames.addElement("test_setTextLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeI")) test_ConstructorLorg_eclipse_swt_widgets_TreeI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeII")) test_ConstructorLorg_eclipse_swt_widgets_TreeII();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemI();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemII();
- else if (getName().equals("test_checkSubclass")) test_checkSubclass();
- else if (getName().equals("test_getBounds")) test_getBounds();
- else if (getName().equals("test_getChecked")) test_getChecked();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getExpanded")) test_getExpanded();
- else if (getName().equals("test_getGrayed")) test_getGrayed();
- else if (getName().equals("test_getItemCount")) test_getItemCount();
- else if (getName().equals("test_getItems")) test_getItems();
- else if (getName().equals("test_getParent")) test_getParent();
- else if (getName().equals("test_getParentItem")) test_getParentItem();
- else if (getName().equals("test_setCheckedZ")) test_setCheckedZ();
- else if (getName().equals("test_setExpandedZ")) test_setExpandedZ();
- else if (getName().equals("test_setGrayedZ")) test_setGrayedZ();
- else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image();
- else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java
deleted file mode 100644
index 68b6643853..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.TypedListener
- *
- * @see org.eclipse.swt.widgets.TypedListener
- */
-public class Test_org_eclipse_swt_widgets_TypedListener extends SwtTestCase {
-
-public Test_org_eclipse_swt_widgets_TypedListener(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
-}
-
-protected void tearDown() {
-}
-
-public void test_ConstructorLorg_eclipse_swt_internal_SWTEventListener() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_internal_SWTEventListener not written");
-}
-
-public void test_getEventListener() {
- warnUnimpl("Test test_getEventListener not written");
-}
-
-public void test_handleEventLorg_eclipse_swt_widgets_Event() {
- warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written");
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_TypedListener((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener");
- methodNames.addElement("test_getEventListener");
- methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener")) test_ConstructorLorg_eclipse_swt_internal_SWTEventListener();
- else if (getName().equals("test_getEventListener")) test_getEventListener();
- else if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java
deleted file mode 100644
index 2e16082614..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Widget
- *
- * @see org.eclipse.swt.widgets.Widget
- */
-public class Test_org_eclipse_swt_widgets_Widget extends SwtTestCase {
-
-public Shell shell;
-private Widget widget;
-
-public Test_org_eclipse_swt_widgets_Widget(String name) {
- super(name);
-}
-
-protected void setUp() {
- shell = new Shell();
-}
-
-protected void tearDown() {
- if (widget != null) {
- assertEquals(false, widget.isDisposed());
- }
- assertEquals(false, shell.isDisposed());
- shell.dispose();
- if (widget != null) {
- assertTrue(widget.isDisposed());
- }
- assertTrue(shell.isDisposed());
-}
-
-protected void setWidget(Widget w) {
- widget = w;
-}
-
-public void test_addListenerILorg_eclipse_swt_widgets_Listener() {
- try {
- widget.addListener(SWT.Dispose, null);
- fail("No exception thrown for listener == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- Listener listener = new Listener() {
- public void handleEvent(Event e) {
- }
- };
- widget.addListener(SWT.Dispose, listener);
- widget.removeListener(SWT.Dispose, listener);
-}
-
-public void test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener() {
- DisposeListener listener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- }
- };
- widget.addDisposeListener(listener);
- widget.removeDisposeListener(listener);
-}
-
-public void test_dispose() {
- // tested in tearDown
-}
-
-public void test_getData() {
- // tested in test_setDataLjava_lang_Object
-}
-
-public void test_getDataLjava_lang_String() {
- // tested in test_setDataLjava_lang_StringLjava_lang_Object
-}
-
-public void test_getDisplay() {
- assertEquals(widget.getDisplay(), widget.getDisplay());
-}
-
-public void test_getStyle() {
- // this test should be overridden by leaf subclasses
-}
-
-public void test_isDisposed() {
- assertEquals(false, widget.isDisposed());
-}
-
-public void test_notifyListenersILorg_eclipse_swt_widgets_Event() {
- // this method is further tested in many of the addTypedListener tests
- try {
- widget.notifyListeners(0, null);
- fail("No exception thrown for event == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- widget.notifyListeners(SWT.Paint, new Event());
-}
-
-public void test_removeListenerILorg_eclipse_swt_widgets_Listener() {
- // this method is further tested by all of the removeTypedListener tests
- try {
- widget.removeListener(SWT.Paint, null);
- fail("No exception thrown for listener == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- widget.removeListener(SWT.Paint, new Listener() {
- public void handleEvent(Event e) {
- }
- });
-
- Listener listener = new Listener() {
- public void handleEvent(Event e) {
- }
- };
- widget.addListener(SWT.Paint, listener);
- widget.removeListener(SWT.Paint, listener);
-}
-
-public void test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener() {
- // tested in test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener
-}
-
-public void test_setDataLjava_lang_Object(){
- widget.setData(widget);
- assertEquals(widget, widget.getData());
-
- widget.setData(null);
- assertNull(widget.getData());
-}
-
-public void test_setDataLjava_lang_StringLjava_lang_Object() {
- widget.setData("the widget", widget);
- assertEquals(widget, widget.getData("the widget"));
-
- widget.setData("the widget", null);
- assertNull(widget.getData("the widget"));
-}
-
-public void test_toString() {
- assertNotNull(widget.toString());
- assertEquals(false, widget.toString().equals(""));
-}
-
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_addListenerILorg_eclipse_swt_widgets_Listener");
- methodNames.addElement("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener");
- methodNames.addElement("test_dispose");
- methodNames.addElement("test_getData");
- methodNames.addElement("test_getDataLjava_lang_String");
- methodNames.addElement("test_getDisplay");
- methodNames.addElement("test_getStyle");
- methodNames.addElement("test_isDisposed");
- methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event");
- methodNames.addElement("test_removeListenerILorg_eclipse_swt_widgets_Listener");
- methodNames.addElement("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener");
- methodNames.addElement("test_setDataLjava_lang_Object");
- methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object");
- methodNames.addElement("test_toString");
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_addListenerILorg_eclipse_swt_widgets_Listener")) test_addListenerILorg_eclipse_swt_widgets_Listener();
- else if (getName().equals("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener();
- else if (getName().equals("test_dispose")) test_dispose();
- else if (getName().equals("test_getData")) test_getData();
- else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String();
- else if (getName().equals("test_getDisplay")) test_getDisplay();
- else if (getName().equals("test_getStyle")) test_getStyle();
- else if (getName().equals("test_isDisposed")) test_isDisposed();
- else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event();
- else if (getName().equals("test_removeListenerILorg_eclipse_swt_widgets_Listener")) test_removeListenerILorg_eclipse_swt_widgets_Listener();
- else if (getName().equals("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener();
- else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object();
- else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object();
- else if (getName().equals("test_toString")) test_toString();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp
deleted file mode 100644
index 72f236079c..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif
deleted file mode 100644
index b9ad0367f8..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp
deleted file mode 100644
index 574351fbd4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp
deleted file mode 100644
index 6ba1214663..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp
deleted file mode 100644
index d61c9f4ce1..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp
deleted file mode 100644
index 89e0cc31c4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp
deleted file mode 100644
index ec7d509e74..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/about.html b/tests/org.eclipse.swt.tests/about.html
deleted file mode 100644
index 9a15e5ca28..0000000000
--- a/tests/org.eclipse.swt.tests/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>About</title>
-<style type="text/css">
-p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
-pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
-h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
-code { font-family: "Courier New", Courier, mono; font-size: 10pt}
-sup { font-family: arial,helvetica,geneva; font-size: 10px}
-h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
-li { font-family: arial, helvetica, geneva; font-size: 10pt}
-h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
-body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
-</style>
-</head>
-<body>
-<body lang=EN-US link=blue vlink=purple>
-<table border=0 cellspacing=5 cellpadding=2 width="100%" >
- <tr>
- <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in</font></b></td>
- </tr>
- <tr>
- <td>
-<p>1st November, 2001</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
-<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, &quot;Program&quot; will mean the plug-in.</p>
-</td></tr></table>
-</body>
-</html> \ No newline at end of file
diff --git a/tests/org.eclipse.swt.tests/build.properties b/tests/org.eclipse.swt.tests/build.properties
deleted file mode 100644
index 2374e5ab05..0000000000
--- a/tests/org.eclipse.swt.tests/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.swttests.jar=JUnit Tests/
-
-bin.includes=*.jar,plugin.xml,test.xml,about.html \ No newline at end of file
diff --git a/tests/org.eclipse.swt.tests/plugin.xml b/tests/org.eclipse.swt.tests/plugin.xml
deleted file mode 100644
index eac4eb2618..0000000000
--- a/tests/org.eclipse.swt.tests/plugin.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.tests"
- name="Tests"
- version="0.0.1">
-
-<requires>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<runtime>
- <library name="swttests.jar">
- <export name="*"/>
- </library>
- </runtime>
-</plugin>
diff --git a/tests/org.eclipse.swt.tests/test.xml b/tests/org.eclipse.swt.tests/test.xml
deleted file mode 100644
index 8f6a53f428..0000000000
--- a/tests/org.eclipse.swt.tests/test.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- This file is intended to be more tightly coupled with the -->
- <!-- org.eclipse.ui plugin, for testing. -->
-
- <!-- The property ${eclipse-home} should be passed into this script -->
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="eclipse-home" value="${basedir}/../.."/>
- <property name="plugin-name" value="org.eclipse.swt.tests"/>
- <property name="library-file" value="${eclipse-home}/fragments/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property name="data" value="${eclipse-home}/swt_sniff_folder"/>
- <delete dir="${location1}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${data}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.swt.tests.junit.AllTests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after the tests -->
- <!-- have been run. You can use this to delete temporary files that are created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen after all -->
- <!-- the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>

Back to the top